It would probably suffice to traverse while moving the display cursor with you until you leave the page. The thing is that ONLY the display cursor can act as a page cursor if I remember correctly (I discuss this in my book, but probably not the free macro document).
Aditya Pandey wrote:
Hi
I have been trying to write a simple page traverser since half a day unsuccessfully. Here is little code:
bool blnJump = xPageCursor->jumpToNextPage(); printf ("Jump Page: %d\n", blnJump);
Reference <XTextViewCursor> xViewCursor2 (xPageCursor, UNO_QUERY);
if (xViewCursor2 == NULL) {
ShowMessageBox( xToolkit, m_ooxFrame,
OUString( RTL_CONSTASCII_USTRINGPARAM( "Test App" )),
OUString( RTL_CONSTASCII_USTRINGPARAM( "
xViewCursor not found" )) );
return false;
}
Reference <XTextRange> xTextRange2 (xViewCursor2, UNO_QUERY);
Reference <XTextCursor> xModelCursor2 = xDocumentText->
createTextCursorByRange(xTextRange2);
Reference <XParagraphCursor> xPrCursor2 (xModelCursor2, UNO_QUERY);
if (xPrCursor2 == NULL) {
ShowMessageBox( xToolkit, m_ooxFrame,
OUString( RTL_CONSTASCII_USTRINGPARAM( "Test App" )),
OUString( RTL_CONSTASCII_USTRINGPARAM( "xPrCursor is not found" )) );
return false;
}
int paraCount = 0;
while (xPrCursor2->gotoNextParagraph(false) ) // && xPrCursor->getText() != xPrCursor2->getText())
{
paraCount ++;
}
printf ("%d\n", paraCount );
This code has a flaw --> It gives all paras starting from the current page till last page of document.
While I want all paras of "current page". Could somebody please help with this? It doesnt appear to be as easy as I thought it to be.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm Free Info: http://www.pitonyak.org/oo.php
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
