Marc Santhoff wrote:
>> yes, I have done that, but this just changes  the anchortype, I have
>> notr found a way to tell it which paragraph the anchor should connect
>> to. :-(
> 
> Wouldn't it be the paragraph where the cursor is you're working with? If
> not, can you try to use a ViewCursor instead of a TextCursor, does it
> make a difference?
> 
> Some API programmer with writer knowledge could help here, I'm only an
> API user ...

I think I have4 found a sollution now, atleast partly an sollution.


Sub Test()
  Dim button, shape, drawpage
  Dim oSize as New com.sun.star.awt.Size
  Dim oPosition as New com.sun.star.awt.Point
  Dim oCursor
  button = createUnoService( "com.sun.star.form.component.CommandButton" )
  shape = ThisComponent.createInstance("com.sun.star.drawing.ControlShape")

  oSize.Height = 1000
  oSize.Width  = 3000
  oPosition.X  = 0
  oPosition.Y  = 0
  oCursor = createCursorAtBookmark("bookmark")
  shape.setSize(oSize)
  shape.setPosition(oPosition)
  shape.LayerName = "Controls"
  shape.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH
  shape.setControl(button)
  shape.attach(oCursor)
End Sub

by using the shape.attache function instead of
ThjisComponent.DrawPage.add I got it where it were supposed to be,
however there seems to be a small graphical bug..

in this example, the bookmark is on page2 of the writer document.
when I run the macro above and then switches over to the document, I can
see the button on the first page, at the top left corner. however when I
move to page2 I will see the button where it is supposed to be, and
moving back to page1 again the button there is gone. so it seems to be a
display bug

or do I need to do some sort of refresh of the page..


-- 
Christian Andersson - [EMAIL PROTECTED]

Configuration and Collaboration for OpenOffice.org
Open Framework Systems AS http://www.ofs.no

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to