

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
3 messages in org.openoffice.fr.prog[prog] Problème pour insérer une form...| From | Sent On | Attachments |
|---|---|---|
| Christophe Devalland | May 27, 2009 1:19 am | |
| Bernard Marcelly | May 27, 2009 5:02 am | |
| Christophe Devalland | May 27, 2009 6:13 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [prog] Problème pour insérer une forme qui vient d'être effacée | Actions... |
|---|---|---|
| From: | Christophe Devalland (chri...@ac-rouen.fr) | |
| Date: | May 27, 2009 1:19:08 am | |
| List: | org.openoffice.fr.prog | |
Bonjour Salut,
j'ai un soucis pour insérer une forme (shape) dans un document writer juste après l'avoir effacée. voici le code qui bloque :
monDocument=ThisComponent monTexte=monDocument.Text monCurseur=monTexte.createTextCursor oligne1=MakeLineShape(monDocument,MakePoint(0,0),MakeSize(500,500)) oLigne1.LineColor = RGB( 0, 0, 0 ) oLigne1.anchorType=com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH oLigne1.Name="Temp" monTexte.insertTextContent(monCurseur,oligne1,False) lesFormes=monDocument.DrawPage i=lesFormes.Count-1 ff=lesFormes(i) lesFormes.remove(ff) monTexte.insertTextContent(monCurseur,oligne1,False)
c'est la dernière ligne qui me dit : "object already inserted" alors qu'elle a bien disparu de l'écran. Je voudrais éviter de créer plusieurs formes d'où mon besoin de réinsérer la même. Comment faire pour réinsérer la même forme sans qu'il y ait d'erreur ? (vous allez me dire : c'est idiot il suffit de ne pas l'effacer ! Sauf que je veux repérer son changement de position lorsque le texte change de place et que OOo ne met pas bien à jour cette position quand la macro tourne en continue, alors qu'en l'effaçant et en l'insérant à nouveau, si. C'est tordu mais c'est pour le moment le seul moyen que j'ai trouvé pour déterminer la hauteur d'une ligne dans un tableau. cf mon message d'hier.) merci de votre aide.
voici les fonctions appelées par ce programme :
'---------- ' Create and return a LineShape object, ' optionally with its position and size initialized. ' Function MakeLineShape( oDoc As Object, Optional position As com.sun.star.awt.Point, Optional size As com.sun.star.awt.Size ) As com.sun.star.drawing.LineShape oShape = oDoc.createInstance( "com.sun.star.drawing.
LineShape" ) If Not IsMissing( position ) Then oShape.Position = position EndIf If Not IsMissing( size ) Then oShape.Size = size EndIf MakeLineShape = oShape End Function
'---------- ' Easy sugar coated way to create and initialize a new Point struct. ' Function MakePoint( ByVal x As Long, ByVal y As Long ) As com.sun.star.awt.Point oPoint = createUnoStruct( "com.sun.star.awt.Point" ) oPoint.X = x oPoint.Y = y MakePoint = oPoint End Function
'---------- ' Easy sugar coated way to create and initialize a new Size struct. ' Function MakeSize( ByVal width As Long, ByVal height As Long ) As com.sun.star.awt.Size oSize = createUnoStruct( "com.sun.star.awt.Size" ) oSize.Width = width oSize.Height = height MakeSize = oSize End Function
-- Christophe Devalland







