20#include <com/sun/star/presentation/EffectPresetClass.hpp>
21#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
22#include <com/sun/star/animations/AnimationNodeType.hpp>
23#include <com/sun/star/animations/ParallelTimeContainer.hpp>
24#include <com/sun/star/view/XSelectionSupplier.hpp>
25#include <com/sun/star/document/XActionLockable.hpp>
26#include <com/sun/star/drawing/XDrawView.hpp>
27#include <com/sun/star/drawing/XShape.hpp>
28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/presentation/EffectNodeType.hpp>
30#include <com/sun/star/presentation/EffectCommands.hpp>
31#include <com/sun/star/animations/AnimationTransformType.hpp>
32#include <com/sun/star/text/XTextRangeCompare.hpp>
33#include <com/sun/star/container/XEnumerationAccess.hpp>
34#include <com/sun/star/container/XIndexAccess.hpp>
35#include <com/sun/star/presentation/ParagraphTarget.hpp>
36#include <com/sun/star/text/XText.hpp>
37#include <com/sun/star/drawing/LineStyle.hpp>
38#include <com/sun/star/drawing/FillStyle.hpp>
56#include <svx/svxids.hrc>
62#include <drawview.hxx>
75#include <svx/strings.hrc>
88using ::com::sun::star::view::XSelectionSupplier;
89using ::com::sun::star::beans::XPropertySet;
90using ::com::sun::star::container::XIndexAccess;
91using ::com::sun::star::container::XEnumerationAccess;
92using ::com::sun::star::container::XEnumeration;
93using ::com::sun::star::text::XText;
94using ::sd::framework::FrameworkHelper;
95using ::com::sun::star::uno::UNO_QUERY;
96using ::com::sun::star::uno::UNO_QUERY_THROW;
97using ::com::sun::star::uno::Any;
98using ::com::sun::star::uno::Reference;
99using ::com::sun::star::uno::Exception;
105 OUString aNone(
SdResId( STR_CUSTOMANIMATION_REPEAT_NONE ) );
113 OUString aUntilClick(
SdResId( STR_CUSTOMANIMATION_REPEAT_UNTIL_NEXT_CLICK ) );
116 OUString aEndOfSlide(
SdResId( STR_CUSTOMANIMATION_REPEAT_UNTIL_END_OF_SLIDE ) );
121 :
PanelLayout(pParent,
"CustomAnimationsPanel",
"modules/simpress/ui/customanimationspanel.ui")
124 , mxFTAnimation(m_xBuilder->weld_label(
"effectlabel"))
125 , mxCustomAnimationList(new
CustomAnimationList(m_xBuilder->weld_tree_view(
"custom_animation_list"),
126 m_xBuilder->weld_label(
"custom_animation_label"),
127 m_xBuilder->weld_widget(
"custom_animation_label_parent")))
128 , mxPBAddEffect(m_xBuilder->weld_button(
"add_effect"))
129 , mxPBRemoveEffect(m_xBuilder->weld_button(
"remove_effect"))
130 , mxPBMoveUp(m_xBuilder->weld_button(
"move_up"))
131 , mxPBMoveDown(m_xBuilder->weld_button(
"move_down"))
132 , mxFTCategory(m_xBuilder->weld_label(
"categorylabel"))
133 , mxLBCategory(m_xBuilder->weld_combo_box(
"categorylb"))
134 , mxFTEffect(m_xBuilder->weld_label(
"effect_label"))
135 , mxLBAnimation(m_xBuilder->weld_tree_view(
"effect_list"))
136 , mxFTStart(m_xBuilder->weld_label(
"start_effect"))
137 , mxLBStart(m_xBuilder->weld_combo_box(
"start_effect_list"))
138 , mxFTProperty(m_xBuilder->weld_label(
"effect_property"))
139 , mxPlaceholderBox(m_xBuilder->weld_container(
"placeholder"))
140 , mxPBPropertyMore(m_xBuilder->weld_button(
"more_properties"))
141 , mxFTDuration(m_xBuilder->weld_label(
"effect_duration"))
142 , mxCBXDuration(m_xBuilder->weld_metric_spin_button(
"anim_duration",
FieldUnit::
SECOND))
143 , mxFTStartDelay(m_xBuilder->weld_label(
"delay_label"))
144 , mxMFStartDelay(m_xBuilder->weld_metric_spin_button(
"delay_value",
FieldUnit::
SECOND))
145 , mxCBAutoPreview(m_xBuilder->weld_check_button(
"auto_preview"))
146 , mxPBPlay(m_xBuilder->weld_button(
"play"))
147 , maIdle(
"sd idle treeview select")
148 , mnLastSelectedAnimation(-1)
151 , mnPolygonPathPos(-1)
152 , mnFreeformPathPos(-1)
153 , maLateInitTimer(
"sd CustomAnimationPane maLateInitTimer")
161 return css::ui::LayoutSize(nMinimumHeight, -1, nMinimumHeight);
225 for (
auto const& tag : aTags)
278 switch (rEvent.meEventId)
281 onSelectionChanged();
285 onChangeCurrentPage();
292 if (mrBase.GetMainViewShell() !=
nullptr)
296 mxView = mrBase.GetDrawController();
297 onSelectionChanged();
298 onChangeCurrentPage();
305 mxCurrentPage =
nullptr;
311 onSelectionChanged();
312 onChangeCurrentPage();
315 if (mpMainSequence && rEvent.mpUserData)
316 mxCustomAnimationList->update( mpMainSequence );
324 if ( rProperty ==
u"Direction" )
327 if ( rProperty ==
u"Spokes" )
330 if ( rProperty ==
u"Zoom" )
333 if ( rProperty ==
u"Accelerate" )
336 if ( rProperty ==
u"Decelerate" )
339 if ( rProperty ==
u"Color1" )
342 if ( rProperty ==
u"Color2" )
345 if ( rProperty ==
u"FillColor" )
348 if ( rProperty ==
u"ColorStyle" )
351 if ( rProperty ==
u"AutoReverse" )
354 if ( rProperty ==
u"FontStyle" )
357 if ( rProperty ==
u"CharColor" )
360 if ( rProperty ==
u"CharHeight" )
363 if ( rProperty ==
u"CharDecoration" )
366 if ( rProperty ==
u"LineColor" )
369 if ( rProperty ==
u"Rotate" )
372 if ( rProperty ==
u"Transparency" )
375 if ( rProperty ==
u"Color" )
378 if ( rProperty ==
u"Scale" )
386 switch( nPropertyType )
389 return SdResId(STR_CUSTOMANIMATION_DIRECTION_PROPERTY);
392 return SdResId(STR_CUSTOMANIMATION_SPOKES_PROPERTY);
395 return SdResId(STR_CUSTOMANIMATION_FIRST_COLOR_PROPERTY);
398 return SdResId(STR_CUSTOMANIMATION_SECOND_COLOR_PROPERTY);
401 return SdResId(STR_CUSTOMANIMATION_ZOOM_PROPERTY);
404 return SdResId(STR_CUSTOMANIMATION_FILL_COLOR_PROPERTY);
407 return SdResId(STR_CUSTOMANIMATION_STYLE_PROPERTY);
410 return SdResId(STR_CUSTOMANIMATION_FONT_PROPERTY);
413 return SdResId(STR_CUSTOMANIMATION_SIZE_PROPERTY);
416 return SdResId(STR_CUSTOMANIMATION_FONT_COLOR_PROPERTY);
419 return SdResId(STR_CUSTOMANIMATION_FONT_SIZE_STYLE_PROPERTY);
422 return SdResId(STR_CUSTOMANIMATION_FONT_STYLE_PROPERTY);
425 return SdResId(STR_CUSTOMANIMATION_LINE_COLOR_PROPERTY);
428 return SdResId(STR_CUSTOMANIMATION_AMOUNT_PROPERTY);
431 return SdResId(STR_CUSTOMANIMATION_COLOR_PROPERTY);
434 return SdResId(STR_CUSTOMANIMATION_AMOUNT_PROPERTY);
437 return SdResId(STR_CUSTOMANIMATION_SCALE_PROPERTY);
485 bool bIsSelected = (nSelectionCount > 0);
503 mxFTStart->set_sensitive(nSelectionCount > 0);
504 mxLBStart->set_sensitive(nSelectionCount > 0);
534 std::vector<OUString>
aProperties( pDescriptor->getProperties() );
548 if (!aValue.hasValue())
563 bool bEnable = aValue.hasValue();
573 sal_Int32 nCategoryPos = -1;
574 switch(pEffect->getPresetClass())
576 case EffectPresetClass::ENTRANCE: nCategoryPos = 0;
break;
577 case EffectPresetClass::EMPHASIS: nCategoryPos = 1;
break;
578 case EffectPresetClass::EXIT: nCategoryPos = 2;
break;
579 case EffectPresetClass::MOTIONPATH: nCategoryPos = 3;
break;
583 switch(pEffect->getCommand())
585 case EffectCommands::TOGGLEPAUSE:
586 case EffectCommands::STOP:
587 case EffectCommands::PLAY:
588 nCategoryPos = 4;
break;
596 OUString rsPresetId = pEffect->getPresetId();
598 while( nAnimationPos-- )
600 auto pEntryData = weld::fromId<CustomAnimationPresetPtr*>(
mxLBAnimation->get_id(nAnimationPos));
604 if( pPtr && pPtr->getPresetId() == rsPresetId )
614 if (nAnimationPos < 0 && nCategoryPos == 3)
616 if (rsPresetId ==
"libo-motionpath-curve")
621 else if (rsPresetId ==
"libo-motionpath-polygon")
626 else if (rsPresetId ==
"libo-motionpath-freeform-line")
633 sal_uInt16
nPos = 0xffff;
635 sal_Int16 nNodeType = pEffect->getNodeType();
638 case EffectNodeType::ON_CLICK:
nPos = 0;
break;
639 case EffectNodeType::WITH_PREVIOUS:
nPos = 1;
break;
640 case EffectNodeType::AFTER_PREVIOUS:
nPos = 2;
break;
645 double fDuration = pEffect->getDuration();
646 const bool bHasSpeed = fDuration > 0.001;
660 double fBegin = pEffect->getBegin();
687 bool bEnableUp =
true;
688 bool bEnableDown =
true;
689 if( nSelectionCount == 0 )
716 if( bEnableUp || bEnableDown )
725 if( pSequence ==
nullptr )
727 pSequence = pEffect->getEffectSequence();
731 if( pSequence != pEffect->getEffectSequence() )
754 bool bChanges =
false;
755 while( aIter != aEnd )
758 if( pEffect && pEffect->getPresetClass() == css::presentation::EffectPresetClass::MOTIONPATH )
762 auto aMIter = std::find_if(rOldTags.begin(), rOldTags.end(),
764 if (aMIter != rOldTags.end())
767 if( !xTag->isDisposed() )
769 xMotionPathTag = xTag;
770 rOldTags.erase( aMIter );
775 if( !xMotionPathTag.is() )
777 xMotionPathTag.set(
new MotionPathTag( rPane, rView, pEffect ) );
781 if( xMotionPathTag.is() )
782 rNewTags.push_back( xMotionPathTag );
791 bool bChanges =
false;
802 pView = xViewShell->GetView();
809 auto rInteractiveSequenceVector =
mpMainSequence->getInteractiveSequenceVector();
825 if( bChanges && pView )
838 Reference< XSelectionSupplier > xSel(
mxView, UNO_QUERY_THROW );
856 if (rIdent ==
"onclick")
858 else if (rIdent ==
"withprev")
860 else if (rIdent ==
"afterprev")
862 else if (rIdent ==
"options")
864 else if (rIdent ==
"timing")
866 else if (rIdent ==
"remove")
873static void addValue(
const std::unique_ptr<STLPropertySet>& pSet, sal_Int32 nHandle,
const Any& rValue )
875 switch( pSet->getPropertyState(
nHandle ) )
882 if( rValue != pSet->getPropertyValue(
nHandle ) )
887 pSet->setPropertyValue(
nHandle, rValue );
894 sal_Int32 nMaxParaDepth = -1;
896 if( xTargetShape.is() )
898 Reference< XEnumerationAccess > xText( xTargetShape, UNO_QUERY );
901 Reference< XPropertySet > xParaSet;
903 Reference< XEnumeration > xEnumeration( xText->createEnumeration(), UNO_SET_THROW );
904 while( xEnumeration->hasMoreElements() )
906 xEnumeration->nextElement() >>= xParaSet;
909 sal_Int32 nParaDepth = 0;
910 xParaSet->getPropertyValue(
"NumberingLevel" ) >>= nParaDepth;
912 if( nParaDepth > nMaxParaDepth )
913 nMaxParaDepth = nParaDepth;
919 return nMaxParaDepth + 1;
929 return Any( pEffect->getPresetSubType() );
939 return pEffect->getColor(
nIndex );
943 return pEffect->getProperty( AnimationNodeType::SET,
u"CharFontName" ,
EValue::To );
947 static constexpr OUStringLiteral aAttributeName(
u"CharHeight" );
948 Any aValue( pEffect->getProperty( AnimationNodeType::SET, aAttributeName,
EValue::To ) );
949 if( !aValue.hasValue() )
950 aValue = pEffect->getProperty( AnimationNodeType::ANIMATE, aAttributeName,
EValue::To );
955 return pEffect->getTransformationProperty( AnimationTransformType::ROTATE,
EValue::By);
958 return pEffect->getProperty( AnimationNodeType::SET,
u"Opacity" ,
EValue::To );
961 return pEffect->getTransformationProperty( AnimationTransformType::SCALE,
EValue::By );
965 Sequence< Any > aValues{
966 pEffect->getProperty( AnimationNodeType::SET,
u"CharWeight" ,
EValue::To ),
967 pEffect->getProperty( AnimationNodeType::SET,
u"CharPosture" ,
EValue::To ),
968 pEffect->getProperty( AnimationNodeType::SET,
u"CharUnderline" ,
EValue::To )
970 return Any( aValues );
980 bool bEffectChanged =
false;
987 OUString aPresetSubType;
988 rValue >>= aPresetSubType;
989 if( aPresetSubType != pEffect->getPresetSubType() )
992 bEffectChanged =
true;
1005 Any aOldColor( pEffect->getColor(
nIndex ) );
1006 if( aOldColor != rValue )
1008 pEffect->setColor(
nIndex, rValue );
1009 bEffectChanged =
true;
1015 bEffectChanged = pEffect->setProperty( AnimationNodeType::SET,
u"CharFontName" ,
EValue::To, rValue );
1020 static constexpr OUStringLiteral aAttributeName(
u"CharHeight" );
1021 bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, aAttributeName,
EValue::To, rValue );
1022 if( !bEffectChanged )
1023 bEffectChanged = pEffect->setProperty( AnimationNodeType::ANIMATE, aAttributeName,
EValue::To, rValue );
1027 bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::ROTATE,
EValue::By , rValue );
1031 bEffectChanged = pEffect->setProperty( AnimationNodeType::SET,
u"Opacity" ,
EValue::To, rValue );
1035 bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::SCALE,
EValue::By, rValue );
1040 Sequence< Any > aValues(3);
1042 bEffectChanged = pEffect->setProperty( AnimationNodeType::SET,
u"CharWeight" ,
EValue::To, aValues[0] );
1043 bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET,
u"CharPosture" ,
EValue::To, aValues[1] );
1044 bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET,
u"CharUnderline" ,
EValue::To, aValues[2] );
1050 return bEffectChanged;
1057 const OUString sShapeType( xShape->getShapeType() );
1059 if( sShapeType ==
"com.sun.star.presentation.TitleTextShape" || sShapeType ==
"com.sun.star.presentation.OutlinerShape" ||
1060 sShapeType ==
"com.sun.star.presentation.SubtitleShape" || sShapeType ==
"com.sun.star.drawing.TextShape" )
1062 Reference< XPropertySet > xSet( xShape, UNO_QUERY_THROW );
1065 xSet->getPropertyValue(
"FillStyle" ) >>= eFillStyle;
1067 css::drawing::LineStyle eLineStyle;
1068 xSet->getPropertyValue(
"LineStyle" ) >>= eLineStyle;
1070 return eFillStyle != FillStyle_NONE || eLineStyle != css::drawing::LineStyle_NONE;
1085 sal_Int32 nMaxParaDepth = 0;
1092 if( !pEffectSequence )
1095 if( pEffect->hasText() )
1098 if(
n > nMaxParaDepth )
1109 float fIterateInterval =
static_cast<float>(pEffect->getIterateInterval());
1110 if( pEffect->getDuration() )
1111 fIterateInterval =
static_cast<float>(fIterateInterval / pEffect->getDuration() );
1112 fIterateInterval *= 100.0;
1129 if( pEffect->getAudio().is() )
1131 aSoundSource = pEffect->getAudio()->getSource();
1136 else if( pEffect->getCommand() == EffectCommands::STOPAUDIO )
1138 aSoundSource <<=
true;
1142 sal_Int32 nGroupId = pEffect->getGroupId();
1144 if( nGroupId != -1 )
1145 pTextGroup = pEffectSequence->
findGroup( nGroupId );
1152 if( pEffectSequence->
getSequenceType() == EffectNodeType::INTERACTIVE_SEQUENCE )
1163 std::vector<OUString>
aProperties( pDescriptor->getProperties() );
1173 if( pDescriptor->hasProperty(
u"Accelerate" ) )
1178 if( pDescriptor->hasProperty(
u"Decelerate" ) )
1183 if( pDescriptor->hasProperty(
u"AutoReverse" ) )
1198 bool bChanged =
false;
1204 DBG_ASSERT( pEffect->getEffectSequence(),
"sd::CustomAnimationPane::changeSelection(), dead effect in selection!" );
1205 if( !pEffect->getEffectSequence() )
1208 double fDuration = 0.0;
1215 fDuration = pEffect->getDuration();
1220 sal_Int16 nIterateType = 0;
1222 if( pEffect->getIterateType() != nIterateType )
1224 pEffect->setIterateType( nIterateType );
1229 if( pEffect->getIterateType() )
1233 double fIterateInterval = 0.0;
1235 if( pEffect->getIterateInterval() != fIterateInterval )
1237 const double f = fIterateInterval * pEffect->getDuration() / 100;
1238 pEffect->setIterateInterval( f );
1244 double fBegin = 0.0;
1249 fBegin = pEffect->getBegin();
1253 pEffect->setBegin( fBegin );
1259 if( pEffect->getDuration() != fDuration )
1261 pEffect->setDuration( fDuration );
1268 sal_Int16 nNodeType = 0;
1270 if( pEffect->getNodeType() != nNodeType )
1272 pEffect->setNodeType( nNodeType );
1280 if( aRepeatCount != pEffect->getRepeatCount() )
1282 pEffect->setRepeatCount( aRepeatCount );
1290 if( pEffect->getEnd() != aEndValue )
1292 pEffect->setEnd( aEndValue );
1299 sal_Int16 nFill = 0;
1301 if( pEffect->getFill() != nFill )
1303 pEffect->setFill( nFill );
1310 bool bHasAfterEffect =
false;
1313 if( pEffect->hasAfterEffect() != bHasAfterEffect )
1315 pEffect->setHasAfterEffect( bHasAfterEffect );
1323 bool bAfterEffectOnNextEffect =
false;
1325 && (pEffect->IsAfterEffectOnNext() != bAfterEffectOnNextEffect) )
1327 pEffect->setAfterEffectOnNext( bAfterEffectOnNextEffect );
1335 if( pEffect->getDimColor() != aDimColor )
1337 pEffect->setDimColor( aDimColor );
1344 double fAccelerate = 0.0;
1346 if( pEffect->getAcceleration() != fAccelerate )
1348 pEffect->setAcceleration( fAccelerate );
1355 double fDecelerate = 0.0;
1357 if( pEffect->getDecelerate() != fDecelerate )
1359 pEffect->setDecelerate( fDecelerate );
1366 bool bAutoReverse =
false;
1368 if( pEffect->getAutoReverse() != bAutoReverse )
1370 pEffect->setAutoReverse( bAutoReverse );
1377 sal_Int32
nType = 0;
1389 pEffect->setStopAudio();
1395 aSoundSource >>= aSoundURL;
1397 if( !aSoundURL.isEmpty() )
1399 if( !pEffect->getAudio().is() )
1401 pEffect->createAudio( aSoundSource );
1406 if( pEffect->getAudio()->getSource() != aSoundSource )
1408 pEffect->getAudio()->setSource( aSoundSource );
1415 if( pEffect->getAudio().is() || pEffect->getStopAudio() )
1417 pEffect->removeAudio();
1426 Reference< XShape > xTriggerShape;
1428 bChanged |=
mpMainSequence->setTrigger( pEffect, xTriggerShape );
1437 if( bHasTextGrouping || bHasAnimateForm || bHasTextGroupingAuto || bHasTextReverse )
1444 sal_Int32 nTextGrouping = 0;
1445 bool bAnimateForm =
true, bTextReverse =
false;
1446 double fTextGroupingAuto = -1.0;
1448 if( bHasTextGrouping )
1453 if( bHasAnimateForm )
1458 if( bHasTextGroupingAuto )
1463 if( bHasTextReverse )
1472 if( !pEffectSequence )
1475 sal_Int32 nGroupId = pEffect->getGroupId();
1477 if( nGroupId != -1 )
1480 pTextGroup = pEffectSequence->
findGroup( nGroupId );
1485 pTextGroup = pEffectSequence->
createTextGroup( pEffect, nTextGrouping, fTextGroupingAuto, bAnimateForm, bTextReverse );
1531 bool bDoSetAnimateFormFirst =
false;
1532 bool bNeedDoSetAnimateForm =
false;
1534 if( bHasAnimateForm )
1536 if( pTextGroup && pTextGroup->getAnimateForm() != bAnimateForm )
1538 if( (pTextGroup->getTextGrouping() >= 0) && (nTextGrouping == -1 ) )
1540 bDoSetAnimateFormFirst =
true;
1542 bNeedDoSetAnimateForm =
true;
1546 if (bDoSetAnimateFormFirst)
1552 if( bHasTextGrouping )
1554 if( pTextGroup && pTextGroup->getTextGrouping() != nTextGrouping )
1561 if (nTextGrouping == -1 && pTextGroup->getEffects().empty())
1563 pEffect->setTarget(
Any(pEffect->getTargetShape()));
1564 pEffect->setGroupId(-1);
1572 if (!bDoSetAnimateFormFirst && bNeedDoSetAnimateForm)
1581 if( bHasTextGroupingAuto )
1583 if( pTextGroup && pTextGroup->getTextGroupingAuto() != fTextGroupingAuto )
1590 if( bHasTextReverse )
1592 if( pTextGroup && pTextGroup->getTextReverse() != bTextReverse )
1613 auto xDlg = std::make_shared<CustomAnimationDialog>(
GetFrameWeld(), std::move(xSet), rPage);
1632 Reference< XDrawPage > xNewPage(
mxView->getCurrentPage() );
1651static bool getTextSelection(
const Any& rSelection, Reference< XShape >& xShape, std::vector< sal_Int16 >& rParaList )
1653 Reference< XTextRange > xSelectedText;
1654 rSelection >>= xSelectedText;
1655 if( xSelectedText.is() )
try
1657 xShape.set( xSelectedText->getText(), UNO_QUERY_THROW );
1659 css::uno::Reference<css::document::XActionLockable> xLockable(xShape, css::uno::UNO_QUERY);
1661 xLockable->addActionLock();
1665 xLockable->removeActionLock();
1668 Reference< XTextRangeCompare > xTextRangeCompare( xShape, UNO_QUERY_THROW );
1669 Reference< XEnumerationAccess > xParaEnumAccess( xShape, UNO_QUERY_THROW );
1670 Reference< XEnumeration > xParaEnum( xParaEnumAccess->createEnumeration(), UNO_SET_THROW );
1671 Reference< XTextRange > xRange;
1672 Reference< XTextRange > xStart( xSelectedText->getStart() );
1673 Reference< XTextRange > xEnd( xSelectedText->getEnd() );
1675 if( xTextRangeCompare->compareRegionEnds( xStart, xEnd ) < 0 )
1677 Reference< XTextRange > xTemp( xStart );
1682 sal_Int16 nPara = 0;
1683 while( xParaEnum->hasMoreElements() )
1685 xParaEnum->nextElement() >>= xRange;
1688 if( xRange.is() && (xTextRangeCompare->compareRegionEnds( xStart, xRange ) >= 0 ) )
1694 while( xRange.is() )
1696 if( xRange.is() && !xRange->getString().isEmpty() )
1697 rParaList.push_back( nPara );
1700 if( xRange.is() && xTextRangeCompare->compareRegionEnds( xEnd, xRange ) >= 0 )
1705 if( xParaEnum->hasMoreElements() )
1706 xParaEnum->nextElement() >>= xRange;
1723 Reference<XShape> getTargetShape(
const Any& rTarget)
1725 Reference<XShape> xShape;
1729 ParagraphTarget aParaTarget;
1730 if (rTarget >>= aParaTarget)
1731 xShape = aParaTarget.Shape;
1739 bool bHasText =
true;
1742 std::vector< Any > aTargets;
1745 Reference< XSelectionSupplier > xSel(
mxView, UNO_QUERY_THROW );
1750 Reference< XIndexAccess > xShapes;
1753 sal_Int32
nCount = xShapes->getCount();
1754 aTargets.reserve(
nCount );
1757 Any aTarget( xShapes->getByIndex(
nIndex ) );
1758 aTargets.push_back( aTarget );
1761 Reference< XText > xText;
1763 if( !xText.is() || xText->getString().isEmpty() )
1771 Reference< XText > xText;
1773 if( !xText.is() || xText->getString().isEmpty() )
1778 Reference< XShape > xShape;
1779 std::vector< sal_Int16 > aParaList;
1782 ParagraphTarget aParaTarget;
1783 aParaTarget.Shape = xShape;
1785 for(
const auto& rPara : aParaList )
1787 aParaTarget.Paragraph = rPara;
1788 aTargets.push_back(
Any( aParaTarget ) );
1794 OSL_FAIL(
"sd::CustomAnimationPane::onAdd(), unknown view selection!" );
1802 bool bCategoryReset =
false;
1808 bCategoryReset =
true;
1817 if (nFirstEffect == -1)
1824 auto pEntryData = weld::fromId<CustomAnimationPresetPtr*>(
mxLBAnimation->get_selected_id());
1826 pDescriptor = *pEntryData;
1830 const double fDuration = pDescriptor->getDuration();
1832 bool bHasSpeed = pDescriptor->getDuration() > 0.001;
1840 for(
const auto&
rTarget : aTargets )
1842 css::uno::Reference<css::document::XActionLockable> xLockable(getTargetShape(
rTarget), css::uno::UNO_QUERY);
1844 xLockable->addActionLock();
1848 xLockable->removeActionLock();
1854 if( bHasText && (aTargets.size() == 1) )
1856 Reference< XShape > xShape(
rTarget, UNO_QUERY );
1859 mpMainSequence->createTextGroup( pCreated, 1, -1.0,
false,
false );
1866 pCreated->setNodeType( EffectNodeType::WITH_PREVIOUS );
1902 if( pEffect->getEffectSequence() )
1903 pEffect->getEffectSequence()->remove( pEffect );
1912 if( pEffect->getEffectSequence() )
1915 pEffect->getEffectSequence()->remove( pEffect );
1922 sal_Int16 nNodeType;
1925 case 0: nNodeType = EffectNodeType::ON_CLICK;
break;
1926 case 1: nNodeType = EffectNodeType::WITH_PREVIOUS;
break;
1927 case 2: nNodeType = EffectNodeType::AFTER_PREVIOUS;
break;
1941 bool bNeedRebuild =
false;
1945 if( pEffect->getNodeType() != nNodeType )
1947 pEffect->setNodeType( nNodeType );
1948 bNeedRebuild =
true;
1975 pEffect->setDuration( fDuration );
1986 double fDuration = 0;
1989 fDuration =
mxCBXDuration->get_value(FieldUnit::NONE) / 100.0;
2021 sal_uInt16 nSID = 0;
2035 FrameworkHelper::Instance(
mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
2043 std::vector< Any > aTargets( 1,
Any( fDuration ) );
2044 aTargets.insert( aTargets.end(), rTargets.begin(), rTargets.end() );
2055 if (!mxLBSubControl)
2062 const Any aValue(mxLBSubControl->getValue());
2064 bool bNeedUpdate =
false;
2069 if( setProperty1Value( mnPropertyType, pEffect, aValue ) )
2075 mpMainSequence->rebuild();
2077 mrBase.GetDocShell()->SetModified();
2090 double fBegin = mxMFStartDelay->get_value(FieldUnit::NONE);
2098 pEffect->setBegin( fBegin/10.0 );
2101 mpMainSequence->rebuild();
2103 mrBase.GetDocShell()->SetModified();
2113 if (mxLBAnimation->has_grab())
2119 int nSelected = mxLBAnimation->get_selected_index();
2120 if (nSelected == -1)
2125 if (mxLBAnimation->get_text_emphasis(nSelected, 0))
2127 if (nSelected == 0 || nSelected > mnLastSelectedAnimation)
2128 mxLBAnimation->select(++nSelected);
2130 mxLBAnimation->select(--nSelected);
2133 mnLastSelectedAnimation = nSelected;
2136 PathKind ePathKind = getCreatePathKind();
2140 std::vector< Any > aTargets;
2145 aTargets.push_back( pEffect->getTarget() );
2148 if( !pEffectSequence )
2149 pEffectSequence = mpMainSequence.get();
2153 pEffectSequence->
remove( pEffect );
2156 createPath( ePathKind, aTargets, 0.0 );
2157 updateMotionPathTags();
2162 const double fDuration = (*pPreset)->getDuration();
2169 if (pEffect->getPresetClass() == css::presentation::EffectPresetClass::MOTIONPATH)
2171 for (
auto const& xTag: maMotionPathTags)
2173 if(xTag->getEffect() == pEffect && !xTag->isDisposed())
2179 if( !pEffectSequence )
2180 pEffectSequence = mpMainSequence.get();
2182 pEffectSequence->
replace( pEffect, pDescriptor, fDuration );
2193 fillAnimationLB( pEffect->hasText() );
2198 if (!mxCBXDuration->get_text().isEmpty())
2200 double duration_value =
static_cast<double>(mxCBXDuration->get_value(FieldUnit::NONE));
2201 if(duration_value <= 0.0)
2203 mxCBXDuration->set_value(1, FieldUnit::NONE);
2211 void InsertCategory(
weld::TreeView& rLBAnimation,
const OUString& rMotionPathLabel)
2234 sal_Int32 nFirstEffect = -1;
2245 OUString sMotionPathLabel(
SdResId( STR_CUSTOMANIMATION_USERPATH ) );
2266 std::vector< CustomAnimationPresetPtr > aSortedVector =
2267 pCategory->maEffects;
2272 if( pDescriptor && ( !pDescriptor->isTextOnly() || bHasText ) )
2279 if (nFirstEffect == -1)
2280 nFirstEffect =
nPos;
2293 return nFirstEffect;
2298 implControlHdl(&rBtn);
2303 implControlHdl(&rBtn);
2308 implControlHdl(&rListBox);
2326 else if (pControl ==
mxPBPlay.get())
2342 onSelectionChanged();
2351 if( pSequence ==
nullptr )
2356 bool bChanged =
false;
2365 EffectSequence::iterator aUpEffectPos( pSequence->
find( pEffect ) );
2367 if( aUpEffectPos != rEffectSequence.end() )
2369 EffectSequence::iterator aInsertPos( rEffectSequence.erase( aUpEffectPos ) );
2371 if( aInsertPos != rEffectSequence.begin() )
2376 rEffectSequence.insert( aInsertPos, pEffect );
2380 rEffectSequence.push_front( pEffect );
2389 const EffectSequence::reverse_iterator aEnd(
maListSelection.rend() );
2391 while( aIter != aEnd )
2395 EffectSequence::iterator aDownEffectPos( pSequence->
find( pEffect ) );
2397 if( aDownEffectPos != rEffectSequence.end() )
2399 EffectSequence::iterator aInsertPos( rEffectSequence.erase( aDownEffectPos ) );
2401 if( aInsertPos != rEffectSequence.end() )
2405 while( (aInsertPos != rEffectSequence.end())
2411 rEffectSequence.insert( aInsertPos, pEffect );
2415 rEffectSequence.push_back( pEffect );
2443 [](
const MotionPathTagVector::value_type& rxMotionPathTag) { return rxMotionPathTag->isSelected(); });
2445 xMotionPathTag = *aIter;
2447 if( xMotionPathTag.is() )
2450 pSequence->append( xMotionPathTag->getEffect()->clone() );
2451 preview( pSequence->getRootNode() );
2455 Reference< XAnimationNodeSupplier > xNodeSupplier(
mxCurrentPage, UNO_QUERY );
2456 if( !xNodeSupplier.is() )
2459 preview( xNodeSupplier->getAnimationNode() );
2468 pSequence->append( pEffect->clone() );
2471 preview( pSequence->getRootNode() );
2477 Reference< XParallelTimeContainer > xRoot = ParallelTimeContainer::create( ::comphelper::getProcessComponentContext() );
2478 Sequence< css::beans::NamedValue > aUserData
2479 { {
"node-type", css::uno::Any(css::presentation::EffectNodeType::TIMING_ROOT) } };
2480 xRoot->setUserData( aUserData );
2481 xRoot->appendChild( xAnimationNode );
2503 FrameworkHelper::Instance(
mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
2511 Reference< XShape > xShape( pEffect->getTargetShape() );
2531 for(
auto const& pEffectDragged : pEffectsDragged )
2534 EffectSequence::iterator aIter =
mpMainSequence->find( pEffectDragged );
2537 while( aIter != aEnd )
2543 mpMainSequence->moveToBeforeEffect( pEffect, pEffectInsertBefore );
2562 if( (pPathObj !=
nullptr) && pEffect )
2572 pEffect->updatePathFromSdrPathObj( *pPathObj );
@ EditViewSelection
The selection in the center pane has changed.
@ Disposing
The EventMultiplexer itself is being disposed.
@ EndTextEdit
Text editing in one of the shapes in the MainViewShell has ended.
@ MainViewRemoved
The current MainViewShell (the ViewShell displayed in the center pane) has been removed.
@ MainViewAdded
A new ViewShell has been made the MainViewShell.
@ CurrentPageChanged
The current page has changed.
PropertiesInfo aProperties
virtual weld::Window * GetFrameWeld() const
Size get_preferred_size() const
bool IsPreviewChangedEffects() const
void SetPreviewChangedEffects(bool bOn)
static SdPage * getImplementation(const css::uno::Reference< css::drawing::XDrawPage > &xPage)
returns the SdPage implementation for the given XDrawPage or 0 if not available
std::shared_ptr< sd::MainSequence > const & getMainSequence()
returns a helper class to manipulate effects inside the main sequence
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
SdrPageView * GetSdrPageView() const
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
SfxDispatcher * GetDispatcher()
css::uno::Reference< css::frame::XController > GetController() const
constexpr tools::Long Height() const
void SetPriority(TaskPriority ePriority)
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
static std::unique_ptr< STLPropertySet > createDefaultSet()
virtual ~CustomAnimationPane() override
std::unique_ptr< weld::TreeView > mxLBAnimation
sal_Int32 mnPolygonPathPos
void updateMotionPathTags()
MainSequencePtr mpMainSequence
std::unique_ptr< weld::MetricSpinButton > mxCBXDuration
void createPath(PathKind eKind, std::vector< ::com::sun::star::uno::Any > &rTargets, double fDuration)
virtual void onDragNDropComplete(std::vector< CustomAnimationEffectPtr > pEffectsDragged, CustomAnimationEffectPtr pEffectInsertBefore) override
void preview(const css::uno::Reference< css::animations::XAnimationNode > &xAnimationNode)
void onPreview(bool bForcePreview)
std::unique_ptr< weld::Button > mxPBAddEffect
std::unique_ptr< weld::Label > mxFTDuration
std::unique_ptr< weld::Label > mxFTCategory
void changeSelection(STLPropertySet const *pResultSet, STLPropertySet const *pOldSet)
ScopeLock maSelectionLock
std::unique_ptr< weld::Button > mxPBPlay
std::unique_ptr< SdPropertySubControl > mxLBSubControl
static bool setProperty1Value(sal_Int32 nType, const CustomAnimationEffectPtr &pEffect, const css::uno::Any &rValue)
virtual void onDoubleClick() override
sal_Int32 fillAnimationLB(bool bHasText)
std::unique_ptr< CustomAnimationList > mxCustomAnimationList
EffectSequence maListSelection
double getDuration() const
sal_Int32 mnFreeformPathPos
std::unique_ptr< weld::Label > mxFTProperty
MotionPathTagVector maMotionPathTags
Timer maLateInitTimer
The CustomAnimationPresets is initialized either on demand or after a short time after the constructi...
static sal_Int32 const gnMotionPathPos
virtual void onSelect() override
std::unique_ptr< weld::MetricSpinButton > mxMFStartDelay
void showOptions(const OUString &sPage={})
css::uno::Reference< css::drawing::XDrawView > mxView
std::unique_ptr< weld::Label > mxFTStart
sal_Int32 mnLastSelectedAnimation
std::unique_ptr< weld::Button > mxPBMoveUp
PathKind getCreatePathKind() const
std::unique_ptr< weld::Label > mxFTStartDelay
std::unique_ptr< STLPropertySet > createSelectionSet()
void onSelectionChanged()
css::uno::Reference< css::drawing::XDrawPage > mxCurrentPage
std::unique_ptr< weld::ComboBox > mxLBStart
css::uno::Any maViewSelection
std::unique_ptr< weld::Label > mxFTAnimation
std::unique_ptr< weld::Button > mxPBRemoveEffect
void implControlHdl(const weld::Widget *pControl)
this link is called when one of the controls is modified
void updatePathFromMotionPathTag(const rtl::Reference< MotionPathTag > &xTag)
std::unique_ptr< weld::CheckButton > mxCBAutoPreview
std::unique_ptr< weld::Button > mxPBMoveDown
void moveSelection(bool bUp)
std::unique_ptr< weld::ComboBox > mxLBCategory
std::unique_ptr< weld::Button > mxPBPropertyMore
std::unique_ptr< weld::Label > mxFTEffect
CustomAnimationPane(weld::Widget *pParent, ViewShellBase &rBase)
void onChangeCurrentPage()
std::unique_ptr< weld::Container > mxPlaceholderBox
void remove(CustomAnimationEffectPtr const &pEffect)
virtual void onContextMenu(const OUString &rIdent) override
virtual css::ui::LayoutSize GetHeightForWidth(const sal_Int32 nWidth) override
static css::uno::Any getProperty1Value(sal_Int32 nType, const CustomAnimationEffectPtr &pEffect)
SAL_DLLPRIVATE const PresetCategoryList & getEmphasisPresets() const
SAL_DLLPRIVATE void changePresetSubType(const CustomAnimationEffectPtr &pEffect, const OUString &rPresetSubType) const
SAL_DLLPRIVATE const PresetCategoryList & getMotionPathsPresets() const
SAL_DLLPRIVATE const PresetCategoryList & getExitPresets() const
CustomAnimationPresetPtr getEffectDescriptor(const OUString &rPresetId) const
static const CustomAnimationPresets & getCustomAnimationPresets()
This method gets presets instance, which is localized for the current user's locale.
SAL_DLLPRIVATE const PresetCategoryList & getMiscPresets() const
SAL_DLLPRIVATE const PresetCategoryList & getEntrancePresets() const
virtual SfxUndoManager * GetUndoManager() override
virtual void SetModified(bool=true) override
SdDrawDocument * GetDoc()
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
DrawView * GetDrawView() const
Derivative of sd::View; contains also a pointer to the document.
SAL_DLLPRIVATE void setTextGroupingAuto(const CustomAnimationTextGroupPtr &pTextGroup, double fTextGroupingAuto)
SAL_DLLPRIVATE void replace(const CustomAnimationEffectPtr &pEffect, const CustomAnimationPresetPtr &pDescriptor, double fDuration)
SAL_DLLPRIVATE sal_Int32 getSequenceType() const
SAL_DLLPRIVATE const css::uno::Reference< css::drawing::XShape > & getTriggerShape() const
SAL_DLLPRIVATE void setTextGrouping(const CustomAnimationTextGroupPtr &pTextGroup, sal_Int32 nTextGrouping)
SAL_DLLPRIVATE EffectSequence::iterator find(const CustomAnimationEffectPtr &pEffect)
CustomAnimationTextGroupPtr createTextGroup(const CustomAnimationEffectPtr &pEffect, sal_Int32 nTextGrouping, double fTextGroupingAuto, bool bAnimateForm, bool bTextReverse)
SAL_DLLPRIVATE void setTextReverse(const CustomAnimationTextGroupPtr &pTextGroup, bool bAnimateForm)
SAL_DLLPRIVATE EffectSequence & getSequence()
SAL_DLLPRIVATE CustomAnimationTextGroupPtr findGroup(sal_Int32 nGroupId)
SAL_DLLPRIVATE void setAnimateForm(const CustomAnimationTextGroupPtr &pTextGroup, bool bAnimateForm)
SAL_DLLPRIVATE void remove(const CustomAnimationEffectPtr &pEffect)
Base class for all functions.
STLPropertyState getPropertyState(sal_Int32 nHandle) const
css::uno::Any getPropertyValue(sal_Int32 nHandle) const
static std::unique_ptr< SdPropertySubControl > create(sal_Int32 nType, weld::Label *pLabel, weld::Container *pParent, weld::Window *pTopLevel, const css::uno::Any &rValue, const OUString &rPresetId, const Link< LinkParamNone *, void > &rModifyHdl)
static void Stop(ViewShellBase const &rBase)
static bool StartPreview(ViewShellBase const &rBase, const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage, const css::uno::Reference< css::animations::XAnimationNode > &xAnimationNode)
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
std::shared_ptr< ViewShell > GetMainViewShell() const
Return the main view shell stacked on the called ViewShellBase object.
std::shared_ptr< tools::EventMultiplexer > const & GetEventMultiplexer() const
Return an event multiplexer.
DrawDocShell * GetDocShell() const
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
void append_text(const OUString &rStr)
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
virtual void set_text_align(int row, double fAlign, int col)=0
void append_text(const OUString &rStr)
virtual int n_children() const=0
virtual void set_text_emphasis(int row, bool bOn, int col)=0
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
SVXCORE_DLLPUBLIC OUString SvxResId(TranslateId aId)
#define LINK(Instance, Class, Member)
enum SAL_DLLPUBLIC_RTTI FillStyle
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
const sal_Int32 nHandleEnd
std::list< CustomAnimationEffectPtr > EffectSequence
const sal_Int32 nPropertyTypeFillColor
const sal_Int32 nHandleTrigger
static void addValue(const std::unique_ptr< STLPropertySet > &pSet, sal_Int32 nHandle, const Any &rValue)
const sal_Int32 nPropertyTypeDirection
const sal_Int32 nHandleProperty1Type
IMPL_LINK_NOARG(MainSequence, onTimerHdl, Timer *, void)
const sal_Int32 nHandleIterateType
const sal_Int32 nPropertyTypeAutoReverse
const sal_Int32 nHandleRepeat
const sal_Int32 nPropertyTypeZoom
const sal_Int32 nPropertyTypeScale
void fillRepeatComboBox(weld::ComboBox &rBox)
static bool hasVisibleShape(const Reference< XShape > &xShape)
const sal_Int32 nPropertyTypeFont
const sal_Int32 nHandleCurrentPage
const sal_Int32 nPropertyTypeSpokes
const sal_Int32 nPropertyTypeColorStyle
std::shared_ptr< MainSequence > MainSequencePtr
const sal_Int32 nHandleBegin
const sal_Int32 nPropertyTypeCharHeightStyle
const sal_Int32 nPropertyTypeSecondColor
std::vector< PresetCategoryPtr > PresetCategoryList
const sal_Int32 nHandleDimColor
const sal_Int32 nPropertyTypeLineColor
std::shared_ptr< CustomAnimationTextGroup > CustomAnimationTextGroupPtr
std::vector< rtl::Reference< MotionPathTag > > MotionPathTagVector
std::shared_ptr< InteractiveSequence > InteractiveSequencePtr
std::shared_ptr< CustomAnimationPreset > CustomAnimationPresetPtr
const sal_Int32 nHandleAccelerate
const sal_Int32 nHandleSoundVolume
const sal_Int32 nPropertyTypeColor
const sal_Int32 nHandleAfterEffectOnNextEffect
const sal_Int32 nHandlePresetId
const sal_Int32 nHandleSoundURL
const sal_Int32 nHandleTextGroupingAuto
const sal_Int32 nHandleDecelerate
const sal_Int32 nHandleTextGrouping
const sal_Int32 nPropertyTypeFirstColor
const sal_Int32 nHandleIterateInterval
const sal_Int32 nHandleStart
const sal_Int32 nHandleHasVisibleShape
OUString getPropertyName(sal_Int32 nPropertyType)
IMPL_LINK(SdCharHeightPropertyBox, implMenuSelectHdl, const OUString &, rIdent, void)
std::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr
static bool updateMotionPathImpl(CustomAnimationPane &rPane, ::sd::View &rView, EffectSequence::iterator aIter, const EffectSequence::iterator &aEnd, MotionPathTagVector &rOldTags, MotionPathTagVector &rNewTags)
std::shared_ptr< PresetCategory > PresetCategoryPtr
const sal_Int32 nPropertyTypeCharDecoration
const sal_Int32 nHandleHasText
const sal_Int32 nPropertyTypeCharHeight
const sal_Int32 nHandleAutoReverse
const sal_Int32 nHandleRewind
const sal_Int32 nHandleMaxParaDepth
const sal_Int32 nHandleProperty1Value
const sal_Int32 nPropertyTypeRotate
static bool getTextSelection(const Any &rSelection, Reference< XShape > &xShape, std::vector< sal_Int16 > &rParaList)
const sal_Int32 nHandleDuration
const sal_Int32 nPropertyTypeAccelerate
const sal_Int32 nHandleTextReverse
const sal_Int32 nPropertyTypeCharColor
const sal_Int32 nHandleAnimateForm
const sal_Int32 nPropertyTypeDecelerate
const sal_Int32 nPropertyTypeNone
const sal_Int32 nHandleHasAfterEffect
static sal_Int32 getPropertyType(std::u16string_view rProperty)
const sal_Int32 nPropertyTypeTransparency
static sal_Int32 calcMaxParaDepth(const Reference< XShape > &xTargetShape)
OUString toId(const void *pValue)
OUString SdResId(TranslateId aId)
uno::Reference< presentation::XSlideShowView > mxView