Kaydet (Commit) 5b87abe0 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

Change ODK example to use Graphic property instead of GraphicURL

Change-Id: I0a8b518a62c35da52008668c6e8cc7d0fd74e1d4
Reviewed-on: https://gerrit.libreoffice.org/51105Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst fc4dfdc9
...@@ -99,8 +99,8 @@ public class GraphicsInserter { ...@@ -99,8 +99,8 @@ public class GraphicsInserter {
Object oGraphic = null; Object oGraphic = null;
try { try {
// Creating the service GraphicObject // Creating the service GraphicObject
oGraphic = oGraphic =xMSFDoc
xMSFDoc.createInstance("com.sun.star.text.TextGraphicObject"); .createInstance("com.sun.star.text.TextGraphicObject");
} }
catch ( Exception exception ) { catch ( Exception exception ) {
System.out.println( "Could not create instance" ); System.out.println( "Could not create instance" );
...@@ -142,12 +142,26 @@ public class GraphicsInserter { ...@@ -142,12 +142,26 @@ public class GraphicsInserter {
sUrl.append(sourceFile.getCanonicalPath().replace('\\', '/')); sUrl.append(sourceFile.getCanonicalPath().replace('\\', '/'));
System.out.println( "insert graphic \"" + sUrl + "\""); 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 // Setting the anchor type
xPropSet.setPropertyValue("AnchorType", xPropSet.setPropertyValue("AnchorType",
com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH ); com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH );
// Setting the graphic url // Setting the graphic url
xPropSet.setPropertyValue( "GraphicURL", sUrl.toString() ); xPropSet.setPropertyValue( "Graphic", xGraphic );
// Setting the horizontal position // Setting the horizontal position
xPropSet.setPropertyValue( "HoriOrientPosition", xPropSet.setPropertyValue( "HoriOrientPosition",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment