1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlgctrls.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include <tools/ref.hxx>
35 #include <tools/debug.hxx>
37 #include "strings.hrc"
38 #include "dlgctrls.hxx"
39 #include "sdresid.hxx"
44 using namespace ::rtl
;
46 struct FadeEffectLBImpl
48 std::vector
< TransitionPresetPtr
> maPresets
;
51 FadeEffectLB::FadeEffectLB( Window
* pParent
, SdResId Id
)
52 : ListBox( pParent
, Id
),
53 mpImpl( new FadeEffectLBImpl
)
57 FadeEffectLB::FadeEffectLB( Window
* pParent
, WinBits aWB
)
58 : ListBox( pParent
, aWB
),
59 mpImpl( new FadeEffectLBImpl
)
63 FadeEffectLB::~FadeEffectLB()
68 void FadeEffectLB::Fill()
70 TransitionPresetPtr pPreset
;
72 InsertEntry( String( SdResId( STR_EFFECT_NONE
) ) );
73 mpImpl
->maPresets
.push_back( pPreset
);
75 const TransitionPresetList
& rPresetList
= TransitionPreset::getTransitionPresetList();
76 TransitionPresetList::const_iterator aIter
;
77 for( aIter
= rPresetList
.begin(); aIter
!= rPresetList
.end(); aIter
++ )
80 const OUString
aUIName( pPreset
->getUIName() );
81 if( aUIName
.getLength() )
83 InsertEntry( aUIName
);
84 mpImpl
->maPresets
.push_back( pPreset
);
91 // -----------------------------------------------------------------------------
94 void FadeEffectLB::SelectEffect( presentation::FadeEffect eFE )
98 for( long i = 0, nCount = sizeof( aEffects ) / sizeof( FadeEffectPair ); ( i < nCount ) && !bFound; i++ )
100 if( aEffects[ i ].meFE == eFE )
102 SelectEntryPos( (USHORT) i );
109 // -----------------------------------------------------------------------------
111 void FadeEffectLB::applySelected( SdPage
* pSlide
) const
113 const USHORT nPos
= GetSelectEntryPos();
115 if( pSlide
&& (nPos
< mpImpl
->maPresets
.size() ) )
117 TransitionPresetPtr
pPreset( mpImpl
->maPresets
[nPos
] );
121 pPreset
->apply( pSlide
);
125 pSlide
->setTransitionType( 0 );
126 pSlide
->setTransitionSubtype( 0 );
127 pSlide
->setTransitionDirection( sal_True
);
128 pSlide
->setTransitionFadeColor( 0 );