diff options
68 files changed, 2157 insertions, 202 deletions
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index e83ccbbb7..328795c7a 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -466,4 +466,6 @@ #define SID_ADD_MOTION_PATH (SID_SD_START+441) #define SID_TABLE_TOOLBOX (SID_SD_START+442) +#define SID_TOOL_PANEL_PANE (SID_SD_START+443) + #endif diff --git a/sd/inc/glob.hrc b/sd/inc/glob.hrc index 9cb0e0f38..7d44a1b92 100644 --- a/sd/inc/glob.hrc +++ b/sd/inc/glob.hrc @@ -141,6 +141,7 @@ #define STR_LEFT_IMPRESS_PANE_SHELL RID_GLOB_START+113 #define STR_LEFT_DRAW_PANE_SHELL RID_GLOB_START+114 #define STR_RIGHT_PANE_SHELL RID_GLOB_START+115 +#define STR_TOOL_PANEL_SHELL RID_GLOB_START+116 #define RID_CUSTOMANIMATION_START RID_GLOB_START+120 #define RID_CUSTOMANIMATION_END RID_GLOB_START+199 @@ -153,6 +154,8 @@ #define DLG_TABLEDESIGNPANE RID_GLOB_START+224 #define STR_TABLEOBJECTBARSHELL RID_GLOB_START+225 #define RID_TABPAGE_PARA_NUMBERING RID_GLOB_START+226 +#define STR_CUSTOMANIMATIONPANE RID_GLOB_START+227 +#define STR_SLIDE_TRANSITION_PANE RID_GLOB_START+228 diff --git a/sd/inc/glob.hxx b/sd/inc/glob.hxx index aee353afb..5acb84da5 100644 --- a/sd/inc/glob.hxx +++ b/sd/inc/glob.hxx @@ -69,6 +69,8 @@ #define SD_IF_SDRIGHTPANESHELL SFX_INTERFACE_SD_START + 26 #define SD_IF_SDDRAWTABLEOBJECTBAR SFX_INTERFACE_SD_START + 27 #define SD_IF_SDANNOTATIONSHELL SFX_INTERFACE_SD_START + 28 +#define SD_IF_SDTOOLPANELPANESHELL SFX_INTERFACE_SD_START + 29 +#define SD_IF_SDTOOLPANELSHELL SFX_INTERFACE_SD_START + 30 // Inventor-Id fuer StarDraw UserData const UINT32 SdUDInventor=UINT32('S')*0x00000001+ diff --git a/sd/sdi/ToolPanelViewShell.sdi b/sd/sdi/ToolPanelViewShell.sdi new file mode 100644 index 000000000..fdbbc9d25 --- /dev/null +++ b/sd/sdi/ToolPanelViewShell.sdi @@ -0,0 +1,30 @@ +/************************************************************************* + * 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. + * +************************************************************************/ + +shell ToolPanelViewShell +{ +} + diff --git a/sd/sdi/ViewShellBase.sdi b/sd/sdi/ViewShellBase.sdi index 67d9cfb1e..226bd38cb 100644 --- a/sd/sdi/ViewShellBase.sdi +++ b/sd/sdi/ViewShellBase.sdi @@ -164,6 +164,32 @@ SfxBoolItem RightPane SID_RIGHT_PANE GroupId = GID_MODIFY; ] +SfxBoolItem ToolPanel SID_TOOL_PANEL_PANE + +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_MODIFY; +] + SfxVoidItem NotesChildWindow SID_NOTES_WINDOW [ @@ -288,6 +314,11 @@ interface ViewShellBaseView ExecMethod = Execute; StateMethod = GetState; ] + SID_TOOL_PANEL_PANE + [ + ExecMethod = Execute; + StateMethod = GetState; + ] SID_NOTES_WINDOW [ ExecMethod = Execute; diff --git a/sd/sdi/makefile.mk b/sd/sdi/makefile.mk index 7eb22a96c..dbe86abd7 100644 --- a/sd/sdi/makefile.mk +++ b/sd/sdi/makefile.mk @@ -71,6 +71,7 @@ SVSDI1DEPEND= \ SlideSorterController.sdi \ ViewShellBase.sdi \ TaskPaneViewShell.sdi \ + ToolPanelViewShell.sdi \ sdslots.hrc \ $(PRJ)$/inc$/app.hrc @@ -93,6 +94,7 @@ SVSDI2DEPEND= \ outlnvsh.sdi \ ViewShellBase.sdi \ TaskPaneViewShell.sdi \ + ToolPanelViewShell.sdi \ sdslots.hrc \ $(PRJ)$/inc$/app.hrc diff --git a/sd/sdi/sdslots.sdi b/sd/sdi/sdslots.sdi index 3a0862a17..49350f821 100644 --- a/sd/sdi/sdslots.sdi +++ b/sd/sdi/sdslots.sdi @@ -108,4 +108,5 @@ ModulePrefix( "Sd" ) include "mediaob.sdi" include "tables.sdi" include "TaskPaneViewShell.sdi" + include "ToolPanelViewShell.sdi" } diff --git a/sd/source/ui/app/sddll1.cxx b/sd/source/ui/app/sddll1.cxx index 6b525a0b3..00810fd53 100644 --- a/sd/source/ui/app/sddll1.cxx +++ b/sd/source/ui/app/sddll1.cxx @@ -51,12 +51,9 @@ #include "GraphicViewShellBase.hxx" #include "DrawDocShell.hxx" #include "GraphicDocShell.hxx" -#ifndef SD_SLIDEBROWSER_SLIDE_SORTER_VIEW_SHELL_HXX #include "SlideSorterViewShell.hxx" -#endif -#ifndef SD_SLIDEBROWSER_TASK_PANE_VIEW_SHELL_HXX +#include "taskpane/ToolPanelViewShell.hxx" #include "TaskPaneViewShell.hxx" -#endif #include "FactoryIds.hxx" #include "sdmod.hxx" #include "app.hrc" @@ -135,7 +132,8 @@ void SdDLL::RegisterInterfaces() // View shells for the side panes. ::sd::slidesorter::SlideSorterViewShell::RegisterInterface (pMod); ::sd::toolpanel::TaskPaneViewShell::RegisterInterface(pMod); - // Tell the task pane view shell to register the interfaces of its + ::sd::toolpanel::ToolPanelViewShell::RegisterInterface(pMod); + // Tell the tool panel view shell to register the interfaces of its // controls. - ::sd::toolpanel::TaskPaneViewShell::RegisterControls(); + ::sd::toolpanel::ToolPanelViewShell::RegisterControls(); } diff --git a/sd/source/ui/app/sddll2.cxx b/sd/source/ui/app/sddll2.cxx index 49f7df07e..6796ba1be 100644 --- a/sd/source/ui/app/sddll2.cxx +++ b/sd/source/ui/app/sddll2.cxx @@ -159,6 +159,7 @@ void SdDLL::RegisterControllers() ::sd::LeftPaneImpressChildWindow::RegisterChildWindow(0, pMod); ::sd::LeftPaneDrawChildWindow::RegisterChildWindow(0, pMod); ::sd::RightPaneChildWindow::RegisterChildWindow(0, pMod); + ::sd::ToolPanelChildWindow::RegisterChildWindow(0, pMod); SvxFillToolBoxControl::RegisterControl(0, pMod); SvxLineStyleToolBoxControl::RegisterControl(0, pMod); diff --git a/sd/source/ui/app/strings.src b/sd/source/ui/app/strings.src index 90a507c78..f1f2b3f7f 100644 --- a/sd/source/ui/app/strings.src +++ b/sd/source/ui/app/strings.src @@ -1253,6 +1253,14 @@ String DLG_TABLEDESIGNPANE { Text [ en-US ] = "Table Designs"; }; +String STR_CUSTOMANIMATIONPANE +{ + Text [ en-US ] = "Custom Animation"; +}; +String STR_SLIDE_TRANSITION_PANE +{ + Text [ en-US ] = "Slide Transition"; +}; String STR_NAVIGATOR_SHOW_NAMED_SHAPES { Text [ en-US ] = "Named shapes"; diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx index 6076890a3..c6d6a8550 100644 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -32,28 +32,25 @@ #include "precompiled_sd.hxx" #include "PaneChildWindows.hxx" #include "PaneDockingWindow.hrc" +#include "PaneDockingWindow.hxx" +#include "ViewShellBase.hxx" +#include "framework/FrameworkHelper.hxx" #include "app.hrc" #include "strings.hrc" #include "sdresid.hxx" + #include <sfx2/app.hxx> #include <sfx2/dockwin.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> -namespace sd -{ - SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS) - SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW) - SFX_IMPL_DOCKINGWINDOW(RightPaneChildWindow, SID_RIGHT_PANE) -} - - -#include "PaneDockingWindow.hxx" -#include "ViewShellBase.hxx" -#include "framework/FrameworkHelper.hxx" - namespace sd { +SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS) +SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW) +SFX_IMPL_DOCKINGWINDOW(RightPaneChildWindow, SID_RIGHT_PANE) +SFX_IMPL_DOCKINGWINDOW( ToolPanelChildWindow, SID_TOOL_PANEL_PANE ) + //===== PaneChildWindow ======================================================= PaneChildWindow::PaneChildWindow ( @@ -61,8 +58,8 @@ PaneChildWindow::PaneChildWindow ( USHORT nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo, - const ResId& rResId, - const ::rtl::OUString& rsTitle, + const USHORT nDockWinTitleResId, + const USHORT nTitleBarResId, SfxChildAlignment eAlignment) : SfxChildWindow (pParentWindow, nId) { @@ -70,9 +67,8 @@ PaneChildWindow::PaneChildWindow ( pBindings, this, pParentWindow, - rResId, - framework::FrameworkHelper::msLeftImpressPaneURL, - rsTitle); + SdResId( nDockWinTitleResId ), + String( SdResId( nTitleBarResId ) ) ); eChildAlignment = eAlignment; static_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo); SetHideNotDelete(TRUE); @@ -115,8 +111,8 @@ LeftPaneImpressChildWindow::LeftPaneImpressChildWindow ( nId, pBindings, pInfo, - SdResId(FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW), - String(SdResId(STR_LEFT_PANE_IMPRESS_TITLE)), + FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW, + STR_LEFT_PANE_IMPRESS_TITLE, SFX_ALIGN_LEFT) { } @@ -136,8 +132,8 @@ LeftPaneDrawChildWindow::LeftPaneDrawChildWindow ( nId, pBindings, pInfo, - SdResId(FLT_LEFT_PANE_DRAW_DOCKING_WINDOW), - String(SdResId(STR_LEFT_PANE_DRAW_TITLE)), + FLT_LEFT_PANE_DRAW_DOCKING_WINDOW, + STR_LEFT_PANE_DRAW_TITLE, SFX_ALIGN_LEFT) { } @@ -157,11 +153,22 @@ RightPaneChildWindow::RightPaneChildWindow ( nId, pBindings, pInfo, - SdResId(FLT_RIGHT_PANE_DOCKING_WINDOW), - String(SdResId(STR_RIGHT_PANE_TITLE)), + FLT_RIGHT_PANE_DOCKING_WINDOW, + STR_RIGHT_PANE_TITLE, SFX_ALIGN_RIGHT) { } +//====================================================================================================================== +//= ToolPanelChildWindow +//====================================================================================================================== +//---------------------------------------------------------------------------------------------------------------------- +ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, USHORT 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_NOALIGNMENT ) +{ +} + } // end of namespace ::sd diff --git a/sd/source/ui/dlg/PaneDockingWindow.cxx b/sd/source/ui/dlg/PaneDockingWindow.cxx index d4ebe02ae..114bec994 100644 --- a/sd/source/ui/dlg/PaneDockingWindow.cxx +++ b/sd/source/ui/dlg/PaneDockingWindow.cxx @@ -52,7 +52,6 @@ PaneDockingWindow::PaneDockingWindow ( SfxChildWindow *pChildWindow, ::Window* pParent, const ResId& rResId, - const ::rtl::OUString& rsPaneURL, const ::rtl::OUString& rsTitle) : SfxDockingWindow ( _pBindings, @@ -60,7 +59,6 @@ PaneDockingWindow::PaneDockingWindow ( pParent, rResId ), - msPaneURL(rsPaneURL), msTitle(rsTitle), mpTitleToolBox(), maBorder (3,1,3,3), @@ -397,6 +395,16 @@ void PaneDockingWindow::DataChanged (const DataChangedEvent& rEvent) +void PaneDockingWindow::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) +{ + SfxDockingWindow::EndDocking( rRect, bFloatMode ); + + if ( maEndDockingHdl.IsSet() ) + maEndDockingHdl.Call( this ); +} + + + ::Window* PaneDockingWindow::GetContentWindow (void) { return mpContentWindow.get(); diff --git a/sd/source/ui/dlg/PaneDockingWindow.src b/sd/source/ui/dlg/PaneDockingWindow.src index 95f6d7217..a9d7256aa 100644 --- a/sd/source/ui/dlg/PaneDockingWindow.src +++ b/sd/source/ui/dlg/PaneDockingWindow.src @@ -77,3 +77,19 @@ DockingWindow FLT_RIGHT_PANE_DOCKING_WINDOW Size = MAP_APPFONT (100,200) ; Text [ en-US ] = "Task Pane" ; }; + +DockingWindow FLT_TOOL_PANEL_DOCKING_WINDOW +{ + // HelpID = SID_EFFECT_WIN ; + 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 index 4e2786064..1d2092dd6 100644 --- a/sd/source/ui/dlg/PaneShells.cxx +++ b/sd/source/ui/dlg/PaneShells.cxx @@ -145,4 +145,31 @@ RightPaneShell::~RightPaneShell (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::createFromAscii( "ToolPanel" ) ); +} + +ToolPanelPaneShell::~ToolPanelPaneShell(void) +{ +} + } // end of namespace ::sd diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx index 125143974..9ba4dd41e 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx @@ -59,7 +59,8 @@ namespace { FullScreenPaneId, LeftImpressPaneId, LeftDrawPaneId, - RightPaneId + RightPaneId, + ToolPanelPaneId }; static const sal_Int32 gnConfigurationUpdateStartEvent(0); @@ -243,6 +244,11 @@ void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments) aDescriptor.mePaneId = RightPaneId; mpPaneContainer->push_back(aDescriptor); xCC->addResourceFactory(aDescriptor.msPaneURL, this); + + aDescriptor.msPaneURL = FrameworkHelper::msToolPanelPaneURL; + aDescriptor.mePaneId = ToolPanelPaneId; + mpPaneContainer->push_back(aDescriptor); + xCC->addResourceFactory(aDescriptor.msPaneURL, this); } // Register as configuration change listener. @@ -312,6 +318,7 @@ Reference<XResource> SAL_CALL BasicPaneFactory::createResource ( case LeftImpressPaneId: case LeftDrawPaneId: case RightPaneId: + case ToolPanelPaneId: xPane = CreateChildWindowPane( rxPaneId, *iDescriptor); @@ -536,6 +543,11 @@ Reference<XResource> BasicPaneFactory::CreateChildWindowPane ( nChildWindowId = ::sd::RightPaneChildWindow::GetChildWindowId(); break; + case ToolPanelPaneId: + pShell.reset(new ToolPanelPaneShell()); + nChildWindowId = ::sd::ToolPanelChildWindow::GetChildWindowId(); + break; + default: break; } diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 519580f47..94ba56a3d 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -47,6 +47,7 @@ #include "GraphicViewShell.hxx" #include "OutlineViewShell.hxx" #include "TaskPaneViewShell.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "PresentationViewShell.hxx" #include "SlideSorterViewShell.hxx" #include "FrameView.hxx" @@ -334,6 +335,7 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments) mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msTaskPaneURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msToolPanelViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this); } catch (RuntimeException&) @@ -459,6 +461,15 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments) &rWindow, pFrameView)); } + else if (rsViewURL.equals(FrameworkHelper::msToolPanelViewURL)) + { + pViewShell.reset( + new ::sd::toolpanel::ToolPanelViewShell( + &rFrame, + *mpBase, + &rWindow, + pFrameView)); + } else if (rsViewURL.equals(FrameworkHelper::msSlideSorterURL)) { pViewShell = ::sd::slidesorter::SlideSorterViewShell::Create ( @@ -535,6 +546,8 @@ bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr<ViewDescriptor>& r FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftImpressPaneURL)); maCacheableResources.push_back(pHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL)); + maCacheableResources.push_back(pHelper->CreateResourceId( + FrameworkHelper::msToolPanelViewURL, FrameworkHelper::msToolPanelPaneURL)); } ::std::vector<Reference<XResourceId> >::const_iterator iId; diff --git a/sd/source/ui/framework/module/ImpressModule.cxx b/sd/source/ui/framework/module/ImpressModule.cxx index a726751a5..1c0b1a758 100644 --- a/sd/source/ui/framework/module/ImpressModule.cxx +++ b/sd/source/ui/framework/module/ImpressModule.cxx @@ -37,6 +37,7 @@ #include "CenterViewFocusModule.hxx" #include "SlideSorterModule.hxx" #include "TaskPaneModule.hxx" +#include "ToolPanelModule.hxx" #include "ToolBarModule.hxx" #include "ShellStackGuard.hxx" @@ -58,6 +59,7 @@ void ImpressModule::Initialize (Reference<frame::XController>& rxController) rxController, FrameworkHelper::msLeftImpressPaneURL); TaskPaneModule::Initialize(rxController); + ToolPanelModule::Initialize(rxController); new ToolBarModule(rxController); new ShellStackGuard(rxController); } diff --git a/sd/source/ui/framework/module/PresentationModule.cxx b/sd/source/ui/framework/module/PresentationModule.cxx index b60f65ead..e7db8a4cb 100644 --- a/sd/source/ui/framework/module/PresentationModule.cxx +++ b/sd/source/ui/framework/module/PresentationModule.cxx @@ -34,7 +34,6 @@ #include "CenterViewFocusModule.hxx" #include "SlideSorterModule.hxx" -#include "TaskPaneModule.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::uno; diff --git a/sd/source/ui/framework/module/ToolPanelModule.cxx b/sd/source/ui/framework/module/ToolPanelModule.cxx new file mode 100644 index 000000000..53f9cbe01 --- /dev/null +++ b/sd/source/ui/framework/module/ToolPanelModule.cxx @@ -0,0 +1,165 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ToolPanelModule.cxx,v $ + * $Revision: 1.4 $ + * + * 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 "ToolPanelModule.hxx" +#include "ReadOnlyModeObserver.hxx" +#include "framework/FrameworkHelper.hxx" + +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/drawing/framework/XControllerManager.hpp> + +#include <comphelper/processfactory.hxx> +#include <cppuhelper/compbase1.hxx> +#include <boost/enable_shared_from_this.hpp> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::drawing::framework; +using ::rtl::OUString; +using ::sd::framework::FrameworkHelper; + + +namespace sd { namespace framework { + +namespace { + +typedef ::cppu::WeakComponentImplHelper1 < + ::com::sun::star::frame::XStatusListener + > LocalReadOnlyModeObserverInterfaceBase; + +/** This local class enables or disables the ResourceManager of a + ToolPanelModule. It connects to a ReadOnlyModeObserver and is called + when the state of the .uno:EditDoc command changes. When either the + ResourceManager or the ReadOnlyModeObserver are disposed then the + LocalReadOnlyModeObserver disposes itself. The link + between the ResourceManager and the ReadOnlyModeObserver is removed and + the ReadOnlyModeObserver typically looses its last reference and is + destroyed. +*/ +class LocalReadOnlyModeObserver + : private MutexOwner, + public LocalReadOnlyModeObserverInterfaceBase +{ +public: + LocalReadOnlyModeObserver ( + const Reference<frame::XController>& rxController, + const ::rtl::Reference<ResourceManager>& rpResourceManager) + : MutexOwner(), + LocalReadOnlyModeObserverInterfaceBase(maMutex), + mpResourceManager(rpResourceManager), + mpObserver(new ReadOnlyModeObserver(rxController)) + { + mpObserver->AddStatusListener(this); + + Reference<lang::XComponent> xComponent ( + static_cast<XWeak*>(mpResourceManager.get()), UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener(this); + } + + ~LocalReadOnlyModeObserver (void) + { + } + + virtual void SAL_CALL disposing (void) + { + Reference<lang::XComponent> xComponent (static_cast<XWeak*>(mpObserver.get()), UNO_QUERY); + if (xComponent.is()) + xComponent->dispose(); + + xComponent = Reference<lang::XComponent>( + static_cast<XWeak*>(mpResourceManager.get()), UNO_QUERY); + if (xComponent.is()) + xComponent->removeEventListener(this); + + } + + virtual void SAL_CALL disposing (const com::sun::star::lang::EventObject& rEvent) + throw(RuntimeException) + { + if (rEvent.Source == Reference<XInterface>(static_cast<XWeak*>(mpObserver.get()))) + { + mpObserver = NULL; + } + else if (rEvent.Source == Reference<XInterface>( + static_cast<XWeak*>(mpResourceManager.get()))) + { + mpResourceManager = NULL; + } + dispose(); + } + + virtual void SAL_CALL statusChanged (const com::sun::star::frame::FeatureStateEvent& rEvent) + throw(RuntimeException) + { + bool bReadWrite (true); + if (rEvent.IsEnabled) + rEvent.State >>= bReadWrite; + + if (bReadWrite) + mpResourceManager->Enable(); + else + mpResourceManager->Disable(); + } + +private: + ::rtl::Reference<ResourceManager> mpResourceManager; + ::rtl::Reference<ReadOnlyModeObserver> mpObserver; + +}; +} + + + + +//===== ToolPanelModule ==================================================== + +void ToolPanelModule::Initialize (const Reference<frame::XController>& rxController) +{ + ::rtl::Reference<ResourceManager> pResourceManager ( + new ResourceManager( + rxController, + FrameworkHelper::CreateResourceId( + FrameworkHelper::msToolPanelViewURL, + FrameworkHelper::msToolPanelPaneURL))); + pResourceManager->AddActiveMainView(FrameworkHelper::msImpressViewURL); + pResourceManager->AddActiveMainView(FrameworkHelper::msNotesViewURL); + pResourceManager->AddActiveMainView(FrameworkHelper::msHandoutViewURL); + pResourceManager->AddActiveMainView(FrameworkHelper::msSlideSorterURL); + + new LocalReadOnlyModeObserver(rxController, pResourceManager); +} + + + + +} } // end of namespace sd::framework diff --git a/sd/source/ui/framework/module/ToolPanelModule.hxx b/sd/source/ui/framework/module/ToolPanelModule.hxx new file mode 100644 index 000000000..7697f2a0f --- /dev/null +++ b/sd/source/ui/framework/module/ToolPanelModule.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: TaskPaneModule.hxx,v $ + * $Revision: 1.3 $ + * + * 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_FRAMEWORK_TOOL_PANEL_MODULE_HXX +#define SD_FRAMEWORK_TOOL_PANEL_MODULE_HXX + +#include "ResourceManager.hxx" + +#include <rtl/ref.hxx> + +namespace sd { namespace framework { + +class ReadOnlyModeObserver; + +/** This module is responsible for showing the task pane. +*/ +class ToolPanelModule +{ +public: + static void Initialize ( + const ::com::sun::star::uno::Reference<com::sun::star::frame::XController>& rxController); +}; + +} } // end of namespace sd::framework + +#endif diff --git a/sd/source/ui/framework/module/makefile.mk b/sd/source/ui/framework/module/makefile.mk index 24a0b6ba0..78c9e0038 100644 --- a/sd/source/ui/framework/module/makefile.mk +++ b/sd/source/ui/framework/module/makefile.mk @@ -57,6 +57,7 @@ SLOFILES = \ $(SLO)$/ShellStackGuard.obj \ $(SLO)$/SlideSorterModule.obj \ $(SLO)$/TaskPaneModule.obj \ + $(SLO)$/ToolPanelModule.obj \ $(SLO)$/ToolBarModule.obj \ $(SLO)$/ViewTabBarModule.obj diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index fcc2ddc7c..122ab528d 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -187,6 +187,8 @@ const OUString FrameworkHelper::msLeftDrawPaneURL( msPaneURLPrefix + OUString::createFromAscii("LeftDrawPane")); const OUString FrameworkHelper::msRightPaneURL( msPaneURLPrefix + OUString::createFromAscii("RightPane")); +const OUString FrameworkHelper::msToolPanelPaneURL( + msPaneURLPrefix + OUString::createFromAscii("ToolPanel")); // View URLs. @@ -209,6 +211,8 @@ const OUString FrameworkHelper::msPresentationViewURL( msViewURLPrefix + OUString::createFromAscii("PresentationView")); const OUString FrameworkHelper::msTaskPaneURL( msViewURLPrefix + OUString::createFromAscii("TaskPane")); +const OUString FrameworkHelper::msToolPanelViewURL( + msViewURLPrefix + OUString::createFromAscii("ToolPanelPane")); // Tool bar URLs. @@ -590,6 +594,7 @@ ViewShell::ShellType FrameworkHelper::GetViewId (const rtl::OUString& rsViewURL) (*mpViewURLMap)[msSlideSorterURL] = ViewShell::ST_SLIDE_SORTER; (*mpViewURLMap)[msPresentationViewURL] = ViewShell::ST_PRESENTATION; (*mpViewURLMap)[msTaskPaneURL] = ViewShell::ST_TASK_PANE; + (*mpViewURLMap)[msToolPanelViewURL] = ViewShell::ST_TOOL_PANEL; } ViewURLMap::const_iterator iView (mpViewURLMap->find(rsViewURL)); if (iView != mpViewURLMap->end()) @@ -613,6 +618,7 @@ ViewShell::ShellType FrameworkHelper::GetViewId (const rtl::OUString& rsViewURL) case ViewShell::ST_SLIDE_SORTER : return msSlideSorterURL; case ViewShell::ST_PRESENTATION : return msPresentationViewURL; case ViewShell::ST_TASK_PANE : return msTaskPaneURL; + case ViewShell::ST_TOOL_PANEL: return msToolPanelViewURL; default: return OUString(); } diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx index 3777483e3..e8fa8ac93 100644 --- a/sd/source/ui/inc/PaneChildWindows.hxx +++ b/sd/source/ui/inc/PaneChildWindows.hxx @@ -44,8 +44,8 @@ public: USHORT nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo, - const ResId& rResId, - const ::rtl::OUString& rsTitle, + const USHORT nDockWinTitleResId, + const USHORT nTitleBarResId, SfxChildAlignment eAlignment); virtual ~PaneChildWindow (void); }; @@ -87,6 +87,20 @@ public: }; +//====================================================================================================================== +//= ToolPanelChildWindow +//====================================================================================================================== +class ToolPanelChildWindow : public PaneChildWindow +{ +public: + ToolPanelChildWindow( + ::Window* i_pParentWindow, + USHORT i_nId, + SfxBindings* i_pBindings, + SfxChildWinInfo* i_pChildWindowInfo ); + + SFX_DECL_CHILDWINDOW( ToolPanelChildWindow ); +}; } // end of namespace ::sd diff --git a/sd/source/ui/inc/PaneDockingWindow.hrc b/sd/source/ui/inc/PaneDockingWindow.hrc index a97e2d6bc..e29562739 100644 --- a/sd/source/ui/inc/PaneDockingWindow.hrc +++ b/sd/source/ui/inc/PaneDockingWindow.hrc @@ -28,6 +28,7 @@ * ************************************************************************/ -#define FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW 792 -#define FLT_LEFT_PANE_DRAW_DOCKING_WINDOW 793 -#define FLT_RIGHT_PANE_DOCKING_WINDOW 794 +#define FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW 792 +#define FLT_LEFT_PANE_DRAW_DOCKING_WINDOW 793 +#define FLT_RIGHT_PANE_DOCKING_WINDOW 794 +#define FLT_TOOL_PANEL_DOCKING_WINDOW 795 diff --git a/sd/source/ui/inc/PaneDockingWindow.hxx b/sd/source/ui/inc/PaneDockingWindow.hxx index bf302d09c..9b60e21d5 100644 --- a/sd/source/ui/inc/PaneDockingWindow.hxx +++ b/sd/source/ui/inc/PaneDockingWindow.hxx @@ -68,7 +68,6 @@ public: SfxChildWindow *pChildWindow, ::Window* pParent, const ResId& rResId, - const ::rtl::OUString& rsPaneURL, const ::rtl::OUString& rsTitle); virtual ~PaneDockingWindow (void); @@ -80,6 +79,8 @@ public: virtual void StateChanged( StateChangedType nType ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode ); + /** Initializing the title tool box either creates a new title tool box or clears all items from an existing one. A closer is added as only item. @@ -96,6 +97,9 @@ public: */ USHORT AddMenu (const String& rsMenuName, ULONG nHelpId, const Link& rCallback); + void SetEndDockingHdl( const Link& i_rEndDockingHdl ) { maEndDockingHdl = i_rEndDockingHdl; } + const Link& GetEndDockingHdl() const { return maEndDockingHdl; } + /** Set the title of the docking window to the given string. Use this method when the title is not yet known at the time of construction or can not be passed to the constructor. @@ -107,10 +111,6 @@ public: ::boost::shared_ptr<ToolBox> GetTitleToolBox (void) const; private: - /** The pane which is represented by the docking window. - */ - ::rtl::OUString msPaneURL; - /** Title that is shown at the top of the docking window. */ ::rtl::OUString msTitle; @@ -130,6 +130,8 @@ private: ::boost::scoped_ptr< ::Window> mpContentWindow; + Link maEndDockingHdl; + /** Remember that a layout is pending, i.e. Resize() has been called since the last Paint(). */ diff --git a/sd/source/ui/inc/PaneShells.hxx b/sd/source/ui/inc/PaneShells.hxx index 6f70adc89..77d182a49 100644 --- a/sd/source/ui/inc/PaneShells.hxx +++ b/sd/source/ui/inc/PaneShells.hxx @@ -89,6 +89,16 @@ public: virtual ~RightPaneShell (void); }; +class ToolPanelPaneShell : public SfxShell +{ +public: + TYPEINFO(); + SFX_DECL_INTERFACE( SD_IF_SDTOOLPANELPANESHELL ) + + ToolPanelPaneShell(); + virtual ~ToolPanelPaneShell(); +}; + } // end of namespace sd #endif diff --git a/sd/source/ui/inc/TaskPaneViewShell.hxx b/sd/source/ui/inc/TaskPaneViewShell.hxx index 7251b279b..78058fe49 100644 --- a/sd/source/ui/inc/TaskPaneViewShell.hxx +++ b/sd/source/ui/inc/TaskPaneViewShell.hxx @@ -90,12 +90,6 @@ public: FrameView* pFrameView); virtual ~TaskPaneViewShell (void); - /** Register the SFX interfaces so that (some of) the controls can be - pushed as SFX shells on the shell stack and process slot calls and - so on. - */ - static void RegisterControls (void); - virtual void GetFocus (void); virtual void LoseFocus (void); virtual void KeyInput (const KeyEvent& rEvent); @@ -205,25 +199,6 @@ private: -/** This functor makes visible a panel in the task pane. It can be used - with the FrameworkHelper to make a panel visible after an asynchonous - update of the configuration, e.g. after switching to another view. -*/ -class PanelActivation -{ -public: - /** Create a new object that, when its operator() method is called, will - make the specified panel visible in the task pane that belongs to - the application window specified by the given ViewShellBase. - */ - PanelActivation (ViewShellBase& rBase, TaskPaneViewShell::PanelId nPanelId); - void operator() (bool); -private: - ViewShellBase& mrBase; - TaskPaneViewShell::PanelId mnPanelId; -}; - - } } // end of namespace ::sd::toolpanel #endif diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 004b26bb4..b86c5b1a5 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -118,7 +118,8 @@ public: ST_OUTLINE, ST_SLIDE_SORTER, ST_PRESENTATION, - ST_TASK_PANE + ST_TASK_PANE, + ST_TOOL_PANEL }; static const int MAX_HSPLIT_CNT = 1; static const int MAX_VSPLIT_CNT = 1; diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx index 3e06aac50..700a2ea81 100644 --- a/sd/source/ui/inc/framework/FrameworkHelper.hxx +++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx @@ -80,6 +80,7 @@ public: static const ::rtl::OUString msLeftImpressPaneURL; static const ::rtl::OUString msLeftDrawPaneURL; static const ::rtl::OUString msRightPaneURL; + static const ::rtl::OUString msToolPanelPaneURL; // URLs of frequently used views. static const ::rtl::OUString msViewURLPrefix; @@ -91,6 +92,7 @@ public: static const ::rtl::OUString msSlideSorterURL; static const ::rtl::OUString msPresentationViewURL; static const ::rtl::OUString msTaskPaneURL; + static const ::rtl::OUString msToolPanelViewURL; // URLs of frequently used tool bars. static const ::rtl::OUString msToolBarURLPrefix; diff --git a/sd/source/ui/inc/taskpane/ScrollPanel.hxx b/sd/source/ui/inc/taskpane/ScrollPanel.hxx index 8111d3975..4f36283ec 100644 --- a/sd/source/ui/inc/taskpane/ScrollPanel.hxx +++ b/sd/source/ui/inc/taskpane/ScrollPanel.hxx @@ -63,6 +63,10 @@ public: parent. This will usually be a child window. */ ScrollPanel (TreeNode* pParent); + /** Create a new scroll panel which itself is the root of a TreeNode hierarchy + parent. This will usually be a child window. + */ + ScrollPanel (::Window& i_rParentWindow); virtual ~ScrollPanel (void); /** Add a control to the sub panel. An title bar is added above the @@ -174,6 +178,10 @@ private: */ sal_Int32 LayoutChildren (void); + /** ctor-impl + */ + void Construct(); + Size SetupScrollBars (const Size& rRequiresSize); sal_Int32 SetupVerticalScrollBar (bool bShow, sal_Int32 nRange); sal_Int32 SetupHorizontalScrollBar (bool bShow, sal_Int32 nRange); diff --git a/sd/source/ui/inc/taskpane/SubToolPanel.hxx b/sd/source/ui/inc/taskpane/SubToolPanel.hxx index d9b8dc8c6..3104a09a8 100644 --- a/sd/source/ui/inc/taskpane/SubToolPanel.hxx +++ b/sd/source/ui/inc/taskpane/SubToolPanel.hxx @@ -43,8 +43,6 @@ class Window; namespace sd { namespace toolpanel { -class ToolPanel; - /** The sub tool panel is in function similar to the tool panel. It differes in two points. First, it is a control that can be used as element in a tool panel and thus is actually a nested tool @@ -70,6 +68,7 @@ public: parent. This will usually be a child window. */ SubToolPanel (TreeNode* pParent); + SubToolPanel (Window& i_rParentWindow); virtual ~SubToolPanel (void); /** Add a control to the sub panel. diff --git a/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx b/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx index 67fa6c2c1..17a1fa840 100644 --- a/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx +++ b/sd/source/ui/inc/taskpane/TaskPaneControlFactory.hxx @@ -66,11 +66,21 @@ public: */ ::std::auto_ptr<TreeNode> CreateControl (TreeNode* pTreeNode); + /** creates a tree node which acts as root of an own tree + + An implementation is allowed to return NULL here, but <em>must</em> return non-NULL then in the other + factory method. + Derived classes should overload InternalCreateControl. + */ + ::std::auto_ptr<TreeNode> CreateRootControl( ::Window& i_rParent ); + protected: /** This is the internal hook for derived classes to overload in order to provide a new control instance. */ virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) = 0; + + virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) = 0; }; @@ -94,6 +104,41 @@ protected: return new ControlType(pTreeNode, mrArgument); } + virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) + { + OSL_ENSURE( false, "ControlFactoryWithArgs1::InternalCreateRootControl: not implemented!" ); + return NULL; + } + +private: + ArgumentType& mrArgument; +}; + + +/** A simple helper class that realizes a ControlFactory that is able to create root controls, providing + the to-be-created control with an additional parameter. +*/ +template<class ControlType, class ArgumentType> +class RootControlFactoryWithArg + : public ControlFactory +{ +public: + RootControlFactoryWithArg (ArgumentType& rArgument) + : mrArgument(rArgument) + {} + +protected: + virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) + { + OSL_ENSURE( false, "ControlFactoryWithArgs1::InternalCreateControl: not implemented!" ); + return NULL; + } + + virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) + { + return new ControlType( i_rParent, mrArgument ); + } + private: ArgumentType& mrArgument; }; diff --git a/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx b/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx index 4dbe85e99..7a68bd0fb 100644 --- a/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx +++ b/sd/source/ui/inc/taskpane/TaskPaneTreeNode.hxx @@ -97,14 +97,6 @@ public: */ virtual sal_Int32 GetMinimumWidth (void); - /** Give each node access to the object bar manager of the tool panel. - - At least the root node has to overwrite this method since the - default implementation simply returns the object bar manager of the - parent. - */ - virtual ObjectBarManager* GetObjectBarManager (void); - /** The default implementaion always returns <FALSE/> */ virtual bool IsResizable (void); diff --git a/sd/source/ui/inc/taskpane/TitleBar.hxx b/sd/source/ui/inc/taskpane/TitleBar.hxx index b5271e85c..64669be9d 100644 --- a/sd/source/ui/inc/taskpane/TitleBar.hxx +++ b/sd/source/ui/inc/taskpane/TitleBar.hxx @@ -92,7 +92,7 @@ public: virtual void Paint (const Rectangle& rBoundingBox); virtual bool Expand (bool bFlag = true); virtual bool IsExpanded (void) const; - virtual void SetEnabledState(bool bFlag);
+ virtual void SetEnabledState(bool bFlag); void SetFocus (bool bFlag); diff --git a/sd/source/ui/inc/taskpane/TitledControl.hxx b/sd/source/ui/inc/taskpane/TitledControl.hxx index 8103c18ea..a299abcf0 100644 --- a/sd/source/ui/inc/taskpane/TitledControl.hxx +++ b/sd/source/ui/inc/taskpane/TitledControl.hxx @@ -135,7 +135,7 @@ public: */ virtual bool IsExpandable (void) const; - virtual void SetEnabledState(bool bFlag);
+ virtual void SetEnabledState(bool bFlag); /** Ownership of the given data remains with the caller. The data is thus not destroyed when the destructor of this class is diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx new file mode 100644 index 000000000..ebfc92f36 --- /dev/null +++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx @@ -0,0 +1,182 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ToolPanelViewShell.hxx,v $ + * $Revision: 1.12 $ + * + * 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_TOOL_PANEL_VIEW_SHELL_HXX +#define SD_TOOL_PANEL_VIEW_SHELL_HXX + +#include "ViewShell.hxx" +#include "glob.hxx" +#include "framework/FrameworkHelper.hxx" +#include <vcl/button.hxx> +#include <sfx2/shell.hxx> +#include <sfx2/viewfac.hxx> +#include <sfx2/dockwin.hxx> + +#include <boost/shared_ptr.hpp> +#include <boost/scoped_ptr.hpp> + +class PopupMenu; + +namespace sd { +class PaneDockingWindow; + +namespace toolpanel { +class TaskPaneShellManager; +class TitleToolBox; +class TitleBar; +class TitledControl; +class ToolPanelDeck; + +/** The tool panel is a view shell for some very specific reasons: + - It fits better into the concept of panes being docking windows whose + content, a view shell, can be exchanged on runtime. + - A control in the tool panel that wants to show a context menu has to + do that over the dispatcher of a shell. These shells, usually + implemented by the controls themselves, have to be managed by someone. + If interpreted as object bars this can be handled by the + ObjectBarManager of the ViewShell. +*/ +class ToolPanelViewShell + : public ViewShell +{ +public: + TYPEINFO(); + SFX_DECL_INTERFACE(SD_IF_SDTOOLPANELSHELL) + + /** List of top level panels that can be shown in the task pane. + */ + enum PanelId + { + PID__START = 0, + PID_UNKNOWN = PID__START, + PID_MASTER_PAGES, + PID_LAYOUT, + PID_TABLE_DESIGN, + PID_ANIMATION_SCHEMES, + PID_CUSTOM_ANIMATION, + PID_SLIDE_TRANSITION, + PID__END = PID_SLIDE_TRANSITION + }; + + ToolPanelViewShell ( + SfxViewFrame* pFrame, + ViewShellBase& rViewShellBase, + ::Window* pParentWindow, + FrameView* pFrameView); + virtual ~ToolPanelViewShell (void); + + /** Register the SFX interfaces so that (some of) the controls can be + pushed as SFX shells on the shell stack and process slot calls and + so on. + */ + static void RegisterControls (void); + + virtual void GetFocus (void); + virtual void LoseFocus (void); + virtual void KeyInput (const KeyEvent& rEvent); + using sd::ViewShell::KeyInput; + + virtual SdPage* GetActualPage (void); + virtual SdPage* getCurrentPage (void) const; + + void Execute (SfxRequest& rRequest); + void GetState (SfxItemSet& rItemSet); + + virtual void ArrangeGUIElements (void); + + TaskPaneShellManager& GetSubShellManager (void) const; + + /** Called when a mouse button has been pressed but not yet + released, this handler is used to show the popup menu of the + title bar. + */ + DECL_LINK(ToolboxClickHandler, ToolBox*); + DECL_LINK(MenuSelectHandler, Menu*); + DECL_LINK(DockingChanged, PaneDockingWindow*); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible> + CreateAccessibleDocumentView (::sd::Window* pWindow); + + virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void); + + /** Relocate all toplevel controls to the given parent window. + */ + virtual bool RelocateToParentWindow (::Window* pParentWindow); + +private: + class Implementation; + ::boost::scoped_ptr< Implementation > mpImpl; + ::boost::scoped_ptr< ToolPanelDeck > mpPanelDeck; + + bool mbIsInitialized; + + ::boost::shared_ptr<TaskPaneShellManager> mpSubShellManager; + + /** The id of the menu in the menu bar/tool box of the parent docking + window. + */ + USHORT mnMenuId; + + /** Create a popup menu. it contains two sections, one for + docking or un-docking the tool panel, one for toggling the + visibility state of the tool panel items. + @param bIsDocking + According to this flag one of the lock/unlock entries is + made disabled. + */ + ::std::auto_ptr<PopupMenu> CreatePopupMenu (bool bIsDocking); + + + /** Return a pointer to the docking window that is the parent or a + predecessor of the content window. + @return + When the view shell is not placed in a docking window, e.g. when + shown in the center pane, then <NULL?> is returned. + */ + DockingWindow* GetDockingWindow (void); + + /** connects to a (new) (Pane)DockingWindow + */ + void ConnectToDockingWindow(); + + /** Initialize the task pane view shell if that has not yet been done + before. If mbIsInitialized is already set to <TRUE/> then this + method returns immediately. + */ + void Initialize (void); +}; + + + + +} } // end of namespace ::sd::toolpanel + +#endif diff --git a/sd/source/ui/toolpanel/LayoutMenu.cxx b/sd/source/ui/toolpanel/LayoutMenu.cxx index 15f9b9f09..46dea1531 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.cxx +++ b/sd/source/ui/toolpanel/LayoutMenu.cxx @@ -50,6 +50,7 @@ #include "controller/SlideSorterController.hxx" #include "controller/SlsPageSelector.hxx" #include "taskpane/TaskPaneControlFactory.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "taskpane/ScrollPanel.hxx" #include "tools/SlotStateListener.hxx" #include "EventMultiplexer.hxx" @@ -113,6 +114,12 @@ protected: return pScrollPanel; } + virtual TreeNode* InternalCreateRootControl( ::Window& /*i_rParent*/ ) + { + OSL_ENSURE( false, "LayoutMenuFactory::InternalCreateRootControl: not implemented!" ); + return NULL; + } + private: ViewShellBase& mrBase; DrawDocShell& mrDocShell; @@ -120,6 +127,37 @@ private: +class LayoutMenuRootFactory + : public ControlFactory +{ +public: + LayoutMenuRootFactory (ToolPanelViewShell& i_rPanelViewShell) + :mrPanelViewShell(i_rPanelViewShell) + { + } + +protected: + virtual TreeNode* InternalCreateControl (TreeNode* pTreeNode) + { + OSL_ENSURE( false, "LayoutMenuRootFactory::InternalCreateControl: not implemented!" ); + return NULL; + } + + virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) + { + ScrollPanel* pScrollPanel = new ScrollPanel (i_rParent); + ::std::auto_ptr<TreeNode> pMenu ( + new LayoutMenu ( + pScrollPanel, + mrPanelViewShell)); + pScrollPanel->AddControl(pMenu); + return pScrollPanel; + } + +private: + ToolPanelViewShell& mrPanelViewShell; +}; + SFX_IMPL_INTERFACE(LayoutMenu, SfxShell, SdResId(STR_TASKPANELAYOUTMENU)) @@ -235,12 +273,41 @@ LayoutMenu::LayoutMenu ( DragSourceHelper(this), DropTargetHelper(this), mrBase (rViewShellBase), + mpShellManager (NULL), mbUseOwnScrollBar (bUseOwnScrollBar), mnPreferredColumnCount(3), mxListener(NULL), mbSelectionUpdatePending(true), mbIsMainViewChangePending(false) { + ImplConstruct( rDocumentShell ); +} + + + +LayoutMenu::LayoutMenu( TreeNode* pParent, ToolPanelViewShell& i_rPanelViewShell ) + : ValueSet (pParent->GetWindow()), + TreeNode(pParent), + DragSourceHelper(this), + DropTargetHelper(this), + mrBase( i_rPanelViewShell.GetViewShellBase() ), + mpShellManager (&i_rPanelViewShell.GetSubShellManager()), + mbUseOwnScrollBar( false ), + mnPreferredColumnCount(3), + mxListener(NULL), + mbSelectionUpdatePending(true), + mbIsMainViewChangePending(false) +{ + ImplConstruct( *mrBase.GetDocument()->GetDocSh() ); +} + + +void LayoutMenu::ImplConstruct( DrawDocShell& rDocumentShell ) +{ + OSL_ENSURE( mrBase.GetDocument()->GetDocSh() == &rDocumentShell, + "LayoutMenu::ImplConstruct: hmm?" ); + // if this fires, then my assumption that the rDocumentShell parameter to our first ctor is superfluous ... + SetStyle ( ( GetStyle() & ~(WB_ITEMBORDER) ) | WB_TABSTOP @@ -279,7 +346,6 @@ LayoutMenu::LayoutMenu ( - LayoutMenu::~LayoutMenu (void) { // Tell the shell factory that this object is no longer available. @@ -308,6 +374,15 @@ LayoutMenu::~LayoutMenu (void) +::std::auto_ptr<ControlFactory> LayoutMenu::CreateControlFactory ( + ToolPanelViewShell& i_rPanelViewShell ) +{ + return ::std::auto_ptr<ControlFactory>(new LayoutMenuRootFactory(i_rPanelViewShell)); +} + + + + String LayoutMenu::GetSelectedLayoutName (void) { return GetItemText (GetSelectItemId()); @@ -434,6 +509,7 @@ void LayoutMenu::UpdateEnabledState (const MasterMode eMode) case ViewShell::ST_OUTLINE: case ViewShell::ST_PRESENTATION: case ViewShell::ST_TASK_PANE: + case ViewShell::ST_TOOL_PANEL: // The complete task pane is disabled for these values or // not even visible. Disabling the LayoutMenu would be // logical but unnecessary. The main disadvantage is that @@ -634,6 +710,13 @@ void LayoutMenu::InsertPageWithLayout (AutoLayout aLayout) +TaskPaneShellManager* LayoutMenu::GetShellManager() +{ + if ( mpShellManager ) + return mpShellManager; + return TreeNode::GetShellManager(); +} + void LayoutMenu::InvalidateContent (void) { // The number of items may have changed. Request a resize so that the diff --git a/sd/source/ui/toolpanel/LayoutMenu.hxx b/sd/source/ui/toolpanel/LayoutMenu.hxx index f866ce46b..9355cce1f 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.hxx +++ b/sd/source/ui/toolpanel/LayoutMenu.hxx @@ -63,6 +63,7 @@ class EventMultiplexerEvent; namespace sd { namespace toolpanel { class ControlFactory; +class ToolPanelViewShell; class LayoutMenu @@ -96,11 +97,16 @@ public: DrawDocShell& rDocumentShell, ViewShellBase& rViewShellBase, bool bUseOwnScrollBar); + LayoutMenu ( + TreeNode* pParent, + ToolPanelViewShell& i_rPanelViewShell); virtual ~LayoutMenu (void); static std::auto_ptr<ControlFactory> CreateControlFactory ( ViewShellBase& rBase, DrawDocShell& rDocShell); + static std::auto_ptr<ControlFactory> CreateControlFactory ( + ToolPanelViewShell& i_rPanelViewShell ); /** Return the name of the currently selected layout. */ @@ -143,6 +149,9 @@ public: enum MasterMode { MM_NORMAL, MM_MASTER, MM_UNKNOWN }; void UpdateEnabledState (const MasterMode eMode); + // TreeNode overridables + virtual TaskPaneShellManager* GetShellManager (void); + /** Call this method when the set of displayed layouts is not up-to-date anymore. It will re-assemple this set according to the current settings. @@ -171,6 +180,8 @@ public: private: ViewShellBase& mrBase; + TaskPaneShellManager* mpShellManager; + /** Do we use our own scroll bar or is viewport handling done by our parent? */ @@ -234,6 +245,9 @@ private: */ void UpdateSelection (void); + // internal ctor + void ImplConstruct( DrawDocShell& rDocumentShell ); + /** When clicked then set the current page of the view in the center pane. */ DECL_LINK(ClickHandler, ValueSet*); diff --git a/sd/source/ui/toolpanel/ScrollPanel.cxx b/sd/source/ui/toolpanel/ScrollPanel.cxx index 1efd770db..658dcb8ce 100644 --- a/sd/source/ui/toolpanel/ScrollPanel.cxx +++ b/sd/source/ui/toolpanel/ScrollPanel.cxx @@ -59,6 +59,30 @@ ScrollPanel::ScrollPanel ( mnVerticalGap(3), mnHorizontalBorder(2) { + Construct(); +} + +ScrollPanel::ScrollPanel ( + ::Window& i_rParentWindow) + : Control (&i_rParentWindow, WB_DIALOGCONTROL), + TreeNode(NULL), + maScrollWindow(this, WB_DIALOGCONTROL), + maVerticalScrollBar(this, WB_VERT), + maHorizontalScrollBar(this, WB_HORZ), + maScrollBarFiller(this), + maScrollWindowFiller(&maScrollWindow), + mbIsRearrangePending(true), + mbIsLayoutPending(true), + mnChildrenWidth(0), + mnVerticalBorder(2), + mnVerticalGap(3), + mnHorizontalBorder(2) +{ + Construct(); +} + +void ScrollPanel::Construct() +{ SetAccessibleName ( ::rtl::OUString::createFromAscii("Sub Task Panel")); mpControlContainer->SetMultiSelection (true); diff --git a/sd/source/ui/toolpanel/SubToolPanel.cxx b/sd/source/ui/toolpanel/SubToolPanel.cxx index c345ea643..94992dd06 100644 --- a/sd/source/ui/toolpanel/SubToolPanel.cxx +++ b/sd/source/ui/toolpanel/SubToolPanel.cxx @@ -73,6 +73,35 @@ SubToolPanel::SubToolPanel ( +SubToolPanel::SubToolPanel ( + Window& i_rParentWindow) + : Control (&i_rParentWindow, WB_DIALOGCONTROL), + TreeNode(NULL), + maWindowFiller(this), + mbIsRearrangePending(true), + mbIsLayoutPending(true), + mnChildrenWidth(0), + mnVerticalBorder(0), + mnVerticalGap(3), + mnHorizontalBorder(2) +{ + SetAccessibleName ( + ::rtl::OUString::createFromAscii("Sub Task Panel")); + mpControlContainer->SetMultiSelection (true); + + SetBorderStyle (WINDOW_BORDER_NORMAL); + SetMapMode (MapMode(MAP_PIXEL)); + + // To reduce flickering during repaints make the container windows + // transparent and rely on their children to paint the whole area. + SetBackground(Wallpaper()); + maWindowFiller.SetBackground( + Application::GetSettings().GetStyleSettings().GetWindowColor()); +} + + + + SubToolPanel::~SubToolPanel (void) { sal_uInt32 nCount = mpControlContainer->GetControlCount(); diff --git a/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx b/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx index 082adc6b3..827a63f5c 100644 --- a/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx +++ b/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx @@ -60,4 +60,10 @@ ControlFactory::~ControlFactory (void) } +::std::auto_ptr<TreeNode> ControlFactory::CreateRootControl( ::Window& i_rParent ) +{ + TreeNode* pNewNode = InternalCreateRootControl( i_rParent ); + return ::std::auto_ptr<TreeNode>( pNewNode ); +} + } } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.cxx b/sd/source/ui/toolpanel/TaskPaneShellManager.cxx index adb534c6e..31afba830 100644 --- a/sd/source/ui/toolpanel/TaskPaneShellManager.cxx +++ b/sd/source/ui/toolpanel/TaskPaneShellManager.cxx @@ -34,7 +34,7 @@ #include "TaskPaneShellManager.hxx" #include "ViewShellManager.hxx" -#include <osl/diagnose.h> +#include <tools/diagnose_ex.h> #include <vcl/window.hxx> #include <algorithm> @@ -114,6 +114,21 @@ void TaskPaneShellManager::AddSubShell ( +void TaskPaneShellManager::RemoveSubShell (const ShellId i_nShellId) +{ + SubShells::iterator pos = maSubShells.find( i_nShellId ); + ENSURE_OR_RETURN_VOID( pos != maSubShells.end(), "no shell for this ID" ); + if ( pos->second.mpWindow != NULL ) + { + pos->second.mpWindow->RemoveEventListener( LINK( this, TaskPaneShellManager, WindowCallback ) ); + } + mpViewShellManager->DeactivateSubShell( mrViewShell, pos->first ); + maSubShells.erase( pos ); +} + + + + void TaskPaneShellManager::RemoveSubShell (const SfxShell* pShell) { if (pShell != NULL) diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.hxx b/sd/source/ui/toolpanel/TaskPaneShellManager.hxx index e7a6a2a5b..93cb88548 100644 --- a/sd/source/ui/toolpanel/TaskPaneShellManager.hxx +++ b/sd/source/ui/toolpanel/TaskPaneShellManager.hxx @@ -89,6 +89,11 @@ public: NULL when this shell is requested. */ void RemoveSubShell (const SfxShell* pShell); + /** removes the shell given by its ID from the set of sub shells managed by the + TaskPaneShellManager. Subsequent calls to CreateShell() will return + NULL when this shell is requested. + */ + void RemoveSubShell (const ShellId i_nShellId); /** Move the given sub-shell to the top of the local shell stack. Furthermore move the view shell whose sub-shells this class manages diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx new file mode 100644 index 000000000..18d4397b0 --- /dev/null +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx @@ -0,0 +1,131 @@ +/************************************************************************* + * 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 "TaskPaneToolPanel.hxx" +#include "ToolPanelDeck.hxx" +#include "sdresid.hxx" + +#include <tools/diagnose_ex.h> +#include <vcl/window.hxx> + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + //================================================================================================================== + //= TaskPaneToolPanel + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + TaskPaneToolPanel::TaskPaneToolPanel( ToolPanelDeck& i_rPanelDeck, ::std::auto_ptr< ControlFactory >& i_rControlFactory, + const Image& i_rImage, const USHORT i_nTitleResId, const ULONG i_nHelpId ) + :m_pPanelDeck( &i_rPanelDeck ) + ,m_pControlFactory( i_rControlFactory ) + ,m_pControl() + ,m_aImage( i_rImage ) + ,m_sTitle( SdResId( i_nTitleResId ) ) + ,m_aHelpId( i_nHelpId ) + { + ENSURE_OR_THROW( m_pControlFactory.get(), "illegal control factory" ); + } + + //------------------------------------------------------------------------------------------------------------------ + TaskPaneToolPanel::~TaskPaneToolPanel() + { + m_pControl.reset(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString TaskPaneToolPanel::GetDisplayName() const + { + return m_sTitle; + } + + //------------------------------------------------------------------------------------------------------------------ + Image TaskPaneToolPanel::GetImage() const + { + return m_aImage; + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneToolPanel::Show() + { + ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to show" ); + m_pControl->GetWindow()->Show(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneToolPanel::Hide() + { + ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to hide" ); + m_pControl->GetWindow()->Hide(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneToolPanel::SetPosSizePixel( const Rectangle& i_rPanelPlayground ) + { + ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to position" ); + m_pControl->GetWindow()->SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneToolPanel::GrabFocus() + { + ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to focus" ); + m_pControl->GetWindow()->GrabFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + bool TaskPaneToolPanel::HasFocus() const + { + ENSURE_OR_RETURN_FALSE( const_cast< TaskPaneToolPanel* >( this )->impl_ensureControl(), "no control to ask" ); + return m_pControl->GetWindow()->HasChildPathFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneToolPanel::Dispose() + { + ENSURE_OR_RETURN_VOID( m_pPanelDeck, "disposed twice" ); + m_pControl.reset(); + m_pPanelDeck = NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + bool TaskPaneToolPanel::impl_ensureControl() + { + if ( m_pControl.get() ) + return true; + if ( !m_pPanelDeck ) + return false; + m_pControl = m_pControlFactory->CreateRootControl( *m_pPanelDeck ); + return ( m_pControl.get() != NULL ); + } + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx new file mode 100644 index 000000000..b4628961b --- /dev/null +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * 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_TASKPANETOOLPANEL_HXX +#define SD_TASKPANETOOLPANEL_HXX + +#include "taskpane/TaskPaneControlFactory.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/drawing/framework/XResourceId.hpp> +/** === end UNO includes === **/ + +#include <svtools/toolpanel/toolpanel.hxx> + +#include <vcl/image.hxx> +#include <vcl/smartid.hxx> + +#include <memory> + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + class ToolPanelDeck; + + //================================================================================================================== + //= TaskPaneToolPanel + //================================================================================================================== + class TaskPaneToolPanel : public ::svt::ToolPanelBase + { + public: + TaskPaneToolPanel( + ToolPanelDeck& i_rPanelDeck, + ::std::auto_ptr< ControlFactory >& i_rControlFactory, + const Image& i_rImage, + const USHORT i_nTitleResId, + const ULONG i_nHelpId/*, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPanelContent*/ + ); + ~TaskPaneToolPanel(); + + // IToolPanel overridables + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; + virtual void Show(); + virtual void Hide(); + virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); + virtual void GrabFocus(); + virtual bool HasFocus() const; + virtual void Dispose(); + + private: + bool impl_ensureControl(); + + private: + ToolPanelDeck* m_pPanelDeck; + ::std::auto_ptr< ControlFactory > m_pControlFactory; + ::std::auto_ptr< TreeNode > m_pControl; + const Image m_aImage; + const String m_sTitle; + const SmartId m_aHelpId; + }; + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... + +#endif // SD_TASKPANETOOLPANEL_HXX diff --git a/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx b/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx index ec7fc1a92..b7934b8eb 100644 --- a/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx +++ b/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx @@ -125,17 +125,6 @@ sal_Int32 TreeNode::GetMinimumWidth (void) -ObjectBarManager* TreeNode::GetObjectBarManager (void) -{ - if (mpParent != NULL) - return mpParent->GetObjectBarManager(); - else - return NULL; -} - - - - bool TreeNode::IsResizable (void) { return false; diff --git a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx b/sd/source/ui/toolpanel/TaskPaneViewShell.cxx index a3cd780f7..bfa47fe87 100644 --- a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx +++ b/sd/source/ui/toolpanel/TaskPaneViewShell.cxx @@ -47,7 +47,6 @@ #include "controls/TableDesignPanel.hxx" #include "controls/CustomAnimationPanel.hxx" #include "controls/SlideTransitionPanel.hxx" -#include "controls/AnimationSchemesPanel.hxx" #include "TitleToolBox.hxx" #include "taskpane/ControlContainer.hxx" #include "FrameView.hxx" @@ -260,37 +259,29 @@ void TaskPaneViewShell::Implementation::Setup ( AddPanel (nId, PID_TABLE_DESIGN); } - { - DummyControl aControl (pToolPanel, SdResId(RID_CUSTOMANIMATION_START+0)); - - // CustomAnimationPanel - nId = pToolPanel->AddControl ( - controls::CustomAnimationPanel::CreateControlFactory(rBase), - aControl.GetText(), - HID_SD_CUSTOM_ANIMATIONS, - ResourceActivationClickHandler( - pFrameworkHelper, - pFrameworkHelper->CreateResourceId( - FrameworkHelper::msCustomAnimationTaskPanelURL, xTaskPaneId), - pToolPanel->GetControlContainer())); - AddPanel (nId, PID_CUSTOM_ANIMATION); - } + // CustomAnimationPanel + nId = pToolPanel->AddControl ( + controls::CustomAnimationPanel::CreateControlFactory(rBase), + SdResId( STR_CUSTOMANIMATIONPANE ), + HID_SD_CUSTOM_ANIMATIONS, + ResourceActivationClickHandler( + pFrameworkHelper, + pFrameworkHelper->CreateResourceId( + FrameworkHelper::msCustomAnimationTaskPanelURL, xTaskPaneId), + pToolPanel->GetControlContainer())); + AddPanel (nId, PID_CUSTOM_ANIMATION); // SlideTransitionPanel - { - DummyControl aControl (pToolPanel, SdResId(RID_CUSTOMANIMATION_START+3)); - - nId = pToolPanel->AddControl ( - controls::SlideTransitionPanel::CreateControlFactory(rBase), - aControl.GetText(), - HID_SD_SLIDE_TRANSITIONS, - ResourceActivationClickHandler( - pFrameworkHelper, - pFrameworkHelper->CreateResourceId( - FrameworkHelper::msSlideTransitionTaskPanelURL, xTaskPaneId), - pToolPanel->GetControlContainer())); - AddPanel (nId, PID_SLIDE_TRANSITION); - } + nId = pToolPanel->AddControl ( + controls::SlideTransitionPanel::CreateControlFactory(rBase), + SdResId( STR_SLIDE_TRANSITION_PANE ), + HID_SD_SLIDE_TRANSITIONS, + ResourceActivationClickHandler( + pFrameworkHelper, + pFrameworkHelper->CreateResourceId( + FrameworkHelper::msSlideTransitionTaskPanelURL, xTaskPaneId), + pToolPanel->GetControlContainer())); + AddPanel (nId, PID_SLIDE_TRANSITION); #ifdef SHOW_COLOR_MENU // Test Menu. @@ -425,17 +416,6 @@ TaskPaneViewShell::~TaskPaneViewShell (void) -// static -void TaskPaneViewShell::RegisterControls (void) -{ - SfxModule* pModule = SD_MOD(); - controls::MasterPagesSelector::RegisterInterface (pModule); - LayoutMenu::RegisterInterface (pModule); -} - - - - void TaskPaneViewShell::ArrangeGUIElements (void) { ViewShell::ArrangeGUIElements(); @@ -841,27 +821,6 @@ sal_uInt32 -//===== PanelActivation ======================================================= - -PanelActivation::PanelActivation (ViewShellBase& rBase, TaskPaneViewShell::PanelId nPanelId) - : mrBase(rBase), - mnPanelId(nPanelId) -{ -} - -void PanelActivation::operator() (bool) -{ - toolpanel::TaskPaneViewShell* pTaskPane - = dynamic_cast<toolpanel::TaskPaneViewShell*>( - framework::FrameworkHelper::Instance(mrBase) - ->GetViewShell(framework::FrameworkHelper::msRightPaneURL).get()); - if (pTaskPane != NULL) - pTaskPane->ShowPanel(mnPanelId); -} - - - - //===== ResourceActivationClickHandler ======================================== ResourceActivationClickHandler::ResourceActivationClickHandler ( diff --git a/sd/source/ui/toolpanel/TestMenu.cxx b/sd/source/ui/toolpanel/TestMenu.cxx index b05824c54..f5b851a01 100644 --- a/sd/source/ui/toolpanel/TestMenu.cxx +++ b/sd/source/ui/toolpanel/TestMenu.cxx @@ -52,6 +52,11 @@ protected: { return new ColorMenu (pTreeNode); } + virtual TreeNode* InternalCreateRootControl( ::Window& /*i_rParent*/ ) + { + OSL_ENSURE( false, "ColorMenuFactory::InternalCreateRootControl: not implemented!" ); + return NULL; + } }; diff --git a/sd/source/ui/toolpanel/TestPanel.cxx b/sd/source/ui/toolpanel/TestPanel.cxx index d3b8eb4c8..21e2e35b1 100644 --- a/sd/source/ui/toolpanel/TestPanel.cxx +++ b/sd/source/ui/toolpanel/TestPanel.cxx @@ -52,6 +52,11 @@ protected: { return new TestPanel (pTreeNode); } + virtual TreeNode* InternalCreateRootControl( ::Window& i_rParent ) + { + OSL_ENSURE( false, "TestPanelFactory::InternalCreateRootControl: not implemented!" ); + return NULL; + } }; diff --git a/sd/source/ui/toolpanel/TitleBar.cxx b/sd/source/ui/toolpanel/TitleBar.cxx index c32176cc4..d53336709 100644 --- a/sd/source/ui/toolpanel/TitleBar.cxx +++ b/sd/source/ui/toolpanel/TitleBar.cxx @@ -216,14 +216,14 @@ bool TitleBar::IsExpanded (void) const } -void TitleBar::SetEnabledState(bool bFlag)
-{
- if(bFlag)
- Enable();
- else
- Disable();
- Invalidate ();
-}
+void TitleBar::SetEnabledState(bool bFlag) +{ + if(bFlag) + Enable(); + else + Disable(); + Invalidate (); +} void TitleBar::SetFocus (bool bFlag) @@ -462,17 +462,17 @@ void TitleBar::PaintText (const Rectangle& rTextBox) USHORT TitleBar::GetTextStyle (void) { - if(IsEnabled())
- {
- return TEXT_DRAW_LEFT
- | TEXT_DRAW_TOP
- | TEXT_DRAW_MULTILINE
- | TEXT_DRAW_WORDBREAK;
- }
- else
- {
- return TEXT_DRAW_DISABLE;
- }
+ if(IsEnabled()) + { + return TEXT_DRAW_LEFT + | TEXT_DRAW_TOP + | TEXT_DRAW_MULTILINE + | TEXT_DRAW_WORDBREAK; + } + else + { + return TEXT_DRAW_DISABLE; + } } diff --git a/sd/source/ui/toolpanel/TitledControl.cxx b/sd/source/ui/toolpanel/TitledControl.cxx index ccd85fc72..371857eab 100644 --- a/sd/source/ui/toolpanel/TitledControl.cxx +++ b/sd/source/ui/toolpanel/TitledControl.cxx @@ -338,27 +338,27 @@ bool TitledControl::IsExpanded (void) const return false; } -void TitledControl::SetEnabledState(bool bFlag)
-{
- if (!bFlag)
- {
- GetParentNode()->GetControlContainer().SetExpansionState (
- this,
- ControlContainer::ES_COLLAPSE);
- Disable();
- }
- else
- {
-/*
- GetParentNode()->GetControlContainer().SetExpansionState (
- this,
- ControlContainer::ES_EXPAND);
-*/
- Enable();
- }
-
- GetTitleBar()->SetEnabledState(bFlag);
-}
+void TitledControl::SetEnabledState(bool bFlag) +{ + if (!bFlag) + { + GetParentNode()->GetControlContainer().SetExpansionState ( + this, + ControlContainer::ES_COLLAPSE); + Disable(); + } + else + { +/* + GetParentNode()->GetControlContainer().SetExpansionState ( + this, + ControlContainer::ES_EXPAND); +*/ + Enable(); + } + + GetTitleBar()->SetEnabledState(bFlag); +} diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx new file mode 100644 index 000000000..e59b78292 --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanelDeck.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * 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 "ToolPanelDeck.hxx" +#include "taskpane/ToolPanelViewShell.hxx" +#include "taskpane/ControlContainer.hxx" +#include "TaskPaneToolPanel.hxx" + +#include <svtools/toolpanel/tablayouter.hxx> + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + //================================================================================================================== + //= ToolPanelDeck + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ToolPanelDeck::ToolPanelDeck( Window& i_rParent, ToolPanelViewShell& i_rViewShell ) + :ToolPanelDeck_Base( i_rParent, 0 ) + ,m_rViewShell( i_rViewShell ) + { + SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); + } + + //------------------------------------------------------------------------------------------------------------------ + ToolPanelDeck::~ToolPanelDeck() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDeck::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) + { + ::svt::PDeckLayouter pLayouter( GetLayouter() ); + ::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() ); + if ( ( pTabLayouter != NULL ) + && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) + && ( pTabLayouter->GetTabItemContent() == i_eTabContent ) + ) + return; + + if ( pTabLayouter && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) ) + { + // changing only the item content does not require a new layouter instance + pTabLayouter->SetTabItemContent( i_eTabContent ); + return; + } + + SetLayouter( new ::svt::TabDeckLayouter( *this, i_eTabAlignment, i_eTabContent ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + size_t ToolPanelDeck::CreateAndInsertPanel( ::std::auto_ptr< ControlFactory >& i_rControlFactory, + const Image& i_rImage, const USHORT i_nTitleResId, const ULONG i_nHelpId ) + { + // create panel + ::svt::PToolPanel pNewPanel( new TaskPaneToolPanel( + *this, i_rControlFactory, + i_rImage, i_nTitleResId, i_nHelpId + ) ); + // insert as new panel + return InsertPanel( pNewPanel, GetPanelCount() ); + } + +//...................................................................................................................... +} } // namespace sd::toolpanel +//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.hxx b/sd/source/ui/toolpanel/ToolPanelDeck.hxx new file mode 100644 index 000000000..145f1d978 --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanelDeck.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * 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_TOOLPANELDECK_HXX +#define SD_TOOLPANELDECK_HXX + +#include "taskpane/TaskPaneTreeNode.hxx" +#include "taskpane/TaskPaneControlFactory.hxx" + +#include <svtools/toolpanel/toolpaneldeck.hxx> +#include <svtools/toolpanel/tabalignment.hxx> +#include <svtools/toolpanel/tabitemcontent.hxx> + +//...................................................................................................................... +namespace sd { namespace toolpanel +{ +//...................................................................................................................... + + class ToolPanelViewShell; + + //================================================================================================================== + //= ToolPanelDeck + //================================================================================================================== + typedef ::svt::ToolPanelDeck ToolPanelDeck_Base; + class ToolPanelDeck : public ToolPanelDeck_Base + { + public: + ToolPanelDeck( + ::Window& i_rParent, + ToolPanelViewShell& i_rViewShell + ); + ~ToolPanelDeck(); + + // panel maintenance + size_t CreateAndInsertPanel( + ::std::auto_ptr< ControlFactory >& i_rControlFactory, + const Image& i_rImage, + const USHORT i_nTitleResId, + const ULONG i_nHelpId + ); + + void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); + + private: + ToolPanelViewShell& m_rViewShell; + }; + +//...................................................................................................................... +} } // sd::toolpanel +//...................................................................................................................... + +#endif // SD_TOOLPANELDECK_HXX diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx new file mode 100644 index 000000000..807d9b040 --- /dev/null +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -0,0 +1,642 @@ +/************************************************************************* + * 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 "taskpane/ToolPanelViewShell.hxx" + +#include "TaskPaneShellManager.hxx" +#include "TaskPaneFocusManager.hxx" +#include "controls/MasterPagesPanel.hxx" +#include "LayoutMenu.hxx" +#include "controls/TableDesignPanel.hxx" +#include "controls/CustomAnimationPanel.hxx" +#include "controls/SlideTransitionPanel.hxx" +#include "controls/MasterPagesSelector.hxx" +#include "PaneDockingWindow.hxx" +#include "FrameView.hxx" +#include "Window.hxx" +#include "PaneDockingWindow.hxx" +#include "ToolPanelDeck.hxx" +#include "sdmod.hxx" +#include "app.hrc" +#include "glob.hrc" +#include "res_bmp.hrc" +#include "helpids.h" +#include "strings.hrc" +#include "sdresid.hxx" +#include "framework/FrameworkHelper.hxx" +#include <com/sun/star/drawing/framework/XResourceId.hpp> +#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp> +#include <com/sun/star/drawing/XDrawSubController.hpp> + +#include <svx/dlgctrl.hxx> +#include <sfx2/imagemgr.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/msg.hxx> +#include <sfx2/objface.hxx> +#include <svx/colrctrl.hxx> +#include <svx/xtable.hxx> +#include <vcl/dockwin.hxx> +#include "sdtreelb.hxx" +#include "DrawViewShell.hxx" +#include "drawdoc.hxx" +#include "ViewShellBase.hxx" +#include <svx/ruler.hxx> +#include <vcl/svapp.hxx> +#include <vcl/toolbox.hxx> +#include <tools/diagnose_ex.h> + +#include <vector> + +using namespace ::sd::toolpanel; + +#define ToolPanelViewShell +#include "sdslots.hxx" + +/** === begin UNO using === **/ +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::XInterface; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::makeAny; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Type; +using ::com::sun::star::accessibility::XAccessible; +using ::com::sun::star::drawing::XDrawSubController; +using ::com::sun::star::frame::XFrame; +/** === end UNO using === **/ + +using ::sd::framework::FrameworkHelper; + +namespace sd { namespace toolpanel { + +// ===================================================================================================================== +// = ToolPanelViewShell::Implementation - declaration +// ===================================================================================================================== +/** Inner implementation class of ToolPanelViewShell. +*/ +class ToolPanelViewShell::Implementation +{ +public: + static const size_t mnInvalidId = static_cast< size_t >( -1 ); + + Implementation(); + ~Implementation(); + + /** Here the panels are created that are shown in the task pane. + */ + void Setup( ToolPanelViewShell& i_rViewShell, ToolPanelDeck& i_rPanelDeck ); + + /** Return the public id for the given internal one. + @return + When the given public id is not known then PID_UNKNOWN is + returned. + */ + PanelId GetPublicId (size_t nInternalId) const; + + /** Return the internal id for the given public one. + @return + When the given public id is not known then mnInvalidId is + returned. + */ + size_t GetInternalId (PanelId nPublicId) const; + +private: + /** Make a new panel known to the translation table that translates + between internal indices as returned by + ControlContainer::AddControl() and public indices defined by + ToolPanelViewShell::PanelId. + */ + void AddPanel (size_t nInternalId, PanelId nPublicId); + + /** This map translates between internal indices returned by + ControlContainer::AddControl() and public indices defined by + ToolPanelViewShell::PanelId. + */ + typedef ::std::vector<PanelId> InternalIdToPanelIdMap; + InternalIdToPanelIdMap maIndexMap; +}; + +// ===================================================================================================================== +// = helpers +// ===================================================================================================================== +// --------------------------------------------------------------------------------------------------------------------- +namespace { + +enum MenuId { + MID_UNLOCK_TASK_PANEL = 1, + MID_LOCK_TASK_PANEL = 2, + MID_FIRST_CONTROL = 3 +}; + +} // end of anonymouse namespace + +// ===================================================================================================================== +// = ToolPanelViewShell +// ===================================================================================================================== +// --------------------------------------------------------------------------------------------------------------------- +SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL)) +{ +} + +// --------------------------------------------------------------------------------------------------------------------- +TYPEINIT1(ToolPanelViewShell, ViewShell); + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::Setup( ToolPanelViewShell& i_rViewShell, ToolPanelDeck& i_rPanelDeck ) +{ + typedef std::auto_ptr<ControlFactory> (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell ); + + struct PanelDescriptor + { + ControlFactoryFactory pFactory; + const sal_Char* pImageCommandName; + USHORT nTitleResourceID; + ULONG nHelpID; + PanelId nPanelID; + }; + + PanelDescriptor aPanels[] = { + // "Master Pages" + { &controls::MasterPagesPanel::CreateControlFactory, "PresentationLayout", STR_TASKPANEL_MASTER_PAGE_TITLE, HID_SD_SLIDE_DESIGNS, PID_MASTER_PAGES }, + // "Layout" + { &LayoutMenu::CreateControlFactory, "ModifyPage", STR_TASKPANEL_LAYOUT_MENU_TITLE, HID_SD_SLIDE_LAYOUTS, PID_LAYOUT }, + // "Tables Design" + { &controls::TableDesignPanel::CreateControlFactory, "InsertTable", DLG_TABLEDESIGNPANE, HID_SD_TABLE_DESIGN, PID_TABLE_DESIGN }, + // "Custom Animation" + { &controls::CustomAnimationPanel::CreateControlFactory, "CustomAnimation", STR_CUSTOMANIMATIONPANE, HID_SD_CUSTOM_ANIMATIONS, PID_CUSTOM_ANIMATION }, + // "Slide Transition" + { &controls::SlideTransitionPanel::CreateControlFactory, "RehearseTimings", STR_SLIDE_TRANSITION_PANE, HID_SD_SLIDE_TRANSITIONS, PID_SLIDE_TRANSITION } + }; + + Reference< XFrame > xFrame( i_rViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ); + for ( size_t i=0; i < sizeof( aPanels ) / sizeof( aPanels[0] ); ++i ) + { + ::rtl::OUStringBuffer aCommandName; + aCommandName.appendAscii( ".uno:" ); + aCommandName.appendAscii( aPanels[i].pImageCommandName ); + + size_t nPanelPos = i_rPanelDeck.CreateAndInsertPanel( + (*aPanels[i].pFactory)( i_rViewShell ), + GetImage( xFrame, aCommandName.makeStringAndClear(), FALSE, FALSE ), + aPanels[i].nTitleResourceID, + aPanels[i].nHelpID + ); + AddPanel( nPanelPos, aPanels[i].nPanelID ); + } + + // activate default panel + i_rPanelDeck.ActivatePanel( GetInternalId( PID_LAYOUT ) ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Initialize() +{ + if ( !mbIsInitialized ) + { + mbIsInitialized = true; + mpImpl->Setup( *this, *mpPanelDeck ); + mpPanelDeck->Show(); + } +} + +// --------------------------------------------------------------------------------------------------------------------- +ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, + FrameView* pFrameViewArgument ) + :ViewShell(pFrame, pParentWindow, rViewShellBase) + ,mpImpl( new Implementation ) + ,mpPanelDeck( new ToolPanelDeck( *mpContentWindow.get(), *this ) ) + ,mbIsInitialized(false) + ,mpSubShellManager() + ,mnMenuId(0) +{ + meShellType = ST_TOOL_PANEL; + + mpContentWindow->SetCenterAllowed( false ); + pParentWindow->SetStyle( pParentWindow->GetStyle() | WB_DIALOGCONTROL ); + + GetParentWindow()->SetBackground( Wallpaper() ); + mpContentWindow->SetBackground( Wallpaper() ); + + GetParentWindow()->SetHelpId(HID_SD_TASK_PANE); + + ConnectToDockingWindow(); + + SetPool( &GetDoc()->GetPool() ); + + if ( pFrameViewArgument ) + mpFrameView = pFrameViewArgument; + else + mpFrameView = new FrameView( GetDoc() ); + GetFrameView()->Connect(); + + // Hide or delete unused controls that we have inherited from the + // ViewShell base class. + mpHorizontalScrollBar.reset(); + mpVerticalScrollBar.reset(); + mpScrollBarBox.reset(); + mpHorizontalRuler.reset(); + mpVerticalRuler.reset(); + + SetName( String( RTL_CONSTASCII_USTRINGPARAM( "ToolPanelViewShell" ) ) ); + + // For accessibility we have to shortly hide the content window. This + // triggers the construction of a new accessibility object for the new + // view shell. (One is created earlier while the construtor of the base + // class is executed. At that time the correct accessibility object can + // not be constructed.) + if ( mpContentWindow.get() ) + { + mpContentWindow->Hide(); + mpContentWindow->Show(); + } + + // Register the shell manager as factory at the ViewShellManager. + mpSubShellManager.reset( new TaskPaneShellManager( + GetViewShellBase().GetViewShellManager(), + *this + ) ); + GetViewShellBase().GetViewShellManager()->AddSubShellFactory( this, mpSubShellManager ); +} + +// --------------------------------------------------------------------------------------------------------------------- +ToolPanelViewShell::~ToolPanelViewShell() +{ + mpPanelDeck.reset(); + GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager); +} + +// --------------------------------------------------------------------------------------------------------------------- +// static +void ToolPanelViewShell::RegisterControls() +{ + SfxModule* pModule = SD_MOD(); + controls::MasterPagesSelector::RegisterInterface( pModule ); + LayoutMenu::RegisterInterface( pModule ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::ArrangeGUIElements() +{ + ViewShell::ArrangeGUIElements(); + + Initialize(); + + mpPanelDeck->SetPosSizePixel( Point(), maViewSize ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::GetFocus() +{ + Invalidate(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::LoseFocus() +{ + Invalidate(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::KeyInput( const KeyEvent& i_rKeyEvent ) +{ + const KeyCode nCode = i_rKeyEvent.GetKeyCode(); + if ( nCode == KEY_RETURN ) + { + if ( !mpPanelDeck->HasChildPathFocus() ) + mpPanelDeck->GrabFocus(); + } + else + ViewShell::KeyInput( i_rKeyEvent, NULL ); +} + +// --------------------------------------------------------------------------------------------------------------------- +IMPL_LINK( ToolPanelViewShell, DockingChanged, PaneDockingWindow*, i_pDockingWindow ) +{ + ENSURE_OR_RETURN( i_pDockingWindow == dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ), "unknown source", 0 ); + switch ( i_pDockingWindow->GetAlignment() ) + { + case SFX_ALIGN_LEFT: + mpPanelDeck->SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY ); + break; + case SFX_ALIGN_RIGHT: + case SFX_ALIGN_NOALIGNMENT: + mpPanelDeck->SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); + break; + case SFX_ALIGN_TOP: + mpPanelDeck->SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY ); + break; + case SFX_ALIGN_BOTTOM: + mpPanelDeck->SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY ); + break; + default: + OSL_ENSURE( false, "ToolPanelViewShell::DockingChanged: unexpected alignment!" ); + break; + } + return 0L; +} + +// --------------------------------------------------------------------------------------------------------------------- +IMPL_LINK(ToolPanelViewShell, ToolboxClickHandler, ToolBox*, pToolBox) +{ + if (pToolBox->GetCurItemId() == mnMenuId) + { + pToolBox->EndSelection(); + + DockingWindow* pDockingWindow = GetDockingWindow(); + ::std::auto_ptr<PopupMenu> pMenu = CreatePopupMenu ( + pDockingWindow!=NULL && !pDockingWindow->IsFloatingMode()); + pMenu->SetSelectHdl ( + LINK(this, ToolPanelViewShell, MenuSelectHandler)); + + // pass toolbox button rect so the menu can stay open on button up + Rectangle aRect = pToolBox->GetItemRect(mnMenuId); + aRect.SetPos(pToolBox->GetPosPixel() ); + pMenu->Execute (pDockingWindow, aRect, POPUPMENU_EXECUTE_DOWN); + } + + return 0; +} + +// --------------------------------------------------------------------------------------------------------------------- +IMPL_LINK(ToolPanelViewShell, MenuSelectHandler, Menu*, pMenu) +{ + if (pMenu) + { + pMenu->Deactivate(); + switch (pMenu->GetCurItemId()) + { + case MID_UNLOCK_TASK_PANEL: + { + DockingWindow* pDockingWindow = GetDockingWindow(); + if (pDockingWindow != NULL) + pDockingWindow->SetFloatingMode (TRUE); + } + break; + + case MID_LOCK_TASK_PANEL: + { + DockingWindow* pDockingWindow = GetDockingWindow(); + if (pDockingWindow != NULL) + pDockingWindow->SetFloatingMode (FALSE); + } + break; + + default: +// { +// sal_uInt32 nIndex (pMenu->GetUserValue(pMenu->GetCurItemId())); +// mpTaskPane->GetControlContainer().SetVisibilityState ( +// nIndex, +// ControlContainer::VS_TOGGLE); +// // mpTaskPane->Resize(); +// // mpTaskPane->Invalidate(); +// } + break; + } + } + + return 0; +} + +// --------------------------------------------------------------------------------------------------------------------- +::std::auto_ptr<PopupMenu> ToolPanelViewShell::CreatePopupMenu ( + bool bIsDocking) +{ + ::std::auto_ptr<PopupMenu> pMenu (new PopupMenu ()); + FloatingWindow* pFloat = static_cast<FloatingWindow*>(pMenu->GetWindow()); + if (pFloat != NULL) + { + pFloat->SetPopupModeFlags ( + pFloat->GetPopupModeFlags() + | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); + } + + // Add one entry for every tool panel element to individually make + // them visible or hide them. +// USHORT nIndex = MID_FIRST_CONTROL; +// sal_uInt32 nControlIndex; +// ControlContainer& rContainer (mpTaskPane->GetControlContainer()); +// for (nControlIndex=0; +// nControlIndex<rContainer.GetControlCount(); +// nControlIndex=rContainer.GetNextIndex(nControlIndex,true,false)) +// { +// TreeNode* pChild = rContainer.GetControl(nControlIndex); +// TitledControl* pControl +// = static_cast<TitledControl*>(pChild->GetWindow()); +// pMenu->InsertItem (nIndex, +// pControl->GetTitle(), +// MIB_CHECKABLE); +// pMenu->SetUserValue (nIndex, nControlIndex); +// if (pControl->IsVisible()) +// pMenu->CheckItem (nIndex, TRUE); +// nIndex++; +// } + + pMenu->InsertSeparator (); + + // Add entry for docking or un-docking the tool panel. + if (bIsDocking) + pMenu->InsertItem ( + MID_UNLOCK_TASK_PANEL, + String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_UNLOCK))); + else + pMenu->InsertItem ( + MID_LOCK_TASK_PANEL, + String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_LOCK))); + pMenu->RemoveDisabledEntries (FALSE, FALSE); + + return pMenu; +} + +// --------------------------------------------------------------------------------------------------------------------- +SdPage* ToolPanelViewShell::GetActualPage() +{ + return NULL; +} + +// --------------------------------------------------------------------------------------------------------------------- +SdPage* ToolPanelViewShell::getCurrentPage() const +{ + return NULL; +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Execute( SfxRequest& ) +{ + OSL_ENSURE( false, "ToolPanelViewShell::Execute: not to be called! (right?)" ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::GetState( SfxItemSet& ) +{ + OSL_ENSURE( false, "ToolPanelViewShell::GetState: not to be called! (right?)" ); +} + +// --------------------------------------------------------------------------------------------------------------------- +TaskPaneShellManager& ToolPanelViewShell::GetSubShellManager() const +{ + return *mpSubShellManager.get(); +} + +// --------------------------------------------------------------------------------------------------------------------- +DockingWindow* ToolPanelViewShell::GetDockingWindow() +{ + ::Window* pParentWindow = GetParentWindow(); + DockingWindow* pDockingWindow = NULL; + while (pParentWindow!=NULL && pDockingWindow==NULL) + { + pDockingWindow = dynamic_cast<DockingWindow*>(pParentWindow); + pParentWindow = pParentWindow->GetParent(); + } + return pDockingWindow; +} + +// --------------------------------------------------------------------------------------------------------------------- +Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd::Window* pWindow ) +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible> xAccessible; + + OSL_ENSURE( false, "ToolPanelViewShell::CreateAccessibleDocumentView: missing implementation!" ); +// if (mpTaskPane.get()!=NULL && pWindow!=NULL) +// { +// // We have to call CreateAccessible directly so that we can specify +// // the correct accessible parent. +// ::Window* pParentWindow = pWindow->GetAccessibleParentWindow(); +// if (pParentWindow != NULL) +// xAccessible = mpTaskPane->CreateAccessibleObject( +// pParentWindow->GetAccessible()); +// } + + return xAccessible; +} + +// --------------------------------------------------------------------------------------------------------------------- +Reference< XDrawSubController > ToolPanelViewShell::CreateSubController() +{ + // This view shell is not designed to be the main view shell and thus + // does not support a UNO sub controller. + return Reference< XDrawSubController >(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::ConnectToDockingWindow() +{ + PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(GetDockingWindow()); + if (pDockingWindow != NULL) + { + pDockingWindow->InitializeTitleToolBox(); + mnMenuId = pDockingWindow->AddMenu ( + String(SdResId(STR_TASKPANEL_MASTER_PAGE_MENU_TITLE)), + HID_SD_TASK_PANE_VIEW_MENU, + LINK(this, ToolPanelViewShell, ToolboxClickHandler)); + + // be notified when the docking position of the window changes + pDockingWindow->SetEndDockingHdl( LINK( this, ToolPanelViewShell, DockingChanged ) ); + } + + // Tell the focus manager that we want to pass the focus to our + // child. + FocusManager::Instance().RegisterDownLink( GetParentWindow(), mpPanelDeck.get() ); +} + +// --------------------------------------------------------------------------------------------------------------------- +bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) +{ + ::Window* pOldParentWindow = GetParentWindow(); + FocusManager::Instance().RemoveLinks( pOldParentWindow, mpPanelDeck.get() ); + FocusManager::Instance().RemoveLinks( mpPanelDeck.get(), pOldParentWindow ); + + PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ); + if ( pDockingWindow != NULL ) + { + pDockingWindow->SetEndDockingHdl( Link() ); + } + + ViewShell::RelocateToParentWindow(pParentWindow); + + ConnectToDockingWindow(); + + Resize(); + + return true; +} + + + + +// ===================================================================================================================== +// = ToolPanelViewShell:Implementation - implementation +// ===================================================================================================================== +// --------------------------------------------------------------------------------------------------------------------- +ToolPanelViewShell::Implementation::Implementation() + :maIndexMap( (InternalIdToPanelIdMap::size_type)PID__END, PID_UNKNOWN ) +{ +} + +// --------------------------------------------------------------------------------------------------------------------- +ToolPanelViewShell::Implementation::~Implementation() +{ +} + +// --------------------------------------------------------------------------------------------------------------------- +void ToolPanelViewShell::Implementation::AddPanel( size_t nInternalId, PanelId nPublicId ) +{ + maIndexMap[nInternalId] = nPublicId; +} + +// --------------------------------------------------------------------------------------------------------------------- +ToolPanelViewShell::PanelId ToolPanelViewShell::Implementation::GetPublicId ( size_t nInternalId ) const +{ + if ( nInternalId < maIndexMap.size() ) + return maIndexMap[nInternalId]; + else + return PID_UNKNOWN; +} + +// --------------------------------------------------------------------------------------------------------------------- +size_t ToolPanelViewShell::Implementation::GetInternalId( ToolPanelViewShell::PanelId nPublicId ) const +{ + for ( size_t i = 0; i < maIndexMap.size(); ++i ) + { + if ( maIndexMap[i] == nPublicId ) + { + return i; + } + } + + return mnInvalidId; +} + +} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx index 10d0cf028..35673e61b 100644 --- a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx +++ b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx @@ -34,6 +34,7 @@ #include "CustomAnimationPanel.hxx" #include "taskpane/TaskPaneControlFactory.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "strings.hrc" #include "sdresid.hxx" @@ -49,11 +50,20 @@ namespace toolpanel { namespace controls { CustomAnimationPanel::CustomAnimationPanel(TreeNode* pParent, ViewShellBase& rBase) : SubToolPanel (pParent) + , m_pPanelViewShell (NULL) { mpWrappedControl = createCustomAnimationPanel( pParent->GetWindow(), rBase ); mpWrappedControl->Show(); } +CustomAnimationPanel::CustomAnimationPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell) + :SubToolPanel( i_rParentWindow ) + ,m_pPanelViewShell( &i_rPanelViewShell ) +{ + mpWrappedControl = createCustomAnimationPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase() ); + mpWrappedControl->Show(); +} + CustomAnimationPanel::~CustomAnimationPanel() { delete mpWrappedControl; @@ -65,6 +75,19 @@ std::auto_ptr<ControlFactory> CustomAnimationPanel::CreateControlFactory (ViewSh new ControlFactoryWithArgs1<CustomAnimationPanel,ViewShellBase>(rBase)); } +std::auto_ptr< ControlFactory > CustomAnimationPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) +{ + return std::auto_ptr< ControlFactory >( + new RootControlFactoryWithArg< CustomAnimationPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); +} + +TaskPaneShellManager* CustomAnimationPanel::GetShellManager() +{ + if ( m_pPanelViewShell ) + return &m_pPanelViewShell->GetSubShellManager(); + return SubToolPanel::GetShellManager(); +} + Size CustomAnimationPanel::GetPreferredSize() { return maPreferredSize; diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx index 36522d7f4..2f0eb4ed7 100644 --- a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx +++ b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx @@ -40,6 +40,7 @@ class ViewShellBase; namespace sd { namespace toolpanel { class TreeNode; class ControlFactory; +class ToolPanelViewShell; } } namespace sd { namespace toolpanel { namespace controls { @@ -51,10 +52,18 @@ public: CustomAnimationPanel ( TreeNode* pParent, ViewShellBase& rBase); + CustomAnimationPanel ( + Window& i_rParentWindow, + ToolPanelViewShell& i_rPanelViewShell); virtual ~CustomAnimationPanel (void); static std::auto_ptr<ControlFactory> CreateControlFactory (ViewShellBase& rBase); + static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rPanelViewShell); + + // TreeNode overridables + virtual TaskPaneShellManager* GetShellManager(); + // ILayoutableWindow overridables virtual Size GetPreferredSize (void); virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); @@ -71,6 +80,7 @@ public: private: Size maPreferredSize; ::Window* mpWrappedControl; + ToolPanelViewShell* m_pPanelViewShell; }; } } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx index 76f5370da..5ea3a7836 100644 --- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx +++ b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx @@ -36,6 +36,7 @@ #include "CurrentMasterPagesSelector.hxx" #include "RecentMasterPagesSelector.hxx" #include "AllMasterPagesSelector.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "taskpane/TaskPaneControlFactory.hxx" #include "taskpane/TitledControl.hxx" #include "../TaskPaneShellManager.hxx" @@ -53,6 +54,19 @@ namespace sd { namespace toolpanel { namespace controls { MasterPagesPanel::MasterPagesPanel (TreeNode* pParent, ViewShellBase& rBase) : ScrollPanel (pParent) + , m_pPanelViewShell (NULL) +{ + impl_construct( rBase ); +} + +MasterPagesPanel::MasterPagesPanel (::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell) + :ScrollPanel (i_rParentWindow) + ,m_pPanelViewShell( &i_rPanelViewShell ) +{ + impl_construct( m_pPanelViewShell->GetViewShellBase() ); +} + +void MasterPagesPanel::impl_construct( ViewShellBase& rBase ) { SdDrawDocument* pDocument = rBase.GetDocument(); ::std::auto_ptr<controls::MasterPagesSelector> pSelector; @@ -121,6 +135,24 @@ MasterPagesPanel::MasterPagesPanel (TreeNode* pParent, ViewShellBase& rBase) MasterPagesPanel::~MasterPagesPanel (void) { + TaskPaneShellManager* pShellManager( GetShellManager() ); + OSL_ENSURE( pShellManager, "MasterPagesPanel::~MasterPagesPanel: no shell manager anymore - cannot remove sub shells!" ); + if ( pShellManager ) + { + pShellManager->RemoveSubShell( HID_SD_TASK_PANE_PREVIEW_CURRENT ); + pShellManager->RemoveSubShell( HID_SD_TASK_PANE_PREVIEW_RECENT ); + pShellManager->RemoveSubShell( HID_SD_TASK_PANE_PREVIEW_ALL ); + } +} + + + + +TaskPaneShellManager* MasterPagesPanel::GetShellManager() +{ + if ( m_pPanelViewShell ) + return &m_pPanelViewShell->GetSubShellManager(); + return TreeNode::GetShellManager(); } @@ -133,6 +165,10 @@ std::auto_ptr<ControlFactory> MasterPagesPanel::CreateControlFactory (ViewShellB } - +std::auto_ptr< ControlFactory > MasterPagesPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) +{ + return std::auto_ptr< ControlFactory >( + new RootControlFactoryWithArg< MasterPagesPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); +} } } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx index a5c557677..3475e2a5f 100644 --- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx +++ b/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx @@ -40,6 +40,7 @@ class ViewShellBase; namespace sd { namespace toolpanel { class ControlFactory; class TreeNode; +class ToolPanelViewShell; } } namespace sd { namespace toolpanel { namespace controls { @@ -55,9 +56,22 @@ public: MasterPagesPanel ( TreeNode* pParent, ViewShellBase& rBase); + MasterPagesPanel ( + ::Window& i_rParentWindow, + ToolPanelViewShell& i_rPanelViewShell); virtual ~MasterPagesPanel (void); + // TreeNode overridables + virtual TaskPaneShellManager* GetShellManager (void); + static std::auto_ptr<ControlFactory> CreateControlFactory (ViewShellBase& rBase); + static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); + +private: + void impl_construct( ViewShellBase& rBase ); + +private: + ToolPanelViewShell* m_pPanelViewShell; }; } } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx index 4c09330ec..b333e3d3d 100644 --- a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx +++ b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx @@ -33,6 +33,7 @@ #include "SlideTransitionPanel.hxx" #include "taskpane/TaskPaneControlFactory.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "strings.hrc" #include "sdresid.hxx" @@ -50,12 +51,22 @@ namespace toolpanel { namespace controls { SlideTransitionPanel::SlideTransitionPanel(TreeNode* pParent, ViewShellBase& rBase) : SubToolPanel (pParent), - maPreferredSize( 100, 200 ) + maPreferredSize( 100, 200 ), + m_pPanelViewShell( NULL ) { mpWrappedControl = createSlideTransitionPanel( pParent->GetWindow(), rBase ); mpWrappedControl->Show(); } +SlideTransitionPanel::SlideTransitionPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rToolPanelShell) + :SubToolPanel( i_rParentWindow ) + ,maPreferredSize( 100, 200 ) + ,m_pPanelViewShell( &i_rToolPanelShell ) +{ + mpWrappedControl = createSlideTransitionPanel( &i_rParentWindow, i_rToolPanelShell.GetViewShellBase() ); + mpWrappedControl->Show(); +} + SlideTransitionPanel::~SlideTransitionPanel() { delete mpWrappedControl; @@ -67,6 +78,19 @@ std::auto_ptr<ControlFactory> SlideTransitionPanel::CreateControlFactory (ViewSh new ControlFactoryWithArgs1<SlideTransitionPanel,ViewShellBase>(rBase)); } +std::auto_ptr< ControlFactory > SlideTransitionPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) +{ + return std::auto_ptr< ControlFactory >( + new RootControlFactoryWithArg< SlideTransitionPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); +} + +TaskPaneShellManager* SlideTransitionPanel::GetShellManager() +{ + if ( m_pPanelViewShell ) + return &m_pPanelViewShell->GetSubShellManager(); + return SubToolPanel::GetShellManager(); +} + Size SlideTransitionPanel::GetPreferredSize() { return maPreferredSize; diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx index 6422afce4..99747c955 100644 --- a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx +++ b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx @@ -39,6 +39,7 @@ class ViewShellBase; namespace sd { namespace toolpanel { class ControlFactory; class TreeNode; +class ToolPanelViewShell; } } namespace sd { namespace toolpanel { namespace controls { @@ -50,10 +51,18 @@ public: SlideTransitionPanel ( TreeNode* pParent, ViewShellBase& rBase); + SlideTransitionPanel ( + Window& i_rParentWindow, + ToolPanelViewShell& i_rToolPanelShell); virtual ~SlideTransitionPanel (void); static std::auto_ptr<ControlFactory> CreateControlFactory (ViewShellBase& rBase); + static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); + + // TreeNode overridables + virtual TaskPaneShellManager* GetShellManager(); + // ILayoutableWindow overridables virtual Size GetPreferredSize (void); virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); @@ -71,6 +80,7 @@ public: private: Size maPreferredSize; ::Window* mpWrappedControl; + ToolPanelViewShell* m_pPanelViewShell; }; } } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx index 78a629888..1a5832e47 100644 --- a/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx +++ b/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx @@ -34,6 +34,7 @@ #include "TableDesignPanel.hxx" #include "taskpane/TaskPaneControlFactory.hxx" +#include "taskpane/ToolPanelViewShell.hxx" #include "strings.hrc" #include "sdresid.hxx" @@ -49,11 +50,20 @@ namespace toolpanel { namespace controls { TableDesignPanel::TableDesignPanel(TreeNode* pParent, ViewShellBase& rBase) : SubToolPanel (pParent) + ,m_pPanelViewShell( NULL ) { mpWrappedControl = createTableDesignPanel( pParent->GetWindow(), rBase ); mpWrappedControl->Show(); } +TableDesignPanel::TableDesignPanel( ::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell ) + :SubToolPanel( i_rParentWindow ) + ,m_pPanelViewShell( &i_rPanelViewShell ) +{ + mpWrappedControl = createTableDesignPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase() ); + mpWrappedControl->Show(); +} + TableDesignPanel::~TableDesignPanel() { delete mpWrappedControl; @@ -65,6 +75,19 @@ std::auto_ptr<ControlFactory> TableDesignPanel::CreateControlFactory (ViewShellB new ControlFactoryWithArgs1<TableDesignPanel,ViewShellBase>(rBase)); } +std::auto_ptr< ControlFactory > TableDesignPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) +{ + return std::auto_ptr< ControlFactory >( + new RootControlFactoryWithArg< TableDesignPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); +} + +TaskPaneShellManager* TableDesignPanel::GetShellManager() +{ + if ( m_pPanelViewShell ) + return &m_pPanelViewShell->GetSubShellManager(); + return SubToolPanel::GetShellManager(); +} + Size TableDesignPanel::GetPreferredSize() { return maPreferredSize; diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx index c62749ae0..6902029c7 100644 --- a/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx +++ b/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx @@ -40,6 +40,7 @@ class ViewShellBase; namespace sd { namespace toolpanel { class TreeNode; class ControlFactory; +class ToolPanelViewShell; } } namespace sd { namespace toolpanel { namespace controls { @@ -51,10 +52,18 @@ public: TableDesignPanel ( TreeNode* pParent, ViewShellBase& rBase); + TableDesignPanel ( + ::Window& i_rParentWindow, + ToolPanelViewShell& i_rPanelViewShell); virtual ~TableDesignPanel (void); static std::auto_ptr<ControlFactory> CreateControlFactory (ViewShellBase& rBase); + static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); + + // TreeNode overridables + virtual TaskPaneShellManager* GetShellManager(); + // ILayoutableWindow overridables virtual Size GetPreferredSize (void); virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); @@ -71,6 +80,7 @@ public: private: Size maPreferredSize; ::Window* mpWrappedControl; + ToolPanelViewShell* m_pPanelViewShell; }; } } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk index ba6a5d29f..4ba8968bd 100644 --- a/sd/source/ui/toolpanel/makefile.mk +++ b/sd/source/ui/toolpanel/makefile.mk @@ -59,7 +59,10 @@ SLOFILES = \ $(SLO)$/TaskPaneFocusManager.obj \ $(SLO)$/TaskPaneShellManager.obj \ $(SLO)$/TaskPaneTreeNode.obj \ - $(SLO)$/TaskPaneViewShell.obj \ + $(SLO)$/TaskPaneViewShell.obj \ + $(SLO)$/ToolPanelViewShell.obj \ + $(SLO)$/ToolPanelDeck.obj \ + $(SLO)$/TaskPaneToolPanel.obj \ \ $(SLO)$/EmptyWindow.obj \ $(SLO)$/LayoutMenu.obj \ diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx index f0f541d2d..da342cc3e 100644 --- a/sd/source/ui/view/GraphicViewShellBase.cxx +++ b/sd/source/ui/view/GraphicViewShellBase.cxx @@ -104,6 +104,7 @@ void GraphicViewShellBase::Execute (SfxRequest& rRequest) switch (nSlotId) { case SID_RIGHT_PANE: + case SID_TOOL_PANEL_PANE: case SID_NOTES_WINDOW: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_DIAMODE: diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 82b32c3ea..1d36d990d 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -1310,6 +1310,7 @@ void ToolBarRules::MainViewShellChanged (ViewShell::ShellType nShellType) case ViewShell::ST_NONE: case ViewShell::ST_PRESENTATION: case ViewShell::ST_TASK_PANE: + case ViewShell::ST_TOOL_PANEL: default: break; } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 90a920ad2..83847b242 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -94,6 +94,7 @@ #include <svl/whiter.hxx> #include <comphelper/processfactory.hxx> #include <vcl/msgbox.hxx> +#include <tools/diagnose_ex.h> #include "fubullet.hxx" @@ -822,6 +823,13 @@ void ViewShellBase::Execute (SfxRequest& rRequest) framework::FrameworkHelper::msTaskPaneURL); break; + case SID_TOOL_PANEL_PANE: + mpImpl->SetPaneVisibility( + rRequest, + framework::FrameworkHelper::msToolPanelPaneURL, + framework::FrameworkHelper::msToolPanelViewURL); + break; + case SID_NORMAL_MULTI_PANE_GUI: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_DRAWINGMODE: @@ -1494,9 +1502,9 @@ void ViewShellBase::Implementation::SetPaneVisibility ( xConfigurationController->requestResourceDeactivation( xPaneId); } - catch (RuntimeException&) + catch (const Exception &) { - DBG_ASSERT(false, "ViewShellBase::Implementation::SetPaneVisibility(): caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } @@ -1546,6 +1554,11 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) xContext, FrameworkHelper::msRightPaneURL); break; + case SID_TOOL_PANEL_PANE: + xResourceId = ResourceId::create( + xContext, FrameworkHelper::msToolPanelPaneURL); + break; + case SID_NORMAL_MULTI_PANE_GUI: xResourceId = ResourceId::createWithAnchorURL( xContext, diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index 90269fb89..2f6ec927d 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -376,6 +376,7 @@ sal_uInt16 ViewShell::Implementation::GetViewId (void) // and there is not (yet) a proper ViewShellBase sub class for the // remaining types we chose the Impress factory as a fall back. case ViewShell::ST_TASK_PANE: + case ViewShell::ST_TOOL_PANEL: case ViewShell::ST_NONE: default: return IMPRESS_FACTORY_ID; diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index c1dacd33e..be0035c51 100644 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -100,7 +100,8 @@ </menu:menu> <menu:menuseparator/> <menu:menuitem menu:id=".uno:RightPane"/> - <menu:menuitem menu:id=".uno:LeftPaneImpress"/> + <menu:menuitem menu:id=".uno:ToolPanel"/> + <menu:menuitem menu:id=".uno:LeftPaneImpress"/> <menu:menuitem menu:id=".uno:AvailableToolbars"/> <menu:menuitem menu:id=".uno:StatusBarVisible"/> <menu:menuitem menu:id=".uno:ShowImeStatusWindow"/> |