I'm attempting to examine the contents of a TextNode that is contained in a cell and determine if any parts have EnterData fields. I'm using a ChildElemIter derived from an EditElemHandleR to examine the Text and TextNodes in the cell. When a TextNode is found, I'm calling mdlElmdscr_operation() to process the contents of the TextNode. Problem is the "operation" finds many more items (text, lines, shapes, etc) that just the text strings in the text node. It even goes past the NEXT TextNode in the file !!!! Is there a "better" (ie "proper") way to do this?
extern "C" DLLEXPORT int scanTextNode
(
MSElement *elP, //=> element to act upon
void *params, //=> passed from original call
int operation, //=> why you were called
UInt32 offset, //=> offset from header
MSElementDescr *elemDscrP //=> element descr
)
{
printf("scanTextNode[%d] type=%d, ID=%I64d\n",gElementCount,mdlElement_getType(elP),mdlElement_getID(elP) );
int rc = 0;
gElementCount++;
return rc;
}
for (ChildElemIter child (eeh, EXPOSECHILDREN_FindText ); child.IsValid(); child=child.ToNext())
{
DPoint3d origin = { 0 };
if ( child.GetElementType() == TEXT_ELM )
{
int numEDfields=0;
mdlText_extract(&origin, NULL, &numEDfields, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (MSElement*) child.GetElementCP () );
if ( numEDfields )
printf("\tbuildTextReplacementList::Text, dataFields:%d\n",numEDfields);
}
else if ( child.GetElementType() == TEXT_NODE_ELM )
{
int nodeNumber=0;
mdlTextNode_extract(NULL, NULL, NULL, NULL, NULL, &nodeNumber, (MSElement*)child.GetElementCP(), NULL );
printf("\tTEXT NODE, number:%d, ID=%I64d\n", nodeNumber, mdlElement_getID(child.GetElementCP()) );
gElementCount=0;
mdlElmdscr_operation( (MSElementDescr*)child.GetElemDescrCP(), scanTextNode, NULL, /*ELMD_ELEMENT*/ ELMD_ALL_ONCE );
printf("\tEnd of TEXT NODE, gElementCount=%d\n", gElementCount);
}
}