Files
libreoffice/sd/source/ui/func/fusldlg.cxx

266 lines
9.7 KiB
C++
Raw Normal View History

2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 16:07:07 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 16:07:07 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 16:07:07 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sd.hxx"
2000-09-18 16:07:07 +00:00
#include "fusldlg.hxx"
#include <svl/itemset.hxx>
2000-09-18 16:07:07 +00:00
#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
#endif
#include "drawdoc.hxx"
#include "sdpage.hxx"
#include "sdresid.hxx"
#include "strings.hrc"
#include "sdattr.hxx"
#include "glob.hrc"
#include "sdmod.hxx"
#include "ViewShell.hxx"
#include "Window.hxx"
2000-09-18 16:07:07 +00:00
#include "optsitem.hxx"
#include "sdabstdlg.hxx"
2000-09-18 16:07:07 +00:00
namespace sd {
2000-09-18 16:07:07 +00:00
#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
TYPEINIT1( FuSlideShowDlg, FuPoor );
/*************************************************************************
|*
|* Konstruktor
|*
\************************************************************************/
FuSlideShowDlg::FuSlideShowDlg (
ViewShell* pViewSh,
::sd::Window* pWin,
::sd::View* pView,
SdDrawDocument* pDoc,
SfxRequest& rReq)
: FuPoor( pViewSh, pWin, pView, pDoc, rReq )
{
}
FunctionReference FuSlideShowDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
{
FunctionReference xFunc( new FuSlideShowDlg( pViewSh, pWin, pView, pDoc, rReq ) );
xFunc->DoExecute(rReq);
return xFunc;
}
void FuSlideShowDlg::DoExecute( SfxRequest& )
2000-09-18 16:07:07 +00:00
{
PresentationSettings& rPresentationSettings = mpDoc->getPresentationSettings();
SfxItemSet aDlgSet( mpDoc->GetPool(), ATTR_PRESENT_START, ATTR_PRESENT_END );
2000-09-18 16:07:07 +00:00
List aPageNameList;
const String& rPresPage = rPresentationSettings.maPresPage;
2000-09-18 16:07:07 +00:00
String aFirstPage;
String aStandardName( SdResId( STR_PAGE ) );
SdPage* pPage = NULL;
long nPage;
for( nPage = mpDoc->GetSdPageCount( PK_STANDARD ) - 1L; nPage >= 0L; nPage-- )
2000-09-18 16:07:07 +00:00
{
pPage = mpDoc->GetSdPage( (USHORT) nPage, PK_STANDARD );
2000-09-18 16:07:07 +00:00
String* pStr = new String( pPage->GetName() );
if ( !pStr->Len() )
{
*pStr = String( SdResId( STR_PAGE ) );
(*pStr).Append( UniString::CreateFromInt32( nPage + 1 ) );
}
aPageNameList.Insert( pStr, (ULONG) 0 );
// ist dies unsere (vorhandene) erste Seite?
if ( rPresPage == *pStr )
aFirstPage = rPresPage;
else if ( pPage->IsSelected() && !aFirstPage.Len() )
aFirstPage = *pStr;
}
List* pCustomShowList = mpDoc->GetCustomShowList(); // No Create
2000-09-18 16:07:07 +00:00
BOOL bStartWithActualPage = SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsStartWithActualPage();
/* #109180# change in behaviour, even when always start with current page is enabled, range settings are
still used
2000-09-18 16:07:07 +00:00
if( bStartWithActualPage )
{
aFirstPage = pViewSh->GetActualPage()->GetName();
pCustomShowList = NULL;
}
*/
2000-09-18 16:07:07 +00:00
if( !aFirstPage.Len() && pPage )
aFirstPage = pPage->GetName();
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALL, rPresentationSettings.mbAll ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CUSTOMSHOW, rPresentationSettings.mbCustomShow ) );
2000-09-18 16:07:07 +00:00
aDlgSet.Put( SfxStringItem( ATTR_PRESENT_DIANAME, aFirstPage ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ENDLESS, rPresentationSettings.mbEndless ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MANUEL, rPresentationSettings.mbManual ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MOUSE, rPresentationSettings.mbMouseVisible ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_PEN, rPresentationSettings.mbMouseAsPen ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_NAVIGATOR, rPresentationSettings.mbStartWithNavigator ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ANIMATION_ALLOWED, rPresentationSettings.mbAnimationAllowed ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CHANGE_PAGE, !rPresentationSettings.mbLockedPages ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALWAYS_ON_TOP, rPresentationSettings.mbAlwaysOnTop ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_FULLSCREEN, rPresentationSettings.mbFullScreen ) );
2000-09-18 16:07:07 +00:00
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_START_ACTUAL_PAGE, bStartWithActualPage ) );
aDlgSet.Put( SfxUInt32Item( ATTR_PRESENT_PAUSE_TIMEOUT, rPresentationSettings.mnPauseTimeout ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_SHOW_PAUSELOGO, rPresentationSettings.mbShowPauseLogo ) );
2000-09-18 16:07:07 +00:00
SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
aDlgSet.Put( SfxInt32Item( ATTR_PRESENT_DISPLAY, pOptions->GetDisplay() ) );
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
AbstractSdStartPresDlg* pDlg = pFact ? pFact->CreateSdStartPresentationDlg(mpWindow, aDlgSet, aPageNameList, pCustomShowList ) : 0;
if( pDlg && (pDlg->Execute() == RET_OK) )
2000-09-18 16:07:07 +00:00
{
rtl::OUString aPage;
long nValue32;
sal_Bool bValue;
bool bValuesChanged = FALSE;
2000-09-18 16:07:07 +00:00
pDlg->GetAttr( aDlgSet );
2000-09-18 16:07:07 +00:00
aPage = ITEMVALUE( aDlgSet, ATTR_PRESENT_DIANAME, SfxStringItem );
if( aPage != rPresentationSettings.maPresPage )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.maPresPage = aPage;
2000-09-18 16:07:07 +00:00
}
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALL, SfxBoolItem );
if ( bValue != rPresentationSettings.mbAll )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbAll = bValue;
2000-09-18 16:07:07 +00:00
}
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_CUSTOMSHOW, SfxBoolItem );
if ( bValue != rPresentationSettings.mbCustomShow )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbCustomShow = bValue;
2000-09-18 16:07:07 +00:00
}
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ENDLESS, SfxBoolItem );
if ( bValue != rPresentationSettings.mbEndless )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbEndless = bValue;
2000-09-18 16:07:07 +00:00
}
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MANUEL, SfxBoolItem );
if ( bValue != rPresentationSettings.mbManual )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbManual = bValue;
2000-09-18 16:07:07 +00:00
}
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MOUSE, SfxBoolItem );
if ( bValue != rPresentationSettings.mbMouseVisible )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbMouseVisible = bValue;
2000-09-18 16:07:07 +00:00
}
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_PEN, SfxBoolItem );
if ( bValue != rPresentationSettings.mbMouseAsPen )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbMouseAsPen = bValue;
2000-09-18 16:07:07 +00:00
}
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_NAVIGATOR, SfxBoolItem );
if( bValue != rPresentationSettings.mbStartWithNavigator )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbStartWithNavigator = bValue;
2000-09-18 16:07:07 +00:00
}
bValue = !ITEMVALUE( aDlgSet, ATTR_PRESENT_CHANGE_PAGE, SfxBoolItem );
if ( bValue != rPresentationSettings.mbLockedPages )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbLockedPages = bValue;
2000-09-18 16:07:07 +00:00
}
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ANIMATION_ALLOWED, SfxBoolItem );
if ( bValue != rPresentationSettings.mbAnimationAllowed )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbAnimationAllowed = bValue;
2000-09-18 16:07:07 +00:00
}
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALWAYS_ON_TOP, SfxBoolItem );
if ( bValue != rPresentationSettings.mbAlwaysOnTop )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbAlwaysOnTop = bValue;
2000-09-18 16:07:07 +00:00
}
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_FULLSCREEN, SfxBoolItem );
if ( bValue != rPresentationSettings.mbFullScreen )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbFullScreen = bValue;
2000-09-18 16:07:07 +00:00
}
nValue32 = ITEMVALUE( aDlgSet, ATTR_PRESENT_PAUSE_TIMEOUT, SfxUInt32Item );
if( nValue32 != rPresentationSettings.mnPauseTimeout )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mnPauseTimeout = nValue32;
2000-09-18 16:07:07 +00:00
}
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_SHOW_PAUSELOGO, SfxBoolItem );
if ( bValue != rPresentationSettings.mbShowPauseLogo )
2000-09-18 16:07:07 +00:00
{
bValuesChanged = true;
rPresentationSettings.mbShowPauseLogo = bValue;
2000-09-18 16:07:07 +00:00
}
pOptions->SetDisplay( ITEMVALUE( aDlgSet, ATTR_PRESENT_DISPLAY, SfxInt32Item ) );
2000-09-18 16:07:07 +00:00
// wenn sich etwas geaendert hat, setzen wir das Modified-Flag,
if ( bValuesChanged )
mpDoc->SetChanged( TRUE );
2000-09-18 16:07:07 +00:00
}
delete pDlg;
2000-09-18 16:07:07 +00:00
// Strings aus Liste loeschen
for( void* pStr = aPageNameList.First(); pStr; pStr = aPageNameList.Next() )
delete (String*) pStr;
}
} // end of namespace sd