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