Steffen ,

thats pretty simple: I use some basic code to find out if the Cursor in a Table, Frame or Document

   oViewCursor = oDocument.getCurrentController().getViewCursor()
   If Not isEmpty(oViewCursor.TextTable) then  ' Cursor is in een Tabel
   sFrameofTabel = "TABEL"
   ' rather complex to find the cell dimensions
  otext = oViewCursor.text
 elseIf Not isEmpty(oViewCursor.TextFrame) then  ' Cursor is in een Frame
    sFrameofTabel = "FRAME"
    inFrameofTabel = true
     RasterofCursor = False
      iFotW = oViewCursor.TextFrame.width
      iFotH = oViewCursor.TextFrame.height
     otext = oViewCursor.text
        endif
Hope it helps
Hi guys,

I'm currently stuck with the insertion of pictures into a XTextFrame. My goal is to insert a GraphicObject at a cursor position. If the cursor resides inside an XTextFrame, the size of the XTextFrame should be queried and the image should be scaled accordingly to fit the size of the XTextFrame. This behaviour can be done with "Insert -> Graphic" in the OO GUI while the cursor resides in a XTextFrame.

What I can do by now is:
- Embed a GraphicObject into an XTextContent. The method can of course also insert into the XTextFrame if the cursor was placed there.
- Get the XTextFrame via the XTextFramesSupplier
- Query the XServiceInfo for supported Services. ( XTextCursor, XTextRange and XTextViewCursor seem to not support com.sun.star.text.XTextFrame , so what should i use here?)

What I cannot do by now is:
- Getting the "surrounding content" of the XTextCursor, therefor I'm also not able to determine if the cursor is currently inside a XTextFrame. I need to find out if I'm inside a XTextFrame to query for the size of the XTextFrame to be able to resize the picture.

Am I on the right track with the XServiceInfo or do I have to use a different approach? And if there is an easier solution to embed GraphicObjects into a XTextFrame( and resize it accordingly), please tell me.

Regards,
Steffen Boersig

Offtopic: I solved my previous problem , with executing the same code several times, by upgrading to OO 3.2.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to