LibreOffice Module sd (master) 1
fusldlg.cxx
Go to the documentation of this file.
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 <fusldlg.hxx>
21#include <svl/eitem.hxx>
22#include <svl/itemset.hxx>
23#include <svl/stritem.hxx>
24#include <svl/intitem.hxx>
25
26#include <drawdoc.hxx>
27#include <sdpage.hxx>
28#include <sdresid.hxx>
29#include <strings.hrc>
30#include <sdattr.hrc>
31#include <sdmod.hxx>
32#include <Window.hxx>
33#include <optsitem.hxx>
34#include <sdabstdlg.hxx>
35
36namespace sd {
37
38#define ITEMVALUE(ItemSet,Id,Cast) static_cast<const Cast&>((ItemSet).Get(Id)).GetValue()
39
40
42 ViewShell* pViewSh,
43 ::sd::Window* pWin,
44 ::sd::View* pView,
45 SdDrawDocument* pDoc,
46 SfxRequest& rReq)
47 : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
48{
49}
50
52{
53 rtl::Reference<FuPoor> xFunc( new FuSlideShowDlg( pViewSh, pWin, pView, pDoc, rReq ) );
54 xFunc->DoExecute(rReq);
55 return xFunc;
56}
57
59{
60 PresentationSettings& rPresentationSettings = mpDoc->getPresentationSettings();
61
63 std::vector<OUString> aPageNameList(mpDoc->GetSdPageCount( PageKind::Standard ));
64 const OUString& rPresPage = rPresentationSettings.maPresPage;
65 OUString aFirstPage;
66 SdPage* pPage = nullptr;
67 ::tools::Long nPage;
68
69 for( nPage = mpDoc->GetSdPageCount( PageKind::Standard ) - 1; nPage >= 0; nPage-- )
70 {
71 pPage = mpDoc->GetSdPage( static_cast<sal_uInt16>(nPage), PageKind::Standard );
72 OUString aStr( pPage->GetName() );
73
74 if ( aStr.isEmpty() )
75 {
76 aStr = SdResId( STR_PAGE ) + OUString::number( nPage + 1 );
77 }
78
79 aPageNameList[ nPage ] = aStr;
80
81 // is this our (existing) first page?
82 if ( rPresPage == aStr )
83 aFirstPage = rPresPage;
84 else if ( pPage->IsSelected() && aFirstPage.isEmpty() )
85 aFirstPage = aStr;
86 }
87 SdCustomShowList* pCustomShowList = mpDoc->GetCustomShowList(); // No Create
88
89 if( aFirstPage.isEmpty() && pPage )
90 aFirstPage = pPage->GetName();
91
92 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALL, rPresentationSettings.mbAll ) );
93 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CUSTOMSHOW, rPresentationSettings.mbCustomShow ) );
94 aDlgSet.Put( SfxStringItem( ATTR_PRESENT_DIANAME, aFirstPage ) );
95 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ENDLESS, rPresentationSettings.mbEndless ) );
96 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MANUEL, rPresentationSettings.mbManual ) );
97 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MOUSE, rPresentationSettings.mbMouseVisible ) );
98 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_PEN, rPresentationSettings.mbMouseAsPen ) );
99 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ANIMATION_ALLOWED, rPresentationSettings.mbAnimationAllowed ) );
100 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CHANGE_PAGE, !rPresentationSettings.mbLockedPages ) );
101 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALWAYS_ON_TOP, rPresentationSettings.mbAlwaysOnTop ) );
102 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS, rPresentationSettings.mbUseNavigation ) );
103 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_FULLSCREEN, rPresentationSettings.mbFullScreen ) );
104 aDlgSet.Put( SfxUInt32Item( ATTR_PRESENT_PAUSE_TIMEOUT, rPresentationSettings.mnPauseTimeout ) );
105 aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_SHOW_PAUSELOGO, rPresentationSettings.mbShowPauseLogo ) );
106
107 SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress);
108 aDlgSet.Put( SfxInt32Item( ATTR_PRESENT_DISPLAY, pOptions->GetDisplay() ) );
109
111 ScopedVclPtr<AbstractSdStartPresDlg> pDlg( pFact->CreateSdStartPresentationDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr, aDlgSet, aPageNameList, pCustomShowList) );
112 if( pDlg->Execute() != RET_OK )
113 return;
114
115 ::tools::Long nValue32;
116 bool bValue;
117 bool bValuesChanged = false;
118
119 pDlg->GetAttr( aDlgSet );
120
121 bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALL, SfxBoolItem );
122 if ( bValue != rPresentationSettings.mbAll )
123 {
124 bValuesChanged = true;
125 rPresentationSettings.mbAll = bValue;
126 // remove any previous existing slide
127 rPresentationSettings.maPresPage.clear();
128 }
129
130 if (!rPresentationSettings.mbAll)
131 {
132 OUString aPage = aDlgSet.Get(ATTR_PRESENT_DIANAME).GetValue();
133 if( aPage != rPresentationSettings.maPresPage )
134 {
135 bValuesChanged = true;
136 rPresentationSettings.maPresPage = aPage;
137 }
138 }
139
140 bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_CUSTOMSHOW, SfxBoolItem );
141 if ( bValue != rPresentationSettings.mbCustomShow )
142 {
143 bValuesChanged = true;
144 rPresentationSettings.mbCustomShow = bValue;
145 rPresentationSettings.mbStartCustomShow = false;
146 }
147
148 bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ENDLESS, SfxBoolItem );
149 if ( bValue != rPresentationSettings.mbEndless )
150 {
151 bValuesChanged = true;
152 rPresentationSettings.mbEndless = bValue;
153 }
154
155 bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MANUEL, SfxBoolItem );
156 if ( bValue != rPresentationSettings.mbManual )
157 {
158 bValuesChanged = true;
159 rPresentationSettings.mbManual = bValue;
160 }
161
162 bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MOUSE, SfxBoolItem );
163 if ( bValue != rPresentationSettings.mbMouseVisible )
164 {
165 bValuesChanged = true;
166 rPresentationSettings.mbMouseVisible = bValue;
167 }
168
169 bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_PEN, SfxBoolItem );
170 if ( bValue != rPresentationSettings.mbMouseAsPen )
171 {
172 bValuesChanged = true;
173 rPresentationSettings.mbMouseAsPen = bValue;
174 }
175
176 bValue = !ITEMVALUE( aDlgSet, ATTR_PRESENT_CHANGE_PAGE, SfxBoolItem );
177 if ( bValue != rPresentationSettings.mbLockedPages )
178 {
179 bValuesChanged = true;
180 rPresentationSettings.mbLockedPages = bValue;
181 }
182
183 bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ANIMATION_ALLOWED, SfxBoolItem );
184 if ( bValue != rPresentationSettings.mbAnimationAllowed )
185 {
186 bValuesChanged = true;
187 rPresentationSettings.mbAnimationAllowed = bValue;
188 }
189
190 bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALWAYS_ON_TOP, SfxBoolItem );
191 if ( bValue != rPresentationSettings.mbAlwaysOnTop )
192 {
193 bValuesChanged = true;
194 rPresentationSettings.mbAlwaysOnTop = bValue;
195 }
196
197 bValue = ITEMVALUE(aDlgSet, ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS, SfxBoolItem);
198 if (bValue != rPresentationSettings.mbUseNavigation)
199 {
200 bValuesChanged = true;
201 rPresentationSettings.mbUseNavigation = bValue;
202 }
203
204 bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_FULLSCREEN, SfxBoolItem );
205 if ( bValue != rPresentationSettings.mbFullScreen )
206 {
207 bValuesChanged = true;
208 rPresentationSettings.mbFullScreen = bValue;
209 }
210
211 nValue32 = aDlgSet.Get(ATTR_PRESENT_PAUSE_TIMEOUT).GetValue();
212 if( nValue32 != rPresentationSettings.mnPauseTimeout )
213 {
214 bValuesChanged = true;
215 rPresentationSettings.mnPauseTimeout = nValue32;
216 }
217
218 bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_SHOW_PAUSELOGO, SfxBoolItem );
219 if ( bValue != rPresentationSettings.mbShowPauseLogo )
220 {
221 bValuesChanged = true;
222 rPresentationSettings.mbShowPauseLogo = bValue;
223 }
224
225 pOptions->SetDisplay( aDlgSet.Get(ATTR_PRESENT_DISPLAY).GetValue() );
226
227 // is something has changed, we set the modified flag
228 if ( bValuesChanged )
229 mpDoc->SetChanged();
230}
231
232} // end of namespace sd
233
234/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static SD_DLLPUBLIC SdAbstractDialogFactory * Create()
Definition: sdabstdlg.cxx:38
virtual VclPtr< AbstractSdStartPresDlg > CreateSdStartPresentationDlg(weld::Window *pWindow, const SfxItemSet &rInAttrs, const std::vector< OUString > &rPageNames, SdCustomShowList *pCSList)=0
SAL_DLLPRIVATE const sd::PresentationSettings & getPresentationSettings() const
Definition: drawdoc.hxx:400
SAL_DLLPRIVATE SfxItemPool & GetPool()
Definition: drawdoc.hxx:237
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
Definition: drawdoc2.cxx:207
SdCustomShowList * GetCustomShowList(bool bCreate=false)
Definition: drawdoc3.cxx:1161
virtual SAL_DLLPRIVATE void SetChanged(bool bFlag=true) override
Definition: drawdoc.cxx:658
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
Definition: drawdoc2.cxx:212
void SetDisplay(sal_Int32 nDisplay)
Definition: optsitem.cxx:1433
sal_Int32 GetDisplay() const
Definition: optsitem.cxx:1427
bool IsSelected() const
Definition: sdpage.hxx:208
const OUString & GetName() const
Definition: sdpage.cxx:2505
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
Base class for all functions.
Definition: fupoor.hxx:48
SdDrawDocument * mpDoc
Definition: fupoor.hxx:148
VclPtr< ::sd::Window > mpWindow
Definition: fupoor.hxx:146
static rtl::Reference< FuPoor > Create(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: fusldlg.cxx:51
FuSlideShowDlg(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: fusldlg.cxx:41
virtual void DoExecute(SfxRequest &rReq) override
Definition: fusldlg.cxx:58
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
#define ITEMVALUE(ItemSet, Id, Cast)
Definition: fusldlg.cxx:38
aStr
long Long
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
#define SD_MOD()
Definition: sdmod.hxx:184
RET_OK