diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-07-24 00:02:23 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-07-25 12:12:53 +0200 |
commit | 5206929f3a125a739adb860709586a0f50cb9611 (patch) | |
tree | 25815723d63f1ad47b4b1b7f667a9d82a0652f64 /sd/source | |
parent | e32a795eee3d6b2c4c4be112674d37b39d3e315f (diff) |
sd: OOoXML import: fix loss of animations
There are 2 different animation formats, legacy one used in OOoXML
format, based on presentation:animations element, and SMIL based one
used in ODF format, based on a node hierarchy with
<anim:par presentation:node-type="timing-root"> at the top.
The problem is that when the legacy animations are imported, they are
not immediately set on the draw-page in the same way as the new
animations are imported.
"soffice --convert-to odp ooo28334-1.sxi" loses all of the animations,
whereas loading the file in the UI and storing it all animations are
converted, and if you use API load/store methods some are converted and
some not depending on timing.
The problem is that there is a necessary conversion step
MainSequence::implRebuild() that needs to happen after all the
EffectMigration calls for a particular SdPage are finished, which
is only triggered by a timer MainSequence::onTimerHdl().
Fix it by forcing a call to implRebuild() from DrawDocShell::Load().
Note: SdDrawDocument::NewOrLoadCompleted() is a horribly misleading
function name as it is actually called *before* loading the document.
Change-Id: I9881cb9bf2ae6ccc5fcf06602343f2d0e0704699
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/core/EffectMigration.cxx | 25 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 3 |
2 files changed, 28 insertions, 0 deletions
diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx index 83ca865b6f80..ab2a4615bdb1 100644 --- a/sd/source/core/EffectMigration.cxx +++ b/sd/source/core/EffectMigration.cxx @@ -1427,4 +1427,29 @@ void EffectMigration::CreateAnimatedGroup(SdrObjGroup& rGroupObj, SdPage& rPage) } } +void EffectMigration::DocumentLoaded(SdDrawDocument & rDoc) +{ + if (DOCUMENT_TYPE_DRAW == rDoc.GetDocumentType()) + return; // no animations in Draw + for (sal_uInt16 n = 0; n < rDoc.GetSdPageCount(PK_STANDARD); ++n) + { + SdPage *const pPage = rDoc.GetSdPage(n, PK_STANDARD); + if (pPage->hasAnimationNode()) + { + // this will force the equivalent of the MainSequence::onTimerHdl + // so that the animations are present in export-able representation + // *before* the import is finished + pPage->getMainSequence()->getRootNode(); + } + } + for (sal_uInt16 n = 0; n < rDoc.GetMasterSdPageCount(PK_STANDARD); ++n) + { + SdPage *const pPage = rDoc.GetMasterSdPage(n, PK_STANDARD); + if (pPage->hasAnimationNode()) + { + pPage->getMainSequence()->getRootNode(); + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 5fa120462fa4..0b9e6a2ec379 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -62,6 +62,7 @@ #include "ViewShell.hxx" #include "sdmod.hxx" #include "View.hxx" +#include "EffectMigration.hxx" #include "CustomAnimationEffect.hxx" #include "sdpage.hxx" #include "sdresid.hxx" @@ -300,6 +301,8 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) if( bRet ) { + // for legacy markup in OOoXML filter, convert the animations now + EffectMigration::DocumentLoaded(*GetDoc()); UpdateTablePointers(); // If we're an embedded OLE object, use tight bounds |