Apache OpenOffice (AOO) Bugzilla – Issue 53001
Loss text while grouping shapes with OOoBasic
Last modified: 2013-02-24 21:09:00 UTC
If you group shapes, who are created and filled with text by OpenOfficeBasic-Makro, save, close and reopen the doc so the text of the last shape has been removed. But before closing the doc the text was there!!! I have tested it on few Windows-Systems, XP down to ME. My code bases on some scripts of DannyB. I think i could say that they are so simple and so often used that there is no bug in this macros. Step by Step: 1. Open a new Draw Document 2. Excute "Main" 3. Switch to Draw 4. Select the 2 shapes 5. right-click the selection and choose the entry Group 6. immediately save the draw document 7. close the doc and open it '------------ START OF CODE ------------------- Sub Main Dim oShape1 As Object Dim oShape2 As Object Dim oShape3 As Object oShape1 = MakeTextShape(ThisComponent, MakePoint_Utils(7*1000, 5*1000), MakeSize_Utils(5*1000, 1*1000)) ThisComponent.getCurrentController().getCurrentPage().add( oShape1 ) oShape1.setString("Foo") oShape2 = MakeTextShape(ThisComponent, MakePoint_Utils(7*1000, 7*1000), MakeSize_Utils(5*1000, 1*1000)) ThisComponent.getCurrentController().getCurrentPage().add( oShape2 ) oShape2.setString("Foo2") oShape3 = MakeTextShape(ThisComponent, MakePoint_Utils(7*1000, 9*1000), MakeSize_Utils(5*1000, 1*1000)) ThisComponent.getCurrentController().getCurrentPage().add( oShape3 ) ThisComponent.getCurrentController().getCurrentPage().remove( oShape3 ) End Sub Function MakeTextShape( oDoc As Object,_ Optional position As com.sun.star.awt.Point,_ Optional size As com.sun.star.awt.Size ) As com.sun.star.drawing.TextShape Dim oShape As Object oShape = oDoc.createInstance( "com.sun.star.drawing.TextShape" ) If Not IsMissing( position ) Then oShape.Position = position EndIf If Not IsMissing( size ) Then oShape.Size = size EndIf MakeTextShape = oShape End Function Function MakePoint_Utils(ByVal x As Long, ByVal y As Long) As com.sun.star.awt.Point Dim oPoint As Object oPoint = CreateUnoStruct("com.sun.star.awt.Point") oPoint.X = x oPoint.Y = y MakePoint_Utils = oPoint End Function Function MakeSize_Utils(ByVal width As Long, ByVal height As Long) As com.sun.star.awt.Size Dim oSize As Object oSize = CreateUnoStruct("com.sun.star.awt.Size") oSize.Width = width oSize.Height = height MakeSize_Utils = oSize End Function '------------ END OF CODE -------------------
Sorry, the code includes my workaround. to reproduce the bug comment out the last 3 lines of Sub Main '------------ START OF CODE ------------------- Sub Main Dim oShape1 As Object Dim oShape2 As Object Dim oShape3 As Object oShape1 = MakeTextShape(ThisComponent, MakePoint_Utils(7*1000, 5*1000), MakeSize_Utils(5*1000, 1*1000)) ThisComponent.getCurrentController().getCurrentPage().add( oShape1 ) oShape1.setString("Foo") oShape2 = MakeTextShape(ThisComponent, MakePoint_Utils(7*1000, 7*1000), MakeSize_Utils(5*1000, 1*1000)) ThisComponent.getCurrentController().getCurrentPage().add( oShape2 ) oShape2.setString("Foo2") 'oShape3 = MakeTextShape(ThisComponent, MakePoint_Utils(7*1000, 9*1000), MakeSize_Utils(5*1000, 1*1000)) 'ThisComponent.getCurrentController().getCurrentPage().add( oShape3 ) 'ThisComponent.getCurrentController().getCurrentPage().remove( oShape3 ) End Sub '------------ END OF CODE -------------------
arkas, can you please provide an sample document containing all the relevant macros?
Created attachment 28564 [details] Relevant Macros
Hi, i have added the relevant macro-code. notice, you have to do a few steps "by hand" descriped in the first comment of this issue. Jan
I could reproduce the behaviour with OOo1.1.4 but not with src680_m122, so I think it has been fixed by now => setting it to WORKFORME
closing