1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sd.hxx" 30*cdf0e10cSrcweir #include <com/sun/star/presentation/AnimationEffect.hpp> 31*cdf0e10cSrcweir #include <com/sun/star/presentation/AnimationSpeed.hpp> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #define _ANIMATION //animation freischalten 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #define _SV_BITMAPEX 36*cdf0e10cSrcweir #include <svx/xoutbmp.hxx> 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir #include <time.h> 39*cdf0e10cSrcweir #include <svl/eitem.hxx> 40*cdf0e10cSrcweir #include <svx/svdograf.hxx> 41*cdf0e10cSrcweir #include <svx/svdogrp.hxx> 42*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 43*cdf0e10cSrcweir #include <sfx2/progress.hxx> 44*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 45*cdf0e10cSrcweir #include "anminfo.hxx" 46*cdf0e10cSrcweir #include "animobjs.hxx" 47*cdf0e10cSrcweir #include "animobjs.hrc" 48*cdf0e10cSrcweir #include "anmdef.hxx" 49*cdf0e10cSrcweir #include "app.hrc" 50*cdf0e10cSrcweir #include "strings.hrc" 51*cdf0e10cSrcweir #include "sdresid.hxx" 52*cdf0e10cSrcweir #include "View.hxx" 53*cdf0e10cSrcweir #include "drawdoc.hxx" 54*cdf0e10cSrcweir #include "sdpage.hxx" 55*cdf0e10cSrcweir #include "res_bmp.hrc" 56*cdf0e10cSrcweir #include "ViewShell.hxx" 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir #ifndef _SV_SVAPP_HXX_ 59*cdf0e10cSrcweir #include <vcl/svapp.hxx> 60*cdf0e10cSrcweir #endif 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir #include <string> 63*cdf0e10cSrcweir #include <algorithm> 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir using namespace ::com::sun::star; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir namespace sd { 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir /************************************************************************* 70*cdf0e10cSrcweir |* SdDisplay - Control 71*cdf0e10cSrcweir \************************************************************************/ 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir SdDisplay::SdDisplay( Window* pWin, SdResId Id ) : 74*cdf0e10cSrcweir Control( pWin, Id ), 75*cdf0e10cSrcweir aScale( 1, 1 ) 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir SetMapMode( MAP_PIXEL ); 78*cdf0e10cSrcweir const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); 79*cdf0e10cSrcweir SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) ); 80*cdf0e10cSrcweir } 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir // ----------------------------------------------------------------------- 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir SdDisplay::~SdDisplay() 85*cdf0e10cSrcweir { 86*cdf0e10cSrcweir } 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir // ----------------------------------------------------------------------- 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir void SdDisplay::SetBitmapEx( BitmapEx* pBmpEx ) 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir if( pBmpEx ) 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir aBitmapEx = *pBmpEx; 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir else 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); 99*cdf0e10cSrcweir const Color aFillColor = rStyles.GetFieldColor(); 100*cdf0e10cSrcweir aBitmapEx.Erase(aFillColor); 101*cdf0e10cSrcweir } 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir // ----------------------------------------------------------------------- 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir void SdDisplay::Paint( const Rectangle& ) 107*cdf0e10cSrcweir { 108*cdf0e10cSrcweir Point aPt; 109*cdf0e10cSrcweir Size aSize = GetOutputSize(); 110*cdf0e10cSrcweir Size aBmpSize = aBitmapEx.GetBitmap().GetSizePixel(); 111*cdf0e10cSrcweir aBmpSize.Width() = (long) ( (double) aBmpSize.Width() * (double) aScale ); 112*cdf0e10cSrcweir aBmpSize.Height() = (long) ( (double) aBmpSize.Height() * (double) aScale ); 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir if( aBmpSize.Width() < aSize.Width() ) 115*cdf0e10cSrcweir aPt.X() = ( aSize.Width() - aBmpSize.Width() ) / 2; 116*cdf0e10cSrcweir if( aBmpSize.Height() < aSize.Height() ) 117*cdf0e10cSrcweir aPt.Y() = ( aSize.Height() - aBmpSize.Height() ) / 2; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir aBitmapEx.Draw( this, aPt, aBmpSize ); 120*cdf0e10cSrcweir //DrawBitmap( aPt, aBmpSize, *pBitmap ); 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir // ----------------------------------------------------------------------- 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir void SdDisplay::SetScale( const Fraction& rFrac ) 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir aScale = rFrac; 128*cdf0e10cSrcweir } 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir void SdDisplay::DataChanged( const DataChangedEvent& rDCEvt ) 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir Control::DataChanged( rDCEvt ); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); 137*cdf0e10cSrcweir SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) ); 138*cdf0e10cSrcweir SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() 139*cdf0e10cSrcweir ? ViewShell::OUTPUT_DRAWMODE_CONTRAST 140*cdf0e10cSrcweir : ViewShell::OUTPUT_DRAWMODE_COLOR ); 141*cdf0e10cSrcweir } 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir /************************************************************************* 145*cdf0e10cSrcweir |* AnimationWindow - FloatingWindow 146*cdf0e10cSrcweir \************************************************************************/ 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir AnimationWindow::AnimationWindow( SfxBindings* pInBindings, 149*cdf0e10cSrcweir SfxChildWindow *pCW, Window* pParent, const SdResId& rSdResId ) : 150*cdf0e10cSrcweir SfxDockingWindow ( pInBindings, pCW, pParent, rSdResId ), 151*cdf0e10cSrcweir aCtlDisplay ( this, SdResId( CTL_DISPLAY ) ), 152*cdf0e10cSrcweir aBtnFirst ( this, SdResId( BTN_FIRST ) ), 153*cdf0e10cSrcweir aBtnReverse ( this, SdResId( BTN_REVERSE ) ), 154*cdf0e10cSrcweir aBtnStop ( this, SdResId( BTN_STOP ) ), 155*cdf0e10cSrcweir aBtnPlay ( this, SdResId( BTN_PLAY ) ), 156*cdf0e10cSrcweir aBtnLast ( this, SdResId( BTN_LAST ) ), 157*cdf0e10cSrcweir aNumFldBitmap ( this, SdResId( NUM_FLD_BITMAP ) ), 158*cdf0e10cSrcweir aTimeField ( this, SdResId( TIME_FIELD ) ), 159*cdf0e10cSrcweir aLbLoopCount ( this, SdResId( LB_LOOP_COUNT ) ), 160*cdf0e10cSrcweir aGrpBitmap ( this, SdResId( GRP_BITMAP ) ), 161*cdf0e10cSrcweir aBtnGetOneObject ( this, SdResId( BTN_GET_ONE_OBJECT ) ), 162*cdf0e10cSrcweir aBtnGetAllObjects ( this, SdResId( BTN_GET_ALL_OBJECTS ) ), 163*cdf0e10cSrcweir aBtnRemoveBitmap ( this, SdResId( BTN_REMOVE_BITMAP ) ), 164*cdf0e10cSrcweir aBtnRemoveAll ( this, SdResId( BTN_REMOVE_ALL ) ), 165*cdf0e10cSrcweir aFtCount ( this, SdResId( FT_COUNT ) ), 166*cdf0e10cSrcweir aFiCount ( this, SdResId( FI_COUNT ) ), 167*cdf0e10cSrcweir aGrpAnimation ( this, SdResId( GRP_ANIMATION_GROUP ) ), 168*cdf0e10cSrcweir aRbtGroup ( this, SdResId( RBT_GROUP ) ), 169*cdf0e10cSrcweir aRbtBitmap ( this, SdResId( RBT_BITMAP ) ), 170*cdf0e10cSrcweir aFtAdjustment ( this, SdResId( FT_ADJUSTMENT ) ), 171*cdf0e10cSrcweir aLbAdjustment ( this, SdResId( LB_ADJUSTMENT ) ), 172*cdf0e10cSrcweir aBtnCreateGroup ( this, SdResId( BTN_CREATE_GROUP ) ), 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir pWin ( pParent ), 175*cdf0e10cSrcweir pBitmapEx ( NULL ), 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir bMovie ( sal_False ), 178*cdf0e10cSrcweir bAllObjects ( sal_False ), 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir pBindings ( pInBindings ) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir aCtlDisplay.SetAccessibleName(String (SdResId(STR_DISPLAY))); 183*cdf0e10cSrcweir FreeResource(); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir aBtnGetOneObject.SetModeImage( Image( SdResId( IMG_GET1OBJECT_H ) ), BMP_COLOR_HIGHCONTRAST ); 186*cdf0e10cSrcweir aBtnGetAllObjects.SetModeImage( Image( SdResId( IMG_GETALLOBJECT_H ) ), BMP_COLOR_HIGHCONTRAST ); 187*cdf0e10cSrcweir aBtnRemoveBitmap.SetModeImage( Image( SdResId( IMG_REMOVEBMP_H ) ), BMP_COLOR_HIGHCONTRAST ); 188*cdf0e10cSrcweir aBtnRemoveAll.SetModeImage( Image( SdResId( IMG_REMOVEALLBMP_H ) ), BMP_COLOR_HIGHCONTRAST ); 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir // neues Dokument mit Seite erzeugen 191*cdf0e10cSrcweir pMyDoc = new SdDrawDocument(DOCUMENT_TYPE_IMPRESS, NULL); 192*cdf0e10cSrcweir SdPage* pPage = (SdPage*) pMyDoc->AllocPage(sal_False); 193*cdf0e10cSrcweir pMyDoc->InsertPage(pPage); 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir pControllerItem = new AnimationControllerItem( SID_ANIMATOR_STATE, this, pBindings ); 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir // Solange noch nicht in der Resource 198*cdf0e10cSrcweir aTimeField.SetFormat( TIMEF_SEC_CS ); 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir aBtnFirst.SetClickHdl( LINK( this, AnimationWindow, ClickFirstHdl ) ); 201*cdf0e10cSrcweir aBtnReverse.SetClickHdl( LINK( this, AnimationWindow, ClickPlayHdl ) ); 202*cdf0e10cSrcweir aBtnStop.SetClickHdl( LINK( this, AnimationWindow, ClickStopHdl ) ); 203*cdf0e10cSrcweir aBtnPlay.SetClickHdl( LINK( this, AnimationWindow, ClickPlayHdl ) ); 204*cdf0e10cSrcweir aBtnLast.SetClickHdl( LINK( this, AnimationWindow, ClickLastHdl ) ); 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir aBtnGetOneObject.SetClickHdl( LINK( this, AnimationWindow, ClickGetObjectHdl ) ); 207*cdf0e10cSrcweir aBtnGetAllObjects.SetClickHdl( LINK( this, AnimationWindow, ClickGetObjectHdl ) ); 208*cdf0e10cSrcweir aBtnRemoveBitmap.SetClickHdl( LINK( this, AnimationWindow, ClickRemoveBitmapHdl ) ); 209*cdf0e10cSrcweir aBtnRemoveAll.SetClickHdl( LINK( this, AnimationWindow, ClickRemoveBitmapHdl ) ); 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir aRbtGroup.SetClickHdl( LINK( this, AnimationWindow, ClickRbtHdl ) ); 212*cdf0e10cSrcweir aRbtBitmap.SetClickHdl( LINK( this, AnimationWindow, ClickRbtHdl ) ); 213*cdf0e10cSrcweir aBtnCreateGroup.SetClickHdl( LINK( this, AnimationWindow, ClickCreateGroupHdl ) ); 214*cdf0e10cSrcweir aNumFldBitmap.SetModifyHdl( LINK( this, AnimationWindow, ModifyBitmapHdl ) ); 215*cdf0e10cSrcweir aTimeField.SetModifyHdl( LINK( this, AnimationWindow, ModifyTimeHdl ) ); 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir // disable 3D border 218*cdf0e10cSrcweir aCtlDisplay.SetBorderStyle(WINDOW_BORDER_MONO); 219*cdf0e10cSrcweir aDisplaySize = aCtlDisplay.GetOutputSize(); 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir aSize = GetOutputSizePixel(); 222*cdf0e10cSrcweir SetMinOutputSizePixel( aSize ); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir ResetAttrs(); 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir // der Animator ist leer; es kann keine Animationsgruppe erstellt werden 227*cdf0e10cSrcweir aBtnCreateGroup.Disable(); 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir aBtnGetOneObject.SetAccessibleRelationMemberOf( &aGrpBitmap ); 230*cdf0e10cSrcweir aBtnGetAllObjects.SetAccessibleRelationMemberOf( &aGrpBitmap ); 231*cdf0e10cSrcweir aBtnRemoveBitmap.SetAccessibleRelationMemberOf( &aGrpBitmap ); 232*cdf0e10cSrcweir aBtnRemoveAll.SetAccessibleRelationMemberOf( &aGrpBitmap ); 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir // ----------------------------------------------------------------------- 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir AnimationWindow::~AnimationWindow() 238*cdf0e10cSrcweir { 239*cdf0e10cSrcweir sal_uLong i, nCount; 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir delete pControllerItem; 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir // Bitmapliste bereinigen 244*cdf0e10cSrcweir for( i = 0, nCount = aBmpExList.Count(); i < nCount; i++ ) 245*cdf0e10cSrcweir delete static_cast< BitmapEx* >( aBmpExList.GetObject( i ) ); 246*cdf0e10cSrcweir aBmpExList.Clear(); 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir // Timeliste bereinigen 249*cdf0e10cSrcweir for( i = 0, nCount = aTimeList.Count(); i < nCount; i++ ) 250*cdf0e10cSrcweir delete static_cast< Time* >( aTimeList.GetObject( i ) ); 251*cdf0e10cSrcweir aTimeList.Clear(); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir // die Clones loeschen 254*cdf0e10cSrcweir delete pMyDoc; 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir // ----------------------------------------------------------------------- 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir IMPL_LINK( AnimationWindow, ClickFirstHdl, void *, EMPTYARG ) 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir aBmpExList.First(); 262*cdf0e10cSrcweir pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() ); 263*cdf0e10cSrcweir UpdateControl( aBmpExList.GetCurPos() ); 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir return( 0L ); 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir // ----------------------------------------------------------------------- 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir IMPL_LINK( AnimationWindow, ClickStopHdl, void *, EMPTYARG ) 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir bMovie = sal_False; 273*cdf0e10cSrcweir return( 0L ); 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir // ----------------------------------------------------------------------- 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir IMPL_LINK( AnimationWindow, ClickPlayHdl, void *, p ) 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir ScopeLockGuard aGuard( maPlayLock ); 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir bMovie = sal_True; 283*cdf0e10cSrcweir sal_Bool bDisableCtrls = sal_False; 284*cdf0e10cSrcweir sal_uLong nCount = aBmpExList.Count(); 285*cdf0e10cSrcweir sal_Bool bReverse = p == &aBtnReverse; 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir // Kann spaeter schwer ermittelt werden 288*cdf0e10cSrcweir sal_Bool bRbtGroupEnabled = aRbtGroup.IsEnabled(); 289*cdf0e10cSrcweir sal_Bool bBtnGetAllObjectsEnabled = aBtnGetAllObjects.IsEnabled(); 290*cdf0e10cSrcweir sal_Bool bBtnGetOneObjectEnabled = aBtnGetOneObject.IsEnabled(); 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir // Gesamtzeit ermitteln 293*cdf0e10cSrcweir Time aTime( 0 ); 294*cdf0e10cSrcweir long nFullTime; 295*cdf0e10cSrcweir if( aRbtBitmap.IsChecked() ) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir for( sal_uLong i = 0; i < nCount; i++ ) 298*cdf0e10cSrcweir aTime += *static_cast< Time* >( aTimeList.GetObject( i ) ); 299*cdf0e10cSrcweir nFullTime = aTime.GetMSFromTime(); 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir else 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir nFullTime = nCount * 100; 304*cdf0e10cSrcweir aTime.MakeTimeFromMS( nFullTime ); 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir // StatusBarManager ab 1 Sekunde 308*cdf0e10cSrcweir SfxProgress* pProgress = NULL; 309*cdf0e10cSrcweir if( nFullTime >= 1000 ) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir bDisableCtrls = sal_True; 312*cdf0e10cSrcweir aBtnStop.Enable(); 313*cdf0e10cSrcweir aBtnStop.Update(); 314*cdf0e10cSrcweir String aStr( RTL_CONSTASCII_USTRINGPARAM( "Animator:" ) ); // Hier sollte man sich noch etwas gescheites ausdenken! 315*cdf0e10cSrcweir pProgress = new SfxProgress( NULL, aStr, nFullTime ); 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir sal_uLong nTmpTime = 0; 319*cdf0e10cSrcweir long i = 0; 320*cdf0e10cSrcweir sal_Bool bCount = i < (long) nCount; 321*cdf0e10cSrcweir if( bReverse ) 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir i = nCount - 1; 324*cdf0e10cSrcweir bCount = i >= 0; 325*cdf0e10cSrcweir } 326*cdf0e10cSrcweir while( bCount && bMovie ) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir // Um Konsistenz zwischen Liste und Anzeige zu erwirken 329*cdf0e10cSrcweir aBmpExList.Seek( i ); 330*cdf0e10cSrcweir pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() ); 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir UpdateControl( i, bDisableCtrls ); 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir if( aRbtBitmap.IsChecked() ) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir Time* pTime = static_cast< Time* >( aTimeList.GetObject( i ) ); 337*cdf0e10cSrcweir DBG_ASSERT( pTime, "Keine Zeit gefunden!" ); 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir aTimeField.SetTime( *pTime ); 340*cdf0e10cSrcweir sal_uLong nTime = pTime->GetMSFromTime(); 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir WaitInEffect( nTime, nTmpTime, pProgress ); 343*cdf0e10cSrcweir nTmpTime += nTime; 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir else 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir WaitInEffect( 100, nTmpTime, pProgress ); 348*cdf0e10cSrcweir nTmpTime += 100; 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir if( bReverse ) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir i--; 353*cdf0e10cSrcweir if (i < 0) 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir // Terminate loop. 356*cdf0e10cSrcweir bCount = false; 357*cdf0e10cSrcweir // Move i back into valid range. 358*cdf0e10cSrcweir i = 0; 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir else 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir i++; 364*cdf0e10cSrcweir if (i >= (long) nCount) 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir // Terminate loop. 367*cdf0e10cSrcweir bCount = false; 368*cdf0e10cSrcweir // Move i back into valid range. 369*cdf0e10cSrcweir i = nCount - 1; 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir // Um die Controls wieder zu enablen 375*cdf0e10cSrcweir bMovie = sal_False; 376*cdf0e10cSrcweir if (nCount > 0) 377*cdf0e10cSrcweir UpdateControl(i); 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir if( pProgress ) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir delete pProgress; 382*cdf0e10cSrcweir aBtnStop.Disable(); 383*cdf0e10cSrcweir } 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir aRbtGroup.Enable( bRbtGroupEnabled ); 386*cdf0e10cSrcweir aBtnGetAllObjects.Enable( bBtnGetAllObjectsEnabled ); 387*cdf0e10cSrcweir aBtnGetOneObject.Enable( bBtnGetOneObjectEnabled ); 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir return( 0L ); 390*cdf0e10cSrcweir } 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir // ----------------------------------------------------------------------- 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir IMPL_LINK( AnimationWindow, ClickLastHdl, void *, EMPTYARG ) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir aBmpExList.Last(); 397*cdf0e10cSrcweir pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() ); 398*cdf0e10cSrcweir UpdateControl( aBmpExList.GetCurPos() ); 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir return( 0L ); 401*cdf0e10cSrcweir } 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir // ----------------------------------------------------------------------- 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir IMPL_LINK( AnimationWindow, ClickRbtHdl, void *, p ) 406*cdf0e10cSrcweir { 407*cdf0e10cSrcweir if( !pBitmapEx || p == &aRbtGroup || aRbtGroup.IsChecked() ) 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir aTimeField.SetText( String() ); 410*cdf0e10cSrcweir aTimeField.Enable( sal_False ); 411*cdf0e10cSrcweir aLbLoopCount.Enable( sal_False ); 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir else if( p == &aRbtBitmap || aRbtBitmap.IsChecked() ) 414*cdf0e10cSrcweir { 415*cdf0e10cSrcweir sal_uLong n = static_cast<sal_uLong>(aNumFldBitmap.GetValue()); 416*cdf0e10cSrcweir if( n > 0 ) 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir Time* pTime = static_cast< Time* >( aTimeList.GetObject( n - 1 ) ); 419*cdf0e10cSrcweir if( pTime ) 420*cdf0e10cSrcweir aTimeField.SetTime( *pTime ); 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir aTimeField.Enable(); 423*cdf0e10cSrcweir aLbLoopCount.Enable(); 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir return( 0L ); 427*cdf0e10cSrcweir } 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir // ----------------------------------------------------------------------- 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir IMPL_LINK( AnimationWindow, ClickGetObjectHdl, void *, pBtn ) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir bAllObjects = pBtn == &aBtnGetAllObjects; 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir // Code jetzt in AddObj() 436*cdf0e10cSrcweir SfxBoolItem aItem( SID_ANIMATOR_ADD, sal_True ); 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir GetBindings().GetDispatcher()->Execute( 439*cdf0e10cSrcweir SID_ANIMATOR_ADD, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L ); 440*cdf0e10cSrcweir return( 0L ); 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir // ----------------------------------------------------------------------- 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, void *, pBtn ) 446*cdf0e10cSrcweir { 447*cdf0e10cSrcweir SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD); 448*cdf0e10cSrcweir SdrObject* pObject; 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir if( pBtn == &aBtnRemoveBitmap ) 451*cdf0e10cSrcweir { 452*cdf0e10cSrcweir sal_uLong nPos = aBmpExList.GetCurPos(); 453*cdf0e10cSrcweir pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() ); 454*cdf0e10cSrcweir if( pBitmapEx ) 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir delete pBitmapEx; 457*cdf0e10cSrcweir aBmpExList.Remove(); 458*cdf0e10cSrcweir pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() ); 459*cdf0e10cSrcweir } 460*cdf0e10cSrcweir Time* pTime = static_cast< Time* >( aTimeList.GetObject( nPos ) ); 461*cdf0e10cSrcweir if( pTime ) 462*cdf0e10cSrcweir { 463*cdf0e10cSrcweir delete pTime; 464*cdf0e10cSrcweir aTimeList.Remove( nPos ); 465*cdf0e10cSrcweir } 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir pObject = pPage->GetObj( nPos ); 468*cdf0e10cSrcweir // Durch Uebernahme der AnimatedGIFs muessen nicht unbedingt 469*cdf0e10cSrcweir // Objekte vorhanden sein. 470*cdf0e10cSrcweir if( pObject ) 471*cdf0e10cSrcweir { 472*cdf0e10cSrcweir pObject = pPage->RemoveObject(nPos); 473*cdf0e10cSrcweir DBG_ASSERT(pObject, "Clone beim Loeschen nicht gefunden"); 474*cdf0e10cSrcweir SdrObject::Free( pObject ); 475*cdf0e10cSrcweir pPage->RecalcObjOrdNums(); 476*cdf0e10cSrcweir } 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir } 479*cdf0e10cSrcweir else // Alles loeschen 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir WarningBox aWarnBox( this, WB_YES_NO, String( SdResId( STR_ASK_DELETE_ALL_PICTURES ) ) ); 482*cdf0e10cSrcweir short nReturn = aWarnBox.Execute(); 483*cdf0e10cSrcweir 484*cdf0e10cSrcweir if( nReturn == RET_YES ) 485*cdf0e10cSrcweir { 486*cdf0e10cSrcweir // Bitmapliste bereinigen 487*cdf0e10cSrcweir long nCount = aBmpExList.Count(); 488*cdf0e10cSrcweir long i; 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir for( i = nCount - 1; i >= 0; i-- ) 491*cdf0e10cSrcweir { 492*cdf0e10cSrcweir pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( i ) ); 493*cdf0e10cSrcweir delete pBitmapEx; 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir pObject = pPage->GetObj( i ); 496*cdf0e10cSrcweir if( pObject ) 497*cdf0e10cSrcweir { 498*cdf0e10cSrcweir pObject = pPage->RemoveObject( i ); 499*cdf0e10cSrcweir DBG_ASSERT(pObject, "Clone beim Loeschen nicht gefunden"); 500*cdf0e10cSrcweir SdrObject::Free( pObject ); 501*cdf0e10cSrcweir //pPage->RecalcObjOrdNums(); 502*cdf0e10cSrcweir } 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir } 505*cdf0e10cSrcweir aBmpExList.Clear(); 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir // Timeliste bereinigen 508*cdf0e10cSrcweir nCount = aTimeList.Count(); 509*cdf0e10cSrcweir for( i = 0; i < nCount; i++ ) 510*cdf0e10cSrcweir { 511*cdf0e10cSrcweir delete static_cast< Time* >( aTimeList.GetObject( i ) ); 512*cdf0e10cSrcweir } 513*cdf0e10cSrcweir aTimeList.Clear(); 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir } 516*cdf0e10cSrcweir 517*cdf0e10cSrcweir // kann noch eine Animationsgruppe erstellt werden? 518*cdf0e10cSrcweir if (aBmpExList.Count() == 0) 519*cdf0e10cSrcweir { 520*cdf0e10cSrcweir aBtnCreateGroup.Disable(); 521*cdf0e10cSrcweir // Falls vorher durch Uebernahme von AnimatedGIFs disabled: 522*cdf0e10cSrcweir //aRbtBitmap.Enable(); 523*cdf0e10cSrcweir aRbtGroup.Enable(); 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir // Zoom fuer DisplayWin berechnen und setzen 527*cdf0e10cSrcweir Fraction aFrac( GetScale() ); 528*cdf0e10cSrcweir aCtlDisplay.SetScale( aFrac ); 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir UpdateControl( aBmpExList.GetCurPos() ); 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir return( 0L ); 533*cdf0e10cSrcweir } 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir // ----------------------------------------------------------------------- 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir IMPL_LINK( AnimationWindow, ClickCreateGroupHdl, void *, EMPTYARG ) 538*cdf0e10cSrcweir { 539*cdf0e10cSrcweir // Code jetzt in CreatePresObj() 540*cdf0e10cSrcweir SfxBoolItem aItem( SID_ANIMATOR_CREATE, sal_True ); 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir GetBindings().GetDispatcher()->Execute( 543*cdf0e10cSrcweir SID_ANIMATOR_CREATE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L ); 544*cdf0e10cSrcweir return( 0L ); 545*cdf0e10cSrcweir } 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir // ----------------------------------------------------------------------- 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir IMPL_LINK( AnimationWindow, ModifyBitmapHdl, void *, EMPTYARG ) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir sal_uLong nBmp = static_cast<sal_uLong>(aNumFldBitmap.GetValue()); 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir if( nBmp > aBmpExList.Count() ) 554*cdf0e10cSrcweir nBmp = aBmpExList.Count(); 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( nBmp - 1 ) ); 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir // Positionieren in der Liste 559*cdf0e10cSrcweir aBmpExList.Seek( nBmp - 1 ); 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir UpdateControl( nBmp - 1 ); 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir return( 0L ); 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir // ----------------------------------------------------------------------- 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir IMPL_LINK( AnimationWindow, ModifyTimeHdl, void *, EMPTYARG ) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir sal_uLong nPos = static_cast<sal_uLong>(aNumFldBitmap.GetValue() - 1); 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir Time* pTime = static_cast< Time* >( aTimeList.GetObject( nPos ) ); 573*cdf0e10cSrcweir DBG_ASSERT( pTime, "Zeit nicht gefunden!" ); 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir *pTime = aTimeField.GetTime(); 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir return( 0L ); 578*cdf0e10cSrcweir } 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir // ----------------------------------------------------------------------- 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir void AnimationWindow::UpdateControl( sal_uLong nListPos, sal_Bool bDisableCtrls ) 583*cdf0e10cSrcweir { 584*cdf0e10cSrcweir String aString; 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir if( pBitmapEx ) 587*cdf0e10cSrcweir { 588*cdf0e10cSrcweir BitmapEx aBmp( *pBitmapEx ); 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD); 591*cdf0e10cSrcweir SdrObject* pObject = (SdrObject*) pPage->GetObj( (sal_uLong) nListPos ); 592*cdf0e10cSrcweir if( pObject ) 593*cdf0e10cSrcweir { 594*cdf0e10cSrcweir VirtualDevice aVD; 595*cdf0e10cSrcweir Rectangle aObjRect( pObject->GetCurrentBoundRect() ); 596*cdf0e10cSrcweir Size aObjSize( aObjRect.GetSize() ); 597*cdf0e10cSrcweir Point aOrigin( Point( -aObjRect.Left(), -aObjRect.Top() ) ); 598*cdf0e10cSrcweir MapMode aMap( aVD.GetMapMode() ); 599*cdf0e10cSrcweir aMap.SetMapUnit( MAP_100TH_MM ); 600*cdf0e10cSrcweir aMap.SetOrigin( aOrigin ); 601*cdf0e10cSrcweir aVD.SetMapMode( aMap ); 602*cdf0e10cSrcweir aVD.SetOutputSize( aObjSize ); 603*cdf0e10cSrcweir const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); 604*cdf0e10cSrcweir aVD.SetBackground( Wallpaper( rStyles.GetFieldColor() ) ); 605*cdf0e10cSrcweir aVD.SetDrawMode( rStyles.GetHighContrastMode() 606*cdf0e10cSrcweir ? ViewShell::OUTPUT_DRAWMODE_CONTRAST 607*cdf0e10cSrcweir : ViewShell::OUTPUT_DRAWMODE_COLOR ); 608*cdf0e10cSrcweir aVD.Erase(); 609*cdf0e10cSrcweir pObject->SingleObjectPainter( aVD ); // #110094#-17 610*cdf0e10cSrcweir aBmp = BitmapEx( aVD.GetBitmap( aObjRect.TopLeft(), aObjSize ) ); 611*cdf0e10cSrcweir } 612*cdf0e10cSrcweir 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir aCtlDisplay.SetBitmapEx( &aBmp ); 615*cdf0e10cSrcweir } 616*cdf0e10cSrcweir else 617*cdf0e10cSrcweir { 618*cdf0e10cSrcweir aCtlDisplay.SetBitmapEx( pBitmapEx ); 619*cdf0e10cSrcweir } 620*cdf0e10cSrcweir aCtlDisplay.Invalidate(); 621*cdf0e10cSrcweir aCtlDisplay.Update(); 622*cdf0e10cSrcweir 623*cdf0e10cSrcweir aFiCount.SetText( UniString::CreateFromInt32( aBmpExList.Count() ) ); 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir if( pBitmapEx && !bMovie ) 626*cdf0e10cSrcweir { 627*cdf0e10cSrcweir aNumFldBitmap.SetValue( nListPos + 1 ); 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir // Wenn mind. 1 Objekt in der Liste ist 630*cdf0e10cSrcweir aBtnFirst.Enable(); 631*cdf0e10cSrcweir aBtnReverse.Enable(); 632*cdf0e10cSrcweir aBtnPlay.Enable(); 633*cdf0e10cSrcweir aBtnLast.Enable(); 634*cdf0e10cSrcweir aNumFldBitmap.Enable(); 635*cdf0e10cSrcweir aTimeField.Enable(); 636*cdf0e10cSrcweir aLbLoopCount.Enable(); 637*cdf0e10cSrcweir aBtnRemoveBitmap.Enable(); 638*cdf0e10cSrcweir aBtnRemoveAll.Enable(); 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir else 641*cdf0e10cSrcweir { 642*cdf0e10cSrcweir //aFiCount.SetText( String( SdResId( STR_NULL ) ) ); 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir // Wenn kein Objekt in der Liste ist 645*cdf0e10cSrcweir aBtnFirst.Enable( sal_False ); 646*cdf0e10cSrcweir aBtnReverse.Enable( sal_False ); 647*cdf0e10cSrcweir aBtnPlay.Enable( sal_False ); 648*cdf0e10cSrcweir aBtnLast.Enable( sal_False ); 649*cdf0e10cSrcweir aNumFldBitmap.Enable( sal_False ); 650*cdf0e10cSrcweir aTimeField.Enable( sal_False ); 651*cdf0e10cSrcweir aLbLoopCount.Enable( sal_False ); 652*cdf0e10cSrcweir aBtnRemoveBitmap.Enable( sal_False ); 653*cdf0e10cSrcweir aBtnRemoveAll.Enable( sal_False ); 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir //aFtAdjustment.Enable(); 656*cdf0e10cSrcweir //aLbAdjustment.Enable(); 657*cdf0e10cSrcweir } 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir if( bMovie && bDisableCtrls ) 660*cdf0e10cSrcweir { 661*cdf0e10cSrcweir aBtnGetOneObject.Enable( sal_False ); 662*cdf0e10cSrcweir aBtnGetAllObjects.Enable( sal_False ); 663*cdf0e10cSrcweir aRbtGroup.Enable( sal_False ); 664*cdf0e10cSrcweir aRbtBitmap.Enable( sal_False ); 665*cdf0e10cSrcweir aBtnCreateGroup.Enable( sal_False ); 666*cdf0e10cSrcweir aFtAdjustment.Enable( sal_False ); 667*cdf0e10cSrcweir aLbAdjustment.Enable( sal_False ); 668*cdf0e10cSrcweir } 669*cdf0e10cSrcweir else 670*cdf0e10cSrcweir { 671*cdf0e10cSrcweir // 'Gruppenobjekt' nur dann enablen, wenn es kein Animated GIF ist 672*cdf0e10cSrcweir if (aBmpExList.Count() == 0) 673*cdf0e10cSrcweir aRbtGroup.Enable(); 674*cdf0e10cSrcweir 675*cdf0e10cSrcweir aRbtBitmap.Enable(); 676*cdf0e10cSrcweir aBtnCreateGroup.Enable(aBmpExList.Count() != 0); 677*cdf0e10cSrcweir aFtAdjustment.Enable( sal_True ); 678*cdf0e10cSrcweir aLbAdjustment.Enable( sal_True ); 679*cdf0e10cSrcweir } 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir ClickRbtHdl( NULL ); 682*cdf0e10cSrcweir } 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir // ----------------------------------------------------------------------- 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir void AnimationWindow::ResetAttrs() 687*cdf0e10cSrcweir { 688*cdf0e10cSrcweir aRbtGroup.Check(); 689*cdf0e10cSrcweir aLbAdjustment.SelectEntryPos( BA_CENTER ); 690*cdf0e10cSrcweir // LoopCount 691*cdf0e10cSrcweir aLbLoopCount.SelectEntryPos( aLbLoopCount.GetEntryCount() - 1); 692*cdf0e10cSrcweir 693*cdf0e10cSrcweir UpdateControl( 0 ); 694*cdf0e10cSrcweir } 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir // ----------------------------------------------------------------------- 697*cdf0e10cSrcweir 698*cdf0e10cSrcweir void AnimationWindow::WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime, 699*cdf0e10cSrcweir SfxProgress* pProgress ) const 700*cdf0e10cSrcweir { 701*cdf0e10cSrcweir clock_t aEnd = Time::GetSystemTicks() + nMilliSeconds; 702*cdf0e10cSrcweir clock_t aCurrent = Time::GetSystemTicks(); 703*cdf0e10cSrcweir while (aCurrent < aEnd) 704*cdf0e10cSrcweir { 705*cdf0e10cSrcweir aCurrent = Time::GetSystemTicks(); 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir if( pProgress ) 708*cdf0e10cSrcweir pProgress->SetState( nTime + nMilliSeconds + aCurrent - aEnd ); 709*cdf0e10cSrcweir 710*cdf0e10cSrcweir Application::Reschedule(); 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir if( !bMovie ) 713*cdf0e10cSrcweir return; 714*cdf0e10cSrcweir } 715*cdf0e10cSrcweir } 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir // ----------------------------------------------------------------------- 718*cdf0e10cSrcweir 719*cdf0e10cSrcweir Fraction AnimationWindow::GetScale() 720*cdf0e10cSrcweir { 721*cdf0e10cSrcweir Fraction aFrac; 722*cdf0e10cSrcweir sal_uLong nPos = aBmpExList.GetCurPos(); 723*cdf0e10cSrcweir sal_uLong nCount = aBmpExList.Count(); 724*cdf0e10cSrcweir if( nCount > 0 ) 725*cdf0e10cSrcweir { 726*cdf0e10cSrcweir aBmpSize.Width() = 0; 727*cdf0e10cSrcweir aBmpSize.Height() = 0; 728*cdf0e10cSrcweir for( sal_uLong i = 0; i < nCount; i++ ) 729*cdf0e10cSrcweir { 730*cdf0e10cSrcweir pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( i ) ); 731*cdf0e10cSrcweir Size aTempSize( pBitmapEx->GetBitmap().GetSizePixel() ); 732*cdf0e10cSrcweir aBmpSize.Width() = Max( aBmpSize.Width(), aTempSize.Width() ); 733*cdf0e10cSrcweir aBmpSize.Height() = Max( aBmpSize.Height(), aTempSize.Height() ); 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir aBmpSize.Width() += 10; 737*cdf0e10cSrcweir aBmpSize.Height() += 10; 738*cdf0e10cSrcweir 739*cdf0e10cSrcweir aFrac = Fraction( std::min( (double)aDisplaySize.Width() / (double)aBmpSize.Width(), 740*cdf0e10cSrcweir (double)aDisplaySize.Height() / (double)aBmpSize.Height() ) ); 741*cdf0e10cSrcweir } 742*cdf0e10cSrcweir // Liste wieder auf alten Stand bringen 743*cdf0e10cSrcweir pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( nPos ) ); 744*cdf0e10cSrcweir return( aFrac ); 745*cdf0e10cSrcweir } 746*cdf0e10cSrcweir 747*cdf0e10cSrcweir // ----------------------------------------------------------------------- 748*cdf0e10cSrcweir 749*cdf0e10cSrcweir void AnimationWindow::Resize() 750*cdf0e10cSrcweir { 751*cdf0e10cSrcweir //if( !IsZoomedIn() ) 752*cdf0e10cSrcweir if ( !IsFloatingMode() || 753*cdf0e10cSrcweir !GetFloatingWindow()->IsRollUp() ) 754*cdf0e10cSrcweir { 755*cdf0e10cSrcweir Size aWinSize( GetOutputSizePixel() ); // vorher rSize im Resizing() 756*cdf0e10cSrcweir 757*cdf0e10cSrcweir Size aDiffSize; 758*cdf0e10cSrcweir aDiffSize.Width() = aWinSize.Width() - aSize.Width(); 759*cdf0e10cSrcweir aDiffSize.Height() = aWinSize.Height() - aSize.Height(); 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir // Umgroessern des Display-Controls 762*cdf0e10cSrcweir aDisplaySize.Width() += aDiffSize.Width(); 763*cdf0e10cSrcweir aDisplaySize.Height() += aDiffSize.Height(); 764*cdf0e10cSrcweir aCtlDisplay.SetOutputSizePixel( aDisplaySize ); 765*cdf0e10cSrcweir 766*cdf0e10cSrcweir Point aPt; 767*cdf0e10cSrcweir // aPt.X() = aDiffSize.Width() / 2; 768*cdf0e10cSrcweir aPt.Y() = aDiffSize.Height(); 769*cdf0e10cSrcweir 770*cdf0e10cSrcweir // Verschieben der anderen Controls 771*cdf0e10cSrcweir aBtnFirst.Hide(); 772*cdf0e10cSrcweir aBtnReverse.Hide(); 773*cdf0e10cSrcweir aBtnStop.Hide(); 774*cdf0e10cSrcweir aBtnPlay.Hide(); 775*cdf0e10cSrcweir aBtnLast.Hide(); 776*cdf0e10cSrcweir aTimeField.Hide(); 777*cdf0e10cSrcweir aLbLoopCount.Hide(); 778*cdf0e10cSrcweir aNumFldBitmap.Hide(); 779*cdf0e10cSrcweir aFtCount.Hide(); 780*cdf0e10cSrcweir aFiCount.Hide(); 781*cdf0e10cSrcweir aBtnGetOneObject.Hide(); 782*cdf0e10cSrcweir aBtnGetAllObjects.Hide(); 783*cdf0e10cSrcweir aBtnRemoveBitmap.Hide(); 784*cdf0e10cSrcweir aBtnRemoveAll.Hide(); 785*cdf0e10cSrcweir aGrpBitmap.Hide(); 786*cdf0e10cSrcweir aRbtGroup.Hide(); 787*cdf0e10cSrcweir aRbtBitmap.Hide(); 788*cdf0e10cSrcweir aFtAdjustment.Hide(); 789*cdf0e10cSrcweir aLbAdjustment.Hide(); 790*cdf0e10cSrcweir aBtnCreateGroup.Hide(); 791*cdf0e10cSrcweir aGrpAnimation.Hide(); 792*cdf0e10cSrcweir 793*cdf0e10cSrcweir 794*cdf0e10cSrcweir aBtnFirst.SetPosPixel( aBtnFirst.GetPosPixel() + aPt ); 795*cdf0e10cSrcweir aBtnReverse.SetPosPixel( aBtnReverse.GetPosPixel() + aPt ); 796*cdf0e10cSrcweir aBtnStop.SetPosPixel( aBtnStop.GetPosPixel() + aPt ); 797*cdf0e10cSrcweir aBtnPlay.SetPosPixel( aBtnPlay.GetPosPixel() + aPt ); 798*cdf0e10cSrcweir aBtnLast.SetPosPixel( aBtnLast.GetPosPixel() + aPt ); 799*cdf0e10cSrcweir aNumFldBitmap.SetPosPixel( aNumFldBitmap.GetPosPixel() + aPt ); 800*cdf0e10cSrcweir aTimeField.SetPosPixel( aTimeField.GetPosPixel() + aPt ); 801*cdf0e10cSrcweir aLbLoopCount.SetPosPixel( aLbLoopCount.GetPosPixel() + aPt ); 802*cdf0e10cSrcweir aFtCount.SetPosPixel( aFtCount.GetPosPixel() + aPt ); 803*cdf0e10cSrcweir aFiCount.SetPosPixel( aFiCount.GetPosPixel() + aPt ); 804*cdf0e10cSrcweir aRbtGroup.SetPosPixel( aRbtGroup.GetPosPixel() + aPt ); 805*cdf0e10cSrcweir aRbtBitmap.SetPosPixel( aRbtBitmap.GetPosPixel() + aPt ); 806*cdf0e10cSrcweir aFtAdjustment.SetPosPixel( aFtAdjustment.GetPosPixel() + aPt ); 807*cdf0e10cSrcweir aLbAdjustment.SetPosPixel( aLbAdjustment.GetPosPixel() + aPt ); 808*cdf0e10cSrcweir aBtnGetOneObject.SetPosPixel( aBtnGetOneObject.GetPosPixel() + aPt ); 809*cdf0e10cSrcweir aBtnGetAllObjects.SetPosPixel( aBtnGetAllObjects.GetPosPixel() + aPt ); 810*cdf0e10cSrcweir aBtnRemoveBitmap.SetPosPixel( aBtnRemoveBitmap.GetPosPixel() + aPt ); 811*cdf0e10cSrcweir aBtnRemoveAll.SetPosPixel( aBtnRemoveAll.GetPosPixel() + aPt ); 812*cdf0e10cSrcweir aBtnCreateGroup.SetPosPixel( aBtnCreateGroup.GetPosPixel() + aPt ); 813*cdf0e10cSrcweir aGrpBitmap.SetPosPixel( aGrpBitmap.GetPosPixel() + aPt ); 814*cdf0e10cSrcweir aGrpAnimation.SetPosPixel( aGrpAnimation.GetPosPixel() + aPt ); 815*cdf0e10cSrcweir 816*cdf0e10cSrcweir // Zoom fuer DisplayWin berechnen und setzen 817*cdf0e10cSrcweir Fraction aFrac( GetScale() ); 818*cdf0e10cSrcweir aCtlDisplay.SetScale( aFrac ); 819*cdf0e10cSrcweir 820*cdf0e10cSrcweir aBtnFirst.Show(); 821*cdf0e10cSrcweir aBtnReverse.Show(); 822*cdf0e10cSrcweir aBtnStop.Show(); 823*cdf0e10cSrcweir aBtnPlay.Show(); 824*cdf0e10cSrcweir aBtnLast.Show(); 825*cdf0e10cSrcweir aNumFldBitmap.Show(); 826*cdf0e10cSrcweir aTimeField.Show(); 827*cdf0e10cSrcweir aLbLoopCount.Show(); 828*cdf0e10cSrcweir aFtCount.Show(); 829*cdf0e10cSrcweir aFiCount.Show(); 830*cdf0e10cSrcweir aFtAdjustment.Show(); 831*cdf0e10cSrcweir aLbAdjustment.Show(); 832*cdf0e10cSrcweir aBtnGetOneObject.Show(); 833*cdf0e10cSrcweir aBtnGetAllObjects.Show(); 834*cdf0e10cSrcweir aBtnRemoveBitmap.Show(); 835*cdf0e10cSrcweir aBtnRemoveAll.Show(); 836*cdf0e10cSrcweir aGrpBitmap.Show(); 837*cdf0e10cSrcweir aRbtGroup.Show(); 838*cdf0e10cSrcweir aRbtBitmap.Show(); 839*cdf0e10cSrcweir aFtAdjustment.Show(); 840*cdf0e10cSrcweir aLbAdjustment.Show(); 841*cdf0e10cSrcweir aBtnCreateGroup.Show(); 842*cdf0e10cSrcweir aGrpAnimation.Show(); 843*cdf0e10cSrcweir 844*cdf0e10cSrcweir aSize = aWinSize; 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir //aFltWinSize = GetSizePixel(); 847*cdf0e10cSrcweir } 848*cdf0e10cSrcweir SfxDockingWindow::Resize(); 849*cdf0e10cSrcweir } 850*cdf0e10cSrcweir 851*cdf0e10cSrcweir // ----------------------------------------------------------------------- 852*cdf0e10cSrcweir 853*cdf0e10cSrcweir sal_Bool AnimationWindow::Close() 854*cdf0e10cSrcweir { 855*cdf0e10cSrcweir if( maPlayLock.isLocked() ) 856*cdf0e10cSrcweir { 857*cdf0e10cSrcweir return sal_False; 858*cdf0e10cSrcweir } 859*cdf0e10cSrcweir else 860*cdf0e10cSrcweir { 861*cdf0e10cSrcweir SfxBoolItem aItem( SID_ANIMATION_OBJECTS, sal_False ); 862*cdf0e10cSrcweir 863*cdf0e10cSrcweir GetBindings().GetDispatcher()->Execute( 864*cdf0e10cSrcweir SID_ANIMATION_OBJECTS, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); 865*cdf0e10cSrcweir 866*cdf0e10cSrcweir SfxDockingWindow::Close(); 867*cdf0e10cSrcweir 868*cdf0e10cSrcweir return sal_True; 869*cdf0e10cSrcweir } 870*cdf0e10cSrcweir } 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir // ----------------------------------------------------------------------- 873*cdf0e10cSrcweir 874*cdf0e10cSrcweir void AnimationWindow::FillInfo( SfxChildWinInfo& rInfo ) const 875*cdf0e10cSrcweir { 876*cdf0e10cSrcweir SfxDockingWindow::FillInfo( rInfo ) ; 877*cdf0e10cSrcweir } 878*cdf0e10cSrcweir 879*cdf0e10cSrcweir // ----------------------------------------------------------------------- 880*cdf0e10cSrcweir 881*cdf0e10cSrcweir void AnimationWindow::AddObj (::sd::View& rView ) 882*cdf0e10cSrcweir { 883*cdf0e10cSrcweir // Texteingabemodus beenden, damit Bitmap mit 884*cdf0e10cSrcweir // Objekt identisch ist. 885*cdf0e10cSrcweir if( rView.IsTextEdit() ) 886*cdf0e10cSrcweir rView.SdrEndTextEdit(); 887*cdf0e10cSrcweir 888*cdf0e10cSrcweir // Objekt(e) clonen und den/die Clone(s) in die Liste stellen 889*cdf0e10cSrcweir const SdrMarkList& rMarkList = rView.GetMarkedObjectList(); 890*cdf0e10cSrcweir sal_uLong nMarkCount = rMarkList.GetMarkCount(); 891*cdf0e10cSrcweir SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD); 892*cdf0e10cSrcweir sal_uLong nCloneCount = pPage->GetObjCount(); 893*cdf0e10cSrcweir 894*cdf0e10cSrcweir if (nMarkCount > 0) 895*cdf0e10cSrcweir { 896*cdf0e10cSrcweir // Wenn es sich um EIN Animationsobjekt oder ein Gruppenobjekt 897*cdf0e10cSrcweir // handelt, das 'einzeln uebernommen' wurde, 898*cdf0e10cSrcweir // werden die einzelnen Objekte eingefuegt 899*cdf0e10cSrcweir sal_Bool bAnimObj = sal_False; 900*cdf0e10cSrcweir if( nMarkCount == 1 ) 901*cdf0e10cSrcweir { 902*cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 903*cdf0e10cSrcweir SdrObject* pObject = pMark->GetMarkedSdrObj(); 904*cdf0e10cSrcweir SdAnimationInfo* pAnimInfo = rView.GetDoc()->GetAnimationInfo( pObject ); 905*cdf0e10cSrcweir sal_uInt32 nInv = pObject->GetObjInventor(); 906*cdf0e10cSrcweir sal_uInt16 nId = pObject->GetObjIdentifier(); 907*cdf0e10cSrcweir 908*cdf0e10cSrcweir // Animated Bitmap (GIF) 909*cdf0e10cSrcweir if( nInv == SdrInventor && nId == OBJ_GRAF && ( (SdrGrafObj*) pObject )->IsAnimated() ) 910*cdf0e10cSrcweir { 911*cdf0e10cSrcweir const SdrGrafObj* pGrafObj = (SdrGrafObj*) pObject; 912*cdf0e10cSrcweir Graphic aGraphic( pGrafObj->GetTransformedGraphic() ); 913*cdf0e10cSrcweir sal_uInt16 nCount = 0; 914*cdf0e10cSrcweir 915*cdf0e10cSrcweir if( aGraphic.IsAnimated() ) 916*cdf0e10cSrcweir nCount = aGraphic.GetAnimation().Count(); 917*cdf0e10cSrcweir 918*cdf0e10cSrcweir if( nCount > 0 ) 919*cdf0e10cSrcweir { 920*cdf0e10cSrcweir const Animation aAnimation( aGraphic.GetAnimation() ); 921*cdf0e10cSrcweir 922*cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nCount; i++ ) 923*cdf0e10cSrcweir { 924*cdf0e10cSrcweir const AnimationBitmap& rAnimBmp = aAnimation.Get( i ); 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir pBitmapEx = new BitmapEx( rAnimBmp.aBmpEx ); 927*cdf0e10cSrcweir aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 ); 928*cdf0e10cSrcweir 929*cdf0e10cSrcweir // LoopCount 930*cdf0e10cSrcweir if( i == 0 ) 931*cdf0e10cSrcweir { 932*cdf0e10cSrcweir long nLoopCount = aAnimation.GetLoopCount(); 933*cdf0e10cSrcweir 934*cdf0e10cSrcweir if( !nLoopCount ) // unendlich 935*cdf0e10cSrcweir aLbLoopCount.SelectEntryPos( aLbLoopCount.GetEntryCount() - 1); 936*cdf0e10cSrcweir else 937*cdf0e10cSrcweir aLbLoopCount.SelectEntry( UniString::CreateFromInt32( nLoopCount ) ); 938*cdf0e10cSrcweir } 939*cdf0e10cSrcweir 940*cdf0e10cSrcweir // Time 941*cdf0e10cSrcweir long nTime = rAnimBmp.nWait; 942*cdf0e10cSrcweir Time* pTime = new Time( 0, 0, nTime / 100, nTime % 100 ); 943*cdf0e10cSrcweir aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 ); 944*cdf0e10cSrcweir 945*cdf0e10cSrcweir // Weiterschalten der BitmapListe 946*cdf0e10cSrcweir aBmpExList.Next(); 947*cdf0e10cSrcweir } 948*cdf0e10cSrcweir // Nachdem ein animated GIF uebernommen wurde, kann auch nur ein solches erstellt werden 949*cdf0e10cSrcweir aRbtBitmap.Check(); 950*cdf0e10cSrcweir aRbtGroup.Enable( sal_False ); 951*cdf0e10cSrcweir bAnimObj = sal_True; 952*cdf0e10cSrcweir } 953*cdf0e10cSrcweir } 954*cdf0e10cSrcweir else if( bAllObjects || ( pAnimInfo && pAnimInfo->mbIsMovie ) ) 955*cdf0e10cSrcweir { 956*cdf0e10cSrcweir // Mehrere Objekte 957*cdf0e10cSrcweir SdrObjList* pObjList = ((SdrObjGroup*)pObject)->GetSubList(); 958*cdf0e10cSrcweir 959*cdf0e10cSrcweir for( sal_uInt16 nObject = 0; nObject < pObjList->GetObjCount(); nObject++ ) 960*cdf0e10cSrcweir { 961*cdf0e10cSrcweir SdrObject* pSnapShot = (SdrObject*) pObjList->GetObj( (sal_uLong) nObject ); 962*cdf0e10cSrcweir 963*cdf0e10cSrcweir pBitmapEx = new BitmapEx( SdrExchangeView::GetObjGraphic( pSnapShot->GetModel(), pSnapShot ).GetBitmapEx() ); 964*cdf0e10cSrcweir aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 ); 965*cdf0e10cSrcweir 966*cdf0e10cSrcweir // Time 967*cdf0e10cSrcweir Time* pTime = new Time( aTimeField.GetTime() ); 968*cdf0e10cSrcweir aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 ); 969*cdf0e10cSrcweir 970*cdf0e10cSrcweir // Clone 971*cdf0e10cSrcweir pPage->InsertObject( pSnapShot->Clone(), aBmpExList.GetCurPos() + 1 ); 972*cdf0e10cSrcweir 973*cdf0e10cSrcweir // Weiterschalten der BitmapListe 974*cdf0e10cSrcweir aBmpExList.Next(); 975*cdf0e10cSrcweir } 976*cdf0e10cSrcweir bAnimObj = sal_True; 977*cdf0e10cSrcweir } 978*cdf0e10cSrcweir } 979*cdf0e10cSrcweir // Auch ein einzelnes animiertes Objekt 980*cdf0e10cSrcweir if( !bAnimObj && !( bAllObjects && nMarkCount > 1 ) ) 981*cdf0e10cSrcweir { 982*cdf0e10cSrcweir pBitmapEx = new BitmapEx( rView.GetAllMarkedGraphic().GetBitmapEx() ); 983*cdf0e10cSrcweir aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 ); 984*cdf0e10cSrcweir 985*cdf0e10cSrcweir // Time 986*cdf0e10cSrcweir Time* pTime = new Time( aTimeField.GetTime() ); 987*cdf0e10cSrcweir aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 ); 988*cdf0e10cSrcweir 989*cdf0e10cSrcweir } 990*cdf0e10cSrcweir 991*cdf0e10cSrcweir // ein einzelnes Objekt 992*cdf0e10cSrcweir if( nMarkCount == 1 && !bAnimObj ) 993*cdf0e10cSrcweir { 994*cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 995*cdf0e10cSrcweir SdrObject* pObject = pMark->GetMarkedSdrObj(); 996*cdf0e10cSrcweir SdrObject* pClone = pObject->Clone(); 997*cdf0e10cSrcweir pPage->InsertObject(pClone, aBmpExList.GetCurPos() + 1); 998*cdf0e10cSrcweir } 999*cdf0e10cSrcweir // mehrere Objekte: die Clones zu einer Gruppe zusammenfassen 1000*cdf0e10cSrcweir else if (nMarkCount > 1) 1001*cdf0e10cSrcweir { 1002*cdf0e10cSrcweir // Objekte einzeln uebernehmen 1003*cdf0e10cSrcweir if( bAllObjects ) 1004*cdf0e10cSrcweir { 1005*cdf0e10cSrcweir for( sal_uLong nObject= 0; nObject < nMarkCount; nObject++ ) 1006*cdf0e10cSrcweir { 1007*cdf0e10cSrcweir // Clone 1008*cdf0e10cSrcweir SdrObject* pObject = rMarkList.GetMark( nObject )->GetMarkedSdrObj(); 1009*cdf0e10cSrcweir 1010*cdf0e10cSrcweir pBitmapEx = new BitmapEx( SdrExchangeView::GetObjGraphic( pObject->GetModel(), pObject ).GetBitmapEx() ); 1011*cdf0e10cSrcweir aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 ); 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir // Time 1014*cdf0e10cSrcweir Time* pTime = new Time( aTimeField.GetTime() ); 1015*cdf0e10cSrcweir aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 ); 1016*cdf0e10cSrcweir 1017*cdf0e10cSrcweir pPage->InsertObject( pObject->Clone(), aBmpExList.GetCurPos() + 1 ); 1018*cdf0e10cSrcweir 1019*cdf0e10cSrcweir aBmpExList.Next(); 1020*cdf0e10cSrcweir } 1021*cdf0e10cSrcweir bAnimObj = sal_True; // damit nicht nochmal weitergeschaltet wird 1022*cdf0e10cSrcweir } 1023*cdf0e10cSrcweir else 1024*cdf0e10cSrcweir { 1025*cdf0e10cSrcweir SdrObjGroup* pCloneGroup = new SdrObjGroup; 1026*cdf0e10cSrcweir SdrObjList* pObjList = pCloneGroup->GetSubList(); 1027*cdf0e10cSrcweir 1028*cdf0e10cSrcweir for (sal_uLong nObject= 0; nObject < nMarkCount; nObject++) 1029*cdf0e10cSrcweir pObjList->InsertObject(rMarkList.GetMark(nObject)->GetMarkedSdrObj()->Clone(), LIST_APPEND); 1030*cdf0e10cSrcweir 1031*cdf0e10cSrcweir pPage->InsertObject(pCloneGroup, aBmpExList.GetCurPos() + 1); 1032*cdf0e10cSrcweir } 1033*cdf0e10cSrcweir } 1034*cdf0e10cSrcweir 1035*cdf0e10cSrcweir if( !bAnimObj ) 1036*cdf0e10cSrcweir aBmpExList.Next(); 1037*cdf0e10cSrcweir 1038*cdf0e10cSrcweir // wenn vorher nichts im Animator war und jetzt was da ist, kann eine 1039*cdf0e10cSrcweir // Animationsgruppe erstellt werden 1040*cdf0e10cSrcweir if (nCloneCount == 0 && aBmpExList.Count() > 0) 1041*cdf0e10cSrcweir aBtnCreateGroup.Enable(); 1042*cdf0e10cSrcweir 1043*cdf0e10cSrcweir // Zoom fuer DisplayWin berechnen und setzen 1044*cdf0e10cSrcweir Fraction aFrac( GetScale() ); 1045*cdf0e10cSrcweir aCtlDisplay.SetScale( aFrac ); 1046*cdf0e10cSrcweir 1047*cdf0e10cSrcweir UpdateControl( aBmpExList.GetCurPos() ); 1048*cdf0e10cSrcweir } 1049*cdf0e10cSrcweir } 1050*cdf0e10cSrcweir 1051*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1052*cdf0e10cSrcweir 1053*cdf0e10cSrcweir void AnimationWindow::CreateAnimObj (::sd::View& rView ) 1054*cdf0e10cSrcweir { 1055*cdf0e10cSrcweir ::Window* pOutWin = static_cast< ::Window*>(rView.GetFirstOutputDevice()); // GetWin( 0 ); 1056*cdf0e10cSrcweir DBG_ASSERT( pOutWin, "Window ist nicht vorhanden!" ); 1057*cdf0e10cSrcweir 1058*cdf0e10cSrcweir // die Fentermitte ermitteln 1059*cdf0e10cSrcweir const MapMode aMap100( MAP_100TH_MM ); 1060*cdf0e10cSrcweir Size aMaxSizeLog; 1061*cdf0e10cSrcweir Size aMaxSizePix; 1062*cdf0e10cSrcweir Size aTemp( pOutWin->GetOutputSizePixel() ); 1063*cdf0e10cSrcweir const Point aWindowCenter( pOutWin->PixelToLogic( Point( aTemp.Width() >> 1, aTemp.Height() >> 1 ) ) ); 1064*cdf0e10cSrcweir const OutputDevice* pDefDev = Application::GetDefaultDevice(); 1065*cdf0e10cSrcweir const sal_uLong nCount = aBmpExList.Count(); 1066*cdf0e10cSrcweir BitmapAdjustment eBA = (BitmapAdjustment) aLbAdjustment.GetSelectEntryPos(); 1067*cdf0e10cSrcweir sal_uLong i; 1068*cdf0e10cSrcweir 1069*cdf0e10cSrcweir // Groesste Bitmap ermitteln 1070*cdf0e10cSrcweir for( i = 0; i < nCount; i++ ) 1071*cdf0e10cSrcweir { 1072*cdf0e10cSrcweir const BitmapEx& rBmpEx = *static_cast< BitmapEx* >( aBmpExList.GetObject( i ) ); 1073*cdf0e10cSrcweir const Graphic aGraphic( rBmpEx ); 1074*cdf0e10cSrcweir Size aTmpSizeLog; 1075*cdf0e10cSrcweir const Size aTmpSizePix( rBmpEx.GetSizePixel() ); 1076*cdf0e10cSrcweir 1077*cdf0e10cSrcweir if ( aGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL ) 1078*cdf0e10cSrcweir aTmpSizeLog = pDefDev->PixelToLogic( aGraphic.GetPrefSize(), aMap100 ); 1079*cdf0e10cSrcweir else 1080*cdf0e10cSrcweir aTmpSizeLog = pDefDev->LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 ); 1081*cdf0e10cSrcweir 1082*cdf0e10cSrcweir aMaxSizeLog.Width() = Max( aMaxSizeLog.Width(), aTmpSizeLog.Width() ); 1083*cdf0e10cSrcweir aMaxSizeLog.Height() = Max( aMaxSizeLog.Height(), aTmpSizeLog.Height() ); 1084*cdf0e10cSrcweir 1085*cdf0e10cSrcweir aMaxSizePix.Width() = Max( aMaxSizePix.Width(), aTmpSizePix.Width() ); 1086*cdf0e10cSrcweir aMaxSizePix.Height() = Max( aMaxSizePix.Height(), aTmpSizePix.Height() ); 1087*cdf0e10cSrcweir } 1088*cdf0e10cSrcweir 1089*cdf0e10cSrcweir SdrPageView* pPV = rView.GetSdrPageView(); 1090*cdf0e10cSrcweir 1091*cdf0e10cSrcweir if( aRbtBitmap.IsChecked() ) 1092*cdf0e10cSrcweir { 1093*cdf0e10cSrcweir // Bitmapgruppe erzeugen (Animated GIF) 1094*cdf0e10cSrcweir Animation aAnimation; 1095*cdf0e10cSrcweir Point aPt; 1096*cdf0e10cSrcweir 1097*cdf0e10cSrcweir for( i = 0; i < nCount; i++ ) 1098*cdf0e10cSrcweir { 1099*cdf0e10cSrcweir Time* pTime = static_cast< Time* >( aTimeList.GetObject( i ) ); 1100*cdf0e10cSrcweir long nTime = pTime->Get100Sec(); 1101*cdf0e10cSrcweir nTime += pTime->GetSec() * 100; 1102*cdf0e10cSrcweir 1103*cdf0e10cSrcweir pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( i ) ); 1104*cdf0e10cSrcweir 1105*cdf0e10cSrcweir // Offset fuer die gewuenschte Ausrichtung bestimmen 1106*cdf0e10cSrcweir const Size aBitmapSize( pBitmapEx->GetSizePixel() ); 1107*cdf0e10cSrcweir 1108*cdf0e10cSrcweir switch( eBA ) 1109*cdf0e10cSrcweir { 1110*cdf0e10cSrcweir case BA_LEFT_UP: 1111*cdf0e10cSrcweir break; 1112*cdf0e10cSrcweir 1113*cdf0e10cSrcweir case BA_LEFT: 1114*cdf0e10cSrcweir aPt.Y() = (aMaxSizePix.Height() - aBitmapSize.Height()) >> 1; 1115*cdf0e10cSrcweir break; 1116*cdf0e10cSrcweir 1117*cdf0e10cSrcweir case BA_LEFT_DOWN: 1118*cdf0e10cSrcweir aPt.Y() = aMaxSizePix.Height() - aBitmapSize.Height(); 1119*cdf0e10cSrcweir break; 1120*cdf0e10cSrcweir 1121*cdf0e10cSrcweir case BA_UP: 1122*cdf0e10cSrcweir aPt.X() = (aMaxSizePix.Width() - aBitmapSize.Width()) >> 1; 1123*cdf0e10cSrcweir break; 1124*cdf0e10cSrcweir 1125*cdf0e10cSrcweir case BA_CENTER: 1126*cdf0e10cSrcweir aPt.X() = (aMaxSizePix.Width() - aBitmapSize.Width()) >> 1; 1127*cdf0e10cSrcweir aPt.Y() = (aMaxSizePix.Height() - aBitmapSize.Height()) >> 1; 1128*cdf0e10cSrcweir break; 1129*cdf0e10cSrcweir 1130*cdf0e10cSrcweir case BA_DOWN: 1131*cdf0e10cSrcweir aPt.X() = (aMaxSizePix.Width() - aBitmapSize.Width()) >> 1; 1132*cdf0e10cSrcweir aPt.Y() = aMaxSizePix.Height() - aBitmapSize.Height(); 1133*cdf0e10cSrcweir break; 1134*cdf0e10cSrcweir 1135*cdf0e10cSrcweir case BA_RIGHT_UP: 1136*cdf0e10cSrcweir aPt.X() = aMaxSizePix.Width() - aBitmapSize.Width(); 1137*cdf0e10cSrcweir break; 1138*cdf0e10cSrcweir 1139*cdf0e10cSrcweir case BA_RIGHT: 1140*cdf0e10cSrcweir aPt.X() = aMaxSizePix.Width() - aBitmapSize.Width(); 1141*cdf0e10cSrcweir aPt.Y() = (aMaxSizePix.Height() - aBitmapSize.Height()) >> 1; 1142*cdf0e10cSrcweir break; 1143*cdf0e10cSrcweir 1144*cdf0e10cSrcweir case BA_RIGHT_DOWN: 1145*cdf0e10cSrcweir aPt.X() = aMaxSizePix.Width() - aBitmapSize.Width(); 1146*cdf0e10cSrcweir aPt.Y() = aMaxSizePix.Height() - aBitmapSize.Height(); 1147*cdf0e10cSrcweir break; 1148*cdf0e10cSrcweir 1149*cdf0e10cSrcweir } 1150*cdf0e10cSrcweir 1151*cdf0e10cSrcweir // LoopCount (Anzahl der Durchlaeufe) ermitteln 1152*cdf0e10cSrcweir AnimationBitmap aAnimBmp; 1153*cdf0e10cSrcweir long nLoopCount = 0L; 1154*cdf0e10cSrcweir sal_uInt16 nPos = aLbLoopCount.GetSelectEntryPos(); 1155*cdf0e10cSrcweir 1156*cdf0e10cSrcweir if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != aLbLoopCount.GetEntryCount() - 1 ) // unendlich 1157*cdf0e10cSrcweir nLoopCount = (long) aLbLoopCount.GetSelectEntry().ToInt32(); 1158*cdf0e10cSrcweir 1159*cdf0e10cSrcweir aAnimBmp.aBmpEx = *pBitmapEx; 1160*cdf0e10cSrcweir aAnimBmp.aPosPix = aPt; 1161*cdf0e10cSrcweir aAnimBmp.aSizePix = aBitmapSize; 1162*cdf0e10cSrcweir aAnimBmp.nWait = nTime; 1163*cdf0e10cSrcweir aAnimBmp.eDisposal = DISPOSE_BACK; 1164*cdf0e10cSrcweir aAnimBmp.bUserInput = sal_False; 1165*cdf0e10cSrcweir 1166*cdf0e10cSrcweir aAnimation.Insert( aAnimBmp ); 1167*cdf0e10cSrcweir aAnimation.SetDisplaySizePixel( aMaxSizePix ); 1168*cdf0e10cSrcweir aAnimation.SetLoopCount( nLoopCount ); 1169*cdf0e10cSrcweir } 1170*cdf0e10cSrcweir 1171*cdf0e10cSrcweir SdrGrafObj* pGrafObj = new SdrGrafObj( Graphic( aAnimation ) ); 1172*cdf0e10cSrcweir const Point aOrg( aWindowCenter.X() - ( aMaxSizeLog.Width() >> 1 ), aWindowCenter.Y() - ( aMaxSizeLog.Height() >> 1 ) ); 1173*cdf0e10cSrcweir 1174*cdf0e10cSrcweir pGrafObj->SetLogicRect( Rectangle( aOrg, aMaxSizeLog ) ); 1175*cdf0e10cSrcweir rView.InsertObjectAtView( pGrafObj, *pPV, SDRINSERT_SETDEFLAYER); 1176*cdf0e10cSrcweir } 1177*cdf0e10cSrcweir else 1178*cdf0e10cSrcweir { 1179*cdf0e10cSrcweir // Offset fuer die gewuenschte Ausrichtung bestimmen 1180*cdf0e10cSrcweir Size aOffset; 1181*cdf0e10cSrcweir SdrObject * pClone = NULL; 1182*cdf0e10cSrcweir SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD); 1183*cdf0e10cSrcweir 1184*cdf0e10cSrcweir for(i = 0; i < nCount; i++) 1185*cdf0e10cSrcweir { 1186*cdf0e10cSrcweir pClone = pPage->GetObj(i); 1187*cdf0e10cSrcweir Rectangle aRect( pClone->GetSnapRect() ); 1188*cdf0e10cSrcweir 1189*cdf0e10cSrcweir switch( eBA ) 1190*cdf0e10cSrcweir { 1191*cdf0e10cSrcweir case BA_LEFT_UP: 1192*cdf0e10cSrcweir break; 1193*cdf0e10cSrcweir 1194*cdf0e10cSrcweir case BA_LEFT: 1195*cdf0e10cSrcweir aOffset.Height() = (aMaxSizeLog.Height() - aRect.GetHeight()) / 2; 1196*cdf0e10cSrcweir break; 1197*cdf0e10cSrcweir 1198*cdf0e10cSrcweir case BA_LEFT_DOWN: 1199*cdf0e10cSrcweir aOffset.Height() = aMaxSizeLog.Height() - aRect.GetHeight(); 1200*cdf0e10cSrcweir break; 1201*cdf0e10cSrcweir 1202*cdf0e10cSrcweir case BA_UP: 1203*cdf0e10cSrcweir aOffset.Width() = (aMaxSizeLog.Width() - aRect.GetWidth()) / 2; 1204*cdf0e10cSrcweir break; 1205*cdf0e10cSrcweir 1206*cdf0e10cSrcweir case BA_CENTER: 1207*cdf0e10cSrcweir aOffset.Width() = (aMaxSizeLog.Width() - aRect.GetWidth()) / 2; 1208*cdf0e10cSrcweir aOffset.Height() = (aMaxSizeLog.Height() - aRect.GetHeight()) / 2; 1209*cdf0e10cSrcweir break; 1210*cdf0e10cSrcweir 1211*cdf0e10cSrcweir case BA_DOWN: 1212*cdf0e10cSrcweir aOffset.Width() = (aMaxSizeLog.Width() - aRect.GetWidth()) / 2; 1213*cdf0e10cSrcweir aOffset.Height() = aMaxSizeLog.Height() - aRect.GetHeight(); 1214*cdf0e10cSrcweir break; 1215*cdf0e10cSrcweir 1216*cdf0e10cSrcweir case BA_RIGHT_UP: 1217*cdf0e10cSrcweir aOffset.Width() = aMaxSizeLog.Width() - aRect.GetWidth(); 1218*cdf0e10cSrcweir break; 1219*cdf0e10cSrcweir 1220*cdf0e10cSrcweir case BA_RIGHT: 1221*cdf0e10cSrcweir aOffset.Width() = aMaxSizeLog.Width() - aRect.GetWidth(); 1222*cdf0e10cSrcweir aOffset.Height() = (aMaxSizeLog.Height() - aRect.GetHeight()) / 2; 1223*cdf0e10cSrcweir break; 1224*cdf0e10cSrcweir 1225*cdf0e10cSrcweir case BA_RIGHT_DOWN: 1226*cdf0e10cSrcweir aOffset.Width() = aMaxSizeLog.Width() - aRect.GetWidth(); 1227*cdf0e10cSrcweir aOffset.Height() = aMaxSizeLog.Height() - aRect.GetHeight(); 1228*cdf0e10cSrcweir break; 1229*cdf0e10cSrcweir 1230*cdf0e10cSrcweir } 1231*cdf0e10cSrcweir //aRect.SetPos(aWindowCenter + Point(aOffset.Width(), aOffset.Height())); 1232*cdf0e10cSrcweir //pClone->SetSnapRect( aRect ); 1233*cdf0e10cSrcweir // SetSnapRect ist fuer Ellipsen leider nicht implementiert !!! 1234*cdf0e10cSrcweir Point aMovePt( aWindowCenter + Point( aOffset.Width(), aOffset.Height() ) - aRect.TopLeft() ); 1235*cdf0e10cSrcweir Size aMoveSize( aMovePt.X(), aMovePt.Y() ); 1236*cdf0e10cSrcweir pClone->NbcMove( aMoveSize ); 1237*cdf0e10cSrcweir } 1238*cdf0e10cSrcweir 1239*cdf0e10cSrcweir // Animationsgruppe erzeugen 1240*cdf0e10cSrcweir SdrObjGroup* pGroup = new SdrObjGroup; 1241*cdf0e10cSrcweir SdrObjList* pObjList = pGroup->GetSubList(); 1242*cdf0e10cSrcweir 1243*cdf0e10cSrcweir for (i = 0; i < nCount; i++) 1244*cdf0e10cSrcweir { 1245*cdf0e10cSrcweir // der Clone verbleibt im Animator; in die Gruppe kommt ein Clone 1246*cdf0e10cSrcweir // des Clones 1247*cdf0e10cSrcweir pClone = pPage->GetObj(i); 1248*cdf0e10cSrcweir SdrObject* pCloneOfClone = pClone->Clone(); 1249*cdf0e10cSrcweir //SdrObject* pCloneOfClone = pPage->GetObj(i)->Clone(); 1250*cdf0e10cSrcweir pObjList->InsertObject(pCloneOfClone, LIST_APPEND); 1251*cdf0e10cSrcweir } 1252*cdf0e10cSrcweir 1253*cdf0e10cSrcweir // bis jetzt liegt die linke obere Ecke der Gruppe in der Fenstermitte; 1254*cdf0e10cSrcweir // jetzt noch um die Haelfte der Groesse nach oben und links korrigieren 1255*cdf0e10cSrcweir aTemp = aMaxSizeLog; 1256*cdf0e10cSrcweir aTemp.Height() = - aTemp.Height() / 2; 1257*cdf0e10cSrcweir aTemp.Width() = - aTemp.Width() / 2; 1258*cdf0e10cSrcweir pGroup->NbcMove(aTemp); 1259*cdf0e10cSrcweir 1260*cdf0e10cSrcweir // Animationsinformation erzeugen 1261*cdf0e10cSrcweir SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pGroup,true); 1262*cdf0e10cSrcweir pInfo->meEffect = presentation::AnimationEffect_NONE; 1263*cdf0e10cSrcweir pInfo->meSpeed = presentation::AnimationSpeed_MEDIUM; 1264*cdf0e10cSrcweir pInfo->mbActive = sal_True; 1265*cdf0e10cSrcweir pInfo->mbIsMovie = sal_True; 1266*cdf0e10cSrcweir pInfo->maBlueScreen = COL_WHITE; 1267*cdf0e10cSrcweir 1268*cdf0e10cSrcweir rView.InsertObjectAtView( pGroup, *pPV, SDRINSERT_SETDEFLAYER); 1269*cdf0e10cSrcweir } 1270*cdf0e10cSrcweir 1271*cdf0e10cSrcweir ClickFirstHdl( this ); 1272*cdf0e10cSrcweir } 1273*cdf0e10cSrcweir 1274*cdf0e10cSrcweir void AnimationWindow::DataChanged( const DataChangedEvent& rDCEvt ) 1275*cdf0e10cSrcweir { 1276*cdf0e10cSrcweir SfxDockingWindow::DataChanged( rDCEvt ); 1277*cdf0e10cSrcweir 1278*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 1279*cdf0e10cSrcweir { 1280*cdf0e10cSrcweir UpdateControl( aBmpExList.GetCurPos() ); 1281*cdf0e10cSrcweir } 1282*cdf0e10cSrcweir } 1283*cdf0e10cSrcweir 1284*cdf0e10cSrcweir /************************************************************************* 1285*cdf0e10cSrcweir |* 1286*cdf0e10cSrcweir |* ControllerItem fuer Animator 1287*cdf0e10cSrcweir |* 1288*cdf0e10cSrcweir \************************************************************************/ 1289*cdf0e10cSrcweir 1290*cdf0e10cSrcweir AnimationControllerItem::AnimationControllerItem( 1291*cdf0e10cSrcweir sal_uInt16 _nId, 1292*cdf0e10cSrcweir AnimationWindow* pAnimWin, 1293*cdf0e10cSrcweir SfxBindings* _pBindings) 1294*cdf0e10cSrcweir : SfxControllerItem( _nId, *_pBindings ), 1295*cdf0e10cSrcweir pAnimationWin( pAnimWin ) 1296*cdf0e10cSrcweir { 1297*cdf0e10cSrcweir } 1298*cdf0e10cSrcweir 1299*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1300*cdf0e10cSrcweir 1301*cdf0e10cSrcweir void AnimationControllerItem::StateChanged( sal_uInt16 nSId, 1302*cdf0e10cSrcweir SfxItemState eState, const SfxPoolItem* pItem ) 1303*cdf0e10cSrcweir { 1304*cdf0e10cSrcweir if( eState >= SFX_ITEM_AVAILABLE && nSId == SID_ANIMATOR_STATE ) 1305*cdf0e10cSrcweir { 1306*cdf0e10cSrcweir const SfxUInt16Item* pStateItem = PTR_CAST( SfxUInt16Item, pItem ); 1307*cdf0e10cSrcweir DBG_ASSERT( pStateItem, "SfxUInt16Item erwartet"); 1308*cdf0e10cSrcweir sal_uInt16 nState = pStateItem->GetValue(); 1309*cdf0e10cSrcweir 1310*cdf0e10cSrcweir pAnimationWin->aBtnGetOneObject.Enable( nState & 1 ); 1311*cdf0e10cSrcweir pAnimationWin->aBtnGetAllObjects.Enable( nState & 2 ); 1312*cdf0e10cSrcweir } 1313*cdf0e10cSrcweir } 1314*cdf0e10cSrcweir 1315*cdf0e10cSrcweir 1316*cdf0e10cSrcweir } // end of namespace sd 1317