Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "strings.hrc"
22 : #include "dlgctrls.hxx"
23 : #include "sdresid.hxx"
24 : #include "fadedef.h"
25 : #include "sdpage.hxx"
26 :
27 : using namespace ::sd;
28 : using namespace ::rtl;
29 :
30 0 : struct FadeEffectLBImpl
31 : {
32 : std::vector< TransitionPresetPtr > maPresets;
33 : };
34 :
35 0 : FadeEffectLB::FadeEffectLB( Window* pParent, SdResId Id )
36 : : ListBox( pParent, Id ),
37 0 : mpImpl( new FadeEffectLBImpl )
38 : {
39 0 : }
40 :
41 0 : FadeEffectLB::~FadeEffectLB()
42 : {
43 0 : delete mpImpl;
44 0 : }
45 :
46 0 : void FadeEffectLB::Fill()
47 : {
48 0 : TransitionPresetPtr pPreset;
49 :
50 0 : InsertEntry( String( SdResId( STR_EFFECT_NONE ) ) );
51 0 : mpImpl->maPresets.push_back( pPreset );
52 :
53 0 : const TransitionPresetList& rPresetList = TransitionPreset::getTransitionPresetList();
54 0 : TransitionPresetList::const_iterator aIter;
55 0 : for( aIter = rPresetList.begin(); aIter != rPresetList.end(); ++aIter )
56 : {
57 0 : pPreset = (*aIter);
58 0 : const OUString aUIName( pPreset->getUIName() );
59 0 : if( !aUIName.isEmpty() )
60 : {
61 0 : InsertEntry( aUIName );
62 0 : mpImpl->maPresets.push_back( pPreset );
63 : }
64 0 : }
65 :
66 0 : SelectEntryPos(0);
67 0 : }
68 :
69 :
70 : // -----------------------------------------------------------------------------
71 :
72 0 : void FadeEffectLB::applySelected( SdPage* pSlide ) const
73 : {
74 0 : const sal_uInt16 nPos = GetSelectEntryPos();
75 :
76 0 : if( pSlide && (nPos < mpImpl->maPresets.size() ) )
77 : {
78 0 : TransitionPresetPtr pPreset( mpImpl->maPresets[nPos] );
79 :
80 0 : if( pPreset.get() )
81 : {
82 0 : pPreset->apply( pSlide );
83 : }
84 : else
85 : {
86 0 : pSlide->setTransitionType( 0 );
87 0 : pSlide->setTransitionSubtype( 0 );
88 0 : pSlide->setTransitionDirection( sal_True );
89 0 : pSlide->setTransitionFadeColor( 0 );
90 0 : }
91 : }
92 0 : }
93 :
94 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|