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 : #include <vcl/builder.hxx>
21 :
22 : #include "strings.hrc"
23 : #include "dlgctrls.hxx"
24 : #include "sdresid.hxx"
25 : #include "fadedef.h"
26 : #include "sdpage.hxx"
27 :
28 : using namespace ::sd;
29 :
30 0 : struct FadeEffectLBImpl
31 : {
32 : std::vector< TransitionPresetPtr > maPresets;
33 : };
34 :
35 0 : FadeEffectLB::FadeEffectLB(vcl::Window* pParent, WinBits nStyle)
36 : : ListBox(pParent, nStyle)
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( SD_RESSTR( 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 0 : extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFadeEffectLB(vcl::Window* pParent, VclBuilder::stringmap &rMap)
70 : {
71 0 : WinBits nBits = WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK;
72 :
73 0 : bool bDropdown = VclBuilder::extractDropdown(rMap);
74 :
75 0 : if (bDropdown)
76 0 : nBits |= WB_DROPDOWN;
77 :
78 0 : return new FadeEffectLB(pParent, nBits);
79 : }
80 :
81 0 : void FadeEffectLB::applySelected( SdPage* pSlide ) const
82 : {
83 0 : const sal_uInt16 nPos = GetSelectEntryPos();
84 :
85 0 : if( pSlide && (nPos < mpImpl->maPresets.size() ) )
86 : {
87 0 : TransitionPresetPtr pPreset( mpImpl->maPresets[nPos] );
88 :
89 0 : if( pPreset.get() )
90 : {
91 0 : pPreset->apply( pSlide );
92 : }
93 : else
94 : {
95 0 : pSlide->setTransitionType( 0 );
96 0 : pSlide->setTransitionSubtype( 0 );
97 0 : pSlide->setTransitionDirection( true );
98 0 : pSlide->setTransitionFadeColor( 0 );
99 0 : }
100 : }
101 114 : }
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|