From 8602973c35b4a3bd545ca9ae280e5e7125ae73dd Mon Sep 17 00:00:00 2001
From: "Frank Schoenheit [fs]" <frank.schoenheit@sun.com>
Date: Wed, 14 Apr 2010 20:24:29 +0200
Subject: slidecopy: allow sorting the tool panels in the TaskPane (so far, the
 implicit ordering was defined by the order in which the config nodes were
 returned by the config manager)

---
 sd/source/ui/inc/taskpane/PanelId.hxx         | 13 +++++++------
 sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 18 +++++++++++++++++-
 2 files changed, 24 insertions(+), 7 deletions(-)

(limited to 'sd/source')

diff --git a/sd/source/ui/inc/taskpane/PanelId.hxx b/sd/source/ui/inc/taskpane/PanelId.hxx
index 43018f11f177..565745f97140 100644
--- a/sd/source/ui/inc/taskpane/PanelId.hxx
+++ b/sd/source/ui/inc/taskpane/PanelId.hxx
@@ -44,12 +44,13 @@ namespace sd { namespace toolpanel
     */
     enum PanelId
     {
-        PID_UNKNOWN             = 0,
-        PID_MASTER_PAGES        = 1,
-        PID_LAYOUT              = 2,
-        PID_TABLE_DESIGN        = 3,
-        PID_CUSTOM_ANIMATION    = 4,
-        PID_SLIDE_TRANSITION    = 5
+        PID_MASTER_PAGES        = 0,
+        PID_LAYOUT              = 1,
+        PID_TABLE_DESIGN        = 2,
+        PID_CUSTOM_ANIMATION    = 3,
+        PID_SLIDE_TRANSITION    = 4,
+
+        PID_UNKNOWN             = 5
     };
 
     PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL );
diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
index 336ef3b6622c..204559043647 100755
--- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
+++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
@@ -211,6 +211,7 @@ private:
 */
 class ToolPanelViewShell_Impl   :public ::boost::noncopyable
                                 ,public ::svt::IToolPanelDeckListener
+                                ,public ::sfx2::IToolPanelCompare
 {
 public:
     static const size_t mnInvalidId = static_cast< size_t >( -1 );
@@ -259,6 +260,9 @@ private:
     virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter );
     virtual void Dying();
 
+    // IToolPanelCompare overridables
+    virtual short compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const;
+
 private:
     struct InitialPanel
     {
@@ -735,7 +739,7 @@ void ToolPanelViewShell::DeactivatePanel( const ::rtl::OUString& i_rPanelResourc
 // ---------------------------------------------------------------------------------------------------------------------
 ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent )
     :m_rPanelViewShell( i_rPanelViewShell )
-    ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() ) )
+    ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface(), *this ) )
     ,m_bInitialized( false )
 {
     const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) );
@@ -830,6 +834,18 @@ void ToolPanelViewShell_Impl::Dying()
     // not interested in
 }
 
+// ---------------------------------------------------------------------------------------------------------------------
+short ToolPanelViewShell_Impl::compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const
+{
+    const PanelId eLHS( GetStandardPanelId( i_rLHS, true ) );
+    const PanelId eRHS( GetStandardPanelId( i_rRHS, true ) );
+    if ( eLHS < eRHS )
+        return -1;
+    if ( eLHS == eRHS )
+        return 0;
+    return 1;
+}
+
 // ---------------------------------------------------------------------------------------------------------------------
 void ToolPanelViewShell_Impl::ConnectToDockingWindow()
 {
-- 
cgit