diff options
-rw-r--r-- | animations/source/animcore/animcore.cxx | 31 | ||||
-rw-r--r-- | include/oox/ppt/animationspersist.hxx | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/animations/XAudio.idl | 12 | ||||
-rw-r--r-- | oox/source/ppt/timenode.cxx | 6 | ||||
-rw-r--r-- | oox/source/ppt/timenodelistcontext.cxx | 9 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml1.cxx | 5 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-animations.cxx | 3 |
7 files changed, 66 insertions, 1 deletions
diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index ba1f6f7d4231..428578fbb831 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -254,6 +254,10 @@ public: virtual void SAL_CALL setSource( const Any& _source ) override; virtual double SAL_CALL getVolume() override; virtual void SAL_CALL setVolume( double _volume ) override; + sal_Bool SAL_CALL getHideDuringShow() override; + void SAL_CALL setHideDuringShow(sal_Bool bHideDuringShow) override; + sal_Bool SAL_CALL getNarration() override; + void SAL_CALL setNarration(sal_Bool bNarration) override; // XCommand - the following two shadowed by animate, unfortunately @@ -347,6 +351,7 @@ private: // XAudio double mfVolume; + bool mbHideDuringShow; // XCommand sal_Int16 mnCommand; @@ -434,6 +439,7 @@ AnimationNode::AnimationNode( sal_Int16 nNodeType ) mbMode(true), mnFadeColor(0), mfVolume(1.0), + mbHideDuringShow(false), mnCommand(0), mnIterateType( css::presentation::ShapeAnimationSubType::AS_WHOLE ), mfIterateInterval(0.0) @@ -504,6 +510,7 @@ AnimationNode::AnimationNode( const AnimationNode& rNode ) // XAudio mfVolume( rNode.mfVolume ), + mbHideDuringShow(rNode.mbHideDuringShow), // XCommand mnCommand( rNode.mnCommand ), @@ -1807,6 +1814,30 @@ void SAL_CALL AnimationNode::setVolume( double _volume ) } } +sal_Bool SAL_CALL AnimationNode::getHideDuringShow() +{ + osl::Guard<osl::Mutex> aGuard(maMutex); + return mbHideDuringShow; +} + +void SAL_CALL AnimationNode::setHideDuringShow(sal_Bool bHideDuringShow) +{ + osl::Guard<osl::Mutex> aGuard(maMutex); + if (static_cast<bool>(bHideDuringShow) != mbHideDuringShow) + { + mbHideDuringShow = bHideDuringShow; + fireChangeListener(); + } +} + +sal_Bool SAL_CALL AnimationNode::getNarration() +{ + return false; +} + +void SAL_CALL AnimationNode::setNarration(sal_Bool /*bNarration*/) +{ +} // XCommand sal_Int16 SAL_CALL AnimationNode::getCommand() diff --git a/include/oox/ppt/animationspersist.hxx b/include/oox/ppt/animationspersist.hxx index 0dcf0dc0662a..f2288929ad6e 100644 --- a/include/oox/ppt/animationspersist.hxx +++ b/include/oox/ppt/animationspersist.hxx @@ -43,6 +43,7 @@ namespace oox::ppt { NP_ENDSYNC, NP_ITERATETYPE, NP_ITERATEINTERVAL, NP_SUBITEM, NP_TARGET, NP_COMMAND, NP_PARAMETER, NP_VALUES, NP_FORMULA, NP_KEYTIMES, NP_DISPLAY, + NP_HIDEDURINGSHOW, NP_SIZE_ }; diff --git a/offapi/com/sun/star/animations/XAudio.idl b/offapi/com/sun/star/animations/XAudio.idl index 00e1deefc4a4..957a842382f0 100644 --- a/offapi/com/sun/star/animations/XAudio.idl +++ b/offapi/com/sun/star/animations/XAudio.idl @@ -32,6 +32,18 @@ interface XAudio : XAnimationNode [attribute] any Source; [attribute] double Volume; + + /** Specifies if the source shape should be hidden during slideshow (defaults to false). + + @since LibreOffice 7.2 + */ + [attribute] boolean HideDuringShow; + + /** Specifies if the source shape is a narration for the slide (defaults to false). + + @since LibreOffice 7.2 + */ + [attribute] boolean Narration; }; diff --git a/oox/source/ppt/timenode.cxx b/oox/source/ppt/timenode.cxx index 132c54b79f4a..978c24a0eabe 100644 --- a/oox/source/ppt/timenode.cxx +++ b/oox/source/ppt/timenode.cxx @@ -336,6 +336,12 @@ namespace oox::ppt { if( xAnimate.is() ) xAnimate->setBy( aValue ); break; + case NP_HIDEDURINGSHOW: + if (xAudio.is() && (aValue >>= bBool)) + { + xAudio->setHideDuringShow(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 3b40af62f2d0..d30e69f53be1 100644 --- a/oox/source/ppt/timenodelistcontext.cxx +++ b/oox/source/ppt/timenodelistcontext.cxx @@ -152,6 +152,7 @@ namespace oox::ppt { : TimeNodeContext( rParent, aElement, pNode ) , mbIsNarration( false ) , mbFullScrn( false ) + , mbHideDuringShow(false) { AttributeList attribs( xAttribs ); @@ -179,6 +180,10 @@ namespace oox::ppt { { // TODO deal with mbFullScrn } + else if (aElement == PPT_TOKEN(cMediaNode)) + { + mpNode->getNodeProperties()[NP_HIDEDURINGSHOW] <<= mbHideDuringShow; + } } virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs) override @@ -189,6 +194,9 @@ namespace oox::ppt { return new CommonTimeNodeContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( tgtEl ): return new TimeTargetElementContext( *this, mpNode->getTarget() ); + case PPT_TOKEN(cMediaNode): + mbHideDuringShow = !rAttribs.getBool(XML_showWhenStopped, true); + break; default: break; } @@ -199,6 +207,7 @@ namespace oox::ppt { private: bool mbIsNarration; bool mbFullScrn; + bool mbHideDuringShow; }; /** CT_TLSetBehavior diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 392aa4a8b32e..b8189c73a87e 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -1353,6 +1353,11 @@ void SdOOXMLExportTest1::testNarrationMimeType() // i.e. <p:childTnLst> had no <p:audio> children, the whole audio animation node was lost. assertXPath(pSlideDoc, "//p:childTnLst/p:audio/p:cMediaNode", 1); + // Without the accompanying fix in place, this test would have failed with: + // - ... no attribute 'showWhenStopped' exist + // i.e. <p:cMediaNode> had the default visibility -> bitmap was visible during slideshow. + assertXPath(pSlideDoc, "//p:childTnLst/p:audio/p:cMediaNode", "showWhenStopped", "0"); + xDocShRef->DoClose(); } diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx index e45ed5783c30..7b64ed365b55 100644 --- a/sd/source/filter/eppt/pptx-animations.cxx +++ b/sd/source/filter/eppt/pptx-animations.cxx @@ -1236,7 +1236,8 @@ void PPTXAnimationExport::WriteAnimationNodeAudio() } mpFS->startElementNS(XML_p, XML_audio); - mpFS->startElementNS(XML_p, XML_cMediaNode); + bool bHideDuringShow = xAudio->getHideDuringShow(); + mpFS->startElementNS(XML_p, XML_cMediaNode, XML_showWhenStopped, bHideDuringShow ? "0" : "1"); mpFS->startElementNS(XML_p, XML_cTn); WriteAnimationCondList(mpContext->getCondition(true), XML_stCondLst); |