Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "fusldlg.hxx"
30 : : #include <svl/itemset.hxx>
31 : : #include <vcl/msgbox.hxx>
32 : :
33 : : #include "drawdoc.hxx"
34 : : #include "sdpage.hxx"
35 : : #include "sdresid.hxx"
36 : : #include "strings.hrc"
37 : : #include "sdattr.hxx"
38 : : #include "glob.hrc"
39 : : #include "sdmod.hxx"
40 : : #include "ViewShell.hxx"
41 : : #include "Window.hxx"
42 : : #include "optsitem.hxx"
43 : : #include "sdabstdlg.hxx"
44 : :
45 : : namespace sd {
46 : :
47 : : #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
48 : :
49 [ # # ][ # # ]: 0 : TYPEINIT1( FuSlideShowDlg, FuPoor );
50 : :
51 : :
52 : : /*************************************************************************
53 : : |*
54 : : |* Konstruktor
55 : : |*
56 : : \************************************************************************/
57 : :
58 : 0 : FuSlideShowDlg::FuSlideShowDlg (
59 : : ViewShell* pViewSh,
60 : : ::sd::Window* pWin,
61 : : ::sd::View* pView,
62 : : SdDrawDocument* pDoc,
63 : : SfxRequest& rReq)
64 : 0 : : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
65 : : {
66 : 0 : }
67 : :
68 : 0 : FunctionReference FuSlideShowDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
69 : : {
70 [ # # ][ # # ]: 0 : FunctionReference xFunc( new FuSlideShowDlg( pViewSh, pWin, pView, pDoc, rReq ) );
71 [ # # ]: 0 : xFunc->DoExecute(rReq);
72 : 0 : return xFunc;
73 : : }
74 : :
75 : 0 : void FuSlideShowDlg::DoExecute( SfxRequest& )
76 : : {
77 : 0 : PresentationSettings& rPresentationSettings = mpDoc->getPresentationSettings();
78 : :
79 [ # # ]: 0 : SfxItemSet aDlgSet( mpDoc->GetPool(), ATTR_PRESENT_START, ATTR_PRESENT_END );
80 [ # # ][ # # ]: 0 : std::vector<String> aPageNameList(mpDoc->GetSdPageCount( PK_STANDARD ));
81 [ # # ]: 0 : const String& rPresPage = rPresentationSettings.maPresPage;
82 [ # # ]: 0 : String aFirstPage;
83 [ # # ][ # # ]: 0 : String aStandardName( SdResId( STR_PAGE ) );
84 : 0 : SdPage* pPage = NULL;
85 : : long nPage;
86 : :
87 [ # # ][ # # ]: 0 : for( nPage = mpDoc->GetSdPageCount( PK_STANDARD ) - 1L; nPage >= 0L; nPage-- )
88 : : {
89 [ # # ]: 0 : pPage = mpDoc->GetSdPage( (sal_uInt16) nPage, PK_STANDARD );
90 [ # # ][ # # ]: 0 : String aStr( pPage->GetName() );
91 : :
92 [ # # ]: 0 : if ( !aStr.Len() )
93 : : {
94 [ # # ][ # # ]: 0 : aStr = String( SdResId( STR_PAGE ) );
[ # # ][ # # ]
95 [ # # ][ # # ]: 0 : aStr.Append( UniString::CreateFromInt32( nPage + 1 ) );
[ # # ]
96 : : }
97 : :
98 [ # # ][ # # ]: 0 : aPageNameList[ nPage ] = aStr;
99 : :
100 : : // ist dies unsere (vorhandene) erste Seite?
101 [ # # ][ # # ]: 0 : if ( rPresPage == aStr )
102 [ # # ]: 0 : aFirstPage = rPresPage;
103 [ # # ][ # # ]: 0 : else if ( pPage->IsSelected() && !aFirstPage.Len() )
[ # # ]
104 [ # # ]: 0 : aFirstPage = aStr;
105 [ # # ]: 0 : }
106 [ # # ]: 0 : SdCustomShowList* pCustomShowList = mpDoc->GetCustomShowList(); // No Create
107 : :
108 [ # # ][ # # ]: 0 : sal_Bool bStartWithActualPage = SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsStartWithActualPage();
[ # # ]
109 [ # # ][ # # ]: 0 : if( !aFirstPage.Len() && pPage )
[ # # ]
110 [ # # ][ # # ]: 0 : aFirstPage = pPage->GetName();
111 : :
112 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALL, rPresentationSettings.mbAll ) );
[ # # ]
113 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CUSTOMSHOW, rPresentationSettings.mbCustomShow ) );
[ # # ]
114 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxStringItem( ATTR_PRESENT_DIANAME, aFirstPage ) );
[ # # ]
115 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ENDLESS, rPresentationSettings.mbEndless ) );
[ # # ]
116 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MANUEL, rPresentationSettings.mbManual ) );
[ # # ]
117 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MOUSE, rPresentationSettings.mbMouseVisible ) );
[ # # ]
118 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_PEN, rPresentationSettings.mbMouseAsPen ) );
[ # # ]
119 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_NAVIGATOR, rPresentationSettings.mbStartWithNavigator ) );
[ # # ]
120 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ANIMATION_ALLOWED, rPresentationSettings.mbAnimationAllowed ) );
[ # # ]
121 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CHANGE_PAGE, !rPresentationSettings.mbLockedPages ) );
[ # # ]
122 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALWAYS_ON_TOP, rPresentationSettings.mbAlwaysOnTop ) );
[ # # ]
123 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_FULLSCREEN, rPresentationSettings.mbFullScreen ) );
[ # # ]
124 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_START_ACTUAL_PAGE, bStartWithActualPage ) );
[ # # ]
125 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxUInt32Item( ATTR_PRESENT_PAUSE_TIMEOUT, rPresentationSettings.mnPauseTimeout ) );
[ # # ]
126 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_SHOW_PAUSELOGO, rPresentationSettings.mbShowPauseLogo ) );
[ # # ]
127 : :
128 [ # # ][ # # ]: 0 : SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
129 [ # # ][ # # ]: 0 : aDlgSet.Put( SfxInt32Item( ATTR_PRESENT_DISPLAY, pOptions->GetDisplay() ) );
[ # # ][ # # ]
130 : :
131 [ # # ]: 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
132 [ # # ][ # # ]: 0 : AbstractSdStartPresDlg* pDlg = pFact ? pFact->CreateSdStartPresentationDlg(mpWindow, aDlgSet, aPageNameList, pCustomShowList) : 0;
133 [ # # ][ # # ]: 0 : if( pDlg && (pDlg->Execute() == RET_OK) )
[ # # ][ # # ]
134 : : {
135 : 0 : rtl::OUString aPage;
136 : : long nValue32;
137 : : sal_Bool bValue;
138 : 0 : bool bValuesChanged = sal_False;
139 : :
140 [ # # ]: 0 : pDlg->GetAttr( aDlgSet );
141 : :
142 [ # # ][ # # ]: 0 : aPage = ITEMVALUE( aDlgSet, ATTR_PRESENT_DIANAME, SfxStringItem );
143 [ # # ]: 0 : if( aPage != rPresentationSettings.maPresPage )
144 : : {
145 : 0 : bValuesChanged = true;
146 : 0 : rPresentationSettings.maPresPage = aPage;
147 : : }
148 : :
149 [ # # ]: 0 : bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALL, SfxBoolItem );
150 [ # # ]: 0 : if ( bValue != rPresentationSettings.mbAll )
151 : : {
152 : 0 : bValuesChanged = true;
153 : 0 : rPresentationSettings.mbAll = bValue;
154 : : }
155 : :
156 [ # # ]: 0 : bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_CUSTOMSHOW, SfxBoolItem );
157 [ # # ]: 0 : if ( bValue != rPresentationSettings.mbCustomShow )
158 : : {
159 : 0 : bValuesChanged = true;
160 : 0 : rPresentationSettings.mbCustomShow = bValue;
161 : : }
162 : :
163 [ # # ]: 0 : bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ENDLESS, SfxBoolItem );
164 [ # # ]: 0 : if ( bValue != rPresentationSettings.mbEndless )
165 : : {
166 : 0 : bValuesChanged = true;
167 : 0 : rPresentationSettings.mbEndless = bValue;
168 : : }
169 : :
170 [ # # ]: 0 : bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MANUEL, SfxBoolItem );
171 [ # # ]: 0 : if ( bValue != rPresentationSettings.mbManual )
172 : : {
173 : 0 : bValuesChanged = true;
174 : 0 : rPresentationSettings.mbManual = bValue;
175 : : }
176 : :
177 [ # # ]: 0 : bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MOUSE, SfxBoolItem );
178 [ # # ]: 0 : if ( bValue != rPresentationSettings.mbMouseVisible )
179 : : {
180 : 0 : bValuesChanged = true;
181 : 0 : rPresentationSettings.mbMouseVisible = bValue;
182 : : }
183 : :
184 [ # # ]: 0 : bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_PEN, SfxBoolItem );
185 [ # # ]: 0 : if ( bValue != rPresentationSettings.mbMouseAsPen )
186 : : {
187 : 0 : bValuesChanged = true;
188 : 0 : rPresentationSettings.mbMouseAsPen = bValue;
189 : : }
190 : :
191 [ # # ]: 0 : bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_NAVIGATOR, SfxBoolItem );
192 [ # # ]: 0 : if( bValue != rPresentationSettings.mbStartWithNavigator )
193 : : {
194 : 0 : bValuesChanged = true;
195 : 0 : rPresentationSettings.mbStartWithNavigator = bValue;
196 : : }
197 : :
198 [ # # ]: 0 : bValue = !ITEMVALUE( aDlgSet, ATTR_PRESENT_CHANGE_PAGE, SfxBoolItem );
199 [ # # ]: 0 : if ( bValue != rPresentationSettings.mbLockedPages )
200 : : {
201 : 0 : bValuesChanged = true;
202 : 0 : rPresentationSettings.mbLockedPages = bValue;
203 : : }
204 : :
205 [ # # ]: 0 : bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ANIMATION_ALLOWED, SfxBoolItem );
206 [ # # ]: 0 : if ( bValue != rPresentationSettings.mbAnimationAllowed )
207 : : {
208 : 0 : bValuesChanged = true;
209 : 0 : rPresentationSettings.mbAnimationAllowed = bValue;
210 : : }
211 : :
212 [ # # ]: 0 : bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALWAYS_ON_TOP, SfxBoolItem );
213 [ # # ]: 0 : if ( bValue != rPresentationSettings.mbAlwaysOnTop )
214 : : {
215 : 0 : bValuesChanged = true;
216 : 0 : rPresentationSettings.mbAlwaysOnTop = bValue;
217 : : }
218 : :
219 [ # # ]: 0 : bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_FULLSCREEN, SfxBoolItem );
220 [ # # ]: 0 : if ( bValue != rPresentationSettings.mbFullScreen )
221 : : {
222 : 0 : bValuesChanged = true;
223 : 0 : rPresentationSettings.mbFullScreen = bValue;
224 : : }
225 : :
226 [ # # ]: 0 : nValue32 = ITEMVALUE( aDlgSet, ATTR_PRESENT_PAUSE_TIMEOUT, SfxUInt32Item );
227 [ # # ]: 0 : if( nValue32 != rPresentationSettings.mnPauseTimeout )
228 : : {
229 : 0 : bValuesChanged = true;
230 : 0 : rPresentationSettings.mnPauseTimeout = nValue32;
231 : : }
232 : :
233 [ # # ]: 0 : bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_SHOW_PAUSELOGO, SfxBoolItem );
234 [ # # ]: 0 : if ( bValue != rPresentationSettings.mbShowPauseLogo )
235 : : {
236 : 0 : bValuesChanged = true;
237 : 0 : rPresentationSettings.mbShowPauseLogo = bValue;
238 : : }
239 : :
240 [ # # ][ # # ]: 0 : pOptions->SetDisplay( ITEMVALUE( aDlgSet, ATTR_PRESENT_DISPLAY, SfxInt32Item ) );
241 : :
242 : : // wenn sich etwas geaendert hat, setzen wir das Modified-Flag,
243 [ # # ]: 0 : if ( bValuesChanged )
244 [ # # ]: 0 : mpDoc->SetChanged( sal_True );
245 : : }
246 [ # # ][ # # ]: 0 : delete pDlg;
[ # # ][ # # ]
[ # # ][ # # ]
247 : 0 : }
248 : :
249 : : } // end of namespace sd
250 : :
251 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|