diff options
Diffstat (limited to 'sd/source/ui/dlg')
81 files changed, 24192 insertions, 0 deletions
diff --git a/sd/source/ui/dlg/AnimationChildWindow.cxx b/sd/source/ui/dlg/AnimationChildWindow.cxx new file mode 100644 index 000000000000..17463d901f61 --- /dev/null +++ b/sd/source/ui/dlg/AnimationChildWindow.cxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "AnimationChildWindow.hxx" + +#include "app.hrc" +#include "animobjs.hxx" +#include "animobjs.hrc" +#include <sfx2/app.hxx> +#include <sfx2/childwin.hxx> +#include <sfx2/dockwin.hxx> + +namespace sd { + +SFX_IMPL_DOCKINGWINDOW(AnimationChildWindow, SID_ANIMATION_OBJECTS) + +/************************************************************************* +|* +|* Ableitung vom SfxChildWindow als "Behaelter" fuer Animator +|* +\************************************************************************/ + +AnimationChildWindow::AnimationChildWindow( + ::Window* _pParent, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo ) + : SfxChildWindow( _pParent, nId ) +{ + AnimationWindow* pAnimWin = new AnimationWindow( + pBindings, this, _pParent, SdResId( FLT_WIN_ANIMATION ) ); + pWindow = pAnimWin; + + eChildAlignment = SFX_ALIGN_NOALIGNMENT; + + pAnimWin->Initialize( pInfo ); + /* + if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 ) + { + pWindow->SetPosSizePixel( pInfo->aPos, pInfo->aSize ); + } + else + pWindow->SetPosPixel(SFX_APPWINDOW->OutputToScreenPixel( + SFX_APPWINDOW->GetClientAreaPixel().TopLeft())); + + if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN ) + pAnimWin->ZoomIn(); + + pAnimWin->aFltWinSize = pWindow->GetSizePixel(); + */ + SetHideNotDelete( sal_True ); +} + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/LayerDialog.src b/sd/source/ui/dlg/LayerDialog.src new file mode 100644 index 000000000000..9d620d8e595f --- /dev/null +++ b/sd/source/ui/dlg/LayerDialog.src @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "app.hrc" +#include "res_bmp.hrc" +#include "helpids.h" +#include "LayerDialog.hrc" + +#define WIDTH 150 +#define TAB_BAR_HEIGHT 17 + +DockingWindow FLT_WIN_LAYER_DIALOG +{ + HelpID = HID_SD_TABBAR_LAYERS; + Border = TRUE ; + Hide = TRUE ; + SVLook = TRUE ; + Sizeable = TRUE ; + Moveable = TRUE ; + Closeable = TRUE ; + Zoomable = TRUE ; + Dockable = TRUE ; + EnableResizing = TRUE ; + Size = MAP_APPFONT ( WIDTH , TAB_BAR_HEIGHT ) ; + Window TB_LAYERS + { + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( WIDTH-2*6, TAB_BAR_HEIGHT ); + HelpId = HID_SD_TABBAR_LAYERS; + BORDER = TRUE; + SvLook = TRUE; + // Scroll = TRUE ; + // SIZEABLE = TRUE; + }; +}; diff --git a/sd/source/ui/dlg/LayerDialogChildWindow.cxx b/sd/source/ui/dlg/LayerDialogChildWindow.cxx new file mode 100644 index 000000000000..a20d7aba1906 --- /dev/null +++ b/sd/source/ui/dlg/LayerDialogChildWindow.cxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "LayerDialogChildWindow.hxx" +#include <sfx2/dockwin.hxx> +#include "app.hrc" +#include <sfx2/app.hxx> + +// Instantiate the implementation of the docking window before files +// are included that define ::sd::Window. The ... macros are not really +// namespace proof. +namespace sd { +SFX_IMPL_DOCKINGWINDOW(LayerDialogChildWindow, SID_LAYER_DIALOG_WIN) +} + +#include "LayerDialog.hrc" +#include "LayerDialogContent.hxx" + + +#include "ViewShellBase.hxx" +#include "DrawViewShell.hxx" +#include <sfx2/dispatch.hxx> + +namespace sd { + + +LayerDialogChildWindow::LayerDialogChildWindow ( + ::Window* _pParent, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo) + : SfxChildWindow (_pParent, nId) +{ + ViewShellBase& rBase (*ViewShellBase::GetViewShellBase( + pBindings->GetDispatcher()->GetFrame())); + LayerDialogContent* pContent = new LayerDialogContent ( + pBindings, + this, + _pParent, + SdResId( FLT_WIN_LAYER_DIALOG), + rBase); + pWindow = pContent; + + eChildAlignment = SFX_ALIGN_NOALIGNMENT; + + pContent->Initialize(pInfo); +} + + + +LayerDialogChildWindow::~LayerDialogChildWindow (void) +{ +} + + + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/LayerDialogContent.cxx b/sd/source/ui/dlg/LayerDialogContent.cxx new file mode 100644 index 000000000000..ca2970b3ec10 --- /dev/null +++ b/sd/source/ui/dlg/LayerDialogContent.cxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "LayerDialogContent.hxx" +#include <com/sun/star/presentation/AnimationEffect.hpp> +#include <com/sun/star/presentation/AnimationSpeed.hpp> + +#include <svx/gallery.hxx> +#include <editeng/colritem.hxx> +#include <sfx2/dispatch.hxx> +#include <svl/aeitem.hxx> +#include <vcl/msgbox.hxx> + +#include "sdattr.hxx" + +#include "LayerDialog.hrc" +#include "app.hrc" +#include "strings.hrc" +#include "res_bmp.hrc" +#include "sdresid.hxx" +#include "View.hxx" +#include "drawdoc.hxx" +#include "ViewShellBase.hxx" +#include "DrawViewShell.hxx" +#include "framework/FrameworkHelper.hxx" + +using namespace ::com::sun::star; + +namespace sd { + + + +LayerDialogContent::LayerDialogContent ( + SfxBindings* pInBindings, + SfxChildWindow *pCW, + Window* pParent, + const SdResId& rSdResId, + ViewShellBase& rBase) + : SfxDockingWindow (pInBindings, pCW, pParent, rSdResId), + maLayerTabBar( + dynamic_cast<DrawViewShell*>( + framework::FrameworkHelper::Instance(rBase)->GetViewShell( + framework::FrameworkHelper::msCenterPaneURL).get()), + this, + SdResId(TB_LAYERS)) +{ + FreeResource(); + + maLayerTabBar.Show(); +} + + + + +LayerDialogContent::~LayerDialogContent (void) +{ +} + + + + +sal_Bool LayerDialogContent::Close (void) +{ + return SfxDockingWindow::Close(); +} + + + + +void LayerDialogContent::Resize (void) +{ + maLayerTabBar.SetPosSizePixel ( + Point(0,0), + Size(GetSizePixel().Width(), 17)); + SfxDockingWindow::Resize(); +} + + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx new file mode 100644 index 000000000000..374d42a1a683 --- /dev/null +++ b/sd/source/ui/dlg/LayerTabBar.cxx @@ -0,0 +1,353 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "LayerTabBar.hxx" +#include <svx/svdlayer.hxx> +#include <svx/svdpagv.hxx> +#include <vcl/msgbox.hxx> +#include <sfx2/dispatch.hxx> + + +#include "sdattr.hxx" +#include "app.hxx" +#include "helpids.h" +#include "app.hrc" +#include "glob.hrc" +#include "strings.hrc" +#include "res_bmp.hrc" +#include "DrawViewShell.hxx" +#include "Window.hxx" +#include "View.hxx" +#include "drawdoc.hxx" +#include "sdresid.hxx" +#include "DrawDocShell.hxx" +#include "drawview.hxx" +#include "undolayer.hxx" + + +namespace sd { + +#define SWITCH_TIMEOUT 20 + + +/************************************************************************* +|* +|* Standard-Konstruktor +|* +\************************************************************************/ + +LayerTabBar::LayerTabBar(DrawViewShell* pViewSh, Window* pParent) + : TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_SIZEABLE ) ), + DropTargetHelper( this ), + pDrViewSh(pViewSh) +{ + EnableEditMode(); + SetSizePixel(Size(0, 0)); + SetMaxPageWidth( 150 ); + SetHelpId( HID_SD_TABBAR_LAYERS ); +} + + +LayerTabBar::LayerTabBar ( + DrawViewShell* pViewSh, + Window* pParent, + const ResId& rResId) + : TabBar (pParent, rResId.GetWinBits()), + DropTargetHelper( this ), + pDrViewSh(pViewSh) +{ + EnableEditMode(); +} + +/************************************************************************* +|* +|* Destruktor +|* +\************************************************************************/ + +LayerTabBar::~LayerTabBar() +{ +} + +void LayerTabBar::Select() +{ + SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher(); + pDispatcher->Execute(SID_SWITCHLAYER, SFX_CALLMODE_ASYNCHRON); +} + +void LayerTabBar::MouseButtonDown(const MouseEvent& rMEvt) +{ + sal_Bool bSetPageID=sal_False; + + if (rMEvt.IsLeft() && !rMEvt.IsMod1() && !rMEvt.IsMod2()) + { + Point aPosPixel = rMEvt.GetPosPixel(); + sal_uInt16 aLayerId = GetPageId( PixelToLogic(aPosPixel) ); + + if (aLayerId == 0) + { + SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher(); + pDispatcher->Execute(SID_INSERTLAYER, SFX_CALLMODE_SYNCHRON); + + bSetPageID=sal_True; + } + else if (rMEvt.IsShift()) + { + // Toggle zw. Layer sichtbar / unsichtbar + String aName(GetPageText(aLayerId)); + SdrPageView* pPV = pDrViewSh->GetView()->GetSdrPageView(); + sal_Bool bVisible = pPV->IsLayerVisible(aName); + pPV->SetLayerVisible(aName, !bVisible); + pDrViewSh->ResetActualLayer(); + } + } + + // If you insert a new layer you must not call TabBar::MouseButtonDown(rMEvt); + // because you want to activate the new layer + if( !bSetPageID ) + TabBar::MouseButtonDown(rMEvt); +} + +void LayerTabBar::DoubleClick() +{ + if (GetCurPageId() != 0) + { + SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher(); + pDispatcher->Execute( SID_MODIFYLAYER, SFX_CALLMODE_SYNCHRON ); + } +} + + +/************************************************************************* +|* +|* AcceptDrop-Event +|* +\************************************************************************/ + +sal_Int8 LayerTabBar::AcceptDrop( const AcceptDropEvent& rEvt ) +{ + sal_Int8 nRet = DND_ACTION_NONE; + + if( rEvt.mbLeaving ) + EndSwitchPage(); + + if( !pDrViewSh->GetDocSh()->IsReadOnly() ) + { + sal_uInt16 nPageId = SDRPAGE_NOTFOUND; + Point aPos( PixelToLogic( rEvt.maPosPixel ) ); + sal_uInt16 nLayerId = pDrViewSh->GetView()->GetDoc()->GetLayerAdmin().GetLayerID( GetPageText( GetPageId( aPos ) ), sal_False ); + + nRet = pDrViewSh->AcceptDrop( rEvt, *this, NULL, nPageId, nLayerId ); + + SwitchPage( aPos ); + } + + return nRet; +} + +/************************************************************************* +|* +|* ExecuteDrop-Event +|* +\************************************************************************/ + +sal_Int8 LayerTabBar::ExecuteDrop( const ExecuteDropEvent& rEvt ) +{ + sal_uInt16 nPageId = SDRPAGE_NOTFOUND; + sal_uInt16 nLayerId = pDrViewSh->GetView()->GetDoc()->GetLayerAdmin().GetLayerID( GetPageText( GetPageId( PixelToLogic( rEvt.maPosPixel ) ) ), sal_False ); + sal_Int8 nRet = pDrViewSh->ExecuteDrop( rEvt, *this, NULL, nPageId, nLayerId ); + + EndSwitchPage(); + + return nRet; + +} + +void LayerTabBar::Command(const CommandEvent& rCEvt) +{ + if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) + { + SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher(); + pDispatcher->ExecutePopup(SdResId(RID_LAYERTAB_POPUP)); + } +} + +long LayerTabBar::StartRenaming() +{ + sal_Bool bOK = sal_True; + String aLayerName = GetPageText( GetEditPageId() ); + String aLayoutLayer ( SdResId(STR_LAYER_LAYOUT) ); + String aControlsLayer ( SdResId(STR_LAYER_CONTROLS) ); + String aMeasureLinesLayer ( SdResId(STR_LAYER_MEASURELINES) ); + String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) ); + String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) ); + + if ( aLayerName == aLayoutLayer || aLayerName == aControlsLayer || + aLayerName == aMeasureLinesLayer || + aLayerName == aBackgroundLayer || aLayerName == aBackgroundObjLayer ) + { + // Diese Namen duerfen nicht veraendert werden + bOK = sal_False; + } + else + { + ::sd::View* pView = pDrViewSh->GetView(); + + if ( pView->IsTextEdit() ) + { + pView->SdrEndTextEdit(); + } + } + + return(bOK); +} + +long LayerTabBar::AllowRenaming() +{ + sal_Bool bOK = sal_True; + + // Ueberpruefung auf schon vorhandene Namen + ::sd::View* pView = pDrViewSh->GetView(); + SdDrawDocument* pDoc = pView->GetDoc(); + String aLayerName = pView->GetActiveLayer(); + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); + String aNewName( GetEditText() ); + + if ( aNewName.Len() == 0 || + (rLayerAdmin.GetLayer( aNewName, sal_False ) && aLayerName != aNewName) ) + { + // Name ist schon vorhanden + WarningBox aWarningBox( &pDrViewSh->GetViewFrame()->GetWindow(), WinBits( WB_OK ), + String(SdResId( STR_WARN_NAME_DUPLICATE ) ) ); + aWarningBox.Execute(); + bOK = sal_False; + } + + if (bOK) + { + String aLayoutLayer ( SdResId(STR_LAYER_LAYOUT) ); + String aControlsLayer ( SdResId(STR_LAYER_CONTROLS) ); + String aMeasureLinesLayer ( SdResId(STR_LAYER_MEASURELINES) ); + String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) ); + String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) ); + + if ( aNewName == aLayoutLayer || aNewName == aControlsLayer || + aNewName == aMeasureLinesLayer || + aNewName == aBackgroundLayer || aNewName == aBackgroundObjLayer ) + { + // Diese Namen duerfen nicht vergeben werden + bOK = sal_False; + } + } + + return(bOK); +} + +void LayerTabBar::EndRenaming() +{ + if( !IsEditModeCanceled() ) + { + ::sd::View* pView = pDrViewSh->GetView(); + DrawView* pDrView = PTR_CAST( DrawView, pView ); + + SdDrawDocument* pDoc = pView->GetDoc(); + String aLayerName = pView->GetActiveLayer(); + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); + SdrLayer* pLayer = rLayerAdmin.GetLayer(aLayerName, sal_False); + + if (pLayer) + { + String aNewName( GetEditText() ); + + DBG_ASSERT( pDrView, "Rename layer undo action is only working with a SdDrawView" ); + if( pDrView ) + { + ::svl::IUndoManager* pManager = pDoc->GetDocSh()->GetUndoManager(); + SdLayerModifyUndoAction* pAction = new SdLayerModifyUndoAction( + pDoc, + pLayer, + aLayerName, + pLayer->GetTitle(), + pLayer->GetDescription(), + pDrView->IsLayerVisible(aLayerName), + pDrView->IsLayerLocked(aLayerName), + pDrView->IsLayerPrintable(aLayerName), + aNewName, + pLayer->GetTitle(), + pLayer->GetDescription(), + pDrView->IsLayerVisible(aLayerName), + pDrView->IsLayerLocked(aLayerName), + pDrView->IsLayerPrintable(aLayerName) + ); + pManager->AddUndoAction( pAction ); + } + + // Zuerst View benachrichtigen, da innerhalb von SetName() schon + // ResetActualLayer() gerufen wird und an der View der Layer dann + // schon bekannt sein muss. + pView->SetActiveLayer(aNewName); + pLayer->SetName(aNewName); + pDoc->SetChanged(sal_True); + } + } +} + +void LayerTabBar::ActivatePage() +{ + if ( /*IsInSwitching*/ 1 && pDrViewSh!=NULL) + { + + SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher(); + pDispatcher->Execute(SID_SWITCHLAYER, SFX_CALLMODE_ASYNCHRON); + } +} + + + + +void LayerTabBar::SendActivatePageEvent (void) +{ + CallEventListeners (VCLEVENT_TABBAR_PAGEACTIVATED, + reinterpret_cast<void*>(GetCurPageId())); +} + + + + +void LayerTabBar::SendDeactivatePageEvent (void) +{ + CallEventListeners (VCLEVENT_TABBAR_PAGEDEACTIVATED, + reinterpret_cast<void*>(GetCurPageId())); +} + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/NavigatorChildWindow.cxx b/sd/source/ui/dlg/NavigatorChildWindow.cxx new file mode 100644 index 000000000000..75419b1eaec2 --- /dev/null +++ b/sd/source/ui/dlg/NavigatorChildWindow.cxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "NavigatorChildWindow.hxx" +#include "navigatr.hxx" +#include "app.hrc" +#include "navigatr.hrc" +#include <sfx2/app.hxx> + +namespace sd { + +SFX_IMPL_CHILDWINDOWCONTEXT(NavigatorChildWindow, SID_NAVIGATOR) + +NavigatorChildWindow::NavigatorChildWindow ( + ::Window* pParent, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* ) + : SfxChildWindowContext( nId ) +{ + SdNavigatorWin* pNavWin = new SdNavigatorWin( pParent, this, + SdResId( FLT_NAVIGATOR ), pBindings ); + + SetWindow( pNavWin ); +} + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx new file mode 100644 index 000000000000..7b3188639d55 --- /dev/null +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -0,0 +1,237 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" +#include "PaneChildWindows.hxx" +#include "PaneDockingWindow.hrc" +#include "PaneDockingWindow.hxx" +#include "ViewShellBase.hxx" +#include "framework/FrameworkHelper.hxx" +#include "taskpane/ToolPanelViewShell.hxx" +#include "app.hrc" +#include "strings.hrc" +#include "sdresid.hxx" + +#include <com/sun/star/drawing/framework/XConfigurationController.hpp> +#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp> + +#include <sfx2/app.hxx> +#include <sfx2/dockwin.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <tools/diagnose_ex.h> + +namespace sd { + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::drawing::framework::XResourceId; +using ::com::sun::star::drawing::framework::XConfigurationController; +using ::com::sun::star::drawing::framework::ResourceActivationMode_ADD; +using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE; + +SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS) +SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW) +SFX_IMPL_DOCKINGWINDOW( ToolPanelChildWindow, SID_TASKPANE) + +//===== PaneChildWindow ======================================================= + +PaneChildWindow::PaneChildWindow ( + ::Window* pParentWindow, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo, + const sal_uInt16 nDockWinTitleResId, + const sal_uInt16 nTitleBarResId, + SfxChildAlignment eAlignment) + : SfxChildWindow (pParentWindow, nId) +{ + pWindow = new PaneDockingWindow ( + pBindings, + this, + pParentWindow, + SdResId( nDockWinTitleResId ), + String( SdResId( nTitleBarResId ) ) ); + eChildAlignment = eAlignment; + static_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo); + SetHideNotDelete(sal_True); + + ViewShellBase* pBase = ViewShellBase::GetViewShellBase(pBindings->GetDispatcher()->GetFrame()); + if (pBase != NULL) + { + framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration(); + } +} + + + + +PaneChildWindow::~PaneChildWindow (void) +{ + ViewShellBase* pBase = NULL; + PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(pWindow); + if (pDockingWindow != NULL) + pBase = ViewShellBase::GetViewShellBase( + pDockingWindow->GetBindings().GetDispatcher()->GetFrame()); + if (pBase != NULL) + framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration(); +} + + + + + + +//===== LeftPaneImpressChildWindow ============================================ + +LeftPaneImpressChildWindow::LeftPaneImpressChildWindow ( + ::Window* pParentWindow, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo) + : PaneChildWindow( + pParentWindow, + nId, + pBindings, + pInfo, + FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW, + STR_LEFT_PANE_IMPRESS_TITLE, + SFX_ALIGN_LEFT) +{ +} + + + + +//===== LeftPaneDrawChildWindow =============================================== + +LeftPaneDrawChildWindow::LeftPaneDrawChildWindow ( + ::Window* pParentWindow, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo) + : PaneChildWindow( + pParentWindow, + nId, + pBindings, + pInfo, + FLT_LEFT_PANE_DRAW_DOCKING_WINDOW, + STR_LEFT_PANE_DRAW_TITLE, + SFX_ALIGN_LEFT) +{ +} + + + + +//====================================================================================================================== +//= ToolPanelChildWindow +//====================================================================================================================== +//---------------------------------------------------------------------------------------------------------------------- +ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, sal_uInt16 i_nId, SfxBindings* i_pBindings, + SfxChildWinInfo* i_pChildWindowInfo ) + :PaneChildWindow( i_pParentWindow, i_nId, i_pBindings, i_pChildWindowInfo, + FLT_TOOL_PANEL_DOCKING_WINDOW, STR_RIGHT_PANE_TITLE, SFX_ALIGN_RIGHT ) +{ + // just in case this window has been created by SFX, instead our resource framework: Ensure that the resource framework + // activates the task pane, so it is really filled with content (in opposite to the other SFX applications, the + // child window registered for SID_TASKPANE is not responsible for its content, but here in SD, it's the ToolPanelViewShell + // which has this responsibility. And this view shell is created implicitly via the resource framework.) + // #i113788# + SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() ); + ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() ); + ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ToolPanelChildWindow: no view shell access!" ); + + const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) ); + ENSURE_OR_RETURN_VOID( pFrameworkHelper.get(), "ToolPanelChildWindow::ToolPanelChildWindow: no framework helper for the view shell!" ); + Reference<XConfigurationController> xConfigController( pFrameworkHelper->GetConfigurationController() ); + ENSURE_OR_RETURN_VOID( xConfigController.is(), "ToolPanelChildWindow::ToolPanelChildWindow: no config controller!" ); + xConfigController->requestResourceActivation( + framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msRightPaneURL ), + ResourceActivationMode_ADD ); + xConfigController->requestResourceActivation( + framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL ), + ResourceActivationMode_REPLACE + ); +} + +//---------------------------------------------------------------------------------------------------------------------- +struct DelayedToolPanelActivation +{ + DelayedToolPanelActivation( ToolPanelChildWindow& i_rToolPanelWindow, const ::rtl::OUString& i_rPanelURL ) + :m_rToolPanelWindow( i_rToolPanelWindow ) + ,m_sPanelURL( i_rPanelURL ) + { + } + + void operator() (bool) + { + m_rToolPanelWindow.ActivateToolPanel( m_sPanelURL ); + } + +private: + ToolPanelChildWindow& m_rToolPanelWindow; + const ::rtl::OUString m_sPanelURL; +}; + +//---------------------------------------------------------------------------------------------------------------------- +void ToolPanelChildWindow::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) +{ + SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() ); + ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() ); + ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ActivateToolPanel: no view shell access!" ); + + const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) ); + + if ( i_rPanelURL.indexOf( framework::FrameworkHelper::msTaskPanelURLPrefix ) == 0 ) + { + // it's one of our standard panels known to the drawing framework + pFrameworkHelper->RequestTaskPanel( i_rPanelURL ); + } + else + { + // TODO: it would be nice if the drawing framework were able to handle non-standard panels, installed by + // extensions, too. As long as this is not the case, we need to take the direct way ... + ::boost::shared_ptr< ViewShell > pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL ); + toolpanel::ToolPanelViewShell* pToolPanelViewShell = dynamic_cast< toolpanel::ToolPanelViewShell* >( pViewShell.get() ); + if ( pToolPanelViewShell ) + { + pToolPanelViewShell->ActivatePanel( i_rPanelURL ); + } + else + { + Reference< XResourceId > xTaskPaneResource = pFrameworkHelper->RequestView( + framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL ); + pFrameworkHelper->RunOnResourceActivation( xTaskPaneResource, DelayedToolPanelActivation( *this, i_rPanelURL ) ); + } + } +} + +} // end of namespace ::sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/PaneDockingWindow.cxx b/sd/source/ui/dlg/PaneDockingWindow.cxx new file mode 100644 index 000000000000..5e88a2c76d8e --- /dev/null +++ b/sd/source/ui/dlg/PaneDockingWindow.cxx @@ -0,0 +1,150 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "PaneDockingWindow.hxx" +#include "Window.hxx" +#include "ViewShellBase.hxx" +#include "framework/FrameworkHelper.hxx" +#include "sdresid.hxx" +#include "res_bmp.hrc" +#include <sfx2/dispatch.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/taskpanelist.hxx> +#include <vcl/splitwin.hxx> +#include <vcl/svapp.hxx> +#include <tools/wintypes.hxx> +#include <boost/bind.hpp> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::drawing::framework; +using ::sfx2::TitledDockingWindow; + +namespace sd { + +PaneDockingWindow::PaneDockingWindow( + SfxBindings *_pBindings, SfxChildWindow *pChildWindow, ::Window* pParent, + const ResId& rResId, const ::rtl::OUString& rsTitle ) + :TitledDockingWindow( _pBindings, pChildWindow, pParent, rResId ) +{ + SetTitle( rsTitle ); +} + +PaneDockingWindow::~PaneDockingWindow (void) +{ +} + +void PaneDockingWindow::StateChanged( StateChangedType nType ) +{ + switch (nType) + { + case STATE_CHANGE_INITSHOW: + Resize(); + GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL); + break; + + case STATE_CHANGE_VISIBLE: + // The visibility of the docking window has changed. Tell the + // ConfigurationController so that it can activate or deactivate + // a/the view for the pane. + // Without this the side panes remain empty after closing an + // in-place slide show. + ViewShellBase* pBase = ViewShellBase::GetViewShellBase( + GetBindings().GetDispatcher()->GetFrame()); + if (pBase != NULL) + { + framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration(); + } + break; + } + SfxDockingWindow::StateChanged (nType); +} + +void PaneDockingWindow::MouseButtonDown (const MouseEvent& rEvent) +{ + if (rEvent.GetButtons() == MOUSE_LEFT) + { + // For some strange reason we have to set the WB_DIALOGCONTROL at + // the content window in order to have it pass focus to its content + // window. Without setting this flag here that works only on views + // that have not been taken from the cash and relocated to this pane + // docking window. + GetContentWindow().SetStyle(GetContentWindow().GetStyle() | WB_DIALOGCONTROL); + GetContentWindow().GrabFocus(); + } + SfxDockingWindow::MouseButtonDown(rEvent); +} + + + + + + + + +void PaneDockingWindow::SetValidSizeRange (const Range aValidSizeRange) +{ + SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent()); + if (pSplitWindow != NULL) + { + const sal_uInt16 nId (pSplitWindow->GetItemId(static_cast< ::Window*>(this))); + const sal_uInt16 nSetId (pSplitWindow->GetSet(nId)); + // Because the PaneDockingWindow paints its own decoration, we have + // to compensate the valid size range for that. + const SvBorder aBorder (GetDecorationBorder()); + sal_Int32 nCompensation (pSplitWindow->IsHorizontal() + ? mnTitleBarHeight + aBorder.Top() + aBorder.Bottom() + : aBorder.Left() + aBorder.Right()); + pSplitWindow->SetItemSizeRange( + nSetId, + Range( + aValidSizeRange.Min() + nCompensation, + aValidSizeRange.Max() + nCompensation)); + } +} + + + + +PaneDockingWindow::Orientation PaneDockingWindow::GetOrientation (void) const +{ + SplitWindow* pSplitWindow = dynamic_cast<SplitWindow*>(GetParent()); + if (pSplitWindow == NULL) + return UnknownOrientation; + else if (pSplitWindow->IsHorizontal()) + return HorizontalOrientation; + else + return VerticalOrientation; +} + +} // end of namespace ::sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/PaneDockingWindow.src b/sd/source/ui/dlg/PaneDockingWindow.src new file mode 100644 index 000000000000..a0def1c18ec7 --- /dev/null +++ b/sd/source/ui/dlg/PaneDockingWindow.src @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "PaneDockingWindow.hrc" + +DockingWindow FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW +{ + HelpID = "sd:DockingWindow:FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW"; + Border = TRUE ; + Hide = TRUE ; + SVLook = TRUE ; + Sizeable = TRUE ; + Moveable = TRUE ; + Closeable = TRUE ; + Zoomable = TRUE ; + Dockable = TRUE ; + EnableResizing = TRUE ; + Size = MAP_APPFONT (100,200) ; + Text [ en-US ] = "Slide Pane" ; +}; + +DockingWindow FLT_LEFT_PANE_DRAW_DOCKING_WINDOW +{ + HelpID = "sd:DockingWindow:FLT_LEFT_PANE_DRAW_DOCKING_WINDOW"; + Border = TRUE ; + Hide = TRUE ; + SVLook = TRUE ; + Sizeable = TRUE ; + Moveable = TRUE ; + Closeable = TRUE ; + Zoomable = TRUE ; + Dockable = TRUE ; + EnableResizing = TRUE ; + Size = MAP_APPFONT (100,200) ; + Text [ en-US ] = "Page Pane" ; +}; + +DockingWindow FLT_TOOL_PANEL_DOCKING_WINDOW +{ + HelpID = "sd:DockingWindow:FLT_TOOL_PANEL_DOCKING_WINDOW"; + Border = TRUE ; + Hide = TRUE ; + SVLook = TRUE ; + Sizeable = TRUE ; + Moveable = TRUE ; + Closeable = TRUE ; + Zoomable = TRUE ; + Dockable = TRUE ; + EnableResizing = TRUE ; + Size = MAP_APPFONT (100,200) ; + Text [ en-US ] = "Task Pane" ; +}; diff --git a/sd/source/ui/dlg/PaneShells.cxx b/sd/source/ui/dlg/PaneShells.cxx new file mode 100644 index 000000000000..61f8f323863c --- /dev/null +++ b/sd/source/ui/dlg/PaneShells.cxx @@ -0,0 +1,142 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "precompiled_sd.hxx" +#include "PaneShells.hxx" + +#include "PaneChildWindows.hxx" + +#include "glob.hrc" +#include "sdresid.hxx" + +#include <sfx2/msg.hxx> +#include <sfx2/objface.hxx> + +namespace sd { + +//===== LeftImpressPaneShell ================================================== + +#define ShellClass LeftImpressPaneShell + +SFX_SLOTMAP(LeftImpressPaneShell) +{ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +SFX_IMPL_INTERFACE(LeftImpressPaneShell, SfxShell, SdResId(STR_LEFT_IMPRESS_PANE_SHELL)) +{ + SFX_CHILDWINDOW_REGISTRATION( + ::sd::LeftPaneImpressChildWindow::GetChildWindowId()); +} + +TYPEINIT1(LeftImpressPaneShell, SfxShell); + + + +LeftImpressPaneShell::LeftImpressPaneShell (void) + : SfxShell() +{ + SetName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LeftImpressPane"))); +} + + + + +LeftImpressPaneShell::~LeftImpressPaneShell (void) +{ +} + + + + +//===== LeftDrawPaneShell ===================================================== + +#undef ShellClass +#define ShellClass LeftDrawPaneShell + +SFX_SLOTMAP(LeftDrawPaneShell) +{ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +SFX_IMPL_INTERFACE(LeftDrawPaneShell, SfxShell, SdResId(STR_LEFT_DRAW_PANE_SHELL)) +{ + SFX_CHILDWINDOW_REGISTRATION( + ::sd::LeftPaneDrawChildWindow::GetChildWindowId()); +} + +TYPEINIT1(LeftDrawPaneShell, SfxShell); + + + +LeftDrawPaneShell::LeftDrawPaneShell (void) + : SfxShell() +{ + SetName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LeftDrawPane"))); +} + + + + +LeftDrawPaneShell::~LeftDrawPaneShell (void) +{ +} + + + + +//===== ToolPanelPaneShell ======================================================== + +#undef ShellClass +#define ShellClass ToolPanelPaneShell + +SFX_SLOTMAP( ToolPanelPaneShell ) +{ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +SFX_IMPL_INTERFACE( ToolPanelPaneShell, SfxShell, SdResId( STR_TOOL_PANEL_SHELL ) ) +{ + SFX_CHILDWINDOW_REGISTRATION( ::sd::ToolPanelChildWindow::GetChildWindowId() ); +} + +TYPEINIT1( ToolPanelPaneShell, SfxShell ); + +ToolPanelPaneShell::ToolPanelPaneShell() + :SfxShell() +{ + SetName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ToolPanel" )) ); +} + +ToolPanelPaneShell::~ToolPanelPaneShell(void) +{ +} + +} // end of namespace ::sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/SpellDialogChildWindow.cxx b/sd/source/ui/dlg/SpellDialogChildWindow.cxx new file mode 100644 index 000000000000..8022672beb64 --- /dev/null +++ b/sd/source/ui/dlg/SpellDialogChildWindow.cxx @@ -0,0 +1,216 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "SpellDialogChildWindow.hxx" +#include <svx/svxids.hrc> +#include <sfx2/app.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + +namespace sd{ + +SFX_IMPL_CHILDWINDOW(SpellDialogChildWindow, SID_SPELL_DIALOG) +} + +#include "ViewShell.hxx" +#include "ViewShellBase.hxx" +#include "DrawViewShell.hxx" +#include "OutlineViewShell.hxx" +#include <Outliner.hxx> +#include "drawdoc.hxx" + + +namespace sd { + +SpellDialogChildWindow::SpellDialogChildWindow ( + ::Window* _pParent, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo) + : ::svx::SpellDialogChildWindow (_pParent, nId, pBindings, pInfo), + mpSdOutliner (NULL), + mbOwnOutliner (false) +{ + ProvideOutliner(); +} + + + + +SpellDialogChildWindow::~SpellDialogChildWindow (void) +{ + if (mpSdOutliner != NULL) + mpSdOutliner->EndSpelling(); + + if (mbOwnOutliner) + delete mpSdOutliner; +} + + + + + + + + +SfxChildWinInfo SpellDialogChildWindow::GetInfo (void) const +{ + return ::svx::SpellDialogChildWindow::GetInfo(); +} + + + + +void SpellDialogChildWindow::InvalidateSpellDialog (void) +{ + ::svx::SpellDialogChildWindow::InvalidateSpellDialog(); +} + + + + +::svx::SpellPortions SpellDialogChildWindow::GetNextWrongSentence( bool /*bRecheck*/ ) +{ + ::svx::SpellPortions aResult; + + if (mpSdOutliner != NULL) + { + ProvideOutliner(); + aResult = mpSdOutliner->GetNextSpellSentence(); + } + + // Close the spell check dialog when there are no more sentences to + // check. + if (aResult.size() == 0) + { + SfxBoolItem aItem (SID_SPELL_DIALOG, sal_False); + GetBindings().GetDispatcher()->Execute( + SID_SPELL_DIALOG, + SFX_CALLMODE_ASYNCHRON, + &aItem, + 0L); + } + + return aResult; +} + + + + +void SpellDialogChildWindow::ApplyChangedSentence ( + const ::svx::SpellPortions& rChanged, bool bRecheck ) +{ + if (mpSdOutliner != NULL) + { + OutlinerView* pOutlinerView = mpSdOutliner->GetView(0); + if (pOutlinerView != NULL) + mpSdOutliner->ApplyChangedSentence ( + pOutlinerView->GetEditView(), + rChanged, bRecheck); + } +} + + + + +void SpellDialogChildWindow::GetFocus (void) +{ + // In order to detect a cursor movement we could compare the + // currently selected text shape with the one that was selected + // when LoseFocus() was called the last time. + // For the time being we instead rely on the DetectChange() method + // in the SdOutliner class. +} + + + + +void SpellDialogChildWindow::LoseFocus() +{ +} + + + + +void SpellDialogChildWindow::ProvideOutliner (void) +{ + ViewShellBase* pViewShellBase = PTR_CAST (ViewShellBase, SfxViewShell::Current()); + + if (pViewShellBase != NULL) + { + ViewShell* pViewShell = pViewShellBase->GetMainViewShell().get(); + // If there already exists an outliner that has been created + // for another view shell then destroy it first. + if (mpSdOutliner != NULL) + if ((pViewShell->ISA(DrawViewShell) && ! mbOwnOutliner) + || (pViewShell->ISA(OutlineViewShell) && mbOwnOutliner)) + { + mpSdOutliner->EndSpelling(); + if (mbOwnOutliner) + delete mpSdOutliner; + mpSdOutliner = NULL; + } + + // Now create/get an outliner if none is present. + if (mpSdOutliner == NULL) + { + if (pViewShell->ISA(DrawViewShell)) + { + // We need an outliner for the spell check so we have + // to create one. + mbOwnOutliner = true; + mpSdOutliner = new Outliner ( + pViewShell->GetDoc(), + OUTLINERMODE_TEXTOBJECT); + } + else if (pViewShell->ISA(OutlineViewShell)) + { + // An outline view is already visible. The SdOutliner + // will use it instead of creating its own. + mbOwnOutliner = false; + mpSdOutliner = pViewShell->GetDoc()->GetOutliner(); + } + + // Initialize spelling. + if (mpSdOutliner != NULL) + { + mpSdOutliner->PrepareSpelling(); + mpSdOutliner->StartSpelling(); + } + } + } +} + + + +} // end of namespace ::sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx new file mode 100644 index 000000000000..d879d497803b --- /dev/null +++ b/sd/source/ui/dlg/TemplateScanner.cxx @@ -0,0 +1,496 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "TemplateScanner.hxx" + +#include <comphelper/processfactory.hxx> +#include <comphelper/documentconstants.hxx> + +#include <tools/debug.hxx> +#include <osl/mutex.hxx> +#include <vcl/svapp.hxx> +#include <com/sun/star/frame/XDocumentTemplates.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/ucb/XContentAccess.hpp> +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XRow.hpp> + +#include <set> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +namespace { + +const ::rtl::OUString TITLE(RTL_CONSTASCII_USTRINGPARAM ("Title")); +const ::rtl::OUString TARGET_DIR_URL(RTL_CONSTASCII_USTRINGPARAM ("TargetDirURL")); +const ::rtl::OUString DESCRIPTION(RTL_CONSTASCII_USTRINGPARAM ("TypeDescription")); +const ::rtl::OUString TARGET_URL(RTL_CONSTASCII_USTRINGPARAM ("TargetURL")); + +const ::rtl::OUString DOCTEMPLATES(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.frame.DocumentTemplates")); + +// These strings are used to find impress templates in the tree of +// template files. Should probably be determined dynamically. +const ::rtl::OUString IMPRESS_BIN_TEMPLATE(RTL_CONSTASCII_USTRINGPARAM ("application/vnd.stardivision.impress")); +const ::rtl::OUString IMPRESS_XML_TEMPLATE = MIMETYPE_VND_SUN_XML_IMPRESS; +// The following id comes from the bugdoc in #i2764#. +const ::rtl::OUString IMPRESS_XML_TEMPLATE_B(RTL_CONSTASCII_USTRINGPARAM ("Impress 2.0")); +const ::rtl::OUString IMPRESS_XML_TEMPLATE_OASIS = MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION; + + +class FolderDescriptor +{ +public: + FolderDescriptor ( + int nPriority, + const ::rtl::OUString& rsTitle, + const ::rtl::OUString& rsTargetDir, + const ::rtl::OUString& rsContentIdentifier, + const Reference<com::sun::star::ucb::XCommandEnvironment>& rxFolderEnvironment) + : mnPriority(nPriority), + msTitle(rsTitle), + msTargetDir(rsTargetDir), + msContentIdentifier(rsContentIdentifier), + mxFolderEnvironment(rxFolderEnvironment) + { } + int mnPriority; + ::rtl::OUString msTitle; + ::rtl::OUString msTargetDir; + ::rtl::OUString msContentIdentifier; + // Reference<sdbc::XResultSet> mxFolderResultSet; + Reference<com::sun::star::ucb::XCommandEnvironment> mxFolderEnvironment; + + class Comparator + { + public: + bool operator() (const FolderDescriptor& r1, const FolderDescriptor& r2) const + { return r1.mnPriority < r2.mnPriority; } + }; +}; + +/** Use a heuristic based on the URL of a top-level template folder to + assign a priority that is used to sort the folders. +*/ +int Classify (const ::rtl::OUString&, const ::rtl::OUString& rsURL) +{ + int nPriority (0); + + if (rsURL.getLength() == 0) + nPriority = 100; + else if (rsURL.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("presnt")))>=0) + { + nPriority = 30; + } + else if (rsURL.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("layout")))>=0) + { + nPriority = 20; + } + else if (rsURL.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("educate")))>=0) + { + nPriority = 40; + } + else if (rsURL.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("finance")))>=0) + { + nPriority = 40; + } + else + { + // All other folders are taken for user supplied and have the + // highest priority. + nPriority = 10; + } + + return nPriority; +} + +} // end of anonymous namespace + + + + +namespace sd +{ + +class TemplateScanner::FolderDescriptorList + : public ::std::multiset<FolderDescriptor,FolderDescriptor::Comparator> +{ +}; + +TemplateScanner::TemplateScanner (void) + : meState(INITIALIZE_SCANNING), + maFolderContent(), + mpTemplateDirectory(NULL), + maFolderList(), + mpLastAddedEntry(NULL), + mpFolderDescriptors(new FolderDescriptorList()), + mxTemplateRoot(), + mxFolderEnvironment(), + mxEntryEnvironment(), + mxFolderResultSet(), + mxEntryResultSet() +{ + // empty; +} + + + + +TemplateScanner::~TemplateScanner (void) +{ + mpFolderDescriptors.reset(); + + // Delete all entries of the template list that have not been + // transferred to another object. + std::vector<TemplateDir*>::iterator I; + for (I=maFolderList.begin(); I!=maFolderList.end(); ++I) + if (*I != NULL) + delete *I; +} + + + + +TemplateScanner::State TemplateScanner::GetTemplateRoot (void) +{ + State eNextState (INITIALIZE_FOLDER_SCANNING); + + Reference<lang::XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory (); + DBG_ASSERT (xFactory.is(), "TemplateScanner::GetTemplateRoot: xFactory is NULL"); + + if (xFactory.is()) + { + Reference<frame::XDocumentTemplates> xTemplates ( + xFactory->createInstance (DOCTEMPLATES), UNO_QUERY); + DBG_ASSERT (xTemplates.is(), "TemplateScanner::GetTemplateRoot: xTemplates is NULL"); + + if (xTemplates.is()) + mxTemplateRoot = xTemplates->getContent(); + else + eNextState = ERROR; + } + else + eNextState = ERROR; + + return eNextState; +} + + + + +TemplateScanner::State TemplateScanner::InitializeEntryScanning (void) +{ + State eNextState (SCAN_ENTRY); + + if (maFolderContent.isFolder()) + { + mxEntryEnvironment = Reference<com::sun::star::ucb::XCommandEnvironment>(); + + // We are interested only in three properties: the entry's name, + // its URL, and its content type. + Sequence<rtl::OUString> aProps (3); + aProps[0] = TITLE; + aProps[1] = TARGET_URL; + aProps[2] = DESCRIPTION; + + // Create a cursor to iterate over the templates in this folders. + ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_DOCUMENTS_ONLY; + mxEntryResultSet = Reference<com::sun::star::sdbc::XResultSet>( + maFolderContent.createCursor(aProps, eInclude)); + } + else + eNextState = ERROR; + + return eNextState; +} + + + + +TemplateScanner::State TemplateScanner::ScanEntry (void) +{ + State eNextState (ERROR); + + Reference<com::sun::star::ucb::XContentAccess> xContentAccess (mxEntryResultSet, UNO_QUERY); + Reference<com::sun::star::sdbc::XRow> xRow (mxEntryResultSet, UNO_QUERY); + + if (xContentAccess.is() && xRow.is() && mxEntryResultSet.is()) + { + if (mxEntryResultSet->next()) + { + ::rtl::OUString sTitle (xRow->getString (1)); + ::rtl::OUString sTargetURL (xRow->getString (2)); + ::rtl::OUString sContentType (xRow->getString (3)); + + ::rtl::OUString aId = xContentAccess->queryContentIdentifierString(); + ::ucbhelper::Content aContent = ::ucbhelper::Content (aId, mxEntryEnvironment); + if (aContent.isDocument ()) + { + // Check wether the entry is an impress template. If so + // add a new entry to the resulting list (which is created + // first if necessary). + if ( (sContentType == MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE) + || (sContentType == IMPRESS_XML_TEMPLATE_OASIS) + || (sContentType == IMPRESS_BIN_TEMPLATE) + || (sContentType == IMPRESS_XML_TEMPLATE) + || (sContentType == IMPRESS_XML_TEMPLATE_B)) + { + mpLastAddedEntry = new TemplateEntry(sTitle, sTargetURL); + mpTemplateDirectory->maEntries.push_back(mpLastAddedEntry); + } + } + + // Continue scanning entries. + eNextState = SCAN_ENTRY; + } + else + { + if (mpTemplateDirectory->maEntries.empty()) + { + delete mpTemplateDirectory; + mpTemplateDirectory = NULL; + } + else + { + SolarMutexGuard aGuard; + maFolderList.push_back(mpTemplateDirectory); + } + + // Continue with scanning the next folder. + eNextState = SCAN_FOLDER; + } + } + + return eNextState; +} + + + + +TemplateScanner::State TemplateScanner::InitializeFolderScanning (void) +{ + State eNextState (ERROR); + + mxFolderResultSet = Reference<sdbc::XResultSet>(); + + try + { + // Create content for template folders. + mxFolderEnvironment = Reference<com::sun::star::ucb::XCommandEnvironment>(); + ::ucbhelper::Content aTemplateDir (mxTemplateRoot, mxFolderEnvironment); + + // Define the list of properties we are interested in. + Sequence<rtl::OUString> aProps (2); + aProps[0] = TITLE; + aProps[1] = TARGET_DIR_URL; + + // Create an cursor to iterate over the template folders. + ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_ONLY; + mxFolderResultSet = Reference<sdbc::XResultSet>( + aTemplateDir.createCursor(aProps, eInclude)); + if (mxFolderResultSet.is()) + eNextState = GATHER_FOLDER_LIST; + } + catch (::com::sun::star::uno::Exception&) + { + eNextState = ERROR; + } + + return eNextState; +} + + + + +TemplateScanner::State TemplateScanner::GatherFolderList (void) +{ + State eNextState (ERROR); + + Reference<com::sun::star::ucb::XContentAccess> xContentAccess (mxFolderResultSet, UNO_QUERY); + if (xContentAccess.is() && mxFolderResultSet.is()) + { + while (mxFolderResultSet->next()) + { + Reference<sdbc::XRow> xRow (mxFolderResultSet, UNO_QUERY); + if (xRow.is()) + { + ::rtl::OUString sTitle (xRow->getString (1)); + ::rtl::OUString sTargetDir (xRow->getString (2)); + ::rtl::OUString aId = xContentAccess->queryContentIdentifierString(); + + mpFolderDescriptors->insert( + FolderDescriptor( + Classify(sTitle,sTargetDir), + sTitle, + sTargetDir, + aId, + mxFolderEnvironment)); + } + } + + eNextState = SCAN_FOLDER; + } + + return eNextState; +} + + + + +TemplateScanner::State TemplateScanner::ScanFolder (void) +{ + State eNextState (ERROR); + + if (mpFolderDescriptors->size() > 0) + { + FolderDescriptor aDescriptor (*mpFolderDescriptors->begin()); + mpFolderDescriptors->erase(mpFolderDescriptors->begin()); + + ::rtl::OUString sTitle (aDescriptor.msTitle); + ::rtl::OUString sTargetDir (aDescriptor.msTargetDir); + ::rtl::OUString aId (aDescriptor.msContentIdentifier); + + maFolderContent = ::ucbhelper::Content (aId, aDescriptor.mxFolderEnvironment); + if (maFolderContent.isFolder()) + { + // Scan the folder and insert it into the list of template + // folders. + mpTemplateDirectory = new TemplateDir (sTitle, sTargetDir); + if (mpTemplateDirectory != NULL) + { + // Continue with scanning all entries in the folder. + eNextState = INITIALIZE_ENTRY_SCAN; + } + } + } + else + { + eNextState = DONE; + } + + return eNextState; +} + + + + +void TemplateScanner::Scan (void) +{ + while (HasNextStep()) + RunNextStep(); +} + + + + +std::vector<TemplateDir*>& TemplateScanner::GetFolderList (void) +{ + return maFolderList; +} + + + + +void TemplateScanner::RunNextStep (void) +{ + switch (meState) + { + case INITIALIZE_SCANNING: + meState = GetTemplateRoot(); + break; + + case INITIALIZE_FOLDER_SCANNING: + meState = InitializeFolderScanning(); + break; + + case SCAN_FOLDER: + meState = ScanFolder(); + break; + + case GATHER_FOLDER_LIST: + meState = GatherFolderList(); + break; + + case INITIALIZE_ENTRY_SCAN: + meState = InitializeEntryScanning(); + break; + + case SCAN_ENTRY: + meState = ScanEntry(); + break; + default: + break; + } + + switch (meState) + { + case DONE: + case ERROR: + mxTemplateRoot.clear(); + mxTemplateRoot.clear(); + mxFolderEnvironment.clear(); + mxEntryEnvironment.clear(); + mxFolderResultSet.clear(); + mxEntryResultSet.clear(); + mpLastAddedEntry = NULL; + break; + default: + break; + } +} + + + + +bool TemplateScanner::HasNextStep (void) +{ + switch (meState) + { + case DONE: + case ERROR: + return false; + + default: + return true; + } +} + + + + +const TemplateEntry* TemplateScanner::GetLastAddedEntry (void) const +{ + return mpLastAddedEntry; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx new file mode 100644 index 000000000000..241a079584a7 --- /dev/null +++ b/sd/source/ui/dlg/animobjs.cxx @@ -0,0 +1,1303 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" +#include <com/sun/star/presentation/AnimationEffect.hpp> +#include <com/sun/star/presentation/AnimationSpeed.hpp> + +#define _ANIMATION //animation freischalten + +#define _SV_BITMAPEX +#include <svx/xoutbmp.hxx> + +#include <time.h> +#include <svl/eitem.hxx> +#include <svx/svdograf.hxx> +#include <svx/svdogrp.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/progress.hxx> +#include <vcl/msgbox.hxx> +#include "anminfo.hxx" +#include "animobjs.hxx" +#include "animobjs.hrc" +#include "anmdef.hxx" +#include "app.hrc" +#include "strings.hrc" +#include "sdresid.hxx" +#include "View.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "res_bmp.hrc" +#include "ViewShell.hxx" + +#include <vcl/svapp.hxx> + +#include <string> +#include <algorithm> + +using namespace ::com::sun::star; + +namespace sd { + +/************************************************************************* +|* SdDisplay - Control +\************************************************************************/ + +SdDisplay::SdDisplay( Window* pWin, SdResId Id ) : + Control( pWin, Id ), + aScale( 1, 1 ) +{ + SetMapMode( MAP_PIXEL ); + const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); + SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) ); +} + +// ----------------------------------------------------------------------- + +SdDisplay::~SdDisplay() +{ +} + +// ----------------------------------------------------------------------- + +void SdDisplay::SetBitmapEx( BitmapEx* pBmpEx ) +{ + if( pBmpEx ) + { + aBitmapEx = *pBmpEx; + } + else + { + const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); + const Color aFillColor = rStyles.GetFieldColor(); + aBitmapEx.Erase(aFillColor); + } +} + +// ----------------------------------------------------------------------- + +void SdDisplay::Paint( const Rectangle& ) +{ + Point aPt; + Size aSize = GetOutputSize(); + Size aBmpSize = aBitmapEx.GetBitmap().GetSizePixel(); + aBmpSize.Width() = (long) ( (double) aBmpSize.Width() * (double) aScale ); + aBmpSize.Height() = (long) ( (double) aBmpSize.Height() * (double) aScale ); + + if( aBmpSize.Width() < aSize.Width() ) + aPt.X() = ( aSize.Width() - aBmpSize.Width() ) / 2; + if( aBmpSize.Height() < aSize.Height() ) + aPt.Y() = ( aSize.Height() - aBmpSize.Height() ) / 2; + + aBitmapEx.Draw( this, aPt, aBmpSize ); +} + +// ----------------------------------------------------------------------- + +void SdDisplay::SetScale( const Fraction& rFrac ) +{ + aScale = rFrac; +} + +void SdDisplay::DataChanged( const DataChangedEvent& rDCEvt ) +{ + Control::DataChanged( rDCEvt ); + + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); + SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) ); + SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() + ? ViewShell::OUTPUT_DRAWMODE_CONTRAST + : ViewShell::OUTPUT_DRAWMODE_COLOR ); + } +} + +/************************************************************************* +|* AnimationWindow - FloatingWindow +\************************************************************************/ + +AnimationWindow::AnimationWindow( SfxBindings* pInBindings, + SfxChildWindow *pCW, Window* pParent, const SdResId& rSdResId ) : + SfxDockingWindow ( pInBindings, pCW, pParent, rSdResId ), + aCtlDisplay ( this, SdResId( CTL_DISPLAY ) ), + aBtnFirst ( this, SdResId( BTN_FIRST ) ), + aBtnReverse ( this, SdResId( BTN_REVERSE ) ), + aBtnStop ( this, SdResId( BTN_STOP ) ), + aBtnPlay ( this, SdResId( BTN_PLAY ) ), + aBtnLast ( this, SdResId( BTN_LAST ) ), + aNumFldBitmap ( this, SdResId( NUM_FLD_BITMAP ) ), + aTimeField ( this, SdResId( TIME_FIELD ) ), + aLbLoopCount ( this, SdResId( LB_LOOP_COUNT ) ), + aGrpBitmap ( this, SdResId( GRP_BITMAP ) ), + aBtnGetOneObject ( this, SdResId( BTN_GET_ONE_OBJECT ) ), + aBtnGetAllObjects ( this, SdResId( BTN_GET_ALL_OBJECTS ) ), + aBtnRemoveBitmap ( this, SdResId( BTN_REMOVE_BITMAP ) ), + aBtnRemoveAll ( this, SdResId( BTN_REMOVE_ALL ) ), + aFtCount ( this, SdResId( FT_COUNT ) ), + aFiCount ( this, SdResId( FI_COUNT ) ), + aGrpAnimation ( this, SdResId( GRP_ANIMATION_GROUP ) ), + aRbtGroup ( this, SdResId( RBT_GROUP ) ), + aRbtBitmap ( this, SdResId( RBT_BITMAP ) ), + aFtAdjustment ( this, SdResId( FT_ADJUSTMENT ) ), + aLbAdjustment ( this, SdResId( LB_ADJUSTMENT ) ), + aBtnCreateGroup ( this, SdResId( BTN_CREATE_GROUP ) ), + + pWin ( pParent ), + pBitmapEx ( NULL ), + + bMovie ( sal_False ), + bAllObjects ( sal_False ), + + pBindings ( pInBindings ) +{ + aCtlDisplay.SetAccessibleName(String (SdResId(STR_DISPLAY))); + FreeResource(); + + // neues Dokument mit Seite erzeugen + pMyDoc = new SdDrawDocument(DOCUMENT_TYPE_IMPRESS, NULL); + SdPage* pPage = (SdPage*) pMyDoc->AllocPage(sal_False); + pMyDoc->InsertPage(pPage); + + pControllerItem = new AnimationControllerItem( SID_ANIMATOR_STATE, this, pBindings ); + + // Solange noch nicht in der Resource + aTimeField.SetFormat( TIMEF_SEC_CS ); + + aBtnFirst.SetClickHdl( LINK( this, AnimationWindow, ClickFirstHdl ) ); + aBtnReverse.SetClickHdl( LINK( this, AnimationWindow, ClickPlayHdl ) ); + aBtnStop.SetClickHdl( LINK( this, AnimationWindow, ClickStopHdl ) ); + aBtnPlay.SetClickHdl( LINK( this, AnimationWindow, ClickPlayHdl ) ); + aBtnLast.SetClickHdl( LINK( this, AnimationWindow, ClickLastHdl ) ); + + aBtnGetOneObject.SetClickHdl( LINK( this, AnimationWindow, ClickGetObjectHdl ) ); + aBtnGetAllObjects.SetClickHdl( LINK( this, AnimationWindow, ClickGetObjectHdl ) ); + aBtnRemoveBitmap.SetClickHdl( LINK( this, AnimationWindow, ClickRemoveBitmapHdl ) ); + aBtnRemoveAll.SetClickHdl( LINK( this, AnimationWindow, ClickRemoveBitmapHdl ) ); + + aRbtGroup.SetClickHdl( LINK( this, AnimationWindow, ClickRbtHdl ) ); + aRbtBitmap.SetClickHdl( LINK( this, AnimationWindow, ClickRbtHdl ) ); + aBtnCreateGroup.SetClickHdl( LINK( this, AnimationWindow, ClickCreateGroupHdl ) ); + aNumFldBitmap.SetModifyHdl( LINK( this, AnimationWindow, ModifyBitmapHdl ) ); + aTimeField.SetModifyHdl( LINK( this, AnimationWindow, ModifyTimeHdl ) ); + + // disable 3D border + aCtlDisplay.SetBorderStyle(WINDOW_BORDER_MONO); + aDisplaySize = aCtlDisplay.GetOutputSize(); + + aSize = GetOutputSizePixel(); + SetMinOutputSizePixel( aSize ); + + ResetAttrs(); + + // der Animator ist leer; es kann keine Animationsgruppe erstellt werden + aBtnCreateGroup.Disable(); + + aBtnGetOneObject.SetAccessibleRelationMemberOf( &aGrpBitmap ); + aBtnGetAllObjects.SetAccessibleRelationMemberOf( &aGrpBitmap ); + aBtnRemoveBitmap.SetAccessibleRelationMemberOf( &aGrpBitmap ); + aBtnRemoveAll.SetAccessibleRelationMemberOf( &aGrpBitmap ); +} + +// ----------------------------------------------------------------------- + +AnimationWindow::~AnimationWindow() +{ + sal_uLong i, nCount; + + delete pControllerItem; + + // Bitmapliste bereinigen + for( i = 0, nCount = aBmpExList.Count(); i < nCount; i++ ) + delete static_cast< BitmapEx* >( aBmpExList.GetObject( i ) ); + aBmpExList.Clear(); + + // Timeliste bereinigen + for( i = 0, nCount = aTimeList.Count(); i < nCount; i++ ) + delete static_cast< Time* >( aTimeList.GetObject( i ) ); + aTimeList.Clear(); + + // die Clones loeschen + delete pMyDoc; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( AnimationWindow, ClickFirstHdl, void *, EMPTYARG ) +{ + aBmpExList.First(); + pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() ); + UpdateControl( aBmpExList.GetCurPos() ); + + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( AnimationWindow, ClickStopHdl, void *, EMPTYARG ) +{ + bMovie = sal_False; + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( AnimationWindow, ClickPlayHdl, void *, p ) +{ + ScopeLockGuard aGuard( maPlayLock ); + + bMovie = sal_True; + sal_Bool bDisableCtrls = sal_False; + sal_uLong nCount = aBmpExList.Count(); + sal_Bool bReverse = p == &aBtnReverse; + + // Kann spaeter schwer ermittelt werden + sal_Bool bRbtGroupEnabled = aRbtGroup.IsEnabled(); + sal_Bool bBtnGetAllObjectsEnabled = aBtnGetAllObjects.IsEnabled(); + sal_Bool bBtnGetOneObjectEnabled = aBtnGetOneObject.IsEnabled(); + + // Gesamtzeit ermitteln + Time aTime( 0 ); + long nFullTime; + if( aRbtBitmap.IsChecked() ) + { + for( sal_uLong i = 0; i < nCount; i++ ) + aTime += *static_cast< Time* >( aTimeList.GetObject( i ) ); + nFullTime = aTime.GetMSFromTime(); + } + else + { + nFullTime = nCount * 100; + aTime.MakeTimeFromMS( nFullTime ); + } + + // StatusBarManager ab 1 Sekunde + SfxProgress* pProgress = NULL; + if( nFullTime >= 1000 ) + { + bDisableCtrls = sal_True; + aBtnStop.Enable(); + aBtnStop.Update(); + String aStr( RTL_CONSTASCII_USTRINGPARAM( "Animator:" ) ); // Hier sollte man sich noch etwas gescheites ausdenken! + pProgress = new SfxProgress( NULL, aStr, nFullTime ); + } + + sal_uLong nTmpTime = 0; + long i = 0; + sal_Bool bCount = i < (long) nCount; + if( bReverse ) + { + i = nCount - 1; + bCount = i >= 0; + } + while( bCount && bMovie ) + { + // Um Konsistenz zwischen Liste und Anzeige zu erwirken + aBmpExList.Seek( i ); + pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() ); + + UpdateControl( i, bDisableCtrls ); + + if( aRbtBitmap.IsChecked() ) + { + Time* pTime = static_cast< Time* >( aTimeList.GetObject( i ) ); + DBG_ASSERT( pTime, "Keine Zeit gefunden!" ); + + aTimeField.SetTime( *pTime ); + sal_uLong nTime = pTime->GetMSFromTime(); + + WaitInEffect( nTime, nTmpTime, pProgress ); + nTmpTime += nTime; + } + else + { + WaitInEffect( 100, nTmpTime, pProgress ); + nTmpTime += 100; + } + if( bReverse ) + { + i--; + if (i < 0) + { + // Terminate loop. + bCount = false; + // Move i back into valid range. + i = 0; + } + } + else + { + i++; + if (i >= (long) nCount) + { + // Terminate loop. + bCount = false; + // Move i back into valid range. + i = nCount - 1; + } + } + } + + // Um die Controls wieder zu enablen + bMovie = sal_False; + if (nCount > 0) + UpdateControl(i); + + if( pProgress ) + { + delete pProgress; + aBtnStop.Disable(); + } + + aRbtGroup.Enable( bRbtGroupEnabled ); + aBtnGetAllObjects.Enable( bBtnGetAllObjectsEnabled ); + aBtnGetOneObject.Enable( bBtnGetOneObjectEnabled ); + + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( AnimationWindow, ClickLastHdl, void *, EMPTYARG ) +{ + aBmpExList.Last(); + pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() ); + UpdateControl( aBmpExList.GetCurPos() ); + + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( AnimationWindow, ClickRbtHdl, void *, p ) +{ + if( !pBitmapEx || p == &aRbtGroup || aRbtGroup.IsChecked() ) + { + aTimeField.SetText( String() ); + aTimeField.Enable( sal_False ); + aLbLoopCount.Enable( sal_False ); + } + else if( p == &aRbtBitmap || aRbtBitmap.IsChecked() ) + { + sal_uLong n = static_cast<sal_uLong>(aNumFldBitmap.GetValue()); + if( n > 0 ) + { + Time* pTime = static_cast< Time* >( aTimeList.GetObject( n - 1 ) ); + if( pTime ) + aTimeField.SetTime( *pTime ); + } + aTimeField.Enable(); + aLbLoopCount.Enable(); + } + + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( AnimationWindow, ClickGetObjectHdl, void *, pBtn ) +{ + bAllObjects = pBtn == &aBtnGetAllObjects; + + // Code jetzt in AddObj() + SfxBoolItem aItem( SID_ANIMATOR_ADD, sal_True ); + + GetBindings().GetDispatcher()->Execute( + SID_ANIMATOR_ADD, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L ); + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, void *, pBtn ) +{ + SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD); + SdrObject* pObject; + + if( pBtn == &aBtnRemoveBitmap ) + { + sal_uLong nPos = aBmpExList.GetCurPos(); + pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() ); + if( pBitmapEx ) + { + delete pBitmapEx; + aBmpExList.Remove(); + pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() ); + } + Time* pTime = static_cast< Time* >( aTimeList.GetObject( nPos ) ); + if( pTime ) + { + delete pTime; + aTimeList.Remove( nPos ); + } + + pObject = pPage->GetObj( nPos ); + // Durch Uebernahme der AnimatedGIFs muessen nicht unbedingt + // Objekte vorhanden sein. + if( pObject ) + { + pObject = pPage->RemoveObject(nPos); + DBG_ASSERT(pObject, "Clone beim Loeschen nicht gefunden"); + SdrObject::Free( pObject ); + pPage->RecalcObjOrdNums(); + } + + } + else // Alles loeschen + { + WarningBox aWarnBox( this, WB_YES_NO, String( SdResId( STR_ASK_DELETE_ALL_PICTURES ) ) ); + short nReturn = aWarnBox.Execute(); + + if( nReturn == RET_YES ) + { + // Bitmapliste bereinigen + long nCount = aBmpExList.Count(); + long i; + + for( i = nCount - 1; i >= 0; i-- ) + { + pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( i ) ); + delete pBitmapEx; + + pObject = pPage->GetObj( i ); + if( pObject ) + { + pObject = pPage->RemoveObject( i ); + DBG_ASSERT(pObject, "Clone beim Loeschen nicht gefunden"); + SdrObject::Free( pObject ); + //pPage->RecalcObjOrdNums(); + } + + } + aBmpExList.Clear(); + + // Timeliste bereinigen + nCount = aTimeList.Count(); + for( i = 0; i < nCount; i++ ) + { + delete static_cast< Time* >( aTimeList.GetObject( i ) ); + } + aTimeList.Clear(); + } + } + + // kann noch eine Animationsgruppe erstellt werden? + if (aBmpExList.Count() == 0) + { + aBtnCreateGroup.Disable(); + // Falls vorher durch Uebernahme von AnimatedGIFs disabled: + //aRbtBitmap.Enable(); + aRbtGroup.Enable(); + } + + // Zoom fuer DisplayWin berechnen und setzen + Fraction aFrac( GetScale() ); + aCtlDisplay.SetScale( aFrac ); + + UpdateControl( aBmpExList.GetCurPos() ); + + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( AnimationWindow, ClickCreateGroupHdl, void *, EMPTYARG ) +{ + // Code jetzt in CreatePresObj() + SfxBoolItem aItem( SID_ANIMATOR_CREATE, sal_True ); + + GetBindings().GetDispatcher()->Execute( + SID_ANIMATOR_CREATE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L ); + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( AnimationWindow, ModifyBitmapHdl, void *, EMPTYARG ) +{ + sal_uLong nBmp = static_cast<sal_uLong>(aNumFldBitmap.GetValue()); + + if( nBmp > aBmpExList.Count() ) + nBmp = aBmpExList.Count(); + + pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( nBmp - 1 ) ); + + // Positionieren in der Liste + aBmpExList.Seek( nBmp - 1 ); + + UpdateControl( nBmp - 1 ); + + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( AnimationWindow, ModifyTimeHdl, void *, EMPTYARG ) +{ + sal_uLong nPos = static_cast<sal_uLong>(aNumFldBitmap.GetValue() - 1); + + Time* pTime = static_cast< Time* >( aTimeList.GetObject( nPos ) ); + DBG_ASSERT( pTime, "Zeit nicht gefunden!" ); + + *pTime = aTimeField.GetTime(); + + return( 0L ); +} + +// ----------------------------------------------------------------------- + +void AnimationWindow::UpdateControl( sal_uLong nListPos, sal_Bool bDisableCtrls ) +{ + String aString; + + if( pBitmapEx ) + { + BitmapEx aBmp( *pBitmapEx ); + + SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD); + SdrObject* pObject = (SdrObject*) pPage->GetObj( (sal_uLong) nListPos ); + if( pObject ) + { + VirtualDevice aVD; + Rectangle aObjRect( pObject->GetCurrentBoundRect() ); + Size aObjSize( aObjRect.GetSize() ); + Point aOrigin( Point( -aObjRect.Left(), -aObjRect.Top() ) ); + MapMode aMap( aVD.GetMapMode() ); + aMap.SetMapUnit( MAP_100TH_MM ); + aMap.SetOrigin( aOrigin ); + aVD.SetMapMode( aMap ); + aVD.SetOutputSize( aObjSize ); + const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); + aVD.SetBackground( Wallpaper( rStyles.GetFieldColor() ) ); + aVD.SetDrawMode( rStyles.GetHighContrastMode() + ? ViewShell::OUTPUT_DRAWMODE_CONTRAST + : ViewShell::OUTPUT_DRAWMODE_COLOR ); + aVD.Erase(); + pObject->SingleObjectPainter( aVD ); + aBmp = BitmapEx( aVD.GetBitmap( aObjRect.TopLeft(), aObjSize ) ); + } + + + aCtlDisplay.SetBitmapEx( &aBmp ); + } + else + { + aCtlDisplay.SetBitmapEx( pBitmapEx ); + } + aCtlDisplay.Invalidate(); + aCtlDisplay.Update(); + + aFiCount.SetText( UniString::CreateFromInt32( aBmpExList.Count() ) ); + + if( pBitmapEx && !bMovie ) + { + aNumFldBitmap.SetValue( nListPos + 1 ); + + // Wenn mind. 1 Objekt in der Liste ist + aBtnFirst.Enable(); + aBtnReverse.Enable(); + aBtnPlay.Enable(); + aBtnLast.Enable(); + aNumFldBitmap.Enable(); + aTimeField.Enable(); + aLbLoopCount.Enable(); + aBtnRemoveBitmap.Enable(); + aBtnRemoveAll.Enable(); + } + else + { + // Wenn kein Objekt in der Liste ist + aBtnFirst.Enable( sal_False ); + aBtnReverse.Enable( sal_False ); + aBtnPlay.Enable( sal_False ); + aBtnLast.Enable( sal_False ); + aNumFldBitmap.Enable( sal_False ); + aTimeField.Enable( sal_False ); + aLbLoopCount.Enable( sal_False ); + aBtnRemoveBitmap.Enable( sal_False ); + aBtnRemoveAll.Enable( sal_False ); + + //aFtAdjustment.Enable(); + //aLbAdjustment.Enable(); + } + + if( bMovie && bDisableCtrls ) + { + aBtnGetOneObject.Enable( sal_False ); + aBtnGetAllObjects.Enable( sal_False ); + aRbtGroup.Enable( sal_False ); + aRbtBitmap.Enable( sal_False ); + aBtnCreateGroup.Enable( sal_False ); + aFtAdjustment.Enable( sal_False ); + aLbAdjustment.Enable( sal_False ); + } + else + { + // 'Gruppenobjekt' nur dann enablen, wenn es kein Animated GIF ist + if (aBmpExList.Count() == 0) + aRbtGroup.Enable(); + + aRbtBitmap.Enable(); + aBtnCreateGroup.Enable(aBmpExList.Count() != 0); + aFtAdjustment.Enable( sal_True ); + aLbAdjustment.Enable( sal_True ); + } + + ClickRbtHdl( NULL ); +} + +// ----------------------------------------------------------------------- + +void AnimationWindow::ResetAttrs() +{ + aRbtGroup.Check(); + aLbAdjustment.SelectEntryPos( BA_CENTER ); + // LoopCount + aLbLoopCount.SelectEntryPos( aLbLoopCount.GetEntryCount() - 1); + + UpdateControl( 0 ); +} + +// ----------------------------------------------------------------------- + +void AnimationWindow::WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime, + SfxProgress* pProgress ) const +{ + clock_t aEnd = Time::GetSystemTicks() + nMilliSeconds; + clock_t aCurrent = Time::GetSystemTicks(); + while (aCurrent < aEnd) + { + aCurrent = Time::GetSystemTicks(); + + if( pProgress ) + pProgress->SetState( nTime + nMilliSeconds + aCurrent - aEnd ); + + Application::Reschedule(); + + if( !bMovie ) + return; + } +} + +// ----------------------------------------------------------------------- + +Fraction AnimationWindow::GetScale() +{ + Fraction aFrac; + sal_uLong nPos = aBmpExList.GetCurPos(); + sal_uLong nCount = aBmpExList.Count(); + if( nCount > 0 ) + { + aBmpSize.Width() = 0; + aBmpSize.Height() = 0; + for( sal_uLong i = 0; i < nCount; i++ ) + { + pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( i ) ); + Size aTempSize( pBitmapEx->GetBitmap().GetSizePixel() ); + aBmpSize.Width() = Max( aBmpSize.Width(), aTempSize.Width() ); + aBmpSize.Height() = Max( aBmpSize.Height(), aTempSize.Height() ); + } + + aBmpSize.Width() += 10; + aBmpSize.Height() += 10; + + aFrac = Fraction( std::min( (double)aDisplaySize.Width() / (double)aBmpSize.Width(), + (double)aDisplaySize.Height() / (double)aBmpSize.Height() ) ); + } + // Liste wieder auf alten Stand bringen + pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( nPos ) ); + return( aFrac ); +} + +// ----------------------------------------------------------------------- + +void AnimationWindow::Resize() +{ + if ( !IsFloatingMode() || + !GetFloatingWindow()->IsRollUp() ) + { + Size aWinSize( GetOutputSizePixel() ); // vorher rSize im Resizing() + + Size aDiffSize; + aDiffSize.Width() = aWinSize.Width() - aSize.Width(); + aDiffSize.Height() = aWinSize.Height() - aSize.Height(); + + // Umgroessern des Display-Controls + aDisplaySize.Width() += aDiffSize.Width(); + aDisplaySize.Height() += aDiffSize.Height(); + aCtlDisplay.SetOutputSizePixel( aDisplaySize ); + + Point aPt; + aPt.Y() = aDiffSize.Height(); + + // Verschieben der anderen Controls + aBtnFirst.Hide(); + aBtnReverse.Hide(); + aBtnStop.Hide(); + aBtnPlay.Hide(); + aBtnLast.Hide(); + aTimeField.Hide(); + aLbLoopCount.Hide(); + aNumFldBitmap.Hide(); + aFtCount.Hide(); + aFiCount.Hide(); + aBtnGetOneObject.Hide(); + aBtnGetAllObjects.Hide(); + aBtnRemoveBitmap.Hide(); + aBtnRemoveAll.Hide(); + aGrpBitmap.Hide(); + aRbtGroup.Hide(); + aRbtBitmap.Hide(); + aFtAdjustment.Hide(); + aLbAdjustment.Hide(); + aBtnCreateGroup.Hide(); + aGrpAnimation.Hide(); + + + aBtnFirst.SetPosPixel( aBtnFirst.GetPosPixel() + aPt ); + aBtnReverse.SetPosPixel( aBtnReverse.GetPosPixel() + aPt ); + aBtnStop.SetPosPixel( aBtnStop.GetPosPixel() + aPt ); + aBtnPlay.SetPosPixel( aBtnPlay.GetPosPixel() + aPt ); + aBtnLast.SetPosPixel( aBtnLast.GetPosPixel() + aPt ); + aNumFldBitmap.SetPosPixel( aNumFldBitmap.GetPosPixel() + aPt ); + aTimeField.SetPosPixel( aTimeField.GetPosPixel() + aPt ); + aLbLoopCount.SetPosPixel( aLbLoopCount.GetPosPixel() + aPt ); + aFtCount.SetPosPixel( aFtCount.GetPosPixel() + aPt ); + aFiCount.SetPosPixel( aFiCount.GetPosPixel() + aPt ); + aRbtGroup.SetPosPixel( aRbtGroup.GetPosPixel() + aPt ); + aRbtBitmap.SetPosPixel( aRbtBitmap.GetPosPixel() + aPt ); + aFtAdjustment.SetPosPixel( aFtAdjustment.GetPosPixel() + aPt ); + aLbAdjustment.SetPosPixel( aLbAdjustment.GetPosPixel() + aPt ); + aBtnGetOneObject.SetPosPixel( aBtnGetOneObject.GetPosPixel() + aPt ); + aBtnGetAllObjects.SetPosPixel( aBtnGetAllObjects.GetPosPixel() + aPt ); + aBtnRemoveBitmap.SetPosPixel( aBtnRemoveBitmap.GetPosPixel() + aPt ); + aBtnRemoveAll.SetPosPixel( aBtnRemoveAll.GetPosPixel() + aPt ); + aBtnCreateGroup.SetPosPixel( aBtnCreateGroup.GetPosPixel() + aPt ); + aGrpBitmap.SetPosPixel( aGrpBitmap.GetPosPixel() + aPt ); + aGrpAnimation.SetPosPixel( aGrpAnimation.GetPosPixel() + aPt ); + + // Zoom fuer DisplayWin berechnen und setzen + Fraction aFrac( GetScale() ); + aCtlDisplay.SetScale( aFrac ); + + aBtnFirst.Show(); + aBtnReverse.Show(); + aBtnStop.Show(); + aBtnPlay.Show(); + aBtnLast.Show(); + aNumFldBitmap.Show(); + aTimeField.Show(); + aLbLoopCount.Show(); + aFtCount.Show(); + aFiCount.Show(); + aFtAdjustment.Show(); + aLbAdjustment.Show(); + aBtnGetOneObject.Show(); + aBtnGetAllObjects.Show(); + aBtnRemoveBitmap.Show(); + aBtnRemoveAll.Show(); + aGrpBitmap.Show(); + aRbtGroup.Show(); + aRbtBitmap.Show(); + aFtAdjustment.Show(); + aLbAdjustment.Show(); + aBtnCreateGroup.Show(); + aGrpAnimation.Show(); + + aSize = aWinSize; + } + SfxDockingWindow::Resize(); +} + +// ----------------------------------------------------------------------- + +sal_Bool AnimationWindow::Close() +{ + if( maPlayLock.isLocked() ) + { + return sal_False; + } + else + { + SfxBoolItem aItem( SID_ANIMATION_OBJECTS, sal_False ); + + GetBindings().GetDispatcher()->Execute( + SID_ANIMATION_OBJECTS, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); + + SfxDockingWindow::Close(); + + return sal_True; + } +} + +// ----------------------------------------------------------------------- + +void AnimationWindow::FillInfo( SfxChildWinInfo& rInfo ) const +{ + SfxDockingWindow::FillInfo( rInfo ) ; +} + +// ----------------------------------------------------------------------- + +void AnimationWindow::AddObj (::sd::View& rView ) +{ + // Texteingabemodus beenden, damit Bitmap mit + // Objekt identisch ist. + if( rView.IsTextEdit() ) + rView.SdrEndTextEdit(); + + // Objekt(e) clonen und den/die Clone(s) in die Liste stellen + const SdrMarkList& rMarkList = rView.GetMarkedObjectList(); + sal_uLong nMarkCount = rMarkList.GetMarkCount(); + SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD); + sal_uLong nCloneCount = pPage->GetObjCount(); + + if (nMarkCount > 0) + { + // Wenn es sich um EIN Animationsobjekt oder ein Gruppenobjekt + // handelt, das 'einzeln uebernommen' wurde, + // werden die einzelnen Objekte eingefuegt + sal_Bool bAnimObj = sal_False; + if( nMarkCount == 1 ) + { + SdrMark* pMark = rMarkList.GetMark(0); + SdrObject* pObject = pMark->GetMarkedSdrObj(); + SdAnimationInfo* pAnimInfo = rView.GetDoc()->GetAnimationInfo( pObject ); + sal_uInt32 nInv = pObject->GetObjInventor(); + sal_uInt16 nId = pObject->GetObjIdentifier(); + + // Animated Bitmap (GIF) + if( nInv == SdrInventor && nId == OBJ_GRAF && ( (SdrGrafObj*) pObject )->IsAnimated() ) + { + const SdrGrafObj* pGrafObj = (SdrGrafObj*) pObject; + Graphic aGraphic( pGrafObj->GetTransformedGraphic() ); + sal_uInt16 nCount = 0; + + if( aGraphic.IsAnimated() ) + nCount = aGraphic.GetAnimation().Count(); + + if( nCount > 0 ) + { + const Animation aAnimation( aGraphic.GetAnimation() ); + + for( sal_uInt16 i = 0; i < nCount; i++ ) + { + const AnimationBitmap& rAnimBmp = aAnimation.Get( i ); + + pBitmapEx = new BitmapEx( rAnimBmp.aBmpEx ); + aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 ); + + // LoopCount + if( i == 0 ) + { + long nLoopCount = aAnimation.GetLoopCount(); + + if( !nLoopCount ) // unendlich + aLbLoopCount.SelectEntryPos( aLbLoopCount.GetEntryCount() - 1); + else + aLbLoopCount.SelectEntry( UniString::CreateFromInt32( nLoopCount ) ); + } + + // Time + long nTime = rAnimBmp.nWait; + Time* pTime = new Time( 0, 0, nTime / 100, nTime % 100 ); + aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 ); + + // Weiterschalten der BitmapListe + aBmpExList.Next(); + } + // Nachdem ein animated GIF uebernommen wurde, kann auch nur ein solches erstellt werden + aRbtBitmap.Check(); + aRbtGroup.Enable( sal_False ); + bAnimObj = sal_True; + } + } + else if( bAllObjects || ( pAnimInfo && pAnimInfo->mbIsMovie ) ) + { + // Mehrere Objekte + SdrObjList* pObjList = ((SdrObjGroup*)pObject)->GetSubList(); + + for( sal_uInt16 nObject = 0; nObject < pObjList->GetObjCount(); nObject++ ) + { + SdrObject* pSnapShot = (SdrObject*) pObjList->GetObj( (sal_uLong) nObject ); + + pBitmapEx = new BitmapEx( SdrExchangeView::GetObjGraphic( pSnapShot->GetModel(), pSnapShot ).GetBitmapEx() ); + aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 ); + + // Time + Time* pTime = new Time( aTimeField.GetTime() ); + aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 ); + + // Clone + pPage->InsertObject( pSnapShot->Clone(), aBmpExList.GetCurPos() + 1 ); + + // Weiterschalten der BitmapListe + aBmpExList.Next(); + } + bAnimObj = sal_True; + } + } + // Auch ein einzelnes animiertes Objekt + if( !bAnimObj && !( bAllObjects && nMarkCount > 1 ) ) + { + pBitmapEx = new BitmapEx( rView.GetAllMarkedGraphic().GetBitmapEx() ); + aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 ); + + // Time + Time* pTime = new Time( aTimeField.GetTime() ); + aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 ); + + } + + // ein einzelnes Objekt + if( nMarkCount == 1 && !bAnimObj ) + { + SdrMark* pMark = rMarkList.GetMark(0); + SdrObject* pObject = pMark->GetMarkedSdrObj(); + SdrObject* pClone = pObject->Clone(); + pPage->InsertObject(pClone, aBmpExList.GetCurPos() + 1); + } + // mehrere Objekte: die Clones zu einer Gruppe zusammenfassen + else if (nMarkCount > 1) + { + // Objekte einzeln uebernehmen + if( bAllObjects ) + { + for( sal_uLong nObject= 0; nObject < nMarkCount; nObject++ ) + { + // Clone + SdrObject* pObject = rMarkList.GetMark( nObject )->GetMarkedSdrObj(); + + pBitmapEx = new BitmapEx( SdrExchangeView::GetObjGraphic( pObject->GetModel(), pObject ).GetBitmapEx() ); + aBmpExList.Insert( pBitmapEx, aBmpExList.GetCurPos() + 1 ); + + // Time + Time* pTime = new Time( aTimeField.GetTime() ); + aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 ); + + pPage->InsertObject( pObject->Clone(), aBmpExList.GetCurPos() + 1 ); + + aBmpExList.Next(); + } + bAnimObj = sal_True; // damit nicht nochmal weitergeschaltet wird + } + else + { + SdrObjGroup* pCloneGroup = new SdrObjGroup; + SdrObjList* pObjList = pCloneGroup->GetSubList(); + + for (sal_uLong nObject= 0; nObject < nMarkCount; nObject++) + pObjList->InsertObject(rMarkList.GetMark(nObject)->GetMarkedSdrObj()->Clone(), LIST_APPEND); + + pPage->InsertObject(pCloneGroup, aBmpExList.GetCurPos() + 1); + } + } + + if( !bAnimObj ) + aBmpExList.Next(); + + // wenn vorher nichts im Animator war und jetzt was da ist, kann eine + // Animationsgruppe erstellt werden + if (nCloneCount == 0 && aBmpExList.Count() > 0) + aBtnCreateGroup.Enable(); + + // Zoom fuer DisplayWin berechnen und setzen + Fraction aFrac( GetScale() ); + aCtlDisplay.SetScale( aFrac ); + + UpdateControl( aBmpExList.GetCurPos() ); + } +} + +// ----------------------------------------------------------------------- + +void AnimationWindow::CreateAnimObj (::sd::View& rView ) +{ + ::Window* pOutWin = static_cast< ::Window*>(rView.GetFirstOutputDevice()); // GetWin( 0 ); + DBG_ASSERT( pOutWin, "Window ist nicht vorhanden!" ); + + // die Fentermitte ermitteln + const MapMode aMap100( MAP_100TH_MM ); + Size aMaxSizeLog; + Size aMaxSizePix; + Size aTemp( pOutWin->GetOutputSizePixel() ); + const Point aWindowCenter( pOutWin->PixelToLogic( Point( aTemp.Width() >> 1, aTemp.Height() >> 1 ) ) ); + const OutputDevice* pDefDev = Application::GetDefaultDevice(); + const sal_uLong nCount = aBmpExList.Count(); + BitmapAdjustment eBA = (BitmapAdjustment) aLbAdjustment.GetSelectEntryPos(); + sal_uLong i; + + // Groesste Bitmap ermitteln + for( i = 0; i < nCount; i++ ) + { + const BitmapEx& rBmpEx = *static_cast< BitmapEx* >( aBmpExList.GetObject( i ) ); + const Graphic aGraphic( rBmpEx ); + Size aTmpSizeLog; + const Size aTmpSizePix( rBmpEx.GetSizePixel() ); + + if ( aGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL ) + aTmpSizeLog = pDefDev->PixelToLogic( aGraphic.GetPrefSize(), aMap100 ); + else + aTmpSizeLog = pDefDev->LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 ); + + aMaxSizeLog.Width() = Max( aMaxSizeLog.Width(), aTmpSizeLog.Width() ); + aMaxSizeLog.Height() = Max( aMaxSizeLog.Height(), aTmpSizeLog.Height() ); + + aMaxSizePix.Width() = Max( aMaxSizePix.Width(), aTmpSizePix.Width() ); + aMaxSizePix.Height() = Max( aMaxSizePix.Height(), aTmpSizePix.Height() ); + } + + SdrPageView* pPV = rView.GetSdrPageView(); + + if( aRbtBitmap.IsChecked() ) + { + // Bitmapgruppe erzeugen (Animated GIF) + Animation aAnimation; + Point aPt; + + for( i = 0; i < nCount; i++ ) + { + Time* pTime = static_cast< Time* >( aTimeList.GetObject( i ) ); + long nTime = pTime->Get100Sec(); + nTime += pTime->GetSec() * 100; + + pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetObject( i ) ); + + // Offset fuer die gewuenschte Ausrichtung bestimmen + const Size aBitmapSize( pBitmapEx->GetSizePixel() ); + + switch( eBA ) + { + case BA_LEFT_UP: + break; + + case BA_LEFT: + aPt.Y() = (aMaxSizePix.Height() - aBitmapSize.Height()) >> 1; + break; + + case BA_LEFT_DOWN: + aPt.Y() = aMaxSizePix.Height() - aBitmapSize.Height(); + break; + + case BA_UP: + aPt.X() = (aMaxSizePix.Width() - aBitmapSize.Width()) >> 1; + break; + + case BA_CENTER: + aPt.X() = (aMaxSizePix.Width() - aBitmapSize.Width()) >> 1; + aPt.Y() = (aMaxSizePix.Height() - aBitmapSize.Height()) >> 1; + break; + + case BA_DOWN: + aPt.X() = (aMaxSizePix.Width() - aBitmapSize.Width()) >> 1; + aPt.Y() = aMaxSizePix.Height() - aBitmapSize.Height(); + break; + + case BA_RIGHT_UP: + aPt.X() = aMaxSizePix.Width() - aBitmapSize.Width(); + break; + + case BA_RIGHT: + aPt.X() = aMaxSizePix.Width() - aBitmapSize.Width(); + aPt.Y() = (aMaxSizePix.Height() - aBitmapSize.Height()) >> 1; + break; + + case BA_RIGHT_DOWN: + aPt.X() = aMaxSizePix.Width() - aBitmapSize.Width(); + aPt.Y() = aMaxSizePix.Height() - aBitmapSize.Height(); + break; + + } + + // LoopCount (Anzahl der Durchlaeufe) ermitteln + AnimationBitmap aAnimBmp; + long nLoopCount = 0L; + sal_uInt16 nPos = aLbLoopCount.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != aLbLoopCount.GetEntryCount() - 1 ) // unendlich + nLoopCount = (long) aLbLoopCount.GetSelectEntry().ToInt32(); + + aAnimBmp.aBmpEx = *pBitmapEx; + aAnimBmp.aPosPix = aPt; + aAnimBmp.aSizePix = aBitmapSize; + aAnimBmp.nWait = nTime; + aAnimBmp.eDisposal = DISPOSE_BACK; + aAnimBmp.bUserInput = sal_False; + + aAnimation.Insert( aAnimBmp ); + aAnimation.SetDisplaySizePixel( aMaxSizePix ); + aAnimation.SetLoopCount( nLoopCount ); + } + + SdrGrafObj* pGrafObj = new SdrGrafObj( Graphic( aAnimation ) ); + const Point aOrg( aWindowCenter.X() - ( aMaxSizeLog.Width() >> 1 ), aWindowCenter.Y() - ( aMaxSizeLog.Height() >> 1 ) ); + + pGrafObj->SetLogicRect( Rectangle( aOrg, aMaxSizeLog ) ); + rView.InsertObjectAtView( pGrafObj, *pPV, SDRINSERT_SETDEFLAYER); + } + else + { + // Offset fuer die gewuenschte Ausrichtung bestimmen + Size aOffset; + SdrObject * pClone = NULL; + SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD); + + for(i = 0; i < nCount; i++) + { + pClone = pPage->GetObj(i); + Rectangle aRect( pClone->GetSnapRect() ); + + switch( eBA ) + { + case BA_LEFT_UP: + break; + + case BA_LEFT: + aOffset.Height() = (aMaxSizeLog.Height() - aRect.GetHeight()) / 2; + break; + + case BA_LEFT_DOWN: + aOffset.Height() = aMaxSizeLog.Height() - aRect.GetHeight(); + break; + + case BA_UP: + aOffset.Width() = (aMaxSizeLog.Width() - aRect.GetWidth()) / 2; + break; + + case BA_CENTER: + aOffset.Width() = (aMaxSizeLog.Width() - aRect.GetWidth()) / 2; + aOffset.Height() = (aMaxSizeLog.Height() - aRect.GetHeight()) / 2; + break; + + case BA_DOWN: + aOffset.Width() = (aMaxSizeLog.Width() - aRect.GetWidth()) / 2; + aOffset.Height() = aMaxSizeLog.Height() - aRect.GetHeight(); + break; + + case BA_RIGHT_UP: + aOffset.Width() = aMaxSizeLog.Width() - aRect.GetWidth(); + break; + + case BA_RIGHT: + aOffset.Width() = aMaxSizeLog.Width() - aRect.GetWidth(); + aOffset.Height() = (aMaxSizeLog.Height() - aRect.GetHeight()) / 2; + break; + + case BA_RIGHT_DOWN: + aOffset.Width() = aMaxSizeLog.Width() - aRect.GetWidth(); + aOffset.Height() = aMaxSizeLog.Height() - aRect.GetHeight(); + break; + + } + // SetSnapRect ist fuer Ellipsen leider nicht implementiert !!! + Point aMovePt( aWindowCenter + Point( aOffset.Width(), aOffset.Height() ) - aRect.TopLeft() ); + Size aMoveSize( aMovePt.X(), aMovePt.Y() ); + pClone->NbcMove( aMoveSize ); + } + + // Animationsgruppe erzeugen + SdrObjGroup* pGroup = new SdrObjGroup; + SdrObjList* pObjList = pGroup->GetSubList(); + + for (i = 0; i < nCount; i++) + { + // der Clone verbleibt im Animator; in die Gruppe kommt ein Clone + // des Clones + pClone = pPage->GetObj(i); + SdrObject* pCloneOfClone = pClone->Clone(); + //SdrObject* pCloneOfClone = pPage->GetObj(i)->Clone(); + pObjList->InsertObject(pCloneOfClone, LIST_APPEND); + } + + // bis jetzt liegt die linke obere Ecke der Gruppe in der Fenstermitte; + // jetzt noch um die Haelfte der Groesse nach oben und links korrigieren + aTemp = aMaxSizeLog; + aTemp.Height() = - aTemp.Height() / 2; + aTemp.Width() = - aTemp.Width() / 2; + pGroup->NbcMove(aTemp); + + // Animationsinformation erzeugen + SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pGroup,true); + pInfo->meEffect = presentation::AnimationEffect_NONE; + pInfo->meSpeed = presentation::AnimationSpeed_MEDIUM; + pInfo->mbActive = sal_True; + pInfo->mbIsMovie = sal_True; + pInfo->maBlueScreen = COL_WHITE; + + rView.InsertObjectAtView( pGroup, *pPV, SDRINSERT_SETDEFLAYER); + } + + ClickFirstHdl( this ); +} + +void AnimationWindow::DataChanged( const DataChangedEvent& rDCEvt ) +{ + SfxDockingWindow::DataChanged( rDCEvt ); + + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + UpdateControl( aBmpExList.GetCurPos() ); + } +} + +/************************************************************************* +|* +|* ControllerItem fuer Animator +|* +\************************************************************************/ + +AnimationControllerItem::AnimationControllerItem( + sal_uInt16 _nId, + AnimationWindow* pAnimWin, + SfxBindings* _pBindings) + : SfxControllerItem( _nId, *_pBindings ), + pAnimationWin( pAnimWin ) +{ +} + +// ----------------------------------------------------------------------- + +void AnimationControllerItem::StateChanged( sal_uInt16 nSId, + SfxItemState eState, const SfxPoolItem* pItem ) +{ + if( eState >= SFX_ITEM_AVAILABLE && nSId == SID_ANIMATOR_STATE ) + { + const SfxUInt16Item* pStateItem = PTR_CAST( SfxUInt16Item, pItem ); + DBG_ASSERT( pStateItem, "SfxUInt16Item erwartet"); + sal_uInt16 nState = pStateItem->GetValue(); + + pAnimationWin->aBtnGetOneObject.Enable( nState & 1 ); + pAnimationWin->aBtnGetAllObjects.Enable( nState & 2 ); + } +} + + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/animobjs.src b/sd/source/ui/dlg/animobjs.src new file mode 100644 index 000000000000..75e2e74f8858 --- /dev/null +++ b/sd/source/ui/dlg/animobjs.src @@ -0,0 +1,372 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "res_bmp.hrc" +#include "app.hrc" +#include "animobjs.hrc" +#include "helpids.h" + +#define BUTTON_WIDTH 16 +#define BUTTON_HEIGHT 14 +#define BUTTON_SIZE MAP_APPFONT( BUTTON_WIDTH, BUTTON_HEIGHT ); +#define MIN_BUTTON_WIDTH 12 +#define MIN_BUTTON_HEIGHT 12 +#define MIN_BUTTON_SIZE MAP_APPFONT( MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT ); +DockingWindow FLT_WIN_ANIMATION +{ + HelpID = CMD_SID_ANIMATION_OBJECTS ; + Border = TRUE ; + Hide = TRUE ; + SVLook = TRUE ; + Sizeable = TRUE ; + Moveable = TRUE ; + Closeable = TRUE ; + Zoomable = TRUE ; + Dockable = TRUE ; + EnableResizing = TRUE ; + Size = MAP_APPFONT ( 159 , 236 ) ; + Text [ en-US ] = "Animation" ; + Control CTL_DISPLAY + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 147 , 87 ) ; + TabStop = TRUE ; + }; + ImageButton BTN_FIRST + { + HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_FIRST"; + Pos = MAP_APPFONT ( 6 , 100 ) ; + Size = MIN_BUTTON_SIZE + Symbol = IMAGEBUTTON_WINDSTART ; + QuickHelpText [ en-US ] = "First Image" ; + }; + ImageButton BTN_REVERSE + { + HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_REVERSE"; + Pos = MAP_APPFONT ( 6 + MIN_BUTTON_WIDTH , 100 ) ; + Size = MIN_BUTTON_SIZE + Symbol = IMAGEBUTTON_REVERSEPLAY ; + QuickHelpText [ en-US ] = "Backwards" ; + }; + ImageButton BTN_STOP + { + HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_STOP"; + Pos = MAP_APPFONT ( 6 + MIN_BUTTON_WIDTH * 2 , 100 ) ; + Size = MIN_BUTTON_SIZE + Symbol = IMAGEBUTTON_STOP ; + Disable = TRUE ; + QuickHelpText [ en-US ] = "Stop" ; + }; + ImageButton BTN_PLAY + { + HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_PLAY"; + Pos = MAP_APPFONT ( 6 + MIN_BUTTON_WIDTH * 3 , 100 ) ; + Size = MIN_BUTTON_SIZE + Symbol = IMAGEBUTTON_PLAY ; + QuickHelpText [ en-US ] = "Play" ; + }; + ImageButton BTN_LAST + { + HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_LAST"; + Pos = MAP_APPFONT ( 6 + MIN_BUTTON_WIDTH * 4 , 100 ) ; + Size = MIN_BUTTON_SIZE + Symbol = IMAGEBUTTON_WINDEND ; + QuickHelpText [ en-US ] = "Last Image" ; + }; + NumericField NUM_FLD_BITMAP + { + HelpID = "sd:NumericField:FLT_WIN_ANIMATION:NUM_FLD_BITMAP"; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 + 3 + MIN_BUTTON_WIDTH * 5 , 100 ) ; + Size = MAP_APPFONT ( MIN_BUTTON_WIDTH * 2 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 999 ; + StrictFormat = TRUE ; + First = 1 ; + Last = 999 ; + SpinSize = 1 ; + QuickHelpText [ en-US ] = "Image Number" ; + }; + TimeField TIME_FIELD + { + HelpID = "sd:TimeField:FLT_WIN_ANIMATION:TIME_FIELD"; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 + 6 + MIN_BUTTON_WIDTH * 7 , 100 ) ; + Size = MAP_APPFONT ( MIN_BUTTON_WIDTH * 2 + 3 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = Time + { + Second = 59 ; + Sec100 = 99 ; + }; + Duration = TRUE ; + StrictFormat = TRUE ; + Last = Time + { + Second = 59 ; + Sec100 = 99 ; + }; + QuickHelpText [ en-US ] = "Duration" ; + }; + ListBox LB_LOOP_COUNT + { + HelpID = "sd:ListBox:FLT_WIN_ANIMATION:LB_LOOP_COUNT"; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 + 12 + MIN_BUTTON_WIDTH * 9 , 100 ) ; + Size = MAP_APPFONT ( MIN_BUTTON_WIDTH * 2 + 3 , 100 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "1" ; > ; + < "2" ; > ; + < "3" ; > ; + < "4" ; > ; + < "5" ; > ; + < "6" ; > ; + < "7" ; > ; + < "8" ; > ; + < "9" ; > ; + < "10" ; > ; + < "12" ; > ; + < "15" ; > ; + < "20" ; > ; + < "25" ; > ; + < "50" ; > ; + < "100" ; > ; + < "500" ; > ; + < "1000" ; > ; + < "Max." ; > ; + }; + QuickHelpText [ en-US ] = "Loop Count" ; + }; + ImageButton BTN_GET_ONE_OBJECT + { + HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_GET_ONE_OBJECT"; + Pos = MAP_APPFONT ( 12 , 132 ) ; + Size = MAP_APPFONT ( 16 , 14 ) ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "get1obj.bmp" ; + }; + MaskColor = IMAGE_MASK_STDCOLOR; + }; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Apply Object" ; + }; + ImageButton BTN_GET_ALL_OBJECTS + { + HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_GET_ALL_OBJECTS"; + Pos = MAP_APPFONT ( 31 , 132 ) ; + Size = MAP_APPFONT ( 16 , 14 ) ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "getallob.bmp" ; + }; + MaskColor = IMAGE_MASK_STDCOLOR; + }; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Apply Objects Individually" ; + }; + ImageButton BTN_REMOVE_BITMAP + { + HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_REMOVE_BITMAP"; + Pos = MAP_APPFONT ( 60 , 132 ) ; + Size = MAP_APPFONT ( 16 , 14 ) ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "del1bmp.bmp" ; + }; + MaskColor = IMAGE_MASK_STDCOLOR; + }; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Delete Current Image" ; + }; + ImageButton BTN_REMOVE_ALL + { + HelpID = "sd:ImageButton:FLT_WIN_ANIMATION:BTN_REMOVE_ALL"; + Pos = MAP_APPFONT ( 79 , 132 ) ; + Size = MAP_APPFONT ( 16 , 14 ) ; + ButtonImage = Image + { + ImageBitmap = Bitmap + { + File = "delall.bmp" ; + }; + MaskColor = IMAGE_MASK_STDCOLOR; + }; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Delete All Images" ; + }; + FixedText FT_COUNT + { + Pos = MAP_APPFONT ( 106 , 135 ) ; + Size = MAP_APPFONT ( 26 , 10 ) ; + Text [ en-US ] = "Number" ; + }; + FixedText FI_COUNT + { + Pos = MAP_APPFONT ( 133 , 135 ) ; + Size = MAP_APPFONT ( 15 , 10 ) ; + DeltaLang [ de ]= < Default ; Default ; Default ; Default ; > ; + DeltaLang [ en-US ] = < 2 ; Default ; Default ; Default ; > ; + Text = "67" ; + }; + FixedLine GRP_BITMAP + { + Pos = MAP_APPFONT ( 6 , 120 ) ; + Size = MAP_APPFONT ( 147 , 8 ) ; + Text [ en-US ] = "Image" ; + }; + RadioButton RBT_GROUP + { + HelpID = "sd:RadioButton:FLT_WIN_ANIMATION:RBT_GROUP"; + Pos = MAP_APPFONT ( 12 , 167 ) ; + Size = MAP_APPFONT ( 140 , 12 ) ; + Text [ en-US ] = "Group object" ; + }; + RadioButton RBT_BITMAP + { + HelpID = "sd:RadioButton:FLT_WIN_ANIMATION:RBT_BITMAP"; + Pos = MAP_APPFONT ( 12 , 181 ) ; + Size = MAP_APPFONT ( 140 , 12 ) ; + Text [ en-US ] = "Bitmap object" ; + }; + FixedText FT_ADJUSTMENT + { + Pos = MAP_APPFONT ( 12 , 198 ) ; + Size = MAP_APPFONT ( 62 , 10 ) ; + DeltaLang [ de ] = < Default ; Default ; Default ; Default ; > ; + DeltaLang [ en-US ] = < -1 ; Default ; -2 ; Default ; > ; + Text [ en-US ] = "Alignment" ; + }; + ListBox LB_ADJUSTMENT + { + HelpID = "sd:ListBox:FLT_WIN_ANIMATION:LB_ADJUSTMENT"; + Border = TRUE ; + Pos = MAP_APPFONT ( 75 , 196 ) ; + Size = MAP_APPFONT ( 72 , 100 ) ; + DeltaLang [ de ] = < Default ; Default ; Default ; Default ; > ; + DeltaLang [ en-US ] = < -1 ; Default ; Default ; Default ; > ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Top Left" ; Default ; > ; + < "Left" ; Default ; > ; + < "Bottom Left" ; Default ; > ; + < "Top" ; Default ; > ; + < "Centered" ; Default ; > ; + < "Bottom" ; Default ; > ; + < "Top Right" ; Default ; > ; + < "Right" ; Default ; > ; + < "Bottom Right" ; Default ; > ; + }; + }; + PushButton BTN_CREATE_GROUP + { + HelpID = "sd:PushButton:FLT_WIN_ANIMATION:BTN_CREATE_GROUP"; + Pos = MAP_APPFONT ( 107 , 216 ) ; + Size = MAP_APPFONT ( 41 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Create" ; + }; + FixedLine GRP_ANIMATION_GROUP + { + Pos = MAP_APPFONT ( 6 , 155 ) ; + Size = MAP_APPFONT ( 147 , 8 ) ; + Text [ en-US ] = "Animation group" ; + }; + String STR_DISPLAY + { + Text [ en-US ] = "Preview"; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/assclass.cxx b/sd/source/ui/dlg/assclass.cxx new file mode 100644 index 000000000000..a299d39aba0e --- /dev/null +++ b/sd/source/ui/dlg/assclass.cxx @@ -0,0 +1,190 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include <tools/debug.hxx> +#include <vcl/ctrl.hxx> + +#include "assclass.hxx" + +Assistent::Assistent(int nNoOfPages) + : mnPages(nNoOfPages), mnCurrentPage(1) +{ + if(mnPages > MAX_PAGES) + mnPages = MAX_PAGES; + + mpPageStatus.reset(new bool[mnPages]); + + for(int i=0; i < mnPages; ++i) + mpPageStatus[i] = true; +} + +bool Assistent::InsertControl(int nDestPage,Control* pUsedControl) +{ + DBG_ASSERT( (nDestPage > 0) && (nDestPage <= mnPages), "Seite nicht vorhanden!"); + + if((nDestPage>0)&&(nDestPage<=mnPages)) + { + maPages[nDestPage-1].push_back(pUsedControl); + pUsedControl->Hide(); + pUsedControl->Disable(); + return true; + } + + return false; +} + +bool Assistent::NextPage() +{ + if(mnCurrentPage<mnPages) + { + int nPage = mnCurrentPage+1; + while(nPage <= mnPages && !mpPageStatus[nPage-1]) + nPage++; + + if(nPage <= mnPages) + return GotoPage(nPage); + } + + return false; +} + + +bool Assistent::PreviousPage() +{ + if(mnCurrentPage>1) + { + int nPage = mnCurrentPage-1; + while(nPage >= 0 && !mpPageStatus[nPage-1]) + nPage--; + + if(nPage >= 0) + return GotoPage(nPage); + } + return false; +} + + +bool Assistent::GotoPage(const int nPageToGo) +{ + DBG_ASSERT( (nPageToGo > 0) && (nPageToGo <= mnPages), "Seite nicht vorhanden!"); + + if((nPageToGo>0)&&(nPageToGo<=mnPages)&&mpPageStatus[nPageToGo-1]) + { + int nIndex=mnCurrentPage-1; + + std::vector<Control*>::iterator iter = maPages[nIndex].begin(); + std::vector<Control*>::iterator iterEnd = maPages[nIndex].end(); + + for(; iter != iterEnd; ++iter) + { + (*iter)->Disable(); + (*iter)->Hide(); + } + + mnCurrentPage=nPageToGo; + nIndex=mnCurrentPage-1; + + iter = maPages[nIndex].begin(); + iterEnd = maPages[nIndex].end(); + + for(; iter != iterEnd; ++iter) + { + (*iter)->Enable(); + (*iter)->Show(); + } + + return true; + } + + return false; +} + + +bool Assistent::IsLastPage() const +{ + if(mnCurrentPage == mnPages) + return true; + + int nPage = mnCurrentPage+1; + while(nPage <= mnPages && !mpPageStatus[nPage-1]) + nPage++; + + return nPage > mnPages; +} + + +bool Assistent::IsFirstPage() const +{ + if(mnCurrentPage == 1) + return true; + + int nPage = mnCurrentPage-1; + while(nPage > 0 && !mpPageStatus[nPage-1]) + nPage--; + + return nPage == 0; +} + +int Assistent::GetCurrentPage() const +{ + return mnCurrentPage; +} + +bool Assistent::IsEnabled( int nPage ) const +{ + DBG_ASSERT( (nPage>0) && (nPage <= mnPages), "Seite nicht vorhanden!" ); + + return (nPage>0) && (nPage <= mnPages && mpPageStatus[nPage-1]); +} + +void Assistent::EnablePage( int nPage ) +{ + DBG_ASSERT( (nPage>0) && (nPage <= mnPages), "Seite nicht vorhanden!" ); + + if((nPage>0) && (nPage < mnPages && !mpPageStatus[nPage-1])) + { + mpPageStatus[nPage-1] = true; + } +} + +void Assistent::DisablePage( int nPage ) +{ + DBG_ASSERT( (nPage>0) && (nPage <= mnPages), "Seite nicht vorhanden!" ); + + if((nPage>0) && (nPage <= mnPages && mpPageStatus[nPage-1])) + { + mpPageStatus[nPage-1] = false; + if(mnCurrentPage == nPage) + GotoPage(1); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/brkdlg.cxx b/sd/source/ui/dlg/brkdlg.cxx new file mode 100644 index 000000000000..6d3bf4c0ed0c --- /dev/null +++ b/sd/source/ui/dlg/brkdlg.cxx @@ -0,0 +1,190 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include "BreakDlg.hxx" +#include <sfx2/progress.hxx> + +#include <svx/svdedtv.hxx> +#include <svx/svdetc.hxx> +#include <sfx2/app.hxx> +#include <vcl/msgbox.hxx> + +#include "sdattr.hxx" +#include "brkdlg.hrc" +#include "sdresid.hxx" +#include "View.hxx" +#include "drawview.hxx" +#include "strings.hrc" +#include "DrawDocShell.hxx" + +namespace sd { + +/************************************************************************* +|* +|* Dialog zum aufbrechen von Metafiles +|* +\************************************************************************/ + +BreakDlg::BreakDlg( + ::Window* pWindow, + DrawView* _pDrView, + DrawDocShell* pShell, + sal_uLong nSumActionCount, + sal_uLong nObjCount ) + : SfxModalDialog ( pWindow, SdResId( DLG_BREAK ) ), + aFtObjInfo ( this, SdResId( FT_OBJ_INFO ) ), + aFtActInfo ( this, SdResId( FT_ACT_INFO ) ), + aFtInsInfo ( this, SdResId( FT_INS_INFO ) ), + aFiObjInfo ( this, SdResId( FI_OBJ_INFO ) ), + aFiActInfo ( this, SdResId( FI_ACT_INFO ) ), + aFiInsInfo ( this, SdResId( FI_INS_INFO ) ), + aBtnCancel ( this, SdResId( BTN_CANCEL ) ), + aLink ( LINK( this, BreakDlg, UpDate)), + mpProgress ( NULL ) +{ + aBtnCancel.SetClickHdl( LINK( this, BreakDlg, CancelButtonHdl)); + + mpProgress = new SfxProgress( pShell, String(SdResId(STR_BREAK_METAFILE)), nSumActionCount*3 ); + + pProgrInfo = new SvdProgressInfo( &aLink ); + // jede Action wird in DoImport() 3mal bearbeitet + pProgrInfo->Init( nSumActionCount*3, nObjCount ); + + pDrView = _pDrView; + bCancel = sal_False; + + FreeResource(); +} + +BreakDlg::~BreakDlg() +{ + if( mpProgress ) + delete mpProgress; + + if( pProgrInfo ) + delete pProgrInfo; +} + +// Control-Handler fuer den Abbruch Button +IMPL_LINK( BreakDlg, CancelButtonHdl, void *, EMPTYARG ) +{ + bCancel = sal_True; + aBtnCancel.Disable(); + return( 0L ); +} + +// Die UpDate Methode muss regelmaessig von der Arbeitsfunktion +// ausgeuehrt werden. +// Beim ersten aufruf wird die gesamtanzahl der actions uebergeben. +// Jeder weitere sollte die bearbeiteten actions seit dem letzten aufruf von +// UpDate erhalten. + +IMPL_LINK( BreakDlg, UpDate, void*, nInit ) +{ + String aEmptyStr; + + if(pProgrInfo == NULL) + return 1L; + + // Statuszeile updaten oder Fehlermeldung? + if(nInit == (void*)1L) + { + ErrorBox aErrBox( this, WB_OK, String( SdResId( STR_BREAK_FAIL ) ) ); + aErrBox.Execute(); + } + else + { + if(mpProgress) + mpProgress->SetState( pProgrInfo->GetSumCurAction() ); + } + + // Welches Oject wird gerade angezeigt? + String info = UniString::CreateFromInt32( pProgrInfo->GetCurObj() ); + info.Append( sal_Unicode('/') ); + info.Append( UniString::CreateFromInt32( pProgrInfo->GetObjCount() ) ); + aFiObjInfo.SetText(info); + + // Wieviele Actions sind schon aufgebrochen? + if(pProgrInfo->GetActionCount() == 0) + { + aFiActInfo.SetText( aEmptyStr ); + } + else + { + info = UniString::CreateFromInt32( pProgrInfo->GetCurAction() ); + info.Append( sal_Unicode('/') ); + info.Append( UniString::CreateFromInt32( pProgrInfo->GetActionCount() ) ); + aFiActInfo.SetText(info); + } + + // Und erst eingefuegt???? + if(pProgrInfo->GetInsertCount() == 0) + { + aFiInsInfo.SetText( aEmptyStr ); + } + else + { + info = UniString::CreateFromInt32( pProgrInfo->GetCurInsert() ); + info.Append( sal_Unicode('/') ); + info.Append( UniString::CreateFromInt32( pProgrInfo->GetInsertCount() ) ); + aFiInsInfo.SetText(info); + } + + Application::Reschedule(); + return( bCancel?0L:1L ); +} + +// Oeffnet den Modalen Dialog und startet einen Timer der die Arbeitsfunktion +// nach oeffnen des Dialogs ausfuehrt +short BreakDlg::Execute() +{ + aTimer.SetTimeout( 10 ); + aTimer.SetTimeoutHdl( LINK( this, BreakDlg, InitialUpdate ) ); + aTimer.Start(); + + return SfxModalDialog::Execute(); +} + +// Linkmethode welche die Arbeitsfunktion startet +IMPL_LINK( BreakDlg, InitialUpdate, Timer*, EMPTYARG ) +{ + pDrView->DoImportMarkedMtf(pProgrInfo); + EndDialog(sal_True); + return 0L; +} + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/brkdlg.src b/sd/source/ui/dlg/brkdlg.src new file mode 100644 index 000000000000..a574ab9714ca --- /dev/null +++ b/sd/source/ui/dlg/brkdlg.src @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "brkdlg.hrc" +ModalDialog DLG_BREAK +{ + HelpID = "sd:ModalDialog:DLG_BREAK"; + OutputSize = TRUE; + SVLook = TRUE; + Pos = MAP_APPFONT( 84, 34 ); + Size = MAP_APPFONT( 160, 74 ); + Moveable = TRUE; + FixedText FT_OBJ_INFO + { + Pos = MAP_APPFONT( 6, 6 ); + Size = MAP_APPFONT( 85, 10 ); + Text [ en-US ] = "Processing metafile:"; + }; + FixedText FT_ACT_INFO + { + Pos = MAP_APPFONT( 6, 22 ); + Size = MAP_APPFONT( 106, 10 ); + Text [ en-US ] = "Broken down metaobjects:"; + }; + FixedText FT_INS_INFO + { + Pos = MAP_APPFONT( 6, 38 ); + Size = MAP_APPFONT( 90, 10 ); + Text [ en-US ] = "Inserted drawing objects:"; + }; + FixedText FI_OBJ_INFO + { + Pos = MAP_APPFONT( 100, 6 ); + Size = MAP_APPFONT( 154, 10 ); + }; + FixedText FI_ACT_INFO + { + Pos = MAP_APPFONT( 100, 22 ); + Size = MAP_APPFONT( 54, 10 ); + }; + FixedText FI_INS_INFO + { + Pos = MAP_APPFONT( 100, 38 ); + Size = MAP_APPFONT( 54, 10 ); + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT( 55, 54 ); + Size = MAP_APPFONT( 50, 14 ); + TabStop = TRUE; + }; + Text [ en-US ] = "Break"; +}; + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/celltempl.cxx b/sd/source/ui/dlg/celltempl.cxx new file mode 100644 index 000000000000..195b59d46019 --- /dev/null +++ b/sd/source/ui/dlg/celltempl.cxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include <svl/style.hxx> +#include <svl/intitem.hxx> + +#include <svx/dialogs.hrc> +#include <svx/drawitem.hxx> +#include <editeng/bulitem.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/numitem.hxx> +#include <svx/svdmodel.hxx> + +#include "DrawDocShell.hxx" +#include "sdresid.hxx" +#include "celltempl.hxx" +#include "celltempl.hrc" +#include "bulmaper.hxx" + +/************************************************************************* +|* +|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu +|* +\************************************************************************/ + +SdPresCellTemplateDlg::SdPresCellTemplateDlg( SdrModel* pModel, Window* pParent, SfxStyleSheetBase& rStyleBase ) +: SfxStyleDialog( pParent, SdResId(TAB_CELL_TEMPLATE), rStyleBase, sal_False ) +, mpColorTab( pModel->GetColorTable() ) +, mpGradientList( pModel->GetGradientList() ) +, mpHatchingList( pModel->GetHatchList() ) +, mpBitmapList( pModel->GetBitmapList() ) +{ + FreeResource(); + + AddTabPage( RID_SVXPAGE_CHAR_NAME ); + AddTabPage( RID_SVXPAGE_CHAR_EFFECTS ); + AddTabPage( RID_SVXPAGE_BORDER ); + AddTabPage( RID_SVXPAGE_AREA ); +} + +// ----------------------------------------------------------------------- + +SdPresCellTemplateDlg::~SdPresCellTemplateDlg() +{ +} + +// ----------------------------------------------------------------------- + +void SdPresCellTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) +{ + switch( nId ) + { + case RID_SVXPAGE_AREA: + { + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + aSet.Put (SvxColorTableItem(mpColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxGradientListItem(mpGradientList,SID_GRADIENT_LIST)); + aSet.Put (SvxHatchListItem(mpHatchingList,SID_HATCH_LIST)); + aSet.Put (SvxBitmapListItem(mpBitmapList,SID_BITMAP_LIST)); + aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0)); + aSet.Put (SfxUInt16Item(SID_DLG_TYPE,1)); + aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,0)); + rPage.PageCreated(aSet); + } + break; + + default: + SfxTabDialog::PageCreated( nId, rPage ); + break; + } +} + +// ----------------------------------------------------------------------- + +const SfxItemSet* SdPresCellTemplateDlg::GetRefreshedSet() +{ + SfxItemSet* pRet = GetInputSetImpl(); + + if( pRet ) + { + pRet->ClearItem(); + pRet->SetParent( GetStyleSheet().GetItemSet().GetParent() ); + } + else + pRet = new SfxItemSet( GetStyleSheet().GetItemSet() ); + + return pRet; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/celltempl.src b/sd/source/ui/dlg/celltempl.src new file mode 100644 index 000000000000..4bdd02a799c2 --- /dev/null +++ b/sd/source/ui/dlg/celltempl.src @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "enumdlg.hrc" +#include "celltempl.hrc" +#include <svx/dialogs.hrc> + +TabDialog TAB_CELL_TEMPLATE +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Moveable = TRUE ; + Text [ en-US ] = "Cell Style" ; + + Size = MAP_APPFONT ( 289 , 176 ) ; + + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_CHAR_NAME ; + PageResID = RID_SVXPAGE_CHAR_NAME ; + Text [ de ] = "Schrift" ; + Text [ en-US ] = "Font" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_CHAR_EFFECTS ; + PageResID = RID_SVXPAGE_CHAR_EFFECTS ; + Text [ de ] = "Schrifteffekt" ; + Text [ en-US ] = "Font Effects" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_BORDER; + PageResID = RID_SVXPAGE_BORDER; + Text [ de ] = "Umrandung" ; + Text [ en-US ] = "Borders" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_AREA; + PageResID = RID_SVXPAGE_AREA; + Text [ de ] = "Hintergrund"; + Text [ en-US ] = "Background"; + }; + }; + }; +}; diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx new file mode 100644 index 000000000000..427ec463a5bc --- /dev/null +++ b/sd/source/ui/dlg/copydlg.cxx @@ -0,0 +1,359 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include "copydlg.hxx" +#include <svx/dlgutil.hxx> +#include <sfx2/module.hxx> +#include <svx/xcolit.hxx> +#include <svx/xflclit.hxx> +#include <svx/xdef.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xenum.hxx> + +#include <sfx2/app.hxx> + + + +#include "sdattr.hxx" + +#include "copydlg.hrc" +#include "View.hxx" +#include "sdresid.hxx" +#include "drawdoc.hxx" +#include "res_bmp.hrc" + +namespace sd { + +#define TOKEN (sal_Unicode(';')) + +/************************************************************************* +|* +|* Dialog zum Kopieren von Objekten +|* +\************************************************************************/ + +CopyDlg::CopyDlg( + ::Window* pWindow, + const SfxItemSet& rInAttrs, + XColorTable* pColTab, + ::sd::View* pInView ) + : SfxModalDialog ( pWindow, SdResId( DLG_COPY ) ), + maFtCopies ( this, SdResId( FT_COPIES ) ), + maNumFldCopies ( this, SdResId( NUM_FLD_COPIES ) ), + maBtnSetViewData ( this, SdResId( BTN_SET_VIEWDATA ) ), + maGrpMovement ( this, SdResId( GRP_MOVEMENT ) ), + maFtMoveX ( this, SdResId( FT_MOVE_X ) ), + maMtrFldMoveX ( this, SdResId( MTR_FLD_MOVE_X ) ), + maFtMoveY ( this, SdResId( FT_MOVE_Y ) ), + maMtrFldMoveY ( this, SdResId( MTR_FLD_MOVE_Y ) ), + maFtAngle ( this, SdResId( FT_ANGLE ) ), + maMtrFldAngle ( this, SdResId( MTR_FLD_ANGLE ) ), + maGrpEnlargement ( this, SdResId( GRP_ENLARGEMENT ) ), + maFtWidth ( this, SdResId( FT_WIDTH ) ), + maMtrFldWidth ( this, SdResId( MTR_FLD_WIDTH ) ), + maFtHeight ( this, SdResId( FT_HEIGHT ) ), + maMtrFldHeight ( this, SdResId( MTR_FLD_HEIGHT ) ), + maGrpColor ( this, SdResId( GRP_COLOR ) ), + maFtStartColor ( this, SdResId( FT_START_COLOR ) ), + maLbStartColor ( this, SdResId( LB_START_COLOR ) ), + maFtEndColor ( this, SdResId( FT_END_COLOR ) ), + maLbEndColor ( this, SdResId( LB_END_COLOR ) ), + maBtnOK ( this, SdResId( BTN_OK ) ), + maBtnCancel ( this, SdResId( BTN_CANCEL ) ), + maBtnHelp ( this, SdResId( BTN_HELP ) ), + maBtnSetDefault ( this, SdResId( BTN_SET_DEFAULT ) ), + mrOutAttrs ( rInAttrs ), + mpColorTab ( pColTab ), + maUIScale(pInView->GetDoc()->GetUIScale()), + mpView ( pInView ) +{ + FreeResource(); + + // Set up the view data button (image and accessible name). + maBtnSetViewData.SetAccessibleName (maBtnSetViewData.GetQuickHelpText()); + + // Farbtabellen + DBG_ASSERT( mpColorTab, "Keine gueltige ColorTable uebergeben!" ); + maLbStartColor.Fill( mpColorTab ); + maLbEndColor.CopyEntries( maLbStartColor ); + + maLbStartColor.SetSelectHdl( LINK( this, CopyDlg, SelectColorHdl ) ); + maBtnSetViewData.SetClickHdl( LINK( this, CopyDlg, SetViewData ) ); + maBtnSetDefault.SetClickHdl( LINK( this, CopyDlg, SetDefault ) ); + + + FieldUnit eFUnit( SfxModule::GetCurrentFieldUnit() ); + + SetFieldUnit( maMtrFldMoveX, eFUnit, sal_True ); + SetFieldUnit( maMtrFldMoveY, eFUnit, sal_True ); + SetFieldUnit( maMtrFldWidth, eFUnit, sal_True ); + SetFieldUnit( maMtrFldHeight, eFUnit, sal_True ); + + Reset(0L); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +CopyDlg::~CopyDlg() +{ + String& rStr = GetExtraData(); + + rStr = UniString::CreateFromInt64( maNumFldCopies.GetValue() ); + rStr.Append( TOKEN ); + + rStr += UniString::CreateFromInt64( maMtrFldMoveX.GetValue() ); + rStr.Append( TOKEN ); + + rStr += UniString::CreateFromInt64( maMtrFldMoveY.GetValue() ); + rStr.Append( TOKEN ); + + rStr += UniString::CreateFromInt64( maMtrFldAngle.GetValue() ); + rStr.Append( TOKEN ); + + rStr += UniString::CreateFromInt64( maMtrFldWidth.GetValue() ); + rStr.Append( TOKEN ); + + rStr += UniString::CreateFromInt64( maMtrFldHeight.GetValue() ); + rStr.Append( TOKEN ); + + rStr += UniString::CreateFromInt32( (long)maLbStartColor.GetSelectEntryColor().GetColor() ); + rStr.Append( TOKEN ); + + rStr += UniString::CreateFromInt32( (long)maLbEndColor.GetSelectEntryColor().GetColor() ); +} + +/************************************************************************* +|* +|* Liest uebergebenen Item-Set oder wertet den INI-String aus +|* +\************************************************************************/ + +IMPL_LINK( CopyDlg, Reset, void*, EMPTYARG ) +{ + const SfxPoolItem* pPoolItem = NULL; + String aStr( GetExtraData() ); + + if( aStr.GetTokenCount( TOKEN ) < 8 ) + { + if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_NUMBER, sal_True, &pPoolItem ) ) + maNumFldCopies.SetValue( ( ( const SfxUInt16Item* ) pPoolItem )->GetValue() ); + else + maNumFldCopies.SetValue( 1L ); + + long nMoveX = 500L; + if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_X, sal_True, &pPoolItem ) ) + nMoveX = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() ); + SetMetricValue( maMtrFldMoveX, Fraction(nMoveX) / maUIScale, SFX_MAPUNIT_100TH_MM); + + long nMoveY = 500L; + if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_Y, sal_True, &pPoolItem ) ) + nMoveY = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() ); + SetMetricValue( maMtrFldMoveY, Fraction(nMoveY) / maUIScale, SFX_MAPUNIT_100TH_MM); + + if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_ANGLE, sal_True, &pPoolItem ) ) + maMtrFldAngle.SetValue( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() ); + else + maMtrFldAngle.SetValue( 0L ); + + long nWidth = 0L; + if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_WIDTH, sal_True, &pPoolItem ) ) + nWidth = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() ); + SetMetricValue( maMtrFldWidth, Fraction(nWidth) / maUIScale, SFX_MAPUNIT_100TH_MM); + + long nHeight = 0L; + if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_HEIGHT, sal_True, &pPoolItem ) ) + nHeight = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() ); + SetMetricValue( maMtrFldHeight, Fraction(nHeight) / maUIScale, SFX_MAPUNIT_100TH_MM); + + if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, sal_True, &pPoolItem ) ) + { + Color aColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue(); + maLbStartColor.SelectEntry( aColor ); + maLbEndColor.SelectEntry( aColor ); + } + else + { + maLbStartColor.SetNoSelection(); + maLbEndColor.SetNoSelection(); + maLbEndColor.Disable(); + maFtEndColor.Disable(); + } + } + else + { + long nTmp; + nTmp = (long)aStr.GetToken( 0, TOKEN ).ToInt32(); + maNumFldCopies.SetValue( nTmp ); + + nTmp = (long)aStr.GetToken( 1, TOKEN ).ToInt32(); + maMtrFldMoveX.SetValue( nTmp ); + + nTmp = (long)aStr.GetToken( 2, TOKEN ).ToInt32(); + maMtrFldMoveY.SetValue( nTmp ); + + nTmp = (long)aStr.GetToken( 3, TOKEN ).ToInt32(); + maMtrFldAngle.SetValue( nTmp ); + + nTmp = (long)aStr.GetToken( 4, TOKEN ).ToInt32(); + maMtrFldWidth.SetValue( nTmp ); + + nTmp = (long)aStr.GetToken( 5, TOKEN ).ToInt32(); + maMtrFldHeight.SetValue( nTmp ); + + nTmp = (long)aStr.GetToken( 6, TOKEN ).ToInt32(); + maLbStartColor.SelectEntry( Color( nTmp ) ); + + nTmp = (long)aStr.GetToken( 7, TOKEN ).ToInt32(); + maLbEndColor.SelectEntry( Color( nTmp ) ); + } + + return 0; +} + +/************************************************************************* +|* +|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen +|* +\************************************************************************/ + +void CopyDlg::GetAttr( SfxItemSet& rOutAttrs ) +{ + long nMoveX = Fraction( GetCoreValue( maMtrFldMoveX, SFX_MAPUNIT_100TH_MM) ) * maUIScale; + long nMoveY = Fraction( GetCoreValue( maMtrFldMoveY, SFX_MAPUNIT_100TH_MM) ) * maUIScale; + long nHeight = Fraction( GetCoreValue( maMtrFldHeight, SFX_MAPUNIT_100TH_MM) ) * maUIScale; + long nWidth = Fraction( GetCoreValue( maMtrFldWidth, SFX_MAPUNIT_100TH_MM) ) * maUIScale; + + rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, (sal_uInt16) maNumFldCopies.GetValue() ) ); + rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_X, nMoveX ) ); + rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_Y, nMoveY ) ); + rOutAttrs.Put( SfxInt32Item( ATTR_COPY_ANGLE, static_cast<sal_Int32>(maMtrFldAngle.GetValue()) ) ); + rOutAttrs.Put( SfxInt32Item( ATTR_COPY_WIDTH, nWidth ) ); + rOutAttrs.Put( SfxInt32Item( ATTR_COPY_HEIGHT, nHeight ) ); + + if( maLbStartColor.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + { + XColorItem aXColorItem( ATTR_COPY_START_COLOR, maLbStartColor.GetSelectEntry(), + maLbStartColor.GetSelectEntryColor() ); + rOutAttrs.Put( aXColorItem ); + } + if( maLbEndColor.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + { + XColorItem aXColorItem( ATTR_COPY_END_COLOR, maLbEndColor.GetSelectEntry(), + maLbEndColor.GetSelectEntryColor() ); + rOutAttrs.Put( aXColorItem ); + } +} + +/************************************************************************* +|* +|* Enabled und selektiert Endfarben-LB +|* +\************************************************************************/ + +IMPL_LINK( CopyDlg, SelectColorHdl, void *, EMPTYARG ) +{ + sal_uInt16 nPos = maLbStartColor.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND && + !maLbEndColor.IsEnabled() ) + { + maLbEndColor.SelectEntryPos( nPos ); + maLbEndColor.Enable(); + maFtEndColor.Enable(); + } + return 0; +} + +/************************************************************************* +|* Setzt Werte der Selektion +\************************************************************************/ + +IMPL_LINK( CopyDlg, SetViewData, void*, EMPTYARG ) +{ + Rectangle aRect = mpView->GetAllMarkedRect(); + + SetMetricValue( maMtrFldMoveX, Fraction( aRect.GetWidth() ) / + maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( maMtrFldMoveY, Fraction( aRect.GetHeight() ) / + maUIScale, SFX_MAPUNIT_100TH_MM); + + // Farb-Attribut setzen + const SfxPoolItem* pPoolItem = NULL; + if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, sal_True, &pPoolItem ) ) + { + Color aColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue(); + maLbStartColor.SelectEntry( aColor ); + } + + return 0; +} + +/************************************************************************* +|* Setzt Werte auf Standard +\************************************************************************/ + +IMPL_LINK( CopyDlg, SetDefault, void*, EMPTYARG ) +{ + maNumFldCopies.SetValue( 1L ); + + long nValue = 500L; + SetMetricValue( maMtrFldMoveX, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( maMtrFldMoveY, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); + + nValue = 0L; + maMtrFldAngle.SetValue( nValue ); + SetMetricValue( maMtrFldWidth, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( maMtrFldHeight, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); + + // Farb-Attribut setzen + const SfxPoolItem* pPoolItem = NULL; + if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, sal_True, &pPoolItem ) ) + { + Color aColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue(); + maLbStartColor.SelectEntry( aColor ); + maLbEndColor.SelectEntry( aColor ); + } + + return 0; +} + + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/copydlg.src b/sd/source/ui/dlg/copydlg.src new file mode 100644 index 000000000000..2cb99b4dfd75 --- /dev/null +++ b/sd/source/ui/dlg/copydlg.src @@ -0,0 +1,320 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "app.hrc" +#include "res_bmp.hrc" +#include "copydlg.hrc" +#include "helpids.h" + +ModalDialog DLG_COPY +{ + HelpID = CMD_SID_COPYOBJECTS ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 204 , 177 ) ; + Text [ en-US ] = "Duplicate" ; + Moveable = TRUE ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 148 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 148 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 148 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + FixedText FT_COPIES + { + Pos = MAP_APPFONT ( 6 , 9 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "Number of ~copies" ; + }; + NumericField NUM_FLD_COPIES + { + HelpID = "sd:NumericField:DLG_COPY:NUM_FLD_COPIES"; + Border = TRUE ; + Pos = MAP_APPFONT ( 76 , 7 ) ; + Size = MAP_APPFONT ( 35 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 999 ; + StrictFormat = TRUE ; + First = 1 ; + Last = 999 ; + SpinSize = 1 ; + }; + ImageButton BTN_SET_VIEWDATA + { + HelpID = "sd:ImageButton:DLG_COPY:BTN_SET_VIEWDATA"; + Pos = MAP_APPFONT ( 122 , 6 ) ; + Size = MAP_APPFONT ( 14 , 14 ) ; + ButtonImage = Image + { + ImageBitmap = Bitmap { File = "pipette.bmp" ; }; + MaskColor = IMAGE_MASK_STDCOLOR; + }; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Values from Selection" ; + }; + PushButton BTN_SET_DEFAULT + { + HelpID = "sd:PushButton:DLG_COPY:BTN_SET_DEFAULT"; + Pos = MAP_APPFONT ( 148 , 63 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Default"; + }; + MetricField MTR_FLD_ANGLE + { + HelpID = "sd:MetricField:DLG_COPY:MTR_FLD_ANGLE"; + Border = TRUE ; + Pos = MAP_APPFONT ( 76 , 69 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 359 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + Last = 359 ; + SpinSize = 5 ; + CustomUnitText [ en-US ] = " degrees" ; + }; + FixedText FT_ANGLE + { + Pos = MAP_APPFONT ( 12 , 71 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "~Angle" ; + }; + FixedText FT_MOVE_X + { + Pos = MAP_APPFONT ( 12 , 39 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "~X axis" ; + }; + MetricField MTR_FLD_MOVE_X + { + HelpID = "sd:MetricField:DLG_COPY:MTR_FLD_MOVE_X"; + Border = TRUE ; + Pos = MAP_APPFONT ( 76 , 37 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -120000 ; + Maximum = 120000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = -120000 ; + Last = 120000 ; + SpinSize = 100 ; + }; + MetricField MTR_FLD_MOVE_Y + { + HelpID = "sd:MetricField:DLG_COPY:MTR_FLD_MOVE_Y"; + Border = TRUE ; + Pos = MAP_APPFONT ( 76 , 53 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -120000 ; + Maximum = 120000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = -120000 ; + Last = 120000 ; + SpinSize = 100 ; + }; + MetricField MTR_FLD_WIDTH + { + HelpID = "sd:MetricField:DLG_COPY:MTR_FLD_WIDTH"; + Border = TRUE ; + Pos = MAP_APPFONT ( 76 , 98 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -120000 ; + Maximum = 120000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = -120000 ; + Last = 120000 ; + SpinSize = 100 ; + }; + MetricField MTR_FLD_HEIGHT + { + HelpID = "sd:MetricField:DLG_COPY:MTR_FLD_HEIGHT"; + Border = TRUE ; + Pos = MAP_APPFONT ( 76 , 114 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -120000 ; + Maximum = 120000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = -120000 ; + Last = 120000 ; + SpinSize = 100 ; + }; + FixedText FT_MOVE_Y + { + Pos = MAP_APPFONT ( 12 , 55 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "~Y axis" ; + }; + FixedText FT_WIDTH + { + Pos = MAP_APPFONT ( 12 , 100 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "~Width" ; + }; + FixedText FT_HEIGHT + { + Pos = MAP_APPFONT ( 12 , 116 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "~Height" ; + }; + FixedLine GRP_MOVEMENT + { + Pos = MAP_APPFONT ( 6 , 26 ) ; + Size = MAP_APPFONT ( 136 , 8 ) ; + Text [ en-US ] = "Placement" ; + }; + FixedLine GRP_ENLARGEMENT + { + Pos = MAP_APPFONT ( 6 , 87 ) ; + Size = MAP_APPFONT ( 136 , 8 ) ; + Text [ en-US ] = "Enlargement" ; + }; + FixedLine GRP_COLOR + { + Pos = MAP_APPFONT ( 6 , 132 ) ; + Size = MAP_APPFONT ( 136 , 8 ) ; + Text [ en-US ] = "Colors" ; + }; + ListBox LB_START_COLOR + { + HelpID = "sd:ListBox:DLG_COPY:LB_START_COLOR"; + Border = TRUE ; + Pos = MAP_APPFONT ( 76 , 143 ) ; + Size = MAP_APPFONT ( 60 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + FixedText FT_START_COLOR + { + Pos = MAP_APPFONT ( 12 , 145 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "~Start" ; + }; + ListBox LB_END_COLOR + { + HelpID = "sd:ListBox:DLG_COPY:LB_END_COLOR"; + Border = TRUE ; + Pos = MAP_APPFONT ( 76 , 159 ) ; + Size = MAP_APPFONT ( 60 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + }; + FixedText FT_END_COLOR + { + Pos = MAP_APPFONT ( 12 , 161 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "~End" ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx new file mode 100644 index 000000000000..57eb4214dc76 --- /dev/null +++ b/sd/source/ui/dlg/custsdlg.cxx @@ -0,0 +1,562 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include "custsdlg.hxx" +#include "custsdlg.hrc" + +#include "strings.hrc" +#include "sdresid.hxx" + +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "cusshow.hxx" +#include "app.hxx" +#include <vcl/msgbox.hxx> + + +///////////////////// +// SdCustomShowDlg // +///////////////////// + + +/************************************************************************* +|* Konstruktor +\************************************************************************/ +SdCustomShowDlg::SdCustomShowDlg( Window* pWindow, + SdDrawDocument& rDrawDoc ) : + ModalDialog ( pWindow, SdResId( DLG_CUSTOMSHOW ) ), + + aLbCustomShows ( this, SdResId( LB_CUSTOMSHOWS ) ), + aCbxUseCustomShow( this, SdResId( CBX_USE_CUSTOMSHOW ) ), + aBtnNew ( this, SdResId( BTN_NEW ) ), + aBtnEdit ( this, SdResId( BTN_EDIT ) ), + aBtnRemove ( this, SdResId( BTN_REMOVE ) ), + aBtnCopy ( this, SdResId( BTN_COPY ) ), + aBtnHelp ( this, SdResId( BTN_HELP ) ), + aBtnStartShow ( this, SdResId( BTN_STARTSHOW ) ), + aBtnOK ( this, SdResId( BTN_OK ) ), + + rDoc ( rDrawDoc ), + pCustomShowList ( NULL ), + pCustomShow ( NULL ), + bModified ( sal_False ) +{ + FreeResource(); + + Link aLink( LINK( this, SdCustomShowDlg, ClickButtonHdl ) ); + aBtnNew.SetClickHdl( aLink ); + aBtnEdit.SetClickHdl( aLink ); + aBtnRemove.SetClickHdl( aLink ); + aBtnCopy.SetClickHdl( aLink ); + aCbxUseCustomShow.SetClickHdl( aLink ); + aLbCustomShows.SetSelectHdl( aLink ); + + aBtnStartShow.SetClickHdl( LINK( this, SdCustomShowDlg, StartShowHdl ) ); // Testweise + + // CustomShow-Liste des Docs abrufen + pCustomShowList = rDoc.GetCustomShowList(); + if( pCustomShowList ) + { + long nPosToSelect = pCustomShowList->GetCurPos(); + // ListBox mit CustomShows fuellen + for( pCustomShow = (SdCustomShow*) pCustomShowList->First(); + pCustomShow != NULL; + pCustomShow = (SdCustomShow*) pCustomShowList->Next() ) + { + aLbCustomShows.InsertEntry( pCustomShow->GetName() ); + } + aLbCustomShows.SelectEntryPos( (sal_uInt16)nPosToSelect ); + pCustomShowList->Seek( nPosToSelect ); + } + + aCbxUseCustomShow.Check( pCustomShowList && rDoc.getPresentationSettings().mbCustomShow ); + + CheckState(); +} + +/************************************************************************* +|* Dtor +\************************************************************************/ +SdCustomShowDlg::~SdCustomShowDlg() +{ +} + +/************************************************************************* +|* CheckState +\************************************************************************/ +void SdCustomShowDlg::CheckState() +{ + sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos(); + + sal_Bool bEnable = nPos != LISTBOX_ENTRY_NOTFOUND; + aBtnEdit.Enable( bEnable ); + aBtnRemove.Enable( bEnable ); + aBtnCopy.Enable( bEnable ); + aCbxUseCustomShow.Enable( bEnable ); + aBtnStartShow.Enable( true ); + + if( bEnable ) + pCustomShowList->Seek( nPos ); +} + +/************************************************************************* +|* ButtonHdl() +\************************************************************************/ +IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p ) +{ + // Neue CustomShow + if( p == &aBtnNew ) + { + pCustomShow = NULL; + SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow ); + if( aDlg.Execute() == RET_OK ) + { + if( pCustomShow ) + { + if( !pCustomShowList ) + pCustomShowList = rDoc.GetCustomShowList( sal_True ); + + pCustomShowList->Insert( pCustomShow, LIST_APPEND ); + pCustomShowList->Last(); + aLbCustomShows.InsertEntry( pCustomShow->GetName() ); + aLbCustomShows.SelectEntry( pCustomShow->GetName() ); + } + + if( aDlg.IsModified() ) + bModified = sal_True; + } + else if( pCustomShow ) + DELETEZ( pCustomShow ); + } + // CustomShow bearbeiten + else if( p == &aBtnEdit ) + { + sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + DBG_ASSERT( pCustomShowList, "pCustomShowList existiert nicht" ); + pCustomShow = (SdCustomShow*) pCustomShowList->GetObject( nPos ); + SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow ); + + if( aDlg.Execute() == RET_OK ) + { + if( pCustomShow ) + { + pCustomShowList->Replace( pCustomShow, nPos ); + pCustomShowList->Seek( nPos ); + aLbCustomShows.RemoveEntry( nPos ); + aLbCustomShows.InsertEntry( pCustomShow->GetName(), nPos ); + aLbCustomShows.SelectEntryPos( nPos ); + } + if( aDlg.IsModified() ) + bModified = sal_True; + } + } + } + // CustomShow loeschen + else if( p == &aBtnRemove ) + { + sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + delete (SdCustomShow*) pCustomShowList->Remove( nPos ); + aLbCustomShows.RemoveEntry( nPos ); + aLbCustomShows.SelectEntryPos( nPos == 0 ? nPos : nPos - 1 ); + bModified = sal_True; + } + } + // CustomShow kopieren + else if( p == &aBtnCopy ) + { + sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + SdCustomShow* pShow = new SdCustomShow( *(SdCustomShow*) pCustomShowList->GetObject( nPos ) ); + String aStr( pShow->GetName() ); + String aStrCopy( SdResId( STR_COPY_CUSTOMSHOW ) ); + + sal_uInt16 nStrPos = aStr.Search( aStrCopy ); + sal_uInt16 nNum = 1; + if( nStrPos == STRING_NOTFOUND ) + { + aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); + aStr.Append( aStrCopy ); + aStr.Append( UniString::CreateFromInt32( nNum ) ); + aStr.Append( sal_Unicode(')') ); + nStrPos = aStr.Search( aStrCopy ); + } + nStrPos = nStrPos + (sal_uInt16)aStrCopy.Len(); + // Um nicht ins Nirvana zu greifen (--> Endlosschleife) + if( nStrPos >= aStr.Len() ) + { + aStr.Append( sal_Unicode(' ') ); + aStr.Append( UniString::CreateFromInt32( nNum ) ); + } + + // Name ueberpruefen... + sal_Bool bDifferent = sal_False; + //long nPosToSelect = pCustomShowList->GetCurPos(); + while( !bDifferent ) + { + bDifferent = sal_True; + for( pCustomShow = (SdCustomShow*) pCustomShowList->First(); + pCustomShow != NULL && bDifferent; + pCustomShow = (SdCustomShow*) pCustomShowList->Next() ) + { + if( aStr == pCustomShow->GetName() ) + bDifferent = sal_False; + } + if( !bDifferent ) + { + // Nummer entfernen und durch um 1 erhoehte ersetzen + + const CharClass* pCharClass = rDoc.GetCharClass(); + while( pCharClass->isDigit( aStr, nStrPos ) ) + aStr.Erase( nStrPos, 1 ); + aStr.Insert( UniString::CreateFromInt32( ++nNum ), nStrPos); + } + + } + //pCustomShowList->Seek( nPosToSelect ); + pShow->SetName( aStr ); + + pCustomShowList->Insert( pShow, LIST_APPEND ); + pCustomShowList->Last(); + aLbCustomShows.InsertEntry( pShow->GetName() ); + aLbCustomShows.SelectEntry( pShow->GetName() ); + + + bModified = sal_True; + } + } + else if( p == &aLbCustomShows ) + { + sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + pCustomShowList->Seek( nPos ); + + bModified = sal_True; + } + else if( p == &aCbxUseCustomShow ) + { + bModified = sal_True; + } + + CheckState(); + + return( 0L ); +} + +/************************************************************************* +|* StartShow-Hdl +\************************************************************************/ +IMPL_LINK( SdCustomShowDlg, StartShowHdl, Button *, EMPTYARG ) +{ + EndDialog( RET_YES ); + + return 0; +} + +/************************************************************************* +|* CheckState +\************************************************************************/ +sal_Bool SdCustomShowDlg::IsCustomShow() const +{ + return( aCbxUseCustomShow.IsEnabled() && aCbxUseCustomShow.IsChecked() ); +} + + + +/////////////////////////// +// SdDefineCustomShowDlg // +/////////////////////////// + + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ +SdDefineCustomShowDlg::SdDefineCustomShowDlg( Window* pWindow, + SdDrawDocument& rDrawDoc, SdCustomShow*& rpCS ) : + ModalDialog ( pWindow, SdResId( DLG_DEFINE_CUSTOMSHOW ) ), + + aFtName ( this, SdResId( FT_NAME ) ), + aEdtName ( this, SdResId( EDT_NAME ) ), + aFtPages ( this, SdResId( FT_PAGES ) ), + aLbPages ( this, SdResId( LB_PAGES ) ), + aBtnAdd ( this, SdResId( BTN_ADD ) ), + aBtnRemove ( this, SdResId( BTN_REMOVE ) ), + aFtCustomPages ( this, SdResId( FT_CUSTOM_PAGES ) ), + aLbCustomPages ( this, SdResId( LB_CUSTOM_PAGES ) ), + aBtnOK ( this, SdResId( BTN_OK ) ), + aBtnCancel ( this, SdResId( BTN_CANCEL ) ), + aBtnHelp ( this, SdResId( BTN_HELP ) ), + + rDoc ( rDrawDoc ), + rpCustomShow ( rpCS ), + bModified ( sal_False ) +{ + FreeResource(); + + Link aLink = LINK( this, SdDefineCustomShowDlg, ClickButtonHdl ); + aBtnAdd.SetClickHdl( aLink ); + aBtnRemove.SetClickHdl( aLink ); + aEdtName.SetModifyHdl( aLink ); + aLbPages.SetSelectHdl( aLink ); // wegen Status + aLbCustomPages.SetSelectHdl( aLink ); // wegen Status + + aBtnOK.SetClickHdl( LINK( this, SdDefineCustomShowDlg, OKHdl ) ); + + SdPage* pPage; + // Listbox mit Seitennamen des Docs fuellen + for( long nPage = 0L; + nPage < rDoc.GetSdPageCount( PK_STANDARD ); + nPage++ ) + { + pPage = rDoc.GetSdPage( (sal_uInt16) nPage, PK_STANDARD ); + String aStr( pPage->GetName() ); + aLbPages.InsertEntry( aStr ); + } + //aLbPages.SelectEntryPos( 0 ); + + if( rpCustomShow ) + { + aOldName = rpCustomShow->GetName(); + aEdtName.SetText( aOldName ); + + // ListBox mit CustomShow-Seiten fuellen + for( pPage = (SdPage*) rpCustomShow->First(); + pPage != NULL; + pPage = (SdPage*) rpCustomShow->Next() ) + { + SvLBoxEntry* pEntry = aLbCustomPages.InsertEntry( pPage->GetName() ); + pEntry->SetUserData( pPage ); + } + } + else + { + rpCustomShow = new SdCustomShow( &rDoc ); + aEdtName.SetText( String( SdResId( STR_NEW_CUSTOMSHOW ) ) ); + aEdtName.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) ); + rpCustomShow->SetName( aEdtName.GetText() ); + } + + aLbCustomPages.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE ); + aLbCustomPages.SetHighlightRange(); + + aBtnOK.Enable( sal_False ); + CheckState(); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ +SdDefineCustomShowDlg::~SdDefineCustomShowDlg() +{ +} + +/************************************************************************* +|* CheckState +\************************************************************************/ +void SdDefineCustomShowDlg::CheckState() +{ + sal_Bool bPages = aLbPages.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND; + //sal_Bool bCSPages = aLbCustomPages.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND; + sal_Bool bCSPages = aLbCustomPages.FirstSelected() != NULL; + sal_Bool bCount = aLbCustomPages.GetEntryCount() > 0; + + aBtnOK.Enable( bCount ); + aBtnAdd.Enable( bPages ); + aBtnRemove.Enable( bCSPages ); +} + +/************************************************************************* +|* ButtonHdl() +\************************************************************************/ +IMPL_LINK( SdDefineCustomShowDlg, ClickButtonHdl, void *, p ) +{ + if( p == &aBtnAdd ) + { + sal_uInt16 nCount = aLbPages.GetSelectEntryCount(); + if( nCount > 0 ) + { + sal_uLong nPosCP = LIST_APPEND; + SvLBoxEntry* pEntry = aLbCustomPages.FirstSelected(); + if( pEntry ) + nPosCP = aLbCustomPages.GetModel()->GetAbsPos( pEntry ) + 1L; + + for( sal_uInt16 i = 0; i < nCount; i++ ) + { + String aStr = aLbPages.GetSelectEntry( i ); + pEntry = aLbCustomPages.InsertEntry( aStr, + 0, sal_False, nPosCP ); + + aLbCustomPages.Select( pEntry ); + SdPage* pPage = rDoc.GetSdPage( (sal_uInt16) aLbPages. + GetSelectEntryPos( i ), PK_STANDARD ); + pEntry->SetUserData( pPage ); + + if( nPosCP != LIST_APPEND ) + nPosCP++; + } + bModified = sal_True; + } + } + else if( p == &aBtnRemove ) + { + //sal_uInt16 nPos = aLbCustomPages.GetSelectEntryPos(); + SvLBoxEntry* pEntry = aLbCustomPages.FirstSelected(); + if( pEntry ) + { + sal_uLong nPos = aLbCustomPages.GetModel()->GetAbsPos( pEntry ); + //rpCustomShow->Remove( nPos ); + //aLbCustomPages.RemoveEntry( nPos ); + aLbCustomPages.GetModel()->Remove( aLbCustomPages.GetModel()->GetEntryAtAbsPos( nPos ) ); + + bModified = sal_True; + } + } + else if( p == &aEdtName ) + { + //rpCustomShow->SetName( aEdtName.GetText() ); + + bModified = sal_True; + } + + CheckState(); + + return( 0L ); +} + +/************************************************************************* +|* CheckCustomShow(): +|* Ueberprueft die Page-Pointer der Show, da die Eintraege ueber die +|* TreeLB verschoben und kopiert werden k”nnen +\************************************************************************/ +void SdDefineCustomShowDlg::CheckCustomShow() +{ + sal_Bool bDifferent = sal_False; + SdPage* pPage = NULL; + SvLBoxEntry* pEntry = NULL; + + // Anzahl vergleichen + if( rpCustomShow->Count() != aLbCustomPages.GetEntryCount() ) + { + rpCustomShow->Clear(); + bDifferent = sal_True; + } + + // Seiten-Pointer vergleichen + if( !bDifferent ) + { + for( pPage = (SdPage*) rpCustomShow->First(), pEntry = aLbCustomPages.First(); + pPage != NULL && pEntry != NULL && !bDifferent; + pPage = (SdPage*) rpCustomShow->Next(), pEntry = aLbCustomPages.Next( pEntry ) ) + { + if( pPage != pEntry->GetUserData() ) + { + rpCustomShow->Clear(); + bDifferent = sal_True; + } + } + } + + // Seiten-Pointer neu setzen + if( bDifferent ) + { + for( pEntry = aLbCustomPages.First(); + pEntry != NULL; + pEntry = aLbCustomPages.Next( pEntry ) ) + { + pPage = (SdPage*) pEntry->GetUserData(); + rpCustomShow->Insert( pPage, LIST_APPEND ); + } + bModified = sal_True; + } + + // Name vergleichen und ggfs. setzen + String aStr( aEdtName.GetText() ); + if( rpCustomShow->GetName() != aStr ) + { + rpCustomShow->SetName( aStr ); + bModified = sal_True; + } +} + +/************************************************************************* +|* OK-Hdl +\************************************************************************/ +IMPL_LINK( SdDefineCustomShowDlg, OKHdl, Button *, EMPTYARG ) +{ + // Name ueberpruefen... + sal_Bool bDifferent = sal_True; + List* pCustomShowList = rDoc.GetCustomShowList(); + if( pCustomShowList ) + { + String aName( aEdtName.GetText() ); + SdCustomShow* pCustomShow; + + long nPosToSelect = pCustomShowList->GetCurPos(); + for( pCustomShow = (SdCustomShow*) pCustomShowList->First(); + pCustomShow != NULL; + pCustomShow = (SdCustomShow*) pCustomShowList->Next() ) + { + if( aName == pCustomShow->GetName() && aName != aOldName ) + bDifferent = sal_False; + } + pCustomShowList->Seek( nPosToSelect ); + } + + if( bDifferent ) + { + CheckCustomShow(); + + EndDialog( RET_OK ); + } + else + { + WarningBox( this, WinBits( WB_OK ), + String( SdResId( STR_WARN_NAME_DUPLICATE ) ) ).Execute(); + + aEdtName.GrabFocus(); + } + + return 0; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/custsdlg.src b/sd/source/ui/dlg/custsdlg.src new file mode 100644 index 000000000000..275a47b38397 --- /dev/null +++ b/sd/source/ui/dlg/custsdlg.src @@ -0,0 +1,204 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "custsdlg.hrc" +#include "app.hrc" +#include "helpids.h" +#define DIFF 20 +#define DIFF_Y 17 +ModalDialog DLG_CUSTOMSHOW +{ + HelpID = CMD_SID_CUSTOMSHOW_DLG ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 175 + DIFF , 114 + DIFF_Y ) ; + Moveable = TRUE ; + Closeable = TRUE ; + PushButton BTN_NEW + { + HelpID = "sd:PushButton:DLG_CUSTOMSHOW:BTN_NEW"; + Pos = MAP_APPFONT ( 120 + DIFF , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~New..." ; + }; + PushButton BTN_EDIT + { + HelpID = "sd:PushButton:DLG_CUSTOMSHOW:BTN_EDIT"; + Pos = MAP_APPFONT ( 120 + DIFF , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Edit..." ; + }; + PushButton BTN_REMOVE + { + HelpID = "sd:PushButton:DLG_CUSTOMSHOW:BTN_REMOVE"; + Pos = MAP_APPFONT ( 120 + DIFF , 40 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Delete" ; + }; + PushButton BTN_COPY + { + HelpID = "sd:PushButton:DLG_CUSTOMSHOW:BTN_COPY"; + Pos = MAP_APPFONT ( 120 + DIFF , 57 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Cop~y" ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 120 + DIFF , 74 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + PushButton BTN_STARTSHOW + { + HelpID = "sd:PushButton:DLG_CUSTOMSHOW:BTN_STARTSHOW"; + Pos = MAP_APPFONT ( 120 + DIFF , 94 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Start" ; + }; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 120 + DIFF , 94 + DIFF_Y ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + Text [ en-US ] = "~Close" ; + }; + ListBox LB_CUSTOMSHOWS + { + HelpID = "sd:ListBox:DLG_CUSTOMSHOW:LB_CUSTOMSHOWS"; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 102 + DIFF , 86 + DIFF_Y ) ; + TabStop = TRUE ; + //IAccessibility2 Implementation 2009----- + QuickHelpText [ en-US ] = "Custom Screen Show" ; + //-----IAccessibility2 Implementation 2009 + }; + CheckBox CBX_USE_CUSTOMSHOW + { + HelpID = "sd:CheckBox:DLG_CUSTOMSHOW:CBX_USE_CUSTOMSHOW"; + Pos = MAP_APPFONT ( 6 , 96 + DIFF_Y ) ; + Size = MAP_APPFONT ( 112 + DIFF , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Use Custom Slide Show" ; + }; + Text [ en-US ] = "Custom Slide Shows" ; +}; +ModalDialog DLG_DEFINE_CUSTOMSHOW +{ + HelpID = HID_DLG_DEFINE_CUSTOMSHOW ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 248 , 117 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 187 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 187 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 187 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + FixedText FT_NAME + { + Pos = MAP_APPFONT ( 6 , 8 ) ; + Size = MAP_APPFONT ( 30 , 10 ) ; + Text [ en-US ] = "Name" ; + }; + Edit EDT_NAME + { + HelpID = "sd:Edit:DLG_DEFINE_CUSTOMSHOW:EDT_NAME"; + Border = TRUE ; + Pos = MAP_APPFONT ( 38 , 6 ) ; + Size = MAP_APPFONT ( 141 , 12 ) ; + TabStop = TRUE ; + }; + MultiListBox LB_PAGES + { + HelpID = "sd:MultiListBox:DLG_DEFINE_CUSTOMSHOW:LB_PAGES"; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 35 ) ; + Size = MAP_APPFONT ( 75 , 75 ) ; + TabStop = TRUE ; + SimpleMode = TRUE ; + }; + PushButton BTN_ADD + { + HelpID = "sd:PushButton:DLG_DEFINE_CUSTOMSHOW:BTN_ADD"; + Pos = MAP_APPFONT ( 84 , 67 ) ; + Size = MAP_APPFONT ( 14 , 14 ) ; + Text = "~>>" ; + TabStop = TRUE ; + }; + Control LB_CUSTOM_PAGES + { + HelpID = HID_DLG_DEFINE_CUSTOMSHOW_CTL ; + Border = TRUE ; + Pos = MAP_APPFONT ( 103 , 35 ) ; + Size = MAP_APPFONT ( 75 , 75 ) ; + TabStop = TRUE ; + }; + PushButton BTN_REMOVE + { + HelpID = "sd:PushButton:DLG_DEFINE_CUSTOMSHOW:BTN_REMOVE"; + Pos = MAP_APPFONT ( 84 , 95 ) ; + Size = MAP_APPFONT ( 14 , 14 ) ; + Text = "~<<" ; + TabStop = TRUE ; + }; + FixedText FT_PAGES + { + Pos = MAP_APPFONT ( 6 , 24 ) ; + Size = MAP_APPFONT ( 83 , 10 ) ; + Text [ en-US ] = "Existing slides" ; + }; + FixedText FT_CUSTOM_PAGES + { + Pos = MAP_APPFONT ( 103 , 24 ) ; + Size = MAP_APPFONT ( 80 , 10 ) ; + Text [ en-US ] = "Selected slides" ; + }; + Text [ en-US ] = "Define Custom Slide Show" ; +}; + diff --git a/sd/source/ui/dlg/diactrl.cxx b/sd/source/ui/dlg/diactrl.cxx new file mode 100644 index 000000000000..9549af88162c --- /dev/null +++ b/sd/source/ui/dlg/diactrl.cxx @@ -0,0 +1,181 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" +#include <com/sun/star/presentation/FadeEffect.hpp> + +#include <svx/dialogs.hrc> + +#include "sdattr.hxx" +#include "strings.hrc" + +#define _SD_DIACTRL_CXX +#include "diactrl.hxx" + +#include "sdresid.hxx" +#include "app.hrc" +#include "res_bmp.hrc" +#include <sfx2/dispatch.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/app.hxx> + +using namespace ::com::sun::star; + +SFX_IMPL_TOOLBOX_CONTROL( SdTbxCtlDiaPages, SfxUInt16Item ) + + +//======================================================================== +// SdPagesField +//======================================================================== + +SdPagesField::SdPagesField( Window* pParent, + const uno::Reference< frame::XFrame >& rFrame, + WinBits nBits ) : + SvxMetricField ( pParent, rFrame, nBits ), + m_xFrame ( rFrame ) +{ + String aStr( SdResId( STR_SLIDE_PLURAL ) ); + SetCustomUnitText( aStr ); + + // Groesse setzen + aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "XXX" ) ); + Size aSize( GetTextWidth( aStr )+20, GetTextHeight()+6 ); + + + SetSizePixel( aSize ); + + // Parameter des MetricFields setzen + SetUnit( FUNIT_CUSTOM ); + SetMin( 1 ); + SetFirst( 1 ); + SetMax( 15 ); + SetLast( 15 ); + SetSpinSize( 1 ); + SetDecimalDigits( 0 ); + Show(); +} + +// ----------------------------------------------------------------------- + +SdPagesField::~SdPagesField() +{ +} + +// ----------------------------------------------------------------------- + +void SdPagesField::UpdatePagesField( const SfxUInt16Item* pItem ) +{ + if( pItem ) + { + long nValue = (long) pItem->GetValue(); + SetValue( nValue ); + if( nValue == 1 ) + SetCustomUnitText( String( SdResId( STR_SLIDE_SINGULAR ) ) ); + else + SetCustomUnitText( String( SdResId( STR_SLIDE_PLURAL ) ) ); + } + else + SetText( String() ); +} + +// ----------------------------------------------------------------------- + +void SdPagesField::Modify() +{ + SfxUInt16Item aItem( SID_PAGES_PER_ROW, (sal_uInt16) GetValue() ); + + ::uno::Any a; + ::uno::Sequence< ::beans::PropertyValue > aArgs( 1 ); + aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PagesPerRow" )); + aItem.QueryValue( a ); + aArgs[0].Value = a; + SfxToolBoxControl::Dispatch( ::uno::Reference< ::frame::XDispatchProvider >( m_xFrame->getController(), ::uno::UNO_QUERY ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PagesPerRow" )), + aArgs ); +/* + rBindings.GetDispatcher()->Execute( + SID_PAGES_PER_ROW, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L, 0L ); +*/ +} + +/************************************************************************* +|* +|* SdTbxCtlDiaPages +|* +\************************************************************************/ + +SdTbxCtlDiaPages::SdTbxCtlDiaPages( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : + SfxToolBoxControl( nSlotId, nId, rTbx ) +{ +} + +//======================================================================== + +SdTbxCtlDiaPages::~SdTbxCtlDiaPages() +{ +} + +//======================================================================== + +void SdTbxCtlDiaPages::StateChanged( sal_uInt16, + SfxItemState eState, const SfxPoolItem* pState ) +{ + SdPagesField* pFld = (SdPagesField*) GetToolBox().GetItemWindow( GetId() ); + DBG_ASSERT( pFld, "Window not found" ); + + if ( eState == SFX_ITEM_DISABLED ) + { + pFld->Disable(); + pFld->SetText( String() ); + } + else + { + pFld->Enable(); + + const SfxUInt16Item* pItem = 0; + if ( eState == SFX_ITEM_AVAILABLE ) + { + pItem = dynamic_cast< const SfxUInt16Item* >( pState ); + DBG_ASSERT( pItem, "sd::SdTbxCtlDiaPages::StateChanged(), wrong item type!" ); + } + + pFld->UpdatePagesField( pItem ); + } +} + +//======================================================================== + +Window* SdTbxCtlDiaPages::CreateItemWindow( Window* pParent ) +{ + return new SdPagesField( pParent, m_xFrame ); +} + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlg_char.src b/sd/source/ui/dlg/dlg_char.src new file mode 100644 index 000000000000..0aff01fc6d6b --- /dev/null +++ b/sd/source/ui/dlg/dlg_char.src @@ -0,0 +1,128 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <svx/dialogs.hrc> +#include "dlg_char.hrc" +TabDialog TAB_CHAR +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 289 , 176 ) ; + Text [ en-US ] = "Character" ; + Moveable = TRUE ; + // Closeable = TRUE; // Dieser Dialog enthaelt OK und/oder Cancel Button (KH) + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_CHAR_NAME ; + Text [ en-US ] = "Font" ; + PageResID = RID_SVXPAGE_CHAR_NAME ; + }; + PageItem + { + Identifier = RID_SVXPAGE_CHAR_EFFECTS ; + Text [ en-US ] = "Font Effects" ; + PageResID = RID_SVXPAGE_CHAR_EFFECTS ; + }; + PageItem + { + Identifier = RID_SVXPAGE_CHAR_POSITION ; + PageResID = RID_SVXPAGE_CHAR_POSITION ; + Text [ en-US ] = "Position"; + }; + }; + }; + OKButton 1 + { + Pos = MAP_APPFONT ( 6 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + CancelButton 1 + { + Pos = MAP_APPFONT ( 60 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton 1 + { + Pos = MAP_APPFONT ( 114 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + PushButton 1 + { + Pos = MAP_APPFONT ( 169 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "Return" ; + TabStop = TRUE ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx new file mode 100644 index 000000000000..c720f1c806d8 --- /dev/null +++ b/sd/source/ui/dlg/dlgass.cxx @@ -0,0 +1,2030 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif +#include <com/sun/star/presentation/ClickAction.hpp> +#include <vcl/svapp.hxx> +#include <osl/mutex.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/combobox.hxx> +#include <sfx2/doctempl.hxx> +#include <svl/lstner.hxx> +#include <sfx2/objsh.hxx> +#include <svtools/ehdl.hxx> +#include <svtools/sfxecode.hxx> +#include <tools/urlobj.hxx> +#include <com/sun/star/presentation/FadeEffect.hpp> +#include <fadedef.h> +#include <sfx2/sfxsids.hrc> +#include <svl/undo.hxx> +#include "DrawDocShell.hxx" +#include <vcl/gdimtf.hxx> +#include <tools/wintypes.hxx> +#include "docprev.hxx" +#include <sfx2/app.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/request.hxx> +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/XImageManager.hpp> +#include <unotools/historyoptions.hxx> +#include <tools/urlobj.hxx> +#include <osl/file.hxx> +#include <sfx2/filedlghelper.hxx> + +#include "sdpage.hxx" +#include "helpids.h" +#include "assclass.hxx" +#include "dlgass.hrc" +#include "dlgass.hxx" +#include "dlgctrls.hxx" +#include "strings.hrc" +#include "dlgassim.hxx" +#include "TemplateScanner.hxx" +#include "WindowUpdater.hxx" + +#include <comphelper/processfactory.hxx> +#include <vector> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::sd; + +using ::std::vector; + +void InterpolateFixedBitmap( FixedBitmap * pBitmap ) +{ + Bitmap aBmp( pBitmap->GetBitmap() ); + Size aSize = pBitmap->GetSizePixel(); + aBmp.Scale( aSize, BMP_SCALE_INTERPOLATE ); + pBitmap->SetBitmap( aBmp ); +} + + +// ==================================================================== +// ==================================================================== + +const char* PageHelpIds[] = +{ + HID_SD_AUTOPILOT_PAGE1, + HID_SD_AUTOPILOT_PAGE2, + HID_SD_AUTOPILOT_PAGE3, + HID_SD_AUTOPILOT_PAGE4, + HID_SD_AUTOPILOT_PAGE5 +}; + +// ==================================================================== + +class PasswordEntry +{ +public: + String maPassword; + String maPath; +}; + +// ==================================================================== + +/** A simple wrapper that looks like a PushButton and is used to force the + broadcasting of focus events primarly for accessibility tools. + Forcing focus events is achieved by using two identical PushButtons + which, when the focus event is requested, are exchanged and play focus + ping-pong by moving the focus from one to the other. +*/ +class NextButton +{ +public: + NextButton (::Window* pParent, const ResId& rResId); + + void ForceFocusEventBroadcast (void); + void SetClickHdl (const Link& rLink); + bool IsEnabled (void); + void Enable (bool bEnable); + +private: + PushButton maNextButton1; + PushButton maNextButton2; + bool mbIsFirstButtonActive; +}; + + + +// ==================================================================== + +class AssistentDlgImpl : public SfxListener +{ +public: + AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, sal_Bool bAutoPilot ); + ~AssistentDlgImpl(); + + /// Local mutex used to serialize concurrent method calls. + ::osl::Mutex maMutex; + + SfxObjectShellLock GetDocument(); + + /** closes the current preview docshell */ + void CloseDocShell(); + + /** Extract form the history list of recently used files the impress + files and insert them into a listbox. + */ + void ScanDocmenu (void); + /** Flag that is set to sal_True after the recently used files have been + scanned. + */ + sal_Bool mbRecentDocumentsReady; + + /** When the list of templates has not been scanned already this is done + when this method is called. That includes requesting the whole list + of templates from UCB and extracting from that list the impress + templates and layouts and storing them for later use in + <member>maPresentList</member>. Note that the first call to this + method after installing a new Office may take some time. + */ + void ProvideTemplates (void); + + /** This method transfers the template folders from the template scanner + to the internal structures of this class. On termination it sets + the flag <member>mbTemplatesReady</member> to <TRUE/> to indicate + that the templates are available. + @param rTemplateFolders + This is a list of template folders. This method takes ownership + of the supplied entries by removing them from the list and + transferring them to an internal structure. + */ + void TemplateScanDone (std::vector<TemplateDir*>& rTemplateFolders); + + /** Flag that is set to sal_True after the impress templates have been + scanned. + */ + sal_Bool mbTemplatesReady; + + /** Flag used to prevent nested or concurrent calls to the + <member>UpdatePreview</memember> method. A <TRUE/> value indicates + that a preview update is currently active. + */ + sal_Bool mbPreviewUpdating; + + ::Window* mpWindow; + + void SavePassword( SfxObjectShellLock xDoc, const String& rPath ); + void RestorePassword( SfxItemSet* pSet, const String& rPath ); + String GetPassword( const String rPath ); + void DeletePassords(); + + vector< PasswordEntry* > maPasswordList; + + String maDocFile; + String maLayoutFile; + + String GetDocFileName(); + String GetLayoutFileName(); + + /// List of URLs of recently used impress files. + std::vector<String*> maOpenFilesList; + + /// List of folders containing data about impress templates. + std::vector<TemplateDir*> maPresentList; + + /// Currently selected template folder. + TemplateDir* mpTemplateRegion; + + /// Currently selected layout folder. + TemplateDir* mpLayoutRegion; + + // preview + sal_Bool mbUserDataDirty; + Timer maPrevTimer; + Timer maEffectPrevTimer; + Timer maUpdatePageListTimer; + Timer maStartScanTimer; + + SfxObjectShellLock xDocShell; + + ::std::auto_ptr<WindowUpdater> mpWindowUpdater; + + sal_Bool mbPreview; + sal_uInt16 mnShowPage; + sal_Bool mbDocPreview; + + sal_uLong mnTemplate; + + String maPageListFile; + + void UpdatePreview( sal_Bool bDocPreview ); + void UpdatePageList(); + void UpdateUserData(); + + sal_Bool IsOwnFormat( const String& rPath ); + + // dlg status + void EndDialog( long nResult = 0 ); + + void SetStartType( StartType eType ); + StartType GetStartType(); + + void SelectTemplateRegion( const String& rRegion ); + void SelectLayoutRegion( const String& rRegion ); + + void UpdatePage(); + void ChangePage(); + void LeavePage(); + + String GetUiTextForCommand (const ::rtl::OUString& aCommandURL); + Image GetUiIconForCommand (const ::rtl::OUString& aCommandURL); + + DECL_LINK( StartScanHdl, void * ); + DECL_LINK( SelectFileHdl, ListBox * ); + DECL_LINK( SelectRegionHdl, ListBox * ); + DECL_LINK( UpdatePreviewHdl, void * ); + DECL_LINK( UpdatePageListHdl, void * ); + DECL_LINK( StartTypeHdl, RadioButton * ); + DECL_LINK( SelectTemplateHdl, ListBox * ); + DECL_LINK( NextPageHdl, PushButton * ); + DECL_LINK( LastPageHdl, PushButton * ); + DECL_LINK( PreviewFlagHdl, CheckBox * ); + DECL_LINK( EffectPreviewHdl, Button * ); + DECL_LINK( SelectLayoutHdl, ListBox * ); + DECL_LINK( PageSelectHdl, Control * ); + DECL_LINK( PresTypeHdl, RadioButton * ); + DECL_LINK( UpdateUserDataHdl, Edit* ); + DECL_LINK( SelectEffectHdl, void* ); + DECL_LINK( OpenButtonHdl, Button * ); + + // Common + Assistent maAssistentFunc; + CheckBox maPreviewFlag; + CheckBox maStartWithFlag; + HelpButton maHelpButton; + CancelButton maCancelButton; + PushButton maLastPageButton; + NextButton maNextPageButton; + OKButton maFinishButton; + SdDocPreviewWin maPreview; + + String maCreateStr; + String maOpenStr; + + // Seite 1 + FixedBitmap* mpPage1FB; + FixedLine* mpPage1ArtFL; + RadioButton* mpPage1EmptyRB; + RadioButton* mpPage1TemplateRB; + ListBox* mpPage1RegionLB; + ListBox* mpPage1TemplateLB; + RadioButton* mpPage1OpenRB; + ListBox* mpPage1OpenLB; + PushButton* mpPage1OpenPB; + + // Seite 2 + FixedBitmap* mpPage2FB; + FixedLine* mpPage2LayoutFL; + ListBox* mpPage2RegionLB; + ListBox* mpPage2LayoutLB; + FixedLine* mpPage2OutTypesFL; + RadioButton* mpPage2Medium1RB; + RadioButton* mpPage2Medium2RB; + RadioButton* mpPage2Medium3RB; + RadioButton* mpPage2Medium4RB; + RadioButton* mpPage2Medium5RB; + + // Seite 3 + FixedBitmap* mpPage3FB; + FixedLine* mpPage3EffectFL; + FixedText* mpPage3EffectFT; + FadeEffectLB* mpPage3EffectLB; + FixedText* mpPage3SpeedFT; + ListBox* mpPage3SpeedLB; + FixedLine* mpPage3PresTypeFL; + RadioButton* mpPage3PresTypeLiveRB; + RadioButton* mpPage3PresTypeKioskRB; + FixedText* mpPage3PresTimeFT; + TimeField* mpPage3PresTimeTMF; + FixedText* mpPage3BreakFT; + TimeField* mpPage3BreakTMF; + CheckBox* mpPage3LogoCB; + + // Seite 4 + FixedBitmap* mpPage4FB; + FixedLine* mpPage4PersonalFL; + FixedText* mpPage4AskNameFT; + Edit* mpPage4AskNameEDT; + FixedText* mpPage4AskTopicFT; + Edit* mpPage4AskTopicEDT; + FixedText* mpPage4AskInfoFT; + MultiLineEdit* mpPage4AskInfoEDT; + + // Seite 5 + FixedBitmap* mpPage5FB; + FixedText* mpPage5PageListFT; + SdPageListControl* mpPage5PageListCT; + CheckBox* mpPage5SummaryCB; + +}; + + + +// ==================================================================== + +AssistentDlgImpl::AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, sal_Bool bAutoPilot ) : + mpTemplateRegion(NULL), + mpLayoutRegion(NULL), + mbUserDataDirty(sal_False), + xDocShell (NULL), + mpWindowUpdater (new WindowUpdater()), + mbPreview(sal_True), + mnShowPage(0), + mbDocPreview(sal_False), + maAssistentFunc(5), + maPreviewFlag(pWindow,SdResId(CB_PREVIEW)), + maStartWithFlag(pWindow,SdResId(CB_STARTWITH)), + maHelpButton(pWindow,SdResId(BUT_HELP)), + maCancelButton(pWindow,SdResId(BUT_CANCEL)), + maLastPageButton(pWindow,SdResId(BUT_LAST)), + maNextPageButton(pWindow,SdResId(BUT_NEXT)), + maFinishButton(pWindow,SdResId(BUT_FINISH)), + maPreview(pWindow,SdResId(CT_PREVIEW)), + maCreateStr(SdResId(STR_CREATE)), + maOpenStr(SdResId(STR_OPEN)) +{ + maPageListFile += sal_Unicode('?'), + mbRecentDocumentsReady = sal_False; + mbTemplatesReady = sal_False; + mbPreviewUpdating = sal_False; + + mpWindow = pWindow; + + if(bAutoPilot) + maStartWithFlag.Hide(); + else + maAssistentFunc.InsertControl(1, &maStartWithFlag ); + + //page1 wird initialisiert und an die Assistentenfunktionalitaet + //uebergeben + maAssistentFunc.InsertControl(1, &maPreview ); + maAssistentFunc.InsertControl(1, &maPreviewFlag ); + maAssistentFunc.InsertControl(1, + mpPage1FB = new FixedBitmap(pWindow,SdResId(FB_PAGE1))); + maAssistentFunc.InsertControl(1, + mpPage1ArtFL = new FixedLine(pWindow,SdResId(FL_PAGE1_ARTGROUP))); + maAssistentFunc.InsertControl(1, + mpPage1EmptyRB=new RadioButton(pWindow,SdResId(RB_PAGE1_EMPTY))); + maAssistentFunc.InsertControl(1, + mpPage1TemplateRB=new RadioButton(pWindow,SdResId(RB_PAGE1_TEMPLATE))); + maAssistentFunc.InsertControl(1, + mpPage1OpenRB=new RadioButton(pWindow,SdResId(RB_PAGE1_OPEN))); + maAssistentFunc.InsertControl(1, + mpPage1RegionLB = new ListBox(pWindow,SdResId(LB_PAGE1_REGION))); + maAssistentFunc.InsertControl(1, + mpPage1TemplateLB=new ListBox(pWindow,SdResId(LB_PAGE1_TEMPLATES))); + maAssistentFunc.InsertControl(1, + mpPage1OpenPB=new PushButton(pWindow,SdResId(PB_PAGE1_OPEN))); + maAssistentFunc.InsertControl(1, + mpPage1OpenLB=new ListBox(pWindow,SdResId(LB_PAGE1_OPEN))); + + // Align the button and list box displayed for the "open existing file" + // radio button with the text of that radio button. + { + RadioButton aEmptyRB (mpWindow); + sal_Int32 nIndent (aEmptyRB.CalcMinimumSize(0).Width()); + sal_Int32 nLeft (mpPage1OpenRB->GetPosPixel().X() + nIndent); + sal_Int32 nWidth (mpPage1OpenRB->GetSizePixel().Width() - nIndent); + mpPage1OpenPB->SetPosSizePixel( + Point(nLeft, mpPage1OpenPB->GetPosPixel().Y()), + Size(mpPage1OpenPB->GetSizePixel())); + mpPage1OpenLB->SetPosSizePixel( + Point(nLeft, mpPage1OpenLB->GetPosPixel().Y()), + Size(nWidth, mpPage1OpenLB->GetSizePixel().Height())); + } + + // Set text and icon of the 'Open...' button. + { + String sText (GetUiTextForCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open")))); + // Remove the mnemonic and add a leading space so that icon and text + // are not too close together. + sText.SearchAndReplaceAll(String(RTL_CONSTASCII_USTRINGPARAM("~")),String()); + sText.Insert(String(RTL_CONSTASCII_USTRINGPARAM(" ")),0); + mpPage1OpenPB->SetText(sText); + // Place icon left of text and both centered in the button. + mpPage1OpenPB->SetModeImage( + GetUiIconForCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open"))) + ); + mpPage1OpenPB->EnableImageDisplay(sal_True); + mpPage1OpenPB->EnableTextDisplay(sal_True); + mpPage1OpenPB->SetImageAlign(IMAGEALIGN_LEFT); + mpPage1OpenPB->SetStyle(mpPage1OpenPB->GetStyle() | WB_CENTER); + } + + // links&handler + mpPage1RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl)); + mpPage1RegionLB->SetDropDownLineCount( 6 ); + mpPage1TemplateLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectTemplateHdl)); + mpPage1TemplateLB->InsertEntry(String(SdResId(STR_ISLOADING))); + + mpPage1EmptyRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl)); + mpPage1TemplateRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl)); + mpPage1OpenRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl)); + mpPage1OpenLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectFileHdl)); + mpPage1OpenLB->SetDoubleClickHdl(rFinishLink); + mpPage1OpenPB->SetClickHdl(LINK(this,AssistentDlgImpl,OpenButtonHdl)); + + // Seite 2 + maAssistentFunc.InsertControl(2, &maPreview ); + maAssistentFunc.InsertControl(2, &maPreviewFlag ); + maAssistentFunc.InsertControl(2, + mpPage2FB = new FixedBitmap(pWindow,SdResId(FB_PAGE2))); + maAssistentFunc.InsertControl(2, + mpPage2LayoutFL = new FixedLine( pWindow, SdResId(FL_PAGE2_LAYOUT) )); + maAssistentFunc.InsertControl(2, + mpPage2RegionLB = new ListBox(pWindow,SdResId(LB_PAGE2_REGION) )); + maAssistentFunc.InsertControl(2, + mpPage2LayoutLB = new ListBox(pWindow,SdResId(LB_PAGE2_LAYOUT) )); + + maAssistentFunc.InsertControl(2, + mpPage2OutTypesFL = new FixedLine( pWindow, SdResId(FL_PAGE2_OUTPUTTYPES) )); + maAssistentFunc.InsertControl(2, + mpPage2Medium5RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM5) )); + maAssistentFunc.InsertControl(2, + mpPage2Medium3RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM3) )); + maAssistentFunc.InsertControl(2, + mpPage2Medium4RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM4) )); + maAssistentFunc.InsertControl(2, + mpPage2Medium1RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM1) )); + maAssistentFunc.InsertControl(2, + mpPage2Medium2RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM2) )); + mpPage2Medium5RB->Check(); + + mpPage2RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl)); + mpPage2RegionLB->SetDropDownLineCount( 6 ); + mpPage2LayoutLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectLayoutHdl)); + mpPage2LayoutLB->InsertEntry(String(SdResId(STR_ISLOADING))); + + // Seite 3 + maAssistentFunc.InsertControl(3, &maPreview ); + maAssistentFunc.InsertControl(3, &maPreviewFlag ); + maAssistentFunc.InsertControl(3, + mpPage3FB = new FixedBitmap(pWindow,SdResId(FB_PAGE3))); + maAssistentFunc.InsertControl(3, + mpPage3EffectFL = new FixedLine( pWindow, SdResId(FL_PAGE3_EFFECT) )); + maAssistentFunc.InsertControl(3, + mpPage3EffectFT = new FixedText( pWindow, SdResId(FT_PAGE3_EFFECT) )); + maAssistentFunc.InsertControl(3, + mpPage3EffectLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_EFFECT) )); + maAssistentFunc.InsertControl(3, + mpPage3SpeedFT = new FixedText( pWindow, SdResId(FT_PAGE3_SPEED) )); + maAssistentFunc.InsertControl(3, + mpPage3SpeedLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_SPEED) )); + maAssistentFunc.InsertControl(3, + mpPage3PresTypeFL = new FixedLine( pWindow, SdResId(FL_PAGE3_PRESTYPE) )); + maAssistentFunc.InsertControl(3, + mpPage3PresTypeLiveRB = new RadioButton( pWindow, SdResId(RB_PAGE3_LIVE) )); + maAssistentFunc.InsertControl(3, + mpPage3PresTypeKioskRB = new RadioButton( pWindow, SdResId(RB_PAGE3_KIOSK) )); + maAssistentFunc.InsertControl(3, + mpPage3PresTimeFT = new FixedText( pWindow, SdResId( FT_PAGE3_TIME) )); + maAssistentFunc.InsertControl(3, + mpPage3PresTimeTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_TIME) )); + maAssistentFunc.InsertControl(3, + mpPage3BreakFT = new FixedText( pWindow, SdResId( FT_PAGE3_BREAK) )); + maAssistentFunc.InsertControl(3, + mpPage3BreakTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_BREAK) )); + maAssistentFunc.InsertControl(3, + mpPage3LogoCB = new CheckBox( pWindow, SdResId( CB_PAGE3_LOGO) )); + + mpPage3EffectLB->Fill(); + mpPage3EffectLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl )); + mpPage3EffectLB->SetDropDownLineCount( 12 ); + + mpPage3SpeedLB->InsertEntry( String( SdResId(STR_SLOW) )); + mpPage3SpeedLB->InsertEntry( String( SdResId(STR_MEDIUM) )); + mpPage3SpeedLB->InsertEntry( String( SdResId(STR_FAST) )); + mpPage3SpeedLB->SetDropDownLineCount( 3 ); + mpPage3SpeedLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl )); + mpPage3SpeedLB->SelectEntryPos( 1 ); + + mpPage3PresTypeLiveRB->Check(); + mpPage3PresTypeLiveRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl )); + mpPage3PresTypeKioskRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl )); + mpPage3PresTimeTMF->SetFormat( TIMEF_SEC ); + mpPage3PresTimeTMF->SetTime( Time( 0, 0, 10 ) ); + mpPage3BreakTMF->SetFormat( TIMEF_SEC ); + mpPage3BreakTMF->SetTime( Time( 0, 0, 10 ) ); + mpPage3LogoCB->Check(); + + // set cursor in timefield + Edit *pEditPage3PresTimeTMF = mpPage3PresTimeTMF->GetField(); + Edit *pEditPage3BreakTMF = mpPage3BreakTMF->GetField(); + Selection aSel1( pEditPage3PresTimeTMF->GetMaxTextLen(), pEditPage3PresTimeTMF->GetMaxTextLen() ); + Selection aSel2( pEditPage3BreakTMF->GetMaxTextLen(), pEditPage3BreakTMF->GetMaxTextLen() ); + pEditPage3PresTimeTMF->SetSelection( aSel1 ); + pEditPage3BreakTMF->SetSelection( aSel2 ); + + // Seite 4 + maAssistentFunc.InsertControl(4, + mpPage4FB = new FixedBitmap(pWindow,SdResId(FB_PAGE4))); + maAssistentFunc.InsertControl(4, + mpPage4PersonalFL = new FixedLine( pWindow, SdResId(FL_PAGE4_PERSONAL) )); + maAssistentFunc.InsertControl(4, + mpPage4AskNameFT = new FixedText( pWindow, SdResId(FT_PAGE4_ASKNAME) )); + maAssistentFunc.InsertControl(4, + mpPage4AskNameEDT = new Edit( pWindow, SdResId(EDT_PAGE4_ASKNAME) )); + maAssistentFunc.InsertControl(4, + mpPage4AskTopicFT= new FixedText( pWindow, SdResId(FT_PAGE4_ASKTOPIC) )); + maAssistentFunc.InsertControl(4, + mpPage4AskTopicEDT = new Edit( pWindow, SdResId(EDT_PAGE4_ASKTOPIC) )); + maAssistentFunc.InsertControl(4, + mpPage4AskInfoFT = new FixedText( pWindow, SdResId(FT_PAGE4_ASKINFORMATION) )); + maAssistentFunc.InsertControl(4, + mpPage4AskInfoEDT = new MultiLineEdit( pWindow, SdResId(EDT_PAGE4_ASKINFORMATION) )); + + mpPage4AskNameEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl)); + mpPage4AskTopicEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl)); + mpPage4AskInfoEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl)); + + // page 5 + maAssistentFunc.InsertControl(5, &maPreview ); + maAssistentFunc.InsertControl(5, &maPreviewFlag ); + maAssistentFunc.InsertControl(5, + mpPage5FB = new FixedBitmap(pWindow,SdResId(FB_PAGE5))); + maAssistentFunc.InsertControl(5, + mpPage5PageListFT = new FixedText( pWindow, SdResId( FT_PAGE5_PAGELIST ) )); + maAssistentFunc.InsertControl(5, + mpPage5PageListCT = new SdPageListControl( pWindow, SdResId( CT_PAGE5_PAGELIST ) )); + maAssistentFunc.InsertControl(5, + mpPage5SummaryCB = new CheckBox( pWindow, SdResId( CB_PAGE5_SUMMARY ) )); + + mpPage5PageListCT->SetSelectHdl(LINK(this,AssistentDlgImpl, PageSelectHdl)); + + + // generell + InterpolateFixedBitmap( mpPage1FB ); + InterpolateFixedBitmap( mpPage2FB ); + InterpolateFixedBitmap( mpPage3FB ); + InterpolateFixedBitmap( mpPage4FB ); + InterpolateFixedBitmap( mpPage5FB ); + + maLastPageButton.SetClickHdl(LINK(this,AssistentDlgImpl, LastPageHdl )); + maNextPageButton.SetClickHdl(LINK(this,AssistentDlgImpl, NextPageHdl )); + + maPreviewFlag.Check( mbPreview ); + maPreviewFlag.SetClickHdl(LINK(this, AssistentDlgImpl, PreviewFlagHdl )); + maPreview.SetClickHdl(LINK(this,AssistentDlgImpl, EffectPreviewHdl )); + + //setzt die Ausgangsseite + maAssistentFunc.GotoPage(1); + maLastPageButton.Disable(); + + maPrevTimer.SetTimeout( 200 ); + maPrevTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, UpdatePreviewHdl)); + + maEffectPrevTimer.SetTimeout( 50 ); + maEffectPrevTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, EffectPreviewHdl )); + + maUpdatePageListTimer.SetTimeout( 50 ); + maUpdatePageListTimer.SetTimeoutHdl( LINK( this, AssistentDlgImpl, UpdatePageListHdl)); + + SetStartType( ST_EMPTY ); + + ChangePage(); + + mpWindowUpdater->RegisterWindow (&maPreview); + + UpdatePreview( sal_True ); + + //check wether we should start with a template document initialy and preselect it + const ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ); + String aStandardTemplate( SfxObjectFactory::GetStandardTemplate( aServiceName ) ); + if( aStandardTemplate.Len() ) + { + ProvideTemplates(); + + //find aStandardTemplate in maPresentList + TemplateDir* pStandardTemplateDir = 0; + TemplateEntry* pStandardTemplateEntry = 0; + + std::vector<TemplateDir*>::iterator I; + for (I=maPresentList.begin(); I!=maPresentList.end(); ++I) + { + TemplateDir* pDir = *I; + std::vector<TemplateEntry*>::iterator J; + for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); ++J) + { + TemplateEntry* pEntry = *J; + if(pEntry->msPath == aStandardTemplate) + { + pStandardTemplateDir = pDir; + pStandardTemplateEntry = pEntry; + break; + } + } + if(pStandardTemplateDir) + break; + } + + //preselect template + if( pStandardTemplateDir && pStandardTemplateEntry ) + { + mpPage1RegionLB->SelectEntry( pStandardTemplateDir->msRegion ); + SelectTemplateRegion( pStandardTemplateDir->msRegion ); + mpPage1TemplateLB->SelectEntry( pStandardTemplateEntry->msTitle ); + SelectTemplateHdl(mpPage1TemplateLB); + } + } +} + + + + +AssistentDlgImpl::~AssistentDlgImpl() +{ + CloseDocShell(); + + DeletePassords(); + + // Delete the template file infos. + std::vector<TemplateDir*>::iterator I; + std::vector<TemplateEntry*>::iterator J; + for (I=maPresentList.begin(); I!=maPresentList.end(); ++I) + { + for (J=(*I)->maEntries.begin(); J!=(*I)->maEntries.end(); ++J) + delete (*J); + delete (*I); + } + + // Seite 1 + delete mpPage1FB; + delete mpPage1ArtFL; + delete mpPage1EmptyRB; + delete mpPage1TemplateRB; + delete mpPage1TemplateLB; + delete mpPage1RegionLB; + delete mpPage1OpenRB; + delete mpPage1OpenLB; + delete mpPage1OpenPB; + + // Seite 2 + delete mpPage2FB; + delete mpPage2LayoutFL; + delete mpPage2RegionLB; + delete mpPage2LayoutLB; + delete mpPage2OutTypesFL; + delete mpPage2Medium1RB; + delete mpPage2Medium2RB; + delete mpPage2Medium3RB; + delete mpPage2Medium4RB; + delete mpPage2Medium5RB; + + // Seite 3 + delete mpPage3FB; + delete mpPage3EffectFL; + delete mpPage3EffectFT; + delete mpPage3EffectLB; + delete mpPage3SpeedFT; + delete mpPage3SpeedLB; + delete mpPage3PresTypeFL; + delete mpPage3PresTypeLiveRB; + delete mpPage3PresTypeKioskRB; + delete mpPage3PresTimeFT; + delete mpPage3PresTimeTMF; + delete mpPage3BreakFT; + delete mpPage3BreakTMF; + delete mpPage3LogoCB; + + // Seite 4 + delete mpPage4FB; + delete mpPage4PersonalFL; + delete mpPage4AskNameFT; + delete mpPage4AskNameEDT; + delete mpPage4AskTopicFT; + delete mpPage4AskTopicEDT; + delete mpPage4AskInfoFT; + delete mpPage4AskInfoEDT; + + // Seite 5 + delete mpPage5FB; + delete mpPage5PageListFT; + delete mpPage5PageListCT; + delete mpPage5SummaryCB; + + // Delete the file history list. + std::vector<String*>::iterator I2; + for (I2=maOpenFilesList.begin(); I2!=maOpenFilesList.end(); ++I2) + delete *I2; +} + +void AssistentDlgImpl::CloseDocShell() +{ + if(xDocShell.Is()) + { + uno::Reference< util::XCloseable > xCloseable( xDocShell->GetModel(), uno::UNO_QUERY ); + if( xCloseable.is() ) + { + xCloseable->close( sal_True ); + xDocShell = NULL; + } + else + { + xDocShell->DoClose(); + xDocShell = NULL; + } + } +} + +void AssistentDlgImpl::EndDialog( long ) +{ + mpWindow = NULL; +} + + + + +void AssistentDlgImpl::ScanDocmenu (void) +{ + if( mbRecentDocumentsReady ) + return; + + uno::Sequence<uno::Sequence<beans::PropertyValue> > aHistory = + SvtHistoryOptions().GetList (ePICKLIST); + + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + uno::Reference< container::XNameAccess > xFilterFactory( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.FilterFactory" ) ) ), uno::UNO_QUERY ); + + Reference< ::com::sun::star::ucb::XSimpleFileAccess > xFileAccess( + xFactory->createInstance( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), + UNO_QUERY_THROW); + + sal_uInt32 nCount = aHistory.getLength(); + for (sal_uInt32 nItem=0; nItem<nCount; ++nItem) + { + // Get the current history item's properties. + uno::Sequence<beans::PropertyValue> aPropertySet = aHistory[nItem]; + rtl::OUString sURL; + rtl::OUString sFilter; + rtl::OUString sTitle; + rtl::OUString sPassword; + sal_uInt32 nPropertyCount = aPropertySet.getLength(); + for (sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty) + if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_URL) + aPropertySet[nProperty].Value >>= sURL; + else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_FILTER) + aPropertySet[nProperty].Value >>= sFilter; + else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_TITLE) + aPropertySet[nProperty].Value >>= sTitle; + else if (aPropertySet[nProperty].Name == HISTORY_PROPERTYNAME_PASSWORD) + aPropertySet[nProperty].Value >>= sPassword; + + // If the entry is an impress file then insert it into the + // history list and the list box. + uno::Sequence< beans::PropertyValue > lProps; + if (xFilterFactory->hasByName(sFilter)) + { + uno::Any aFilterPropSet = xFilterFactory->getByName( sFilter ); + aFilterPropSet >>= lProps; + } + + sal_Int32 nPropCount = lProps.getLength(); + rtl::OUString sFactoryName; + for( sal_Int32 i=0; i<nPropCount; ++i ) + { + if( lProps[i].Name.compareToAscii( "DocumentService" ) == 0 && + (lProps[i].Value >>= sFactoryName) && + sFactoryName.compareToAscii( "com.sun.star.presentation.PresentationDocument" ) == 0 ) + { + // yes, it's an impress document + INetURLObject aURL; + + // Do not include the file if it does not exist. + if (xFileAccess.is() && ! xFileAccess->exists(sURL)) + continue; + + aURL.SetSmartURL (sURL); + // The password is set only when it is not empty. + if (sPassword.getLength() > 0) + aURL.SetPass (sPassword); + maOpenFilesList.push_back (new String (aURL.GetMainURL( INetURLObject::NO_DECODE ))); + mpPage1OpenLB->InsertEntry (sTitle); + break; + } + } + } + mbRecentDocumentsReady = sal_True; + try + { + UpdatePreview(sal_True); + } + catch (uno::RuntimeException& ) + { + // Ignore all exceptions. + } +} + + + +void AssistentDlgImpl::ProvideTemplates (void) +{ + if ( ! mbTemplatesReady) + { + TemplateScanner aScanner; + aScanner.Scan (); + TemplateScanDone (aScanner.GetFolderList()); + + try + { + UpdatePreview(sal_True); + } + catch (uno::RuntimeException& e) + { + // Ignore all exceptions. + (void) e; + } + } +} + +void AssistentDlgImpl::TemplateScanDone ( + std::vector<TemplateDir*>& rTemplateFolder) +{ + // This method is called from a thread. Therefore we get the solar mutex. + SolarMutexGuard aGuard; + + // Copy the contents of the given template folders to a local list. + maPresentList.swap (rTemplateFolder); + + // Fill in the list box on the first page. + int nFirstEntry = 0; + mpPage1RegionLB->Clear(); + std::vector<TemplateDir*>::iterator I; + int i; + for (i=0,I=maPresentList.begin(); I!=maPresentList.end(); ++I,++i) + { + TemplateDir* pDir = *I; + if (pDir == NULL) + continue; + + // HACK! presnt directory is always initially selected. + // We have to look at the first entry to get a URL. + if (pDir->maEntries.size() > 0) + { + TemplateEntry* pEntry = pDir->maEntries.front(); + if (pEntry != NULL) + if (pEntry->msPath.SearchAscii("presnt") != STRING_NOTFOUND) + nFirstEntry = i; + } + + mpPage1RegionLB->InsertEntry (pDir->msRegion); + } + mpPage1RegionLB->SelectEntryPos ((sal_uInt16)nFirstEntry); + mpPage1RegionLB->Update(); + SelectTemplateRegion (mpPage1RegionLB->GetSelectEntry()); + + // Fill in the list box on the second page. + nFirstEntry = 0; + mpPage2RegionLB->Clear(); + for (i=0,I=maPresentList.begin(); I!=maPresentList.end(); ++I,++i) + { + TemplateDir* pDir = *I; + if (pDir == NULL) + continue; + + // HACK! layout directory is always initially selected. + // We have to look at the first entry to get a URL. + if (pDir->maEntries.size() > 0) + { + TemplateEntry* pEntry = pDir->maEntries.front(); + if (pEntry != NULL) + if (pEntry->msPath.SearchAscii("layout") != STRING_NOTFOUND) + nFirstEntry = i; + } + + mpPage2RegionLB->InsertEntry (pDir->msRegion); + } + mpPage2RegionLB->SelectEntryPos ((sal_uInt16)nFirstEntry); + mpPage2RegionLB->Update(); + SelectLayoutRegion (mpPage2RegionLB->GetSelectEntry()); + + // Make the changes visible. + mbTemplatesReady = sal_True; + if (mpWindow) + UpdatePage(); +} + + + + +// ******************************************************************** +// Status Methoden +// ******************************************************************** + +void AssistentDlgImpl::SetStartType( StartType eType ) +{ + mpPage1EmptyRB->SetState( eType == ST_EMPTY ); + mpPage1TemplateRB->SetState( eType == ST_TEMPLATE ); + mpPage1OpenRB->SetState( eType == ST_OPEN ); + maNextPageButton.Enable( eType != ST_OPEN ); + + mpPage1RegionLB->Show(eType == ST_TEMPLATE); + mpPage1TemplateLB->Show(eType == ST_TEMPLATE); + mpPage1OpenLB->Show(eType == ST_OPEN); + mpPage1OpenPB->Show(eType == ST_OPEN); + + if (eType == ST_OPEN) + maFinishButton.SetText(maOpenStr); + else + maFinishButton.SetText(maCreateStr); +} + +StartType AssistentDlgImpl::GetStartType() +{ + if( mpPage1EmptyRB->IsChecked() ) + return ST_EMPTY; + else if( mpPage1TemplateRB->IsChecked() ) + return ST_TEMPLATE; + else + return ST_OPEN; +} + +String AssistentDlgImpl::GetDocFileName() +{ + String aTitle; + if(mpWindow) + { + aTitle = mpWindow->GetText(); + sal_uInt16 nPos = aTitle.Search(sal_Unicode('(')); + if(nPos != STRING_NOTFOUND) + aTitle.Erase( nPos-1 ); + } + + String aDocFile; + if( GetStartType() == ST_TEMPLATE ) + { + const sal_uInt16 nEntry = mpPage1TemplateLB->GetSelectEntryPos(); + TemplateEntry* pEntry = NULL; + if(nEntry != (sal_uInt16)-1) + pEntry = mpTemplateRegion->maEntries[nEntry]; + + if(pEntry) + { + aDocFile = pEntry->msPath; + + aTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); + aTitle.Append( pEntry->msTitle ); + aTitle.Append( sal_Unicode(')') ); + } + } + else if( GetStartType() == ST_OPEN ) + { + const sal_uInt16 nEntry = mpPage1OpenLB->GetSelectEntryPos(); + if(nEntry != (sal_uInt16)-1 ) + aDocFile = *maOpenFilesList[nEntry]; + } + + if(mpWindow) + mpWindow->SetText(aTitle); + + return aDocFile; +} + +String AssistentDlgImpl::GetLayoutFileName() +{ + String aFile; + const sal_uInt16 nEntry = mpPage2LayoutLB->GetSelectEntryPos(); + TemplateEntry* pEntry = NULL; + if(nEntry != (sal_uInt16)-1 && nEntry > 0) + pEntry = mpLayoutRegion->maEntries[nEntry-1]; + + if(pEntry) + aFile = pEntry->msPath; + + return aFile; +} + +SfxObjectShellLock AssistentDlgImpl::GetDocument() +{ + UpdatePreview(sal_False); // aber komplett laden + UpdatePageList(); + + SfxObjectShell* pShell = xDocShell; + ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell,pShell); + SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL; + + if(pDoc) + { + const sal_uInt16 nPageCount = pDoc->GetSdPageCount(PK_STANDARD); + sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked(); + sal_uInt32 nNewTime = (sal_uInt32)mpPage3PresTimeTMF->GetTime().GetMSFromTime() / 1000; + if(bKiosk) + { + PresentationSettings& rSettings = pDoc->getPresentationSettings(); + rSettings.mbEndless = bKiosk; + rSettings.mnPauseTimeout = (sal_Int32)mpPage3BreakTMF->GetTime().GetMSFromTime() / 1000; + rSettings.mbShowPauseLogo = mpPage3LogoCB->IsChecked(); + } + + sal_uInt16 nPgAbsNum = 0; + sal_uInt16 nPgRelNum = 0; + while( nPgAbsNum < nPageCount ) + { + SdPage* pPage = pDoc->GetSdPage( nPgRelNum, PK_STANDARD ); + if( mpPage5PageListCT->IsPageChecked(nPgAbsNum) ) + { + mpPage3EffectLB->applySelected(pPage); + const sal_uInt16 nPos = mpPage3SpeedLB->GetSelectEntryPos(); + pPage->setTransitionDuration( (nPos == 0) ? 3.0 : (nPos == 1) ? 2.0 : 1.0 ); + if(bKiosk) + { + pPage->SetPresChange( PRESCHANGE_AUTO ); + pPage->SetTime(nNewTime); + } + nPgRelNum++; + } + else + { + // diese Seite loeschen + pDoc->DeletePage( (nPgRelNum << 1) + 2 ); // Notizseite loeschen + pDoc->DeletePage( (nPgRelNum << 1) + 1 ); // Seite loeschen + } + + nPgAbsNum++; + } + } + else + { + OSL_FAIL("sd::AssistentDlgImpl::GetDocument(), no template?"); + } + + SfxObjectShellLock xRet = xDocShell; + xDocShell = NULL; + + return xRet; +} + +void AssistentDlgImpl::LeavePage() +{ + int nPage = maAssistentFunc.GetCurrentPage(); + + if( nPage == 4 && mbUserDataDirty ) + maPrevTimer.Start(); +} + +void AssistentDlgImpl::ChangePage() +{ + maNextPageButton.Enable(!maAssistentFunc.IsLastPage()); + maLastPageButton.Enable(!maAssistentFunc.IsFirstPage()); + + sal_uInt16 nPage = (sal_uInt16)maAssistentFunc.GetCurrentPage(); + + if( mpWindow ) + { + mpWindow->SetHelpId( PageHelpIds[nPage-1]); + } + + UpdatePage(); + + if( maNextPageButton.IsEnabled() ) + { + maNextPageButton.ForceFocusEventBroadcast(); + } + else + maFinishButton.GrabFocus(); +} + +void AssistentDlgImpl::UpdatePage() +{ + sal_uInt16 nPage = (sal_uInt16)maAssistentFunc.GetCurrentPage(); + + switch(nPage) + { + case 1: + { + // Elemente auf der ersten Seite abhaengig vom Starttype Zeigen + SetStartType( GetStartType() ); + mpPage1TemplateRB->Enable(sal_True /*mbTemplatesReady*/); + break; + } + + case 2: + { + mpPage2RegionLB->Enable(mbTemplatesReady); + mpPage2LayoutLB->Enable(mbTemplatesReady); + + if( GetStartType() != ST_EMPTY ) + { + mpPage2Medium5RB->Enable( sal_True ); + } + else + { + mpPage2Medium5RB->Enable( sal_False ); + if(mpPage2Medium5RB->IsChecked()) + mpPage2Medium1RB->Check(); + } + + break; + } + case 5: + { + if(mbDocPreview || maPageListFile != maDocFile) + mpPage5PageListCT->Clear(); + + maUpdatePageListTimer.Start(); + break; + } + + case 3: + { + if(GetStartType() != ST_TEMPLATE) + maNextPageButton.Enable(false); + + sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked(); + mpPage3PresTimeFT->Enable(bKiosk); + mpPage3BreakFT->Enable(bKiosk); + mpPage3PresTimeTMF->Enable(bKiosk); + mpPage3BreakTMF->Enable(bKiosk); + mpPage3LogoCB->Enable(bKiosk); + break; + } + } +} + +// ******************************************************************** +// UI-Handler +// ******************************************************************** + +IMPL_LINK( AssistentDlgImpl, SelectRegionHdl, ListBox *, pLB ) +{ + if( pLB == mpPage1RegionLB ) + { + SelectTemplateRegion( pLB->GetSelectEntry() ); + SetStartType( ST_TEMPLATE ); + mpPage2Medium5RB->Check(); + } + else + { + SelectLayoutRegion( pLB->GetSelectEntry() ); + } + + return 0; +} + +IMPL_LINK( AssistentDlgImpl, SelectEffectHdl, void*, EMPTYARG ) +{ + maEffectPrevTimer.Start(); + return 0; +} + +IMPL_LINK( AssistentDlgImpl, OpenButtonHdl, Button*, pButton ) +{ + // Clear the selection and forward the call. + mpPage1OpenLB->SetNoSelection(); + return mpPage1OpenLB->GetDoubleClickHdl().Call(pButton); +} + +IMPL_LINK( AssistentDlgImpl, EffectPreviewHdl, Button *, EMPTYARG ) +{ + if(mbPreview && xDocShell.Is() ) + { + SfxObjectShell* pShell = xDocShell; + DrawDocShell* pDocShell = dynamic_cast< DrawDocShell * >(pShell); + if( pDocShell ) + { + SdDrawDocument* pDoc = pDocShell->GetDoc(); + if( pDoc ) + { + SdPage* pPage = pDoc->GetSdPage( mnShowPage, PK_STANDARD ); + if( pPage ) + mpPage3EffectLB->applySelected(pPage); + } + } + maPreview.startPreview(); + } + return 0; +} + +IMPL_LINK( AssistentDlgImpl, PreviewFlagHdl, CheckBox *, EMPTYARG ) + +{ + if( maPreviewFlag.IsChecked() != mbPreview ) + { + mbPreview = maPreviewFlag.IsChecked(); + UpdatePreview(sal_True); + } + return 0; +} + +IMPL_LINK( AssistentDlgImpl, SelectTemplateHdl, ListBox *, EMPTYARG ) +{ + SetStartType( ST_TEMPLATE ); + mpPage2Medium5RB->Check(); + mpPage2LayoutLB->SelectEntryPos(0); + maPrevTimer.Start(); + return 0; +} + +IMPL_LINK( AssistentDlgImpl, SelectLayoutHdl, ListBox *, EMPTYARG ) +{ + maPrevTimer.Start(); + return 0; +} + +IMPL_LINK( AssistentDlgImpl, SelectFileHdl, ListBox *, EMPTYARG ) +{ + SetStartType( ST_OPEN ); + maPrevTimer.Start(); + return 0; +} + +IMPL_LINK( AssistentDlgImpl, PageSelectHdl, Control *, EMPTYARG ) +{ + sal_uInt16 nPage = mpPage5PageListCT->GetSelectedPage(); + if( mnShowPage != nPage ) + { + mnShowPage = nPage; + UpdatePreview(sal_False); + } + + return 0; +} + +IMPL_LINK( AssistentDlgImpl, UpdatePageListHdl, void *, EMPTYARG ) +{ + UpdatePageList(); + return 0; +} + +IMPL_LINK( AssistentDlgImpl, UpdatePreviewHdl, void *, EMPTYARG ) +{ + UpdatePreview( sal_True ); + return 0; +} + +IMPL_LINK( AssistentDlgImpl, StartTypeHdl, RadioButton *, pButton ) +{ + StartType eType = pButton == mpPage1EmptyRB?ST_EMPTY:pButton == mpPage1TemplateRB?ST_TEMPLATE:ST_OPEN; + + if(eType == ST_TEMPLATE) + ProvideTemplates(); + else if(eType == ST_OPEN) + ScanDocmenu(); + + SetStartType( eType ); + + if(eType == ST_TEMPLATE) + { + mpPage1TemplateLB->SelectEntryPos(0); + mpPage2Medium5RB->Check(); + } + else if(eType == ST_OPEN) + mpPage1OpenLB->SelectEntryPos(0); + + maPrevTimer.Start(); + return 0; +} + + +IMPL_LINK( AssistentDlgImpl, NextPageHdl, PushButton *, EMPTYARG ) +{ + // When changing from the first to the second page make sure that the + // templates are present. + if (maAssistentFunc.GetCurrentPage() == 1) + ProvideTemplates(); + + // Change to the next page. + LeavePage(); + maAssistentFunc.NextPage(); + ChangePage(); + return 0; +} + +IMPL_LINK( AssistentDlgImpl, LastPageHdl, PushButton *, EMPTYARG ) +{ + LeavePage(); + maAssistentFunc.PreviousPage(); + ChangePage(); + return 0; +} + +IMPL_LINK( AssistentDlgImpl, PresTypeHdl, RadioButton*, EMPTYARG ) +{ + if(maDocFile.Len() == 0) + { + maNextPageButton.Enable(false); + } + + sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked(); + mpPage3PresTimeFT->Enable(bKiosk); + mpPage3BreakFT->Enable(bKiosk); + mpPage3PresTimeTMF->Enable(bKiosk); + mpPage3BreakTMF->Enable(bKiosk); + mpPage3LogoCB->Enable(bKiosk); + return 0; +} + +IMPL_LINK( AssistentDlgImpl, UpdateUserDataHdl, Edit*, EMPTYARG ) +{ + mbUserDataDirty = sal_True; + String aTopic = mpPage4AskTopicEDT->GetText(); + String aName = mpPage4AskNameEDT->GetText(); + String aInfo = mpPage4AskInfoEDT->GetText(); + + if(aTopic.Len() == 0 && aName.Len() == 0 && aInfo.Len() == 0) + maDocFile.Erase(); + + return 0; +} + +// ******************************************************************** +// ******************************************************************** + +void AssistentDlgImpl::SelectTemplateRegion( const String& rRegion ) +{ + mpPage1TemplateLB->Clear(); + std::vector<TemplateDir*>::iterator I; + for (I=maPresentList.begin(); I!=maPresentList.end(); ++I) + { + TemplateDir * pDir = *I; + mpTemplateRegion = *I; + if (pDir->msRegion.Equals( rRegion ) ) + { + std::vector<TemplateEntry*>::iterator J; + for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); ++J) + mpPage1TemplateLB->InsertEntry ((*J)->msTitle); + mpPage1TemplateLB->Update(); + if(GetStartType() == ST_TEMPLATE) + { + mpPage1TemplateLB->SelectEntryPos( 0 ); + SelectTemplateHdl(NULL); + } + break; + } + } +} + +void AssistentDlgImpl::SelectLayoutRegion( const String& rRegion ) +{ + mpPage2LayoutLB->Clear(); + mpPage2LayoutLB->InsertEntry(String(SdResId(STR_WIZARD_ORIGINAL))); + std::vector<TemplateDir*>::iterator I; + for (I=maPresentList.begin(); I!=maPresentList.end(); ++I) + { + TemplateDir * pDir = *I; + mpLayoutRegion = *I; + + if (pDir->msRegion.Equals (rRegion)) + { + std::vector<TemplateEntry*>::iterator J; + for (J=pDir->maEntries.begin(); J!=pDir->maEntries.end(); ++J) + mpPage2LayoutLB->InsertEntry ((*J)->msTitle); + mpPage2LayoutLB->Update(); + break; + } + } +} + +void AssistentDlgImpl::UpdateUserData() +{ + String aTopic = mpPage4AskTopicEDT->GetText(); + String aName = mpPage4AskNameEDT->GetText(); + String aInfo = mpPage4AskInfoEDT->GetText(); + + SfxObjectShell* pShell = xDocShell; + DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell); + SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL; + SdPage* pPage = pDoc?pDoc->GetSdPage(0, PK_STANDARD):NULL; + + if(pPage && ( aTopic.Len() != 0 || aName.Len() != 0 || aInfo.Len() != 0 ) ) + { + if( pPage->GetAutoLayout() == AUTOLAYOUT_NONE ) + pPage->SetAutoLayout(AUTOLAYOUT_TITLE, sal_True); + + SdrTextObj* pObj; + String aEmptyString; + + if( aTopic.Len() ) + { + pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_TITLE ) ); + if( pObj ) + { + pPage->SetObjText( pObj, NULL, PRESOBJ_TITLE, aTopic ); + pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ), sal_True ); + pObj->SetEmptyPresObj(sal_False); + } + + } + + if ( aName.Len() || aInfo.Len() ) + { + String aStrTmp( aName ); + if( aName.Len() ) + aStrTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n\n" ) ); + aStrTmp.Append( aInfo ); + + pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_OUTLINE ) ); + if( pObj ) + { + pPage->SetObjText( pObj, NULL, PRESOBJ_OUTLINE, aStrTmp ); + pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE ), sal_True ); + pObj->SetEmptyPresObj(sal_False); + } + else + { + pObj = dynamic_cast<SdrTextObj*>( pPage->GetPresObj( PRESOBJ_TEXT ) ); + if( pObj ) + { + pPage->SetObjText( pObj, NULL, PRESOBJ_TEXT, aStrTmp ); + pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT ), sal_True ); + pObj->SetEmptyPresObj(sal_False); + } + } + } + } + + mbUserDataDirty = sal_False; +} + +void AssistentDlgImpl::UpdatePageList() +{ + if(mbDocPreview || !mbPreview) + UpdatePreview(sal_False); + else if(maPageListFile == maDocFile) + return; + + maPageListFile = maDocFile; + + SfxObjectShell* pShell = xDocShell; + DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell); + SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL; + + mpPage5PageListCT->Clear(); + + if(pDoc) + mpPage5PageListCT->Fill(pDoc); +} + +void AssistentDlgImpl::UpdatePreview( sal_Bool bDocPreview ) +{ + // Guard against multiple concurrent execution to this method caused either + // by calls from different threads or recursion. + ::osl::MutexGuard aGuard (maMutex); + if (mbPreviewUpdating) + return; + mbPreviewUpdating = sal_True; + + if(!mbPreview && bDocPreview) + { + maPreview.Invalidate(); + maPreview.SetObjectShell(0); + mbPreviewUpdating = sal_False; + return; + } + + String aDocFile = GetDocFileName(); + String aLayoutFile = GetLayoutFileName(); + String aEmptyStr; + + SfxApplication *pSfxApp = SFX_APP(); + sal_uLong lErr; + sal_Bool bChangeMaster = aLayoutFile.Len() != 0; + + if( aDocFile.Len() == 0 ) + { + if( !xDocShell.Is() || maDocFile.Len() != 0 || + (maDocFile.Len() == 0 && maLayoutFile.Len() != 0 && aLayoutFile.Len() == 0 )) + { + CloseDocShell(); + + DrawDocShell* pNewDocSh; + xDocShell = pNewDocSh = new DrawDocShell(SFX_CREATE_MODE_STANDARD, sal_False); + pNewDocSh->DoInitNew(NULL); + SdDrawDocument* pDoc = pNewDocSh->GetDoc(); + pDoc->CreateFirstPages(); + pDoc->StopWorkStartupDelay(); + mbDocPreview = sal_False; + + maDocFile = aDocFile; + mbUserDataDirty = sal_True; + } + else + bChangeMaster = (aLayoutFile.Len() != 0) && (maLayoutFile != aLayoutFile); + } + else if( aDocFile == maDocFile && ( mbDocPreview == bDocPreview || bDocPreview ) ) + { + if( aLayoutFile != maLayoutFile ) + { + SfxObjectShell* pShell = xDocShell; + DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell); + ::svl::IUndoManager* pUndoMgr = pDocShell?pDocShell->GetUndoManager():NULL; + if(pUndoMgr) + pUndoMgr->Undo(); + mbUserDataDirty = sal_True; + } + else + bChangeMaster = sal_False; + } + else + { + CloseDocShell(); + + ::Window *pParent = Application::GetDefDialogParent(); + Application::SetDefDialogParent( mpWindow ); + + SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow); + + SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() ); + if(IsOwnFormat(aDocFile)) + { + pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); + if(bDocPreview) + pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) ); + RestorePassword( pSet, aDocFile ); + if( (lErr = pSfxApp->LoadTemplate( xDocShell, aDocFile, sal_True, pSet )) != 0 ) + ErrorHandler::HandleError(lErr); + else + SavePassword( xDocShell, aDocFile ); + } + else + { + const String aTargetStr( RTL_CONSTASCII_USTRINGPARAM("_default") ); + + SfxRequest aReq( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() ); + aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aDocFile )); + aReq.AppendItem( SfxStringItem( SID_REFERER, aEmptyStr ) ); + aReq.AppendItem( SfxStringItem( SID_TARGETNAME, aTargetStr ) ); + aReq.AppendItem( SfxBoolItem( SID_HIDDEN, sal_True ) ); + aReq.AppendItem( SfxBoolItem( SID_PREVIEW, bDocPreview ) ); + + const SfxViewFrameItem* pRet = PTR_CAST( SfxViewFrameItem, SFX_APP()->ExecuteSlot( aReq ) ); + + if ( pRet && pRet->GetFrame() && pRet->GetFrame()->GetObjectShell() ) + xDocShell = pRet->GetFrame()->GetObjectShell(); + } + + + Application::SetDefDialogParent( pParent ); + + mnShowPage = 0; + mbDocPreview = bDocPreview; + maDocFile = aDocFile; + mbUserDataDirty = sal_True; + } + + if(bChangeMaster && (aLayoutFile != maDocFile)) + { + // Layoutvorlage laden + SfxObjectShellLock xLayoutDocShell; + SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow); + SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() ); + + ::Window *pParent = Application::GetDefDialogParent(); + Application::SetDefDialogParent( mpWindow ); + + if(IsOwnFormat(aLayoutFile)) + { + pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); + pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) ); + + RestorePassword( pSet, aLayoutFile ); + if( (lErr = pSfxApp->LoadTemplate( xLayoutDocShell, aLayoutFile, sal_True, pSet )) != 0 ) + ErrorHandler::HandleError(lErr); + SavePassword( xLayoutDocShell, aLayoutFile ); + } + + Application::SetDefDialogParent( pParent ); + + // die Implementierung ermitteln + SfxObjectShell* pShell = xDocShell; + DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell); + SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL; + + pShell = xLayoutDocShell; + pDocShell = PTR_CAST(DrawDocShell,pShell); + SdDrawDocument* pLayoutDoc = pDocShell?pDocShell->GetDoc():NULL; + + if( pDoc && pLayoutDoc ) + { + pDoc->SetMasterPage(0, aEmptyStr, pLayoutDoc, sal_True, sal_False ); + } + else + { + OSL_FAIL("sd::AssistentDlgImpl::UpdatePreview(), no document for preview?"); + } + + mbUserDataDirty = sal_True; + } + maLayoutFile = aLayoutFile; + + if(mbUserDataDirty) + UpdateUserData(); + + if ( !xDocShell.Is() || !mbPreview ) + maPreview.SetObjectShell( 0 ); + else + { + maPreview.SetObjectShell( xDocShell, mnShowPage ); + } + + mbPreviewUpdating = sal_False; +} + +void AssistentDlgImpl::SavePassword( SfxObjectShellLock xDoc, const String& rPath ) +{ + if(xDoc.Is()) + { + SfxMedium * pMedium = xDoc->GetMedium(); + if(pMedium && pMedium->IsStorage()) + { + SfxItemSet * pSet = pMedium->GetItemSet(); + const SfxPoolItem *pItem = 0; + if( pSet->GetItemState(SID_PASSWORD, sal_True, &pItem) == SFX_ITEM_SET ) + { + //TODO/MBA: testing + String aPass( ((const SfxStringItem*)pItem)->GetValue()); + if(aPass.Len() == 0) + return; + + PasswordEntry* pEntry = NULL; + for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i ) + { + if ( maPasswordList[ i ]->maPath == rPath ) + { + pEntry = maPasswordList[ i ]; + break; + } + } + + if(pEntry == NULL) + { + pEntry = new PasswordEntry(); + pEntry->maPath = rPath; + maPasswordList.push_back( pEntry ); + } + + if(pEntry) + pEntry->maPassword = aPass; + } + } + } +} + +void AssistentDlgImpl::RestorePassword( SfxItemSet* pSet, const String& rPath ) +{ + String aPassword( GetPassword( rPath ) ); + + if(aPassword.Len()) + pSet->Put( SfxStringItem( SID_PASSWORD, aPassword ) ); +} + +String AssistentDlgImpl::GetPassword( const String rPath ) +{ + for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i ) + { + PasswordEntry* pEntry = maPasswordList[ i ]; + if(pEntry->maPath == rPath) + return pEntry->maPassword; + } + return String(); +} + +void AssistentDlgImpl::DeletePassords() +{ + for ( size_t i = 0, n = maPasswordList.size(); i < n; ++i ) + delete maPasswordList[ i ]; + maPasswordList.clear(); +} + +sal_Bool AssistentDlgImpl::IsOwnFormat( const String& rPath ) +{ + INetURLObject aURL( rPath ); + String aExt( aURL.GetFileExtension() ); + + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + return !aExt.EqualsIgnoreCaseAscii( "ppt" ); +} + + + + +String AssistentDlgImpl::GetUiTextForCommand (const ::rtl::OUString& sCommandURL) +{ + String sLabel; + Reference<container::XNameAccess> xUICommandLabels; + + try + { + do + { + if (sCommandURL.getLength() == 0) + break; + + // Retrieve popup menu labels + Reference<lang::XMultiServiceFactory> xFactory ( + ::comphelper::getProcessServiceFactory ()); + if ( ! xFactory.is()) + break; + + ::rtl::OUString sModuleIdentifier ( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument")); + Reference<container::XNameAccess> xNameAccess ( + xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.frame.UICommandDescription"))), + UNO_QUERY); + if ( ! xNameAccess.is()) + break; + Any a = xNameAccess->getByName(sModuleIdentifier); + a >>= xUICommandLabels; + if ( ! xUICommandLabels.is()) + break; + + ::rtl::OUString sString; + Sequence<beans::PropertyValue> aProperties; + Any aAny (xUICommandLabels->getByName(sCommandURL)); + if (aAny >>= aProperties) + { + sal_Int32 nCount (aProperties.getLength()); + for (sal_Int32 i=0; i<nCount; i++) + { + ::rtl::OUString sPropertyName (aProperties[i].Name); + if (sPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Label"))) + { + aProperties[i].Value >>= sString; + break; + } + } + } + sLabel = sString; + } + while(false); + } + catch (com::sun::star::uno::Exception& rException) + { + (void)rException; + } + + return sLabel; +} + + + + +Image AssistentDlgImpl::GetUiIconForCommand (const ::rtl::OUString& sCommandURL) +{ + Image aIcon; + Reference<container::XNameAccess> xUICommandLabels; + + try + { + do + { + if (sCommandURL.getLength() == 0) + break; + + // Retrieve popup menu labels + Reference<lang::XMultiServiceFactory> xFactory ( + ::comphelper::getProcessServiceFactory ()); + if ( ! xFactory.is()) + break; + + ::rtl::OUString sModuleIdentifier ( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument")); + + Reference<com::sun::star::ui::XModuleUIConfigurationManagerSupplier> xSupplier ( + xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.ui.ModuleUIConfigurationManagerSupplier"))), + UNO_QUERY_THROW); + + Reference<com::sun::star::ui::XUIConfigurationManager> xManager ( + xSupplier->getUIConfigurationManager(sModuleIdentifier)); + if ( ! xManager.is()) + break; + + Reference<com::sun::star::ui::XImageManager> xImageManager ( + xManager->getImageManager(), + UNO_QUERY_THROW); + + Sequence<rtl::OUString> aCommandList(1); + aCommandList[0] = sCommandURL; + Sequence<Reference<graphic::XGraphic> > xIconList ( + xImageManager->getImages(0,aCommandList)); + if ( ! xIconList.hasElements()) + break; + + aIcon = Graphic(xIconList[0]).GetBitmapEx(); + } + while(false); + } + catch (com::sun::star::uno::Exception& rException) + { + (void)rException; + } + + return aIcon; +} + + +////////////////////////////////////////////// + +AssistentDlg::AssistentDlg(Window* pParent, sal_Bool bAutoPilot) : + ModalDialog(pParent,SdResId(DLG_ASS)) +{ + Link aFinishLink = LINK(this,AssistentDlg, FinishHdl); + mpImpl = new AssistentDlgImpl( this, aFinishLink, bAutoPilot ); + + //Buttonbelegung + mpImpl->maFinishButton.SetClickHdl(LINK(this,AssistentDlg,FinishHdl)); + + FreeResource(); +} + +IMPL_LINK( AssistentDlg, FinishHdl, OKButton *, EMPTYARG ) +{ + if( GetStartType() == ST_OPEN ) + { + //if we do not have a file here asked for one before ending the dialog + String aFileToOpen = GetDocPath(); + if(aFileToOpen.Len() == 0) + { + sfx2::FileDialogHelper aFileDlg( WB_OPEN, ::String::CreateFromAscii("simpress") ); + + if ( aFileDlg.Execute() == ERRCODE_NONE ) + aFileToOpen = aFileDlg.GetPath(); + if( aFileToOpen.Len() == 0) + return 1; + else + { + //add the selected file to the recent-file-listbox and select the new entry + //this is necessary for 'GetDocPath()' returning the selected file after end of dialog + + INetURLObject aURL; + aURL.SetSmartURL(aFileToOpen); + mpImpl->maOpenFilesList.push_back (new String (aURL.GetMainURL( INetURLObject::NO_DECODE ))); + sal_uInt16 nNewPos = mpImpl->mpPage1OpenLB->InsertEntry(aURL.getName()); + mpImpl->mpPage1OpenLB->SelectEntryPos(nNewPos); + } + } + } + + //Ende + mpImpl->EndDialog(RET_OK); + EndDialog(RET_OK); + return 0; +} + +AssistentDlg::~AssistentDlg() +{ + delete mpImpl; +} + + +SfxObjectShellLock AssistentDlg::GetDocument() +{ + return mpImpl->GetDocument(); +} + +OutputType AssistentDlg::GetOutputMedium() const +{ + if(mpImpl->mpPage2Medium1RB->IsChecked()) + return OUTPUT_PRESENTATION; + else if(mpImpl->mpPage2Medium2RB->IsChecked()) + return OUTPUT_SLIDE; + else if(mpImpl->mpPage2Medium3RB->IsChecked()) + return OUTPUT_OVERHEAD; + else if(mpImpl->mpPage2Medium4RB->IsChecked()) + return OUTPUT_PAGE; + else + return OUTPUT_ORIGINAL; +} + +sal_Bool AssistentDlg::IsSummary() const +{ + return mpImpl->mpPage5SummaryCB->IsChecked(); +} + +StartType AssistentDlg::GetStartType() const +{ + return mpImpl->GetStartType(); +} + +String AssistentDlg::GetDocPath() const +{ + return mpImpl->GetDocFileName(); +} + +sal_Bool AssistentDlg::GetStartWithFlag() const +{ + return !mpImpl->maStartWithFlag.IsChecked(); +} + +sal_Bool AssistentDlg::IsDocEmpty() const +{ + return mpImpl->GetDocFileName().Len() == 0 && + mpImpl->GetLayoutFileName().Len() == 0; +} + +String AssistentDlg::GetPassword() +{ + return mpImpl->GetPassword( mpImpl->maDocFile ); +} + + + + +//===== NextButton ============================================================ + +NextButton::NextButton (::Window* pParent, const ResId& rResId) + : maNextButton1(pParent, rResId), + maNextButton2(pParent, rResId), + mbIsFirstButtonActive(true) +{ + // Hide the unused button. + maNextButton2.Hide(); +} + + + + +void NextButton::ForceFocusEventBroadcast (void) +{ + // Hide the currently visible button and show and focus the other one. + if (mbIsFirstButtonActive) + { + mbIsFirstButtonActive = false; + maNextButton2.Show(); + maNextButton2.GrabFocus(); + maNextButton1.Hide(); + } + else + { + mbIsFirstButtonActive = true; + maNextButton1.Show(); + maNextButton1.GrabFocus(); + maNextButton2.Hide(); + } +} + + + + +void NextButton::SetClickHdl (const Link& rLink) +{ + // Forward the setting of the click handler to the two buttons + // regardless of which one is currently visible. + maNextButton1.SetClickHdl(rLink); + maNextButton2.SetClickHdl(rLink); +} + + + + +bool NextButton::IsEnabled (void) +{ + // Because the buttons are both either enabled or disabled, it is + // sufficient to ask one to determine the state. + return maNextButton1.IsEnabled(); +} + + + + +void NextButton::Enable (bool bEnable) +{ + // Enable or disable both buttons but do not change visibility or focus. + maNextButton1.Enable(bEnable); + maNextButton2.Enable(bEnable); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlgass.src b/sd/source/ui/dlg/dlgass.src new file mode 100644 index 000000000000..6427b9bff297 --- /dev/null +++ b/sd/source/ui/dlg/dlgass.src @@ -0,0 +1,595 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "dlgass.hrc" +#include "helpids.h" +ModalDialog DLG_ASS +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 272 , 190 ) ; + Text[ en-US ] = "Presentation Wizard"; + + HelpId = HID_SD_AUTOPILOT_PAGE1 ; + Moveable = TRUE ; + Closeable = FALSE; + + Control CT_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 144 , 40 ) ; + Size = MAP_APPFONT ( 122 , 96 ) ; + SVLook = FALSE ; + }; + + CheckBox CB_PREVIEW + { + HelpID = "sd:CheckBox:DLG_ASS:CB_PREVIEW"; + Pos = MAP_APPFONT ( 144 , 140 ); + Size = MAP_APPFONT ( 122 , 10 ); + TabStop = TRUE; + Text [ en-US ] = "Previe~w"; + }; + + CheckBox CB_STARTWITH + { + HelpID = "sd:CheckBox:DLG_ASS:CB_STARTWITH"; + Pos = MAP_APPFONT ( 144 , 154 ); + Size = MAP_APPFONT ( 122 , 10 ); + TabStop = TRUE; + Text [ en-US ] = "~Do not show this wizard again" ; + }; + + // Seite 1 + + FixedBitmap FB_PAGE1 + { + OutputSize = TRUE ; + Scale = TRUE; + Border = TRUE; + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 258 , 29 ) ; + Fixed = Bitmap { File = "dlgass1.bmp" ; }; + }; + + FixedLine FL_PAGE1_ARTGROUP + { + OutputSize = TRUE; + Pos = MAP_APPFONT ( 6 , 37 ); + Size =MAP_APPFONT ( 132 , 8 ); + Text [ en-US ] = "Type"; + }; + + RadioButton RB_PAGE1_EMPTY + { + HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE1_EMPTY"; + Pos = MAP_APPFONT ( 12 , 48 ); + Size = MAP_APPFONT ( 130 , 10 ); + TabStop = TRUE; + Text [ en-US ] = "~Empty presentation"; + }; + + RadioButton RB_PAGE1_TEMPLATE + { + HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE1_TEMPLATE"; + Pos = MAP_APPFONT ( 12 , 62 ); + Size = MAP_APPFONT ( 130 , 10 ); + Text [ en-US ] = "~From template"; + }; + + RadioButton RB_PAGE1_OPEN + { + HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE1_OPEN"; + Pos = MAP_APPFONT ( 12 , 76 ); + Size = MAP_APPFONT ( 130 , 10 ); + Text [ en-US ] = "O~pen existing presentation"; + }; + + PushButton PB_PAGE1_OPEN + { + HelpID = "sd:PushButton:DLG_ASS:PB_PAGE1_OPEN"; + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 18 , 89 ) ; + Size = MAP_APPFONT ( 50 , 18 ) ; + TabStop = TRUE ; + }; + + ListBox LB_PAGE1_REGION + { + Pos = MAP_APPFONT ( 12 , 90 ); + Size = MAP_APPFONT ( 120 , 12 ); + TabStop = TRUE ; + Border = TRUE ; + DropDown = TRUE ; + HelpId = HID_SD_AUTOPILOT_REGION ; + }; + + ListBox LB_PAGE1_TEMPLATES + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 106 ) ; + Size = MAP_APPFONT ( 120 , 59 ) ; + HelpId = HID_SD_AUTOPILOT_TEMPLATES ; + }; + + ListBox LB_PAGE1_OPEN + { + Pos = MAP_APPFONT ( 18 , 110 ); + Size = MAP_APPFONT ( 120 , 55 ); + TabStop = TRUE; + Border = TRUE; + HelpId = HID_SD_AUTOPILOT_OPEN ; + AutoHScroll = TRUE; + }; + + // Seite 2 + FixedBitmap FB_PAGE2 + { + OutputSize = TRUE ; + Scale = TRUE; + Border = TRUE; + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 258 , 29 ) ; + Fixed = Bitmap { File = "dlgass2.bmp" ; }; + }; + + FixedLine FL_PAGE2_LAYOUT + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 37 ) ; + Size = MAP_APPFONT ( 132 , 8 ) ; + Text [ en-US ] = "~Select a slide design" ; + }; + + ListBox LB_PAGE2_REGION + { + Pos = MAP_APPFONT ( 12 , 48 ); + Size = MAP_APPFONT ( 120 , 12 ); + TabStop = TRUE ; + Border = TRUE ; + DropDown = TRUE ; + HelpId = HID_SD_AUTOPILOT_PAGETEMPLATES ; + }; + + ListBox LB_PAGE2_LAYOUT + { + HelpID = "sd:ListBox:DLG_ASS:LB_PAGE2_LAYOUT"; + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 64 ) ; + Size = MAP_APPFONT ( 120 , 40 ) ; + }; + + FixedLine FL_PAGE2_OUTPUTTYPES + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 110 ) ; + Size = MAP_APPFONT ( 132 , 8 ) ; + Text [ en-US ] = "Select an output medium" ; + }; + + RadioButton RB_PAGE2_MEDIUM5 + { + HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE2_MEDIUM5"; + OutputSize = TRUE; + Pos = MAP_APPFONT ( 12 , 121 ); + Size = MAP_APPFONT ( 59 , 10 ); + Text [ en-US ] = "~Original"; + }; + + RadioButton RB_PAGE2_MEDIUM1 + { + HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE2_MEDIUM1"; + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 75 , 121 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + Text [ en-US ] = "Sc~reen"; + }; + + RadioButton RB_PAGE2_MEDIUM2 + { + HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE2_MEDIUM2"; + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 75 , 135 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Sli~de" ; + }; + + RadioButton RB_PAGE2_MEDIUM3 + { + HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE2_MEDIUM3"; + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 12 , 135 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "O~verhead sheet" ; + }; + + RadioButton RB_PAGE2_MEDIUM4 + { + HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE2_MEDIUM4"; + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 12 , 149 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "P~aper" ; + }; + + // Seite 3 + FixedBitmap FB_PAGE3 + { + OutputSize = TRUE ; + Scale = TRUE; + Border = TRUE; + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 258 , 29 ) ; + Fixed = Bitmap { File = "dlgass3.bmp" ; }; + }; + + FixedLine FL_PAGE3_EFFECT + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 37 ); + Size = MAP_APPFONT ( 132 , 8 ); + Text [ en-US ] = "Select a slide transition"; + }; + + FixedText FT_PAGE3_EFFECT + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 12 , 49 ); + Size = MAP_APPFONT ( 60 , 10 ); + Text [ en-US ] = "~Effect"; + }; + + ListBox LB_PAGE3_EFFECT + { + HelpID = "sd:ListBox:DLG_ASS:LB_PAGE3_EFFECT"; + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 72 , 48 ); + Size = MAP_APPFONT ( 60 , 12 ); + TabStop = TRUE; + Border = TRUE; + DropDown = TRUE; + }; + + FixedText FT_PAGE3_SPEED + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 12 , 65 ); + Size = MAP_APPFONT ( 60 , 10 ); + Text [ en-US ] = "~Speed"; + }; + + ListBox LB_PAGE3_SPEED + { + HelpID = "sd:ListBox:DLG_ASS:LB_PAGE3_SPEED"; + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 72 , 64 ); + Size = MAP_APPFONT ( 60 , 12 ); + TabStop = TRUE; + Border = TRUE; + DropDown = TRUE; + }; + + FixedLine FL_PAGE3_PRESTYPE + { + OutputSize = TRUE; + Pos = MAP_APPFONT ( 6 , 83 ); + Size = MAP_APPFONT ( 132 , 8 ); + Text [ en-US ] = "Select the presentation type"; + }; + + RadioButton RB_PAGE3_LIVE + { + HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE3_LIVE"; + OutputSize = TRUE; + Pos = MAP_APPFONT ( 12 , 94 ); + Size = MAP_APPFONT ( 120 , 10 ); + Text [ en-US ] = "~Default"; + }; + + RadioButton RB_PAGE3_KIOSK + { + HelpID = "sd:RadioButton:DLG_ASS:RB_PAGE3_KIOSK"; + OutputSize = TRUE; + Pos = MAP_APPFONT ( 12 , 108 ); + Size = MAP_APPFONT ( 120 , 10 ); + Text [ en-US ] = "~Automatic"; + }; + + FixedText FT_PAGE3_TIME + { + OutputSize = TRUE; + Pos = MAP_APPFONT ( 21 , 123 ); + Size = MAP_APPFONT ( 55 , 10 ); + Text [ en-US ] = "D~uration of page"; + }; + + TimeField TMF_PAGE3_TIME + { + HelpID = "sd:TimeField:DLG_ASS:TMF_PAGE3_TIME"; + OutputSize = TRUE; + Pos = MAP_APPFONT ( 77 , 122 ) ; + Size = MAP_APPFONT ( 55 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Duration = TRUE ; + StrictFormat = TRUE ; + Maximum = Time + { + Hour = 23 ; + Minute = 59 ; + Second = 59 ; + }; + Last = Time + { + Hour = 23 ; + Minute = 59 ; + Second = 59 ; + }; + }; + + FixedText FT_PAGE3_BREAK + { + OutputSize = TRUE; + Pos = MAP_APPFONT ( 21 , 139 ); + Size = MAP_APPFONT ( 55 , 10 ); + Text [ en-US ] = "Du~ration of pause"; + }; + + TimeField TMF_PAGE3_BREAK + { + HelpID = "sd:TimeField:DLG_ASS:TMF_PAGE3_BREAK"; + OutputSize = TRUE; + Pos = MAP_APPFONT ( 77 , 138 ) ; + Size = MAP_APPFONT ( 55 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Duration = TRUE ; + StrictFormat = TRUE ; + Maximum = Time + { + Hour = 23 ; + Minute = 59 ; + Second = 59 ; + }; + Last = Time + { + Hour = 23 ; + Minute = 59 ; + Second = 59 ; + }; + }; + + CheckBox CB_PAGE3_LOGO + { + HelpID = "sd:CheckBox:DLG_ASS:CB_PAGE3_LOGO"; + OutputSize = TRUE; + Pos = MAP_APPFONT ( 21 , 154 ); + Size = MAP_APPFONT ( 111 , 10 ); + TabStop = TRUE; + Text [ en-US ] = "Sh~ow logo"; + }; + + // Seite 4 + FixedBitmap FB_PAGE4 + { + OutputSize = TRUE ; + Scale = TRUE; + Border = TRUE; + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 258 , 29 ) ; + Fixed = Bitmap { File = "dlgass4.bmp" ; }; + }; + + FixedLine FL_PAGE4_PERSONAL + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 37 ); + Size = MAP_APPFONT ( 260 , 8 ); + Text [ en-US ] = "Describe your basic ideas" ; + }; + + FixedText FT_PAGE4_ASKNAME + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 12 , 48 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "What is your name or the name of your company?" ; + + }; + Edit EDT_PAGE4_ASKNAME + { + HelpID = "sd:Edit:DLG_ASS:EDT_PAGE4_ASKNAME"; + OutputSize = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 59 ) ; + Size = MAP_APPFONT ( 248 , 12 ) ; + TabStop = TRUE ; + }; + FixedText FT_PAGE4_ASKTOPIC + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 12 , 77 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "What is the subject of your presentation?" ; + }; + Edit EDT_PAGE4_ASKTOPIC + { + HelpID = "sd:Edit:DLG_ASS:EDT_PAGE4_ASKTOPIC"; + OutputSize = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 88 ) ; + Size = MAP_APPFONT ( 248 , 12 ) ; + TabStop = TRUE ; + }; + FixedText FT_PAGE4_ASKINFORMATION + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 12 , 106 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Further ideas to be presented?" ; + }; + MultiLineEdit EDT_PAGE4_ASKINFORMATION + { + HelpID = "sd:MultiLineEdit:DLG_ASS:EDT_PAGE4_ASKINFORMATION"; + OutputSize = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 117 ) ; + Size = MAP_APPFONT ( 248 , 47 ) ; + TabStop = TRUE ; + IgnoreTab = TRUE ; + VSCROLL = TRUE ; + }; + + // Seite 5 + FixedBitmap FB_PAGE5 + { + OutputSize = TRUE ; + Scale = TRUE; + Border = TRUE; + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 258 , 29 ) ; + Fixed = Bitmap { File = "dlgass5.bmp" ; }; + }; + + FixedText FT_PAGE5_PAGELIST + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 39 ); + Size = MAP_APPFONT ( 132 , 8 ); + Text [ en-US ] = "Ch~oose your pages"; + }; + + Control CT_PAGE5_PAGELIST + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 50 ); + Size = MAP_APPFONT ( 132 , 100 ); + Border = TRUE; + TabStop = TRUE ; + }; + + CheckBox CB_PAGE5_SUMMARY + { + HelpID = "sd:CheckBox:DLG_ASS:CB_PAGE5_SUMMARY"; + OutputSize = TRUE; + Pos = MAP_APPFONT ( 6 , 154 ); + Size = MAP_APPFONT ( 132 , 10 ); + TabStop = TRUE ; + Text [ en-US ] = "C~reate summary"; + }; + + // generell + HelpButton BUT_HELP + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + + CancelButton BUT_CANCEL + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 59 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + + PushButton BUT_LAST + { + HelpID = "sd:PushButton:DLG_ASS:BUT_LAST"; + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 112 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "<< ~Back" ; + }; + + PushButton BUT_NEXT + { + HelpID = "sd:PushButton:DLG_ASS:BUT_NEXT"; + DefButton = TRUE ; + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 165 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Next >>" ; + }; + + OKButton BUT_FINISH + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 218 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Create" ; + }; + + String STR_OPEN + { + Text [ en-US ] = "~Open"; + }; + + String STR_CREATE + { + Text [ en-US ] = "~Create" ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/dlgassim.cxx b/sd/source/ui/dlg/dlgassim.cxx new file mode 100644 index 000000000000..493ef074b4c1 --- /dev/null +++ b/sd/source/ui/dlg/dlgassim.cxx @@ -0,0 +1,211 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif +#include <sfx2/docfile.hxx> +#include <tools/urlobj.hxx> +#include <unotools/pathoptions.hxx> + +#include "sdpage.hxx" +#include "Outliner.hxx" +#include "res_bmp.hrc" + +#include <vcl/svapp.hxx> + +#include "dlgassim.hxx" + +SdPageListControl::SdPageListControl( + ::Window* pParent, + const ResId& rResId ) + : SvTreeListBox(pParent, rResId) +{ + // Tree-ListBox mit Linien versehen + SetStyle( GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES | + WB_HASBUTTONS | WB_HASLINESATROOT | + WB_HSCROLL | + WB_HASBUTTONSATROOT ); + + SetNodeDefaultImages (); + m_pCheckButton = new SvLBoxButtonData(this); + EnableCheckButton (m_pCheckButton); + + SetCheckButtonHdl( LINK(this,SdPageListControl,CheckButtonClickHdl) ); +} + +IMPL_LINK( SdPageListControl, CheckButtonClickHdl, SvLBoxButtonData *, EMPTYARG ) +{ + SvLBoxTreeList* pTreeModel = GetModel(); + SvLBoxEntry* pEntry = pTreeModel->First(); + + while( pEntry ) + { + if(pTreeModel->IsAtRootDepth(pEntry) && GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) + return 0; + pEntry = pTreeModel->Next( pEntry ); + } + + pEntry = pTreeModel->First(); + SetCheckButtonState( pEntry, SV_BUTTON_CHECKED ); + + return 0; +} + +SdPageListControl::~SdPageListControl() +{ + delete m_pCheckButton; +} + +void SdPageListControl::Clear() +{ + SvTreeListBox::Clear(); +} + +SvLBoxEntry* SdPageListControl::InsertPage( const String& rPageName ) +{ + SvLBoxEntry* pEntry = new SvLBoxEntry; + + pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, + 0, m_pCheckButton)); + pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! + pEntry->AddItem( new SvLBoxString( pEntry, 0, rPageName ) ); + + GetModel()->Insert( pEntry ); + + return pEntry; +} + +void SdPageListControl::InsertTitle( SvLBoxEntry* pParent, const String& rTitle ) +{ + SvLBoxEntry* pEntry = new SvLBoxEntry; + pEntry->AddItem( new SvLBoxString( pEntry, 0, String() ) ); + pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! + pEntry->AddItem( new SvLBoxString( pEntry, 0, rTitle ) ); + GetModel()->Insert( pEntry,pParent ); +} + +void SdPageListControl::Fill( SdDrawDocument* pDoc ) +{ + Outliner* pOutliner = pDoc->GetInternalOutliner(); + + sal_uInt16 nPage = 0; + const sal_uInt16 nMaxPages = pDoc->GetPageCount(); + while( nPage < nMaxPages ) + { + SdPage* pPage = (SdPage*) pDoc->GetPage( nPage ); + if( pPage->GetPageKind() == PK_STANDARD ) + { + SvLBoxEntry* pEntry = InsertPage( pPage->GetName() ); + SetCheckButtonState(pEntry, SvButtonState( SV_BUTTON_CHECKED ) ); + + SdrTextObj* pTO = (SdrTextObj*)pPage->GetPresObj(PRESOBJ_TEXT); + if(!pTO) + { + // Ermittelt das SdrTextObject mit dem Layout Text dieser Seite + const sal_uLong nObjectCount = pPage->GetObjCount(); + for (sal_uLong nObject = 0; nObject < nObjectCount; nObject++) + { + SdrObject* pObject = pPage->GetObj(nObject); + if (pObject->GetObjInventor() == SdrInventor && pObject->GetObjIdentifier() == OBJ_OUTLINETEXT) + { + pTO = (SdrTextObj*)pObject; + break; + } + } + } + + if (pTO && !pTO->IsEmptyPresObj()) + { + OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject(); + if (pOPO) + { + pOutliner->Clear(); + pOutliner->SetText( *pOPO ); + + sal_uLong nCount = pOutliner->GetParagraphCount(); + + Paragraph* pPara = NULL; + + for (sal_uLong nPara = 0; nPara < nCount; nPara++) + { + pPara = pOutliner->GetParagraph(nPara); + if(pPara && pOutliner->GetDepth( (sal_uInt16) nPara ) == 0 ) + { + String aParaText = pOutliner->GetText(pPara); + if(aParaText.Len() != 0) + InsertTitle( pEntry, aParaText ); + } + } + } + } + } + nPage++; + } + + pOutliner->Clear(); +} + +sal_uInt16 SdPageListControl::GetSelectedPage() +{ + SvLBoxEntry* pSelEntry = GetCurEntry(); + sal_uInt16 nPage = 0; + + if ( pSelEntry ) + { + SvLBoxTreeList* pTreeModel = GetModel(); + SvLBoxEntry* pEntry = pTreeModel->First(); + + while( pEntry && pEntry != pSelEntry ) + { + if(pTreeModel->IsAtRootDepth(pEntry)) + nPage++; + pEntry = pTreeModel->Next( pEntry ); + } + + if(!pTreeModel->IsAtRootDepth(pSelEntry)) + nPage--; + } + return nPage; +} + +sal_Bool SdPageListControl::IsPageChecked( sal_uInt16 nPage ) +{ + SvLBoxEntry* pEntry = GetModel()->GetEntry(nPage); + return pEntry?(sal_Bool)(GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED): sal_False; +} + +void SdPageListControl::DataChanged( const DataChangedEvent& rDCEvt ) +{ + SvTreeListBox::DataChanged( rDCEvt ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlgassim.hxx b/sd/source/ui/dlg/dlgassim.hxx new file mode 100644 index 000000000000..3eeb40144ee8 --- /dev/null +++ b/sd/source/ui/dlg/dlgassim.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <svl/dateitem.hxx> +#include "drawdoc.hxx" +#include <svx/svdotext.hxx> +#include <svtools/svtreebx.hxx> + +#include "sdresid.hxx" + +class SdPageListControl : public SvTreeListBox +{ +private: + SvLBoxButtonData* m_pCheckButton; + + SvLBoxEntry* InsertPage( const String& rPageName ); + void InsertTitle( SvLBoxEntry* pEntry, const String& rTitle ); + +public: + SdPageListControl( Window* pParent, const ResId& rResId ); + ~SdPageListControl(); + + void Fill( SdDrawDocument* pDoc ); + void Clear(); + + sal_uInt16 GetSelectedPage(); + sal_Bool IsPageChecked( sal_uInt16 nPage ); + + DECL_LINK( CheckButtonClickHdl, SvLBoxButtonData * ); + + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlgchar.cxx b/sd/source/ui/dlg/dlgchar.cxx new file mode 100644 index 000000000000..5194e9ba1794 --- /dev/null +++ b/sd/source/ui/dlg/dlgchar.cxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + + +#include <svx/dialogs.hrc> +#include <editeng/flstitem.hxx> +#include <svx/flagsdef.hxx> +#include <sfx2/objsh.hxx> + +#include "sdresid.hxx" +#include "dlg_char.hxx" +#include <svx/svxids.hrc> +#include <svl/intitem.hxx> + +/************************************************************************* +|* +|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu +|* +\************************************************************************/ + +SdCharDlg::SdCharDlg( Window* pParent, const SfxItemSet* pAttr, + const SfxObjectShell* pDocShell ) : + SfxTabDialog ( pParent, SdResId( TAB_CHAR ), pAttr ), + rOutAttrs ( *pAttr ), + rDocShell ( *pDocShell ) +{ + FreeResource(); + + AddTabPage( RID_SVXPAGE_CHAR_NAME ); + AddTabPage( RID_SVXPAGE_CHAR_EFFECTS ); + AddTabPage( RID_SVXPAGE_CHAR_POSITION ); +} + +// ----------------------------------------------------------------------- + +void SdCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) +{ + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + switch( nId ) + { + case RID_SVXPAGE_CHAR_NAME: + { + SvxFontListItem aItem(*( (const SvxFontListItem*) + ( rDocShell.GetItem( SID_ATTR_CHAR_FONTLIST) ) ) ); + + aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST)); + rPage.PageCreated(aSet); + } + break; + + case RID_SVXPAGE_CHAR_EFFECTS: + aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP)); + rPage.PageCreated(aSet); + break; + + default: + break; + } +} + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlgctrls.cxx b/sd/source/ui/dlg/dlgctrls.cxx new file mode 100644 index 000000000000..1e9d6c52e1fe --- /dev/null +++ b/sd/source/ui/dlg/dlgctrls.cxx @@ -0,0 +1,125 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include <tools/ref.hxx> +#include <tools/debug.hxx> + +#include "strings.hrc" +#include "dlgctrls.hxx" +#include "sdresid.hxx" +#include "fadedef.h" +#include "sdpage.hxx" + +using namespace ::sd; +using namespace ::rtl; + +struct FadeEffectLBImpl +{ + std::vector< TransitionPresetPtr > maPresets; +}; + +FadeEffectLB::FadeEffectLB( Window* pParent, SdResId Id ) +: ListBox( pParent, Id ), + mpImpl( new FadeEffectLBImpl ) +{ +} + +FadeEffectLB::~FadeEffectLB() +{ + delete mpImpl; +} + +void FadeEffectLB::Fill() +{ + TransitionPresetPtr pPreset; + + InsertEntry( String( SdResId( STR_EFFECT_NONE ) ) ); + mpImpl->maPresets.push_back( pPreset ); + + const TransitionPresetList& rPresetList = TransitionPreset::getTransitionPresetList(); + TransitionPresetList::const_iterator aIter; + for( aIter = rPresetList.begin(); aIter != rPresetList.end(); ++aIter ) + { + pPreset = (*aIter); + const OUString aUIName( pPreset->getUIName() ); + if( aUIName.getLength() ) + { + InsertEntry( aUIName ); + mpImpl->maPresets.push_back( pPreset ); + } + } + + SelectEntryPos(0); +} + +// ----------------------------------------------------------------------------- + +/* +void FadeEffectLB::SelectEffect( presentation::FadeEffect eFE ) +{ + sal_Bool bFound = sal_False; + + for( long i = 0, nCount = sizeof( aEffects ) / sizeof( FadeEffectPair ); ( i < nCount ) && !bFound; i++ ) + { + if( aEffects[ i ].meFE == eFE ) + { + SelectEntryPos( (sal_uInt16) i ); + bFound = sal_True; + } + } +} +*/ + +// ----------------------------------------------------------------------------- + +void FadeEffectLB::applySelected( SdPage* pSlide ) const +{ + const sal_uInt16 nPos = GetSelectEntryPos(); + + if( pSlide && (nPos < mpImpl->maPresets.size() ) ) + { + TransitionPresetPtr pPreset( mpImpl->maPresets[nPos] ); + + if( pPreset.get() ) + { + pPreset->apply( pSlide ); + } + else + { + pSlide->setTransitionType( 0 ); + pSlide->setTransitionSubtype( 0 ); + pSlide->setTransitionDirection( sal_True ); + pSlide->setTransitionFadeColor( 0 ); + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx new file mode 100644 index 000000000000..e586925d43d5 --- /dev/null +++ b/sd/source/ui/dlg/dlgfield.cxx @@ -0,0 +1,362 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + + + +#include <editeng/editeng.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/flditem.hxx> +#include <svl/zforlist.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/docfile.hxx> +#include <svl/itemset.hxx> +#include <editeng/langitem.hxx> +#include <unotools/useroptions.hxx> + +#include "strings.hrc" +#include "dlgfield.hrc" +#include "sdattr.hxx" +#include "sdresid.hxx" +#include "sdmod.hxx" +#include "dlgfield.hxx" +#include "drawdoc.hxx" +#include "DrawDocShell.hxx" + +/************************************************************************* +|* +|* Dialog zum Bearbeiten von Feldbefehlen +|* +\************************************************************************/ + +SdModifyFieldDlg::SdModifyFieldDlg( Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ) : + ModalDialog ( pWindow, SdResId( DLG_FIELD_MODIFY ) ), + aGrpType ( this, SdResId( GRP_TYPE ) ), + aRbtFix ( this, SdResId( RBT_FIX ) ), + aRbtVar ( this, SdResId( RBT_VAR ) ), + maFtLanguage( this, SdResId( FT_LANGUAGE ) ), + maLbLanguage( this, SdResId( LB_LANGUAGE ) ), + aFtFormat ( this, SdResId( FT_FORMAT ) ), + aLbFormat ( this, SdResId( LB_FORMAT ) ), + aBtnOK ( this, SdResId( BTN_OK ) ), + aBtnCancel ( this, SdResId( BTN_CANCEL ) ), + aBtnHelp ( this, SdResId( BTN_HELP ) ), + maInputSet ( rSet ), + pField ( pInField ) +{ + FreeResource(); + + maLbLanguage.SetLanguageList( LANG_LIST_ALL|LANG_LIST_ONLY_KNOWN, false ); + maLbLanguage.SetSelectHdl( LINK( this, SdModifyFieldDlg, LanguageChangeHdl ) ); + FillControls(); +} + +/************************************************************************* +|* +|* Gibt das neue Feld zurueck, gehoert dem Caller. +|* Liefert NULL, wenn sich nichts geaendert hat. +|* +\************************************************************************/ + +SvxFieldData* SdModifyFieldDlg::GetField() +{ + SvxFieldData* pNewField = NULL; + + if( aRbtFix.IsChecked() != aRbtFix.GetSavedValue() || + aRbtVar.IsChecked() != aRbtVar.GetSavedValue() || + aLbFormat.GetSelectEntryPos() != aLbFormat.GetSavedValue() ) + { + if( pField->ISA( SvxDateField ) ) + { + const SvxDateField* pDateField = (const SvxDateField*) pField; + SvxDateType eType; + SvxDateFormat eFormat; + + if( aRbtFix.IsChecked() ) + eType = SVXDATETYPE_FIX; + else + eType = SVXDATETYPE_VAR; + + eFormat = (SvxDateFormat) ( aLbFormat.GetSelectEntryPos() + 2 ); + + pNewField = new SvxDateField( *pDateField ); + ( (SvxDateField*) pNewField )->SetType( eType ); + ( (SvxDateField*) pNewField )->SetFormat( eFormat ); + } + else if( pField->ISA( SvxExtTimeField ) ) + { + const SvxExtTimeField* pTimeField = (const SvxExtTimeField*) pField; + SvxTimeType eType; + SvxTimeFormat eFormat; + + if( aRbtFix.IsChecked() ) + eType = SVXTIMETYPE_FIX; + else + eType = SVXTIMETYPE_VAR; + + eFormat = (SvxTimeFormat) ( aLbFormat.GetSelectEntryPos() + 2 ); + + pNewField = new SvxExtTimeField( *pTimeField ); + ( (SvxExtTimeField*) pNewField )->SetType( eType ); + ( (SvxExtTimeField*) pNewField )->SetFormat( eFormat ); + } + else if( pField->ISA( SvxExtFileField ) ) + { + const SvxExtFileField* pFileField = (const SvxExtFileField*) pField; + SvxFileType eType; + SvxFileFormat eFormat; + + if( aRbtFix.IsChecked() ) + eType = SVXFILETYPE_FIX; + else + eType = SVXFILETYPE_VAR; + + eFormat = (SvxFileFormat) ( aLbFormat.GetSelectEntryPos() ); + + ::sd::DrawDocShell* pDocSh = PTR_CAST( ::sd::DrawDocShell, + SfxObjectShell::Current() ); + + if( pDocSh ) + { + SvxExtFileField aFileField( *pFileField ); + + String aName; + if( pDocSh->HasName() ) + aName = pDocSh->GetMedium()->GetName(); + + // Get current filename, not the one stored in the old field + pNewField = new SvxExtFileField( aName ); + ( (SvxExtFileField*) pNewField )->SetType( eType ); + ( (SvxExtFileField*) pNewField )->SetFormat( eFormat ); + } + } + else if( pField->ISA( SvxAuthorField ) ) + { + SvxAuthorType eType; + SvxAuthorFormat eFormat; + + if( aRbtFix.IsChecked() ) + eType = SVXAUTHORTYPE_FIX; + else + eType = SVXAUTHORTYPE_VAR; + + eFormat = (SvxAuthorFormat) ( aLbFormat.GetSelectEntryPos() ); + + // Get current state of address, not the old one + SvtUserOptions aUserOptions; + pNewField = new SvxAuthorField( aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() ); + ( (SvxAuthorField*) pNewField )->SetType( eType ); + ( (SvxAuthorField*) pNewField )->SetFormat( eFormat ); + } + } + + return( pNewField ); +} + +void SdModifyFieldDlg::FillFormatList() +{ + LanguageType eLangType = maLbLanguage.GetSelectLanguage(); + + aLbFormat.Clear(); + + if( pField->ISA( SvxDateField ) ) + { + const SvxDateField* pDateField = (const SvxDateField*) pField; + SvxDateField aDateField( *pDateField ); + + //SVXDATEFORMAT_APPDEFAULT, // Wird nicht benutzt + //SVXDATEFORMAT_SYSTEM, // Wird nicht benutzt + aLbFormat.InsertEntry( String( SdResId( STR_STANDARD_SMALL ) ) ); + aLbFormat.InsertEntry( String( SdResId( STR_STANDARD_BIG ) ) ); + + SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter(); + aDateField.SetFormat( SVXDATEFORMAT_A ); // 13.02.96 + aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + aDateField.SetFormat( SVXDATEFORMAT_B ); // 13.02.1996 + aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + aDateField.SetFormat( SVXDATEFORMAT_C ); // 13.Feb 1996 + aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + aDateField.SetFormat( SVXDATEFORMAT_D ); // 13.Februar 1996 + aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + aDateField.SetFormat( SVXDATEFORMAT_E ); // Die, 13.Februar 1996 + aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + aDateField.SetFormat( SVXDATEFORMAT_F ); // Dienstag, 13.Februar 1996 + aLbFormat.InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + + aLbFormat.SelectEntryPos( (sal_uInt16) ( pDateField->GetFormat() - 2 ) ); + } + else if( pField->ISA( SvxExtTimeField ) ) + { + const SvxExtTimeField* pTimeField = (const SvxExtTimeField*) pField; + SvxExtTimeField aTimeField( *pTimeField ); + + //SVXTIMEFORMAT_APPDEFAULT, // Wird nicht benutzt + //SVXTIMEFORMAT_SYSTEM, // Wird nicht benutzt + aLbFormat.InsertEntry( String( SdResId( STR_STANDARD_NORMAL ) ) ); + + SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter(); + aTimeField.SetFormat( SVXTIMEFORMAT_24_HM ); // 13:49 + aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + aTimeField.SetFormat( SVXTIMEFORMAT_24_HMS ); // 13:49:38 + aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + aTimeField.SetFormat( SVXTIMEFORMAT_24_HMSH ); // 13:49:38.78 + aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + aTimeField.SetFormat( SVXTIMEFORMAT_12_HM ); // 01:49 + aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + aTimeField.SetFormat( SVXTIMEFORMAT_12_HMS ); // 01:49:38 + aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + aTimeField.SetFormat( SVXTIMEFORMAT_12_HMSH ); // 01:49:38.78 + aLbFormat.InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + //SVXTIMEFORMAT_AM_HM, // 01:49 PM + //SVXTIMEFORMAT_AM_HMS, // 01:49:38 PM + //SVXTIMEFORMAT_AM_HMSH // 01:49:38.78 PM + + aLbFormat.SelectEntryPos( (sal_uInt16) ( pTimeField->GetFormat() - 2 ) ); + } + else if( pField->ISA( SvxExtFileField ) ) + { + const SvxExtFileField* pFileField = (const SvxExtFileField*) pField; + SvxExtFileField aFileField( *pFileField ); + + aLbFormat.InsertEntry( String( SdResId( STR_FILEFORMAT_NAME_EXT ) ) ); + aLbFormat.InsertEntry( String( SdResId( STR_FILEFORMAT_FULLPATH ) ) ); + aLbFormat.InsertEntry( String( SdResId( STR_FILEFORMAT_PATH ) ) ); + aLbFormat.InsertEntry( String( SdResId( STR_FILEFORMAT_NAME ) ) ); + + aLbFormat.SelectEntryPos( (sal_uInt16) ( pFileField->GetFormat() ) ); + } + else if( pField->ISA( SvxAuthorField ) ) + { + const SvxAuthorField* pAuthorField = (const SvxAuthorField*) pField; + SvxAuthorField aAuthorField( *pAuthorField ); + + for( sal_uInt16 i = 0; i < 4; i++ ) + { + aAuthorField.SetFormat( (SvxAuthorFormat) i ); + aLbFormat.InsertEntry( aAuthorField.GetFormatted() ); + } + + aLbFormat.SelectEntryPos( (sal_uInt16) ( pAuthorField->GetFormat() ) ); + + } + + +} + +void SdModifyFieldDlg::FillControls() +{ + aLbFormat.Clear(); + + if( pField->ISA( SvxDateField ) ) + { + const SvxDateField* pDateField = (const SvxDateField*) pField; + SvxDateField aDateField( *pDateField ); + + if( pDateField->GetType() == SVXDATETYPE_FIX ) + aRbtFix.Check(); + else + aRbtVar.Check(); + } + else if( pField->ISA( SvxExtTimeField ) ) + { + const SvxExtTimeField* pTimeField = (const SvxExtTimeField*) pField; + SvxExtTimeField aTimeField( *pTimeField ); + + if( pTimeField->GetType() == SVXTIMETYPE_FIX ) + aRbtFix.Check(); + else + aRbtVar.Check(); + } + else if( pField->ISA( SvxExtFileField ) ) + { + const SvxExtFileField* pFileField = (const SvxExtFileField*) pField; + SvxExtFileField aFileField( *pFileField ); + + if( pFileField->GetType() == SVXFILETYPE_FIX ) + aRbtFix.Check(); + else + aRbtVar.Check(); + } + else if( pField->ISA( SvxAuthorField ) ) + { + const SvxAuthorField* pAuthorField = (const SvxAuthorField*) pField; + SvxAuthorField aAuthorField( *pAuthorField ); + + if( pAuthorField->GetType() == SVXAUTHORTYPE_FIX ) + aRbtFix.Check(); + else + aRbtVar.Check(); + } + aRbtFix.SaveValue(); + aRbtVar.SaveValue(); + + const SfxPoolItem* pItem; + if( SFX_ITEM_SET == maInputSet.GetItemState(EE_CHAR_LANGUAGE, sal_True, &pItem ) ) + maLbLanguage.SelectLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() ); + + maLbLanguage.SaveValue(); + + FillFormatList(); + aLbFormat.SaveValue(); +} + + +IMPL_LINK( SdModifyFieldDlg, LanguageChangeHdl, void *, EMPTYARG ) +{ + FillFormatList(); + + return 0L; +} + +SfxItemSet SdModifyFieldDlg::GetItemSet() +{ + SfxItemSet aOutput( *maInputSet.GetPool(), EE_CHAR_LANGUAGE, EE_CHAR_LANGUAGE_CTL ); + + if( maLbLanguage.GetSelectEntryPos() != maLbLanguage.GetSavedValue() ) + { + LanguageType eLangType = maLbLanguage.GetSelectLanguage(); + SvxLanguageItem aItem( eLangType, EE_CHAR_LANGUAGE ); + aOutput.Put( aItem ); + + SvxLanguageItem aItemCJK( eLangType, EE_CHAR_LANGUAGE_CJK ); + aOutput.Put( aItemCJK ); + + SvxLanguageItem aItemCTL( eLangType, EE_CHAR_LANGUAGE_CTL ); + aOutput.Put( aItemCTL ); + } + + return aOutput; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlgfield.src b/sd/source/ui/dlg/dlgfield.src new file mode 100644 index 000000000000..cbd1ba56f7cd --- /dev/null +++ b/sd/source/ui/dlg/dlgfield.src @@ -0,0 +1,132 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "dlgfield.hrc" +ModalDialog DLG_FIELD_MODIFY +{ + HelpID = "sd:ModalDialog:DLG_FIELD_MODIFY"; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 138 , 154 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + FixedLine GRP_TYPE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Field type" ; + }; + RadioButton RBT_FIX + { + HelpID = "sd:RadioButton:DLG_FIELD_MODIFY:RBT_FIX"; + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 64 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Fixed" ; + }; + RadioButton RBT_VAR + { + HelpID = "sd:RadioButton:DLG_FIELD_MODIFY:RBT_VAR"; + Pos = MAP_APPFONT ( 12 , 25 ) ; + Size = MAP_APPFONT ( 64 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Variable" ; + }; + FixedText FT_LANGUAGE + { + Pos = MAP_APPFONT ( 6 , 67 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "~Language" ; + }; + + ListBox LB_LANGUAGE + { + HelpID = "sd:ListBox:DLG_FIELD_MODIFY:LB_LANGUAGE"; + Border = TRUE ; + Pos = MAP_APPFONT ( 52 , 65 ) ; + Size = MAP_APPFONT ( 80 , 70 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + + ListBox LB_FORMAT + { + HelpID = "sd:ListBox:DLG_FIELD_MODIFY:LB_FORMAT"; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 94 ) ; + Size = MAP_APPFONT ( 126 , 54 ) ; + TabStop = TRUE ; + }; + FixedText FT_FORMAT + { + Pos = MAP_APPFONT ( 6 , 83 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "F~ormat" ; + }; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 82 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 82 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 82 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + Text [ en-US ] = "Edit Field" ; +}; + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx new file mode 100644 index 000000000000..142073422fed --- /dev/null +++ b/sd/source/ui/dlg/dlgolbul.cxx @@ -0,0 +1,241 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include "OutlineBulletDlg.hxx" + +#include <svx/svxids.hrc> +#include <sfx2/objsh.hxx> +#include <svx/drawitem.hxx> +#include <editeng/bulitem.hxx> +#include <editeng/eeitem.hxx> + +#include <editeng/numitem.hxx> + +#include <svx/dialogs.hrc> +#include <svl/intitem.hxx> +#include <svx/svdmark.hxx> +#include "View.hxx" +#include <svx/svdobj.hxx> +#include <svl/style.hxx> +#include <drawdoc.hxx> + +#include "sdresid.hxx" + +#include "glob.hrc" +#include "dlgolbul.hrc" +#include "bulmaper.hxx" +#include "DrawDocShell.hxx" +#include <svx/svxids.hrc> +#include <svl/aeitem.hxx> + +namespace sd { + +/************************************************************************* +|* +|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu +|* +\************************************************************************/ + +OutlineBulletDlg::OutlineBulletDlg( + ::Window* pParent, + const SfxItemSet* pAttr, + ::sd::View* pView ) + : SfxTabDialog ( pParent, SdResId(TAB_OUTLINEBULLET) ), + aInputSet ( *pAttr ), + bTitle ( sal_False ), + pSdView ( pView ) +{ + FreeResource(); + + aInputSet.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL ); + aInputSet.Put( *pAttr ); + + pOutputSet = new SfxItemSet( *pAttr ); + pOutputSet->ClearItem(); + + sal_Bool bOutliner = sal_False; + + // Sonderbehandlung wenn eine Title Objekt selektiert wurde + if( pView ) + { + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); + const sal_uLong nCount = rMarkList.GetMarkCount(); + for(sal_uLong nNum = 0; nNum < nCount; nNum++) + { + SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj(); + if( pObj->GetObjInventor() == SdrInventor ) + { + + switch(pObj->GetObjIdentifier()) + { + case OBJ_TITLETEXT: + bTitle = sal_True; + break; + case OBJ_OUTLINETEXT: + bOutliner = sal_True; + break; + } + } + } + } + + if( SFX_ITEM_SET != aInputSet.GetItemState(EE_PARA_NUMBULLET)) + { + const SvxNumBulletItem *pItem = NULL; + if(bOutliner) + { + SfxStyleSheetBasePool* pSSPool = pView->GetDocSh()->GetStyleSheetPool(); + String aStyleName((SdResId(STR_LAYOUT_OUTLINE))); + aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) ); + SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO); + if( pFirstStyleSheet ) + pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem); + } + + if( pItem == NULL ) + pItem = (SvxNumBulletItem*) aInputSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET); + + DBG_ASSERT( pItem, "Kein EE_PARA_NUMBULLET im Pool! [CL]" ); + + aInputSet.Put(*pItem, EE_PARA_NUMBULLET); + } + + /* debug + if( SFX_ITEM_SET == aInputSet.GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem )) + { + SvxNumRule& rItem = *((SvxNumBulletItem*)pItem)->GetNumRule(); + for( int i = 0; i < 9; i++ ) + { + SvxNumberFormat aNumberFormat = rItem.GetLevel(i); + } + } + */ + + if(bTitle && aInputSet.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON ) + { + SvxNumBulletItem* pItem = (SvxNumBulletItem*)aInputSet.GetItem(EE_PARA_NUMBULLET,sal_True); + SvxNumRule* pRule = pItem->GetNumRule(); + if(pRule) + { + SvxNumRule aNewRule( *pRule ); + aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True ); + + SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET ); + aInputSet.Put(aNewItem); + } + } + + SetInputSet( &aInputSet ); + + if(!bTitle) + AddTabPage(RID_SVXPAGE_PICK_SINGLE_NUM); + else + RemoveTabPage( RID_SVXPAGE_PICK_SINGLE_NUM ); + + AddTabPage( RID_SVXPAGE_PICK_BULLET ); + AddTabPage( RID_SVXPAGE_PICK_BMP ); + AddTabPage(RID_SVXPAGE_NUM_OPTIONS ); + AddTabPage(RID_SVXPAGE_NUM_POSITION ); + +} + +OutlineBulletDlg::~OutlineBulletDlg() +{ + delete pOutputSet; +} + +void OutlineBulletDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) +{ + switch ( nId ) + { + case RID_SVXPAGE_NUM_OPTIONS: + { + if( pSdView ) + { + FieldUnit eMetric = pSdView->GetDoc()->GetUIUnit(); + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM,(sal_uInt16)eMetric)); + rPage.PageCreated(aSet); + } + } + break; + case RID_SVXPAGE_NUM_POSITION: + { + if( pSdView ) + { + FieldUnit eMetric = pSdView->GetDoc()->GetUIUnit(); + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM,(sal_uInt16)eMetric)); + rPage.PageCreated(aSet); + } + } + break; + } +} + +const SfxItemSet* OutlineBulletDlg::GetOutputItemSet() const +{ + SfxItemSet aSet( *SfxTabDialog::GetOutputItemSet() ); + pOutputSet->Put( aSet ); + + const SfxPoolItem *pItem = NULL; + if( SFX_ITEM_SET == pOutputSet->GetItemState(pOutputSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE), sal_False, &pItem )) + { + SdBulletMapper::MapFontsInNumRule( *((SvxNumBulletItem*)pItem)->GetNumRule(), *pOutputSet ); + +/* #i35937# + SfxUInt16Item aBulletState( EE_PARA_BULLETSTATE, 1 ); + pOutputSet->Put(aBulletState); +*/ + } + +/* #i35937# + SdBulletMapper::PostMapNumBulletForDialog( *pOutputSet ); +*/ + + if(bTitle && pOutputSet->GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON ) + { + SvxNumBulletItem* pBulletItem = (SvxNumBulletItem*)pOutputSet->GetItem(EE_PARA_NUMBULLET,sal_True); + SvxNumRule* pRule = pBulletItem->GetNumRule(); + if(pRule) + pRule->SetFeatureFlag( NUM_NO_NUMBERS, sal_False ); + } + + return pOutputSet; +} + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlgolbul.src b/sd/source/ui/dlg/dlgolbul.src new file mode 100644 index 000000000000..0f35c8b44d98 --- /dev/null +++ b/sd/source/ui/dlg/dlgolbul.src @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <svx/dialogs.hrc> +#include "dlgolbul.hrc" + +TabDialog TAB_OUTLINEBULLET +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Bullets and Numbering" ; + Moveable = TRUE ; + TabControl 1 + { + SVLook = TRUE ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_PICK_BULLET ; + Text [ en-US ] = "Bullets" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_PICK_SINGLE_NUM ; + Text [ en-US ] = "Numbering type" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_PICK_BMP ; + Text [ en-US ] = "Graphics" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_NUM_POSITION ; + Text [ en-US ] = "Position" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_NUM_OPTIONS ; + Text [ en-US ] = "Customize" ; + }; + }; + }; +}; + diff --git a/sd/source/ui/dlg/dlgpage.cxx b/sd/source/ui/dlg/dlgpage.cxx new file mode 100644 index 000000000000..f09c6ea21db5 --- /dev/null +++ b/sd/source/ui/dlg/dlgpage.cxx @@ -0,0 +1,116 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include <svl/intitem.hxx> +#include <svx/dialogs.hrc> +#include <svx/tabarea.hxx> +#include <svx/drawitem.hxx> + +#include "sdresid.hxx" +#include "dlgpage.hxx" + +#include "DrawDocShell.hxx" +#include <svl/aeitem.hxx> +#include <svx/flagsdef.hxx> +#include <editeng/svxenum.hxx> + +/************************************************************************* +|* +|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu +|* +\************************************************************************/ + +SdPageDlg::SdPageDlg( SfxObjectShell* pDocSh, Window* pParent, const SfxItemSet* pAttr, sal_Bool bAreaPage ) : + SfxTabDialog ( pParent, SdResId( TAB_PAGE ), pAttr ), + mrOutAttrs ( *pAttr ), + mpDocShell ( pDocSh ) +{ + SvxColorTableItem aColorTableItem(*( (const SvxColorTableItem*) + ( mpDocShell->GetItem( SID_COLOR_TABLE ) ) ) ); + SvxGradientListItem aGradientListItem(*( (const SvxGradientListItem*) + ( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) ) ); + SvxBitmapListItem aBitmapListItem(*( (const SvxBitmapListItem*) + ( mpDocShell->GetItem( SID_BITMAP_LIST ) ) ) ); + SvxHatchListItem aHatchListItem(*( (const SvxHatchListItem*) + ( mpDocShell->GetItem( SID_HATCH_LIST ) ) ) ); + + mpColorTab = aColorTableItem.GetColorTable(); + mpGradientList = aGradientListItem.GetGradientList(); + mpHatchingList = aHatchListItem.GetHatchList(); + mpBitmapList = aBitmapListItem.GetBitmapList(); + + FreeResource(); + + AddTabPage( RID_SVXPAGE_PAGE); + AddTabPage( RID_SVXPAGE_AREA); + + if(!bAreaPage) // I have to add the page before I remove it ! + RemoveTabPage( RID_SVXPAGE_AREA ); +} + + +/************************************************************************* +|* +|* Seite wird erzeugt +|* +\************************************************************************/ + +void SdPageDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) +{ + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + switch(nId) + { + case RID_SVXPAGE_PAGE: + aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_ENUM_PAGE_MODE, SVX_PAGE_MODE_PRESENTATION)); + aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_PAPER_START, PAPER_A0)); + aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_PAPER_END, PAPER_E)); + rPage.PageCreated(aSet); + break; + case RID_SVXPAGE_AREA: + aSet.Put (SvxColorTableItem(mpColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxGradientListItem(mpGradientList,SID_GRADIENT_LIST)); + aSet.Put (SvxHatchListItem(mpHatchingList,SID_HATCH_LIST)); + aSet.Put (SvxBitmapListItem(mpBitmapList,SID_BITMAP_LIST)); + aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0)); + aSet.Put (SfxUInt16Item(SID_DLG_TYPE,1)); + aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,0)); + rPage.PageCreated(aSet); + break; + } +} + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlgpage.src b/sd/source/ui/dlg/dlgpage.src new file mode 100644 index 000000000000..0c98caf8385c --- /dev/null +++ b/sd/source/ui/dlg/dlgpage.src @@ -0,0 +1,118 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <svx/dialogs.hrc> +#include "dlgpage.hrc" +TabDialog TAB_PAGE +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 289 , 176 ) ; + Text [ en-US ] = "Page Setup" ; + Moveable = TRUE ; + Closeable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_PAGE ; + Text [ en-US ] = "Page" ; + PageResID = RID_SVXPAGE_PAGE ; + }; + + PageItem + { + Identifier = RID_SVXPAGE_AREA; + PageResID = RID_SVXPAGE_AREA; + Text [ en-US ] = "Background"; + }; + }; + }; + OKButton 1 + { + Pos = MAP_APPFONT ( 6 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + CancelButton 1 + { + Pos = MAP_APPFONT ( 60 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton 1 + { + Pos = MAP_APPFONT ( 114 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + PushButton 1 + { + Pos = MAP_APPFONT ( 169 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "Return" ; + TabStop = TRUE ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx new file mode 100644 index 000000000000..7f5807551f63 --- /dev/null +++ b/sd/source/ui/dlg/dlgsnap.cxx @@ -0,0 +1,233 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + + +#include <svx/svxids.hrc> +#include <svx/dlgutil.hxx> +#include <svl/itempool.hxx> +#include <svl/aeitem.hxx> + +#include "dlgsnap.hrc" +#include "sdattr.hxx" +#include "View.hxx" +#include "sdresid.hxx" +#include "drawdoc.hxx" +#include "dlgsnap.hxx" + + +/************************************************************************* +|* +|* Dialog zum Einstellen des Rasters (wohl kaum ESO!) +|* +\************************************************************************/ + +SdSnapLineDlg::SdSnapLineDlg( + ::Window* pWindow, + const SfxItemSet& rInAttrs, + ::sd::View* pView) + : ModalDialog (pWindow, SdResId(DLG_SNAPLINE)), + aFlPos (this, SdResId(FL_POSITION)), + aFtX (this, SdResId(FT_X)), + aMtrFldX (this, SdResId(MTR_FLD_X)), + aFtY (this, SdResId(FT_Y)), + aMtrFldY (this, SdResId(MTR_FLD_Y)), + aFlDir (this, SdResId(FL_DIRECTION)), + aRbPoint (this, SdResId(RB_POINT)), + aRbVert (this, SdResId(RB_VERTICAL)), + aRbHorz (this, SdResId(RB_HORIZONTAL)), + aBtnOK (this, SdResId(BTN_OK)), + aBtnCancel (this, SdResId(BTN_CANCEL)), + aBtnHelp (this, SdResId(BTN_HELP)), + aBtnDelete (this, SdResId(BTN_DELETE)), + eUIUnit(pView->GetDoc()->GetUIUnit()), + aUIScale(pView->GetDoc()->GetUIScale()) +{ + FreeResource(); + + aRbHorz.SetClickHdl(LINK(this, SdSnapLineDlg, ClickHdl)); + aRbVert.SetClickHdl(LINK(this, SdSnapLineDlg, ClickHdl)); + aRbPoint.SetClickHdl(LINK(this, SdSnapLineDlg, ClickHdl)); + + aBtnDelete.SetClickHdl(LINK(this, SdSnapLineDlg, ClickHdl)); + + SetFieldUnit( aMtrFldX, eUIUnit, sal_True ); + SetFieldUnit( aMtrFldY, eUIUnit, sal_True ); + + // WorkArea holen + Rectangle aWorkArea = pView->GetWorkArea(); + + // PoolUnit ermitteln + SfxItemPool* pPool = rInAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool?" ); + SfxMapUnit ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH ); + + // #i48497# Consider page origin + SdrPageView* pPV = pView->GetSdrPageView(); + Point aLeftTop(aWorkArea.Left()+1, aWorkArea.Top()+1); + pPV->LogicToPagePos(aLeftTop); + Point aRightBottom(aWorkArea.Right()-2, aWorkArea.Bottom()-2); + pPV->LogicToPagePos(aRightBottom); + + // Hier werden die Max- und MinWerte in Abhaengigkeit von der + // WorkArea, PoolUnit und der FieldUnit: + SetMetricValue( aMtrFldX, aLeftTop.X(), ePoolUnit ); + + long nValue = static_cast<long>(aMtrFldX.GetValue()); + nValue = Fraction( nValue ) / aUIScale; + aMtrFldX.SetMin( nValue ); + aMtrFldX.SetFirst( nValue ); + + SetMetricValue( aMtrFldX, aRightBottom.X(), ePoolUnit ); + nValue = static_cast<long>(aMtrFldX.GetValue()); + nValue = Fraction( nValue ) / aUIScale; + aMtrFldX.SetMax( nValue ); + aMtrFldX.SetLast( nValue ); + + SetMetricValue( aMtrFldY, aLeftTop.Y(), ePoolUnit ); + nValue = static_cast<long>(aMtrFldY.GetValue()); + nValue = Fraction( nValue ) / aUIScale; + aMtrFldY.SetMin( nValue ); + aMtrFldY.SetFirst( nValue ); + + SetMetricValue( aMtrFldY, aRightBottom.Y(), ePoolUnit ); + nValue = static_cast<long>(aMtrFldY.GetValue()); + nValue = Fraction( nValue ) / aUIScale; + aMtrFldY.SetMax( nValue ); + aMtrFldY.SetLast( nValue ); + + // Setzen der Werte + nXValue = ((const SfxUInt32Item&) rInAttrs.Get(ATTR_SNAPLINE_X)).GetValue(); + nYValue = ((const SfxUInt32Item&) rInAttrs.Get(ATTR_SNAPLINE_Y)).GetValue(); + nXValue = Fraction(nXValue) / aUIScale; + nYValue = Fraction(nYValue) / aUIScale; + SetMetricValue( aMtrFldX, nXValue, SFX_MAPUNIT_100TH_MM); + SetMetricValue( aMtrFldY, nYValue, SFX_MAPUNIT_100TH_MM); + + aRbPoint.Check(); +} + +/************************************************************************* +|* +|* Fuellt uebergebenes Item-Set mit Dialogbox-Attributen +|* +\************************************************************************/ + +IMPL_LINK( SdSnapLineDlg, ClickHdl, Button *, pBtn ) +{ + if ( pBtn == &aRbPoint ) SetInputFields(sal_True, sal_True); + else if ( pBtn == &aRbHorz ) SetInputFields(sal_False, sal_True); + else if ( pBtn == &aRbVert ) SetInputFields(sal_True, sal_False); + else if ( pBtn == &aBtnDelete ) EndDialog(RET_SNAP_DELETE); + + return 0; +} + +/************************************************************************* +|* +|* Fuellt uebergebenes Item-Set mit Dialogbox-Attributen +|* +\************************************************************************/ + +void SdSnapLineDlg::GetAttr(SfxItemSet& rOutAttrs) +{ + SnapKind eKind; + + if ( aRbHorz.IsChecked() ) eKind = SK_HORIZONTAL; + else if ( aRbVert.IsChecked() ) eKind = SK_VERTICAL; + else eKind = SK_POINT; + + nXValue = Fraction( GetCoreValue( aMtrFldX, SFX_MAPUNIT_100TH_MM) ) * aUIScale; + nYValue = Fraction( GetCoreValue( aMtrFldY, SFX_MAPUNIT_100TH_MM) ) * aUIScale; + + rOutAttrs.Put(SfxAllEnumItem(ATTR_SNAPLINE_KIND, (sal_uInt16)eKind)); + rOutAttrs.Put(SfxUInt32Item(ATTR_SNAPLINE_X, nXValue)); + rOutAttrs.Put(SfxUInt32Item(ATTR_SNAPLINE_Y, nYValue)); +} + +/************************************************************************* +|* +|* Gruppe mit Radiobutton verstecken +|* +\************************************************************************/ + +void SdSnapLineDlg::HideRadioGroup() +{ + aFlDir.Hide(); + aRbHorz.Hide(); + aRbVert.Hide(); + aRbPoint.Hide(); +} + +/************************************************************************* +|* +|* X- bzw. Y-Inputfeld disablen +|* +\************************************************************************/ + +void SdSnapLineDlg::SetInputFields(sal_Bool bEnableX, sal_Bool bEnableY) +{ + if ( bEnableX ) + { + if ( !aMtrFldX.IsEnabled() ) + aMtrFldX.SetValue(nXValue); + aMtrFldX.Enable(); + aFtX.Enable(); + } + else if ( aMtrFldX.IsEnabled() ) + { + nXValue = static_cast<long>(aMtrFldX.GetValue()); + aMtrFldX.SetText(String()); + aMtrFldX.Disable(); + aFtX.Disable(); + } + if ( bEnableY ) + { + if ( !aMtrFldY.IsEnabled() ) + aMtrFldY.SetValue(nYValue); + aMtrFldY.Enable(); + aFtY.Enable(); + } + else if ( aMtrFldY.IsEnabled() ) + { + nYValue = static_cast<long>(aMtrFldY.GetValue()); + aMtrFldY.SetText(String()); + aMtrFldY.Disable(); + aFtY.Disable(); + } +} + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlgsnap.src b/sd/source/ui/dlg/dlgsnap.src new file mode 100644 index 000000000000..45938c433092 --- /dev/null +++ b/sd/source/ui/dlg/dlgsnap.src @@ -0,0 +1,167 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "app.hrc" +#include "res_bmp.hrc" +#include "dlgsnap.hrc" +#include "helpids.h" + +ModalDialog DLG_SNAPLINE +{ + HelpID = CMD_SID_CAPTUREPOINT ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 140 , 125 ) ; + Text [ en-US ] = "New Snap Object" ; + Moveable = TRUE ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 88 , 6 ) ; + Size = MAP_APPFONT ( 46 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 88 , 23 ) ; + Size = MAP_APPFONT ( 46 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 88 , 43 ) ; + Size = MAP_APPFONT ( 46 , 14 ) ; + TabStop = TRUE ; + }; + PushButton BTN_DELETE + { + HelpID = "sd:PushButton:DLG_SNAPLINE:BTN_DELETE"; + Pos = MAP_APPFONT ( 88 , 63 ) ; + Size = MAP_APPFONT ( 46 , 14 ) ; + Text [ en-US ] = "~Delete" ; + TabStop = TRUE ; + }; + FixedLine FL_POSITION + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 76 , 8 ) ; + Text [ en-US ] = "Position" ; + }; + FixedText FT_X + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 7 , 10 ) ; + Text = "~X" ; + }; + MetricField MTR_FLD_X + { + HelpID = "sd:MetricField:DLG_SNAPLINE:MTR_FLD_X"; + Border = TRUE ; + Pos = MAP_APPFONT ( 22 , 14 ) ; + Size = MAP_APPFONT ( 54 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -5000000 ; + Maximum = 5000000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = -5000000 ; + Last = 5000000 ; + SpinSize = 50 ; + }; + FixedText FT_Y + { + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 7 , 10 ) ; + Text = "~Y" ; + }; + MetricField MTR_FLD_Y + { + HelpID = "sd:MetricField:DLG_SNAPLINE:MTR_FLD_Y"; + Border = TRUE ; + Pos = MAP_APPFONT ( 22 , 30 ) ; + Size = MAP_APPFONT ( 54 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -5000000 ; + Maximum = 5000000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = -5000000 ; + Last = 5000000 ; + SpinSize = 50 ; + }; + FixedLine FL_DIRECTION + { + Pos = MAP_APPFONT ( 6 , 50 ) ; + Size = MAP_APPFONT ( 76 , 8 ) ; + Text [ en-US ] = "Type" ; + }; + ImageRadioButton RB_POINT + { + HelpID = "sd:ImageRadioButton:DLG_SNAPLINE:RB_POINT"; + Pos = MAP_APPFONT ( 12 , 61 ) ; + Size = MAP_APPFONT ( 64 , 16 ) ; + Text [ en-US ] = "~Point" ; + TabStop = TRUE ; + RadioButtonImage = Image + { + MaskColor = IMAGE_MASK_STDCOLOR; + ImageBitmap = Bitmap { File = "hlppoint.bmp" ; }; + }; + }; + ImageRadioButton RB_VERTICAL + { + HelpID = "sd:ImageRadioButton:DLG_SNAPLINE:RB_VERTICAL"; + Pos = MAP_APPFONT ( 12 , 81 ) ; + Size = MAP_APPFONT ( 64 , 16 ) ; + Text [ en-US ] = "~Vertical" ; + TabStop = TRUE ; + RadioButtonImage = Image + { + MaskColor = IMAGE_MASK_STDCOLOR; + ImageBitmap = Bitmap { File = "hlplvert.bmp" ; }; + }; + }; + ImageRadioButton RB_HORIZONTAL + { + HelpID = "sd:ImageRadioButton:DLG_SNAPLINE:RB_HORIZONTAL"; + Pos = MAP_APPFONT ( 12 , 101 ) ; + Size = MAP_APPFONT ( 65 , 16 ) ; + Text [ en-US ] = "Hori~zontal" ; + TabStop = TRUE ; + RadioButtonImage = Image + { + MaskColor = IMAGE_MASK_STDCOLOR; + ImageBitmap = Bitmap { File = "hlplhorz.bmp" ; }; + }; + }; +}; diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx new file mode 100644 index 000000000000..0da01ad2ac54 --- /dev/null +++ b/sd/source/ui/dlg/docprev.cxx @@ -0,0 +1,308 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/animations/XAnimationNode.hpp> +#include "slideshow.hxx" +#include <sfx2/objsh.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/virdev.hxx> +#include <com/sun/star/presentation/FadeEffect.hpp> +#include <fadedef.h> +#include <vcl/ctrl.hxx> +#include <svx/svdoutl.hxx> +#include <svx/svdpagv.hxx> +#include <svx/svdorect.hxx> + +#include "docprev.hxx" +#include "drawdoc.hxx" +#include "DrawDocShell.hxx" +#include "ViewShell.hxx" +#include "ViewShellBase.hxx" +#include "drawview.hxx" +#include "sdpage.hxx" +#include "sfx2/viewfrm.hxx" +#include <vcl/svapp.hxx> + +#include <memory> + +using ::com::sun::star::drawing::XDrawPage; +using ::com::sun::star::animations::XAnimationNode; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +const int SdDocPreviewWin::FRAME = 4; + +void SdDocPreviewWin::SetObjectShell( SfxObjectShell* pObj, sal_uInt16 nShowPage ) +{ + mpObj = pObj; + mnShowPage = nShowPage; + if (mxSlideShow.is()) + { + mxSlideShow->end(); + mxSlideShow.clear(); + } + updateViewSettings(); +} + +SdDocPreviewWin::SdDocPreviewWin( Window* pParent, const ResId& rResId ) +: Control(pParent, rResId), pMetaFile( 0 ), bInEffect(sal_False), mpObj(NULL), mnShowPage(0) +{ + SetBorderStyle( WINDOW_BORDER_MONO ); + svtools::ColorConfig aColorConfig; + Wallpaper aEmpty; + SetBackground( aEmpty ); +} + +SdDocPreviewWin::~SdDocPreviewWin() +{ + delete pMetaFile; +} + +void SdDocPreviewWin::Resize() +{ + Invalidate(); + if( mxSlideShow.is() ) + mxSlideShow->resize( GetSizePixel() ); +} + +void SdDocPreviewWin::CalcSizeAndPos( GDIMetaFile* pFile, Size& rSize, Point& rPoint ) +{ + Size aTmpSize = pFile ? pFile->GetPrefSize() : Size(1,1 ); + long nWidth = rSize.Width() - 2*FRAME; + long nHeight = rSize.Height() - 2*FRAME; + if( nWidth < 0 ) nWidth = 0; + if( nHeight < 0 ) nHeight = 0; + + double dRatio=((double)aTmpSize.Width())/aTmpSize.Height(); + double dRatioPreV=((double) nWidth ) / nHeight; + + if (dRatio>dRatioPreV) + { + rSize=Size(nWidth, (sal_uInt16)(nWidth/dRatio)); + rPoint=Point( 0, (sal_uInt16)((nHeight-rSize.Height())/2)); + } + else + { + rSize=Size((sal_uInt16)(nHeight*dRatio), nHeight); + rPoint=Point((sal_uInt16)((nWidth-rSize.Width())/2),0); + } +} + +void SdDocPreviewWin::ImpPaint( GDIMetaFile* pFile, OutputDevice* pVDev ) +{ + Point aPoint; + Size aSize = pVDev->GetOutputSize(); + Point bPoint(aSize.Width()-2*FRAME, aSize.Height()-2*FRAME ); + CalcSizeAndPos( pFile, aSize, aPoint ); + bPoint -= aPoint; + aPoint += Point( FRAME, FRAME ); + + svtools::ColorConfig aColorConfig; + + pVDev->SetLineColor(); + pVDev->SetFillColor( Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor ) ); + pVDev->DrawRect(Rectangle( Point(0,0 ), pVDev->GetOutputSize())); + if( pFile ) + { + pVDev->SetFillColor( maDocumentColor ); + pVDev->DrawRect(Rectangle(aPoint, aSize)); + pFile->WindStart(); + pFile->Play( pVDev, aPoint, aSize ); + } +} + +void SdDocPreviewWin::Paint( const Rectangle& rRect ) +{ + if( (!mxSlideShow.is()) || (!mxSlideShow->isRunning() ) ) + { + SvtAccessibilityOptions aAccOptions; + bool bUseContrast = aAccOptions.GetIsForPagePreviews() && Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + SetDrawMode( bUseContrast + ? ::sd::ViewShell::OUTPUT_DRAWMODE_CONTRAST + : ::sd::ViewShell::OUTPUT_DRAWMODE_COLOR ); + + ImpPaint( pMetaFile, (VirtualDevice*)this ); + } + else + { + mxSlideShow->paint( rRect ); + } +} + +void SdDocPreviewWin::startPreview() +{ + ::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell * >( mpObj ); + if( mpObj ) + { + SdDrawDocument* pDoc = pDocShell->GetDoc(); + + if( pDoc ) + { + SdPage* pPage = pDoc->GetSdPage( mnShowPage, PK_STANDARD ); + + if( pPage && (pPage->getTransitionType() != 0) ) + { + if( !mxSlideShow.is() ) + mxSlideShow = sd::SlideShow::Create( pDoc ); + + Reference< XDrawPage > xDrawPage( pPage->getUnoPage(), UNO_QUERY ); + Reference< XAnimationNode > xAnimationNode; + + mxSlideShow->startPreview( xDrawPage, xAnimationNode, this ); + } + } + } +} + +long SdDocPreviewWin::Notify( NotifyEvent& rNEvt ) +{ + if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) + { + const MouseEvent* pMEvt = rNEvt.GetMouseEvent(); + if ( pMEvt->IsLeft() ) + { + if( rNEvt.GetWindow() == this ) + { + if(aClickHdl.IsSet()) + aClickHdl.Call(this); + } + } + } + + return Control::Notify( rNEvt ); +} + + +void SdDocPreviewWin::updateViewSettings() +{ + ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell,mpObj); + SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL; + + SvtAccessibilityOptions aAccOptions; + bool bUseWhiteColor = !aAccOptions.GetIsForPagePreviews() && GetSettings().GetStyleSettings().GetHighContrastMode(); + if( bUseWhiteColor ) + { + maDocumentColor = Color( COL_WHITE ); + } + else + { + svtools::ColorConfig aColorConfig; + maDocumentColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor ); + } + + GDIMetaFile* pMtf = NULL; + + if(pDoc) + { + SdPage * pPage = pDoc->GetSdPage( mnShowPage, PK_STANDARD ); + if( pPage ) + { + SdrOutliner& rOutl = pDoc->GetDrawOutliner(); + Color aOldBackgroundColor = rOutl.GetBackgroundColor(); + rOutl.SetBackgroundColor( maDocumentColor ); + + pMtf = new GDIMetaFile; + + VirtualDevice aVDev; + + const Fraction aFrac( pDoc->GetScaleFraction() ); + const MapMode aMap( pDoc->GetScaleUnit(), Point(), aFrac, aFrac ); + + aVDev.SetMapMode( aMap ); + + // Disable output, as we only want to record a metafile + aVDev.EnableOutput( sal_False ); + + pMtf->Record( &aVDev ); + + ::sd::DrawView* pView = new ::sd::DrawView(pDocShell, this, NULL); + + + const Size aSize( pPage->GetSize() ); + + pView->SetBordVisible( sal_False ); + pView->SetPageVisible( sal_False ); + pView->ShowSdrPage( pPage ); + + const Point aNewOrg( pPage->GetLftBorder(), pPage->GetUppBorder() ); + const Size aNewSize( aSize.Width() - pPage->GetLftBorder() - pPage->GetRgtBorder(), + aSize.Height() - pPage->GetUppBorder() - pPage->GetLwrBorder() ); + const Rectangle aClipRect( aNewOrg, aNewSize ); + MapMode aVMap( aMap ); + + aVDev.Push(); + aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) ); + aVDev.SetRelativeMapMode( aVMap ); + aVDev.IntersectClipRegion( aClipRect ); + + // Use new StandardCheckVisisbilityRedirector + StandardCheckVisisbilityRedirector aRedirector; + const Rectangle aRedrawRectangle = Rectangle( Point(), aNewSize ); + Region aRedrawRegion(aRedrawRectangle); + pView->SdrPaintView::CompleteRedraw(&aVDev,aRedrawRegion,&aRedirector); + + aVDev.Pop(); + + pMtf->Stop(); + pMtf->WindStart(); + pMtf->SetPrefMapMode( aMap ); + pMtf->SetPrefSize( aNewSize ); + + rOutl.SetBackgroundColor( aOldBackgroundColor ); + + delete pView; + } + } + + delete pMetaFile; + pMetaFile = pMtf; + + Invalidate(); +} + +void SdDocPreviewWin::Notify(SfxBroadcaster&, const SfxHint& rHint) +{ + if( rHint.ISA( SfxSimpleHint ) && ( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_COLORS_CHANGED ) + { + updateViewSettings(); + } +} +void SdDocPreviewWin::DataChanged( const DataChangedEvent& rDCEvt ) +{ + Control::DataChanged( rDCEvt ); + + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + updateViewSettings(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/filedlg.cxx b/sd/source/ui/dlg/filedlg.cxx new file mode 100644 index 000000000000..a80feb80e3f7 --- /dev/null +++ b/sd/source/ui/dlg/filedlg.cxx @@ -0,0 +1,371 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" +#include <tools/debug.hxx> +#include <cppuhelper/implbase1.hxx> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#include <com/sun/star/ui/dialogs/ListboxControlActions.hpp> +#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerListener.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp> +#include <com/sun/star/ui/dialogs/XFilePicker.hpp> +#include <vcl/msgbox.hxx> +#include <sal/types.h> +#include <tools/urlobj.hxx> +#include <osl/thread.hxx> +#include <osl/mutex.hxx> +#include <vcl/svapp.hxx> +#include <sfx2/filedlghelper.hxx> +#include <avmedia/mediawindow.hxx> +#include "filedlg.hxx" +#include "sdresid.hxx" +#include "strings.hrc" +#include <svtools/filter.hxx> + + +//----------------------------------------------------------------------------- + +namespace css = ::com::sun::star; + + +// -------------------------------------------------------------------- +// ----------- SdFileDialog_Imp --------------------------- +// -------------------------------------------------------------------- +class SdFileDialog_Imp : public sfx2::FileDialogHelper +{ +private: +#if defined __SUNPRO_CC + using sfx2::FileDialogHelper::Execute; +#endif + + friend class SdOpenSoundFileDialog; + + css::uno::Reference< css::ui::dialogs::XFilePickerControlAccess > mxControlAccess; + + css::uno::Reference< css::media::XPlayer > mxPlayer; + sal_uLong mnPlaySoundEvent; + sal_Bool mbUsableSelection; + sal_Bool mbLabelPlaying; + + void CheckSelectionState(); + + DECL_LINK( PlayMusicHdl, void * ); + + Timer maUpdateTimer; + + DECL_LINK( IsMusicStoppedHdl, void * ); + +public: + SdFileDialog_Imp( const short nDialogType, sal_Bool bUsableSelection ); + ~SdFileDialog_Imp(); + + ErrCode Execute(); + + // overwritten from FileDialogHelper, to receive user feedback + virtual void SAL_CALL ControlStateChanged( const css::ui::dialogs::FilePickerEvent& aEvent ); +}; + +// ------------------------------------------------------------------------ +void SAL_CALL SdFileDialog_Imp::ControlStateChanged( const css::ui::dialogs::FilePickerEvent& aEvent ) +{ + SolarMutexGuard aGuard; + + switch( aEvent.ElementId ) + { + case css::ui::dialogs::CommonFilePickerElementIds::LISTBOX_FILTER: + CheckSelectionState(); + break; + + case css::ui::dialogs::ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: + if( mxControlAccess.is() ) + { + if( mnPlaySoundEvent ) + Application::RemoveUserEvent( mnPlaySoundEvent ); + + mnPlaySoundEvent = Application::PostUserEvent( LINK( this, SdFileDialog_Imp, PlayMusicHdl ) ); + } + break; + } +} + +// ------------------------------------------------------------------------ +IMPL_LINK( SdFileDialog_Imp, PlayMusicHdl, void *, EMPTYARG ) +{ + maUpdateTimer.Stop(); + mnPlaySoundEvent = 0; + + if (mxPlayer.is()) + { + if (mxPlayer->isPlaying()) + mxPlayer->stop(); + mxPlayer.clear(); + } + + if( mbLabelPlaying ) + { + try + { + mxControlAccess->setLabel( css::ui::dialogs::ExtendedFilePickerElementIds::PUSHBUTTON_PLAY, + String( SdResId( STR_PLAY ) ) ); + + mbLabelPlaying = sal_False; + } + catch( css::lang::IllegalArgumentException ) + { +#ifdef DBG_UTIL + OSL_FAIL( "Cannot access play button" ); +#endif + } + } + else + { + rtl::OUString aUrl( GetPath() ); + if ( aUrl.getLength() ) + { + try + { + mxPlayer.set( avmedia::MediaWindow::createPlayer( aUrl ), css::uno::UNO_QUERY_THROW ); + mxPlayer->start(); + maUpdateTimer.SetTimeout( 100 ); + maUpdateTimer.Start(); + } + catch( css::uno::Exception& e ) + { + (void)e; + mxPlayer.clear(); + } + + if (mxPlayer.is()) + { + try + { + mxControlAccess->setLabel( css::ui::dialogs::ExtendedFilePickerElementIds::PUSHBUTTON_PLAY, + String( SdResId( STR_STOP ) ) ); + + mbLabelPlaying = sal_True; + } + catch( css::lang::IllegalArgumentException ) + { +#ifdef DBG_UTIL + OSL_FAIL( "Cannot access play button" ); +#endif + } + } + } + } + + return 0; +} + +// ------------------------------------------------------------------------ +IMPL_LINK( SdFileDialog_Imp, IsMusicStoppedHdl, void *, EMPTYARG ) +{ + SolarMutexGuard aGuard; + + if ( + mxPlayer.is() && mxPlayer->isPlaying() && + mxPlayer->getMediaTime() < mxPlayer->getDuration() + ) + { + maUpdateTimer.Start(); + return 0L; + } + + + if( mxControlAccess.is() ) + { + try + { + mxControlAccess->setLabel( css::ui::dialogs::ExtendedFilePickerElementIds::PUSHBUTTON_PLAY, + String( SdResId( STR_PLAY ) ) ); + mbLabelPlaying = sal_False; + } + catch( css::lang::IllegalArgumentException ) + { +#ifdef DBG_UTIL + OSL_FAIL( "Cannot access play button" ); +#endif + } + } + + return( 0L ); +} + +// check whether to disable the "selection" checkbox +void SdFileDialog_Imp::CheckSelectionState() +{ + if( mbUsableSelection && mxControlAccess.is() ) + { + String aCurrFilter( GetCurrentFilter() ); + + try + { + if( !aCurrFilter.Len() || ( aCurrFilter == String( SdResId( STR_EXPORT_HTML_NAME ) ) ) ) + mxControlAccess->enableControl( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION, sal_False ); + else + mxControlAccess->enableControl( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION, sal_True ); + } + catch( css::lang::IllegalArgumentException ) + { +#ifdef DBG_UTIL + OSL_FAIL( "Cannot access \"selection\" checkbox" ); +#endif + } + } +} + +//----------------------------------------------------------------------------- +SdFileDialog_Imp::SdFileDialog_Imp( const short nDialogType, + sal_Bool bUsableSelection ) : + FileDialogHelper( nDialogType, 0 ), + mnPlaySoundEvent( 0 ), + mbUsableSelection( bUsableSelection ), + mbLabelPlaying(sal_False) +{ + maUpdateTimer.SetTimeoutHdl(LINK(this, SdFileDialog_Imp, IsMusicStoppedHdl)); + + css::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker > xFileDlg = GetFilePicker(); + + // get the control access + mxControlAccess = css::uno::Reference< css::ui::dialogs::XFilePickerControlAccess > ( xFileDlg, css::uno::UNO_QUERY ); + + if( mxControlAccess.is() ) + { + if( nDialogType == + css::ui::dialogs::TemplateDescription::FILEOPEN_PLAY ) + { + try + { + mxControlAccess->setLabel( css::ui::dialogs::ExtendedFilePickerElementIds::PUSHBUTTON_PLAY, + String( SdResId( STR_PLAY ) ) ); + } + catch( css::lang::IllegalArgumentException ) + { +#ifdef DBG_UTIL + OSL_FAIL( "Cannot set play button label" ); +#endif + } + } + else if( mbUsableSelection != sal_True ) + { + try + { + mxControlAccess->enableControl( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION, sal_False ); + } + catch( css::lang::IllegalArgumentException ) + { +#ifdef DBG_UTIL + OSL_FAIL( "Cannot disable selection checkbox" ); +#endif + } + } + } +} + + +// ------------------------------------------------------------------------ +SdFileDialog_Imp::~SdFileDialog_Imp() +{ + if( mnPlaySoundEvent ) + Application::RemoveUserEvent( mnPlaySoundEvent ); +} + +// ------------------------------------------------------------------------ +ErrCode SdFileDialog_Imp::Execute() +{ + // make sure selection checkbox is disabled if + // HTML is current filter! + CheckSelectionState(); + return FileDialogHelper::Execute(); +} + +// -------------------------------------------------------------------- +// ----------- SdOpenSoundFileDialog ----------------------- +// -------------------------------------------------------------------- + +// these are simple forwarders +SdOpenSoundFileDialog::SdOpenSoundFileDialog() : + mpImpl( + new SdFileDialog_Imp( + css::ui::dialogs::TemplateDescription::FILEOPEN_PLAY, sal_False ) ) +{ + String aDescr; + aDescr = String(SdResId(STR_ALL_FILES)); + mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.*" ) ) ); + + // setup filter +#if defined UNX + aDescr = String(SdResId(STR_AU_FILE)); + mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.au;*.snd" ) ) ); + aDescr = String(SdResId(STR_VOC_FILE)); + mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.voc" ) ) ); + aDescr = String(SdResId(STR_WAV_FILE)); + mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.wav" ) ) ); + aDescr = String(SdResId(STR_AIFF_FILE)); + mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.aiff" ) ) ); + aDescr = String(SdResId(STR_SVX_FILE)); + mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.svx" ) ) ); +#else + aDescr = String(SdResId(STR_WAV_FILE)); + mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.wav;*.mp3;*.ogg" ) ) ); + aDescr = String(SdResId(STR_MIDI_FILE)); + mpImpl->AddFilter( aDescr, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.mid" ) ) ); +#endif +} + +// ------------------------------------------------------------------------ +SdOpenSoundFileDialog::~SdOpenSoundFileDialog() +{ +} + +// ------------------------------------------------------------------------ +ErrCode SdOpenSoundFileDialog::Execute() +{ + return mpImpl->Execute(); +} + +// ------------------------------------------------------------------------ +String SdOpenSoundFileDialog::GetPath() const +{ + return mpImpl->GetPath(); +} + +// ------------------------------------------------------------------------ +void SdOpenSoundFileDialog::SetPath( const String& rPath ) +{ + mpImpl->SetDisplayDirectory( rPath ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx new file mode 100644 index 000000000000..e4e62cc8be13 --- /dev/null +++ b/sd/source/ui/dlg/gluectrl.cxx @@ -0,0 +1,233 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + + +#include <string> + +#include <svx/dialogs.hrc> +#include <svx/svdglue.hxx> +#include <svl/intitem.hxx> +#include <sfx2/app.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/toolbox.hxx> +#include <sfx2/viewfrm.hxx> + +#include "strings.hrc" +#include "gluectrl.hxx" +#include "sdresid.hxx" +#include "app.hrc" + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::frame; + +// z.Z. werden von Joe nur die u.a. Moeglichkeiten unterstuetzt +#define ESCDIR_COUNT 5 +static sal_uInt16 aEscDirArray[] = +{ + SDRESC_SMART, + SDRESC_LEFT, + SDRESC_RIGHT, + SDRESC_TOP, + SDRESC_BOTTOM, +// SDRESC_LO, +// SDRESC_LU, +// SDRESC_RO, +// SDRESC_RU, +// SDRESC_HORZ, +// SDRESC_VERT, +// SDRESC_ALL +}; + + + +SFX_IMPL_TOOLBOX_CONTROL( SdTbxCtlGlueEscDir, SfxUInt16Item ) + +/************************************************************************* +|* +|* Konstruktor fuer Klebepunkt-Autrittsrichtungs-Listbox +|* +\************************************************************************/ + +GlueEscDirLB::GlueEscDirLB( Window* pParent, const Reference< XFrame >& rFrame ) : + ListBox( pParent, WinBits( WB_BORDER | WB_DROPDOWN ) ), + m_xFrame( rFrame ) +{ + String aStr; aStr += sal_Unicode('X'); + Size aXSize( GetTextWidth( aStr ), GetTextHeight() ); + //SetPosPixel( Point( aSize.Width(), 0 ) ); + SetSizePixel( Size( aXSize.Width() * 12, aXSize.Height() * 10 ) ); + Fill(); + //SelectEntryPos( 0 ); + Show(); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +GlueEscDirLB::~GlueEscDirLB() +{ +} + +/************************************************************************* +|* +|* Ermittelt die Austrittsrichtung und verschickt den entspr. Slot +|* +\************************************************************************/ + +void GlueEscDirLB::Select() +{ + sal_uInt16 nPos = GetSelectEntryPos(); + SfxUInt16Item aItem( SID_GLUE_ESCDIR, aEscDirArray[ nPos ] ); + + if ( m_xFrame.is() ) + { + Any a; + Sequence< PropertyValue > aArgs( 1 ); + aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GlueEscapeDirection" )); + aItem.QueryValue( a ); + aArgs[0].Value = a; + SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GlueEscapeDirection" )), + aArgs ); + } +/* + SfxViewFrame::Current()->GetDispatcher()->Execute( SID_GLUE_ESCDIR, SFX_CALLMODE_ASYNCHRON | + SFX_CALLMODE_RECORD, &aItem, (void*) NULL, 0L ); +*/ +} + +/************************************************************************* +|* +|* Fuellen der Listbox mit Strings +|* +\************************************************************************/ + +void GlueEscDirLB::Fill() +{ + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_SMART ) ) ); + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_LEFT ) ) ); + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_RIGHT ) ) ); + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_TOP ) ) ); + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_BOTTOM ) ) ); + /* + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_LO ) ) ); + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_LU ) ) ); + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_RO ) ) ); + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_RU ) ) ); + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_HORZ ) ) ); + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_VERT ) ) ); + InsertEntry( String( SdResId( STR_GLUE_ESCDIR_ALL ) ) ); + */ +} + +/************************************************************************* +|* +|* Konstruktor fuer Klebepunkt-Autrittsrichtungs-Toolbox-Control +|* +\************************************************************************/ + +SdTbxCtlGlueEscDir::SdTbxCtlGlueEscDir( + sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : + SfxToolBoxControl( nSlotId, nId, rTbx ) +{ +} + +/************************************************************************* +|* +|* Stellt Status in der Listbox des Controllers dar +|* +\************************************************************************/ + +void SdTbxCtlGlueEscDir::StateChanged( sal_uInt16 nSId, + SfxItemState eState, const SfxPoolItem* pState ) +{ + if( eState == SFX_ITEM_AVAILABLE ) + { + GlueEscDirLB* pGlueEscDirLB = (GlueEscDirLB*) ( GetToolBox(). + GetItemWindow( GetId() ) ); + if( pGlueEscDirLB ) + { + if( pState ) + { + pGlueEscDirLB->Enable(); + if ( IsInvalidItem( pState ) ) + { + pGlueEscDirLB->SetNoSelection(); + } + else + { + sal_uInt16 nEscDir = ( (const SfxUInt16Item*) pState )->GetValue(); + pGlueEscDirLB->SelectEntryPos( GetEscDirPos( nEscDir ) ); + } + } + else + { + pGlueEscDirLB->Disable(); + pGlueEscDirLB->SetNoSelection(); + } + } + } + + SfxToolBoxControl::StateChanged( nSId, eState, pState ); +} + +Window* SdTbxCtlGlueEscDir::CreateItemWindow( Window *pParent ) +{ + if( GetSlotId() == SID_GLUE_ESCDIR ) + { + return( new GlueEscDirLB( pParent, m_xFrame ) ); + } + + return( NULL ); +} + + +/************************************************************************* +|* +|* Liefert Position im Array fuer EscDir zurueck (Mapping fuer Listbox) +|* +\************************************************************************/ + +sal_uInt16 SdTbxCtlGlueEscDir::GetEscDirPos( sal_uInt16 nEscDir ) +{ + for( sal_uInt16 i = 0; i < ESCDIR_COUNT; i++ ) + { + if( aEscDirArray[ i ] == nEscDir ) + return( i ); + } + return( 99 ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx new file mode 100644 index 000000000000..37663bcee34b --- /dev/null +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -0,0 +1,952 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include <svx/dialogs.hrc> +#include <editeng/eeitem.hxx> +#include <editeng/flditem.hxx> +#include <editeng/langitem.hxx> +#include <svx/langbox.hxx> +#include <svx/svdotext.hxx> +#include <editeng/editeng.hxx> +#include <sfx2/viewfrm.hxx> + +#include "sdresid.hxx" + +#include <vcl/fixed.hxx> +#include <vcl/button.hxx> +#include <vcl/edit.hxx> +#include <vcl/combobox.hxx> + +#include "helpids.h" +#include "Outliner.hxx" +#include "dialogs.hrc" +#include "headerfooterdlg.hxx" +#include "DrawDocShell.hxx" +#include "drawdoc.hxx" +#include "ViewShell.hxx" + +/////////////////////////////////////////////////////////////////////// +// preview control for presentation layout +/////////////////////////////////////////////////////////////////////// +#include <vcl/ctrl.hxx> +#include <tools/color.hxx> +#include <i18npool/mslangid.hxx> +#include <svtools/colorcfg.hxx> +#include <svx/xlndsit.hxx> +#include <svx/xlineit0.hxx> +#include <svx/xlnclit.hxx> +#include <vcl/decoview.hxx> + +#include "undoheaderfooter.hxx" +#include "sdundogr.hxx" +#include "ViewShell.hxx" + +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> + +namespace sd +{ + +class PresLayoutPreview : public Control +{ +private: + SdPage* mpMaster; + HeaderFooterSettings maSettings; + Size maPageSize; + Rectangle maOutRect; + +private: + void Paint( OutputDevice& aOut, SdrTextObj* pObj, bool bVisible, bool bDotted = false ); + +public: + PresLayoutPreview( ::Window* pParent, const ResId& rResId, SdPage* pMaster ); + ~PresLayoutPreview(); + + virtual void Paint( const Rectangle& rRect ); + + void update( HeaderFooterSettings& rSettings ); +}; + +} + +/////////////////////////////////////////////////////////////////////// +// tab page for slide & header'n'notes +/////////////////////////////////////////////////////////////////////// + +namespace sd +{ + +const int nDateTimeFormatsCount = 10; +int nDateTimeFormats[nDateTimeFormatsCount] = +{ + SVXDATEFORMAT_A, + SVXDATEFORMAT_F, + SVXDATEFORMAT_D, + SVXDATEFORMAT_C, + + SVXDATEFORMAT_A | (SVXTIMEFORMAT_24_HM << 4), + SVXDATEFORMAT_A | (SVXTIMEFORMAT_12_HM << 4), + + (SVXTIMEFORMAT_24_HM << 4), + (SVXTIMEFORMAT_24_HMS <<4), + + (SVXTIMEFORMAT_12_HM << 4 ), + (SVXTIMEFORMAT_12_HMS << 4 ) +}; + +class HeaderFooterTabPage : public TabPage +{ +private: + FixedLine maFLIncludeOnPage; + + CheckBox maCBHeader; + FixedText maFTHeader; + Edit maTBHeader; + + FixedLine maFLDateTime; + CheckBox maCBDateTime; + RadioButton maRBDateTimeFixed; + RadioButton maRBDateTimeAutomatic; + Edit maTBDateTimeFixed; + ListBox maCBDateTimeFormat; + FixedText maFTDateTimeLanguage; + SvxLanguageBox maCBDateTimeLanguage; + + FixedLine maFLFooter; + CheckBox maCBFooter; + FixedText maFTFooter; + Edit maTBFooter; + + FixedLine maFLSlideNumber; + CheckBox maCBSlideNumber; + + FixedLine maFLNotOnTitle; + CheckBox maCBNotOnTitle; + + PushButton maPBApplyToAll; + PushButton maPBApply; + CancelButton maPBCancel; + HelpButton maPBHelp; + + PresLayoutPreview maCTPreview; + + SdPage* mpCurrentPage; + SdDrawDocument * mpDoc; + HeaderFooterDialog* mpDialog; + LanguageType meOldLanguage; + + bool mbHandoutMode; + + DECL_LINK( UpdateOnClickHdl, void * ); + + DECL_LINK( ClickApplyToAllHdl, void * ); + DECL_LINK( ClickApplyHdl, void * ); + DECL_LINK( ClickCancelHdl, void * ); + + DECL_LINK( LanguageChangeHdl, void * ); + + void FillFormatList(int eFormat); + void GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet ); + void GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet, SdPage* pPage ); + +public: + HeaderFooterTabPage( HeaderFooterDialog* pDialog, ::Window* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); + ~HeaderFooterTabPage(); + + static SfxTabPage* Create( ::Window*, const SfxItemSet& ); + static sal_uInt16* GetRanges(); + + void init( const HeaderFooterSettings& rSettings, bool bNotOnTitle, bool bHasApply ); + void getData( HeaderFooterSettings& rSettings, bool& rNotOnTitle ); + void update(); +}; + +} + +/////////////////////////////////////////////////////////////////////// + +using namespace ::sd; + + +HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, ::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage ) : + TabDialog ( pParent, SdResId( RID_SD_DLG_HEADERFOOTER ) ), + maTabCtrl( this, SdResId( 1 ) ), + mpDoc( pDoc ), + mpCurrentPage( pCurrentPage ), + mpViewShell( pViewShell ) +{ + FreeResource(); + + SdPage* pSlide; + SdPage* pNotes; + if( pCurrentPage->GetPageKind() == PK_STANDARD ) + { + pSlide = pCurrentPage; + pNotes = (SdPage*)pDoc->GetPage( pCurrentPage->GetPageNum() + 1 ); + } + else if( pCurrentPage->GetPageKind() == PK_NOTES ) + { + pNotes = pCurrentPage; + pSlide = (SdPage*)pDoc->GetPage( pCurrentPage->GetPageNum() -1 ); + mpCurrentPage = pSlide; + } + else + { + // handout + pSlide = pDoc->GetSdPage( 0, PK_STANDARD ); + pNotes = pDoc->GetSdPage( 0, PK_NOTES ); + mpCurrentPage = NULL; + } + +// maTabCtrl.SetHelpId( HID_XML_FILTER_TABPAGE_CTRL ); + maTabCtrl.Show(); + + mpSlideTabPage = new HeaderFooterTabPage( this, &maTabCtrl, pDoc, pSlide, false ); + mpSlideTabPage->SetHelpId( HID_SD_TABPAGE_HEADERFOOTER_SLIDE ); + maTabCtrl.SetTabPage( RID_SD_TABPAGE_HEADERFOOTER_SLIDE, mpSlideTabPage ); + + Size aSiz = mpSlideTabPage->GetSizePixel(); + Size aCtrlSiz = maTabCtrl.GetOutputSizePixel(); + // set size on TabControl only if smaller than TabPage + if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() ) + { + maTabCtrl.SetOutputSizePixel( aSiz ); + aCtrlSiz = aSiz; + } + + mpNotesHandoutsTabPage = new HeaderFooterTabPage( this, &maTabCtrl, pDoc, pNotes, true ); + mpNotesHandoutsTabPage->SetHelpId( HID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT ); + maTabCtrl.SetTabPage( RID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT, mpNotesHandoutsTabPage ); + + aSiz = mpNotesHandoutsTabPage->GetSizePixel(); + if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() ) + { + maTabCtrl.SetOutputSizePixel( aSiz ); + aCtrlSiz = aSiz; + } + + ActivatePageHdl( &maTabCtrl ); + + AdjustLayout(); + + maTabCtrl.SetActivatePageHdl( LINK( this, HeaderFooterDialog, ActivatePageHdl ) ); + maTabCtrl.SetDeactivatePageHdl( LINK( this, HeaderFooterDialog, DeactivatePageHdl ) ); + + maSlideSettings = pSlide->getHeaderFooterSettings(); + + const HeaderFooterSettings& rTitleSettings = mpDoc->GetSdPage(0, PK_STANDARD)->getHeaderFooterSettings(); + bool bNotOnTitle = !rTitleSettings.mbFooterVisible && !rTitleSettings.mbSlideNumberVisible && !rTitleSettings.mbDateTimeVisible; + + mpSlideTabPage->init( maSlideSettings, bNotOnTitle, mpCurrentPage != NULL ); + + maNotesHandoutSettings = pNotes->getHeaderFooterSettings(); + mpNotesHandoutsTabPage->init( maNotesHandoutSettings, false, false ); +} + +// ----------------------------------------------------------------------- + +HeaderFooterDialog::~HeaderFooterDialog() +{ + delete mpSlideTabPage; + delete mpNotesHandoutsTabPage; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( HeaderFooterDialog, ActivatePageHdl, TabControl *, pTabCtrl ) +{ + const sal_uInt16 nId = pTabCtrl->GetCurPageId(); + TabPage* pTabPage = pTabCtrl->GetTabPage( nId ); + pTabPage->Show(); + + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( HeaderFooterDialog, DeactivatePageHdl, TabControl *, EMPTYARG ) +{ + return sal_True; +} + +// ----------------------------------------------------------------------- + +short HeaderFooterDialog::Execute() +{ + sal_uInt16 nRet = TabDialog::Execute(); + if( nRet ) + mpViewShell->GetDocSh()->SetModified(); + return nRet; +} + +// ----------------------------------------------------------------------- + +void HeaderFooterDialog::ApplyToAll( TabPage* pPage ) +{ + apply( true, pPage == mpSlideTabPage ); + EndDialog(1); +} + +// ----------------------------------------------------------------------- + +void HeaderFooterDialog::Apply( TabPage* pPage ) +{ + apply( false, pPage == mpSlideTabPage ); + EndDialog(1); +} + +// ----------------------------------------------------------------------- + +void HeaderFooterDialog::Cancel( TabPage* ) +{ + EndDialog(); +} + +// ----------------------------------------------------------------------- + +void HeaderFooterDialog::apply( bool bToAll, bool bForceSlides ) +{ + SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc); + String aComment( GetText() ); + pUndoGroup->SetComment( aComment ); + + HeaderFooterSettings aNewSettings; + bool bNewNotOnTitle; + + // change slide settings first ... + + mpSlideTabPage->getData( aNewSettings, bNewNotOnTitle ); + + // only if we pressed apply or apply all on the slide tab page or if the slide settings + // have been changed + if( bForceSlides || !(aNewSettings == maSlideSettings) ) + { + // apply to all slides + if( bToAll ) + { + int nPageCount = mpDoc->GetSdPageCount( PK_STANDARD ); + int nPage; + for( nPage = 0; nPage < nPageCount; nPage++ ) + { + SdPage* pPage = mpDoc->GetSdPage( (sal_uInt16)nPage, PK_STANDARD ); + change( pUndoGroup, pPage, aNewSettings ); + } + } + else + { + // apply only to the current slide + DBG_ASSERT( mpCurrentPage && mpCurrentPage->GetPageKind() == PK_STANDARD, "no current page to apply to!" ); + if( mpCurrentPage && (mpCurrentPage->GetPageKind() == PK_STANDARD) ) + { + change( pUndoGroup, mpCurrentPage, aNewSettings ); + } + } + } + + // if we don't want to have header&footer on the first slide + if( bNewNotOnTitle ) + { + // just hide them, plain simple UI feature + HeaderFooterSettings aTempSettings = mpDoc->GetSdPage( 0, PK_STANDARD )->getHeaderFooterSettings(); + + aTempSettings.mbFooterVisible = false; + aTempSettings.mbSlideNumberVisible = false; + aTempSettings.mbDateTimeVisible = false; + + change( pUndoGroup, mpDoc->GetSdPage( 0, PK_STANDARD ), aTempSettings ); + } + + // now notes settings + + mpNotesHandoutsTabPage->getData( aNewSettings, bNewNotOnTitle ); + + // only if we pressed apply or apply all on the notes tab page or if the notes settings + // have been changed + if( !bForceSlides || !(aNewSettings == maNotesHandoutSettings) ) + { + // first set to all notes pages + int nPageCount = mpDoc->GetSdPageCount( PK_NOTES ); + int nPage; + for( nPage = 0; nPage < nPageCount; nPage++ ) + { + SdPage* pPage = mpDoc->GetSdPage( (sal_uInt16)nPage, PK_NOTES ); + + change( pUndoGroup, pPage, aNewSettings ); + } + + // and last but not least to the handout page + change( pUndoGroup, mpDoc->GetMasterSdPage( 0, PK_HANDOUT ), aNewSettings ); + } + + // Undo Gruppe dem Undo Manager uebergeben + mpViewShell->GetViewFrame()->GetObjectShell()->GetUndoManager()->AddUndoAction(pUndoGroup); +} + +// ----------------------------------------------------------------------- + +void HeaderFooterDialog::change( SdUndoGroup* pUndoGroup, SdPage* pPage, const HeaderFooterSettings& rNewSettings ) +{ + pUndoGroup->AddAction(new SdHeaderFooterUndoAction(mpDoc, pPage, rNewSettings )); + pPage->setHeaderFooterSettings( rNewSettings ); +} + +/////////////////////////////////////////////////////////////////////// + +inline void moveY( ::Window& rWin, int deltaY ) +{ + Point aPos = rWin.GetPosPixel(); + aPos.Y() += deltaY; + rWin.SetPosPixel( aPos ); +} + +HeaderFooterTabPage::HeaderFooterTabPage( HeaderFooterDialog* pDialog, ::Window* pWindow, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ) : + TabPage( pWindow, SdResId( RID_SD_TABPAGE_HEADERFOOTER ) ), + maFLIncludeOnPage( this, SdResId( FL_INCLUDE_ON_PAGE ) ), + maCBHeader( this, SdResId( CB_HEADER ) ), + maFTHeader( this, SdResId( FT_HEADER ) ), + maTBHeader( this, SdResId( TB_HEADER_FIXED ) ), + maFLDateTime( this, SdResId( FL_DATETIME ) ), + maCBDateTime( this, SdResId( CB_DATETIME ) ), + maRBDateTimeFixed( this, SdResId( RB_DATETIME_FIXED ) ), + maRBDateTimeAutomatic( this, SdResId( RB_DATETIME_AUTOMATIC ) ), + maTBDateTimeFixed( this, SdResId( TB_DATETIME_FIXED ) ), + maCBDateTimeFormat( this, SdResId( CB_DATETIME_FORMAT ) ), + maFTDateTimeLanguage( this, SdResId( FT_DATETIME_LANGUAGE ) ), + maCBDateTimeLanguage( this, SdResId( CB_DATETIME_LANGUAGE ) ), + + maFLFooter( this, SdResId( FL_FOOTER ) ), + maCBFooter( this, SdResId( CB_FOOTER ) ), + maFTFooter( this, SdResId( FT_FOOTER ) ), + maTBFooter( this, SdResId( TB_FOOTER_FIXED ) ), + + maFLSlideNumber( this, SdResId( FL_SLIDENUMBER ) ), + maCBSlideNumber( this, SdResId( CB_SLIDENUMBER ) ), + + maFLNotOnTitle( this, SdResId( FL_NOTONTITLE ) ), + maCBNotOnTitle( this, SdResId( CB_NOTONTITLE ) ), + + maPBApplyToAll( this, SdResId( BT_APPLYTOALL ) ), + maPBApply( this, SdResId( BT_APPLY ) ), + maPBCancel( this, SdResId( BT_CANCEL ) ), + maPBHelp( this, SdResId( BT_HELP ) ), + + maCTPreview( this, SdResId( CT_PREVIEW ), + pActualPage ? + (pActualPage->IsMasterPage() ? pActualPage : (SdPage*)(&(pActualPage->TRG_GetMasterPage()))) : + (pDoc->GetMasterSdPage( 0, bHandoutMode ? PK_NOTES : PK_STANDARD )) ), + mpCurrentPage(pActualPage), + mpDoc(pDoc), + mpDialog(pDialog), + mbHandoutMode( bHandoutMode ) + +{ + pDoc->StopWorkStartupDelay(); + + if( !mbHandoutMode ) + { + int deltaY = maCBHeader.GetPosPixel().Y() - maCBDateTime.GetPosPixel().Y(); + + moveY( maCBDateTime, deltaY ); + moveY( maRBDateTimeFixed, deltaY ); + moveY( maRBDateTimeAutomatic, deltaY ); + moveY( maTBDateTimeFixed, deltaY ); + moveY( maCBDateTimeFormat, deltaY ); + moveY( maFTDateTimeLanguage, deltaY ); + moveY( maCBDateTimeLanguage, deltaY ); + moveY( maFLFooter, deltaY ); + moveY( maCBFooter, deltaY ); + moveY( maFTFooter, deltaY ); + moveY( maTBFooter, deltaY ); + moveY( maFLSlideNumber, deltaY ); + moveY( maCBSlideNumber, deltaY ); + moveY( maFLNotOnTitle, deltaY ); + moveY( maCBNotOnTitle, deltaY ); + } + else + { + int deltaY = maPBApply.GetPosPixel().Y() - maPBCancel.GetPosPixel().Y(); + + moveY( maPBCancel, deltaY ); + moveY( maPBHelp, deltaY ); + + String aPageNumberStr( SdResId( STR_PAGE_NUMBER ) ); + maCBSlideNumber.SetText( aPageNumberStr ); + + String aIncludeOnPageStr( SdResId( STR_INCLUDE_ON_PAGE ) ); + maFLIncludeOnPage.SetText( aIncludeOnPageStr ); + } + + FreeResource(); + + maPBApply.Show( !mbHandoutMode ); + maCBHeader.Show( mbHandoutMode ); + maFTHeader.Show( mbHandoutMode ); + maTBHeader.Show( mbHandoutMode ); + maFLDateTime.Show( mbHandoutMode ); + maFLNotOnTitle.Show( !mbHandoutMode ); + maCBNotOnTitle.Show( !mbHandoutMode ); + + maCBDateTime.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); + maRBDateTimeFixed.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); + maRBDateTimeAutomatic.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); + maCBFooter.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); + maCBHeader.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); + maCBSlideNumber.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); + + maPBApplyToAll.SetClickHdl( LINK( this, HeaderFooterTabPage, ClickApplyToAllHdl ) ); + maPBApply.SetClickHdl( LINK( this, HeaderFooterTabPage, ClickApplyHdl ) ); + maPBCancel.SetClickHdl( LINK( this, HeaderFooterTabPage, ClickCancelHdl ) ); + + maCBDateTimeLanguage.SetLanguageList( LANG_LIST_ALL|LANG_LIST_ONLY_KNOWN, false ); + maCBDateTimeLanguage.SetSelectHdl( LINK( this, HeaderFooterTabPage, LanguageChangeHdl ) ); + + GetOrSetDateTimeLanguage( meOldLanguage, false ); + meOldLanguage = MsLangId::getRealLanguage( meOldLanguage ); + maCBDateTimeLanguage.SelectLanguage( meOldLanguage ); + + FillFormatList(SVXDATEFORMAT_A); + + maTBHeader.SetAccessibleRelationMemberOf(&maCBHeader); + maRBDateTimeFixed.SetAccessibleRelationMemberOf(&maCBDateTime); + maRBDateTimeAutomatic.SetAccessibleRelationMemberOf(&maCBDateTime); + maTBDateTimeFixed.SetAccessibleName(maRBDateTimeFixed.GetText()); + maTBDateTimeFixed.SetAccessibleRelationMemberOf(&maCBDateTime); + maTBDateTimeFixed.SetAccessibleRelationLabeledBy(&maRBDateTimeFixed); + maCBDateTimeFormat.SetAccessibleRelationMemberOf(&maCBDateTime); + maCBDateTimeFormat.SetAccessibleName(maRBDateTimeAutomatic.GetText()); + maCBDateTimeFormat.SetAccessibleRelationLabeledBy(&maRBDateTimeAutomatic); + maCBDateTimeLanguage.SetAccessibleRelationMemberOf(&maCBDateTime); + maTBFooter.SetAccessibleRelationMemberOf(&maCBFooter); + maCBSlideNumber.SetAccessibleRelationMemberOf(&maFLIncludeOnPage); + maCBFooter.SetAccessibleRelationMemberOf(&maFLIncludeOnPage); +} +// ----------------------------------------------------------------------- + +HeaderFooterTabPage::~HeaderFooterTabPage() +{ +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( HeaderFooterTabPage, LanguageChangeHdl, void *, EMPTYARG ) +{ + FillFormatList( (int)(sal_IntPtr)maCBDateTimeFormat.GetEntryData( maCBDateTimeFormat.GetSelectEntryPos() ) ); + + + return 0L; +} + +// ----------------------------------------------------------------------- + +void HeaderFooterTabPage::FillFormatList( int eFormat ) +{ + LanguageType eLanguage = maCBDateTimeLanguage.GetSelectLanguage(); + + maCBDateTimeFormat.Clear(); + + Date aDate; + Time aTime; + + int nFormat; + for( nFormat = 0; nFormat < nDateTimeFormatsCount; nFormat++ ) + { + String aStr( SvxDateTimeField::GetFormatted( aDate, aTime, nDateTimeFormats[nFormat], *(SD_MOD()->GetNumberFormatter()), eLanguage ) ); + sal_uInt16 nEntry = maCBDateTimeFormat.InsertEntry( aStr ); + maCBDateTimeFormat.SetEntryData( nEntry, (void*)(sal_IntPtr)nDateTimeFormats[nFormat] ); + if( nDateTimeFormats[nFormat] == eFormat ) + { + maCBDateTimeFormat.SelectEntryPos( nEntry ); + maCBDateTimeFormat.SetText( aStr ); + } + } +} + +// ----------------------------------------------------------------------- + +void HeaderFooterTabPage::init( const HeaderFooterSettings& rSettings, bool bNotOnTitle, bool bHasApply ) +{ + maCBDateTime.Check( rSettings.mbDateTimeVisible ); + maRBDateTimeFixed.Check( rSettings.mbDateTimeIsFixed ); + maRBDateTimeAutomatic.Check( !rSettings.mbDateTimeIsFixed ); + maTBDateTimeFixed.SetText( rSettings.maDateTimeText ); + + maCBHeader.Check( rSettings.mbHeaderVisible ); + maTBHeader.SetText( rSettings.maHeaderText ); + + maCBFooter.Check( rSettings.mbFooterVisible ); + maTBFooter.SetText( rSettings.maFooterText ); + + maCBSlideNumber.Check( rSettings.mbSlideNumberVisible ); + + maCBNotOnTitle.Check( bNotOnTitle ); + maPBApply.Enable( bHasApply ); + + maCBDateTimeLanguage.SelectLanguage( meOldLanguage ); + + sal_uInt16 nPos; + for( nPos = 0; nPos < maCBDateTimeFormat.GetEntryCount(); nPos++ ) + { + int nFormat = (int)(sal_IntPtr)maCBDateTimeFormat.GetEntryData( nPos ); + if( nFormat == rSettings.meDateTimeFormat ) + { + maCBDateTimeFormat.SelectEntryPos( nPos ); + maCBDateTimeFormat.SetText( maCBDateTimeFormat.GetEntry(nPos) ); + break; + } + } + + update(); +} + +// ----------------------------------------------------------------------- + +void HeaderFooterTabPage::getData( HeaderFooterSettings& rSettings, bool& rNotOnTitle ) +{ + rSettings.mbDateTimeVisible = maCBDateTime.IsChecked(); + rSettings.mbDateTimeIsFixed = maRBDateTimeFixed.IsChecked(); + rSettings.maDateTimeText = maTBDateTimeFixed.GetText(); + rSettings.mbFooterVisible = maCBFooter.IsChecked(); + rSettings.maFooterText = maTBFooter.GetText(); + rSettings.mbSlideNumberVisible = maCBSlideNumber.IsChecked(); + rSettings.mbHeaderVisible = maCBHeader.IsChecked(); + rSettings.maHeaderText = maTBHeader.GetText(); + + if( maCBDateTimeFormat.GetSelectEntryCount() == 1 ) + rSettings.meDateTimeFormat = (int)(sal_IntPtr)maCBDateTimeFormat.GetEntryData( maCBDateTimeFormat.GetSelectEntryPos() ); + + LanguageType eLanguage = maCBDateTimeLanguage.GetSelectLanguage(); + if( eLanguage != meOldLanguage ) + GetOrSetDateTimeLanguage( eLanguage, true ); + + rNotOnTitle = maCBNotOnTitle.IsChecked(); +} + +// ----------------------------------------------------------------------- + +void HeaderFooterTabPage::update() +{ + maRBDateTimeFixed.Enable( maCBDateTime.IsChecked() ); + maTBDateTimeFixed.Enable( maRBDateTimeFixed.IsChecked() && maCBDateTime.IsChecked() ); + maRBDateTimeAutomatic.Enable( maCBDateTime.IsChecked() ); + maCBDateTimeFormat.Enable( maCBDateTime.IsChecked() && maRBDateTimeAutomatic.IsChecked() ); + maFTDateTimeLanguage.Enable( maCBDateTime.IsChecked() && maRBDateTimeAutomatic.IsChecked() ); + maCBDateTimeLanguage.Enable( maCBDateTime.IsChecked() && maRBDateTimeAutomatic.IsChecked() ); + + maFTFooter.Enable( maCBFooter.IsChecked() ); + maTBFooter.Enable( maCBFooter.IsChecked() ); + + maFTHeader.Enable( maCBHeader.IsChecked() ); + maTBHeader.Enable( maCBHeader.IsChecked() ); + + HeaderFooterSettings aSettings; + bool bNotOnTitle; + getData( aSettings, bNotOnTitle ); + maCTPreview.update( aSettings ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( HeaderFooterTabPage, UpdateOnClickHdl, void *, EMPTYARG ) +{ + update(); + + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( HeaderFooterTabPage, ClickApplyToAllHdl, void *, EMPTYARG ) +{ + mpDialog->ApplyToAll( this ); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( HeaderFooterTabPage, ClickApplyHdl, void *, EMPTYARG ) +{ + mpDialog->Apply( this ); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( HeaderFooterTabPage, ClickCancelHdl, void *, EMPTYARG ) +{ + mpDialog->Cancel( this ); + return 0; +} + +// ----------------------------------------------------------------------- + +void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet ) +{ + if( mbHandoutMode ) + { + // if set, set it on all notes master pages + if( bSet ) + { + sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount( PK_NOTES ); + sal_uInt16 nPage; + for( nPage = 0; nPage < nPageCount; nPage++ ) + { + GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PK_NOTES ) ); + } + } + + // and set it, or just get it from the handout master page + GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 0, PK_HANDOUT ) ); + } + else + { + // get the language from the first master page + // or set it to all master pages + sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( PK_NOTES ) : 1; + sal_uInt16 nPage; + for( nPage = 0; nPage < nPageCount; nPage++ ) + { + GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PK_STANDARD ) ); + } + } +} + +// ----------------------------------------------------------------------- + +void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet, SdPage* pPage ) +{ + if( pPage ) + { + SdrTextObj* pObj = (SdrTextObj*)pPage->GetPresObj( PRESOBJ_DATETIME ); + if( pObj ) + { + Outliner* pOutl = mpDoc->GetInternalOutliner(); + pOutl->Init( OUTLINERMODE_TEXTOBJECT ); + sal_uInt16 nOutlMode = pOutl->GetMode(); + + EditEngine* pEdit = const_cast< EditEngine* >(&pOutl->GetEditEngine()); + + OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); + if( pOPO ) + pOutl->SetText( *pOPO ); + + EFieldInfo aFieldInfo; + aFieldInfo.pFieldItem = NULL; + + sal_uInt16 nParaCount = pEdit->GetParagraphCount(); + sal_uInt16 nPara; + for( nPara = 0; (nPara < nParaCount) && (aFieldInfo.pFieldItem == NULL); nPara++ ) + { + sal_uInt16 nFieldCount = pEdit->GetFieldCount( nPara ); + sal_uInt16 nField; + for( nField = 0; (nField < nFieldCount) && (aFieldInfo.pFieldItem == NULL); nField++ ) + { + aFieldInfo = pEdit->GetFieldInfo( nPara, nField ); + if( aFieldInfo.pFieldItem ) + { + const SvxFieldData* pFieldData = aFieldInfo.pFieldItem->GetField(); + if( pFieldData && pFieldData->ISA( SvxDateTimeField ) ) + { + break; + } + } + aFieldInfo.pFieldItem = NULL; + } + } + + + if( aFieldInfo.pFieldItem != NULL ) + { + if( bSet ) + { + SfxItemSet aSet( pEdit->GetAttribs( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex, aFieldInfo.aPosition.nIndex+1, bSet ? GETATTRIBS_CHARATTRIBS : GETATTRIBS_ALL ) ); + + SvxLanguageItem aItem( rLanguage, EE_CHAR_LANGUAGE ); + aSet.Put( aItem ); + + SvxLanguageItem aItemCJK( rLanguage, EE_CHAR_LANGUAGE_CJK ); + aSet.Put( aItemCJK ); + + SvxLanguageItem aItemCTL( rLanguage, EE_CHAR_LANGUAGE_CTL ); + aSet.Put( aItemCTL ); + + ESelection aSel( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex, aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex+1 ); + pEdit->QuickSetAttribs( aSet, aSel ); + + pObj->SetOutlinerParaObject( pOutl->CreateParaObject() ); + pOutl->UpdateFields(); + } + else + { + rLanguage = pOutl->GetLanguage( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex ); + } + } + + pOutl->Clear(); + pOutl->Init( nOutlMode ); + } + } +} + +/////////////////////////////////////////////////////////////////////// + +PresLayoutPreview::PresLayoutPreview( ::Window* pParent, const ResId& rResId, SdPage* pMaster ) +:Control( pParent, rResId ), mpMaster( pMaster ), maPageSize( pMaster->GetSize() ) +{ +} + +// ----------------------------------------------------------------------- + +PresLayoutPreview::~PresLayoutPreview() +{ +} + +// ----------------------------------------------------------------------- + +void PresLayoutPreview::update( HeaderFooterSettings& rSettings ) +{ + maSettings = rSettings; + Invalidate(); +} + +// ----------------------------------------------------------------------- + +void PresLayoutPreview::Paint( OutputDevice& aOut, SdrTextObj* pObj, bool bVisible, bool bDotted /* = false*/ ) +{ + // get object transformation + basegfx::B2DHomMatrix aObjectTransform; + basegfx::B2DPolyPolygon aObjectPolyPolygon; + pObj->TRGetBaseGeometry(aObjectTransform, aObjectPolyPolygon); + + // build complete transformation by adding view transformation from + // logic page coordinates to local pixel coordinates + const double fScaleX((double)maOutRect.getWidth() / (double)maPageSize.Width()); + const double fScaleY((double)maOutRect.getHeight() / (double)maPageSize.Height()); + aObjectTransform.scale(fScaleX, fScaleY); + aObjectTransform.translate(maOutRect.TopLeft().X(), maOutRect.TopLeft().Y()); + + // create geometry using unit range and object transform + basegfx::B2DPolyPolygon aGeometry(basegfx::tools::createUnitPolygon()); + aGeometry.transform(aObjectTransform); + + // apply line pattern if wanted + if(bDotted) + { + ::std::vector<double> aPattern; + static double fFactor(1.0); + aPattern.push_back(3.0 * fFactor); + aPattern.push_back(1.0 * fFactor); + + basegfx::B2DPolyPolygon aDashed; + basegfx::tools::applyLineDashing(aGeometry, aPattern, &aDashed); + aGeometry = aDashed; + } + + // determine line color + svtools::ColorConfig aColorConfig; + svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( bVisible ? svtools::FONTCOLOR : svtools::OBJECTBOUNDARIES ) ); + + // paint at OutDev + aOut.SetLineColor(Color(aColor.nColor)); + aOut.SetFillColor(); + + for(sal_uInt32 a(0); a < aGeometry.count(); a++) + { + aOut.DrawPolyLine(aGeometry.getB2DPolygon(a)); + } +} + +// ----------------------------------------------------------------------- + +void PresLayoutPreview::Paint( const Rectangle& ) +{ + Push(); + + svtools::ColorConfig aColorConfig; + svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( svtools::APPBACKGROUND ) ); + + maOutRect = Rectangle( Point(0,0), GetOutputSize() ); + + // calculate page size with correct aspect ratio + int nWidth, nHeight; + if( maPageSize.Width() > maPageSize.Height() ) + { + nWidth = maOutRect.GetWidth(); + nHeight = long( (double)(nWidth * maPageSize.Height()) / (double)maPageSize.Width() ); + } + else + { + nHeight = maOutRect.GetHeight(); + nWidth = long( (double)(nHeight * maPageSize.Width()) / (double)maPageSize.Height() ); + } + + maOutRect.nLeft += (maOutRect.GetWidth() - nWidth) >> 1; + maOutRect.nRight = maOutRect.nLeft + nWidth - 1; + maOutRect.nTop += (maOutRect.GetHeight() - nHeight) >> 1; + maOutRect.nBottom = maOutRect.nTop + nHeight - 1; + + // draw decoration frame + DecorationView aDecoView( this ); + maOutRect = aDecoView.DrawFrame( maOutRect, FRAME_HIGHLIGHT_IN ); + + // draw page background + SetFillColor( Color(COL_WHITE) ); + DrawRect( maOutRect ); + + // paint presentation objects from masterpage + SdrTextObj* pMasterTitle = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_TITLE ); + SdrTextObj* pMasterOutline = (SdrTextObj*)mpMaster->GetPresObj( mpMaster->GetPageKind()==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE ); + SdrTextObj* pHeader = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_HEADER ); + SdrTextObj* pFooter = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_FOOTER ); + SdrTextObj* pDate = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_DATETIME ); + SdrTextObj* pNumber = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_SLIDENUMBER ); + + if( pMasterTitle ) + Paint( *this, pMasterTitle, true, true ); + if( pMasterOutline ) + Paint( *this, pMasterOutline, true, true ); + if( pHeader ) + Paint( *this, pHeader, maSettings.mbHeaderVisible ); + if( pFooter ) + Paint( *this, pFooter, maSettings.mbFooterVisible ); + if( pDate ) + Paint( *this, pDate, maSettings.mbDateTimeVisible ); + if( pNumber ) + Paint( *this, pNumber, maSettings.mbSlideNumberVisible ); + + Pop(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/headerfooterdlg.src b/sd/source/ui/dlg/headerfooterdlg.src new file mode 100644 index 000000000000..6dccc1cf2b6a --- /dev/null +++ b/sd/source/ui/dlg/headerfooterdlg.src @@ -0,0 +1,317 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <svtools/controldims.hrc> +#include "dialogs.hrc" +#include "headerfooterdlg.hrc" + +#define TAB_WIDTH 290 +#define TAB_HEIGHT 186 + +#define DLG_WIDTH TAB_WIDTH + 6 +#define DLG_HEIGHT TAB_HEIGHT + 6 + +TabDialog RID_SD_DLG_HEADERFOOTER +{ + OutputSize = TRUE; + SVLook = TRUE; + Size = MAP_APPFONT( DLG_WIDTH, DLG_HEIGHT ); + Text [ en-US ] = "Header and Footer"; + Moveable = TRUE; + Closeable = TRUE; + + TabControl 1 + { + OutputSize = TRUE; + Pos = MAP_APPFONT( 3 , 3 ); + Size = MAP_APPFONT( TAB_WIDTH , TAB_HEIGHT ); + PageList = + { + PageItem + { + Identifier = RID_SD_TABPAGE_HEADERFOOTER_SLIDE; + PageResID = RID_SD_TABPAGE_HEADERFOOTER; + Text [ en-US ] = "Slide"; + }; + + PageItem + { + Identifier = RID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT; + PageResID = RID_SD_TABPAGE_HEADERFOOTER; + Text [ en-US ] = "Notes and Handouts"; + }; + }; + }; +}; + +#define SPACE_Y 3 +#define SPACE_X 3 + +#define C1 (RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT) +#define C2 (RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + RSC_SP_CHK_TEXTINDENT) +#define C3 (RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 2 * RSC_SP_CHK_TEXTINDENT) +#define W1 (TAB_WIDTH - PUSHBUTTON_WIDTH - 10 * SPACE_X) +#define W2 (60) +#define W3 (W1 - C2 - W2 - SPACE_X) +#define W4 ((W1 - C3 - SPACE_X) / 2) + +#define C4 (C2 + W2 + SPACE_X) + +#define PUSHBUTTON_WIDTH 80 + +TabPage RID_SD_TABPAGE_HEADERFOOTER +{ +// HelpID = SID_ANIMATION_EFFECTS ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( TAB_WIDTH , TAB_HEIGHT ) ; + Hide = TRUE; + +#define Y0 (RSC_SP_TBPG_INNERBORDER_TOP ) + + FixedLine FL_INCLUDE_ON_PAGE + { + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT, Y0 ) ; + Size = MAP_APPFONT ( W1 - RSC_SP_TBPG_INNERBORDER_LEFT , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Include on slide"; + }; + +#define Y1 (Y0 + RSC_CD_FIXEDLINE_HEIGHT + SPACE_Y) + + CheckBox CB_HEADER + { + HelpID = "sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_HEADER"; + Pos = MAP_APPFONT ( C1, Y1 ); + Size = MAP_APPFONT ( W1 - C1, RSC_CD_CHECKBOX_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "Header"; + }; + + FixedText FT_HEADER + { + Pos = MAP_APPFONT ( C2, Y1 + SPACE_Y + RSC_CD_CHECKBOX_HEIGHT + 1 ); + Size = MAP_APPFONT ( W2, RSC_CD_FIXEDTEXT_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "Header text"; + }; + + Edit TB_HEADER_FIXED + { + HelpID = "sd:Edit:RID_SD_TABPAGE_HEADERFOOTER:TB_HEADER_FIXED"; + Pos = MAP_APPFONT ( C4, Y1 + SPACE_Y + RSC_CD_CHECKBOX_HEIGHT ); + Size = MAP_APPFONT ( W3, RSC_CD_TEXTBOX_HEIGHT ); + TabStop = TRUE ; + Border = TRUE ; + }; + +#define Y2 (Y1 + 2 * SPACE_Y + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT) + + FixedLine FL_DATETIME + { + Pos = MAP_APPFONT ( C1, Y2 ); + Size = MAP_APPFONT ( W1 - C1, RSC_CD_FIXEDLINE_HEIGHT ); + }; + + CheckBox CB_DATETIME + { + HelpID = "sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_DATETIME"; + Pos = MAP_APPFONT ( C1, Y2 + SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT ); + Size = MAP_APPFONT ( W1 - C1, RSC_CD_CHECKBOX_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "~Date and time"; + }; + + RadioButton RB_DATETIME_FIXED + { + HelpID = "sd:RadioButton:RID_SD_TABPAGE_HEADERFOOTER:RB_DATETIME_FIXED"; + Pos = MAP_APPFONT ( C2, Y2 + 2 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + 1 ); + Size = MAP_APPFONT ( W2, RSC_CD_RADIOBUTTON_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "Fi~xed"; + }; + + Edit TB_DATETIME_FIXED + { + HelpID = "sd:Edit:RID_SD_TABPAGE_HEADERFOOTER:TB_DATETIME_FIXED"; + Pos = MAP_APPFONT ( C4, Y2 + 2 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT ); + Size = MAP_APPFONT ( W3, RSC_CD_TEXTBOX_HEIGHT ); + TabStop = TRUE ; + Border = TRUE ; + }; + + RadioButton RB_DATETIME_AUTOMATIC + { + HelpID = "sd:RadioButton:RID_SD_TABPAGE_HEADERFOOTER:RB_DATETIME_AUTOMATIC"; + Pos = MAP_APPFONT ( C2, Y2 + 3 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT ); + Size = MAP_APPFONT ( 80, RSC_CD_RADIOBUTTON_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "~Variable"; + }; + + ListBox CB_DATETIME_FORMAT + { + HelpID = "sd:ListBox:RID_SD_TABPAGE_HEADERFOOTER:CB_DATETIME_FORMAT"; + Pos = MAP_APPFONT ( C3, Y2 + 4 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT + RSC_CD_RADIOBUTTON_HEIGHT ); + Size = MAP_APPFONT ( W4, 80 ); + TabStop = TRUE ; + DropDown = TRUE ; + }; + + FixedText FT_DATETIME_LANGUAGE + { + Pos = MAP_APPFONT ( C3 + W4 + SPACE_X, Y2 + 3 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT + 1 ); + Size = MAP_APPFONT ( W4, RSC_CD_FIXEDTEXT_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "~Language:"; + }; + + ListBox CB_DATETIME_LANGUAGE + { + HelpID = "sd:ListBox:RID_SD_TABPAGE_HEADERFOOTER:CB_DATETIME_LANGUAGE"; + Pos = MAP_APPFONT ( C3 + W4 + SPACE_X, Y2 + 4 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT + RSC_CD_RADIOBUTTON_HEIGHT ); + Size = MAP_APPFONT ( W4, 80 ); + TabStop = TRUE ; + DropDown = TRUE ; + }; + +#define Y3 (Y2 + 5 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT + RSC_CD_RADIOBUTTON_HEIGHT + RSC_CD_DROPDOWN_HEIGHT ) + + FixedLine FL_FOOTER + { + Pos = MAP_APPFONT ( C1, Y3 ); + Size = MAP_APPFONT ( W1 - C1, RSC_CD_FIXEDLINE_HEIGHT ); + }; + + CheckBox CB_FOOTER + { + HelpID = "sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_FOOTER"; + Pos = MAP_APPFONT ( C1, Y3 + SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT ); + Size = MAP_APPFONT ( W1 - C1, RSC_CD_CHECKBOX_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "Footer"; + }; + + FixedText FT_FOOTER + { + Pos = MAP_APPFONT ( C2, Y3 + 2 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + 1 ); + Size = MAP_APPFONT ( W2, RSC_CD_FIXEDTEXT_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "Footer text"; + }; + + Edit TB_FOOTER_FIXED + { + HelpID = "sd:Edit:RID_SD_TABPAGE_HEADERFOOTER:TB_FOOTER_FIXED"; + Pos = MAP_APPFONT ( C4, Y3 + 2 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT ); + Size = MAP_APPFONT ( W3, RSC_CD_TEXTBOX_HEIGHT ); + TabStop = TRUE ; + Border = TRUE ; + }; + +#define Y4 (Y3 + 3 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT + RSC_CD_TEXTBOX_HEIGHT ) + + FixedLine FL_SLIDENUMBER + { + Pos = MAP_APPFONT ( C1, Y4 ); + Size = MAP_APPFONT ( W1 - C1, RSC_CD_FIXEDLINE_HEIGHT ); + }; + + CheckBox CB_SLIDENUMBER + { + HelpID = "sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_SLIDENUMBER"; + Pos = MAP_APPFONT ( C1, Y4 + SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT ); + Size = MAP_APPFONT ( W1 - C1, RSC_CD_CHECKBOX_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "Slide number"; + }; + +#define Y5 (Y4 + 2 * SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_CD_CHECKBOX_HEIGHT ) + + FixedLine FL_NOTONTITLE + { + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT, Y5 ) ; + Size = MAP_APPFONT ( W1 - RSC_SP_TBPG_INNERBORDER_LEFT, RSC_CD_FIXEDLINE_HEIGHT ); + }; + + CheckBox CB_NOTONTITLE + { + HelpID = "sd:CheckBox:RID_SD_TABPAGE_HEADERFOOTER:CB_NOTONTITLE"; + Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT, Y5 + SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT ); + Size = MAP_APPFONT ( W1 - RSC_SP_TBPG_INNERBORDER_LEFT, RSC_CD_CHECKBOX_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "Do not show on first slide"; + }; + + PushButton BT_APPLYTOALL + { + HelpID = "sd:PushButton:RID_SD_TABPAGE_HEADERFOOTER:BT_APPLYTOALL"; + Pos = MAP_APPFONT ( TAB_WIDTH - 7 * SPACE_X - PUSHBUTTON_WIDTH, RSC_SP_TBPG_INNERBORDER_TOP ); + Size = MAP_APPFONT ( PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "Apply to All"; + }; + + PushButton BT_APPLY + { + HelpID = "sd:PushButton:RID_SD_TABPAGE_HEADERFOOTER:BT_APPLY"; + Pos = MAP_APPFONT ( TAB_WIDTH - 7 * SPACE_X - PUSHBUTTON_WIDTH, RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_PUSHBUTTON_HEIGHT + SPACE_Y ); + Size = MAP_APPFONT ( PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + TabStop = TRUE ; + Text [ en-US ] = "Apply"; + }; + + CancelButton BT_CANCEL + { + Pos = MAP_APPFONT ( TAB_WIDTH - 7 * SPACE_X - PUSHBUTTON_WIDTH, RSC_SP_TBPG_INNERBORDER_TOP + 2 * RSC_CD_PUSHBUTTON_HEIGHT + 2 * SPACE_Y ); + Size = MAP_APPFONT ( PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + TabStop = TRUE ; + }; + + HelpButton BT_HELP + { + Pos = MAP_APPFONT ( TAB_WIDTH - 7 * SPACE_X - PUSHBUTTON_WIDTH, RSC_SP_TBPG_INNERBORDER_TOP + 3* RSC_CD_PUSHBUTTON_HEIGHT + 3 * SPACE_Y ); + Size = MAP_APPFONT ( PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + TabStop = TRUE ; + }; + + Control CT_PREVIEW + { + Pos = MAP_APPFONT ( TAB_WIDTH - 7 * SPACE_X - PUSHBUTTON_WIDTH, TAB_HEIGHT - 6*SPACE_Y - PUSHBUTTON_WIDTH ); + Size = MAP_APPFONT ( PUSHBUTTON_WIDTH, PUSHBUTTON_WIDTH ); + }; + + String STR_PAGE_NUMBER + { + Text [ en-US ] = "Page number"; + }; + + String STR_INCLUDE_ON_PAGE + { + Text [ en-US ] = "Include on page"; + }; +}; + + diff --git a/sd/source/ui/dlg/ins_paste.cxx b/sd/source/ui/dlg/ins_paste.cxx new file mode 100644 index 000000000000..2fadfdaa826d --- /dev/null +++ b/sd/source/ui/dlg/ins_paste.cxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include "ins_paste.hrc" +#include "ins_paste.hxx" + +// -------------------- +// - SdInsertPasteDlg - +// -------------------- + +SdInsertPasteDlg::SdInsertPasteDlg( Window* pWindow ) : + ModalDialog( pWindow, SdResId( DLG_INSERT_PASTE ) ), + aFlPosition( this, SdResId( FL_POSITION ) ), + aRbBefore( this, SdResId( RB_BEFORE ) ), + aRbAfter( this, SdResId( RB_AFTER ) ), + aBtnOK( this, SdResId( BTN_OK ) ), + aBtnCancel( this, SdResId( BTN_CANCEL ) ), + aBtnHelp( this, SdResId( BTN_HELP ) ) +{ + FreeResource(); + aRbAfter.Check( sal_True ); +} + +// ----------------------------------------------------------------------------- + +SdInsertPasteDlg::~SdInsertPasteDlg() +{ +} + +// ----------------------------------------------------------------------------- + +sal_Bool SdInsertPasteDlg::IsInsertBefore() const +{ + return( aRbBefore.IsChecked() ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/ins_paste.src b/sd/source/ui/dlg/ins_paste.src new file mode 100644 index 000000000000..0668e26f1993 --- /dev/null +++ b/sd/source/ui/dlg/ins_paste.src @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "ins_paste.hrc" + +ModalDialog DLG_INSERT_PASTE +{ + HelpID = "sd:ModalDialog:DLG_INSERT_PASTE"; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 148 , 90 ) ; + Moveable = TRUE ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 92 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 92 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 92 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + + FixedLine FL_POSITION + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "Position"; + }; + RadioButton RB_BEFORE + { + HelpID = "sd:RadioButton:DLG_INSERT_PASTE:RB_BEFORE"; + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 80, 10 ) ; + Text [ en-US ] = "~Before" ; + TabStop = TRUE ; + }; + RadioButton RB_AFTER + { + HelpID = "sd:RadioButton:DLG_INSERT_PASTE:RB_AFTER"; + Pos = MAP_APPFONT ( 12, 27 ) ; + Size = MAP_APPFONT ( 80, 10 ) ; + Text [ en-US ] = "A~fter" ; + TabStop = TRUE ; + Check = TRUE ; + }; + Text [ en-US ] = "Insert Slides"; +}; + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/inspagob.cxx b/sd/source/ui/dlg/inspagob.cxx new file mode 100644 index 000000000000..0b38e670225e --- /dev/null +++ b/sd/source/ui/dlg/inspagob.cxx @@ -0,0 +1,186 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + + +#include "inspagob.hxx" + +#include "strings.hrc" +#include "res_bmp.hrc" +#include "sdresid.hxx" +#include "drawdoc.hxx" +#include "DrawDocShell.hxx" +#include "ViewShell.hxx" +#include "inspagob.hrc" + + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +SdInsertPagesObjsDlg::SdInsertPagesObjsDlg( + ::Window* pWindow, + const SdDrawDocument* pInDoc, + SfxMedium* pSfxMedium, + const String& rFileName ) + : ModalDialog ( pWindow, SdResId( DLG_INSERT_PAGES_OBJS ) ), + aLbTree ( this, SdResId( LB_TREE ) ), + aCbxLink ( this, SdResId( CBX_LINK ) ), + aCbxMasters ( this, SdResId( CBX_CHECK_MASTERS ) ), + aBtnOk ( this, SdResId( BTN_OK ) ), + aBtnCancel ( this, SdResId( BTN_CANCEL ) ), + aBtnHelp ( this, SdResId( BTN_HELP ) ), + pMedium ( pSfxMedium ), + mpDoc ( pInDoc ), + rName ( rFileName ) +{ + FreeResource(); + + aLbTree.SetViewFrame( ( (SdDrawDocument*) pInDoc )->GetDocSh()->GetViewShell()->GetViewFrame() ); + + aLbTree.SetSelectHdl( LINK( this, SdInsertPagesObjsDlg, SelectObjectHdl ) ); + + // Text wird eingefuegt + if( !pMedium ) + SetText( String( SdResId( STR_INSERT_TEXT ) ) ); + + Reset(); +} + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg() +{ +} + +/************************************************************************* +|* +|* Fuellt die TreeLB in Abhaengigkeit des Mediums. Ist kein Medium +|* vorhanden, handelt es sich um ein Text- und kein Drawdokument +|* +\************************************************************************/ + +void SdInsertPagesObjsDlg::Reset() +{ + if( pMedium ) + { + aLbTree.SetSelectionMode( MULTIPLE_SELECTION ); + + // transfer ownership of Medium + aLbTree.Fill( mpDoc, pMedium, rName ); + } + else + { + Color aColor( COL_WHITE ); + Bitmap aBmpText( SdResId( BMP_DOC_TEXT ) ); + Image aImgText( aBmpText, aColor ); + aLbTree.InsertEntry( rName, aImgText, aImgText ); + } + + aCbxMasters.Check( sal_True ); +} + +/************************************************************************* +|* +|* Liefert die Liste zurueck +|* nType == 0 -> Seiten +|* nType == 1 -> Objekte +|* +\************************************************************************/ + +List* SdInsertPagesObjsDlg::GetList( sal_uInt16 nType ) +{ + // Bei Draw-Dokumenten muss bei der Selektion des Dokumentes NULL + // zurueckgegeben werden + if( pMedium ) + { + // Um zu gewaehrleisten, dass die Bookmarks geoeffnet sind + // (Wenn gesamtes Dokument ausgewaehlt wurde) + aLbTree.GetBookmarkDoc(); + + // Wenn das Dokument (mit-)selektiert oder nichst selektiert ist, + // wird das gesamte Dokument (und nicht mehr!) eingefuegt. + if( aLbTree.GetSelectionCount() == 0 || + ( aLbTree.IsSelected( aLbTree.First() ) ) ) + return( NULL ); + } + return( aLbTree.GetSelectEntryList( nType ) ); +} + +/************************************************************************* +|* +|* Ist Verknuepfung gechecked +|* +\************************************************************************/ + +sal_Bool SdInsertPagesObjsDlg::IsLink() +{ + return( aCbxLink.IsChecked() ); +} + +/************************************************************************* +|* +|* Ist Verknuepfung gechecked +|* +\************************************************************************/ + +sal_Bool SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const +{ + return( aCbxMasters.IsChecked() ); +} + +/************************************************************************* +|* +|* Enabled und selektiert Endfarben-LB +|* +\************************************************************************/ + +IMPL_LINK( SdInsertPagesObjsDlg, SelectObjectHdl, void *, EMPTYARG ) +{ + if( aLbTree.IsLinkableSelected() ) + aCbxLink.Enable(); + else + aCbxLink.Disable(); + + return( 0 ); +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/inspagob.src b/sd/source/ui/dlg/inspagob.src new file mode 100644 index 000000000000..8f0444752114 --- /dev/null +++ b/sd/source/ui/dlg/inspagob.src @@ -0,0 +1,118 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "helpids.h" +#include "inspagob.hrc" + +ModalDialog DLG_INSERT_PAGES_OBJS +{ + HelpID = HID_DLG_INSERT_PAGES_OBJS ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 200 , 128 ) ; + Moveable = TRUE ; + Text [ en-US ] = "Insert Slides/Objects" ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 144 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 144 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 144 , 46 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + Control LB_TREE + { + HelpId = HID_SD_PAGEOBJSTLB; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 132 , 88 ) ; + TabStop = TRUE ; + }; + CheckBox CBX_LINK + { + HelpID = "sd:CheckBox:DLG_INSERT_PAGES_OBJS:CBX_LINK"; + Pos = MAP_APPFONT ( 6 , 100 ) ; + Size = MAP_APPFONT ( 140 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Link" ; + }; + CheckBox CBX_CHECK_MASTERS + { + HelpID = "sd:CheckBox:DLG_INSERT_PAGES_OBJS:CBX_CHECK_MASTERS"; + Pos = MAP_APPFONT ( 6 , 114 ) ; + Size = MAP_APPFONT ( 140 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Delete unused backg~rounds"; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/layeroptionsdlg.cxx b/sd/source/ui/dlg/layeroptionsdlg.cxx new file mode 100644 index 000000000000..8671ff3941da --- /dev/null +++ b/sd/source/ui/dlg/layeroptionsdlg.cxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif +#include <svl/itemset.hxx> + +#include "strings.hrc" +#include "sdattr.hxx" +#include "sdresid.hxx" +#include "layeroptionsdlg.hxx" +#include "layeroptionsdlg.hrc" + +SdInsertLayerDlg::SdInsertLayerDlg( Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, String aStr ) +: ModalDialog( pWindow, SdResId( DLG_INSERT_LAYER ) ) +, maFtName( this, SdResId( FT_NAME ) ) +, maEdtName( this, SdResId( EDT_NAME ) ) +, maFtTitle( this, SdResId( FT_TITLE ) ) +, maEdtTitle( this, SdResId( EDT_TITLE ) ) +, maFtDesc( this, SdResId( FT_DESCRIPTION ) ) +, maEdtDesc( this, SdResId( EDT_DESCRIPTION ) ) +, maCbxVisible( this, SdResId( CBX_VISIBLE ) ) +, maCbxPrintable( this, SdResId( CBX_PRINTABLE ) ) +, maCbxLocked( this, SdResId( CBX_LOCKED ) ) +, maFixedLine( this, SdResId( FL_SEPARATOR_B ) ) +, maBtnHelp( this, SdResId( BTN_HELP ) ) +, maBtnOK( this, SdResId( BTN_OK ) ) +, maBtnCancel( this, SdResId( BTN_CANCEL ) ) +, mrOutAttrs( rInAttrs ) +{ + FreeResource(); + + SetText( aStr ); + + maEdtName.SetText( ( ( const SdAttrLayerName& ) mrOutAttrs.Get( ATTR_LAYER_NAME ) ).GetValue() ); + maEdtTitle.SetText( ( ( const SdAttrLayerTitle& ) mrOutAttrs.Get( ATTR_LAYER_TITLE ) ).GetValue() ); + maEdtDesc.SetText( ( ( const SdAttrLayerDesc& ) mrOutAttrs.Get( ATTR_LAYER_DESC ) ).GetValue() ); + maCbxVisible.Check( ( ( const SdAttrLayerVisible& ) mrOutAttrs.Get( ATTR_LAYER_VISIBLE ) ).GetValue() ); + maCbxPrintable.Check( ( ( const SdAttrLayerPrintable& ) mrOutAttrs.Get( ATTR_LAYER_PRINTABLE ) ).GetValue() ); + maCbxLocked.Check( ( ( const SdAttrLayerLocked& ) mrOutAttrs.Get( ATTR_LAYER_LOCKED ) ).GetValue() ); + + if( !bDeletable ) + { + maFtName.Disable(); + maEdtName.Disable(); + } +} + +void SdInsertLayerDlg::GetAttr( SfxItemSet& rAttrs ) +{ + rAttrs.Put( SdAttrLayerName( maEdtName.GetText() ) ); + rAttrs.Put( SdAttrLayerTitle( maEdtTitle.GetText() ) ); + rAttrs.Put( SdAttrLayerDesc( maEdtDesc.GetText() ) ); + rAttrs.Put( SdAttrLayerVisible( maCbxVisible.IsChecked() ) ); + rAttrs.Put( SdAttrLayerPrintable( maCbxPrintable.IsChecked() ) ); + rAttrs.Put( SdAttrLayerLocked( maCbxLocked.IsChecked() ) ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/layeroptionsdlg.src b/sd/source/ui/dlg/layeroptionsdlg.src new file mode 100644 index 000000000000..ee6a4c6c19d1 --- /dev/null +++ b/sd/source/ui/dlg/layeroptionsdlg.src @@ -0,0 +1,190 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "app.hrc" +#include "layeroptionsdlg.hrc" +#include "helpids.h" + +ModalDialog DLG_INSERT_LAYER +{ + HelpID = CMD_SID_INSERTLAYER ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 200 , 172 ) ; + Text [ en-US ] = "Insert Layer" ; + Moveable = TRUE ; + + FixedText FT_NAME + { + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 188 , 8 ) ; + Text [ en-US ] = "~Name" ; + }; + + Edit EDT_NAME + { + HelpID = "sd:Edit:DLG_INSERT_LAYER:EDT_NAME"; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 17 ) ; + Size = MAP_APPFONT ( 188 , 12 ) ; + TabStop = TRUE ; + }; + + FixedText FT_TITLE + { + Pos = MAP_APPFONT ( 6 , 32 ) ; + Size = MAP_APPFONT ( 188 , 8 ) ; + Text [ en-US ] = "~Title" ; + }; + + Edit EDT_TITLE + { + HelpID = "sd:Edit:DLG_INSERT_LAYER:EDT_TITLE"; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 43 ) ; + Size = MAP_APPFONT ( 188 , 12 ) ; + TabStop = TRUE ; + }; + + FixedText FT_DESCRIPTION + { + Pos = MAP_APPFONT ( 6 , 58 ) ; + Size = MAP_APPFONT ( 188 , 8 ) ; + Text [ en-US ] = "~Description" ; + }; + + MultiLineEdit EDT_DESCRIPTION + { + HelpID = "sd:MultiLineEdit:DLG_INSERT_LAYER:EDT_DESCRIPTION"; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 69 ) ; + Size = MAP_APPFONT ( 188 , 34 ) ; + TabStop = TRUE ; + IgnoreTab = TRUE; + VScroll = TRUE; + }; + + CheckBox CBX_VISIBLE + { + HelpID = "sd:CheckBox:DLG_INSERT_LAYER:CBX_VISIBLE"; + Pos = MAP_APPFONT ( 6 , 106 ) ; + Size = MAP_APPFONT ( 188 , 10 ) ; + Text [ en-US ] = "~Visible" ; + TabStop = TRUE ; + }; + + CheckBox CBX_PRINTABLE + { + HelpID = "sd:CheckBox:DLG_INSERT_LAYER:CBX_PRINTABLE"; + Pos = MAP_APPFONT ( 6 , 119 ) ; + Size = MAP_APPFONT ( 188 , 10 ) ; + Text [ en-US ] = "~Printable" ; + TabStop = TRUE ; + }; + + CheckBox CBX_LOCKED + { + HelpID = "sd:CheckBox:DLG_INSERT_LAYER:CBX_LOCKED"; + Pos = MAP_APPFONT ( 6 , 132 ) ; + Size = MAP_APPFONT ( 188 , 10 ) ; + Text [ en-US ] = "~Locked" ; + TabStop = TRUE ; + }; + + // divider + FixedLine FL_SEPARATOR_B + { + Pos = MAP_APPFONT ( 0 , 144 ) ; + Size = MAP_APPFONT ( 200 , 4 ) ; + }; + + // Buttons + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 6, 152 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 200 - (50 + 50 + 9), 152) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 200 - (50 + 6), 152) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/makefile.mk b/sd/source/ui/dlg/makefile.mk new file mode 100755 index 000000000000..13492daa3726 --- /dev/null +++ b/sd/source/ui/dlg/makefile.mk @@ -0,0 +1,196 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# 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. +# +# 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). +# +# 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. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PROJECTPCH=sd +PROJECTPCHSOURCE=$(PRJ)$/util$/sd +PRJNAME=sd +TARGET=dlg +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SRS1NAME=$(TARGET) +SRC1FILES =\ + masterlayoutdlg.src\ + headerfooterdlg.src\ + ins_paste.src\ + inspagob.src\ + present.src\ + dlg_char.src\ + paragr.src\ + tabtempl.src\ + dlgpage.src\ + tpaction.src\ + animobjs.src\ + prltempl.src\ + prntopts.src\ + dlgsnap.src\ + copydlg.src\ + tpoption.src\ + dlgass.src\ + navigatr.src\ + sdpreslt.src\ + morphdlg.src\ + dlgfield.src\ + custsdlg.src\ + brkdlg.src\ + vectdlg.src\ + dlgolbul.src \ + LayerDialog.src \ + PaneDockingWindow.src \ + layeroptionsdlg.src + +SLOFILES = \ + $(SLO)$/masterlayoutdlg.obj \ + $(SLO)$/headerfooterdlg.obj \ + $(SLO)$/inspagob.obj \ + $(SLO)$/ins_paste.obj \ + $(SLO)$/present.obj \ + $(SLO)$/dlgctrls.obj \ + $(SLO)$/dlgchar.obj \ + $(SLO)$/paragr.obj \ + $(SLO)$/tabtempl.obj \ + $(SLO)$/dlgpage.obj \ + $(SLO)$/diactrl.obj \ + $(SLO)$/gluectrl.obj \ + $(SLO)$/sdtreelb.obj \ + $(SLO)$/animobjs.obj \ + $(SLO)$/prltempl.obj \ + $(SLO)$/prntopts.obj \ + $(SLO)$/dlgsnap.obj \ + $(SLO)$/copydlg.obj \ + $(SLO)$/dlgolbul.obj \ + $(SLO)$/tpaction.obj \ + $(SLO)$/tpoption.obj \ + $(SLO)$/filedlg.obj \ + $(SLO)$/unchss.obj \ + $(SLO)$/dlgassim.obj \ + $(SLO)$/dlgass.obj \ + $(SLO)$/assclass.obj \ + $(SLO)$/navigatr.obj \ + $(SLO)$/sdpreslt.obj \ + $(SLO)$/morphdlg.obj \ + $(SLO)$/dlgfield.obj \ + $(SLO)$/custsdlg.obj \ + $(SLO)$/brkdlg.obj \ + $(SLO)$/vectdlg.obj \ + $(SLO)$/docprev.obj \ + $(SLO)$/SpellDialogChildWindow.obj \ + $(SLO)$/AnimationChildWindow.obj \ + $(SLO)$/LayerDialogChildWindow.obj \ + $(SLO)$/LayerDialogContent.obj \ + $(SLO)$/LayerTabBar.obj \ + $(SLO)$/NavigatorChildWindow.obj \ + $(SLO)$/TemplateScanner.obj \ + $(SLO)$/sduiexp.obj \ + $(SLO)$/sddlgfact.obj \ + $(SLO)$/sdabstdlg.obj \ + $(SLO)$/PaneChildWindows.obj \ + $(SLO)$/PaneDockingWindow.obj \ + $(SLO)$/PaneShells.obj + +LIB1TARGET= $(SLB)$/$(TARGET).lib + +LIB1OBJFILES= \ + $(SLO)$/dlgctrls.obj \ + $(SLO)$/diactrl.obj \ + $(SLO)$/gluectrl.obj \ + $(SLO)$/sdtreelb.obj \ + $(SLO)$/animobjs.obj \ + $(SLO)$/filedlg.obj \ + $(SLO)$/unchss.obj \ + $(SLO)$/assclass.obj \ + $(SLO)$/navigatr.obj \ + $(SLO)$/docprev.obj \ + $(SLO)$/ins_paste.obj \ + $(SLO)$/AnimationChildWindow.obj \ + $(SLO)$/LayerDialogChildWindow.obj \ + $(SLO)$/LayerDialogContent.obj \ + $(SLO)$/LayerTabBar.obj \ + $(SLO)$/NavigatorChildWindow.obj \ + $(SLO)$/SpellDialogChildWindow.obj \ + $(SLO)$/TemplateScanner.obj \ + $(SLO)$/sdabstdlg.obj \ + $(SLO)$/PaneChildWindows.obj \ + $(SLO)$/PaneDockingWindow.obj \ + $(SLO)$/PaneShells.obj \ + $(SLO)$/layeroptionsdlg.obj + + +LIB2TARGET= $(SLB)$/sdui.lib + +LIB2OBJFILES= \ + $(SLO)$/masterlayoutdlg.obj\ + $(SLO)$/headerfooterdlg.obj\ + $(SLO)$/sduiexp.obj \ + $(SLO)$/sddlgfact.obj \ + $(SLO)$/brkdlg.obj \ + $(SLO)$/copydlg.obj \ + $(SLO)$/custsdlg.obj \ + $(SLO)$/dlgchar.obj \ + $(SLO)$/dlgass.obj \ + $(SLO)$/dlgassim.obj \ + $(SLO)$/dlgfield.obj \ + $(SLO)$/dlgpage.obj \ + $(SLO)$/dlgsnap.obj \ + $(SLO)$/ins_paste.obj \ + $(SLO)$/inspagob.obj \ + $(SLO)$/morphdlg.obj \ + $(SLO)$/dlgolbul.obj \ + $(SLO)$/paragr.obj \ + $(SLO)$/present.obj \ + $(SLO)$/prltempl.obj \ + $(SLO)$/sdpreslt.obj \ + $(SLO)$/tabtempl.obj \ + $(SLO)$/tpaction.obj \ + $(SLO)$/tpoption.obj \ + $(SLO)$/vectdlg.obj \ + $(SLO)$/prntopts.obj \ + $(SLO)$/layeroptionsdlg.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + +$(INCCOM)$/sduilib.hxx: makefile.mk +.IF "$(GUI)"=="UNX" + $(RM) $@ + echo \#define DLL_NAME \"libsdui$(DLLPOSTFIX)$(DLLPOST)\" >$@ +.ELSE + echo $(EMQ)#define DLL_NAME $(EMQ)"sdui$(DLLPOSTFIX)$(DLLPOST)$(EMQ)" >$@ +.ENDIF + +$(SLO)$/sdabstdlg.obj : $(INCCOM)$/sduilib.hxx + diff --git a/sd/source/ui/dlg/masterlayoutdlg.cxx b/sd/source/ui/dlg/masterlayoutdlg.cxx new file mode 100644 index 000000000000..4b7ee911957a --- /dev/null +++ b/sd/source/ui/dlg/masterlayoutdlg.cxx @@ -0,0 +1,178 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include <svx/dialogs.hrc> + +#include "sdresid.hxx" + +#include "strings.hrc" +#include "dialogs.hrc" +#include "masterlayoutdlg.hxx" +#include "masterlayoutdlg.hrc" +#include "drawdoc.hxx" + +using namespace ::sd; + +MasterLayoutDialog::MasterLayoutDialog( Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage ) +: ModalDialog( pParent, SdResId( RID_SD_DLG_MASTER_LAYOUT ) ), + mpDoc( pDoc ), + mpCurrentPage( pCurrentPage ), + maFLPlaceholders( this, SdResId( FL_PLACEHOLDERS ) ), + maCBDate( this, SdResId( CB_DATE ) ), + maCBPageNumber( this, SdResId( CB_PAGE_NUMBER ) ), + maCBHeader( this, SdResId( CB_HEADER ) ), + maCBFooter( this, SdResId( CB_FOOTER ) ), + maPBOK( this, SdResId( BT_OK ) ), + maPBCancel( this, SdResId( BT_CANCEL ) ) +{ + if( mpCurrentPage && !mpCurrentPage->IsMasterPage() ) + { + mpCurrentPage = (SdPage*)(&(mpCurrentPage->TRG_GetMasterPage())); + } + + if( mpCurrentPage == 0 ) + { + mpCurrentPage = pDoc->GetMasterSdPage( 0, PK_STANDARD ); + OSL_FAIL( "MasterLayoutDialog::MasterLayoutDialog() - no current page?" ); + } + + switch( mpCurrentPage->GetPageKind() ) + { + case PK_STANDARD: + { + // aTitle = String( SdResId( STR_MASTER_LAYOUT_TITLE ) ); + maCBHeader.Enable( sal_False ); + String aSlideNumberStr( SdResId( STR_SLIDE_NUMBER ) ); + maCBPageNumber.SetText( aSlideNumberStr ); + break; + } + case PK_NOTES: + // aTitle = String( SdResId( STR_NOTES_MASTER_LAYOUT_TITLE ) ); + break; + case PK_HANDOUT: + // aTitle = String( SdResId( STR_HANDOUT_TEMPLATE_LAYOUT_TITLE ) ); + break; + } + String aTitle (SdResId( STR_MASTER_LAYOUT_TITLE ) ); + + SetText( aTitle ); + + FreeResource(); + + mbOldHeader = mpCurrentPage->GetPresObj( PRESOBJ_HEADER ) != NULL; + mbOldDate = mpCurrentPage->GetPresObj( PRESOBJ_DATETIME ) != NULL; + mbOldFooter = mpCurrentPage->GetPresObj( PRESOBJ_FOOTER ) != NULL; + mbOldPageNumber = mpCurrentPage->GetPresObj( PRESOBJ_SLIDENUMBER ) != NULL; + + maCBHeader.Check( mbOldHeader ); + maCBDate.Check( mbOldDate ); + maCBFooter.Check( mbOldFooter ); + maCBPageNumber.Check( mbOldPageNumber ); +} + +MasterLayoutDialog::~MasterLayoutDialog() +{ +} + +short MasterLayoutDialog::Execute() +{ + if ( ModalDialog::Execute() ) + applyChanges(); + return 1; +} + +void MasterLayoutDialog::applyChanges() +{ + mpDoc->BegUndo(GetText()); + + if( (mpCurrentPage->GetPageKind() != PK_STANDARD) && (mbOldHeader != maCBHeader.IsChecked() ) ) + { + if( mbOldHeader ) + remove( PRESOBJ_HEADER ); + else + create( PRESOBJ_HEADER ); + } + + if( mbOldFooter != maCBFooter.IsChecked() ) + { + if( mbOldFooter ) + remove( PRESOBJ_FOOTER ); + else + create( PRESOBJ_FOOTER ); + } + + if( mbOldDate != maCBDate.IsChecked() ) + { + if( mbOldDate ) + remove( PRESOBJ_DATETIME ); + else + create( PRESOBJ_DATETIME ); + } + + if( mbOldPageNumber != maCBPageNumber.IsChecked() ) + { + if( mbOldPageNumber ) + remove( PRESOBJ_SLIDENUMBER ); + else + create( PRESOBJ_SLIDENUMBER ); + } + + mpDoc->EndUndo(); +} + +void MasterLayoutDialog::create( PresObjKind eKind ) +{ + mpCurrentPage->CreateDefaultPresObj( eKind, true ); +} + +void MasterLayoutDialog::remove( PresObjKind eKind ) +{ + SdrObject* pObject = mpCurrentPage->GetPresObj( eKind ); + + if( pObject ) + { + const bool bUndo = mpDoc->IsUndoEnabled(); + if( bUndo ) + mpDoc->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pObject)); + SdrObjList* pOL =pObject->GetObjList(); + sal_uInt32 nOrdNum=pObject->GetOrdNumDirect(); + pOL->RemoveObject(nOrdNum); + + if( !bUndo ) + SdrObject::Free(pObject); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/masterlayoutdlg.src b/sd/source/ui/dlg/masterlayoutdlg.src new file mode 100644 index 000000000000..71cf192b5fd4 --- /dev/null +++ b/sd/source/ui/dlg/masterlayoutdlg.src @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <dialogs.hrc> +#include <masterlayoutdlg.hrc> +#include <strings.hrc> + +ModalDialog RID_SD_DLG_MASTER_LAYOUT +{ + HelpID = "sd:ModalDialog:RID_SD_DLG_MASTER_LAYOUT"; + Size = MAP_APPFONT( 89 , 92 ); + OutputSize = TRUE; + SVLook = TRUE; + Moveable = TRUE; + CloseAble = TRUE; + FixedLine FL_PLACEHOLDERS + { + Pos = MAP_APPFONT( 3, 3 ); + Size = MAP_APPFONT( 83, 10 ); + + Text [ en-US ] = "Placeholders"; + }; + + CheckBox CB_HEADER + { + HelpID = "sd:CheckBox:RID_SD_DLG_MASTER_LAYOUT:CB_HEADER"; + Pos = MAP_APPFONT( 6, 16 ); + Size = MAP_APPFONT( 134 , 10 ); + TabStop = TRUE; + + Text [ en-US ] = "Header"; + }; + + CheckBox CB_DATE + { + HelpID = "sd:CheckBox:RID_SD_DLG_MASTER_LAYOUT:CB_DATE"; + Pos = MAP_APPFONT( 6, 29 ); + Size = MAP_APPFONT( 134 , 10 ); + TabStop = TRUE; + + Text [ en-US ] = "Date/time"; + }; + + CheckBox CB_FOOTER + { + HelpID = "sd:CheckBox:RID_SD_DLG_MASTER_LAYOUT:CB_FOOTER"; + Pos = MAP_APPFONT( 6, 42 ); + Size = MAP_APPFONT( 134 , 10 ); + TabStop = TRUE; + + Text [ en-US ] = "Footer"; + }; + + CheckBox CB_PAGE_NUMBER + { + HelpID = "sd:CheckBox:RID_SD_DLG_MASTER_LAYOUT:CB_PAGE_NUMBER"; + Pos = MAP_APPFONT( 6, 55 ); + Size = MAP_APPFONT( 134 , 10 ); + TabStop = TRUE; + + Text [ en-US ] = "Page number"; + }; + + OKButton BT_OK + { + Pos = MAP_APPFONT( 3, 71 ); + Size = MAP_APPFONT( 40 , 14 ); + TabStop = TRUE; + }; + + CancelButton BT_CANCEL + { + Pos = MAP_APPFONT( 46, 71 ); + Size = MAP_APPFONT( 40 , 14 ); + TabStop = TRUE; + }; + + String STR_SLIDE_NUMBER + { + Text [ en-US ] = "Slide number"; + }; + + String STR_MASTER_LAYOUT_TITLE + { + Text [ en-US ] = "Master Elements"; + }; +}; + + + + diff --git a/sd/source/ui/dlg/morphdlg.cxx b/sd/source/ui/dlg/morphdlg.cxx new file mode 100644 index 000000000000..bf618ce7671a --- /dev/null +++ b/sd/source/ui/dlg/morphdlg.cxx @@ -0,0 +1,141 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include "morphdlg.hxx" + +#include "strings.hrc" +#include "sdresid.hxx" +#include "sdmod.hxx" +#include "sdiocmpt.hxx" +#include "morphdlg.hrc" +#include <tools/config.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xlineit0.hxx> +#include <svx/xenum.hxx> +#include <svx/svdobj.hxx> +#include <svl/itemset.hxx> +#include <svl/itempool.hxx> + +namespace sd { + +#define FADE_STEP "FadeSteps" +#define FADE_ATTRIB "FadeAttributes" +#define FADE_ORIENT "FadeOrientation" +#define FADE_TRUE "true" +#define FADE_FALSE "false" + +MorphDlg::MorphDlg( ::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2 ) : + ModalDialog ( pParent, SdResId( DLG_MORPH ) ), + aGrpPreset ( this, SdResId( GRP_PRESET ) ), + aFtSteps ( this, SdResId( FT_STEPS ) ), + aMtfSteps ( this, SdResId( MTF_STEPS ) ), + aCbxAttributes ( this, SdResId( CBX_ATTRIBUTES ) ), + aCbxOrientation ( this, SdResId( CBX_ORIENTATION ) ), + aBtnOK ( this, SdResId( BTN_OK ) ), + aBtnCancel ( this, SdResId( BTN_CANCEL ) ), + aBtnHelp ( this, SdResId( BTN_HELP ) ) +{ + FreeResource(); + LoadSettings(); + + SfxItemPool* pPool = (SfxItemPool*) pObj1->GetObjectItemPool(); + SfxItemSet aSet1( *pPool ); + SfxItemSet aSet2( *pPool ); + + aSet1.Put(pObj1->GetMergedItemSet()); + aSet2.Put(pObj2->GetMergedItemSet()); + + const XLineStyle eLineStyle1 = ( (const XLineStyleItem&) aSet1.Get( XATTR_LINESTYLE ) ).GetValue(); + const XLineStyle eLineStyle2 = ( (const XLineStyleItem&) aSet2.Get( XATTR_LINESTYLE ) ).GetValue(); + const XFillStyle eFillStyle1 = ( (const XFillStyleItem&) aSet1.Get( XATTR_FILLSTYLE ) ).GetValue(); + const XFillStyle eFillStyle2 = ( (const XFillStyleItem&) aSet2.Get( XATTR_FILLSTYLE ) ).GetValue(); + + if ( ( ( eLineStyle1 == XLINE_NONE ) || ( eLineStyle2 == XLINE_NONE ) ) && + ( ( eFillStyle1 != XFILL_SOLID ) || ( eFillStyle2 != XFILL_SOLID ) ) ) + { + aCbxAttributes.Disable(); + } +} + +MorphDlg::~MorphDlg() +{ +} + +void MorphDlg::LoadSettings() +{ + SvStorageStreamRef xIStm( SD_MOD()->GetOptionStream( UniString::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM( SD_OPTION_MORPHING ) ), + SD_OPTION_LOAD ) ); + sal_uInt16 nSteps; + sal_Bool bOrient, bAttrib; + + if( xIStm.Is() ) + { + SdIOCompat aCompat( *xIStm, STREAM_READ ); + + *xIStm >> nSteps >> bOrient >> bAttrib; + } + else + { + nSteps = 16; + bOrient = bAttrib = sal_True; + } + + aMtfSteps.SetValue( nSteps ); + aCbxOrientation.Check( bOrient ); + aCbxAttributes.Check( bAttrib ); +} + +// ----------------------------------------------------------------------------- + +void MorphDlg::SaveSettings() const +{ + SvStorageStreamRef xOStm( SD_MOD()->GetOptionStream( UniString::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM( SD_OPTION_MORPHING ) ), + SD_OPTION_STORE ) ); + + if( xOStm.Is() ) + { + SdIOCompat aCompat( *xOStm, STREAM_WRITE, 1 ); + + *xOStm << (sal_uInt16) aMtfSteps.GetValue() + << aCbxOrientation.IsChecked() + << aCbxAttributes.IsChecked(); + } +} + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/morphdlg.src b/sd/source/ui/dlg/morphdlg.src new file mode 100644 index 000000000000..24ccb096199c --- /dev/null +++ b/sd/source/ui/dlg/morphdlg.src @@ -0,0 +1,141 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "app.hrc" +#include "morphdlg.hrc" +#include "helpids.h" + +/****************************************************************************** +|* +|* +|* +\******************************************************************************/ +ModalDialog DLG_MORPH +{ + HelpID = CMD_SID_POLYGON_MORPHING ; + HelpID = ".uno:Morphing" ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 196 , 68 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 141 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 141 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 140 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + FixedLine GRP_PRESET + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 129 , 8 ) ; + Text [ en-US ] = "Settings" ; + }; + FixedText FT_STEPS + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "Increments" ; + }; + MetricField MTF_STEPS + { + HelpID = "sd:MetricField:DLG_MORPH:MTF_STEPS"; + Border = TRUE ; + Pos = MAP_APPFONT ( 56 , 14 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + Minimum = 1 ; + Maximum = 256 ; + First = 1 ; + Last = 256 ; + }; + CheckBox CBX_ATTRIBUTES + { + HelpID = "sd:CheckBox:DLG_MORPH:CBX_ATTRIBUTES"; + Pos = MAP_APPFONT ( 12 , 29 ) ; + Size = MAP_APPFONT ( 121 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Cross-fade attributes" ; + }; + CheckBox CBX_ORIENTATION + { + HelpID = "sd:CheckBox:DLG_MORPH:CBX_ORIENTATION"; + Pos = MAP_APPFONT ( 12 , 44 ) ; + Size = MAP_APPFONT ( 121 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Same orientation" ; + }; + Text [ en-US ] = "Cross-fading" ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx new file mode 100644 index 000000000000..98cee39db011 --- /dev/null +++ b/sd/source/ui/dlg/navigatr.cxx @@ -0,0 +1,1008 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + + +#include <tools/urlobj.hxx> +#include <unotools/localfilehelper.hxx> +#include <sfx2/imgmgr.hxx> +#include <sfx2/fcontnr.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/docfile.hxx> +#include <svl/intitem.hxx> +#include <sfx2/dispatch.hxx> +#include <svx/svxids.hrc> +#include <vcl/menu.hxx> + +#include <sfx2/viewfrm.hxx> +#include <sfx2/dockwin.hxx> +#include <sfx2/sfxresid.hxx> + +#include "pres.hxx" +#include "navigatr.hxx" +#include "navigatr.hrc" +#include "pgjump.hxx" +#include "app.hrc" +#include "strings.hrc" +#include "res_bmp.hrc" +#include "drawdoc.hxx" +#include "DrawDocShell.hxx" +#include "sdresid.hxx" +#include "ViewShell.hxx" +#include "ViewShellBase.hxx" +#include "DrawViewShell.hxx" +#include "slideshow.hxx" +#include "FrameView.hxx" +#include "helpids.h" + +namespace { +static const sal_uInt16 nShowNamedShapesFilter=1; +static const sal_uInt16 nShowAllShapesFilter=2; +} + +/************************************************************************* +|* SdNavigatorWin - FloatingWindow +\************************************************************************/ + +SdNavigatorWin::SdNavigatorWin( + ::Window* pParent, + ::sd::NavigatorChildWindow* pChWinCtxt, + const SdResId& rSdResId, + SfxBindings* pInBindings ) +: ::Window( pParent, rSdResId ) +, maToolbox ( this, SdResId( 1 ) ) +, maTlbObjects( this, SdResId( TLB_OBJECTS ) ) +, maLbDocs ( this, SdResId( LB_DOCS ) ) +, mpChildWinContext( pChWinCtxt ) +, mbDocImported ( sal_False ) + // Bei Aenderung des DragTypes: SelectionMode der TLB anpassen! +, meDragType ( NAVIGATOR_DRAGTYPE_EMBEDDED ) +, mpBindings ( pInBindings ) +, maImageList ( SdResId( IL_NAVIGATR ) ) +{ + maTlbObjects.SetViewFrame( mpBindings->GetDispatcher()->GetFrame() ); + + FreeResource(); + + maTlbObjects.SetAccessibleName(String(SdResId(STR_OBJECTS_TREE))); + + mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings ); + mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings ); + mpDocList = new List(); + + ApplyImageList(); // load images *before* calculating sizes to get something useful !!! + + Size aTbxSize( maToolbox.CalcWindowSizePixel() ); + maToolbox.SetOutputSizePixel( aTbxSize ); + maToolbox.SetSelectHdl( LINK( this, SdNavigatorWin, SelectToolboxHdl ) ); + maToolbox.SetClickHdl( LINK( this, SdNavigatorWin, ClickToolboxHdl ) ); + maToolbox.SetDropdownClickHdl( LINK(this, SdNavigatorWin, DropdownClickToolBoxHdl) ); + maToolbox.SetItemBits( TBI_DRAGTYPE, maToolbox.GetItemBits( TBI_DRAGTYPE ) | TIB_DROPDOWNONLY ); + + // Shape filter drop down menu. + maToolbox.SetItemBits(TBI_SHAPE_FILTER, + maToolbox.GetItemBits(TBI_SHAPE_FILTER) | TIB_DROPDOWNONLY); + + // TreeListBox + // set position below toolbox + long nListboxYPos = maToolbox.GetPosPixel().Y() + maToolbox.GetSizePixel().Height() + 4; + maTlbObjects.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); + maTlbObjects.SetDoubleClickHdl( LINK( this, SdNavigatorWin, ClickObjectHdl ) ); + maTlbObjects.SetSelectionMode( SINGLE_SELECTION ); + // set focus to listbox, otherwise it is in the toolbox which is only useful + // for keyboard navigation + maTlbObjects.GrabFocus(); + + // DragTypeListBox + maLbDocs.SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) ); + // set position below treelistbox + nListboxYPos = maTlbObjects.GetPosPixel().Y() + maTlbObjects.GetSizePixel().Height() + 4; + maLbDocs.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); + + // set min outputsize after all sizes are known + long nFullHeight = nListboxYPos + maLbDocs.GetSizePixel().Height() + 4; + maSize = GetOutputSizePixel(); + if( maSize.Height() < nFullHeight ) + { + maSize.Height() = nFullHeight; + SetOutputSizePixel( maSize ); + } + maMinSize = maSize; + long nMinWidth = 2*maToolbox.GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox + if( nMinWidth > maMinSize.Width() ) + maMinSize.Width() = nMinWidth; + maMinSize.Height() -= 40; + ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel( maMinSize ); + + // InitTlb; Wird ueber Slot initiiert + SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True ); + mpBindings->GetDispatcher()->Execute( + SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); + +} + +// ----------------------------------------------------------------------- + +SdNavigatorWin::~SdNavigatorWin() +{ + delete mpNavigatorCtrlItem; + delete mpPageNameCtrlItem; + + // Liste der DocInfos loeschen + long nCount = mpDocList->Count(); + while( nCount-- ) + delete (NavDocInfo*) mpDocList->Remove( (sal_uLong)0 ); + + delete mpDocList; +} + +// ----------------------------------------------------------------------- + +void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc ) +{ + SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can... + ::sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh(); + String aDocShName( pDocShell->GetName() ); + ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); + + // Restore the 'ShowAllShapes' flag from the last time (in this session) + // that the navigator was shown. + if (pViewShell != NULL) + { + ::sd::FrameView* pFrameView = pViewShell->GetFrameView(); + if (pFrameView != NULL) + maTlbObjects.SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), false); + } + + // Disable the shape filter drop down menu when there is a running slide + // show. + if (pViewShell!=NULL && sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() )) + maToolbox.EnableItem(TBI_SHAPE_FILTER, sal_False); + else + maToolbox.EnableItem(TBI_SHAPE_FILTER); + + if( !maTlbObjects.IsEqualToDoc( pDoc ) ) + { + String aDocName = pDocShell->GetMedium()->GetName(); + maTlbObjects.Clear(); + maTlbObjects.Fill( pDoc, (sal_Bool) sal_False, aDocName ); // Nur normale Seiten + + RefreshDocumentLB(); + maLbDocs.SelectEntry( aDocShName ); + } + else + { + maLbDocs.SetNoSelection(); + maLbDocs.SelectEntry( aDocShName ); + +// auskommentiert um 30246 zu fixen +// if( maLbDocs.GetSelectEntryCount() == 0 ) + { + RefreshDocumentLB(); + maLbDocs.SelectEntry( aDocShName ); + } + } + + SfxViewFrame* pViewFrame = ( ( pViewShell && pViewShell->GetViewFrame() ) ? pViewShell->GetViewFrame() : SfxViewFrame::Current() ); + if( pViewFrame ) + pViewFrame->GetBindings().Invalidate(SID_NAVIGATOR_PAGENAME, sal_True, sal_True); +} + +/************************************************************************* +|* +|* DragType wird in Abhaengigkeit davon gesetzt, ob ein Drag ueberhaupt +|* moeglich ist. Graphiken duerfen beispielsweise unter gewissen Umstaenden +|* nicht gedragt werden (#31038#). +|* +\************************************************************************/ + +NavigatorDragType SdNavigatorWin::GetNavigatorDragType() +{ + NavigatorDragType eDT = meDragType; + NavDocInfo* pInfo = GetDocInfo(); + + if( ( eDT == NAVIGATOR_DRAGTYPE_LINK ) && ( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() ) ) + eDT = NAVIGATOR_DRAGTYPE_NONE; + + return( eDT ); +} + +// ----------------------------------------------------------------------- + + +IMPL_LINK( SdNavigatorWin, SelectToolboxHdl, void *, EMPTYARG ) +{ + sal_uInt16 nId = maToolbox.GetCurItemId(); + sal_uInt16 nSId = 0; + PageJump ePage = PAGE_NONE; + + switch( nId ) + { + case TBI_PEN: + { + if( nId == TBI_PEN ) + { + nSId = SID_NAVIGATOR_PEN; + } + + if( nSId > 0 ) + { + SfxBoolItem aItem( nSId, sal_True ); + mpBindings->GetDispatcher()->Execute( + nSId, SFX_CALLMODE_SLOT |SFX_CALLMODE_RECORD, &aItem, 0L ); + } + } + break; + + case TBI_FIRST: + case TBI_PREVIOUS: + case TBI_NEXT: + case TBI_LAST: + { + if( nId == TBI_FIRST ) + ePage = PAGE_FIRST; + else if( nId == TBI_PREVIOUS ) + ePage = PAGE_PREVIOUS; + else if( nId == TBI_NEXT ) + ePage = PAGE_NEXT; + else if( nId == TBI_LAST ) + ePage = PAGE_LAST; + + if( ePage != PAGE_NONE ) + { + SfxUInt16Item aItem( SID_NAVIGATOR_PAGE, (sal_uInt16)ePage ); + mpBindings->GetDispatcher()->Execute( + SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L ); + } + } + break; + } + return 0; +} + +// ----------------------------------------------------------------------- + + +IMPL_LINK( SdNavigatorWin, ClickToolboxHdl, ToolBox*, EMPTYARG ) +{ + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox ) +{ + sal_uInt16 nId = maToolbox.GetCurItemId(); + + switch( nId ) + { + case TBI_DRAGTYPE: + { + // Popup-Menu wird in Abhaengigkeit davon erzeugt, ob Dokument + // gespeichert ist oder nicht + PopupMenu *pMenu = new PopupMenu; + + static const char* aHIDs[] = + { + HID_SD_NAVIGATOR_MENU1, + HID_SD_NAVIGATOR_MENU2, + HID_SD_NAVIGATOR_MENU3, + 0 + }; + + for( sal_uInt16 nID = NAVIGATOR_DRAGTYPE_URL; + nID < NAVIGATOR_DRAGTYPE_COUNT; + nID++ ) + { + sal_uInt16 nRId = GetDragTypeSdResId( (NavigatorDragType)nID ); + if( nRId > 0 ) + { + DBG_ASSERT(aHIDs[nID-NAVIGATOR_DRAGTYPE_URL],"HelpId not added!"); + pMenu->InsertItem( nID, String( SdResId( nRId ) ) ); + pMenu->SetHelpId( nID, aHIDs[nID - NAVIGATOR_DRAGTYPE_URL] ); + } + + } + NavDocInfo* pInfo = GetDocInfo(); + + if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() ) + { + pMenu->EnableItem( NAVIGATOR_DRAGTYPE_LINK, sal_False ); + pMenu->EnableItem( NAVIGATOR_DRAGTYPE_URL, sal_False ); + meDragType = NAVIGATOR_DRAGTYPE_EMBEDDED; + } + + pMenu->CheckItem( (sal_uInt16)meDragType ); + pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, MenuSelectHdl ) ); + + pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN ); + pBox->EndSelection(); + delete pMenu; + } + break; + + case TBI_SHAPE_FILTER: + { + PopupMenu *pMenu = new PopupMenu; + + pMenu->InsertItem( + nShowNamedShapesFilter, + String(SdResId(STR_NAVIGATOR_SHOW_NAMED_SHAPES))); + pMenu->InsertItem( + nShowAllShapesFilter, + String(SdResId(STR_NAVIGATOR_SHOW_ALL_SHAPES))); + + if (maTlbObjects.GetShowAllShapes()) + pMenu->CheckItem(nShowAllShapesFilter); + else + pMenu->CheckItem(nShowNamedShapesFilter); + pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, ShapeFilterCallback ) ); + + pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN ); + pBox->EndSelection(); + delete pMenu; + } + break; + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SdNavigatorWin, ClickObjectHdl, void *, EMPTYARG ) +{ + if( !mbDocImported || maLbDocs.GetSelectEntryPos() != 0 ) + { + NavDocInfo* pInfo = GetDocInfo(); + + // Nur wenn es sich um das aktive Fenster handelt, wird + // auf die Seite gesprungen + if( pInfo && pInfo->IsActive() ) + { + String aStr( maTlbObjects.GetSelectEntry() ); + + if( aStr.Len() > 0 ) + { + SfxStringItem aItem( SID_NAVIGATOR_OBJECT, aStr ); + mpBindings->GetDispatcher()->Execute( + SID_NAVIGATOR_OBJECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L ); + + // moved here from SetGetFocusHdl. Reset the + // focus only if something has been selected in the + // document. + SfxViewShell* pCurSh = SfxViewShell::Current(); + + if ( pCurSh ) + { + Window* pShellWnd = pCurSh->GetWindow(); + if ( pShellWnd ) + pShellWnd->GrabFocus(); + } + } + } + } + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SdNavigatorWin, SelectDocumentHdl, void *, EMPTYARG ) +{ + String aStrLb = maLbDocs.GetSelectEntry(); + long nPos = maLbDocs.GetSelectEntryPos(); + sal_Bool bFound = sal_False; + ::sd::DrawDocShell* pDocShell = NULL; + NavDocInfo* pInfo = GetDocInfo(); + + // Handelt es sich um ein gedragtes Objekt? + if( mbDocImported && nPos == 0 ) + { + // Dokument in TLB aufbauen + InsertFile( aStrLb ); + } + else if (pInfo) + { + pDocShell = pInfo->mpDocShell; + + bFound = sal_True; + } + + if( bFound ) + { + SdDrawDocument* pDoc = pDocShell->GetDoc(); + if( !maTlbObjects.IsEqualToDoc( pDoc ) ) + { + SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can... + ::sd::DrawDocShell* pNCDocShell = pNonConstDoc->GetDocSh(); + String aDocName = pNCDocShell->GetMedium()->GetName(); + maTlbObjects.Clear(); + maTlbObjects.Fill( pDoc, (sal_Bool) sal_False, aDocName ); // Nur normale Seiten + } + } + + // Pruefen, ob Link oder URL moeglich ist + if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() || ( meDragType != NAVIGATOR_DRAGTYPE_EMBEDDED ) ) + { + meDragType = NAVIGATOR_DRAGTYPE_EMBEDDED; + SetDragImage(); + } + + return( 0L ); +} + +/************************************************************************* +|* +|* DrageType wird gesetzt und Image wird entspr. gesetzt. +|* Sollte Handler mit NULL gerufen werden, so wird der Default (URL) gesetzt. +|* +\************************************************************************/ + +IMPL_LINK( SdNavigatorWin, MenuSelectHdl, Menu *, pMenu ) +{ + sal_uInt16 nMenuId; + if( pMenu ) + nMenuId = pMenu->GetCurItemId(); + else + nMenuId = NAVIGATOR_DRAGTYPE_URL; + + if( nMenuId != USHRT_MAX ) // Notwendig ? + { + NavigatorDragType eDT = (NavigatorDragType) nMenuId; + if( meDragType != eDT ) + { + meDragType = eDT; + SetDragImage(); + + if( meDragType == NAVIGATOR_DRAGTYPE_URL ) + { + // Fix, um Endlosschleife zu unterbinden + if( maTlbObjects.GetSelectionCount() > 1 ) + maTlbObjects.SelectAll( sal_False ); + + maTlbObjects.SetSelectionMode( SINGLE_SELECTION ); + } + else + maTlbObjects.SetSelectionMode( MULTIPLE_SELECTION ); + } + } + return( 0 ); +} + + + + +IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, Menu *, pMenu ) +{ + if (pMenu != NULL) + { + bool bShowAllShapes (maTlbObjects.GetShowAllShapes()); + sal_uInt16 nMenuId (pMenu->GetCurItemId()); + switch (nMenuId) + { + case nShowNamedShapesFilter: + bShowAllShapes = false; + break; + + case nShowAllShapesFilter: + bShowAllShapes = true; + break; + + default: + OSL_FAIL( + "SdNavigatorWin::ShapeFilterCallback called for unknown menu entry"); + break; + } + + maTlbObjects.SetShowAllShapes(bShowAllShapes, true); + + // Remember the selection in the FrameView. + NavDocInfo* pInfo = GetDocInfo(); + if (pInfo != NULL) + { + ::sd::DrawDocShell* pDocShell = pInfo->mpDocShell; + if (pDocShell != NULL) + { + ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); + if (pViewShell != NULL) + { + ::sd::FrameView* pFrameView = pViewShell->GetFrameView(); + if (pFrameView != NULL) + { + pFrameView->SetIsNavigatorShowingAllShapes(bShowAllShapes); + } + } + } + } + } + + return 0; +} + +// ----------------------------------------------------------------------- + +void SdNavigatorWin::Resize() +{ + Size aWinSize( GetOutputSizePixel() ); + if( aWinSize.Height() >= maMinSize.Height() ) + //aWinSize.Width() >= maMinSize.Width() ) + { + Size aDiffSize; + aDiffSize.Width() = aWinSize.Width() - maSize.Width(); + aDiffSize.Height() = aWinSize.Height() - maSize.Height(); + + // Umgroessern der Toolbox + Size aObjSize( maToolbox.GetOutputSizePixel() ); + aObjSize.Width() += aDiffSize.Width(); + maToolbox.SetOutputSizePixel( aObjSize ); + + // Umgroessern der TreeLB + aObjSize = maTlbObjects.Control::GetOutputSizePixel(); + aObjSize.Width() += aDiffSize.Width(); + aObjSize.Height() += aDiffSize.Height(); + maTlbObjects.SetOutputSizePixel( aObjSize ); + + Point aPt( 0, aDiffSize.Height() ); + + // Verschieben der anderen Controls (DocumentLB) + maLbDocs.Hide(); + aObjSize = maLbDocs.GetOutputSizePixel(); + aObjSize.Width() += aDiffSize.Width(); + maLbDocs.SetPosPixel( maLbDocs.GetPosPixel() + aPt ); + maLbDocs.SetOutputSizePixel( aObjSize ); + maLbDocs.Show(); + + maSize = aWinSize; + } + Window::Resize(); +} + +// ----------------------------------------------------------------------- + +sal_Bool SdNavigatorWin::InsertFile(const String& rFileName) +{ + INetURLObject aURL( rFileName ); + sal_Bool bReturn = sal_True; + + if( aURL.GetProtocol() == INET_PROT_NOT_VALID ) + { + String aURLStr; + ::utl::LocalFileHelper::ConvertPhysicalNameToURL( rFileName, aURLStr ); + aURL = INetURLObject( aURLStr ); + } + + // get adjusted FileName + String aFileName( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); + + if (!aFileName.Len()) + { + /********************************************************************** + * Wieder aktuelles Dokument anzeigen + **********************************************************************/ + maDropFileName = aFileName; + } + else + { + /********************************************************************** + * Hineingedraggtes Dokument anzeigen + **********************************************************************/ + const SfxFilter* pFilter = NULL; + ErrCode nErr = 0; + + if (aFileName != maDropFileName) + { + SfxMedium aMed(aFileName, (STREAM_READ | STREAM_SHARE_DENYNONE), sal_False); + SfxFilterMatcher aMatch( String::CreateFromAscii("simpress") ); + aMed.UseInteractionHandler( sal_True ); + nErr = aMatch.GuessFilter(aMed, &pFilter); + } + + if ((pFilter && !nErr) || aFileName == maDropFileName) + { + // Das Medium muss ggf. mit READ/WRITE geoeffnet werden, daher wird + // ersteinmal nachgeschaut, ob es einen Storage enthaelt + SfxMedium* pMedium = new SfxMedium( aFileName, + STREAM_READ | STREAM_NOCREATE, + sal_True); // Download + + if (pMedium->IsStorage()) + { + // Jetzt modusabhaengig: + // maTlbObjects.SetSelectionMode(MULTIPLE_SELECTION); + // Eigentuemeruebergabe von pMedium; + SdDrawDocument* pDropDoc = maTlbObjects.GetBookmarkDoc(pMedium); + + if (pDropDoc) + { + maTlbObjects.Clear(); + maDropFileName = aFileName; + + if( !maTlbObjects.IsEqualToDoc( pDropDoc ) ) + { + // Nur normale Seiten + maTlbObjects.Fill(pDropDoc, (sal_Bool) sal_False, maDropFileName); + RefreshDocumentLB( &maDropFileName ); + } + } + } + else + { + bReturn = sal_False; + delete pMedium; + } + } + else + { + bReturn = sal_False; + } + } + + return (bReturn); +} + +// ----------------------------------------------------------------------- + +void SdNavigatorWin::RefreshDocumentLB( const String* pDocName ) +{ + sal_uInt16 nPos = 0; + + if( pDocName ) + { + if( mbDocImported ) + maLbDocs.RemoveEntry( 0 ); + + maLbDocs.InsertEntry( *pDocName, 0 ); + mbDocImported = sal_True; + } + else + { + nPos = maLbDocs.GetSelectEntryPos(); + if( nPos == LISTBOX_ENTRY_NOTFOUND ) + nPos = 0; + + String aStr; + if( mbDocImported ) + aStr = maLbDocs.GetEntry( 0 ); + + maLbDocs.Clear(); + + // Liste der DocInfos loeschen + long nCount = mpDocList->Count(); + while( nCount-- ) + delete (NavDocInfo*) mpDocList->Remove( (sal_uLong)0 ); + + if( mbDocImported ) + maLbDocs.InsertEntry( aStr, 0 ); + + ::sd::DrawDocShell* pCurrentDocShell = + PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); + SfxObjectShell* pSfxDocShell = SfxObjectShell::GetFirst(0, sal_False); + while( pSfxDocShell ) + { + ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, pSfxDocShell ); + if( pDocShell && !pDocShell->IsInDestruction() && ( pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) ) + { + NavDocInfo* pInfo = new NavDocInfo(); + pInfo->mpDocShell = pDocShell; + + aStr = pDocShell->GetMedium()->GetName(); + if( aStr.Len() ) + pInfo->SetName(); + else + pInfo->SetName( sal_False ); + // z.Z. wird wieder der Name der Shell genommen (also ohne Pfad) + // da Koose es als Fehler ansieht, wenn er Pfad in URL-Notation + // angezeigt wird! + aStr = pDocShell->GetName(); + + maLbDocs.InsertEntry( aStr, LISTBOX_APPEND ); + + if( pDocShell == pCurrentDocShell ) + pInfo->SetActive(); + else + pInfo->SetActive( sal_False ); + + mpDocList->Insert( pInfo, LIST_APPEND ); + } + pSfxDocShell = SfxObjectShell::GetNext( *pSfxDocShell, 0 , sal_False ); + } + } + maLbDocs.SelectEntryPos( nPos ); +} + +//------------------------------------------------------------------------ + +sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage ) +{ + switch( eDT ) + { + case NAVIGATOR_DRAGTYPE_NONE: + return( bImage ? 0 : STR_NONE ); + case NAVIGATOR_DRAGTYPE_URL: + return( bImage ? TBI_HYPERLINK : STR_DRAGTYPE_URL ); + case NAVIGATOR_DRAGTYPE_EMBEDDED: + return( bImage ? TBI_EMBEDDED : STR_DRAGTYPE_EMBEDDED ); + case NAVIGATOR_DRAGTYPE_LINK: + return( bImage ? TBI_LINK : STR_DRAGTYPE_LINK ); + default: OSL_FAIL( "Keine Resource fuer DragType vorhanden!" ); + } + return( 0 ); +} + +//------------------------------------------------------------------------ + +NavDocInfo* SdNavigatorWin::GetDocInfo() +{ + long nPos = maLbDocs.GetSelectEntryPos(); + + if( mbDocImported ) + { + if( nPos == 0 ) + { + return( NULL ); + } + nPos--; + } + + NavDocInfo* pInfo = (NavDocInfo*)mpDocList->GetObject( nPos ); + + return( pInfo ); +} + +/************************************************************************* +|* +|* PreNotify +|* +\************************************************************************/ + +long SdNavigatorWin::Notify(NotifyEvent& rNEvt) +{ + const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); + long nOK = sal_False; + + if( pKEvt ) + { + if( KEY_ESCAPE == pKEvt->GetKeyCode().GetCode() ) + { + if( SdPageObjsTLB::IsInDrag() ) + { + // during drag'n'drop we just stop the drag but do not close the navigator + nOK = sal_True; + } + else + { + ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase( mpBindings->GetDispatcher()->GetFrame()); + if( pBase ) + { + sd::SlideShow::Stop( *pBase ); + // Stopping the slide show may result in a synchronous + // deletion of the navigator window. Calling the + // parents Notify after this is unsafe. Therefore we + // return now. + return sal_True; + } + } + } + } + + if( !nOK ) + nOK = Window::Notify( rNEvt ); + + return( nOK ); +} + + +/************************************************************************* +|* +|* KeyInput: ESCAPE abfangen, um Show zu beenden +|* +\************************************************************************/ + +void SdNavigatorWin::KeyInput( const KeyEvent& rKEvt ) +{ + long nOK = sal_False; + + if (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE) + { + if( SdPageObjsTLB::IsInDrag() ) + { + // during drag'n'drop we just stop the drag but do not close the navigator + nOK = sal_True; + } + else + { + ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase( mpBindings->GetDispatcher()->GetFrame()); + if(pBase) + { + ::sd::SlideShow::Stop( *pBase ); + } + } + } + + if (!nOK) + { + Window::KeyInput(rKEvt); + } +} + +void SdNavigatorWin::DataChanged( const DataChangedEvent& rDCEvt ) +{ + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + ApplyImageList(); + + Window::DataChanged( rDCEvt ); +} + +void SdNavigatorWin::SetDragImage() +{ + maToolbox.SetItemImage( TBI_DRAGTYPE, maToolbox.GetImageList().GetImage( GetDragTypeSdResId( meDragType, sal_True ) ) ); +} + +void SdNavigatorWin::ApplyImageList() +{ + + maToolbox.SetImageList( maImageList ); + maToolbox.SetItemImage( TBI_SHAPE_FILTER, BitmapEx( SdResId( BMP_GRAPHIC ) ) ); + + SetDragImage(); +} + + + +/************************************************************************* +|* +|* ControllerItem fuer Navigator +|* +\************************************************************************/ + +SdNavigatorControllerItem::SdNavigatorControllerItem( sal_uInt16 _nId, + SdNavigatorWin* pNavWin, + SfxBindings* _pBindings) : + SfxControllerItem( _nId, *_pBindings ), + pNavigatorWin( pNavWin ) +{ +} + +// ----------------------------------------------------------------------- + +void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId, + SfxItemState eState, const SfxPoolItem* pItem ) +{ + if( eState >= SFX_ITEM_AVAILABLE && nSId == SID_NAVIGATOR_STATE ) + { + const SfxUInt32Item* pStateItem = PTR_CAST( SfxUInt32Item, pItem ); + DBG_ASSERT( pStateItem, "SfxUInt16Item erwartet"); + sal_uInt32 nState = pStateItem->GetValue(); + + // Stift + if( nState & NAVBTN_PEN_ENABLED && + !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) ) + pNavigatorWin->maToolbox.EnableItem( TBI_PEN ); + if( nState & NAVBTN_PEN_DISABLED && + pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) ) + pNavigatorWin->maToolbox.EnableItem( TBI_PEN, sal_False ); + if( nState & NAVBTN_PEN_CHECKED && + !pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) ) + pNavigatorWin->maToolbox.CheckItem( TBI_PEN ); + if( nState & NAVBTN_PEN_UNCHECKED && + pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) ) + pNavigatorWin->maToolbox.CheckItem( TBI_PEN, sal_False ); + + // Nur wenn Doc in LB das Aktive ist + NavDocInfo* pInfo = pNavigatorWin->GetDocInfo(); + if( pInfo && pInfo->IsActive() ) + { + // First + if( nState & NAVBTN_FIRST_ENABLED && + !pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) ) + pNavigatorWin->maToolbox.EnableItem( TBI_FIRST ); + if( nState & NAVBTN_FIRST_DISABLED && + pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) ) + pNavigatorWin->maToolbox.EnableItem( TBI_FIRST, sal_False ); + + // Prev + if( nState & NAVBTN_PREV_ENABLED && + !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) ) + pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS ); + if( nState & NAVBTN_PREV_DISABLED && + pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) ) + pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS, sal_False ); + + // Last + if( nState & NAVBTN_LAST_ENABLED && + !pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) ) + pNavigatorWin->maToolbox.EnableItem( TBI_LAST ); + if( nState & NAVBTN_LAST_DISABLED && + pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) ) + pNavigatorWin->maToolbox.EnableItem( TBI_LAST, sal_False ); + + // Next + if( nState & NAVBTN_NEXT_ENABLED && + !pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) ) + pNavigatorWin->maToolbox.EnableItem( TBI_NEXT ); + if( nState & NAVBTN_NEXT_DISABLED && + pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) ) + pNavigatorWin->maToolbox.EnableItem( TBI_NEXT, sal_False ); + + if( nState & NAVTLB_UPDATE ) + { + // InitTlb; Wird ueber Slot initiiert + SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True ); + GetBindings().GetDispatcher()->Execute( + SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); + } + } + } +} + +/************************************************************************* +|* +|* ControllerItem fuer Navigator, um die Seite in der TreeLB anzuzeigen +|* +\************************************************************************/ + +SdPageNameControllerItem::SdPageNameControllerItem( sal_uInt16 _nId, + SdNavigatorWin* pNavWin, + SfxBindings* _pBindings) : + SfxControllerItem( _nId, *_pBindings ), + pNavigatorWin( pNavWin ) +{ +} + +// ----------------------------------------------------------------------- + +void SdPageNameControllerItem::StateChanged( sal_uInt16 nSId, + SfxItemState eState, const SfxPoolItem* pItem ) +{ + if( eState >= SFX_ITEM_AVAILABLE && nSId == SID_NAVIGATOR_PAGENAME ) + { + // Nur wenn Doc in LB das Aktive ist + NavDocInfo* pInfo = pNavigatorWin->GetDocInfo(); + if( pInfo && pInfo->IsActive() ) + { + const SfxStringItem* pStateItem = PTR_CAST( SfxStringItem, pItem ); + DBG_ASSERT( pStateItem, "SfxStringItem erwartet"); + String aPageName = pStateItem->GetValue(); + + if( !pNavigatorWin->maTlbObjects.HasSelectedChilds( aPageName ) ) + { + if( pNavigatorWin->maTlbObjects.GetSelectionMode() == MULTIPLE_SELECTION ) + { + // Weil sonst immer dazuselektiert wird + pNavigatorWin->maTlbObjects.SelectAll( sal_False ); + } + pNavigatorWin->maTlbObjects.SelectEntry( aPageName ); + } + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/navigatr.src b/sd/source/ui/dlg/navigatr.src new file mode 100644 index 000000000000..c7df880018ce --- /dev/null +++ b/sd/source/ui/dlg/navigatr.src @@ -0,0 +1,156 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "navigatr.hrc" +#include "helpids.h" +#include "res_bmp.hrc" +#define BUTTON_WIDTH 13 +#define BUTTON_COUNT 7 +#define BUTTON_SIZE MAP_APPFONT( BUTTON_WIDTH, BUTTON_WIDTH ); +Window FLT_NAVIGATOR +{ + HelpId = HID_SD_NAVIGATOR ; + Size = MAP_APPFONT ( 12 + BUTTON_WIDTH * BUTTON_COUNT , 105 ) ; + Text = "Navigator" ; + SVLook = TRUE ; + DialogControl = TRUE; + Control TLB_OBJECTS + { + HelpId = HID_SD_NAVIGATOR_TLB ; + Border = TRUE ; + Pos = MAP_APPFONT ( 3 , 20 ) ; + Size = MAP_APPFONT ( 6 + BUTTON_WIDTH * BUTTON_COUNT , 67 ) ; + TabStop = TRUE ; + }; + ToolBox 1 + { + HelpId = HID_SD_NAVIGATOR_TBX ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 6 + BUTTON_WIDTH , 15 ) ; + TabStop = TRUE ; + ItemList = + { + ToolBoxItem + { + AutoCheck = TRUE ; + Identifier = TBI_PEN ; + HelpId = HID_SD_NAVIGATOR_TBI_PEN ; + Text [ en-US ] = "Pointer" ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = TBI_FIRST ; + HelpId = HID_SD_NAVIGATOR_TBI_FIRST ; + //Symbol = IMAGEBUTTON_FIRST ; + Text [ en-US ] = "First Slide" ; + }; + ToolBoxItem + { + Identifier = TBI_PREVIOUS ; + HelpId = HID_SD_NAVIGATOR_TBI_PREV ; + //Symbol = IMAGEBUTTON_PREV ; + Text [ en-US ] = "Previous Slide" ; + }; + ToolBoxItem + { + Identifier = TBI_NEXT ; + HelpId = HID_SD_NAVIGATOR_TBI_NEXT ; + //Symbol = IMAGEBUTTON_NEXT ; + Text [ en-US ] = "Next Slide" ; + }; + ToolBoxItem + { + Identifier = TBI_LAST ; + HelpId = HID_SD_NAVIGATOR_TBI_LAST ; + //Symbol = IMAGEBUTTON_LAST ; + Text [ en-US ] = "Last Slide" ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = TBI_DRAGTYPE ; + HelpId = HID_SD_NAVIGATOR_TBI_DRAGTYPE ; + DropDown = TRUE ; + //Left = FALSE; + Text [ en-US ] = "Drag Mode" ; + }; + ToolBoxItem + { + Identifier = TBI_SHAPE_FILTER ; + HelpId = HID_SD_NAVIGATOR_TBI_SHAPE_FILTER ; + DropDown = TRUE ; + Text [ en-US ] = "Show Shapes" ; + }; + }; + }; + ListBox LB_DOCS + { + HelpId = HID_SD_NAVIGATOR_LB ; + Border = TRUE ; + Pos = MAP_APPFONT ( 3 , 89 ) ; + Size = MAP_APPFONT ( 6 + BUTTON_WIDTH * BUTTON_COUNT , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + QuickHelpText [ en-US ] = "Documents" ; + }; + + #define NAVIGATR_IDLIST \ + IdList = \ + { \ + TBI_PEN ; \ + TBI_FIRST ; \ + TBI_PREVIOUS ; \ + TBI_NEXT ; \ + TBI_LAST ; \ + TBI_EMBEDDED ; \ + TBI_LINK ; \ + TBI_HYPERLINK ; \ + }; \ + IdCount = { 8 ; }; + + #define IMAGE_STDBTN_COLOR Color { Red = 0xff00; Green = 0x0000; Blue = 0xff00; } + + ImageList IL_NAVIGATR + { + Prefix = "nv"; + MaskColor = IMAGE_STDBTN_COLOR ; + NAVIGATR_IDLIST + }; +}; + +String STR_OBJECTS_TREE +{ + Text [ en-US ] = "Page Tree"; +}; diff --git a/sd/source/ui/dlg/paragr.cxx b/sd/source/ui/dlg/paragr.cxx new file mode 100644 index 000000000000..36751843fb0f --- /dev/null +++ b/sd/source/ui/dlg/paragr.cxx @@ -0,0 +1,209 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include <vcl/field.hxx> + +#include <svl/cjkoptions.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> + +#include <editeng/editdata.hxx> +#include <svx/dialogs.hrc> +#include <editeng/eeitem.hxx> +#include <svx/flagsdef.hxx> + +#include "eetext.hxx" +#include "paragr.hxx" +#include "sdresid.hxx" +#include "glob.hrc" +#include "sdattr.hrc" + +class SdParagraphNumTabPage : public SfxTabPage +{ +public: + SdParagraphNumTabPage(Window* pParent, const SfxItemSet& rSet ); + ~SdParagraphNumTabPage(); + + static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); + static sal_uInt16* GetRanges(); + + virtual sal_Bool FillItemSet( SfxItemSet& rSet ); + virtual void Reset( const SfxItemSet& rSet ); + +private: + TriStateBox maNewStartCB; + TriStateBox maNewStartNumberCB; + NumericField maNewStartNF; + bool mbModified; + + DECL_LINK( ImplNewStartHdl, CheckBox* ); +}; + +SdParagraphNumTabPage::SdParagraphNumTabPage(Window* pParent, const SfxItemSet& rAttr ) +: SfxTabPage(pParent, SdResId(RID_TABPAGE_PARA_NUMBERING), rAttr) +, maNewStartCB( this, SdResId( CB_NEW_START ) ) +, maNewStartNumberCB( this, SdResId( CB_NUMBER_NEW_START ) ) +, maNewStartNF( this, SdResId( NF_NEW_START ) ) +, mbModified(false) +{ + FreeResource(); + + maNewStartCB.SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl)); + maNewStartNumberCB.SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl)); +} + +SdParagraphNumTabPage::~SdParagraphNumTabPage() +{ +} + +SfxTabPage* SdParagraphNumTabPage::Create(Window *pParent, const SfxItemSet & rAttrSet) +{ + return new SdParagraphNumTabPage( pParent, rAttrSet ); +} + +sal_uInt16* SdParagraphNumTabPage::GetRanges() +{ + static sal_uInt16 aRange[] = + { + ATTR_PARANUMBERING_START, ATTR_PARANUMBERING_END, + 0 + }; + + return aRange; +} + +sal_Bool SdParagraphNumTabPage::FillItemSet( SfxItemSet& rSet ) +{ + if(maNewStartCB.GetState() != maNewStartCB.GetSavedValue() || + maNewStartNumberCB.GetState() != maNewStartNumberCB.GetSavedValue()|| + maNewStartNF.GetText() != maNewStartNF.GetSavedValue()) + { + mbModified = true; + sal_Bool bNewStartChecked = STATE_CHECK == maNewStartCB.GetState(); + sal_Bool bNumberNewStartChecked = STATE_CHECK == maNewStartNumberCB.GetState(); + rSet.Put(SfxBoolItem(ATTR_NUMBER_NEWSTART, bNewStartChecked)); + + const sal_Int16 nStartAt = (sal_Int16)maNewStartNF.GetValue(); + rSet.Put(SfxInt16Item(ATTR_NUMBER_NEWSTART_AT, bNumberNewStartChecked && bNewStartChecked ? nStartAt : -1)); + } + + return mbModified; +} + +void SdParagraphNumTabPage::Reset( const SfxItemSet& rSet ) +{ + SfxItemState eItemState = rSet.GetItemState( ATTR_NUMBER_NEWSTART ); + if(eItemState > SFX_ITEM_AVAILABLE ) + { + const SfxBoolItem& rStart = (const SfxBoolItem&)rSet.Get(ATTR_NUMBER_NEWSTART); + maNewStartCB.SetState( rStart.GetValue() ? STATE_CHECK : STATE_NOCHECK ); + maNewStartCB.EnableTriState(sal_False); + } + else + { + maNewStartCB.SetState(STATE_DONTKNOW); + maNewStartCB.Disable(); + } + maNewStartCB.SaveValue(); + + eItemState = rSet.GetItemState( ATTR_NUMBER_NEWSTART_AT); + if( eItemState > SFX_ITEM_AVAILABLE ) + { + sal_Int16 nNewStart = ((const SfxInt16Item&)rSet.Get(ATTR_NUMBER_NEWSTART_AT)).GetValue(); + maNewStartNumberCB.Check(-1 != nNewStart); + if(-1 == nNewStart) + nNewStart = 1; + + maNewStartNF.SetValue(nNewStart); + maNewStartNumberCB.EnableTriState(sal_False); + } + else + { + maNewStartCB.SetState(STATE_DONTKNOW); + } + ImplNewStartHdl(&maNewStartCB); + maNewStartNF.SaveValue(); + maNewStartNumberCB.SaveValue(); + mbModified = sal_False; +} + +IMPL_LINK( SdParagraphNumTabPage, ImplNewStartHdl, CheckBox*, EMPTYARG ) +{ + sal_Bool bEnable = maNewStartCB.IsChecked(); + maNewStartNumberCB.Enable(bEnable); + maNewStartNF.Enable(bEnable && maNewStartNumberCB.IsChecked()); + return 0; +} + +SdParagraphDlg::SdParagraphDlg( Window* pParent, const SfxItemSet* pAttr ) +: SfxTabDialog( pParent, SdResId( TAB_PARAGRAPH ), pAttr ) +, rOutAttrs( *pAttr ) +{ + FreeResource(); + + AddTabPage( RID_SVXPAGE_STD_PARAGRAPH ); + + SvtCJKOptions aCJKOptions; + if( aCJKOptions.IsAsianTypographyEnabled() ) + AddTabPage( RID_SVXPAGE_PARA_ASIAN); + else + RemoveTabPage( RID_SVXPAGE_PARA_ASIAN ); + + AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH ); + + static const sal_Bool bShowParaNumbering = ( getenv( "SD_SHOW_NUMBERING_PAGE" ) != NULL ); + if( bShowParaNumbering ) + AddTabPage( RID_TABPAGE_PARA_NUMBERING, SdParagraphNumTabPage::Create, SdParagraphNumTabPage::GetRanges ); + else + RemoveTabPage( RID_TABPAGE_PARA_NUMBERING ); + + AddTabPage( RID_SVXPAGE_TABULATOR ); +} + +void SdParagraphDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) +{ + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + switch( nId ) + { + case RID_SVXPAGE_STD_PARAGRAPH: + aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/2)); + rPage.PageCreated(aSet); + break; + default: + break; + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/paragr.src b/sd/source/ui/dlg/paragr.src new file mode 100644 index 000000000000..99a9d4f4c17f --- /dev/null +++ b/sd/source/ui/dlg/paragr.src @@ -0,0 +1,177 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <svx/dialogs.hrc> +#include "glob.hrc" +#include "helpids.h" +#include "paragr.hrc" + +TabDialog TAB_PARAGRAPH +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 289 , 176 ) ; + Text [ en-US ] = "Paragraph" ; + Moveable = TRUE ; + Closeable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_STD_PARAGRAPH ; + Text [ en-US ] = "Indents & Spacing" ; + PageResID = RID_SVXPAGE_STD_PARAGRAPH ; + }; + PageItem + { + Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ; + PageResID = RID_SVXPAGE_ALIGN_PARAGRAPH ; + Text [ en-US ] = "Alignment" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_PARA_ASIAN ; + PageResID = RID_SVXPAGE_PARA_ASIAN ; + Text [ en-US ] = "Asian Typography"; + }; + PageItem + { + Identifier = RID_TABPAGE_PARA_NUMBERING; + Text = "Numbering"; + PageResID = RID_TABPAGE_PARA_NUMBERING; + }; + PageItem + { + Identifier = RID_SVXPAGE_TABULATOR ; + Text [ en-US ] = "Tabs" ; + PageResID = RID_SVXPAGE_TABULATOR ; + }; + }; + }; + OKButton 1 + { + Pos = MAP_APPFONT ( 6 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + CancelButton 1 + { + Pos = MAP_APPFONT ( 60 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton 1 + { + Pos = MAP_APPFONT ( 114 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + PushButton 1 + { + Pos = MAP_APPFONT ( 169 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "Return" ; + TabStop = TRUE ; + }; +}; + +TabPage RID_TABPAGE_PARA_NUMBERING +{ + HelpId = HID_TABPAGE_PARA_NUMBERING ; + Hide = TRUE ; + Text = "Numbering" ; + Size = MAP_APPFONT ( 260 , 185 ) ; + + TriStateBox CB_NEW_START + { + HelpID = "sd:TriStateBox:RID_TABPAGE_PARA_NUMBERING:CB_NEW_START"; + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 160 , 10 ) ; + TabStop = TRUE ; + Text = "R~estart at this paragraph" ; + }; + TriStateBox CB_NUMBER_NEW_START + { + HelpID = "sd:TriStateBox:RID_TABPAGE_PARA_NUMBERING:CB_NUMBER_NEW_START"; + Pos = MAP_APPFONT ( 15 , 21 ) ; + Size = MAP_APPFONT ( 103 , 10 ) ; + Disable = TRUE ; + Text = "S~tart with" ; + }; + NumericField NF_NEW_START + { + HelpID = "sd:NumericField:RID_TABPAGE_PARA_NUMBERING:NF_NEW_START"; + Border = TRUE ; + Pos = MAP_APPFONT ( 124 , 20 ) ; + Size = MAP_APPFONT ( 26 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 9999 ; + Value = 0 ; + First = 0 ; + Last = 9999 ; + Disable = TRUE ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx new file mode 100644 index 000000000000..192e57c21b91 --- /dev/null +++ b/sd/source/ui/dlg/present.cxx @@ -0,0 +1,327 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <comphelper/processfactory.hxx> +#include <svl/itemset.hxx> + +#include "sdattr.hxx" +#include "present.hxx" +#include "present.hrc" +#include "sdresid.hxx" +#include "cusshow.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; + +/************************************************************************* +|* Ctor +\************************************************************************/ +SdStartPresentationDlg::SdStartPresentationDlg( Window* pWindow, + const SfxItemSet& rInAttrs, + List& rPageNames, List* pCSList ) : + ModalDialog ( pWindow, SdResId( DLG_START_PRESENTATION ) ), + aGrpRange ( this, SdResId( GRP_RANGE ) ), + aRbtAll ( this, SdResId( RBT_ALL ) ), + aRbtAtDia ( this, SdResId( RBT_AT_DIA ) ), + aRbtCustomshow ( this, SdResId( RBT_CUSTOMSHOW ) ), + aLbDias ( this, SdResId( LB_DIAS ) ), + aLbCustomshow ( this, SdResId( LB_CUSTOMSHOW ) ), + + aGrpKind ( this, SdResId( GRP_KIND ) ), + aRbtStandard ( this, SdResId( RBT_STANDARD ) ), + aRbtWindow ( this, SdResId( RBT_WINDOW ) ), + aRbtAuto ( this, SdResId( RBT_AUTO ) ), + aTmfPause ( this, SdResId( TMF_PAUSE ) ), + aCbxAutoLogo ( this, SdResId( CBX_AUTOLOGO ) ), + + aGrpOptions ( this, SdResId( GRP_OPTIONS ) ), + aCbxManuel ( this, SdResId( CBX_MANUEL ) ), + aCbxMousepointer ( this, SdResId( CBX_MOUSEPOINTER ) ), + aCbxPen ( this, SdResId( CBX_PEN ) ), + aCbxNavigator ( this, SdResId( CBX_NAVIGATOR ) ), + aCbxAnimationAllowed ( this, SdResId( CBX_ANIMATION_ALLOWED ) ), + aCbxChangePage ( this, SdResId( CBX_CHANGE_PAGE ) ), + aCbxAlwaysOnTop ( this, SdResId( CBX_ALWAYS_ON_TOP ) ), + + maGrpMonitor ( this, SdResId( GRP_MONITOR ) ), + maFtMonitor ( this, SdResId( FT_MONITOR ) ), + maLBMonitor ( this, SdResId( LB_MONITOR ) ), + + aBtnOK ( this, SdResId( BTN_OK ) ), + aBtnCancel ( this, SdResId( BTN_CANCEL ) ), + aBtnHelp ( this, SdResId( BTN_HELP ) ), + + pCustomShowList ( pCSList ), + rOutAttrs ( rInAttrs ), + mnMonitors ( 0 ), + + msPrimaryMonitor( SdResId(STR_PRIMARY_MONITOR ) ), + msMonitor( SdResId( STR_MONITOR ) ), + msAllMonitors( SdResId( STR_ALL_MONITORS ) ) +{ + FreeResource(); + + Link aLink( LINK( this, SdStartPresentationDlg, ChangeRangeHdl ) ); + + aRbtAll.SetClickHdl( aLink ); + aRbtAtDia.SetClickHdl( aLink ); + aRbtCustomshow.SetClickHdl( aLink ); + + aLink = LINK( this, SdStartPresentationDlg, ClickWindowPresentationHdl ); + aRbtStandard.SetClickHdl( aLink ); + aRbtWindow.SetClickHdl( aLink ); + aRbtAuto.SetClickHdl( aLink ); + + aTmfPause.SetModifyHdl( LINK( this, SdStartPresentationDlg, ChangePauseHdl ) ); + aTmfPause.SetFormat( TIMEF_SEC ); + + aLbDias.SetAccessibleRelationLabeledBy( &aRbtAtDia ); + aLbDias.SetAccessibleName(aRbtAtDia.GetText()); + aLbCustomshow.SetAccessibleRelationLabeledBy( &aRbtCustomshow ); + aTmfPause.SetAccessibleRelationLabeledBy( &aRbtAuto ); + aTmfPause.SetAccessibleName(aRbtAuto.GetText()); + + // Listbox mit Seitennamen fuellen + rPageNames.First(); + for( sal_uInt16 i = 0; + i < rPageNames.Count(); + i++ ) + { + aLbDias.InsertEntry( *( String* ) rPageNames.GetCurObject() ); + rPageNames.Next(); + } + + if( pCustomShowList ) + { + sal_uInt16 nPosToSelect = (sal_uInt16) pCustomShowList->GetCurPos(); + SdCustomShow* pCustomShow; + // Listbox mit CustomShows fuellen + for( pCustomShow = (SdCustomShow*) pCustomShowList->First(); + pCustomShow != NULL; + pCustomShow = (SdCustomShow*) pCustomShowList->Next() ) + { + aLbCustomshow.InsertEntry( pCustomShow->GetName() ); + } + aLbCustomshow.SelectEntryPos( nPosToSelect ); + pCustomShowList->Seek( nPosToSelect ); + } + else + aRbtCustomshow.Disable(); + + if( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_CUSTOMSHOW ) ).GetValue() && pCSList ) + aRbtCustomshow.Check(); + else if( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_ALL ) ).GetValue() ) + aRbtAll.Check(); + else + aRbtAtDia.Check(); + + aLbDias.SelectEntry( ( ( const SfxStringItem& ) rOutAttrs.Get( ATTR_PRESENT_DIANAME ) ).GetValue() ); + aCbxManuel.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_MANUEL ) ).GetValue() ); + aCbxMousepointer.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_MOUSE ) ).GetValue() ); + aCbxPen.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_PEN ) ).GetValue() ); + aCbxNavigator.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_NAVIGATOR ) ).GetValue() ); + aCbxAnimationAllowed.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_ANIMATION_ALLOWED ) ).GetValue() ); + aCbxChangePage.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_CHANGE_PAGE ) ).GetValue() ); + aCbxAlwaysOnTop.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_ALWAYS_ON_TOP ) ).GetValue() ); + + const sal_Bool bEndless = ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_ENDLESS ) ).GetValue(); + const sal_Bool bWindow = !( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_FULLSCREEN ) ).GetValue(); + const long nPause = ( ( const SfxUInt32Item& ) rOutAttrs.Get( ATTR_PRESENT_PAUSE_TIMEOUT ) ).GetValue(); + + aTmfPause.SetTime( Time( 0, 0, nPause ) ); + // set cursor in timefield + Edit *pEdit = aTmfPause.GetField(); + Selection aSel( pEdit->GetMaxTextLen(), pEdit->GetMaxTextLen() ); + pEdit->SetSelection( aSel ); + + aCbxAutoLogo.Check( ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_SHOW_PAUSELOGO ) ).GetValue() ); + + if( bWindow ) + aRbtWindow.Check( sal_True ); + else if( bEndless ) + aRbtAuto.Check( sal_True ); + else + aRbtStandard.Check( sal_True ); + + InitMonitorSettings(); + + ChangeRangeHdl( this ); + + ClickWindowPresentationHdl( NULL ); + ChangePauseHdl( NULL ); +} + +void SdStartPresentationDlg::InitMonitorSettings() +{ + try + { + Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); + maGrpMonitor.Show( true ); + maFtMonitor.Show( true ); + maLBMonitor.Show( true ); + + mnMonitors = xMultiMon->getCount(); + + if( mnMonitors <= 1 ) + { + maFtMonitor.Enable( false ); + maLBMonitor.Enable( false ); + } + else + { + sal_Bool bMultiscreen = false; + sal_Int32 nPrimaryIndex = 0; + Reference< XPropertySet > xMonProps( xMultiMon, UNO_QUERY ); + if( xMonProps.is() ) try + { + const OUString sPropName1( RTL_CONSTASCII_USTRINGPARAM( "MultiDisplay" ) ); + xMonProps->getPropertyValue( sPropName1 ) >>= bMultiscreen; + const OUString sPropName2( RTL_CONSTASCII_USTRINGPARAM( "DefaultDisplay" ) ); + xMonProps->getPropertyValue( sPropName2 ) >>= nPrimaryIndex; + } + catch( Exception& ) + { + } + + const String sPlaceHolder( RTL_CONSTASCII_USTRINGPARAM( "%1" ) ); + for( sal_Int32 nDisplay = 0; nDisplay < mnMonitors; nDisplay++ ) + { + String aName( nDisplay == nPrimaryIndex ? msPrimaryMonitor : msMonitor ); + const String aNumber( String::CreateFromInt32( nDisplay + 1 ) ); + aName.SearchAndReplace( sPlaceHolder, aNumber ); + maLBMonitor.InsertEntry( aName ); + } + + if( !bMultiscreen ) + maLBMonitor.InsertEntry( msAllMonitors ); + + sal_Int32 nSelected = ( ( const SfxInt32Item& ) rOutAttrs.Get( ATTR_PRESENT_DISPLAY ) ).GetValue(); + if( nSelected <= 0 ) + nSelected = nPrimaryIndex; + else + nSelected--; + + maLBMonitor.SelectEntryPos( (sal_uInt16)nSelected ); + } + } + catch( Exception& ) + { + } +} + +/************************************************************************* +|* Setzt die ausgewaehlten Attribute des Dialogs +\************************************************************************/ +void SdStartPresentationDlg::GetAttr( SfxItemSet& rAttr ) +{ + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ALL, aRbtAll.IsChecked() ) ); + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_CUSTOMSHOW, aRbtCustomshow.IsChecked() ) ); + rAttr.Put( SfxStringItem ( ATTR_PRESENT_DIANAME, aLbDias.GetSelectEntry() ) ); + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_MANUEL, aCbxManuel.IsChecked() ) ); + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_MOUSE, aCbxMousepointer.IsChecked() ) ); + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_PEN, aCbxPen.IsChecked() ) ); + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_NAVIGATOR, aCbxNavigator.IsChecked() ) ); + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ANIMATION_ALLOWED, aCbxAnimationAllowed.IsChecked() ) ); + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_CHANGE_PAGE, aCbxChangePage.IsChecked() ) ); + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ALWAYS_ON_TOP, aCbxAlwaysOnTop.IsChecked() ) ); + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_FULLSCREEN, !aRbtWindow.IsChecked() ) ); + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ENDLESS, aRbtAuto.IsChecked() ) ); + rAttr.Put( SfxUInt32Item ( ATTR_PRESENT_PAUSE_TIMEOUT, aTmfPause.GetTime().GetMSFromTime() / 1000 ) ); + rAttr.Put( SfxBoolItem ( ATTR_PRESENT_SHOW_PAUSELOGO, aCbxAutoLogo.IsChecked() ) ); + + sal_uInt16 nPos = maLBMonitor.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + rAttr.Put( SfxInt32Item ( ATTR_PRESENT_DISPLAY, nPos + 1 ) ); + + nPos = aLbCustomshow.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + pCustomShowList->Seek( nPos ); +} + +/************************************************************************* +|* Handler: Enabled/Disabled Listbox "Dias" +\************************************************************************/ +IMPL_LINK( SdStartPresentationDlg, ChangeRangeHdl, void *, EMPTYARG ) +{ + aLbDias.Enable( aRbtAtDia.IsChecked() ); + aLbCustomshow.Enable( aRbtCustomshow.IsChecked() ); + + return( 0L ); +} + +/************************************************************************* +|* Handler: Enabled/Disabled Checkbox "AlwaysOnTop" +\************************************************************************/ +IMPL_LINK( SdStartPresentationDlg, ClickWindowPresentationHdl, void *, EMPTYARG ) +{ + const bool bAuto = aRbtAuto.IsChecked(); + const bool bWindow = aRbtWindow.IsChecked(); + + // aFtPause.Enable( bAuto ); + aTmfPause.Enable( bAuto ); + aCbxAutoLogo.Enable( bAuto && ( aTmfPause.GetTime().GetMSFromTime() > 0 ) ); + + const bool bDisplay = !bWindow && ( mnMonitors > 1 ); + maFtMonitor.Enable( bDisplay ); + maLBMonitor.Enable( bDisplay ); + + if( bWindow ) + { + aCbxAlwaysOnTop.Enable( sal_False ); + aCbxAlwaysOnTop.Check( sal_False ); + } + else + aCbxAlwaysOnTop.Enable(); + + return( 0L ); +} + +/************************************************************************* +|* Handler: Enabled/Disabled Checkbox "AlwaysOnTop" +\************************************************************************/ +IMPL_LINK( SdStartPresentationDlg, ChangePauseHdl, void *, EMPTYARG ) +{ + aCbxAutoLogo.Enable( aRbtAuto.IsChecked() && ( aTmfPause.GetTime().GetMSFromTime() > 0 ) ); + return( 0L ); +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/present.src b/sd/source/ui/dlg/present.src new file mode 100644 index 000000000000..b53facb8d1e2 --- /dev/null +++ b/sd/source/ui/dlg/present.src @@ -0,0 +1,292 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#include "helpids.h" +#include <svx/svxids.hrc> +#include "present.hrc" + +#define DISTANCE 23 +#define DISTANCE2 ((DISTANCE) + 81) + +ModalDialog DLG_START_PRESENTATION +{ + HelpID = CMD_SID_PRESENTATION ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 256, 205 ) ; + Text [ en-US ] = "Slide Show" ; + Moveable = TRUE ; + + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 200, 6 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 200, 23 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 200, 43 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + TabStop = TRUE ; + }; + + FixedLine GRP_RANGE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 187, 8 ) ; + Text [ en-US ] = "Range" ; + }; + RadioButton RBT_ALL + { + HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_ALL"; + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 80 , 12 ) ; + Text [ en-US ] = "All ~slides" ; + TabStop = TRUE ; + }; + RadioButton RBT_AT_DIA + { + HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_AT_DIA"; + Pos = MAP_APPFONT ( 12 , 26 ) ; + Size = MAP_APPFONT ( 60 , 12 ) ; + Text [ en-US ] = "~From:" ; + TabStop = TRUE ; + }; + ListBox LB_DIAS + { + HelpID = "sd:ListBox:DLG_START_PRESENTATION:LB_DIAS"; + Border = TRUE ; + Pos = MAP_APPFONT ( 82, 24 ) ; + Size = MAP_APPFONT ( 111, 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + //DDExtraWidth = TRUE; + }; + RadioButton RBT_CUSTOMSHOW + { + HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_CUSTOMSHOW"; + Pos = MAP_APPFONT ( 12 , 38 ) ; + Size = MAP_APPFONT ( 130 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Custom Slide Show" ; + }; + ListBox LB_CUSTOMSHOW + { + HelpID = "sd:ListBox:DLG_START_PRESENTATION:LB_CUSTOMSHOW"; + Border = TRUE ; + Pos = MAP_APPFONT ( 32, 53 ) ; + Size = MAP_APPFONT ( 161, 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + + FixedLine GRP_KIND + { + Pos = MAP_APPFONT ( 6, 73 ) ; + Size = MAP_APPFONT ( 90, 8 ); + Text [ en-US ] = "Type" ; + }; + RadioButton RBT_STANDARD + { + HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_STANDARD"; + Pos = MAP_APPFONT ( 12, 84 ) ; + Size = MAP_APPFONT ( 81, 12 ) ; + Text [ en-US ] = "~Default" ; + TabStop = TRUE ; + }; + RadioButton RBT_WINDOW + { + HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_WINDOW"; + Pos = MAP_APPFONT ( 12 , 96 ) ; + Size = MAP_APPFONT ( 81 , 12 ) ; + Text [ en-US ] = "~Window" ; + TabStop = TRUE ; + }; + RadioButton RBT_AUTO + { + HelpID = "sd:RadioButton:DLG_START_PRESENTATION:RBT_AUTO"; + Pos = MAP_APPFONT ( 12 , 108 ) ; + Size = MAP_APPFONT ( 81 , 12 ) ; + Text [ en-US ] = "A~uto" ; + TabStop = TRUE ; + }; +/* + FixedText FT_PAUSE + { + Pos = MAP_APPFONT ( 32, 124 ) ; + Size = MAP_APPFONT ( 25, 12 ) ; + Text [ en-US ] = "Pause:" ; + }; +*/ + TimeField TMF_PAUSE + { + HelpID = "sd:TimeField:DLG_START_PRESENTATION:TMF_PAUSE"; + Pos = MAP_APPFONT ( 32, 120 ) ; + Size = MAP_APPFONT ( 50, 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Duration = TRUE ; + StrictFormat = TRUE ; + Maximum = Time + { + Hour = 23 ; + Minute = 59 ; + Second = 59 ; + }; + Last = Time + { + Hour = 23 ; + Minute = 59 ; + Second = 59 ; + }; + QuickHelpText [ en-US ] = "Duration of pause" ; + }; + CheckBox CBX_AUTOLOGO + { + HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_AUTOLOGO"; + Pos = MAP_APPFONT ( 32 , 138 ) ; + Size = MAP_APPFONT ( 61 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Show ~logo" ; + }; + + FixedLine GRP_OPTIONS + { + Pos = MAP_APPFONT ( 102 , 73 ) ; + Size = MAP_APPFONT ( 148, 8 ); + Text [ en-US ] = "Options" ; + }; + CheckBox CBX_MANUEL + { + HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_MANUEL"; + Pos = MAP_APPFONT ( 108 , 84 ) ; + Size = MAP_APPFONT ( 139 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Change slides ~manually" ; + }; + CheckBox CBX_MOUSEPOINTER + { + HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_MOUSEPOINTER"; + Pos = MAP_APPFONT ( 108, 96 ) ; + Size = MAP_APPFONT ( 139, 12 ) ; + Text [ en-US ] = "Mouse pointer ~visible" ; + TabStop = TRUE ; + }; + CheckBox CBX_PEN + { + HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_PEN"; + Pos = MAP_APPFONT ( 108, 108 ) ; + Size = MAP_APPFONT ( 139, 12 ) ; + Text [ en-US ] = "Mouse pointer as ~pen" ; + TabStop = TRUE ; + }; + CheckBox CBX_NAVIGATOR + { + HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_NAVIGATOR"; + Pos = MAP_APPFONT ( 108, 120 ) ; + Size = MAP_APPFONT ( 139, 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Navigator visible" ; + }; + CheckBox CBX_ANIMATION_ALLOWED + { + HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_ANIMATION_ALLOWED"; + Pos = MAP_APPFONT ( 108, 132 ) ; + Size = MAP_APPFONT ( 139, 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Animations allowed" ; + }; + CheckBox CBX_CHANGE_PAGE + { + HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_CHANGE_PAGE"; + Pos = MAP_APPFONT ( 108, 144 ) ; + Size = MAP_APPFONT ( 139, 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Change slides by clic~king on background" ; + }; + CheckBox CBX_ALWAYS_ON_TOP + { + HelpID = "sd:CheckBox:DLG_START_PRESENTATION:CBX_ALWAYS_ON_TOP"; + Pos = MAP_APPFONT ( 108, 156 ) ; + Size = MAP_APPFONT ( 145, 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Presentation always ~on top" ; + }; + + FixedLine GRP_MONITOR + { + Pos = MAP_APPFONT ( 6, 174 ) ; + Size = MAP_APPFONT ( 244, 8 ); + Hide = TRUE; + Text [ en-US ] = "Multiple displays" ; + }; + + FixedText FT_MONITOR + { + OutputSize = TRUE; + Pos = MAP_APPFONT ( 12 , 185 + 2 ) ; + Size = MAP_APPFONT( 70, 8 ); + Hide = TRUE; + Text [ en-US ] = "P~resentation display" ; + }; + + ListBox LB_MONITOR + { + Pos = MAP_APPFONT ( 82 , 185 ) ; + Size = MAP_APPFONT ( 111, 100 ); + HelpId = HID_SD_SLIDESHOW_DISPLAY; + Hide = TRUE; + TabStop = TRUE ; + Border = TRUE ; + DropDown = TRUE ; + ClipChildren = TRUE; + }; + + String STR_PRIMARY_MONITOR + { + Text [ en-US ] = "Display %1 (primary)"; + }; + + String STR_MONITOR + { + Text [ en-US ] = "Display %1"; + }; + + String STR_ALL_MONITORS + { + Text [ en-US ] = "All displays"; + }; + +}; diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx new file mode 100644 index 000000000000..112eb6e3c68e --- /dev/null +++ b/sd/source/ui/dlg/prltempl.cxx @@ -0,0 +1,358 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + + +#include "eetext.hxx" + +#include <svx/dialogs.hrc> +#include <editeng/flstitem.hxx> +#include <svx/drawitem.hxx> +#include <svl/style.hxx> +#include <svx/tabline.hxx> +#include <editeng/bulitem.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/brshitem.hxx> +#include <vcl/graph.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/numitem.hxx> +#include <svl/cjkoptions.hxx> + +#include "DrawDocShell.hxx" +#include "glob.hrc" +#include "sdresid.hxx" +#include "prltempl.hxx" +#include "prltempl.hrc" +#include "enumdlg.hrc" +#include "bulmaper.hxx" +#include <svl/intitem.hxx> +#include <svx/svxgrahicitem.hxx> +#include <svx/flagsdef.hxx> +#include "drawdoc.hxx" +#define IS_OUTLINE(x) (x >= PO_OUTLINE_1 && x <= PO_OUTLINE_9) + +/************************************************************************* +|* +|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu +|* +\************************************************************************/ + +SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, + Window* pParent, + SdResId DlgId, + SfxStyleSheetBase& rStyleBase, + PresentationObjects _ePO, + SfxStyleSheetBasePool* pSSPool ) : + SfxTabDialog ( pParent, DlgId ), + mpDocShell ( pDocSh ), + ePO ( _ePO ), + aInputSet ( *rStyleBase.GetItemSet().GetPool(), SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL ), + pOutSet ( NULL ), + pOrgSet ( &rStyleBase.GetItemSet() ) +{ + if( IS_OUTLINE(ePO)) + { + // Leider sind die Itemsets unserer Stylesheets nicht discret.. + const sal_uInt16* pPtr = pOrgSet->GetRanges(); + sal_uInt16 p1, p2; + while( *pPtr ) + { + p1 = pPtr[0]; + p2 = pPtr[1]; + + // erstmal das ganze discret machen + while(pPtr[2] && (pPtr[2] - p2 == 1)) + { + p2 = pPtr[3]; + pPtr += 2; + } + aInputSet.MergeRange( p1, p2 ); + pPtr += 2; + } + + aInputSet.Put( rStyleBase.GetItemSet() ); + + // need parent-relationship + const SfxItemSet* pParentItemSet = rStyleBase.GetItemSet().GetParent();; + if( pParentItemSet ) + aInputSet.SetParent( pParentItemSet ); + + pOutSet = new SfxItemSet( rStyleBase.GetItemSet() ); + pOutSet->ClearItem(); + + const SfxPoolItem *pItem = NULL; + + // Fals in diesem Stylesheet kein Bullet Item ist, holen wir uns + // das aus dem 'Outline 1' Stylesheet. + if( SFX_ITEM_SET != aInputSet.GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem )) + { + String aStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE))); + aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) ); + SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO); + + if(pFirstStyleSheet) + if( SFX_ITEM_SET == pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem) ) + aInputSet.Put( *pItem ); + } + + // gewaehlte Ebene im Dialog vorselektieren + aInputSet.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, 1<<GetOutlineLevel())); + + SetInputSet( &aInputSet ); + } + else + SetInputSet( pOrgSet ); + + FreeResource(); + + SvxColorTableItem aColorTableItem(*( (const SvxColorTableItem*) + ( mpDocShell->GetItem( SID_COLOR_TABLE ) ) ) ); + SvxGradientListItem aGradientListItem(*( (const SvxGradientListItem*) + ( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) ) ); + SvxBitmapListItem aBitmapListItem(*( (const SvxBitmapListItem*) + ( mpDocShell->GetItem( SID_BITMAP_LIST ) ) ) ); + SvxHatchListItem aHatchListItem(*( (const SvxHatchListItem*) + ( mpDocShell->GetItem( SID_HATCH_LIST ) ) ) ); + SvxDashListItem aDashListItem(*( (const SvxDashListItem*) + ( mpDocShell->GetItem( SID_DASH_LIST ) ) ) ); + SvxLineEndListItem aLineEndListItem(*( (const SvxLineEndListItem*) + ( mpDocShell->GetItem( SID_LINEEND_LIST ) ) ) ); + + pColorTab = aColorTableItem.GetColorTable(); + pDashList = aDashListItem.GetDashList(); + pLineEndList = aLineEndListItem.GetLineEndList(); + pGradientList = aGradientListItem.GetGradientList(); + pHatchingList = aHatchListItem.GetHatchList(); + pBitmapList = aBitmapListItem.GetBitmapList(); + + switch( DlgId.GetId() ) + { + case TAB_PRES_LAYOUT_TEMPLATE: + { + AddTabPage( RID_SVXPAGE_LINE); + AddTabPage( RID_SVXPAGE_AREA); + AddTabPage( RID_SVXPAGE_SHADOW); + AddTabPage( RID_SVXPAGE_TRANSPARENCE); + AddTabPage( RID_SVXPAGE_CHAR_NAME ); + AddTabPage( RID_SVXPAGE_CHAR_EFFECTS ); + AddTabPage( RID_SVXPAGE_STD_PARAGRAPH ); + AddTabPage( RID_SVXPAGE_TEXTATTR ); + AddTabPage( RID_SVXPAGE_PICK_BULLET ); + AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM ); + AddTabPage( RID_SVXPAGE_PICK_BMP ); + AddTabPage( RID_SVXPAGE_NUM_OPTIONS ); + AddTabPage( RID_SVXPAGE_TABULATOR ); + } + break; + + case TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND: // background + AddTabPage( RID_SVXPAGE_AREA); + break; + } + + // the tabpages Alignment, Tabs and Asian Typography are very + // usefull, except for the background style + if( DlgId.GetId() != TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND ) + { + SvtCJKOptions aCJKOptions; + if( aCJKOptions.IsAsianTypographyEnabled() ) + AddTabPage( RID_SVXPAGE_PARA_ASIAN ); + else + RemoveTabPage( RID_SVXPAGE_PARA_ASIAN ); + + AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH ); + } + + // Titel setzen und + // entsprechende Seiten zum Dialog hinzufuegen + String aTitle; + + switch( ePO ) + { + case PO_TITLE: + aTitle = String(SdResId( STR_PSEUDOSHEET_TITLE )); + break; + + case PO_SUBTITLE: + aTitle = String(SdResId( STR_PSEUDOSHEET_SUBTITLE )); + break; + + case PO_BACKGROUND: + aTitle = String(SdResId( STR_PSEUDOSHEET_BACKGROUND )); + break; + + case PO_BACKGROUNDOBJECTS: + aTitle = String(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS )); + break; + + case PO_OUTLINE_1: + case PO_OUTLINE_2: + case PO_OUTLINE_3: + case PO_OUTLINE_4: + case PO_OUTLINE_5: + case PO_OUTLINE_6: + case PO_OUTLINE_7: + case PO_OUTLINE_8: + case PO_OUTLINE_9: + aTitle = String(SdResId( STR_PSEUDOSHEET_OUTLINE )); + aTitle.Append( sal_Unicode(' ') ); + aTitle.Append( UniString::CreateFromInt32( ePO - PO_OUTLINE_1 + 1 ) ); + break; + + case PO_NOTES: + aTitle = String(SdResId( STR_PSEUDOSHEET_NOTES )); + break; + } + SetText( aTitle ); + + nDlgType = 1; // Vorlagen-Dialog + nPageType = 0; + nPos = 0; + + nColorTableState = CT_NONE; + nBitmapListState = CT_NONE; + nGradientListState = CT_NONE; + nHatchingListState = CT_NONE; +} + +// ----------------------------------------------------------------------- + +SdPresLayoutTemplateDlg::~SdPresLayoutTemplateDlg() +{ + delete pOutSet; +} + +// ----------------------------------------------------------------------- + +void SdPresLayoutTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) +{ SfxAllItemSet aSet(*(aInputSet.GetPool())); + switch( nId ) + { + case RID_SVXPAGE_LINE: + { + aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST)); + aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST)); + aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); + + rPage.PageCreated(aSet); + } + break; + + case RID_SVXPAGE_AREA: + { + aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST)); + aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST)); + aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_LIST)); + aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); + aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); + aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos)); + rPage.PageCreated(aSet); + + } + break; + + case RID_SVXPAGE_SHADOW: + aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); + aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); + rPage.PageCreated(aSet); + break; + + case RID_SVXPAGE_TRANSPARENCE: + aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); + aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); + rPage.PageCreated(aSet); + break; + + case RID_SVXPAGE_CHAR_NAME: + { + SvxFontListItem aItem(*( (const SvxFontListItem*) + ( mpDocShell->GetItem( SID_ATTR_CHAR_FONTLIST) ) ) ); + + aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST)); + rPage.PageCreated(aSet); + } + break; + + case RID_SVXPAGE_CHAR_EFFECTS: + aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP)); + rPage.PageCreated(aSet); + break; + + case RID_SVXPAGE_STD_PARAGRAPH: + break; + } +} + +const SfxItemSet* SdPresLayoutTemplateDlg::GetOutputItemSet() const +{ + if( pOutSet ) + { + pOutSet->Put( *SfxTabDialog::GetOutputItemSet() ); + + const SvxNumBulletItem *pSvxNumBulletItem = NULL; + if( SFX_ITEM_SET == pOutSet->GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pSvxNumBulletItem )) + SdBulletMapper::MapFontsInNumRule( *pSvxNumBulletItem->GetNumRule(), *pOutSet ); + return pOutSet; + } + else + return SfxTabDialog::GetOutputItemSet(); +} + +// --------------------------------------------------------------------- +// --------------------------------------------------------------------- +sal_uInt16 SdPresLayoutTemplateDlg::GetOutlineLevel() const +{ + switch( ePO ) + { + case PO_OUTLINE_1: return 0; + case PO_OUTLINE_2: return 1; + case PO_OUTLINE_3: return 2; + case PO_OUTLINE_4: return 3; + case PO_OUTLINE_5: return 4; + case PO_OUTLINE_6: return 5; + case PO_OUTLINE_7: return 6; + case PO_OUTLINE_8: return 7; + case PO_OUTLINE_9: return 8; + default: + DBG_ASSERT( sal_False, "Falscher Po! [CL]"); + } + return 0; +} + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/prltempl.src b/sd/source/ui/dlg/prltempl.src new file mode 100644 index 000000000000..d7251c084c3d --- /dev/null +++ b/sd/source/ui/dlg/prltempl.src @@ -0,0 +1,195 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "enumdlg.hrc" +#include "prltempl.hrc" +#include <svx/dialogs.hrc> +TabDialog TAB_PRES_LAYOUT_TEMPLATE +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 289 , 176 ) ; + Text [ en-US ] = "Presentation Layout" ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_LINE ; + Text [ en-US ] = "Line" ; + PageResID = RID_SVXPAGE_LINE ; + }; + PageItem + { + Identifier = RID_SVXPAGE_AREA ; + Text [ en-US ] = "Area" ; + PageResID = RID_SVXPAGE_AREA ; + }; + PageItem + { + Identifier = RID_SVXPAGE_SHADOW ; + PageResID = RID_SVXPAGE_SHADOW ; + Text [ en-US ] = "Shadow" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_TRANSPARENCE ; + Text [ en-US ] = "Transparency"; + }; + PageItem + { + Identifier = RID_SVXPAGE_CHAR_NAME ; + Text [ en-US ] = "Font" ; + PageResID = RID_SVXPAGE_CHAR_NAME; + }; + PageItem + { + Identifier = RID_SVXPAGE_CHAR_EFFECTS ; + Text [ en-US ] = "Font Effects" ; + PageResID = RID_SVXPAGE_CHAR_EFFECTS ; + }; + PageItem + { + Identifier = RID_SVXPAGE_STD_PARAGRAPH ; + Text [ en-US ] = "Indents & Spacing" ; + PageResID = RID_SVXPAGE_STD_PARAGRAPH ; + }; + PageItem + { + Identifier = RID_SVXPAGE_TEXTATTR ; + PageResID = RID_SVXPAGE_TEXTATTR ; + Text [ en-US ] = "Text" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_PICK_BULLET ; + PageResID = RID_SVXPAGE_PICK_BULLET ; + Text [ en-US ] = "Bullets" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_PICK_SINGLE_NUM ; + PageResID = RID_SVXPAGE_PICK_SINGLE_NUM ; + Text [ en-US ] = "Numbering type" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_PICK_BMP ; + PageResID = RID_SVXPAGE_PICK_BMP ; + Text [ en-US ] = "Graphics" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_NUM_OPTIONS ; + PageResID = RID_SVXPAGE_NUM_OPTIONS ; + Text [ en-US ] = "Customize" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ; + PageResID = RID_SVXPAGE_ALIGN_PARAGRAPH ; + Text [ en-US ] = "Alignment" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_PARA_ASIAN ; + PageResID = RID_SVXPAGE_PARA_ASIAN ; + Text[ en-US ] = "Asian Typography"; + }; + PageItem + { + Identifier = RID_SVXPAGE_TABULATOR ; + PageResID = RID_SVXPAGE_TABULATOR ; + Text [ en-US ] = "Tabs" ; + }; + }; + }; +}; + +TabDialog TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 289 , 176 ) ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_AREA ; + Text [ en-US ] = "Area" ; + PageResID = RID_SVXPAGE_AREA ; + }; + }; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/prntopts.cxx b/sd/source/ui/dlg/prntopts.cxx new file mode 100644 index 000000000000..e48be95d161f --- /dev/null +++ b/sd/source/ui/dlg/prntopts.cxx @@ -0,0 +1,313 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + + +#include "sdattr.hxx" +#include "optsitem.hxx" +#include "prntopts.hrc" +#include "sdresid.hxx" +#include "prntopts.hxx" +#include "app.hrc" +#include <svl/intitem.hxx> +#include <sfx2/request.hxx> + +/************************************************************************* +|* +|* Dialog zum Aendern der Print-Optionen +|* +\************************************************************************/ + +SdPrintOptions::SdPrintOptions( Window* pParent, const SfxItemSet& rInAttrs ) : + SfxTabPage ( pParent, SdResId( TP_PRINT_OPTIONS ), rInAttrs ), + + aGrpPrint ( this, SdResId( GRP_PRINT ) ), + aCbxDraw ( this, SdResId( CBX_DRAW ) ), + aCbxNotes ( this, SdResId( CBX_NOTES ) ), + aCbxHandout ( this, SdResId( CBX_HANDOUTS ) ), + aCbxOutline ( this, SdResId( CBX_OUTLINE ) ), + + aSeparator1FL ( this, SdResId( FL_SEPARATOR1 ) ), + aGrpOutput ( this, SdResId( GRP_OUTPUT ) ), + aRbtColor ( this, SdResId( RBT_COLOR ) ), + aRbtGrayscale ( this, SdResId( RBT_GRAYSCALE ) ), + aRbtBlackWhite ( this, SdResId( RBT_BLACKWHITE ) ), + + aGrpPrintExt ( this, SdResId( GRP_PRINT_EXT ) ), + aCbxPagename ( this, SdResId( CBX_PAGENAME ) ), + aCbxDate ( this, SdResId( CBX_DATE ) ), + aCbxTime ( this, SdResId( CBX_TIME ) ), + aCbxHiddenPages ( this, SdResId( CBX_HIDDEN_PAGES ) ), + + aSeparator2FL ( this, SdResId( FL_SEPARATOR2 ) ), + aGrpPageoptions ( this, SdResId( GRP_PAGE ) ), + aRbtDefault ( this, SdResId( RBT_DEFAULT ) ), + aRbtPagesize ( this, SdResId( RBT_PAGESIZE ) ), + aRbtPagetile ( this, SdResId( RBT_PAGETILE ) ), + aRbtBooklet ( this, SdResId( RBT_BOOKLET ) ), + aCbxFront ( this, SdResId( CBX_FRONT ) ), + aCbxBack ( this, SdResId( CBX_BACK ) ), + + aCbxPaperbin ( this, SdResId( CBX_PAPERBIN ) ), + + rOutAttrs ( rInAttrs ) +{ + FreeResource(); + + Link aLink = LINK( this, SdPrintOptions, ClickBookletHdl ); + aRbtDefault.SetClickHdl( aLink ); + aRbtPagesize.SetClickHdl( aLink ); + aRbtPagetile.SetClickHdl( aLink ); + aRbtBooklet.SetClickHdl( aLink ); + + aLink = LINK( this, SdPrintOptions, ClickCheckboxHdl ); + aCbxDraw.SetClickHdl( aLink ); + aCbxNotes.SetClickHdl( aLink ); + aCbxHandout.SetClickHdl( aLink ); + aCbxOutline.SetClickHdl( aLink ); + +#ifndef QUARTZ + SetDrawMode(); +#endif + + aCbxFront.SetAccessibleRelationLabeledBy( &aRbtBooklet ); + aCbxBack.SetAccessibleRelationLabeledBy( &aRbtBooklet ); +} + +// ----------------------------------------------------------------------- + +SdPrintOptions::~SdPrintOptions() +{ +} + +// ----------------------------------------------------------------------- + +sal_Bool SdPrintOptions::FillItemSet( SfxItemSet& rAttrs ) +{ + if( aCbxDraw.GetSavedValue() != aCbxDraw.IsChecked() || + aCbxNotes.GetSavedValue() != aCbxNotes.IsChecked() || + aCbxHandout.GetSavedValue() != aCbxHandout.IsChecked() || + aCbxOutline.GetSavedValue() != aCbxOutline.IsChecked() || + aCbxDate.GetSavedValue() != aCbxDate.IsChecked() || + aCbxTime.GetSavedValue() != aCbxTime.IsChecked() || + aCbxPagename.GetSavedValue() != aCbxPagename.IsChecked() || + aCbxHiddenPages.GetSavedValue() != aCbxHiddenPages.IsChecked() || + aRbtPagesize.GetSavedValue() != aRbtPagesize.IsChecked() || + aRbtPagetile.GetSavedValue() != aRbtPagetile.IsChecked() || + aRbtBooklet.GetSavedValue() != aRbtBooklet.IsChecked() || + aCbxFront.GetSavedValue() != aCbxFront.IsChecked() || + aCbxBack.GetSavedValue() != aCbxBack.IsChecked() || + aCbxPaperbin.GetSavedValue() != aCbxPaperbin.IsChecked() || + aRbtColor.GetSavedValue() != aRbtColor.IsChecked() || + aRbtGrayscale.GetSavedValue() != aRbtGrayscale.IsChecked() || + aRbtBlackWhite.GetSavedValue() != aRbtBlackWhite.IsChecked() ) + { + SdOptionsPrintItem aOptions( ATTR_OPTIONS_PRINT ); + + aOptions.GetOptionsPrint().SetDraw( aCbxDraw.IsChecked() ); + aOptions.GetOptionsPrint().SetNotes( aCbxNotes.IsChecked() ); + aOptions.GetOptionsPrint().SetHandout( aCbxHandout.IsChecked() ); + aOptions.GetOptionsPrint().SetOutline( aCbxOutline.IsChecked() ); + aOptions.GetOptionsPrint().SetDate( aCbxDate.IsChecked() ); + aOptions.GetOptionsPrint().SetTime( aCbxTime.IsChecked() ); + aOptions.GetOptionsPrint().SetPagename( aCbxPagename.IsChecked() ); + aOptions.GetOptionsPrint().SetHiddenPages( aCbxHiddenPages.IsChecked() ); + aOptions.GetOptionsPrint().SetPagesize( aRbtPagesize.IsChecked() ); + aOptions.GetOptionsPrint().SetPagetile( aRbtPagetile.IsChecked() ); + aOptions.GetOptionsPrint().SetBooklet( aRbtBooklet.IsChecked() ); + aOptions.GetOptionsPrint().SetFrontPage( aCbxFront.IsChecked() ); + aOptions.GetOptionsPrint().SetBackPage( aCbxBack.IsChecked() ); + aOptions.GetOptionsPrint().SetPaperbin( aCbxPaperbin.IsChecked() ); + + sal_uInt16 nQuality = 0; // Standard, also Color + if( aRbtGrayscale.IsChecked() ) + nQuality = 1; + if( aRbtBlackWhite.IsChecked() ) + nQuality = 2; + aOptions.GetOptionsPrint().SetOutputQuality( nQuality ); + + rAttrs.Put( aOptions ); + + return( sal_True ); + } + return( sal_False ); +} + +// ----------------------------------------------------------------------- + +void SdPrintOptions::Reset( const SfxItemSet& rAttrs ) +{ + const SdOptionsPrintItem* pPrintOpts = NULL; + if( SFX_ITEM_SET == rAttrs.GetItemState( ATTR_OPTIONS_PRINT, sal_False, + (const SfxPoolItem**) &pPrintOpts ) ) + { + aCbxDraw.Check( pPrintOpts->GetOptionsPrint().IsDraw() ); + aCbxNotes.Check( pPrintOpts->GetOptionsPrint().IsNotes() ); + aCbxHandout.Check( pPrintOpts->GetOptionsPrint().IsHandout() ); + aCbxOutline.Check( pPrintOpts->GetOptionsPrint().IsOutline() ); + aCbxDate.Check( pPrintOpts->GetOptionsPrint().IsDate() ); + aCbxTime.Check( pPrintOpts->GetOptionsPrint().IsTime() ); + aCbxPagename.Check( pPrintOpts->GetOptionsPrint().IsPagename() ); + aCbxHiddenPages.Check( pPrintOpts->GetOptionsPrint().IsHiddenPages() ); + aRbtPagesize.Check( pPrintOpts->GetOptionsPrint().IsPagesize() ); + aRbtPagetile.Check( pPrintOpts->GetOptionsPrint().IsPagetile() ); + aRbtBooklet.Check( pPrintOpts->GetOptionsPrint().IsBooklet() ); + aCbxFront.Check( pPrintOpts->GetOptionsPrint().IsFrontPage() ); + aCbxBack.Check( pPrintOpts->GetOptionsPrint().IsBackPage() ); + aCbxPaperbin.Check( pPrintOpts->GetOptionsPrint().IsPaperbin() ); + + if( !aRbtPagesize.IsChecked() && + !aRbtPagetile.IsChecked() && + !aRbtBooklet.IsChecked() ) + { + aRbtDefault.Check(); + } + + sal_uInt16 nQuality = pPrintOpts->GetOptionsPrint().GetOutputQuality(); + if( nQuality == 0 ) + aRbtColor.Check(); + else if( nQuality == 1 ) + aRbtGrayscale.Check(); + else + aRbtBlackWhite.Check(); + } + aCbxDraw.SaveValue(); + aCbxNotes.SaveValue(); + aCbxHandout.SaveValue(); + aCbxOutline.SaveValue(); + aCbxDate.SaveValue(); + aCbxTime.SaveValue(); + aCbxPagename.SaveValue(); + aCbxHiddenPages.SaveValue(); + aRbtPagesize.SaveValue(); + aRbtPagetile.SaveValue(); + aRbtBooklet.SaveValue(); + aCbxPaperbin.SaveValue(); + aRbtColor.SaveValue(); + aRbtGrayscale.SaveValue(); + aRbtBlackWhite.SaveValue(); + + ClickBookletHdl( NULL ); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SdPrintOptions::Create( Window* pWindow, + const SfxItemSet& rOutAttrs ) +{ + return( new SdPrintOptions( pWindow, rOutAttrs ) ); +} + +//----------------------------------------------------------------------- + +IMPL_LINK( SdPrintOptions, ClickCheckboxHdl, CheckBox *, pCbx ) +{ + // there must be at least one of them checked + if( !aCbxDraw.IsChecked() && !aCbxNotes.IsChecked() && !aCbxOutline.IsChecked() && !aCbxHandout.IsChecked() ) + pCbx->Check(); + + updateControls(); + return 0; +} + +//----------------------------------------------------------------------- + +IMPL_LINK( SdPrintOptions, ClickBookletHdl, CheckBox *, EMPTYARG ) +{ + updateControls(); + return 0; +} + +void SdPrintOptions::updateControls() +{ + aCbxFront.Enable(aRbtBooklet.IsChecked()); + aCbxBack.Enable(aRbtBooklet.IsChecked()); + + aCbxDate.Enable( !aRbtBooklet.IsChecked() ); + aCbxTime.Enable( !aRbtBooklet.IsChecked() ); + + aCbxPagename.Enable( !aRbtBooklet.IsChecked() && (aCbxDraw.IsChecked() || aCbxNotes.IsChecked() || aCbxOutline.IsChecked()) ); +} + +void lcl_MoveRB_Impl(Window& rBtn, long nXDiff) +{ + Point aPos(rBtn.GetPosPixel()); + aPos.X() -= nXDiff; + rBtn.SetPosPixel(aPos); +} + +void SdPrintOptions::SetDrawMode() +{ + if(aCbxNotes.IsVisible()) + { + aCbxNotes.Hide(); + aCbxHandout.Hide(); + aCbxOutline.Hide(); + aCbxDraw.Hide(); + aGrpPrint.Hide(); + + aSeparator1FL.Hide(); + long nXDiff = aGrpOutput.GetPosPixel().X() - aGrpPrint.GetPosPixel().X(); + lcl_MoveRB_Impl(aRbtColor, nXDiff); + lcl_MoveRB_Impl(aRbtGrayscale, nXDiff); + lcl_MoveRB_Impl(aRbtBlackWhite, nXDiff); + lcl_MoveRB_Impl(aGrpOutput, nXDiff); + + long nWidth = aGrpOutput.GetSizePixel().Width() + nXDiff; + Size aSize(aGrpOutput.GetSizePixel()); + aSize.Width() = nWidth; + aGrpOutput.SetSizePixel(aSize); + } +} + +void SdPrintOptions::PageCreated (SfxAllItemSet +#ifdef QUARTZ + aSet +#endif + ) +{ +#ifdef QUARTZ + SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_SDMODE_FLAG,sal_False); + if (pFlagItem) + { + sal_uInt32 nFlags=pFlagItem->GetValue(); + if ( ( nFlags & SD_DRAW_MODE ) == SD_DRAW_MODE ) + SetDrawMode(); + } +#else + SetDrawMode(); +#endif +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/prntopts.src b/sd/source/ui/dlg/prntopts.src new file mode 100644 index 000000000000..7a4f88068e87 --- /dev/null +++ b/sd/source/ui/dlg/prntopts.src @@ -0,0 +1,250 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "prntopts.hrc" +#include "helpids.h" +TabPage TP_PRINT_OPTIONS +{ + HelpID = HID_SD_PRINT_OPTIONS ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Text [ en-US ] = "Options" ; + Hide = TRUE; + FixedLine GRP_PRINT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 118 , 8 ) ; + Text [ en-US ] = "Contents" ; + }; + CheckBox CBX_DRAW + { + HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_DRAW"; + TabStop = TRUE ; + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + Text [ en-US ] = "~Drawing" ; + }; + CheckBox CBX_NOTES + { + HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_NOTES"; + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Notes" ; + }; + CheckBox CBX_HANDOUTS + { + HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_HANDOUTS"; + Pos = MAP_APPFONT ( 12 , 42 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Hando~uts" ; + }; + CheckBox CBX_OUTLINE + { + HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_OUTLINE"; + Pos = MAP_APPFONT ( 12 , 56 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Out~line" ; + }; + FixedLine FL_SEPARATOR1 + { + Pos = MAP_APPFONT ( 125 , 14 ) ; + Size = MAP_APPFONT ( 4 , 52 ) ; + Vert = TRUE ; + }; + FixedLine GRP_OUTPUT + { + Pos = MAP_APPFONT ( 130 , 3 ) ; + Size = MAP_APPFONT ( 124 , 8 ) ; + Text [ en-US ] = "Quality" ; + }; + RadioButton RBT_COLOR + { + HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_COLOR"; + Pos = MAP_APPFONT ( 136 , 14 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "Default" ; + TabStop = TRUE ; + }; + RadioButton RBT_GRAYSCALE + { + HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_GRAYSCALE"; + Pos = MAP_APPFONT ( 136 , 28 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "Gra~yscale" ; + TabStop = TRUE ; + }; + RadioButton RBT_BLACKWHITE + { + HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_BLACKWHITE"; + Pos = MAP_APPFONT ( 136 , 42 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "Black & ~white" ; + TabStop = TRUE ; + }; + FixedLine GRP_PRINT_EXT + { + Pos = MAP_APPFONT ( 6 , 72 ) ; + Size = MAP_APPFONT ( 118 , 8 ) ; + Text [ en-US ] = "Print" ; + }; + CheckBox CBX_PAGENAME + { + HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_PAGENAME"; + Pos = MAP_APPFONT ( 12 , 83 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + Text [ en-US ] = "~Page name" ; + TabStop = TRUE ; + }; + CheckBox CBX_DATE + { + HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_DATE"; + Pos = MAP_APPFONT ( 12 , 97 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + Text [ en-US ] = "D~ate" ; + TabStop = TRUE ; + }; + CheckBox CBX_TIME + { + HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_TIME"; + Pos = MAP_APPFONT ( 12 , 111 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + Text [ en-US ] = "Ti~me" ; + TabStop = TRUE ; + }; + CheckBox CBX_HIDDEN_PAGES + { + HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_HIDDEN_PAGES"; + Pos = MAP_APPFONT ( 12 , 125 ) ; + // 120 , 14 + Size = MAP_APPFONT ( 90 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "H~idden pages" ; + }; + FixedLine FL_SEPARATOR2 + { + Pos = MAP_APPFONT ( 125 , 83 ) ; + Size = MAP_APPFONT ( 4 , 80 ) ; + Vert = TRUE ; + }; + FixedLine GRP_PAGE + { + Pos = MAP_APPFONT ( 130 , 72 ) ; + Size = MAP_APPFONT ( 124 , 8 ) ; + Text [ en-US ] = "Page options" ; + }; + RadioButton RBT_DEFAULT + { + HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_DEFAULT"; + Pos = MAP_APPFONT ( 136 , 83 ) ; + Size = MAP_APPFONT ( 110 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Default" ; + }; + RadioButton RBT_PAGESIZE + { + HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_PAGESIZE"; + Pos = MAP_APPFONT ( 136 , 97 ) ; + Size = MAP_APPFONT ( 110 , 10 ) ; + Text [ en-US ] = "~Fit to page" ; + TabStop = TRUE ; + }; + RadioButton RBT_PAGETILE + { + HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_PAGETILE"; + Pos = MAP_APPFONT ( 136 , 111 ) ; + Size = MAP_APPFONT ( 110 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Tile pages" ; + }; + RadioButton RBT_BOOKLET + { + HelpID = "sd:RadioButton:TP_PRINT_OPTIONS:RBT_BOOKLET"; + Pos = MAP_APPFONT ( 136, 125 ) ; + Size = MAP_APPFONT ( 110 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "B~rochure" ; + }; + CheckBox CBX_FRONT + { + HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_FRONT"; + Pos = MAP_APPFONT ( 145 , 139 ) ; + Size = MAP_APPFONT ( 53 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Fr~ont" ; + }; + CheckBox CBX_BACK + { + HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_BACK"; + Pos = MAP_APPFONT ( 202 , 139 ) ; + Size = MAP_APPFONT ( 50 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Ba~ck" ; + }; + CheckBox CBX_PAPERBIN + { + HelpID = "sd:CheckBox:TP_PRINT_OPTIONS:CBX_PAPERBIN"; + Pos = MAP_APPFONT ( 136 , 153 ) ; + Size = MAP_APPFONT ( 118 , 30 ) ; + Text [ en-US ] = "Paper tray from printer s~ettings" ; + WordBreak = TRUE ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/sdabstdlg.cxx b/sd/source/ui/dlg/sdabstdlg.cxx new file mode 100644 index 000000000000..e7e504bd5456 --- /dev/null +++ b/sd/source/ui/dlg/sdabstdlg.cxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "sdabstdlg.hxx" +#include "sduilib.hxx" + +#include <osl/module.hxx> +#include <tools/string.hxx> + +typedef SdAbstractDialogFactory* (__LOADONCALLAPI *SdFuncPtrCreateDialogFactory)(); + +extern "C" { static void SAL_CALL thisModule() {} } + +SdAbstractDialogFactory* SdAbstractDialogFactory::Create() +{ + SdFuncPtrCreateDialogFactory fp = 0; + static ::osl::Module aDialogLibrary; + if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( RTL_CONSTASCII_USTRINGPARAM( DLL_NAME ) ), + SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ) ) + fp = ( SdAbstractDialogFactory* (__LOADONCALLAPI*)() ) + aDialogLibrary.getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDialogFactory")) ); + if ( fp ) + return fp(); + return 0; +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx new file mode 100644 index 000000000000..bb1930c43b2a --- /dev/null +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -0,0 +1,566 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include <sfx2/objsh.hxx> +#include <tools/rc.hxx> +#include "sddlgfact.hxx" +#include "strings.hrc" +#include "BreakDlg.hxx" +#include "copydlg.hxx" +#include "custsdlg.hxx" +#include "dlg_char.hxx" +#include "dlgpage.hxx" +#include "dlgass.hxx" +#include "dlgfield.hxx" +#include "dlgsnap.hxx" +#include "layeroptionsdlg.hxx" +#include "ins_paste.hxx" +#include "inspagob.hxx" +#include "morphdlg.hxx" +#include "OutlineBulletDlg.hxx" +#include "paragr.hxx" +#include "present.hxx" +#include "prltempl.hxx" +#include "sdpreslt.hxx" +#include "tabtempl.hxx" +#include "tpaction.hxx" +#include "vectdlg.hxx" +#include "tpoption.hxx" +#include "prntopts.hxx" +#include "pubdlg.hxx" +#include "masterlayoutdlg.hxx" +#include "headerfooterdlg.hxx" + +IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractCopyDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractSdCustomShowDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); +IMPL_ABSTDLG_BASE(SdPresLayoutTemplateDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractAssistentDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractSdModifyFieldDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractSdSnapLineDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractSdInsertLayerDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractSdInsertPasteDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractSdInsertPagesObjsDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractMorphDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractSdStartPresDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractSdPresLayoutDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractSfxDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractSdVectorizeDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractSdPublishingDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractHeaderFooterDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractBulletDialog_Impl); + +//AbstractCopyDlg_Impl begin +void AbstractCopyDlg_Impl::GetAttr( SfxItemSet& rOutAttrs ) +{ + pDlg->GetAttr( rOutAttrs ); +} +// AbstractCopyDlg_Impl end + +//AbstractSdCustomShowDlg_Impl begin +sal_Bool AbstractSdCustomShowDlg_Impl::IsModified() const +{ + return pDlg->IsModified(); +} +sal_Bool AbstractSdCustomShowDlg_Impl::IsCustomShow() const +{ + return pDlg->IsCustomShow(); +} +// AbstractSdCustomShowDlg_Impl end + +// AbstractTabDialog_Impl begin +void AbstractTabDialog_Impl::SetCurPageId( sal_uInt16 nId ) +{ + pDlg->SetCurPageId( nId ); +} +const SfxItemSet* AbstractTabDialog_Impl::GetOutputItemSet() const +{ + return pDlg->GetOutputItemSet(); +} +const sal_uInt16* AbstractTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem ) +{ + return pDlg->GetInputRanges( pItem ); +} +void AbstractTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet ) +{ + pDlg->SetInputSet( pInSet ); +} +//From class Window. +void AbstractTabDialog_Impl::SetText( const XubString& rStr ) +{ + pDlg->SetText( rStr ); +} +String AbstractTabDialog_Impl::GetText() const +{ + return pDlg->GetText(); +} +//add for AbstractTabDialog_Impl end + +// -------------------------------------------------------------------- + +// AbstractBulletDialog_Impl begin +void AbstractBulletDialog_Impl::SetCurPageId( sal_uInt16 nId ) +{ + static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetCurPageId( nId ); +} +const SfxItemSet* AbstractBulletDialog_Impl::GetOutputItemSet() const +{ + return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetOutputItemSet(); +} +const sal_uInt16* AbstractBulletDialog_Impl::GetInputRanges(const SfxItemPool& pItem ) +{ + return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetInputRanges( pItem ); +} +void AbstractBulletDialog_Impl::SetInputSet( const SfxItemSet* pInSet ) +{ + static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetInputSet( pInSet ); +} +//From class Window. +void AbstractBulletDialog_Impl::SetText( const XubString& rStr ) +{ + static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetText( rStr ); +} +String AbstractBulletDialog_Impl::GetText() const +{ + return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetText(); +} +//add for AbstractBulletDialog_Impl end + +// -------------------------------------------------------------------- + +void SdPresLayoutTemplateDlg_Impl::SetCurPageId( sal_uInt16 nId ) +{ + pDlg->SetCurPageId( nId ); +} + +const SfxItemSet* SdPresLayoutTemplateDlg_Impl::GetOutputItemSet() const +{ + return pDlg->GetOutputItemSet(); +} + +const sal_uInt16* SdPresLayoutTemplateDlg_Impl::GetInputRanges(const SfxItemPool& pItem ) +{ + return pDlg->GetInputRanges( pItem ); +} + +void SdPresLayoutTemplateDlg_Impl::SetInputSet( const SfxItemSet* pInSet ) +{ + pDlg->SetInputSet( pInSet ); +} + +void SdPresLayoutTemplateDlg_Impl::SetText( const XubString& rStr ) +{ + pDlg->SetText( rStr ); +} + +String SdPresLayoutTemplateDlg_Impl::GetText() const +{ + return pDlg->GetText(); +} + +// -------------------------------------------------------------------- + +//AbstractAssistentDlg_Impl begin +SfxObjectShellLock AbstractAssistentDlg_Impl::GetDocument() +{ + return pDlg->GetDocument(); +} +OutputType AbstractAssistentDlg_Impl::GetOutputMedium() const +{ + return pDlg->GetOutputMedium(); +} +sal_Bool AbstractAssistentDlg_Impl::IsSummary() const +{ + return pDlg->IsSummary(); +} +StartType AbstractAssistentDlg_Impl::GetStartType() const +{ + return pDlg->GetStartType(); +} +String AbstractAssistentDlg_Impl::GetDocPath() const +{ + return pDlg->GetDocPath(); +} +sal_Bool AbstractAssistentDlg_Impl::GetStartWithFlag() const +{ + return pDlg->GetStartWithFlag(); +} +sal_Bool AbstractAssistentDlg_Impl::IsDocEmpty() const +{ + return pDlg->IsDocEmpty(); +} +String AbstractAssistentDlg_Impl::GetPassword() +{ + return pDlg->GetPassword(); +} +// AbstractAssistentDlg_Impl end + +//AbstractSdModifyFieldDlg_Impl begin +SvxFieldData* AbstractSdModifyFieldDlg_Impl::GetField() +{ + return pDlg->GetField(); +} +SfxItemSet AbstractSdModifyFieldDlg_Impl::GetItemSet() +{ + return pDlg->GetItemSet(); +} +// AbstractSdModifyFieldDlg_Impl end + +//AbstractSdSnapLineDlg_Impl begin +void AbstractSdSnapLineDlg_Impl::GetAttr(SfxItemSet& rOutAttrs) +{ + pDlg->GetAttr(rOutAttrs); +} +void AbstractSdSnapLineDlg_Impl::HideRadioGroup() +{ + pDlg->HideRadioGroup(); +} +void AbstractSdSnapLineDlg_Impl::HideDeleteBtn() +{ + pDlg->HideDeleteBtn(); +} +void AbstractSdSnapLineDlg_Impl::SetInputFields(sal_Bool bEnableX, sal_Bool bEnableY) +{ + pDlg->SetInputFields(bEnableX, bEnableY); +} +void AbstractSdSnapLineDlg_Impl::SetText( const XubString& rStr ) +{ + pDlg->SetText( rStr ); +} +// AbstractSdSnapLineDlg_Impl end + +//AbstractSdInsertLayerDlg_Impl begin +void AbstractSdInsertLayerDlg_Impl::GetAttr( SfxItemSet& rOutAttrs ) +{ + pDlg->GetAttr( rOutAttrs ); +} +void AbstractSdInsertLayerDlg_Impl::SetHelpId( const rtl::OString& rHelpId ) +{ + pDlg->SetHelpId( rHelpId ); +} +// AbstractSdInsertLayerDlg_Impl end + +//AbstractSdInsertPasteDlg_Impl begin +sal_Bool AbstractSdInsertPasteDlg_Impl::IsInsertBefore() const +{ + return pDlg->IsInsertBefore(); +} +// AbstractSdInsertPasteDlg_Impl end + +//AbstractSdInsertPagesObjsDlg_Impl begin +::Window* AbstractSdInsertPagesObjsDlg_Impl::GetWindow() +{ + return (::Window*)pDlg; +} +List* AbstractSdInsertPagesObjsDlg_Impl::GetList( sal_uInt16 nType ) +{ + return pDlg->GetList( nType ); +} +sal_Bool AbstractSdInsertPagesObjsDlg_Impl::IsLink() +{ + return pDlg->IsLink(); +} +sal_Bool AbstractSdInsertPagesObjsDlg_Impl::IsRemoveUnnessesaryMasterPages() const +{ + return pDlg->IsRemoveUnnessesaryMasterPages(); +} +// AbstractSdInsertPagesObjsDlg_Impl end + +//AbstractMorphDlg_Impl begin +void AbstractMorphDlg_Impl::SaveSettings() const +{ + pDlg->SaveSettings(); +} +sal_uInt16 AbstractMorphDlg_Impl::GetFadeSteps() const +{ + return pDlg->GetFadeSteps(); +} +sal_Bool AbstractMorphDlg_Impl::IsAttributeFade() const +{ + return pDlg->IsAttributeFade(); +} +sal_Bool AbstractMorphDlg_Impl::IsOrientationFade() const +{ + return pDlg->IsOrientationFade(); +} +// AbstractMorphDlg_Impl end + +//AbstractSdStartPresDlg_Impl begin +void AbstractSdStartPresDlg_Impl::GetAttr( SfxItemSet& rOutAttrs ) +{ + pDlg->GetAttr( rOutAttrs ); +} +// AbstractSdStartPresDlg_Impl end + +//AbstractSdPresLayoutDlg_Impl begin +void AbstractSdPresLayoutDlg_Impl::GetAttr( SfxItemSet& rOutAttrs ) +{ + pDlg->GetAttr( rOutAttrs ); +} +// AbstractSdPresLayoutDlg_Impl end + +//SfxAbstractDialog_Impl begin +const SfxItemSet* AbstractSfxDialog_Impl::GetOutputItemSet() const +{ + return pDlg->GetOutputItemSet(); +} +void AbstractSfxDialog_Impl::SetText( const XubString& rStr ) +{ + pDlg->SetText( rStr ); +} +String AbstractSfxDialog_Impl::GetText() const +{ + return pDlg->GetText(); +} + +//AbstractSfxSingleTabDialog_Impl end + +//AbstractSdVectorizeDlg_Impl begin +const GDIMetaFile& AbstractSdVectorizeDlg_Impl::GetGDIMetaFile() const +{ + return pDlg->GetGDIMetaFile(); +} +//AbstractSdVectorizeDlg_Impl end + +//AbstractSdPublishingDlg_Impl begin +void AbstractSdPublishingDlg_Impl::GetParameterSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rParams ) +{ + pDlg->GetParameterSequence( rParams ); +} +//AbstractSdPublishingDlg_Impl end + +//AbstractHeaderFooterDialog_Impl +void AbstractHeaderFooterDialog_Impl::ApplyToAll( TabPage* pPage ) +{ + pDlg->ApplyToAll( pPage ); +} + +void AbstractHeaderFooterDialog_Impl::Apply( TabPage* pPage ) +{ + pDlg->Apply( pPage ); +} + +void AbstractHeaderFooterDialog_Impl::Cancel( TabPage* pPage ) +{ + pDlg->Cancel( pPage ); +} +//AbstractHeaderFooterDialog_Impl + +//-------------- SdAbstractDialogFactory implementation-------------- + +//add for BreakDlg begin +VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateBreakDlg( + ::Window* pWindow, + ::sd::DrawView* pDrView, + ::sd::DrawDocShell* pShell, + sal_uLong nSumActionCount, + sal_uLong nObjCount ) //add for BreakDlg +{ + return new VclAbstractDialog_Impl( new ::sd::BreakDlg( pWindow, pDrView, pShell, nSumActionCount, nObjCount ) ); +} +//add for BreakDlg end + +//add for CopyDlg begin +AbstractCopyDlg * SdAbstractDialogFactory_Impl::CreateCopyDlg( + ::Window* pWindow, const SfxItemSet& rInAttrs, + XColorTable* pColTab, ::sd::View* pView ) //add for CopyDlg +{ + return new AbstractCopyDlg_Impl( new ::sd::CopyDlg( pWindow, rInAttrs, pColTab, pView ) ); +} +//add for CopyDlg end + +//add for SdCustomShowDlg begin +AbstractSdCustomShowDlg * SdAbstractDialogFactory_Impl::CreateSdCustomShowDlg( ::Window* pWindow, SdDrawDocument& rDrawDoc ) //add for SdCustomShowDlg +{ + return new AbstractSdCustomShowDlg_Impl( new SdCustomShowDlg( pWindow, rDrawDoc ) ); +} +//add for SdCustomShowDlg end + +// add for SdCharDlg begin +SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabCharDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell ) +{ + return new AbstractTabDialog_Impl( new SdCharDlg( pParent, pAttr, pDocShell ) ); +} + + +SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabPageDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, sal_Bool bAreaPage ) +{ + return new AbstractTabDialog_Impl( new SdPageDlg( pDocShell, pParent, pAttr, bAreaPage ) ); +} +// add for SdCharDlg end + +//add for AssistentDlg begin +AbstractAssistentDlg * SdAbstractDialogFactory_Impl::CreateAssistentDlg( ::Window* pParent, sal_Bool bAutoPilot) +{ + return new AbstractAssistentDlg_Impl( new AssistentDlg( pParent, bAutoPilot ) ); +} +//add for AssistentDlg end + +//add for SdModifyFieldDlg begin +AbstractSdModifyFieldDlg * SdAbstractDialogFactory_Impl::CreateSdModifyFieldDlg( ::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ) +{ + return new AbstractSdModifyFieldDlg_Impl( new SdModifyFieldDlg( pWindow, pInField, rSet ) ); +} +//add for SdModifyFieldDlg end + +//add for SdSnapLineDlg begin +AbstractSdSnapLineDlg * SdAbstractDialogFactory_Impl::CreateSdSnapLineDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView) +{ + return new AbstractSdSnapLineDlg_Impl( new SdSnapLineDlg( pWindow, rInAttrs, pView ) ); +} +//add for SdSnapLineDlg end + +//add for SdInsertLayerDlg begin +AbstractSdInsertLayerDlg * SdAbstractDialogFactory_Impl::CreateSdInsertLayerDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, String aStr ) //add for SdInsertLayerDlg +{ + return new AbstractSdInsertLayerDlg_Impl( new SdInsertLayerDlg( pWindow, rInAttrs, bDeletable, aStr ) ); +} +//add for SdInsertLayerDlg end + +//add for SdInsertPasteDlg begin +AbstractSdInsertPasteDlg * SdAbstractDialogFactory_Impl::CreateSdInsertPasteDlg( ::Window* pWindow ) +{ + return new AbstractSdInsertPasteDlg_Impl( new SdInsertPasteDlg( pWindow ) ); +} +//add for SdInsertPasteDlg end + +//add for SdInsertPagesObjsDlg begin +AbstractSdInsertPagesObjsDlg * SdAbstractDialogFactory_Impl::CreateSdInsertPagesObjsDlg( ::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const String& rFileName ) +{ + return new AbstractSdInsertPagesObjsDlg_Impl( new SdInsertPagesObjsDlg( pParent, pDoc, pSfxMedium, rFileName ) ); +} +//add for SdInsertPagesObjsDlg end + +//add for MorphDlg begin +AbstractMorphDlg * SdAbstractDialogFactory_Impl::CreateMorphDlg( ::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) +{ + return new AbstractMorphDlg_Impl( new ::sd::MorphDlg( pParent, pObj1, pObj2 ) ); +} +//add for MorphDlg end + +// add for OutlineBulletDlg begin +SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdOutlineBulletTabDlg( ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView ) +{ + return new AbstractBulletDialog_Impl( new ::sd::OutlineBulletDlg( pParent, pAttr, pView ) ); +} + +SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdParagraphTabDlg( ::Window* pParent, const SfxItemSet* pAttr ) +{ + return new AbstractTabDialog_Impl( new SdParagraphDlg( pParent, pAttr ) ); +} +// add for OutlineBulletDlg end + +// add for SdStartPresentationDlg begin +AbstractSdStartPresDlg * SdAbstractDialogFactory_Impl::CreateSdStartPresentationDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, List& rPageNames, List* pCSList ) +{ + return new AbstractSdStartPresDlg_Impl( new SdStartPresentationDlg( pWindow, rInAttrs, rPageNames, pCSList ) ); +} +// add for SdStartPresentationDlg end + +// add for SdPresLayoutTemplateDlg begin +SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, ::Window* pParent, SdResId DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool ) +{ + return new SdPresLayoutTemplateDlg_Impl( new SdPresLayoutTemplateDlg( pDocSh, pParent, DlgId, rStyleBase, ePO, pSSPool ) ); +} + +// add for SdPresLayoutDlg begin +AbstractSdPresLayoutDlg * SdAbstractDialogFactory_Impl::CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, ::sd::ViewShell* pViewShell, ::Window* pWindow, const SfxItemSet& rInAttrs) +{ + return new AbstractSdPresLayoutDlg_Impl( new SdPresLayoutDlg( pDocShell, pViewShell, pWindow, rInAttrs ) ); +} +// add for SdPresLayoutDlg end + +// add for SdTabTemplateDlg begin +SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabTemplateDlg( ::Window* pParent, const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView ) +{ + return new AbstractTabDialog_Impl( new SdTabTemplateDlg( pParent, pDocShell, rStyleBase, pModel, pView ) ); +} +// add for SdTabTemplateDlg end + +SfxAbstractDialog* SdAbstractDialogFactory_Impl::CreatSdActionDialog( ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView ) +{ + return new AbstractSfxDialog_Impl( new SdActionDlg( pParent, pAttr, pView ) ); +} + +// add for SdVectorizeDlg begin +AbstractSdVectorizeDlg * SdAbstractDialogFactory_Impl::CreateSdVectorizeDlg( ::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ) +{ + return new AbstractSdVectorizeDlg_Impl( new SdVectorizeDlg( pParent, rBmp, pDocShell ) ); +} +// add for SdVectorizeDlg end + +// add for SdPublishingDlg begin +AbstractSdPublishingDlg * SdAbstractDialogFactory_Impl::CreateSdPublishingDlg( ::Window* pWindow, DocumentType eDocType) +{ + return new AbstractSdPublishingDlg_Impl( new SdPublishingDlg( pWindow, eDocType ) ); +} +// add for SdPublishingDlg end + +// Factories for TabPages +CreateTabPage SdAbstractDialogFactory_Impl::GetSdOptionsContentsTabPageCreatorFunc() +{ + return SdTpOptionsContents::Create; +} + +CreateTabPage SdAbstractDialogFactory_Impl::GetSdPrintOptionsTabPageCreatorFunc() +{ + return SdPrintOptions::Create; +} + +CreateTabPage SdAbstractDialogFactory_Impl::GetSdOptionsMiscTabPageCreatorFunc() +{ + return SdTpOptionsMisc::Create; +} + +CreateTabPage SdAbstractDialogFactory_Impl::GetSdOptionsSnapTabPageCreatorFunc() +{ + return SdTpOptionsSnap::Create; +} + +VclAbstractDialog* SdAbstractDialogFactory_Impl::CreateMasterLayoutDialog( ::Window* pParent, + SdDrawDocument* pDoc, SdPage* pCurrentPage ) +{ + return new VclAbstractDialog_Impl( new ::sd::MasterLayoutDialog( pParent, pDoc, pCurrentPage )); +} + +AbstractHeaderFooterDialog* SdAbstractDialogFactory_Impl::CreateHeaderFooterDialog( ViewShell* pViewShell, + ::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage ) +{ + return new AbstractHeaderFooterDialog_Impl( new ::sd::HeaderFooterDialog( (::sd::ViewShell*)pViewShell, pParent, pDoc, pCurrentPage )); +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx new file mode 100644 index 000000000000..5ff7effcbc33 --- /dev/null +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -0,0 +1,302 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _SD_DLGFACT_HXX +#define _SD_DLGFACT_HXX + +// include --------------------------------------------------------------- +#include "sdabstdlg.hxx" +#include <sfx2/basedlgs.hxx> + +#define DECL_ABSTDLG_BASE(Class,DialogClass) \ + DialogClass* pDlg; \ +public: \ + Class( DialogClass* p) \ + : pDlg(p) \ + {} \ + virtual ~Class(); \ + virtual short Execute() ; + +#define IMPL_ABSTDLG_BASE(Class) \ +Class::~Class() \ +{ \ + delete pDlg; \ +} \ +short Class::Execute() \ +{ \ + return pDlg->Execute(); \ +} + +namespace sd { + class MorphDlg; + class CopyDlg; + class BreakDlg; + class OutlineBulletDlg; + class HeaderFooterDialog; +} +// add for BreakDlg +class Dialog; +class VclAbstractDialog_Impl : public VclAbstractDialog +{ + DECL_ABSTDLG_BASE(VclAbstractDialog_Impl,Dialog) +}; + +// add for CopyDlg + +class AbstractCopyDlg_Impl : public AbstractCopyDlg +{ + DECL_ABSTDLG_BASE(AbstractCopyDlg_Impl,::sd::CopyDlg) + virtual void GetAttr( SfxItemSet& rOutAttrs ); +}; + +// add for SdCustomShowDlg +class SdCustomShowDlg; +class AbstractSdCustomShowDlg_Impl : public AbstractSdCustomShowDlg +{ + DECL_ABSTDLG_BASE(AbstractSdCustomShowDlg_Impl,SdCustomShowDlg) + virtual sal_Bool IsModified() const ; + virtual sal_Bool IsCustomShow() const ; +}; + +//add for SdCharDlg begin +class SfxTabDialog; +class AbstractTabDialog_Impl : public SfxAbstractTabDialog +{ + DECL_ABSTDLG_BASE( AbstractTabDialog_Impl,SfxTabDialog ) + virtual void SetCurPageId( sal_uInt16 nId ); + virtual const SfxItemSet* GetOutputItemSet() const; + virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ); + virtual void SetInputSet( const SfxItemSet* pInSet ); + //From class Window. + virtual void SetText( const XubString& rStr ); + virtual String GetText() const; +}; +//add for SdCharDlg end + + +//add for OutlineBulletDlg begin +class SfxTabDialog; +class AbstractBulletDialog_Impl : public SfxAbstractTabDialog +{ + DECL_ABSTDLG_BASE( AbstractBulletDialog_Impl,SfxTabDialog ) + virtual void SetCurPageId( sal_uInt16 nId ); + virtual const SfxItemSet* GetOutputItemSet() const; + virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ); + virtual void SetInputSet( const SfxItemSet* pInSet ); + //From class Window. + virtual void SetText( const XubString& rStr ); + virtual String GetText() const; +}; +//add for OutlineBulletDlg end + +class SdPresLayoutTemplateDlg; +class SdPresLayoutTemplateDlg_Impl : public SfxAbstractTabDialog +{ + DECL_ABSTDLG_BASE( SdPresLayoutTemplateDlg_Impl,SdPresLayoutTemplateDlg ) + virtual void SetCurPageId( sal_uInt16 nId ); + virtual const SfxItemSet* GetOutputItemSet() const; + virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ); + virtual void SetInputSet( const SfxItemSet* pInSet ); + //From class Window. + virtual void SetText( const XubString& rStr ); + virtual String GetText() const; +}; + +// add for AssistentDlg +class AssistentDlg; +class AbstractAssistentDlg_Impl : public AbstractAssistentDlg +{ + DECL_ABSTDLG_BASE(AbstractAssistentDlg_Impl,AssistentDlg) + virtual SfxObjectShellLock GetDocument(); + virtual OutputType GetOutputMedium() const; + virtual sal_Bool IsSummary() const; + virtual StartType GetStartType() const; + virtual String GetDocPath() const; + virtual sal_Bool GetStartWithFlag() const; + virtual sal_Bool IsDocEmpty() const; + virtual String GetPassword(); +}; + +// add for SdModifyFieldDlg +class SdModifyFieldDlg; +class AbstractSdModifyFieldDlg_Impl : public AbstractSdModifyFieldDlg +{ + DECL_ABSTDLG_BASE(AbstractSdModifyFieldDlg_Impl,SdModifyFieldDlg) + virtual SvxFieldData* GetField(); + virtual SfxItemSet GetItemSet(); +}; + +// add for SdSnapLineDlg +class SdSnapLineDlg; +class AbstractSdSnapLineDlg_Impl : public AbstractSdSnapLineDlg +{ + DECL_ABSTDLG_BASE(AbstractSdSnapLineDlg_Impl,SdSnapLineDlg) + virtual void GetAttr(SfxItemSet& rOutAttrs); + virtual void HideRadioGroup(); + virtual void HideDeleteBtn(); + virtual void SetInputFields(sal_Bool bEnableX, sal_Bool bEnableY); + //from class Window + virtual void SetText( const XubString& rStr ); +}; + +// add for SdInsertLayerDlg +class SdInsertLayerDlg; +class AbstractSdInsertLayerDlg_Impl : public AbstractSdInsertLayerDlg +{ + DECL_ABSTDLG_BASE(AbstractSdInsertLayerDlg_Impl,SdInsertLayerDlg) + virtual void GetAttr( SfxItemSet& rOutAttrs ) ; + //from class Window + virtual void SetHelpId( const rtl::OString& rHelpId ) ; +}; + +// add for SdInsertPasteDlg +class SdInsertPasteDlg; +class AbstractSdInsertPasteDlg_Impl : public AbstractSdInsertPasteDlg +{ + DECL_ABSTDLG_BASE(AbstractSdInsertPasteDlg_Impl,SdInsertPasteDlg) + virtual sal_Bool IsInsertBefore() const; +}; + +// add for SdInsertPagesObjsDlg +class SdInsertPagesObjsDlg; +class AbstractSdInsertPagesObjsDlg_Impl : public AbstractSdInsertPagesObjsDlg +{ + DECL_ABSTDLG_BASE(AbstractSdInsertPagesObjsDlg_Impl,SdInsertPagesObjsDlg) + virtual ::Window * GetWindow(); //this method is added for return a Window type pointer + virtual List* GetList( sal_uInt16 nType ); + virtual sal_Bool IsLink(); + virtual sal_Bool IsRemoveUnnessesaryMasterPages() const; +}; + +// add for MorphDlg +class AbstractMorphDlg_Impl : public AbstractMorphDlg +{ + DECL_ABSTDLG_BASE(AbstractMorphDlg_Impl,::sd::MorphDlg) + virtual void SaveSettings() const; + virtual sal_uInt16 GetFadeSteps() const; + virtual sal_Bool IsAttributeFade() const ; + virtual sal_Bool IsOrientationFade() const ; +}; + +// add for SdStartPresentationDlg +class SdStartPresentationDlg; +class AbstractSdStartPresDlg_Impl : public AbstractSdStartPresDlg +{ + DECL_ABSTDLG_BASE(AbstractSdStartPresDlg_Impl,SdStartPresentationDlg) + virtual void GetAttr( SfxItemSet& rOutAttrs ); +}; + +// add for SdPresLayoutDlg +class SdPresLayoutDlg; +class AbstractSdPresLayoutDlg_Impl : public AbstractSdPresLayoutDlg +{ + DECL_ABSTDLG_BASE(AbstractSdPresLayoutDlg_Impl,SdPresLayoutDlg) + virtual void GetAttr(SfxItemSet& rOutAttrs); +}; + +// add for SdActionDlg +class SfxSingleTabDialog; +class AbstractSfxDialog_Impl : public SfxAbstractDialog +{ + DECL_ABSTDLG_BASE(AbstractSfxDialog_Impl,SfxModalDialog) + virtual const SfxItemSet* GetOutputItemSet() const; + virtual void SetText( const XubString& rStr ); + virtual String GetText() const; +}; + +// add for SdVectorizeDlg +class SdVectorizeDlg; +class AbstractSdVectorizeDlg_Impl :public AbstractSdVectorizeDlg +{ + DECL_ABSTDLG_BASE(AbstractSdVectorizeDlg_Impl,SdVectorizeDlg) + virtual const GDIMetaFile& GetGDIMetaFile() const ; +}; + +// add for SdPublishingDlg +class SdPublishingDlg; +class AbstractSdPublishingDlg_Impl :public AbstractSdPublishingDlg +{ + DECL_ABSTDLG_BASE(AbstractSdPublishingDlg_Impl,SdPublishingDlg) + virtual void GetParameterSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rParams ); +}; + +// add for HeaderFooterDialog +class AbstractHeaderFooterDialog_Impl :public AbstractHeaderFooterDialog +{ + DECL_ABSTDLG_BASE(AbstractHeaderFooterDialog_Impl,::sd::HeaderFooterDialog) + virtual void ApplyToAll( TabPage* pPage ); + virtual void Apply( TabPage* pPage ); + virtual void Cancel( TabPage* pPage ); +}; + +//------------------------------------------------------------------------ +//AbstractDialogFactory_Impl implementations +class SdAbstractDialogFactory_Impl : public SdAbstractDialogFactory +{ + +public: + virtual VclAbstractDialog* CreateBreakDlg(::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount ); + virtual AbstractCopyDlg* CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, XColorTable* pColTab, ::sd::View* pView ); + virtual AbstractSdCustomShowDlg* CreateSdCustomShowDlg( ::Window* pWindow, SdDrawDocument& rDrawDoc ); + virtual SfxAbstractTabDialog* CreateSdTabCharDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell ); + virtual SfxAbstractTabDialog* CreateSdTabPageDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, sal_Bool bAreaPage = sal_True ); + virtual AbstractAssistentDlg* CreateAssistentDlg( ::Window* pParent, sal_Bool bAutoPilot); + virtual AbstractSdModifyFieldDlg* CreateSdModifyFieldDlg( ::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ); + virtual AbstractSdSnapLineDlg* CreateSdSnapLineDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView); + virtual AbstractSdInsertLayerDlg* CreateSdInsertLayerDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, String aStr ); + virtual AbstractSdInsertPasteDlg* CreateSdInsertPasteDlg( ::Window* pWindow ); + virtual AbstractSdInsertPagesObjsDlg* CreateSdInsertPagesObjsDlg( ::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const String& rFileName ); + virtual AbstractMorphDlg* CreateMorphDlg( ::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2); + virtual SfxAbstractTabDialog* CreateSdOutlineBulletTabDlg ( ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView = NULL ); + virtual SfxAbstractTabDialog* CreateSdParagraphTabDlg ( ::Window* pParent, const SfxItemSet* pAttr ); + virtual AbstractSdStartPresDlg* CreateSdStartPresentationDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, List& rPageNames, List* pCSList ); + virtual SfxAbstractTabDialog* CreateSdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, ::Window* pParent, SdResId DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool ); + virtual AbstractSdPresLayoutDlg* CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, ::sd::ViewShell* pViewShell, ::Window* pWindow, const SfxItemSet& rInAttrs); + virtual SfxAbstractTabDialog* CreateSdTabTemplateDlg( ::Window* pParent, const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView ); + virtual SfxAbstractDialog* CreatSdActionDialog( ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView ); + virtual AbstractSdVectorizeDlg* CreateSdVectorizeDlg( ::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ); + virtual AbstractSdPublishingDlg* CreateSdPublishingDlg( ::Window* pWindow, DocumentType eDocType); + + virtual VclAbstractDialog* CreateMasterLayoutDialog( ::Window* pParent, + SdDrawDocument* pDoc, + SdPage* ); // add for MasterLayoutDialog + + virtual AbstractHeaderFooterDialog* CreateHeaderFooterDialog( ViewShell* pViewShell, + ::Window* pParent, + SdDrawDocument* pDoc, + SdPage* pCurrentPage ); // add for HeaderFooterDialog + + // For TabPage + virtual CreateTabPage GetSdOptionsContentsTabPageCreatorFunc(); + virtual CreateTabPage GetSdPrintOptionsTabPageCreatorFunc(); + virtual CreateTabPage GetSdOptionsMiscTabPageCreatorFunc(); + virtual CreateTabPage GetSdOptionsSnapTabPageCreatorFunc(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/sdpreslt.cxx b/sd/source/ui/dlg/sdpreslt.cxx new file mode 100644 index 000000000000..f02c915c5339 --- /dev/null +++ b/sd/source/ui/dlg/sdpreslt.cxx @@ -0,0 +1,351 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + + +#include <svl/itemset.hxx> +#include <sfx2/new.hxx> +#include <vcl/msgbox.hxx> + +#include "strings.hrc" +#include "res_bmp.hrc" +#include "sdpreslt.hxx" +#include "sdpreslt.hrc" +#include "sdattr.hxx" +#include "sdresid.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "DrawDocShell.hxx" +#include "ViewShell.hxx" + +#define DOCUMENT_TOKEN (sal_Unicode('#')) + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +SdPresLayoutDlg::SdPresLayoutDlg( + ::sd::DrawDocShell* pDocShell, + ::sd::ViewShell* pViewShell, + ::Window* pWindow, + const SfxItemSet& rInAttrs ): + ModalDialog (pWindow, SdResId(DLG_PRESLT)), + mpDocSh ( pDocShell ), + mpViewSh ( pViewShell ), + maFtLayout (this, SdResId(FT_LAYOUT)), + maVS (this, SdResId(VS_LAYOUT)), + maBtnOK (this, SdResId(BTN_OK)), + maBtnCancel (this, SdResId(BTN_CANCEL)), + maBtnHelp (this, SdResId(BTN_HELP)), + maCbxMasterPage (this, SdResId(CBX_MASTER_PAGE)), + maCbxCheckMasters (this, SdResId(CBX_CHECK_MASTERS)), + maBtnLoad (this, SdResId(BTN_LOAD)), + mrOutAttrs (rInAttrs), + maStrNone ( SdResId( STR_NULL ) ) +{ + FreeResource(); + + mpLayoutNames = new List; + + maVS.SetDoubleClickHdl(LINK(this, SdPresLayoutDlg, ClickLayoutHdl)); + maBtnLoad.SetClickHdl(LINK(this, SdPresLayoutDlg, ClickLoadHdl)); + + Reset(); +} + +/************************************************************************* +|* +|* Dtor +|* +*************************************************************************/ + +SdPresLayoutDlg::~SdPresLayoutDlg() +{ + String* pName = (String*)mpLayoutNames->First(); + while (pName) + { + delete pName; + pName = (String*)mpLayoutNames->Next(); + } + + delete mpLayoutNames; +} + +/************************************************************************* +|* +|* Initialisierung +|* +*************************************************************************/ + +void SdPresLayoutDlg::Reset() +{ + const SfxPoolItem *pPoolItem = NULL; + long nName; + + // MasterPage austauschen + if( mrOutAttrs.GetItemState( ATTR_PRESLAYOUT_MASTER_PAGE, sal_False, &pPoolItem ) == SFX_ITEM_SET ) + { + sal_Bool bMasterPage = ( (const SfxBoolItem*) pPoolItem)->GetValue(); + maCbxMasterPage.Enable( !bMasterPage ); + maCbxMasterPage.Check( bMasterPage ); + } + + // Nicht verwendete MasterPages entfernen + maCbxCheckMasters.Check(sal_False); + + if(mrOutAttrs.GetItemState(ATTR_PRESLAYOUT_NAME, sal_True, &pPoolItem) == SFX_ITEM_SET) + maName = ((const SfxStringItem*)pPoolItem)->GetValue(); + else + maName.Erase(); + + FillValueSet(); + + mnLayoutCount = mpLayoutNames->Count(); + for( nName = 0; nName < mnLayoutCount; nName++ ) + { + if (*((String*)mpLayoutNames->GetObject(nName)) == maName) + break; + } + DBG_ASSERT(nName < mnLayoutCount, "Layout nicht gefunden"); + + maVS.SelectItem((sal_uInt16)nName + 1); // Inizes des ValueSets beginnen bei 1 + +} + +/************************************************************************* +|* +|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen +|* +*************************************************************************/ + +void SdPresLayoutDlg::GetAttr(SfxItemSet& rOutAttrs) +{ + short nId = maVS.GetSelectItemId(); + sal_Bool bLoad = nId > mnLayoutCount; + rOutAttrs.Put( SfxBoolItem( ATTR_PRESLAYOUT_LOAD, bLoad ) ); + + String aLayoutName; + + if( bLoad ) + { + aLayoutName = maName; + aLayoutName.Append( DOCUMENT_TOKEN ); + aLayoutName.Append( *(String*)mpLayoutNames->GetObject( nId - 1 ) ); + } + else + { + aLayoutName = *(String*)mpLayoutNames->GetObject( nId - 1 ); + if( aLayoutName == maStrNone ) + aLayoutName.Erase(); // so wird "- keine -" codiert (s.u.) + } + + rOutAttrs.Put( SfxStringItem( ATTR_PRESLAYOUT_NAME, aLayoutName ) ); + rOutAttrs.Put( SfxBoolItem( ATTR_PRESLAYOUT_MASTER_PAGE, maCbxMasterPage.IsChecked() ) ); + rOutAttrs.Put( SfxBoolItem( ATTR_PRESLAYOUT_CHECK_MASTERS, maCbxCheckMasters.IsChecked() ) ); +} + + +/************************************************************************* +|* +|* Fuellt das ValueSet mit Bitmaps +|* +\************************************************************************/ + +void SdPresLayoutDlg::FillValueSet() +{ + maVS.SetStyle(maVS.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER + | WB_VSCROLL | WB_NAMEFIELD); + + maVS.SetColCount(2); + maVS.SetLineCount(2); + maVS.SetExtraSpacing(2); + + SdDrawDocument* pDoc = mpDocSh->GetDoc(); + + sal_uInt16 nCount = pDoc->GetMasterPageCount(); + + for (sal_uInt16 nLayout = 0; nLayout < nCount; nLayout++) + { + SdPage* pMaster = (SdPage*)pDoc->GetMasterPage(nLayout); + if (pMaster->GetPageKind() == PK_STANDARD) + { + String aLayoutName(pMaster->GetLayoutName()); + aLayoutName.Erase( aLayoutName.SearchAscii( SD_LT_SEPARATOR ) ); + mpLayoutNames->Insert(new String(aLayoutName), LIST_APPEND); + + Bitmap aBitmap(mpDocSh->GetPagePreviewBitmap(pMaster, 90)); + maVS.InsertItem((sal_uInt16)mpLayoutNames->Count(), aBitmap, aLayoutName); + } + } + + maVS.Show(); +} + + +/************************************************************************* +|* +|* Doppelklick-Handler +|* +\************************************************************************/ + +IMPL_LINK(SdPresLayoutDlg, ClickLayoutHdl, void *, EMPTYARG) +{ + EndDialog(RET_OK); + return 0; +} + +/************************************************************************* +|* +|* Klick-Handler fuer Laden-Button +|* +\************************************************************************/ + +IMPL_LINK(SdPresLayoutDlg, ClickLoadHdl, void *, EMPTYARG) +{ + SfxNewFileDialog* pDlg = new SfxNewFileDialog(this, SFXWB_PREVIEW); + pDlg->SetText(String(SdResId(STR_LOAD_PRESENTATION_LAYOUT))); + + if(!IsReallyVisible()) + { + delete pDlg; + return 0; + } + + sal_uInt16 nResult = pDlg->Execute(); + // Inserted update to force repaint + Update(); + + String aFile; + sal_Bool bCancel = sal_False; + + switch (nResult) + { + case RET_OK: + { + if (pDlg->IsTemplate()) + { + maName = pDlg->GetTemplateFileName(); + } + else + { + // so wird "- keine -" codiert + maName.Erase(); + } + } + break; + + default: + bCancel = sal_True; + } + delete pDlg; + + if( !bCancel ) + { + // Pruefen, ob Vorlage schon vorhanden + sal_Bool bExists = sal_False; + String* pName = (String*)mpLayoutNames->First(); + String aCompareStr( maName ); + if( maName.Len() == 0 ) + aCompareStr = maStrNone; + + while( pName && !bExists ) + { + if( aCompareStr == *pName ) + { + bExists = sal_True; + // Vorlage selektieren + sal_uInt16 nId = (sal_uInt16) mpLayoutNames->GetCurPos() + 1; + maVS.SelectItem( nId ); + } + pName = (String*)mpLayoutNames->Next(); + } + + if( !bExists ) + { + // Dokument laden um Preview-Bitmap zu ermitteln (wenn Vorlage ausgewaehlt) + if( maName.Len() ) + { + // Dokument ermitteln, um OpenBookmarkDoc rufen zu koennen + SdDrawDocument* pDoc = mpDocSh->GetDoc(); + SdDrawDocument* pTemplDoc = pDoc->OpenBookmarkDoc( maName ); + + if (pTemplDoc) + { + ::sd::DrawDocShell* pTemplDocSh= pTemplDoc->GetDocSh(); + + sal_uInt16 nCount = pTemplDoc->GetMasterPageCount(); + + for (sal_uInt16 nLayout = 0; nLayout < nCount; nLayout++) + { + SdPage* pMaster = (SdPage*) pTemplDoc->GetMasterPage(nLayout); + if (pMaster->GetPageKind() == PK_STANDARD) + { + String aLayoutName(pMaster->GetLayoutName()); + aLayoutName.Erase( aLayoutName.SearchAscii( SD_LT_SEPARATOR ) ); + mpLayoutNames->Insert(new String(aLayoutName), LIST_APPEND); + + Bitmap aBitmap(pTemplDocSh->GetPagePreviewBitmap(pMaster, 90)); + maVS.InsertItem((sal_uInt16)mpLayoutNames->Count(), aBitmap, aLayoutName); + } + } + } + else + { + bCancel = sal_True; + } + + pDoc->CloseBookmarkDoc(); + } + else + { + // leeres Layout + mpLayoutNames->Insert( new String( maStrNone ), LIST_APPEND ); + maVS.InsertItem( (sal_uInt16) mpLayoutNames->Count(), + Bitmap( SdResId( BMP_FOIL_NONE ) ), maStrNone ); + } + + if (!bCancel) + { + // Vorlage selektieren + maVS.SelectItem( (sal_uInt16) mpLayoutNames->Count() ); + } + } + } + + return( 0 ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/sdpreslt.src b/sd/source/ui/dlg/sdpreslt.src new file mode 100644 index 000000000000..8ec56c9a320b --- /dev/null +++ b/sd/source/ui/dlg/sdpreslt.src @@ -0,0 +1,128 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "app.hrc" +#include "sdpreslt.hrc" +#include "sdcommands.h" + +ModalDialog DLG_PRESLT +{ + HelpID = CMD_SID_PRESENTATION_LAYOUT ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 212 , 185 ) ; + Moveable = TRUE ; + FixedText FT_LAYOUT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 110 , 10 ) ; + Text [ en-US ] = "~Select a slide design" ; + }; + Control VS_LAYOUT + { + Border = TRUE ; + Hide = TRUE ; + Pos = MAP_APPFONT ( 6 , 14 ) ; + Size = MAP_APPFONT ( 144 , 141 ) ; + TabStop = TRUE ; + }; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 156 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 156 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + CheckBox CBX_MASTER_PAGE + { + HelpID = "sd:CheckBox:DLG_PRESLT:CBX_MASTER_PAGE"; + Pos = MAP_APPFONT ( 6 , 158 ) ; + Size = MAP_APPFONT ( 120 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Exchange background page" ; + }; + CheckBox CBX_CHECK_MASTERS + { + HelpID = "sd:CheckBox:DLG_PRESLT:CBX_CHECK_MASTERS"; + Pos = MAP_APPFONT ( 6 , 170 ) ; + Size = MAP_APPFONT ( 140 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Delete unused backgrounds"; + }; + PushButton BTN_LOAD + { + HelpID = "sd:PushButton:DLG_PRESLT:BTN_LOAD"; + Pos = MAP_APPFONT ( 156 , 155 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Load..." ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 156 , 53 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + Text [ en-US ] = "Slide Design" ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx new file mode 100644 index 000000000000..a892577516c9 --- /dev/null +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -0,0 +1,1404 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include <sal/types.h> +#include <sot/formats.hxx> +#include <sot/storage.hxx> +#include <vcl/msgbox.hxx> +#include <svl/urihelper.hxx> +#include <svx/svditer.hxx> +#include <sfx2/docfile.hxx> +#include <svx/svdoole2.hxx> +#include <vcl/svapp.hxx> +#include "cusshow.hxx" +#include <sfx2/childwin.hxx> + +#include <sfx2/viewfrm.hxx> + +#include "strmname.h" +#include "sdtreelb.hxx" +#include "DrawDocShell.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "sdresid.hxx" +#include "navigatr.hxx" +#include "strings.hrc" +#include "res_bmp.hrc" + +#include <com/sun/star/embed/XEmbedPersist.hpp> +#include <svtools/embedtransfer.hxx> +#include <tools/diagnose_ex.h> +#include <ViewShell.hxx> + +using namespace com::sun::star; + +class SdPageObjsTLB::IconProvider +{ +public: + IconProvider (void); + + // Regular icons. + Image maImgPage; + Image maImgPageExcl; + Image maImgPageObjsExcl; + Image maImgPageObjs; + Image maImgObjects; + Image maImgGroup; +}; + + +sal_Bool SD_DLLPRIVATE SdPageObjsTLB::bIsInDrag = sal_False; + +sal_Bool SdPageObjsTLB::IsInDrag() +{ + return bIsInDrag; +} + +sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::mnListBoxDropFormatId = SAL_MAX_UINT32; + +// ----------------------------------------- +// - SdPageObjsTLB::SdPageObjsTransferable - +// ----------------------------------------- + +SdPageObjsTLB::SdPageObjsTransferable::SdPageObjsTransferable( + SdPageObjsTLB& rParent, + const INetBookmark& rBookmark, + ::sd::DrawDocShell& rDocShell, + NavigatorDragType eDragType, + const ::com::sun::star::uno::Any& rTreeListBoxData ) + : SdTransferable(rDocShell.GetDoc(), NULL, sal_True), + mrParent( rParent ), + maBookmark( rBookmark ), + mrDocShell( rDocShell ), + meDragType( eDragType ), + maTreeListBoxData( rTreeListBoxData ) +{ +} + + + + +SdPageObjsTLB::SdPageObjsTransferable::~SdPageObjsTransferable() +{ +} + +// ----------------------------------------------------------------------------- + +void SdPageObjsTLB::SdPageObjsTransferable::AddSupportedFormats() +{ + AddFormat(SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK); + AddFormat(SOT_FORMATSTR_ID_TREELISTBOX); + AddFormat(GetListBoxDropFormatId()); +} + +// ----------------------------------------------------------------------------- + +sal_Bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) +{ + sal_uLong nFormatId = SotExchange::GetFormat( rFlavor ); + switch (nFormatId) + { + case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK: + SetINetBookmark( maBookmark, rFlavor ); + return sal_True; + + case SOT_FORMATSTR_ID_TREELISTBOX: + SetAny(maTreeListBoxData, rFlavor); + return sal_True; + + default: + return sal_False; + } +} + +// ----------------------------------------------------------------------------- + +void SdPageObjsTLB::SdPageObjsTransferable::DragFinished( sal_Int8 nDropAction ) +{ + mrParent.OnDragFinished( nDropAction ); +} + +// ----------------------------------------------------------------------------- + +::sd::DrawDocShell& SdPageObjsTLB::SdPageObjsTransferable::GetDocShell() const +{ + return mrDocShell; +} + +// ----------------------------------------------------------------------------- + +NavigatorDragType SdPageObjsTLB::SdPageObjsTransferable::GetDragType() const +{ + return meDragType; +} + +// ----------------------------------------------------------------------------- + +sal_Int64 SAL_CALL SdPageObjsTLB::SdPageObjsTransferable::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException ) +{ + sal_Int64 nRet; + + if( ( rId.getLength() == 16 ) && + ( 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + { + nRet = (sal_Int64)(sal_IntPtr)this; + } + else + nRet = SdTransferable::getSomething(rId); + + return nRet; +} + +// ----------------------------------------------------------------------------- + +const ::com::sun::star::uno::Sequence< sal_Int8 >& SdPageObjsTLB::SdPageObjsTransferable::getUnoTunnelId() +{ + static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; + + if( !aSeq.getLength() ) + { + static osl::Mutex aCreateMutex; + osl::MutexGuard aGuard( aCreateMutex ); + + aSeq.realloc( 16 ); + rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True ); + } + + return aSeq; +} + +// ----------------------------------------------------------------------------- + +SdPageObjsTLB::SdPageObjsTransferable* SdPageObjsTLB::SdPageObjsTransferable::getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) + throw() +{ + try + { + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUnoTunnel( rxData, ::com::sun::star::uno::UNO_QUERY_THROW ); + + return reinterpret_cast<SdPageObjsTLB::SdPageObjsTransferable*>( + sal::static_int_cast<sal_uIntPtr>( + xUnoTunnel->getSomething( SdPageObjsTLB::SdPageObjsTransferable::getUnoTunnelId()) ) ); + } + catch( const ::com::sun::star::uno::Exception& ) + { + } + return 0; +} + + +sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::GetListBoxDropFormatId (void) +{ + if (mnListBoxDropFormatId == SAL_MAX_UINT32) + mnListBoxDropFormatId = SotExchange::RegisterFormatMimeType( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "application/x-openoffice-treelistbox-moveonly;" + "windows_formatname=\"SV_LBOX_DD_FORMAT_MOVE\""))); + return mnListBoxDropFormatId; +} + +/************************************************************************* +|* +|* Ctor1 SdPageObjsTLB +|* +\************************************************************************/ + +SdPageObjsTLB::SdPageObjsTLB( Window* pParentWin, const SdResId& rSdResId ) +: SvTreeListBox ( pParentWin, rSdResId ) +, mpParent ( pParentWin ) +, mpDoc ( NULL ) +, mpBookmarkDoc ( NULL ) +, mpMedium ( NULL ) +, mpOwnMedium ( NULL ) +, maImgOle ( BitmapEx( SdResId( BMP_OLE ) ) ) +, maImgGraphic ( BitmapEx( SdResId( BMP_GRAPHIC ) ) ) +, mbLinkableSelected ( sal_False ) +, mpDropNavWin ( NULL ) +, mbShowAllShapes ( false ) +, mbShowAllPages ( false ) + +{ + // Tree-ListBox mit Linien versehen + SetStyle( GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES | + WB_HASBUTTONS | // WB_HASLINESATROOT | + WB_HSCROLL | + WB_HASBUTTONSATROOT | + WB_QUICK_SEARCH /* i31275 */ ); + SetNodeBitmaps( Bitmap( SdResId( BMP_EXPAND ) ), + Bitmap( SdResId( BMP_COLLAPSE ) ) ); + + SetDragDropMode( + SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY | + SV_DRAGDROP_APP_MOVE | SV_DRAGDROP_APP_COPY | SV_DRAGDROP_APP_DROP ); +} + +/************************************************************************* +|* +|* Dtor SdPageObjsTLB +|* +\************************************************************************/ + +SdPageObjsTLB::~SdPageObjsTLB() +{ + if ( mpBookmarkDoc ) + CloseBookmarkDoc(); + else + // no document was created from mpMedium, so this object is still the owner of it + delete mpMedium; +} + +/************************************************************************* +|* +|* return name of object +|* +\************************************************************************/ + +String SdPageObjsTLB::GetObjectName( + const SdrObject* pObject, + const bool bCreate) const +{ + String aRet; + + if ( pObject ) + { + aRet = pObject->GetName(); + + if( !aRet.Len() && pObject->ISA( SdrOle2Obj ) ) + aRet = static_cast< const SdrOle2Obj* >( pObject )->GetPersistName(); + } + + if (bCreate + && mbShowAllShapes + && aRet.Len() == 0 + && pObject!=NULL) + { + aRet = SdResId(STR_NAVIGATOR_SHAPE_BASE_NAME); + aRet.SearchAndReplaceAscii("%1", String::CreateFromInt32(pObject->GetOrdNum() + 1)); + } + + return aRet; +} + +/************************************************************************* +|* +|* In TreeLB Eintrag selektieren +|* +\************************************************************************/ + +sal_Bool SdPageObjsTLB::SelectEntry( const String& rName ) +{ + sal_Bool bFound = sal_False; + + if( rName.Len() ) + { + SvLBoxEntry* pEntry = NULL; + String aTmp; + + for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) ) + { + aTmp = GetEntryText( pEntry ); + if( aTmp == rName ) + { + bFound = sal_True; + SetCurEntry( pEntry ); + } + } + } + return( bFound ); +} + +/************************************************************************* +|* +|* Gibt zurueck, ob Childs des uebergebenen Strings selektiert sind +|* +\************************************************************************/ + +sal_Bool SdPageObjsTLB::HasSelectedChilds( const String& rName ) +{ + sal_Bool bFound = sal_False; + sal_Bool bChilds = sal_False; + + if( rName.Len() ) + { + SvLBoxEntry* pEntry = NULL; + String aTmp; + + for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) ) + { + aTmp = GetEntryText( pEntry ); + if( aTmp == rName ) + { + bFound = sal_True; + sal_Bool bExpanded = IsExpanded( pEntry ); + long nCount = GetChildSelectionCount( pEntry ); + if( bExpanded && nCount > 0 ) + bChilds = sal_True; + } + } + } + return( bChilds ); +} + + +/************************************************************************* +|* +|* TreeLB mit Seiten und Objekten fuellen +|* +\************************************************************************/ + +void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, sal_Bool bAllPages, + const String& rDocName) +{ + String aSelection; + if( GetSelectionCount() > 0 ) + { + aSelection = GetSelectEntry(); + Clear(); + } + + mpDoc = pInDoc; + maDocName = rDocName; + mbShowAllPages = (bAllPages == sal_True); + mpMedium = NULL; + + SdPage* pPage = NULL; + + IconProvider aIconProvider; + + // first insert all pages including objects + sal_uInt16 nPage = 0; + const sal_uInt16 nMaxPages = mpDoc->GetPageCount(); + + while( nPage < nMaxPages ) + { + pPage = (SdPage*) mpDoc->GetPage( nPage ); + if( (mbShowAllPages || pPage->GetPageKind() == PK_STANDARD) + && !(pPage->GetPageKind()==PK_HANDOUT) ) //#94954# never list the normal handout page ( handout-masterpage is used instead ) + { + sal_Bool bPageExluded = pPage->IsExcluded(); + + bool bPageBelongsToShow = PageBelongsToCurrentShow (pPage); + bPageExluded |= !bPageBelongsToShow; + + AddShapeList(*pPage, NULL, pPage->GetName(), bPageExluded, NULL, aIconProvider); + } + nPage++; + } + + // dann alle MasterPages incl. Objekte einfuegen + if( mbShowAllPages ) + { + nPage = 0; + const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount(); + + while( nPage < nMaxMasterPages ) + { + pPage = (SdPage*) mpDoc->GetMasterPage( nPage ); + AddShapeList(*pPage, NULL, pPage->GetName(), false, NULL, aIconProvider); + nPage++; + } + } + if( aSelection.Len() ) + SelectEntry( aSelection ); +} + +/************************************************************************* +|* +|* Es wird nur der erste Eintrag eingefuegt. Childs werden OnDemand erzeugt +|* +\************************************************************************/ + +void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium, + const String& rDocName ) +{ + mpDoc = pInDoc; + + // this object now owns the Medium + mpMedium = pInMedium; + maDocName = rDocName; + + Image aImgDocOpen=Image( BitmapEx( SdResId( BMP_DOC_OPEN ) ) ); + Image aImgDocClosed=Image( BitmapEx( SdResId( BMP_DOC_CLOSED ) ) ); + + // Dokumentnamen einfuegen + InsertEntry( maDocName, aImgDocOpen, aImgDocClosed, NULL, sal_True, LIST_APPEND, + reinterpret_cast< void* >( 1 ) + ); +} + + + + +void SdPageObjsTLB::AddShapeList ( + const SdrObjList& rList, + SdrObject* pShape, + const ::rtl::OUString& rsName, + const bool bIsExcluded, + SvLBoxEntry* pParentEntry, + const IconProvider& rIconProvider) +{ + Image aIcon (rIconProvider.maImgPage); + if (bIsExcluded) + aIcon = rIconProvider.maImgPageExcl; + else if (pShape != NULL) + aIcon = rIconProvider.maImgGroup; + + void* pUserData (reinterpret_cast<void*>(1)); + if (pShape != NULL) + pUserData = pShape; + + SvLBoxEntry* pEntry = InsertEntry( + rsName, + aIcon, + aIcon, + pParentEntry, + sal_False, + LIST_APPEND, + pUserData); + + SdrObjListIter aIter( + rList, + !rList.HasObjectNavigationOrder() /* use navigation order, if available */, + IM_FLAT, + sal_False /*not reverse*/); + + while( aIter.IsMore() ) + { + SdrObject* pObj = aIter.Next(); + OSL_ASSERT(pObj!=NULL); + + // Get the shape name. + String aStr (GetObjectName( pObj ) ); + + if( aStr.Len() ) + { + if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 ) + { + InsertEntry( + aStr, + maImgOle, + maImgOle, + pEntry, + sal_False, + LIST_APPEND, + pObj + ); + } + else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF ) + { + InsertEntry( + aStr, + maImgGraphic, + maImgGraphic, + pEntry, + sal_False, + LIST_APPEND, + pObj + ); + } + else if (pObj->IsGroupObject()) + { + AddShapeList( + *pObj->GetSubList(), + pObj, + aStr, + false, + pEntry, + rIconProvider + ); + } + else + { + InsertEntry( + aStr, + rIconProvider.maImgObjects, + rIconProvider.maImgObjects, + pEntry, + sal_False, + LIST_APPEND, + pObj + ); + } + } + } + + if( pEntry->HasChilds() ) + { + SetExpandedEntryBmp( + pEntry, + bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs); + SetCollapsedEntryBmp( + pEntry, + bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs); + } +} + + + + +void SdPageObjsTLB::SetShowAllShapes ( + const bool bShowAllShapes, + const bool bFillList) +{ + mbShowAllShapes = bShowAllShapes; + if (bFillList) + { + if (mpMedium == NULL) + Fill(mpDoc, mbShowAllPages, maDocName); + else + Fill(mpDoc, mpMedium, maDocName); + } +} + + + + +bool SdPageObjsTLB::GetShowAllShapes (void) const +{ + return mbShowAllShapes; +} + + + + +/************************************************************************* +|* +|* Prueft, ob die Seiten (PK_STANDARD) und die darauf befindlichen Objekte +|* des Docs und der TreeLB identisch sind. +|* Wird ein Doc uebergeben, wird dieses zum aktuellem Doc (Wichtig bei +|* mehreren Documenten). +|* +\************************************************************************/ + +sal_Bool SdPageObjsTLB::IsEqualToDoc( const SdDrawDocument* pInDoc ) +{ + if( pInDoc ) + mpDoc = pInDoc; + + if( !mpDoc ) + return( sal_False ); + + SdrObject* pObj = NULL; + SdPage* pPage = NULL; + SvLBoxEntry* pEntry = First(); + String aName; + + // Alle Pages incl. Objekte vergleichen + sal_uInt16 nPage = 0; + const sal_uInt16 nMaxPages = mpDoc->GetPageCount(); + + while( nPage < nMaxPages ) + { + pPage = (SdPage*) mpDoc->GetPage( nPage ); + if( pPage->GetPageKind() == PK_STANDARD ) + { + if( !pEntry ) + return( sal_False ); + aName = GetEntryText( pEntry ); + + if( pPage->GetName() != aName ) + return( sal_False ); + + pEntry = Next( pEntry ); + + SdrObjListIter aIter( + *pPage, + !pPage->HasObjectNavigationOrder() /* use navigation order, if available */, + IM_DEEPWITHGROUPS ); + + while( aIter.IsMore() ) + { + pObj = aIter.Next(); + + const String aObjectName( GetObjectName( pObj ) ); + + if( aObjectName.Len() ) + { + if( !pEntry ) + return( sal_False ); + + aName = GetEntryText( pEntry ); + + if( aObjectName != aName ) + return( sal_False ); + + pEntry = Next( pEntry ); + } + } + } + nPage++; + } + // Wenn noch Eintraege in der Listbox vorhanden sind, wurden + // Objekte (mit Namen) oder Seiten geloescht + return( !pEntry ); +} + +/************************************************************************* +|* +|* Selectierten String zurueckgeben +|* +\************************************************************************/ + +String SdPageObjsTLB::GetSelectEntry() +{ + return( GetEntryText( GetCurEntry() ) ); +} + +/************************************************************************* +|* +|* Selektierte Eintrage zurueckgeben +|* nDepth == 0 -> Seiten +|* nDepth == 1 -> Objekte +|* +\************************************************************************/ + +List* SdPageObjsTLB::GetSelectEntryList( sal_uInt16 nDepth ) +{ + List* pList = NULL; + SvLBoxEntry* pEntry = FirstSelected(); + + while( pEntry ) + { + sal_uInt16 nListDepth = GetModel()->GetDepth( pEntry ); + if( nListDepth == nDepth ) + { + if( !pList ) + pList = new List(); + + const String aEntryText( GetEntryText( pEntry ) ); + pList->Insert( new String( aEntryText ), LIST_APPEND ); + } + pEntry = NextSelected( pEntry ); + } + + return( pList ); +} + +/************************************************************************* +|* +|* Eintraege werden erst auf Anforderung (Doppelklick) eingefuegt +|* +\************************************************************************/ + +void SdPageObjsTLB::RequestingChilds( SvLBoxEntry* pFileEntry ) +{ + if( !pFileEntry->HasChilds() ) + { + if( GetBookmarkDoc() ) + { + SdrObject* pObj = NULL; + SdPage* pPage = NULL; + SvLBoxEntry* pPageEntry = NULL; + + Image aImgPage = Image( BitmapEx( SdResId( BMP_PAGE ) ) ); + Image aImgPageObjs = Image( BitmapEx( SdResId( BMP_PAGEOBJS ) ) ); + Image aImgObjects = Image( BitmapEx( SdResId( BMP_OBJECTS ) ) ); + + // document name already inserted + + // only insert all "normal" ? slides with objects + sal_uInt16 nPage = 0; + const sal_uInt16 nMaxPages = mpBookmarkDoc->GetPageCount(); + + while( nPage < nMaxPages ) + { + pPage = (SdPage*) mpBookmarkDoc->GetPage( nPage ); + if( pPage->GetPageKind() == PK_STANDARD ) + { + pPageEntry = InsertEntry( pPage->GetName(), + aImgPage, + aImgPage, + pFileEntry, + sal_False, + LIST_APPEND, + reinterpret_cast< void* >( 1 ) ); + + SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS ); + + while( aIter.IsMore() ) + { + pObj = aIter.Next(); + String aStr( GetObjectName( pObj ) ); + if( aStr.Len() ) + { + if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 ) + { + InsertEntry(aStr, maImgOle, maImgOle, pPageEntry); + } + else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF ) + { + InsertEntry(aStr, maImgGraphic, maImgGraphic, pPageEntry); + } + else + { + InsertEntry(aStr, aImgObjects, aImgObjects, pPageEntry); + } + } + } + if( pPageEntry->HasChilds() ) + { + SetExpandedEntryBmp( pPageEntry, aImgPageObjs ); + SetCollapsedEntryBmp( pPageEntry, aImgPageObjs ); + } + } + nPage++; + } + } + } + else + SvTreeListBox::RequestingChilds( pFileEntry ); +} + +/************************************************************************* +|* +|* Prueft, ob es sich um eine Draw-Datei handelt und oeffnet anhand des +|* uebergebenen Docs das BookmarkDoc +|* +\************************************************************************/ + +SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed) +{ + if ( + !mpBookmarkDoc || + (pMed && (!mpOwnMedium || mpOwnMedium->GetName() != pMed->GetName())) + ) + { + // create a new BookmarkDoc if now one exists or if a new Medium is provided + if (mpOwnMedium != pMed) + { + CloseBookmarkDoc(); + } + + if (pMed) + { + // it looks that it is undefined if a Medium was set by Fill() allready + DBG_ASSERT( !mpMedium, "SfxMedium confusion!" ); + delete mpMedium; + mpMedium = NULL; + + // take over this Medium (currently used only be Navigator) + mpOwnMedium = pMed; + } + + DBG_ASSERT( mpMedium || pMed, "No SfxMedium provided!" ); + + if( pMed ) + { + // in this mode the document is also owned and controlled by this instance + mxBookmarkDocShRef = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD, sal_True); + if (mxBookmarkDocShRef->DoLoad(pMed)) + mpBookmarkDoc = mxBookmarkDocShRef->GetDoc(); + else + mpBookmarkDoc = NULL; + } + else if ( mpMedium ) + // in this mode the document is owned and controlled by the SdDrawDocument + // it can be released by calling the corresponding CloseBookmarkDoc method + // successfull creation of a document makes this the owner of the medium + mpBookmarkDoc = ((SdDrawDocument*) mpDoc)->OpenBookmarkDoc(*mpMedium); + + if ( !mpBookmarkDoc ) + { + ErrorBox aErrorBox( this, WB_OK, String( SdResId( STR_READ_DATA_ERROR ) ) ); + aErrorBox.Execute(); + mpMedium = 0; //On failure the SfxMedium is invalid + } + } + + return( mpBookmarkDoc ); +} + +/************************************************************************* +|* +|* Bookmark-Dokument schlie�en und loeschen +|* +\************************************************************************/ + +void SdPageObjsTLB::CloseBookmarkDoc() +{ + if (mxBookmarkDocShRef.Is()) + { + mxBookmarkDocShRef->DoClose(); + mxBookmarkDocShRef.Clear(); + + // Medium is owned by document, so it's destroyed already + mpOwnMedium = 0; + } + else if ( mpBookmarkDoc ) + { + DBG_ASSERT( !mpOwnMedium, "SfxMedium confusion!" ); + if ( mpDoc ) + { + // The document owns the Medium, so the Medium will be invalid after closing the document + ((SdDrawDocument*) mpDoc)->CloseBookmarkDoc(); + mpMedium = 0; + } + } + else + { + // perhaps mpOwnMedium provided, but no successfull creation of BookmarkDoc + delete mpOwnMedium; + mpOwnMedium = NULL; + } + + mpBookmarkDoc = NULL; +} + +void SdPageObjsTLB::SelectHdl() +{ + SvLBoxEntry* pEntry = FirstSelected(); + + mbLinkableSelected = sal_True; + + while( pEntry && mbLinkableSelected ) + { + if( NULL == pEntry->GetUserData() ) + mbLinkableSelected = sal_False; + + pEntry = NextSelected( pEntry ); + } + + SvTreeListBox::SelectHdl(); +} + +/************************************************************************* +|* +|* Ueberlaedt RETURN mit der Funktionsweise von DoubleClick +|* +\************************************************************************/ + +void SdPageObjsTLB::KeyInput( const KeyEvent& rKEvt ) +{ + if( rKEvt.GetKeyCode().GetCode() == KEY_RETURN ) + { + // Auskommentierter Code aus svtools/source/contnr/svimpbox.cxx + SvLBoxEntry* pCursor = GetCurEntry(); + if( pCursor->HasChilds() || pCursor->HasChildsOnDemand() ) + { + if( IsExpanded( pCursor ) ) + Collapse( pCursor ); + else + Expand( pCursor ); + } + + DoubleClickHdl(); + } + else + SvTreeListBox::KeyInput( rKEvt ); +} + +/************************************************************************* +|* +|* StartDrag-Request +|* +\************************************************************************/ + +void SdPageObjsTLB::StartDrag( sal_Int8 nAction, const Point& rPosPixel) +{ + (void)nAction; + (void)rPosPixel; + + SdNavigatorWin* pNavWin = NULL; + SvLBoxEntry* pEntry = GetEntry(rPosPixel); + + if( mpFrame->HasChildWindow( SID_NAVIGATOR ) ) + pNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) ); + + if (pEntry != NULL + && pNavWin !=NULL + && pNavWin == mpParent + && pNavWin->GetNavigatorDragType() != NAVIGATOR_DRAGTYPE_NONE ) + { + // Mark only the children of the page under the mouse as drop + // targets. This prevents moving shapes from one page to another. + + // Select all entries and disable them as drop targets. + SetSelectionMode(MULTIPLE_SELECTION); + SetCursor(NULL, sal_False); + SelectAll(sal_True, sal_False); + EnableSelectionAsDropTarget(sal_False, sal_True); + + // Enable only the entries as drop targets that are children of the + // page under the mouse. + SvLBoxEntry* pParent = GetRootLevelParent(pEntry); + if (pParent != NULL) + { + SelectAll(sal_False, sal_False); + Select(pParent, sal_True); + // for (SvLBoxEntry*pChild=FirstChild(pParent); pChild!=NULL; pChild=NextSibling(pChild)) + // Select(pChild, sal_True); + EnableSelectionAsDropTarget(sal_True, sal_True);//sal_False); + } + + // Set selection back to the entry under the mouse. + SelectAll(sal_False,sal_False); + SetSelectionMode(SINGLE_SELECTION); + Select(pEntry, sal_True); + + // Aus dem ExecuteDrag heraus kann der Navigator geloescht werden + // (beim Umschalten auf einen anderen Dokument-Typ), das wuerde aber + // den StarView MouseMove-Handler, der Command() aufruft, umbringen. + // Deshalb Drag&Drop asynchron: + Application::PostUserEvent( STATIC_LINK( this, SdPageObjsTLB, ExecDragHdl ) ); + } +} + +/************************************************************************* +|* +|* Begin drag +|* +\************************************************************************/ + +void SdPageObjsTLB::DoDrag() +{ + mpDropNavWin = ( mpFrame->HasChildWindow( SID_NAVIGATOR ) ) ? + (SdNavigatorWin*)( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) ) : + NULL; + + if( mpDropNavWin ) + { + ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh(); + String aURL = INetURLObject( pDocShell->GetMedium()->GetPhysicalName(), INET_PROT_FILE ).GetMainURL( INetURLObject::NO_DECODE ); + NavigatorDragType eDragType = mpDropNavWin->GetNavigatorDragType(); + + aURL.Append( '#' ); + aURL.Append( GetSelectEntry() ); + + INetBookmark aBookmark( aURL, GetSelectEntry() ); + sal_Int8 nDNDActions = DND_ACTION_COPYMOVE; + + if( eDragType == NAVIGATOR_DRAGTYPE_LINK ) + nDNDActions = DND_ACTION_LINK; // Either COPY *or* LINK, never both! + + SvTreeListBox::ReleaseMouse(); + + bIsInDrag = sal_True; + + SvLBoxDDInfo aDDInfo; + memset(&aDDInfo,0,sizeof(SvLBoxDDInfo)); + aDDInfo.pApp = GetpApp(); + aDDInfo.pSource = this; + // aDDInfo.pDDStartEntry = pEntry; + ::com::sun::star::uno::Sequence<sal_Int8> aSequence (sizeof(SvLBoxDDInfo)); + memcpy(aSequence.getArray(), (sal_Char*)&aDDInfo, sizeof(SvLBoxDDInfo)); + ::com::sun::star::uno::Any aTreeListBoxData (aSequence); + + // object is destroyed by internal reference mechanism + SdTransferable* pTransferable = new SdPageObjsTLB::SdPageObjsTransferable( + *this, aBookmark, *pDocShell, eDragType, aTreeListBoxData); + OSL_TRACE("created new SdPageObjsTransferable at %x", pTransferable); + + // Get the view. + sd::View* pView = NULL; + if (pDocShell != NULL) + { + ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); + if (pViewShell != NULL) + pView = pViewShell->GetView(); + } + if (pView == NULL) + { + OSL_ASSERT(pView!=NULL); + return; + } + + SdrObject* pObject = NULL; + void* pUserData = GetCurEntry()->GetUserData(); + if (pUserData != NULL && pUserData != (void*)1) + pObject = reinterpret_cast<SdrObject*>(pUserData); + if (pObject == NULL) + return; + + // For shapes without a user supplied name (the automatically + // created name does not count), a different drag and drop technique + // is used. + if (GetObjectName(pObject, false).Len() == 0) + { + AddShapeToTransferable(*pTransferable, *pObject); + pTransferable->SetView(pView); + SD_MOD()->pTransferDrag = pTransferable; + } + + // Unnamed shapes have to be selected to be recognized by the + // current drop implementation. In order to have a consistent + // behaviour for all shapes, every shape that is to be dragged is + // selected first. + SdrPageView* pPageView = pView->GetSdrPageView(); + pView->UnmarkAllObj(pPageView); + pView->MarkObj(pObject, pPageView); + + pTransferable->StartDrag( this, nDNDActions ); + } +} + +/************************************************************************* +|* +|* Drag finished +|* +\************************************************************************/ + +void SdPageObjsTLB::OnDragFinished( sal_uInt8 ) +{ + if( mpFrame->HasChildWindow( SID_NAVIGATOR ) ) + { + SdNavigatorWin* pNewNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) ); + + if( mpDropNavWin == pNewNavWin) + { + MouseEvent aMEvt( mpDropNavWin->GetPointerPosPixel() ); + SvTreeListBox::MouseButtonUp( aMEvt ); + } + } + + mpDropNavWin = NULL; + bIsInDrag = sal_False; +} + +/************************************************************************* +|* +|* AcceptDrop-Event +|* +\************************************************************************/ + +sal_Int8 SdPageObjsTLB::AcceptDrop (const AcceptDropEvent& rEvent) +{ + sal_Int8 nResult (DND_ACTION_NONE); + + if ( !bIsInDrag && IsDropFormatSupported( FORMAT_FILE ) ) + { + nResult = rEvent.mnAction; + } + else + { + SvLBoxEntry* pEntry = GetDropTarget(rEvent.maPosPixel); + if (rEvent.mbLeaving || !CheckDragAndDropMode( this, rEvent.mnAction )) + { + ImplShowTargetEmphasis( pTargetEntry, sal_False ); + } + else if( !nDragDropMode ) + { + DBG_ERRORFILE( "SdPageObjsTLB::AcceptDrop(): no target" ); + } + else if (IsDropAllowed(pEntry)) + { + nResult = DND_ACTION_MOVE; + + // Draw emphasis. + if (pEntry != pTargetEntry || !(nImpFlags & SVLBOX_TARGEMPH_VIS)) + { + ImplShowTargetEmphasis( pTargetEntry, sal_False ); + pTargetEntry = pEntry; + ImplShowTargetEmphasis( pTargetEntry, sal_True ); + } + } + } + + // Hide emphasis when there is no valid drop action. + if (nResult == DND_ACTION_NONE) + ImplShowTargetEmphasis(pTargetEntry, sal_False); + + return nResult; +} + +/************************************************************************* +|* +|* ExecuteDrop-Event +|* +\************************************************************************/ + +sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt ) +{ + sal_Int8 nRet = DND_ACTION_NONE; + + try + { + if( !bIsInDrag ) + { + SdNavigatorWin* pNavWin = NULL; + sal_uInt16 nId = SID_NAVIGATOR; + + if( mpFrame->HasChildWindow( nId ) ) + pNavWin = (SdNavigatorWin*)( mpFrame->GetChildWindow( nId )->GetContextWindow( SD_MOD() ) ); + + if( pNavWin && ( pNavWin == mpParent ) ) + { + TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable ); + String aFile; + + if( aDataHelper.GetString( FORMAT_FILE, aFile ) && + ( (SdNavigatorWin*) mpParent)->InsertFile( aFile ) ) + { + nRet = rEvt.mnAction; + } + } + } + } + catch (com::sun::star::uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if (nRet == DND_ACTION_NONE) + SvTreeListBox::ExecuteDrop(rEvt, this); + + + return nRet; +} + +/************************************************************************* +|* +|* Handler fuers Dragging +|* +\************************************************************************/ + +IMPL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*, EMPTYARG) +{ + // als Link, damit asynchron ohne ImpMouseMoveMsg auf dem Stack auch der + // Navigator geloescht werden darf + pThis->DoDrag(); + return 0; +} + + +bool SdPageObjsTLB::PageBelongsToCurrentShow (const SdPage* pPage) const +{ + // Return <TRUE/> as default when there is no custom show or when none + // is used. The page does then belong to the standard show. + bool bBelongsToShow = true; + + if (mpDoc->getPresentationSettings().mbCustomShow) + { + // Get the current custom show. + SdCustomShow* pCustomShow = NULL; + List* pShowList = const_cast<SdDrawDocument*>(mpDoc)->GetCustomShowList(); + if (pShowList != NULL) + { + sal_uLong nCurrentShowIndex = pShowList->GetCurPos(); + void* pObject = pShowList->GetObject(nCurrentShowIndex); + pCustomShow = static_cast<SdCustomShow*>(pObject); + } + + // Check whether the given page is part of that custom show. + if (pCustomShow != NULL) + { + bBelongsToShow = false; + sal_uLong nPageCount = pCustomShow->Count(); + for (sal_uInt16 i=0; i<nPageCount && !bBelongsToShow; i++) + if (pPage == static_cast<SdPage*>(pCustomShow->GetObject (i))) + bBelongsToShow = true; + } + } + + return bBelongsToShow; +} + + + + +sal_Bool SdPageObjsTLB::NotifyMoving( + SvLBoxEntry* pTarget, + SvLBoxEntry* pEntry, + SvLBoxEntry*& rpNewParent, + sal_uLong& rNewChildPos) +{ + SvLBoxEntry* pDestination = pTarget; + while (GetParent(pDestination) != NULL && GetParent(GetParent(pDestination)) != NULL) + pDestination = GetParent(pDestination); + + SdrObject* pTargetObject = reinterpret_cast<SdrObject*>(pDestination->GetUserData()); + SdrObject* pSourceObject = reinterpret_cast<SdrObject*>(pEntry->GetUserData()); + if (pSourceObject == reinterpret_cast<SdrObject*>(1)) + pSourceObject = NULL; + + if (pTargetObject != NULL && pSourceObject != NULL) + { + SdrPage* pObjectList = pSourceObject->GetPage(); + if (pObjectList != NULL) + { + sal_uInt32 nNewPosition; + if (pTargetObject == reinterpret_cast<SdrObject*>(1)) + nNewPosition = 0; + else + nNewPosition = pTargetObject->GetNavigationPosition() + 1; + pObjectList->SetObjectNavigationPosition(*pSourceObject, nNewPosition); + } + + // Update the tree list. + if (pTarget == NULL) + { + rpNewParent = 0; + rNewChildPos = 0; + return sal_True; + } + else if (GetParent(pDestination) == NULL) + { + rpNewParent = pDestination; + rNewChildPos = 0; + } + else + { + rpNewParent = GetParent(pDestination); + rNewChildPos = pModel->GetRelPos(pDestination) + 1; + rNewChildPos += nCurEntrySelPos; + nCurEntrySelPos++; + } + return sal_True; + } + else + return sal_False; +} + + + + +SvLBoxEntry* SdPageObjsTLB::GetDropTarget (const Point& rLocation) +{ + SvLBoxEntry* pEntry = SvTreeListBox::GetDropTarget(rLocation); + if (pEntry == NULL) + return NULL; + + OSL_TRACE("entry is %s", + ::rtl::OUStringToOString(GetEntryText(pEntry), RTL_TEXTENCODING_UTF8).getStr()); + if (GetParent(pEntry) == NULL) + { + // Use page entry as insertion position. + } + else + { + // Go to second hierarchy level, i.e. top level shapes, + // i.e. children of pages. + while (GetParent(pEntry) != NULL && GetParent(GetParent(pEntry)) != NULL) + pEntry = GetParent(pEntry); + + // Advance to next sibling. + SvLBoxEntry* pNext; + sal_uInt16 nDepth (0); + while (pEntry != NULL) + { + pNext = dynamic_cast<SvLBoxEntry*>(NextVisible(pEntry, &nDepth)); + if (pNext != NULL && nDepth > 0 && nDepth!=0xffff) + pEntry = pNext; + else + break; + } + OSL_TRACE("returning %s", + ::rtl::OUStringToOString(GetEntryText(pEntry), RTL_TEXTENCODING_UTF8).getStr()); + } + + return pEntry; +} + + + + +bool SdPageObjsTLB::IsDropAllowed (SvLBoxEntry* pEntry) +{ + if (pEntry == NULL) + return false; + + if ( ! IsDropFormatSupported(SdPageObjsTransferable::GetListBoxDropFormatId())) + return false; + + if ((pEntry->GetFlags() & SV_ENTRYFLAG_DISABLE_DROP) != 0) + return false; + + return true; +} + + + + +void SdPageObjsTLB::AddShapeToTransferable ( + SdTransferable& rTransferable, + SdrObject& rObject) const +{ + TransferableObjectDescriptor aObjectDescriptor; + bool bIsDescriptorFillingPending (true); + + const SdrOle2Obj* pOleObject = dynamic_cast<const SdrOle2Obj*>(&rObject); + if (pOleObject != NULL && pOleObject->GetObjRef().is()) + { + // If object has no persistence it must be copied as part of the document + try + { + uno::Reference< embed::XEmbedPersist > xPersObj (pOleObject->GetObjRef(), uno::UNO_QUERY ); + if (xPersObj.is() && xPersObj->hasEntry()) + { + SvEmbedTransferHelper::FillTransferableObjectDescriptor( + aObjectDescriptor, + pOleObject->GetObjRef(), + pOleObject->GetGraphic(), + pOleObject->GetAspect()); + bIsDescriptorFillingPending = false; + } + } + catch( uno::Exception& ) + { + } + } + + ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh(); + if (bIsDescriptorFillingPending && pDocShell!=NULL) + { + bIsDescriptorFillingPending = false; + pDocShell->FillTransferableObjectDescriptor(aObjectDescriptor); + } + + Point aDragPos (rObject.GetCurrentBoundRect().Center()); + //Point aDragPos (0,0); + aObjectDescriptor.maDragStartPos = aDragPos; + // aObjectDescriptor.maSize = GetAllMarkedRect().GetSize(); + if (pDocShell != NULL) + aObjectDescriptor.maDisplayName = pDocShell->GetMedium()->GetURLObject().GetURLNoPass(); + else + aObjectDescriptor.maDisplayName = String(); + aObjectDescriptor.mbCanLink = sal_False; + + rTransferable.SetStartPos(aDragPos); + rTransferable.SetObjectDescriptor( aObjectDescriptor ); +} + + + + +//===== IconProvider ========================================================== + +SdPageObjsTLB::IconProvider::IconProvider (void) + : maImgPage( BitmapEx( SdResId( BMP_PAGE ) ) ), + maImgPageExcl( BitmapEx( SdResId( BMP_PAGE_EXCLUDED ) ) ), + maImgPageObjsExcl( BitmapEx( SdResId( BMP_PAGEOBJS_EXCLUDED ) ) ), + maImgPageObjs( BitmapEx( SdResId( BMP_PAGEOBJS ) ) ), + maImgObjects( BitmapEx( SdResId( BMP_OBJECTS ) ) ), + maImgGroup( BitmapEx( SdResId( BMP_GROUP ) ) ) +{ +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/sduiexp.cxx b/sd/source/ui/dlg/sduiexp.cxx new file mode 100644 index 000000000000..3380fcb555c7 --- /dev/null +++ b/sd/source/ui/dlg/sduiexp.cxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include "sddlgfact.hxx" +#include "sal/types.h" + +namespace sdui +{ + static SdAbstractDialogFactory_Impl* pFactory=NULL; + SdAbstractDialogFactory_Impl* GetFactory() + { + if ( !pFactory ) + pFactory = new SdAbstractDialogFactory_Impl; + return pFactory; + } +} + +extern "C" +{ + SAL_DLLPUBLIC_EXPORT SdAbstractDialogFactory* CreateDialogFactory() + { + return ::sdui::GetFactory(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/tabtempl.cxx b/sd/source/ui/dlg/tabtempl.cxx new file mode 100644 index 000000000000..fc8333658ba1 --- /dev/null +++ b/sd/source/ui/dlg/tabtempl.cxx @@ -0,0 +1,225 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include <editeng/flstitem.hxx> + +#include <svx/svxids.hrc> + +#include <svx/drawitem.hxx> +#include <svl/intitem.hxx> +#include <svx/ofaitem.hxx> +#include <svx/svxgrahicitem.hxx> +#include <svx/svdmodel.hxx> +#include <svl/cjkoptions.hxx> + + +#include <svx/dialogs.hrc> + +#include <svx/svxdlg.hxx> +#include <svx/tabline.hxx> +#include <svl/style.hxx> +#include <svx/xtable.hxx> + +#include "DrawDocShell.hxx" +#include "tabtempl.hxx" +#include "tabtempl.hrc" +#include "sdresid.hxx" +#include "dlg_char.hxx" +#include "paragr.hxx" +#include <svx/flagsdef.hxx> + +/************************************************************************* +|* +|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu +|* +\************************************************************************/ + +SdTabTemplateDlg::SdTabTemplateDlg( Window* pParent, + const SfxObjectShell* pDocShell, + SfxStyleSheetBase& rStyleBase, + SdrModel* pModel, + SdrView* pView ) : + SfxStyleDialog ( pParent, SdResId( TAB_TEMPLATE ), rStyleBase, sal_False ), + rDocShell ( *pDocShell ), + pSdrView ( pView ), + pColorTab ( pModel->GetColorTable() ), + pGradientList ( pModel->GetGradientList() ), + pHatchingList ( pModel->GetHatchList() ), + pBitmapList ( pModel->GetBitmapList() ), + pDashList ( pModel->GetDashList() ), + pLineEndList ( pModel->GetLineEndList() ) +{ + FreeResource(); + + // Listbox fuellen und Select-Handler ueberladen + + AddTabPage( RID_SVXPAGE_LINE); + AddTabPage( RID_SVXPAGE_AREA); + AddTabPage( RID_SVXPAGE_SHADOW); + AddTabPage( RID_SVXPAGE_TRANSPARENCE); + AddTabPage( RID_SVXPAGE_CHAR_NAME ); + AddTabPage( RID_SVXPAGE_CHAR_EFFECTS ); + AddTabPage( RID_SVXPAGE_STD_PARAGRAPH ); + AddTabPage( RID_SVXPAGE_TEXTATTR ); + AddTabPage( RID_SVXPAGE_TEXTANIMATION ); + AddTabPage( RID_SVXPAGE_MEASURE); + AddTabPage( RID_SVXPAGE_CONNECTION); + AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH ); + AddTabPage( RID_SVXPAGE_TABULATOR ); + SvtCJKOptions aCJKOptions; + if( aCJKOptions.IsAsianTypographyEnabled() ) + AddTabPage( RID_SVXPAGE_PARA_ASIAN ); + else + RemoveTabPage( RID_SVXPAGE_PARA_ASIAN ); + + nDlgType = 1; + nPageType = 0; + nPos = 0; + + nColorTableState = CT_NONE; + nBitmapListState = CT_NONE; + nGradientListState = CT_NONE; + nHatchingListState = CT_NONE; +} + +// ----------------------------------------------------------------------- + +SdTabTemplateDlg::~SdTabTemplateDlg() +{ +} + +// ----------------------------------------------------------------------- + +void SdTabTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) +{ + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + switch( nId ) + { + case RID_SVXPAGE_LINE: + aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST)); + aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST)); + aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); + rPage.PageCreated(aSet); + break; + + case RID_SVXPAGE_AREA: + aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST)); + aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST)); + aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_LIST)); + aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); + aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); + aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos)); + rPage.PageCreated(aSet); + + + break; + + case RID_SVXPAGE_SHADOW: + aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); + aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); + rPage.PageCreated(aSet); + break; + + case RID_SVXPAGE_TRANSPARENCE: + aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); + aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); + rPage.PageCreated(aSet); + break; + + case RID_SVXPAGE_CHAR_NAME: + { + SvxFontListItem aItem(*( (const SvxFontListItem*) + ( rDocShell.GetItem( SID_ATTR_CHAR_FONTLIST) ) ) ); + + aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST)); + rPage.PageCreated(aSet); + } + break; + + case RID_SVXPAGE_CHAR_EFFECTS: + aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP)); + rPage.PageCreated(aSet); + break; + + case RID_SVXPAGE_STD_PARAGRAPH: + break; + + case RID_SVXPAGE_TEXTATTR: + { + aSet.Put(OfaPtrItem(SID_SVXTEXTATTRPAGE_VIEW,pSdrView)); + rPage.PageCreated(aSet); + } + break; + + case RID_SVXPAGE_TEXTANIMATION: + break; + + case RID_SVXPAGE_MEASURE: + aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView)); + rPage.PageCreated(aSet); + break; + + case RID_SVXPAGE_CONNECTION: + { + aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView)); + rPage.PageCreated(aSet); + } + break; + } +} + +// ----------------------------------------------------------------------- + +const SfxItemSet* SdTabTemplateDlg::GetRefreshedSet() +{ + SfxItemSet* pRet = GetInputSetImpl(); + + if( pRet ) + { + pRet->ClearItem(); + pRet->SetParent( GetStyleSheet().GetItemSet().GetParent() ); + } + else + pRet = new SfxItemSet( GetStyleSheet().GetItemSet() ); + + return pRet; +} + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/tabtempl.src b/sd/source/ui/dlg/tabtempl.src new file mode 100644 index 000000000000..92d65bf0265d --- /dev/null +++ b/sd/source/ui/dlg/tabtempl.src @@ -0,0 +1,189 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "tabtempl.hrc" +#include <svx/dialogs.hrc> +TabDialog TAB_TEMPLATE +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 289 , 176 ) ; + Text [ en-US ] = "Graphics Styles" ; + Moveable = TRUE ; + // Closeable = TRUE; // Dieser Dialog hat OK und/oder Cancel Button ! (KH) + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_LINE ; + Text [ en-US ] = "Line" ; + PageResID = RID_SVXPAGE_LINE ; + }; + PageItem + { + Identifier = RID_SVXPAGE_AREA ; + Text [ en-US ] = "Area" ; + PageResID = RID_SVXPAGE_AREA ; + }; + PageItem + { + Identifier = RID_SVXPAGE_SHADOW ; + PageResID = RID_SVXPAGE_SHADOW ; + Text [ en-US ] = "Shadowing" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_TRANSPARENCE ; + Text [ en-US ] = "Transparency"; + }; + PageItem + { + Identifier = RID_SVXPAGE_CHAR_NAME; + Text [ en-US ] = "Font" ; + PageResID = RID_SVXPAGE_CHAR_NAME ; + }; + PageItem + { + Identifier = RID_SVXPAGE_CHAR_EFFECTS ; + Text [ en-US ] = "Font Effect" ; + PageResID = RID_SVXPAGE_CHAR_EFFECTS ; + }; + PageItem + { + Identifier = RID_SVXPAGE_STD_PARAGRAPH ; + Text [ en-US ] = "Indents & Spacing" ; + PageResID = RID_SVXPAGE_STD_PARAGRAPH ; + }; + PageItem + { + Identifier = RID_SVXPAGE_TEXTATTR ; + PageResID = RID_SVXPAGE_TEXTATTR ; + Text [ en-US ] = "Text" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_TEXTANIMATION ; + PageResID = RID_SVXPAGE_TEXTANIMATION ; + Text [ en-US ] = "Text Animation" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_MEASURE ; + Text [ en-US ] = "Dimensioning" ; + PageResID = RID_SVXPAGE_MEASURE ; + }; + PageItem + { + Identifier = RID_SVXPAGE_CONNECTION ; + Text [ en-US ] = "Connector" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ; + PageResID = RID_SVXPAGE_ALIGN_PARAGRAPH ; + Text [ en-US ] = "Alignment" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_PARA_ASIAN ; + PageResID = RID_SVXPAGE_PARA_ASIAN ; + Text[ en-US ] = "Asian Typography"; + }; + PageItem + { + Identifier = RID_SVXPAGE_TABULATOR ; + Text [ en-US ] = "Tabs" ; + PageResID = RID_SVXPAGE_TABULATOR ; + }; + }; + }; + OKButton 1 + { + Pos = MAP_APPFONT ( 6 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + CancelButton 1 + { + Pos = MAP_APPFONT ( 60 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton 1 + { + Pos = MAP_APPFONT ( 114 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + PushButton 1 + { + Pos = MAP_APPFONT ( 169 , 151 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "Back" ; + TabStop = TRUE ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx new file mode 100644 index 000000000000..1187be030f1f --- /dev/null +++ b/sd/source/ui/dlg/tpaction.cxx @@ -0,0 +1,928 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include <svx/svxids.hrc> +#include <com/sun/star/presentation/AnimationEffect.hpp> +#include <com/sun/star/presentation/ClickAction.hpp> +#include <com/sun/star/presentation/AnimationSpeed.hpp> +#include <com/sun/star/embed/VerbDescriptor.hpp> +#include <com/sun/star/embed/EmbedStates.hpp> +#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/embed/VerbAttributes.hpp> + +#include "sdattr.hxx" +#include <sfx2/sfxresid.hxx> + +#include <vcl/waitobj.hxx> +#include <osl/file.hxx> +#include <sfx2/app.hxx> +#include <unotools/pathoptions.hxx> +#include <svx/svdpagv.hxx> +#include <unotools/localfilehelper.hxx> +#include <svl/aeitem.hxx> +#include <editeng/colritem.hxx> +#include <svx/svdoole2.hxx> +#include <sfx2/docfile.hxx> +#include <sot/storage.hxx> +#include <basic/sbmeth.hxx> +#include <basic/sbmod.hxx> +#include <basic/sbstar.hxx> +#include <svx/xtable.hxx> +#include <vcl/svapp.hxx> +#include <vcl/mnemonic.hxx> +#include <svl/urihelper.hxx> +#include <sfx2/filedlghelper.hxx> +#include <svx/drawitem.hxx> +#include "View.hxx" +#include "sdresid.hxx" +#include "tpaction.hxx" +#include "tpaction.hrc" +#include "strmname.h" +#include "ViewShell.hxx" +#include "drawdoc.hxx" +#include "DrawDocShell.hxx" +#include "strings.hrc" +#include "res_bmp.hrc" +#include "filedlg.hxx" + +#include <algorithm> + +using namespace ::com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; + +#define DOCUMENT_TOKEN (sal_Unicode('#')) + +/************************************************************************* +|* +|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu +|* +\************************************************************************/ + +SdActionDlg::SdActionDlg ( + ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView ) : + SfxSingleTabDialog ( pParent, *pAttr, TP_ANIMATION_ACTION ), + rOutAttrs ( *pAttr ) +{ + // FreeResource(); + SfxTabPage* pNewPage = SdTPAction::Create( this, rOutAttrs ); + DBG_ASSERT( pNewPage, "Seite konnte nicht erzeugt werden"); + + // Ehemals in PageCreated + ( (SdTPAction*) pNewPage )->SetView( pView ); + ( (SdTPAction*) pNewPage )->Construct(); + + SetTabPage( pNewPage ); + + String aStr( pNewPage->GetText() ); + if( aStr.Len() ) + SetText( aStr ); +} + + +/************************************************************************* +|* +|* Action-TabPage +|* +\************************************************************************/ + +SdTPAction::SdTPAction( Window* pWindow, const SfxItemSet& rInAttrs ) : + SfxTabPage ( pWindow, SdResId( TP_ANIMATION ), rInAttrs ), + + aFtAction ( this, SdResId( FT_ACTION ) ), + aLbAction ( this, SdResId( LB_ACTION ) ), + aFtTree ( this, SdResId( FT_TREE ) ), + aLbTree ( this, SdResId( LB_TREE ) ), + aLbTreeDocument ( this, SdResId( LB_TREE_DOCUMENT ) ), + aLbOLEAction ( this, SdResId( LB_OLE_ACTION ) ), + aFlSeparator ( this, SdResId( FL_SEPARATOR ) ), + aEdtSound ( this, SdResId( EDT_SOUND ) ), + aEdtBookmark ( this, SdResId( EDT_BOOKMARK ) ), + aEdtDocument ( this, SdResId( EDT_DOCUMENT ) ), + aEdtProgram ( this, SdResId( EDT_PROGRAM ) ), + aEdtMacro ( this, SdResId( EDT_MACRO ) ), + aBtnSearch ( this, SdResId( BTN_SEARCH ) ), + aBtnSeek ( this, SdResId( BTN_SEEK ) ), + + rOutAttrs ( rInAttrs ), + mpView ( NULL ), + mpDoc ( NULL ), + bTreeUpdated ( sal_False ) +{ + aEdtSound.SetAccessibleName(String(SdResId(STR_PATHNAME))); + aBtnSeek.SetAccessibleRelationMemberOf( &aFlSeparator ); + + FreeResource(); + + aBtnSearch.SetClickHdl( LINK( this, SdTPAction, ClickSearchHdl ) ); + aBtnSeek.SetClickHdl( LINK( this, SdTPAction, ClickSearchHdl ) ); + + // diese Page braucht ExchangeSupport + SetExchangeSupport(); + + aLbAction.SetSelectHdl( LINK( this, SdTPAction, ClickActionHdl ) ); + aLbTree.SetSelectHdl( LINK( this, SdTPAction, SelectTreeHdl ) ); + aEdtDocument.SetLoseFocusHdl( LINK( this, SdTPAction, CheckFileHdl ) ); + aEdtMacro.SetLoseFocusHdl( LINK( this, SdTPAction, CheckFileHdl ) ); + + // Controls enablen + aFtAction.Show(); + aLbAction.Show(); + + ClickActionHdl( this ); +} + +// ----------------------------------------------------------------------- + +SdTPAction::~SdTPAction() +{ + delete pCurrentActions; +} + +// ----------------------------------------------------------------------- + +void SdTPAction::SetView( const ::sd::View* pSdView ) +{ + mpView = pSdView; + + // Holen der ColorTable und Fuellen der ListBox + ::sd::DrawDocShell* pDocSh = static_cast<const ::sd::View*>(mpView)->GetDocSh(); + if( pDocSh && pDocSh->GetViewShell() ) + { + mpDoc = pDocSh->GetDoc(); + SfxViewFrame* pFrame = pDocSh->GetViewShell()->GetViewFrame(); + aLbTree.SetViewFrame( pFrame ); + aLbTreeDocument.SetViewFrame( pFrame ); + + SvxColorTableItem aItem( *(const SvxColorTableItem*)( pDocSh->GetItem( SID_COLOR_TABLE ) ) ); + pColTab = aItem.GetColorTable(); + DBG_ASSERT( pColTab, "Keine Farbtabelle vorhanden!" ); + } + else + { + OSL_FAIL("sd::SdTPAction::SetView(), no docshell or viewshell?"); + } +} + +// ----------------------------------------------------------------------- + +void SdTPAction::Construct() +{ + // OLE-Actionlistbox auffuellen + SdrOle2Obj* pOleObj = NULL; + SdrGrafObj* pGrafObj = NULL; + sal_Bool bOLEAction = sal_False; + + if ( mpView->AreObjectsMarked() ) + { + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + SdrObject* pObj; + + if (rMarkList.GetMarkCount() == 1) + { + SdrMark* pMark = rMarkList.GetMark(0); + pObj = pMark->GetMarkedSdrObj(); + + sal_uInt32 nInv = pObj->GetObjInventor(); + sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); + + if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2) + { + pOleObj = (SdrOle2Obj*) pObj; + } + else if (nInv == SdrInventor && nSdrObjKind == OBJ_GRAF) + { + pGrafObj = (SdrGrafObj*) pObj; + } +// // VCXControl ? +// else if( pObj->IsA( TYPE( VCSbxDrawObject ) ) ) +// { +// bDisableAll = sal_True; +// } + } + } + if( pGrafObj ) + { + bOLEAction = sal_True; + + aVerbVector.push_back( 0 ); + aLbOLEAction.InsertEntry( MnemonicGenerator::EraseAllMnemonicChars( String( SdResId( STR_EDIT_OBJ ) ) ) ); + } + else if( pOleObj ) + { + uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef(); + if ( xObj.is() ) + { + bOLEAction = sal_True; + uno::Sequence < embed::VerbDescriptor > aVerbs; + try + { + aVerbs = xObj->getSupportedVerbs(); + } + catch ( embed::NeedsRunningStateException& ) + { + xObj->changeState( embed::EmbedStates::RUNNING ); + aVerbs = xObj->getSupportedVerbs(); + } + + for( sal_Int32 i=0; i<aVerbs.getLength(); i++ ) + { + embed::VerbDescriptor aVerb = aVerbs[i]; + if( aVerb.VerbAttributes & embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU ) + { + String aTmp( aVerb.VerbName ); + aVerbVector.push_back( aVerb.VerbID ); + aLbOLEAction.InsertEntry( MnemonicGenerator::EraseAllMnemonicChars( aTmp ) ); + } + } + } + } + + pCurrentActions = new List; + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_NONE, LIST_APPEND); + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_PREVPAGE, LIST_APPEND); + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_NEXTPAGE, LIST_APPEND); + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_FIRSTPAGE, LIST_APPEND); + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_LASTPAGE, LIST_APPEND); + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_BOOKMARK, LIST_APPEND); + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_DOCUMENT, LIST_APPEND); + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_SOUND, LIST_APPEND); + if( bOLEAction && aLbOLEAction.GetEntryCount() ) + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_VERB, LIST_APPEND ); + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_PROGRAM, LIST_APPEND); + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_MACRO, LIST_APPEND); + pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_STOPPRESENTATION, LIST_APPEND); + + // Action-Listbox fuellen + for (sal_uLong nAction = 0; nAction < pCurrentActions->Count(); nAction++) + { + sal_uInt16 nRId = GetClickActionSdResId((presentation::ClickAction)(sal_uLong)pCurrentActions->GetObject(nAction)); + aLbAction.InsertEntry( String( SdResId( nRId ) ) ); + } + +} + +// ----------------------------------------------------------------------- + +sal_Bool SdTPAction::FillItemSet( SfxItemSet& rAttrs ) +{ + sal_Bool bModified = sal_False; + presentation::ClickAction eCA = presentation::ClickAction_NONE; + + if( aLbAction.GetSelectEntryCount() ) + eCA = GetActualClickAction(); + + if( aLbAction.GetSavedValue() != aLbAction.GetSelectEntryPos() ) + { + rAttrs.Put( SfxAllEnumItem( ATTR_ACTION, (sal_uInt16)eCA ) ); + bModified = sal_True; + } + else + rAttrs.InvalidateItem( ATTR_ACTION ); + + String aFileName = GetEditText( sal_True ); + if( aFileName.Len() == 0 ) + rAttrs.InvalidateItem( ATTR_ACTION_FILENAME ); + else + { + if( mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() ) + { + String aBaseURL = mpDoc->GetDocSh()->GetMedium()->GetBaseURL(); + if( eCA == presentation::ClickAction_SOUND || + eCA == presentation::ClickAction_DOCUMENT || + eCA == presentation::ClickAction_PROGRAM ) + aFileName = ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), aFileName, URIHelper::GetMaybeFileHdl(), true, false, + INetURLObject::WAS_ENCODED, + INetURLObject::DECODE_UNAMBIGUOUS ); + + rAttrs.Put( SfxStringItem( ATTR_ACTION_FILENAME, aFileName ) ); + bModified = sal_True; + } + else + { + OSL_FAIL("sd::SdTPAction::FillItemSet(), I need a medium!"); + } + } + + return( bModified ); +} + +//------------------------------------------------------------------------ + +void SdTPAction::Reset( const SfxItemSet& rAttrs ) +{ + presentation::ClickAction eCA = presentation::ClickAction_NONE; + String aFileName; + + // aLbAction + if( rAttrs.GetItemState( ATTR_ACTION ) != SFX_ITEM_DONTCARE ) + { + eCA = (presentation::ClickAction) ( ( const SfxAllEnumItem& ) rAttrs. + Get( ATTR_ACTION ) ).GetValue(); + SetActualClickAction( eCA ); + } + else + aLbAction.SetNoSelection(); + + // aEdtSound + if( rAttrs.GetItemState( ATTR_ACTION_FILENAME ) != SFX_ITEM_DONTCARE ) + { + aFileName = ( ( const SfxStringItem& ) rAttrs.Get( ATTR_ACTION_FILENAME ) ).GetValue(); + SetEditText( aFileName ); + } + + switch( eCA ) + { + case presentation::ClickAction_BOOKMARK: + { + if( !aLbTree.SelectEntry( aFileName ) ) + aLbTree.SelectAll( sal_False ); + } + break; + + case presentation::ClickAction_DOCUMENT: + { + if( aFileName.GetTokenCount( DOCUMENT_TOKEN ) == 2 ) + aLbTreeDocument.SelectEntry( aFileName.GetToken( 1, DOCUMENT_TOKEN ) ); + } + break; + + default: + break; + } + ClickActionHdl( this ); + + aLbAction.SaveValue(); + aEdtSound.SaveValue(); +} + +// ----------------------------------------------------------------------- + +void SdTPAction::ActivatePage( const SfxItemSet& ) +{ +} + +// ----------------------------------------------------------------------- + +int SdTPAction::DeactivatePage( SfxItemSet* pPageSet ) +{ + if( pPageSet ) + FillItemSet( *pPageSet ); + + return( LEAVE_PAGE ); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SdTPAction::Create( Window* pWindow, + const SfxItemSet& rAttrs ) +{ + return( new SdTPAction( pWindow, rAttrs ) ); +} + +//------------------------------------------------------------------------ + +void SdTPAction::UpdateTree() +{ + if( !bTreeUpdated && mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() ) + { + //aLbTree.Clear(); + aLbTree.Fill( mpDoc, sal_True, mpDoc->GetDocSh()->GetMedium()->GetName() ); + bTreeUpdated = sal_True; + } +} + +//------------------------------------------------------------------------ + +void SdTPAction::OpenFileDialog() +{ + // Soundpreview nur fuer Interaktionen mit Sound + presentation::ClickAction eCA = GetActualClickAction(); + sal_Bool bSound = ( eCA == presentation::ClickAction_SOUND ); + sal_Bool bPage = ( eCA == presentation::ClickAction_BOOKMARK ); + sal_Bool bDocument = ( eCA == presentation::ClickAction_DOCUMENT || + eCA == presentation::ClickAction_PROGRAM ); + sal_Bool bMacro = ( eCA == presentation::ClickAction_MACRO ); + + if( bPage ) + { + // Es wird in der TreeLB nach dem eingegebenen Objekt gesucht + aLbTree.SelectEntry( GetEditText() ); + } + else + { + String aFile( GetEditText() ); + + if (bSound) + { + SdOpenSoundFileDialog aFileDialog; + + if( !aFile.Len() ) + aFile = SvtPathOptions().GetGraphicPath(); + + aFileDialog.SetPath( aFile ); + + if( aFileDialog.Execute() == ERRCODE_NONE ) + { + aFile = aFileDialog.GetPath(); + SetEditText( aFile ); + } + } + else if (bMacro) + { + Window* pOldWin = Application::GetDefDialogParent(); + Application::SetDefDialogParent( this ); + + // choose macro dialog + ::rtl::OUString aScriptURL = SfxApplication::ChooseScript(); + + if ( aScriptURL.getLength() != 0 ) + { + SetEditText( aScriptURL ); + } + + Application::SetDefDialogParent( pOldWin ); + } + else + { + sfx2::FileDialogHelper aFileDialog(WB_OPEN | WB_3DLOOK | WB_STDMODAL ); + + if (bDocument && !aFile.Len()) + aFile = SvtPathOptions().GetWorkPath(); + + aFileDialog.SetDisplayDirectory( aFile ); + + // The following is a workarround for #i4306#: + // The addition of the implicitely existing "all files" + // filter makes the (Windows system) open file dialog follow + // links on the desktop to directories. + aFileDialog.AddFilter ( + String (SfxResId (STR_SFX_FILTERNAME_ALL)), + String (RTL_CONSTASCII_USTRINGPARAM("*.*"))); + + + if( aFileDialog.Execute() == ERRCODE_NONE ) + { + aFile = aFileDialog.GetPath(); + SetEditText( aFile ); + } + if( bDocument ) + CheckFileHdl( NULL ); + } + } +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SdTPAction, ClickSearchHdl, void *, EMPTYARG ) +{ + OpenFileDialog(); + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SdTPAction, ClickActionHdl, void *, EMPTYARG ) +{ + presentation::ClickAction eCA = GetActualClickAction(); + + // hide controls we don't need + switch( eCA ) + { + case presentation::ClickAction_NONE: + case presentation::ClickAction_INVISIBLE: + case presentation::ClickAction_PREVPAGE: + case presentation::ClickAction_NEXTPAGE: + case presentation::ClickAction_FIRSTPAGE: + case presentation::ClickAction_LASTPAGE: + case presentation::ClickAction_STOPPRESENTATION: + default: + aFtTree.Hide(); + aLbTree.Hide(); + aLbTreeDocument.Hide(); + aLbOLEAction.Hide(); + + aFlSeparator.Hide(); + aEdtSound.Hide(); + aEdtBookmark.Hide(); + aEdtDocument.Hide(); + aEdtProgram.Hide(); + aEdtMacro.Hide(); + aBtnSearch.Hide(); + aBtnSeek.Hide(); + break; + + case presentation::ClickAction_SOUND: + case presentation::ClickAction_PROGRAM: + case presentation::ClickAction_MACRO: + aFtTree.Hide(); + aLbTree.Hide(); + aLbTreeDocument.Hide(); + aLbOLEAction.Hide(); + + aEdtDocument.Hide(); + + if( eCA == presentation::ClickAction_MACRO ) + { + aEdtSound.Hide(); + aEdtProgram.Hide(); + } + else if( eCA == presentation::ClickAction_PROGRAM ) + { + aEdtSound.Hide(); + aEdtMacro.Hide(); + } + else if( eCA == presentation::ClickAction_SOUND ) + { + aEdtProgram.Hide(); + aEdtMacro.Hide(); + } + + aBtnSeek.Hide(); + break; + + + case presentation::ClickAction_DOCUMENT: + aLbTree.Hide(); + aLbOLEAction.Hide(); + + aEdtSound.Hide(); + aEdtProgram.Hide(); + aEdtMacro.Hide(); + aEdtBookmark.Hide(); + aBtnSeek.Hide(); + break; + + case presentation::ClickAction_BOOKMARK: + aLbTreeDocument.Hide(); + aLbOLEAction.Hide(); + aEdtSound.Hide(); + aEdtDocument.Hide(); + aEdtProgram.Hide(); + aEdtMacro.Hide(); + aBtnSearch.Hide(); + break; + + case presentation::ClickAction_VERB: + aLbTree.Hide(); + aEdtDocument.Hide(); + aEdtProgram.Hide(); + aEdtBookmark.Hide(); + aEdtMacro.Hide(); + aBtnSearch.Hide(); + aFlSeparator.Hide(); + aEdtSound.Hide(); + aBtnSeek.Hide(); + break; + } + + // show controls we do need + switch( eCA ) + { + case presentation::ClickAction_NONE: + case presentation::ClickAction_INVISIBLE: + case presentation::ClickAction_PREVPAGE: + case presentation::ClickAction_NEXTPAGE: + case presentation::ClickAction_FIRSTPAGE: + case presentation::ClickAction_LASTPAGE: + case presentation::ClickAction_STOPPRESENTATION: + // none + break; + + case presentation::ClickAction_SOUND: + aFlSeparator.Show(); + aEdtSound.Show(); + aEdtSound.Enable(); + aBtnSearch.Show(); + aBtnSearch.Enable(); + aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_SOUND ) ) ); + break; + + case presentation::ClickAction_PROGRAM: + case presentation::ClickAction_MACRO: + aFlSeparator.Show(); + aBtnSearch.Show(); + aBtnSearch.Enable(); + if( eCA == presentation::ClickAction_MACRO ) + { + aEdtMacro.Show(); + aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_MACRO ) ) ); + } + else + { + aEdtProgram.Show(); + aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_PROGRAM ) ) ); + } + break; + + case presentation::ClickAction_DOCUMENT: + aFtTree.Show(); + aLbTreeDocument.Show(); + + aFlSeparator.Show(); + aEdtDocument.Show(); + aBtnSearch.Show(); + aBtnSearch.Enable(); + + aFtTree.SetText( String( SdResId( STR_EFFECTDLG_JUMP ) ) ); + aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_DOCUMENT ) ) ); + + CheckFileHdl( NULL ); + break; + + case presentation::ClickAction_VERB: + aFtTree.Show(); + aLbOLEAction.Show(); + + aFtTree.SetText( String( SdResId( STR_EFFECTDLG_ACTION ) ) ); + break; + + case presentation::ClickAction_BOOKMARK: + UpdateTree(); + + aFtTree.Show(); + aLbTree.Show(); + + aFlSeparator.Show(); + aEdtBookmark.Show(); + aBtnSeek.Show(); + + aFtTree.SetText( String( SdResId( STR_EFFECTDLG_JUMP ) ) ); + aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_PAGE_OBJECT ) ) ); + break; + default: + break; + } + + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SdTPAction, SelectTreeHdl, void *, EMPTYARG ) +{ + aEdtBookmark.SetText( aLbTree.GetSelectEntry() ); + return( 0L ); +} + +//------------------------------------------------------------------------ + +IMPL_LINK( SdTPAction, CheckFileHdl, void *, EMPTYARG ) +{ + String aFile( GetEditText() ); + + if( aFile != aLastFile ) + { + // Ueberpruefen, ob es eine gueltige Draw-Datei ist + SfxMedium aMedium( aFile, + STREAM_READ | STREAM_NOCREATE, + sal_True ); // Download + + if( aMedium.IsStorage() ) + { + WaitObject aWait( GetParent()->GetParent() ); + + // ist es eine Draw-Datei? + // mit READ oeffnen, sonst schreiben die Storages evtl. in die Datei! + uno::Reference < embed::XStorage > xStorage = aMedium.GetStorage(); + DBG_ASSERT( xStorage.is(), "Kein Storage!" ); + + uno::Reference < container::XNameAccess > xAccess( xStorage, uno::UNO_QUERY ); + if( xAccess.is() && + ( xAccess->hasByName( pStarDrawXMLContent ) || + xAccess->hasByName( pStarDrawOldXMLContent ) ) ) + { + SdDrawDocument* pBookmarkDoc = mpDoc->OpenBookmarkDoc( aFile ); + if( pBookmarkDoc ) + { + aLastFile = aFile; + + aLbTreeDocument.Clear(); + aLbTreeDocument.Fill( pBookmarkDoc, sal_True, aFile ); + mpDoc->CloseBookmarkDoc(); + aLbTreeDocument.Show(); + } + else + aLbTreeDocument.Hide(); + } + else + aLbTreeDocument.Hide(); + + } + else + aLbTreeDocument.Hide(); + } + + return( 0L ); +} + +//------------------------------------------------------------------------ + +presentation::ClickAction SdTPAction::GetActualClickAction() +{ + presentation::ClickAction eCA = presentation::ClickAction_NONE; + sal_uInt16 nPos = aLbAction.GetSelectEntryPos(); + + if (nPos != LISTBOX_ENTRY_NOTFOUND) + eCA = (presentation::ClickAction)(sal_uLong)pCurrentActions->GetObject((sal_uLong)nPos); + return( eCA ); +} + +//------------------------------------------------------------------------ + +void SdTPAction::SetActualClickAction( presentation::ClickAction eCA ) +{ + sal_uInt16 nPos = (sal_uInt16)pCurrentActions->GetPos((void*)(sal_uLong)eCA); + DBG_ASSERT(nPos != 0xffff, "unbekannte Interaktion"); + aLbAction.SelectEntryPos(nPos); +} + +//------------------------------------------------------------------------ + +void SdTPAction::SetEditText( String const & rStr ) +{ + presentation::ClickAction eCA = GetActualClickAction(); + String aText(rStr); + + // possibly convert URI back to system path + switch( eCA ) + { + case presentation::ClickAction_DOCUMENT: + if( rStr.GetTokenCount( DOCUMENT_TOKEN ) == 2 ) + aText = rStr.GetToken( 0, DOCUMENT_TOKEN ); + + // fallthrough inteded + case presentation::ClickAction_SOUND: + case presentation::ClickAction_PROGRAM: + { + INetURLObject aURL( aText ); + + // try to convert to system path + String aTmpStr(aURL.getFSysPath(INetURLObject::FSYS_DETECT)); + + if( aTmpStr.Len() ) + aText = aTmpStr; // was a system path + } + break; + default: + break; + } + + // set the string to the corresponding control + switch( eCA ) + { + case presentation::ClickAction_SOUND: + aEdtSound.SetText(aText ); + break; + case presentation::ClickAction_VERB: + { + ::std::vector< long >::iterator aFound( ::std::find( aVerbVector.begin(), aVerbVector.end(), rStr.ToInt32() ) ); + if( aFound != aVerbVector.end() ) + aLbOLEAction.SelectEntryPos( static_cast< short >( aFound - aVerbVector.begin() ) ); + } + break; + case presentation::ClickAction_PROGRAM: + aEdtProgram.SetText( aText ); + break; + case presentation::ClickAction_MACRO: + { + aEdtMacro.SetText( aText ); + } + break; + case presentation::ClickAction_DOCUMENT: + aEdtDocument.SetText( aText ); + break; + case presentation::ClickAction_BOOKMARK: + aEdtBookmark.SetText( aText ); + break; + default: + break; + } +} + +//------------------------------------------------------------------------ + +String SdTPAction::GetEditText( sal_Bool bFullDocDestination ) +{ + String aStr; + presentation::ClickAction eCA = GetActualClickAction(); + + switch( eCA ) + { + case presentation::ClickAction_SOUND: + aStr = aEdtSound.GetText(); + break; + case presentation::ClickAction_VERB: + { + const sal_uInt16 nPos = aLbOLEAction.GetSelectEntryPos(); + if( nPos < aVerbVector.size() ) + aStr = UniString::CreateFromInt32( aVerbVector[ nPos ] ); + return aStr; + } + case presentation::ClickAction_DOCUMENT: + aStr = aEdtDocument.GetText(); + break; + + case presentation::ClickAction_PROGRAM: + aStr = aEdtProgram.GetText(); + break; + + case presentation::ClickAction_MACRO: + { + return aEdtMacro.GetText(); + } + + case presentation::ClickAction_BOOKMARK: + return( aEdtBookmark.GetText() ); + + default: + break; + } + + // validate file URI + INetURLObject aURL( aStr ); + String aBaseURL; + if( mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() ) + aBaseURL = mpDoc->GetDocSh()->GetMedium()->GetBaseURL(); + + if( aStr.Len() && aURL.GetProtocol() == INET_PROT_NOT_VALID ) + aURL = INetURLObject( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), aStr, URIHelper::GetMaybeFileHdl(), true, false ) ); + + // get adjusted file name + aStr = aURL.GetMainURL( INetURLObject::NO_DECODE ); + + if( bFullDocDestination && + eCA == presentation::ClickAction_DOCUMENT && + aLbTreeDocument.Control::IsVisible() && + aLbTreeDocument.GetSelectionCount() > 0 ) + { + String aTmpStr( aLbTreeDocument.GetSelectEntry() ); + if( aTmpStr.Len() ) + { + aStr.Append( DOCUMENT_TOKEN ); + aStr.Append( aTmpStr ); + } + } + + return( aStr ); +} + +//------------------------------------------------------------------------ + +sal_uInt16 SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA ) +{ + switch( eCA ) + { + case presentation::ClickAction_NONE: return STR_CLICK_ACTION_NONE; + case presentation::ClickAction_PREVPAGE: return STR_CLICK_ACTION_PREVPAGE; + case presentation::ClickAction_NEXTPAGE: return STR_CLICK_ACTION_NEXTPAGE; + case presentation::ClickAction_FIRSTPAGE: return STR_CLICK_ACTION_FIRSTPAGE; + case presentation::ClickAction_LASTPAGE: return STR_CLICK_ACTION_LASTPAGE; + case presentation::ClickAction_BOOKMARK: return STR_CLICK_ACTION_BOOKMARK; + case presentation::ClickAction_DOCUMENT: return STR_CLICK_ACTION_DOCUMENT; + case presentation::ClickAction_PROGRAM: return STR_CLICK_ACTION_PROGRAM; + case presentation::ClickAction_MACRO: return STR_CLICK_ACTION_MACRO; + case presentation::ClickAction_SOUND: return STR_CLICK_ACTION_SOUND; + case presentation::ClickAction_VERB: return STR_CLICK_ACTION_VERB; + case presentation::ClickAction_STOPPRESENTATION: return STR_CLICK_ACTION_STOPPRESENTATION; + default: OSL_FAIL( "Keine StringResource fuer ClickAction vorhanden!" ); + } + return( 0 ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/tpaction.src b/sd/source/ui/dlg/tpaction.src new file mode 100644 index 000000000000..79cd333c9300 --- /dev/null +++ b/sd/source/ui/dlg/tpaction.src @@ -0,0 +1,208 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "app.hrc" +#include "helpids.h" +#include "tpaction.hrc" +#include <svtools/controldims.hrc> + +TabPage TP_ANIMATION +{ + HelpID = CMD_SID_ANIMATION_EFFECTS ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 164 ) ; + Hide = TRUE; + // always visible --------------------------------------------------------------------- +#define MA_ACTIONLB_TOP (RSC_SP_DLG_INNERBORDER_TOP + (2*RSC_CD_PUSHBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y - RSC_CD_DROPDOWN_HEIGHT) / 2) +#define MA_ACTIONLB_LEFT (103) + FixedText FT_ACTION + { + Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_ACTIONLB_TOP + 1 ) ; + Size = MAP_APPFONT ( 86 , 10 ) ; + Hide = TRUE ; + Text [ en-US ] = "Action at mouse click" ; + }; + ListBox LB_ACTION + { + HelpID = "sd:ListBox:TP_ANIMATION:LB_ACTION"; + Border = TRUE ; + Pos = MAP_APPFONT ( MA_ACTIONLB_LEFT , MA_ACTIONLB_TOP ) ; + Size = MAP_APPFONT ( 150 - RSC_SP_GRP_INNERBORDER_RIGHT , 79 ) ; + Hide = TRUE ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + + // sometimes visible --------------------------------------------------------------------- + +#define MA_Y0 (MA_ACTIONLB_TOP + RSC_CD_DROPDOWN_HEIGHT + RSC_SP_FLGR_SPACE_Y + RSC_SP_FLGR_INNERBORDER_BOTTOM) +#define MA_Y1 (MA_Y0 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP) +#define MA_Y2 (MA_Y1 + RSC_CD_DROPDOWN_HEIGHT + RSC_SP_CTRL_GROUP_Y) +#define MA_Y3 (MA_Y2 + 3*(RSC_CD_RADIOBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y)) +#define MA_Y4 (MA_Y3 + RSC_CD_DROPDOWN_HEIGHT + RSC_SP_CTRL_GROUP_Y) + + Edit EDT_SOUND + { + HelpID = "sd:Edit:TP_ANIMATION:EDT_SOUND"; + Border = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + RSC_SP_CHK_TEXTINDENT , MA_Y4 + RSC_CD_CHECKBOX_HEIGHT + 1 ) ; + Size = MAP_APPFONT ( 247 - 65 - 10 - (RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + RSC_SP_CHK_TEXTINDENT) , 12 ) ; + TabStop = TRUE ; + Hide = TRUE ; + }; + + // Es ist schon wichtig, daß Durchsuchen (search) und Suchen (seek/find) unter- + // schiedlich heissen, da sie eben auch eine unterschiedliche Bedeutung haben + PushButton BTN_SEARCH + { + HelpID = "sd:PushButton:TP_ANIMATION:BTN_SEARCH"; + Pos = MAP_APPFONT ( 247 - 65, MA_Y4 + RSC_CD_CHECKBOX_HEIGHT ) ; + Size = MAP_APPFONT ( 65 , 14 ) ; + TabStop = TRUE ; + Hide = TRUE ; + Text [ en-US ] = "~Browse..." ; + }; + + //------------------------------------ + // Goto page/object/document stuff + FixedText FT_TREE + { + Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_Y0 + 4 ); + Size = MAP_APPFONT ( 86 , 10 ) ; + Hide = TRUE ; + }; + Control LB_TREE + { + HelpID = HID_CTL_ACTION_DLG_1 ; + Border = TRUE ; + Pos = MAP_APPFONT ( MA_ACTIONLB_LEFT, MA_Y0 + 3 ) ; + Size = MAP_APPFONT ( 150 - RSC_SP_GRP_INNERBORDER_RIGHT , 77 ) ; + TabStop = TRUE ; + Hide = TRUE ; + }; + Control LB_TREE_DOCUMENT + { + HelpID = HID_CTL_ACTION_DLG_2 ; + Border = TRUE ; + Pos = MAP_APPFONT ( MA_ACTIONLB_LEFT, MA_Y0 + 3 ) ; + Size = MAP_APPFONT ( 150 - RSC_SP_GRP_INNERBORDER_RIGHT , 77 ) ; + TabStop = TRUE ; + Hide = TRUE ; + }; + ListBox LB_OLE_ACTION + { + HelpID = "sd:ListBox:TP_ANIMATION:LB_OLE_ACTION"; + Border = TRUE ; + Pos = MAP_APPFONT ( MA_ACTIONLB_LEFT, MA_Y0 + 3 ) ; + Size = MAP_APPFONT ( 150 - RSC_SP_GRP_INNERBORDER_RIGHT , 77 ) ; + TabStop = TRUE ; + Hide = TRUE ; + }; + FixedLine FL_SEPARATOR + { + Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT , MA_Y1 + 63 + RSC_SP_FLGR_SPACE_Y + RSC_SP_FLGR_INNERBORDER_BOTTOM + 6 ) ; + Size = MAP_APPFONT ( 247 , 8 ) ; + Hide = TRUE ; + }; + Edit EDT_BOOKMARK + { + HelpID = "sd:Edit:TP_ANIMATION:EDT_BOOKMARK"; + Border = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_Y4 + RSC_CD_CHECKBOX_HEIGHT + 1 ) ; + Size = MAP_APPFONT ( 247 - 65 - 10 - (RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT) , 12 ) ; + TabStop = TRUE ; + Hide = TRUE ; + }; + Edit EDT_DOCUMENT + { + HelpID = "sd:Edit:TP_ANIMATION:EDT_DOCUMENT"; + Border = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_Y4 + RSC_CD_CHECKBOX_HEIGHT + 1 ) ; + Size = MAP_APPFONT ( 247 - 65 - 10 - (RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT) , 12 ) ; + TabStop = TRUE ; + Hide = TRUE ; + }; + Edit EDT_PROGRAM + { + HelpID = "sd:Edit:TP_ANIMATION:EDT_PROGRAM"; + Border = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_Y4 + RSC_CD_CHECKBOX_HEIGHT + 1 ) ; + Size = MAP_APPFONT ( 247 - 65 - 10 - (RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT) , 12 ) ; + TabStop = TRUE ; + Hide = TRUE ; + }; + Edit EDT_MACRO + { + HelpID = "sd:Edit:TP_ANIMATION:EDT_MACRO"; + Border = TRUE ; + Pos = MAP_APPFONT ( RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT , MA_Y4 + RSC_CD_CHECKBOX_HEIGHT + 1 ) ; + Size = MAP_APPFONT ( 247 - 65 - 10 - (RSC_SP_DLG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT) , 12 ) ; + TabStop = TRUE ; + Hide = TRUE ; + }; + PushButton BTN_SEEK + { + HelpID = "sd:PushButton:TP_ANIMATION:BTN_SEEK"; + Pos = MAP_APPFONT ( 247 - 65, MA_Y4 + RSC_CD_CHECKBOX_HEIGHT ) ; + Size = MAP_APPFONT ( 65 , 14 ) ; + TabStop = TRUE ; + Hide = TRUE ; + Text [ en-US ] = "~Find" ; + }; + String STR_PATHNAME + { + Text [ en-US ] = "Path Name"; + }; + Text [ en-US ] = "Interaction"; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx new file mode 100644 index 000000000000..8f1c4135e3a2 --- /dev/null +++ b/sd/source/ui/dlg/tpoption.cxx @@ -0,0 +1,852 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + + +#include <com/sun/star/document/PrinterIndependentLayout.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/uno/Exception.hpp> +#include <sfx2/module.hxx> +#include <sfx2/app.hxx> +#include <svx/svxids.hrc> +#include <svx/dialogs.hrc> +#include <svx/strarray.hxx> +#include <svx/dlgutil.hxx> +#include <vcl/msgbox.hxx> + +#include "sdattr.hxx" +#include "sdresid.hxx" +#include "optsitem.hxx" +#include "tpoption.hrc" +#include "tpoption.hxx" +#include "strings.hrc" +#include "app.hrc" +#include <svl/intitem.hxx> +#include <sfx2/request.hxx> +#define DLGWIN this->GetParent()->GetParent() + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +/************************************************************************* +|* +|* TabPage zum Einstellen der Fang-Optionen +|* +\************************************************************************/ + +SdTpOptionsSnap::SdTpOptionsSnap( Window* pParent, const SfxItemSet& rInAttrs ) : + SvxGridTabPage(pParent, rInAttrs) +{ + aGrpSnap.Show(); + aCbxSnapHelplines.Show(); + aCbxSnapBorder.Show(); + aCbxSnapFrame.Show(); + aCbxSnapPoints.Show(); + aFtSnapArea.Show(); + aMtrFldSnapArea.Show(); + aGrpOrtho.Show(); + aCbxOrtho.Show(); + aCbxBigOrtho.Show(); + aCbxRotate.Show(); + aMtrFldAngle.Show(); + aFtBezAngle.Show(); + aMtrFldBezAngle.Show(); + aSeparatorFL.Show(); +} + +// ----------------------------------------------------------------------- + +SdTpOptionsSnap::~SdTpOptionsSnap() +{ +} + +// ----------------------------------------------------------------------- + +sal_Bool SdTpOptionsSnap::FillItemSet( SfxItemSet& rAttrs ) +{ + SvxGridTabPage::FillItemSet(rAttrs); + SdOptionsSnapItem* pOptsItem = NULL; + SdOptionsSnapItem aOptsItem( ATTR_OPTIONS_SNAP ); + + aOptsItem.GetOptionsSnap().SetSnapHelplines( aCbxSnapHelplines.IsChecked() ); + aOptsItem.GetOptionsSnap().SetSnapBorder( aCbxSnapBorder.IsChecked() ); + aOptsItem.GetOptionsSnap().SetSnapFrame( aCbxSnapFrame.IsChecked() ); + aOptsItem.GetOptionsSnap().SetSnapPoints( aCbxSnapPoints.IsChecked() ); + aOptsItem.GetOptionsSnap().SetOrtho( aCbxOrtho.IsChecked() ); + aOptsItem.GetOptionsSnap().SetBigOrtho( aCbxBigOrtho.IsChecked() ); + aOptsItem.GetOptionsSnap().SetRotate( aCbxRotate.IsChecked() ); + aOptsItem.GetOptionsSnap().SetSnapArea( (sal_Int16) aMtrFldSnapArea.GetValue() ); + aOptsItem.GetOptionsSnap().SetAngle( (sal_Int16) aMtrFldAngle.GetValue() ); + aOptsItem.GetOptionsSnap().SetEliminatePolyPointLimitAngle( (sal_Int16) aMtrFldBezAngle.GetValue() ); + + if( pOptsItem == NULL || !(aOptsItem == *pOptsItem) ) + rAttrs.Put( aOptsItem ); + + // Evtl. vorhandenes GridItem wird geholt, um nicht versehentlich + // irgendwelche Standardwerte einzustellen + return( sal_True ); +} + +// ----------------------------------------------------------------------- + +void SdTpOptionsSnap::Reset( const SfxItemSet& rAttrs ) +{ + SvxGridTabPage::Reset(rAttrs); + + SdOptionsSnapItem aOptsItem( (const SdOptionsSnapItem&) rAttrs. + Get( ATTR_OPTIONS_SNAP ) ); + + aCbxSnapHelplines.Check( aOptsItem.GetOptionsSnap().IsSnapHelplines() ); + aCbxSnapBorder.Check( aOptsItem.GetOptionsSnap().IsSnapBorder() ); + aCbxSnapFrame.Check( aOptsItem.GetOptionsSnap().IsSnapFrame() ); + aCbxSnapPoints.Check( aOptsItem.GetOptionsSnap().IsSnapPoints() ); + aCbxOrtho.Check( aOptsItem.GetOptionsSnap().IsOrtho() ); + aCbxBigOrtho.Check( aOptsItem.GetOptionsSnap().IsBigOrtho() ); + aCbxRotate.Check( aOptsItem.GetOptionsSnap().IsRotate() ); + aMtrFldSnapArea.SetValue( aOptsItem.GetOptionsSnap().GetSnapArea() ); + aMtrFldAngle.SetValue( aOptsItem.GetOptionsSnap().GetAngle() ); + aMtrFldBezAngle.SetValue( aOptsItem.GetOptionsSnap().GetEliminatePolyPointLimitAngle() ); + + aCbxRotate.GetClickHdl().Call(0); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SdTpOptionsSnap::Create( Window* pWindow, + const SfxItemSet& rAttrs ) +{ + return( new SdTpOptionsSnap( pWindow, rAttrs ) ); +} + +/************************************************************************* +|* +|* TabPage zum Einstellen der Inhalte-Optionen +|* +\************************************************************************/ + +SdTpOptionsContents::SdTpOptionsContents( Window* pParent, const SfxItemSet& rInAttrs ) : + SfxTabPage ( pParent, SdResId( TP_OPTIONS_CONTENTS ), rInAttrs ), + aGrpDisplay ( this, SdResId( GRP_DISPLAY ) ), + aCbxRuler ( this, SdResId( CBX_RULER ) ), + aCbxDragStripes ( this, SdResId( CBX_HELPLINES ) ), + aCbxHandlesBezier ( this, SdResId( CBX_HANDLES_BEZIER ) ), + aCbxMoveOutline ( this, SdResId( CBX_MOVE_OUTLINE ) ) +{ + FreeResource(); +} + +// ----------------------------------------------------------------------- + +SdTpOptionsContents::~SdTpOptionsContents() +{ +} + +// ----------------------------------------------------------------------- + +sal_Bool SdTpOptionsContents::FillItemSet( SfxItemSet& rAttrs ) +{ + sal_Bool bModified = sal_False; + + if( aCbxRuler.GetSavedValue() != aCbxRuler.IsChecked() || + aCbxMoveOutline.GetSavedValue() != aCbxMoveOutline.IsChecked() || + aCbxDragStripes.GetSavedValue() != aCbxDragStripes.IsChecked() || + aCbxHandlesBezier.GetSavedValue() != aCbxHandlesBezier.IsChecked() ) + { + SdOptionsLayoutItem aOptsItem( ATTR_OPTIONS_LAYOUT ); + + aOptsItem.GetOptionsLayout().SetRulerVisible( aCbxRuler.IsChecked() ); + aOptsItem.GetOptionsLayout().SetMoveOutline( aCbxMoveOutline.IsChecked() ); + aOptsItem.GetOptionsLayout().SetDragStripes( aCbxDragStripes.IsChecked() ); + aOptsItem.GetOptionsLayout().SetHandlesBezier( aCbxHandlesBezier.IsChecked() ); + + rAttrs.Put( aOptsItem ); + bModified = sal_True; + } + return( bModified ); +} + +// ----------------------------------------------------------------------- + +void SdTpOptionsContents::Reset( const SfxItemSet& rAttrs ) +{ + SdOptionsContentsItem aOptsItem( (const SdOptionsContentsItem&) rAttrs. + Get( ATTR_OPTIONS_CONTENTS ) ); + + SdOptionsLayoutItem aLayoutItem( (const SdOptionsLayoutItem&) rAttrs. + Get( ATTR_OPTIONS_LAYOUT ) ); + + aCbxRuler.Check( aLayoutItem.GetOptionsLayout().IsRulerVisible() ); + aCbxMoveOutline.Check( aLayoutItem.GetOptionsLayout().IsMoveOutline() ); + aCbxDragStripes.Check( aLayoutItem.GetOptionsLayout().IsDragStripes() ); + aCbxHandlesBezier.Check( aLayoutItem.GetOptionsLayout().IsHandlesBezier() ); + + aCbxRuler.SaveValue(); + aCbxMoveOutline.SaveValue(); + aCbxDragStripes.SaveValue(); + aCbxHandlesBezier.SaveValue(); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SdTpOptionsContents::Create( Window* pWindow, + const SfxItemSet& rAttrs ) +{ + return( new SdTpOptionsContents( pWindow, rAttrs ) ); +} + +/************************************************************************* +|* +|* TabPage zum Einstellen der Sonstige-Optionen +|* +\************************************************************************/ +#define TABLE_COUNT 12 +#define TOKEN (sal_Unicode(':')) + +SdTpOptionsMisc::SdTpOptionsMisc( Window* pParent, const SfxItemSet& rInAttrs ) : + SfxTabPage ( pParent, SdResId( TP_OPTIONS_MISC ), rInAttrs ), + aGrpText ( this, SdResId( GRP_TEXT ) ), + aCbxQuickEdit ( this, SdResId( CBX_QUICKEDIT ) ), + aCbxPickThrough ( this, SdResId( CBX_PICKTHROUGH ) ), + + // Template & Layout laufen z.Z. synchron! + aGrpProgramStart ( this, SdResId( GRP_PROGRAMSTART ) ), + aCbxStartWithTemplate ( this, SdResId( CBX_START_WITH_TEMPLATE ) ), + + aGrpSettings ( this, SdResId( GRP_SETTINGS ) ), + aCbxMasterPageCache ( this, SdResId( CBX_MASTERPAGE_CACHE ) ), + aCbxCopy ( this, SdResId( CBX_COPY ) ), + aCbxMarkedHitMovesAlways ( this, SdResId( CBX_MARKED_HIT_MOVES_ALWAYS ) ), + aCbxCrookNoContortion ( this, SdResId( CBX_CROOK_NO_CONTORTION ) ), + + aTxtMetric ( this, SdResId( FT_METRIC ) ), + aLbMetric ( this, SdResId( LB_METRIC ) ), + aTxtTabstop ( this, SdResId( FT_TABSTOP ) ), + aMtrFldTabstop ( this, SdResId( MTR_FLD_TABSTOP ) ), + + aCbxStartWithActualPage ( this, SdResId( CBX_START_WITH_ACTUAL_PAGE ) ), + aGrpStartWithActualPage ( this, SdResId( GRP_START_WITH_ACTUAL_PAGE ) ), + aTxtCompatibility ( this, SdResId( FT_COMPATIBILITY ) ), + aCbxUsePrinterMetrics ( this, SdResId( CB_USE_PRINTER_METRICS ) ), + aCbxCompatibility ( this, SdResId( CB_MERGE_PARA_DIST ) ), + aGrpScale ( this, SdResId( GRP_SCALE ) ), + aFtScale ( this, SdResId( FT_SCALE ) ), + aCbScale ( this, SdResId( CB_SCALE ) ), + aFtOriginal ( this, SdResId( FT_ORIGINAL ) ), + aFtEquivalent ( this, SdResId( FT_EQUIVALENT ) ), + aFtPageWidth ( this, SdResId( FT_PAGEWIDTH ) ), + aFiInfo1 ( this, SdResId( FI_INFO_1 ) ), + aMtrFldOriginalWidth ( this, SdResId( MTR_FLD_ORIGINAL_WIDTH ) ), + aFtPageHeight ( this, SdResId( FT_PAGEHEIGHT ) ), + aFiInfo2 ( this, SdResId( FI_INFO_2 ) ), + aMtrFldOriginalHeight ( this, SdResId( MTR_FLD_ORIGINAL_HEIGHT ) ), + aMtrFldInfo1 ( this, WinBits( WB_HIDE ) ), + aMtrFldInfo2 ( this, WinBits( WB_HIDE ) ) +{ + FreeResource(); + SetExchangeSupport(); + + // Metrik einstellen + FieldUnit eFUnit; + + sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC ); + if ( rInAttrs.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + { + const SfxUInt16Item& rItem = (SfxUInt16Item&)rInAttrs.Get( nWhich ); + eFUnit = (FieldUnit)rItem.GetValue(); + } + else + eFUnit = SfxModule::GetCurrentFieldUnit(); + + SetFieldUnit( aMtrFldTabstop, eFUnit ); + + // ListBox mit Metriken f"ullen + SvxStringArray aMetricArr( RID_SVXSTR_FIELDUNIT_TABLE ); + sal_uInt16 i; + + for ( i = 0; i < aMetricArr.Count(); ++i ) + { + String sMetric = aMetricArr.GetStringByPos( i ); + long nFieldUnit = aMetricArr.GetValue( i ); + sal_uInt16 nPos = aLbMetric.InsertEntry( sMetric ); + aLbMetric.SetEntryData( nPos, (void*)nFieldUnit ); + } + aLbMetric.SetSelectHdl( LINK( this, SdTpOptionsMisc, SelectMetricHdl_Impl ) ); + + SetFieldUnit( aMtrFldOriginalWidth, eFUnit ); + SetFieldUnit( aMtrFldOriginalHeight, eFUnit ); + aMtrFldOriginalWidth.SetLast( 999999999 ); + aMtrFldOriginalWidth.SetMax( 999999999 ); + aMtrFldOriginalHeight.SetLast( 999999999 ); + aMtrFldOriginalHeight.SetMax( 999999999 ); + + // Temporaere Fields fuer Info-Texte (fuer Formatierung/Berechnung) + aMtrFldInfo1.SetUnit( eFUnit ); + aMtrFldInfo1.SetMax( 999999999 ); + aMtrFldInfo1.SetDecimalDigits( 2 ); + aMtrFldInfo2.SetUnit( eFUnit ); + aMtrFldInfo2.SetMax( 999999999 ); + aMtrFldInfo2.SetDecimalDigits( 2 ); + + // PoolUnit ermitteln + SfxItemPool* pPool = rInAttrs.GetPool(); + DBG_ASSERT( pPool, "Wo ist der Pool?" ); + ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH ); + + // Fuellen der CB + sal_uInt16 aTable[ TABLE_COUNT ] = + { 1, 2, 4, 5, 8, 10, 16, 20, 30, 40, 50, 100 }; + + for( i = 0; i < TABLE_COUNT; i++ ) + aCbScale.InsertEntry( GetScale( 1, aTable[i] ) ); + for( i = 1; i < TABLE_COUNT; i++ ) + aCbScale.InsertEntry( GetScale( aTable[i], 1 ) ); +} + +// ----------------------------------------------------------------------- + +SdTpOptionsMisc::~SdTpOptionsMisc() +{ +} +// ----------------------------------------------------------------------- +void SdTpOptionsMisc::ActivatePage( const SfxItemSet& rSet ) +{ + // Hier muss noch einmal SaveValue gerufen werden, da sonst u.U. + // der Wert in anderen TabPages keine Wirkung hat + aLbMetric.SaveValue(); + // Metrik ggfs. aendern (da TabPage im Dialog liegt, + // wo die Metrik eingestellt werden kann + const SfxPoolItem* pAttr = NULL; + if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_METRIC , sal_False, + (const SfxPoolItem**)&pAttr )) + { + const SfxUInt16Item* pItem = (SfxUInt16Item*) pAttr; + + FieldUnit eFUnit = (FieldUnit)(long)pItem->GetValue(); + + if( eFUnit != aMtrFldOriginalWidth.GetUnit() ) + { + // Metriken einstellen + sal_Int64 nVal = aMtrFldOriginalWidth.Denormalize( aMtrFldOriginalWidth.GetValue( FUNIT_TWIP ) ); + SetFieldUnit( aMtrFldOriginalWidth, eFUnit, sal_True ); + aMtrFldOriginalWidth.SetValue( aMtrFldOriginalWidth.Normalize( nVal ), FUNIT_TWIP ); + + nVal = aMtrFldOriginalHeight.Denormalize( aMtrFldOriginalHeight.GetValue( FUNIT_TWIP ) ); + SetFieldUnit( aMtrFldOriginalHeight, eFUnit, sal_True ); + aMtrFldOriginalHeight.SetValue( aMtrFldOriginalHeight.Normalize( nVal ), FUNIT_TWIP ); + + + if( nWidth != 0 && nHeight != 0 ) + { + aMtrFldInfo1.SetUnit( eFUnit ); + aMtrFldInfo2.SetUnit( eFUnit ); + + SetMetricValue( aMtrFldInfo1, nWidth, ePoolUnit ); + aInfo1 = aMtrFldInfo1.GetText(); + aFiInfo1.SetText( aInfo1 ); + + SetMetricValue( aMtrFldInfo2, nHeight, ePoolUnit ); + aInfo2 = aMtrFldInfo2.GetText(); + aFiInfo2.SetText( aInfo2 ); + } + } + } +} + +// ----------------------------------------------------------------------- + +int SdTpOptionsMisc::DeactivatePage( SfxItemSet* pActiveSet ) +{ + // Parsercheck + sal_Int32 nX, nY; + if( SetScale( aCbScale.GetText(), nX, nY ) ) + { + if( pActiveSet ) + FillItemSet( *pActiveSet ); + return( LEAVE_PAGE ); + } + WarningBox aWarnBox( GetParent(), WB_YES_NO, String( SdResId( STR_WARN_SCALE_FAIL ) ) ); + short nReturn = aWarnBox.Execute(); + + if( nReturn == RET_YES ) + return( KEEP_PAGE ); + + if( pActiveSet ) + FillItemSet( *pActiveSet ); + + return( LEAVE_PAGE ); +} + +// ----------------------------------------------------------------------- + +sal_Bool SdTpOptionsMisc::FillItemSet( SfxItemSet& rAttrs ) +{ + sal_Bool bModified = sal_False; + + if( aCbxStartWithTemplate.GetSavedValue() != aCbxStartWithTemplate.IsChecked() || + aCbxMarkedHitMovesAlways.GetSavedValue()!= aCbxMarkedHitMovesAlways.IsChecked() || + aCbxCrookNoContortion.GetSavedValue() != aCbxCrookNoContortion.IsChecked() || + aCbxQuickEdit.GetSavedValue() != aCbxQuickEdit.IsChecked() || + aCbxPickThrough.GetSavedValue() != aCbxPickThrough.IsChecked() || + aCbxMasterPageCache.GetSavedValue() != aCbxMasterPageCache.IsChecked() || + aCbxCopy.GetSavedValue() != aCbxCopy.IsChecked() || + aCbxStartWithActualPage.GetSavedValue() != aCbxStartWithActualPage.IsChecked() || + aCbxCompatibility.GetSavedValue() != aCbxCompatibility.IsChecked() || + aCbxUsePrinterMetrics.GetSavedValue() != aCbxUsePrinterMetrics.IsChecked() ) + { + SdOptionsMiscItem aOptsItem( ATTR_OPTIONS_MISC ); + + aOptsItem.GetOptionsMisc().SetStartWithTemplate( aCbxStartWithTemplate.IsChecked() ); + aOptsItem.GetOptionsMisc().SetMarkedHitMovesAlways( aCbxMarkedHitMovesAlways.IsChecked() ); + aOptsItem.GetOptionsMisc().SetCrookNoContortion( aCbxCrookNoContortion.IsChecked() ); + aOptsItem.GetOptionsMisc().SetQuickEdit( aCbxQuickEdit.IsChecked() ); + aOptsItem.GetOptionsMisc().SetPickThrough( aCbxPickThrough.IsChecked() ); + aOptsItem.GetOptionsMisc().SetMasterPagePaintCaching( aCbxMasterPageCache.IsChecked() ); + aOptsItem.GetOptionsMisc().SetDragWithCopy( aCbxCopy.IsChecked() ); + aOptsItem.GetOptionsMisc().SetStartWithActualPage( aCbxStartWithActualPage.IsChecked() ); + aOptsItem.GetOptionsMisc().SetSummationOfParagraphs( aCbxCompatibility.IsChecked() ); + aOptsItem.GetOptionsMisc().SetPrinterIndependentLayout ( + aCbxUsePrinterMetrics.IsChecked() + ? ::com::sun::star::document::PrinterIndependentLayout::DISABLED + : ::com::sun::star::document::PrinterIndependentLayout::ENABLED); + rAttrs.Put( aOptsItem ); + + bModified = sal_True; + } + + // Metrik + const sal_uInt16 nMPos = aLbMetric.GetSelectEntryPos(); + if ( nMPos != aLbMetric.GetSavedValue() ) + { + sal_uInt16 nFieldUnit = (sal_uInt16)(long)aLbMetric.GetEntryData( nMPos ); + rAttrs.Put( SfxUInt16Item( GetWhich( SID_ATTR_METRIC ), + (sal_uInt16)nFieldUnit ) ); + bModified |= sal_True; + } + + // Tabulatorabstand + if( aMtrFldTabstop.GetText() != aMtrFldTabstop.GetSavedValue() ) + { + sal_uInt16 nWh = GetWhich( SID_ATTR_DEFTABSTOP ); + SfxMapUnit eUnit = rAttrs.GetPool()->GetMetric( nWh ); + SfxUInt16Item aDef( nWh,(sal_uInt16)GetCoreValue( aMtrFldTabstop, eUnit ) ); + rAttrs.Put( aDef ); + bModified |= sal_True; + } + + sal_Int32 nX, nY; + if( SetScale( aCbScale.GetText(), nX, nY ) ) + { + rAttrs.Put( SfxInt32Item( ATTR_OPTIONS_SCALE_X, nX ) ); + rAttrs.Put( SfxInt32Item( ATTR_OPTIONS_SCALE_Y, nY ) ); + + bModified = sal_True; + } + + return( bModified ); +} + +// ----------------------------------------------------------------------- + +void SdTpOptionsMisc::Reset( const SfxItemSet& rAttrs ) +{ + SdOptionsMiscItem aOptsItem( (const SdOptionsMiscItem&) rAttrs. + Get( ATTR_OPTIONS_MISC ) ); + + aCbxStartWithTemplate.Check( aOptsItem.GetOptionsMisc().IsStartWithTemplate() ); + aCbxMarkedHitMovesAlways.Check( aOptsItem.GetOptionsMisc().IsMarkedHitMovesAlways() ); + aCbxCrookNoContortion.Check( aOptsItem.GetOptionsMisc().IsCrookNoContortion() ); + aCbxQuickEdit.Check( aOptsItem.GetOptionsMisc().IsQuickEdit() ); + aCbxPickThrough.Check( aOptsItem.GetOptionsMisc().IsPickThrough() ); + aCbxMasterPageCache.Check( aOptsItem.GetOptionsMisc().IsMasterPagePaintCaching() ); + aCbxCopy.Check( aOptsItem.GetOptionsMisc().IsDragWithCopy() ); + aCbxStartWithActualPage.Check( aOptsItem.GetOptionsMisc().IsStartWithActualPage() ); + aCbxCompatibility.Check( aOptsItem.GetOptionsMisc().IsSummationOfParagraphs() ); + aCbxUsePrinterMetrics.Check( aOptsItem.GetOptionsMisc().GetPrinterIndependentLayout()==1 ); + aCbxStartWithTemplate.SaveValue(); + aCbxMarkedHitMovesAlways.SaveValue(); + aCbxCrookNoContortion.SaveValue(); + aCbxQuickEdit.SaveValue(); + aCbxPickThrough.SaveValue(); + + aCbxMasterPageCache.SaveValue(); + aCbxCopy.SaveValue(); + aCbxStartWithActualPage.SaveValue(); + aCbxCompatibility.SaveValue(); + aCbxUsePrinterMetrics.SaveValue(); + + // Metrik + sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC ); + aLbMetric.SetNoSelection(); + + if ( rAttrs.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + { + const SfxUInt16Item& rItem = (SfxUInt16Item&)rAttrs.Get( nWhich ); + long nFieldUnit = (long)rItem.GetValue(); + + for ( sal_uInt16 i = 0; i < aLbMetric.GetEntryCount(); ++i ) + { + if ( (long)aLbMetric.GetEntryData( i ) == nFieldUnit ) + { + aLbMetric.SelectEntryPos( i ); + break; + } + } + } + + // Tabulatorabstand + nWhich = GetWhich( SID_ATTR_DEFTABSTOP ); + if( rAttrs.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + { + SfxMapUnit eUnit = rAttrs.GetPool()->GetMetric( nWhich ); + const SfxUInt16Item& rItem = (SfxUInt16Item&)rAttrs.Get( nWhich ); + SetMetricValue( aMtrFldTabstop, rItem.GetValue(), eUnit ); + } + aLbMetric.SaveValue(); + aMtrFldTabstop.SaveValue(); + //Scale + sal_Int32 nX = ( (const SfxInt32Item&) rAttrs. + Get( ATTR_OPTIONS_SCALE_X ) ).GetValue(); + sal_Int32 nY = ( (const SfxInt32Item&) rAttrs. + Get( ATTR_OPTIONS_SCALE_Y ) ).GetValue(); + nWidth = ( (const SfxUInt32Item&) rAttrs. + Get( ATTR_OPTIONS_SCALE_WIDTH ) ).GetValue(); + nHeight = ( (const SfxUInt32Item&) rAttrs. + Get( ATTR_OPTIONS_SCALE_HEIGHT ) ).GetValue(); + + aCbScale.SetText( GetScale( nX, nY ) ); + + aFtOriginal.Hide(); + aFtEquivalent.Hide(); + aMtrFldOriginalWidth.Hide(); + aMtrFldOriginalWidth.SetText( aInfo1 ); // leer + aMtrFldOriginalHeight.Hide(); + aMtrFldOriginalHeight.SetText( aInfo2 ); //leer + aFtPageWidth.Hide(); + aFtPageHeight.Hide(); + aFiInfo1.Hide(); + aFiInfo2.Hide(); + + UpdateCompatibilityControls (); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SdTpOptionsMisc::Create( Window* pWindow, + const SfxItemSet& rAttrs ) +{ + return( new SdTpOptionsMisc( pWindow, rAttrs ) ); +} +//------------------------------------------------------------------------ + +IMPL_LINK( SdTpOptionsMisc, SelectMetricHdl_Impl, ListBox *, EMPTYARG ) +{ + sal_uInt16 nPos = aLbMetric.GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + FieldUnit eUnit = (FieldUnit)(long)aLbMetric.GetEntryData( nPos ); + sal_Int64 nVal = + aMtrFldTabstop.Denormalize( aMtrFldTabstop.GetValue( FUNIT_TWIP ) ); + SetFieldUnit( aMtrFldTabstop, eUnit ); + aMtrFldTabstop.SetValue( aMtrFldTabstop.Normalize( nVal ), FUNIT_TWIP ); + } + return 0; +} + + +namespace { +void lcl_MoveWin( Window& rWin, long nYDiff) +{ + Point aPos(rWin.GetPosPixel()); + aPos.Y() += nYDiff; + rWin.SetPosPixel (aPos); +} + +void lcl_MoveWin( Window& rWin, long nXdiff, long nYdiff) +{ + Point aPos(rWin.GetPosPixel()); + aPos.X() += nXdiff; + aPos.Y() += nYdiff; + rWin.SetPosPixel(aPos); +} +} + +void SdTpOptionsMisc::SetImpressMode (void) +{ + long nDialogWidth = GetSizePixel().Width(); + long nLineHeight = aCbxPickThrough.GetPosPixel().Y() + - aCbxQuickEdit.GetPosPixel().Y(); + + // Put both "Text objects" check boxes side by side. + lcl_MoveWin (aCbxPickThrough, + nDialogWidth/2 - aCbxPickThrough.GetPosPixel().X(), + -nLineHeight); + + // Move the other controls up one line. + lcl_MoveWin (aGrpProgramStart, -nLineHeight); + lcl_MoveWin (aCbxStartWithTemplate, -nLineHeight); + lcl_MoveWin (aGrpSettings, -nLineHeight); + lcl_MoveWin (aCbxMasterPageCache, -nLineHeight); + lcl_MoveWin (aCbxCopy, -nLineHeight); + lcl_MoveWin (aCbxMarkedHitMovesAlways, -nLineHeight); + lcl_MoveWin (aCbxCrookNoContortion, -nLineHeight); + lcl_MoveWin (aTxtMetric, -nLineHeight); + lcl_MoveWin (aLbMetric, -nLineHeight); + lcl_MoveWin (aTxtTabstop, -nLineHeight); + lcl_MoveWin (aMtrFldTabstop, -nLineHeight); + lcl_MoveWin (aGrpStartWithActualPage, -nLineHeight); + lcl_MoveWin (aCbxStartWithActualPage, -nLineHeight); + lcl_MoveWin (aTxtCompatibility, -nLineHeight); + + // Move the printer-independent-metrics check box up two lines to change + // places with spacing-between-paragraphs check box. + lcl_MoveWin (aCbxUsePrinterMetrics, -2*nLineHeight); +} + +void SdTpOptionsMisc::SetDrawMode() +{ + aCbxStartWithTemplate.Hide(); + aGrpProgramStart.Hide(); + aCbxStartWithActualPage.Hide(); + aCbxCompatibility.Hide(); + aGrpStartWithActualPage.Hide(); + aCbxCrookNoContortion.Show(); + + aGrpScale.Show(); + aFtScale.Show(); + aCbScale.Show(); + + aFtOriginal.Show(); + aFtEquivalent.Show(); + + aFtPageWidth.Show(); + aFiInfo1.Show(); + aMtrFldOriginalWidth.Show(); + + aFtPageHeight.Show(); + aFiInfo2.Show(); + aMtrFldOriginalHeight.Show(); + + long nDiff = aGrpSettings.GetPosPixel().Y() - aGrpProgramStart.GetPosPixel().Y(); + lcl_MoveWin( aGrpSettings, -nDiff ); + lcl_MoveWin( aCbxMasterPageCache, -nDiff ); + lcl_MoveWin( aCbxCopy, -nDiff ); + lcl_MoveWin( aCbxMarkedHitMovesAlways, -nDiff ); + lcl_MoveWin( aCbxCrookNoContortion, -nDiff ); + nDiff -= aCbxCrookNoContortion.GetPosPixel().Y() - aCbxMarkedHitMovesAlways.GetPosPixel().Y(); + lcl_MoveWin( aTxtMetric, -nDiff ); + lcl_MoveWin( aLbMetric, -nDiff ); + lcl_MoveWin( aTxtTabstop, -nDiff ); + lcl_MoveWin( aMtrFldTabstop, -nDiff ); + + // Move the scale controls so that they are visually centered betwen the + // group controls above and below. + lcl_MoveWin (aFtScale, -17); + lcl_MoveWin (aCbScale, -17); + + // Move the printer-independent-metrics check box in the place that the + // spacing-between-paragraphs check box normally is in. + aCbxUsePrinterMetrics.SetPosPixel (aCbxCompatibility.GetPosPixel()); +} +// ----------------------------------------------------------------------- + +IMPL_LINK( SdTpOptionsMisc, ModifyScaleHdl, void *, EMPTYARG ) +{ + // Originalgroesse berechnen + sal_Int32 nX, nY; + if( SetScale( aCbScale.GetText(), nX, nY ) ) + { + sal_Int32 nW = nWidth * nY / nX; + sal_Int32 nH = nHeight * nY / nX; + + SetMetricValue( aMtrFldOriginalWidth, nW, ePoolUnit ); + SetMetricValue( aMtrFldOriginalHeight, nH, ePoolUnit ); + } + + return( 0L ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SdTpOptionsMisc, ModifyOriginalScaleHdl, void *, EMPTYARG ) +{ + // Berechnen des Massstabs + long nOrgW = static_cast<long>(aMtrFldOriginalWidth.GetValue()); + long nOrgH = static_cast<long>(aMtrFldOriginalHeight.GetValue()); + + if( nOrgW == 0 || nOrgH == 0 ) + return( 0L ); + + Fraction aFract1( nOrgW, static_cast<long>(aMtrFldInfo1.GetValue()) ); + Fraction aFract2( nOrgH, static_cast<long>(aMtrFldInfo2.GetValue()) ); + Fraction aFract( aFract1 > aFract2 ? aFract1 : aFract2 ); + + long nValue; + if( aFract < Fraction( 1, 1 ) ) + { + // Fraction umdrehen + aFract1 = aFract; + aFract = Fraction( aFract1.GetDenominator(), aFract1.GetNumerator() ); + nValue = aFract; + + // Swap nominator and denominator + aCbScale.SetText( GetScale( nValue, 1 ) ); + } + else + { + double fValue = aFract; + nValue = aFract; + if( fValue > (double)nValue ) + nValue++; + + // Swap nominator and denominator + aCbScale.SetText( GetScale( 1, nValue ) ); + } + return( 0L ); +} + +// ----------------------------------------------------------------------- + +String SdTpOptionsMisc::GetScale( sal_Int32 nX, sal_Int32 nY ) +{ + String aScale( UniString::CreateFromInt32( nX ) ); + aScale.Append( TOKEN ); + aScale.Append( UniString::CreateFromInt32( nY ) ); + + return( aScale ); +} + +// ----------------------------------------------------------------------- + +sal_Bool SdTpOptionsMisc::SetScale( const String& aScale, sal_Int32& rX, sal_Int32& rY ) +{ + if( aScale.GetTokenCount( TOKEN ) != 2 ) + return( sal_False ); + + ByteString aTmp( aScale.GetToken( 0, TOKEN ), RTL_TEXTENCODING_ASCII_US ); + if( !aTmp.IsNumericAscii() ) + return( sal_False ); + + rX = (long) aTmp.ToInt32(); + if( rX == 0 ) + return( sal_False ); + + aTmp = ByteString( aScale.GetToken( 1, TOKEN ), RTL_TEXTENCODING_ASCII_US ); + if( !aTmp.IsNumericAscii() ) + return( sal_False ); + + rY = (long) aTmp.ToInt32(); + if( rY == 0 ) + return( sal_False ); + + return( sal_True ); +} + + + + +void SdTpOptionsMisc::UpdateCompatibilityControls (void) +{ + // Disable the compatibility controls by default. Enable them only when + // there is at least one open document. + sal_Bool bIsEnabled = sal_False; + + try + { + // Get a component enumeration from the desktop and search it for documents. + Reference<lang::XMultiServiceFactory> xFactory ( + ::comphelper::getProcessServiceFactory ()); + do + { + if ( ! xFactory.is()) + break; + + Reference<frame::XDesktop> xDesktop (xFactory->createInstance ( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), UNO_QUERY); + if ( ! xDesktop.is()) + break; + + Reference<container::XEnumerationAccess> xComponents ( + xDesktop->getComponents(), UNO_QUERY); + if ( ! xComponents.is()) + break; + + Reference<container::XEnumeration> xEnumeration ( + xComponents->createEnumeration()); + if ( ! xEnumeration.is()) + break; + + while (xEnumeration->hasMoreElements()) + { + Reference<frame::XModel> xModel (xEnumeration->nextElement(), UNO_QUERY); + if (xModel.is()) + { + // There is at leas one model/document: Enable the compatibility controls. + bIsEnabled = sal_True; + break; + } + } + + } + while (false); // One 'loop'. + } + catch (uno::Exception e) + { + // When there is an exception then simply use the default value of + // bIsEnabled and disable the controls. + } + + aTxtCompatibility.Enable (bIsEnabled); + aCbxCompatibility.Enable(bIsEnabled); + aCbxUsePrinterMetrics.Enable (bIsEnabled); +} + +void SdTpOptionsMisc::PageCreated (SfxAllItemSet aSet) +{ + SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_SDMODE_FLAG,sal_False); + if (pFlagItem) + { + sal_uInt32 nFlags=pFlagItem->GetValue(); + if ( ( nFlags & SD_DRAW_MODE ) == SD_DRAW_MODE ) + SetDrawMode(); + if ( ( nFlags & SD_IMPRESS_MODE ) == SD_IMPRESS_MODE ) + SetImpressMode(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/tpoption.src b/sd/source/ui/dlg/tpoption.src new file mode 100644 index 000000000000..67c8f40341e6 --- /dev/null +++ b/sd/source/ui/dlg/tpoption.src @@ -0,0 +1,379 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#include "tpoption.hrc" +#include "helpids.h" + +#define SCALE_TEXT \ + Text [ en-US ] = "Scale" ; \ + + // Contents (Inhalte) +TabPage TP_OPTIONS_CONTENTS +{ + HelpID = HID_SD_OPTIONS_CONTENTS ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE; + Text [ en-US ] = "Contents" ; + FixedLine GRP_DISPLAY + { + Pos = MAP_APPFONT ( 6 , 72 - 69 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Display" ; + }; + CheckBox CBX_RULER + { + HelpID = "sd:CheckBox:TP_OPTIONS_CONTENTS:CBX_RULER"; + Pos = MAP_APPFONT ( 12 , 83 - 69 ) ; + Size = MAP_APPFONT ( 160 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Rulers visible" ; + }; + CheckBox CBX_HELPLINES + { + HelpID = "sd:CheckBox:TP_OPTIONS_CONTENTS:CBX_HELPLINES"; + Pos = MAP_APPFONT ( 12 , 97 - 69 ) ; + Size = MAP_APPFONT ( 160 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Guides when moving" ; + }; + CheckBox CBX_HANDLES_BEZIER + { + HelpID = "sd:CheckBox:TP_OPTIONS_CONTENTS:CBX_HANDLES_BEZIER"; + Pos = MAP_APPFONT ( 12 , 111 - 69 ) ; + Size = MAP_APPFONT ( 160 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~All control points in Bézier editor" ; + }; + CheckBox CBX_MOVE_OUTLINE + { + HelpID = "sd:CheckBox:TP_OPTIONS_CONTENTS:CBX_MOVE_OUTLINE"; + Pos = MAP_APPFONT ( 12 , 125 - 69 ) ; + Size = MAP_APPFONT ( 160 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Contour of each individual object" ; + }; +}; + // MISC (Sonstiges) +TabPage TP_OPTIONS_MISC +{ + HelpID = HID_SD_OPTIONS_MISC ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE; + Text [ en-US ] = "Other" ; + FixedLine GRP_TEXT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Text objects" ; + }; + CheckBox CBX_QUICKEDIT + { + HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_QUICKEDIT"; + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 116 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Allow quick editing" ; + }; + CheckBox CBX_PICKTHROUGH + { + HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_PICKTHROUGH"; + Pos = MAP_APPFONT ( 12 , 27 ) ; + Size = MAP_APPFONT ( 116 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Only text area selectable" ; + }; + FixedLine GRP_PROGRAMSTART + { + Pos = MAP_APPFONT ( 6 , 42 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "New document" ; + }; + CheckBox CBX_START_WITH_TEMPLATE + { + HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_START_WITH_TEMPLATE"; + Pos = MAP_APPFONT ( 12 , 53 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Start with ~wizard" ; + }; + FixedLine GRP_SETTINGS + { + Pos = MAP_APPFONT ( 6 , 69 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Settings"; + }; + CheckBox CBX_MASTERPAGE_CACHE + { + HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_MASTERPAGE_CACHE"; + Pos = MAP_APPFONT ( 12 , 80 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Use background cache" ; + }; + CheckBox CBX_COPY + { + HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_COPY"; + Pos = MAP_APPFONT ( 12 , 93 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Copy when moving" ; + }; + CheckBox CBX_MARKED_HIT_MOVES_ALWAYS + { + HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_MARKED_HIT_MOVES_ALWAYS"; + Pos = MAP_APPFONT ( 12 , 106 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Objects always moveable" ; + }; + CheckBox CBX_CROOK_NO_CONTORTION + { + HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_CROOK_NO_CONTORTION"; + Pos = MAP_APPFONT ( 12 , 119 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + TabStop = TRUE ; + Hide = TRUE; + Text [ en-US ] = "Do not distort objects in curve" ; + }; + FixedText FT_METRIC + { + Pos = MAP_APPFONT ( 12 , 119 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "Unit of ~measurement" ; + }; + ListBox LB_METRIC + { + HelpID = "sd:ListBox:TP_OPTIONS_MISC:LB_METRIC"; + Border = TRUE ; + Pos = MAP_APPFONT ( 75 , 117 ) ; + Size = MAP_APPFONT ( 50 , 50 ) ; + DropDown = TRUE ; + }; + FixedText FT_TABSTOP + { + Pos = MAP_APPFONT ( 130 , 119 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Right = TRUE; + Text [ en-US ] = "Ta~b stops" ; + }; + MetricField MTR_FLD_TABSTOP + { + HelpID = "sd:MetricField:TP_OPTIONS_MISC:MTR_FLD_TABSTOP"; + Border = TRUE ; + Pos = MAP_APPFONT ( 206 , 117 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Unit = FUNIT_CM ; + SpinSize = 10 ; + Minimum = 50 ; + Maximum = 2000; + First = 50 ; + Last = 2000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + }; + FixedLine GRP_START_WITH_ACTUAL_PAGE + { + Pos = MAP_APPFONT ( 6 , 134 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Start presentation" ; + }; + CheckBox CBX_START_WITH_ACTUAL_PAGE + { + HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CBX_START_WITH_ACTUAL_PAGE"; + Pos = MAP_APPFONT ( 12 , 145 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Always with current page" ; + }; + FixedLine FT_COMPATIBILITY + { + Pos = MAP_APPFONT ( 6 , 160 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Compatibility" ; + }; + CheckBox CB_USE_PRINTER_METRICS + { + HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CB_USE_PRINTER_METRICS"; + // This checkbox and the following one will change places when this + // one is wired in into the dialog. At the moment exists only for + // translation to work on. + Pos = MAP_APPFONT ( 12 , 184 ) ; + Size = MAP_APPFONT ( 242, 10 ) ; + Text [ en-US ] = "Us~e printer metrics for document formatting"; + }; + CheckBox CB_MERGE_PARA_DIST + { + HelpID = "sd:CheckBox:TP_OPTIONS_MISC:CB_MERGE_PARA_DIST"; + Pos = MAP_APPFONT ( 12 , 171 ) ; + Size = MAP_APPFONT ( 242, 10 ) ; + Text [ en-US ] = "Add ~spacing between paragraphs and tables (in current document)"; + }; + FixedLine GRP_SCALE + { + Hide = TRUE; + Pos = MAP_APPFONT ( 6 , 122 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + SCALE_TEXT + }; + FixedText FT_ORIGINAL + { + Hide = TRUE; + Pos = MAP_APPFONT ( 155 , 133 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "Original"; + }; + FixedText FT_EQUIVALENT + { + Hide = TRUE; + Pos = MAP_APPFONT ( 206 , 133 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "Equivalent to"; + }; + FixedText FT_SCALE + { + Hide = TRUE; + Pos = MAP_APPFONT ( 12 , 149 ) ; + Size = MAP_APPFONT ( 56 , 8 ) ; + Text [ en-US ] = "~Drawing scale"; + }; + ComboBox CB_SCALE + { + HelpID = "sd:ComboBox:TP_OPTIONS_MISC:CB_SCALE"; + Hide = TRUE; + Pos = MAP_APPFONT ( 72 , 147 ) ; + Size = MAP_APPFONT ( 30 , 70 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_PAGEWIDTH + { + Hide = TRUE; + Pos = MAP_APPFONT ( 105 , 149 ) ; + Size = MAP_APPFONT ( 49 , 8 ) ; + Text [ en-US ] = "Page ~width" ; + }; + FixedText FI_INFO_1 + { + Hide = TRUE; + Pos = MAP_APPFONT ( 155 , 149 ) ; + Size = MAP_APPFONT ( 49 , 8 ) ; + }; + MetricField MTR_FLD_ORIGINAL_WIDTH + { + HelpID = "sd:MetricField:TP_OPTIONS_MISC:MTR_FLD_ORIGINAL_WIDTH"; + Hide = TRUE; + Border = TRUE ; + Pos = MAP_APPFONT ( 206 , 147 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + SpinSize = 100 ; + Minimum = 1 ; + Maximum = 999999999 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = 1 ; + Last = 999999999 ; + }; + FixedText FT_PAGEHEIGHT + { + Hide = TRUE; + Pos = MAP_APPFONT ( 105 , 165 ) ; + Size = MAP_APPFONT ( 49 , 8 ) ; + Text [ en-US ] = "Page ~height" ; + }; + FixedText FI_INFO_2 + { + Hide = TRUE; + Pos = MAP_APPFONT ( 155 , 165 ) ; + Size = MAP_APPFONT ( 49 , 8 ) ; + }; + MetricField MTR_FLD_ORIGINAL_HEIGHT + { + HelpID = "sd:MetricField:TP_OPTIONS_MISC:MTR_FLD_ORIGINAL_HEIGHT"; + Hide = TRUE; + Border = TRUE ; + Pos = MAP_APPFONT ( 206 , 163 ) ; + Size = MAP_APPFONT ( 45 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + SpinSize = 100 ; + Minimum = 1 ; + Maximum = 999999999 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = 1 ; + Last = 999999999 ; + }; + +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/ui/dlg/unchss.cxx b/sd/source/ui/dlg/unchss.cxx new file mode 100644 index 000000000000..4e066fbd364d --- /dev/null +++ b/sd/source/ui/dlg/unchss.cxx @@ -0,0 +1,181 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + + +#include <svl/itemset.hxx> +#include <svl/style.hxx> +#include <svl/smplhint.hxx> +#include <svx/svdobj.hxx> + +#include "unchss.hxx" + +#include "strings.hrc" +#include "glob.hxx" +#include "sdresid.hxx" +#include "drawdoc.hxx" +#include "stlsheet.hxx" +#include "glob.hrc" + + +TYPEINIT1(StyleSheetUndoAction, SdUndoAction); + + + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +StyleSheetUndoAction::StyleSheetUndoAction(SdDrawDocument* pTheDoc, + SfxStyleSheet* pTheStyleSheet, + const SfxItemSet* pTheNewItemSet) : + SdUndoAction(pTheDoc) +{ + DBG_ASSERT(pTheStyleSheet, "Undo ohne StyleSheet ???"); + pStyleSheet = pTheStyleSheet; + + // ItemSets anlegen; Vorsicht, das neue koennte aus einem anderen Pool + // stammen, also mitsamt seinen Items clonen + pNewSet = new SfxItemSet((SfxItemPool&)SdrObject::GetGlobalDrawObjectItemPool(), pTheNewItemSet->GetRanges()); + pTheDoc->MigrateItemSet( pTheNewItemSet, pNewSet, pTheDoc ); + + pOldSet = new SfxItemSet((SfxItemPool&)SdrObject::GetGlobalDrawObjectItemPool(),pStyleSheet->GetItemSet().GetRanges()); + pTheDoc->MigrateItemSet( &pStyleSheet->GetItemSet(), pOldSet, pTheDoc ); + + aComment = String(SdResId(STR_UNDO_CHANGE_PRES_OBJECT)); + String aName(pStyleSheet->GetName()); + + // Layoutnamen und Separator loeschen + String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ) ); + sal_uInt16 nPos = aName.Search(aSep); + if( nPos != STRING_NOTFOUND ) + aName.Erase(0, nPos + aSep.Len()); + + if (aName == String(SdResId(STR_LAYOUT_TITLE))) + { + aName = String(SdResId(STR_PSEUDOSHEET_TITLE)); + } + else if (aName == String(SdResId(STR_LAYOUT_SUBTITLE))) + { + aName = String(SdResId(STR_PSEUDOSHEET_SUBTITLE)); + } + else if (aName == String(SdResId(STR_LAYOUT_BACKGROUND))) + { + aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUND)); + } + else if (aName == String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS))) + { + aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS)); + } + else if (aName == String(SdResId(STR_LAYOUT_NOTES))) + { + aName = String(SdResId(STR_PSEUDOSHEET_NOTES)); + } + else + { + String aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE)); + nPos = aName.Search(aOutlineStr); + if (nPos != STRING_NOTFOUND) + { + String aNumStr(aName.Copy(aOutlineStr.Len())); + aName = String(SdResId(STR_LAYOUT_OUTLINE)); + aName += aNumStr; + } + } + + // Platzhalter durch Vorlagennamen ersetzen + nPos = aComment.Search(sal_Unicode('$')); + aComment.Erase(nPos, 1); + aComment.Insert(aName, nPos); +} + + +/************************************************************************* +|* +|* Undo() +|* +\************************************************************************/ + +void StyleSheetUndoAction::Undo() +{ + SfxItemSet aNewSet( mpDoc->GetItemPool(), pOldSet->GetRanges() ); + mpDoc->MigrateItemSet( pOldSet, &aNewSet, mpDoc ); + + pStyleSheet->GetItemSet().Set(aNewSet); + if( pStyleSheet->GetFamily() == SD_STYLE_FAMILY_PSEUDO ) + ( (SdStyleSheet*)pStyleSheet )->GetRealStyleSheet()->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + else + pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); +} + +/************************************************************************* +|* +|* Redo() +|* +\************************************************************************/ + +void StyleSheetUndoAction::Redo() +{ + SfxItemSet aNewSet( mpDoc->GetItemPool(), pOldSet->GetRanges() ); + mpDoc->MigrateItemSet( pNewSet, &aNewSet, mpDoc ); + + pStyleSheet->GetItemSet().Set(aNewSet); + if( pStyleSheet->GetFamily() == SD_STYLE_FAMILY_PSEUDO ) + ( (SdStyleSheet*)pStyleSheet )->GetRealStyleSheet()->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + else + pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); +} + +/************************************************************************* +|* +|* Destruktor +|* +\************************************************************************/ + +StyleSheetUndoAction::~StyleSheetUndoAction() +{ + delete pNewSet; + delete pOldSet; +} + +/************************************************************************* +|* +|* Kommentar liefern +|* +\************************************************************************/ + +String StyleSheetUndoAction::GetComment() const +{ + return aComment; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx new file mode 100644 index 000000000000..e05a9d393b49 --- /dev/null +++ b/sd/source/ui/dlg/vectdlg.cxx @@ -0,0 +1,400 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif +#include <vcl/vclenum.hxx> +#include <vcl/wrkwin.hxx> + +#include "strings.hrc" +#include "sdresid.hxx" +#include "DrawDocShell.hxx" +#include "sdmod.hxx" +#include "sdiocmpt.hxx" +#include "DrawDocShell.hxx" +#include "vectdlg.hxx" +#include "vectdlg.hrc" +#include <tools/config.hxx> +#include <vcl/bmpacc.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/metaact.hxx> + +// ----------- +// - Defines - +// ----------- + +#define VECTORIZE_MAX_EXTENT 512 + +// ------------------ +// - SdVectorizeDlg - +// ------------------ + +SdVectorizeDlg::SdVectorizeDlg( + Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ) : + ModalDialog ( pParent, SdResId( DLG_VECTORIZE ) ), + mpDocSh ( pDocShell ), + aGrpSettings ( this, SdResId( GRP_SETTINGS ) ), + aFtLayers ( this, SdResId( FT_LAYERS ) ), + aNmLayers ( this, SdResId( NM_LAYERS ) ), + aFtReduce ( this, SdResId( FT_REDUCE ) ), + aMtReduce ( this, SdResId( MT_REDUCE ) ), + aFtFillHoles ( this, SdResId( FT_FILLHOLES ) ), + aMtFillHoles ( this, SdResId( MT_FILLHOLES ) ), + aCbFillHoles ( this, SdResId( CB_FILLHOLES ) ), + aFtOriginal ( this, SdResId( FT_ORIGINAL ) ), + aBmpWin ( this, SdResId( CTL_BMP ) ), + aFtVectorized ( this, SdResId( FT_VECTORIZED ) ), + aMtfWin ( this, SdResId( CTL_WMF ) ), + aGrpPrgs ( this, SdResId( GRP_PRGS ) ), + aPrgs ( this, SdResId( WND_PRGS ) ), + aBtnOK ( this, SdResId( BTN_OK ) ), + aBtnCancel ( this, SdResId( BTN_CANCEL ) ), + aBtnHelp ( this, SdResId( BTN_HELP ) ), + aBtnPreview ( this, SdResId( BTN_PREVIEW ) ), + aBmp ( rBmp ) +{ + FreeResource(); + + aBtnPreview.SetClickHdl( LINK( this, SdVectorizeDlg, ClickPreviewHdl ) ); + aBtnOK.SetClickHdl( LINK( this, SdVectorizeDlg, ClickOKHdl ) ); + aNmLayers.SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) ); + aMtReduce.SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) ); + aMtFillHoles.SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) ); + aCbFillHoles.SetToggleHdl( LINK( this, SdVectorizeDlg, ToggleHdl ) ); + + // disable 3D border + aBmpWin.SetBorderStyle(WINDOW_BORDER_MONO); + aMtfWin.SetBorderStyle(WINDOW_BORDER_MONO); + + LoadSettings(); + InitPreviewBmp(); +} + +// ----------------------------------------------------------------------------- + +SdVectorizeDlg::~SdVectorizeDlg() +{ +} + +// ----------------------------------------------------------------------------- + +Rectangle SdVectorizeDlg::GetRect( const Size& rDispSize, const Size& rBmpSize ) const +{ + Rectangle aRect; + + if( rBmpSize.Width() && rBmpSize.Height() && rDispSize.Width() && rDispSize.Height() ) + { + Size aBmpSize( rBmpSize ); + const double fGrfWH = (double) aBmpSize.Width() / aBmpSize.Height(); + const double fWinWH = (double) rDispSize.Width() / rDispSize.Height(); + + if( fGrfWH < fWinWH ) + { + aBmpSize.Width() = (long) ( rDispSize.Height() * fGrfWH ); + aBmpSize.Height()= rDispSize.Height(); + } + else + { + aBmpSize.Width() = rDispSize.Width(); + aBmpSize.Height()= (long) ( rDispSize.Width() / fGrfWH); + } + + const Point aBmpPos( ( rDispSize.Width() - aBmpSize.Width() ) >> 1, + ( rDispSize.Height() - aBmpSize.Height() ) >> 1 ); + + aRect = Rectangle( aBmpPos, aBmpSize ); + } + + return aRect; +} + +// ----------------------------------------------------------------------------- + +void SdVectorizeDlg::InitPreviewBmp() +{ + const Rectangle aRect( GetRect( aBmpWin.GetSizePixel(), aBmp.GetSizePixel() ) ); + + aPreviewBmp = aBmp; + aPreviewBmp.Scale( aRect.GetSize() ); + aBmpWin.SetGraphic( aPreviewBmp ); +} + +// ----------------------------------------------------------------------------- + +Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap& rBmp, Fraction& rScale ) +{ + Bitmap aNew( rBmp ); + const Size aSizePix( aNew.GetSizePixel() ); + + if( aSizePix.Width() > VECTORIZE_MAX_EXTENT || aSizePix.Height() > VECTORIZE_MAX_EXTENT ) + { + const Rectangle aRect( GetRect( Size( VECTORIZE_MAX_EXTENT, VECTORIZE_MAX_EXTENT ), aSizePix ) ); + rScale = Fraction( aSizePix.Width(), aRect.GetWidth() ); + aNew.Scale( aRect.GetSize() ); + } + else + rScale = Fraction( 1, 1 ); + + aNew.ReduceColors( (sal_uInt16) aNmLayers.GetValue(), BMP_REDUCE_SIMPLE ); + + return aNew; +} + +// ----------------------------------------------------------------------------- + +void SdVectorizeDlg::Calculate( Bitmap& rBmp, GDIMetaFile& rMtf ) +{ + mpDocSh->SetWaitCursor( sal_True ); + aPrgs.SetValue( 0 ); + + Fraction aScale; + Bitmap aTmp( GetPreparedBitmap( rBmp, aScale ) ); + + if( !!aTmp ) + { + const Link aPrgsHdl( LINK( this, SdVectorizeDlg, ProgressHdl ) ); + aTmp.Vectorize( rMtf, (sal_uInt8) aMtReduce.GetValue(), BMP_VECTORIZE_OUTER | BMP_VECTORIZE_REDUCE_EDGES, &aPrgsHdl ); + + if( aCbFillHoles.IsChecked() ) + { + GDIMetaFile aNewMtf; + BitmapReadAccess* pRAcc = aTmp.AcquireReadAccess(); + + if( pRAcc ) + { + const long nWidth = pRAcc->Width(); + const long nHeight = pRAcc->Height(); + const long nTileX = static_cast<long>(aMtFillHoles.GetValue()); + const long nTileY = static_cast<long>(aMtFillHoles.GetValue()); + const long nCountX = nWidth / nTileX; + const long nCountY = nHeight / nTileY; + const long nRestX = nWidth % nTileX; + const long nRestY = nHeight % nTileY; + + MapMode aMap( rMtf.GetPrefMapMode() ); + aNewMtf.SetPrefSize( rMtf.GetPrefSize() ); + aNewMtf.SetPrefMapMode( aMap ); + + for( long nTY = 0; nTY < nCountY; nTY++ ) + { + const long nY = nTY * nTileY; + + for( long nTX = 0; nTX < nCountX; nTX++ ) + AddTile( pRAcc, aNewMtf, nTX * nTileX, nTY * nTileY, nTileX, nTileY ); + + if( nRestX ) + AddTile( pRAcc, aNewMtf, nCountX * nTileX, nY, nRestX, nTileY ); + } + + if( nRestY ) + { + const long nY = nCountY * nTileY; + + for( long nTX = 0; nTX < nCountX; nTX++ ) + AddTile( pRAcc, aNewMtf, nTX * nTileX, nY, nTileX, nRestY ); + + if( nRestX ) + AddTile( pRAcc, aNewMtf, nCountX * nTileX, nCountY * nTileY, nRestX, nRestY ); + } + + + aTmp.ReleaseAccess( pRAcc ); + + for( sal_uLong n = 0UL, nCount = rMtf.GetActionCount(); n < nCount; n++ ) + aNewMtf.AddAction( rMtf.GetAction( n )->Clone() ); + + aMap.SetScaleX( aMap.GetScaleX() * aScale ); + aMap.SetScaleY( aMap.GetScaleY() * aScale ); + aNewMtf.SetPrefMapMode( aMap ); + rMtf = aNewMtf; + } + } + } + + aPrgs.SetValue( 0 ); + mpDocSh->SetWaitCursor( sal_False ); +} + +// ----------------------------------------------------------------------------- + +void SdVectorizeDlg::AddTile( BitmapReadAccess* pRAcc, GDIMetaFile& rMtf, + long nPosX, long nPosY, long nWidth, long nHeight ) +{ + sal_uLong nSumR = 0UL, nSumG = 0UL, nSumB = 0UL; + const long nRight = nPosX + nWidth - 1L; + const long nBottom = nPosY + nHeight - 1L; + const double fMult = 1.0 / ( nWidth * nHeight ); + + for( long nY = nPosY; nY <= nBottom; nY++ ) + { + for( long nX = nPosX; nX <= nRight; nX++ ) + { + const BitmapColor aPixel( pRAcc->GetColor( nY, nX ) ); + + nSumR += aPixel.GetRed(); + nSumG += aPixel.GetGreen(); + nSumB += aPixel.GetBlue(); + } + } + + const Color aColor( (sal_uInt8) FRound( nSumR * fMult ), + (sal_uInt8) FRound( nSumG * fMult ), + (sal_uInt8) FRound( nSumB * fMult ) ); + + Rectangle aRect( Point( nPosX, nPosY ), Size( nWidth + 1, nHeight + 1 ) ); + const Size& rMaxSize = rMtf.GetPrefSize(); + + aRect = PixelToLogic( aRect, rMtf.GetPrefMapMode() ); + + if( aRect.Right() > ( rMaxSize.Width() - 1L ) ) + aRect.Right() = rMaxSize.Width() - 1L; + + if( aRect.Bottom() > ( rMaxSize.Height() - 1L ) ) + aRect.Bottom() = rMaxSize.Height() - 1L; + + rMtf.AddAction( new MetaLineColorAction( aColor, sal_True ) ); + rMtf.AddAction( new MetaFillColorAction( aColor, sal_True ) ); + rMtf.AddAction( new MetaRectAction( aRect ) ); +} + +// ----------------------------------------------------------------------------- + +IMPL_LINK( SdVectorizeDlg, ProgressHdl, void*, pData ) +{ + aPrgs.SetValue( (sal_uInt16)(sal_uLong) pData ); + return 0L; +} + +// ----------------------------------------------------------------------------- + +IMPL_LINK( SdVectorizeDlg, ClickPreviewHdl, PushButton*, EMPTYARG ) +{ + Calculate( aBmp, aMtf ); + aMtfWin.SetGraphic( aMtf ); + aBtnPreview.Disable(); + + return 0L; +} + +// ----------------------------------------------------------------------------- + +IMPL_LINK( SdVectorizeDlg, ClickOKHdl, OKButton*, EMPTYARG ) +{ + if( aBtnPreview.IsEnabled() ) + Calculate( aBmp, aMtf ); + + SaveSettings(); + EndDialog( RET_OK ); + + return 0L; +} + +// ----------------------------------------------------------------------------- + +IMPL_LINK( SdVectorizeDlg, ToggleHdl, CheckBox*, pCb ) +{ + if( pCb->IsChecked() ) + { + aFtFillHoles.Enable(); + aMtFillHoles.Enable(); + } + else + { + aFtFillHoles.Disable(); + aMtFillHoles.Disable(); + } + + ModifyHdl( NULL ); + + return 0L; +} + +// ----------------------------------------------------------------------------- + +IMPL_LINK( SdVectorizeDlg, ModifyHdl, void*, EMPTYARG ) +{ + aBtnPreview.Enable(); + return 0L; +} + +// ----------------------------------------------------------------------------- + +void SdVectorizeDlg::LoadSettings() +{ + SvStorageStreamRef xIStm( SD_MOD()->GetOptionStream( + UniString::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM( SD_OPTION_VECTORIZE ) ), + SD_OPTION_LOAD ) ); + sal_uInt16 nLayers; + sal_uInt16 nReduce; + sal_uInt16 nFillHoles; + sal_Bool bFillHoles; + + if( xIStm.Is() ) + { + SdIOCompat aCompat( *xIStm, STREAM_READ ); + *xIStm >> nLayers >> nReduce >> nFillHoles >> bFillHoles; + } + else + { + nLayers = 8; + nReduce = 0; + nFillHoles = 32; + bFillHoles = sal_False; + } + + aNmLayers.SetValue( nLayers ); + aMtReduce.SetValue( nReduce ); + aMtFillHoles.SetValue( nFillHoles ); + aCbFillHoles.Check( bFillHoles ); + + ToggleHdl( &aCbFillHoles ); +} + +// ----------------------------------------------------------------------------- + +void SdVectorizeDlg::SaveSettings() const +{ + SvStorageStreamRef xOStm( SD_MOD()->GetOptionStream( + UniString::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM( SD_OPTION_VECTORIZE ) ), + SD_OPTION_STORE ) ); + + if( xOStm.Is() ) + { + SdIOCompat aCompat( *xOStm, STREAM_WRITE, 1 ); + *xOStm << (sal_uInt16) aNmLayers.GetValue() << (sal_uInt16) aMtReduce.GetValue(); + *xOStm << (sal_uInt16) aMtFillHoles.GetValue() << aCbFillHoles.IsChecked(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/vectdlg.src b/sd/source/ui/dlg/vectdlg.src new file mode 100644 index 000000000000..49390105ceff --- /dev/null +++ b/sd/source/ui/dlg/vectdlg.src @@ -0,0 +1,248 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + + +#include "app.hrc" +#include "vectdlg.hrc" +#include "helpids.h" + +ModalDialog DLG_VECTORIZE +{ + HelpID = HID_VECTORIZE_DLG; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 200, 237 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + + Text [ en-US ] = "Convert to Polygon" ; + + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 144 , 6 ); + Size = MAP_APPFONT ( 50 , 14 ); + TabStop = TRUE ; + DefButton = TRUE ; + }; + + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 144 , 23 ); + Size = MAP_APPFONT ( 50 , 14 ); + TabStop = TRUE ; + }; + + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 144 , 43 ); + Size = MAP_APPFONT ( 50 , 14 ); + TabStop = TRUE ; + }; + + PushButton BTN_PREVIEW + { + HelpID = "sd:PushButton:DLG_VECTORIZE:BTN_PREVIEW"; + Pos = MAP_APPFONT ( 144 , 63 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Preview" ; + }; + + FixedLine GRP_SETTINGS + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 132 , 8 ) ; + Text [ en-US ] = "Settings" ; + }; + + FixedText FT_LAYERS + { + Pos = MAP_APPFONT ( 12 , 14 ); + Size = MAP_APPFONT ( 79 , 12 ); + Text [ en-US ] = "Number of colors:"; + }; + + NumericField NM_LAYERS + { + HelpID = "sd:NumericField:DLG_VECTORIZE:NM_LAYERS"; + Border = TRUE ; + Pos = MAP_APPFONT ( 92 , 14 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 8; + Maximum = 32 ; + StrictFormat = TRUE ; + First = 8; + Last = 32 ; + SpinSize = 1 ; + }; + + FixedText FT_REDUCE + { + Pos = MAP_APPFONT ( 12 , 29 ); + Size = MAP_APPFONT ( 79 , 12 ); + Text [ en-US ] = "Point reduction:"; + }; + + MetricField MT_REDUCE + { + HelpID = "sd:MetricField:DLG_VECTORIZE:MT_REDUCE"; + Border = TRUE ; + Pos = MAP_APPFONT ( 92 , 29 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0; + Maximum = 32 ; + StrictFormat = TRUE ; + First = 0; + Last = 32 ; + SpinSize = 1 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText [ en-US ] = " Pixel" ; + }; + + CheckBox CB_FILLHOLES + { + HelpID = "sd:CheckBox:DLG_VECTORIZE:CB_FILLHOLES"; + Pos = MAP_APPFONT ( 12 , 44 ) ; + Size = MAP_APPFONT ( 79 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Fill holes:"; + }; + + FixedText FT_FILLHOLES + { + Pos = MAP_APPFONT ( 12 , 59 ); + Size = MAP_APPFONT ( 79 , 12 ); + Text [ en-US ] = "Tile size:"; + }; + + MetricField MT_FILLHOLES + { + HelpID = "sd:MetricField:DLG_VECTORIZE:MT_FILLHOLES"; + Border = TRUE ; + Pos = MAP_APPFONT ( 92 , 59 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 8; + Maximum = 128; + StrictFormat = TRUE ; + First = 8; + Last = 128; + SpinSize = 1; + Unit = FUNIT_CUSTOM ; + CustomUnitText [ en-US ] = " Pixel" ; + }; + + FixedText FT_ORIGINAL + { + Pos = MAP_APPFONT ( 6 , 87 ); + Size = MAP_APPFONT ( 92 , 12 ); + Text [ en-US ] = "Source picture:"; + }; + + Control CTL_BMP + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6, 98 ) ; + Size = MAP_APPFONT ( 92, 100 ) ; + Text [ en-US ] = "Source picture" ; + }; + + FixedText FT_VECTORIZED + { + Pos = MAP_APPFONT ( 101 , 87 ); + Size = MAP_APPFONT ( 92 , 12 ); + Text [ en-US ] = "Vectorized image:"; + }; + + Control CTL_WMF + { + Border = TRUE ; + Pos = MAP_APPFONT ( 101, 98 ) ; + Size = MAP_APPFONT ( 93, 100 ) ; + Text [ en-US ] = "Vectorized image" ; + }; + + FixedText GRP_PRGS + { + Pos = MAP_APPFONT ( 6, 204 ); + Size = MAP_APPFONT( 188, 8 ); + Text [ en-US ] = "Progress"; + }; + + Window WND_PRGS + { + Border = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6, 215 ) ; + Size = MAP_APPFONT ( 188, 10 ) ; + Text [ en-US ] = "Progress" ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |