On 20/04/13 08:21, Rheinländer wrote:
Hi,
I'm trying to find the character after a Formula's anchor. It's anchored
"as character" so I thought this would be easy...
// Create a model cursor at the anchor point
Reference < XTextContent > formula = ...
Reference < XText > xDocumentText = formula->getAnchor()->getText();
Reference < XTextCursor > xModelCursor =
xDocumentText->createTextCursorByRange(formula->getAnchor()->getEnd());
// Get the first paragraph of the cursor's text
Reference< XEnumerationAccess > xEnum(xModelCursor->getText(),
UNO_QUERY_THROW);
guess here it's going wrong: XText from getText() is most likely the
Body text and that enumeration will contain all paragraphs/tables in it.
i think you will have more luck by moving the cursor to the right by 1
with "true" parameter to get a selection and then reading the text (i
don't actually know know if that getAnchor()->getEnd() puts you "before"
or "after" the frame, if it's before you need 2 cursor moves).
anything anchored AS-character is represented by one "dummy character"
in the paragraph text that you can move over with the XTextCursor etc. APIs.
Context
   
 
  Privacy Policy |
  
Impressum (Legal Info) |
  
Copyright information: Unless otherwise specified, all text and images
  on this website are licensed under the
  
Creative Commons Attribution-Share Alike 3.0 License.
  This does not include the source code of LibreOffice, which is
  licensed under the Mozilla Public License (
MPLv2).
  "LibreOffice" and "The Document Foundation" are
  registered trademarks of their corresponding registered owners or are
  in actual use as trademarks in one or more countries. Their respective
  logos and icons are also subject to international copyright laws. Use
  thereof is explained in our 
trademark policy.