diff options
author | Tünde Tóth <toth.tunde@nisz.hu> | 2022-03-22 09:47:57 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2022-03-30 18:24:45 +0200 |
commit | aea8043bc5f5187498fa450505d6de9d6986e2a6 (patch) | |
tree | 2047231de903ae94656848f14d31a3523d429fe8 /include | |
parent | 94ace0e51744f82b58156392e53b4c4ad819e4bf (diff) |
Impress and Calc used to dump the same image file
as many times as it was featured in the document,
resulting redundant, sometimes huge documents.
Note: using only checksum to recognize image duplication
is a regression, because checksum collision results
image loss. This is a very unlikely event, and
the following commits have got the same problem.
The solution is comparing the images with the same
checksum byte for byte.
See also commit b484e9814c66d8d51cea974390963a6944bc9d73
"tdf#83227 oox: reuse RelId in DML/VML export for the same graphic"
and commit 797fef38612fb2fd62d1f6591619b9361e526bca
"tdf#118535 DOCX export: save header image once".
Change-Id: I9f233d521941381746634cf4f9b5991da0dadda9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131928
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/oox/export/drawingml.hxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index fb125dd647ad..9a7f744520c8 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -21,7 +21,9 @@ #define INCLUDED_OOX_EXPORT_DRAWINGML_HXX #include <map> +#include <stack> #include <string_view> +#include <unordered_map> #include <vector> #include <com/sun/star/beans/PropertyState.hpp> @@ -41,6 +43,7 @@ #include <sax/fshelper.hxx> #include <svx/msdffdef.hxx> #include <vcl/checksum.hxx> +#include <vcl/graph.hxx> #include <tools/gen.hxx> #include <tools/color.hxx> #include <vcl/mapmod.hxx> @@ -150,6 +153,7 @@ private: static std::map<OUString, OUString> maWdpCache; static sal_Int32 mnDrawingMLCount; static sal_Int32 mnVmlCount; + static std::stack<std::unordered_map<BitmapChecksum, OUString>> maExportGraphics; /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC). DocumentType meDocumentType; @@ -342,9 +346,11 @@ public: sal_Int32 getBulletMarginIndentation (const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view propName); static void ResetCounters(); - static void ResetMlCounters(); + static void PushExportGraphics(); + static void PopExportGraphics(); + static sal_Int32 getNewDrawingUniqueId() { return ++mnDrawingMLCount; } static sal_Int32 getNewVMLUniqueId() { return ++mnVmlCount; } |