diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-03-06 18:47:46 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-03-07 03:23:29 +0100 |
commit | bec51fdb04bf25b9d670982dccab728c55c83fdf (patch) | |
tree | ddce5d22b3e653c2286f274db870fad95a590272 | |
parent | e030fbbf67a2490c4e734583d9f987c27506179e (diff) |
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@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | include/svx/xmlgrhlp.hxx | 2 | ||||
-rw-r--r-- | svx/source/xml/xmlgrhlp.cxx | 7 |
2 files changed, 6 insertions, 3 deletions
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; } |