[Libreoffice-commits] core.git: qadevOOo/objdsc qadevOOo/runner qadevOOo/tests sw/inc sw/qa sw/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Thu Mar 8 11:57:17 UTC 2018


 qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextGraphicObject.csv |    2 
 qadevOOo/runner/util/WriterTools.java                                |   25 +
 qadevOOo/tests/java/mod/_sw/SwXTextDocument.java                     |    4 
 qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java                |   28 +-
 qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java               |   24 +
 sw/inc/cmdid.h                                                       |    2 
 sw/inc/unoprnms.hxx                                                  |    1 
 sw/qa/extras/globalfilter/globalfilter.cxx                           |   44 +--
 sw/qa/extras/htmlimport/htmlimport.cxx                               |    8 
 sw/qa/extras/rtfexport/rtfexport2.cxx                                |    6 
 sw/source/core/unocore/unoframe.cxx                                  |  132 +---------
 sw/source/core/unocore/unomap1.cxx                                   |    1 
 sw/source/filter/ww8/docxattributeoutput.cxx                         |   10 
 sw/source/filter/ww8/rtfsdrexport.cxx                                |   18 -
 14 files changed, 121 insertions(+), 184 deletions(-)

New commits:
commit dfee7d93b4e863d673c45921f79bb876b5738ea6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu Mar 8 09:01:17 2018 +0900

    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 at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

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
-
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 2e048f6289a9..16de50113705 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -550,7 +550,7 @@
 #define FN_UNO_IS_PIXEL_CONTOUR             (FN_EXTRA2 + 83)
 #define FN_UNO_ALTERNATIVE_TEXT             (FN_EXTRA2 + 84)
 #define FN_UNO_ACTUAL_SIZE                  (FN_EXTRA2 + 85)
-#define FN_UNO_GRAPHIC_U_R_L                (FN_EXTRA2 + 86)
+// #define free                             (FN_EXTRA2 + 86)
 #define FN_UNO_GRAPHIC_FILTER               (FN_EXTRA2 + 87)
 #define FN_UNO_CELL_NAME                    (FN_EXTRA2 + 88)
 #define FN_INSERT_GLOSSARY                  (FN_EXTRA2 + 89)
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index b0d7f87d6bad..5c446e594c37 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -39,7 +39,6 @@
 #define UNO_NAME_BACK_GRAPHIC "BackGraphic"
 #define UNO_NAME_BACK_GRAPHIC_FILTER "BackGraphicFilter"
 #define UNO_NAME_BACK_GRAPHIC_LOCATION "BackGraphicLocation"
-#define UNO_NAME_GRAPHIC_URL "GraphicURL"
 #define UNO_NAME_GRAPHIC_FILTER "GraphicFilter"
 #define UNO_NAME_GRAPHIC_SIZE "GraphicSize"
 #define UNO_NAME_GRAPHIC_BITMAP "GraphicBitmap"
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index 7c3082aec701..0c4d6612c53a 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -11,6 +11,7 @@
 
 #include <com/sun/star/awt/XBitmap.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/GraphicType.hpp>
 #include <officecfg/Office/Common.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/propertysequence.hxx>
@@ -105,16 +106,13 @@ void Test::testSwappedOutImageExport()
         // First image
         uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), uno::UNO_QUERY);
         uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
