summaryrefslogtreecommitdiff
path: root/odk
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-03-12 16:54:05 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-03-13 00:35:32 +0100
commit5b87abe06da35ca3a11628674af23460349b439a (patch)
tree75e026cfcce636fa9f654ccfe821d2fd69c01cde /odk
parentfc4dfdc9f5ee5ae408f0177d2aaa6ad16d28ca05 (diff)
Change ODK example to use Graphic property instead of GraphicURL
Change-Id: I0a8b518a62c35da52008668c6e8cc7d0fd74e1d4 Reviewed-on: https://gerrit.libreoffice.org/51105 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'odk')
-rw-r--r--odk/examples/java/Text/GraphicsInserter.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/odk/examples/java/Text/GraphicsInserter.java b/odk/examples/java/Text/GraphicsInserter.java
index c49d118b69d6..b4b5b49eaa62 100644
--- a/odk/examples/java/Text/GraphicsInserter.java
+++ b/odk/examples/java/Text/GraphicsInserter.java
@@ -99,8 +99,8 @@ public class GraphicsInserter {
Object oGraphic = null;
try {
// Creating the service GraphicObject
- oGraphic =
- xMSFDoc.createInstance("com.sun.star.text.TextGraphicObject");
+ oGraphic =xMSFDoc
+ .createInstance("com.sun.star.text.TextGraphicObject");
}
catch ( Exception exception ) {
System.out.println( "Could not create instance" );
@@ -142,12 +142,26 @@ public class GraphicsInserter {
sUrl.append(sourceFile.getCanonicalPath().replace('\\', '/'));
System.out.println( "insert graphic \"" + sUrl + "\"");
+ com.sun.star.graphic.XGraphicProvider xGraphicProvider =
+ UnoRuntime.queryInterface(com.sun.star.graphic.XGraphicProvider.class,
+ xMCF.createInstanceWithContext("com.sun.star.graphic.GraphicProvider",
+ xContext));
+
+
+ com.sun.star.beans.PropertyValue[] aMediaProps = new com.sun.star.beans.PropertyValue[] { new com.sun.star.beans.PropertyValue() };
+ aMediaProps[0].Name = "URL";
+ aMediaProps[0].Value = sUrl;
+
+ com.sun.star.graphic.XGraphic xGraphic =
+ UnoRuntime.queryInterface(com.sun.star.graphic.XGraphic.class,
+ xGraphicProvider.queryGraphic(aMediaProps));
+
// Setting the anchor type
xPropSet.setPropertyValue("AnchorType",
com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH );
// Setting the graphic url
- xPropSet.setPropertyValue( "GraphicURL", sUrl.toString() );
+ xPropSet.setPropertyValue( "Graphic", xGraphic );
// Setting the horizontal position
xPropSet.setPropertyValue( "HoriOrientPosition",