From 56d5b221f91f792fa6ff215a54a343c3672d6e24 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 4 Mar 2021 12:21:58 +0000 Subject: remove intermediate CustomAnimationPanel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I34e1e3f87565cb9d8bf33f8e8f22844081785e21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111969 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- sd/IwyuFilter_sd.yaml | 9 +- sd/Library_sd.mk | 1 - sd/source/ui/animations/CustomAnimationDialog.cxx | 2 +- sd/source/ui/animations/CustomAnimationList.cxx | 2 +- sd/source/ui/animations/CustomAnimationList.hxx | 172 -------------------- sd/source/ui/animations/CustomAnimationPane.cxx | 24 +-- sd/source/ui/animations/CustomAnimationPane.hxx | 183 --------------------- sd/source/ui/animations/motionpathtag.cxx | 2 +- sd/source/ui/animations/motionpathtag.hxx | 2 +- sd/source/ui/inc/CustomAnimationList.hxx | 172 ++++++++++++++++++++ sd/source/ui/inc/CustomAnimationPane.hxx | 189 ++++++++++++++++++++++ sd/source/ui/inc/createcustomanimationpanel.hxx | 38 ----- sd/source/ui/sidebar/CustomAnimationPanel.cxx | 63 -------- sd/source/ui/sidebar/CustomAnimationPanel.hxx | 54 ------- sd/source/ui/sidebar/PanelFactory.cxx | 4 +- 15 files changed, 378 insertions(+), 539 deletions(-) delete mode 100644 sd/source/ui/animations/CustomAnimationList.hxx delete mode 100644 sd/source/ui/animations/CustomAnimationPane.hxx create mode 100644 sd/source/ui/inc/CustomAnimationList.hxx create mode 100644 sd/source/ui/inc/CustomAnimationPane.hxx delete mode 100644 sd/source/ui/inc/createcustomanimationpanel.hxx delete mode 100644 sd/source/ui/sidebar/CustomAnimationPanel.cxx delete mode 100644 sd/source/ui/sidebar/CustomAnimationPanel.hxx (limited to 'sd') diff --git a/sd/IwyuFilter_sd.yaml b/sd/IwyuFilter_sd.yaml index b4632fdb7c91..288f567758fe 100644 --- a/sd/IwyuFilter_sd.yaml +++ b/sd/IwyuFilter_sd.yaml @@ -87,12 +87,6 @@ excludelist: sd/source/filter/eppt/eppt.hxx: # base class has to be a complete type - escherex.hxx - sd/source/ui/animations/CustomAnimationPane.hxx: - # Needed for typedef - - motionpathtag.hxx - sd/source/ui/animations/CustomAnimationPane.cxx: - # Avoid loplugin:unreffun error - - createcustomanimationpanel.hxx sd/source/ui/annotations/annotationmanagerimpl.hxx: # base class has to be a complete type - annotationtag.hxx @@ -180,6 +174,9 @@ excludelist: - com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp - com/sun/star/accessibility/XAccessibleSelection.hpp - com/sun/star/lang/XServiceInfo.hpp + sd/source/ui/inc/CustomAnimationPane.hxx: + # Needed for typedef + - motionpathtag.hxx sd/source/ui/inc/DrawDocShell.hxx: # base class has to be a complete type - fupoor.hxx diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk index 9ba5375ad7fa..b4a029c81920 100644 --- a/sd/Library_sd.mk +++ b/sd/Library_sd.mk @@ -325,7 +325,6 @@ $(eval $(call gb_Library_add_exception_objects,sd,\ sd/source/ui/presenter/SlideRenderer \ sd/source/ui/sidebar/AllMasterPagesSelector \ sd/source/ui/sidebar/CurrentMasterPagesSelector \ - sd/source/ui/sidebar/CustomAnimationPanel \ sd/source/ui/sidebar/DocumentHelper \ sd/source/ui/sidebar/LayoutMenu \ sd/source/ui/sidebar/MasterPageContainer \ diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index fb8a5bc68efd..16df53997094 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -57,7 +57,7 @@ #include #include "CustomAnimationDialog.hxx" -#include "CustomAnimationPane.hxx" +#include #include "STLPropertySet.hxx" #include diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index 2b24919a57a0..d4fcbb1c852b 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -27,7 +27,7 @@ #include #include #include -#include "CustomAnimationList.hxx" +#include #include #include #include diff --git a/sd/source/ui/animations/CustomAnimationList.hxx b/sd/source/ui/animations/CustomAnimationList.hxx deleted file mode 100644 index 56cfafcf5176..000000000000 --- a/sd/source/ui/animations/CustomAnimationList.hxx +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONLIST_HXX -#define INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONLIST_HXX - -#include - -#include - -#include -#include -#include - -namespace com::sun::star::drawing { class XShape; } - -struct ImplSVEvent; - -namespace sd { - -typedef std::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr; - -class ICustomAnimationListController -{ -public: - virtual void onSelect() = 0; - virtual void onDoubleClick() = 0; - virtual void onContextMenu(const OString &rIdent) = 0; - virtual void onDragNDropComplete( std::vector< CustomAnimationEffectPtr > pEffectsDragged, CustomAnimationEffectPtr pEffectInsertBefore ) = 0; - virtual ~ICustomAnimationListController() {} -}; - -class CustomAnimationList; -class CustomAnimationListEntryItem; - -class CustomAnimationListDropTarget : public DropTargetHelper -{ -private: - CustomAnimationList& m_rTreeView; - - virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; - virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; - -public: - CustomAnimationListDropTarget(CustomAnimationList& rTreeView); -}; - -class CustomAnimationList : public ISequenceListener -{ - friend class CustomAnimationListEntryItem; - friend struct stl_append_effect_func; - -public: - explicit CustomAnimationList(std::unique_ptr xTreeView, - std::unique_ptr xLabel, - std::unique_ptr xScrolledWindow); - virtual ~CustomAnimationList(); - - // methods - - /** selects or deselects the given effect. - Selections of other effects are not changed */ - void select( const CustomAnimationEffectPtr& pEffect ); - - /** populates the list with all effects from the given MainSequence */ - void update( const MainSequencePtr& pMainSequence ); - - void update(); - - EffectSequence getSelection() const; - - // events - void onSelectionChanged(const css::uno::Any& rSelection); - - void Select(); - - virtual void notify_change() override; - - bool isExpanded( const CustomAnimationEffectPtr& pEffect ) const; - bool isVisible( const CustomAnimationEffectPtr& pEffect ) const; - - // clears all entries from the listbox - void clear(); - - void setController( ICustomAnimationListController* pController ) - { - mpController = pController; - }; - - sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt); - sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt); - - void set_sensitive(bool bSensitive) { mxTreeView->set_sensitive(bSensitive); } - int get_height_rows(int nRows) { return mxTreeView->get_height_rows(nRows); } - int get_approximate_digit_width() const { return mxTreeView->get_approximate_digit_width(); } - void set_size_request(int nWidth, int nHeight) - { - mxTreeView->set_size_request(nWidth, nHeight); - mxEmptyLabel->set_size_request(nWidth, nHeight); - } - void unselect_all() { mxTreeView->unselect_all(); } - weld::TreeView& get_widget() { return *mxTreeView; } - - DECL_LINK(KeyInputHdl, const KeyEvent&, bool); - DECL_LINK(ExpandHdl, const weld::TreeIter&, bool); - DECL_LINK(PostExpandHdl, void*, void); - DECL_LINK(CollapseHdl, const weld::TreeIter&, bool); - DECL_LINK(PostCollapseHdl, void*, void); - -private: - std::unique_ptr mxTreeView; - CustomAnimationListDropTarget maDropTargetHelper; - std::unique_ptr mxEmptyLabel; - std::unique_ptr mxEmptyLabelParent; - std::vector> mxEntries; - std::vector> lastSelectedEntries; - - bool mbIgnorePaint; - - DECL_LINK(SelectHdl, weld::TreeView&, void); - DECL_LINK(CommandHdl, const CommandEvent&, bool); - DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); - DECL_LINK(DragBeginHdl, bool&, bool); - DECL_STATIC_LINK(CustomAnimationList, CustomRenderHdl, weld::TreeView::render_args, void); - DECL_STATIC_LINK(CustomAnimationList, CustomGetSizeHdl, weld::TreeView::get_size_args, Size); - - void ExecuteContextMenuAction(const OString& rSelectedPopupEntry); - - /** appends the given effect to the list*/ - void append( CustomAnimationEffectPtr pEffect ); - - ICustomAnimationListController* mpController; - - MainSequencePtr mpMainSequence; - - css::uno::Reference< css::drawing::XShape > mxLastTargetShape; - sal_Int32 mnLastGroupId; - ImplSVEvent* mnPostExpandEvent; - ImplSVEvent* mnPostCollapseEvent; - - std::unique_ptr mxLastParentEntry; - - // drag & drop - std::unique_ptr mxDndEffectDragging; - std::vector> mDndEffectsSelected; -}; - -OUString getPropertyName( sal_Int32 nPropertyType ); - -OUString getShapeDescription( const css::uno::Reference< css::drawing::XShape >& xShape, bool bWithText ); - -} - -#endif // INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONLIST_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 624d70ad901d..825a88b9bab8 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -40,12 +40,11 @@ #include #include #include "STLPropertySet.hxx" -#include "CustomAnimationPane.hxx" +#include #include "CustomAnimationDialog.hxx" -#include "CustomAnimationList.hxx" +#include #include "motionpathtag.hxx" #include -#include #include #include @@ -158,6 +157,12 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase, m_pInitialFocusWidget = &mxCustomAnimationList->get_widget(); } +css::ui::LayoutSize CustomAnimationPane::GetHeightForWidth(const sal_Int32 /*nWidth*/) +{ + sal_Int32 nMinimumHeight = get_preferred_size().Height(); + return css::ui::LayoutSize(nMinimumHeight, -1, nMinimumHeight); +} + void CustomAnimationPane::initialize() { mxLBAnimation->connect_changed(LINK(this, CustomAnimationPane, AnimationSelectHdl)); @@ -2542,19 +2547,6 @@ void CustomAnimationPane::updatePathFromMotionPathTag( const rtl::Reference< Mot } } -vcl::Window * createCustomAnimationPanel( vcl::Window* pParent, ViewShellBase& rBase, const css::uno::Reference& rxFrame ) -{ - vcl::Window* pWindow = nullptr; - - DrawDocShell* pDocSh = rBase.GetDocShell(); - if( pDocSh ) - { - pWindow = VclPtr::Create( pParent, rBase, rxFrame ); - } - - return pWindow; -} - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx deleted file mode 100644 index 94b543dcd298..000000000000 --- a/sd/source/ui/animations/CustomAnimationPane.hxx +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONPANE_HXX -#define INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONPANE_HXX - -#include -#include "CustomAnimationDialog.hxx" -#include "CustomAnimationList.hxx" -#include "motionpathtag.hxx" -#include - -#include - -namespace com::sun::star::drawing { class XDrawPage; } -namespace com::sun::star::drawing { class XDrawView; } -namespace weld { class ComboBox; } -namespace com::sun::star::animations { class XAnimationNode; } -namespace sd::tools { class EventMultiplexerEvent; } - -enum class PathKind { NONE, CURVE, POLYGON, FREEFORM }; - -namespace sd { - -class STLPropertySet; -class ViewShellBase; - -typedef std::vector< rtl::Reference< MotionPathTag > > MotionPathTagVector; - -class CustomAnimationPane : public PanelLayout, public ICustomAnimationListController -{ - friend class MotionPathTag; -public: - CustomAnimationPane( vcl::Window* pParent, ViewShellBase& rBase, const css::uno::Reference& rxFrame ); - virtual ~CustomAnimationPane() override; - virtual void dispose() override; - - // callbacks - void onSelectionChanged(); - void onChangeCurrentPage(); - void onAdd(); - void onRemove(); - void onChangeStart(); - void onChangeStart( sal_Int16 nNodeType ); - void onChangeSpeed(); - - // methods - void preview( const css::uno::Reference< css::animations::XAnimationNode >& xAnimationNode ); - void remove( CustomAnimationEffectPtr const & pEffect ); - - // Control - virtual void StateChanged( StateChangedType nStateChange ) override; - virtual void KeyInput( const KeyEvent& rKEvt ) override; - - // ICustomAnimationListController - virtual void onSelect() override; - virtual void onDoubleClick() override; - virtual void onContextMenu(const OString& rIdent) override; - virtual void onDragNDropComplete( std::vector< CustomAnimationEffectPtr > pEffectsDragged, CustomAnimationEffectPtr pEffectInsertBefore ) override; - - // Window - virtual void DataChanged (const DataChangedEvent& rEvent) override; - - void addUndo(); - - double getDuration() const; - void updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag ); - -private: - void initialize(); - void addListener(); - void removeListener(); - void updateControls(); - void updateMotionPathTags(); - - void showOptions(const OString& sPage = OString()); - void moveSelection( bool bUp ); - void onPreview( bool bForcePreview ); - - std::unique_ptr createSelectionSet(); - void changeSelection( STLPropertySet const * pResultSet, STLPropertySet const * pOldSet ); - - static css::uno::Any getProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect ); - static bool setProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect, const css::uno::Any& rValue ); - void UpdateLook(); - sal_Int32 fillAnimationLB( bool bHasText ); - PathKind getCreatePathKind() const; - void createPath( PathKind eKind, std::vector< ::com::sun::star::uno::Any >& rTargets, double fDuration ); - - DECL_LINK( implControlListBoxHdl, weld::ComboBox&, void ); - DECL_LINK( implClickHdl, weld::Button&, void ); - DECL_LINK( implPropertyHdl, LinkParamNone*, void ); - DECL_LINK( EventMultiplexerListener, tools::EventMultiplexerEvent&, void ); - DECL_LINK( lateInitCallback, Timer *, void ); - DECL_LINK( DurationModifiedHdl, weld::MetricSpinButton&, void ); - DECL_LINK( DelayModifiedHdl, weld::MetricSpinButton&, void ); - DECL_LINK( DelayLoseFocusHdl, weld::Widget&, void ); - DECL_LINK( UpdateAnimationLB, weld::ComboBox&, void ); - DECL_LINK( AnimationSelectHdl, weld::TreeView&, void ); - DECL_LINK( SelectionHandler, Timer*, void ); - void implControlHdl(const weld::Widget* pControl); - -private: - ViewShellBase& mrBase; - - // UI Elements - std::unique_ptr mxFTAnimation; - std::unique_ptr mxCustomAnimationList; - std::unique_ptr mxPBAddEffect; - std::unique_ptr mxPBRemoveEffect; - std::unique_ptr mxPBMoveUp; - std::unique_ptr mxPBMoveDown; - std::unique_ptr mxFTCategory; - std::unique_ptr mxLBCategory; - std::unique_ptr mxFTEffect; - std::unique_ptr mxLBAnimation; - std::unique_ptr mxFTStart; - std::unique_ptr mxLBStart; - std::unique_ptr mxFTProperty; - std::unique_ptr mxLBSubControl; - std::unique_ptr mxPlaceholderBox; - std::unique_ptr mxPBPropertyMore; - std::unique_ptr mxFTDuration; - std::unique_ptr mxCBXDuration; - std::unique_ptr mxFTStartDelay; - std::unique_ptr mxMFStartDelay; - std::unique_ptr mxCBAutoPreview; - std::unique_ptr mxPBPlay; - - Idle maIdle; - - OUString maStrModify; - OUString maStrProperty; - - sal_Int32 mnLastSelectedAnimation; - sal_Int32 mnPropertyType; - static sal_Int32 const gnMotionPathPos = 3; - sal_Int32 mnCurvePathPos; - sal_Int32 mnPolygonPathPos; - sal_Int32 mnFreeformPathPos; - - EffectSequence maListSelection; - css::uno::Any maViewSelection; - - MainSequencePtr mpMainSequence; - - css::uno::Reference< css::drawing::XDrawPage > mxCurrentPage; - css::uno::Reference< css::drawing::XDrawView > mxView; - - /** The CustomAnimationPresets is initialized either on demand or - after a short time after the construction of a new object of this - class. This timer is responsible for the later. - */ - Timer maLateInitTimer; - - MotionPathTagVector maMotionPathTags; - - ScopeLock maSelectionLock; -}; - -void fillRepeatComboBox(weld::ComboBox& rBox); - -} - -#endif // INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONPANE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index b20e57740f4f..6597faf2c7b9 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -45,7 +45,7 @@ #include #include -#include "CustomAnimationPane.hxx" +#include #include #include "motionpathtag.hxx" #include diff --git a/sd/source/ui/animations/motionpathtag.hxx b/sd/source/ui/animations/motionpathtag.hxx index 82d596c90c23..9c2a493fa728 100644 --- a/sd/source/ui/animations/motionpathtag.hxx +++ b/sd/source/ui/animations/motionpathtag.hxx @@ -23,7 +23,7 @@ #include #include #include -#include "CustomAnimationList.hxx" +#include namespace com::sun::star::drawing { class XShape; } class SdrPathObj; diff --git a/sd/source/ui/inc/CustomAnimationList.hxx b/sd/source/ui/inc/CustomAnimationList.hxx new file mode 100644 index 000000000000..56cfafcf5176 --- /dev/null +++ b/sd/source/ui/inc/CustomAnimationList.hxx @@ -0,0 +1,172 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONLIST_HXX +#define INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONLIST_HXX + +#include + +#include + +#include +#include +#include + +namespace com::sun::star::drawing { class XShape; } + +struct ImplSVEvent; + +namespace sd { + +typedef std::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr; + +class ICustomAnimationListController +{ +public: + virtual void onSelect() = 0; + virtual void onDoubleClick() = 0; + virtual void onContextMenu(const OString &rIdent) = 0; + virtual void onDragNDropComplete( std::vector< CustomAnimationEffectPtr > pEffectsDragged, CustomAnimationEffectPtr pEffectInsertBefore ) = 0; + virtual ~ICustomAnimationListController() {} +}; + +class CustomAnimationList; +class CustomAnimationListEntryItem; + +class CustomAnimationListDropTarget : public DropTargetHelper +{ +private: + CustomAnimationList& m_rTreeView; + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + +public: + CustomAnimationListDropTarget(CustomAnimationList& rTreeView); +}; + +class CustomAnimationList : public ISequenceListener +{ + friend class CustomAnimationListEntryItem; + friend struct stl_append_effect_func; + +public: + explicit CustomAnimationList(std::unique_ptr xTreeView, + std::unique_ptr xLabel, + std::unique_ptr xScrolledWindow); + virtual ~CustomAnimationList(); + + // methods + + /** selects or deselects the given effect. + Selections of other effects are not changed */ + void select( const CustomAnimationEffectPtr& pEffect ); + + /** populates the list with all effects from the given MainSequence */ + void update( const MainSequencePtr& pMainSequence ); + + void update(); + + EffectSequence getSelection() const; + + // events + void onSelectionChanged(const css::uno::Any& rSelection); + + void Select(); + + virtual void notify_change() override; + + bool isExpanded( const CustomAnimationEffectPtr& pEffect ) const; + bool isVisible( const CustomAnimationEffectPtr& pEffect ) const; + + // clears all entries from the listbox + void clear(); + + void setController( ICustomAnimationListController* pController ) + { + mpController = pController; + }; + + sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt); + sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt); + + void set_sensitive(bool bSensitive) { mxTreeView->set_sensitive(bSensitive); } + int get_height_rows(int nRows) { return mxTreeView->get_height_rows(nRows); } + int get_approximate_digit_width() const { return mxTreeView->get_approximate_digit_width(); } + void set_size_request(int nWidth, int nHeight) + { + mxTreeView->set_size_request(nWidth, nHeight); + mxEmptyLabel->set_size_request(nWidth, nHeight); + } + void unselect_all() { mxTreeView->unselect_all(); } + weld::TreeView& get_widget() { return *mxTreeView; } + + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(ExpandHdl, const weld::TreeIter&, bool); + DECL_LINK(PostExpandHdl, void*, void); + DECL_LINK(CollapseHdl, const weld::TreeIter&, bool); + DECL_LINK(PostCollapseHdl, void*, void); + +private: + std::unique_ptr mxTreeView; + CustomAnimationListDropTarget maDropTargetHelper; + std::unique_ptr mxEmptyLabel; + std::unique_ptr mxEmptyLabelParent; + std::vector> mxEntries; + std::vector> lastSelectedEntries; + + bool mbIgnorePaint; + + DECL_LINK(SelectHdl, weld::TreeView&, void); + DECL_LINK(CommandHdl, const CommandEvent&, bool); + DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); + DECL_LINK(DragBeginHdl, bool&, bool); + DECL_STATIC_LINK(CustomAnimationList, CustomRenderHdl, weld::TreeView::render_args, void); + DECL_STATIC_LINK(CustomAnimationList, CustomGetSizeHdl, weld::TreeView::get_size_args, Size); + + void ExecuteContextMenuAction(const OString& rSelectedPopupEntry); + + /** appends the given effect to the list*/ + void append( CustomAnimationEffectPtr pEffect ); + + ICustomAnimationListController* mpController; + + MainSequencePtr mpMainSequence; + + css::uno::Reference< css::drawing::XShape > mxLastTargetShape; + sal_Int32 mnLastGroupId; + ImplSVEvent* mnPostExpandEvent; + ImplSVEvent* mnPostCollapseEvent; + + std::unique_ptr mxLastParentEntry; + + // drag & drop + std::unique_ptr mxDndEffectDragging; + std::vector> mDndEffectsSelected; +}; + +OUString getPropertyName( sal_Int32 nPropertyType ); + +OUString getShapeDescription( const css::uno::Reference< css::drawing::XShape >& xShape, bool bWithText ); + +} + +#endif // INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONLIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/CustomAnimationPane.hxx b/sd/source/ui/inc/CustomAnimationPane.hxx new file mode 100644 index 000000000000..5d156884a919 --- /dev/null +++ b/sd/source/ui/inc/CustomAnimationPane.hxx @@ -0,0 +1,189 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONPANE_HXX +#define INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONPANE_HXX + +#include +#include +#include "CustomAnimationList.hxx" +#include + +#include + +namespace com::sun::star::drawing { class XDrawPage; } +namespace com::sun::star::drawing { class XDrawView; } +namespace weld { class ComboBox; } +namespace com::sun::star::animations { class XAnimationNode; } +namespace sd::tools { class EventMultiplexerEvent; } + +enum class PathKind { NONE, CURVE, POLYGON, FREEFORM }; + +namespace sd { + +class MotionPathTag; +class SdPropertySubControl; +class STLPropertySet; +class ViewShellBase; + +typedef std::vector< rtl::Reference< MotionPathTag > > MotionPathTagVector; + +class CustomAnimationPane : public PanelLayout + , public sfx2::sidebar::ILayoutableWindow + , public ICustomAnimationListController +{ + friend class MotionPathTag; +public: + CustomAnimationPane( vcl::Window* pParent, ViewShellBase& rBase, const css::uno::Reference& rxFrame ); + virtual ~CustomAnimationPane() override; + virtual void dispose() override; + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) override; + + // callbacks + void onSelectionChanged(); + void onChangeCurrentPage(); + void onAdd(); + void onRemove(); + void onChangeStart(); + void onChangeStart( sal_Int16 nNodeType ); + void onChangeSpeed(); + + // methods + void preview( const css::uno::Reference< css::animations::XAnimationNode >& xAnimationNode ); + void remove( CustomAnimationEffectPtr const & pEffect ); + + // Control + virtual void StateChanged( StateChangedType nStateChange ) override; + virtual void KeyInput( const KeyEvent& rKEvt ) override; + + // ICustomAnimationListController + virtual void onSelect() override; + virtual void onDoubleClick() override; + virtual void onContextMenu(const OString& rIdent) override; + virtual void onDragNDropComplete( std::vector< CustomAnimationEffectPtr > pEffectsDragged, CustomAnimationEffectPtr pEffectInsertBefore ) override; + + // Window + virtual void DataChanged (const DataChangedEvent& rEvent) override; + + void addUndo(); + + double getDuration() const; + void updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag ); + +private: + void initialize(); + void addListener(); + void removeListener(); + void updateControls(); + void updateMotionPathTags(); + + void showOptions(const OString& sPage = OString()); + void moveSelection( bool bUp ); + void onPreview( bool bForcePreview ); + + std::unique_ptr createSelectionSet(); + void changeSelection( STLPropertySet const * pResultSet, STLPropertySet const * pOldSet ); + + static css::uno::Any getProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect ); + static bool setProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect, const css::uno::Any& rValue ); + void UpdateLook(); + sal_Int32 fillAnimationLB( bool bHasText ); + PathKind getCreatePathKind() const; + void createPath( PathKind eKind, std::vector< ::com::sun::star::uno::Any >& rTargets, double fDuration ); + + DECL_LINK( implControlListBoxHdl, weld::ComboBox&, void ); + DECL_LINK( implClickHdl, weld::Button&, void ); + DECL_LINK( implPropertyHdl, LinkParamNone*, void ); + DECL_LINK( EventMultiplexerListener, tools::EventMultiplexerEvent&, void ); + DECL_LINK( lateInitCallback, Timer *, void ); + DECL_LINK( DurationModifiedHdl, weld::MetricSpinButton&, void ); + DECL_LINK( DelayModifiedHdl, weld::MetricSpinButton&, void ); + DECL_LINK( DelayLoseFocusHdl, weld::Widget&, void ); + DECL_LINK( UpdateAnimationLB, weld::ComboBox&, void ); + DECL_LINK( AnimationSelectHdl, weld::TreeView&, void ); + DECL_LINK( SelectionHandler, Timer*, void ); + void implControlHdl(const weld::Widget* pControl); + +private: + ViewShellBase& mrBase; + + // UI Elements + std::unique_ptr mxFTAnimation; + std::unique_ptr mxCustomAnimationList; + std::unique_ptr mxPBAddEffect; + std::unique_ptr mxPBRemoveEffect; + std::unique_ptr mxPBMoveUp; + std::unique_ptr mxPBMoveDown; + std::unique_ptr mxFTCategory; + std::unique_ptr mxLBCategory; + std::unique_ptr mxFTEffect; + std::unique_ptr mxLBAnimation; + std::unique_ptr mxFTStart; + std::unique_ptr mxLBStart; + std::unique_ptr mxFTProperty; + std::unique_ptr mxLBSubControl; + std::unique_ptr mxPlaceholderBox; + std::unique_ptr mxPBPropertyMore; + std::unique_ptr mxFTDuration; + std::unique_ptr mxCBXDuration; + std::unique_ptr mxFTStartDelay; + std::unique_ptr mxMFStartDelay; + std::unique_ptr mxCBAutoPreview; + std::unique_ptr mxPBPlay; + + Idle maIdle; + + OUString maStrModify; + OUString maStrProperty; + + sal_Int32 mnLastSelectedAnimation; + sal_Int32 mnPropertyType; + static sal_Int32 const gnMotionPathPos = 3; + sal_Int32 mnCurvePathPos; + sal_Int32 mnPolygonPathPos; + sal_Int32 mnFreeformPathPos; + + EffectSequence maListSelection; + css::uno::Any maViewSelection; + + MainSequencePtr mpMainSequence; + + css::uno::Reference< css::drawing::XDrawPage > mxCurrentPage; + css::uno::Reference< css::drawing::XDrawView > mxView; + + /** The CustomAnimationPresets is initialized either on demand or + after a short time after the construction of a new object of this + class. This timer is responsible for the later. + */ + Timer maLateInitTimer; + + MotionPathTagVector maMotionPathTags; + + ScopeLock maSelectionLock; +}; + +void fillRepeatComboBox(weld::ComboBox& rBox); + +} + +#endif // INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONPANE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/createcustomanimationpanel.hxx b/sd/source/ui/inc/createcustomanimationpanel.hxx deleted file mode 100644 index 7005d71abd44..000000000000 --- a/sd/source/ui/inc/createcustomanimationpanel.hxx +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SD_SOURCE_UI_INC_CREATECUSTOMANIMATIONPANEL_HXX -#define INCLUDED_SD_SOURCE_UI_INC_CREATECUSTOMANIMATIONPANEL_HXX - -#include -#include - -#include - -#include "ViewShell.hxx" - -namespace sd { - -vcl::Window * createCustomAnimationPanel (vcl::Window* pParent, ViewShellBase& rBase, const css::uno::Reference& rxFrame); - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/CustomAnimationPanel.cxx b/sd/source/ui/sidebar/CustomAnimationPanel.cxx deleted file mode 100644 index bd253f2a52f9..000000000000 --- a/sd/source/ui/sidebar/CustomAnimationPanel.cxx +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "CustomAnimationPanel.hxx" -#include - -#include - -namespace sd::sidebar { - -CustomAnimationPanel::CustomAnimationPanel ( - vcl::Window* pParentWindow, - ViewShellBase& rViewShellBase, - const css::uno::Reference& rxFrame - ) - : PanelBase( - pParentWindow, - rViewShellBase), - mxFrame( rxFrame ) -{ - SetStyle( GetStyle() | WB_DIALOGCONTROL ); -#ifdef DEBUG - SetText(OUString("sd:CustomAnimationPanel")); -#endif -} - -CustomAnimationPanel::~CustomAnimationPanel() -{ -} - -vcl::Window* CustomAnimationPanel::CreateWrappedControl ( - vcl::Window* pParentWindow, - ViewShellBase& rViewShellBase) -{ - return createCustomAnimationPanel(pParentWindow, rViewShellBase, mxFrame); -} - -css::ui::LayoutSize CustomAnimationPanel::GetHeightForWidth (const sal_Int32 /*nWidth*/) -{ - Window *pControl = mpWrappedControl.get(); - sal_Int32 nMinimumHeight = pControl ? pControl->get_preferred_size().Height() : 0; - return css::ui::LayoutSize(nMinimumHeight,-1, nMinimumHeight); -} - -} // end of namespace sd::sidebar - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/CustomAnimationPanel.hxx b/sd/source/ui/sidebar/CustomAnimationPanel.hxx deleted file mode 100644 index 0e03fb399600..000000000000 --- a/sd/source/ui/sidebar/CustomAnimationPanel.hxx +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SD_SOURCE_UI_SIDEBAR_CUSTOMANIMATIONPANEL_HXX -#define INCLUDED_SD_SOURCE_UI_SIDEBAR_CUSTOMANIMATIONPANEL_HXX - -#include "PanelBase.hxx" - -namespace com::sun::star::frame { class XFrame; } - -namespace sd::sidebar { - -class CustomAnimationPanel - : public PanelBase -{ -public: - CustomAnimationPanel ( - vcl::Window* pParentWindow, - ViewShellBase& rViewShellBase, - const css::uno::Reference& rxFrame); - virtual ~CustomAnimationPanel() override; - - // ILayoutableWindow - virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) override; - -protected: - virtual vcl::Window* CreateWrappedControl ( - vcl::Window* pParentWindow, - ViewShellBase& rViewShellBase) override; - -private: - css::uno::Reference mxFrame; -}; - -} // end of namespace sd::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx index d24eca6ff0a9..baa2938320ad 100644 --- a/sd/source/ui/sidebar/PanelFactory.cxx +++ b/sd/source/ui/sidebar/PanelFactory.cxx @@ -25,7 +25,7 @@ #include "CurrentMasterPagesSelector.hxx" #include "RecentMasterPagesSelector.hxx" #include "AllMasterPagesSelector.hxx" -#include "CustomAnimationPanel.hxx" +#include #include "NavigatorWrapper.hxx" #include #include "TableDesignPanel.hxx" @@ -101,7 +101,7 @@ Reference SAL_CALL PanelFactory::createUIElement ( for the TaskPanelFactory. */ if (rsUIElementResourceURL.endsWith("/CustomAnimations")) - pControl = VclPtr::Create(pParentWindow, *pBase, xFrame); + pControl = VclPtr::Create(pParentWindow, *pBase, xFrame); else if (rsUIElementResourceURL.endsWith("/Layouts")) pControl = VclPtr::Create(pParentWindow, *pBase, xSidebar); else if (rsUIElementResourceURL.endsWith("/AllMasterPages")) -- cgit