summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-18 15:25:13 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-18 15:25:13 +0100
commitcd3ef5819cb644515289776b8872970218c0ac65 (patch)
tree6e7d64011974579995f1d0a52e78edba94fb256e /sd
parent32feee91361deef53c3077f2baf941f37e7302d5 (diff)
slidecopy: initial implementation for custom tool panels
The idea is to allow third-party components to plug additional tool panels into the task pane, by using the drawing framework (http://wiki.services.openoffice.org/wiki/Drawing_framework). This first step is not finished at all, it just adds a configuration scheme/data for such custom tool panels, and implements basic functionality in the ToolPanelDeck to respect this config data. Additionally, the first version of an example extension for a custom tool panel is implemented in sd/workben/custompanel. Still, except showing a drawer in the tool panel deck, representing the custom panel, nothing works. More to come :)
Diffstat (limited to 'sd')
-rw-r--r--[-rwxr-xr-x]sd/prj/build.lst1
-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
-rw-r--r--sd/workben/custompanel/Impress.xcu34
-rw-r--r--sd/workben/custompanel/colorpanel.map8
-rw-r--r--sd/workben/custompanel/ctp_factory.cxx187
-rw-r--r--sd/workben/custompanel/ctp_factory.hxx114
-rw-r--r--sd/workben/custompanel/ctp_panel.cxx90
-rw-r--r--sd/workben/custompanel/ctp_panel.hxx79
-rw-r--r--sd/workben/custompanel/ctp_services.cxx92
-rw-r--r--sd/workben/custompanel/delzip0
-rw-r--r--sd/workben/custompanel/description.xml16
-rw-r--r--sd/workben/custompanel/makefile.mk102
-rw-r--r--sd/workben/custompanel/manifest.xml8
25 files changed, 1340 insertions, 109 deletions
diff --git a/sd/prj/build.lst b/sd/prj/build.lst
index bc8bf923f7e5..1b565ac71fb0 100755..100644
--- a/sd/prj/build.lst
+++ b/sd/prj/build.lst
@@ -44,3 +44,4 @@ sd sd\source\ui\framework\factories nmake - all sd_framework_factories sd
sd sd\source\ui\framework\tools nmake - all sd_framework_tools sd_inc NULL
sd sd\source\ui\annotations nmake - all sd_uiannotations sd_inc NULL
sd sd\util nmake - all sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_filt sd_func sd_grf sd_unid sd_view sd_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories sd_text sd_annotations sd_uiannotations NULL
+sd sd\workben\custompanel nmake - all sd_workben_panel sd_inc NULL
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 \
diff --git a/sd/workben/custompanel/Impress.xcu b/sd/workben/custompanel/Impress.xcu
new file mode 100644
index 000000000000..1c7bb5f6b102
--- /dev/null
+++ b/sd/workben/custompanel/Impress.xcu
@@ -0,0 +1,34 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE oor:component-data SYSTEM "../../../../component-update.dtd">
+<oor:component-data oor:name="Impress" oor:package="org.openoffice.Office" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <node oor:name="MultiPaneGUI">
+ <node oor:name="ToolPanel">
+ <node oor:name="CustomPanels">
+ <node oor:name="org.openoffice.example.colorpanel.SingleColorPanel" oor:op="replace">
+ <prop oor:name="ResourceURL" oor:type="xs:string">
+ <value>private:resource/view/SingleColorView</value>
+ </prop>
+ <prop oor:name="DisplayTitle" oor:type="xs:string">
+ <value>Single Color Panel</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="Framework">
+ <node oor:name="ResourceFactories">
+ <node oor:name="org.openoffice.example.colorpanel.1" oor:op="replace">
+ <prop oor:name="ServiceName">
+ <value>org.openoffice.example.colorpanel.ResourceFactory</value>
+ </prop>
+ <node oor:name="ResourceList">
+ <node oor:name="SingleColorView" oor:op="replace">
+ <prop oor:name="URL">
+ <value>private:resource/view/SingleColorView</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/sd/workben/custompanel/colorpanel.map b/sd/workben/custompanel/colorpanel.map
new file mode 100644
index 000000000000..f4ed78b9e970
--- /dev/null
+++ b/sd/workben/custompanel/colorpanel.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ local:
+ *;
+};
diff --git a/sd/workben/custompanel/ctp_factory.cxx b/sd/workben/custompanel/ctp_factory.cxx
new file mode 100644
index 000000000000..573c68ebfecb
--- /dev/null
+++ b/sd/workben/custompanel/ctp_factory.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ * 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 "ctp_factory.hxx"
+#include "ctp_panel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/NotInitializedException.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/drawing/framework/XResourceFactoryManager.hpp>
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ /** === 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::uno::XComponentContext;
+ using ::com::sun::star::drawing::framework::XResourceId;
+ using ::com::sun::star::drawing::framework::XResource;
+ using ::com::sun::star::lang::NotInitializedException;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::drawing::framework::XResourceFactoryManager;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ const ::rtl::OUString& lcl_getSingleColorViewURL()
+ {
+ static ::rtl::OUString s_sSingleColorViewURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/view/SingleColorView" ) );
+ return s_sSingleColorViewURL;
+ }
+ }
+
+ //==================================================================================================================
+ //= ResourceFactory
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ResourceFactory::ResourceFactory( const Reference< XComponentContext >& i_rContext )
+ :m_xContext( i_rContext )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ResourceFactory::~ResourceFactory()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XResource > SAL_CALL ResourceFactory::createResource( const Reference< XResourceId >& i_rResourceId ) throw (RuntimeException)
+ {
+ FactoryGuard aGuard( *this );
+ if ( !i_rResourceId.is() )
+ // TODO: the API should allow me to throw an IllegalArgumentException here
+ throw NULL;
+
+ const ::rtl::OUString sResourceURL( i_rResourceId->getResourceURL() );
+ if ( sResourceURL != lcl_getSingleColorViewURL() )
+ return NULL;
+
+ return new SingleColorPanel( m_xContext, m_xControllerManager->getConfigurationController(), i_rResourceId );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL ResourceFactory::releaseResource( const Reference< XResource >& i_rResource ) throw (RuntimeException)
+ {
+ FactoryGuard aGuard( *this );
+ // TODO: place your code here
+ (void)i_rResource;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ResourceFactory::getImplementationName( ) throw (RuntimeException)
+ {
+ return getImplementationName_static();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ResourceFactory::getImplementationName_static( ) throw (RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.example.colorpanel.ResourceFactory" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL ResourceFactory::supportsService( const ::rtl::OUString& i_rServiceName ) throw (RuntimeException)
+ {
+ const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() );
+ for ( const ::rtl::OUString* serviceName = aServiceNames.getConstArray();
+ serviceName != aServiceNames.getConstArray() + aServiceNames.getLength();
+ ++serviceName
+ )
+ {
+ if ( i_rServiceName == *serviceName )
+ return sal_True;
+ }
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL ResourceFactory::getSupportedServiceNames() throw (RuntimeException)
+ {
+ return getSupportedServiceNames_static();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL ResourceFactory::getSupportedServiceNames_static() throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServiceNames(1);
+ aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.example.colorpanel.ResourceFactory" ) );
+ return aServiceNames;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL ResourceFactory::Create( const Reference< XComponentContext >& i_rContext ) throw (RuntimeException)
+ {
+ return *( new ResourceFactory( i_rContext ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ResourceFactory::checkInitialized( GuardAccess ) const
+ {
+ if ( !m_xControllerManager.is() )
+ throw NotInitializedException( ::rtl::OUString(), *const_cast< ResourceFactory* >( this ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ResourceFactory::checkDisposed( GuardAccess ) const
+ {
+ // cannot be disposed currently ...
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL ResourceFactory::initialize( const Sequence< Any >& i_rArguments ) throw (Exception, RuntimeException)
+ {
+ if ( !i_rArguments.getLength() )
+ throw IllegalArgumentException();
+
+ FactoryGuard aGuard( *this, false );
+ m_xControllerManager.set( i_rArguments[0], UNO_QUERY_THROW );
+
+ Reference< XResourceFactoryManager > xFactoryManager( m_xControllerManager->getConfigurationController(), UNO_QUERY_THROW );
+ xFactoryManager->addResourceFactory( lcl_getSingleColorViewURL(), this );
+ }
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
diff --git a/sd/workben/custompanel/ctp_factory.hxx b/sd/workben/custompanel/ctp_factory.hxx
new file mode 100644
index 000000000000..8f9ff523f5ec
--- /dev/null
+++ b/sd/workben/custompanel/ctp_factory.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ * 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_WORKBENCH_CTP_FACTORY_HXX
+#define SD_WORKBENCH_CTP_FACTORY_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ class FactoryGuard;
+
+ //==================================================================================================================
+ //= ResourceFactory
+ //==================================================================================================================
+ typedef ::cppu::WeakImplHelper3 < ::com::sun::star::drawing::framework::XResourceFactory
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XInitialization
+ > ResourceFactory_Base;
+ class ResourceFactory :public ::cppu::BaseMutex
+ ,public ResourceFactory_Base
+ {
+ public:
+ ResourceFactory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext
+ );
+ ~ResourceFactory();
+
+ // XResourceFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource > SAL_CALL createResource( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& xResourceId ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL releaseResource( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResource >& xResource ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo - static versions
+ static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ public:
+ struct GuardAccess { friend class FactoryGuard; private: GuardAccess() { } };
+
+ void checkInitialized( GuardAccess ) const;
+ void checkDisposed( GuardAccess ) const;
+ ::osl::Mutex& getMutex( GuardAccess ) { return m_aMutex; }
+
+ private:
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XControllerManager >
+ m_xControllerManager;
+ };
+
+ class FactoryGuard
+ {
+ public:
+ FactoryGuard( ResourceFactory& i_rFactory, const bool i_bNeedInit = true )
+ :m_aGuard( i_rFactory.getMutex( ResourceFactory::GuardAccess() ) )
+ {
+ i_rFactory.checkDisposed( ResourceFactory::GuardAccess() );
+ if ( i_bNeedInit )
+ i_rFactory.checkInitialized( ResourceFactory::GuardAccess() );
+ }
+
+ protected:
+ ::osl::MutexGuard m_aGuard;
+ };
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
+
+#endif // SD_WORKBENCH_CTP_FACTORY_HXX
diff --git a/sd/workben/custompanel/ctp_panel.cxx b/sd/workben/custompanel/ctp_panel.cxx
new file mode 100644
index 000000000000..dbbbb8c6f273
--- /dev/null
+++ b/sd/workben/custompanel/ctp_panel.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ * 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 "ctp_panel.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ /** === 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::uno::XComponentContext;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= class SingleColorPanel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext,
+ const Reference< XConfigurationController >& i_rConfigController, const Reference< XResourceId >& i_rResourceId )
+ :m_xContext( i_rContext )
+ ,m_xResourceId( i_rResourceId )
+ {
+ // TODO: retrieve the resource object for the anchor, ask it for its XPane interface, retrieve the window
+ // associated with it, create our own window as child of the pane's window
+ (void)i_rConfigController;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SingleColorPanel::~SingleColorPanel()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XResourceId > SAL_CALL SingleColorPanel::getResourceId( ) throw (RuntimeException)
+ {
+ return m_xResourceId;
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Bool SAL_CALL SingleColorPanel::isAnchorOnly( ) throw (RuntimeException)
+ {
+ return sal_False;
+ }
+
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
diff --git a/sd/workben/custompanel/ctp_panel.hxx b/sd/workben/custompanel/ctp_panel.hxx
new file mode 100644
index 000000000000..c7ecb7c19795
--- /dev/null
+++ b/sd/workben/custompanel/ctp_panel.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ * 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_WORKBENCH_CTP_PANEL_HXX
+#define SD_WORKBENCH_CTP_PANEL_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/drawing/framework/XView.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= class SingleColorPanel
+ //==================================================================================================================
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::drawing::framework::XView
+ > SingleColorPanel_Base;
+ class SingleColorPanel :public ::cppu::BaseMutex
+ ,public SingleColorPanel_Base
+ {
+ public:
+ SingleColorPanel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XConfigurationController >& i_rConfigController,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& i_rResourceId
+ );
+
+ // XView
+ // (no methods)
+
+ // XResource
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > SAL_CALL getResourceId( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isAnchorOnly( ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ ~SingleColorPanel();
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > m_xResourceId;
+ };
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
+
+#endif // SD_WORKBENCH_CTP_PANEL_HXX
diff --git a/sd/workben/custompanel/ctp_services.cxx b/sd/workben/custompanel/ctp_services.cxx
new file mode 100644
index 000000000000..67fd5af14c7b
--- /dev/null
+++ b/sd/workben/custompanel/ctp_services.cxx
@@ -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.
+ *
+************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ctp_factory.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <cppuhelper/implementationentry.hxx>
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ /** === 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;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= descriptors for the services implemented in this component
+ //==================================================================================================================
+ static struct ::cppu::ImplementationEntry s_aServiceEntries[] =
+ {
+ {
+ ResourceFactory::Create,
+ ResourceFactory::getImplementationName_static,
+ ResourceFactory::getSupportedServiceNames_static,
+ ::cppu::createSingleComponentFactory, NULL, 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+ };
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
+
+extern "C"
+{
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
+ {
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey )
+ {
+ return ::cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, ::sd::colortoolpanel::s_aServiceEntries );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+ {
+ return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , ::sd::colortoolpanel::s_aServiceEntries );
+ }
+}
diff --git a/sd/workben/custompanel/delzip b/sd/workben/custompanel/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/sd/workben/custompanel/delzip
diff --git a/sd/workben/custompanel/description.xml b/sd/workben/custompanel/description.xml
new file mode 100644
index 000000000000..a1dbdf4f125d
--- /dev/null
+++ b/sd/workben/custompanel/description.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description
+ xmlns="http://openoffice.org/extensions/description/2006"
+ xmlns:d="http://openoffice.org/extensions/description/2006"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <identifier value="UPDATED_IDENTIFIER"/>
+ <version value="0.1" />
+ <platform value="UPDATED_SUPPORTED_PLATFORM" />
+ <display-name>
+ <name lang="en-US">Custom Tool Panel Example</name>
+ </display-name>
+ <dependencies>
+ <OpenOffice.org-minimal-version value="3.2" d:name="OpenOffice.org 3.2"/>
+ </dependencies>
+</description>
diff --git a/sd/workben/custompanel/makefile.mk b/sd/workben/custompanel/makefile.mk
new file mode 100644
index 000000000000..7703b7163fa3
--- /dev/null
+++ b/sd/workben/custompanel/makefile.mk
@@ -0,0 +1,102 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=../..
+PRJNAME=sd
+
+TARGET=colorpanel
+ENABLE_EXCEPTIONS=TRUE
+LIBTARGET=NO
+EXTENSIONNAME:=colored-tool-panel
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+#-------------------------------------------------------------------
+
+#---- extension version
+EXTENSION_VERSION_BASE=0.1
+.IF ( "$(CWS_WORK_STAMP)" == "" ) || ( "$(UPDATER)" == "YES" )
+ EXTENSION_VERSION=$(EXTENSION_VERSION_BASE)
+.ELSE
+ EXTENSION_VERSION=$(EXTENSION_VERSION_BASE).cws.$(CWS_WORK_STAMP)
+.ENDIF
+
+#---- extension title package name
+EXTENSION_TITLE=Custom Tool Panel Example
+EXTENSION_ZIPNAME=$(EXTENSIONNAME)-$(EXTENSION_VERSION_BASE)-$(RTL_OS:l)-$(RTL_ARCH:l)
+
+#--------------------------------------------------
+
+SHL1DLLPRE=
+SHL1TARGET=$(TARGET).uno
+LIB1TARGET=$(SLB)/$(SHL1TARGET).lib
+LIB1OBJFILES= \
+ $(SLO)/ctp_factory.obj \
+ $(SLO)/ctp_services.obj \
+ $(SLO)/ctp_panel.obj
+
+SHL1STDLIBS= \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(SALHELPERLIB) \
+ $(CPPUHELPERLIB)
+
+SHL1VERSIONMAP=$(TARGET).map
+SHL1LIBS= $(LIB1TARGET)
+SHL1DEF= $(MISC)/$(SHL1TARGET).def
+SHL1RPATH= OXT
+DEF1NAME= $(SHL1TARGET)
+
+# create Extension -----------------------------
+
+COMPONENT_CONFIGDEST=.
+
+COMPONENT_XCU = \
+ $(EXTENSIONDIR)/Impress.xcu
+
+COMPONENT_LIBRARIES = \
+ $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST)
+
+# ........ dependencies for packaging the extension ........
+EXTENSION_PACKDEPS=makefile.mk
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : extension_pre.mk
+.INCLUDE : target.mk
+.INCLUDE : extension_post.mk
+
+# xcu files: copy
+
+#$(COMPONENT_XCU) : ./Impress.xcu
+# @-$(MKDIRHIER) $(@:d)
+# $(COPY) $< $@
+
+#$(COMPONENT_LIBRARY) : $(BIN)/$(SHL1TARGET)$(DLLPOST)
+# @@-$(MKDIRHIER) $(@:d)
+# @$(COPY) $< $@
diff --git a/sd/workben/custompanel/manifest.xml b/sd/workben/custompanel/manifest.xml
new file mode 100644
index 000000000000..96f62afe4e27
--- /dev/null
+++ b/sd/workben/custompanel/manifest.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
+<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=native"
+ manifest:full-path="colorpanel.unoSHARED_EXTENSION"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="Impress.xcu"/>
+</manifest:manifest>