To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=85105
------- Additional comments from [email protected] Thu Jun 18 22:08:53 +0000 2009 ------- I also experienced problems with the property "ActualSize" of a TextGraphicObject. And I am sure that the bug it is not just due to the asynchronous loading of the image in the background. The proposed solution A does not work for me. My basic macro looped forever if I did not trigger by some other means the update of the ActualSize property. I have found that watching the contents of the TextGraphic object in the OOo Basic IDE updates the field ActualSize. Also using XRay (http://ooomacros.org/dev.php#101416) to inspect the object updates the ActualSize field. I then identified the line in the XRay macro which triggers the update. The field is updated when the property "IsPixelContour" is read: oTextGraphic.getPropertyValue("IsPixelContour") I am now using this in my routine to update an existing graphic or create a new graphic. The code is the following: Function ImportBitmapIntoWriter(sFile As String, Optional oTextGraphic) As Object ' Imports a bitmap into Writer Dim oDoc As Object Dim oBitmaps As Object Dim sNewUrl As String Dim oCursor As Object Dim oText As Object Const INCH = 2540 oDoc = ThisComponent ' Load the image into the internal bitmap table oBitmaps = oDoc.createInstance("com.sun.star.drawing.BitmapTable") oBitmaps.insertByName( "OOoLilyPond", ConvertToURL(sFile) ) sNewURL = oBitmaps.getByName( "OOoLilyPond" ) ' Create a new TextGraphic Object, if needed If IsMissing(oTextGraphic) Then oCursor=oDoc.getCurrentController().getViewCursor() oText = oCursor.getText() oTextGraphic = oDoc.createInstance("com.sun.star.text.GraphicObject") oTextGraphic.GraphicURL = sNewURL oTextGraphic.AnchorType = com.sun.star.text.TextContentAnchorType.AS_CHARACTER oText.insertTextContent( oCursor, oTextGraphic, False ) End If ' remove the Bitmap from the table ' (otherwise the Bitmaps of deleted Objects will still be referenced and saved) oBitmaps.removeByName( "OOoLilyPond" ) ' this triggers the updating of the property "ActualSize" ' see http://www.openoffice.org/issues/show_bug.cgi?id=85105 oTextGraphic.getPropertyValue("IsPixelContour") ' set the original graphic size oTextGraphic.setSize(oTextGraphic.ActualSize) ' oTextGraphic ' select the object oDoc.getCurrentController().select(oTextGraphic) 'return the TextGraphic object ImportBitmapIntoWriter = oTextGraphic End Function If reading "IsPixelContour" triggers the update of "ActualSize". It should be implemented that reading "ActualSize" also triggers the same action. Or alternatively if there is really a time delay due to the asynchronous loading of the image there should be a property "GraphicIsLoaded" and a method "WaitForGraphicLoaded". Samuel --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- 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]
