summaryrefslogtreecommitdiff
path: root/qadevOOo/runner
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-03-08 09:01:17 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-03-08 12:56:51 +0100
commitdfee7d93b4e863d673c45921f79bb876b5738ea6 (patch)
treed82ed3b540f740ef2aae3cb5f58692bf56a76a1e /qadevOOo/runner
parent8f79f22a8d4b1c2d209c55cd618c24428960088f (diff)
sw: get rid of FN_UNO_GRAPHIC_U_R_L and "GraphicURL" property
Change-Id: I6148016658e5bb46fd4f8765a233a434174791fd Reviewed-on: https://gerrit.libreoffice.org/50922 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'qadevOOo/runner')
-rw-r--r--qadevOOo/runner/util/WriterTools.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/qadevOOo/runner/util/WriterTools.java b/qadevOOo/runner/util/WriterTools.java
index 250ecbf6be45..ad769ca8623a 100644
--- a/qadevOOo/runner/util/WriterTools.java
+++ b/qadevOOo/runner/util/WriterTools.java
@@ -27,13 +27,19 @@ import com.sun.star.drawing.XDrawPageSupplier;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.text.XText;
import com.sun.star.text.XTextContent;
import com.sun.star.text.XTextCursor;
import com.sun.star.text.XTextDocument;
+import com.sun.star.graphic.XGraphic;
+import com.sun.star.graphic.XGraphicProvider;
+import com.sun.star.graphic.GraphicProvider;
+
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
public class WriterTools {
public static XTextDocument createTextDoc(XMultiServiceFactory xMSF) {
@@ -77,13 +83,27 @@ public class WriterTools {
}
public static void insertTextGraphic(XTextDocument aDoc,
- XMultiServiceFactory xMSF, int hpos,
+ XMultiServiceFactory xMSF, XComponentContext xContext, int hpos,
int vpos, int width, int height,
String pic, String name) {
try {
Object oGObject = xMSF.createInstance(
"com.sun.star.text.GraphicObject");
+ XGraphicProvider xGraphicProvider = UnoRuntime.queryInterface(
+ XGraphicProvider.class,
+ xContext.getServiceManager().createInstanceWithContext(
+ "com.sun.star.graphic.GraphicProvider", xContext));
+
+ String fullURL = util.utils.getFullTestURL(pic);
+
+ PropertyValue[] aMediaProps = new PropertyValue[] { new PropertyValue() };
+ aMediaProps[0].Name = "URL";
+ aMediaProps[0].Value = fullURL;
+
+ XGraphic xGraphic = UnoRuntime.queryInterface(XGraphic.class,
+ xGraphicProvider.queryGraphic(aMediaProps));
+
XText the_text = aDoc.getText();
XTextCursor the_cursor = the_text.createTextCursor();
XTextContent the_content = UnoRuntime.queryInterface(
@@ -93,8 +113,7 @@ public class WriterTools {
XPropertySet oProps = UnoRuntime.queryInterface(
XPropertySet.class, oGObject);
- String fullURL = util.utils.getFullTestURL(pic);
- oProps.setPropertyValue("GraphicURL", fullURL);
+ oProps.setPropertyValue("Graphic", xGraphic);
oProps.setPropertyValue("HoriOrientPosition", Integer.valueOf(hpos));
oProps.setPropertyValue("VertOrientPosition", Integer.valueOf(vpos));
oProps.setPropertyValue("Width", Integer.valueOf(width));