summaryrefslogtreecommitdiff
path: root/qadevOOo
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
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')
-rw-r--r--qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextGraphicObject.csv2
-rw-r--r--qadevOOo/runner/util/WriterTools.java25
-rw-r--r--qadevOOo/tests/java/mod/_sw/SwXTextDocument.java4
-rw-r--r--qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java28
-rw-r--r--qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java24
5 files changed, 69 insertions, 14 deletions
diff --git a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextGraphicObject.csv b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextGraphicObject.csv
index bf33c49518c5..d487128a2b03 100644
--- a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextGraphicObject.csv
+++ b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextGraphicObject.csv
@@ -7,7 +7,7 @@
"SwXTextGraphicObject";"com::sun::star::text::TextGraphicObject";"HoriMirroredOnEvenPages"
"SwXTextGraphicObject";"com::sun::star::text::TextGraphicObject";"HoriMirroredOnOddPages"
"SwXTextGraphicObject";"com::sun::star::text::TextGraphicObject";"VertMirrored"
-"SwXTextGraphicObject";"com::sun::star::text::TextGraphicObject";"GraphicURL"
+"SwXTextGraphicObject";"com::sun::star::text::TextGraphicObject";"Graphic"
"SwXTextGraphicObject";"com::sun::star::text::TextGraphicObject";"GraphicFilter"
"SwXTextGraphicObject";"com::sun::star::text::TextGraphicObject";"ActualSize"
"SwXTextGraphicObject";"com::sun::star::text::TextGraphicObject";"AdjustLuminance"
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));
diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java b/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java
index 75ffd622d6dd..442d94b2cc05 100644
--- a/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java
+++ b/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java
@@ -153,8 +153,8 @@ public class SwXTextDocument extends TestCase {
SOfficeFactory.insertTextContent(xTextDoc, oTC);
log.println(" adding TextGraphic");
- WriterTools.insertTextGraphic(xTextDoc, oDocMSF, 5200, 4200, 4400,
- 4000, "space-metal.jpg", "SwXTextDocument");
+ WriterTools.insertTextGraphic(xTextDoc, oDocMSF, Param.getComponentContext(),
+ 5200, 4200, 4400, 4000, "space-metal.jpg", "SwXTextDocument");
log.println(" adding EndNote");
diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java
index 695bf61480da..7d2cfcdd19d3 100644
--- a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java
+++ b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java
@@ -26,14 +26,19 @@ import lib.TestParameters;
import util.SOfficeFactory;
import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.PropertyValue;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.text.TextContentAnchorType;
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.XInterface;
+import com.sun.star.uno.XComponentContext;
public class SwXTextGraphicObject extends TestCase {
@@ -124,12 +129,26 @@ public class SwXTextGraphicObject extends TestCase {
the_text.insertTextContent(the_cursor, the_content, true);
log.println("adding graphic");
+
+ XComponentContext xContext = tParam.getComponentContext();
+
+ XGraphicProvider xGraphicProvider = UnoRuntime.queryInterface(XGraphicProvider.class,
+ xContext.getServiceManager().createInstanceWithContext("com.sun.star.graphic.GraphicProvider", xContext));
+
+ String fullURL = util.utils.getFullTestURL("space-metal.jpg");
+
+ PropertyValue[] aMediaProps = new PropertyValue[] { new PropertyValue() };
+ aMediaProps[0].Name = "URL";
+ aMediaProps[0].Value = fullURL;
+
+ XGraphic xGraphic = UnoRuntime.queryInterface(XGraphic.class,
+ xGraphicProvider.queryGraphic(aMediaProps));
+
XPropertySet oProps = UnoRuntime.queryInterface(XPropertySet.class,
oObj);
- String wat = util.utils.getFullTestURL("space-metal.jpg");
- oProps.setPropertyValue("AnchorType",
- TextContentAnchorType.AT_PARAGRAPH);
- oProps.setPropertyValue("GraphicURL", wat);
+
+ oProps.setPropertyValue("AnchorType", TextContentAnchorType.AT_PARAGRAPH);
+ oProps.setPropertyValue("Graphic", xGraphic);
oProps.setPropertyValue("HoriOrientPosition", Integer.valueOf(5500));
oProps.setPropertyValue("VertOrientPosition", Integer.valueOf(4200));
oProps.setPropertyValue("Width", Integer.valueOf(4400));
@@ -167,4 +186,3 @@ public class SwXTextGraphicObject extends TestCase {
} // finish method getTestEnvironment
} // finish class SwXTextGraphicObject
-
diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java
index 7e3a6dbb59cc..87982b31a5ab 100644
--- a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java
+++ b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java
@@ -26,13 +26,18 @@ import lib.TestParameters;
import util.SOfficeFactory;
import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.PropertyValue;
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.text.XTextGraphicObjectsSupplier;
+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.XInterface;
+import com.sun.star.uno.XComponentContext;
public class SwXTextGraphicObjects extends TestCase {
@@ -112,10 +117,24 @@ public class SwXTextGraphicObjects extends TestCase {
the_text.insertTextContent(the_cursor, the_content, true);
log.println("adding graphic");
+
+ XComponentContext xContext = tParam.getComponentContext();
+
+ XGraphicProvider xGraphicProvider = UnoRuntime.queryInterface(XGraphicProvider.class,
+ xContext.getServiceManager().createInstanceWithContext("com.sun.star.graphic.GraphicProvider", xContext));
+
+ String fullURL = util.utils.getFullTestURL("space-metal.jpg");
+
+ PropertyValue[] aMediaProps = new PropertyValue[] { new PropertyValue() };
+ aMediaProps[0].Name = "URL";
+ aMediaProps[0].Value = fullURL;
+
+ XGraphic xGraphic = UnoRuntime.queryInterface(XGraphic.class,
+ xGraphicProvider.queryGraphic(aMediaProps));
+
XPropertySet oProps = UnoRuntime.queryInterface(XPropertySet.class,
oObj);
- String wat = util.utils.getFullTestURL("space-metal.jpg");
- oProps.setPropertyValue("GraphicURL", wat);
+ oProps.setPropertyValue("Graphic", xGraphic);
oProps.setPropertyValue("HoriOrientPosition", Integer.valueOf(5500));
oProps.setPropertyValue("VertOrientPosition", Integer.valueOf(4200));
oProps.setPropertyValue("Width", Integer.valueOf(4400));
@@ -132,4 +151,3 @@ public class SwXTextGraphicObjects extends TestCase {
} // finish method getTestEnvironment
} // finish class SwXTextGraphicObjects
-