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

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Wed Mar 7 02:23:54 UTC 2018


 include/svx/xmlgrhlp.hxx    |    2 +-
 svx/source/xml/xmlgrhlp.cxx |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit bec51fdb04bf25b9d670982dccab728c55c83fdf
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Mar 6 18:47:46 2018 +0900

    cache location and mime type when saving a graphic to a storage
    
    Change-Id: If27a5f617a103da235d6690ea0447d6c64538dea
    Reviewed-on: https://gerrit.libreoffice.org/50810
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/svx/xmlgrhlp.hxx b/include/svx/xmlgrhlp.hxx
index 94cc40d17179..578b9a5f98fb 100644
--- a/include/svx/xmlgrhlp.hxx
+++ b/include/svx/xmlgrhlp.hxx
@@ -63,7 +63,7 @@ private:
     ::std::set< OUString >      maURLSet;
 
     std::unordered_map<OUString, css::uno::Reference<css::graphic::XGraphic>> maGraphicObjects;
-    std::unordered_map<Graphic, OUString> maExportGraphics;
+    std::unordered_map<Graphic, std::pair<OUString, OUString>> maExportGraphics;
 
     SvXMLGraphicHelperMode      meCreateMode;
     OUString                    maOutputMimeType;
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index f8f690747959..62aa1bb6dd1b 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -49,6 +49,7 @@
 
 #include <algorithm>
 #include <memory>
+#include <utility>
 
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
@@ -1070,7 +1071,9 @@ OUString SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference<css::graphic::X
     auto aIterator = maExportGraphics.find(aGraphic);
     if (aIterator != maExportGraphics.end())
     {
-        return aIterator->second;
+        auto const & aURLAndMimePair = aIterator->second;
+        rOutSavedMimeType = aURLAndMimePair.second;
+        return aURLAndMimePair.first;
     }
 
     GraphicObject aGraphicObject(aGraphic);
@@ -1275,7 +1278,7 @@ OUString SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference<css::graphic::X
             aStoragePath += rPictureStreamName;
 
             // put into cache
-            maExportGraphics[aGraphic] = aStoragePath;
+            maExportGraphics[aGraphic] = std::make_pair(aStoragePath, rOutSavedMimeType);
 
             return aStoragePath;
         }


More information about the Libreoffice-commits mailing list