summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/ui/inc/taskpane/PanelId.hxx16
-rw-r--r--sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx2
-rw-r--r--sd/source/ui/toolpanel/CustomToolPanel.cxx184
-rw-r--r--sd/source/ui/toolpanel/CustomToolPanel.hxx95
-rw-r--r--sd/source/ui/toolpanel/StandardToolPanel.cxx111
-rw-r--r--sd/source/ui/toolpanel/StandardToolPanel.hxx76
-rw-r--r--sd/source/ui/toolpanel/TaskPaneToolPanel.cxx57
-rw-r--r--sd/source/ui/toolpanel/TaskPaneToolPanel.hxx32
-rw-r--r--sd/source/ui/toolpanel/ToolPanelDeck.cxx14
-rw-r--r--sd/source/ui/toolpanel/ToolPanelDeck.hxx9
-rw-r--r--sd/source/ui/toolpanel/ToolPanelDrawer.cxx1
-rw-r--r--sd/source/ui/toolpanel/ToolPanelViewShell.cxx119
-rw-r--r--sd/source/ui/toolpanel/makefile.mk2
13 files changed, 609 insertions, 109 deletions
diff --git a/sd/source/ui/inc/taskpane/PanelId.hxx b/sd/source/ui/inc/taskpane/PanelId.hxx
index dbd618118ecf..6ce1c4693267 100644
--- a/sd/source/ui/inc/taskpane/PanelId.hxx
+++ b/sd/source/ui/inc/taskpane/PanelId.hxx
@@ -39,14 +39,14 @@ namespace sd { namespace toolpanel
*/
enum PanelId
{
- PID__START = 0,
- PID_UNKNOWN = PID__START,
- PID_MASTER_PAGES,
- PID_LAYOUT,
- PID_TABLE_DESIGN,
- PID_CUSTOM_ANIMATION,
- PID_SLIDE_TRANSITION,
- PID__END = PID_SLIDE_TRANSITION
+ PID_UNKNOWN = 0,
+ PID_MASTER_PAGES = 1,
+ PID_LAYOUT = 2,
+ PID_TABLE_DESIGN = 3,
+ PID_CUSTOM_ANIMATION = 4,
+ PID_SLIDE_TRANSITION = 5,
+
+ PID_FIRST_CUSTOM_PANEL = 6
};
//......................................................................................................................
diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx
index bfe3b9419748..9e02194a71c6 100644
--- a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx
+++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx
@@ -129,8 +129,6 @@ private:
class Implementation;
::boost::scoped_ptr< Implementation > mpImpl;
- bool mbIsInitialized;
-
::boost::shared_ptr<TaskPaneShellManager> mpSubShellManager;
/** The id of the menu in the menu bar/tool box of the parent docking
diff --git a/sd/source/ui/toolpanel/CustomToolPanel.cxx b/sd/source/ui/toolpanel/CustomToolPanel.cxx
new file mode 100644
index 000000000000..33ee1270ab1d
--- /dev/null
+++ b/sd/source/ui/toolpanel/CustomToolPanel.cxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ * 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 "CustomToolPanel.hxx"
+#include "framework/FrameworkHelper.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/drawing/framework/ResourceId.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/processfactory.hxx>
+#include <unotools/confignode.hxx>
+#include <tools/diagnose_ex.h>
+
+#if OSL_DEBUG_LEVEL > 0
+#include <rtl/strbuf.hxx>
+#endif
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ /** === 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::drawing::framework::XConfigurationController;
+ using ::com::sun::star::drawing::framework::XResourceId;
+ using ::com::sun::star::drawing::framework::ResourceId;
+ using ::com::sun::star::drawing::framework::XResource;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ ::rtl::OUString lcl_getPanelConfig( const ::utl::OConfigurationNode& i_rPanelConfig, const sal_Char* i_pAsciiPropName )
+ {
+ ::rtl::OUString sConfigValue;
+ OSL_VERIFY( i_rPanelConfig.getNodeValue( i_pAsciiPropName ) >>= sConfigValue );
+ if ( sConfigValue.getLength() == 0 )
+ {
+#if OSL_DEBUG_LEVEL > 0
+ ::rtl::OStringBuffer aMessage;
+ aMessage.append( "lcl_getPanelConfig: invalid config value (" );
+ aMessage.append( i_pAsciiPropName );
+ aMessage.append( ") for panel config '" );
+ aMessage.append( ::rtl::OUStringToOString( i_rPanelConfig.getLocalName(), RTL_TEXTENCODING_UTF8 ) );
+ aMessage.append( "'" );
+ OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+#endif
+ }
+ return sConfigValue;
+ }
+ }
+
+ //==================================================================================================================
+ //= CustomToolPanel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ CustomToolPanel::CustomToolPanel( ToolPanelDeck& i_rPanelDeck, const ::utl::OConfigurationNode& i_rPanelConfig,
+ const Reference< XResourceId >& i_rPaneResourceId, const ::boost::shared_ptr< framework::FrameworkHelper >& i_pFrameworkHelper )
+ :TaskPaneToolPanel( i_rPanelDeck, lcl_getPanelConfig( i_rPanelConfig, "DisplayTitle" ), Image() /* TODO */, SmartId() /* TODO */ )
+ ,m_pFrameworkHelper( i_pFrameworkHelper )
+ ,m_xPanelResourceId()
+ ,m_xPanel()
+ ,m_bAttemptedPanelCreation( false )
+ {
+ ENSURE_OR_THROW( m_pFrameworkHelper.get() != NULL, "invalid framework helper" );
+ ENSURE_OR_THROW( i_rPaneResourceId.is(), "invalid pane resource id" );
+ try
+ {
+ ::rtl::OUString sPanelResourceURL( lcl_getPanelConfig( i_rPanelConfig, "ResourceURL" ) );
+ m_xPanelResourceId.set(
+ ResourceId::createWithAnchor(
+ ::comphelper::getProcessComponentContext(),
+ sPanelResourceURL,
+ i_rPaneResourceId ),
+ UNO_SET_THROW
+ );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ CustomToolPanel::~CustomToolPanel()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void CustomToolPanel::Dispose()
+ {
+ if ( m_xPanel.is() )
+ {
+ try
+ {
+ // TODO: obtain the factory for our panel, and invoke its destroyResource method
+ }
+ catch ( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ TaskPaneToolPanel::Dispose();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ const Reference< XResourceId >& CustomToolPanel::getResourceId() const
+ {
+ return m_xPanelResourceId;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::Window* CustomToolPanel::getPanelWindow() const
+ {
+ ENSURE_OR_RETURN( impl_ensurePanel(), "could not create the panel", NULL );
+ // TODO
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool CustomToolPanel::impl_ensurePanel() const
+ {
+ ENSURE_OR_RETURN_FALSE( !isDisposed(), "already disposed" );
+
+ if ( !m_bAttemptedPanelCreation )
+ {
+ const_cast< CustomToolPanel* >( this )->m_bAttemptedPanelCreation = true;
+
+ try
+ {
+ Reference< XConfigurationController > xConfigController( m_pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW );
+ Reference< XResource > xToolPanelResource( xConfigController->getResource( m_xPanelResourceId ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ return m_xPanel.is();
+ }
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
+
diff --git a/sd/source/ui/toolpanel/CustomToolPanel.hxx b/sd/source/ui/toolpanel/CustomToolPanel.hxx
new file mode 100644
index 000000000000..23a3dcbb3cfc
--- /dev/null
+++ b/sd/source/ui/toolpanel/CustomToolPanel.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ * 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_TOOLPANEL_CUSTOMTOOLPANEL_HXX
+#define SD_TOOLPANEL_CUSTOMTOOLPANEL_HXX
+
+#include "TaskPaneToolPanel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/drawing/framework/XPane2.hpp>
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+/** === end UNO includes === **/
+
+#include <boost/shared_ptr.hpp>
+
+namespace utl
+{
+ class OConfigurationNode;
+}
+
+namespace sd { namespace framework
+{
+ class FrameworkHelper;
+} }
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ class ToolPanelDeck;
+
+ //==================================================================================================================
+ //= CustomToolPanel
+ //==================================================================================================================
+ /** is a ::svt::IToolPanel implementation for custom tool panels, i.e. those defined in the configuration, and
+ implemented by external components.
+ */
+ class CustomToolPanel : public TaskPaneToolPanel
+ {
+ public:
+ CustomToolPanel(
+ ToolPanelDeck& i_rPanelDeck,
+ const ::utl::OConfigurationNode& i_rPanelConfig,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPaneResourceId,
+ const ::boost::shared_ptr< framework::FrameworkHelper >& i_pFrameworkHelper
+ );
+ ~CustomToolPanel();
+
+ // IToolPanel overridables
+ virtual void Dispose();
+
+ protected:
+ // TaskPaneToolPanel overridables
+ virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const;
+ virtual ::Window* getPanelWindow() const;
+
+ private:
+ bool impl_ensurePanel() const;
+
+ private:
+ ::boost::shared_ptr< framework::FrameworkHelper > m_pFrameworkHelper;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > m_xPanelResourceId;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XPane2 > m_xPanel;
+ bool m_bAttemptedPanelCreation;
+ };
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
+
+#endif // SD_TOOLPANEL_CUSTOMTOOLPANEL_HXX
diff --git a/sd/source/ui/toolpanel/StandardToolPanel.cxx b/sd/source/ui/toolpanel/StandardToolPanel.cxx
new file mode 100644
index 000000000000..5e4d35ee1729
--- /dev/null
+++ b/sd/source/ui/toolpanel/StandardToolPanel.cxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ * 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 "StandardToolPanel.hxx"
+#include "ToolPanelDeck.hxx"
+#include "sdresid.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ /** === 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::drawing::framework::XResourceId;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= StandardToolPanel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ StandardToolPanel::StandardToolPanel( ToolPanelDeck& i_rPanelDeck, ::std::auto_ptr< ControlFactory >& i_rControlFactory,
+ const USHORT i_nTitleResId, const Image& i_rImage, const ULONG i_nHelpId,
+ const Reference< XResourceId >& i_rPanelResourceId )
+ :TaskPaneToolPanel( i_rPanelDeck, SdResId( i_nTitleResId ), i_rImage, SmartId( i_nHelpId ) )
+ ,m_pControlFactory( i_rControlFactory )
+ ,m_xPanelResourceId( i_rPanelResourceId )
+ {
+ ENSURE_OR_THROW( m_pControlFactory.get(), "illegal control factory" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ StandardToolPanel::~StandardToolPanel()
+ {
+ m_pControl.reset();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void StandardToolPanel::Dispose()
+ {
+ m_pControl.reset();
+ TaskPaneToolPanel::Dispose();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ const Reference< XResourceId >& StandardToolPanel::getResourceId() const
+ {
+ return m_xPanelResourceId;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::Window* StandardToolPanel::getPanelWindow() const
+ {
+ ENSURE_OR_RETURN( const_cast< StandardToolPanel* >( this )->impl_ensureControl(), "StandardToolPanel::getPanelWindow: no control!", NULL );
+ return m_pControl->GetWindow();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool StandardToolPanel::impl_ensureControl()
+ {
+ if ( m_pControl.get() )
+ return true;
+ if ( isDisposed() )
+ return false;
+ m_pControl = m_pControlFactory->CreateRootControl( getPanelDeck() );
+ return ( m_pControl.get() != NULL );
+ }
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
diff --git a/sd/source/ui/toolpanel/StandardToolPanel.hxx b/sd/source/ui/toolpanel/StandardToolPanel.hxx
new file mode 100644
index 000000000000..8e4ad7e8eeea
--- /dev/null
+++ b/sd/source/ui/toolpanel/StandardToolPanel.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SD_TOOLPANEL_STANDARDTOOLPANEL_HXX
+#define SD_TOOLPANEL_STANDARDTOOLPANEL_HXX
+
+#include "TaskPaneToolPanel.hxx"
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= StandardToolPanel
+ //==================================================================================================================
+ /** an IToolPanel implementation for one of the standard (aka built-in) tool panels
+ */
+ class StandardToolPanel : public TaskPaneToolPanel
+ {
+ public:
+ StandardToolPanel(
+ ToolPanelDeck& i_rPanelDeck,
+ ::std::auto_ptr< ControlFactory >& i_rControlFactory,
+ const USHORT i_nTitleResId,
+ const Image& i_rImage,
+ const ULONG i_nHelpId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rPanelResourceId
+ );
+ ~StandardToolPanel();
+
+ // IToolPanel overridables
+ virtual void Dispose();
+
+ // TaskPaneToolPanel overridables
+ virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const;
+ virtual ::Window* getPanelWindow() const;
+
+ private:
+ bool impl_ensureControl();
+
+ private:
+ ::std::auto_ptr< ControlFactory > m_pControlFactory;
+ ::std::auto_ptr< TreeNode > m_pControl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >
+ m_xPanelResourceId;
+ };
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
+
+#endif // SD_TOOLPANEL_STANDARDTOOLPANEL_HXX
diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx
index 3e5a7ba3065f..92530bf9e5bc 100644
--- a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx
+++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx
@@ -28,7 +28,6 @@
#include "TaskPaneToolPanel.hxx"
#include "ToolPanelDeck.hxx"
-#include "sdresid.hxx"
#include <tools/diagnose_ex.h>
#include <vcl/window.hxx>
@@ -57,91 +56,79 @@ 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, const Reference< XResourceId >& i_rPanelResourceId )
+ TaskPaneToolPanel::TaskPaneToolPanel( ToolPanelDeck& i_rPanelDeck, const String& i_rPanelName, const Image& i_rImage,
+ const SmartId& i_rHelpId )
:m_pPanelDeck( &i_rPanelDeck )
- ,m_pControlFactory( i_rControlFactory )
- ,m_pControl()
- ,m_aImage( i_rImage )
- ,m_sTitle( SdResId( i_nTitleResId ) )
- ,m_aHelpId( i_nHelpId )
- ,m_xPanelResourceId( i_rPanelResourceId )
+ ,m_aPanelImage( i_rImage )
+ ,m_sPanelName( i_rPanelName )
+ ,m_aHelpId( i_rHelpId )
{
- ENSURE_OR_THROW( m_pControlFactory.get(), "illegal control factory" );
}
//------------------------------------------------------------------------------------------------------------------
TaskPaneToolPanel::~TaskPaneToolPanel()
{
- m_pControl.reset();
}
//------------------------------------------------------------------------------------------------------------------
::rtl::OUString TaskPaneToolPanel::GetDisplayName() const
{
- return m_sTitle;
+ return m_sPanelName;
}
//------------------------------------------------------------------------------------------------------------------
Image TaskPaneToolPanel::GetImage() const
{
- return m_aImage;
+ return m_aPanelImage;
}
//------------------------------------------------------------------------------------------------------------------
void TaskPaneToolPanel::Show()
{
- ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to show" );
- m_pControl->GetWindow()->Show();
+ Window* pPanelWindow( getPanelWindow() );
+ ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to show" );
+ pPanelWindow->Show();
}
//------------------------------------------------------------------------------------------------------------------
void TaskPaneToolPanel::Hide()
{
- ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to hide" );
- m_pControl->GetWindow()->Hide();
+ Window* pPanelWindow( getPanelWindow() );
+ ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to hide" );
+ pPanelWindow->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() );
+ Window* pPanelWindow( getPanelWindow() );
+ ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to position" );
+ pPanelWindow->SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() );
}
//------------------------------------------------------------------------------------------------------------------
void TaskPaneToolPanel::GrabFocus()
{
- ENSURE_OR_RETURN_VOID( impl_ensureControl(), "no control to focus" );
- m_pControl->GetWindow()->GrabFocus();
+ Window* pPanelWindow( getPanelWindow() );
+ ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to focus" );
+ pPanelWindow->GrabFocus();
}
//------------------------------------------------------------------------------------------------------------------
bool TaskPaneToolPanel::HasFocus() const
{
- ENSURE_OR_RETURN_FALSE( const_cast< TaskPaneToolPanel* >( this )->impl_ensureControl(), "no control to ask" );
- return m_pControl->GetWindow()->HasChildPathFocus();
+ Window* pPanelWindow( getPanelWindow() );
+ ENSURE_OR_RETURN_FALSE( pPanelWindow, "no window to ask" );
+ return pPanelWindow->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
index 0ff352f58abb..8fad423d1c79 100644
--- a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx
+++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx
@@ -52,17 +52,16 @@ namespace sd { namespace toolpanel
//==================================================================================================================
class TaskPaneToolPanel : public ::svt::ToolPanelBase
{
- public:
+ protected:
TaskPaneToolPanel(
ToolPanelDeck& i_rPanelDeck,
- ::std::auto_ptr< ControlFactory >& i_rControlFactory,
+ const String& i_rPanelName,
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_rPanelResourceId
+ const SmartId& i_rHelpId
);
~TaskPaneToolPanel();
+ public:
// IToolPanel overridables
virtual ::rtl::OUString GetDisplayName() const;
virtual Image GetImage() const;
@@ -73,22 +72,19 @@ namespace sd { namespace toolpanel
virtual bool HasFocus() const;
virtual void Dispose();
- // own attributes
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >&
- getResourceId() const { return m_xPanelResourceId; }
+ // own overridables
+ virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const = 0;
+ virtual ::Window* getPanelWindow() const = 0;
- private:
- bool impl_ensureControl();
+ protected:
+ bool isDisposed() const { return m_pPanelDeck == NULL; }
+ ToolPanelDeck& getPanelDeck() { OSL_ENSURE( !isDisposed(), "already disposed!" ); return *m_pPanelDeck; }
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;
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >
- m_xPanelResourceId;
+ ToolPanelDeck* m_pPanelDeck;
+ const Image m_aPanelImage;
+ const String m_sPanelName;
+ const SmartId m_aHelpId;
};
//......................................................................................................................
diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx
index 0b93e7178e18..25d8bb45c012 100644
--- a/sd/source/ui/toolpanel/ToolPanelDeck.cxx
+++ b/sd/source/ui/toolpanel/ToolPanelDeck.cxx
@@ -112,20 +112,6 @@ namespace sd { namespace toolpanel
}
//------------------------------------------------------------------------------------------------------------------
- size_t ToolPanelDeck::CreateAndInsertPanel( ::std::auto_ptr< ControlFactory >& i_rControlFactory,
- const Image& i_rImage, const USHORT i_nTitleResId, const ULONG i_nHelpId, const Reference< XResourceId >& i_rPanelResourceId )
- {
- // create panel
- ::svt::PToolPanel pNewPanel( new TaskPaneToolPanel(
- *this, i_rControlFactory,
- i_rImage, i_nTitleResId, i_nHelpId,
- i_rPanelResourceId
- ) );
- // insert as new panel
- return InsertPanel( pNewPanel, GetPanelCount() );
- }
-
- //------------------------------------------------------------------------------------------------------------------
void ToolPanelDeck::ActivatePanelDirectly( const ::boost::optional< size_t >& i_rPanel )
{
ToolPanelDeck_Base::ActivatePanel( i_rPanel );
diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.hxx b/sd/source/ui/toolpanel/ToolPanelDeck.hxx
index a9dc1a239144..e140d9577220 100644
--- a/sd/source/ui/toolpanel/ToolPanelDeck.hxx
+++ b/sd/source/ui/toolpanel/ToolPanelDeck.hxx
@@ -58,15 +58,6 @@ namespace sd { namespace toolpanel
);
~ToolPanelDeck();
- // panel maintenance
- size_t CreateAndInsertPanel(
- ::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_rPanelResourceId
- );
-
/** activates a layout where the active panel is selected via tabs at the right/left/top/bottom (depending on
the given TabAlignment value).
*/
diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx
index 151fd4350790..c071e5e611c1 100644
--- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx
+++ b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx
@@ -132,6 +132,7 @@ namespace sd { namespace toolpanel
pTitleBar->GetWindow()->Show();
pTitleBar->GetWindow()->AddEventListener( LINK( this, ToolPanelDrawer, OnWindowEvent ) );
m_aDrawers.insert( m_aDrawers.begin() + i_nPosition, pTitleBar );
+ impl_triggerRearrange();
}
//------------------------------------------------------------------------------------------------------------------
diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
index 0da1da192ce1..276cc5a83fec 100644
--- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
+++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
@@ -31,6 +31,8 @@
#include "TaskPaneShellManager.hxx"
#include "TaskPaneFocusManager.hxx"
+#include "StandardToolPanel.hxx"
+#include "CustomToolPanel.hxx"
#include "controls/MasterPagesPanel.hxx"
#include "LayoutMenu.hxx"
#include "controls/TableDesignPanel.hxx"
@@ -74,6 +76,9 @@
#include <vcl/svapp.hxx>
#include <vcl/toolbox.hxx>
#include <tools/diagnose_ex.h>
+#include <unotools/confignode.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
#include <vector>
@@ -183,7 +188,7 @@ public:
*/
size_t GetPanelCount() const
{
- return size_t( PID__END );
+ return m_aPanels.size();
}
const PanelDescriptor& GetPanel( const size_t i_nLogicalPanelIndex ) const
@@ -214,11 +219,20 @@ private:
void RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel );
void UpdateDockingWindowTitle();
+ /** creates the built-in panels, returns the position of the panel to activate initially
+ */
+ size_t SetupDefaultPanels();
+
+ /** creates the custom panels
+ */
+ void SetupCustomPanels();
+
typedef ::std::vector< PanelDescriptor > PanelDescriptors;
- PanelDescriptors m_aPanels;
- ToolPanelViewShell& m_rPanelViewShell;
- ::boost::scoped_ptr< ToolPanelDeck > m_pPanelDeck;
- PanelSelectorLayout m_eCurrentLayout;
+ PanelDescriptors m_aPanels;
+ ToolPanelViewShell& m_rPanelViewShell;
+ ::boost::scoped_ptr< ToolPanelDeck > m_pPanelDeck;
+ PanelSelectorLayout m_eCurrentLayout;
+ bool m_bInitialized;
};
// =====================================================================================================================
@@ -249,7 +263,7 @@ SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL))
TYPEINIT1(ToolPanelViewShell, ViewShell);
// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::Implementation::Setup()
+size_t ToolPanelViewShell::Implementation::SetupDefaultPanels()
{
typedef std::auto_ptr<ControlFactory> (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell );
@@ -263,7 +277,8 @@ void ToolPanelViewShell::Implementation::Setup()
::rtl::OUString sResourceURL;
};
- PanelDescriptor aPanels[] = {
+ PanelDescriptor aPanels[] =
+ {
// "Master Pages"
{ &controls::MasterPagesPanel::CreateControlFactory,
"PresentationLayout",
@@ -329,21 +344,70 @@ void ToolPanelViewShell::Implementation::Setup()
const Reference< XResourceId > xPanelId( pFrameworkHelper->CreateResourceId( aPanels[i].sResourceURL, xToolPanelId ) );
// create and insert the panel
- size_t nPanelPos = m_pPanelDeck->CreateAndInsertPanel(
+ ::svt::PToolPanel pNewPanel( new StandardToolPanel(
+ *m_pPanelDeck,
(*aPanels[i].pFactory)( m_rPanelViewShell ),
- aPanelImage,
aPanels[i].nTitleResourceID,
+ aPanelImage,
aPanels[i].nHelpID,
xPanelId
- );
+ ) );
+ const size_t nPanelPos = m_pPanelDeck->InsertPanel( pNewPanel, m_pPanelDeck->GetPanelCount() );
// remember it
- RegisterPanel( nPanelPos, aPanels[i].nPanelID, m_pPanelDeck->GetPanel( nPanelPos ) );
+ RegisterPanel( nPanelPos, aPanels[i].nPanelID, pNewPanel );
if ( nPanelIdToActivate == aPanels[i].nPanelID )
nPanelPosToActivate = nPanelPos;
}
+ return nPanelPosToActivate;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell::Implementation::SetupCustomPanels()
+{
+ // compose the resource ID for the ToolPanel view
+ ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) );
+ const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) );
+
+ // get the config node holding the custom tool panel descriptions
+ ::utl::OConfigurationTreeRoot aConfig( ::comphelper::ComponentContext( ::comphelper::getProcessServiceFactory() ),
+ "/org.openoffice.Office.Impress/MultiPaneGUI/ToolPanel/CustomPanels", false );
+ const Sequence< ::rtl::OUString > aCustomPanelDescs( aConfig.getNodeNames() );
+
+ // create panels
+ size_t nCustomPanelNo = 0;
+ for ( const ::rtl::OUString* panelNodeName = aCustomPanelDescs.getConstArray();
+ panelNodeName != aCustomPanelDescs.getConstArray() + aCustomPanelDescs.getLength();
+ ++panelNodeName
+ )
+ {
+ ::utl::OConfigurationNode aPanelDesc( aConfig.openNode( *panelNodeName ) );
+
+ // create and insert the panel
+ ::svt::PToolPanel pNewPanel( new CustomToolPanel( *m_pPanelDeck, aPanelDesc, xToolPanelId, pFrameworkHelper ) );
+ const size_t nPanelPos = m_pPanelDeck->InsertPanel( pNewPanel, m_pPanelDeck->GetPanelCount() );
+
+ // remember it
+ RegisterPanel( nPanelPos, PanelId( PID_FIRST_CUSTOM_PANEL + nCustomPanelNo ), pNewPanel );
+ ++nCustomPanelNo;
+ }
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell::Implementation::Setup()
+{
+ if ( m_bInitialized )
+ return;
+ m_bInitialized = true;
+
+ // standard (built-in) panels
+ const size_t nPanelPosToActivate = SetupDefaultPanels();
+
+ // custom panels
+ SetupCustomPanels();
+
// activate default panel
m_pPanelDeck->ActivatePanelResource( nPanelPosToActivate );
@@ -387,18 +451,27 @@ void ToolPanelViewShell::Implementation::SetLayout( const PanelSelectorLayout i_
// ---------------------------------------------------------------------------------------------------------------------
void ToolPanelViewShell::Implementation::Cleanup()
{
- m_pPanelDeck->RemoveListener( *this );
+ if ( !m_bInitialized )
+ {
+ m_pPanelDeck->RemoveListener( *this );
+ // remove the panels which are not under the control of the panel deck currently
+ for ( PanelDescriptors::iterator panelPos = m_aPanels.begin();
+ panelPos != m_aPanels.end();
+ ++panelPos
+ )
+ {
+ if ( panelPos->bHidden )
+ panelPos->pPanel->Dispose();
+ }
+ m_aPanels.clear();
+ }
m_pPanelDeck.reset();
}
// ---------------------------------------------------------------------------------------------------------------------
void ToolPanelViewShell::Initialize()
{
- if ( !mbIsInitialized )
- {
- mbIsInitialized = true;
- mpImpl->Setup();
- }
+ mpImpl->Setup();
}
// ---------------------------------------------------------------------------------------------------------------------
@@ -406,7 +479,6 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi
FrameView* pFrameViewArgument )
:ViewShell(pFrame, pParentWindow, rViewShellBase)
,mpImpl( new Implementation( *this, *mpContentWindow.get() ) )
- ,mbIsInitialized(false)
,mpSubShellManager()
,mnMenuId(0)
{
@@ -462,10 +534,7 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi
// ---------------------------------------------------------------------------------------------------------------------
ToolPanelViewShell::~ToolPanelViewShell()
{
- if ( mbIsInitialized )
- {
- mpImpl->Cleanup();
- }
+ mpImpl->Cleanup();
// reset our impl before destroying the panel deck, to ensure the hidden panels are properly
// disposed/destroyed, too
@@ -800,10 +869,11 @@ void ToolPanelViewShell::ActivatePanel( const PanelId i_ePanelId )
// =====================================================================================================================
// ---------------------------------------------------------------------------------------------------------------------
ToolPanelViewShell::Implementation::Implementation( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent )
- :m_aPanels( PanelDescriptors::size_type( PID__END ) )
+ :m_aPanels()
,m_rPanelViewShell( i_rPanelViewShell )
,m_pPanelDeck( new ToolPanelDeck( i_rPanelDeckParent, i_rPanelViewShell ) )
,m_eCurrentLayout( LAYOUT_DRAWERS )
+ ,m_bInitialized( false )
{
}
@@ -875,6 +945,9 @@ void ToolPanelViewShell::Implementation::ActivatePanelDirectly( const PanelId i_
// ---------------------------------------------------------------------------------------------------------------------
void ToolPanelViewShell::Implementation::RegisterPanel( size_t i_nPosition, PanelId i_nPanelId, const ::svt::PToolPanel& i_rPanel )
{
+ if ( i_nPosition >= m_aPanels.size() )
+ m_aPanels.resize( i_nPosition + 1 );
+
OSL_PRECOND( m_aPanels[ i_nPosition ].nId == PID_UNKNOWN, "ToolPanelViewShell::Implementation::RegisterPanel: "
"already registered a panel for this ID!" );
m_aPanels[ i_nPosition ] = PanelDescriptor( i_nPanelId, i_rPanel );
diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk
index d364b74ea062..837ffb710499 100644
--- a/sd/source/ui/toolpanel/makefile.mk
+++ b/sd/source/ui/toolpanel/makefile.mk
@@ -62,6 +62,8 @@ SLOFILES = \
$(SLO)$/ToolPanelDeck.obj \
$(SLO)$/ToolPanelDrawer.obj \
$(SLO)$/TaskPaneToolPanel.obj \
+ $(SLO)$/CustomToolPanel.obj \
+ $(SLO)$/StandardToolPanel.obj \
\
$(SLO)$/EmptyWindow.obj \
$(SLO)$/LayoutMenu.obj \