sd/Library_sd.mk | 1 sd/source/filter/eppt/pptx-animations-cond.cxx | 105 ++++++++++++++ sd/source/filter/eppt/pptx-animations-cond.hxx | 31 ++++ sd/source/filter/eppt/pptx-animations.cxx | 95 ------------ svx/source/accessibility/svxpixelctlaccessiblecontext.cxx | 3 svx/source/accessibility/svxrectctaccessiblecontext.cxx | 3 svx/source/inc/svxpixelctlaccessiblecontext.hxx | 11 - svx/source/inc/svxrectctaccessiblecontext.hxx | 12 - 8 files changed, 145 insertions(+), 116 deletions(-)
New commits: commit 0a55335ef3b91bbf573f6e5eaa4241d14a15a4ee Author: Mark Hung <mark...@gmail.com> AuthorDate: Fri Jan 27 22:13:36 2023 +0800 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Jan 28 17:44:37 2023 +0000 sd/filter/pptx-anmiation refactor Cond class. Change-Id: Iffb0eeb1454a858987680d402add3f5122f7b6db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146292 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk index 86ad12f6a2b9..297c2bc23654 100644 --- a/sd/Library_sd.mk +++ b/sd/Library_sd.mk @@ -187,6 +187,7 @@ $(eval $(call gb_Library_add_exception_objects,sd,\ sd/source/filter/eppt/pptx-epptbase \ sd/source/filter/eppt/pptx-epptooxml \ sd/source/filter/eppt/pptx-animations \ + sd/source/filter/eppt/pptx-animations-cond \ sd/source/filter/eppt/pptx-grouptable \ sd/source/filter/eppt/pptx-stylesheet \ sd/source/filter/eppt/pptx-text \ diff --git a/sd/source/filter/eppt/pptx-animations-cond.cxx b/sd/source/filter/eppt/pptx-animations-cond.cxx new file mode 100644 index 000000000000..440d31885dad --- /dev/null +++ b/sd/source/filter/eppt/pptx-animations-cond.cxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <com/sun/star/animations/Timing.hpp> +#include <com/sun/star/animations/Event.hpp> +#include <com/sun/star/animations/EventTrigger.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/animations/XAnimationNode.hpp> +#include "pptx-animations-cond.hxx" + +using namespace ::com::sun::star::animations; +using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::uno; + +namespace +{ +const char* convertEventTrigger(sal_Int16 nTrigger) +{ + const char* pEvent = nullptr; + switch (nTrigger) + { + case EventTrigger::ON_NEXT: + pEvent = "onNext"; + break; + case EventTrigger::ON_PREV: + pEvent = "onPrev"; + break; + case EventTrigger::BEGIN_EVENT: + pEvent = "begin"; + break; + case EventTrigger::END_EVENT: + pEvent = "end"; + break; + case EventTrigger::ON_BEGIN: + pEvent = "onBegin"; + break; + case EventTrigger::ON_END: + pEvent = "onEnd"; + break; + case EventTrigger::ON_CLICK: + pEvent = "onClick"; + break; + case EventTrigger::ON_DBL_CLICK: + pEvent = "onDblClick"; + break; + case EventTrigger::ON_STOP_AUDIO: + pEvent = "onStopAudio"; + break; + case EventTrigger::ON_MOUSE_ENTER: + pEvent = "onMouseOver"; // not exact? + break; + case EventTrigger::ON_MOUSE_LEAVE: + pEvent = "onMouseOut"; + break; + } + return pEvent; +} +} + +namespace oox::core +{ +Cond::Cond(const Any& rAny, bool bIsMainSeqChild) + : mpEvent(nullptr) +{ + bool bHasFDelay = false; + double fDelay = 0; + Timing eTiming; + Event aEvent; + + if (rAny >>= eTiming) + { + if (eTiming == Timing_INDEFINITE) + msDelay = "indefinite"; + } + else if (rAny >>= aEvent) + { + if (aEvent.Trigger == EventTrigger::ON_NEXT && bIsMainSeqChild) + msDelay = "indefinite"; + else + { + mpEvent = convertEventTrigger(aEvent.Trigger); + if (!(aEvent.Source >>= mxShape)) + aEvent.Source >>= mxNode; + + if (aEvent.Offset >>= fDelay) + bHasFDelay = true; + } + } + else if (rAny >>= fDelay) + bHasFDelay = true; + + if (bHasFDelay) + { + sal_Int32 nDelay = static_cast<sal_uInt32>(fDelay * 1000.0); + msDelay = OString::number(nDelay); + } +} +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/filter/eppt/pptx-animations-cond.hxx b/sd/source/filter/eppt/pptx-animations-cond.hxx new file mode 100644 index 000000000000..ec101c429ef1 --- /dev/null +++ b/sd/source/filter/eppt/pptx-animations-cond.hxx @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#pragma once + +#include <o3tl/any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/animations/XAnimationNode.hpp> + +namespace oox::core +{ +struct Cond +{ + OString msDelay; + const char* mpEvent; + css::uno::Reference<css::drawing::XShape> mxShape; + css::uno::Reference<css::animations::XAnimationNode> mxNode; + + Cond(const css::uno::Any& rAny, bool bIsMainSeqChild); + + bool isValid() const { return msDelay.getLength() || mpEvent; } + const char* getDelay() const { return msDelay.getLength() ? msDelay.getStr() : nullptr; } +}; +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx index 03c8e6cc7b49..77b4ea2282a7 100644 --- a/sd/source/filter/eppt/pptx-animations.cxx +++ b/sd/source/filter/eppt/pptx-animations.cxx @@ -33,8 +33,6 @@ #include <com/sun/star/animations/AnimationTransformType.hpp> #include <com/sun/star/animations/AnimationValueType.hpp> #include <com/sun/star/animations/AnimationColorSpace.hpp> -#include <com/sun/star/animations/Event.hpp> -#include <com/sun/star/animations/EventTrigger.hpp> #include <com/sun/star/animations/Timing.hpp> #include <com/sun/star/animations/ValuePair.hpp> #include <com/sun/star/animations/XAnimateMotion.hpp> @@ -61,6 +59,7 @@ #include "pptexanimations.hxx" #include "pptx-animations.hxx" +#include "pptx-animations-cond.hxx" #include "../ppt/pptanimations.hxx" using namespace ::com::sun::star; @@ -258,48 +257,6 @@ void WriteAnimationCondListForSeq(const FSHelperPtr& pFS, sal_Int32 nToken) pFS->endElementNS(XML_p, nToken); } -const char* convertEventTrigger(sal_Int16 nTrigger) -{ - const char* pEvent = nullptr; - switch (nTrigger) - { - case EventTrigger::ON_NEXT: - pEvent = "onNext"; - break; - case EventTrigger::ON_PREV: - pEvent = "onPrev"; - break; - case EventTrigger::BEGIN_EVENT: - pEvent = "begin"; - break; - case EventTrigger::END_EVENT: - pEvent = "end"; - break; - case EventTrigger::ON_BEGIN: - pEvent = "onBegin"; - break; - case EventTrigger::ON_END: - pEvent = "onEnd"; - break; - case EventTrigger::ON_CLICK: - pEvent = "onClick"; - break; - case EventTrigger::ON_DBL_CLICK: - pEvent = "onDblClick"; - break; - case EventTrigger::ON_STOP_AUDIO: - pEvent = "onStopAudio"; - break; - case EventTrigger::ON_MOUSE_ENTER: - pEvent = "onMouseOver"; // not exact? - break; - case EventTrigger::ON_MOUSE_LEAVE: - pEvent = "onMouseOut"; - break; - } - return pEvent; -} - void WriteAnimationAttributeName(const FSHelperPtr& pFS, const OUString& rAttributeName) { if (rAttributeName.isEmpty()) @@ -575,56 +532,6 @@ public: const Reference<XAnimationNode>& getNodeForCondition() const; }; -struct Cond -{ - OString msDelay; - const char* mpEvent; - Reference<XShape> mxShape; - Reference<XAnimationNode> mxNode; - - Cond(const Any& rAny, bool bIsMainSeqChild); - - bool isValid() const { return msDelay.getLength() || mpEvent; } - const char* getDelay() const { return msDelay.getLength() ? msDelay.getStr() : nullptr; } -}; - -Cond::Cond(const Any& rAny, bool bIsMainSeqChild) - : mpEvent(nullptr) -{ - bool bHasFDelay = false; - double fDelay = 0; - Timing eTiming; - Event aEvent; - - if (rAny >>= eTiming) - { - if (eTiming == Timing_INDEFINITE) - msDelay = "indefinite"; - } - else if (rAny >>= aEvent) - { - if (aEvent.Trigger == EventTrigger::ON_NEXT && bIsMainSeqChild) - msDelay = "indefinite"; - else - { - mpEvent = convertEventTrigger(aEvent.Trigger); - if (!(aEvent.Source >>= mxShape)) - aEvent.Source >>= mxNode; - - if (aEvent.Offset >>= fDelay) - bHasFDelay = true; - } - } - else if (rAny >>= fDelay) - bHasFDelay = true; - - if (bHasFDelay) - { - sal_Int32 nDelay = static_cast<sal_uInt32>(fDelay * 1000.0); - msDelay = OString::number(nDelay); - } -} - class PPTXAnimationExport { void WriteAnimationNode(const NodeContextPtr& pContext); commit a434653fd46828d152d0256738c24adb63530330 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Jan 27 16:14:18 2023 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sat Jan 28 17:44:30 2023 +0000 Use ImplInheritanceHelper in SvxRectCtlAccessibleContext Change-Id: I864a1c2571ce8642626d77b726f2fa6dfbdadf2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146284 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx index 9586330127b5..f5cb1eaf3611 100644 --- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx +++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx @@ -112,9 +112,6 @@ SvxRectCtlAccessibleContext::~SvxRectCtlAccessibleContext() ensureDisposed(); } -IMPLEMENT_FORWARD_XINTERFACE2( SvxRectCtlAccessibleContext, OAccessibleSelectionHelper, OAccessibleHelper_Base ) -IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxRectCtlAccessibleContext, OAccessibleSelectionHelper, OAccessibleHelper_Base ) - Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleAtPoint( const awt::Point& rPoint ) { ::osl::MutexGuard aGuard( m_aMutex ); diff --git a/svx/source/inc/svxrectctaccessiblecontext.hxx b/svx/source/inc/svxrectctaccessiblecontext.hxx index d25805e4ad53..97552901d8b1 100644 --- a/svx/source/inc/svxrectctaccessiblecontext.hxx +++ b/svx/source/inc/svxrectctaccessiblecontext.hxx @@ -26,7 +26,7 @@ #include <com/sun/star/accessibility/XAccessibleAction.hpp> #include <com/sun/star/accessibility/XAccessibleValue.hpp> #include <com/sun/star/uno/Reference.hxx> -#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase3.hxx> #include <comphelper/accessibleselectionhelper.hxx> #include <rtl/ref.hxx> @@ -44,18 +44,14 @@ namespace tools { class Rectangle; } class SvxRectCtl; class SvxRectCtlChildAccessibleContext; -typedef ::cppu::ImplHelper1<css::accessibility::XAccessible> OAccessibleHelper_Base; - -class SvxRectCtlAccessibleContext final : public ::comphelper::OAccessibleSelectionHelper, - public OAccessibleHelper_Base +class SvxRectCtlAccessibleContext final : public cppu::ImplInheritanceHelper< + ::comphelper::OAccessibleSelectionHelper, + css::accessibility::XAccessible> { public: // internal SvxRectCtlAccessibleContext(SvxRectCtl* pRepresentation); - DECLARE_XINTERFACE( ) - DECLARE_XTYPEPROVIDER( ) - // XAccessibleComponent virtual void SAL_CALL grabFocus() override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point& rPoint) override; commit 71b797dda8ea5cd579b8402c2f3ad3c803fb8986 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Jan 27 16:04:53 2023 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sat Jan 28 17:44:23 2023 +0000 Use ImplInheritanceHelper in SvxPixelCtlAccessibleChild Change-Id: I09d7004d6cf268831725435c5e634dedfa385a7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146283 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx index 23847464b58c..f1badee58bf6 100644 --- a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx +++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx @@ -325,9 +325,6 @@ SvxPixelCtlAccessibleChild::~SvxPixelCtlAccessibleChild() ensureDisposed(); } -IMPLEMENT_FORWARD_XINTERFACE2( SvxPixelCtlAccessibleChild, OAccessibleComponentHelper, OAccessibleHelper_Base ) -IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxPixelCtlAccessibleChild, OAccessibleComponentHelper, OAccessibleHelper_Base ) - // XAccessible uno::Reference< XAccessibleContext> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleContext() { diff --git a/svx/source/inc/svxpixelctlaccessiblecontext.hxx b/svx/source/inc/svxpixelctlaccessiblecontext.hxx index 25c2cfa77a35..5ae6a9b92828 100644 --- a/svx/source/inc/svxpixelctlaccessiblecontext.hxx +++ b/svx/source/inc/svxpixelctlaccessiblecontext.hxx @@ -25,7 +25,6 @@ #include <com/sun/star/uno/Reference.hxx> #include <comphelper/accessibleselectionhelper.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/implbase1.hxx> #include <rtl/ref.hxx> #include <tools/gen.hxx> @@ -40,10 +39,9 @@ namespace com::sun::star::awt { class SvxPixelCtl; class SvxPixelCtlAccessible; -typedef ::cppu::ImplHelper1<css::accessibility::XAccessible> OAccessibleHelper_Base; - -class SvxPixelCtlAccessibleChild final : public ::comphelper::OAccessibleComponentHelper, - public OAccessibleHelper_Base +class SvxPixelCtlAccessibleChild final : public cppu::ImplInheritanceHelper< + ::comphelper::OAccessibleComponentHelper, + css::accessibility::XAccessible> { public: SvxPixelCtlAccessibleChild( @@ -53,9 +51,6 @@ public: rtl::Reference<SvxPixelCtlAccessible> xParent, tools::Long nIndexInParent ); - DECLARE_XINTERFACE( ) - DECLARE_XTYPEPROVIDER( ) - //XAccessibleComponent virtual void SAL_CALL grabFocus( ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;