-        // Check URL
-        {
-            OUString sURL;
-            XPropSet->getPropertyValue("GraphicURL") >>= sURL;
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
-        }
-        // Check size
+
+        // Check graphic, size
         {
             uno::Reference<graphic::XGraphic> xGraphic;
             XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+            CPPUNIT_ASSERT(xGraphic.is());
+            CPPUNIT_ASSERT(xGraphic->getType() != graphic::GraphicType::EMPTY);
             uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
             CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
@@ -124,17 +122,13 @@ void Test::testSwappedOutImageExport()
         // Second Image
         xImage.set(xDraws->getByIndex(1), uno::UNO_QUERY);
         XPropSet.set( xImage, uno::UNO_QUERY_THROW );
-        // Check URL
-        {
-            OUString sURL;
-            XPropSet->getPropertyValue("GraphicURL") >>= sURL;
-            CPPUNIT_ASSERT_MESSAGE(
-                sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
-        }
-        // Check size
+
+        // Check graphic, size
         {
             uno::Reference<graphic::XGraphic> xGraphic;
             XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+            CPPUNIT_ASSERT(xGraphic.is());
+            CPPUNIT_ASSERT(xGraphic->getType() != graphic::GraphicType::EMPTY);
             uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
             CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(900), xBitmap->getSize().Width );
@@ -246,16 +240,13 @@ void Test::testImageWithSpecialID()
 
         uno::Reference<drawing::XShape> xImage = getShape(1);
         uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
-        // Check URL
-        {
-            OUString sURL;
-            XPropSet->getPropertyValue("GraphicURL") >>= sURL;
-            CPPUNIT_ASSERT(sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
-        }
-        // Check size
+
+        // Check graphic, size
         {
             uno::Reference<graphic::XGraphic> xGraphic;
             XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+            CPPUNIT_ASSERT(xGraphic.is());
+            CPPUNIT_ASSERT(xGraphic->getType() != graphic::GraphicType::EMPTY);
             uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
             CPPUNIT_ASSERT(xBitmap.is());
             CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(610), xBitmap->getSize().Width );
@@ -264,16 +255,13 @@ void Test::testImageWithSpecialID()
         // Second Image
         xImage = getShape(2);
         XPropSet.set( xImage, uno::UNO_QUERY_THROW );
-        // Check URL
-        {
-            OUString sURL;
-            XPropSet->getPropertyValue("GraphicURL") >>= sURL;
-            CPPUNIT_ASSERT(sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
-        }
+
         // Check size
         {
             uno::Reference<graphic::XGraphic> xGraphic;
             XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+            CPPUNIT_ASSERT(xGraphic.is());
+            CPPUNIT_ASSERT(xGraphic->getType() != graphic::GraphicType::EMPTY);
             uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
             CPPUNIT_ASSERT(xBitmap.is());
             CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(900), xBitmap->getSize().Width );
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx
index 079cc803b569..e01870143888 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -78,15 +78,11 @@ DECLARE_HTMLIMPORT_TEST(testInlinedImage, "inlined_image.html")
     uno::Reference<container::XNamed> const xNamed(xShape, uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("Image1"), xNamed->getName());
 
-    uno::Reference<graphic::XGraphic> xGraphic =
-        getProperty< uno::Reference<graphic::XGraphic> >(xShape, "Graphic");
+    uno::Reference<graphic::XGraphic> xGraphic;
+    xGraphic = getProperty< uno::Reference<graphic::XGraphic> >(xShape, "Graphic");
     CPPUNIT_ASSERT(xGraphic.is());
     CPPUNIT_ASSERT(xGraphic->getType() != graphic::GraphicType::EMPTY);
 
-    OUString sGraphicURL = getProperty< OUString >(xShape, "GraphicURL");
-    // Before it was "data:image/png;base64,<data>"
-    CPPUNIT_ASSERT(sGraphicURL.startsWith("vnd.sun.star.GraphicObject:"));
-
     for (int n = 0; ; n++)
     {
         SwNode* pNode = pDoc->GetNodes()[ n ];
diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx
index 06b46172cbd2..5c7abf1068d5 100644
--- a/sw/qa/extras/rtfexport/rtfexport2.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport2.cxx
@@ -1873,8 +1873,10 @@ DECLARE_RTFEXPORT_TEST(testClassificatonPasteLevels, "classification-confidentia
 DECLARE_RTFEXPORT_TEST(testTdf95707, "tdf95707.rtf")
 {
     // Graphic was replaced with a "Read-Error" placeholder.
-    CPPUNIT_ASSERT(getProperty<OUString>(getShape(1), "GraphicURL")
-                   != "vnd.sun.star.GraphicObject:0000000000000000000000000000000000000000");
+    uno::Reference<graphic::XGraphic> xGraphic;
+    xGraphic = getProperty<uno::Reference<graphic::XGraphic>>(getShape(1), "Graphic");
+    CPPUNIT_ASSERT(xGraphic.is());
+    CPPUNIT_ASSERT(xGraphic->getType() != graphic::GraphicType::EMPTY);
 }
 
 DECLARE_RTFEXPORT_TEST(testTdf96275, "tdf96275.rtf")
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index bb2f794d7a3e..3a601806da34 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -151,9 +151,6 @@ using ::com::sun::star::frame::XModel;
 using ::com::sun::star::container::XNameAccess;
 using ::com::sun::star::style::XStyleFamiliesSupplier;
 
-const sal_Char sPackageProtocol[] = "vnd.sun.star.Package:";
-const sal_Char sGraphicObjectProtocol[] = "vnd.sun.star.GraphicObject:";
-
 class BaseFrameProperties_Impl
 {
     SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
@@ -1575,44 +1572,15 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
             delete pSet;
 
         }
-        else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID ||
-                FN_UNO_GRAPHIC_FILTER == pEntry->nWID)
+        else if (FN_UNO_GRAPHIC_FILTER == pEntry->nWID)
         {
             OUString sGrfName;
             OUString sFltName;
-            std::unique_ptr<GraphicObject> pGrfObj;
             SwDoc::GetGrfNms( *static_cast<SwFlyFrameFormat*>(pFormat), &sGrfName, &sFltName );
-            OUString sTmp;
-            aValue >>= sTmp;
+            aValue >>= sFltName;
             UnoActionContext aAction(pFormat->GetDoc());
-            if(FN_UNO_GRAPHIC_U_R_L == pEntry->nWID)
-            {
-                if( sTmp.startsWith(sPackageProtocol) )
-                {
-                    pGrfObj = o3tl::make_unique<GraphicObject>();
-                    pGrfObj->SetUserData( sTmp );
-                    sGrfName.clear();
-                }
-                else if( sTmp.startsWith(sGraphicObjectProtocol) )
-                {
-                    const OString sId(OUStringToOString(
-                        sTmp.copy(sizeof(sGraphicObjectProtocol)-1),
-                        RTL_TEXTENCODING_ASCII_US));
-                    pGrfObj = o3tl::make_unique<GraphicObject>( sId );
-                    sGrfName.clear();
-                }
-                else
-                {
-                    sGrfName = sTmp;
-                }
-            }
-            else
-            {
-                sFltName = sTmp;
-            }
-
             const ::SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
-            if(pIdx)
+            if (pIdx)
             {
                 SwNodeIndex aIdx(*pIdx, 1);
                 SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
@@ -1621,11 +1589,10 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
                     throw uno::RuntimeException();
                 }
                 SwPaM aGrfPaM(*pGrfNode);
-                pFormat->GetDoc()->getIDocumentContentOperations().ReRead( aGrfPaM, sGrfName, sFltName, nullptr,
-                                        pGrfObj.get() );
+                pFormat->GetDoc()->getIDocumentContentOperations().ReRead(aGrfPaM, sGrfName, sFltName, nullptr, nullptr);
             }
         }
-        else if( FN_UNO_GRAPHIC == pEntry->nWID )
+        else if (FN_UNO_GRAPHIC == pEntry->nWID)
         {
             uno::Reference< graphic::XGraphic > xGraphic;
             aValue >>= xGraphic;
@@ -1636,7 +1603,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
                 {
                     SwNodeIndex aIdx(*pIdx, 1);
                     SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
-                    if(!pGrfNode)
+                    if (!pGrfNode)
                     {
                         throw uno::RuntimeException();
                     }
@@ -1652,7 +1619,6 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
             aValue >>= xGraphic;
             if (xGraphic.is())
             {
-                Graphic aGraphic(xGraphic);
                 const ::SwFormatContent* pCnt = &pFormat->GetContent();
                 if ( pCnt->GetContentIdx() && pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ] )
                 {
@@ -1660,9 +1626,9 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
 
                     if ( pOleNode )
                     {
-                        svt::EmbeddedObjectRef &rObj = pOleNode->GetOLEObj().GetObject();
-
-                        rObj.SetGraphic( aGraphic, OUString() );
+                        svt::EmbeddedObjectRef &rEmbeddedObject = pOleNode->GetOLEObj().GetObject();
+                        Graphic aGraphic(xGraphic);
+                        rEmbeddedObject.SetGraphic(aGraphic, OUString() );
                     }
                 }
             }
@@ -2039,30 +2005,6 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
                 }
             }
         }
-        else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID)
-        {
-            OUString sGrfName;
-            const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
-            if(pIdx)
-            {
-                SwNodeIndex aIdx(*pIdx, 1);
-                SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
-                if(!pGrfNode)
-                    throw uno::RuntimeException();
-                if( pGrfNode->IsGrfLink() )
-                {
-                    SwDoc::GetGrfNms( *static_cast<SwFlyFrameFormat*>(pFormat), &sGrfName, nullptr );
-                }
-                else
-                {
-                    OUString sId(OStringToOUString(
-                        pGrfNode->GetGrfObj().GetUniqueID(),
-                        RTL_TEXTENCODING_ASCII_US));
-                    sGrfName = sGraphicObjectProtocol + sId;
-                }
-            }
-            aAny <<= sGrfName;
-        }
         else if (FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID)
         {
             const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
@@ -2370,7 +2312,7 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
             if(pEntry->nWID == FN_UNO_ANCHOR_TYPES||
                 pEntry->nWID == FN_PARAM_LINK_DISPLAY_NAME||
                 FN_UNO_FRAME_STYLE_NAME == pEntry->nWID||
-                FN_UNO_GRAPHIC_U_R_L == pEntry->nWID||
+                FN_UNO_GRAPHIC == pEntry->nWID||
                 FN_UNO_GRAPHIC_FILTER     == pEntry->nWID||
                 FN_UNO_ACTUAL_SIZE == pEntry->nWID||
                 FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
@@ -2777,53 +2719,27 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
     }
     else if( eType == FLYCNTTYPE_GRF)
     {
-        UnoActionContext aCont(pDoc);
-        const ::uno::Any* pGraphicURL;
-        OUString sGraphicURL;
-        std::unique_ptr<GraphicObject> pGrfObj;
-        if (m_pProps->GetProperty(FN_UNO_GRAPHIC_U_R_L, 0, pGraphicURL))
-        {
-            (*pGraphicURL) >>= sGraphicURL;
-            if( sGraphicURL.startsWith(sPackageProtocol) )
-            {
-                pGrfObj = o3tl::make_unique<GraphicObject>();
-                pGrfObj->SetUserData( sGraphicURL );
-                sGraphicURL.clear();
-            }
-            else if( sGraphicURL.startsWith(sGraphicObjectProtocol) )
-            {
-                OString sId(OUStringToOString(
-                    sGraphicURL.copy( sizeof(sGraphicObjectProtocol)-1 ),
-                    RTL_TEXTENCODING_ASCII_US));
-                pGrfObj = o3tl::make_unique<GraphicObject>( sId );
-                sGraphicURL.clear();
-            }
-        }
+        UnoActionContext aActionContext(pDoc);
         Graphic aGraphic;
-        const ::uno::Any* pGraphic;
-        const bool bHasGraphic = m_pProps->GetProperty(FN_UNO_GRAPHIC, 0, pGraphic);
-        if( bHasGraphic )
+        const ::uno::Any* pGraphicAny;
+        const bool bHasGraphic = m_pProps->GetProperty(FN_UNO_GRAPHIC, 0, pGraphicAny);
+        if (bHasGraphic)
         {
-            uno::Reference< graphic::XGraphic > xGraphic;
-            (*pGraphic) >>= xGraphic;
-            aGraphic = Graphic( xGraphic );
+            uno::Reference<graphic::XGraphic> xGraphic;
+            (*pGraphicAny) >>= xGraphic;
+            aGraphic = Graphic(xGraphic);
         }
 
-        OUString sFltName;
-        const ::uno::Any* pFilter;
-        if (m_pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilter))
+        OUString sFilterName;
+        const uno::Any* pFilterAny;
+        if (m_pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilterAny))
         {
-            (*pFilter) >>= sFltName;
+            (*pFilterAny) >>= sFilterName;
         }
 
-        pFormat = pGrfObj
-            ? pDoc->getIDocumentContentOperations().InsertGraphicObject(
-                    aPam, *pGrfObj.get(), &aFrameSet, &aGrSet, pParentFrameFormat)
-            : pDoc->getIDocumentContentOperations().InsertGraphic(
-                    aPam, sGraphicURL, sFltName,
-                    (!bHasGraphic && !sGraphicURL.isEmpty()) ? nullptr : &aGraphic,
-                    &aFrameSet, &aGrSet, pParentFrameFormat);
-        if(pFormat)
+        pFormat = pDoc->getIDocumentContentOperations().InsertGraphic(
+                    aPam, OUString(), sFilterName, &aGraphic, &aFrameSet, &aGrSet, pParentFrameFormat);
+        if (pFormat)
         {
             SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFormat->GetContent().GetContentIdx()
                                         ->GetIndex()+1 ]->GetGrfNode();
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index fbe12b66844e..4b6a44211faa 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -849,7 +849,6 @@ const SfxItemPropertyMapEntry*  SwUnoPropertyMapProvider::GetGraphicPropertyMap(
         { OUString(UNO_NAME_HORI_MIRRORED_ON_EVEN_PAGES), RES_GRFATR_MIRRORGRF, cppu::UnoType<bool>::get(),             PROPERTY_NONE,      MID_MIRROR_HORZ_EVEN_PAGES            },
         { OUString(UNO_NAME_HORI_MIRRORED_ON_ODD_PAGES), RES_GRFATR_MIRRORGRF,  cppu::UnoType<bool>::get(),             PROPERTY_NONE,      MID_MIRROR_HORZ_ODD_PAGES                 },
         { OUString(UNO_NAME_VERT_MIRRORED), RES_GRFATR_MIRRORGRF,   cppu::UnoType<bool>::get(),             PROPERTY_NONE,     MID_MIRROR_VERT            },
-        { OUString(UNO_NAME_GRAPHIC_URL), FN_UNO_GRAPHIC_U_R_L, cppu::UnoType<OUString>::get(), 0, 0 },
         { OUString(UNO_NAME_REPLACEMENT_GRAPHIC), FN_UNO_REPLACEMENT_GRAPHIC, cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0 },
         { OUString(UNO_NAME_GRAPHIC_FILTER), FN_UNO_GRAPHIC_FILTER,      cppu::UnoType<OUString>::get(), 0, 0 },
         { OUString(UNO_NAME_GRAPHIC), FN_UNO_GRAPHIC, cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0 },
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6c069de73777..3e4c9396f99b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4482,14 +4482,14 @@ void DocxAttributeOutput::WriteSrcRect(const SdrObject* pSdrObj, const SwFrameFo
     uno::Reference< drawing::XShape > xShape( const_cast<SdrObject*>(pSdrObj)->getUnoShape(), uno::UNO_QUERY );
     uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
 
-    OUString sUrl;
-    xPropSet->getPropertyValue("GraphicURL") >>= sUrl;
-    const GraphicObject aGrafObj(GraphicObject::CreateGraphicObjectFromURL(sUrl));
+    uno::Reference<graphic::XGraphic> xGraphic;
+    xPropSet->getPropertyValue("Graphic") >>= xGraphic;
+    const Graphic aGraphic(xGraphic);
 
-    Size aOriginalSize(aGrafObj.GetPrefSize());
+    Size aOriginalSize(aGraphic.GetPrefSize());
 
     const MapMode aMap100mm( MapUnit::Map100thMM );
-    const MapMode& rMapMode = aGrafObj.GetPrefMapMode();
+    const MapMode& rMapMode = aGraphic.GetPrefMapMode();
     if (rMapMode.GetMapUnit() == MapUnit::MapPixel)
     {
         aOriginalSize = Application::GetDefaultDevice()->PixelToLogic(aOriginalSize, aMap100mm);
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index b62dd2b7c16b..42767872be02 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -517,24 +517,6 @@ void RtfSdrExport::impl_writeGraphic()
     {
         aGraphic = Graphic(xGraphic);
     }
-    else
-    {
-        OUString sGraphicURL;
-        try
-        {
-            xPropertySet->getPropertyValue("GraphicURL") >>= sGraphicURL;
-        }
-        catch (beans::UnknownPropertyException& rException)
-        {
-            // ATM groupshapes are not supported, just make sure we don't crash on them.
-            SAL_WARN("sw.rtf", "failed. Message: " << rException);
-            return;
-        }
-
-        OString aURLBS(OUStringToOString(sGraphicURL, RTL_TEXTENCODING_UTF8));
-        OString aUrl = aURLBS.copy(RTL_CONSTASCII_LENGTH("vnd.sun.star.GraphicObject:"));
-        aGraphic = GraphicObject(aUrl).GetTransformedGraphic();
-    }
 
     // Export it to a stream.
     SvMemoryStream aStream;


More information about the Libreoffice-commits mailing list