[Libreoffice-commits] core.git: include/xmloff svx/source xmloff/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Sat Mar 10 16:51:21 UTC 2018


 include/xmloff/xmlexp.hxx     |    1 -
 svx/source/xml/xmleohlp.cxx   |    2 +-
 xmloff/source/core/xmlexp.cxx |   15 +++++++++------
 3 files changed, 10 insertions(+), 8 deletions(-)

New commits:
commit 4ea605cb5c31fe4c7d3931a656782a652b4d96fc
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sat Mar 10 18:27:40 2018 +0900

    xmloff: embedded objects can still use GraphicObject URL
    
    The embedded graphic object don't seem to use the uniqueID of
    a graphic object, but seem to have the same URL prefix. Let's
    leave this in for now.
    
    Change-Id: I48d9ad2c3b1eca745911f03221988c46c0fdb8d2
    Reviewed-on: https://gerrit.libreoffice.org/51041
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
index cf132192bc39..a40d47edf9e6 100644
--- a/include/xmloff/xmlexp.hxx
+++ b/include/xmloff/xmlexp.hxx
@@ -137,7 +137,6 @@ class XMLOFF_DLLPUBLIC SvXMLExport : public cppu::WeakImplHelper<
     rtl::Reference<SvXMLAttributeList>          mxAttrList;        // a common attribute list
 
     OUString     msOrigFileName; // the original URL
-    OUString     msEmbeddedObjectProtocol;
     OUString     msFilterName;
     OUString     msImgFilterName;
     std::unique_ptr<SvXMLNamespaceMap> mpNamespaceMap;    // the namepspace map
diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx
index 7074b498f91f..10fb40bb0124 100644
--- a/svx/source/xml/xmleohlp.cxx
+++ b/svx/source/xml/xmleohlp.cxx
@@ -61,7 +61,7 @@ using namespace ::com::sun::star::lang;
 #define XML_CONTAINERSTORAGE_NAME_60        "Pictures"
 #define XML_CONTAINERSTORAGE_NAME       "ObjectReplacements"
 #define XML_EMBEDDEDOBJECT_URL_BASE     "vnd.sun.star.EmbeddedObject:"
-#define XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE      "vnd.sun.star.GraphicObject:"
+#define XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE "vnd.sun.star.GraphicObject:"
 
 
 class OutputStorageWrapper_Impl : public ::cppu::WeakImplHelper<XOutputStream>
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index c0be7c830a09..f76e7b677710 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -118,6 +118,9 @@ sal_Char const sXML_1_2[] = "1.2";
 
 #define XML_USEPRETTYPRINTING       "UsePrettyPrinting"
 
+#define XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE "vnd.sun.star.GraphicObject:"
+#define XML_EMBEDDEDOBJECT_URL_BASE     "vnd.sun.star.EmbeddedObject:"
+
 namespace {
 
 struct XMLServiceMapEntry_Impl
@@ -396,8 +399,6 @@ void SvXMLExport::InitCtor_()
             GetXMLToken(XML_NP_CSS3TEXT), GetXMLToken(XML_N_CSS3TEXT), XML_NAMESPACE_CSS3TEXT );
     }
 
-    msEmbeddedObjectProtocol = "vnd.sun.star.EmbeddedObject:";
-
     if (mxModel.is() && !mxEventListener.is())
     {
         mxEventListener.set( new SvXMLExportEventListener(this));
@@ -1933,8 +1934,9 @@ bool SvXMLExport::AddEmbeddedXGraphicAsBase64(uno::Reference<graphic::XGraphic>
 OUString SvXMLExport::AddEmbeddedObject( const OUString& rEmbeddedObjectURL )
 {
     OUString sRet;
-    if (rEmbeddedObjectURL.startsWith(msEmbeddedObjectProtocol) &&
-        mxEmbeddedResolver.is())
+    bool bSupportedURL = rEmbeddedObjectURL.startsWith(XML_EMBEDDEDOBJECT_URL_BASE) ||
+                         rEmbeddedObjectURL.startsWith(XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE);
+    if (bSupportedURL && mxEmbeddedResolver.is())
     {
         sRet = mxEmbeddedResolver->resolveEmbeddedObjectURL(rEmbeddedObjectURL);
     }
@@ -1947,8 +1949,9 @@ OUString SvXMLExport::AddEmbeddedObject( const OUString& rEmbeddedObjectURL )
 bool SvXMLExport::AddEmbeddedObjectAsBase64( const OUString& rEmbeddedObjectURL )
 {
     bool bRet = false;
-    if (rEmbeddedObjectURL.startsWith(msEmbeddedObjectProtocol) &&
-        mxEmbeddedResolver.is())
+    bool bSupportedURL = rEmbeddedObjectURL.startsWith(XML_EMBEDDEDOBJECT_URL_BASE) ||
+                         rEmbeddedObjectURL.startsWith(XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE);
+    if (bSupportedURL && mxEmbeddedResolver.is())
     {
         Reference < XNameAccess > xNA( mxEmbeddedResolver, UNO_QUERY );
         if( xNA.is() )


More information about the Libreoffice-commits mailing list