Apache OpenOffice (AOO) Bugzilla – Issue 77246
Relative glue points are messy after save and reload
Last modified: 2013-02-24 21:07:53 UTC
I made a macro that create a rectangular shape and insert relative glue point in it. After saving and reloading the file, the glue points have changed of place. It seems that before reloading, the coordinates of the glue points are from (0,0) to (10000,10000). After reloading, it seems that the coordinates are from (-5000,-5000) to (5000,5000). So a relative glue point created with (0,0) coordinates will be in the upper left corner (this is normal), but after saving and reloading, it will be in the center :(
It works without problem in the UI. Therefore please attach your macro.
This is not my macro but a simpler one which will create a rectangle shape with a relative glue point with coordonate (0,0) wich is upper-left corner.After saving and reloading the odg document, the gluepoint moved to the centre. Sub Main Dim oDoc As Object Dim oPage As Object Dim Size As New com.sun.star.awt.Size Dim Point As New com.sun.star.awt.Point Dim oRectangleShape As Object Dim oGluePoints As Object Dim oGluePoint As Object 'Retrive Doc and Page oDoc = ThisComponent oPage = oDoc.drawPages(0) 'Create rectangle shape in the center of the page Size.Width = 5000 Size.Height = 3000 Point.x = oPage.Width/2 - Size.Width/2 Point.y = oPage.Height/2 - Size.Height/2 oRectangleShape = oDoc.createInstance( "com.sun.star.drawing.RectangleShape" ) oRectangleShape.Position = Point oRectangleShape.Size = Size oRectangleShape.FillStyle = com.sun.star.drawing.FillStyle.NONE oPage.add(oRectangleShape) 'Create a relative glue point at position (0,0) oGluePoints = oRectangleShape.getGluePoints() Point.x = 0 Point.y = 0 oGluePoint = createUnoStruct( "com.sun.star.drawing.GluePoint2" ) With oGluePoint .IsRelative = True .Position = Point .Escape = com.sun.star.drawing.EscapeDirection.LEFT .IsUserDefined = False End With oGluePoints.insertByIndex( oGluePoints.getCount(), oGluePoint ) End Sub
jsc - sj: can you please check this
I investigated a litle bit: If I create gluepoints with the UI and theirs coordinates varies between (-5000,-5000) and (5000,5000). Like I said if I create de gluepoints in a macro, It is displayed correctly only after a save and a reload. Can I force a refresh of the shape without saving (and overwriting the file)? Unfortunately, this issue blocks my company to switch from a propriatary draw soft to oodraw, but they (my bosses) will wait a little time before paying the lisence fees for next year. So I need a quick fix/workaround.
Confirming with 2.2 on WinXP - as described. Repro steps: 1. run provided macro, display gluepoints with the button on toolbar - gluepoint is at the top left corner. 2. Save, close and reopen file. 3. Display gluepoints - gluepoint is in the middle of rectangle.