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