summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd/inc/app.hrc1
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.cxx105
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.hxx2
-rw-r--r--sd/source/ui/func/fuconbez.cxx13
-rw-r--r--sd/source/ui/inc/fuconbez.hxx1
5 files changed, 113 insertions, 9 deletions
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 4dfb5122295e..58f0d0bf7afe 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -445,6 +445,7 @@
// Add companion for the SID_HIDE_SLIDE (that is defined in svx)
#define SID_SHOW_SLIDE (SID_SD_START+441)
+#define SID_ADD_MOTION_PATH (SID_SD_START+442)
// FREE
#define SID_ZOOM_MODE (SID_SD_START+447)
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 86c77ac79387..20bd4c1f23fa 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -1988,6 +1988,63 @@ double CustomAnimationPane::getDuration()
return fDuration;
}
+PathKind CustomAnimationPane::getCreatePathKind() const
+{
+ PathKind eKind = PathKind::NONE;
+
+ if( mpLBAnimation->GetSelectEntryCount() == 1 )
+ {
+ const sal_Int32 nPos = mpLBAnimation->GetSelectEntryPos();
+ if( nPos == mnCurvePathPos )
+ {
+ eKind = PathKind::CURVE;
+ }
+ else if( nPos == mnPolygonPathPos )
+ {
+ eKind = PathKind::POLYGON;
+ }
+ else if( nPos == mnFreeformPathPos )
+ {
+ eKind = PathKind::FREEFORM;
+ }
+ }
+
+ return eKind;
+}
+
+void CustomAnimationPane::createPath( PathKind eKind, std::vector< Any >& rTargets, double fDuration)
+{
+ sal_uInt16 nSID = 0;
+
+ switch( eKind )
+ {
+ case PathKind::CURVE: nSID = SID_DRAW_BEZIER_NOFILL; break;
+ case PathKind::POLYGON: nSID = SID_DRAW_POLYGON_NOFILL; break;
+ case PathKind::FREEFORM: nSID = SID_DRAW_FREELINE_NOFILL; break;
+ default: break;
+ }
+
+ if( nSID )
+ {
+ DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >(
+ FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
+
+ if( pViewShell )
+ {
+ DrawView* pView = pViewShell->GetDrawView();
+ if( pView )
+ pView->UnmarkAllObj();
+
+ std::vector< Any > aTargets( 1, Any( fDuration ) );
+ aTargets.insert( aTargets.end(), rTargets.begin(), rTargets.end() );
+ Sequence< Any > aTargetSequence( comphelper::containerToSequence( aTargets ) );
+ const SfxUnoAnyItem aItem( SID_ADD_MOTION_PATH, Any( aTargetSequence ) );
+ pViewShell->GetViewFrame()->GetDispatcher()->ExecuteList( nSID, SfxCallMode::ASYNCHRON, {&aItem} );
+ }
+ }
+}
+
+
/// this link is called when the property box is modified by the user
IMPL_LINK_NOARG(CustomAnimationPane, implPropertyHdl, LinkParamNone*, void)
{
@@ -2054,17 +2111,45 @@ IMPL_LINK_NOARG(CustomAnimationPane, AnimationSelectHdl, ListBox&, void)
if( maListSelection.size() == 1 )
{
CustomAnimationPresetPtr* pPreset = static_cast< CustomAnimationPresetPtr* >(mpLBAnimation->GetSelectEntryData());
+ PathKind ePathKind = getCreatePathKind();
+
// tdf#99137, the selected entry may also be a subcategory title, so not an effect
// just leave in this case
- if (!pPreset)
+ if ( !pPreset && ( ePathKind == PathKind::NONE ) )
return;
- const double fDuration = (*pPreset)->getDuration();
+
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+
+ if ( ePathKind != PathKind::NONE )
+ {
+ std::vector< Any > aTargets;
+ MainSequenceRebuildGuard aGuard( mpMainSequence );
+
+ while( aIter != aEnd )
+ {
+ aTargets.push_back( (*aIter)->getTarget() );
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+
+ EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
+ if( !pEffectSequence )
+ pEffectSequence = mpMainSequence.get();
+
+ // delete the old animation, new one will be appended
+ // by createPath and SID_ADD_MOTION_PATH therein
+ pEffectSequence->remove( pEffect );
+ }
+
+ createPath( ePathKind, aTargets, 0.0 );
+ updateMotionPathTags();
+ return;
+ }
+
CustomAnimationPresetPtr pDescriptor(*pPreset);
+ const double fDuration = (*pPreset)->getDuration();
MainSequenceRebuildGuard aGuard( mpMainSequence );
// get selected effect
- EffectSequence::iterator aIter( maListSelection.begin() );
- const EffectSequence::iterator aEnd( maListSelection.end() );
while( aIter != aEnd )
{
CustomAnimationEffectPtr pEffect = (*aIter++);
@@ -2075,6 +2160,7 @@ IMPL_LINK_NOARG(CustomAnimationPane, AnimationSelectHdl, ListBox&, void)
pEffectSequence->replace( pEffect, pDescriptor, fDuration );
}
+
onPreview(false);
}
}
@@ -2115,18 +2201,19 @@ sal_uInt32 CustomAnimationPane::fillAnimationLB( bool bHasText )
sal_uInt32 nFirstEffect = LISTBOX_ENTRY_NOTFOUND;
- if(nPosition == 0)
+ PresetCategoryList::const_iterator aCategoryIter( rCategoryList.begin() );
+ const PresetCategoryList::const_iterator aCategoryEnd( rCategoryList.end() );
+ mpLBAnimation->Clear();
+
+ if(nPosition == 3)
{
OUString sMotionPathLabel( SD_RESSTR( STR_CUSTOMANIMATION_USERPATH ) );
mpLBAnimation->InsertCategory( sMotionPathLabel );
mnCurvePathPos = mpLBAnimation->InsertEntry( sdr::GetResourceString(STR_ObjNameSingulCOMBLINE) );
mnPolygonPathPos = mpLBAnimation->InsertEntry( sdr::GetResourceString(STR_ObjNameSingulPOLY) );
mnFreeformPathPos = mpLBAnimation->InsertEntry( sdr::GetResourceString(STR_ObjNameSingulFREELINE) );
-
}
- PresetCategoryList::const_iterator aCategoryIter( rCategoryList.begin() );
- const PresetCategoryList::const_iterator aCategoryEnd( rCategoryList.end() );
- mpLBAnimation->Clear();
+
while(aCategoryIter != aCategoryEnd)
{
PresetCategoryPtr pCategory( *aCategoryIter++ );
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx
index 12e2cd9f9a35..5a5302390a1d 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -117,6 +117,8 @@ private:
bool setProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect, const css::uno::Any& rValue );
void UpdateLook();
sal_uInt32 fillAnimationLB( bool bHasText );
+ PathKind getCreatePathKind() const;
+ void createPath( PathKind eKind, std::vector< ::com::sun::star::uno::Any >& rTargets, double fDuration );
DECL_LINK( implControlListBoxHdl, ListBox&, void );
DECL_LINK( implClickHdl, Button*, void );
diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
index 18fc19bd1860..1de24b2bf9c9 100644
--- a/sd/source/ui/func/fuconbez.cxx
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -70,6 +70,19 @@ rtl::Reference<FuPoor> FuConstructBezierPolygon::Create( ViewShell* pViewSh, ::s
return xFunc;
}
+void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if( pArgs )
+ {
+ const SfxPoolItem* pPoolItem = nullptr;
+ if( SfxItemState::SET == pArgs->GetItemState( SID_ADD_MOTION_PATH, true, &pPoolItem ) )
+ maTargets = static_cast<const SfxUnoAnyItem*>( pPoolItem )->GetValue();
+ }
+}
+
bool FuConstructBezierPolygon::MouseButtonDown(const MouseEvent& rMEvt)
{
bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
diff --git a/sd/source/ui/inc/fuconbez.hxx b/sd/source/ui/inc/fuconbez.hxx
index 4530b9de7147..ebf9bc32e00f 100644
--- a/sd/source/ui/inc/fuconbez.hxx
+++ b/sd/source/ui/inc/fuconbez.hxx
@@ -33,6 +33,7 @@ class FuConstructBezierPolygon
public:
static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent );
+ void DoExecute( SfxRequest& rReq ) override;
// Mouse- & Key-Events
virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;