summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-04-13 12:17:53 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-04-13 12:17:53 +0200
commit0c5e350b2ae8c46a24407cf122114e58852fb072 (patch)
tree9e004bb920b3a8d51b1d1419c99e527d5c6d091d
parentc08e0f6a88407fac29857a71314f0a704fa7c393 (diff)
slidecopy: moved SD's task pane implementation to the new base implementation from SFX.
Still not all previous functionality restored.
-rw-r--r--sd/source/ui/framework/factories/TaskPanelFactory.cxx5
-rw-r--r--sd/source/ui/framework/factories/ViewShellWrapper.cxx90
-rw-r--r--sd/source/ui/framework/tools/FrameworkHelper.cxx2
-rw-r--r--sd/source/ui/inc/framework/ViewShellWrapper.hxx33
-rw-r--r--sd/source/ui/inc/taskpane/PanelId.hxx5
-rw-r--r--sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx26
-rw-r--r--sd/source/ui/toolpanel/CustomToolPanel.cxx290
-rw-r--r--sd/source/ui/toolpanel/CustomToolPanel.hxx113
-rw-r--r--sd/source/ui/toolpanel/MethodGuard.hxx67
-rw-r--r--sd/source/ui/toolpanel/StandardToolPanel.cxx163
-rw-r--r--sd/source/ui/toolpanel/ToolPanel.cxx (renamed from sd/source/ui/toolpanel/TaskPaneToolPanel.cxx)58
-rw-r--r--sd/source/ui/toolpanel/ToolPanel.hxx (renamed from sd/source/ui/toolpanel/TaskPaneToolPanel.hxx)69
-rwxr-xr-xsd/source/ui/toolpanel/ToolPanelDeck.cxx160
-rw-r--r--sd/source/ui/toolpanel/ToolPanelDeck.hxx97
-rw-r--r--sd/source/ui/toolpanel/ToolPanelFactory.cxx255
-rw-r--r--sd/source/ui/toolpanel/ToolPanelUIElement.cxx134
-rw-r--r--sd/source/ui/toolpanel/ToolPanelUIElement.hxx (renamed from sd/source/ui/toolpanel/StandardToolPanel.hxx)75
-rwxr-xr-xsd/source/ui/toolpanel/ToolPanelViewShell.cxx637
-rw-r--r--sd/source/ui/toolpanel/makefile.mk7
-rw-r--r--sd/source/ui/unoidl/facreg.cxx25
-rw-r--r--sd/source/ui/view/drvwshrg.cxx1
21 files changed, 862 insertions, 1450 deletions
diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx
index 89bb417fde25..9892fe4e61f5 100644
--- a/sd/source/ui/framework/factories/TaskPanelFactory.cxx
+++ b/sd/source/ui/framework/factories/TaskPanelFactory.cxx
@@ -263,14 +263,15 @@ void SAL_CALL TaskPanelFactory::releaseResource (
const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) );
if ( pPaneViewShell != NULL )
{
- toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( xResourceId->getResourceURL() ) );
+ const ::rtl::OUString sPanelResourceURL( xResourceId->getResourceURL() );
+ const toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sPanelResourceURL ) );
toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() );
if ( ( ePanelId != toolpanel::PID_UNKNOWN )
&& ( pToolPanel != NULL )
)
{
- pToolPanel->DeactivatePanel( ePanelId );
+ pToolPanel->DeactivatePanel( sPanelResourceURL );
}
else
{
diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx
index e2fa7ff570e6..30136e590004 100644
--- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx
+++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx
@@ -69,8 +69,7 @@ ViewShellWrapper::ViewShellWrapper (
: ViewShellWrapperInterfaceBase(MutexOwner::maMutex),
mpViewShell(pViewShell),
mxViewId(rxViewId),
- mxWindow(rxWindow),
- mbIsPane( pViewShell == NULL ? false : ( pViewShell->GetShellType() == ViewShell::ST_TASK_PANE ) )
+ mxWindow(rxWindow)
{
if (rxWindow.is())
{
@@ -118,93 +117,6 @@ void SAL_CALL ViewShellWrapper::disposing (void)
-//----- XInterface ------------------------------------------------------------
-
-Any SAL_CALL ViewShellWrapper::queryInterface( const Type& i_rType ) throw (RuntimeException)
-{
- Any aInterface( ViewShellWrapperInterfaceBase::queryInterface( i_rType ) );
- if ( !aInterface.hasValue() )
- {
- if ( mbIsPane )
- aInterface = ViewShellWrapper_PaneBase::queryInterface( i_rType );
- else
- aInterface = ViewShellWrapper_ViewBase::queryInterface( i_rType );
- }
- return aInterface;
-}
-
-void SAL_CALL ViewShellWrapper::acquire() throw ()
-{
- ViewShellWrapperInterfaceBase::acquire();
-}
-
-void SAL_CALL ViewShellWrapper::release() throw ()
-{
- ViewShellWrapperInterfaceBase::release();
-}
-
-//----- XTypeProvider ---------------------------------------------------------
-
-Sequence< Type > SAL_CALL ViewShellWrapper::getTypes( ) throw (RuntimeException)
-{
- const Sequence< Type > aCommonTypes( ViewShellWrapperInterfaceBase::getTypes() );
- const Sequence< Type > aSpecialTypes(
- mbIsPane
- ? ViewShellWrapper_PaneBase::getTypes()
- : ViewShellWrapper_ViewBase::getTypes()
- );
- return ::comphelper::concatSequences( aCommonTypes, aSpecialTypes );
-}
-
-Sequence< ::sal_Int8 > SAL_CALL ViewShellWrapper::getImplementationId( ) throw (RuntimeException)
-{
- static ::cppu::OImplementationId* pViewId = NULL;
- static ::cppu::OImplementationId* pPaneId = NULL;
- if ( !pViewId )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !pViewId )
- {
- static ::cppu::OImplementationId aViewId;
- static ::cppu::OImplementationId aPaneId;
- pViewId = &aViewId;
- pPaneId = &aPaneId;
- }
- }
-
- return ( mbIsPane ? pPaneId : pViewId )->getImplementationId();
-}
-
-//----- XPane -----------------------------------------------------------------
-
-Reference< XInterface > ViewShellWrapper::impl_getPaneWindowOrCanvas( const bool i_bWindow )
-{
- ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::MutexGuard aGuard( maMutex );
- if ( !mpViewShell.get() )
- throw DisposedException( ::rtl::OUString(), *this );
-
- ToolPanelViewShell* pToolPanelShell = dynamic_cast< ToolPanelViewShell* >( mpViewShell.get() );
- ENSURE_OR_RETURN( pToolPanelShell != NULL, "XPane should be accessible for a ToolPanelViewShell only", NULL );
-
- ::Window* pPaneWindow = pToolPanelShell->GetToolPanelParentWindow();
- ENSURE_OR_RETURN( pPaneWindow, "shell is not able to provide a panel parent", NULL );
-
- if ( i_bWindow )
- return VCLUnoHelper::GetInterface( pPaneWindow );
- return pPaneWindow->GetCanvas();
-}
-
-Reference< XWindow > SAL_CALL ViewShellWrapper::getWindow() throw (RuntimeException)
-{
- return Reference< XWindow >( impl_getPaneWindowOrCanvas( true ), UNO_QUERY );
-}
-
-Reference< XCanvas > SAL_CALL ViewShellWrapper::getCanvas() throw (RuntimeException)
-{
- return Reference< XCanvas >( impl_getPaneWindowOrCanvas( false ), UNO_QUERY );
-}
-
//----- XResource -------------------------------------------------------------
Reference<XResourceId> SAL_CALL ViewShellWrapper::getResourceId (void)
diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx
index cc68f79535ba..1fed73205065 100644
--- a/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -222,7 +222,7 @@ const OUString FrameworkHelper::msViewTabBarURL(
// Task panel URLs.
const ::rtl::OUString FrameworkHelper::msTaskPanelURLPrefix(
- OUString::createFromAscii("private:resource/toolpanel/"));
+ OUString::createFromAscii("private:resource/toolpanel/DrawingFramework/"));
const ::rtl::OUString FrameworkHelper::msMasterPagesTaskPanelURL(
msTaskPanelURLPrefix + OUString::createFromAscii("MasterPages"));
const ::rtl::OUString FrameworkHelper::msLayoutTaskPanelURL(
diff --git a/sd/source/ui/inc/framework/ViewShellWrapper.hxx b/sd/source/ui/inc/framework/ViewShellWrapper.hxx
index d8406adb1632..09ea3a0910ae 100644
--- a/sd/source/ui/inc/framework/ViewShellWrapper.hxx
+++ b/sd/source/ui/inc/framework/ViewShellWrapper.hxx
@@ -33,26 +33,22 @@
#include "MutexOwner.hxx"
#include <com/sun/star/drawing/framework/XView.hpp>
-#include <com/sun/star/drawing/framework/XPane.hpp>
#include <com/sun/star/drawing/framework/XRelocatableResource.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <osl/mutex.hxx>
-#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/compbase4.hxx>
#include <cppuhelper/implbase1.hxx>
#include <boost/shared_ptr.hpp>
namespace {
-typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::lang::XUnoTunnel
+typedef ::cppu::WeakComponentImplHelper4 < ::com::sun::star::lang::XUnoTunnel
, ::com::sun::star::awt::XWindowListener
, ::com::sun::star::drawing::framework::XRelocatableResource
+ , ::com::sun::star::drawing::framework::XView
> ViewShellWrapperInterfaceBase;
-typedef ::cppu::ImplHelper1 < ::com::sun::star::drawing::framework::XView
- > ViewShellWrapper_ViewBase;
-typedef ::cppu::ImplHelper1 < ::com::sun::star::drawing::framework::XPane
- > ViewShellWrapper_PaneBase;
} // end of anonymous namespace.
@@ -66,8 +62,6 @@ namespace sd { namespace framework {
*/
class ViewShellWrapper :private sd::MutexOwner
,public ViewShellWrapperInterfaceBase
- ,public ViewShellWrapper_ViewBase
- ,public ViewShellWrapper_PaneBase
{
public:
/** Create a new ViewShellWrapper object that wraps the given ViewShell
@@ -103,22 +97,6 @@ public:
virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
throw (com::sun::star::uno::RuntimeException);
- // XInterface
-
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire( ) throw ();
- virtual void SAL_CALL release( ) throw ();
-
- // XTypeProvider
-
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XPane
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > SAL_CALL getCanvas( ) throw (::com::sun::star::uno::RuntimeException);
-
// XResource
virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
@@ -166,11 +144,6 @@ private:
::boost::shared_ptr< ViewShell > mpViewShell;
const ::com::sun::star::uno::Reference< com::sun::star::drawing::framework::XResourceId > mxViewId;
::com::sun::star::uno::Reference<com::sun::star::awt::XWindow > mxWindow;
- const bool mbIsPane;
-
-private:
- // only to be called when mbIsPane is <TRUE/>
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > impl_getPaneWindowOrCanvas( const bool i_bWindow );
};
} } // end of namespace sd::framework
diff --git a/sd/source/ui/inc/taskpane/PanelId.hxx b/sd/source/ui/inc/taskpane/PanelId.hxx
index 7e26c4e66e68..e89b76a1cf07 100644
--- a/sd/source/ui/inc/taskpane/PanelId.hxx
+++ b/sd/source/ui/inc/taskpane/PanelId.hxx
@@ -27,6 +27,11 @@
#ifndef SD_UI_TASKPANE_PANELID_HXX
#define SD_UI_TASKPANE_PANELID_HXX
+namespace rtl
+{
+ class OUString;
+}
+
//......................................................................................................................
namespace sd { namespace toolpanel
{
diff --git a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx
index a82908ec56e3..4d16dd8d26e4 100644
--- a/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx
+++ b/sd/source/ui/inc/taskpane/ToolPanelViewShell.hxx
@@ -45,6 +45,10 @@
class PopupMenu;
+namespace com { namespace sun { namespace star { namespace ui {
+ class XUIElement;
+} } } }
+
namespace sd {
class PaneDockingWindow;
@@ -53,7 +57,6 @@ class TaskPaneShellManager;
class TitleToolBox;
class TitleBar;
class TitledControl;
-class ToolPanelDeck;
class ToolPanelViewShell_Impl;
/** The tool panel is a view shell for some very specific reasons:
- It fits better into the concept of panes being docking windows whose
@@ -99,17 +102,9 @@ public:
TaskPaneShellManager& GetSubShellManager (void) const;
- /** returns the window which should be used as parent for tool panel windows
- */
- ::Window* GetToolPanelParentWindow();
-
- /** activates the given panel, bypassing the configuration controller, deactivates the previously active one.
- */
- void ActivatePanel( const PanelId i_ePanelId );
-
/** deactivates the given panel, bypassing the configuration controller
*/
- void DeactivatePanel( const PanelId i_ePanelId );
+ void DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL );
/** Return a pointer to the docking window that is the parent or a
predecessor of the content window.
@@ -137,6 +132,17 @@ public:
*/
virtual bool RelocateToParentWindow (::Window* pParentWindow);
+ /// returns <TRUE/> if and only if the given window is the panel anchor window of our ToolPanelDeck
+ bool IsPanelAnchorWindow( const ::Window& i_rWindow ) const;
+
+ /** creates an XUIElement for the given standard panel
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >
+ CreatePanelUIElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocFrame,
+ const ::rtl::OUString& i_rPanelResourceURL
+ );
+
private:
::boost::scoped_ptr< ToolPanelViewShell_Impl > mpImpl;
diff --git a/sd/source/ui/toolpanel/CustomToolPanel.cxx b/sd/source/ui/toolpanel/CustomToolPanel.cxx
deleted file mode 100644
index 1515bf09104f..000000000000
--- a/sd/source/ui/toolpanel/CustomToolPanel.cxx
+++ /dev/null
@@ -1,290 +0,0 @@
-/*************************************************************************
- * 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>
-#include <com/sun/star/awt/PosSize.hpp>
-#include <com/sun/star/drawing/framework/XPane2.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;
- using ::com::sun::star::awt::XWindow;
- using ::com::sun::star::accessibility::XAccessible;
- using ::com::sun::star::drawing::framework::XPane2;
- /** === end UNO using === **/
- namespace PosSize = ::com::sun::star::awt::PosSize;
-
- //==================================================================================================================
- //= 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_xResource()
- ,m_xToolPanel()
- ,m_bAttemptedPanelCreation( false )
- ,m_nResourceAccessLock( 0 )
- {
- 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::Activate( ::Window& i_rParentWindow )
- {
- OSL_ENSURE( &getPanelWindowAnchor() == &i_rParentWindow,
- "CustomToolPanel::Activate: invalid new parent window" );
- // getPanelWindowAnchor() is what is returned in the TaskPane's XPane::getWindow method. So,
- // any custom panel which is loaded into the TaskPane will use this window as parent window.
- // Consequently, this is the window which shall be passed here, since this method is intended to
- // re-create the panel with the given parent.
-
- // we do not need to do anything here. The XResourceFactory::createResource method of the custom
- // tool panel already created and showed the window.
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void CustomToolPanel::Deactivate()
- {
- // When a certain tool panel is activated, this is routed through the drawing framework, which ensures
- // that the resource associated with the previously active panel is deactivated, which calls the
- // XResourceFactory::destroyResource at our custom panel's factory.
-
- // So, we do not have to do anything here - except forgetting the XResource, at it might (or might not,
- // if cached by the factory) be re-created next time.
- m_xResource.clear();
- m_xToolPanel.clear();
- m_bAttemptedPanelCreation = false;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void CustomToolPanel::SetSizePixel( const Size& i_rPanelWindowSize )
- {
- impl_ensurePanel();
- if ( !m_xToolPanel.is() )
- // if the custom panel does not support XPanel, this just means it is its own responsibility
- // to resize/layout everything within the pane window.
- return;
-
- try
- {
- Reference< XWindow > xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW );
- xPanelWindow->setPosSize( 0, 0, i_rPanelWindowSize.Width(), i_rPanelWindowSize.Height(),
- PosSize::POSSIZE );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void CustomToolPanel::GrabFocus()
- {
- impl_ensurePanel();
- if ( !m_xToolPanel.is() )
- // if the custom panel does not support XPanel, this just means it is its own responsibility
- // to care for focus handling
- return;
-
- try
- {
- Reference< XWindow > xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW );
- xPanelWindow->setFocus();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void CustomToolPanel::Dispose()
- {
- // nothing to do here. Lifetime handling of the XResource which this panel represents is done by
- // the drawing framework, we ourself do not have resources to release.
- TaskPaneToolPanel::Dispose();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible )
- {
- ENSURE_OR_RETURN( !isDisposed(), "CustomToolPanel::CreatePanelAccessible: already disposed!", NULL );
- (void)i_rParentAccessible;
-
- // an XResource might also be an XPane2, which can provide an XAccessible. Check this first.
- const Reference< XPane2 > xPane( m_xResource, UNO_QUERY );
- if ( xPane.is() )
- {
- const Reference< XAccessible > xPaneAccessible( xPane->getAccessible() );
- if ( xPaneAccessible.is() )
- return xPaneAccessible;
- }
-
- // if we have an XToolPanel, ask it for its XWindow, and query it
- impl_ensurePanel();
- if ( !m_xToolPanel.is() )
- return NULL;
-
- const Reference< XAccessible > xPanelWindowAccessible( m_xToolPanel->getWindow(), UNO_QUERY );
- if ( xPanelWindowAccessible.is() )
- return xPanelWindowAccessible;
-
- // maybe the XToolPanel itself can provide an XAccessible?
- const Reference< XAccessible > xPanelAccessible( m_xToolPanel, UNO_QUERY );
- if ( xPanelAccessible.is() )
- return xPanelAccessible;
-
- OSL_ENSURE( false, "CustomToolPanel::CreatePanelAccessible: no XAccessible for the custom panel!" );
- return NULL;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void CustomToolPanel::LockResourceAccess()
- {
- ++m_nResourceAccessLock;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void CustomToolPanel::UnlockResourceAccess()
- {
- OSL_ENSURE( m_nResourceAccessLock > 0, "CustomToolPanel::UnlockResourceAccess: not locked!" );
- --m_nResourceAccessLock;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- const Reference< XResourceId >& CustomToolPanel::getResourceId() const
- {
- return m_xPanelResourceId;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void CustomToolPanel::impl_ensurePanel()
- {
- ENSURE_OR_RETURN_VOID( !isDisposed(), "already disposed" );
-
- if ( ( m_nResourceAccessLock == 0 ) && !m_bAttemptedPanelCreation )
- {
- m_bAttemptedPanelCreation = true;
-
- try
- {
- Reference< XConfigurationController > xConfigController( m_pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW );
- m_xResource.set( xConfigController->getResource( m_xPanelResourceId ), UNO_QUERY_THROW );
- m_xToolPanel.set( m_xResource, UNO_QUERY );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- }
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
diff --git a/sd/source/ui/toolpanel/CustomToolPanel.hxx b/sd/source/ui/toolpanel/CustomToolPanel.hxx
deleted file mode 100644
index 7f7f5ec3417d..000000000000
--- a/sd/source/ui/toolpanel/CustomToolPanel.hxx
+++ /dev/null
@@ -1,113 +0,0 @@
-/*************************************************************************
- * 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/XPane.hpp>
-#include <com/sun/star/drawing/framework/XResourceId.hpp>
-#include <com/sun/star/drawing/framework/XResource.hpp>
-#include <com/sun/star/ui/XToolPanel.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 Activate( ::Window& i_rParentWindow );
- virtual void Deactivate();
- virtual void SetSizePixel( const Size& i_rPanelWindowSize );
- virtual void GrabFocus();
- virtual void Dispose();
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- CreatePanelAccessible(
- const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
- );
-
- /** locks (aka prevents) the access to the associated XResource object
- */
- void LockResourceAccess();
- /** unlocks (aka allows) the access to the associated XResource object
- */
- void UnlockResourceAccess();
-
- protected:
- // TaskPaneToolPanel overridables
- virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const;
-
- private:
- void impl_ensurePanel();
-
- 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::XResource > m_xResource;
- ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel > m_xToolPanel;
- bool m_bAttemptedPanelCreation;
- sal_uInt32 m_nResourceAccessLock;
- };
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
-#endif // SD_TOOLPANEL_CUSTOMTOOLPANEL_HXX
diff --git a/sd/source/ui/toolpanel/MethodGuard.hxx b/sd/source/ui/toolpanel/MethodGuard.hxx
new file mode 100644
index 000000000000..45b81367c8de
--- /dev/null
+++ b/sd/source/ui/toolpanel/MethodGuard.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ * 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_METHODGUARD_HXX
+#define SD_METHODGUARD_HXX
+
+#include <osl/mutex.hxx>
+
+//......................................................................................................................
+namespace sd { namespace toolpanel
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= MethodGuard
+ //==================================================================================================================
+ template < class COMPONENT >
+ class MethodGuard
+ {
+ public:
+ MethodGuard( COMPONENT& i_rComponent )
+ :m_aGuard( i_rComponent.getMutex() )
+ {
+ i_rComponent.checkDisposed();
+ }
+
+ ~MethodGuard()
+ {
+ }
+
+ inline void clear()
+ {
+ m_aGuard.clear();
+ }
+
+ private:
+ ::osl::ClearableMutexGuard m_aGuard;
+ };
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
+
+#endif // SD_METHODGUARD_HXX
diff --git a/sd/source/ui/toolpanel/StandardToolPanel.cxx b/sd/source/ui/toolpanel/StandardToolPanel.cxx
deleted file mode 100644
index ede20ea3404c..000000000000
--- a/sd/source/ui/toolpanel/StandardToolPanel.cxx
+++ /dev/null
@@ -1,163 +0,0 @@
-/*************************************************************************
- * 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;
- using ::com::sun::star::accessibility::XAccessible;
- /** === 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::Activate( ::Window& i_rParentWindow )
- {
- Window* pPanelWindow( impl_getPanelWindow() );
- ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to show" );
- pPanelWindow->SetPosSizePixel( Point(), i_rParentWindow.GetSizePixel() );
- pPanelWindow->Show();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void StandardToolPanel::Deactivate()
- {
- Window* pPanelWindow( impl_getPanelWindow() );
- ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to hide" );
- pPanelWindow->Hide();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void StandardToolPanel::SetSizePixel( const Size& i_rPanelWindowSize )
- {
- Window* pPanelWindow( impl_getPanelWindow() );
- ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to resize" );
- pPanelWindow->SetSizePixel( i_rPanelWindowSize );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void StandardToolPanel::GrabFocus()
- {
- Window* pPanelWindow( impl_getPanelWindow() );
- ENSURE_OR_RETURN_VOID( pPanelWindow, "no window to focus" );
- pPanelWindow->GrabFocus();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void StandardToolPanel::Dispose()
- {
- m_pControl.reset();
- TaskPaneToolPanel::Dispose();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XAccessible > StandardToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible )
- {
- ENSURE_OR_RETURN( !isDisposed(), "already disposed!", NULL );
-
- Window* pControlWindow( m_pControl->GetWindow() );
-
- Reference< XAccessible > xControlAccessible( pControlWindow->GetAccessible( FALSE ) );
- if ( !xControlAccessible.is() )
- {
- xControlAccessible = m_pControl->CreateAccessibleObject( i_rParentAccessible );
- OSL_ENSURE( xControlAccessible.is(), "StandardToolPanel::CreatePanelAccessible: invalid XAccessible returned by CreateAccessibleObject!" );
- pControlWindow->SetAccessible( xControlAccessible );
- }
- return xControlAccessible;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- const Reference< XResourceId >& StandardToolPanel::getResourceId() const
- {
- return m_xPanelResourceId;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::Window* StandardToolPanel::impl_getPanelWindow() const
- {
- if ( const_cast< StandardToolPanel* >( this )->impl_ensureControl() )
- return m_pControl->GetWindow();
- return NULL;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- bool StandardToolPanel::impl_ensureControl()
- {
- if ( m_pControl.get() )
- return true;
- if ( isDisposed() )
- return false;
- m_pControl = m_pControlFactory->CreateControl( getPanelWindowAnchor() );
- return ( m_pControl.get() != NULL );
- }
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx b/sd/source/ui/toolpanel/ToolPanel.cxx
index 4d0103086932..6dbcae52547a 100644
--- a/sd/source/ui/toolpanel/TaskPaneToolPanel.cxx
+++ b/sd/source/ui/toolpanel/ToolPanel.cxx
@@ -22,14 +22,18 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
-************************************************************************/
+ ************************************************************************/
#include "precompiled_sd.hxx"
-#include "TaskPaneToolPanel.hxx"
-#include "ToolPanelDeck.hxx"
+#include "ToolPanel.hxx"
+#include "MethodGuard.hxx"
+#include <taskpane/TaskPaneTreeNode.hxx>
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
-#include <tools/diagnose_ex.h>
#include <vcl/window.hxx>
//......................................................................................................................
@@ -49,51 +53,59 @@ namespace sd { namespace toolpanel
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;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::accessibility::XAccessible;
/** === end UNO using === **/
+ typedef MethodGuard< ToolPanel > ToolPanelGuard;
+
//==================================================================================================================
- //= TaskPaneToolPanel
+ //= ToolPanel
//==================================================================================================================
//------------------------------------------------------------------------------------------------------------------
- TaskPaneToolPanel::TaskPaneToolPanel( ToolPanelDeck& i_rPanelDeck, const String& i_rPanelName, const Image& i_rImage,
- const SmartId& i_rHelpId )
- :m_pPanelDeck( &i_rPanelDeck )
- ,m_aPanelImage( i_rImage )
- ,m_sPanelName( i_rPanelName )
- ,m_aHelpId( i_rHelpId )
+ ToolPanel::ToolPanel( ::std::auto_ptr< TreeNode >& i_rControl )
+ :ToolPanel_Base( m_aMutex )
+ ,m_pControl( i_rControl )
{
}
//------------------------------------------------------------------------------------------------------------------
- TaskPaneToolPanel::~TaskPaneToolPanel()
+ ToolPanel::~ToolPanel()
{
}
//------------------------------------------------------------------------------------------------------------------
- Window& TaskPaneToolPanel::getPanelWindowAnchor()
+ void ToolPanel::checkDisposed()
{
- OSL_ENSURE( !isDisposed(), "already disposed!" );
- return m_pPanelDeck->GetPanelWindowAnchor();
+ if ( m_pControl.get() == NULL )
+ throw DisposedException( ::rtl::OUString(), *this );
}
//------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString TaskPaneToolPanel::GetDisplayName() const
+ Reference< XWindow > SAL_CALL ToolPanel::getWindow() throw (RuntimeException)
{
- return m_sPanelName;
+ ToolPanelGuard aGuard( *this );
+ return Reference< XWindow >( m_pControl->GetWindow()->GetComponentInterface(), UNO_QUERY_THROW );
}
//------------------------------------------------------------------------------------------------------------------
- Image TaskPaneToolPanel::GetImage() const
+ Reference< XAccessible > SAL_CALL ToolPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException)
{
- return m_aPanelImage;
+ ToolPanelGuard aGuard( *this );
+ Reference< XAccessible > xAccessible( m_pControl->GetWindow()->GetAccessible( FALSE ) );
+ if ( !xAccessible.is() )
+ {
+ xAccessible.set( m_pControl->CreateAccessibleObject( i_rParentAccessible ) );
+ m_pControl->GetWindow()->SetAccessible( xAccessible );
+ }
+ return xAccessible;
}
//------------------------------------------------------------------------------------------------------------------
- void TaskPaneToolPanel::Dispose()
+ void SAL_CALL ToolPanel::disposing()
{
- ENSURE_OR_RETURN_VOID( m_pPanelDeck, "disposed twice" );
- m_pPanelDeck = NULL;
+ m_pControl.reset();
}
//......................................................................................................................
diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx b/sd/source/ui/toolpanel/ToolPanel.hxx
index d92b1c14bf27..2fe4a64c71be 100644
--- a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx
+++ b/sd/source/ui/toolpanel/ToolPanel.hxx
@@ -22,21 +22,17 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
-************************************************************************/
+ ************************************************************************/
-#ifndef SD_TASKPANETOOLPANEL_HXX
-#define SD_TASKPANETOOLPANEL_HXX
-
-#include "taskpane/TaskPaneControlFactory.hxx"
+#ifndef SD_TOOLPANEL_HXX
+#define SD_TOOLPANEL_HXX
/** === begin UNO includes === **/
-#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/ui/XToolPanel.hpp>
/** === end UNO includes === **/
-#include <svtools/toolpanel/toolpanel.hxx>
-
-#include <vcl/image.hxx>
-#include <vcl/smartid.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase1.hxx>
#include <memory>
@@ -45,53 +41,40 @@ namespace sd { namespace toolpanel
{
//......................................................................................................................
- class ToolPanelDeck;
+ class TreeNode;
//==================================================================================================================
- //= TaskPaneToolPanel
+ //= ToolPanel
//==================================================================================================================
- class TaskPaneToolPanel : public ::svt::ToolPanelBase
+ typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XToolPanel
+ > ToolPanel_Base;
+ class ToolPanel :public ::cppu::BaseMutex
+ ,public ToolPanel_Base
{
- protected:
- TaskPaneToolPanel(
- ToolPanelDeck& i_rPanelDeck,
- const String& i_rPanelName,
- const Image& i_rImage,
- const SmartId& i_rHelpId
+ public:
+ ToolPanel(
+ ::std::auto_ptr< TreeNode >& i_rControl
);
- ~TaskPaneToolPanel();
- public:
- // IToolPanel overridables
- virtual ::rtl::OUString GetDisplayName() const;
- virtual Image GetImage() const;
- virtual void Dispose();
- // those are still abstract, and waiting to be overloaded
- virtual void Activate( ::Window& i_rParentWindow ) = 0;
- virtual void Deactivate() = 0;
- virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0;
- virtual void GrabFocus() = 0;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- CreatePanelAccessible(
- const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
- ) = 0;
+ // XToolPanel
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL createAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& ParentAccessible ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
- // own overridables
- virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const = 0;
+ ::osl::Mutex& getMutex() { return m_aMutex; }
+ void checkDisposed();
protected:
- bool isDisposed() const { return m_pPanelDeck == NULL; }
- Window& getPanelWindowAnchor();
+ ~ToolPanel();
private:
- ToolPanelDeck* m_pPanelDeck;
- const Image m_aPanelImage;
- const String m_sPanelName;
- const SmartId m_aHelpId;
+ ::std::auto_ptr< TreeNode > m_pControl;
};
//......................................................................................................................
} } // namespace sd::toolpanel
//......................................................................................................................
-#endif // SD_TASKPANETOOLPANEL_HXX
+#endif // SD_TOOLPANEL_HXX
diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx
deleted file mode 100755
index 53a1caff73d9..000000000000
--- a/sd/source/ui/toolpanel/ToolPanelDeck.cxx
+++ /dev/null
@@ -1,160 +0,0 @@
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "ToolPanelDeck.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-#include "taskpane/ControlContainer.hxx"
-#include "framework/FrameworkHelper.hxx"
-#include "TaskPaneToolPanel.hxx"
-#include "strings.hrc"
-#include "sdresid.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
-/** === end UNO includes === **/
-
-#include <svtools/toolpanel/tablayouter.hxx>
-#include <svtools/toolpanel/drawerlayouter.hxx>
-#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;
- using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE;
- /** === end UNO using === **/
- using ::sd::framework::FrameworkHelper;
-
- //==================================================================================================================
- //= ToolPanelDeck
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- ToolPanelDeck::ToolPanelDeck( Window& i_rParent, ToolPanelViewShell& i_rViewShell )
- :ToolPanelDeck_Base( i_rParent, WB_DIALOGCONTROL )
- ,m_rViewShell( i_rViewShell )
- {
- SetDrawersLayout();
-
- const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) );
- SetAccessibleName( sPaneTitle );
- SetAccessibleDescription( sPaneTitle );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ToolPanelDeck::~ToolPanelDeck()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void ToolPanelDeck::SetDrawersLayout()
- {
- const ::svt::PDeckLayouter pLayouter( GetLayouter() );
- const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() );
- if ( pDrawerLayouter != NULL )
- // already have the proper layout
- return;
- SetLayouter( new ::svt::DrawerDeckLayouter( *this, *this ) );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void ToolPanelDeck::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent )
- {
- ::svt::PDeckLayouter pLayouter( GetLayouter() );
- ::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() );
- if ( ( pTabLayouter != NULL )
- && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment )
- && ( pTabLayouter->GetTabItemContent() == i_eTabContent )
- )
- // already have the requested layout
- return;
-
- if ( pTabLayouter && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) )
- {
- // changing only the item content does not require a new layouter instance
- pTabLayouter->SetTabItemContent( i_eTabContent );
- return;
- }
-
- SetLayouter( new ::svt::TabDeckLayouter( *this, *this, i_eTabAlignment, i_eTabContent ) );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void ToolPanelDeck::ActivatePanelDirectly( const ::boost::optional< size_t >& i_rPanel )
- {
- ToolPanelDeck_Base::ActivatePanel( i_rPanel );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void ToolPanelDeck::ActivatePanelResource( const size_t i_nPanel )
- {
- // determine resource ID for the given panel
- ::svt::PToolPanel pPanel( GetPanel( i_nPanel ) );
- const TaskPaneToolPanel* pTaskPanePanel( dynamic_cast< const TaskPaneToolPanel* >( pPanel.get() ) );
- ENSURE_OR_RETURN_VOID( pTaskPanePanel, "did not find the right panel/type at the given position" );
- const Reference< XResourceId > xPanelId( pTaskPanePanel->getResourceId() );
-
- // delegate the request to the configuration controller
- ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rViewShell.GetViewShellBase() ) );
- pFrameworkHelper->GetConfigurationController()->requestResourceActivation(
- xPanelId, ResourceActivationMode_REPLACE );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void ToolPanelDeck::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
- {
- if ( !i_rPanel )
- {
- // this is a de-activate request. Quite improbable that this really happens: We're within the overloaded
- // version of IToolPanelDeck::ActivatePanel. The only instance which has access to this IToolPanel
- // interface is the panel layouter, which is not expected to call us with a NULL panel position.
- // All other instances should not have access to this method, as it is protected in this class here.
- OSL_ENSURE( false, "ToolPanelDeck::ActivatePanel: is this legitimate?" );
- // well, handle it nonetheless.
- ActivatePanelDirectly( i_rPanel );
- }
- else
- ActivatePanelResource( *i_rPanel );
- }
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.hxx b/sd/source/ui/toolpanel/ToolPanelDeck.hxx
deleted file mode 100644
index e140d9577220..000000000000
--- a/sd/source/ui/toolpanel/ToolPanelDeck.hxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-#ifndef SD_TOOLPANELDECK_HXX
-#define SD_TOOLPANELDECK_HXX
-
-#include "taskpane/TaskPaneTreeNode.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/drawing/framework/XResourceId.hpp>
-/** === end UNO includes === **/
-
-#include <svtools/toolpanel/toolpaneldeck.hxx>
-#include <svtools/toolpanel/tabalignment.hxx>
-#include <svtools/toolpanel/tabitemcontent.hxx>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
- class ToolPanelViewShell;
-
- //==================================================================================================================
- //= ToolPanelDeck
- //==================================================================================================================
- typedef ::svt::ToolPanelDeck ToolPanelDeck_Base;
- class ToolPanelDeck : public ToolPanelDeck_Base
- {
- public:
- ToolPanelDeck(
- ::Window& i_rParent,
- ToolPanelViewShell& i_rViewShell
- );
- ~ToolPanelDeck();
-
- /** activates a layout where the active panel is selected via tabs at the right/left/top/bottom (depending on
- the given TabAlignment value).
- */
- void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent );
-
- /** activates the "classical" layout with the panels being represneted by stacked drawers
- */
- void SetDrawersLayout();
-
- /** directly activates the given panel, without re-routing the activation request through the drawing
- framework's configuration controller.
- */
- void ActivatePanelDirectly( const ::boost::optional< size_t >& i_rPanel );
-
- /** activates the given panel by delegating the acvtivation request to the drawing framework's configuration
- controller.
- */
- void ActivatePanelResource( const size_t i_nPanel );
-
- protected:
- // IToolPanelDeck
- /** this method, which is part of the callback used by the PanelSelector, does not forward the request to
- the base class. Instead, it forwards it to the ToolPanelViewShell, which transforms it into a request
- to the drawing framework's configuration controller, which in turn will end up in our public
- ActivatePanelDirectly method.
- */
- virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel );
-
- private:
- ToolPanelViewShell& m_rViewShell;
- };
-
-//......................................................................................................................
-} } // sd::toolpanel
-//......................................................................................................................
-
-#endif // SD_TOOLPANELDECK_HXX
diff --git a/sd/source/ui/toolpanel/ToolPanelFactory.cxx b/sd/source/ui/toolpanel/ToolPanelFactory.cxx
new file mode 100644
index 000000000000..a0315ed30fd0
--- /dev/null
+++ b/sd/source/ui/toolpanel/ToolPanelFactory.cxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ * 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 "taskpane/ToolPanelViewShell.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "PaneChildWindows.hxx"
+#include "ViewShellBase.hxx"
+#include "app.hrc"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+/** === end UNO includes === **/
+
+#include <sfx2/frame.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+//......................................................................................................................
+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::uno::XComponentContext;
+ using ::com::sun::star::ui::XUIElementFactory;
+ using ::com::sun::star::ui::XUIElement;
+ using ::com::sun::star::beans::PropertyValue;
+ using ::com::sun::star::container::NoSuchElementException;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::lang::XServiceInfo;
+ using ::com::sun::star::lang::XInitialization;
+ using ::com::sun::star::frame::XFrame;
+ using ::com::sun::star::awt::XWindow;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= ToolPanelFactory
+ //==================================================================================================================
+ typedef ::cppu::WeakImplHelper3 < XUIElementFactory
+ , XServiceInfo
+ , XInitialization
+ > ToolPanelFactory_Base;
+ class ToolPanelFactory : public ToolPanelFactory_Base
+ {
+ public:
+ ToolPanelFactory( const Reference< XComponentContext >& i_rContext );
+
+ // XUIElementFactory
+ virtual Reference< XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const Sequence< PropertyValue >& Args ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
+ virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
+
+ protected:
+ virtual ~ToolPanelFactory();
+
+ private:
+ const Reference< XComponentContext > m_xContext;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL ToolPanelFactory_createInstance( const Reference< XComponentContext >& i_rContext )
+ {
+ return Reference< XInterface >( *new ToolPanelFactory( i_rContext ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString ToolPanelFactory_getImplementationName() throw(RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.drawing.ToolPanelFactory" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory_getSupportedServiceNames (void)
+ throw (RuntimeException)
+ {
+ const ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DefaultToolPanelFactory" ) );
+ return Sequence< ::rtl::OUString >( &sServiceName, 1 );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelFactory::ToolPanelFactory( const Reference< XComponentContext >& i_rContext )
+ :m_xContext( i_rContext )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelFactory::~ToolPanelFactory()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XUIElement > SAL_CALL ToolPanelFactory::createUIElement( const ::rtl::OUString& i_rResourceURL, const Sequence< PropertyValue >& i_rArgs ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ const PanelId ePanelId( toolpanel::GetStandardPanelId( i_rResourceURL ) );
+ if ( ePanelId == PID_UNKNOWN )
+ throw NoSuchElementException( i_rResourceURL, *this );
+
+ const ::comphelper::NamedValueCollection aArgs( i_rArgs );
+ const Reference< XFrame > xDocFrame( aArgs.getOrDefault( "Frame", Reference< XFrame >() ) );
+ const Reference< XWindow > xParentWindow( aArgs.getOrDefault( "ParentWindow", Reference< XWindow >() ) );
+ if ( !xDocFrame.is() || !xParentWindow.is() )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "For creating a standard tool panel, a Frame and a Parent window are needed." ) ),
+ *this,
+ 2
+ );
+
+ // look up the Sfx(View)Frame for the given XFrame
+ SfxViewFrame* pViewFrame = NULL;
+ for ( SfxFrame* pFrame = SfxFrame::GetFirst();
+ pFrame != NULL;
+ pFrame = SfxFrame::GetNext( *pFrame )
+ )
+ {
+ if ( pFrame->GetFrameInterface() == xDocFrame )
+ {
+ pViewFrame = pFrame->GetCurrentViewFrame();
+ break;
+ }
+ }
+
+ if ( !pViewFrame || !pViewFrame->HasChildWindow( SID_RIGHT_PANE ) )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal frame." ) ),
+ *this,
+ 2
+ );
+
+ // retrieve the task pane
+ ToolPanelChildWindow* pToolPanelWindow( dynamic_cast< ToolPanelChildWindow* >( pViewFrame->GetChildWindow( SID_RIGHT_PANE ) ) );
+ if ( !pToolPanelWindow )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No Impress document, or no Impress Task Pane." ) ),
+ *this,
+ 2
+ );
+
+ // retrieve the ViewShellBase, and the view shell of the task pane
+ ViewShellBase* pViewShellBase = dynamic_cast< ViewShellBase* >( pViewFrame->GetViewShell() );
+ ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper;
+ if ( pViewShellBase )
+ pFrameworkHelper = framework::FrameworkHelper::Instance( *pViewShellBase );
+ ::boost::shared_ptr< ViewShell > pViewShell;
+ if ( pFrameworkHelper.get() )
+ pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL );
+ ToolPanelViewShell* pToolPanelShell = dynamic_cast< ToolPanelViewShell* >( pViewShell.get() );
+
+ if ( !pToolPanelShell )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Wrong document type." ) ),
+ *this,
+ 2
+ );
+
+ ::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
+ if ( !pParentWindow || !pToolPanelShell->IsPanelAnchorWindow( *pParentWindow ) )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported parent window." ) ),
+ *this,
+ 2
+ );
+
+ return pToolPanelShell->CreatePanelUIElement( xDocFrame, i_rResourceURL );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ToolPanelFactory::getImplementationName( ) throw (RuntimeException)
+ {
+ return ToolPanelFactory_getImplementationName();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL ToolPanelFactory::supportsService( const ::rtl::OUString& i_rServiceName ) throw (RuntimeException)
+ {
+ const Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() );
+ for ( const ::rtl::OUString* pSupported = aSupported.getConstArray();
+ pSupported != aSupported.getConstArray() + aSupported.getLength();
+ ++pSupported
+ )
+ if ( *pSupported == i_rServiceName )
+ return sal_True;
+
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ return ToolPanelFactory_getSupportedServiceNames();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL ToolPanelFactory::initialize( const Sequence< Any >& i_rArguments ) throw (Exception, RuntimeException)
+ {
+ ::comphelper::NamedValueCollection aArgs( i_rArguments );
+ (void)aArgs;
+ // TODO
+ }
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
diff --git a/sd/source/ui/toolpanel/ToolPanelUIElement.cxx b/sd/source/ui/toolpanel/ToolPanelUIElement.cxx
new file mode 100644
index 000000000000..e81f683bcfa7
--- /dev/null
+++ b/sd/source/ui/toolpanel/ToolPanelUIElement.cxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ * 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 "ToolPanelUIElement.hxx"
+#include "MethodGuard.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/UIElementType.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+/** === 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::frame::XFrame;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::ui::XToolPanel;
+ using ::com::sun::star::lang::DisposedException;
+ /** === end UNO using === **/
+ namespace UIElementType = ::com::sun::star::ui::UIElementType;
+
+ typedef MethodGuard< ToolPanelUIElement > UIElementMethodGuard;
+
+ //==================================================================================================================
+ //= ToolPanelUIElement
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelUIElement::ToolPanelUIElement( const Reference< XFrame >& i_rFrame, const ::rtl::OUString& i_rResourceURL,
+ const Reference< XToolPanel >& i_rToolPanel )
+ :ToolPanelUIElement_Base( m_aMutex )
+ ,m_xFrame( i_rFrame )
+ ,m_sResourceURL( i_rResourceURL )
+ ,m_xToolPanel( i_rToolPanel )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ToolPanelUIElement::~ToolPanelUIElement()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ToolPanelUIElement::checkDisposed()
+ {
+ if ( !m_xToolPanel.is() )
+ throw DisposedException( ::rtl::OUString(), *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XFrame > SAL_CALL ToolPanelUIElement::getFrame() throw (RuntimeException)
+ {
+ UIElementMethodGuard aGuard( *this );
+ return m_xFrame;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ToolPanelUIElement::getResourceURL() throw (RuntimeException)
+ {
+ UIElementMethodGuard aGuard( *this );
+ return m_sResourceURL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int16 SAL_CALL ToolPanelUIElement::getType() throw (RuntimeException)
+ {
+ UIElementMethodGuard aGuard( *this );
+ return UIElementType::TOOLPANEL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL ToolPanelUIElement::getRealInterface( ) throw (RuntimeException)
+ {
+ UIElementMethodGuard aGuard( *this );
+ return m_xToolPanel.get();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL ToolPanelUIElement::disposing()
+ {
+ try
+ {
+ Reference< XComponent > xPanelComponent( m_xToolPanel, UNO_QUERY_THROW );
+ xPanelComponent->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+//......................................................................................................................
+} } // namespace sd::toolpanel
+//......................................................................................................................
diff --git a/sd/source/ui/toolpanel/StandardToolPanel.hxx b/sd/source/ui/toolpanel/ToolPanelUIElement.hxx
index a40c3d4af5f2..0a74b7bd449e 100644
--- a/sd/source/ui/toolpanel/StandardToolPanel.hxx
+++ b/sd/source/ui/toolpanel/ToolPanelUIElement.hxx
@@ -22,63 +22,66 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
-************************************************************************/
+ ************************************************************************/
-#ifndef SD_TOOLPANEL_STANDARDTOOLPANEL_HXX
-#define SD_TOOLPANEL_STANDARDTOOLPANEL_HXX
+#ifndef SD_TOOLPANELUIELEMENT_HXX
+#define SD_TOOLPANELUIELEMENT_HXX
-#include "TaskPaneToolPanel.hxx"
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/ui/XToolPanel.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <memory>
//......................................................................................................................
namespace sd { namespace toolpanel
{
//......................................................................................................................
+ class TreeNode;
+
//==================================================================================================================
- //= StandardToolPanel
+ //= ToolPanelUIElement
//==================================================================================================================
- /** an IToolPanel implementation for one of the standard (aka built-in) tool panels
- */
- class StandardToolPanel : public TaskPaneToolPanel
+ typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XUIElement
+ > ToolPanelUIElement_Base;
+ class ToolPanelUIElement :public ::cppu::BaseMutex
+ ,public ToolPanelUIElement_Base
{
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
+ ToolPanelUIElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
+ const ::rtl::OUString& i_rResourceURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >& i_rToolPanel
);
- ~StandardToolPanel();
- // IToolPanel overridables
- virtual void Activate( ::Window& i_rParentWindow );
- virtual void Deactivate();
- virtual void SetSizePixel( const Size& i_rPanelWindowSize );
- virtual void GrabFocus();
- virtual void Dispose();
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- CreatePanelAccessible(
- const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
- );
+ // XUIElement
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface( ) throw (::com::sun::star::uno::RuntimeException);
- // TaskPaneToolPanel overridables
- virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const;
+ void checkDisposed();
+ ::osl::Mutex& getMutex() { return m_aMutex; }
- private:
- bool impl_ensureControl();
- ::Window* impl_getPanelWindow() const;
+ protected:
+ virtual ~ToolPanelUIElement();
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
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;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+ const ::rtl::OUString m_sResourceURL;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel > m_xToolPanel;
};
//......................................................................................................................
} } // namespace sd::toolpanel
//......................................................................................................................
-#endif // SD_TOOLPANEL_STANDARDTOOLPANEL_HXX
+#endif // SD_TOOLPANELUIELEMENT_HXX
diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
index 429d1564ad1f..99d130096e27 100755
--- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
+++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
@@ -31,18 +31,18 @@
#include "TaskPaneShellManager.hxx"
#include "TaskPaneFocusManager.hxx"
-#include "StandardToolPanel.hxx"
-#include "CustomToolPanel.hxx"
+#include "taskpane/TaskPaneControlFactory.hxx"
#include "controls/MasterPagesPanel.hxx"
#include "LayoutMenu.hxx"
#include "controls/TableDesignPanel.hxx"
#include "controls/CustomAnimationPanel.hxx"
#include "controls/SlideTransitionPanel.hxx"
#include "controls/MasterPagesSelector.hxx"
+#include "ToolPanel.hxx"
+#include "ToolPanelUIElement.hxx"
#include "PaneDockingWindow.hxx"
#include "FrameView.hxx"
#include "Window.hxx"
-#include "ToolPanelDeck.hxx"
#include "sdmod.hxx"
#include "app.hrc"
#include "glob.hrc"
@@ -56,10 +56,14 @@
#include <com/sun/star/drawing/framework/XResourceId.hpp>
#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
#include <com/sun/star/drawing/framework/AnchorBindingMode.hpp>
+#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
#include <com/sun/star/drawing/XDrawSubController.hpp>
/** === end UNO includes === **/
+#include <svtools/toolpanel/toolpanel.hxx>
+#include <svtools/toolpanel/toolpaneldeck.hxx>
#include <svx/dlgctrl.hxx>
+#include <sfx2/taskpane.hxx>
#include <sfx2/imagemgr.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
@@ -114,6 +118,9 @@ using ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster;
using ::com::sun::star::drawing::framework::XConfigurationController;
using ::com::sun::star::drawing::framework::XConfiguration;
using ::com::sun::star::drawing::framework::AnchorBindingMode_DIRECT;
+using ::com::sun::star::ui::XUIElement;
+using ::com::sun::star::ui::XToolPanel;
+using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE;
/** === end UNO using === **/
using ::sd::framework::FrameworkHelper;
@@ -225,41 +232,25 @@ public:
PanelSelectorLayout
GetLayout() const { return m_eCurrentLayout; }
- /** called by our configuration controller listener when the request to activate a tool panel has been observed.
+ /** activates the panel which has the given resource URL
*/
- void OnToolPanelActivationRequest( const ::rtl::OUString& i_rResourceURL );
+ void ActivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL );
- /** provides access to the the VCL window of the panel deck
- */
- ::Window& GetPanelDeck() { return *m_pPanelDeck.get(); }
- const ::Window& GetPanelDeck() const { return *m_pPanelDeck.get(); }
+ /** de-activates the panel given by its resource URL, bypassing the configuration controller
- ::Window* GetToolPanelParentWindow() { return m_pPanelDeck.get() ? &m_pPanelDeck->GetPanelWindowAnchor() : NULL; }
-
- /** returns the logical number of panels. This is greater than or equal to the number of panels displayed in the
- panel deck
+ If the panel is not active currently, nothing happens.
*/
- size_t GetPanelCount() const
- {
- return m_aPanels.size();
- }
-
- const PanelDescriptor& GetPanel( const size_t i_nLogicalPanelIndex ) const
- {
- return m_aPanels[ i_nLogicalPanelIndex ];
- }
+ void DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL );
- void TogglePanelVisibility( const size_t i_nLogicalPanelIndex );
-
- /** ensures the panel with the given ID is visible, and directly activates it, bypassing the configuration controller
+ /** provides access to the the VCL window of the panel deck
*/
- void ActivatePanelDirectly( const PanelId i_nPanelId );
+ ::sfx2::ModuleTaskPane& GetTaskPane() { return *m_pTaskPane; }
+ const ::sfx2::ModuleTaskPane& GetTaskPane() const { return *m_pTaskPane; }
- /** de-activates the panel given by ID, bypassing the configuration controller
+ ::svt::ToolPanelDeck& GetToolPanelDeck() { return GetTaskPane().GetPanelDeck(); }
+ const ::svt::ToolPanelDeck& GetToolPanelDeck() const { return GetTaskPane().GetPanelDeck(); }
- If the panel is not active currently, nothing happens.
- */
- void DeactivatePanelDirectly( const PanelId i_nPanelId );
+ void TogglePanelVisibility( const size_t i_nLogicalPanelIndex );
Reference< XAccessible >
CreateAccessible( ::sd::Window& i_rWindow );
@@ -273,35 +264,27 @@ protected:
virtual void Dying();
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 initially activate
- */
- struct PanelActivation
+ struct InitialPanel
{
- size_t nPanelPos;
- bool bActivateAsResource;
-
- PanelActivation()
- :nPanelPos( size_t( -1 ) )
- ,bActivateAsResource( true )
+ ::rtl::OUString sPanelResourceURL;
+ bool bActivateDirectly;
+ InitialPanel()
+ :sPanelResourceURL()
+ ,bActivateDirectly( true )
{
}
};
- PanelActivation SetupDefaultPanels();
-
- /** creates the custom panels
- */
- void SetupCustomPanels();
-
- typedef ::std::vector< PanelDescriptor > PanelDescriptors;
- PanelDescriptors m_aPanels;
- ToolPanelViewShell& m_rPanelViewShell;
- ::boost::scoped_ptr< ToolPanelDeck > m_pPanelDeck;
- ::rtl::Reference< ConfigurationListener > m_pConfigListener;
- PanelSelectorLayout m_eCurrentLayout;
- bool m_bInitialized;
+ InitialPanel DetermineInitialPanel();
+
+ typedef ::std::vector< PanelDescriptor > PanelDescriptors;
+ ToolPanelViewShell& m_rPanelViewShell;
+ ::boost::scoped_ptr< ::sfx2::ModuleTaskPane > m_pTaskPane;
+ //::boost::scoped_ptr< ToolPanelDeck > m_pPanelDeck;
+ ::rtl::Reference< ConfigurationListener > m_pConfigListener;
+ PanelSelectorLayout m_eCurrentLayout;
+ bool m_bInitialized;
};
// =====================================================================================================================
@@ -335,17 +318,6 @@ void SAL_CALL ConfigurationListener::notifyConfigurationChange( const Configurat
::osl::MutexGuard aGuard( m_aMutex );
impl_checkDisposed_throw();
-// if ( i_rEvent.Type == FrameworkHelper::msConfigurationUpdateStartEvent )
-// {
-// m_pShellImpl->GetPanelDeck().SetUpdateMode( FALSE );
-// return;
-// }
-// if ( i_rEvent.Type == FrameworkHelper::msConfigurationUpdateEndEvent )
-// {
-// m_pShellImpl->GetPanelDeck().SetUpdateMode( TRUE );
-// return;
-// }
-//
// is this an event we're interested in?
if ( i_rEvent.Type != FrameworkHelper::msResourceActivationEvent )
return;
@@ -360,7 +332,7 @@ void SAL_CALL ConfigurationListener::notifyConfigurationChange( const Configurat
if ( sAnchorURL != FrameworkHelper::msTaskPaneURL )
return;
- m_pShellImpl->OnToolPanelActivationRequest( i_rEvent.ResourceId->getResourceURL() );
+ m_pShellImpl->ActivatePanelByResource( i_rEvent.ResourceId->getResourceURL() );
}
// ---------------------------------------------------------------------------------------------------------------------
@@ -410,75 +382,17 @@ SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL))
TYPEINIT1(ToolPanelViewShell, ViewShell);
// ---------------------------------------------------------------------------------------------------------------------
-ToolPanelViewShell_Impl::PanelActivation ToolPanelViewShell_Impl::SetupDefaultPanels()
+ToolPanelViewShell_Impl::InitialPanel ToolPanelViewShell_Impl::DetermineInitialPanel()
{
- typedef std::auto_ptr<ControlFactory> (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell );
-
- struct PanelDescriptor
- {
- ControlFactoryFactory pFactory;
- const sal_Char* pImageCommandName;
- USHORT nTitleResourceID;
- ULONG nHelpID;
- PanelId nPanelID;
- ::rtl::OUString sResourceURL;
- };
-
- PanelDescriptor aPanels[] =
- {
- // "Master Pages"
- { &controls::MasterPagesPanel::CreateControlFactory,
- "PresentationLayout",
- STR_TASKPANEL_MASTER_PAGE_TITLE,
- HID_SD_SLIDE_DESIGNS,
- PID_MASTER_PAGES,
- FrameworkHelper::msMasterPagesTaskPanelURL
- },
- // "Layout"
- { &LayoutMenu::CreateControlFactory,
- "ModifyPage",
- STR_TASKPANEL_LAYOUT_MENU_TITLE,
- HID_SD_SLIDE_LAYOUTS,
- PID_LAYOUT,
- FrameworkHelper::msLayoutTaskPanelURL
- },
- // "Tables Design"
- { &controls::TableDesignPanel::CreateControlFactory,
- "InsertTable",
- DLG_TABLEDESIGNPANE,
- HID_SD_TABLE_DESIGN,
- PID_TABLE_DESIGN,
- FrameworkHelper::msTableDesignPanelURL
- },
- // "Custom Animation"
- { &controls::CustomAnimationPanel::CreateControlFactory,
- "CustomAnimation",
- STR_CUSTOMANIMATIONPANE,
- HID_SD_CUSTOM_ANIMATIONS,
- PID_CUSTOM_ANIMATION,
- FrameworkHelper::msCustomAnimationTaskPanelURL
- },
- // "Slide Transition"
- { &controls::SlideTransitionPanel::CreateControlFactory,
- "RehearseTimings",
- STR_SLIDE_TRANSITION_PANE,
- HID_SD_SLIDE_TRANSITIONS,
- PID_SLIDE_TRANSITION,
- FrameworkHelper::msSlideTransitionTaskPanelURL
- }
- };
-
- // 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 ) );
-
- // determine which panel should be activated initially.
- // Default to PID_LAYOUT, but check whether the requested configuration already contains a tool panel, in this case,
+ // Default to Layout panel, but check whether the requested configuration already contains a tool panel, in this case,
// use that one.
- PanelId nPanelToActivate = PID_LAYOUT;
- PanelActivation aPanelToActivate;
+ InitialPanel aPanelToActivate;
+ aPanelToActivate.sPanelResourceURL = FrameworkHelper::msLayoutTaskPanelURL;
+ aPanelToActivate.bActivateDirectly = false;
try
{
+ ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) );
+ const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) );
Reference< XConfigurationController > xCC( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW );
Reference< XConfiguration > xConfiguration( xCC->getRequestedConfiguration(), UNO_QUERY_THROW );
Sequence< Reference< XResourceId > > aViewIds( xConfiguration->getResources(
@@ -491,8 +405,8 @@ ToolPanelViewShell_Impl::PanelActivation ToolPanelViewShell_Impl::SetupDefaultPa
PanelId nRequestedPanel = GetStandardPanelId( sResourceURL );
if ( nRequestedPanel != PID_UNKNOWN )
{
- nPanelToActivate = nRequestedPanel;
- aPanelToActivate.bActivateAsResource = false;
+ aPanelToActivate.sPanelResourceURL = sResourceURL;
+ aPanelToActivate.bActivateDirectly = true;
}
}
}
@@ -500,95 +414,36 @@ ToolPanelViewShell_Impl::PanelActivation ToolPanelViewShell_Impl::SetupDefaultPa
{
DBG_UNHANDLED_EXCEPTION();
}
-
- // create the panels
- Reference< XFrame > xFrame( m_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() );
- const BOOL bHiContrast( m_pPanelDeck->GetSettings().GetStyleSettings().GetHighContrastMode() );
- for ( size_t i=0; i < sizeof( aPanels ) / sizeof( aPanels[0] ); ++i )
- {
- // compose the command name, and obtain the image for it
- ::rtl::OUStringBuffer aCommandName;
- aCommandName.appendAscii( ".uno:" );
- aCommandName.appendAscii( aPanels[i].pImageCommandName );
- const Image aPanelImage( GetImage( xFrame, aCommandName.makeStringAndClear(), FALSE, bHiContrast ) );
-
- // compose the resource ID of the panel
- const Reference< XResourceId > xPanelId( pFrameworkHelper->CreateResourceId( aPanels[i].sResourceURL, xToolPanelId ) );
-
- // create and insert the panel
- ::std::auto_ptr< ControlFactory > pControlFactory( (*aPanels[i].pFactory)( m_rPanelViewShell ) );
- ::svt::PToolPanel pNewPanel( new StandardToolPanel(
- *m_pPanelDeck,
- pControlFactory,
- 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, pNewPanel );
-
- if ( nPanelToActivate == aPanels[i].nPanelID )
- aPanelToActivate.nPanelPos = nPanelPos;
- }
-
return aPanelToActivate;
}
// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::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_Impl::Setup()
{
if ( m_bInitialized )
return;
m_bInitialized = true;
- // standard (built-in) panels
- const PanelActivation aPanelToActivate = SetupDefaultPanels();
-
- // custom panels
- SetupCustomPanels();
-
- // activate default panel
- if ( aPanelToActivate.bActivateAsResource )
- m_pPanelDeck->ActivatePanelResource( aPanelToActivate.nPanelPos );
- else
- m_pPanelDeck->ActivatePanelDirectly( aPanelToActivate.nPanelPos );
+ // initially activate a panel
+ const InitialPanel aInitialPanel = DetermineInitialPanel();
+ if ( aInitialPanel.sPanelResourceURL.getLength() )
+ {
+ if ( aInitialPanel.bActivateDirectly )
+ {
+ ActivatePanelByResource( aInitialPanel.sPanelResourceURL );
+ }
+ else
+ {
+ ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) );
+ const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId(
+ FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL, aInitialPanel.sPanelResourceURL ) );
+ pFrameworkHelper->GetConfigurationController()->requestResourceActivation(
+ xToolPanelId, ResourceActivationMode_REPLACE );
+ }
+ }
- // add as listener to the panel deck
- m_pPanelDeck->AddListener( *this );
+// // add as listener to the panel deck
+// m_pPanelDeck->AddListener( *this );
// initialize panel selector
SetLayout( LAYOUT_DRAWERS, true );
@@ -596,7 +451,7 @@ void ToolPanelViewShell_Impl::Setup()
// listen at the configuration
m_pConfigListener.set( new ConfigurationListener( *this ) );
- m_pPanelDeck->Show();
+ m_pTaskPane->Show();
}
// ---------------------------------------------------------------------------------------------------------------------
@@ -605,24 +460,24 @@ void ToolPanelViewShell_Impl::SetLayout( const PanelSelectorLayout i_eLayout, co
if ( !i_bForce && ( m_eCurrentLayout == i_eLayout ) )
return;
- switch ( i_eLayout )
- {
- case LAYOUT_DRAWERS:
- m_pPanelDeck->SetDrawersLayout();
- break;
- case LAYOUT_TABS_TOP:
- m_pPanelDeck->SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY );
- break;
- case LAYOUT_TABS_BOTTOM:
- m_pPanelDeck->SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY );
- break;
- case LAYOUT_TABS_LEFT:
- m_pPanelDeck->SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY );
- break;
- case LAYOUT_TABS_RIGHT:
- m_pPanelDeck->SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY );
- break;
- }
+// switch ( i_eLayout )
+// {
+// case LAYOUT_DRAWERS:
+// m_pPanelDeck->SetDrawersLayout();
+// break;
+// case LAYOUT_TABS_TOP:
+// m_pPanelDeck->SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY );
+// break;
+// case LAYOUT_TABS_BOTTOM:
+// m_pPanelDeck->SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY );
+// break;
+// case LAYOUT_TABS_LEFT:
+// m_pPanelDeck->SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY );
+// break;
+// case LAYOUT_TABS_RIGHT:
+// m_pPanelDeck->SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY );
+// break;
+// }
m_eCurrentLayout = i_eLayout;
UpdateDockingWindowTitle();
}
@@ -632,56 +487,45 @@ void ToolPanelViewShell_Impl::Cleanup()
{
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();
-
- if ( m_pConfigListener.is() )
- m_pConfigListener->dispose();
+// 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();
+//
+// if ( m_pConfigListener.is() )
+// m_pConfigListener->dispose();
}
- m_pPanelDeck.reset();
+// m_pPanelDeck.reset();
+ m_pTaskPane.reset();
}
// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::OnToolPanelActivationRequest( const ::rtl::OUString& i_rResourceURL )
+void ToolPanelViewShell_Impl::ActivatePanelByResource( const ::rtl::OUString& i_rResourceURL )
{
- // look up the panel which belongs to the given resource
- for ( size_t i=0; i<GetPanelCount(); ++i )
- {
- const PanelDescriptor& rPanel = GetPanel( i );
- const TaskPaneToolPanel* pPanel( dynamic_cast< const TaskPaneToolPanel* >( rPanel.pPanel.get() ) );
- ENSURE_OR_CONTINUE( pPanel != NULL, "ToolPanelViewShell::OnToolPanelActivationRequest: illegal panel implementation!" );
-
- Reference< XResourceId > xPanelId( pPanel->getResourceId() );
- ::rtl::OUString sPanelURL( xPanelId.is() ? xPanelId->getResourceURL() : ::rtl::OUString() );
- ENSURE_OR_CONTINUE( sPanelURL.getLength(), "illegal panel resource!" );
+ // determine position of the requested panel
+ ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rResourceURL );
+ OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::ActivatePanelByResource: illegal panel resource, or illegal panel deck setup!" );
+ if ( !!aPanelPos )
+ GetToolPanelDeck().ActivatePanel( *aPanelPos );
+}
- if ( sPanelURL == i_rResourceURL )
- {
- CustomToolPanel* pCustomPanel = dynamic_cast< CustomToolPanel* >( rPanel.pPanel.get() );
- OSL_ENSURE( ( pCustomPanel != NULL ) == ( rPanel.nId >= PID_FIRST_CUSTOM_PANEL ),
- "ToolPanelViewShell::OnToolPanelActivationRequest: inconsistency!" );
- if ( pCustomPanel != NULL )
- {
- // if that's a custom tool panel, then temporarily disable the access of the tool panel implementation
- // to the XPane object. Otherwise, it would request this resource from the configuration controller during
- // the below ActivatePanelDirectly call, which would fail, since the resource is just to be created.
- pCustomPanel->LockResourceAccess();
- }
- ActivatePanelDirectly( rPanel.nId );
- if ( pCustomPanel != NULL )
- {
- pCustomPanel->UnlockResourceAccess();
- }
- }
+// ---------------------------------------------------------------------------------------------------------------------
+void ToolPanelViewShell_Impl::DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL )
+{
+ // determine position of the requested panel
+ ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rPanelResourceURL );
+ OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::DeactivatePanelByResource: illegal panel resource, or illegal panel deck setup!" );
+ if ( !!aPanelPos )
+ {
+ if ( GetToolPanelDeck().GetActivePanel() == *aPanelPos )
+ GetToolPanelDeck().ActivatePanel( ::boost::optional< size_t >() );
}
}
@@ -775,7 +619,7 @@ void ToolPanelViewShell::ArrangeGUIElements()
Initialize();
- mpImpl->GetPanelDeck().SetPosSizePixel( Point(), maViewSize );
+ mpImpl->GetTaskPane().SetPosSizePixel( Point(), maViewSize );
}
// ---------------------------------------------------------------------------------------------------------------------
@@ -796,8 +640,8 @@ void ToolPanelViewShell::KeyInput( const KeyEvent& i_rKeyEvent )
const KeyCode nCode = i_rKeyEvent.GetKeyCode();
if ( nCode == KEY_RETURN )
{
- if ( !mpImpl->GetPanelDeck().HasChildPathFocus() )
- mpImpl->GetPanelDeck().GrabFocus();
+ if ( !mpImpl->GetTaskPane().HasChildPathFocus() )
+ mpImpl->GetTaskPane().GrabFocus();
}
else
ViewShell::KeyInput( i_rKeyEvent, NULL );
@@ -921,14 +765,14 @@ IMPL_LINK(ToolPanelViewShell, MenuSelectHandler, Menu*, pMenu)
// Add one entry for every tool panel element to individually make
// them visible or hide them.
USHORT nIndex = MID_FIRST_PANEL;
- for ( size_t i=0; i<mpImpl->GetPanelCount(); ++i, ++nIndex )
- {
- const PanelDescriptor& rPanelDesc( mpImpl->GetPanel(i) );
- pMenu->InsertItem( nIndex, rPanelDesc.pPanel->GetDisplayName(), MIB_CHECKABLE );
- pMenu->SetUserValue( nIndex, rPanelDesc.nId );
- pMenu->CheckItem( nIndex, !rPanelDesc.bHidden );
- }
- pMenu->InsertSeparator();
+// for ( size_t i=0; i<mpImpl->GetPanelCount(); ++i, ++nIndex )
+// {
+// const PanelDescriptor& rPanelDesc( mpImpl->GetPanel(i) );
+// pMenu->InsertItem( nIndex, rPanelDesc.pPanel->GetDisplayName(), MIB_CHECKABLE );
+// pMenu->SetUserValue( nIndex, rPanelDesc.nId );
+// pMenu->CheckItem( nIndex, !rPanelDesc.bHidden );
+// }
+// pMenu->InsertSeparator();
#if OSL_DEBUG_LEVEL > 0
pMenu->InsertItem( MID_LAYOUT_TABS, String::CreateFromAscii( "Tab-Layout (exp.)" ), MIB_CHECKABLE );
@@ -1030,15 +874,15 @@ void ToolPanelViewShell::ConnectToDockingWindow()
// Tell the focus manager that we want to pass the focus to our
// child.
- FocusManager::Instance().RegisterDownLink( GetParentWindow(), &mpImpl->GetPanelDeck() );
+ FocusManager::Instance().RegisterDownLink( GetParentWindow(), &mpImpl->GetTaskPane() );
}
// ---------------------------------------------------------------------------------------------------------------------
bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow )
{
::Window* pOldParentWindow = GetParentWindow();
- FocusManager::Instance().RemoveLinks( pOldParentWindow, &mpImpl->GetPanelDeck() );
- FocusManager::Instance().RemoveLinks( &mpImpl->GetPanelDeck(), pOldParentWindow );
+ FocusManager::Instance().RemoveLinks( pOldParentWindow, &mpImpl->GetTaskPane() );
+ FocusManager::Instance().RemoveLinks( &mpImpl->GetTaskPane(), pOldParentWindow );
PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() );
if ( pDockingWindow != NULL )
@@ -1055,36 +899,91 @@ bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow )
return true;
}
-// ---------------------------------------------------------------------------------------------------------------------
-::Window* ToolPanelViewShell::GetToolPanelParentWindow()
+//---------------------------------------------------------------------------------------------------------------------
+bool ToolPanelViewShell::IsPanelAnchorWindow( const ::Window& i_rWindow ) const
+{
+ return &mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() == &i_rWindow;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+namespace
{
- return mpImpl->GetToolPanelParentWindow();
+ typedef std::auto_ptr< ControlFactory > (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell );
+
+ struct PanelFactory
+ {
+ ControlFactoryFactory pFactory;
+ ULONG nHelpID;
+ PanelFactory( const ControlFactoryFactory i_pFactory, const ULONG i_nHelpID )
+ :pFactory( i_pFactory )
+ ,nHelpID( i_nHelpID )
+ {
+ }
+ };
+
+ const PanelFactory lcl_describePanel( const PanelId i_ePanelId )
+ {
+ switch ( i_ePanelId )
+ {
+ case PID_MASTER_PAGES:
+ return PanelFactory( &controls::MasterPagesPanel::CreateControlFactory, HID_SD_SLIDE_DESIGNS );
+ case PID_LAYOUT:
+ return PanelFactory( &LayoutMenu::CreateControlFactory, HID_SD_SLIDE_LAYOUTS );
+ case PID_TABLE_DESIGN:
+ return PanelFactory( &controls::TableDesignPanel::CreateControlFactory, HID_SD_TABLE_DESIGN );
+ case PID_CUSTOM_ANIMATION:
+ return PanelFactory( &controls::CustomAnimationPanel::CreateControlFactory, HID_SD_CUSTOM_ANIMATIONS );
+ case PID_SLIDE_TRANSITION:
+ return PanelFactory( &controls::SlideTransitionPanel::CreateControlFactory, HID_SD_SLIDE_TRANSITIONS );
+ default:
+ break;
+ }
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "illegal panel ID" ) ), NULL );
+ }
}
//---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::DeactivatePanel( const PanelId i_ePanelId )
+Reference< XUIElement > ToolPanelViewShell::CreatePanelUIElement( const Reference< XFrame >& i_rDocFrame, const ::rtl::OUString& i_rPanelResourceURL )
{
- mpImpl->DeactivatePanelDirectly( i_ePanelId );
+ const PanelId ePanelId( GetStandardPanelId( i_rPanelResourceURL ) );
+ ENSURE_OR_RETURN( ePanelId != PID_UNKNOWN, "ToolPanelViewShell::CreatePanelUIElement: illegal panel URL!", NULL );
+
+ // a TreeNode which will resemble the panel
+ const PanelFactory aPanelFactory( lcl_describePanel( ePanelId ) );
+ ::std::auto_ptr< ControlFactory > pControlFactory( (*aPanelFactory.pFactory)( *this ) );
+ ::std::auto_ptr< TreeNode > pNode( pControlFactory->CreateControl( mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() ) );
+ ENSURE_OR_THROW( ( pNode.get() != NULL ) && ( pNode->GetWindow() != NULL ),
+ "illegal node returned by the control factory" );
+ pNode->GetWindow()->SetHelpId( aPanelFactory.nHelpID );
+
+ // create an XToolPanel
+ Reference< XToolPanel > xPanel( new ToolPanel( pNode ) );
+
+ // create an XUIElement providing this panel
+ const Reference< XUIElement > xUIElement( new ToolPanelUIElement( i_rDocFrame, i_rPanelResourceURL, xPanel ) );
+
+ return xUIElement;
}
// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::ActivatePanel( const PanelId i_ePanelId )
+void ToolPanelViewShell::DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL )
{
- mpImpl->ActivatePanelDirectly( i_ePanelId );
+ mpImpl->DeactivatePanelByResource( i_rPanelResourceURL );
}
-
// =====================================================================================================================
// = ToolPanelViewShell_Impl - implementation
// =====================================================================================================================
// ---------------------------------------------------------------------------------------------------------------------
ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent )
- :m_aPanels()
- ,m_rPanelViewShell( i_rPanelViewShell )
- ,m_pPanelDeck( new ToolPanelDeck( i_rPanelDeckParent, i_rPanelViewShell ) )
+ :m_rPanelViewShell( i_rPanelViewShell )
+ ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ) )
,m_eCurrentLayout( LAYOUT_DRAWERS )
,m_bInitialized( false )
{
+ const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) );
+ GetToolPanelDeck().SetAccessibleName( sPaneTitle );
+ GetToolPanelDeck().SetAccessibleDescription( sPaneTitle );
}
// ---------------------------------------------------------------------------------------------------------------------
@@ -1095,72 +994,30 @@ ToolPanelViewShell_Impl::~ToolPanelViewShell_Impl()
// ---------------------------------------------------------------------------------------------------------------------
void ToolPanelViewShell_Impl::TogglePanelVisibility( const size_t i_nLogicalPanelIndex )
{
- ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanels.size(), "illegal index" );
-
- // get the actual panel index, within the deck
- size_t nActualPanelIndex(0);
- for ( size_t i=0; i < i_nLogicalPanelIndex; ++i )
- {
- if ( !m_aPanels[i].bHidden )
- ++nActualPanelIndex;
- }
- if ( m_aPanels[ i_nLogicalPanelIndex ].bHidden )
- {
- OSL_VERIFY( m_pPanelDeck->InsertPanel( m_aPanels[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex );
- // if there has not been an active panel before, activate the newly inserted one
- ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() );
- if ( !aActivePanel )
- m_pPanelDeck->ActivatePanelResource( nActualPanelIndex );
- }
- else
- {
- OSL_VERIFY( m_pPanelDeck->RemovePanel( nActualPanelIndex ).get() == m_aPanels[ i_nLogicalPanelIndex ].pPanel.get() );
- }
- m_aPanels[ i_nLogicalPanelIndex ].bHidden = !m_aPanels[ i_nLogicalPanelIndex ].bHidden;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::DeactivatePanelDirectly( const PanelId i_nPanelId )
-{
- for ( size_t i=0; i<m_aPanels.size(); ++i )
- {
- if ( m_aPanels[i].nId == i_nPanelId )
- {
- if ( m_pPanelDeck->GetActivePanel() == i )
- m_pPanelDeck->ActivatePanelDirectly( ::boost::optional< size_t >() );
- return;
- }
- }
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::ActivatePanelDirectly( const PanelId i_nPanelId )
-{
- size_t nActualPanelIndex(0);
- for ( size_t i=0; i<m_aPanels.size(); ++i )
- {
- if ( m_aPanels[i].nId == i_nPanelId )
- {
- if ( m_aPanels[i].bHidden )
- TogglePanelVisibility( i );
- m_pPanelDeck->ActivatePanelDirectly( nActualPanelIndex );
- return;
- }
- if ( !m_aPanels[i].bHidden )
- ++nActualPanelIndex;
- }
- OSL_ENSURE( false, "ToolPanelViewShell::ActivatePanelDirectly: don't have a panel with the given ID!" );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::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_Impl::RegisterPanel: "
- "already registered a panel for this ID!" );
- m_aPanels[ i_nPosition ] = PanelDescriptor( i_nPanelId, i_rPanel );
+ OSL_ENSURE( false, "ToolPanelViewShell_Impl::TogglePanelVisibility: not yet re-implemented!" );
+// ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanels.size(), "illegal index" );
+//
+// // get the actual panel index, within the deck
+// size_t nActualPanelIndex(0);
+// for ( size_t i=0; i < i_nLogicalPanelIndex; ++i )
+// {
+// if ( !m_aPanels[i].bHidden )
+// ++nActualPanelIndex;
+// }
+// if ( m_aPanels[ i_nLogicalPanelIndex ].bHidden )
+// {
+// OSL_VERIFY( m_pPanelDeck->InsertPanel( m_aPanels[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex );
+// // if there has not been an active panel before, activate the newly inserted one
+// ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() );
+// if ( !aActivePanel )
+// m_pPanelDeck->ActivatePanelResource( nActualPanelIndex );
+// }
+// else
+// {
+// OSL_VERIFY( m_pPanelDeck->RemovePanel( nActualPanelIndex ).get() == m_aPanels[ i_nLogicalPanelIndex ].pPanel.get() );
+// }
+// m_aPanels[ i_nLogicalPanelIndex ].bHidden = !m_aPanels[ i_nLogicalPanelIndex ].bHidden;
+ (void)i_nLogicalPanelIndex;
}
// ---------------------------------------------------------------------------------------------------------------------
@@ -1179,28 +1036,28 @@ void ToolPanelViewShell_Impl::PanelRemoved( const size_t i_nPosition )
// ---------------------------------------------------------------------------------------------------------------------
void ToolPanelViewShell_Impl::UpdateDockingWindowTitle()
{
- PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( m_rPanelViewShell.GetDockingWindow() );
- ENSURE_OR_RETURN_VOID( pDockingWindow, "ToolPanelViewShell_Impl::UpdateDockingWindowTitle: no PaneDockingWindow!?" );
-
- ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() );
- if ( !aActivePanel || ( GetLayout() == LAYOUT_DRAWERS ) )
- pDockingWindow->SetTitle( String( SdResId( STR_RIGHT_PANE_TITLE ) ) );
- else
- {
- size_t nNewActive( *aActivePanel );
- for ( size_t i=0; i < m_aPanels.size(); ++i )
- {
- if ( m_aPanels[i].bHidden )
- continue;
-
- if ( !nNewActive )
- {
- pDockingWindow->SetTitle( m_aPanels[i].pPanel->GetDisplayName() );
- break;
- }
- --nNewActive;
- }
- }
+// PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( m_rPanelViewShell.GetDockingWindow() );
+// ENSURE_OR_RETURN_VOID( pDockingWindow, "ToolPanelViewShell_Impl::UpdateDockingWindowTitle: no PaneDockingWindow!?" );
+//
+// ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() );
+// if ( !aActivePanel || ( GetLayout() == LAYOUT_DRAWERS ) )
+// pDockingWindow->SetTitle( String( SdResId( STR_RIGHT_PANE_TITLE ) ) );
+// else
+// {
+// size_t nNewActive( *aActivePanel );
+// for ( size_t i=0; i < m_aPanels.size(); ++i )
+// {
+// if ( m_aPanels[i].bHidden )
+// continue;
+//
+// if ( !nNewActive )
+// {
+// pDockingWindow->SetTitle( m_aPanels[i].pPanel->GetDisplayName() );
+// break;
+// }
+// --nNewActive;
+// }
+// }
}
// ---------------------------------------------------------------------------------------------------------------------
@@ -1230,9 +1087,11 @@ void ToolPanelViewShell_Impl::Dying()
// ---------------------------------------------------------------------------------------------------------------------
Reference< XAccessible > ToolPanelViewShell_Impl::CreateAccessible( ::sd::Window& i_rWindow )
{
- ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow();
- m_pPanelDeck->SetAccessibleParentWindow( pAccessibleParent );
- return m_pPanelDeck->GetAccessible();
+// ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow();
+// m_pPanelDeck->SetAccessibleParentWindow( pAccessibleParent );
+// return m_pPanelDeck->GetAccessible();
+ (void)i_rWindow;
+ return Reference< XAccessible >();
}
// ---------------------------------------------------------------------------------------------------------------------
diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk
index f9cd156855d0..a50355d18145 100644
--- a/sd/source/ui/toolpanel/makefile.mk
+++ b/sd/source/ui/toolpanel/makefile.mk
@@ -58,11 +58,10 @@ SLOFILES = \
$(SLO)$/TaskPaneFocusManager.obj \
$(SLO)$/TaskPaneShellManager.obj \
$(SLO)$/TaskPaneTreeNode.obj \
+ $(SLO)$/ToolPanel.obj \
$(SLO)$/ToolPanelViewShell.obj \
- $(SLO)$/ToolPanelDeck.obj \
- $(SLO)$/TaskPaneToolPanel.obj \
- $(SLO)$/CustomToolPanel.obj \
- $(SLO)$/StandardToolPanel.obj \
+ $(SLO)$/ToolPanelFactory.obj \
+ $(SLO)$/ToolPanelUIElement.obj \
\
$(SLO)$/EmptyWindow.obj \
$(SLO)$/LayoutMenu.obj \
diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx
index 959f22e30cf1..4ce4590ff07d 100644
--- a/sd/source/ui/unoidl/facreg.cxx
+++ b/sd/source/ui/unoidl/facreg.cxx
@@ -145,6 +145,17 @@ extern uno::Sequence<OUString> SAL_CALL PresentationFactoryProvider_getSupported
} }
+namespace sd { namespace toolpanel {
+
+extern uno::Reference<uno::XInterface> SAL_CALL ToolPanelFactory_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString ToolPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL ToolPanelFactory_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+} }
+
namespace sd { namespace presenter {
extern uno::Reference<uno::XInterface> SAL_CALL SlideRenderer_createInstance(
const uno::Reference<uno::XComponentContext>& rxContext)
@@ -202,6 +213,7 @@ using namespace ::sd;
using namespace ::sd::framework;
using namespace ::sd::presenter;
using namespace ::sd::slidesorter;
+using namespace ::sd::toolpanel;
@@ -225,6 +237,7 @@ enum FactoryId
BasicToolBarFactoryFactoryId,
BasicViewFactoryFactoryId,
TaskPanelFactoryFactoryId,
+ ToolPanelFactoryFactoryId,
ResourceIdFactoryId,
PresentationFactoryProviderFactoryId,
SlideRendererFactoryId,
@@ -256,6 +269,7 @@ static ::boost::shared_ptr<FactoryMap> spFactoryMap;
(*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId;
(*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId;
(*spFactoryMap)[TaskPanelFactory_getImplementationName()] = TaskPanelFactoryFactoryId;
+ (*spFactoryMap)[ToolPanelFactory_getImplementationName()] = ToolPanelFactoryFactoryId;
(*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId;
(*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId;
(*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId;
@@ -338,6 +352,10 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
sd::framework::TaskPanelFactory_getSupportedServiceNames());
writeInfo(
pKey,
+ sd::toolpanel::ToolPanelFactory_getImplementationName(),
+ sd::toolpanel::ToolPanelFactory_getSupportedServiceNames());
+ writeInfo(
+ pKey,
sd::framework::ResourceId_getImplementationName(),
sd::framework::ResourceId_getSupportedServiceNames());
writeInfo(
@@ -487,6 +505,13 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
sd::framework::TaskPanelFactory_getSupportedServiceNames());
break;
+ case ToolPanelFactoryFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::toolpanel::ToolPanelFactory_createInstance,
+ sd::toolpanel::ToolPanelFactory_getImplementationName(),
+ sd::toolpanel::ToolPanelFactory_getSupportedServiceNames());
+ break;
+
case ResourceIdFactoryId:
xComponentFactory = ::cppu::createSingleComponentFactory(
sd::framework::ResourceId_createInstance,
diff --git a/sd/source/ui/view/drvwshrg.cxx b/sd/source/ui/view/drvwshrg.cxx
index 5366c5c1668b..ce0e9f0be16f 100644
--- a/sd/source/ui/view/drvwshrg.cxx
+++ b/sd/source/ui/view/drvwshrg.cxx
@@ -83,6 +83,7 @@ SFX_IMPL_INTERFACE(DrawViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL))
{
SFX_POPUPMENU_REGISTRATION( SdResId(RID_DRAW_TEXTOBJ_INSIDE_POPUP) );
SFX_CHILDWINDOW_CONTEXT_REGISTRATION( SID_NAVIGATOR );
+ SFX_CHILDWINDOW_REGISTRATION( SID_TASKPANE );
SFX_CHILDWINDOW_REGISTRATION( SfxTemplateDialogWrapper::GetChildWindowId() );
SFX_CHILDWINDOW_REGISTRATION( SvxFontWorkChildWindow::GetChildWindowId() );
SFX_CHILDWINDOW_REGISTRATION( SvxColorChildWindow::GetChildWindowId() );