summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-09-23 23:28:30 +0200
committerAndras Timar <andras.timar@collabora.com>2020-10-06 08:24:46 +0200
commitd483df8fee614261170f7b7b6ad8a3e155727a21 (patch)
treefc4f4470f19c15816c26d9d1b0f60045c12b2772 /include
parent8c75dc8cdae09aeae447862cdfc1fda948bc369d (diff)
fix Graphic duplication in import and add GraphicMapper
When importing writerfilter, we change to oox when importing images. This transition doesn't store any previous contexts and all instances are reset. The problem occurs when we have identical images because the transition erases all caches we have to determine if an image has already been imported or not, which causes that we import the same image multiple times which create unnecessary copies. This introduces the XGraphicMapper, which can be used to store the XGraphic for a key and can be transferred between writerfilter to oox. With this we can remember which images were already imported and don't create unnecessary internal copies which decreases memory. This also includes a test which checks that the import and export doesn't produce unnecessary copies of identical images. The test checks that for OOXML, ODF and MS Binary formats. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103283 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit d0efd878dc41e3913a2d91ff4b5c335c1d71a85c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103407 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 3de1b009bd187afa1dd49b10644c1920641e1596) Change-Id: I33dc19218c565937fab77e132b3a996c51358b6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103607 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/oox/helper/graphichelper.hxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx
index 0f277ca98fd0..caf96dd57f43 100644
--- a/include/oox/helper/graphichelper.hxx
+++ b/include/oox/helper/graphichelper.hxx
@@ -32,6 +32,7 @@
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <com/sun/star/graphic/XGraphicProvider2.hpp>
+#include <com/sun/star/graphic/XGraphicMapper.hpp>
struct WmfExternal;
@@ -128,9 +129,10 @@ public:
@return The original Graphic size in 100thmm */
css::awt::Size getOriginalSize( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic ) const;
+ void setGraphicMapper(css::uno::Reference<css::graphic::XGraphicMapper> const & rxGraphicMapper);
+ void initializeGraphicMapperIfNeeded() const;
private:
- typedef ::std::map< OUString, css::uno::Reference< css::graphic::XGraphic > > EmbeddedGraphicMap;
css::uno::Reference< css::uno::XComponentContext > mxContext;
css::uno::Reference< css::graphic::XGraphicProvider2 > mxGraphicProvider;
@@ -138,9 +140,9 @@ private:
css::awt::DeviceInfo maDeviceInfo; ///< Current output device info.
::std::map< sal_Int32, ::Color > maSystemPalette; ///< Maps system colors (XML tokens) to RGB color values.
StorageRef mxStorage; ///< Storage containing embedded graphics.
- mutable EmbeddedGraphicMap maEmbeddedGraphics; ///< Maps all embedded graphics by their storage path.
double mfPixelPerHmmX; ///< Number of screen pixels per 1/100 mm in X direction.
double mfPixelPerHmmY; ///< Number of screen pixels per 1/100 mm in Y direction.
+ css::uno::Reference<css::graphic::XGraphicMapper> mxGraphicMapper;
};