path: root/sfx2/source/doc/objstor.cxx
diff options
authorMichael Stahl <>2016-02-12 18:22:51 +0100
committerAndras Timar <>2016-02-22 08:58:16 +0100
commit806c73ffb65db133f797e9b315f061754e7648c8 (patch)
tree9fcc57fd50bed037836ab5c2c41670404a5ed5c6 /sfx2/source/doc/objstor.cxx
parent89f45e7b255d98e2cd3693938c132072c3cfe63f (diff)
sfx2: related tdf#56270: loss of embedded objects imported from DOCX
After the import some of these are kept in RUNNING state. For Math objects imported from MathType3 OLEs in particular, first a new Math object is created and stored to the XStorage, only then is the MathType3 stream imported. This means the Math object is modified and contains data that must be stored. The problem is then that SfxObjectShell::ImportFrom() simply calls setModified(false), clearing the flag without storing the object. For Flat ODF export we lose all the objects that are cached in sw's SwOLELRUCache; for the bugdoc something more inexplicable happens for ODT export where we lose "Object 214" (which is the first one in the cache) but no other ones. (The main difference is that for ODF there is an optimization to copy the embedded object's storage without loading the object, but for Flat ODF every object must be loaded and exported.) (regression from 83777cd6e0f3f1a4458af896fd13344c696ecb1e) (cherry picked from commit d81d104833f0ee9349ebcd0d79d2de84ba9a7262) Change-Id: Id1474fba9f4da2d5247c7ff4dc6819ddb9829fe8 Reviewed-on: Tested-by: Jenkins <> Reviewed-by: Caolán McNamara <> Tested-by: Caolán McNamara <> (cherry picked from commit b21bb8d7b3808eee06320b634e11e3a4ab217839)
Diffstat (limited to 'sfx2/source/doc/objstor.cxx')
1 files changed, 12 insertions, 1 deletions
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index be8ecd062f66..7bc028d85229 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2281,8 +2281,19 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium,
if ( nState == embed::EmbedStates::LOADED || nState == embed::EmbedStates::RUNNING ) // means that the object is not active
uno::Reference< util::XModifiable > xModifiable( xObj->getComponent(), uno::UNO_QUERY );
- if ( )
+ if ( && xModifiable->isModified())
+ {
+ uno::Reference<embed::XEmbedPersist> const xPers(xObj, uno::UNO_QUERY);
+ if (
+ { // store it before resetting modified!
+ xPers->storeOwn();
+ }
+ else
+ {
+ SAL_WARN("sfx.doc", "Modified object without persistence!");
+ }
+ }