<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - sw TextGraphicObject: handle XBitmap for GraphicURL - make it available in Draw and Impress"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=120527#c8">Comment # 8</a>
on <a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - sw TextGraphicObject: handle XBitmap for GraphicURL - make it available in Draw and Impress"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=120527">bug 120527</a>
from <span class="vcard"><a class="email" href="mailto:benbignoise@gmx.de" title="Klaus Blum <benbignoise@gmx.de>"> <span class="fn">Klaus Blum</span></a>
</span></b>
<pre>Okay, now I know what is still missing.
Here is a function for Draw and Impress that hopefully does what you need.
It contains a path to a SVG file that you'd have to adjust to work on your
machine.
I'll attach a LilyPond-generated SVG file, but of course any graphics file
should work.
The following code works fine in 6.0.7.3,
but fails in 6.1.0.3, 6.1.1.2, 6.1.2.1 and 6.1.3.2:
---------------------------------------------------------
Sub SVG_Test
Dim oDrawPage As Object
Dim oBitmaps As Object
Dim sNewUrl
Dim oSize As Object
Dim oShape As Object
Dim oDoc As Object
Dim oDocCtrl As Object
Dim oCrop As new com.sun.star.text.GraphicCrop
oDoc = ThisComponent
oDocCtrl = oDoc.getCurrentController
oBitmaps = oDoc.createInstance("com.sun.star.drawing.BitmapTable")
If oBitmaps.hasByName( "OOoLilyPond" ) Then
oBitmaps.removeByName( "OOoLilyPond" )
End If
oBitmaps.insertByName( "OOoLilyPond",
ConvertToURL("C:\Users\Admin\Desktop\Test.svg") )
' Replace this by a valid path to a graphics file on your machine
sNewURL = oBitmaps.getByName( "OOoLilyPond" )
'Insert the Bitmap
oDrawPage=oDocCtrl.getCurrentPage()
oGraphicShape =
oDoc.createInstance("com.sun.star.drawing.GraphicObjectShape")
oGraphicShape.graphicURL=sNewURL ' This line causes the error.
oDrawPage.add(oGraphicShape)
'Set the correct Size
oSize = createUnoStruct( "com.sun.star.awt.Size" )
oSize.width = oGraphicShape.Graphic.Size100thMM.Width
oSize.height = oGraphicShape.Graphic.Size100thMM.Height
' remove the Bitmap from the table
' (otherwise the Bitmaps of deleted Objects will still be referenced
and saved)
oBitmaps.removeByName( "OOoLilyPond" )
' refresh the view
oDocCtrl.restoreViewData(oDocCtrl.getViewData)
oGraphicShape.setSize(oSize)
' apply size as calculated above
oGraphicShape.setPropertyValue ("GraphicCrop", oCrop) ' overwrite old
Crop settings
End Sub</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>