Apache OpenOffice (AOO) Bugzilla – Issue 59199
replaceByName in com.sun.star.drawing.BitmapTable seems to be broken
Last modified: 2013-02-24 21:07:37 UTC
I have the following function that worked fine in OO 1.1.5, but not anymore in OO 2.0: Function LoadGraphicIntoDocument( oDoc As Object, cUrl As String, cInternalName As String ) As String ' Get the BitmapTable from this drawing document. ' It is a service that maintains a list of bitmaps that are internal ' to the document. Dim oBitmaps as Object Dim cNewURL as String oBitmaps = oDoc.createInstance( "com.sun.star.drawing.BitmapTable" ) If oBitmaps.hasByName (cInternalName) Then oBitmaps.replaceByName (cInternalName, cUrl) Else ' Add an external graphic to the BitmapTable of this document. oBitmaps.insertByName( cInternalName, cUrl ) End If ' Now ask for it back. ' What we get back is an different Url that points to a graphic ' which is inside this document, and remains with the document. cNewUrl = oBitmaps.getByName( cInternalName ) LoadGraphicIntoDocument = cNewUrl End Function It throws a NoSuchElementException when asking back the name with the getbyname function. And it seems to do that only once it was running the insertbyName section. Obviously the InsertByName function does not work properly. The replacebyName does not throw a runtime error, but it does not seem to do anything either. I did not do thorough tests on that point, but the InsertByName is definitely not functioning anymore.
I just tried again, and found out that there was just a mistake in the path entry I gave, and the only difference in OO 2.0 seems to be the way this error is handled. Otherwise, everything is running OK. Sorry for the mistake on my part.
resolved as reporter stated
closed