Converting C++ Props

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

Is there a easy way to convert properties from C++?

Here is the code I am working with:

PROP rgprop [ipropMax] = {
actnByte, propChp, offsetof(CHP, fBold), // ipropBold
actnByte, propChp, offsetof(CHP, fItalic), // ipropItalic
actnByte, propChp, offsetof(CHP, fUnderline), // ipropUnderline
actnWord, propPap, offsetof(PAP, xaLeft), // ipropLeftInd
actnWord, propPap, offsetof(PAP, xaRight), // ipropRightInd
actnWord, propPap, offsetof(PAP, xaFirst), // ipropFirstInd
actnWord, propSep, offsetof(SEP, cCols), // ipropCols
actnWord, propSep, offsetof(SEP, xaPgn), // ipropPgnX
actnWord, propSep, offsetof(SEP, yaPgn), // ipropPgnY
actnWord, propDop, offsetof(DOP, xaPage), // ipropXaPage
actnWord, propDop, offsetof(DOP, yaPage), // ipropYaPage
actnWord, propDop, offsetof(DOP, xaLeft), // ipropXaLeft
actnWord, propDop, offsetof(DOP, xaRight), // ipropXaRight
actnWord, propDop, offsetof(DOP, yaTop), // ipropYaTop
actnWord, propDop, offsetof(DOP, yaBottom), // ipropYaBottom
actnWord, propDop, offsetof(DOP, pgnStart), // ipropPgnStart
actnByte, propSep, offsetof(SEP, sbk), // ipropSbk
actnByte, propSep, offsetof(SEP, pgnFormat), // ipropPgnFormat
actnByte, propDop, offsetof(DOP, fFacingp), // ipropFacingp
actnByte, propDop, offsetof(DOP, fLandscape), // ipropLandscape
actnByte, propPap, offsetof(PAP, just), // ipropJust
actnSpec, propPap, 0, // ipropPard
actnSpec, propChp, 0, // ipropPlain
actnSpec, propSep, 0, // ipropSectd
};
 
Ken said:
Is there a easy way to convert properties from C++?

Here is the code I am working with:

PROP rgprop [ipropMax] = {
actnByte, propChp, offsetof(CHP, fBold), // ipropBold
actnByte, propChp, offsetof(CHP, fItalic), // ipropItalic
actnByte, propChp, offsetof(CHP, fUnderline), // ipropUnderline
actnWord, propPap, offsetof(PAP, xaLeft), // ipropLeftInd
actnWord, propPap, offsetof(PAP, xaRight), // ipropRightInd
actnWord, propPap, offsetof(PAP, xaFirst), // ipropFirstInd
actnWord, propSep, offsetof(SEP, cCols), // ipropCols
actnWord, propSep, offsetof(SEP, xaPgn), // ipropPgnX
actnWord, propSep, offsetof(SEP, yaPgn), // ipropPgnY
actnWord, propDop, offsetof(DOP, xaPage), // ipropXaPage
actnWord, propDop, offsetof(DOP, yaPage), // ipropYaPage
actnWord, propDop, offsetof(DOP, xaLeft), // ipropXaLeft
actnWord, propDop, offsetof(DOP, xaRight), // ipropXaRight
actnWord, propDop, offsetof(DOP, yaTop), // ipropYaTop
actnWord, propDop, offsetof(DOP, yaBottom), // ipropYaBottom
actnWord, propDop, offsetof(DOP, pgnStart), // ipropPgnStart
actnByte, propSep, offsetof(SEP, sbk), // ipropSbk
actnByte, propSep, offsetof(SEP, pgnFormat), // ipropPgnFormat
actnByte, propDop, offsetof(DOP, fFacingp), // ipropFacingp
actnByte, propDop, offsetof(DOP, fLandscape), // ipropLandscape
actnByte, propPap, offsetof(PAP, just), // ipropJust
actnSpec, propPap, 0, // ipropPard
actnSpec, propChp, 0, // ipropPlain
actnSpec, propSep, 0, // ipropSectd
};

Where is the C++ code coming from? I'm assuming you want to convert this
to VBA? Furthermore, if it's a property, doesn't it imply there is an
associated object you need to convert? Finally, do you really need to
convert the code? Wouldn't it be easier to call the C++ code directly
from VBA?
 
