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: fusldlg.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"
35 #include "fusldlg.hxx"
36 #include <svtools/itemset.hxx>
37 #ifndef _MSGBOX_HXX //autogen
38 #include <vcl/msgbox.hxx>
41 #include "drawdoc.hxx"
43 #include "sdresid.hxx"
44 #include "strings.hrc"
48 #include "ViewShell.hxx"
50 #include "optsitem.hxx"
51 #include "sdabstdlg.hxx"
55 #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
57 TYPEINIT1( FuSlideShowDlg
, FuPoor
);
60 /*************************************************************************
64 \************************************************************************/
66 FuSlideShowDlg::FuSlideShowDlg (
72 : FuPoor( pViewSh
, pWin
, pView
, pDoc
, rReq
)
76 FunctionReference
FuSlideShowDlg::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
78 FunctionReference
xFunc( new FuSlideShowDlg( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
79 xFunc
->DoExecute(rReq
);
83 void FuSlideShowDlg::DoExecute( SfxRequest
& )
85 PresentationSettings
& rPresentationSettings
= mpDoc
->getPresentationSettings();
87 SfxItemSet
aDlgSet( mpDoc
->GetPool(), ATTR_PRESENT_START
, ATTR_PRESENT_END
);
89 const String
& rPresPage
= rPresentationSettings
.maPresPage
;
91 String
aStandardName( SdResId( STR_PAGE
) );
95 for( nPage
= mpDoc
->GetSdPageCount( PK_STANDARD
) - 1L; nPage
>= 0L; nPage
-- )
97 pPage
= mpDoc
->GetSdPage( (USHORT
) nPage
, PK_STANDARD
);
98 String
* pStr
= new String( pPage
->GetName() );
102 *pStr
= String( SdResId( STR_PAGE
) );
103 (*pStr
).Append( UniString::CreateFromInt32( nPage
+ 1 ) );
106 aPageNameList
.Insert( pStr
, (ULONG
) 0 );
108 // ist dies unsere (vorhandene) erste Seite?
109 if ( rPresPage
== *pStr
)
110 aFirstPage
= rPresPage
;
111 else if ( pPage
->IsSelected() && !aFirstPage
.Len() )
114 List
* pCustomShowList
= mpDoc
->GetCustomShowList(); // No Create
116 BOOL bStartWithActualPage
= SD_MOD()->GetSdOptions( mpDoc
->GetDocumentType() )->IsStartWithActualPage();
117 /* #109180# change in behaviour, even when always start with current page is enabled, range settings are
119 if( bStartWithActualPage )
121 aFirstPage = pViewSh->GetActualPage()->GetName();
122 pCustomShowList = NULL;
125 if( !aFirstPage
.Len() && pPage
)
126 aFirstPage
= pPage
->GetName();
128 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_ALL
, rPresentationSettings
.mbAll
) );
129 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_CUSTOMSHOW
, rPresentationSettings
.mbCustomShow
) );
130 aDlgSet
.Put( SfxStringItem( ATTR_PRESENT_DIANAME
, aFirstPage
) );
131 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_ENDLESS
, rPresentationSettings
.mbEndless
) );
132 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_MANUEL
, rPresentationSettings
.mbManual
) );
133 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_MOUSE
, rPresentationSettings
.mbMouseVisible
) );
134 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_PEN
, rPresentationSettings
.mbMouseAsPen
) );
135 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_NAVIGATOR
, rPresentationSettings
.mbStartWithNavigator
) );
136 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_ANIMATION_ALLOWED
, rPresentationSettings
.mbAnimationAllowed
) );
137 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_CHANGE_PAGE
, !rPresentationSettings
.mbLockedPages
) );
138 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_ALWAYS_ON_TOP
, rPresentationSettings
.mbAlwaysOnTop
) );
139 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_FULLSCREEN
, rPresentationSettings
.mbFullScreen
) );
140 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_START_ACTUAL_PAGE
, bStartWithActualPage
) );
141 aDlgSet
.Put( SfxUInt32Item( ATTR_PRESENT_PAUSE_TIMEOUT
, rPresentationSettings
.mnPauseTimeout
) );
142 aDlgSet
.Put( SfxBoolItem( ATTR_PRESENT_SHOW_PAUSELOGO
, rPresentationSettings
.mbShowPauseLogo
) );
144 SdOptions
* pOptions
= SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS
);
145 aDlgSet
.Put( SfxInt32Item( ATTR_PRESENT_DISPLAY
, pOptions
->GetDisplay() ) );
147 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
148 AbstractSdStartPresDlg
* pDlg
= pFact
? pFact
->CreateSdStartPresentationDlg(mpWindow
, aDlgSet
, aPageNameList
, pCustomShowList
) : 0;
149 if( pDlg
&& (pDlg
->Execute() == RET_OK
) )
154 bool bValuesChanged
= FALSE
;
156 pDlg
->GetAttr( aDlgSet
);
158 aPage
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_DIANAME
, SfxStringItem
);
159 if( aPage
!= rPresentationSettings
.maPresPage
)
161 bValuesChanged
= true;
162 rPresentationSettings
.maPresPage
= aPage
;
165 bValue
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_ALL
, SfxBoolItem
);
166 if ( bValue
!= rPresentationSettings
.mbAll
)
168 bValuesChanged
= true;
169 rPresentationSettings
.mbAll
= bValue
;
172 bValue
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_CUSTOMSHOW
, SfxBoolItem
);
173 if ( bValue
!= rPresentationSettings
.mbCustomShow
)
175 bValuesChanged
= true;
176 rPresentationSettings
.mbCustomShow
= bValue
;
179 bValue
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_ENDLESS
, SfxBoolItem
);
180 if ( bValue
!= rPresentationSettings
.mbEndless
)
182 bValuesChanged
= true;
183 rPresentationSettings
.mbEndless
= bValue
;
186 bValue
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_MANUEL
, SfxBoolItem
);
187 if ( bValue
!= rPresentationSettings
.mbManual
)
189 bValuesChanged
= true;
190 rPresentationSettings
.mbManual
= bValue
;
193 bValue
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_MOUSE
, SfxBoolItem
);
194 if ( bValue
!= rPresentationSettings
.mbMouseVisible
)
196 bValuesChanged
= true;
197 rPresentationSettings
.mbMouseVisible
= bValue
;
200 bValue
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_PEN
, SfxBoolItem
);
201 if ( bValue
!= rPresentationSettings
.mbMouseAsPen
)
203 bValuesChanged
= true;
204 rPresentationSettings
.mbMouseAsPen
= bValue
;
207 bValue
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_NAVIGATOR
, SfxBoolItem
);
208 if( bValue
!= rPresentationSettings
.mbStartWithNavigator
)
210 bValuesChanged
= true;
211 rPresentationSettings
.mbStartWithNavigator
= bValue
;
214 bValue
= !ITEMVALUE( aDlgSet
, ATTR_PRESENT_CHANGE_PAGE
, SfxBoolItem
);
215 if ( bValue
!= rPresentationSettings
.mbLockedPages
)
217 bValuesChanged
= true;
218 rPresentationSettings
.mbLockedPages
= bValue
;
221 bValue
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_ANIMATION_ALLOWED
, SfxBoolItem
);
222 if ( bValue
!= rPresentationSettings
.mbAnimationAllowed
)
224 bValuesChanged
= true;
225 rPresentationSettings
.mbAnimationAllowed
= bValue
;
228 bValue
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_ALWAYS_ON_TOP
, SfxBoolItem
);
229 if ( bValue
!= rPresentationSettings
.mbAlwaysOnTop
)
231 bValuesChanged
= true;
232 rPresentationSettings
.mbAlwaysOnTop
= bValue
;
235 bValue
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_FULLSCREEN
, SfxBoolItem
);
236 if ( bValue
!= rPresentationSettings
.mbFullScreen
)
238 bValuesChanged
= true;
239 rPresentationSettings
.mbFullScreen
= bValue
;
242 nValue32
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_PAUSE_TIMEOUT
, SfxUInt32Item
);
243 if( nValue32
!= rPresentationSettings
.mnPauseTimeout
)
245 bValuesChanged
= true;
246 rPresentationSettings
.mnPauseTimeout
= nValue32
;
249 bValue
= ITEMVALUE( aDlgSet
, ATTR_PRESENT_SHOW_PAUSELOGO
, SfxBoolItem
);
250 if ( bValue
!= rPresentationSettings
.mbShowPauseLogo
)
252 bValuesChanged
= true;
253 rPresentationSettings
.mbShowPauseLogo
= bValue
;
256 pOptions
->SetDisplay( ITEMVALUE( aDlgSet
, ATTR_PRESENT_DISPLAY
, SfxInt32Item
) );
258 // wenn sich etwas geaendert hat, setzen wir das Modified-Flag,
259 if ( bValuesChanged
)
260 mpDoc
->SetChanged( TRUE
);
263 // Strings aus Liste loeschen
264 for( void* pStr
= aPageNameList
.First(); pStr
; pStr
= aPageNameList
.Next() )
265 delete (String
*) pStr
;
268 } // end of namespace sd