summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-06-03 18:53:52 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-06-03 18:53:52 +0200
commit76db982b9162045ffa72dbc63c92211de0bf3936 (patch)
tree59eac097cb3e7640f8ca4bf2531d25934037e6b8 /sfx2
parentbba2a81a5e2215591d8f29e69bd64d0e31fc23b1 (diff)
parentf39e88f23e8491e8e450796b000dd5c712cae3dd (diff)
slidecopy: merge after copying in CWS renaissance2
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/imagemgr.hxx2
-rw-r--r--sfx2/inc/pch/precompiled_sfx2.hxx2
-rw-r--r--sfx2/inc/sfx2/childwin.hxx42
-rw-r--r--sfx2/inc/sfx2/filedlghelper.hxx24
-rw-r--r--sfx2/inc/sfx2/module.hxx2
-rw-r--r--sfx2/inc/sfx2/sfxsids.hrc1
-rw-r--r--sfx2/inc/sfx2/taskpane.hxx245
-rw-r--r--sfx2/inc/sfx2/titledockwin.hxx162
-rw-r--r--sfx2/inc/sfx2/viewfrm.hxx66
-rw-r--r--sfx2/prj/build.lst2
-rw-r--r--sfx2/sdi/frmslots.sdi5
-rw-r--r--sfx2/sdi/sfx.sdi27
-rw-r--r--sfx2/source/appl/app.cxx1
-rw-r--r--sfx2/source/appl/appinit.cxx2
-rw-r--r--sfx2/source/appl/appreg.cxx1
-rw-r--r--sfx2/source/appl/imagemgr.cxx2
-rw-r--r--sfx2/source/appl/module.cxx13
-rw-r--r--sfx2/source/appl/workwin.cxx107
-rw-r--r--sfx2/source/dialog/dialog.hrc31
-rw-r--r--sfx2/source/dialog/dialog.src157
-rw-r--r--sfx2/source/dialog/makefile.mk15
-rw-r--r--sfx2/source/dialog/taskpane.cxx1283
-rw-r--r--sfx2/source/dialog/taskpane.src (renamed from sfx2/source/dialog/sfxurl.cxx)32
-rw-r--r--sfx2/source/dialog/titledockwin.cxx364
-rw-r--r--sfx2/source/dialog/titledockwin.src39
-rw-r--r--sfx2/source/inc/helpid.hrc3
-rw-r--r--sfx2/source/inc/sfxlocal.hrc12
-rw-r--r--sfx2/source/inc/workwin.hxx1
-rw-r--r--sfx2/source/view/impviewframe.hxx4
-rw-r--r--sfx2/source/view/viewfrm.cxx67
-rw-r--r--sfx2/util/hidother.src1
-rw-r--r--sfx2/win/res/expdesk.icobin4990 -> 0 bytes
-rw-r--r--sfx2/win/res/expexp.icobin2758 -> 0 bytes
-rw-r--r--sfx2/win/res/expfld.icobin2758 -> 0 bytes
-rw-r--r--sfx2/win/res/expftp.icobin2758 -> 0 bytes
-rw-r--r--sfx2/win/res/exptrash.icobin2758 -> 0 bytes
-rw-r--r--sfx2/win/res/expwork.icobin2758 -> 0 bytes
-rw-r--r--sfx2/win/res/frameset.icobin2758 -> 0 bytes
-rw-r--r--sfx2/win/res/search.icobin2758 -> 0 bytes
-rw-r--r--sfx2/workben/custompanel/CalcWindowState.xcu21
-rw-r--r--sfx2/workben/custompanel/DrawWindowState.xcu21
-rw-r--r--sfx2/workben/custompanel/Factories.xcu21
-rw-r--r--sfx2/workben/custompanel/ImpressWindowState.xcu21
-rw-r--r--sfx2/workben/custompanel/WriterWindowState.xcu35
-rw-r--r--sfx2/workben/custompanel/ctp_factory.cxx167
-rw-r--r--sfx2/workben/custompanel/ctp_factory.hxx83
-rw-r--r--sfx2/workben/custompanel/ctp_panel.cxx270
-rw-r--r--sfx2/workben/custompanel/ctp_panel.hxx124
-rw-r--r--sfx2/workben/custompanel/ctp_services.cxx92
-rw-r--r--sfx2/workben/custompanel/delzip0
-rw-r--r--sfx2/workben/custompanel/description.xml16
-rw-r--r--sfx2/workben/custompanel/makefile.mk120
-rw-r--r--sfx2/workben/custompanel/manifest.xml18
-rw-r--r--sfx2/workben/custompanel/panel.pngbin0 -> 202 bytes
54 files changed, 3367 insertions, 357 deletions
diff --git a/sfx2/inc/imagemgr.hxx b/sfx2/inc/imagemgr.hxx
index ead9b6988cea..79dc724210c4 100644
--- a/sfx2/inc/imagemgr.hxx
+++ b/sfx2/inc/imagemgr.hxx
@@ -33,4 +33,4 @@
#include <rtl/ustring.hxx>
#include <vcl/image.hxx>
-SFX2_DLLPUBLIC Image SAL_CALL GetImage( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast );
+SFX2_DLLPUBLIC Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast );
diff --git a/sfx2/inc/pch/precompiled_sfx2.hxx b/sfx2/inc/pch/precompiled_sfx2.hxx
index 8cd8f9d8561f..b43dba7d6673 100644
--- a/sfx2/inc/pch/precompiled_sfx2.hxx
+++ b/sfx2/inc/pch/precompiled_sfx2.hxx
@@ -566,7 +566,7 @@
#include "svl/svdde.hxx"
#include "svl/svstdarr.hxx"
#include "svtools/svtdata.hxx"
-#include "svl/svtools.hrc"
+#include "svtools/svtools.hrc"
#include "unotools/syslocale.hxx"
#include "unotools/syslocaleoptions.hxx"
#include "svl/szitem.hxx"
diff --git a/sfx2/inc/sfx2/childwin.hxx b/sfx2/inc/sfx2/childwin.hxx
index cac0b72f13cf..fd1eb65d54df 100644
--- a/sfx2/inc/sfx2/childwin.hxx
+++ b/sfx2/inc/sfx2/childwin.hxx
@@ -87,13 +87,13 @@ struct SfxChildWinInfo
};
// Factory-Methode eines ChildWindows
-typedef SfxChildWindow* (*SfxChildWinCtor)( Window *pParentWindow,
+typedef SfxChildWindow* (*SfxChildWinCtor)( ::Window *pParentWindow,
sal_uInt16 nId,
SfxBindings *pBindings,
SfxChildWinInfo *pInfo);
// Factory-Methode eines ChildWindowsContexts
-typedef SfxChildWindowContext* (*SfxChildWinContextCtor)( Window *pParentWindow,
+typedef SfxChildWindowContext* (*SfxChildWinContextCtor)( ::Window *pParentWindow,
SfxBindings *pBindings,
SfxChildWinInfo *pInfo);
struct SfxChildWinContextFactory
@@ -143,8 +143,8 @@ struct SfxChildWindow_Impl;
class SFX2_DLLPUBLIC SfxChildWindowContext
{
friend class SfxChildWindow;
- Window* pWindow;
- sal_uInt16 nContextId;
+ ::Window* pWindow;
+ sal_uInt16 nContextId;
protected:
SfxChildWindowContext( sal_uInt16 nId );
@@ -152,9 +152,9 @@ protected:
public:
virtual ~SfxChildWindowContext();
- void SetWindow( Window* pWin )
+ void SetWindow( ::Window* pWin )
{ pWindow=pWin; }
- Window* GetWindow() const
+ ::Window* GetWindow() const
{ return pWindow; }
sal_uInt16 GetContextId() const
{ return nContextId; }
@@ -169,12 +169,12 @@ public:
class SFX2_DLLPUBLIC SfxChildWindow
{
- Window* pParent; // parent window ( Topwindow )
- sal_uInt16 nType; // ChildWindow-Id
+ ::Window* pParent; // parent window ( Topwindow )
+ sal_uInt16 nType; // ChildWindow-Id
protected:
SfxChildAlignment eChildAlignment;// aktuelles ::com::sun::star::drawing::Alignment
- Window* pWindow; // eigentlicher Inhalt
+ ::Window* pWindow; // eigentlicher Inhalt
SfxChildWindow_Impl* pImp; // Imp-Daten
private:
@@ -185,14 +185,14 @@ private:
{ return pContext; }
protected:
- SfxChildWindow(Window *pParentWindow, sal_uInt16 nId);
+ SfxChildWindow(::Window *pParentWindow, sal_uInt16 nId);
public:
virtual ~SfxChildWindow();
void Destroy();
- Window* GetWindow() const
+ ::Window* GetWindow() const
{ return pWindow; }
- Window* GetParent() const
+ ::Window* GetParent() const
{ return pParent; }
SfxChildAlignment GetAlignment() const
{ return eChildAlignment; }
@@ -217,17 +217,17 @@ public:
sal_uInt16 GetContextId() const
{ return pContext ? pContext->GetContextId(): 0; }
- Window* GetContextWindow() const
+ ::Window* GetContextWindow() const
{ return pContext ? pContext->GetWindow(): 0; }
- Window* GetContextWindow( SfxModule *pModule ) const;
+ ::Window* GetContextWindow( SfxModule *pModule ) const;
virtual SfxChildWinInfo GetInfo() const;
void SaveStatus(const SfxChildWinInfo& rInfo);
static void RegisterChildWindow(SfxModule*, SfxChildWinFactory*);
- static SfxChildWindow* CreateChildWindow( sal_uInt16, Window*, SfxBindings*, SfxChildWinInfo&);
+ static SfxChildWindow* CreateChildWindow( sal_uInt16, ::Window*, SfxBindings*, SfxChildWinInfo&);
void SetHideNotDelete( sal_Bool bOn );
sal_Bool IsHideNotDelete() const;
void SetHideAtToggle( sal_Bool bOn );
@@ -258,19 +258,19 @@ public:
//------------------------------------------------------------------
//! demn"achst hinf"allig !
#define SFX_DECL_CHILDWINDOW_CONTEXT(Class) \
- static SfxChildWindowContext* CreateImpl(Window *pParent, \
+ static SfxChildWindowContext* CreateImpl(::Window *pParent, \
SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \
static void RegisterChildWindowContext(SfxModule *pMod=0); \
//! Das Macro der Zukunft ...
#define SFX_DECL_CHILDWINDOWCONTEXT(Class) \
- static SfxChildWindowContext* CreateImpl(Window *pParent, \
+ static SfxChildWindowContext* CreateImpl(::Window *pParent, \
SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \
static void RegisterChildWindowContext(sal_uInt16, SfxModule *pMod=0); \
//! demn"achst hinf"allig !
#define SFX_IMPL_CHILDWINDOW_CONTEXT(Class, MyID, ShellClass) \
- SfxChildWindowContext* __EXPORT Class::CreateImpl( Window *pParent, \
+ SfxChildWindowContext* __EXPORT Class::CreateImpl( ::Window *pParent, \
SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \
{ \
SfxChildWindowContext *pContext = new Class(pParent, \
@@ -290,7 +290,7 @@ public:
// CreateImpl mu\s noch als Parameter die Factory mitbekommen wg. ContextId
// Solange wird diese Id auf 0 gesetzt und in SfxChildWindow::CreateContext gepatched
#define SFX_IMPL_CHILDWINDOWCONTEXT(Class, MyID) \
- SfxChildWindowContext* __EXPORT Class::CreateImpl( Window *pParent, \
+ SfxChildWindowContext* __EXPORT Class::CreateImpl( ::Window *pParent, \
SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \
{ \
SfxChildWindowContext *pContext = new Class(pParent,0,pBindings,pInfo);\
@@ -305,7 +305,7 @@ public:
#define SFX_DECL_CHILDWINDOW(Class) \
public : \
- static SfxChildWindow* CreateImpl(Window *pParent, sal_uInt16 nId, \
+ static SfxChildWindow* CreateImpl(::Window *pParent, sal_uInt16 nId, \
SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \
static void RegisterChildWindow (sal_Bool bVisible=sal_False, SfxModule *pMod=NULL, sal_uInt16 nFlags=0); \
static sal_uInt16 GetChildWindowId ();\
@@ -315,7 +315,7 @@ public:
SFX_IMPL_POS_CHILDWINDOW(Class, MyID, CHILDWIN_NOPOS)
#define SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \
- SfxChildWindow* __EXPORT Class::CreateImpl( Window *pParent, \
+ SfxChildWindow* __EXPORT Class::CreateImpl( ::Window *pParent, \
sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \
{ \
SfxChildWindow *pWin = new Class(pParent, nId, pBindings, pInfo);\
diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx
index d17553e2b2d0..9b775f8e827d 100644
--- a/sfx2/inc/sfx2/filedlghelper.hxx
+++ b/sfx2/inc/sfx2/filedlghelper.hxx
@@ -102,30 +102,6 @@ class Window;
#define FILE_OPEN_SERVICE_NAME_SYSTEM "com.sun.star.ui.dialogs.SystemFilePicker"
#define FILE_OPEN_SERVICE_NAME_OOO "com.sun.star.ui.dialogs.OfficeFilePicker"
-//*****************************************************************************
-// SfxUrlDialog
-//*****************************************************************************
-
-//#if 0 // _SOLAR__PRIVATE
-#ifndef DONT_USE_FILE_DIALOG_SERVICE
-
-class SfxUrlDialog : public ModalDialog
-{
-private:
- Edit aEdit;
- OKButton aOk;
- CancelButton aCancel;
-
-public:
- SfxUrlDialog( Window* pParent );
-
- String GetUrl() const { return aEdit.GetText(); }
- void SetUrl( const String& rUrl ) { aEdit.SetText( rUrl ); }
-};
-
-#endif
-//#endif
-
//-----------------------------------------------------------------------------
namespace sfx2 {
diff --git a/sfx2/inc/sfx2/module.hxx b/sfx2/inc/sfx2/module.hxx
index 793dd8f76cab..ad83bb4a7418 100644
--- a/sfx2/inc/sfx2/module.hxx
+++ b/sfx2/inc/sfx2/module.hxx
@@ -93,6 +93,8 @@ public:
virtual void Invalidate(USHORT nId = 0);
BOOL IsActive() const;
+ /*virtual*/ bool IsChildWindowAvailable( const USHORT i_nId, const SfxViewFrame* i_pViewFrame ) const;
+
static SfxModule* GetActiveModule( SfxViewFrame* pFrame=NULL );
static FieldUnit GetCurrentFieldUnit();
FieldUnit GetFieldUnit() const;
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index bc4c11b53184..41dceafc1756 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -867,6 +867,7 @@
#define SID_HYPERLINK_GETLINK (SID_SVX_START + 361)
#define SID_HYPERLINK_SETLINK (SID_SVX_START + 362)
#define SID_NAVIGATOR (SID_SVX_START + 366)
+#define SID_TASKPANE (SID_SVX_START + 370)
#define SID_ZOOM_NEXT (SID_SVX_START + 402)
#define SID_ZOOM_PREV (SID_SVX_START + 403)
#define SID_INET_DLG (SID_SVX_START + 416)
diff --git a/sfx2/inc/sfx2/taskpane.hxx b/sfx2/inc/sfx2/taskpane.hxx
new file mode 100644
index 000000000000..69ebd866a50b
--- /dev/null
+++ b/sfx2/inc/sfx2/taskpane.hxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ * 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 SFX_TASKPANE_HXX
+#define SFX_TASKPANE_HXX
+
+#include "sfx2/dllapi.h"
+#include "sfx2/childwin.hxx"
+#include "sfx2/titledockwin.hxx"
+
+#include <svtools/toolpanel/tabalignment.hxx>
+#include <svtools/toolpanel/tabitemcontent.hxx>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/optional.hpp>
+
+namespace svt
+{
+ class ToolPanelDeck;
+}
+
+//......................................................................................................................
+namespace sfx2
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ITaskPaneToolPanelAccess
+ //==================================================================================================================
+ class SAL_NO_VTABLE ITaskPaneToolPanelAccess
+ {
+ public:
+ virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) = 0;
+ };
+
+ //==================================================================================================================
+ //= TaskPaneWrapper
+ //==================================================================================================================
+ class SFX2_DLLPUBLIC TaskPaneWrapper :public SfxChildWindow
+ ,public ITaskPaneToolPanelAccess
+ {
+ public:
+ TaskPaneWrapper(
+ Window* i_pParent,
+ USHORT i_nId,
+ SfxBindings* i_pBindings,
+ SfxChildWinInfo* i_pInfo
+ );
+
+ SFX_DECL_CHILDWINDOW( TaskPaneWrapper );
+
+ // ITaskPaneToolPanelAccess
+ virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL );
+ };
+
+ //==================================================================================================================
+ //= IToolPanelCompare
+ //==================================================================================================================
+ class SFX2_DLLPUBLIC SAL_NO_VTABLE IToolPanelCompare
+ {
+ public:
+ /** compares to tool panel URLs
+ @return
+ <ul>
+ <li>-1 if the tool panel described by i_rLHS should precede the one described by i_rRHS</li>
+ <li>0 if the two panels have no particular relative order</li>
+ <li>1 if the tool panel described by i_rLHS should succeed the one described by i_rRHS</li>
+
+ */
+ virtual short compareToolPanelsURLs(
+ const ::rtl::OUString& i_rLHS,
+ const ::rtl::OUString& i_rRHS
+ ) const = 0;
+ };
+
+ //==================================================================================================================
+ //= ModuleTaskPane
+ //==================================================================================================================
+ class ModuleTaskPane_Impl;
+ /** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective
+ module's configuration
+ */
+ class SFX2_DLLPUBLIC ModuleTaskPane : public Window
+ {
+ public:
+ /** creates a new instance
+ @param i_rParentWindow
+ the parent window
+ @param i_rDocumentFrame
+ the frame to which the task pane belongs. Will be passed to any custom tool panels created
+ via an XUIElementFactory. Also, it is used to determine the module which the task pane is
+ responsible for, thus controlling which tool panels are actually available.
+ */
+ ModuleTaskPane(
+ Window& i_rParentWindow,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame
+ );
+ /** creates a new instance
+ @param i_rParentWindow
+ the parent window
+ @param i_rDocumentFrame
+ the frame to which the task pane belongs. Will be passed to any custom tool panels created
+ via an XUIElementFactory. Also, it is used to determine the module which the task pane is
+ responsible for, thus controlling which tool panels are actually available.
+ @param i_rCompare
+ a comparator for tool panel URLs, which allows controlling the order in which the panels are
+ added to the tool panel deck.
+ */
+ ModuleTaskPane(
+ Window& i_rParentWindow,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame,
+ const IToolPanelCompare& i_rCompare
+ );
+ ~ModuleTaskPane();
+
+ /** determines whether a given module has any registered tool panels
+ */
+ static bool ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier );
+ /** determines whether a given module has any registered tool panels
+ */
+ static bool ModuleHasToolPanels( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame );
+
+ /** provides access to the Window aspect of the PanelDeck
+
+ Be careful with this method. For instance, you're not allowed to insert arbitrary IToolPanel implementations
+ into the deck, as the ModuleTaskPane has certain assumptions about the panel implementations. However,
+ you're allowed to remove and re-insert panels, which have originally been created by the ModuleTaskPane
+ itself.
+ */
+ ::svt::ToolPanelDeck& GetPanelDeck();
+ const ::svt::ToolPanelDeck& GetPanelDeck() const;
+
+ /** returns the position of the panel with the given resource URL
+ */
+ ::boost::optional< size_t >
+ GetPanelPos( const ::rtl::OUString& i_rResourceURL );
+
+ /** returns the resource URL of the panel at the specified position
+ */
+ ::rtl::OUString
+ GetPanelResourceURL( const size_t i_nPanelPos ) const;
+
+ /// sets the "classical" layout of the tool panel deck, using drawers
+ void SetDrawersLayout();
+ /// sets the new layout of the tool panel deck, using tabs
+ void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent );
+
+ protected:
+ // Window overridables
+ virtual void Resize();
+ virtual void GetFocus();
+
+ private:
+ ::boost::scoped_ptr< ModuleTaskPane_Impl > m_pImpl;
+ };
+
+ //==================================================================================================================
+ //= TaskPaneController
+ //==================================================================================================================
+ class TaskPaneController_Impl;
+ /** is a helper class for connecting a ModuleTaskPane and a TitledDockingWindow, for clients of the ModuleTaskPane
+ which do not use the TaskPaneDockingWindow
+
+ The controller will add a drop down menu to the docking window which contains one item for each panel in the
+ panel deck, and allows toggling their visibility.
+ */
+ class SFX2_DLLPUBLIC TaskPaneController
+ {
+ public:
+ TaskPaneController(
+ ModuleTaskPane& i_rTaskPane,
+ TitledDockingWindow& i_rDockingWindow
+ );
+ ~TaskPaneController();
+
+ /** sets the default title to be used for the TitledDockingWindow
+
+ When the controller switches the docking window to "tabbed" mode, then the title of the docking window
+ will contain the name of the currently active panel (since this name isn't to be seen elsewhere).
+ When the controller switches the docking window to "drawer" mode, then the title of the docking window
+ contains the default title as given here (since in this mode, the names of the panels are shown in
+ the drawers).
+ */
+ void SetDefaultTitle( const String& i_rTitle );
+
+ /// activates the panel with the given URL
+ void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL );
+
+ private:
+ ::boost::scoped_ptr< TaskPaneController_Impl > m_pImpl;
+ };
+
+ //==================================================================================================================
+ //= TaskPaneDockingWindow
+ //==================================================================================================================
+ class TaskPaneDockingWindow :public TitledDockingWindow
+ ,public ITaskPaneToolPanelAccess
+ {
+ public:
+ TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper,
+ Window* i_pParent, WinBits i_nBits );
+
+ // ITaskPaneToolPanelAccess
+ virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL );
+
+ protected:
+ // Window overridables
+ virtual void GetFocus();
+
+ // TitledDockingWindow overridables
+ virtual void onLayoutDone();
+
+ private:
+ ModuleTaskPane m_aTaskPane;
+ TaskPaneController m_aPaneController;
+ };
+
+//......................................................................................................................
+} // namespace sfx2
+//......................................................................................................................
+
+#endif // SFX_TASKPANE_HXX
diff --git a/sfx2/inc/sfx2/titledockwin.hxx b/sfx2/inc/sfx2/titledockwin.hxx
new file mode 100644
index 000000000000..ebb4497a0ba2
--- /dev/null
+++ b/sfx2/inc/sfx2/titledockwin.hxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ * 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 SFX_TITLEDOCKWIN_HXX
+#define SFX_TITLEDOCKWIN_HXX
+
+#include "sfx2/dllapi.h"
+#include "sfx2/dockwin.hxx"
+
+#include <vcl/toolbox.hxx>
+#include <tools/svborder.hxx>
+
+//......................................................................................................................
+namespace sfx2
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= TitledDockingWindow
+ //==================================================================================================================
+ class SFX2_DLLPUBLIC TitledDockingWindow : public SfxDockingWindow
+ {
+ public:
+ TitledDockingWindow(
+ SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow,
+ Window* i_pParent, WinBits i_nStyle = 0
+ );
+
+ TitledDockingWindow( SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow,
+ Window* i_pParent, const ResId& i_rResId
+ );
+
+ virtual ~TitledDockingWindow();
+
+ /** sets a title to be displayed in the docking window
+ */
+ void SetTitle( const String& i_rTitle );
+ /** returns the current title displayed in the docking window
+
+ Note that if you never called SetTitle before, then this method will not return an empty string,
+ but the window text (Window::GetText), since this is what is displayed as title then.
+ */
+ String GetTitle() const;
+
+ /** adds a drop down item to the toolbox. Usually, this is used to add some kind of menu to the toolbox.
+
+ @param i_rItemText
+ the text to display for the item
+ @param i_nHelpId
+ the help ID for the new toolbox item
+ @param i_rCallback
+ the callback to invoke when the drop item has been clicked
+ @return
+ the ID of the newly created toolbox item
+ */
+ USHORT AddDropDownToolBoxItem( const String& i_rItemText, ULONG i_nHelpId, const Link& i_rCallback )
+ {
+ return impl_addDropDownToolBoxItem( i_rItemText, i_nHelpId, i_rCallback );
+ }
+
+ void SetEndDockingHdl( const Link& i_rEndDockingHdl ) { m_aEndDockingHdl = i_rEndDockingHdl; }
+ const Link& GetEndDockingHdl() const { return m_aEndDockingHdl; }
+
+ /** resets the toolbox. Upon return, the only item in the toolbox is the closer.
+ */
+ void ResetToolBox()
+ {
+ impl_resetToolBox();
+ }
+
+ /** returns the content window, which is to be used as parent window for any content to be displayed
+ in the docking window.
+ */
+ ::Window& GetContentWindow() { return m_aContentWindow; }
+ const ::Window& GetContentWindow() const { return m_aContentWindow; }
+
+ ToolBox& GetToolBox() { return m_aToolbox; }
+ const ToolBox& GetToolBox() const { return m_aToolbox; }
+
+ protected:
+ // Window overridables
+ virtual void Paint( const Rectangle& i_rArea );
+ virtual void Resize();
+ virtual void StateChanged( StateChangedType i_nType );
+ virtual void DataChanged( const DataChangedEvent& i_rDataChangedEvent );
+ virtual void SetText( const String& i_rText );
+
+ // DockingWindow overridables
+ void EndDocking( const Rectangle& rRect, BOOL bFloatMode );
+
+ // own overridables
+ virtual void onLayoutDone();
+
+ protected:
+ /** internal version of ResetToolBox
+ */
+ void impl_resetToolBox();
+
+ /** internal version of AddDropDownToolBoxItem
+ */
+ USHORT impl_addDropDownToolBoxItem( const String& i_rItemText, ULONG i_nHelpId, const Link& i_rCallback );
+
+ /** returns the current title.
+
+ If no title has been set via SetTitle, then the window text (Window::GetText) is returned.
+ */
+ String impl_getTitle() const;
+
+ private:
+ DECL_LINK( OnToolboxItemSelected, ToolBox* );
+
+ void impl_construct();
+ void impl_layout();
+ void impl_scheduleLayout();
+
+ private:
+ String m_sTitle;
+ ToolBox m_aToolbox;
+ Window m_aContentWindow;
+
+ Link m_aEndDockingHdl;
+
+ /** The border that is painted arround the inner window. The bevel
+ shadow lines are part of the border, so where the border is 0 no
+ such line is painted.
+ */
+ SvBorder m_aBorder;
+
+ /** Remember that a layout is pending, i.e. Resize() has been called
+ since the last Paint().
+ */
+ bool m_bLayoutPending;
+ };
+
+//......................................................................................................................
+} // namespace sfx2
+//......................................................................................................................
+
+#endif // SFX_TITLEDOCKWIN_HXX
diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx
index 8350bc5f0f9d..d376236bf830 100644
--- a/sfx2/inc/sfx2/viewfrm.hxx
+++ b/sfx2/inc/sfx2/viewfrm.hxx
@@ -40,6 +40,8 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XController2.hpp>
+#include <tools/svborder.hxx>
+
class SfxMacro;
class SvBorder;
class SfxDispatcher;
@@ -70,67 +72,6 @@ SV_DECL_REF(SfxObjectShell)
#endif
//========================================================================
-#include <tools/gen.hxx>
-class SvBorder
-{
- long nTop, nRight, nBottom, nLeft;
-public:
- SvBorder()
- { nTop = nRight = nBottom = nLeft = 0; }
- SvBorder( const Size & rSz )
- { nTop = nBottom = rSz.Height(); nRight = nLeft = rSz.Width(); }
- SvBorder( const Rectangle & rOuter, const Rectangle & rInner );
- SvBorder( long nLeftP, long nTopP, long nRightP, long nBottomP )
- { nLeft = nLeftP; nTop = nTopP; nRight = nRightP; nBottom = nBottomP; }
- BOOL operator == ( const SvBorder & rObj ) const
- {
- return nTop == rObj.nTop && nRight == rObj.nRight &&
- nBottom == rObj.nBottom && nLeft == rObj.nLeft;
- }
- BOOL operator != ( const SvBorder & rObj ) const
- { return !(*this == rObj); }
- SvBorder & operator = ( const SvBorder & rBorder )
- {
- Left() = rBorder.Left();
- Top() = rBorder.Top();
- Right() = rBorder.Right();
- Bottom() = rBorder.Bottom();
- return *this;
- }
- SvBorder & operator += ( const SvBorder & rBorder )
- {
- Left() += rBorder.Left();
- Top() += rBorder.Top();
- Right() += rBorder.Right();
- Bottom() += rBorder.Bottom();
- return *this;
- }
- SvBorder & operator -= ( const SvBorder & rBorder )
- {
- Left() -= rBorder.Left();
- Top() -= rBorder.Top();
- Right() -= rBorder.Right();
- Bottom() -= rBorder.Bottom();
- return *this;
- }
- BOOL IsInside( const SvBorder & rInside )
- {
- return nTop >= rInside.nTop && nRight >= rInside.nRight &&
- nBottom >= rInside.nBottom && nLeft >= rInside.nLeft;
- }
- long & Top() { return nTop; }
- long & Right() { return nRight; }
- long & Bottom() { return nBottom; }
- long & Left() { return nLeft; }
- long Top() const { return nTop; }
- long Right() const { return nRight; }
- long Bottom() const { return nBottom; }
- long Left() const { return nLeft; }
-};
-Rectangle & operator += ( Rectangle & rRect, const SvBorder & rBorder );
-Rectangle & operator -= ( Rectangle & rRect, const SvBorder & rBorder );
-
-
DBG_NAMEEX(SfxViewFrame)
class SFX2_DLLPUBLIC SfxViewFrame: public SfxShell, public SfxListener
{
@@ -228,6 +169,8 @@ public:
String UpdateTitle();
+ static void ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL );
+
// interne Handler
SAL_DLLPRIVATE virtual BOOL SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder );
SAL_DLLPRIVATE virtual const SvBorder& GetBorderPixelImpl( const SfxViewShell *pSh ) const;
@@ -304,6 +247,7 @@ public:
SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &);
SAL_DLLPRIVATE void SetCurViewId_Impl( const USHORT i_nID );
+ SAL_DLLPRIVATE void ActivateToolPanel_Impl( const ::rtl::OUString& i_rPanelURL );
//#endif
private:
diff --git a/sfx2/prj/build.lst b/sfx2/prj/build.lst
index 3e791fbc2000..763c60810b3e 100644
--- a/sfx2/prj/build.lst
+++ b/sfx2/prj/build.lst
@@ -2,7 +2,6 @@ sf sfx2 : l10n idl basic xmlscript framework shell setup_native sax S
sf sfx2 usr1 - all sf_mkout NULL
sf sfx2\inc nmake - all sf_inc NULL
sf sfx2\prj get - all sf_prj NULL
-sf sfx2\win\res get - all sf_wres NULL
sf sfx2\mac\res get - all sf_mres NULL
sf sfx2\source\inc get - all sf_sinc NULL
sf sfx2\sdi nmake - all sf_sdi NULL
@@ -20,5 +19,6 @@ sf sfx2\source\statbar nmake - all sf_sbar sf_sdi sf_inc NULL
sf sfx2\source\toolbox nmake - all sf_tbox sf_sdi sf_inc NULL
sf sfx2\source\inet nmake - all sf_inet sf_sdi sf_inc NULL
sf sfx2\source\explorer nmake - all sf_expl sf_sdi sf_inc NULL
+sf sfx2\workben\custompanel nmake - all sf_wb_custompanel NULL
sf sfx2\util nmake - all sf_util sf_appl sf_bast sf_cnfg sf_ctrl sf_dlg sf_doc sf_expl sf_inet sf_menu sf_layout sf_noti sf_sbar sf_tbox sf_view NULL
sf sfx2\qa\unoapi nmake - all sf_qa_unoapi NULL
diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi
index c4210b801bf6..dbf9267448e1 100644
--- a/sfx2/sdi/frmslots.sdi
+++ b/sfx2/sdi/frmslots.sdi
@@ -50,6 +50,11 @@ interface Window
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
+ SID_TASKPANE // status(final|play)
+ [
+ ExecMethod = ChildWindowExecute ;
+ StateMethod = ChildWindowState ;
+ ]
SID_SHOW_BROWSER // ole(no) api(final/play/rec)
[
ExecMethod = ChildWindowExecute ;
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 10a920852848..dbe7cdfbb7e1 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -3931,6 +3931,33 @@ SfxBoolItem Navigator SID_NAVIGATOR
ToolBoxConfig = TRUE,
GroupId = GID_NAVIGATOR;
]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TaskPane SID_TASKPANE
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
//--------------------------------------------------------------------------
SfxVoidItem RestoreEditingView SID_RESTORE_EDITING_VIEW
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index d42d203e57f5..6e13894feb49 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -322,6 +322,7 @@ SfxApplication* SfxApplication::GetOrCreate()
::framework::SetStatusBarControllerCreator( SfxStatusBarControllerFactory );
::framework::SetDockingWindowCreator( SfxDockingWindowFactory );
::framework::SetIsDockingWindowVisible( IsDockingWindowVisible );
+ ::framework::SetActivateToolPanel( &SfxViewFrame::ActivateToolPanel );
SfxHelp* pSfxHelp = new SfxHelp;
Application::SetHelp( pSfxHelp );
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index a34a2e0d6a32..08023c5414a6 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -35,7 +35,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <svtools/soerr.hxx>
-#include <svl/svtools.hrc>
+#include <svtools/svtools.hrc>
#include <unotools/saveopt.hxx>
#include <unotools/localisationoptions.hxx>
#include <tools/config.hxx>
diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx
index 47bf98292316..addace134362 100644
--- a/sfx2/source/appl/appreg.cxx
+++ b/sfx2/source/appl/appreg.cxx
@@ -42,6 +42,7 @@
#include "inettbc.hxx"
#include "stbitem.hxx"
#include <sfx2/navigat.hxx>
+#include <sfx2/taskpane.hxx>
#include <sfx2/module.hxx>
#include <sfx2/viewfrm.hxx>
#include "partwnd.hxx"
diff --git a/sfx2/source/appl/imagemgr.cxx b/sfx2/source/appl/imagemgr.cxx
index f7cccf2712b8..3b26eae1858d 100644
--- a/sfx2/source/appl/imagemgr.cxx
+++ b/sfx2/source/appl/imagemgr.cxx
@@ -71,7 +71,7 @@ static WeakReference< XModuleUIConfigurationManagerSupplier > m_xModuleCfgMgrSup
static WeakReference< XURLTransformer > m_xURLTransformer;
static ModuleIdToImagegMgr m_aModuleIdToImageMgrMap;
-Image SAL_CALL GetImage( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast )
+Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast )
{
// TODO/LATeR: shouldn't this become a method at SfxViewFrame?! That would save the UnoTunnel
if ( !rFrame.is() )
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index c8a9742f49cf..895263ef4783 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -49,6 +49,8 @@
#include <sfx2/objface.hxx>
#include <sfx2/viewfrm.hxx>
#include <svl/intitem.hxx>
+#include "sfx2/taskpane.hxx"
+#include <tools/diagnose_ex.h>
#define SfxModule
#include "sfxslots.hxx"
@@ -400,6 +402,17 @@ BOOL SfxModule::IsActive() const
return FALSE;
}
+bool SfxModule::IsChildWindowAvailable( const USHORT i_nId, const SfxViewFrame* i_pViewFrame ) const
+{
+ if ( i_nId != SID_TASKPANE )
+ // by default, assume it is
+ return true;
+
+ const SfxViewFrame* pViewFrame = i_pViewFrame ? i_pViewFrame : GetFrame();
+ ENSURE_OR_RETURN( pViewFrame, "SfxModule::IsChildWindowAvailable: no frame to ask for the module identifier!", false );
+ return ::sfx2::ModuleTaskPane::ModuleHasToolPanels( pViewFrame->GetFrame().GetFrameInterface() );
+}
+
SfxModule* SfxModule::GetActiveModule( SfxViewFrame* pFrame )
{
if ( !pFrame )
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 24cf7dab8095..f9a388deee5c 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -53,6 +53,7 @@
#include <vcl/taskpanelist.hxx>
#include <vcl/toolbox.hxx>
#include <tools/rcid.h>
+#include <tools/diagnose_ex.h>
#include <toolkit/helper/vclunohelper.hxx>
#include <svl/itempool.hxx>
#include <svl/itemiter.hxx>
@@ -1538,6 +1539,16 @@ void SfxWorkWindow::UpdateObjectBars_Impl()
}
}
+bool SfxWorkWindow::AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const
+{
+ // or checking the availability of child windows, we need access to the module
+ const SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame();
+ const SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : NULL;
+ const SfxModule* pModule = pShell ? pShell->GetModule() : NULL;
+ ENSURE_OR_RETURN( pModule, "SfxWorkWindow::UpdateChildWindows_Impl: did not find an SfxModule to ask for the child win availability!", true );
+ return pModule->IsChildWindowAvailable( i_rCW.nId, pViewFrame );
+}
+
void SfxWorkWindow::UpdateChildWindows_Impl()
{
// alle vorhandenen oder in den Kontext gekommenen ChildWindows
@@ -1550,7 +1561,7 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
{
// Im Kontext ist ein geeignetes ChildWindow erlaubt;
// ist es auch eingeschaltet ?
- if ( pChildWin == 0 && pCW->bCreate )
+ if ( pChildWin == NULL && pCW->bCreate )
{
// Internal docking is only used for embedding into another
// container. We force the floating state of all floatable
@@ -1571,6 +1582,9 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
else
bCreate = TRUE;
+ if ( bCreate )
+ bCreate = AllowChildWindowCreation_Impl( *pCW );
+
// Momentan kein Fenster da, aber es ist eingeschaltet; Fenster
// und ggf. Context erzeugen
if ( bCreate )
@@ -1588,19 +1602,25 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
if ( ( !bIsFullScreen || pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT ) && bAllChildsVisible )
{
// Updatemode ist kompatibel; auf jeden Fall wieder einschalten
- bCreate = TRUE;
- if ( pCW->pCli )
+ bCreate = AllowChildWindowCreation_Impl( *pCW );
+ if ( bCreate )
{
- // Fenster ist direktes Child
- if ( bAllChildsVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) )
- pCW->pCli->nVisible |= CHILD_NOT_HIDDEN;
+ if ( pCW->pCli )
+ {
+ // Fenster ist direktes Child
+ if ( bAllChildsVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) )
+ pCW->pCli->nVisible |= CHILD_NOT_HIDDEN;
+ }
+ else
+ {
+ if ( pCW->bCreate && IsDockingAllowed() && bInternalDockingAllowed )
+ // Fenster liegt in einem SplitWindow
+ ((SfxDockingWindow*)pChildWin->GetWindow())->Reappear_Impl();
+ }
+
+ if ( pCW->nInterfaceId != pChildWin->GetContextId() )
+ pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() );
}
- else if ( pCW->bCreate && IsDockingAllowed() && bInternalDockingAllowed )
- // Fenster liegt in einem SplitWindow
- ((SfxDockingWindow*)pChildWin->GetWindow())->Reappear_Impl();
-
- if ( pCW->nInterfaceId != pChildWin->GetContextId() )
- pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() );
}
}
}
@@ -2225,7 +2245,7 @@ void SfxWorkWindow::ToggleChildWindow_Impl(USHORT nId, BOOL bSetFocus)
SfxChildWin_Impl *pCW = (*pChildWins)[n];
SfxChildWindow *pChild = pCW->pWin;
- bool bCreationAllowed( sal_True );
+ bool bCreationAllowed( true );
if ( !bInternalDockingAllowed )
{
// Special case for all non-floatable child windows. We have
@@ -2233,43 +2253,51 @@ void SfxWorkWindow::ToggleChildWindow_Impl(USHORT nId, BOOL bSetFocus)
bCreationAllowed = !( pCW->aInfo.nFlags & SFX_CHILDWIN_FORCEDOCK );
}
- if ( pChild && pCW->bCreate && bCreationAllowed )
+ if ( bCreationAllowed )
{
- if ( pChild->QueryClose() )
+ if ( pCW->bCreate )
{
- if ( pChild && pChild->IsHideAtToggle() )
+ if ( pChild )
{
- pCW->bCreate = !pCW->bCreate;
- ShowChildWindow_Impl( nId, pCW->bCreate, bSetFocus );
+ if ( pChild->QueryClose() )
+ {
+ pCW->bCreate = FALSE;
+ if ( pChild->IsHideAtToggle() )
+ {
+ ShowChildWindow_Impl( nId, FALSE, bSetFocus );
+ }
+ else
+ {
+ // Fenster soll ausgeschaltet werdem
+ pChild->SetVisible_Impl( FALSE );
+ RemoveChildWin_Impl( pCW );
+ }
+ }
}
else
{
- // Fenster soll ausgeschaltet werdem
+ // no actual Window exists, yet => just remember the "switched off" state
pCW->bCreate = FALSE;
- pChild->SetVisible_Impl( FALSE );
- RemoveChildWin_Impl( pCW );
}
}
- }
- else if ( pCW->bCreate && bCreationAllowed )
- {
- pCW->bCreate = FALSE;
- }
- else if ( bCreationAllowed )
- {
- pCW->bCreate = TRUE;
-
- if ( pChild )
- {
- ShowChildWindow_Impl( nId, pCW->bCreate, bSetFocus );
- }
else
{
- // Fenster erzeugen
- CreateChildWin_Impl( pCW, bSetFocus );
- if ( !pCW->pWin )
- // Erzeugung war erfolglos
- pCW->bCreate = FALSE;
+ pCW->bCreate = AllowChildWindowCreation_Impl( *pCW );
+ if ( pCW->bCreate )
+ {
+ if ( pChild )
+ {
+ ShowChildWindow_Impl( nId, TRUE, bSetFocus );
+ }
+ else
+ {
+ // create actual Window
+ CreateChildWin_Impl( pCW, bSetFocus );
+ if ( !pCW->pWin )
+ // no success
+ pCW->bCreate = FALSE;
+ }
+ }
}
}
@@ -2488,7 +2516,6 @@ void SfxWorkWindow::ShowChildWindow_Impl(USHORT nId, BOOL bVisible, BOOL bSetFoc
SfxChildWindow *pChildWin = pCW->pWin;
if ( pChildWin )
{
-// pCW->bCreate = bVisible;
if ( bVisible )
{
if ( pCW->pCli )
diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc
index f1e100e17cf5..7f03bf416431 100644
--- a/sfx2/source/dialog/dialog.hrc
+++ b/sfx2/source/dialog/dialog.hrc
@@ -39,54 +39,24 @@
#define RID_DLG_ALIEN_WARNING ( RC_DIALOG_BEGIN + 0)
#define STR_RESET ( RC_DIALOG_BEGIN + 0)
-#define STR_BASEFMT ( RC_DIALOG_BEGIN + 1)
-#define CB_USE_PASSWD ( RC_DIALOG_BEGIN + 2)
-#define CB_READ_ONLY ( RC_DIALOG_BEGIN + 3)
-#define BTN_MANAGER ( RC_DIALOG_BEGIN + 4)
-#define BTN_STANDARD ( RC_DIALOG_BEGIN + 5)
#define DLG_PASSWD ( RC_DIALOG_BEGIN + 8)
-#define STR_FILEDLG_INSERT ( RC_DIALOG_BEGIN + 10)
#define STR_TABPAGE_MANAGESTYLES ( RC_DIALOG_BEGIN + 12)
#define MSG_TABPAGE_INVALIDNAME ( RC_DIALOG_BEGIN + 13)
#define MSG_TABPAGE_INVALIDSTYLE ( RC_DIALOG_BEGIN + 14)
#define DLG_NEW_STYLE_BY_EXAMPLE ( RC_DIALOG_BEGIN + 15)
#define MSG_POOL_STYLE_NAME ( RC_DIALOG_BEGIN + 16)
-#define MSG_OVERWRITE_STYLE ( RC_DIALOG_BEGIN + 17)
#define MSG_TABPAGE_INVALIDPARENT ( RC_DIALOG_BEGIN + 18)
#define STR_DELETE_STYLE ( RC_DIALOG_BEGIN + 18)
#define STR_DELETE_STYLE_USED ( RC_DIALOG_BEGIN + 20)
-#define LOGO_IMAGELIST ( RC_DIALOG_BEGIN + 45)
#define MN_CONTEXT_TEMPLDLG ( RC_DIALOG_BEGIN + 46)
-#define MSG_LAYOUT_NOT_LOADING ( RC_DIALOG_BEGIN + 49)
-#define ACC_LAYOUT_NOT_LOADING ( RC_DIALOG_BEGIN + 50)
-
-#define MSG_ERR_CANT_EDIT_OLD_FORMAT ( RC_DIALOG_BEGIN + 60 )
-#define MSG_ERR_CANT_EDIT_OPEN_DOCS ( RC_DIALOG_BEGIN + 61 )
-
-#define RID_URLOPEN ( RC_DIALOG_BEGIN + 62 )
-#define RID_URLOPEN_OK 1
-#define RID_URLOPEN_CANCEL 2
-#define RID_URLOPEN_URL 3
-
-#define CB_FILE ( RC_DIALOG_BEGIN + 63 )
-#define CB_URL ( RC_DIALOG_BEGIN + 64 )
-
-#define STR_INTERNET ( RC_DIALOG_BEGIN + 65 )
-#define RID_AUTOHIDE ( RC_DIALOG_BEGIN + 66 )
-
-#define DLG_ONLINE_REGISTER ( RC_DIALOG_BEGIN + 68 )
#define DLG_VERSIONS ( RC_DIALOG_BEGIN + 69 )
#define DLG_COMMENTS ( RC_DIALOG_BEGIN + 70 )
-#define RID_REGISTER_DLG ( RC_DIALOG_BEGIN + 73 )
-#define DLG_PHONE_CONFIGURATION ( RC_DIALOG_BEGIN + 74 )
-#define DLG_RECOGNIZER_ENGINEMODE ( RC_DIALOG_BEGIN + 75 )
#define MSG_ERROR_WRONG_CONFIRM ( RC_DIALOG_BEGIN + 76 )
-#define DLG_RECOGNIZER_SPEAKER ( RC_DIALOG_BEGIN + 77 )
#define STR_APPLY ( RC_DIALOG_BEGIN + 87 )
@@ -104,7 +74,6 @@
#define RID_DLG_SEARCH ( RC_DIALOG_BEGIN + 109 )
#define STR_PDF_EXPORT_SEND ( RC_DIALOG_BEGIN + 120 )
-#define STR_RECHECK_DOCUMENT ( RC_DIALOG_BEGIN + 121 )
#define IMG_INFO ( RC_DIALOG_BEGIN + 122 )
#define RID_EDIT_DURATIONS ( RC_DIALOG_BEGIN + 123 )
#define SFX_PB_EDIT ( RC_DIALOG_BEGIN + 124 )
diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src
index a54d2c340d04..c39425510ae2 100644
--- a/sfx2/source/dialog/dialog.src
+++ b/sfx2/source/dialog/dialog.src
@@ -31,30 +31,6 @@
#include "helpid.hrc"
#include "sfxlocal.hrc"
- // Imageliste fuer die AboutBox
-ImageList LOGO_IMAGELIST
-{
- Prefix = "an";
- MaskColor = Color
- {
- Red = 0xFFFF ;
- Green = 0x0000 ;
- Blue = 0xFFFF ;
- };
- IdList =
- {
- 1 ;
- 2 ;
- 3 ;
- 4 ;
- 5 ;
- 6 ;
- };
- IdCount =
- {
- 6 ;
- };
-};
String STR_RESET
{
Text [ en-US ] = "~Reset" ;
@@ -63,48 +39,6 @@ String STR_APPLY
{
Text [ en-US ] = "Apply";
};
-String STR_INTERNET
-{
- Text [ en-US ] = "(Internet)" ;
-};
-String STR_BASEFMT
-{
- Text [ en-US ] = "Base format" ;
-};
-CheckBox CB_USE_PASSWD
-{
- HelpId = HID_FILEDLG_USE_PASSWD ;
- Text [ en-US ] = "~Password" ;
-};
-CheckBox CB_READ_ONLY
-{
- HelpId = HID_FILEDLG_READ_ONLY ;
- Text [ en-US ] = "~Read-only" ;
-};
-PushButton CB_FILE
-{
- HelpId = HID_FILEDLG_FILE ;
- Text [ en-US ] = "~File System" ;
-};
-PushButton CB_URL
-{
- HelpId = HID_FILEDLG_URL ;
- Text [ en-US ] = "Int~ernet" ;
-};
-PushButton BTN_MANAGER
-{
- HelpId = HID_FILEDLG_MANAGER ;
- Text [ en-US ] = "~Manager..." ;
-};
-PushButton BTN_STANDARD
-{
- HelpId = HID_FILEDLG_STANDARD ;
- Text [ en-US ] = "~Home" ;
-};
-String STR_FILEDLG_INSERT
-{
- Text [ en-US ] = "Insert File" ;
-};
String STR_TABPAGE_MANAGESTYLES
{
Text [ en-US ] = "Organizer" ;
@@ -131,12 +65,6 @@ InfoBox MSG_POOL_STYLE_NAME
{
Message [ en-US ] = "Name already exists as a default Style.\nPlease choose another name." ;
};
-QueryBox MSG_OVERWRITE_STYLE
-{
- Buttons = WB_YES_NO ;
- DefButton = WB_DEF_NO ;
- Message [ en-US ] = "Style already exists. Overwrite?" ;
-};
String STR_DELETE_STYLE
{
Text [ en-US ] = "Do you really want to delete Style $1?" ;
@@ -170,87 +98,15 @@ Menu MN_CONTEXT_TEMPLDLG
};
};
-InfoBox MSG_LAYOUT_NOT_LOADING
-{
- BUTTONS = WB_OK ;
- DEFBUTTON = WB_DEF_OK ;
- Message [ en-US ] = "Loading document without layout." ;
-};
-Accelerator ACC_LAYOUT_NOT_LOADING
-{
- ItemList =
- {
- AcceleratorItem
- {
- Key = KeyCode
- {
- Code = KEY_L ;
- Shift = FALSE ; Modifier1 = TRUE ; Modifier2 = TRUE ;
- };
- Identifier = 1 ;
- };
- };
-};
//------------------------------------------------------------------------
-ErrorBox MSG_ERR_CANT_EDIT_OLD_FORMAT
-{
- Message [ en-US ] = "Cannot edit document info for documents\n in this file format." ;
-};
- //------------------------------------------------------------------------
-ErrorBox MSG_ERR_CANT_EDIT_OPEN_DOCS
-{
- Message [ en-US ] = "Document info of documents\n being currently edited cannot be modified from within the document manager." ;
-};
-ModalDialog RID_URLOPEN
-{
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 204 , 44 ) ;
- Moveable = TRUE ;
- Text [ en-US ] = "Enter URL" ;
- Moveable = TRUE ;
- OKButton RID_URLOPEN_OK
- {
- Pos = MAP_APPFONT ( 148 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton RID_URLOPEN_CANCEL
- {
- Pos = MAP_APPFONT ( 148 , 24 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- Edit RID_URLOPEN_URL
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 16 ) ;
- Size = MAP_APPFONT ( 138 , 12 ) ;
- TabStop = TRUE ;
- Left = TRUE ;
- };
-};
-Menu RID_AUTOHIDE
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = SID_AUTOHIDE ;
- HelpID = SID_AUTOHIDE ;
- Text [ en-US ] = "Hide" ;
- };
- };
-};
-String RID_AUTOHIDE
-{
- Text [ en-US ] = "Don't Hide" ;
-};
String SID_NAVIGATOR
{
Text [ en-US ] = "Navigator";
};
+String SID_TASKPANE
+{
+ Text [ en-US ] = "Task Pane";
+};
ErrorBox MSG_ERROR_WRONG_CONFIRM
{
@@ -264,11 +120,6 @@ String STR_PDF_EXPORT_SEND
Text [ en-US ] = "Send" ;
};
-String STR_RECHECK_DOCUMENT
-{
- Text [ en-US ] = "Recheck Document" ;
-};
-
Image IMG_INFO
{
ImageBitmap = Bitmap
diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk
index 87ef0f1a7af1..3d0c53cdb932 100644
--- a/sfx2/source/dialog/makefile.mk
+++ b/sfx2/source/dialog/makefile.mk
@@ -45,7 +45,8 @@ EXCEPTIONSFILES=\
$(SLO)$/recfloat.obj \
$(SLO)$/templdlg.obj \
$(SLO)$/dinfdlg.obj \
- $(SLO)$/dockwin.obj
+ $(SLO)$/dockwin.obj \
+ $(SLO)$/taskpane.obj
SLOFILES =\
$(EXCEPTIONSFILES) \
@@ -60,7 +61,6 @@ SLOFILES =\
$(SLO)$/passwd.obj \
$(SLO)$/printopt.obj \
$(SLO)$/sfxdlg.obj \
- $(SLO)$/sfxurl.obj \
$(SLO)$/splitwin.obj \
$(SLO)$/srchdlg.obj \
$(SLO)$/styfitem.obj \
@@ -68,7 +68,8 @@ SLOFILES =\
$(SLO)$/tabdlg.obj \
$(SLO)$/tplcitem.obj \
$(SLO)$/tplpitem.obj \
- $(SLO)$/versdlg.obj
+ $(SLO)$/versdlg.obj \
+ $(SLO)$/titledockwin.obj
SRS1NAME=$(TARGET)
SRC1FILES =\
@@ -85,7 +86,9 @@ SRC1FILES =\
templdlg.src \
versdlg.src \
printopt.src \
- srchdlg.src
+ srchdlg.src \
+ titledockwin.src \
+ taskpane.src
.IF "$(BUILD_VER_STRING)"!=""
.IF "$(GUI)"=="UNX"
@@ -102,9 +105,9 @@ CFLAGS+=-DBUILD_VER_STRING="$(subst,",\" "$(BUILD_VER_STRING)")"
$(INCCOM)$/cuilib.hxx: makefile.mk
.IF "$(GUI)"=="UNX"
$(RM) $@
- echo \#define DLL_NAME \"libcui$(DLLPOSTFIX)$(DLLPOST)\" >$@
+ @echo \#define DLL_NAME \"libcui$(DLLPOSTFIX)$(DLLPOST)\" >$@
.ELSE
- echo $(EMQ)#define DLL_NAME $(EMQ)"cui$(DLLPOSTFIX)$(DLLPOST)$(EMQ)" >$@
+ @echo $(EMQ)#define DLL_NAME $(EMQ)"cui$(DLLPOSTFIX)$(DLLPOST)$(EMQ)" >$@
.ENDIF
$(SLO)$/sfxdlg.obj : $(INCCOM)$/cuilib.hxx
diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx
new file mode 100644
index 000000000000..f25485a1401c
--- /dev/null
+++ b/sfx2/source/dialog/taskpane.cxx
@@ -0,0 +1,1283 @@
+/*************************************************************************
+ * 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_sfx2.hxx"
+
+#include "sfx2/taskpane.hxx"
+#include "imagemgr.hxx"
+#include "sfx2/sfxsids.hrc"
+#include "sfx2/bindings.hxx"
+#include "sfx2/dispatch.hxx"
+#include "sfxresid.hxx"
+#include "sfxlocal.hrc"
+#include "helpid.hrc"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/ui/XToolPanel.hpp>
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/types.hxx>
+#include <comphelper/processfactory.hxx>
+#include <tools/diagnose_ex.h>
+#include <svtools/toolpanel/toolpaneldeck.hxx>
+#include <svtools/toolpanel/tablayouter.hxx>
+#include <svtools/toolpanel/drawerlayouter.hxx>
+#include <unotools/confignode.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/svapp.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <boost/noncopyable.hpp>
+
+//......................................................................................................................
+namespace sfx2
+{
+//......................................................................................................................
+
+ /** === 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::XModuleManager;
+ using ::com::sun::star::container::XNameAccess;
+ using ::com::sun::star::ui::XToolPanel;
+ using ::com::sun::star::ui::XUIElementFactory;
+ using ::com::sun::star::ui::XUIElement;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::frame::XModuleManager;
+ using ::com::sun::star::frame::XFrame;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::graphic::XGraphicProvider;
+ using ::com::sun::star::graphic::XGraphic;
+ using ::com::sun::star::accessibility::XAccessible;
+ using ::com::sun::star::awt::XControl;
+ /** === end UNO using === **/
+ namespace PosSize = ::com::sun::star::awt::PosSize;
+
+ //==================================================================================================================
+ //= helpers
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ ::utl::OConfigurationTreeRoot lcl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier,
+ const ::rtl::OUString& i_rResourceURL = ::rtl::OUString() )
+ {
+ const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ ::rtl::OUStringBuffer aPathComposer;
+ try
+ {
+ const Reference< XNameAccess > xModuleAccess( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW );
+ const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) );
+
+ const ::rtl::OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", ::rtl::OUString() ) );
+
+ aPathComposer.appendAscii( "org.openoffice.Office.UI." );
+ aPathComposer.append( sWindowStateRef );
+ aPathComposer.appendAscii( "/UIElements/States" );
+ if ( i_rResourceURL.getLength() )
+ {
+ aPathComposer.appendAscii( "/" );
+ aPathComposer.append( i_rResourceURL );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return ::utl::OConfigurationTreeRoot( aContext, aPathComposer.makeStringAndClear(), false );
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString lcl_identifyModule( const Reference< XFrame >& i_rDocumentFrame )
+ {
+ ::rtl::OUString sModuleName;
+ try
+ {
+ const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ const Reference< XModuleManager > xModuleManager( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW );
+ sModuleName = xModuleManager->identify( i_rDocumentFrame );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return sModuleName;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ Reference< XFrame > lcl_getFrame( const SfxBindings* i_pBindings )
+ {
+ const SfxViewFrame* pViewFrame = i_pBindings->GetDispatcher()->GetFrame();
+ const SfxFrame& rFrame = pViewFrame->GetFrame();
+ const Reference< XFrame > xFrame( rFrame.GetFrameInterface() );
+ return xFrame;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString lcl_getPanelHelpURL( const ::utl::OConfigurationNode& i_rPanelConfigNode )
+ {
+ const ::rtl::OUString sHelpURL( ::comphelper::getString( i_rPanelConfigNode.getNodeValue( "HelpURL" ) ) );
+ return sHelpURL;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ Image lcl_getPanelImage( const Reference< XFrame >& i_rDocFrame, const ::utl::OConfigurationNode& i_rPanelConfigNode )
+ {
+ const ::rtl::OUString sImageURL( ::comphelper::getString( i_rPanelConfigNode.getNodeValue( "ImageURL" ) ) );
+ if ( sImageURL.getLength() )
+ {
+ try
+ {
+ ::comphelper::NamedValueCollection aMediaProperties;
+ aMediaProperties.put( "URL", sImageURL );
+
+ // special handling: if the ImageURL denotes a CommandName, then retrieve the image for that command
+ const sal_Char* pCommandImagePrefix = "private:commandimage/";
+ const sal_Int32 nCommandImagePrefixLen = strlen( pCommandImagePrefix );
+ if ( sImageURL.compareToAscii( pCommandImagePrefix, nCommandImagePrefixLen ) == 0 )
+ {
+ ::rtl::OUStringBuffer aCommandName;
+ aCommandName.appendAscii( ".uno:" );
+ aCommandName.append( sImageURL.copy( nCommandImagePrefixLen ) );
+ const ::rtl::OUString sCommandName( aCommandName.makeStringAndClear() );
+
+ const BOOL bHiContrast( Application::GetSettings().GetStyleSettings().GetHighContrastMode() );
+ const Image aPanelImage( GetImage( i_rDocFrame, sCommandName, FALSE, bHiContrast ) );
+ return aPanelImage.GetXGraphic();
+ }
+
+ // otherwise, delegate to the GraphicProvider
+ const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW );
+
+ const Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_SET_THROW );
+ return Image( xGraphic );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ return Image();
+ }
+ }
+
+ //==================================================================================================================
+ //= TaskPaneDockingWindow
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits )
+ :TitledDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits )
+ ,m_aTaskPane( GetContentWindow(), lcl_getFrame( i_pBindings ) )
+ ,m_aPaneController( m_aTaskPane, *this )
+ {
+ m_aTaskPane.Show();
+ SetText( String( SfxResId( SID_TASKPANE ) ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TaskPaneDockingWindow::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL )
+ {
+ m_aPaneController.ActivateToolPanel( i_rPanelURL );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TaskPaneDockingWindow::GetFocus()
+ {
+ TitledDockingWindow::GetFocus();
+ m_aTaskPane.GrabFocus();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TaskPaneDockingWindow::onLayoutDone()
+ {
+ m_aTaskPane.SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() );
+ }
+
+ //==================================================================================================================
+ //= TaskPaneWrapper
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ SFX_IMPL_DOCKINGWINDOW( TaskPaneWrapper, SID_TASKPANE );
+
+ //------------------------------------------------------------------------------------------------------------------
+ TaskPaneWrapper::TaskPaneWrapper( Window* i_pParent, USHORT i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pInfo )
+ :SfxChildWindow( i_pParent, i_nId )
+ {
+ pWindow = new TaskPaneDockingWindow( i_pBindings, *this, i_pParent,
+ WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
+ eChildAlignment = SFX_ALIGN_RIGHT;
+
+ pWindow->SetHelpId( HID_TASKPANE_WINDOW );
+ pWindow->SetOutputSizePixel( Size( 300, 450 ) );
+ pWindow->Show();
+
+ dynamic_cast< SfxDockingWindow* >( pWindow )->Initialize( i_pInfo );
+ SetHideNotDelete( TRUE );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TaskPaneWrapper::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL )
+ {
+ TaskPaneDockingWindow* pDockingWindow = dynamic_cast< TaskPaneDockingWindow* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pDockingWindow, "TaskPaneWrapper::ActivateToolPanel: invalid docking window implementation!" );
+ pDockingWindow->ActivateToolPanel( i_rPanelURL );
+ }
+
+ //==================================================================================================================
+ //= CustomPanelUIElement
+ //==================================================================================================================
+ class CustomPanelUIElement
+ {
+ public:
+ CustomPanelUIElement()
+ :m_xUIElement()
+ ,m_xToolPanel()
+ ,m_xPanelWindow()
+ {
+ }
+
+ CustomPanelUIElement( const Reference< XUIElement >& i_rUIElement )
+ :m_xUIElement( i_rUIElement, UNO_SET_THROW )
+ ,m_xToolPanel( i_rUIElement->getRealInterface(), UNO_QUERY_THROW )
+ ,m_xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW )
+ {
+ }
+
+ bool is() const { return m_xPanelWindow.is(); }
+
+ const Reference< XUIElement >& getUIElement() const { return m_xUIElement; }
+ const Reference< XToolPanel >& getToolPanel() const { return m_xToolPanel; }
+ const Reference< XWindow >& getPanelWindow() const { return m_xPanelWindow; }
+
+ private:
+ Reference< XUIElement > m_xUIElement;
+ Reference< XToolPanel > m_xToolPanel;
+ Reference< XWindow > m_xPanelWindow;
+ };
+
+ //==================================================================================================================
+ //= CustomToolPanel
+ //==================================================================================================================
+ class CustomToolPanel : public ::svt::ToolPanelBase
+ {
+ public:
+ CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState, const Reference< XFrame >& i_rFrame );
+
+ virtual ::rtl::OUString GetDisplayName() const;
+ virtual Image GetImage() const;
+ virtual SmartId GetHelpID() const;
+ virtual void Activate( Window& i_rParentWindow );
+ virtual void Deactivate();
+ virtual void SetSizePixel( const Size& i_rPanelWindowSize );
+ virtual void GrabFocus();
+ virtual void Dispose();
+ virtual Reference< XAccessible >
+ CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible );
+
+ const ::rtl::OUString&
+ GetResourceURL() const { return m_sResourceURL; }
+
+ protected:
+ ~CustomToolPanel();
+
+ private:
+ bool impl_ensureToolPanelWindow( Window& i_rPanelParentWindow );
+ void impl_updatePanelConfig( const bool i_bVisible ) const;
+
+ private:
+ const ::rtl::OUString m_sUIName;
+ const Image m_aPanelImage;
+ const ::rtl::OUString m_aPanelHelpURL;
+ const ::rtl::OUString m_sResourceURL;
+ const ::rtl::OUString m_sPanelConfigPath;
+ Reference< XFrame > m_xFrame;
+ CustomPanelUIElement m_aCustomPanel;
+ bool m_bAttemptedCreation;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState, const Reference< XFrame >& i_rFrame )
+ :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) )
+ ,m_aPanelImage( lcl_getPanelImage( i_rFrame, i_rPanelWindowState ) )
+ ,m_aPanelHelpURL( lcl_getPanelHelpURL( i_rPanelWindowState ) )
+ ,m_sResourceURL( i_rPanelWindowState.getLocalName() )
+ ,m_sPanelConfigPath( i_rPanelWindowState.getNodePath() )
+ ,m_xFrame( i_rFrame )
+ ,m_aCustomPanel()
+ ,m_bAttemptedCreation( false )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ CustomToolPanel::~CustomToolPanel()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool CustomToolPanel::impl_ensureToolPanelWindow( Window& i_rPanelParentWindow )
+ {
+ if ( m_bAttemptedCreation )
+ return m_aCustomPanel.is();
+
+ m_bAttemptedCreation = true;
+ try
+ {
+ const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ const Reference< XUIElementFactory > xFactory( aContext.createComponent( "com.sun.star.ui.UIElementFactoryManager" ), UNO_QUERY_THROW );
+
+ ::comphelper::NamedValueCollection aCreationArgs;
+ aCreationArgs.put( "Frame", makeAny( m_xFrame ) );
+ aCreationArgs.put( "ParentWindow", makeAny( i_rPanelParentWindow.GetComponentInterface() ) );
+
+ const Reference< XUIElement > xElement(
+ xFactory->createUIElement( m_sResourceURL, aCreationArgs.getPropertyValues() ),
+ UNO_SET_THROW );
+
+ m_aCustomPanel = CustomPanelUIElement( xElement );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return m_aCustomPanel.is();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void CustomToolPanel::impl_updatePanelConfig( const bool i_bVisible ) const
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ ::utl::OConfigurationTreeRoot aConfig( aContext, m_sPanelConfigPath, true );
+
+ aConfig.setNodeValue( "Visible", makeAny( i_bVisible ) );
+ aConfig.commit();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString CustomToolPanel::GetDisplayName() const
+ {
+ return m_sUIName;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Image CustomToolPanel::GetImage() const
+ {
+ return m_aPanelImage;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SmartId CustomToolPanel::GetHelpID() const
+ {
+ return SmartId( m_aPanelHelpURL );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void CustomToolPanel::Activate( Window& i_rParentWindow )
+ {
+ ENSURE_OR_RETURN_VOID( impl_ensureToolPanelWindow( i_rParentWindow ), "no panel to activate!" );
+
+ // TODO: we might need a mechanism to decide whether the panel should be destroyed/re-created, or (as it is
+ // done now) hidden/shown
+ m_aCustomPanel.getPanelWindow()->setVisible( sal_True );
+
+ // update the panel's configuration
+ impl_updatePanelConfig( true );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void CustomToolPanel::Deactivate()
+ {
+ ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to deactivate!" );
+
+ m_aCustomPanel.getPanelWindow()->setVisible( sal_False );
+
+ // update the panel's configuration
+ impl_updatePanelConfig( false );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void CustomToolPanel::SetSizePixel( const Size& i_rPanelWindowSize )
+ {
+ ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel/window to position!" );
+
+ try
+ {
+ m_aCustomPanel.getPanelWindow()->setPosSize( 0, 0, i_rPanelWindowSize.Width(), i_rPanelWindowSize.Height(),
+ PosSize::POSSIZE );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void CustomToolPanel::GrabFocus()
+ {
+ ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel/window to focus!" );
+
+ m_aCustomPanel.getPanelWindow()->setFocus();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void CustomToolPanel::Dispose()
+ {
+ if ( !m_bAttemptedCreation )
+ // nothing to dispose
+ return;
+
+ ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to destroy!" );
+ try
+ {
+ Reference< XComponent > xUIElementComponent( m_aCustomPanel.getUIElement(), UNO_QUERY_THROW );
+ xUIElementComponent->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible )
+ {
+ ENSURE_OR_RETURN( m_aCustomPanel.is(), "no panel to ask!", NULL );
+
+ Reference< XAccessible > xPanelAccessible;
+ try
+ {
+ xPanelAccessible.set( m_aCustomPanel.getToolPanel()->createAccessible( i_rParentAccessible ), UNO_SET_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xPanelAccessible;
+ }
+
+ //==================================================================================================================
+ //= ModuleTaskPane_Impl
+ //==================================================================================================================
+ class ModuleTaskPane_Impl : public ::boost::noncopyable
+ {
+ public:
+ ModuleTaskPane_Impl( ModuleTaskPane& i_rAntiImpl, const Reference< XFrame >& i_rDocumentFrame,
+ const IToolPanelCompare* i_pPanelCompare )
+ :m_rAntiImpl( i_rAntiImpl )
+ ,m_sModuleIdentifier( lcl_identifyModule( i_rDocumentFrame ) )
+ ,m_xFrame( i_rDocumentFrame )
+ ,m_aPanelDeck( i_rAntiImpl )
+ {
+ m_aPanelDeck.Show();
+ OnResize();
+ impl_initFromConfiguration( i_pPanelCompare );
+ }
+
+ ~ModuleTaskPane_Impl()
+ {
+ }
+
+ void OnResize();
+ void OnGetFocus();
+
+ static bool ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier );
+
+ ::svt::ToolPanelDeck& GetPanelDeck() { return m_aPanelDeck; }
+ const ::svt::ToolPanelDeck& GetPanelDeck() const { return m_aPanelDeck; }
+
+ ::boost::optional< size_t >
+ GetPanelPos( const ::rtl::OUString& i_rResourceURL );
+ ::rtl::OUString
+ GetPanelResourceURL( const size_t i_nPanelPos ) const;
+
+ void SetDrawersLayout();
+ void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent );
+
+ private:
+ void impl_initFromConfiguration( const IToolPanelCompare* i_pPanelCompare );
+
+ static bool
+ impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL );
+
+ DECL_LINK( OnActivatePanel, void* );
+
+ private:
+ ModuleTaskPane& m_rAntiImpl;
+ const ::rtl::OUString m_sModuleIdentifier;
+ const Reference< XFrame > m_xFrame;
+ ::svt::ToolPanelDeck m_aPanelDeck;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ModuleTaskPane_Impl::OnResize()
+ {
+ m_aPanelDeck.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ModuleTaskPane_Impl::OnGetFocus()
+ {
+ m_aPanelDeck.GrabFocus();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( ModuleTaskPane_Impl, OnActivatePanel, void*, i_pArg )
+ {
+ m_aPanelDeck.ActivatePanel( reinterpret_cast< size_t >( i_pArg ) );
+ return 1L;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool ModuleTaskPane_Impl::impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL )
+ {
+ return i_rResourceURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ModuleTaskPane_Impl::impl_initFromConfiguration( const IToolPanelCompare* i_pPanelCompare )
+ {
+ const ::utl::OConfigurationTreeRoot aWindowStateConfig( lcl_getModuleUIElementStatesConfig( m_sModuleIdentifier ) );
+ if ( !aWindowStateConfig.isValid() )
+ return;
+
+ ::rtl::OUString sFirstVisiblePanelResource;
+
+ const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() );
+ for ( const ::rtl::OUString* resource = aUIElements.getConstArray();
+ resource != aUIElements.getConstArray() + aUIElements.getLength();
+ ++resource
+ )
+ {
+ if ( !impl_isToolPanelResource( *resource ) )
+ continue;
+
+ ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) );
+ ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) );
+
+ size_t nPanelPos = m_aPanelDeck.GetPanelCount();
+ if ( i_pPanelCompare )
+ {
+ // assuming that nobody will insert hundreths of panels, a simple O(n) search should suffice here ...
+ while ( nPanelPos > 0 )
+ {
+ const short nCompare = i_pPanelCompare->compareToolPanelsURLs(
+ *resource,
+ GetPanelResourceURL( --nPanelPos )
+ );
+ if ( nCompare >= 0 )
+ {
+ ++nPanelPos;
+ break;
+ }
+ }
+ }
+ nPanelPos = m_aPanelDeck.InsertPanel( pCustomPanel, nPanelPos );
+
+ if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) )
+ sFirstVisiblePanelResource = *resource;
+ }
+
+ if ( sFirstVisiblePanelResource.getLength() )
+ {
+ ::boost::optional< size_t > aPanelPos( GetPanelPos( sFirstVisiblePanelResource ) );
+ OSL_ENSURE( !!aPanelPos, "ModuleTaskPane_Impl::impl_isToolPanelResource: just inserted it, and it's not there?!" );
+ if ( !!aPanelPos )
+ m_rAntiImpl.PostUserEvent( LINK( this, ModuleTaskPane_Impl, OnActivatePanel ), reinterpret_cast< void* >( *aPanelPos ) );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool ModuleTaskPane_Impl::ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier )
+ {
+ const ::utl::OConfigurationTreeRoot aWindowStateConfig( lcl_getModuleUIElementStatesConfig( i_rModuleIdentifier ) );
+ if ( !aWindowStateConfig.isValid() )
+ return false;
+
+ const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() );
+ for ( const ::rtl::OUString* resource = aUIElements.getConstArray();
+ resource != aUIElements.getConstArray() + aUIElements.getLength();
+ ++resource
+ )
+ {
+ if ( impl_isToolPanelResource( *resource ) )
+ return true;
+ }
+ return false;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< size_t > ModuleTaskPane_Impl::GetPanelPos( const ::rtl::OUString& i_rResourceURL )
+ {
+ ::boost::optional< size_t > aPanelPos;
+ for ( size_t i = 0; i < m_aPanelDeck.GetPanelCount(); ++i )
+ {
+ const ::svt::PToolPanel pPanel( m_aPanelDeck.GetPanel( i ) );
+ const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() );
+ ENSURE_OR_CONTINUE( pCustomPanel != NULL, "ModuleTaskPane_Impl::GetPanelPos: illegal panel implementation!" );
+ if ( pCustomPanel->GetResourceURL() == i_rResourceURL )
+ {
+ aPanelPos = i;
+ break;
+ }
+ }
+ return aPanelPos;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString ModuleTaskPane_Impl::GetPanelResourceURL( const size_t i_nPanelPos ) const
+ {
+ ENSURE_OR_RETURN( i_nPanelPos < m_aPanelDeck.GetPanelCount(), "ModuleTaskPane_Impl::GetPanelResourceURL: illegal panel position!", ::rtl::OUString() );
+ const ::svt::PToolPanel pPanel( m_aPanelDeck.GetPanel( i_nPanelPos ) );
+ const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() );
+ ENSURE_OR_RETURN( pCustomPanel != NULL, "ModuleTaskPane_Impl::GetPanelPos: illegal panel implementation!", ::rtl::OUString() );
+ return pCustomPanel->GetResourceURL();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ModuleTaskPane_Impl::SetDrawersLayout()
+ {
+ const ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() );
+ const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() );
+ if ( pDrawerLayouter != NULL )
+ // already have the proper layout
+ return;
+ m_aPanelDeck.SetLayouter( new ::svt::DrawerDeckLayouter( m_aPanelDeck, m_aPanelDeck ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ModuleTaskPane_Impl::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent )
+ {
+ ::svt::PDeckLayouter pLayouter( m_aPanelDeck.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;
+ }
+
+ m_aPanelDeck.SetLayouter( new ::svt::TabDeckLayouter( m_aPanelDeck, m_aPanelDeck, i_eTabAlignment, i_eTabContent ) );
+ }
+
+ //==================================================================================================================
+ //= ModuleTaskPane
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const Reference< XFrame >& i_rDocumentFrame )
+ :Window( &i_rParentWindow, WB_DIALOGCONTROL )
+ ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rDocumentFrame, NULL ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const Reference< XFrame >& i_rDocumentFrame,
+ const IToolPanelCompare& i_rCompare )
+ :Window( &i_rParentWindow, WB_DIALOGCONTROL )
+ ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rDocumentFrame, &i_rCompare ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ModuleTaskPane::~ModuleTaskPane()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool ModuleTaskPane::ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier )
+ {
+ return ModuleTaskPane_Impl::ModuleHasToolPanels( i_rModuleIdentifier );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool ModuleTaskPane::ModuleHasToolPanels( const Reference< XFrame >& i_rDocumentFrame )
+ {
+ return ModuleTaskPane_Impl::ModuleHasToolPanels( lcl_identifyModule( i_rDocumentFrame ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ModuleTaskPane::Resize()
+ {
+ Window::Resize();
+ m_pImpl->OnResize();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ModuleTaskPane::GetFocus()
+ {
+ Window::GetFocus();
+ m_pImpl->OnGetFocus();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::svt::ToolPanelDeck& ModuleTaskPane::GetPanelDeck()
+ {
+ return m_pImpl->GetPanelDeck();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ const ::svt::ToolPanelDeck& ModuleTaskPane::GetPanelDeck() const
+ {
+ return m_pImpl->GetPanelDeck();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< size_t > ModuleTaskPane::GetPanelPos( const ::rtl::OUString& i_rResourceURL )
+ {
+ return m_pImpl->GetPanelPos( i_rResourceURL );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString ModuleTaskPane::GetPanelResourceURL( const size_t i_nPanelPos ) const
+ {
+ return m_pImpl->GetPanelResourceURL( i_nPanelPos );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ModuleTaskPane::SetDrawersLayout()
+ {
+ m_pImpl->SetDrawersLayout();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ModuleTaskPane::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent )
+ {
+ m_pImpl->SetTabsLayout( i_eTabAlignment, i_eTabContent );
+ }
+
+ // =====================================================================================================================
+ // = PanelSelectorLayout
+ // =====================================================================================================================
+ enum PanelSelectorLayout
+ {
+ LAYOUT_DRAWERS,
+ LAYOUT_TABS_RIGHT,
+ LAYOUT_TABS_LEFT,
+ LAYOUT_TABS_TOP,
+ LAYOUT_TABS_BOTTOM
+ };
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ PanelSelectorLayout lcl_getTabLayoutFromAlignment( const SfxChildAlignment i_eAlignment )
+ {
+ switch ( i_eAlignment )
+ {
+ case SFX_ALIGN_LEFT:
+ return LAYOUT_TABS_LEFT;
+ case SFX_ALIGN_TOP:
+ return LAYOUT_TABS_TOP;
+ case SFX_ALIGN_BOTTOM:
+ return LAYOUT_TABS_BOTTOM;
+ default:
+ return LAYOUT_TABS_RIGHT;
+ }
+ }
+ }
+
+ // =====================================================================================================================
+ // = PanelDescriptor
+ // =====================================================================================================================
+ /** is a helper class for TaskPaneController_Impl, holding the details about a single panel which is not
+ contained in the IToolPanel implementation itself.
+ */
+ struct PanelDescriptor
+ {
+ ::svt::PToolPanel pPanel;
+ bool bHidden;
+
+ PanelDescriptor()
+ :pPanel()
+ ,bHidden( false )
+ {
+ }
+
+ PanelDescriptor( const ::svt::PToolPanel& i_rPanel )
+ :pPanel( i_rPanel )
+ ,bHidden( false )
+ {
+ }
+ };
+
+ //==================================================================================================================
+ //= TaskPaneController_Impl
+ //==================================================================================================================
+ class TaskPaneController_Impl :public ::boost::noncopyable
+ ,public ::svt::IToolPanelDeckListener
+ {
+ public:
+ TaskPaneController_Impl(
+ ModuleTaskPane& i_rTaskPane,
+ TitledDockingWindow& i_rDockingWindow
+ );
+ ~TaskPaneController_Impl();
+
+ void SetDefaultTitle( const String& i_rTitle );
+ void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL );
+
+ protected:
+ // IToolPanelDeckListener overridables
+ virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ private:
+ DECL_LINK( OnToolboxClicked, ToolBox* );
+ DECL_LINK( OnMenuItemSelected, Menu* );
+ DECL_LINK( DockingChanged, TitledDockingWindow* );
+ ::std::auto_ptr< PopupMenu > impl_createPopupMenu() const;
+
+ /// sets the given layout for the panel selector
+ void impl_setLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce = false );
+
+ /// returns the current layout of the panel selector
+ PanelSelectorLayout
+ impl_getLayout() const { return m_eCurrentLayout; }
+
+ void impl_updateDockingWindowTitle();
+ void impl_togglePanelVisibility( const size_t i_nLogicalPanelIndex );
+ size_t impl_getLogicalPanelIndex( const size_t i_nVisibleIndex );
+
+ private:
+ enum MenuId
+ {
+ MID_UNLOCK_TASK_PANEL = 1,
+ MID_LOCK_TASK_PANEL = 2,
+ MID_LAYOUT_TABS = 3,
+ MID_LAYOUT_DRAWERS = 4,
+ MID_FIRST_PANEL = 5
+ };
+
+ private:
+ typedef ::std::vector< PanelDescriptor > PanelDescriptors;
+
+ ModuleTaskPane& m_rTaskPane;
+ TitledDockingWindow& m_rDockingWindow;
+ USHORT m_nViewMenuID;
+ PanelSelectorLayout m_eCurrentLayout;
+ PanelDescriptors m_aPanelRepository;
+ bool m_bTogglingPanelVisibility;
+ ::rtl::OUString m_sDefaultTitle;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ TaskPaneController_Impl::TaskPaneController_Impl( ModuleTaskPane& i_rTaskPane, TitledDockingWindow& i_rDockingWindow )
+ :m_rTaskPane( i_rTaskPane )
+ ,m_rDockingWindow( i_rDockingWindow )
+ ,m_nViewMenuID( 0 )
+ ,m_eCurrentLayout( LAYOUT_DRAWERS )
+ ,m_aPanelRepository()
+ ,m_bTogglingPanelVisibility( false )
+ ,m_sDefaultTitle()
+ {
+ m_rDockingWindow.ResetToolBox();
+ m_nViewMenuID = m_rDockingWindow.AddDropDownToolBoxItem(
+ String( SfxResId( STR_SFX_TASK_PANE_VIEW ) ),
+ HID_TASKPANE_VIEW_MENU,
+ LINK( this, TaskPaneController_Impl, OnToolboxClicked )
+ );
+ m_rDockingWindow.SetEndDockingHdl( LINK( this, TaskPaneController_Impl, DockingChanged ) );
+ impl_setLayout( LAYOUT_DRAWERS, true );
+
+ m_rTaskPane.GetPanelDeck().AddListener( *this );
+
+ // initialize the panel repository
+ for ( size_t i = 0; i < m_rTaskPane.GetPanelDeck().GetPanelCount(); ++i )
+ {
+ ::svt::PToolPanel pPanel( m_rTaskPane.GetPanelDeck().GetPanel( i ) );
+ m_aPanelRepository.push_back( PanelDescriptor( pPanel ) );
+ }
+
+ SetDefaultTitle( String( SfxResId( STR_SFX_TASKS ) ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TaskPaneController_Impl::~TaskPaneController_Impl()
+ {
+ m_rTaskPane.GetPanelDeck().RemoveListener( *this );
+
+ // remove the panels which are not under the control of the panel deck currently
+ for ( PanelDescriptors::iterator panelPos = m_aPanelRepository.begin();
+ panelPos != m_aPanelRepository.end();
+ ++panelPos
+ )
+ {
+ if ( panelPos->bHidden )
+ panelPos->pPanel->Dispose();
+ }
+ m_aPanelRepository.clear();
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ void TaskPaneController_Impl::SetDefaultTitle( const String& i_rTitle )
+ {
+ m_sDefaultTitle = i_rTitle;
+ impl_updateDockingWindowTitle();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TaskPaneController_Impl::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL )
+ {
+ ::boost::optional< size_t > aPanelPos( m_rTaskPane.GetPanelPos( i_rPanelURL ) );
+ ENSURE_OR_RETURN_VOID( !!aPanelPos, "TaskPaneController_Impl::ActivateToolPanel: no such panel!" );
+
+ if ( aPanelPos == m_rTaskPane.GetPanelDeck().GetActivePanel() )
+ {
+ ::svt::PToolPanel pPanel( m_rTaskPane.GetPanelDeck().GetPanel( *aPanelPos ) );
+ pPanel->GrabFocus();
+ }
+ else
+ {
+ m_rTaskPane.GetPanelDeck().ActivatePanel( aPanelPos );
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( TaskPaneController_Impl, DockingChanged, TitledDockingWindow*, i_pDockingWindow )
+ {
+ ENSURE_OR_RETURN( i_pDockingWindow && &m_rDockingWindow, "TaskPaneController_Impl::DockingChanged: where does this come from?", 0L );
+
+ if ( impl_getLayout() == LAYOUT_DRAWERS )
+ return 0L;
+
+ impl_setLayout( lcl_getTabLayoutFromAlignment( i_pDockingWindow->GetAlignment() ) );
+ return 1L;
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( TaskPaneController_Impl, OnToolboxClicked, ToolBox*, i_pToolBox )
+ {
+ if ( i_pToolBox->GetCurItemId() == m_nViewMenuID )
+ {
+ i_pToolBox->EndSelection();
+
+ ::std::auto_ptr< PopupMenu > pMenu = impl_createPopupMenu();
+ pMenu->SetSelectHdl( LINK( this, TaskPaneController_Impl, OnMenuItemSelected ) );
+
+ // pass toolbox button rect so the menu can stay open on button up
+ Rectangle aMenuRect( i_pToolBox->GetItemRect( m_nViewMenuID ) );
+ aMenuRect.SetPos( i_pToolBox->GetPosPixel() );
+ pMenu->Execute( &m_rDockingWindow, aMenuRect, POPUPMENU_EXECUTE_DOWN );
+ }
+
+ return 0;
+ }
+
+ // ---------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( TaskPaneController_Impl, OnMenuItemSelected, Menu*, i_pMenu )
+ {
+ ENSURE_OR_RETURN( i_pMenu, "TaskPaneController_Impl::OnMenuItemSelected: illegal menu!", 0L );
+
+ i_pMenu->Deactivate();
+ switch ( i_pMenu->GetCurItemId() )
+ {
+ case MID_UNLOCK_TASK_PANEL:
+ m_rDockingWindow.SetFloatingMode( TRUE );
+ break;
+
+ case MID_LOCK_TASK_PANEL:
+ m_rDockingWindow.SetFloatingMode( FALSE );
+ break;
+
+ case MID_LAYOUT_DRAWERS:
+ impl_setLayout( LAYOUT_DRAWERS );
+ break;
+
+ case MID_LAYOUT_TABS:
+ impl_setLayout( lcl_getTabLayoutFromAlignment( m_rDockingWindow.GetAlignment() ) );
+ break;
+
+ default:
+ {
+ size_t nPanelIndex = size_t( i_pMenu->GetCurItemId() - MID_FIRST_PANEL );
+ impl_togglePanelVisibility( nPanelIndex );
+ }
+ break;
+ }
+
+ return 1L;
+ }
+
+ // ---------------------------------------------------------------------------------------------------------------------
+ size_t TaskPaneController_Impl::impl_getLogicalPanelIndex( const size_t i_nVisibleIndex )
+ {
+ size_t nLogicalIndex = 0;
+ size_t nVisibleIndex( i_nVisibleIndex );
+ for ( size_t i=0; i < m_aPanelRepository.size(); ++i )
+ {
+ if ( !m_aPanelRepository[i].bHidden )
+ {
+ if ( !nVisibleIndex )
+ break;
+ --nVisibleIndex;
+ }
+ ++nLogicalIndex;
+ }
+ return nLogicalIndex;
+ }
+
+ // ---------------------------------------------------------------------------------------------------------------------
+ void TaskPaneController_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ if ( m_bTogglingPanelVisibility )
+ return;
+
+ const size_t nLogicalIndex( impl_getLogicalPanelIndex( i_nPosition ) );
+ m_aPanelRepository.insert( m_aPanelRepository.begin() + nLogicalIndex, PanelDescriptor( i_pPanel ) );
+ }
+
+ // ---------------------------------------------------------------------------------------------------------------------
+ void TaskPaneController_Impl::PanelRemoved( const size_t i_nPosition )
+ {
+ if ( m_bTogglingPanelVisibility )
+ return;
+
+ const size_t nLogicalIndex( impl_getLogicalPanelIndex( i_nPosition ) );
+ m_aPanelRepository.erase( m_aPanelRepository.begin() + nLogicalIndex );
+ }
+
+ // ---------------------------------------------------------------------------------------------------------------------
+ void TaskPaneController_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ if ( impl_getLayout() == LAYOUT_DRAWERS )
+ // no adjustment of the title when we use the classical "drawers" layout
+ return;
+
+ impl_updateDockingWindowTitle( );
+ (void)i_rOldActive;
+ (void)i_rNewActive;
+ }
+
+ // ---------------------------------------------------------------------------------------------------------------------
+ void TaskPaneController_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter )
+ {
+ // not interested in
+ (void)i_rNewLayouter;
+ }
+
+ // ---------------------------------------------------------------------------------------------------------------------
+ void TaskPaneController_Impl::Dying()
+ {
+ OSL_ENSURE( false, "TaskPaneController_Impl::Dying: unexpected call!" );
+ // We are expected to live longer than the ToolPanelDeck we work with. Since we remove ourself, in our dtor,
+ // as listener from the panel deck, this method here should never be called.
+ }
+
+ // ---------------------------------------------------------------------------------------------------------------------
+ void TaskPaneController_Impl::impl_togglePanelVisibility( const size_t i_nLogicalPanelIndex )
+ {
+ ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanelRepository.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_aPanelRepository[i].bHidden )
+ ++nActualPanelIndex;
+ }
+
+ ::boost::optional< size_t > aActivatePanel;
+
+ m_bTogglingPanelVisibility = true;
+ if ( m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden )
+ {
+ OSL_VERIFY( m_rTaskPane.GetPanelDeck().InsertPanel( m_aPanelRepository[ 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_rTaskPane.GetPanelDeck().GetActivePanel() );
+ if ( !aActivePanel )
+ aActivatePanel = nActualPanelIndex;
+ }
+ else
+ {
+ OSL_VERIFY( m_rTaskPane.GetPanelDeck().RemovePanel( nActualPanelIndex ).get() == m_aPanelRepository[ i_nLogicalPanelIndex ].pPanel.get() );
+ }
+ m_bTogglingPanelVisibility = false;
+ m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden = !m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden;
+
+ if ( !!aActivatePanel )
+ m_rTaskPane.GetPanelDeck().ActivatePanel( *aActivatePanel );
+ }
+
+ // ---------------------------------------------------------------------------------------------------------------------
+ void TaskPaneController_Impl::impl_setLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce )
+ {
+ if ( !i_bForce && ( m_eCurrentLayout == i_eLayout ) )
+ return;
+
+ switch ( i_eLayout )
+ {
+ case LAYOUT_DRAWERS:
+ m_rTaskPane.SetDrawersLayout();
+ break;
+ case LAYOUT_TABS_TOP:
+ m_rTaskPane.SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY );
+ break;
+ case LAYOUT_TABS_BOTTOM:
+ m_rTaskPane.SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY );
+ break;
+ case LAYOUT_TABS_LEFT:
+ m_rTaskPane.SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY );
+ break;
+ case LAYOUT_TABS_RIGHT:
+ m_rTaskPane.SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY );
+ break;
+ }
+ m_eCurrentLayout = i_eLayout;
+
+ impl_updateDockingWindowTitle();
+ }
+
+ // ---------------------------------------------------------------------------------------------------------------------
+ void TaskPaneController_Impl::impl_updateDockingWindowTitle()
+ {
+ ::boost::optional< size_t > aActivePanel( m_rTaskPane.GetPanelDeck().GetActivePanel() );
+ if ( !aActivePanel || ( impl_getLayout() == LAYOUT_DRAWERS ) )
+ m_rDockingWindow.SetTitle( m_sDefaultTitle );
+ else
+ {
+ size_t nNewActive( *aActivePanel );
+ for ( size_t i=0; i < m_aPanelRepository.size(); ++i )
+ {
+ if ( m_aPanelRepository[i].bHidden )
+ continue;
+
+ if ( !nNewActive )
+ {
+ m_rDockingWindow.SetTitle( m_aPanelRepository[i].pPanel->GetDisplayName() );
+ break;
+ }
+ --nNewActive;
+ }
+ }
+ }
+
+ // ---------------------------------------------------------------------------------------------------------------------
+ ::std::auto_ptr< PopupMenu > TaskPaneController_Impl::impl_createPopupMenu() const
+ {
+ ::std::auto_ptr<PopupMenu> pMenu( new PopupMenu );
+ FloatingWindow* pMenuWindow = static_cast< FloatingWindow* >( pMenu->GetWindow() );
+ if ( pMenuWindow != NULL )
+ {
+ pMenuWindow->SetPopupModeFlags ( pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE );
+ }
+
+ // 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<m_aPanelRepository.size(); ++i, ++nIndex )
+ {
+ const PanelDescriptor& rPanelDesc( m_aPanelRepository[i] );
+ pMenu->InsertItem( nIndex, rPanelDesc.pPanel->GetDisplayName(), MIB_CHECKABLE );
+ pMenu->CheckItem( nIndex, !rPanelDesc.bHidden );
+ }
+ pMenu->InsertSeparator();
+
+ #if OSL_DEBUG_LEVEL > 0
+ pMenu->InsertItem( MID_LAYOUT_TABS, String::CreateFromAscii( "Tab-Layout (exp.)" ), MIB_CHECKABLE );
+ pMenu->CheckItem( MID_LAYOUT_TABS, impl_getLayout() != LAYOUT_DRAWERS );
+ pMenu->InsertItem( MID_LAYOUT_DRAWERS, String::CreateFromAscii( "Drawer-Layout" ), MIB_CHECKABLE );
+ pMenu->CheckItem( MID_LAYOUT_DRAWERS, impl_getLayout() == LAYOUT_DRAWERS );
+
+ pMenu->InsertSeparator();
+ #endif
+
+ // Add entry for docking or un-docking the tool panel.
+ if ( m_rDockingWindow.IsFloatingMode() )
+ pMenu->InsertItem(
+ MID_LOCK_TASK_PANEL,
+ String( SfxResId( STR_SFX_DOCK ) )
+ );
+ else
+ pMenu->InsertItem(
+ MID_UNLOCK_TASK_PANEL,
+ String( SfxResId( STR_SFX_UNDOCK ) )
+ );
+
+ pMenu->RemoveDisabledEntries( FALSE, FALSE );
+
+ return pMenu;
+ }
+
+ //==================================================================================================================
+ //= TaskPaneController
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ TaskPaneController::TaskPaneController( ModuleTaskPane& i_rTaskPane, TitledDockingWindow& i_rDockingWindow )
+ :m_pImpl( new TaskPaneController_Impl( i_rTaskPane, i_rDockingWindow ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TaskPaneController::~TaskPaneController()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TaskPaneController::SetDefaultTitle( const String& i_rTitle )
+ {
+ m_pImpl->SetDefaultTitle( i_rTitle );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TaskPaneController::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL )
+ {
+ m_pImpl->ActivateToolPanel( i_rPanelURL );
+ }
+
+//......................................................................................................................
+} // namespace sfx2
+//......................................................................................................................
diff --git a/sfx2/source/dialog/sfxurl.cxx b/sfx2/source/dialog/taskpane.src
index 47e4062ac350..5a955e8587d1 100644
--- a/sfx2/source/dialog/sfxurl.cxx
+++ b/sfx2/source/dialog/taskpane.src
@@ -1,5 +1,4 @@
/*************************************************************************
- *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -25,17 +24,24 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sfx2.hxx"
-#include <sfx2/filedlghelper.hxx>
-#include <sfxresid.hxx>
-#include <dialog.hrc>
+#include <sfx2/sfx.hrc>
+#include "sfxlocal.hrc"
+
+String STR_SFX_DOCK
+{
+ Text [ en-US ] = "Dock";
+};
+
+String STR_SFX_UNDOCK
+{
+ Text [ en-US ] = "Undock";
+};
-SfxUrlDialog::SfxUrlDialog( Window *pParent )
- : ModalDialog( pParent, SfxResId( RID_URLOPEN ) ),
- aEdit( this, SfxResId(RID_URLOPEN_URL) ),
- aOk( this, SfxResId(RID_URLOPEN_OK) ),
- aCancel( this, SfxResId(RID_URLOPEN_CANCEL) )
+String STR_SFX_TASK_PANE_VIEW
+{
+ Text [ en-US ] = "View";
+};
+String STR_SFX_TASKS
{
- FreeResource();
-}
+ Text [ en-US ] = "Tasks";
+};
diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx
new file mode 100644
index 000000000000..58a61d66ba8b
--- /dev/null
+++ b/sfx2/source/dialog/titledockwin.cxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ * 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_sfx2.hxx"
+
+#include "sfx2/titledockwin.hxx"
+#include "sfx2/bindings.hxx"
+#include "sfx2/dispatch.hxx"
+#include "sfxlocal.hrc"
+#include "sfxresid.hxx"
+
+#include <svl/eitem.hxx>
+
+//......................................................................................................................
+namespace sfx2
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= TitledDockingWindow
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ TitledDockingWindow::TitledDockingWindow( SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow, Window* i_pParent,
+ WinBits i_nStyle )
+ :SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_nStyle )
+ ,m_sTitle()
+ ,m_aToolbox( this )
+ ,m_aContentWindow( this, WB_DIALOGCONTROL )
+ ,m_aBorder( 3, 1, 3, 3 )
+ ,m_bLayoutPending( false )
+ {
+ impl_construct();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TitledDockingWindow::TitledDockingWindow( SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow, Window* i_pParent,
+ const ResId& i_rResId )
+ :SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_rResId )
+ ,m_sTitle()
+ ,m_aToolbox( this )
+ ,m_aContentWindow( this )
+ ,m_aBorder( 3, 1, 3, 3 )
+ ,m_bLayoutPending( false )
+ {
+ impl_construct();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::impl_construct()
+ {
+ SetBackground( Wallpaper() );
+
+ m_aToolbox.SetSelectHdl( LINK( this, TitledDockingWindow, OnToolboxItemSelected ) );
+ m_aToolbox.SetOutStyle( TOOLBOX_STYLE_FLAT );
+ m_aToolbox.SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetDialogColor() ) );
+ m_aToolbox.Show();
+ impl_resetToolBox();
+
+ m_aContentWindow.Show();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ TitledDockingWindow::~TitledDockingWindow()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::SetTitle( const String& i_rTitle )
+ {
+ m_sTitle = i_rTitle;
+ Invalidate();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ String TitledDockingWindow::GetTitle() const
+ {
+ return impl_getTitle();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::SetText( const String& i_rText )
+ {
+ SfxDockingWindow::SetText( i_rText );
+ if ( m_sTitle.Len() == 0 )
+ // our text is used as title, too => repaint
+ Invalidate();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::Resize()
+ {
+ SfxDockingWindow::Resize();
+ impl_scheduleLayout();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::onLayoutDone()
+ {
+ // not interested in
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::impl_scheduleLayout()
+ {
+ m_bLayoutPending = true;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::impl_layout()
+ {
+ m_bLayoutPending = false;
+
+ m_aToolbox.ShowItem( 1, !IsFloatingMode() );
+
+ const Size aToolBoxSize( m_aToolbox.CalcWindowSizePixel() );
+ Size aWindowSize( GetOutputSizePixel() );
+
+ // position the tool box
+ int nTitleBarHeight( GetSettings().GetStyleSettings().GetTitleHeight() );
+ if ( aToolBoxSize.Height() > nTitleBarHeight )
+ nTitleBarHeight = aToolBoxSize.Height();
+ m_aToolbox.SetPosSizePixel(
+ Point(
+ aWindowSize.Width() - aToolBoxSize.Width(),
+ ( nTitleBarHeight - aToolBoxSize.Height() ) / 2
+ ),
+ aToolBoxSize
+ );
+
+ // Place the content window.
+ if ( nTitleBarHeight < aToolBoxSize.Height() )
+ nTitleBarHeight = aToolBoxSize.Height();
+ aWindowSize.Height() -= nTitleBarHeight;
+ m_aContentWindow.SetPosSizePixel(
+ Point( m_aBorder.Left(), nTitleBarHeight + m_aBorder.Top() ),
+ Size(
+ aWindowSize.Width() - m_aBorder.Left() - m_aBorder.Right(),
+ aWindowSize.Height() - m_aBorder.Top() - m_aBorder.Bottom()
+ )
+ );
+
+ onLayoutDone();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::Paint( const Rectangle& i_rArea )
+ {
+ if ( m_bLayoutPending )
+ impl_layout();
+
+ SfxDockingWindow::Paint( i_rArea );
+
+ Push( PUSH_FONT | PUSH_FILLCOLOR | PUSH_LINECOLOR );
+
+ int nTitleBarHeight( GetSettings().GetStyleSettings().GetTitleHeight() );
+ const Size aToolBoxSize = m_aToolbox.CalcWindowSizePixel();
+ if ( aToolBoxSize.Height() > nTitleBarHeight )
+ nTitleBarHeight = aToolBoxSize.Height();
+
+ SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() );
+ SetLineColor();
+
+ // bold font
+ Font aFont( GetFont() );
+ aFont.SetWeight( WEIGHT_BOLD );
+ SetFont( aFont );
+
+ // Set border values.
+ Size aWindowSize( GetOutputSizePixel() );
+ int nOuterLeft = 0;
+ int nInnerLeft = nOuterLeft + m_aBorder.Left() - 1;
+ int nOuterRight = aWindowSize.Width() - 1;
+ int nInnerRight = nOuterRight - m_aBorder.Right() + 1;
+ int nInnerTop = nTitleBarHeight + m_aBorder.Top() - 1;
+ int nOuterBottom = aWindowSize.Height() - 1;
+ int nInnerBottom = nOuterBottom - m_aBorder.Bottom() + 1;
+
+ // Paint title bar background.
+ Rectangle aTitleBarBox( Rectangle(
+ nOuterLeft,
+ 0,
+ nOuterRight,
+ nInnerTop-1
+ ) );
+ DrawRect( aTitleBarBox );
+
+ if ( nInnerLeft > nOuterLeft )
+ DrawRect( Rectangle( nOuterLeft, nInnerTop, nInnerLeft, nInnerBottom ) );
+ if ( nOuterRight > nInnerRight )
+ DrawRect( Rectangle( nInnerRight, nInnerTop, nOuterRight, nInnerBottom ) );
+ if ( nInnerBottom < nOuterBottom )
+ DrawRect( Rectangle( nOuterLeft, nInnerBottom, nOuterRight, nOuterBottom ) );
+
+ // Paint bevel border.
+ SetFillColor();
+ SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
+ if ( m_aBorder.Top() > 0 )
+ DrawLine( Point( nInnerLeft, nInnerTop ), Point( nInnerLeft, nInnerBottom ) );
+ if ( m_aBorder.Left() > 0 )
+ DrawLine( Point( nInnerLeft, nInnerTop ), Point( nInnerRight, nInnerTop ) );
+
+ SetLineColor( GetSettings().GetStyleSettings().GetLightColor() );
+ if ( m_aBorder.Bottom() > 0 )
+ DrawLine( Point( nInnerRight, nInnerBottom ), Point( nInnerLeft, nInnerBottom ) );
+ if ( m_aBorder.Right() > 0 )
+ DrawLine( Point( nInnerRight, nInnerBottom ), Point( nInnerRight, nInnerTop ) );
+
+ // Paint title bar text.
+ SetLineColor( GetSettings().GetStyleSettings().GetActiveTextColor() );
+ aTitleBarBox.Left() += 3;
+ DrawText( aTitleBarBox, impl_getTitle(), TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+
+ // Restore original values of the output device.
+ Pop();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ String TitledDockingWindow::impl_getTitle() const
+ {
+ return m_sTitle.Len() ? m_sTitle : GetText();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::impl_resetToolBox()
+ {
+ m_aToolbox.Clear();
+
+ // Get the closer bitmap and set it as right most button.
+ Image aImage( SfxResId( SFX_IMG_CLOSE_DOC ) );
+ Image aImageHC( SfxResId( SFX_IMG_CLOSE_DOC_HC ) );
+ m_aToolbox.InsertItem( 1,
+ GetSettings().GetStyleSettings().GetHighContrastMode()
+ ? aImageHC
+ : aImage
+ );
+ m_aToolbox.ShowItem( 1 );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ USHORT TitledDockingWindow::impl_addDropDownToolBoxItem( const String& i_rItemText, ULONG i_nHelpId, const Link& i_rCallback )
+ {
+ // Add the menu before the closer button.
+ const USHORT nItemCount( m_aToolbox.GetItemCount() );
+ const USHORT nItemId( nItemCount + 1 );
+ m_aToolbox.InsertItem( nItemId, i_rItemText, TIB_DROPDOWNONLY, nItemCount > 0 ? nItemCount - 1 : TOOLBOX_APPEND );
+ m_aToolbox.SetHelpId( nItemId, i_nHelpId );
+ m_aToolbox.SetClickHdl( i_rCallback );
+ m_aToolbox.SetDropdownClickHdl( i_rCallback );
+
+ // The tool box has likely changed its size. The title bar has to be
+ // resized.
+ impl_scheduleLayout();
+ Invalidate();
+
+ return nItemId;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( TitledDockingWindow, OnToolboxItemSelected, ToolBox*, pToolBox )
+ {
+ const USHORT nId = pToolBox->GetCurItemId();
+
+ if ( nId == 1 )
+ {
+ // the closer
+ EndTracking();
+ const sal_uInt16 nChildWindowId( GetChildWindow_Impl()->GetType() );
+ const SfxBoolItem aVisibility( nChildWindowId, FALSE );
+ GetBindings().GetDispatcher()->Execute(
+ nChildWindowId,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aVisibility,
+ NULL
+ );
+ }
+
+ return 0;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::StateChanged( StateChangedType i_nType )
+ {
+ switch ( i_nType )
+ {
+ case STATE_CHANGE_INITSHOW:
+ impl_scheduleLayout();
+ break;
+ }
+ SfxDockingWindow::StateChanged( i_nType );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::EndDocking( const Rectangle& i_rRect, BOOL i_bFloatMode )
+ {
+ SfxDockingWindow::EndDocking( i_rRect, i_bFloatMode );
+
+ if ( m_aEndDockingHdl.IsSet() )
+ m_aEndDockingHdl.Call( this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void TitledDockingWindow::DataChanged( const DataChangedEvent& i_rDataChangedEvent )
+ {
+ SfxDockingWindow::DataChanged( i_rDataChangedEvent );
+
+ switch ( i_rDataChangedEvent.GetType() )
+ {
+ case DATACHANGED_SETTINGS:
+ if ( ( i_rDataChangedEvent.GetFlags() & SETTINGS_STYLE ) == 0)
+ break;
+ // else fall through.
+ case DATACHANGED_FONTS:
+ case DATACHANGED_FONTSUBSTITUTION:
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ // Font.
+ Font aFont = rStyleSettings.GetAppFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+
+ // Color.
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetButtonTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+
+ impl_scheduleLayout();
+ Invalidate();
+ }
+ break;
+ }
+ }
+
+//......................................................................................................................
+} // namespace sfx2
+//......................................................................................................................
diff --git a/sfx2/source/dialog/titledockwin.src b/sfx2/source/dialog/titledockwin.src
new file mode 100644
index 000000000000..3f52e84ab75d
--- /dev/null
+++ b/sfx2/source/dialog/titledockwin.src
@@ -0,0 +1,39 @@
+/*************************************************************************
+ * 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 <sfx2/sfx.hrc>
+#include "sfxlocal.hrc"
+
+Image SFX_IMG_CLOSE_DOC
+{
+ ImageBitmap = Bitmap { File = "closedoc.png" ; };
+};
+
+Image SFX_IMG_CLOSE_DOC_HC
+{
+ ImageBitmap = Bitmap { File = "closedochc.png" ; };
+};
+
diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc
index 29ad461d18da..848446a774e9 100644
--- a/sfx2/source/inc/helpid.hrc
+++ b/sfx2/source/inc/helpid.hrc
@@ -330,7 +330,8 @@
#define HID_CONFIG_SAVE (HID_SFX_START + 310)
#define HID_SEARCHDIALOG (HID_SFX_START + 311)
-
+#define HID_TASKPANE_WINDOW (HID_SFX_START + 312)
+#define HID_TASKPANE_VIEW_MENU (HID_SFX_START + 313)
#define HID_XMLSEC_WARNING_BROKENSIGNATURE (HID_SFX_START + 314)
#define HID_XMLSEC_QUERY_LOSINGSIGNATURE (HID_SFX_START + 315)
#define HID_XMLSEC_QUERY_SAVEBEFORESIGN (HID_SFX_START + 316)
diff --git a/sfx2/source/inc/sfxlocal.hrc b/sfx2/source/inc/sfxlocal.hrc
index fb21cb0ab13c..202ed6f6f00f 100644
--- a/sfx2/source/inc/sfxlocal.hrc
+++ b/sfx2/source/inc/sfxlocal.hrc
@@ -44,6 +44,10 @@
#define STR_SFX_EXPLORERFILE_BUTTONINSERT (RID_SFX_SFXLOCAL_START + 4)
#define STR_SFX_IMPORT_ALL (RID_SFX_SFXLOCAL_START + 5)
#define STR_SFX_EXPLORERFILE_EXPORT (RID_SFX_SFXLOCAL_START + 6)
+#define STR_SFX_DOCK (RID_SFX_SFXLOCAL_START + 7)
+#define STR_SFX_UNDOCK (RID_SFX_SFXLOCAL_START + 8)
+#define STR_SFX_TASK_PANE_VIEW (RID_SFX_SFXLOCAL_START + 9)
+#define STR_SFX_TASKS (RID_SFX_SFXLOCAL_START + 10)
// Controls --------------------------------------------------------------
@@ -55,13 +59,17 @@
#define SFX_PB_PROPERTY_REMOVE (RID_SFX_SFXLOCAL_START + 5)
#define SFX_WIN_PROPERTY_YESNO (RID_SFX_SFXLOCAL_START + 6)
#define SFX_QB_WRONG_TYPE (RID_SFX_SFXLOCAL_START + 7)
-#define SFX_IMG_PROPERTY_REMOVE (RID_SFX_SFXLOCAL_START + 8)
-#define SFX_IMG_PROPERTY_REMOVE_HC (RID_SFX_SFXLOCAL_START + 9)
#define SFX_FLD_DATE (RID_SFX_SFXLOCAL_START + 10)
#define SFX_FLD_TIME (RID_SFX_SFXLOCAL_START + 11)
#define SFX_FLD_DURATION (RID_SFX_SFXLOCAL_START + 12)
#define SFX_ST_DURATION_FORMAT (RID_SFX_SFXLOCAL_START + 13)
+// Images ----------------------------------------------------------------
+
+#define SFX_IMG_PROPERTY_REMOVE (RID_SFX_SFXLOCAL_START + 0)
+#define SFX_IMG_PROPERTY_REMOVE_HC (RID_SFX_SFXLOCAL_START + 1)
+#define SFX_IMG_CLOSE_DOC (RID_SFX_SFXLOCAL_START + 2)
+#define SFX_IMG_CLOSE_DOC_HC (RID_SFX_SFXLOCAL_START + 3)
#endif
diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx
index ae005d1bad88..a82b72bc2947 100644
--- a/sfx2/source/inc/workwin.hxx
+++ b/sfx2/source/inc/workwin.hxx
@@ -365,6 +365,7 @@ public:
void SetActiveChild_Impl( Window *pChild );
Window* GetActiveChild_Impl();
virtual BOOL ActivateNextChild_Impl( BOOL bForward = TRUE );
+ bool AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const;
// Methoden f"ur StatusBar
void SetTempStatusBar_Impl( BOOL bSet );
diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx
index 5460d613c7e8..abe4cb6852d9 100644
--- a/sfx2/source/view/impviewframe.hxx
+++ b/sfx2/source/view/impviewframe.hxx
@@ -31,6 +31,8 @@
#include <svtools/asynclink.hxx>
#include <vcl/window.hxx>
+#include <boost/optional.hpp>
+
struct SfxViewFrame_Impl
{
SvBorder aBorder;
@@ -56,6 +58,8 @@ struct SfxViewFrame_Impl
sal_Bool bWindowWasEnabled:1;
sal_Bool bActive;
String aFactoryName;
+ ::boost::optional< bool >
+ aHasToolPanels;
SfxViewFrame_Impl( SfxFrame& i_rFrame )
: rFrame( i_rFrame )
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 66af0d7ac8ba..189c9a8aae0e 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -44,6 +44,7 @@
#endif
#include <unotools/moduleoptions.hxx>
#include <svl/intitem.hxx>
+#include <svl/visitem.hxx>
#include <svl/stritem.hxx>
#include <svl/eitem.hxx>
#include <svl/slstitm.hxx>
@@ -94,6 +95,8 @@
#include <svtools/asynclink.hxx>
#include <svl/sharecontrolfile.hxx>
+#include <boost/optional.hpp>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
@@ -108,6 +111,7 @@ namespace css = ::com::sun::star;
// wg. ViewFrame::Current
#include "appdata.hxx"
+#include <sfx2/taskpane.hxx>
#include <sfx2/app.hxx>
#include <sfx2/objface.hxx>
#include "openflag.hxx"
@@ -169,6 +173,19 @@ TYPEINIT1(SfxViewFrameItem, SfxPoolItem);
//=========================================================================
//-------------------------------------------------------------------------
+namespace
+{
+ bool moduleHasToolPanels( SfxViewFrame_Impl& i_rViewFrameImpl )
+ {
+ if ( !i_rViewFrameImpl.aHasToolPanels )
+ {
+ i_rViewFrameImpl.aHasToolPanels.reset( ::sfx2::ModuleTaskPane::ModuleHasToolPanels(
+ i_rViewFrameImpl.rFrame.GetFrameInterface() ) );
+ }
+ return *i_rViewFrameImpl.aHasToolPanels;
+ }
+}
+//-------------------------------------------------------------------------
void SfxViewFrame::SetDowning_Impl()
{
pImp->bIsDowning = sal_True;
@@ -3294,6 +3311,22 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState )
else if ( KnowsChildWindow(nSID) )
rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) );
}
+ else if ( nSID == SID_TASKPANE )
+ {
+ if ( !KnowsChildWindow( nSID ) )
+ {
+ OSL_ENSURE( false, "SID_TASKPANE state requested, but no task pane child window exists for this ID!" );
+ rState.DisableItem( nSID );
+ }
+ else if ( !moduleHasToolPanels( *pImp ) )
+ {
+ rState.Put( SfxVisibilityItem( nSID, sal_False ) );
+ }
+ else
+ {
+ rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) );
+ }
+ }
else if ( KnowsChildWindow(nSID) )
rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) );
else
@@ -3381,3 +3414,37 @@ void SfxViewFrame::SetViewFrame( SfxViewFrame* pFrame )
{
SFX_APP()->SetViewFrame_Impl( pFrame );
}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SfxViewFrame::ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ // look up the SfxFrame for the given XFrame
+ SfxFrame* pFrame = NULL;
+ for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) )
+ {
+ if ( pFrame->GetFrameInterface() == i_rFrame )
+ break;
+ }
+ SfxViewFrame* pViewFrame = pFrame ? pFrame->GetCurrentViewFrame() : NULL;
+ ENSURE_OR_RETURN_VOID( pViewFrame != NULL, "SfxViewFrame::ActivateToolPanel: did not find an SfxFrame for the given XFrame!" );
+
+ pViewFrame->ActivateToolPanel_Impl( i_rPanelURL );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SfxViewFrame::ActivateToolPanel_Impl( const ::rtl::OUString& i_rPanelURL )
+{
+ // ensure the task pane is visible
+ ENSURE_OR_RETURN_VOID( KnowsChildWindow( SID_TASKPANE ), "SfxViewFrame::ActivateToolPanel: this frame/module does not allow for a task pane!" );
+ if ( !HasChildWindow( SID_TASKPANE ) )
+ ToggleChildWindow( SID_TASKPANE );
+
+ SfxChildWindow* pTaskPaneChildWindow = GetChildWindow( SID_TASKPANE );
+ ENSURE_OR_RETURN_VOID( pTaskPaneChildWindow, "SfxViewFrame::ActivateToolPanel_Impl: just switched it on, but it is not there!" );
+
+ ::sfx2::ITaskPaneToolPanelAccess* pPanelAccess = dynamic_cast< ::sfx2::ITaskPaneToolPanelAccess* >( pTaskPaneChildWindow );
+ ENSURE_OR_RETURN_VOID( pPanelAccess, "SfxViewFrame::ActivateToolPanel_Impl: task pane child window does not implement a required interface!" );
+ pPanelAccess->ActivateToolPanel( i_rPanelURL );
+}
diff --git a/sfx2/util/hidother.src b/sfx2/util/hidother.src
index 72b178b2d629..bbea19100df9 100644
--- a/sfx2/util/hidother.src
+++ b/sfx2/util/hidother.src
@@ -165,3 +165,4 @@ hidspecial HID_DID_SAVE_PACKED_XML { HelpID = HID_DID_SAVE_PACKED_X
hidspecial HID_HELP_ONHELP { HelpID = HID_HELP_ONHELP; };
hidspecial HID_HELP_TEXT_SELECTION_MODE { HelpID = HID_HELP_TEXT_SELECTION_MODE; };
hidspecial HID_DLG_CHECKFORONLINEUPDATE { HelpID = HID_DLG_CHECKFORONLINEUPDATE; };
+hidspecial HID_TASKPANE_VIEW_MENU { HelpID = HID_TASKPANE_VIEW_MENU; }; \ No newline at end of file
diff --git a/sfx2/win/res/expdesk.ico b/sfx2/win/res/expdesk.ico
deleted file mode 100644
index 06fb6e712e89..000000000000
--- a/sfx2/win/res/expdesk.ico
+++ /dev/null
Binary files differ
diff --git a/sfx2/win/res/expexp.ico b/sfx2/win/res/expexp.ico
deleted file mode 100644
index e0643765f605..000000000000
--- a/sfx2/win/res/expexp.ico
+++ /dev/null
Binary files differ
diff --git a/sfx2/win/res/expfld.ico b/sfx2/win/res/expfld.ico
deleted file mode 100644
index aeefecbdad51..000000000000
--- a/sfx2/win/res/expfld.ico
+++ /dev/null
Binary files differ
diff --git a/sfx2/win/res/expftp.ico b/sfx2/win/res/expftp.ico
deleted file mode 100644
index e1a442067d35..000000000000
--- a/sfx2/win/res/expftp.ico
+++ /dev/null
Binary files differ
diff --git a/sfx2/win/res/exptrash.ico b/sfx2/win/res/exptrash.ico
deleted file mode 100644
index 5c3e956863c3..000000000000
--- a/sfx2/win/res/exptrash.ico
+++ /dev/null
Binary files differ
diff --git a/sfx2/win/res/expwork.ico b/sfx2/win/res/expwork.ico
deleted file mode 100644
index 93fe39c7a492..000000000000
--- a/sfx2/win/res/expwork.ico
+++ /dev/null
Binary files differ
diff --git a/sfx2/win/res/frameset.ico b/sfx2/win/res/frameset.ico
deleted file mode 100644
index c9546f1e4d40..000000000000
--- a/sfx2/win/res/frameset.ico
+++ /dev/null
Binary files differ
diff --git a/sfx2/win/res/search.ico b/sfx2/win/res/search.ico
deleted file mode 100644
index 13e96131e3b8..000000000000
--- a/sfx2/win/res/search.ico
+++ /dev/null
Binary files differ
diff --git a/sfx2/workben/custompanel/CalcWindowState.xcu b/sfx2/workben/custompanel/CalcWindowState.xcu
new file mode 100644
index 000000000000..2f224f32aa77
--- /dev/null
+++ b/sfx2/workben/custompanel/CalcWindowState.xcu
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data oor:name="CalcWindowState" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <node oor:name="UIElements">
+ <node oor:name="States">
+ <node oor:name="private:resource/toolpanel/org.openoffice.example.colorpanel/0000FF" oor:op="replace">
+ <prop oor:name="UIName" oor:type="xs:string">
+ <value xml:lang="en-US">Soylent Blue</value>
+ </prop>
+ <prop oor:name="Visible" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ <prop oor:name="ImageURL" oor:type="xs:string">
+ <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value>
+ </prop>
+ <prop oor:name="HelpURL" oor:type="xs:string">
+ <value>vnd.sun.star.help://UPDATED_IDENTIFIER/colorpanel</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/sfx2/workben/custompanel/DrawWindowState.xcu b/sfx2/workben/custompanel/DrawWindowState.xcu
new file mode 100644
index 000000000000..3c0992bc4871
--- /dev/null
+++ b/sfx2/workben/custompanel/DrawWindowState.xcu
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data oor:name="DrawWindowState" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <node oor:name="UIElements">
+ <node oor:name="States">
+ <node oor:name="private:resource/toolpanel/org.openoffice.example.colorpanel/FFFF00" oor:op="replace">
+ <prop oor:name="UIName" oor:type="xs:string">
+ <value xml:lang="en-US">Soylent Yellow</value>
+ </prop>
+ <prop oor:name="Visible" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ <prop oor:name="ImageURL" oor:type="xs:string">
+ <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value>
+ </prop>
+ <prop oor:name="HelpURL" oor:type="xs:string">
+ <value>vnd.sun.star.help://UPDATED_IDENTIFIER/colorpanel</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/sfx2/workben/custompanel/Factories.xcu b/sfx2/workben/custompanel/Factories.xcu
new file mode 100644
index 000000000000..f8df23e9f40a
--- /dev/null
+++ b/sfx2/workben/custompanel/Factories.xcu
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data oor:name="Factories" oor:package="org.openoffice.Office.UI" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <node oor:name="Registered">
+ <node oor:name="UIElementFactories">
+ <node oor:name="org.openoffice.example.CustomToolPanel" oor:op="replace">
+ <prop oor:name="Type">
+ <value>toolpanel</value>
+ </prop>
+ <prop oor:name="Name">
+ <value>org.openoffice.example.colorpanel</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="FactoryImplementation">
+ <value>org.openoffice.example.colorpanel.ToolPanelFactory</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/sfx2/workben/custompanel/ImpressWindowState.xcu b/sfx2/workben/custompanel/ImpressWindowState.xcu
new file mode 100644
index 000000000000..0fc1bb9d40c8
--- /dev/null
+++ b/sfx2/workben/custompanel/ImpressWindowState.xcu
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data oor:name="ImpressWindowState" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <node oor:name="UIElements">
+ <node oor:name="States">
+ <node oor:name="private:resource/toolpanel/org.openoffice.example.colorpanel/FFCC99" oor:op="replace">
+ <prop oor:name="UIName" oor:type="xs:string">
+ <value xml:lang="en-US">Soylent Orange</value>
+ </prop>
+ <prop oor:name="Visible" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ <prop oor:name="ImageURL" oor:type="xs:string">
+ <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value>
+ </prop>
+ <prop oor:name="HelpURL" oor:type="xs:string">
+ <value>vnd.sun.star.help://UPDATED_IDENTIFIER/colorpanel</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/sfx2/workben/custompanel/WriterWindowState.xcu b/sfx2/workben/custompanel/WriterWindowState.xcu
new file mode 100644
index 000000000000..f1edd4a12881
--- /dev/null
+++ b/sfx2/workben/custompanel/WriterWindowState.xcu
@@ -0,0 +1,35 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data oor:name="WriterWindowState" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <node oor:name="UIElements">
+ <node oor:name="States">
+ <node oor:name="private:resource/toolpanel/org.openoffice.example.colorpanel/00FF00" oor:op="replace">
+ <prop oor:name="UIName" oor:type="xs:string">
+ <value xml:lang="en-US">Soylent Green</value>
+ </prop>
+ <prop oor:name="Visible" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ <prop oor:name="ImageURL" oor:type="xs:string">
+ <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value>
+ </prop>
+ <prop oor:name="HelpURL" oor:type="xs:string">
+ <value>vnd.sun.star.help://UPDATED_IDENTIFIER/colorpanel</value>
+ </prop>
+ </node>
+ <node oor:name="private:resource/toolpanel/org.openoffice.example.colorpanel/FF0000" oor:op="replace">
+ <prop oor:name="UIName" oor:type="xs:string">
+ <value xml:lang="en-US">Soylent Red</value>
+ </prop>
+ <prop oor:name="Visible" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ <prop oor:name="ImageURL" oor:type="xs:string">
+ <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value>
+ </prop>
+ <prop oor:name="HelpURL" oor:type="xs:string">
+ <value>vnd.sun.star.help://UPDATED_IDENTIFIER/colorpanel</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/sfx2/workben/custompanel/ctp_factory.cxx b/sfx2/workben/custompanel/ctp_factory.cxx
new file mode 100644
index 000000000000..54880cc5fcc7
--- /dev/null
+++ b/sfx2/workben/custompanel/ctp_factory.cxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ * 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_sfx2.hxx"
+
+#include "ctp_factory.hxx"
+#include "ctp_panel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/NotInitializedException.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::uno::XComponentContext;
+ using ::com::sun::star::lang::NotInitializedException;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::ui::XUIElement;
+ using ::com::sun::star::beans::PropertyValue;
+ using ::com::sun::star::container::NoSuchElementException;
+ using ::com::sun::star::beans::PropertyValue;
+ using ::com::sun::star::awt::XWindow;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= ToolPanelFactory
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ 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)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !i_rResourceURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/org.openoffice.example.colorpanel/" ) ) )
+ throw NoSuchElementException( i_rResourceURL, *this );
+
+ const ::rtl::OUString sColor( i_rResourceURL.copy( i_rResourceURL.lastIndexOf( '/' ) + 1 ) );
+ const sal_Int32 nPanelColor = sColor.toInt32( 16 );
+
+ // retrieve the parent window
+ Reference< XWindow > xParentWindow;
+ const PropertyValue* pArg = i_rArgs.getConstArray();
+ const PropertyValue* pArgEnd = i_rArgs.getConstArray() + i_rArgs.getLength();
+ for ( ; pArg != pArgEnd; ++pArg )
+ {
+ if ( pArg->Name.equalsAscii( "ParentWindow" ) )
+ {
+ xParentWindow.set( pArg->Value, UNO_QUERY );
+ break;
+ }
+ }
+ if ( !xParentWindow.is() )
+ {
+ OSL_ENSURE( false, "ToolPanelFactory::createUIElement: no parent window in the args!" );
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No parent window provided in the creation arguments. Cannot create tool panel." ) ),
+ *this,
+ 2
+ );
+ }
+
+ /// create the panel
+ Reference< XUIElement > xUIElement( new PanelUIElement( m_xContext, xParentWindow, i_rResourceURL, nPanelColor ) );
+ return xUIElement;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ToolPanelFactory::getImplementationName( ) throw (RuntimeException)
+ {
+ return getImplementationName_static();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ToolPanelFactory::getImplementationName_static( ) throw (RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.example.custompanel.ToolPanelFactory" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL ToolPanelFactory::supportsService( const ::rtl::OUString& i_rServiceName ) throw (RuntimeException)
+ {
+ const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() );
+ for ( const ::rtl::OUString* serviceName = aServiceNames.getConstArray();
+ serviceName != aServiceNames.getConstArray() + aServiceNames.getLength();
+ ++serviceName
+ )
+ {
+ if ( i_rServiceName == *serviceName )
+ return sal_True;
+ }
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames() throw (RuntimeException)
+ {
+ return getSupportedServiceNames_static();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames_static() throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServiceNames(1);
+ aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.example.colorpanel.ToolPanelFactory" ) );
+ return aServiceNames;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL ToolPanelFactory::Create( const Reference< XComponentContext >& i_rContext ) throw (RuntimeException)
+ {
+ return *( new ToolPanelFactory( i_rContext ) );
+ }
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
diff --git a/sfx2/workben/custompanel/ctp_factory.hxx b/sfx2/workben/custompanel/ctp_factory.hxx
new file mode 100644
index 000000000000..8a359f59caaf
--- /dev/null
+++ b/sfx2/workben/custompanel/ctp_factory.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SD_WORKBENCH_CTP_FACTORY_HXX
+#define SD_WORKBENCH_CTP_FACTORY_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ class FactoryGuard;
+
+ //==================================================================================================================
+ //= ToolPanelFactory
+ //==================================================================================================================
+ typedef ::cppu::WeakImplHelper2 < ::com::sun::star::ui::XUIElementFactory
+ , ::com::sun::star::lang::XServiceInfo
+ > ToolPanelFactory_Base;
+ class ToolPanelFactory :public ::cppu::BaseMutex
+ ,public ToolPanelFactory_Base
+ {
+ public:
+ ToolPanelFactory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext
+ );
+ ~ToolPanelFactory();
+
+ // XUIElementFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& i_rResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rArgs ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo - static versions
+ static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+ };
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
+
+#endif // SD_WORKBENCH_CTP_FACTORY_HXX
diff --git a/sfx2/workben/custompanel/ctp_panel.cxx b/sfx2/workben/custompanel/ctp_panel.cxx
new file mode 100644
index 000000000000..ee94287bedbf
--- /dev/null
+++ b/sfx2/workben/custompanel/ctp_panel.cxx
@@ -0,0 +1,270 @@
+/*************************************************************************
+ * 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_sfx2.hxx"
+
+#include "ctp_panel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/WindowClass.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/awt/XGraphics.hpp>
+#include <com/sun/star/ui/UIElementType.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::uno::XComponentContext;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::awt::XWindowPeer;
+ using ::com::sun::star::lang::XMultiComponentFactory;
+ using ::com::sun::star::awt::XToolkit;
+ using ::com::sun::star::awt::WindowDescriptor;
+ using ::com::sun::star::awt::WindowClass_SIMPLE;
+ using ::com::sun::star::awt::Rectangle;
+ using ::com::sun::star::awt::PaintEvent;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::awt::XDevice;
+ using ::com::sun::star::awt::XGraphics;
+ using ::com::sun::star::accessibility::XAccessible;
+ using ::com::sun::star::frame::XFrame;
+ /** === end UNO using === **/
+ namespace WindowAttribute = ::com::sun::star::awt::WindowAttribute;
+ namespace PosSize = ::com::sun::star::awt::PosSize;
+ namespace UIElementType = ::com::sun::star::ui::UIElementType;
+
+ //==================================================================================================================
+ //= helpers
+ //==================================================================================================================
+ namespace
+ {
+ Reference< XWindow > lcl_createPlainWindow_nothrow( const Reference< XComponentContext >& i_rContext,
+ const Reference< XWindowPeer >& i_rParentWindow )
+ {
+ try
+ {
+ ENSURE_OR_THROW( i_rContext.is(), "illegal component context" );
+ Reference< XMultiComponentFactory > xFactory( i_rContext->getServiceManager(), UNO_SET_THROW );
+ Reference< XToolkit > xToolkit( xFactory->createInstanceWithContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ),
+ i_rContext
+ ), UNO_QUERY_THROW );
+
+ WindowDescriptor aWindow;
+ aWindow.Type = WindowClass_SIMPLE;
+ aWindow.WindowServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "window" ) );
+ aWindow.Parent = i_rParentWindow;
+ aWindow.WindowAttributes = WindowAttribute::BORDER;
+
+ Reference< XWindowPeer > xWindow( xToolkit->createWindow( aWindow ), UNO_SET_THROW );
+ return Reference< XWindow >( xWindow, UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return NULL;
+ }
+ }
+ //==================================================================================================================
+ //= class SingleColorPanel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow, const ::sal_Int32 i_nPanelColor )
+ :SingleColorPanel_Base( m_aMutex )
+ ,m_xWindow()
+ ,m_nPanelColor( i_nPanelColor )
+ {
+ // retrieve the parent window for our to-be-created pane window
+ Reference< XWindowPeer > xParentPeer( i_rParentWindow, UNO_QUERY );
+
+ osl_incrementInterlockedCount( &m_refCount );
+ if ( xParentPeer.is() )
+ {
+ m_xWindow = lcl_createPlainWindow_nothrow( i_rContext, xParentPeer );
+ m_xWindow->addPaintListener( this );
+ if ( m_xWindow.is() )
+ {
+ const Rectangle aPanelAnchorSize( i_rParentWindow->getPosSize() );
+ m_xWindow->setPosSize( 0, 0, aPanelAnchorSize.Width, aPanelAnchorSize.Height, PosSize::POSSIZE );
+ m_xWindow->setVisible( sal_True );
+ }
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SingleColorPanel::~SingleColorPanel()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XWindow > SAL_CALL SingleColorPanel::getWindow() throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xWindow.is() )
+ throw DisposedException( ::rtl::OUString(), *this );
+ return m_xWindow;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL SingleColorPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xWindow.is() )
+ throw DisposedException( ::rtl::OUString(), *this );
+
+ // TODO: the following is wrong, since it doesn't respect i_rParentAccessible. In a real extension, you should
+ // implement this correctly :)
+ (void)i_rParentAccessible;
+ return Reference< XAccessible >( getWindow(), UNO_QUERY );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SingleColorPanel::windowPaint( const PaintEvent& i_rEvent ) throw (RuntimeException)
+ {
+ try
+ {
+ const Reference< XDevice > xDevice( i_rEvent.Source, UNO_QUERY_THROW );
+ const Reference< XGraphics > xGraphics( xDevice->createGraphics(), UNO_SET_THROW );
+ xGraphics->setFillColor( m_nPanelColor );
+ xGraphics->setLineColor( 0x00FFFFFF );
+
+ const Reference< XWindow > xWindow( i_rEvent.Source, UNO_QUERY_THROW );
+ const Rectangle aWindowRect( xWindow->getPosSize() );
+ xGraphics->drawRect( 0, 0, aWindowRect.Width - 1, aWindowRect.Height - 1 );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SingleColorPanel::disposing( const EventObject& i_rSource ) throw (RuntimeException)
+ {
+ (void)i_rSource;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SingleColorPanel::disposing()
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xWindow.is() )
+ // already disposed
+ return;
+ m_xWindow->removePaintListener( this );
+ try
+ {
+ Reference< XComponent > xWindowComp( m_xWindow, UNO_QUERY_THROW );
+ xWindowComp->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ m_xWindow.clear();
+ }
+
+ //==================================================================================================================
+ //= PanelUIElement
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ PanelUIElement::PanelUIElement( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow,
+ const ::rtl::OUString& i_rResourceURL, const ::sal_Int32 i_nPanelColor )
+ :PanelUIElement_Base( m_aMutex )
+ ,m_sResourceURL( i_rResourceURL )
+ ,m_xToolPanel( new SingleColorPanel( i_rContext, i_rParentWindow, i_nPanelColor ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ PanelUIElement::~PanelUIElement()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XFrame > SAL_CALL PanelUIElement::getFrame() throw (RuntimeException)
+ {
+ // TODO
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL PanelUIElement::getResourceURL() throw (RuntimeException)
+ {
+ return m_sResourceURL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int16 SAL_CALL PanelUIElement::getType() throw (RuntimeException)
+ {
+ return UIElementType::TOOLPANEL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL PanelUIElement::getRealInterface( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xToolPanel.is() )
+ throw DisposedException();
+ return m_xToolPanel;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL PanelUIElement::disposing()
+ {
+ Reference< XComponent > xPanelComponent( m_xToolPanel, UNO_QUERY_THROW );
+ m_xToolPanel.clear();
+ xPanelComponent->dispose();
+ }
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
diff --git a/sfx2/workben/custompanel/ctp_panel.hxx b/sfx2/workben/custompanel/ctp_panel.hxx
new file mode 100644
index 000000000000..39c46c9d93a5
--- /dev/null
+++ b/sfx2/workben/custompanel/ctp_panel.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SD_WORKBENCH_CTP_PANEL_HXX
+#define SD_WORKBENCH_CTP_PANEL_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/XToolPanel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/awt/XPaintListener.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/ui/XUIElement.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= SingleColorPanel
+ //==================================================================================================================
+ typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::ui::XToolPanel
+ , ::com::sun::star::awt::XPaintListener
+ > SingleColorPanel_Base;
+ class SingleColorPanel :public ::cppu::BaseMutex
+ ,public SingleColorPanel_Base
+ {
+ public:
+ SingleColorPanel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
+ const ::sal_Int32 i_nPanelColor
+ );
+
+ // 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 >& i_rParentAccessible ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XPaintListener
+ virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent equivalents
+ virtual void SAL_CALL disposing();
+
+ protected:
+ ~SingleColorPanel();
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow;
+ const sal_Int32 m_nPanelColor;
+ };
+
+ //==================================================================================================================
+ //= PanelUIElement
+ //==================================================================================================================
+ typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XUIElement
+ > PanelUIElement_Base;
+ class PanelUIElement :public ::cppu::BaseMutex
+ ,public PanelUIElement_Base
+ {
+ public:
+ PanelUIElement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
+ const ::rtl::OUString& i_rResourceURL,
+ const ::sal_Int32 i_nPanelColor
+ );
+
+ // 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);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ protected:
+ ~PanelUIElement();
+
+ private:
+ const ::rtl::OUString m_sResourceURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >
+ m_xToolPanel;
+ };
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
+
+#endif // SD_WORKBENCH_CTP_PANEL_HXX
diff --git a/sfx2/workben/custompanel/ctp_services.cxx b/sfx2/workben/custompanel/ctp_services.cxx
new file mode 100644
index 000000000000..4164e8bc1629
--- /dev/null
+++ b/sfx2/workben/custompanel/ctp_services.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_sfx2.hxx"
+
+#include "ctp_factory.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <cppuhelper/implementationentry.hxx>
+
+//......................................................................................................................
+namespace sd { namespace colortoolpanel
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= descriptors for the services implemented in this component
+ //==================================================================================================================
+ static struct ::cppu::ImplementationEntry s_aServiceEntries[] =
+ {
+ {
+ ToolPanelFactory::Create,
+ ToolPanelFactory::getImplementationName_static,
+ ToolPanelFactory::getSupportedServiceNames_static,
+ ::cppu::createSingleComponentFactory, NULL, 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+ };
+
+//......................................................................................................................
+} } // namespace sd::colortoolpanel
+//......................................................................................................................
+
+extern "C"
+{
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
+ {
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey )
+ {
+ return ::cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, ::sd::colortoolpanel::s_aServiceEntries );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+ {
+ return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , ::sd::colortoolpanel::s_aServiceEntries );
+ }
+}
diff --git a/sfx2/workben/custompanel/delzip b/sfx2/workben/custompanel/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/sfx2/workben/custompanel/delzip
diff --git a/sfx2/workben/custompanel/description.xml b/sfx2/workben/custompanel/description.xml
new file mode 100644
index 000000000000..7b85d64eaf69
--- /dev/null
+++ b/sfx2/workben/custompanel/description.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description
+ xmlns="http://openoffice.org/extensions/description/2006"
+ xmlns:d="http://openoffice.org/extensions/description/2006"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <identifier value="UPDATED_IDENTIFIER"/>
+ <version value="0.1" />
+ <platform value="UPDATED_SUPPORTED_PLATFORM" />
+ <display-name>
+ <name lang="en-US">Custom Tool Panel Example</name>
+ </display-name>
+ <dependencies>
+ <OpenOffice.org-minimal-version value="3.3" d:name="OpenOffice.org 3.3"/>
+ </dependencies>
+</description>
diff --git a/sfx2/workben/custompanel/makefile.mk b/sfx2/workben/custompanel/makefile.mk
new file mode 100644
index 000000000000..1eb20ceed35d
--- /dev/null
+++ b/sfx2/workben/custompanel/makefile.mk
@@ -0,0 +1,120 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=../..
+PRJNAME=sfx2
+
+TARGET=custompanel
+ENABLE_EXCEPTIONS=TRUE
+LIBTARGET=NO
+EXTENSIONNAME:=custom-tool-panel
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+#-------------------------------------------------------------------
+
+#---- extension version
+EXTENSION_VERSION_BASE=0.1
+.IF ( "$(CWS_WORK_STAMP)" == "" ) || ( "$(UPDATER)" == "YES" )
+ EXTENSION_VERSION=$(EXTENSION_VERSION_BASE)
+.ELSE
+ EXTENSION_VERSION=$(EXTENSION_VERSION_BASE).cws.$(CWS_WORK_STAMP)
+.ENDIF
+
+#---- extension title package name
+EXTENSION_TITLE=Custom Tool Panel Example
+EXTENSION_ZIPNAME=$(EXTENSIONNAME)-$(EXTENSION_VERSION_BASE)-$(RTL_OS:l)-$(RTL_ARCH:l)
+
+#--------------------------------------------------
+
+SHL1DLLPRE=
+SHL1TARGET=$(TARGET).uno
+LIB1TARGET=$(SLB)/$(SHL1TARGET).lib
+LIB1OBJFILES= \
+ $(SLO)/ctp_factory.obj \
+ $(SLO)/ctp_services.obj \
+ $(SLO)/ctp_panel.obj
+
+SHL1STDLIBS= \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(SALHELPERLIB) \
+ $(CPPUHELPERLIB)
+
+SHL1VERSIONMAP=$(SOLARSRC)/solenv/src/component.map
+SHL1LIBS= $(LIB1TARGET)
+SHL1DEF= $(MISC)/$(SHL1TARGET).def
+SHL1RPATH= OXT
+DEF1NAME= $(SHL1TARGET)
+
+# create Extension -----------------------------
+
+COMPONENT_CONFIGDEST=.
+
+COMPONENT_XCU = \
+ $(EXTENSIONDIR)/WriterWindowState.xcu \
+ $(EXTENSIONDIR)/CalcWindowState.xcu \
+ $(EXTENSIONDIR)/DrawWindowState.xcu \
+ $(EXTENSIONDIR)/ImpressWindowState.xcu \
+ $(EXTENSIONDIR)/Factories.xcu
+
+COMPONENT_LIBRARIES = \
+ $(EXTENSIONDIR)/$(SHL1TARGET)$(DLLPOST)
+
+COMPONENT_IMAGES= \
+ $(EXTENSIONDIR)/panel.png
+
+# ........ dependencies for packaging the extension ........
+EXTENSION_PACKDEPS=makefile.mk $(COMPONENT_IMAGES)
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : extension_pre.mk
+.INCLUDE : target.mk
+.INCLUDE : extension_post.mk
+
+$(EXTENSIONDIR)/%.png : ./%.png
+ @@-$(MKDIRHIER) $(@:d)
+ @$(COPY) $< $@ > $(NULLDEV)
+
+$(EXTENSIONDIR)/WriterWindowState.xcu: ./WriterWindowState.xcu
+ @@-$(MKDIRHIER) $(@:d)
+ $(COMMAND_ECHO)$(TYPE) ./WriterWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/WriterWindowState.xcu
+
+$(EXTENSIONDIR)/CalcWindowState.xcu: ./CalcWindowState.xcu
+ @@-$(MKDIRHIER) $(@:d)
+ $(COMMAND_ECHO)$(TYPE) ./CalcWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/CalcWindowState.xcu
+
+$(EXTENSIONDIR)/DrawWindowState.xcu: ./DrawWindowState.xcu
+ @@-$(MKDIRHIER) $(@:d)
+ $(COMMAND_ECHO)$(TYPE) ./DrawWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/DrawWindowState.xcu
+
+$(EXTENSIONDIR)/ImpressWindowState.xcu: ./ImpressWindowState.xcu
+ @@-$(MKDIRHIER) $(@:d)
+ $(COMMAND_ECHO)$(TYPE) ./ImpressWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/ImpressWindowState.xcu
+
diff --git a/sfx2/workben/custompanel/manifest.xml b/sfx2/workben/custompanel/manifest.xml
new file mode 100644
index 000000000000..9122d16a4189
--- /dev/null
+++ b/sfx2/workben/custompanel/manifest.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
+<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=native"
+ manifest:full-path="custompanel.unoSHARED_EXTENSION"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="WriterWindowState.xcu"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="CalcWindowState.xcu"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="DrawWindowState.xcu"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="ImpressWindowState.xcu"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="Factories.xcu"/>
+ <!-- <manifest:file-entry manifest:media-type="image/png"
+ manifest:full-path="panel.png"/>-->
+</manifest:manifest>
diff --git a/sfx2/workben/custompanel/panel.png b/sfx2/workben/custompanel/panel.png
new file mode 100644
index 000000000000..2438714af8a6
--- /dev/null
+++ b/sfx2/workben/custompanel/panel.png
Binary files differ