Hi all
in java
i want to import a graphic in a draw document
seems to work but the only problem is that it is 100 height & width, no
matter the original size
how can i have my image imported with the correct proportion & size so
that i can select it (to export it)
here is a snippet of where i am
(thx to cloph :) )
could someone put me in the right direction ?
thanks in advance
Laurent
'------------------
XMultiServiceFactory xFactory =
(XMultiServiceFactory)UnoRuntime.queryInterface(
XMultiServiceFactory.class, document);
Object image =
xFactory.createInstance("com.sun.star.drawing.GraphicObjectShape");
XShape graphicShape = (XShape)
UnoRuntime.queryInterface(XShape.class, image);
XNameContainer xBitmapContainer = null;
xBitmapContainer = (XNameContainer) UnoRuntime.queryInterface(
XNameContainer.class, xFactory.createInstance(
"com.sun.star.drawing.BitmapTable"));
xBitmapContainer.insertByName("someID", inputUrl);
String internalURL = AnyConverter.toString(xBitmapContainer
.getByName("someID"));
XPropertySet props =
(XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, graphicShape);
props.setPropertyValue("GraphicURL",internalURL );
// add it to the document first drawpage
XDrawPagesSupplier xDrawPagesSupplier =
(XDrawPagesSupplier)UnoRuntime.queryInterface(
XDrawPagesSupplier.class,
document);
XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
Object objDrawPage = xDrawPages.getByIndex(0);
XDrawPage drawpage = (XDrawPage)
UnoRuntime.queryInterface(XDrawPage.class, objDrawPage);
drawpage.add(graphicShape);
refreshDocument(document);
Object objShape = drawpage.getByIndex(0);
XShape finalShape = (XShape)
UnoRuntime.queryInterface(XShape.class, objShape);
Size currentSize = finalShape.getSize();
// width & height = 100
--
Laurent Godard <[EMAIL PROTECTED]> - Ingénierie OpenOffice.org -
http://www.indesko.com
Nuxeo Enterprise Content Management >> http://www.nuxeo.com -
http://www.nuxeo.org
Livre "Programmation OpenOffice.org", Eyrolles 2004-2006
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]