Yes I want to convert the code to VBA. I don't want to call the external
code but use the code to convert the RTF tags to LaTex.

The code comes from Microsofts gc1039 Conversion SDK.

The properties are integers defined elsewhere. I was hoping there was a
easy way to convert the code to VBA without having to implicitily set each
item in the structure, but it does not look like it.


Clifford Bass via AccessMonster.com said:
Hi Ken,

These are not standard C++ items. You will need to tell us what PROP,
ipropMax, actnByte, PropChp, CHP and a whole bunch of other items are that
are there in that array. Somewhere I presume they are #defined, probably in
a header file. Without further information, I can only guess that it is a C
int/long array, which would be an array of type Long in VBA. So it might
convert to:

Dim rgprop(0 to 71) As Long

' Code to initialize the values
rgprop(0) = ???
rgprop(1) = ???
rgprop(2) = ???
' etc.

You could store the values in a table and read them into the array.

Perhaps that helps?

Clifford Bass
Is there a easy way to convert properties from C++?

Here is the code I am working with:

PROP rgprop [ipropMax] = {
actnByte, propChp, offsetof(CHP, fBold), // ipropBold
actnByte, propChp, offsetof(CHP, fItalic), // ipropItalic
actnByte, propChp, offsetof(CHP, fUnderline), // ipropUnderline
actnWord, propPap, offsetof(PAP, xaLeft), // ipropLeftInd
actnWord, propPap, offsetof(PAP, xaRight), // ipropRightInd
actnWord, propPap, offsetof(PAP, xaFirst), // ipropFirstInd
actnWord, propSep, offsetof(SEP, cCols), // ipropCols
actnWord, propSep, offsetof(SEP, xaPgn), // ipropPgnX
actnWord, propSep, offsetof(SEP, yaPgn), // ipropPgnY
actnWord, propDop, offsetof(DOP, xaPage), // ipropXaPage
actnWord, propDop, offsetof(DOP, yaPage), // ipropYaPage
actnWord, propDop, offsetof(DOP, xaLeft), // ipropXaLeft
actnWord, propDop, offsetof(DOP, xaRight), // ipropXaRight
actnWord, propDop, offsetof(DOP, yaTop), // ipropYaTop
actnWord, propDop, offsetof(DOP, yaBottom), // ipropYaBottom
actnWord, propDop, offsetof(DOP, pgnStart), // ipropPgnStart
actnByte, propSep, offsetof(SEP, sbk), // ipropSbk
actnByte, propSep, offsetof(SEP, pgnFormat), // ipropPgnFormat
actnByte, propDop, offsetof(DOP, fFacingp), // ipropFacingp
actnByte, propDop, offsetof(DOP, fLandscape), // ipropLandscape
actnByte, propPap, offsetof(PAP, just), // ipropJust
actnSpec, propPap, 0, // ipropPard
actnSpec, propChp, 0, // ipropPlain
actnSpec, propSep, 0, // ipropSectd
};

--
Message posted via AccessMonster.com


.
 
Just a guess but it might convert to
the User-defined Data Type rgProp.

If you want it to be persistent you
could also try creating Tables for
each of the UDT's CHP, PAP, SEP and
DOP and relate those to Table rgProp.

Public Type CHP
fBold As Byte
fItalic As Byte
fUnderline As Byte
End Type

Public Type PAP
xaLeft As Long
xaRight As Long
xaFirst As Long
just As Byte
End Type

Public Type SEP
cCols As Long
xaPgn As Long
yaPgn As Long
sbk As Byte
pgnFormat As Byte
End Type

Public Type DOP
xaPage As Long
yaPage As Long
xaLeft As Long
xaRight As Long
yaTop As Long
yaBottom As Long
pgnStart As Long
fFacingp As Byte
fLandscape As Byte
End Type

Public Type rgProp
ipropPard As Variant ' Don't know what this is.
ipropPlain As Variant ' Don't know what this is.
ipropSectd As Variant ' Don't know what this is.
propChp As CHP
propPap As PAP
propSep As SEP
propDop As DOP
End Type


