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

254 lines
9.3 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
*
************************************************************************/
2000-09-18 16:07:07 +00:00
#include "fusldlg.hxx"
#include <svl/itemset.hxx>
2000-09-18 16:07:07 +00:00
#include <vcl/msgbox.hxx>
#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 );
2011-06-12 17:50:47 -04:30
std::vector<String> aPageNameList(mpDoc->GetSdPageCount( PK_STANDARD ));
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( (sal_uInt16) nPage, PK_STANDARD );
2011-06-12 17:50:47 -04:30
String aStr( pPage->GetName() );
2000-09-18 16:07:07 +00:00
2011-06-12 17:50:47 -04:30
if ( !aStr.Len() )
2000-09-18 16:07:07 +00:00
{
2011-06-12 17:50:47 -04:30
aStr = String( SdResId( STR_PAGE ) );
aStr.Append( UniString::CreateFromInt32( nPage + 1 ) );
2000-09-18 16:07:07 +00:00
}
2011-06-12 17:50:47 -04:30
aPageNameList[ nPage ] = aStr;
2000-09-18 16:07:07 +00:00
// ist dies unsere (vorhandene) erste Seite?
2011-06-12 17:50:47 -04:30
if ( rPresPage == aStr )
2000-09-18 16:07:07 +00:00
aFirstPage = rPresPage;
else if ( pPage->IsSelected() && !aFirstPage.Len() )
2011-06-12 17:50:47 -04:30
aFirstPage = aStr;
2000-09-18 16:07:07 +00:00
}
List* pCustomShowList = mpDoc->GetCustomShowList(); // No Create
2000-09-18 16:07:07 +00:00
sal_Bool bStartWithActualPage = SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsStartWithActualPage();
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 = sal_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( sal_True );
2000-09-18 16:07:07 +00:00
}
delete pDlg;
2000-09-18 16:07:07 +00:00
}
} // end of namespace sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */