15b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 55b190011SAndrew Rist * distributed with this work for additional information 65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 85b190011SAndrew Rist * "License"); you may not use this file except in compliance 95b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 145b190011SAndrew Rist * software distributed under the License is distributed on an 155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 165b190011SAndrew Rist * KIND, either express or implied. See the License for the 175b190011SAndrew Rist * specific language governing permissions and limitations 185b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 205b190011SAndrew Rist *************************************************************/ 215b190011SAndrew Rist 225b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/presentation/EffectPresetClass.hpp> 28cdf0e10cSrcweir #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> 29cdf0e10cSrcweir #include <com/sun/star/view/XSelectionSupplier.hpp> 30cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp> 31cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp> 32cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 33cdf0e10cSrcweir #include <com/sun/star/presentation/EffectNodeType.hpp> 34cdf0e10cSrcweir #include <com/sun/star/presentation/EffectCommands.hpp> 35cdf0e10cSrcweir #include <com/sun/star/animations/AnimationTransformType.hpp> 36cdf0e10cSrcweir #include <com/sun/star/text/XTextRangeCompare.hpp> 37cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp> 38cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp> 39cdf0e10cSrcweir #include <com/sun/star/presentation/ParagraphTarget.hpp> 40cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp> 41cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 42cdf0e10cSrcweir #include <com/sun/star/drawing/LineStyle.hpp> 43cdf0e10cSrcweir #include <com/sun/star/drawing/FillStyle.hpp> 44cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 45cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 46cdf0e10cSrcweir #include "STLPropertySet.hxx" 47cdf0e10cSrcweir #include "CustomAnimationPane.hxx" 48cdf0e10cSrcweir #include "CustomAnimationDialog.hxx" 49cdf0e10cSrcweir #include "CustomAnimationCreateDialog.hxx" 50cdf0e10cSrcweir #include "CustomAnimationPane.hrc" 51cdf0e10cSrcweir #include "CustomAnimation.hrc" 52cdf0e10cSrcweir #include "CustomAnimationList.hxx" 53cdf0e10cSrcweir #include <vcl/lstbox.hxx> 54cdf0e10cSrcweir #include <vcl/fixed.hxx> 55cdf0e10cSrcweir 56cdf0e10cSrcweir #include <vcl/button.hxx> 57cdf0e10cSrcweir #include <vcl/combobox.hxx> 58cdf0e10cSrcweir #include <vcl/scrbar.hxx> 59cdf0e10cSrcweir 60cdf0e10cSrcweir #include <comphelper/sequence.hxx> 61cdf0e10cSrcweir #include <sfx2/frame.hxx> 62*7a32b0c8SAndre Fischer #include <sfx2/sidebar/Theme.hxx> 63cdf0e10cSrcweir 64cdf0e10cSrcweir #include <svx/unoapi.hxx> 65cdf0e10cSrcweir #include <svx/svxids.hrc> 66cdf0e10cSrcweir #include <DrawDocShell.hxx> 67cdf0e10cSrcweir #include <ViewShellBase.hxx> 68cdf0e10cSrcweir #include "DrawViewShell.hxx" 69cdf0e10cSrcweir #include "DrawController.hxx" 70cdf0e10cSrcweir #include "sdresid.hxx" 71cdf0e10cSrcweir #include "drawview.hxx" 72cdf0e10cSrcweir #include "slideshow.hxx" 73cdf0e10cSrcweir #include "undoanim.hxx" 74cdf0e10cSrcweir #include "optsitem.hxx" 75cdf0e10cSrcweir #include "sddll.hxx" 76cdf0e10cSrcweir #include "framework/FrameworkHelper.hxx" 77cdf0e10cSrcweir 78cdf0e10cSrcweir #include "EventMultiplexer.hxx" 79cdf0e10cSrcweir #include "DialogListBox.hxx" 80cdf0e10cSrcweir 81cdf0e10cSrcweir #include "glob.hrc" 82cdf0e10cSrcweir #include "sdpage.hxx" 83cdf0e10cSrcweir #include "drawdoc.hxx" 84cdf0e10cSrcweir #include "app.hrc" 85cdf0e10cSrcweir 86cdf0e10cSrcweir #include <memory> 87cdf0e10cSrcweir #include <algorithm> 88cdf0e10cSrcweir 89cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx> 90cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 91cdf0e10cSrcweir #include <basegfx/range/b2drange.hxx> 92cdf0e10cSrcweir 93cdf0e10cSrcweir using namespace ::com::sun::star; 94cdf0e10cSrcweir using namespace ::com::sun::star::animations; 95cdf0e10cSrcweir using namespace ::com::sun::star::presentation; 96cdf0e10cSrcweir using namespace ::com::sun::star::text; 97cdf0e10cSrcweir 98cdf0e10cSrcweir using ::rtl::OUString; 99cdf0e10cSrcweir using namespace ::com::sun::star::uno; 100cdf0e10cSrcweir using namespace ::com::sun::star::drawing; 101cdf0e10cSrcweir using ::com::sun::star::view::XSelectionSupplier; 102cdf0e10cSrcweir using ::com::sun::star::view::XSelectionChangeListener; 103cdf0e10cSrcweir using ::com::sun::star::frame::XController; 104cdf0e10cSrcweir using ::com::sun::star::frame::XModel; 105cdf0e10cSrcweir using ::com::sun::star::beans::XPropertySet; 106cdf0e10cSrcweir using ::com::sun::star::beans::XPropertyChangeListener; 107cdf0e10cSrcweir using ::com::sun::star::container::XIndexAccess; 108cdf0e10cSrcweir using ::com::sun::star::container::XEnumerationAccess; 109cdf0e10cSrcweir using ::com::sun::star::container::XEnumeration; 110cdf0e10cSrcweir using ::com::sun::star::text::XText; 111cdf0e10cSrcweir using ::sd::framework::FrameworkHelper; 112cdf0e10cSrcweir 113cdf0e10cSrcweir namespace sd { 114cdf0e10cSrcweir 115cdf0e10cSrcweir // -------------------------------------------------------------------- 116cdf0e10cSrcweir 117cdf0e10cSrcweir void fillDurationComboBox( ComboBox* pBox ) 118cdf0e10cSrcweir { 119cdf0e10cSrcweir static const double gdVerySlow = 5.0; 120cdf0e10cSrcweir static const double gdSlow = 3.0; 121cdf0e10cSrcweir static const double gdNormal = 2.0; 122cdf0e10cSrcweir static const double gdFast = 1.0; 123cdf0e10cSrcweir static const double gdVeryFast = 0.5; 124cdf0e10cSrcweir 125cdf0e10cSrcweir String aVerySlow( SdResId( STR_CUSTOMANIMATION_DURATION_VERY_SLOW ) ); 126cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( aVerySlow ), (void*)&gdVerySlow ); 127cdf0e10cSrcweir 128cdf0e10cSrcweir String aSlow( SdResId( STR_CUSTOMANIMATION_DURATION_SLOW ) ); 129cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( aSlow ), (void*)&gdSlow ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir String aNormal( SdResId( STR_CUSTOMANIMATION_DURATION_NORMAL ) ); 132cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( aNormal ), (void*)&gdNormal ); 133cdf0e10cSrcweir 134cdf0e10cSrcweir String aFast( SdResId( STR_CUSTOMANIMATION_DURATION_FAST ) ); 135cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( aFast ), (void*)&gdFast ); 136cdf0e10cSrcweir 137cdf0e10cSrcweir String aVeryFast( SdResId( STR_CUSTOMANIMATION_DURATION_VERY_FAST ) ); 138cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( aVeryFast ), (void*)&gdVeryFast ); 139cdf0e10cSrcweir } 140cdf0e10cSrcweir 141cdf0e10cSrcweir void fillRepeatComboBox( ComboBox* pBox ) 142cdf0e10cSrcweir { 143cdf0e10cSrcweir String aNone( SdResId( STR_CUSTOMANIMATION_REPEAT_NONE ) ); 144cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( aNone ), (void*)((sal_Int32)0) ); 145cdf0e10cSrcweir 146cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 2 ) ), (void*)((sal_Int32)1) ); 147cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 3 ) ), (void*)((sal_Int32)3) ); 148cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 4 ) ), (void*)((sal_Int32)4) ); 149cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 5 ) ), (void*)((sal_Int32)5) ); 150cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 10 ) ), (void*)((sal_Int32)10) ); 151cdf0e10cSrcweir 152cdf0e10cSrcweir String aUntilClick( SdResId( STR_CUSTOMANIMATION_REPEAT_UNTIL_NEXT_CLICK ) ); 153cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( aUntilClick ), (void*)((sal_Int32)-1) ); 154cdf0e10cSrcweir 155cdf0e10cSrcweir String aEndOfSlide( SdResId( STR_CUSTOMANIMATION_REPEAT_UNTIL_END_OF_SLIDE ) ); 156cdf0e10cSrcweir pBox->SetEntryData( pBox->InsertEntry( aEndOfSlide ), (void*)((sal_Int32)-2) ); 157cdf0e10cSrcweir } 158cdf0e10cSrcweir 159cdf0e10cSrcweir // -------------------------------------------------------------------- 160cdf0e10cSrcweir 161cdf0e10cSrcweir CustomAnimationPane::CustomAnimationPane( ::Window* pParent, ViewShellBase& rBase, const Size& rMinSize ) 162cdf0e10cSrcweir : Control( pParent, SdResId(DLG_CUSTOMANIMATIONPANE) ), 163cdf0e10cSrcweir mrBase( rBase ), 164cdf0e10cSrcweir mpCustomAnimationPresets(NULL), 165cdf0e10cSrcweir mnPropertyType( nPropertyTypeNone ), 166cdf0e10cSrcweir maMinSize( rMinSize ), 167cdf0e10cSrcweir mxModel( rBase.GetDocShell()->GetDoc()->getUnoModel(), UNO_QUERY ), 168cdf0e10cSrcweir maLateInitTimer() 169cdf0e10cSrcweir { 170cdf0e10cSrcweir // load resources 171cdf0e10cSrcweir mpFLEffect = new FixedLine( this, SdResId( FL_EFFECT ) ); 172cdf0e10cSrcweir 173cdf0e10cSrcweir mpPBAddEffect = new PushButton( this, SdResId( PB_ADD_EFFECT ) ); 174cdf0e10cSrcweir mpPBChangeEffect = new PushButton( this, SdResId( PB_CHANGE_EFFECT ) ); 175cdf0e10cSrcweir mpPBRemoveEffect = new PushButton( this, SdResId( PB_REMOVE_EFFECT ) ); 176cdf0e10cSrcweir 177cdf0e10cSrcweir mpFLModify = new FixedLine( this, SdResId( FL_MODIFY ) ); 178cdf0e10cSrcweir 179cdf0e10cSrcweir mpFTStart = new FixedText( this, SdResId( FT_START ) ); 180cdf0e10cSrcweir mpLBStart = new ListBox( this, SdResId( LB_START ) ); 181cdf0e10cSrcweir mpFTProperty = new FixedText( this, SdResId( FT_PROPERTY ) ); 182cdf0e10cSrcweir mpLBProperty = new PropertyControl( this, SdResId( LB_PROPERTY ) ); 183cdf0e10cSrcweir mpPBPropertyMore = new PushButton( this, SdResId( PB_PROPERTY_MORE ) ); 184cdf0e10cSrcweir 185cdf0e10cSrcweir mpFTSpeed = new FixedText( this, SdResId( FT_SPEED ) ); 186cdf0e10cSrcweir mpCBSpeed = new ComboBox( this, SdResId( CB_SPEED ) ); 187cdf0e10cSrcweir 188cdf0e10cSrcweir mpCustomAnimationList = new CustomAnimationList( this, SdResId( CT_CUSTOM_ANIMATION_LIST ), this ); 189cdf0e10cSrcweir 190cdf0e10cSrcweir mpPBMoveUp = new PushButton( this, SdResId( PB_MOVE_UP ) ); 191cdf0e10cSrcweir mpPBMoveDown = new PushButton( this, SdResId( PB_MOVE_DOWN ) ); 192cdf0e10cSrcweir mpFTChangeOrder = new FixedText( this, SdResId( FT_CHANGE_ORDER ) ); 193cdf0e10cSrcweir mpFLSeperator1 = new FixedLine( this, SdResId( FL_SEPERATOR1 ) ); 194cdf0e10cSrcweir mpPBPlay = new PushButton( this, SdResId( PB_PLAY ) ); 195cdf0e10cSrcweir mpPBSlideShow = new PushButton( this, SdResId( PB_SLIDE_SHOW ) ); 196cdf0e10cSrcweir mpFLSeperator2 = new FixedLine( this, SdResId( FL_SEPERATOR2 ) ); 197cdf0e10cSrcweir mpCBAutoPreview = new CheckBox( this, SdResId( CB_AUTOPREVIEW ) ); 198cdf0e10cSrcweir 199cdf0e10cSrcweir maStrProperty = mpFTProperty->GetText(); 200cdf0e10cSrcweir 201cdf0e10cSrcweir FreeResource(); 202cdf0e10cSrcweir 203cdf0e10cSrcweir // use bold font for group headings (same font for all fixed lines): 204cdf0e10cSrcweir Font font( mpFLEffect->GetFont() ); 205cdf0e10cSrcweir font.SetWeight( WEIGHT_BOLD ); 206cdf0e10cSrcweir mpFLEffect->SetFont( font ); 207cdf0e10cSrcweir mpFLModify->SetFont( font ); 208cdf0e10cSrcweir 209cdf0e10cSrcweir fillDurationComboBox( mpCBSpeed ); 210cdf0e10cSrcweir mpPBMoveUp->SetSymbol( SYMBOL_ARROW_UP ); 211cdf0e10cSrcweir mpPBMoveDown->SetSymbol( SYMBOL_ARROW_DOWN ); 212cdf0e10cSrcweir 213cdf0e10cSrcweir mpPBAddEffect->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) ); 214cdf0e10cSrcweir mpPBChangeEffect->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) ); 215cdf0e10cSrcweir mpPBRemoveEffect->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) ); 216cdf0e10cSrcweir mpLBStart->SetSelectHdl( LINK( this, CustomAnimationPane, implControlHdl ) ); 217cdf0e10cSrcweir mpCBSpeed->SetSelectHdl( LINK( this, CustomAnimationPane, implControlHdl ) ); 218cdf0e10cSrcweir mpPBPropertyMore->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) ); 219cdf0e10cSrcweir mpPBMoveUp->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) ); 220cdf0e10cSrcweir mpPBMoveDown->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) ); 221cdf0e10cSrcweir mpPBPlay->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) ); 222cdf0e10cSrcweir mpPBSlideShow->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) ); 223cdf0e10cSrcweir mpCBAutoPreview->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) ); 224cdf0e10cSrcweir 225cdf0e10cSrcweir maStrModify = mpFLEffect->GetText(); 226cdf0e10cSrcweir 227cdf0e10cSrcweir // resize controls according to current size 228cdf0e10cSrcweir updateLayout(); 229cdf0e10cSrcweir 230cdf0e10cSrcweir // get current controller and initialize listeners 231cdf0e10cSrcweir try 232cdf0e10cSrcweir { 233cdf0e10cSrcweir mxView = Reference< XDrawView >::query(mrBase.GetController()); 234cdf0e10cSrcweir addListener(); 235cdf0e10cSrcweir } 236cdf0e10cSrcweir catch( Exception& e ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir (void)e; 239cdf0e10cSrcweir DBG_ERROR( "sd::CustomAnimationPane::CustomAnimationPane(), Exception cought!" ); 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir // get current page and update custom animation list 243cdf0e10cSrcweir onChangeCurrentPage(); 244cdf0e10cSrcweir 245cdf0e10cSrcweir // Wait a short time before the presets list is created. This gives the 246cdf0e10cSrcweir // system time to paint the control. 247cdf0e10cSrcweir maLateInitTimer.SetTimeout(100); 248cdf0e10cSrcweir maLateInitTimer.SetTimeoutHdl(LINK(this, CustomAnimationPane, lateInitCallback)); 249cdf0e10cSrcweir maLateInitTimer.Start(); 250*7a32b0c8SAndre Fischer 251*7a32b0c8SAndre Fischer UpdateLook(); 252cdf0e10cSrcweir } 253cdf0e10cSrcweir 254cdf0e10cSrcweir CustomAnimationPane::~CustomAnimationPane() 255cdf0e10cSrcweir { 256cdf0e10cSrcweir maLateInitTimer.Stop(); 257cdf0e10cSrcweir 258cdf0e10cSrcweir removeListener(); 259cdf0e10cSrcweir 260cdf0e10cSrcweir MotionPathTagVector aTags; 261cdf0e10cSrcweir aTags.swap( maMotionPathTags ); 262cdf0e10cSrcweir MotionPathTagVector::iterator aIter; 263cdf0e10cSrcweir for( aIter = aTags.begin(); aIter != aTags.end(); aIter++ ) 264cdf0e10cSrcweir (*aIter)->Dispose(); 265cdf0e10cSrcweir 266cdf0e10cSrcweir delete mpFLModify; 267cdf0e10cSrcweir delete mpPBAddEffect; 268cdf0e10cSrcweir delete mpPBChangeEffect; 269cdf0e10cSrcweir delete mpPBRemoveEffect; 270cdf0e10cSrcweir delete mpFLEffect; 271cdf0e10cSrcweir delete mpFTStart; 272cdf0e10cSrcweir delete mpLBStart; 273cdf0e10cSrcweir delete mpFTProperty; 274cdf0e10cSrcweir delete mpLBProperty; 275cdf0e10cSrcweir delete mpPBPropertyMore; 276cdf0e10cSrcweir delete mpFTSpeed; 277cdf0e10cSrcweir delete mpCBSpeed; 278cdf0e10cSrcweir delete mpCustomAnimationList; 279cdf0e10cSrcweir delete mpFTChangeOrder; 280cdf0e10cSrcweir delete mpPBMoveUp; 281cdf0e10cSrcweir delete mpPBMoveDown; 282cdf0e10cSrcweir delete mpFLSeperator1; 283cdf0e10cSrcweir delete mpPBPlay; 284cdf0e10cSrcweir delete mpPBSlideShow; 285cdf0e10cSrcweir delete mpFLSeperator2; 286cdf0e10cSrcweir delete mpCBAutoPreview; 287cdf0e10cSrcweir } 288cdf0e10cSrcweir 289cdf0e10cSrcweir void CustomAnimationPane::addUndo() 290cdf0e10cSrcweir { 291cdf0e10cSrcweir ::svl::IUndoManager* pManager = mrBase.GetDocShell()->GetUndoManager(); 292cdf0e10cSrcweir if( pManager ) 293cdf0e10cSrcweir { 294cdf0e10cSrcweir SdPage* pPage = SdPage::getImplementation( mxCurrentPage ); 295cdf0e10cSrcweir if( pPage ) 296cdf0e10cSrcweir pManager->AddUndoAction( new UndoAnimation( mrBase.GetDocShell()->GetDoc(), pPage ) ); 297cdf0e10cSrcweir } 298cdf0e10cSrcweir } 299cdf0e10cSrcweir 300cdf0e10cSrcweir void CustomAnimationPane::Resize() 301cdf0e10cSrcweir { 302cdf0e10cSrcweir updateLayout(); 303cdf0e10cSrcweir } 304cdf0e10cSrcweir 305cdf0e10cSrcweir void CustomAnimationPane::StateChanged( StateChangedType nStateChange ) 306cdf0e10cSrcweir { 307cdf0e10cSrcweir Control::StateChanged( nStateChange ); 308cdf0e10cSrcweir 309cdf0e10cSrcweir if( nStateChange == STATE_CHANGE_VISIBLE ) 310cdf0e10cSrcweir updateMotionPathTags(); 311cdf0e10cSrcweir } 312cdf0e10cSrcweir 313cdf0e10cSrcweir void CustomAnimationPane::KeyInput( const KeyEvent& rKEvt ) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir if( mpCustomAnimationList ) 316cdf0e10cSrcweir mpCustomAnimationList->KeyInput( rKEvt ); 317cdf0e10cSrcweir } 318cdf0e10cSrcweir 319cdf0e10cSrcweir void CustomAnimationPane::addListener() 320cdf0e10cSrcweir { 321cdf0e10cSrcweir Link aLink( LINK(this,CustomAnimationPane,EventMultiplexerListener) ); 322cdf0e10cSrcweir mrBase.GetEventMultiplexer()->AddEventListener ( 323cdf0e10cSrcweir aLink, 324cdf0e10cSrcweir tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION 325cdf0e10cSrcweir | tools::EventMultiplexerEvent::EID_CURRENT_PAGE 326cdf0e10cSrcweir | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED 327cdf0e10cSrcweir | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED 328cdf0e10cSrcweir | tools::EventMultiplexerEvent::EID_DISPOSING 329cdf0e10cSrcweir | tools::EventMultiplexerEvent::EID_END_TEXT_EDIT); 330cdf0e10cSrcweir } 331cdf0e10cSrcweir 332cdf0e10cSrcweir void CustomAnimationPane::removeListener() 333cdf0e10cSrcweir { 334cdf0e10cSrcweir Link aLink( LINK(this,CustomAnimationPane,EventMultiplexerListener) ); 335cdf0e10cSrcweir mrBase.GetEventMultiplexer()->RemoveEventListener( aLink ); 336cdf0e10cSrcweir } 337cdf0e10cSrcweir 338cdf0e10cSrcweir IMPL_LINK(CustomAnimationPane,EventMultiplexerListener, 339cdf0e10cSrcweir tools::EventMultiplexerEvent*,pEvent) 340cdf0e10cSrcweir { 341cdf0e10cSrcweir switch (pEvent->meEventId) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION: 344cdf0e10cSrcweir onSelectionChanged(); 345cdf0e10cSrcweir break; 346cdf0e10cSrcweir 347cdf0e10cSrcweir case tools::EventMultiplexerEvent::EID_CURRENT_PAGE: 348cdf0e10cSrcweir onChangeCurrentPage(); 349cdf0e10cSrcweir break; 350cdf0e10cSrcweir 351cdf0e10cSrcweir case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: 352cdf0e10cSrcweir // At this moment the controller may not yet been set at model 353cdf0e10cSrcweir // or ViewShellBase. Take it from the view shell passed with 354cdf0e10cSrcweir // the event. 355cdf0e10cSrcweir if (mrBase.GetMainViewShell() != NULL) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir if( mrBase.GetMainViewShell()->GetShellType() == ViewShell::ST_IMPRESS ) 358cdf0e10cSrcweir { 359cdf0e10cSrcweir mxView = Reference<XDrawView>::query(mrBase.GetDrawController()); 360cdf0e10cSrcweir onSelectionChanged(); 361cdf0e10cSrcweir onChangeCurrentPage(); 362cdf0e10cSrcweir break; 363cdf0e10cSrcweir } 364cdf0e10cSrcweir } 365cdf0e10cSrcweir // fall through intended 366cdf0e10cSrcweir case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED: 367cdf0e10cSrcweir mxView = 0; 368cdf0e10cSrcweir mxCurrentPage = 0; 369cdf0e10cSrcweir updateControls(); 370cdf0e10cSrcweir break; 371cdf0e10cSrcweir 372cdf0e10cSrcweir case tools::EventMultiplexerEvent::EID_DISPOSING: 373cdf0e10cSrcweir mxView = Reference<XDrawView>(); 374cdf0e10cSrcweir onSelectionChanged(); 375cdf0e10cSrcweir onChangeCurrentPage(); 376cdf0e10cSrcweir break; 377cdf0e10cSrcweir case tools::EventMultiplexerEvent::EID_END_TEXT_EDIT: 378cdf0e10cSrcweir if( mpMainSequence.get() && pEvent->mpUserData ) 379cdf0e10cSrcweir mpCustomAnimationList->update( mpMainSequence ); 380cdf0e10cSrcweir break; 381cdf0e10cSrcweir } 382cdf0e10cSrcweir return 0; 383cdf0e10cSrcweir } 384cdf0e10cSrcweir 385cdf0e10cSrcweir 386cdf0e10cSrcweir void CustomAnimationPane::updateLayout() 387cdf0e10cSrcweir { 388cdf0e10cSrcweir Size aPaneSize( GetSizePixel() ); 389cdf0e10cSrcweir if( aPaneSize.Width() < maMinSize.Width() ) 390cdf0e10cSrcweir aPaneSize.Width() = maMinSize.Width(); 391cdf0e10cSrcweir 392cdf0e10cSrcweir if( aPaneSize.Height() < maMinSize.Height() ) 393cdf0e10cSrcweir aPaneSize.Height() = maMinSize.Height(); 394cdf0e10cSrcweir 395cdf0e10cSrcweir Point aOffset( LogicToPixel( Point(3,3), MAP_APPFONT ) ); 396cdf0e10cSrcweir Point aCursor( aOffset ); 397cdf0e10cSrcweir 398cdf0e10cSrcweir // place the modify fixed line 399cdf0e10cSrcweir 400cdf0e10cSrcweir // place the "modify effect" fixed line 401cdf0e10cSrcweir Size aSize( mpFLModify->GetSizePixel() ); 402cdf0e10cSrcweir aSize.Width() = aPaneSize.Width() - 2 * aOffset.X(); 403cdf0e10cSrcweir 404cdf0e10cSrcweir mpFLModify->SetPosSizePixel( aCursor, aSize ); 405cdf0e10cSrcweir 406cdf0e10cSrcweir aCursor.Y() += aSize.Height() + aOffset.Y(); 407cdf0e10cSrcweir 408cdf0e10cSrcweir const int nButtonExtraWidth = 4 * aOffset.X(); 409cdf0e10cSrcweir 410cdf0e10cSrcweir // the "add effect" button is placed top-left 411cdf0e10cSrcweir Size aCtrlSize( mpPBAddEffect->GetSizePixel() ); 412cdf0e10cSrcweir aCtrlSize.setWidth( mpPBAddEffect->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth ); 413cdf0e10cSrcweir mpPBAddEffect->SetPosSizePixel( aCursor, aCtrlSize ); 414cdf0e10cSrcweir 415cdf0e10cSrcweir aCursor.X() += aOffset.X() + aCtrlSize.Width(); 416cdf0e10cSrcweir 417cdf0e10cSrcweir // place the "change effect" button 418cdf0e10cSrcweir 419cdf0e10cSrcweir // if the "change" button does not fit right of the "add effect", put it on the next line 420cdf0e10cSrcweir aCtrlSize = mpPBChangeEffect->GetSizePixel(); 421cdf0e10cSrcweir aCtrlSize.setWidth( mpPBChangeEffect->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth ); 422cdf0e10cSrcweir if( ( aCursor.X() + aCtrlSize.Width() + aOffset.X() ) > aPaneSize.Width() ) 423cdf0e10cSrcweir { 424cdf0e10cSrcweir aCursor.X() = aOffset.X(); 425cdf0e10cSrcweir aCursor.Y() += aCtrlSize.Height() + aOffset.Y(); 426cdf0e10cSrcweir } 427cdf0e10cSrcweir mpPBChangeEffect->SetPosSizePixel( aCursor, aCtrlSize ); 428cdf0e10cSrcweir 429cdf0e10cSrcweir aCursor.X() += aOffset.X() + aCtrlSize.Width(); 430cdf0e10cSrcweir 431cdf0e10cSrcweir // place the "remove effect" button 432cdf0e10cSrcweir 433cdf0e10cSrcweir // if the "remove" button does not fit right of the "add effect", put it on the next line 434cdf0e10cSrcweir aCtrlSize = mpPBRemoveEffect->GetSizePixel(); 435cdf0e10cSrcweir aCtrlSize.setWidth( mpPBRemoveEffect->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth ); 436cdf0e10cSrcweir if( ( aCursor.X() + aCtrlSize.Width() + aOffset.X() ) > aPaneSize.Width() ) 437cdf0e10cSrcweir { 438cdf0e10cSrcweir aCursor.X() = aOffset.X(); 439cdf0e10cSrcweir aCursor.Y() += aCtrlSize.Height() + aOffset.Y(); 440cdf0e10cSrcweir } 441cdf0e10cSrcweir 442cdf0e10cSrcweir mpPBRemoveEffect->SetPosSizePixel( aCursor, aCtrlSize ); 443cdf0e10cSrcweir 444cdf0e10cSrcweir aCursor.X() = aOffset.X(); 445cdf0e10cSrcweir aCursor.Y() += aCtrlSize.Height() + 2 * aOffset.Y(); 446cdf0e10cSrcweir 447cdf0e10cSrcweir // place the "modify effect" fixed line 448cdf0e10cSrcweir aSize = mpFLEffect->GetSizePixel(); 449cdf0e10cSrcweir aSize.Width() = aPaneSize.Width() - 2 * aOffset.X(); 450cdf0e10cSrcweir 451cdf0e10cSrcweir mpFLEffect->SetPosSizePixel( aCursor, aSize ); 452cdf0e10cSrcweir 453cdf0e10cSrcweir aCursor.Y() += aSize.Height() + aOffset.Y(); 454cdf0e10cSrcweir 455cdf0e10cSrcweir // --------------------------------------------------------------------------- 456cdf0e10cSrcweir // place the properties controls 457cdf0e10cSrcweir 458cdf0e10cSrcweir // calc minimum width for fixedtext 459cdf0e10cSrcweir 460cdf0e10cSrcweir Size aFixedTextSize( mpFTStart->CalcMinimumSize() ); 461cdf0e10cSrcweir long nWidth = aFixedTextSize.Width(); 462cdf0e10cSrcweir aFixedTextSize = mpFTProperty->CalcMinimumSize(); 463cdf0e10cSrcweir nWidth = std::max( nWidth, aFixedTextSize.Width() ); 464cdf0e10cSrcweir aFixedTextSize = mpFTSpeed->CalcMinimumSize(); 465cdf0e10cSrcweir aFixedTextSize.Width() = std::max( nWidth, aFixedTextSize.Width() ) + aOffset.X(); 466cdf0e10cSrcweir mpFTStart->SetSizePixel(aFixedTextSize); 467cdf0e10cSrcweir mpFTProperty->SetSizePixel(aFixedTextSize); 468cdf0e10cSrcweir mpFTSpeed->SetSizePixel(aFixedTextSize); 469cdf0e10cSrcweir 470cdf0e10cSrcweir aSize = mpPBPropertyMore->GetSizePixel(); 471cdf0e10cSrcweir 472cdf0e10cSrcweir // place the "start" fixed text 473cdf0e10cSrcweir 474cdf0e10cSrcweir Point aFTPos( aCursor ); 475cdf0e10cSrcweir Point aLBPos( aCursor ); 476cdf0e10cSrcweir Size aListBoxSize( LogicToPixel( Size( 60, 12 ), MAP_APPFONT ) ); 477cdf0e10cSrcweir long nDeltaY = aListBoxSize.Height() + aOffset.Y(); 478cdf0e10cSrcweir 479cdf0e10cSrcweir // linebreak? 480cdf0e10cSrcweir if( (aFixedTextSize.Width() + aListBoxSize.Width() + aSize.Width() + 4 * aOffset.X()) > aPaneSize.Width() ) 481cdf0e10cSrcweir { 482cdf0e10cSrcweir // y position for list box is below fixed text 483cdf0e10cSrcweir aLBPos.Y() += aFixedTextSize.Height() + aOffset.Y(); 484cdf0e10cSrcweir 485cdf0e10cSrcweir // height of fixed text + list box + something = 2 * list box 486cdf0e10cSrcweir nDeltaY = aListBoxSize.Height() + aFixedTextSize.Height() + 2*aOffset.Y(); 487cdf0e10cSrcweir } 488cdf0e10cSrcweir else 489cdf0e10cSrcweir { 490cdf0e10cSrcweir // x position for list box is right of fixed text 491cdf0e10cSrcweir aLBPos.X() += aFixedTextSize.Width() + aOffset.X(); 492cdf0e10cSrcweir 493cdf0e10cSrcweir if( aListBoxSize.Height() > aFixedTextSize.Height() ) 494cdf0e10cSrcweir aFTPos.Y() = aLBPos.Y() + ((aListBoxSize.Height() - aFixedTextSize.Height()) >> 1); 495cdf0e10cSrcweir else 496cdf0e10cSrcweir aLBPos.Y() = aFTPos.Y() + ((aFixedTextSize.Height() - aListBoxSize.Height()) >> 1); 497cdf0e10cSrcweir } 498cdf0e10cSrcweir 499cdf0e10cSrcweir // width of the listbox is from its left side until end of pane 500cdf0e10cSrcweir aListBoxSize.Width() = aPaneSize.Width() - aLBPos.X() - aSize.Width() - 2 * aOffset.X(); 501cdf0e10cSrcweir 502cdf0e10cSrcweir mpFTStart->SetPosPixel( aFTPos ); 503cdf0e10cSrcweir mpLBStart->SetPosSizePixel( aLBPos, aListBoxSize ); 504cdf0e10cSrcweir 505cdf0e10cSrcweir aFTPos.Y() += nDeltaY; aLBPos.Y() += nDeltaY; 506cdf0e10cSrcweir 507cdf0e10cSrcweir mpFTProperty->SetPosPixel( aFTPos ); 508cdf0e10cSrcweir mpLBProperty->SetPosSizePixel( aLBPos, aListBoxSize ); 509cdf0e10cSrcweir mpLBProperty->Resize(); 510cdf0e10cSrcweir 511cdf0e10cSrcweir Point aMorePos( aLBPos ); 512cdf0e10cSrcweir aMorePos.X() += aListBoxSize.Width() + aOffset.X(); 513cdf0e10cSrcweir mpPBPropertyMore->SetPosPixel( aMorePos ); 514cdf0e10cSrcweir 515cdf0e10cSrcweir aFTPos.Y() += nDeltaY; aLBPos.Y() += nDeltaY; 516cdf0e10cSrcweir 517cdf0e10cSrcweir mpFTSpeed->SetPosPixel( aFTPos ); 518cdf0e10cSrcweir mpCBSpeed->SetPosSizePixel( aLBPos, aListBoxSize ); 519cdf0e10cSrcweir 520cdf0e10cSrcweir aFTPos.Y() += nDeltaY + aOffset.Y(); 521cdf0e10cSrcweir 522cdf0e10cSrcweir Point aListPos( aFTPos ); 523cdf0e10cSrcweir 524cdf0e10cSrcweir // positionate the buttons on the bottom 525cdf0e10cSrcweir 526cdf0e10cSrcweir // place the auto preview checkbox 527cdf0e10cSrcweir aCursor = Point( aOffset.X(), aPaneSize.Height() - mpCBAutoPreview->GetSizePixel().Height() - aOffset.Y() ); 528cdf0e10cSrcweir mpCBAutoPreview->SetPosPixel( aCursor ); 529cdf0e10cSrcweir 530cdf0e10cSrcweir // place the seperator 2 fixed line 531cdf0e10cSrcweir aCursor.Y() -= /* aOffset.Y() + */ mpFLSeperator2->GetSizePixel().Height(); 532cdf0e10cSrcweir aSize = mpFLSeperator2->GetSizePixel(); 533cdf0e10cSrcweir aSize.Width() = aPaneSize.Width() - 2 * aOffset.X(); 534cdf0e10cSrcweir mpFLSeperator2->SetPosSizePixel( aCursor, aSize ); 535cdf0e10cSrcweir 536cdf0e10cSrcweir // next, layout and place the play and slide show buttons 537cdf0e10cSrcweir aCtrlSize = mpPBSlideShow->GetSizePixel(); 538cdf0e10cSrcweir aCtrlSize.setWidth( mpPBSlideShow->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth ); 539cdf0e10cSrcweir 540cdf0e10cSrcweir Size aPlaySize( mpPBPlay->GetSizePixel() ); 541cdf0e10cSrcweir aPlaySize.setWidth( mpPBPlay->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth ); 542cdf0e10cSrcweir 543cdf0e10cSrcweir aCursor.Y() -= aCtrlSize.Height() /* + aOffset.Y() */; 544cdf0e10cSrcweir 545cdf0e10cSrcweir // do we need two lines for the buttons? 546cdf0e10cSrcweir int aTestWidth = aCursor.X() + mpPBPlay->GetSizePixel().Width() + 2 * aOffset.X() + mpPBSlideShow->GetSizePixel().Width(); 547cdf0e10cSrcweir if( aTestWidth > aPaneSize.Width() ) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir mpPBSlideShow->SetPosSizePixel( aCursor, aCtrlSize ); 550cdf0e10cSrcweir aCursor.Y() -= aCtrlSize.Height() + aOffset.Y(); 551cdf0e10cSrcweir mpPBPlay->SetPosSizePixel( aCursor, aPlaySize ); 552cdf0e10cSrcweir } 553cdf0e10cSrcweir else 554cdf0e10cSrcweir { 555cdf0e10cSrcweir mpPBPlay->SetPosSizePixel( aCursor, aPlaySize ); 556cdf0e10cSrcweir aCursor.X() += aPlaySize.Width() + aOffset.X(); 557cdf0e10cSrcweir mpPBSlideShow->SetPosSizePixel( aCursor, aCtrlSize ); 558cdf0e10cSrcweir } 559cdf0e10cSrcweir 560cdf0e10cSrcweir // place the seperator 1 fixed line 561cdf0e10cSrcweir aCursor.X() = aOffset.X(); 562cdf0e10cSrcweir aCursor.Y() -= /* aOffset.Y() + */ mpFLSeperator1->GetSizePixel().Height(); 563cdf0e10cSrcweir aSize = mpFLSeperator1->GetSizePixel(); 564cdf0e10cSrcweir aSize.Width() = aPaneSize.Width() - 2 * aOffset.X(); 565cdf0e10cSrcweir mpFLSeperator1->SetPosSizePixel( aCursor, aSize ); 566cdf0e10cSrcweir 567cdf0e10cSrcweir // place the move down button 568cdf0e10cSrcweir aSize = mpPBMoveDown->GetSizePixel(); 569cdf0e10cSrcweir 570cdf0e10cSrcweir aCursor.X() = aPaneSize.Width() - aOffset.X() - aSize.Width(); 571cdf0e10cSrcweir aCursor.Y() -= aOffset.Y() + aSize.Height(); 572cdf0e10cSrcweir mpPBMoveDown->SetPosPixel( aCursor ); 573cdf0e10cSrcweir 574cdf0e10cSrcweir aCursor.X() -= aOffset.X() + aSize.Width(); 575cdf0e10cSrcweir mpPBMoveUp->SetPosPixel( aCursor ); 576cdf0e10cSrcweir 577cdf0e10cSrcweir // Place the change order label. 578cdf0e10cSrcweir // Its width has to be calculated dynamically so that is can be 579cdf0e10cSrcweir // displayed flush right without having too much space to the buttons 580cdf0e10cSrcweir // with some languages or truncated text with others. 581cdf0e10cSrcweir mpFTChangeOrder->SetSizePixel(mpFTChangeOrder->CalcMinimumSize()); 582cdf0e10cSrcweir 583cdf0e10cSrcweir aCursor.X() -= aOffset.X() + mpFTChangeOrder->GetSizePixel().Width(); 584cdf0e10cSrcweir aCursor.Y() += (aSize.Height() - mpFTChangeOrder->GetSizePixel().Height()) >> 1; 585cdf0e10cSrcweir mpFTChangeOrder->SetPosPixel( aCursor ); 586cdf0e10cSrcweir 587cdf0e10cSrcweir // positionate the custom animation list control 588cdf0e10cSrcweir Size aCustomAnimationListSize( aPaneSize.Width() - aListPos.X() - aOffset.X(), aCursor.Y() - aListPos.Y() - 2 * aOffset.Y() ); 589cdf0e10cSrcweir mpCustomAnimationList->SetPosSizePixel( aListPos, aCustomAnimationListSize ); 590cdf0e10cSrcweir } 591cdf0e10cSrcweir 592cdf0e10cSrcweir static sal_Int32 getPropertyType( const OUString& rProperty ) 593cdf0e10cSrcweir { 594cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Direction") ) ) 595cdf0e10cSrcweir return nPropertyTypeDirection; 596cdf0e10cSrcweir 597cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Spokes") ) ) 598cdf0e10cSrcweir return nPropertyTypeSpokes; 599cdf0e10cSrcweir 600cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Zoom") ) ) 601cdf0e10cSrcweir return nPropertyTypeZoom; 602cdf0e10cSrcweir 603cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Accelerate") ) ) 604cdf0e10cSrcweir return nPropertyTypeAccelerate; 605cdf0e10cSrcweir 606cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Decelerate") ) ) 607cdf0e10cSrcweir return nPropertyTypeDecelerate; 608cdf0e10cSrcweir 609cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Color1") ) ) 610cdf0e10cSrcweir return nPropertyTypeFirstColor; 611cdf0e10cSrcweir 612cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Color2") ) ) 613cdf0e10cSrcweir return nPropertyTypeSecondColor; 614cdf0e10cSrcweir 615cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FillColor") ) ) 616cdf0e10cSrcweir return nPropertyTypeFillColor; 617cdf0e10cSrcweir 618cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ColorStyle") ) ) 619cdf0e10cSrcweir return nPropertyTypeColorStyle; 620cdf0e10cSrcweir 621cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("AutoReverse") ) ) 622cdf0e10cSrcweir return nPropertyTypeAutoReverse; 623cdf0e10cSrcweir 624cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FontStyle") ) ) 625cdf0e10cSrcweir return nPropertyTypeFont; 626cdf0e10cSrcweir 627cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CharColor") ) ) 628cdf0e10cSrcweir return nPropertyTypeCharColor; 629cdf0e10cSrcweir 630cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CharHeight") ) ) 631cdf0e10cSrcweir return nPropertyTypeCharHeight; 632cdf0e10cSrcweir 633cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CharDecoration") ) ) 634cdf0e10cSrcweir return nPropertyTypeCharDecoration; 635cdf0e10cSrcweir 636cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("LineColor") ) ) 637cdf0e10cSrcweir return nPropertyTypeLineColor; 638cdf0e10cSrcweir 639cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Rotate") ) ) 640cdf0e10cSrcweir return nPropertyTypeRotate; 641cdf0e10cSrcweir 642cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Transparency") ) ) 643cdf0e10cSrcweir return nPropertyTypeTransparency; 644cdf0e10cSrcweir 645cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Color") ) ) 646cdf0e10cSrcweir return nPropertyTypeColor; 647cdf0e10cSrcweir 648cdf0e10cSrcweir if( rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Scale") ) ) 649cdf0e10cSrcweir return nPropertyTypeScale; 650cdf0e10cSrcweir 651cdf0e10cSrcweir return nPropertyTypeNone; 652cdf0e10cSrcweir } 653cdf0e10cSrcweir 654cdf0e10cSrcweir OUString getPropertyName( sal_Int32 nPropertyType ) 655cdf0e10cSrcweir { 656cdf0e10cSrcweir switch( nPropertyType ) 657cdf0e10cSrcweir { 658cdf0e10cSrcweir case nPropertyTypeDirection: 659cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_DIRECTION_PROPERTY ) ) ); 660cdf0e10cSrcweir 661cdf0e10cSrcweir case nPropertyTypeSpokes: 662cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_SPOKES_PROPERTY ) ) ); 663cdf0e10cSrcweir 664cdf0e10cSrcweir case nPropertyTypeFirstColor: 665cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_FIRST_COLOR_PROPERTY ) ) ); 666cdf0e10cSrcweir 667cdf0e10cSrcweir case nPropertyTypeSecondColor: 668cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_SECOND_COLOR_PROPERTY ) ) ); 669cdf0e10cSrcweir 670cdf0e10cSrcweir case nPropertyTypeZoom: 671cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_ZOOM_PROPERTY ) ) ); 672cdf0e10cSrcweir 673cdf0e10cSrcweir case nPropertyTypeFillColor: 674cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_FILL_COLOR_PROPERTY ) ) ); 675cdf0e10cSrcweir 676cdf0e10cSrcweir case nPropertyTypeColorStyle: 677cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_STYLE_PROPERTY ) ) ); 678cdf0e10cSrcweir 679cdf0e10cSrcweir case nPropertyTypeFont: 680cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_PROPERTY ) ) ); 681cdf0e10cSrcweir 682cdf0e10cSrcweir case nPropertyTypeCharHeight: 683cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_SIZE_PROPERTY ) ) ); 684cdf0e10cSrcweir 685cdf0e10cSrcweir case nPropertyTypeCharColor: 686cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_COLOR_PROPERTY ) ) ); 687cdf0e10cSrcweir 688cdf0e10cSrcweir case nPropertyTypeCharHeightStyle: 689cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_SIZE_STYLE_PROPERTY ) ) ); 690cdf0e10cSrcweir 691cdf0e10cSrcweir case nPropertyTypeCharDecoration: 692cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_STYLE_PROPERTY ) ) ); 693cdf0e10cSrcweir 694cdf0e10cSrcweir case nPropertyTypeLineColor: 695cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_LINE_COLOR_PROPERTY ) ) ); 696cdf0e10cSrcweir 697cdf0e10cSrcweir case nPropertyTypeRotate: 698cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_AMOUNT_PROPERTY ) ) ); 699cdf0e10cSrcweir 700cdf0e10cSrcweir case nPropertyTypeColor: 701cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_COLOR_PROPERTY ) ) ); 702cdf0e10cSrcweir 703cdf0e10cSrcweir case nPropertyTypeTransparency: 704cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_AMOUNT_PROPERTY ) ) ); 705cdf0e10cSrcweir 706cdf0e10cSrcweir case nPropertyTypeScale: 707cdf0e10cSrcweir return OUString( String( SdResId( STR_CUSTOMANIMATION_SCALE_PROPERTY ) ) ); 708cdf0e10cSrcweir } 709cdf0e10cSrcweir 710cdf0e10cSrcweir OUString aStr; 711cdf0e10cSrcweir return aStr; 712cdf0e10cSrcweir } 713cdf0e10cSrcweir 714cdf0e10cSrcweir void CustomAnimationPane::updateControls() 715cdf0e10cSrcweir { 716cdf0e10cSrcweir mpFLModify->Enable( mxView.is() ); 717cdf0e10cSrcweir mpFTSpeed->Enable( mxView.is() ); 718cdf0e10cSrcweir mpCBSpeed->Enable( mxView.is() ); 719cdf0e10cSrcweir mpCustomAnimationList->Enable( mxView.is() ); 720cdf0e10cSrcweir mpFTChangeOrder->Enable( mxView.is() ); 721cdf0e10cSrcweir mpPBMoveUp->Enable( mxView.is() ); 722cdf0e10cSrcweir mpPBMoveDown->Enable( mxView.is() ); 723cdf0e10cSrcweir mpFLSeperator1->Enable( mxView.is() ); 724cdf0e10cSrcweir mpPBPlay->Enable( mxView.is() ); 725cdf0e10cSrcweir mpPBSlideShow->Enable( mxView.is() ); 726cdf0e10cSrcweir mpFLSeperator2->Enable( mxView.is() ); 727cdf0e10cSrcweir mpCBAutoPreview->Enable( mxView.is() ); 728cdf0e10cSrcweir 729cdf0e10cSrcweir if( !mxView.is() ) 730cdf0e10cSrcweir { 731cdf0e10cSrcweir mpPBAddEffect->Enable( sal_False ); 732cdf0e10cSrcweir mpPBChangeEffect->Enable( sal_False ); 733cdf0e10cSrcweir mpPBRemoveEffect->Enable( sal_False ); 734cdf0e10cSrcweir mpFLEffect->Enable( sal_False ); 735cdf0e10cSrcweir mpFTStart->Enable( sal_False ); 736cdf0e10cSrcweir mpLBStart->Enable( sal_False ); 737cdf0e10cSrcweir mpPBPropertyMore->Enable( sal_False ); 738cdf0e10cSrcweir mpLBProperty->Enable( sal_False ); 739cdf0e10cSrcweir mpFTProperty->Enable( sal_False ); 740cdf0e10cSrcweir mpCustomAnimationList->clear(); 741cdf0e10cSrcweir return; 742cdf0e10cSrcweir } 743cdf0e10cSrcweir 744cdf0e10cSrcweir const int nSelectionCount = maListSelection.size(); 745cdf0e10cSrcweir 746cdf0e10cSrcweir mpPBAddEffect->Enable( maViewSelection.hasValue() ); 747cdf0e10cSrcweir mpPBChangeEffect->Enable( nSelectionCount); 748cdf0e10cSrcweir mpPBRemoveEffect->Enable(nSelectionCount); 749cdf0e10cSrcweir 750cdf0e10cSrcweir mpFLEffect->Enable(nSelectionCount > 0); 751cdf0e10cSrcweir mpFTStart->Enable(nSelectionCount > 0); 752cdf0e10cSrcweir mpLBStart->Enable(nSelectionCount > 0); 753cdf0e10cSrcweir mpPBPropertyMore->Enable(nSelectionCount > 0); 754cdf0e10cSrcweir 755cdf0e10cSrcweir // mpPBPlay->Enable(nSelectionCount > 0); 756cdf0e10cSrcweir 757cdf0e10cSrcweir mpFTProperty->SetText( maStrProperty ); 758cdf0e10cSrcweir 759cdf0e10cSrcweir mnPropertyType = nPropertyTypeNone; 760cdf0e10cSrcweir 761cdf0e10cSrcweir if( nSelectionCount == 1 ) 762cdf0e10cSrcweir { 763cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = maListSelection.front(); 764cdf0e10cSrcweir 765cdf0e10cSrcweir OUString aUIName( getPresets().getUINameForPresetId( pEffect->getPresetId() ) ); 766cdf0e10cSrcweir 767cdf0e10cSrcweir OUString aTemp( maStrModify ); 768cdf0e10cSrcweir 769cdf0e10cSrcweir if( aUIName.getLength() ) 770cdf0e10cSrcweir { 771cdf0e10cSrcweir aTemp += OUString( (sal_Unicode)' ' ); 772cdf0e10cSrcweir aTemp += aUIName; 773cdf0e10cSrcweir } 774cdf0e10cSrcweir mpFLEffect->SetText( aTemp ); 775cdf0e10cSrcweir 776cdf0e10cSrcweir CustomAnimationPresetPtr pDescriptor = getPresets().getEffectDescriptor( pEffect->getPresetId() ); 777cdf0e10cSrcweir if( pDescriptor.get() ) 778cdf0e10cSrcweir { 779cdf0e10cSrcweir PropertySubControl* pSubControl = NULL; 780cdf0e10cSrcweir 781cdf0e10cSrcweir Any aValue; 782cdf0e10cSrcweir 783cdf0e10cSrcweir UStringList aProperties( pDescriptor->getProperties() ); 784cdf0e10cSrcweir if( aProperties.size() >= 1 ) 785cdf0e10cSrcweir { 786cdf0e10cSrcweir OUString aProperty( aProperties.front() ); 787cdf0e10cSrcweir 788cdf0e10cSrcweir mnPropertyType = getPropertyType( aProperties.front() ); 789cdf0e10cSrcweir 790cdf0e10cSrcweir mpFTProperty->SetText( getPropertyName( mnPropertyType ) ); 791cdf0e10cSrcweir 792cdf0e10cSrcweir aValue = getProperty1Value( mnPropertyType, pEffect ); 793cdf0e10cSrcweir } 794cdf0e10cSrcweir 795cdf0e10cSrcweir if( aValue.hasValue() ) 796cdf0e10cSrcweir { 797cdf0e10cSrcweir pSubControl = mpLBProperty->getSubControl(); 798cdf0e10cSrcweir if( !pSubControl || (pSubControl->getControlType() != mnPropertyType) ) 799cdf0e10cSrcweir { 800cdf0e10cSrcweir pSubControl = PropertySubControl::create( mnPropertyType, this, aValue, pEffect->getPresetId(), LINK( this, CustomAnimationPane, implPropertyHdl ) ); 801cdf0e10cSrcweir mpLBProperty->setSubControl( pSubControl ); 802cdf0e10cSrcweir } 803cdf0e10cSrcweir else 804cdf0e10cSrcweir { 805cdf0e10cSrcweir pSubControl->setValue( aValue, pEffect->getPresetId() ); 806cdf0e10cSrcweir } 807cdf0e10cSrcweir } 808cdf0e10cSrcweir else 809cdf0e10cSrcweir { 810cdf0e10cSrcweir mpLBProperty->setSubControl( 0 ); 811cdf0e10cSrcweir } 812cdf0e10cSrcweir 813cdf0e10cSrcweir bool bEnable = (pSubControl != 0) && (pSubControl->getControl()->IsEnabled()); 814cdf0e10cSrcweir mpLBProperty->Enable( bEnable ); 815cdf0e10cSrcweir mpFTProperty->Enable( bEnable ); 816cdf0e10cSrcweir } 817cdf0e10cSrcweir else 818cdf0e10cSrcweir { 819cdf0e10cSrcweir mpLBProperty->setSubControl( 0 ); 820cdf0e10cSrcweir mpFTProperty->Enable( sal_False ); 821cdf0e10cSrcweir mpLBProperty->Enable( sal_False ); 822cdf0e10cSrcweir mpPBPropertyMore->Enable( sal_False ); 823cdf0e10cSrcweir } 824cdf0e10cSrcweir 825cdf0e10cSrcweir // 826cdf0e10cSrcweir // --- 827cdf0e10cSrcweir // 828cdf0e10cSrcweir sal_uInt16 nPos = 0xffff; 829cdf0e10cSrcweir 830cdf0e10cSrcweir sal_Int16 nNodeType = pEffect->getNodeType(); 831cdf0e10cSrcweir switch( nNodeType ) 832cdf0e10cSrcweir { 833cdf0e10cSrcweir case EffectNodeType::ON_CLICK: nPos = 0; break; 834cdf0e10cSrcweir case EffectNodeType::WITH_PREVIOUS: nPos = 1; break; 835cdf0e10cSrcweir case EffectNodeType::AFTER_PREVIOUS: nPos = 2; break; 836cdf0e10cSrcweir } 837cdf0e10cSrcweir 838cdf0e10cSrcweir mpLBStart->SelectEntryPos( nPos ); 839cdf0e10cSrcweir 840cdf0e10cSrcweir double fDuration = pEffect->getDuration(); 841cdf0e10cSrcweir const bool bHasSpeed = fDuration > 0.001; 842cdf0e10cSrcweir 843cdf0e10cSrcweir mpFTSpeed->Enable(bHasSpeed); 844cdf0e10cSrcweir mpCBSpeed->Enable(bHasSpeed); 845cdf0e10cSrcweir 846cdf0e10cSrcweir if( bHasSpeed ) 847cdf0e10cSrcweir { 848cdf0e10cSrcweir if( fDuration == 5.0 ) 849cdf0e10cSrcweir nPos = 0; 850cdf0e10cSrcweir else if( fDuration == 3.0 ) 851cdf0e10cSrcweir nPos = 1; 852cdf0e10cSrcweir else if( fDuration == 2.0 ) 853cdf0e10cSrcweir nPos = 2; 854cdf0e10cSrcweir else if( fDuration == 1.0 ) 855cdf0e10cSrcweir nPos = 3; 856cdf0e10cSrcweir else if( fDuration == 0.5 ) 857cdf0e10cSrcweir nPos = 4; 858cdf0e10cSrcweir else 859cdf0e10cSrcweir nPos = 0xffff; 860cdf0e10cSrcweir 861cdf0e10cSrcweir mpCBSpeed->SelectEntryPos( nPos ); 862cdf0e10cSrcweir } 863cdf0e10cSrcweir 864cdf0e10cSrcweir mpPBPropertyMore->Enable( sal_True ); 865cdf0e10cSrcweir 866cdf0e10cSrcweir mpFTChangeOrder->Enable( sal_True ); 867cdf0e10cSrcweir } 868cdf0e10cSrcweir else 869cdf0e10cSrcweir { 870cdf0e10cSrcweir mpLBProperty->setSubControl( 0 ); 871cdf0e10cSrcweir mpFTProperty->Enable( sal_False ); 872cdf0e10cSrcweir mpLBProperty->Enable( sal_False ); 873cdf0e10cSrcweir mpPBPropertyMore->Enable( sal_False ); 874cdf0e10cSrcweir mpFTSpeed->Enable(sal_False); 875cdf0e10cSrcweir mpCBSpeed->Enable(sal_False); 876cdf0e10cSrcweir mpFTChangeOrder->Enable( sal_False ); 877cdf0e10cSrcweir mpLBStart->SetNoSelection(); 878cdf0e10cSrcweir mpCBSpeed->SetNoSelection(); 879cdf0e10cSrcweir mpFLEffect->SetText( maStrModify ); 880cdf0e10cSrcweir } 881cdf0e10cSrcweir 882cdf0e10cSrcweir bool bEnableUp = true; 883cdf0e10cSrcweir bool bEnableDown = true; 884cdf0e10cSrcweir if( nSelectionCount == 0 ) 885cdf0e10cSrcweir { 886cdf0e10cSrcweir bEnableUp = false; 887cdf0e10cSrcweir bEnableDown = false; 888cdf0e10cSrcweir } 889cdf0e10cSrcweir else 890cdf0e10cSrcweir { 891cdf0e10cSrcweir if( mpMainSequence->find( maListSelection.front() ) == mpMainSequence->getBegin() ) 892cdf0e10cSrcweir bEnableUp = false; 893cdf0e10cSrcweir 894cdf0e10cSrcweir EffectSequence::iterator aIter( mpMainSequence->find( maListSelection.back() ) ); 895cdf0e10cSrcweir if( aIter == mpMainSequence->getEnd() ) 896cdf0e10cSrcweir { 897cdf0e10cSrcweir bEnableDown = false; 898cdf0e10cSrcweir } 899cdf0e10cSrcweir else 900cdf0e10cSrcweir { 901cdf0e10cSrcweir do 902cdf0e10cSrcweir { 903cdf0e10cSrcweir aIter++; 904cdf0e10cSrcweir } 905cdf0e10cSrcweir while( (aIter != mpMainSequence->getEnd()) && !(mpCustomAnimationList->isExpanded((*aIter)) ) ); 906cdf0e10cSrcweir 907cdf0e10cSrcweir if( aIter == mpMainSequence->getEnd() ) 908cdf0e10cSrcweir bEnableDown = false; 909cdf0e10cSrcweir } 910cdf0e10cSrcweir 911cdf0e10cSrcweir if( bEnableUp || bEnableDown ) 912cdf0e10cSrcweir { 913cdf0e10cSrcweir MainSequenceRebuildGuard aGuard( mpMainSequence ); 914cdf0e10cSrcweir 915cdf0e10cSrcweir EffectSequenceHelper* pSequence = 0; 916cdf0e10cSrcweir EffectSequence::iterator aRebuildIter( maListSelection.begin() ); 917cdf0e10cSrcweir const EffectSequence::iterator aRebuildEnd( maListSelection.end() ); 918cdf0e10cSrcweir while( aRebuildIter != aRebuildEnd ) 919cdf0e10cSrcweir { 920cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aRebuildIter++); 921cdf0e10cSrcweir 922cdf0e10cSrcweir if( pEffect.get() ) 923cdf0e10cSrcweir { 924cdf0e10cSrcweir if( pSequence == 0 ) 925cdf0e10cSrcweir { 926cdf0e10cSrcweir pSequence = pEffect->getEffectSequence(); 927cdf0e10cSrcweir } 928cdf0e10cSrcweir else 929cdf0e10cSrcweir { 930cdf0e10cSrcweir if( pSequence != pEffect->getEffectSequence() ) 931cdf0e10cSrcweir { 932cdf0e10cSrcweir bEnableUp = false; 933cdf0e10cSrcweir bEnableDown = false; 934cdf0e10cSrcweir break; 935cdf0e10cSrcweir } 936cdf0e10cSrcweir } 937cdf0e10cSrcweir } 938cdf0e10cSrcweir } 939cdf0e10cSrcweir } 940cdf0e10cSrcweir } 941cdf0e10cSrcweir 942cdf0e10cSrcweir mpPBMoveUp->Enable(bEnableUp); 943cdf0e10cSrcweir mpPBMoveDown->Enable(bEnableDown); 944cdf0e10cSrcweir 945cdf0e10cSrcweir SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS); 946cdf0e10cSrcweir mpCBAutoPreview->Check( pOptions->IsPreviewChangedEffects() == sal_True ); 947cdf0e10cSrcweir 948cdf0e10cSrcweir updateMotionPathTags(); 949cdf0e10cSrcweir } 950cdf0e10cSrcweir 951cdf0e10cSrcweir static bool updateMotionPathImpl( CustomAnimationPane& rPane, ::sd::View& rView, EffectSequence::iterator aIter, EffectSequence::iterator aEnd, MotionPathTagVector& rOldTags, MotionPathTagVector& rNewTags ) 952cdf0e10cSrcweir { 953cdf0e10cSrcweir bool bChanges = false; 954cdf0e10cSrcweir while( aIter != aEnd ) 955cdf0e10cSrcweir { 956cdf0e10cSrcweir CustomAnimationEffectPtr pEffect( (*aIter++) ); 957cdf0e10cSrcweir if( pEffect.get() && pEffect->getPresetClass() == ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH ) 958cdf0e10cSrcweir { 959cdf0e10cSrcweir rtl::Reference< MotionPathTag > xMotionPathTag; 960cdf0e10cSrcweir // first try to find if there is already a tag for this 961cdf0e10cSrcweir MotionPathTagVector::iterator aMIter( rOldTags.begin() ); 962cdf0e10cSrcweir for( ; aMIter != rOldTags.end(); aMIter++ ) 963cdf0e10cSrcweir { 964cdf0e10cSrcweir rtl::Reference< MotionPathTag > xTag( (*aMIter) ); 965cdf0e10cSrcweir if( xTag->getEffect() == pEffect ) 966cdf0e10cSrcweir { 967cdf0e10cSrcweir if( !xTag->isDisposed() ) 968cdf0e10cSrcweir { 969cdf0e10cSrcweir xMotionPathTag = xTag; 970cdf0e10cSrcweir rOldTags.erase( aMIter ); 971cdf0e10cSrcweir } 972cdf0e10cSrcweir break; 973cdf0e10cSrcweir } 974cdf0e10cSrcweir } 975cdf0e10cSrcweir 976cdf0e10cSrcweir // if not found, create new one 977cdf0e10cSrcweir if( !xMotionPathTag.is() ) 978cdf0e10cSrcweir { 979cdf0e10cSrcweir xMotionPathTag.set( new MotionPathTag( rPane, rView, pEffect ) ); 980cdf0e10cSrcweir bChanges = true; 981cdf0e10cSrcweir } 982cdf0e10cSrcweir 983cdf0e10cSrcweir if( xMotionPathTag.is() ) 984cdf0e10cSrcweir rNewTags.push_back( xMotionPathTag ); 985cdf0e10cSrcweir } 986cdf0e10cSrcweir } 987cdf0e10cSrcweir 988cdf0e10cSrcweir return bChanges; 989cdf0e10cSrcweir } 990cdf0e10cSrcweir 991cdf0e10cSrcweir void CustomAnimationPane::updateMotionPathTags() 992cdf0e10cSrcweir { 993cdf0e10cSrcweir bool bChanges = false; 994cdf0e10cSrcweir 995cdf0e10cSrcweir MotionPathTagVector aTags; 996cdf0e10cSrcweir aTags.swap( maMotionPathTags ); 997cdf0e10cSrcweir 998cdf0e10cSrcweir ::sd::View* pView = 0; 999cdf0e10cSrcweir 1000cdf0e10cSrcweir if( mxView.is() ) 1001cdf0e10cSrcweir { 1002cdf0e10cSrcweir ::boost::shared_ptr<ViewShell> xViewShell( mrBase.GetMainViewShell() ); 1003cdf0e10cSrcweir if( xViewShell.get() ) 1004cdf0e10cSrcweir pView = xViewShell->GetView(); 1005cdf0e10cSrcweir } 1006cdf0e10cSrcweir 1007cdf0e10cSrcweir if( IsVisible() && mpMainSequence.get() && pView ) 1008cdf0e10cSrcweir { 1009cdf0e10cSrcweir bChanges = updateMotionPathImpl( *this, *pView, mpMainSequence->getBegin(), mpMainSequence->getEnd(), aTags, maMotionPathTags ); 1010cdf0e10cSrcweir 1011cdf0e10cSrcweir const InteractiveSequenceList& rISL = mpMainSequence->getInteractiveSequenceList(); 1012cdf0e10cSrcweir InteractiveSequenceList::const_iterator aISI( rISL.begin() ); 1013cdf0e10cSrcweir while( aISI != rISL.end() ) 1014cdf0e10cSrcweir { 1015cdf0e10cSrcweir InteractiveSequencePtr pIS( (*aISI++) ); 1016cdf0e10cSrcweir bChanges |= updateMotionPathImpl( *this, *pView, pIS->getBegin(), pIS->getEnd(), aTags, maMotionPathTags ); 1017cdf0e10cSrcweir } 1018cdf0e10cSrcweir } 1019cdf0e10cSrcweir 1020cdf0e10cSrcweir if( !aTags.empty() ) 1021cdf0e10cSrcweir { 1022cdf0e10cSrcweir bChanges = true; 1023cdf0e10cSrcweir MotionPathTagVector::iterator aIter( aTags.begin() ); 1024cdf0e10cSrcweir while( aIter != aTags.end() ) 1025cdf0e10cSrcweir { 1026cdf0e10cSrcweir rtl::Reference< MotionPathTag > xTag( (*aIter++) ); 1027cdf0e10cSrcweir xTag->Dispose(); 1028cdf0e10cSrcweir } 1029cdf0e10cSrcweir } 1030cdf0e10cSrcweir 1031cdf0e10cSrcweir if( bChanges && pView ) 1032cdf0e10cSrcweir pView->updateHandles(); 1033cdf0e10cSrcweir } 1034cdf0e10cSrcweir 1035cdf0e10cSrcweir void CustomAnimationPane::onSelectionChanged() 1036cdf0e10cSrcweir { 1037cdf0e10cSrcweir if( !maSelectionLock.isLocked() ) 1038cdf0e10cSrcweir { 1039cdf0e10cSrcweir ScopeLockGuard aGuard( maSelectionLock ); 1040cdf0e10cSrcweir 1041cdf0e10cSrcweir if( mxView.is() ) try 1042cdf0e10cSrcweir { 1043cdf0e10cSrcweir Reference< XSelectionSupplier > xSel( mxView, UNO_QUERY_THROW ); 1044cdf0e10cSrcweir if (xSel.is()) 1045cdf0e10cSrcweir { 1046cdf0e10cSrcweir maViewSelection = xSel->getSelection(); 1047cdf0e10cSrcweir mpCustomAnimationList->onSelectionChanged( maViewSelection ); 1048cdf0e10cSrcweir updateControls(); 1049cdf0e10cSrcweir } 1050cdf0e10cSrcweir } 1051cdf0e10cSrcweir catch( Exception& ) 1052cdf0e10cSrcweir { 1053cdf0e10cSrcweir DBG_ERROR( "sd::CustomAnimationPane::onSelectionChanged(), Exception catched!" ); 1054cdf0e10cSrcweir } 1055cdf0e10cSrcweir } 1056cdf0e10cSrcweir } 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir void CustomAnimationPane::onDoubleClick() 1059cdf0e10cSrcweir { 1060cdf0e10cSrcweir showOptions(); 1061cdf0e10cSrcweir } 1062cdf0e10cSrcweir 1063cdf0e10cSrcweir void CustomAnimationPane::onContextMenu( sal_uInt16 nSelectedPopupEntry ) 1064cdf0e10cSrcweir { 1065cdf0e10cSrcweir switch( nSelectedPopupEntry ) 1066cdf0e10cSrcweir { 1067cdf0e10cSrcweir case CM_WITH_CLICK: onChangeStart( EffectNodeType::ON_CLICK ); break; 1068cdf0e10cSrcweir case CM_WITH_PREVIOUS: onChangeStart( EffectNodeType::WITH_PREVIOUS ); break; 1069cdf0e10cSrcweir case CM_AFTER_PREVIOUS: onChangeStart( EffectNodeType::AFTER_PREVIOUS ); break; 1070cdf0e10cSrcweir case CM_OPTIONS: showOptions(); break; 1071cdf0e10cSrcweir case CM_DURATION: showOptions(RID_TP_CUSTOMANIMATION_DURATION); break; 1072cdf0e10cSrcweir case CM_REMOVE: onRemove(); break; 1073cdf0e10cSrcweir case CM_CREATE: if( maViewSelection.hasValue() ) onChange( true ); break; 1074cdf0e10cSrcweir } 1075cdf0e10cSrcweir 1076cdf0e10cSrcweir updateControls(); 1077cdf0e10cSrcweir } 1078cdf0e10cSrcweir 1079*7a32b0c8SAndre Fischer 1080*7a32b0c8SAndre Fischer 1081*7a32b0c8SAndre Fischer 1082*7a32b0c8SAndre Fischer void CustomAnimationPane::DataChanged (const DataChangedEvent& rEvent) 1083*7a32b0c8SAndre Fischer { 1084*7a32b0c8SAndre Fischer (void)rEvent; 1085*7a32b0c8SAndre Fischer UpdateLook(); 1086*7a32b0c8SAndre Fischer } 1087*7a32b0c8SAndre Fischer 1088*7a32b0c8SAndre Fischer 1089*7a32b0c8SAndre Fischer 1090*7a32b0c8SAndre Fischer 1091*7a32b0c8SAndre Fischer void CustomAnimationPane::UpdateLook (void) 1092*7a32b0c8SAndre Fischer { 1093*7a32b0c8SAndre Fischer SetBackground(::sfx2::sidebar::Theme::GetWallpaper(::sfx2::sidebar::Theme::Paint_PanelBackground)); 1094*7a32b0c8SAndre Fischer if (mpFLModify != NULL) 1095*7a32b0c8SAndre Fischer mpFLModify->SetBackground(Wallpaper()); 1096*7a32b0c8SAndre Fischer if (mpFLEffect != NULL) 1097*7a32b0c8SAndre Fischer mpFLEffect->SetBackground(Wallpaper()); 1098*7a32b0c8SAndre Fischer if (mpFTStart != NULL) 1099*7a32b0c8SAndre Fischer mpFTStart->SetBackground(Wallpaper()); 1100*7a32b0c8SAndre Fischer if (mpFTProperty != NULL) 1101*7a32b0c8SAndre Fischer mpFTProperty->SetBackground(Wallpaper()); 1102*7a32b0c8SAndre Fischer if (mpFTSpeed != NULL) 1103*7a32b0c8SAndre Fischer mpFTSpeed->SetBackground(Wallpaper()); 1104*7a32b0c8SAndre Fischer if (mpFTChangeOrder != NULL) 1105*7a32b0c8SAndre Fischer mpFTChangeOrder->SetBackground(Wallpaper()); 1106*7a32b0c8SAndre Fischer if (mpFLSeperator1 != NULL) 1107*7a32b0c8SAndre Fischer mpFLSeperator1->SetBackground(Wallpaper()); 1108*7a32b0c8SAndre Fischer if (mpFLSeperator2 != NULL) 1109*7a32b0c8SAndre Fischer mpFLSeperator2->SetBackground(Wallpaper()); 1110*7a32b0c8SAndre Fischer } 1111*7a32b0c8SAndre Fischer 1112*7a32b0c8SAndre Fischer 1113*7a32b0c8SAndre Fischer 1114*7a32b0c8SAndre Fischer 1115cdf0e10cSrcweir void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue ) 1116cdf0e10cSrcweir { 1117cdf0e10cSrcweir switch( pSet->getPropertyState( nHandle ) ) 1118cdf0e10cSrcweir { 1119cdf0e10cSrcweir case STLPropertyState_AMBIGUOUS: 1120cdf0e10cSrcweir // value is already ambiguous, do nothing 1121cdf0e10cSrcweir break; 1122cdf0e10cSrcweir case STLPropertyState_DIRECT: 1123cdf0e10cSrcweir // set to ambiguous if existing value is different 1124cdf0e10cSrcweir if( rValue != pSet->getPropertyValue( nHandle ) ) 1125cdf0e10cSrcweir pSet->setPropertyState( nHandle, STLPropertyState_AMBIGUOUS ); 1126cdf0e10cSrcweir break; 1127cdf0e10cSrcweir case STLPropertyState_DEFAULT: 1128cdf0e10cSrcweir // just set new value 1129cdf0e10cSrcweir pSet->setPropertyValue( nHandle, rValue ); 1130cdf0e10cSrcweir break; 1131cdf0e10cSrcweir } 1132cdf0e10cSrcweir } 1133cdf0e10cSrcweir 1134cdf0e10cSrcweir static sal_Int32 calcMaxParaDepth( Reference< XShape > xTargetShape ) 1135cdf0e10cSrcweir { 1136cdf0e10cSrcweir sal_Int32 nMaxParaDepth = -1; 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir if( xTargetShape.is() ) 1139cdf0e10cSrcweir { 1140cdf0e10cSrcweir Reference< XEnumerationAccess > xText( xTargetShape, UNO_QUERY ); 1141cdf0e10cSrcweir if( xText.is() ) 1142cdf0e10cSrcweir { 1143cdf0e10cSrcweir Reference< XPropertySet > xParaSet; 1144cdf0e10cSrcweir const OUString strNumberingLevel( RTL_CONSTASCII_USTRINGPARAM("NumberingLevel") ); 1145cdf0e10cSrcweir 1146cdf0e10cSrcweir Reference< XEnumeration > xEnumeration( xText->createEnumeration(), UNO_QUERY_THROW ); 1147cdf0e10cSrcweir while( xEnumeration->hasMoreElements() ) 1148cdf0e10cSrcweir { 1149cdf0e10cSrcweir xEnumeration->nextElement() >>= xParaSet; 1150cdf0e10cSrcweir if( xParaSet.is() ) 1151cdf0e10cSrcweir { 1152cdf0e10cSrcweir sal_Int32 nParaDepth = 0; 1153cdf0e10cSrcweir xParaSet->getPropertyValue( strNumberingLevel ) >>= nParaDepth; 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir if( nParaDepth > nMaxParaDepth ) 1156cdf0e10cSrcweir nMaxParaDepth = nParaDepth; 1157cdf0e10cSrcweir } 1158cdf0e10cSrcweir } 1159cdf0e10cSrcweir } 1160cdf0e10cSrcweir } 1161cdf0e10cSrcweir 1162cdf0e10cSrcweir return nMaxParaDepth + 1; 1163cdf0e10cSrcweir } 1164cdf0e10cSrcweir 1165cdf0e10cSrcweir Any CustomAnimationPane::getProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect ) 1166cdf0e10cSrcweir { 1167cdf0e10cSrcweir switch( nType ) 1168cdf0e10cSrcweir { 1169cdf0e10cSrcweir case nPropertyTypeDirection: 1170cdf0e10cSrcweir case nPropertyTypeSpokes: 1171cdf0e10cSrcweir case nPropertyTypeZoom: 1172cdf0e10cSrcweir return makeAny( pEffect->getPresetSubType() ); 1173cdf0e10cSrcweir 1174cdf0e10cSrcweir case nPropertyTypeColor: 1175cdf0e10cSrcweir case nPropertyTypeFillColor: 1176cdf0e10cSrcweir case nPropertyTypeFirstColor: 1177cdf0e10cSrcweir case nPropertyTypeSecondColor: 1178cdf0e10cSrcweir case nPropertyTypeCharColor: 1179cdf0e10cSrcweir case nPropertyTypeLineColor: 1180cdf0e10cSrcweir { 1181cdf0e10cSrcweir const sal_Int32 nIndex = (nPropertyTypeFirstColor == nType) ? 0 : 1; 1182cdf0e10cSrcweir return pEffect->getColor( nIndex ); 1183cdf0e10cSrcweir } 1184cdf0e10cSrcweir 1185cdf0e10cSrcweir case nPropertyTypeFont: 1186cdf0e10cSrcweir return pEffect->getProperty( AnimationNodeType::SET, OUString( RTL_CONSTASCII_USTRINGPARAM("CharFontName") ), VALUE_TO ); 1187cdf0e10cSrcweir 1188cdf0e10cSrcweir case nPropertyTypeCharHeight: 1189cdf0e10cSrcweir { 1190cdf0e10cSrcweir const OUString aAttributeName( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ); 1191cdf0e10cSrcweir Any aValue( pEffect->getProperty( AnimationNodeType::SET, aAttributeName, VALUE_TO ) ); 1192cdf0e10cSrcweir if( !aValue.hasValue() ) 1193cdf0e10cSrcweir aValue = pEffect->getProperty( AnimationNodeType::ANIMATE, aAttributeName, VALUE_TO ); 1194cdf0e10cSrcweir return aValue; 1195cdf0e10cSrcweir } 1196cdf0e10cSrcweir 1197cdf0e10cSrcweir case nPropertyTypeRotate: 1198cdf0e10cSrcweir return pEffect->getTransformationProperty( AnimationTransformType::ROTATE, VALUE_BY); 1199cdf0e10cSrcweir 1200cdf0e10cSrcweir case nPropertyTypeTransparency: 1201cdf0e10cSrcweir return pEffect->getProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("Opacity")), VALUE_TO ); 1202cdf0e10cSrcweir 1203cdf0e10cSrcweir case nPropertyTypeScale: 1204cdf0e10cSrcweir return pEffect->getTransformationProperty( AnimationTransformType::SCALE, VALUE_BY ); 1205cdf0e10cSrcweir 1206cdf0e10cSrcweir case nPropertyTypeCharDecoration: 1207cdf0e10cSrcweir { 1208cdf0e10cSrcweir Sequence< Any > aValues(3); 1209cdf0e10cSrcweir aValues[0] = pEffect->getProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharWeight")), VALUE_TO ); 1210cdf0e10cSrcweir aValues[1] = pEffect->getProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharPosture")), VALUE_TO ); 1211cdf0e10cSrcweir aValues[2] = pEffect->getProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharUnderline")), VALUE_TO ); 1212cdf0e10cSrcweir return makeAny( aValues ); 1213cdf0e10cSrcweir } 1214cdf0e10cSrcweir } 1215cdf0e10cSrcweir 1216cdf0e10cSrcweir Any aAny; 1217cdf0e10cSrcweir return aAny; 1218cdf0e10cSrcweir } 1219cdf0e10cSrcweir 1220cdf0e10cSrcweir bool CustomAnimationPane::setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, const Any& rValue ) 1221cdf0e10cSrcweir { 1222cdf0e10cSrcweir bool bEffectChanged = false; 1223cdf0e10cSrcweir switch( nType ) 1224cdf0e10cSrcweir { 1225cdf0e10cSrcweir case nPropertyTypeDirection: 1226cdf0e10cSrcweir case nPropertyTypeSpokes: 1227cdf0e10cSrcweir case nPropertyTypeZoom: 1228cdf0e10cSrcweir { 1229cdf0e10cSrcweir OUString aPresetSubType; 1230cdf0e10cSrcweir rValue >>= aPresetSubType; 1231cdf0e10cSrcweir if( aPresetSubType != pEffect->getPresetSubType() ) 1232cdf0e10cSrcweir { 1233cdf0e10cSrcweir getPresets().changePresetSubType( pEffect, aPresetSubType ); 1234cdf0e10cSrcweir bEffectChanged = true; 1235cdf0e10cSrcweir } 1236cdf0e10cSrcweir } 1237cdf0e10cSrcweir break; 1238cdf0e10cSrcweir 1239cdf0e10cSrcweir case nPropertyTypeFillColor: 1240cdf0e10cSrcweir case nPropertyTypeColor: 1241cdf0e10cSrcweir case nPropertyTypeFirstColor: 1242cdf0e10cSrcweir case nPropertyTypeSecondColor: 1243cdf0e10cSrcweir case nPropertyTypeCharColor: 1244cdf0e10cSrcweir case nPropertyTypeLineColor: 1245cdf0e10cSrcweir { 1246cdf0e10cSrcweir const sal_Int32 nIndex = (nPropertyTypeFirstColor == nType) ? 0 : 1; 1247cdf0e10cSrcweir Any aOldColor( pEffect->getColor( nIndex ) ); 1248cdf0e10cSrcweir if( aOldColor != rValue ) 1249cdf0e10cSrcweir { 1250cdf0e10cSrcweir pEffect->setColor( nIndex, rValue ); 1251cdf0e10cSrcweir bEffectChanged = true; 1252cdf0e10cSrcweir } 1253cdf0e10cSrcweir } 1254cdf0e10cSrcweir break; 1255cdf0e10cSrcweir 1256cdf0e10cSrcweir case nPropertyTypeFont: 1257cdf0e10cSrcweir bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), VALUE_TO, rValue ); 1258cdf0e10cSrcweir break; 1259cdf0e10cSrcweir 1260cdf0e10cSrcweir case nPropertyTypeCharHeight: 1261cdf0e10cSrcweir { 1262cdf0e10cSrcweir const OUString aAttributeName( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ); 1263cdf0e10cSrcweir bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, aAttributeName, VALUE_TO, rValue ); 1264cdf0e10cSrcweir if( !bEffectChanged ) 1265cdf0e10cSrcweir bEffectChanged = pEffect->setProperty( AnimationNodeType::ANIMATE, aAttributeName, VALUE_TO, rValue ); 1266cdf0e10cSrcweir } 1267cdf0e10cSrcweir break; 1268cdf0e10cSrcweir case nPropertyTypeRotate: 1269cdf0e10cSrcweir bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::ROTATE, VALUE_BY , rValue ); 1270cdf0e10cSrcweir break; 1271cdf0e10cSrcweir 1272cdf0e10cSrcweir case nPropertyTypeTransparency: 1273cdf0e10cSrcweir bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, OUString( RTL_CONSTASCII_USTRINGPARAM("Opacity") ), VALUE_TO, rValue ); 1274cdf0e10cSrcweir break; 1275cdf0e10cSrcweir 1276cdf0e10cSrcweir case nPropertyTypeScale: 1277cdf0e10cSrcweir bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::SCALE, VALUE_BY, rValue ); 1278cdf0e10cSrcweir break; 1279cdf0e10cSrcweir 1280cdf0e10cSrcweir case nPropertyTypeCharDecoration: 1281cdf0e10cSrcweir { 1282cdf0e10cSrcweir Sequence< Any > aValues(3); 1283cdf0e10cSrcweir rValue >>= aValues; 1284cdf0e10cSrcweir bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharWeight")), VALUE_TO, aValues[0] ); 1285cdf0e10cSrcweir bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharPosture")), VALUE_TO, aValues[1] ); 1286cdf0e10cSrcweir bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET, OUString(RTL_CONSTASCII_USTRINGPARAM("CharUnderline")), VALUE_TO, aValues[2] ); 1287cdf0e10cSrcweir } 1288cdf0e10cSrcweir break; 1289cdf0e10cSrcweir 1290cdf0e10cSrcweir } 1291cdf0e10cSrcweir 1292cdf0e10cSrcweir return bEffectChanged; 1293cdf0e10cSrcweir } 1294cdf0e10cSrcweir 1295cdf0e10cSrcweir static sal_Bool hasVisibleShape( const Reference< XShape >& xShape ) 1296cdf0e10cSrcweir { 1297cdf0e10cSrcweir try 1298cdf0e10cSrcweir { 1299cdf0e10cSrcweir const OUString sShapeType( xShape->getShapeType() ); 1300cdf0e10cSrcweir 1301cdf0e10cSrcweir if( sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TitleTextShape") ) || 1302cdf0e10cSrcweir sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.OutlinerShape") ) || 1303cdf0e10cSrcweir sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.SubtitleShape") ) || 1304cdf0e10cSrcweir sShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TextShape") ) ) 1305cdf0e10cSrcweir { 1306cdf0e10cSrcweir const OUString sFillStyle( RTL_CONSTASCII_USTRINGPARAM("FillStyle" ) ); 1307cdf0e10cSrcweir const OUString sLineStyle( RTL_CONSTASCII_USTRINGPARAM("LineStyle" ) ); 1308cdf0e10cSrcweir Reference< XPropertySet > xSet( xShape, UNO_QUERY_THROW ); 1309cdf0e10cSrcweir 1310cdf0e10cSrcweir FillStyle eFillStyle; 1311cdf0e10cSrcweir xSet->getPropertyValue( sFillStyle ) >>= eFillStyle; 1312cdf0e10cSrcweir 1313cdf0e10cSrcweir ::com::sun::star::drawing::LineStyle eLineStyle; 1314cdf0e10cSrcweir xSet->getPropertyValue( sLineStyle ) >>= eLineStyle; 1315cdf0e10cSrcweir 1316cdf0e10cSrcweir return eFillStyle != FillStyle_NONE || eLineStyle != ::com::sun::star::drawing::LineStyle_NONE; 1317cdf0e10cSrcweir } 1318cdf0e10cSrcweir } 1319cdf0e10cSrcweir catch( Exception& e ) 1320cdf0e10cSrcweir { 1321cdf0e10cSrcweir (void)e; 1322cdf0e10cSrcweir } 1323cdf0e10cSrcweir return sal_True; 1324cdf0e10cSrcweir } 1325cdf0e10cSrcweir 1326cdf0e10cSrcweir STLPropertySet* CustomAnimationPane::createSelectionSet() 1327cdf0e10cSrcweir { 1328cdf0e10cSrcweir STLPropertySet* pSet = CustomAnimationDialog::createDefaultSet(); 1329cdf0e10cSrcweir 1330cdf0e10cSrcweir pSet->setPropertyValue( nHandleCurrentPage, makeAny( mxCurrentPage ) ); 1331cdf0e10cSrcweir 1332cdf0e10cSrcweir sal_Int32 nMaxParaDepth = 0; 1333cdf0e10cSrcweir 1334cdf0e10cSrcweir // get options from selected effects 1335cdf0e10cSrcweir EffectSequence::iterator aIter( maListSelection.begin() ); 1336cdf0e10cSrcweir const EffectSequence::iterator aEnd( maListSelection.end() ); 1337cdf0e10cSrcweir const CustomAnimationPresets& rPresets (getPresets()); 1338cdf0e10cSrcweir while( aIter != aEnd ) 1339cdf0e10cSrcweir { 1340cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aIter++); 1341cdf0e10cSrcweir 1342cdf0e10cSrcweir EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence(); 1343cdf0e10cSrcweir if( !pEffectSequence ) 1344cdf0e10cSrcweir pEffectSequence = mpMainSequence.get(); 1345cdf0e10cSrcweir 1346cdf0e10cSrcweir if( pEffect->hasText() ) 1347cdf0e10cSrcweir { 1348cdf0e10cSrcweir sal_Int32 n = calcMaxParaDepth(pEffect->getTargetShape()); 1349cdf0e10cSrcweir if( n > nMaxParaDepth ) 1350cdf0e10cSrcweir nMaxParaDepth = n; 1351cdf0e10cSrcweir } 1352cdf0e10cSrcweir 1353cdf0e10cSrcweir addValue( pSet, nHandleHasAfterEffect, makeAny( pEffect->hasAfterEffect() ) ); 1354cdf0e10cSrcweir addValue( pSet, nHandleAfterEffectOnNextEffect, makeAny( pEffect->IsAfterEffectOnNext() ? sal_True : sal_False ) ); 1355cdf0e10cSrcweir addValue( pSet, nHandleDimColor, pEffect->getDimColor() ); 1356cdf0e10cSrcweir addValue( pSet, nHandleIterateType, makeAny( pEffect->getIterateType() ) ); 1357cdf0e10cSrcweir 1358cdf0e10cSrcweir // convert absolute time to percentage value 1359cdf0e10cSrcweir // This calculation is done in float to avoid some rounding artifacts. 1360cdf0e10cSrcweir float fIterateInterval = (float)pEffect->getIterateInterval(); 1361cdf0e10cSrcweir if( pEffect->getDuration() ) 1362cdf0e10cSrcweir fIterateInterval = (float)(fIterateInterval / pEffect->getDuration() ); 1363cdf0e10cSrcweir fIterateInterval *= 100.0; 1364cdf0e10cSrcweir addValue( pSet, nHandleIterateInterval, makeAny( (double)fIterateInterval ) ); 1365cdf0e10cSrcweir 1366cdf0e10cSrcweir addValue( pSet, nHandleBegin, makeAny( pEffect->getBegin() ) ); 1367cdf0e10cSrcweir addValue( pSet, nHandleDuration, makeAny( pEffect->getDuration() ) ); 1368cdf0e10cSrcweir addValue( pSet, nHandleStart, makeAny( pEffect->getNodeType() ) ); 1369cdf0e10cSrcweir addValue( pSet, nHandleRepeat, makeAny( pEffect->getRepeatCount() ) ); 1370cdf0e10cSrcweir addValue( pSet, nHandleEnd, pEffect->getEnd() ); 1371cdf0e10cSrcweir addValue( pSet, nHandleRewind, makeAny( pEffect->getFill() ) ); 1372cdf0e10cSrcweir 1373cdf0e10cSrcweir addValue( pSet, nHandlePresetId, makeAny( pEffect->getPresetId() ) ); 1374cdf0e10cSrcweir 1375cdf0e10cSrcweir addValue( pSet, nHandleHasText, makeAny( (sal_Bool)pEffect->hasText() ) ); 1376cdf0e10cSrcweir 1377cdf0e10cSrcweir addValue( pSet, nHandleHasVisibleShape, Any( hasVisibleShape( pEffect->getTargetShape() ) ) ); 1378cdf0e10cSrcweir 1379cdf0e10cSrcweir Any aSoundSource; 1380cdf0e10cSrcweir if( pEffect->getAudio().is() ) 1381cdf0e10cSrcweir { 1382cdf0e10cSrcweir aSoundSource = pEffect->getAudio()->getSource(); 1383cdf0e10cSrcweir addValue( pSet, nHandleSoundVolumne, makeAny( pEffect->getAudio()->getVolume() ) ); 1384cdf0e10cSrcweir // todo addValue( pSet, nHandleSoundEndAfterSlide, makeAny( pEffect->getAudio()->getEndAfterSlide() ) ); 1385cdf0e10cSrcweir // this is now stored at the XCommand parameter sequence 1386cdf0e10cSrcweir } 1387cdf0e10cSrcweir else if( pEffect->getCommand() == EffectCommands::STOPAUDIO ) 1388cdf0e10cSrcweir { 1389cdf0e10cSrcweir aSoundSource = makeAny( (sal_Bool)sal_True ); 1390cdf0e10cSrcweir } 1391cdf0e10cSrcweir addValue( pSet, nHandleSoundURL, aSoundSource ); 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir sal_Int32 nGroupId = pEffect->getGroupId(); 1394cdf0e10cSrcweir CustomAnimationTextGroupPtr pTextGroup; 1395cdf0e10cSrcweir if( nGroupId != -1 ) 1396cdf0e10cSrcweir pTextGroup = pEffectSequence->findGroup( nGroupId ); 1397cdf0e10cSrcweir 1398cdf0e10cSrcweir addValue( pSet, nHandleTextGrouping, makeAny( pTextGroup.get() ? pTextGroup->getTextGrouping() : (sal_Int32)-1 ) ); 1399cdf0e10cSrcweir addValue( pSet, nHandleAnimateForm, makeAny( pTextGroup.get() ? (sal_Bool)pTextGroup->getAnimateForm() : sal_True ) ); 1400cdf0e10cSrcweir addValue( pSet, nHandleTextGroupingAuto, makeAny( pTextGroup.get() ? pTextGroup->getTextGroupingAuto() : (double)-1.0 ) ); 1401cdf0e10cSrcweir addValue( pSet, nHandleTextReverse, makeAny( pTextGroup.get() ? (sal_Bool)pTextGroup->getTextReverse() : sal_False ) ); 1402cdf0e10cSrcweir 1403cdf0e10cSrcweir if( pEffectSequence->getSequenceType() == EffectNodeType::INTERACTIVE_SEQUENCE ) 1404cdf0e10cSrcweir { 1405cdf0e10cSrcweir InteractiveSequence* pIS = static_cast< InteractiveSequence* >( pEffectSequence ); 1406cdf0e10cSrcweir addValue( pSet, nHandleTrigger, makeAny( pIS->getTriggerShape() ) ); 1407cdf0e10cSrcweir } 1408cdf0e10cSrcweir 1409cdf0e10cSrcweir // 1410cdf0e10cSrcweir 1411cdf0e10cSrcweir CustomAnimationPresetPtr pDescriptor = rPresets.getEffectDescriptor( pEffect->getPresetId() ); 1412cdf0e10cSrcweir if( pDescriptor.get() ) 1413cdf0e10cSrcweir { 1414cdf0e10cSrcweir sal_Int32 nType = nPropertyTypeNone; 1415cdf0e10cSrcweir 1416cdf0e10cSrcweir UStringList aProperties( pDescriptor->getProperties() ); 1417cdf0e10cSrcweir if( aProperties.size() >= 1 ) 1418cdf0e10cSrcweir nType = getPropertyType( aProperties.front() ); 1419cdf0e10cSrcweir 1420cdf0e10cSrcweir if( nType != nPropertyTypeNone ) 1421cdf0e10cSrcweir { 1422cdf0e10cSrcweir addValue( pSet, nHandleProperty1Type, makeAny( nType ) ); 1423cdf0e10cSrcweir addValue( pSet, nHandleProperty1Value, getProperty1Value( nType, pEffect ) ); 1424cdf0e10cSrcweir } 1425cdf0e10cSrcweir 1426cdf0e10cSrcweir if( pDescriptor->hasProperty( OUString( RTL_CONSTASCII_USTRINGPARAM( "Accelerate" ) ) ) ) 1427cdf0e10cSrcweir { 1428cdf0e10cSrcweir addValue( pSet, nHandleAccelerate, makeAny( pEffect->getAcceleration() ) ); 1429cdf0e10cSrcweir } 1430cdf0e10cSrcweir 1431cdf0e10cSrcweir if( pDescriptor->hasProperty( OUString( RTL_CONSTASCII_USTRINGPARAM( "Decelerate" ) ) ) ) 1432cdf0e10cSrcweir { 1433cdf0e10cSrcweir addValue( pSet, nHandleDecelerate, makeAny( pEffect->getDecelerate() ) ); 1434cdf0e10cSrcweir } 1435cdf0e10cSrcweir 1436cdf0e10cSrcweir if( pDescriptor->hasProperty( OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoReverse" ) ) ) ) 1437cdf0e10cSrcweir { 1438cdf0e10cSrcweir addValue( pSet, nHandleAutoReverse, makeAny( pEffect->getAutoReverse() ) ); 1439cdf0e10cSrcweir } 1440cdf0e10cSrcweir } 1441cdf0e10cSrcweir } 1442cdf0e10cSrcweir 1443cdf0e10cSrcweir addValue( pSet, nHandleMaxParaDepth, makeAny( nMaxParaDepth ) ); 1444cdf0e10cSrcweir 1445cdf0e10cSrcweir return pSet; 1446cdf0e10cSrcweir } 1447cdf0e10cSrcweir 1448cdf0e10cSrcweir void CustomAnimationPane::changeSelection( STLPropertySet* pResultSet, STLPropertySet* pOldSet ) 1449cdf0e10cSrcweir { 1450cdf0e10cSrcweir // change selected effect 1451cdf0e10cSrcweir bool bChanged = false; 1452cdf0e10cSrcweir 1453cdf0e10cSrcweir MainSequenceRebuildGuard aGuard( mpMainSequence ); 1454cdf0e10cSrcweir 1455cdf0e10cSrcweir EffectSequence::iterator aIter( maListSelection.begin() ); 1456cdf0e10cSrcweir const EffectSequence::iterator aEnd( maListSelection.end() ); 1457cdf0e10cSrcweir while( aIter != aEnd ) 1458cdf0e10cSrcweir { 1459cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aIter++); 1460cdf0e10cSrcweir 1461cdf0e10cSrcweir DBG_ASSERT( pEffect->getEffectSequence(), "sd::CustomAnimationPane::changeSelection(), dead effect in selection!" ); 1462cdf0e10cSrcweir if( !pEffect->getEffectSequence() ) 1463cdf0e10cSrcweir continue; 1464cdf0e10cSrcweir 1465cdf0e10cSrcweir double fDuration = 0.0; // we might need this for iterate-interval 1466cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT ) 1467cdf0e10cSrcweir { 1468cdf0e10cSrcweir pResultSet->getPropertyValue( nHandleDuration ) >>= fDuration; 1469cdf0e10cSrcweir } 1470cdf0e10cSrcweir else 1471cdf0e10cSrcweir { 1472cdf0e10cSrcweir fDuration = pEffect->getDuration(); 1473cdf0e10cSrcweir } 1474cdf0e10cSrcweir 1475cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleIterateType ) == STLPropertyState_DIRECT ) 1476cdf0e10cSrcweir { 1477cdf0e10cSrcweir sal_Int16 nIterateType = 0; 1478cdf0e10cSrcweir pResultSet->getPropertyValue( nHandleIterateType ) >>= nIterateType; 1479cdf0e10cSrcweir if( pEffect->getIterateType() != nIterateType ) 1480cdf0e10cSrcweir { 1481cdf0e10cSrcweir pEffect->setIterateType( nIterateType ); 1482cdf0e10cSrcweir bChanged = true; 1483cdf0e10cSrcweir } 1484cdf0e10cSrcweir } 1485cdf0e10cSrcweir 1486cdf0e10cSrcweir if( pEffect->getIterateType() ) 1487cdf0e10cSrcweir { 1488cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleIterateInterval ) == STLPropertyState_DIRECT ) 1489cdf0e10cSrcweir { 1490cdf0e10cSrcweir double fIterateInterval = 0.0; 1491cdf0e10cSrcweir pResultSet->getPropertyValue( nHandleIterateInterval ) >>= fIterateInterval; 1492cdf0e10cSrcweir if( pEffect->getIterateInterval() != fIterateInterval ) 1493cdf0e10cSrcweir { 1494cdf0e10cSrcweir const double f = fIterateInterval * pEffect->getDuration() / 100; 1495cdf0e10cSrcweir pEffect->setIterateInterval( f ); 1496cdf0e10cSrcweir bChanged = true; 1497cdf0e10cSrcweir } 1498cdf0e10cSrcweir } 1499cdf0e10cSrcweir } 1500cdf0e10cSrcweir 1501cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleBegin ) == STLPropertyState_DIRECT ) 1502cdf0e10cSrcweir { 1503cdf0e10cSrcweir double fBegin = 0.0; 1504cdf0e10cSrcweir pResultSet->getPropertyValue( nHandleBegin ) >>= fBegin; 1505cdf0e10cSrcweir if( pEffect->getBegin() != fBegin ) 1506cdf0e10cSrcweir { 1507cdf0e10cSrcweir pEffect->setBegin( fBegin ); 1508cdf0e10cSrcweir bChanged = true; 1509cdf0e10cSrcweir } 1510cdf0e10cSrcweir } 1511cdf0e10cSrcweir 1512cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT ) 1513cdf0e10cSrcweir { 1514cdf0e10cSrcweir if( pEffect->getDuration() != fDuration ) 1515cdf0e10cSrcweir { 1516cdf0e10cSrcweir pEffect->setDuration( fDuration ); 1517cdf0e10cSrcweir bChanged = true; 1518cdf0e10cSrcweir } 1519cdf0e10cSrcweir } 1520cdf0e10cSrcweir 1521cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleStart ) == STLPropertyState_DIRECT ) 1522cdf0e10cSrcweir { 1523cdf0e10cSrcweir sal_Int16 nNodeType = 0; 1524cdf0e10cSrcweir pResultSet->getPropertyValue( nHandleStart ) >>= nNodeType; 1525cdf0e10cSrcweir if( pEffect->getNodeType() != nNodeType ) 1526cdf0e10cSrcweir { 1527cdf0e10cSrcweir pEffect->setNodeType( nNodeType ); 1528cdf0e10cSrcweir bChanged = true; 1529cdf0e10cSrcweir } 1530cdf0e10cSrcweir } 1531cdf0e10cSrcweir 1532cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleRepeat ) == STLPropertyState_DIRECT ) 1533cdf0e10cSrcweir { 1534cdf0e10cSrcweir Any aRepeatCount( pResultSet->getPropertyValue( nHandleRepeat ) ); 1535cdf0e10cSrcweir if( aRepeatCount != pEffect->getRepeatCount() ) 1536cdf0e10cSrcweir { 1537cdf0e10cSrcweir pEffect->setRepeatCount( aRepeatCount ); 1538cdf0e10cSrcweir bChanged = true; 1539cdf0e10cSrcweir } 1540cdf0e10cSrcweir } 1541cdf0e10cSrcweir 1542cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleEnd ) == STLPropertyState_DIRECT ) 1543cdf0e10cSrcweir { 1544cdf0e10cSrcweir Any aEndValue( pResultSet->getPropertyValue( nHandleEnd ) ); 1545cdf0e10cSrcweir if( pEffect->getEnd() != aEndValue ) 1546cdf0e10cSrcweir { 1547cdf0e10cSrcweir pEffect->setEnd( aEndValue ); 1548cdf0e10cSrcweir bChanged = true; 1549cdf0e10cSrcweir } 1550cdf0e10cSrcweir } 1551cdf0e10cSrcweir 1552cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleRewind ) == STLPropertyState_DIRECT ) 1553cdf0e10cSrcweir { 1554cdf0e10cSrcweir sal_Int16 nFill = 0; 1555cdf0e10cSrcweir pResultSet->getPropertyValue( nHandleRewind ) >>= nFill; 1556cdf0e10cSrcweir if( pEffect->getFill() != nFill ) 1557cdf0e10cSrcweir { 1558cdf0e10cSrcweir pEffect->setFill( nFill ); 1559cdf0e10cSrcweir bChanged = true; 1560cdf0e10cSrcweir } 1561cdf0e10cSrcweir } 1562cdf0e10cSrcweir 1563cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleHasAfterEffect ) == STLPropertyState_DIRECT ) 1564cdf0e10cSrcweir { 1565cdf0e10cSrcweir sal_Bool bHasAfterEffect = sal_False; 1566cdf0e10cSrcweir if( pResultSet->getPropertyValue( nHandleHasAfterEffect ) >>= bHasAfterEffect ) 1567cdf0e10cSrcweir { 1568cdf0e10cSrcweir if( pEffect->hasAfterEffect() != bHasAfterEffect ) 1569cdf0e10cSrcweir { 1570cdf0e10cSrcweir pEffect->setHasAfterEffect( bHasAfterEffect ); 1571cdf0e10cSrcweir bChanged = true; 1572cdf0e10cSrcweir } 1573cdf0e10cSrcweir } 1574cdf0e10cSrcweir } 1575cdf0e10cSrcweir 1576cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleAfterEffectOnNextEffect ) == STLPropertyState_DIRECT ) 1577cdf0e10cSrcweir { 1578cdf0e10cSrcweir sal_Bool bAfterEffectOnNextEffect = sal_False; 1579cdf0e10cSrcweir if( (pResultSet->getPropertyValue( nHandleAfterEffectOnNextEffect ) >>= bAfterEffectOnNextEffect) && ((pEffect->IsAfterEffectOnNext() ? sal_True : sal_False) != bAfterEffectOnNextEffect) ) 1580cdf0e10cSrcweir { 1581cdf0e10cSrcweir pEffect->setAfterEffectOnNext( bAfterEffectOnNextEffect ); 1582cdf0e10cSrcweir bChanged = true; 1583cdf0e10cSrcweir } 1584cdf0e10cSrcweir } 1585cdf0e10cSrcweir 1586cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleDimColor ) == STLPropertyState_DIRECT ) 1587cdf0e10cSrcweir { 1588cdf0e10cSrcweir Any aDimColor( pResultSet->getPropertyValue( nHandleDimColor ) ); 1589cdf0e10cSrcweir if( pEffect->getDimColor() != aDimColor ) 1590cdf0e10cSrcweir { 1591cdf0e10cSrcweir pEffect->setDimColor( aDimColor ); 1592cdf0e10cSrcweir bChanged = true; 1593cdf0e10cSrcweir } 1594cdf0e10cSrcweir } 1595cdf0e10cSrcweir 1596cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleAccelerate ) == STLPropertyState_DIRECT ) 1597cdf0e10cSrcweir { 1598cdf0e10cSrcweir double fAccelerate = 0.0; 1599cdf0e10cSrcweir pResultSet->getPropertyValue( nHandleAccelerate ) >>= fAccelerate; 1600cdf0e10cSrcweir if( pEffect->getAcceleration() != fAccelerate ) 1601cdf0e10cSrcweir { 1602cdf0e10cSrcweir pEffect->setAcceleration( fAccelerate ); 1603cdf0e10cSrcweir bChanged = true; 1604cdf0e10cSrcweir } 1605cdf0e10cSrcweir } 1606cdf0e10cSrcweir 1607cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleDecelerate ) == STLPropertyState_DIRECT ) 1608cdf0e10cSrcweir { 1609cdf0e10cSrcweir double fDecelerate = 0.0; 1610cdf0e10cSrcweir pResultSet->getPropertyValue( nHandleDecelerate ) >>= fDecelerate; 1611cdf0e10cSrcweir if( pEffect->getDecelerate() != fDecelerate ) 1612cdf0e10cSrcweir { 1613cdf0e10cSrcweir pEffect->setDecelerate( fDecelerate ); 1614cdf0e10cSrcweir bChanged = true; 1615cdf0e10cSrcweir } 1616cdf0e10cSrcweir } 1617cdf0e10cSrcweir 1618cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleAutoReverse ) == STLPropertyState_DIRECT ) 1619cdf0e10cSrcweir { 1620cdf0e10cSrcweir sal_Bool bAutoReverse = sal_False; 1621cdf0e10cSrcweir pResultSet->getPropertyValue( nHandleAutoReverse ) >>= bAutoReverse; 1622cdf0e10cSrcweir if( pEffect->getAutoReverse() != bAutoReverse ) 1623cdf0e10cSrcweir { 1624cdf0e10cSrcweir pEffect->setAutoReverse( bAutoReverse ); 1625cdf0e10cSrcweir bChanged = true; 1626cdf0e10cSrcweir } 1627cdf0e10cSrcweir } 1628cdf0e10cSrcweir 1629cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleProperty1Value ) == STLPropertyState_DIRECT ) 1630cdf0e10cSrcweir { 1631cdf0e10cSrcweir sal_Int32 nType = 0; 1632cdf0e10cSrcweir pOldSet->getPropertyValue( nHandleProperty1Type ) >>= nType; 1633cdf0e10cSrcweir 1634cdf0e10cSrcweir bChanged |= setProperty1Value( nType, pEffect, pResultSet->getPropertyValue( nHandleProperty1Value ) ); 1635cdf0e10cSrcweir } 1636cdf0e10cSrcweir 1637cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleSoundURL ) == STLPropertyState_DIRECT ) 1638cdf0e10cSrcweir { 1639cdf0e10cSrcweir const Any aSoundSource( pResultSet->getPropertyValue( nHandleSoundURL ) ); 1640cdf0e10cSrcweir 1641cdf0e10cSrcweir if( aSoundSource.getValueType() == ::getCppuType((const sal_Bool*)0) ) 1642cdf0e10cSrcweir { 1643cdf0e10cSrcweir pEffect->setStopAudio(); 1644cdf0e10cSrcweir bChanged = true; 1645cdf0e10cSrcweir } 1646cdf0e10cSrcweir else 1647cdf0e10cSrcweir { 1648cdf0e10cSrcweir OUString aSoundURL; 1649cdf0e10cSrcweir aSoundSource >>= aSoundURL; 1650cdf0e10cSrcweir 1651cdf0e10cSrcweir if( aSoundURL.getLength() ) 1652cdf0e10cSrcweir { 1653cdf0e10cSrcweir if( !pEffect->getAudio().is() ) 1654cdf0e10cSrcweir { 1655cdf0e10cSrcweir pEffect->createAudio( aSoundSource ); 1656cdf0e10cSrcweir bChanged = true; 1657cdf0e10cSrcweir } 1658cdf0e10cSrcweir else 1659cdf0e10cSrcweir { 1660cdf0e10cSrcweir if( pEffect->getAudio()->getSource() != aSoundSource ) 1661cdf0e10cSrcweir { 1662cdf0e10cSrcweir pEffect->getAudio()->setSource( aSoundSource ); 1663cdf0e10cSrcweir bChanged = true; 1664cdf0e10cSrcweir } 1665cdf0e10cSrcweir } 1666cdf0e10cSrcweir } 1667cdf0e10cSrcweir else 1668cdf0e10cSrcweir { 1669cdf0e10cSrcweir if( pEffect->getAudio().is() || pEffect->getStopAudio() ) 1670cdf0e10cSrcweir { 1671cdf0e10cSrcweir pEffect->removeAudio(); 1672cdf0e10cSrcweir bChanged = true; 1673cdf0e10cSrcweir } 1674cdf0e10cSrcweir } 1675cdf0e10cSrcweir } 1676cdf0e10cSrcweir } 1677cdf0e10cSrcweir 1678cdf0e10cSrcweir if( pResultSet->getPropertyState( nHandleTrigger ) == STLPropertyState_DIRECT ) 1679cdf0e10cSrcweir { 1680cdf0e10cSrcweir Reference< XShape > xTriggerShape; 1681cdf0e10cSrcweir pResultSet->getPropertyValue( nHandleTrigger ) >>= xTriggerShape; 1682cdf0e10cSrcweir bChanged |= mpMainSequence->setTrigger( pEffect, xTriggerShape ); 1683cdf0e10cSrcweir } 1684cdf0e10cSrcweir } 1685cdf0e10cSrcweir 1686cdf0e10cSrcweir const bool bHasTextGrouping = pResultSet->getPropertyState( nHandleTextGrouping ) == STLPropertyState_DIRECT; 1687cdf0e10cSrcweir const bool bHasAnimateForm = pResultSet->getPropertyState( nHandleAnimateForm ) == STLPropertyState_DIRECT; 1688cdf0e10cSrcweir const bool bHasTextGroupingAuto = pResultSet->getPropertyState( nHandleTextGroupingAuto ) == STLPropertyState_DIRECT; 1689cdf0e10cSrcweir const bool bHasTextReverse = pResultSet->getPropertyState( nHandleTextReverse ) == STLPropertyState_DIRECT; 1690cdf0e10cSrcweir 1691cdf0e10cSrcweir if( bHasTextGrouping || bHasAnimateForm || bHasTextGroupingAuto || bHasTextReverse ) 1692cdf0e10cSrcweir { 1693cdf0e10cSrcweir // we need to do a second pass for text grouping options 1694cdf0e10cSrcweir // since changing them can cause effects to be removed 1695cdf0e10cSrcweir // or replaced, we do this after we aplied all other options 1696cdf0e10cSrcweir // above 1697cdf0e10cSrcweir 1698cdf0e10cSrcweir sal_Int32 nTextGrouping = 0; 1699cdf0e10cSrcweir sal_Bool bAnimateForm = sal_True, bTextReverse = sal_False; 1700cdf0e10cSrcweir double fTextGroupingAuto = -1.0; 1701cdf0e10cSrcweir 1702cdf0e10cSrcweir if( bHasTextGrouping ) 1703cdf0e10cSrcweir pResultSet->getPropertyValue(nHandleTextGrouping) >>= nTextGrouping; 1704cdf0e10cSrcweir 1705cdf0e10cSrcweir if( bHasAnimateForm ) 1706cdf0e10cSrcweir pResultSet->getPropertyValue(nHandleAnimateForm) >>= bAnimateForm; 1707cdf0e10cSrcweir 1708cdf0e10cSrcweir if( bHasTextGroupingAuto ) 1709cdf0e10cSrcweir pResultSet->getPropertyValue(nHandleTextGroupingAuto) >>= fTextGroupingAuto; 1710cdf0e10cSrcweir 1711cdf0e10cSrcweir if( bHasTextReverse ) 1712cdf0e10cSrcweir pResultSet->getPropertyValue(nHandleTextReverse) >>= bTextReverse; 1713cdf0e10cSrcweir 1714cdf0e10cSrcweir EffectSequence const aSelectedEffects( maListSelection ); 1715cdf0e10cSrcweir EffectSequence::const_iterator iter( aSelectedEffects.begin() ); 1716cdf0e10cSrcweir const EffectSequence::const_iterator iEnd( aSelectedEffects.end() ); 1717cdf0e10cSrcweir while( iter != iEnd ) 1718cdf0e10cSrcweir { 1719cdf0e10cSrcweir CustomAnimationEffectPtr const& pEffect = (*iter++); 1720cdf0e10cSrcweir 1721cdf0e10cSrcweir EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence(); 1722cdf0e10cSrcweir if( !pEffectSequence ) 1723cdf0e10cSrcweir pEffectSequence = mpMainSequence.get(); 1724cdf0e10cSrcweir 1725cdf0e10cSrcweir sal_Int32 nGroupId = pEffect->getGroupId(); 1726cdf0e10cSrcweir CustomAnimationTextGroupPtr pTextGroup; 1727cdf0e10cSrcweir if( (nGroupId != -1) ) 1728cdf0e10cSrcweir { 1729cdf0e10cSrcweir // use existing group 1730cdf0e10cSrcweir pTextGroup = pEffectSequence->findGroup( nGroupId ); 1731cdf0e10cSrcweir } 1732cdf0e10cSrcweir else 1733cdf0e10cSrcweir { 1734cdf0e10cSrcweir // somethings changed so we need a group now 1735cdf0e10cSrcweir pTextGroup = pEffectSequence->createTextGroup( pEffect, nTextGrouping, fTextGroupingAuto, bAnimateForm, bTextReverse ); 1736cdf0e10cSrcweir bChanged = true; 1737cdf0e10cSrcweir } 1738cdf0e10cSrcweir 17396024f9c4SZhe Wang //#Bug 119988# 17406024f9c4SZhe Wang /************************************************************************/ 17416024f9c4SZhe Wang /* 17426024f9c4SZhe Wang Note, the setAnimateForm means set the animation from TextGroup to Object's Shape 17436024f9c4SZhe Wang And on the UI in means "Animate attached shape" in "Effect Option" dialog 17446024f9c4SZhe Wang The setTextGrouping means set animation to Object's Text, 17456024f9c4SZhe Wang the nTextGrouping is Text Animation Type 17466024f9c4SZhe Wang nTextGrouping = -1 is "As one Object", means no text animation. 17476024f9c4SZhe Wang 17486024f9c4SZhe Wang The previous call order first do the setTextGrouping and then do the setAnimateForm, 17496024f9c4SZhe Wang that will cause such defect: in the setTextGrouping, the effect has been removed, 17506024f9c4SZhe Wang but in setAnimateForm still need this effect, then a NULL pointer of that effect will 17516024f9c4SZhe Wang be gotten, and cause crash. 17526024f9c4SZhe Wang 17536024f9c4SZhe Wang []bHasAnimateForm means the UI has changed, bAnimateForm is it value 17546024f9c4SZhe Wang 17556024f9c4SZhe Wang So if create a new textgroup animation, the following animation will never be run! 17566024f9c4SZhe Wang Since the ��Animate attached shape�� is default checked. 17576024f9c4SZhe Wang And the bHasAnimateForm default is false, and if user uncheck it the value bAnimateForm will be false, 17586024f9c4SZhe Wang it same as the TextGroup��s default value, also could not be run setAnimateForm. 17596024f9c4SZhe Wang if( bHasAnimateForm ) 17606024f9c4SZhe Wang { 17616024f9c4SZhe Wang if( pTextGroup->getAnimateForm() != bAnimateForm ) 17626024f9c4SZhe Wang { 17636024f9c4SZhe Wang pEffectSequence->setAnimateForm( pTextGroup, bAnimateForm ); 17646024f9c4SZhe Wang bChanged = true; 17656024f9c4SZhe Wang } 17666024f9c4SZhe Wang } 17676024f9c4SZhe Wang 17686024f9c4SZhe Wang In setTextGrouping, there are three case: 17696024f9c4SZhe Wang 1. Create new text effects for empty TextGroup 17706024f9c4SZhe Wang 2. Remove all text effects of TextGroup (nTextGrouping == -1) 17716024f9c4SZhe Wang 3. Change all the text effects�� start type 17726024f9c4SZhe Wang 17736024f9c4SZhe Wang So here is the right logic: 17746024f9c4SZhe Wang If set the animation from text to shape and remove text animation, 17756024f9c4SZhe Wang should do setAnimateForm first, then do setTextGrouping. 17766024f9c4SZhe Wang Other case,do setTextGrouping first, then do setAnimateForm. 17776024f9c4SZhe Wang 17786024f9c4SZhe Wang */ 17796024f9c4SZhe Wang /************************************************************************/ 17806024f9c4SZhe Wang 17816024f9c4SZhe Wang bool bDoSetAnimateFormFirst = false; 17826024f9c4SZhe Wang bool bNeedDoSetAnimateForm = false; 17836024f9c4SZhe Wang 17846024f9c4SZhe Wang if( bHasAnimateForm ) 17856024f9c4SZhe Wang { 17866024f9c4SZhe Wang if( pTextGroup->getAnimateForm() != bAnimateForm ) 17876024f9c4SZhe Wang { 17886024f9c4SZhe Wang if( (pTextGroup->getTextGrouping() >= 0) && (nTextGrouping == -1 ) ) 17896024f9c4SZhe Wang { 17906024f9c4SZhe Wang bDoSetAnimateFormFirst = true; 17916024f9c4SZhe Wang } 17926024f9c4SZhe Wang bNeedDoSetAnimateForm = true; 17936024f9c4SZhe Wang } 17946024f9c4SZhe Wang } 17956024f9c4SZhe Wang 17966024f9c4SZhe Wang if (bDoSetAnimateFormFirst) 17976024f9c4SZhe Wang { 17986024f9c4SZhe Wang pEffectSequence->setAnimateForm( pTextGroup, bAnimateForm ); 17996024f9c4SZhe Wang bChanged = true; 18006024f9c4SZhe Wang } 18016024f9c4SZhe Wang 1802cdf0e10cSrcweir if( bHasTextGrouping ) 1803cdf0e10cSrcweir { 1804cdf0e10cSrcweir if( (pTextGroup->getTextGrouping() != nTextGrouping) ) 1805cdf0e10cSrcweir { 1806cdf0e10cSrcweir pEffectSequence->setTextGrouping( pTextGroup, nTextGrouping ); 1807cdf0e10cSrcweir bChanged = true; 1808cdf0e10cSrcweir } 1809cdf0e10cSrcweir } 1810cdf0e10cSrcweir 18116024f9c4SZhe Wang if (!bDoSetAnimateFormFirst&&bNeedDoSetAnimateForm) 1812cdf0e10cSrcweir { 1813cdf0e10cSrcweir pEffectSequence->setAnimateForm( pTextGroup, bAnimateForm ); 1814cdf0e10cSrcweir bChanged = true; 1815cdf0e10cSrcweir } 1816cdf0e10cSrcweir 1817cdf0e10cSrcweir if( bHasTextGroupingAuto ) 1818cdf0e10cSrcweir { 1819cdf0e10cSrcweir if( pTextGroup->getTextGroupingAuto() != fTextGroupingAuto ) 1820cdf0e10cSrcweir { 1821cdf0e10cSrcweir pEffectSequence->setTextGroupingAuto( pTextGroup, fTextGroupingAuto ); 1822cdf0e10cSrcweir bChanged = true; 1823cdf0e10cSrcweir } 1824cdf0e10cSrcweir } 1825cdf0e10cSrcweir 1826cdf0e10cSrcweir if( bHasTextReverse ) 1827cdf0e10cSrcweir { 1828cdf0e10cSrcweir if( pTextGroup->getTextReverse() != bTextReverse ) 1829cdf0e10cSrcweir { 1830cdf0e10cSrcweir pEffectSequence->setTextReverse( pTextGroup, bTextReverse ); 1831cdf0e10cSrcweir bChanged = true; 1832cdf0e10cSrcweir } 1833cdf0e10cSrcweir } 1834cdf0e10cSrcweir } 1835cdf0e10cSrcweir } 1836cdf0e10cSrcweir 1837cdf0e10cSrcweir if( bChanged ) 1838cdf0e10cSrcweir { 1839cdf0e10cSrcweir mpMainSequence->rebuild(); 1840cdf0e10cSrcweir updateControls(); 1841cdf0e10cSrcweir mrBase.GetDocShell()->SetModified(); 1842cdf0e10cSrcweir } 1843cdf0e10cSrcweir } 1844cdf0e10cSrcweir 1845cdf0e10cSrcweir void CustomAnimationPane::showOptions( sal_uInt16 nPage /* = 0 */ ) 1846cdf0e10cSrcweir { 1847cdf0e10cSrcweir STLPropertySet* pSet = createSelectionSet(); 1848cdf0e10cSrcweir 1849cdf0e10cSrcweir CustomAnimationDialog* pDlg = new CustomAnimationDialog( this, pSet, nPage ); 1850cdf0e10cSrcweir if( pDlg->Execute() ) 1851cdf0e10cSrcweir { 1852cdf0e10cSrcweir addUndo(); 1853cdf0e10cSrcweir changeSelection( pDlg->getResultSet(), pSet ); 1854cdf0e10cSrcweir updateControls(); 1855cdf0e10cSrcweir } 1856cdf0e10cSrcweir 1857cdf0e10cSrcweir delete pDlg; 1858cdf0e10cSrcweir } 1859cdf0e10cSrcweir 1860cdf0e10cSrcweir void CustomAnimationPane::onChangeCurrentPage() 1861cdf0e10cSrcweir { 1862cdf0e10cSrcweir if( mxView.is() ) try 1863cdf0e10cSrcweir { 1864cdf0e10cSrcweir Reference< XDrawPage > xNewPage( mxView->getCurrentPage() ); 1865cdf0e10cSrcweir if( xNewPage != mxCurrentPage ) 1866cdf0e10cSrcweir { 1867cdf0e10cSrcweir mxCurrentPage = xNewPage; 1868cdf0e10cSrcweir SdPage* pPage = SdPage::getImplementation( mxCurrentPage ); 1869cdf0e10cSrcweir if( pPage ) 1870cdf0e10cSrcweir { 1871cdf0e10cSrcweir mpMainSequence = pPage->getMainSequence(); 1872cdf0e10cSrcweir mpCustomAnimationList->update( mpMainSequence ); 1873cdf0e10cSrcweir } 1874cdf0e10cSrcweir updateControls(); 1875cdf0e10cSrcweir } 1876cdf0e10cSrcweir } 1877cdf0e10cSrcweir catch( Exception& ) 1878cdf0e10cSrcweir { 1879cdf0e10cSrcweir DBG_ERROR( "sd::CustomAnimationPane::onChangeCurrentPage(), exception catched!" ); 1880cdf0e10cSrcweir } 1881cdf0e10cSrcweir } 1882cdf0e10cSrcweir 1883cdf0e10cSrcweir bool getTextSelection( const Any& rSelection, Reference< XShape >& xShape, std::list< sal_Int16 >& rParaList ) 1884cdf0e10cSrcweir { 1885cdf0e10cSrcweir Reference< XTextRange > xSelectedText; 1886cdf0e10cSrcweir rSelection >>= xSelectedText; 1887cdf0e10cSrcweir if( xSelectedText.is() ) try 1888cdf0e10cSrcweir { 1889cdf0e10cSrcweir xShape.set( xSelectedText->getText(), UNO_QUERY_THROW ); 1890cdf0e10cSrcweir 1891cdf0e10cSrcweir Reference< XTextRangeCompare > xTextRangeCompare( xShape, UNO_QUERY_THROW ); 1892cdf0e10cSrcweir Reference< XEnumerationAccess > xParaEnumAccess( xShape, UNO_QUERY_THROW ); 1893cdf0e10cSrcweir Reference< XEnumeration > xParaEnum( xParaEnumAccess->createEnumeration(), UNO_QUERY_THROW ); 1894cdf0e10cSrcweir Reference< XTextRange > xRange; 1895cdf0e10cSrcweir Reference< XTextRange > xStart( xSelectedText->getStart() ); 1896cdf0e10cSrcweir Reference< XTextRange > xEnd( xSelectedText->getEnd() ); 1897cdf0e10cSrcweir 1898cdf0e10cSrcweir if( xTextRangeCompare->compareRegionEnds( xStart, xEnd ) < 0 ) 1899cdf0e10cSrcweir { 1900cdf0e10cSrcweir Reference< XTextRange > xTemp( xStart ); 1901cdf0e10cSrcweir xStart = xEnd; 1902cdf0e10cSrcweir xEnd = xTemp; 1903cdf0e10cSrcweir } 1904cdf0e10cSrcweir 1905cdf0e10cSrcweir sal_Int16 nPara = 0; 1906cdf0e10cSrcweir while( xParaEnum->hasMoreElements() ) 1907cdf0e10cSrcweir { 1908cdf0e10cSrcweir xParaEnum->nextElement() >>= xRange; 1909cdf0e10cSrcweir 1910cdf0e10cSrcweir // break if start of selection is prior to end of current paragraph 1911cdf0e10cSrcweir if( xRange.is() && (xTextRangeCompare->compareRegionEnds( xStart, xRange ) >= 0 ) ) 1912cdf0e10cSrcweir break; 1913cdf0e10cSrcweir 1914cdf0e10cSrcweir nPara++; 1915cdf0e10cSrcweir } 1916cdf0e10cSrcweir 1917cdf0e10cSrcweir while( xRange.is() ) 1918cdf0e10cSrcweir { 1919cdf0e10cSrcweir if( xRange.is() && xRange->getString().getLength() ) 1920cdf0e10cSrcweir rParaList.push_back( nPara ); 1921cdf0e10cSrcweir 1922cdf0e10cSrcweir // break if end of selection is before or at end of current paragraph 1923cdf0e10cSrcweir if( xRange.is() && xTextRangeCompare->compareRegionEnds( xEnd, xRange ) >= 0 ) 1924cdf0e10cSrcweir break; 1925cdf0e10cSrcweir 1926cdf0e10cSrcweir nPara++; 1927cdf0e10cSrcweir 1928cdf0e10cSrcweir if( xParaEnum->hasMoreElements() ) 1929cdf0e10cSrcweir xParaEnum->nextElement() >>= xRange; 1930cdf0e10cSrcweir else 1931cdf0e10cSrcweir xRange.clear(); 1932cdf0e10cSrcweir } 1933cdf0e10cSrcweir 1934cdf0e10cSrcweir return true; 1935cdf0e10cSrcweir } 1936cdf0e10cSrcweir catch( Exception& e ) 1937cdf0e10cSrcweir { 1938cdf0e10cSrcweir (void)e; 1939cdf0e10cSrcweir DBG_ERROR( "sd::CustomAnimationPane::getTextSelection(), exception cought!" ); 1940cdf0e10cSrcweir } 1941cdf0e10cSrcweir 1942cdf0e10cSrcweir return false; 1943cdf0e10cSrcweir } 1944cdf0e10cSrcweir 1945cdf0e10cSrcweir void CustomAnimationPane::onChange( bool bCreate ) 1946cdf0e10cSrcweir { 1947cdf0e10cSrcweir bool bHasText = true; 1948cdf0e10cSrcweir 1949cdf0e10cSrcweir // first create vector of targets for dialog preview 1950cdf0e10cSrcweir std::vector< Any > aTargets; 1951cdf0e10cSrcweir OUString sPresetId; 1952cdf0e10cSrcweir double fDuration = 2.0f; 1953cdf0e10cSrcweir 1954cdf0e10cSrcweir if( bCreate ) 1955cdf0e10cSrcweir { 1956cdf0e10cSrcweir // gather shapes from the selection 1957cdf0e10cSrcweir Reference< XSelectionSupplier > xSel( mxView, UNO_QUERY_THROW ); 1958cdf0e10cSrcweir maViewSelection = xSel->getSelection(); 1959cdf0e10cSrcweir 1960cdf0e10cSrcweir if( maViewSelection.getValueType() == ::getCppuType((const Reference< XShapes >*)0) ) 1961cdf0e10cSrcweir { 1962cdf0e10cSrcweir Reference< XIndexAccess > xShapes; 1963cdf0e10cSrcweir maViewSelection >>= xShapes; 1964cdf0e10cSrcweir 1965cdf0e10cSrcweir sal_Int32 nCount = xShapes->getCount(); 1966cdf0e10cSrcweir sal_Int32 nIndex; 1967cdf0e10cSrcweir for( nIndex = 0; nIndex < nCount; nIndex++ ) 1968cdf0e10cSrcweir { 1969cdf0e10cSrcweir Any aTarget( xShapes->getByIndex( nIndex ) ); 1970cdf0e10cSrcweir aTargets.push_back( aTarget ); 1971cdf0e10cSrcweir if( bHasText ) 1972cdf0e10cSrcweir { 1973cdf0e10cSrcweir Reference< XText > xText; 1974cdf0e10cSrcweir aTarget >>= xText; 1975cdf0e10cSrcweir if( !xText.is() || xText->getString().getLength() == 0 ) 1976cdf0e10cSrcweir bHasText = false; 1977cdf0e10cSrcweir } 1978cdf0e10cSrcweir } 1979cdf0e10cSrcweir } 1980cdf0e10cSrcweir else if ( maViewSelection.getValueType() == ::getCppuType((const Reference< XShape >*)0) ) 1981cdf0e10cSrcweir { 1982cdf0e10cSrcweir aTargets.push_back( maViewSelection ); 1983cdf0e10cSrcweir Reference< XText > xText; 1984cdf0e10cSrcweir maViewSelection >>= xText; 1985cdf0e10cSrcweir if( !xText.is() || xText->getString().getLength() == 0 ) 1986cdf0e10cSrcweir bHasText = false; 1987cdf0e10cSrcweir } 1988cdf0e10cSrcweir else if ( maViewSelection.getValueType() == ::getCppuType((const Reference< XTextCursor >*)0) ) 1989cdf0e10cSrcweir { 1990cdf0e10cSrcweir Reference< XShape > xShape; 1991cdf0e10cSrcweir std::list< sal_Int16 > aParaList; 1992cdf0e10cSrcweir if( getTextSelection( maViewSelection, xShape, aParaList ) ) 1993cdf0e10cSrcweir { 1994cdf0e10cSrcweir ParagraphTarget aParaTarget; 1995cdf0e10cSrcweir aParaTarget.Shape = xShape; 1996cdf0e10cSrcweir 1997cdf0e10cSrcweir std::list< sal_Int16 >::iterator aIter( aParaList.begin() ); 1998cdf0e10cSrcweir for( ; aIter != aParaList.end(); aIter++ ) 1999cdf0e10cSrcweir { 2000cdf0e10cSrcweir aParaTarget.Paragraph = (*aIter); 2001cdf0e10cSrcweir aTargets.push_back( makeAny( aParaTarget ) ); 2002cdf0e10cSrcweir } 2003cdf0e10cSrcweir } 2004cdf0e10cSrcweir } 2005cdf0e10cSrcweir else 2006cdf0e10cSrcweir { 2007cdf0e10cSrcweir DBG_ERROR("sd::CustomAnimationPane::onChange(), unknown view selection!" ); 2008cdf0e10cSrcweir return; 2009cdf0e10cSrcweir } 2010cdf0e10cSrcweir } 2011cdf0e10cSrcweir else 2012cdf0e10cSrcweir { 2013cdf0e10cSrcweir // get selected effect 2014cdf0e10cSrcweir EffectSequence::iterator aIter( maListSelection.begin() ); 2015cdf0e10cSrcweir const EffectSequence::iterator aEnd( maListSelection.end() ); 2016cdf0e10cSrcweir while( aIter != aEnd ) 2017cdf0e10cSrcweir { 2018cdf0e10cSrcweir if( !bHasText || !(*aIter)->hasText() ) 2019cdf0e10cSrcweir bHasText = false; 2020cdf0e10cSrcweir 2021cdf0e10cSrcweir if( sPresetId.getLength() == 0 ) 2022cdf0e10cSrcweir { 2023cdf0e10cSrcweir sPresetId = (*aIter)->getPresetId(); 2024cdf0e10cSrcweir fDuration = (*aIter)->getDuration(); 2025cdf0e10cSrcweir } 2026cdf0e10cSrcweir 2027cdf0e10cSrcweir aTargets.push_back( (*aIter++)->getTarget() ); 2028cdf0e10cSrcweir } 2029cdf0e10cSrcweir } 2030cdf0e10cSrcweir 2031cdf0e10cSrcweir CustomAnimationCreateDialog* pDlg = new CustomAnimationCreateDialog( this, this, aTargets, bHasText, sPresetId, fDuration ); 2032cdf0e10cSrcweir if( pDlg->Execute() ) 2033cdf0e10cSrcweir { 2034cdf0e10cSrcweir addUndo(); 2035cdf0e10cSrcweir fDuration = pDlg->getSelectedDuration(); 2036cdf0e10cSrcweir CustomAnimationPresetPtr pDescriptor = pDlg->getSelectedPreset(); 2037cdf0e10cSrcweir if( pDescriptor.get() ) 2038cdf0e10cSrcweir { 2039cdf0e10cSrcweir if( bCreate ) 2040cdf0e10cSrcweir { 2041cdf0e10cSrcweir mpCustomAnimationList->SelectAll( sal_False ); 2042cdf0e10cSrcweir 2043cdf0e10cSrcweir // gather shapes from the selection 2044cdf0e10cSrcweir std::vector< Any >::iterator aIter( aTargets.begin() ); 2045cdf0e10cSrcweir const std::vector< Any >::iterator aEnd( aTargets.end() ); 2046cdf0e10cSrcweir bool bFirst = true; 2047cdf0e10cSrcweir for( ; aIter != aEnd; aIter++ ) 2048cdf0e10cSrcweir { 2049cdf0e10cSrcweir CustomAnimationEffectPtr pCreated = mpMainSequence->append( pDescriptor, (*aIter), fDuration ); 2050cdf0e10cSrcweir 2051cdf0e10cSrcweir // if only one shape with text and no fill or outline is selected, animate only by first level paragraphs 2052cdf0e10cSrcweir if( bHasText && (aTargets.size() == 1) ) 2053cdf0e10cSrcweir { 2054cdf0e10cSrcweir Reference< XShape > xShape( (*aIter), UNO_QUERY ); 2055cdf0e10cSrcweir if( xShape.is() && !hasVisibleShape( xShape ) ) 2056cdf0e10cSrcweir { 2057cdf0e10cSrcweir mpMainSequence->createTextGroup( pCreated, 1, -1.0, sal_False, sal_False ); 2058cdf0e10cSrcweir } 2059cdf0e10cSrcweir } 2060cdf0e10cSrcweir 2061cdf0e10cSrcweir if( bFirst ) 2062cdf0e10cSrcweir bFirst = false; 2063cdf0e10cSrcweir else 2064cdf0e10cSrcweir pCreated->setNodeType( EffectNodeType::WITH_PREVIOUS ); 2065cdf0e10cSrcweir 2066cdf0e10cSrcweir if( pCreated.get() ) 2067cdf0e10cSrcweir { 2068cdf0e10cSrcweir mpCustomAnimationList->select( pCreated ); 2069cdf0e10cSrcweir } 2070cdf0e10cSrcweir } 2071cdf0e10cSrcweir } 2072cdf0e10cSrcweir else 2073cdf0e10cSrcweir { 2074cdf0e10cSrcweir MainSequenceRebuildGuard aGuard( mpMainSequence ); 2075cdf0e10cSrcweir 2076cdf0e10cSrcweir // get selected effect 2077cdf0e10cSrcweir EffectSequence::iterator aIter( maListSelection.begin() ); 2078cdf0e10cSrcweir const EffectSequence::iterator aEnd( maListSelection.end() ); 2079cdf0e10cSrcweir while( aIter != aEnd ) 2080cdf0e10cSrcweir { 2081cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aIter++); 2082cdf0e10cSrcweir 2083cdf0e10cSrcweir EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence(); 2084cdf0e10cSrcweir if( !pEffectSequence ) 2085cdf0e10cSrcweir pEffectSequence = mpMainSequence.get(); 2086cdf0e10cSrcweir 2087cdf0e10cSrcweir pEffectSequence->replace( pEffect, pDescriptor, fDuration ); 2088cdf0e10cSrcweir } 2089cdf0e10cSrcweir } 2090cdf0e10cSrcweir } 2091cdf0e10cSrcweir else 2092cdf0e10cSrcweir { 2093cdf0e10cSrcweir PathKind eKind = pDlg->getCreatePathKind(); 2094cdf0e10cSrcweir if( eKind != NONE ) 2095cdf0e10cSrcweir createPath( eKind, aTargets, fDuration ); 2096cdf0e10cSrcweir } 2097cdf0e10cSrcweir mrBase.GetDocShell()->SetModified(); 2098cdf0e10cSrcweir } 2099cdf0e10cSrcweir 2100cdf0e10cSrcweir delete pDlg; 2101cdf0e10cSrcweir 2102cdf0e10cSrcweir updateControls(); 2103cdf0e10cSrcweir 2104cdf0e10cSrcweir // stop running preview from dialog 2105cdf0e10cSrcweir SlideShow::Stop( mrBase ); 2106cdf0e10cSrcweir } 2107cdf0e10cSrcweir 2108cdf0e10cSrcweir void CustomAnimationPane::createPath( PathKind eKind, std::vector< Any >& rTargets, double fDuration) 2109cdf0e10cSrcweir { 2110cdf0e10cSrcweir sal_uInt16 nSID = 0; 2111cdf0e10cSrcweir 2112cdf0e10cSrcweir switch( eKind ) 2113cdf0e10cSrcweir { 2114cdf0e10cSrcweir case CURVE: nSID = SID_DRAW_BEZIER_NOFILL; break; 2115cdf0e10cSrcweir case POLYGON: nSID = SID_DRAW_POLYGON_NOFILL; break; 2116cdf0e10cSrcweir case FREEFORM: nSID = SID_DRAW_FREELINE_NOFILL; break; 2117cdf0e10cSrcweir default: break; 2118cdf0e10cSrcweir } 2119cdf0e10cSrcweir 2120cdf0e10cSrcweir if( nSID ) 2121cdf0e10cSrcweir { 2122cdf0e10cSrcweir DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >( 2123cdf0e10cSrcweir FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get()); 2124cdf0e10cSrcweir 2125cdf0e10cSrcweir if( pViewShell ) 2126cdf0e10cSrcweir { 2127cdf0e10cSrcweir DrawView* pView = pViewShell->GetDrawView(); 2128cdf0e10cSrcweir if( pView ) 2129cdf0e10cSrcweir pView->UnmarkAllObj(); 2130cdf0e10cSrcweir 2131cdf0e10cSrcweir std::vector< Any > aTargets( 1, Any( fDuration ) ); 2132cdf0e10cSrcweir aTargets.insert( aTargets.end(), rTargets.begin(), rTargets.end() ); 2133cdf0e10cSrcweir Sequence< Any > aTargetSequence( comphelper::containerToSequence( aTargets ) ); 2134cdf0e10cSrcweir const SfxUnoAnyItem aItem( SID_ADD_MOTION_PATH, Any( aTargetSequence ) ); 2135cdf0e10cSrcweir pViewShell->GetViewFrame()->GetDispatcher()->Execute( nSID, SFX_CALLMODE_ASYNCHRON, &aItem, 0 ); 2136cdf0e10cSrcweir } 2137cdf0e10cSrcweir } 2138cdf0e10cSrcweir } 2139cdf0e10cSrcweir 2140cdf0e10cSrcweir void CustomAnimationPane::onRemove() 2141cdf0e10cSrcweir { 2142cdf0e10cSrcweir if( !maListSelection.empty() ) 2143cdf0e10cSrcweir { 2144cdf0e10cSrcweir addUndo(); 2145cdf0e10cSrcweir 2146cdf0e10cSrcweir MainSequenceRebuildGuard aGuard( mpMainSequence ); 2147cdf0e10cSrcweir 2148cdf0e10cSrcweir EffectSequence aList( maListSelection ); 2149cdf0e10cSrcweir 2150cdf0e10cSrcweir EffectSequence::iterator aIter( aList.begin() ); 2151cdf0e10cSrcweir const EffectSequence::iterator aEnd( aList.end() ); 2152cdf0e10cSrcweir while( aIter != aEnd ) 2153cdf0e10cSrcweir { 2154cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aIter++); 2155cdf0e10cSrcweir if( pEffect->getEffectSequence() ) 2156cdf0e10cSrcweir pEffect->getEffectSequence()->remove( pEffect ); 2157cdf0e10cSrcweir } 2158cdf0e10cSrcweir 2159cdf0e10cSrcweir maListSelection.clear(); 2160cdf0e10cSrcweir mrBase.GetDocShell()->SetModified(); 2161cdf0e10cSrcweir } 2162cdf0e10cSrcweir } 2163cdf0e10cSrcweir 2164cdf0e10cSrcweir void CustomAnimationPane::remove( CustomAnimationEffectPtr& pEffect ) 2165cdf0e10cSrcweir { 2166cdf0e10cSrcweir if( pEffect->getEffectSequence() ) 2167cdf0e10cSrcweir { 2168cdf0e10cSrcweir addUndo(); 2169cdf0e10cSrcweir pEffect->getEffectSequence()->remove( pEffect ); 2170cdf0e10cSrcweir mrBase.GetDocShell()->SetModified(); 2171cdf0e10cSrcweir } 2172cdf0e10cSrcweir } 2173cdf0e10cSrcweir 2174cdf0e10cSrcweir void CustomAnimationPane::onChangeStart() 2175cdf0e10cSrcweir { 2176cdf0e10cSrcweir if( mpLBStart->GetSelectEntryCount() == 1 ) 2177cdf0e10cSrcweir { 2178cdf0e10cSrcweir sal_Int16 nNodeType; 2179cdf0e10cSrcweir sal_uInt16 nPos= mpLBStart->GetSelectEntryPos(); 2180cdf0e10cSrcweir switch( nPos ) 2181cdf0e10cSrcweir { 2182cdf0e10cSrcweir case 0: nNodeType = EffectNodeType::ON_CLICK; break; 2183cdf0e10cSrcweir case 1: nNodeType = EffectNodeType::WITH_PREVIOUS; break; 2184cdf0e10cSrcweir case 2: nNodeType = EffectNodeType::AFTER_PREVIOUS; break; 2185cdf0e10cSrcweir default: 2186cdf0e10cSrcweir return; 2187cdf0e10cSrcweir } 2188cdf0e10cSrcweir 2189cdf0e10cSrcweir onChangeStart( nNodeType ); 2190cdf0e10cSrcweir } 2191cdf0e10cSrcweir } 2192cdf0e10cSrcweir 2193cdf0e10cSrcweir void CustomAnimationPane::onChangeStart( sal_Int16 nNodeType ) 2194cdf0e10cSrcweir { 2195cdf0e10cSrcweir addUndo(); 2196cdf0e10cSrcweir 2197cdf0e10cSrcweir MainSequenceRebuildGuard aGuard( mpMainSequence ); 2198cdf0e10cSrcweir 2199cdf0e10cSrcweir bool bNeedRebuild = false; 2200cdf0e10cSrcweir 2201cdf0e10cSrcweir EffectSequence::iterator aIter( maListSelection.begin() ); 2202cdf0e10cSrcweir const EffectSequence::iterator aEnd( maListSelection.end() ); 2203cdf0e10cSrcweir while( aIter != aEnd ) 2204cdf0e10cSrcweir { 2205cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aIter++); 2206cdf0e10cSrcweir if( pEffect->getNodeType() != nNodeType ) 2207cdf0e10cSrcweir { 2208cdf0e10cSrcweir pEffect->setNodeType( nNodeType ); 2209cdf0e10cSrcweir bNeedRebuild = true; 2210cdf0e10cSrcweir } 2211cdf0e10cSrcweir } 2212cdf0e10cSrcweir 2213cdf0e10cSrcweir if( bNeedRebuild ) 2214cdf0e10cSrcweir { 2215cdf0e10cSrcweir mpMainSequence->rebuild(); 2216cdf0e10cSrcweir updateControls(); 2217cdf0e10cSrcweir mrBase.GetDocShell()->SetModified(); 2218cdf0e10cSrcweir } 2219cdf0e10cSrcweir } 2220cdf0e10cSrcweir 2221cdf0e10cSrcweir void CustomAnimationPane::onChangeProperty() 2222cdf0e10cSrcweir { 2223cdf0e10cSrcweir if( mpLBProperty->getSubControl() ) 2224cdf0e10cSrcweir { 2225cdf0e10cSrcweir addUndo(); 2226cdf0e10cSrcweir 2227cdf0e10cSrcweir MainSequenceRebuildGuard aGuard( mpMainSequence ); 2228cdf0e10cSrcweir 2229cdf0e10cSrcweir const Any aValue( mpLBProperty->getSubControl()->getValue() ); 2230cdf0e10cSrcweir 2231cdf0e10cSrcweir bool bNeedUpdate = false; 2232cdf0e10cSrcweir 2233cdf0e10cSrcweir // change selected effect 2234cdf0e10cSrcweir EffectSequence::iterator aIter( maListSelection.begin() ); 2235cdf0e10cSrcweir const EffectSequence::iterator aEnd( maListSelection.end() ); 2236cdf0e10cSrcweir while( aIter != aEnd ) 2237cdf0e10cSrcweir { 2238cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aIter++); 2239cdf0e10cSrcweir 2240cdf0e10cSrcweir if( setProperty1Value( mnPropertyType, pEffect, aValue ) ) 2241cdf0e10cSrcweir bNeedUpdate = true; 2242cdf0e10cSrcweir } 2243cdf0e10cSrcweir 2244cdf0e10cSrcweir if( bNeedUpdate ) 2245cdf0e10cSrcweir { 2246cdf0e10cSrcweir mpMainSequence->rebuild(); 2247cdf0e10cSrcweir updateControls(); 2248cdf0e10cSrcweir mrBase.GetDocShell()->SetModified(); 2249cdf0e10cSrcweir } 2250cdf0e10cSrcweir 2251cdf0e10cSrcweir onPreview( false ); 2252cdf0e10cSrcweir } 2253cdf0e10cSrcweir } 2254cdf0e10cSrcweir 2255cdf0e10cSrcweir void CustomAnimationPane::onChangeSpeed() 2256cdf0e10cSrcweir { 2257cdf0e10cSrcweir if( mpCBSpeed->GetSelectEntryCount() == 1 ) 2258cdf0e10cSrcweir { 2259cdf0e10cSrcweir addUndo(); 2260cdf0e10cSrcweir 2261cdf0e10cSrcweir MainSequenceRebuildGuard aGuard( mpMainSequence ); 2262cdf0e10cSrcweir 2263cdf0e10cSrcweir double fDuration; 2264cdf0e10cSrcweir 2265cdf0e10cSrcweir sal_uInt16 nPos= mpCBSpeed->GetSelectEntryPos(); 2266cdf0e10cSrcweir 2267cdf0e10cSrcweir switch( nPos ) 2268cdf0e10cSrcweir { 2269cdf0e10cSrcweir case 0: fDuration = 5.0; break; 2270cdf0e10cSrcweir case 1: fDuration = 3.0; break; 2271cdf0e10cSrcweir case 2: fDuration = 2.0; break; 2272cdf0e10cSrcweir case 3: fDuration = 1.0; break; 2273cdf0e10cSrcweir case 4: fDuration = 0.5; break; 2274cdf0e10cSrcweir default: 2275cdf0e10cSrcweir return; 2276cdf0e10cSrcweir } 2277cdf0e10cSrcweir 2278cdf0e10cSrcweir // change selected effect 2279cdf0e10cSrcweir EffectSequence::iterator aIter( maListSelection.begin() ); 2280cdf0e10cSrcweir const EffectSequence::iterator aEnd( maListSelection.end() ); 2281cdf0e10cSrcweir while( aIter != aEnd ) 2282cdf0e10cSrcweir { 2283cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aIter++); 2284cdf0e10cSrcweir pEffect->setDuration( fDuration ); 2285cdf0e10cSrcweir } 2286cdf0e10cSrcweir 2287cdf0e10cSrcweir mpMainSequence->rebuild(); 2288cdf0e10cSrcweir updateControls(); 2289cdf0e10cSrcweir mrBase.GetDocShell()->SetModified(); 2290cdf0e10cSrcweir 2291cdf0e10cSrcweir onPreview( false ); 2292cdf0e10cSrcweir } 2293cdf0e10cSrcweir } 2294cdf0e10cSrcweir 2295cdf0e10cSrcweir /// this link is called when the property box is modified by the user 2296cdf0e10cSrcweir IMPL_LINK( CustomAnimationPane, implPropertyHdl, Control*, EMPTYARG ) 2297cdf0e10cSrcweir { 2298cdf0e10cSrcweir onChangeProperty(); 2299cdf0e10cSrcweir return 0; 2300cdf0e10cSrcweir } 2301cdf0e10cSrcweir 2302cdf0e10cSrcweir /// this link is called when one of the controls is modified 2303cdf0e10cSrcweir IMPL_LINK( CustomAnimationPane, implControlHdl, Control*, pControl ) 2304cdf0e10cSrcweir { 2305cdf0e10cSrcweir if( pControl == mpPBAddEffect ) 2306cdf0e10cSrcweir onChange(true); 2307cdf0e10cSrcweir else if( pControl == mpPBChangeEffect ) 2308cdf0e10cSrcweir onChange(false); 2309cdf0e10cSrcweir else if( pControl == mpPBRemoveEffect ) 2310cdf0e10cSrcweir onRemove(); 2311cdf0e10cSrcweir else if( pControl == mpLBStart ) 2312cdf0e10cSrcweir onChangeStart(); 2313cdf0e10cSrcweir else if( pControl == mpCBSpeed ) 2314cdf0e10cSrcweir onChangeSpeed(); 2315cdf0e10cSrcweir else if( pControl == mpPBPropertyMore ) 2316cdf0e10cSrcweir showOptions(); 2317cdf0e10cSrcweir else if( pControl == mpPBMoveUp ) 2318cdf0e10cSrcweir moveSelection( true ); 2319cdf0e10cSrcweir else if( pControl == mpPBMoveDown ) 2320cdf0e10cSrcweir moveSelection( false ); 2321cdf0e10cSrcweir else if( pControl == mpPBPlay ) 2322cdf0e10cSrcweir onPreview( true ); 2323cdf0e10cSrcweir else if( pControl == mpPBSlideShow ) 2324cdf0e10cSrcweir { 2325cdf0e10cSrcweir mrBase.StartPresentation(); 2326cdf0e10cSrcweir } 2327cdf0e10cSrcweir else if( pControl == mpCBAutoPreview ) 2328cdf0e10cSrcweir { 2329cdf0e10cSrcweir SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS); 2330cdf0e10cSrcweir pOptions->SetPreviewChangedEffects( mpCBAutoPreview->IsChecked() ? sal_True : sal_False ); 2331cdf0e10cSrcweir } 2332cdf0e10cSrcweir 2333cdf0e10cSrcweir updateControls(); 2334cdf0e10cSrcweir 2335cdf0e10cSrcweir return 0; 2336cdf0e10cSrcweir } 2337cdf0e10cSrcweir 2338cdf0e10cSrcweir IMPL_LINK(CustomAnimationPane, lateInitCallback, Timer*, EMPTYARG ) 2339cdf0e10cSrcweir { 2340cdf0e10cSrcweir // Call getPresets() to initiate the (expensive) construction of the 2341cdf0e10cSrcweir // presets list. 2342cdf0e10cSrcweir getPresets(); 2343cdf0e10cSrcweir 2344cdf0e10cSrcweir // update selection and control states 2345cdf0e10cSrcweir onSelectionChanged(); 2346cdf0e10cSrcweir 2347cdf0e10cSrcweir return 0; 2348cdf0e10cSrcweir } 2349cdf0e10cSrcweir 2350cdf0e10cSrcweir void CustomAnimationPane::moveSelection( bool bUp ) 2351cdf0e10cSrcweir { 2352cdf0e10cSrcweir if( maListSelection.empty() ) 2353cdf0e10cSrcweir return; 2354cdf0e10cSrcweir 2355cdf0e10cSrcweir EffectSequenceHelper* pSequence = maListSelection.front()->getEffectSequence(); 2356cdf0e10cSrcweir if( pSequence == 0 ) 2357cdf0e10cSrcweir return; 2358cdf0e10cSrcweir 2359cdf0e10cSrcweir addUndo(); 2360cdf0e10cSrcweir 2361cdf0e10cSrcweir bool bChanged = false; 2362cdf0e10cSrcweir 2363cdf0e10cSrcweir MainSequenceRebuildGuard aGuard( mpMainSequence ); 2364cdf0e10cSrcweir EffectSequence& rEffectSequence = pSequence->getSequence(); 2365cdf0e10cSrcweir 2366cdf0e10cSrcweir if( bUp ) 2367cdf0e10cSrcweir { 2368cdf0e10cSrcweir EffectSequence::iterator aIter( maListSelection.begin() ); 2369cdf0e10cSrcweir const EffectSequence::iterator aEnd( maListSelection.end() ); 2370cdf0e10cSrcweir 2371cdf0e10cSrcweir while( aIter != aEnd ) 2372cdf0e10cSrcweir { 2373cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aIter++); 2374cdf0e10cSrcweir 2375cdf0e10cSrcweir EffectSequence::iterator aEffectPos( pSequence->find( pEffect ) ); 2376cdf0e10cSrcweir if( aEffectPos != rEffectSequence.end() ) 2377cdf0e10cSrcweir { 2378cdf0e10cSrcweir EffectSequence::iterator aInsertPos( rEffectSequence.erase( aEffectPos ) ); 2379cdf0e10cSrcweir 2380cdf0e10cSrcweir if( aInsertPos != rEffectSequence.begin() ) 2381cdf0e10cSrcweir { 2382cdf0e10cSrcweir aInsertPos--; 2383cdf0e10cSrcweir while( (aInsertPos != rEffectSequence.begin()) && !mpCustomAnimationList->isExpanded(*aInsertPos)) 2384cdf0e10cSrcweir aInsertPos--; 2385cdf0e10cSrcweir 2386cdf0e10cSrcweir rEffectSequence.insert( aInsertPos, pEffect ); 2387cdf0e10cSrcweir } 2388cdf0e10cSrcweir else 2389cdf0e10cSrcweir { 2390cdf0e10cSrcweir rEffectSequence.push_front( pEffect ); 2391cdf0e10cSrcweir } 2392cdf0e10cSrcweir bChanged = true; 2393cdf0e10cSrcweir } 2394cdf0e10cSrcweir } 2395cdf0e10cSrcweir } 2396cdf0e10cSrcweir else 2397cdf0e10cSrcweir { 2398cdf0e10cSrcweir EffectSequence::reverse_iterator aIter( maListSelection.rbegin() ); 2399cdf0e10cSrcweir const EffectSequence::reverse_iterator aEnd( maListSelection.rend() ); 2400cdf0e10cSrcweir 2401cdf0e10cSrcweir while( aIter != aEnd ) 2402cdf0e10cSrcweir { 2403cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aIter++); 2404cdf0e10cSrcweir 2405cdf0e10cSrcweir EffectSequence::iterator aEffectPos( pSequence->find( pEffect ) ); 2406cdf0e10cSrcweir if( aEffectPos != rEffectSequence.end() ) 2407cdf0e10cSrcweir { 2408cdf0e10cSrcweir EffectSequence::iterator aInsertPos( rEffectSequence.erase( aEffectPos ) ); 2409cdf0e10cSrcweir 2410cdf0e10cSrcweir if( aInsertPos != rEffectSequence.end() ) 2411cdf0e10cSrcweir { 2412cdf0e10cSrcweir aInsertPos++; 2413cdf0e10cSrcweir while( (aInsertPos != rEffectSequence.end()) && !mpCustomAnimationList->isExpanded(*aInsertPos)) 2414cdf0e10cSrcweir aInsertPos++; 2415cdf0e10cSrcweir 2416cdf0e10cSrcweir rEffectSequence.insert( aInsertPos, pEffect ); 2417cdf0e10cSrcweir } 2418cdf0e10cSrcweir else 2419cdf0e10cSrcweir { 2420cdf0e10cSrcweir rEffectSequence.push_back( pEffect ); 2421cdf0e10cSrcweir } 2422cdf0e10cSrcweir bChanged = true; 2423cdf0e10cSrcweir } 2424cdf0e10cSrcweir } 2425cdf0e10cSrcweir } 2426cdf0e10cSrcweir 2427cdf0e10cSrcweir if( bChanged ) 2428cdf0e10cSrcweir { 2429cdf0e10cSrcweir mpMainSequence->rebuild(); 2430cdf0e10cSrcweir updateControls(); 2431cdf0e10cSrcweir mrBase.GetDocShell()->SetModified(); 2432cdf0e10cSrcweir } 2433cdf0e10cSrcweir } 2434cdf0e10cSrcweir 2435cdf0e10cSrcweir void CustomAnimationPane::onPreview( bool bForcePreview ) 2436cdf0e10cSrcweir { 2437cdf0e10cSrcweir if( !bForcePreview && !mpCBAutoPreview->IsChecked() ) 2438cdf0e10cSrcweir return; 2439cdf0e10cSrcweir 2440cdf0e10cSrcweir if( maListSelection.empty() ) 2441cdf0e10cSrcweir { 2442cdf0e10cSrcweir rtl::Reference< MotionPathTag > xMotionPathTag; 2443cdf0e10cSrcweir MotionPathTagVector::iterator aIter; 2444cdf0e10cSrcweir for( aIter = maMotionPathTags.begin(); aIter != maMotionPathTags.end(); aIter++ ) 2445cdf0e10cSrcweir { 2446cdf0e10cSrcweir if( (*aIter)->isSelected() ) 2447cdf0e10cSrcweir { 2448cdf0e10cSrcweir xMotionPathTag = (*aIter); 2449cdf0e10cSrcweir break; 2450cdf0e10cSrcweir } 2451cdf0e10cSrcweir } 2452cdf0e10cSrcweir 2453cdf0e10cSrcweir if( xMotionPathTag.is() ) 2454cdf0e10cSrcweir { 2455cdf0e10cSrcweir MainSequencePtr pSequence( new MainSequence() ); 2456cdf0e10cSrcweir pSequence->append( xMotionPathTag->getEffect()->clone() ); 2457cdf0e10cSrcweir preview( pSequence->getRootNode() ); 2458cdf0e10cSrcweir } 2459cdf0e10cSrcweir else 2460cdf0e10cSrcweir { 2461cdf0e10cSrcweir Reference< XAnimationNodeSupplier > xNodeSupplier( mxCurrentPage, UNO_QUERY ); 2462cdf0e10cSrcweir if( !xNodeSupplier.is() ) 2463cdf0e10cSrcweir return; 2464cdf0e10cSrcweir 2465cdf0e10cSrcweir preview( xNodeSupplier->getAnimationNode() ); 2466cdf0e10cSrcweir } 2467cdf0e10cSrcweir } 2468cdf0e10cSrcweir else 2469cdf0e10cSrcweir { 2470cdf0e10cSrcweir MainSequencePtr pSequence( new MainSequence() ); 2471cdf0e10cSrcweir 2472cdf0e10cSrcweir EffectSequence::iterator aIter( maListSelection.begin() ); 2473cdf0e10cSrcweir const EffectSequence::iterator aEnd( maListSelection.end() ); 2474cdf0e10cSrcweir 2475cdf0e10cSrcweir while( aIter != aEnd ) 2476cdf0e10cSrcweir { 2477cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aIter++); 2478cdf0e10cSrcweir pSequence->append( pEffect->clone() ); 2479cdf0e10cSrcweir } 2480cdf0e10cSrcweir 2481cdf0e10cSrcweir preview( pSequence->getRootNode() ); 2482cdf0e10cSrcweir } 2483cdf0e10cSrcweir } 2484cdf0e10cSrcweir 2485cdf0e10cSrcweir void CustomAnimationPane::preview( const Reference< XAnimationNode >& xAnimationNode ) 2486cdf0e10cSrcweir { 2487cdf0e10cSrcweir Reference< XTimeContainer > xRoot(::comphelper::getProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.ParallelTimeContainer"))), UNO_QUERY); 2488cdf0e10cSrcweir if( xRoot.is() ) 2489cdf0e10cSrcweir { 2490cdf0e10cSrcweir Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 ); 2491cdf0e10cSrcweir aUserData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "node-type" ) ); 2492cdf0e10cSrcweir aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT; 2493cdf0e10cSrcweir xRoot->setUserData( aUserData ); 2494cdf0e10cSrcweir xRoot->appendChild( xAnimationNode ); 2495cdf0e10cSrcweir 2496cdf0e10cSrcweir Reference< XAnimationNode > xNode( xRoot, UNO_QUERY ); 2497cdf0e10cSrcweir SlideShow::StartPreview( mrBase, mxCurrentPage, xNode ); 2498cdf0e10cSrcweir } 2499cdf0e10cSrcweir } 2500cdf0e10cSrcweir 2501cdf0e10cSrcweir 2502cdf0e10cSrcweir // ICustomAnimationListController 2503cdf0e10cSrcweir void CustomAnimationPane::onSelect() 2504cdf0e10cSrcweir { 2505cdf0e10cSrcweir maListSelection = mpCustomAnimationList->getSelection(); 2506cdf0e10cSrcweir updateControls(); 2507cdf0e10cSrcweir markShapesFromSelectedEffects(); 2508cdf0e10cSrcweir } 2509cdf0e10cSrcweir 2510cdf0e10cSrcweir 2511cdf0e10cSrcweir 2512cdf0e10cSrcweir 2513cdf0e10cSrcweir const CustomAnimationPresets& CustomAnimationPane::getPresets (void) 2514cdf0e10cSrcweir { 2515cdf0e10cSrcweir if (mpCustomAnimationPresets == NULL) 2516cdf0e10cSrcweir mpCustomAnimationPresets = &CustomAnimationPresets::getCustomAnimationPresets(); 2517cdf0e10cSrcweir return *mpCustomAnimationPresets; 2518cdf0e10cSrcweir } 2519cdf0e10cSrcweir 2520cdf0e10cSrcweir 2521cdf0e10cSrcweir 2522cdf0e10cSrcweir void CustomAnimationPane::markShapesFromSelectedEffects() 2523cdf0e10cSrcweir { 2524cdf0e10cSrcweir if( !maSelectionLock.isLocked() ) 2525cdf0e10cSrcweir { 2526cdf0e10cSrcweir ScopeLockGuard aGuard( maSelectionLock ); 2527cdf0e10cSrcweir DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >( 2528cdf0e10cSrcweir FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get()); 2529cdf0e10cSrcweir DrawView* pView = pViewShell ? pViewShell->GetDrawView() : NULL; 2530cdf0e10cSrcweir 2531cdf0e10cSrcweir if( pView ) 2532cdf0e10cSrcweir { 2533cdf0e10cSrcweir pView->UnmarkAllObj(); 2534cdf0e10cSrcweir EffectSequence::iterator aIter( maListSelection.begin() ); 2535cdf0e10cSrcweir const EffectSequence::iterator aEnd( maListSelection.end() ); 2536cdf0e10cSrcweir while( aIter != aEnd ) 2537cdf0e10cSrcweir { 2538cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = (*aIter++); 2539cdf0e10cSrcweir 2540cdf0e10cSrcweir Reference< XShape > xShape( pEffect->getTargetShape() ); 2541cdf0e10cSrcweir SdrObject* pObj = GetSdrObjectFromXShape( xShape ); 2542cdf0e10cSrcweir if( pObj ) 2543cdf0e10cSrcweir pView->MarkObj(pObj, pView->GetSdrPageView(), sal_False, sal_False); 2544cdf0e10cSrcweir } 2545cdf0e10cSrcweir } 2546cdf0e10cSrcweir } 2547cdf0e10cSrcweir } 2548cdf0e10cSrcweir 2549cdf0e10cSrcweir 2550cdf0e10cSrcweir void CustomAnimationPane::updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag ) 2551cdf0e10cSrcweir { 2552cdf0e10cSrcweir MainSequenceRebuildGuard aGuard( mpMainSequence ); 2553cdf0e10cSrcweir if( xTag.is() ) 2554cdf0e10cSrcweir { 2555cdf0e10cSrcweir SdrPathObj* pPathObj = xTag->getPathObj(); 2556cdf0e10cSrcweir CustomAnimationEffectPtr pEffect = xTag->getEffect(); 2557cdf0e10cSrcweir if( (pPathObj != 0) && pEffect.get() != 0 ) 2558cdf0e10cSrcweir { 2559cdf0e10cSrcweir ::svl::IUndoManager* pManager = mrBase.GetDocShell()->GetUndoManager(); 2560cdf0e10cSrcweir if( pManager ) 2561cdf0e10cSrcweir { 2562cdf0e10cSrcweir SdPage* pPage = SdPage::getImplementation( mxCurrentPage ); 2563cdf0e10cSrcweir if( pPage ) 2564cdf0e10cSrcweir pManager->AddUndoAction( new UndoAnimationPath( mrBase.GetDocShell()->GetDoc(), pPage, pEffect->getNode() ) ); 2565cdf0e10cSrcweir } 2566cdf0e10cSrcweir 2567cdf0e10cSrcweir pEffect->updatePathFromSdrPathObj( *pPathObj ); 2568cdf0e10cSrcweir } 2569cdf0e10cSrcweir } 2570cdf0e10cSrcweir } 2571cdf0e10cSrcweir 2572cdf0e10cSrcweir // ==================================================================== 2573cdf0e10cSrcweir 2574cdf0e10cSrcweir ::Window * createCustomAnimationPanel( ::Window* pParent, ViewShellBase& rBase ) 2575cdf0e10cSrcweir { 2576cdf0e10cSrcweir DialogListBox* pWindow = 0; 2577cdf0e10cSrcweir 2578cdf0e10cSrcweir DrawDocShell* pDocSh = rBase.GetDocShell(); 2579cdf0e10cSrcweir if( pDocSh ) 2580cdf0e10cSrcweir { 2581cdf0e10cSrcweir pWindow = new DialogListBox( pParent, WB_CLIPCHILDREN|WB_TABSTOP|WB_AUTOHSCROLL ); 2582*7a32b0c8SAndre Fischer const Size aMinSize( pWindow->LogicToPixel( Size( 80, 256 ), MAP_APPFONT ) ); 2583*7a32b0c8SAndre Fischer pWindow->SetSizePixel(aMinSize); 2584*7a32b0c8SAndre Fischer pWindow->SetBackground(Wallpaper(Color(COL_BLUE))); 2585cdf0e10cSrcweir 2586cdf0e10cSrcweir ::Window* pPaneWindow = new CustomAnimationPane( pWindow, rBase, aMinSize ); 2587cdf0e10cSrcweir pWindow->SetChildWindow( pPaneWindow, aMinSize ); 2588cdf0e10cSrcweir pWindow->SetText( pPaneWindow->GetText() ); 2589cdf0e10cSrcweir } 2590cdf0e10cSrcweir 2591cdf0e10cSrcweir return pWindow; 2592cdf0e10cSrcweir } 2593cdf0e10cSrcweir 2594cdf0e10cSrcweir 2595cdf0e10cSrcweir 2596*7a32b0c8SAndre Fischer 2597*7a32b0c8SAndre Fischer sal_Int32 getCustomAnimationPanelMinimumHeight (::Window* pDialog) 2598*7a32b0c8SAndre Fischer { 2599*7a32b0c8SAndre Fischer if (pDialog != NULL) 2600*7a32b0c8SAndre Fischer return pDialog->LogicToPixel(Size( 80, 256 ), MAP_APPFONT).Height(); 2601*7a32b0c8SAndre Fischer else 2602*7a32b0c8SAndre Fischer return 0; 2603*7a32b0c8SAndre Fischer } 2604*7a32b0c8SAndre Fischer 2605cdf0e10cSrcweir } 2606