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