Sub TestIt()
Dim MyrgProp As rgProp

With LoadProp(MyrgProp)
Debug.Print .ipropPard
Debug.Print .ipropPlain
Debug.Print .ipropSectd

Debug.Print .propChp.fBold
Debug.Print .propChp.fItalic
Debug.Print .propChp.fUnderline

Debug.Print .propPap.xaLeft
Debug.Print .propPap.xaRight
Debug.Print .propPap.xaFirst
Debug.Print .propPap.just

' And so forth.
End With

End Sub


Public Function LoadProp(ByRef Prop As rgProp) As rgProp

LoadProp.ipropPard = Null
LoadProp.ipropPlain = Null
LoadProp.ipropSectd = Null

LoadProp.propChp.fBold = 1
LoadProp.propChp.fItalic = 0
LoadProp.propChp.fUnderline = 0

LoadProp.propPap.xaLeft = 1234
LoadProp.propPap.xaRight = 5678
LoadProp.propPap.xaFirst = 1
LoadProp.propPap.just = 0

' And so forth.

End Function

--
A nod is as good as a wink to a blind horse.


Ken said:
Yes I want to convert the code to VBA. I don't want to call the external
code but use the code to convert the RTF tags to LaTex.

The code comes from Microsofts gc1039 Conversion SDK.

The properties are integers defined elsewhere. I was hoping there was a
easy way to convert the code to VBA without having to implicitily set each
item in the structure, but it does not look like it.


Clifford Bass via AccessMonster.com said:
Hi Ken,

These are not standard C++ items. You will need to tell us what PROP,
ipropMax, actnByte, PropChp, CHP and a whole bunch of other items are that
are there in that array. Somewhere I presume they are #defined, probably in
a header file. Without further information, I can only guess that it is a C
int/long array, which would be an array of type Long in VBA. So it might
convert to:

Dim rgprop(0 to 71) As Long

' Code to initialize the values
rgprop(0) = ???
rgprop(1) = ???
rgprop(2) = ???
' etc.

You could store the values in a table and read them into the array.

Perhaps that helps?

Clifford Bass
Is there a easy way to convert properties from C++?

Here is the code I am working with:

PROP rgprop [ipropMax] = {
actnByte, propChp, offsetof(CHP, fBold), // ipropBold
actnByte, propChp, offsetof(CHP, fItalic), // ipropItalic
actnByte, propChp, offsetof(CHP, fUnderline), // ipropUnderline
actnWord, propPap, offsetof(PAP, xaLeft), // ipropLeftInd
actnWord, propPap, offsetof(PAP, xaRight), // ipropRightInd
actnWord, propPap, offsetof(PAP, xaFirst), // ipropFirstInd
actnWord, propSep, offsetof(SEP, cCols), // ipropCols
actnWord, propSep, offsetof(SEP, xaPgn), // ipropPgnX
actnWord, propSep, offsetof(SEP, yaPgn), // ipropPgnY
actnWord, propDop, offsetof(DOP, xaPage), // ipropXaPage
actnWord, propDop, offsetof(DOP, yaPage), // ipropYaPage
actnWord, propDop, offsetof(DOP, xaLeft), // ipropXaLeft
actnWord, propDop, offsetof(DOP, xaRight), // ipropXaRight
actnWord, propDop, offsetof(DOP, yaTop), // ipropYaTop
actnWord, propDop, offsetof(DOP, yaBottom), // ipropYaBottom
actnWord, propDop, offsetof(DOP, pgnStart), // ipropPgnStart
actnByte, propSep, offsetof(SEP, sbk), // ipropSbk
actnByte, propSep, offsetof(SEP, pgnFormat), // ipropPgnFormat
actnByte, propDop, offsetof(DOP, fFacingp), // ipropFacingp
actnByte, propDop, offsetof(DOP, fLandscape), // ipropLandscape
actnByte, propPap, offsetof(PAP, just), // ipropJust
actnSpec, propPap, 0, // ipropPard
actnSpec, propChp, 0, // ipropPlain
actnSpec, propSep, 0, // ipropSectd
};

--
Message posted via AccessMonster.com


.
 
Back
Top