diff options
Diffstat (limited to 'sd/source/ui/dlg/PaneChildWindows.cxx')
-rwxr-xr-x | sd/source/ui/dlg/PaneChildWindows.cxx | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx index 6a6d515822f8..f9f181b0e44d 100755 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -37,6 +37,9 @@ #include "strings.hrc" #include "sdresid.hxx" +#include <com/sun/star/drawing/framework/XConfigurationController.hpp> +#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp> + #include <sfx2/app.hxx> #include <sfx2/dockwin.hxx> #include <sfx2/bindings.hxx> @@ -45,6 +48,12 @@ namespace sd { +using ::com::sun::star::uno::Reference; +using ::com::sun::star::drawing::framework::XResourceId; +using ::com::sun::star::drawing::framework::XConfigurationController; +using ::com::sun::star::drawing::framework::ResourceActivationMode_ADD; +using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE; + SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS) SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW) SFX_IMPL_DOCKINGWINDOW( ToolPanelChildWindow, SID_TASKPANE) @@ -148,9 +157,48 @@ ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, USHORT i_ :PaneChildWindow( i_pParentWindow, i_nId, i_pBindings, i_pChildWindowInfo, FLT_TOOL_PANEL_DOCKING_WINDOW, STR_RIGHT_PANE_TITLE, SFX_ALIGN_RIGHT ) { + // just in case this window has been created by SFX, instead our resource framework: Ensure that the resource framework + // activates the task pane, so it is really filled with content (in opposite to the other SFX applications, the + // child window registered for SID_TASKPANE is not responsible for its content, but here in SD, it's the ToolPanelViewShell + // which has this responsibility. And this view shell is created implicitly via the resource framework.) + // #i113788# / 2010-09-03 / frank.schoenheit@oracle.com + SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() ); + ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() ); + ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ToolPanelChildWindow: no view shell access!" ); + + const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) ); + ENSURE_OR_RETURN_VOID( pFrameworkHelper.get(), "ToolPanelChildWindow::ToolPanelChildWindow: no framework helper for the view shell!" ); + Reference<XConfigurationController> xConfigController( pFrameworkHelper->GetConfigurationController() ); + ENSURE_OR_RETURN_VOID( xConfigController.is(), "ToolPanelChildWindow::ToolPanelChildWindow: no config controller!" ); + xConfigController->requestResourceActivation( + framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msRightPaneURL ), + ResourceActivationMode_ADD ); + xConfigController->requestResourceActivation( + framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL ), + ResourceActivationMode_REPLACE + ); } //---------------------------------------------------------------------------------------------------------------------- +struct DelayedToolPanelActivation +{ + DelayedToolPanelActivation( ToolPanelChildWindow& i_rToolPanelWindow, const ::rtl::OUString& i_rPanelURL ) + :m_rToolPanelWindow( i_rToolPanelWindow ) + ,m_sPanelURL( i_rPanelURL ) + { + } + + void operator() (bool) + { + m_rToolPanelWindow.ActivateToolPanel( m_sPanelURL ); + } + +private: + ToolPanelChildWindow& m_rToolPanelWindow; + const ::rtl::OUString m_sPanelURL; +}; + +//---------------------------------------------------------------------------------------------------------------------- void ToolPanelChildWindow::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) { SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() ); @@ -170,8 +218,16 @@ void ToolPanelChildWindow::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL // extensions, too. As long as this is not the case, we need to take the direct way ... ::boost::shared_ptr< ViewShell > pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL ); toolpanel::ToolPanelViewShell* pToolPanelViewShell = dynamic_cast< toolpanel::ToolPanelViewShell* >( pViewShell.get() ); - ENSURE_OR_RETURN_VOID( pToolPanelViewShell != NULL, "ToolPanelChildWindow::ActivateToolPanel: no tool panel view shell access!" ); - pToolPanelViewShell->ActivatePanel( i_rPanelURL ); + if ( pToolPanelViewShell ) + { + pToolPanelViewShell->ActivatePanel( i_rPanelURL ); + } + else + { + Reference< XResourceId > xTaskPaneResource = pFrameworkHelper->RequestView( + framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL ); + pFrameworkHelper->RunOnResourceActivation( xTaskPaneResource, DelayedToolPanelActivation( *this, i_rPanelURL ) ); + } } } |