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

279 lines
10 KiB
C++
Raw Normal View History

2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* $RCSfile: fusldlg.cxx,v $
2000-09-18 16:07:07 +00:00
*
* $Revision: 1.7 $
2000-09-18 16:07:07 +00:00
*
* last change: $Author: rt $ $Date: 2005-12-14 17:03:31 $
2000-09-18 16:07:07 +00:00
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
2000-09-18 16:07:07 +00:00
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
2000-09-18 16:07:07 +00:00
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
2000-09-18 16:07:07 +00:00
*
* This library 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 for more details.
2000-09-18 16:07:07 +00:00
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
2000-09-18 16:07:07 +00:00
*
************************************************************************/
#pragma hdrstop
#include "fusldlg.hxx"
2000-09-18 16:07:07 +00:00
#ifndef _SFXITEMSET_HXX //autogen
#include <svtools/itemset.hxx>
#endif
#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
#endif
#include "drawdoc.hxx"
#include "sdpage.hxx"
//CHINA001 #include "present.hxx"
2000-09-18 16:07:07 +00:00
#include "sdresid.hxx"
#include "strings.hrc"
#include "sdattr.hxx"
#include "glob.hrc"
#include "sdmod.hxx"
#ifndef SD_VIEW_SHELL_HXX
#include "ViewShell.hxx"
#endif
#ifndef SD_WINDOW_HXX
#include "Window.hxx"
#endif
2000-09-18 16:07:07 +00:00
#include "optsitem.hxx"
#include "sdabstdlg.hxx" //CHINA001
#include "present.hrc" //CHINA001
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& rReq )
2000-09-18 16:07:07 +00:00
{
PresentationSettings& rPresentationSettings = pDoc->getPresentationSettings();
2000-09-18 16:07:07 +00:00
SfxItemSet aDlgSet( pDoc->GetPool(), ATTR_PRESENT_START, ATTR_PRESENT_END );
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 = pDoc->GetSdPageCount( PK_STANDARD ) - 1L; nPage >= 0L; nPage-- )
{
pPage = pDoc->GetSdPage( (USHORT) nPage, PK_STANDARD );
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 = pDoc->GetCustomShowList(); // No Create
BOOL bStartWithActualPage = SD_MOD()->GetSdOptions( pDoc->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
//CHINA001 SdStartPresentationDlg aDlg (pWindow, aDlgSet, aPageNameList, pCustomShowList );
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();//CHINA001
DBG_ASSERT(pFact, "SdAbstractDialogFactory fail!");//CHINA001
AbstractSdStartPresDlg* pDlg = pFact->CreateSdStartPresentationDlg(ResId( DLG_START_PRESENTATION ), pWindow, aDlgSet, aPageNameList, pCustomShowList );
DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
if( pDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.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 ); //CHINA001 aDlg.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
}
// wenn sich etwas geaendert hat, setzen wir das Modified-Flag,
if ( bValuesChanged )
pDoc->SetChanged( TRUE );
}
delete pDlg; //add by CHINA001
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