[Libreoffice-commits] core.git: animations/source include/oox oox/source sd/qa sd/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 27 17:05:28 UTC 2021
animations/source/animcore/animcore.cxx | 14 ++++++++++++--
include/oox/ppt/animationspersist.hxx | 1 +
oox/source/ppt/timenode.cxx | 6 ++++++
oox/source/ppt/timenodelistcontext.cxx | 2 +-
sd/qa/unit/export-tests-ooxml1.cxx | 5 +++++
sd/source/filter/eppt/pptx-animations.cxx | 3 ++-
6 files changed, 27 insertions(+), 4 deletions(-)
New commits:
commit 020c721fa937d63b2c1b1bf6185ce1060e630676
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Jan 27 14:25:21 2021 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Jan 27 18:04:44 2021 +0100
PPTX filter: fix lost is-narration property for slide narrations
Otherwise removing narrations don't work in powerpoint, it would say
there are no narrations, just plain media shapes.
Change-Id: Ibd0478540ac018bc23f81223846518b3bf7c7c2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110016
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx
index 428578fbb831..adb41c26c0e7 100644
--- a/animations/source/animcore/animcore.cxx
+++ b/animations/source/animcore/animcore.cxx
@@ -352,6 +352,7 @@ private:
// XAudio
double mfVolume;
bool mbHideDuringShow;
+ bool mbNarration;
// XCommand
sal_Int16 mnCommand;
@@ -440,6 +441,7 @@ AnimationNode::AnimationNode( sal_Int16 nNodeType )
mnFadeColor(0),
mfVolume(1.0),
mbHideDuringShow(false),
+ mbNarration(false),
mnCommand(0),
mnIterateType( css::presentation::ShapeAnimationSubType::AS_WHOLE ),
mfIterateInterval(0.0)
@@ -511,6 +513,7 @@ AnimationNode::AnimationNode( const AnimationNode& rNode )
// XAudio
mfVolume( rNode.mfVolume ),
mbHideDuringShow(rNode.mbHideDuringShow),
+ mbNarration(rNode.mbNarration),
// XCommand
mnCommand( rNode.mnCommand ),
@@ -1832,11 +1835,18 @@ void SAL_CALL AnimationNode::setHideDuringShow(sal_Bool bHideDuringShow)
sal_Bool SAL_CALL AnimationNode::getNarration()
{
- return false;
+ osl::Guard<osl::Mutex> aGuard(maMutex);
+ return mbNarration;
}
-void SAL_CALL AnimationNode::setNarration(sal_Bool /*bNarration*/)
+void SAL_CALL AnimationNode::setNarration(sal_Bool bNarration)
{
+ osl::Guard<osl::Mutex> aGuard(maMutex);
+ if (static_cast<bool>(bNarration) != mbNarration)
+ {
+ mbNarration = bNarration;
+ fireChangeListener();
+ }
}
// XCommand
diff --git a/include/oox/ppt/animationspersist.hxx b/include/oox/ppt/animationspersist.hxx
index f2288929ad6e..8c8bb766d5aa 100644
--- a/include/oox/ppt/animationspersist.hxx
+++ b/include/oox/ppt/animationspersist.hxx
@@ -44,6 +44,7 @@ namespace oox::ppt {
NP_SUBITEM, NP_TARGET, NP_COMMAND, NP_PARAMETER,
NP_VALUES, NP_FORMULA, NP_KEYTIMES, NP_DISPLAY,
NP_HIDEDURINGSHOW,
+ NP_ISNARRATION,
NP_SIZE_
};
diff --git a/oox/source/ppt/timenode.cxx b/oox/source/ppt/timenode.cxx
index 978c24a0eabe..5d7604ec0952 100644
--- a/oox/source/ppt/timenode.cxx
+++ b/oox/source/ppt/timenode.cxx
@@ -342,6 +342,12 @@ namespace oox::ppt {
xAudio->setHideDuringShow(bBool);
}
break;
+ case NP_ISNARRATION:
+ if (xAudio.is() && (aValue >>= bBool))
+ {
+ xAudio->setNarration(bBool);
+ }
+ break;
case NP_TARGET:
if (xParent.is() && xParent->getType() == AnimationNodeType::ITERATE)
diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx
index d30e69f53be1..6ecd0985cd0a 100644
--- a/oox/source/ppt/timenodelistcontext.cxx
+++ b/oox/source/ppt/timenodelistcontext.cxx
@@ -174,7 +174,7 @@ namespace oox::ppt {
sal_Int32 aElement = getCurrentElement();
if( aElement == PPT_TOKEN( audio ) )
{
- // TODO deal with mbIsNarration
+ mpNode->getNodeProperties()[NP_ISNARRATION] <<= mbIsNarration;
}
else if( aElement == PPT_TOKEN( video ) )
{
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index b8189c73a87e..da61677f7b48 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -1358,6 +1358,11 @@ void SdOOXMLExportTest1::testNarrationMimeType()
// i.e. <p:cMediaNode> had the default visibility -> bitmap was visible during slideshow.
assertXPath(pSlideDoc, "//p:childTnLst/p:audio/p:cMediaNode", "showWhenStopped", "0");
+ // Without the accompanying fix in place, this test would have failed with:
+ // - ... no attribute 'isNarration' exist
+ // i.e. <p:audio> was not a narration -> could not mass-remove narrations on the UI.
+ assertXPath(pSlideDoc, "//p:childTnLst/p:audio", "isNarration", "1");
+
xDocShRef->DoClose();
}
diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx
index 7b64ed365b55..5de9475857d3 100644
--- a/sd/source/filter/eppt/pptx-animations.cxx
+++ b/sd/source/filter/eppt/pptx-animations.cxx
@@ -1235,7 +1235,8 @@ void PPTXAnimationExport::WriteAnimationNodeAudio()
mrPowerPointExport.embedEffectAudio(mpFS, sUrl, sRelId, sName);
}
- mpFS->startElementNS(XML_p, XML_audio);
+ bool bNarration = xAudio->getNarration();
+ mpFS->startElementNS(XML_p, XML_audio, XML_isNarration, bNarration ? "1" : "0");
bool bHideDuringShow = xAudio->getHideDuringShow();
mpFS->startElementNS(XML_p, XML_cMediaNode, XML_showWhenStopped, bHideDuringShow ? "0" : "1");
More information about the Libreoffice-commits
mailing list