[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sfx2/inc sfx2/Library_sfx.mk sfx2/Package_inc.mk sfx2/source svx/source

Andre Fischer af at apache.org
Tue May 14 09:07:46 PDT 2013


 sfx2/Library_sfx.mk                               |    1 
 sfx2/Package_inc.mk                               |   17 -
 sfx2/inc/sfx2/sidebar/ControlFactory.hxx          |   19 +
 sfx2/inc/sfx2/sidebar/ControllerFactory.hxx       |   49 +++
 sfx2/inc/sfx2/sidebar/EnumContext.hxx             |    3 
 sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx          |  105 +++++++
 sfx2/source/sidebar/ControlFactory.cxx            |   22 +
 sfx2/source/sidebar/ControllerFactory.cxx         |  108 +++++++
 sfx2/source/sidebar/EnumContext.cxx               |   50 ++-
 sfx2/source/sidebar/SidebarController.cxx         |   14 
 sfx2/source/sidebar/SidebarController.hxx         |    6 
 sfx2/source/sidebar/SidebarToolBox.cxx            |  197 +++++++++++++
 sfx2/source/sidebar/SidebarToolBox.hxx            |   57 ----
 sfx2/source/sidebar/ToolBoxBackground.cxx         |    4 
 svx/source/sidebar/PanelFactory.cxx               |    5 
 svx/source/sidebar/insert/InsertPropertyPanel.cxx |  312 +---------------------
 svx/source/sidebar/insert/InsertPropertyPanel.hxx |   32 --
 svx/source/sidebar/text/TextPropertyPanel.cxx     |  188 +------------
 svx/source/sidebar/text/TextPropertyPanel.hrc     |    4 
 svx/source/sidebar/text/TextPropertyPanel.hxx     |   24 -
 svx/source/sidebar/text/TextPropertyPanel.src     |   21 +
 21 files changed, 623 insertions(+), 615 deletions(-)

New commits:
commit 3b252796e1126b5ec1216082f55b8d12017eaeb1
Author: Andre Fischer <af at apache.org>
Date:   Tue May 14 15:21:57 2013 +0000

    122302: Use tool bar controls for color controls in text property panel.

diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index c10196b..7695d47 100755
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -224,6 +224,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/sidebar/ContextChangeBroadcaster \
     sfx2/source/sidebar/ContextList \
     sfx2/source/sidebar/ControlFactory \
+    sfx2/source/sidebar/ControllerFactory \
     sfx2/source/sidebar/ControllerItem \
     sfx2/source/sidebar/CustomImageRadioButton \
     sfx2/source/sidebar/Deck \
diff --git a/sfx2/Package_inc.mk b/sfx2/Package_inc.mk
index 268dfd7..f3b113a 100644
--- a/sfx2/Package_inc.mk
+++ b/sfx2/Package_inc.mk
@@ -131,15 +131,16 @@ $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/userinputinterception.hxx,sf
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewfac.hxx,sfx2/viewfac.hxx))
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewfrm.hxx,sfx2/viewfrm.hxx))
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewsh.hxx,sfx2/viewsh.hxx))
-$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/SidebarChildWindow.hxx,sfx2/sidebar/SidebarChildWindow.hxx))
-$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/SidebarPanelBase.hxx,sfx2/sidebar/SidebarPanelBase.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/CommandInfoProvider.hxx,sfx2/sidebar/CommandInfoProvider.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControlFactory.hxx,sfx2/sidebar/ControlFactory.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControllerFactory.hxx,sfx2/sidebar/ControllerFactory.hxx))
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControllerItem.hxx,sfx2/sidebar/ControllerItem.hxx))
-$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ResourceDefinitions.hrc,sfx2/sidebar/ResourceDefinitions.hrc))
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/EnumContext.hxx,sfx2/sidebar/EnumContext.hxx))
-$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControlFactory.hxx,sfx2/sidebar/ControlFactory.hxx))
-$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/Theme.hxx,sfx2/sidebar/Theme.hxx))
-$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ILayoutableWindow.hxx,sfx2/sidebar/ILayoutableWindow.hxx))
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/IContextChangeReceiver.hxx,sfx2/sidebar/IContextChangeReceiver.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ILayoutableWindow.hxx,sfx2/sidebar/ILayoutableWindow.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ResourceDefinitions.hrc,sfx2/sidebar/ResourceDefinitions.hrc))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/SidebarChildWindow.hxx,sfx2/sidebar/SidebarChildWindow.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/SidebarPanelBase.hxx,sfx2/sidebar/SidebarPanelBase.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/SidebarToolBox.hxx,sfx2/sidebar/SidebarToolBox.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/Theme.hxx,sfx2/sidebar/Theme.hxx))
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/Tools.hxx,sfx2/sidebar/Tools.hxx))
-$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/CommandInfoProvider.hxx,sfx2/sidebar/CommandInfoProvider.hxx))
-
diff --git a/sfx2/inc/sfx2/sidebar/ControlFactory.hxx b/sfx2/inc/sfx2/sidebar/ControlFactory.hxx
index f873889..623abf1 100644
--- a/sfx2/inc/sfx2/sidebar/ControlFactory.hxx
+++ b/sfx2/inc/sfx2/sidebar/ControlFactory.hxx
@@ -23,21 +23,34 @@
 #define SFX_SIDEBAR_CONTROL_FACTORY_HXX
 
 #include <sfx2/dllapi.h>
+#include <sfx2/sidebar/SidebarToolBox.hxx>
 #include <vcl/button.hxx>
-
+#include <com/sun/star/frame/XFrame.hpp>
 class ToolBox;
 
 namespace sfx2 { namespace sidebar {
 
 class ToolBoxBackground;
 
-
 class SFX2_DLLPUBLIC ControlFactory
 {
 public:
     static CheckBox* CreateMenuButton (Window* pParentWindow);
     static ImageRadioButton* CreateTabItem (Window* pParentWindow);
-    static ToolBox* CreateToolBox (Window* pParentWindow, const ResId& rResId);
+
+    /** Create a tool box that does *not* handle its items.
+    */
+    static SidebarToolBox* CreateToolBox (
+        Window* pParentWindow,
+        const ResId& rResId);
+
+    /** Create a tool box that *does* handle its items.
+    */
+    static SidebarToolBox* CreateToolBox (
+        Window* pParentWindow,
+        const ResId& rResId,
+        const ::com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rxFrame);
+
     static Window* CreateToolBoxBackground (Window* pParentWindow);
     static ImageRadioButton* CreateCustomImageRadionButton(
         Window* pParentWindow,
diff --git a/sfx2/source/sidebar/SidebarToolBox.hxx b/sfx2/inc/sfx2/sidebar/ControllerFactory.hxx
similarity index 61%
rename from sfx2/source/sidebar/SidebarToolBox.hxx
rename to sfx2/inc/sfx2/sidebar/ControllerFactory.hxx
index 3746fa6..802d3e7 100644
--- a/sfx2/source/sidebar/SidebarToolBox.hxx
+++ b/sfx2/inc/sfx2/sidebar/ControllerFactory.hxx
@@ -19,36 +19,28 @@
  *
  *************************************************************/
 
-#ifndef SFX_SIDEBAR_TOOLBOX_HXX
-#define SFX_SIDEBAR_TOOLBOX_HXX
+#ifndef SFX_SIDEBAR_CONTROLLER_FACTORY_HXX
+#define SFX_SIDEBAR_CONTROLLER_FACTORY_HXX
 
-#include "vcl/toolbox.hxx"
+#include "sfx2/dllapi.h"
+#include <com/sun/star/frame/XToolbarController.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
 
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
 
 namespace sfx2 { namespace sidebar {
 
-class SidebarToolBox
-    : public ToolBox
+/** Convenience class for easy creation of toolbox controllers.
+*/
+class SFX2_DLLPUBLIC ControllerFactory
 {
 public:
-    SidebarToolBox (Window* pParentWindow, const ResId& rResId);
-    virtual ~SidebarToolBox (void);
-
-    void SetBorderWindow (const Window* pBorderWindow);
-    virtual void Paint (const Rectangle& rRect);
-
-    virtual Point GetPosPixel (void) const;
-    virtual void SetPosSizePixel (
-        long nX,
-        long nY,
-        long nWidth,
-        long nHeight,
-        sal_uInt16 nFlags);
-    virtual long Notify (NotifyEvent& rEvent);
-
-private:
-    bool mbParentIsBorder;
-    Image maItemSeparator;
+    static cssu::Reference<css::frame::XToolbarController> CreateToolBoxController(
+        ToolBox* pToolBox,
+        const sal_uInt16 nItemId,
+        const ::rtl::OUString& rsCommandName,
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
 };
 
 
diff --git a/sfx2/inc/sfx2/sidebar/EnumContext.hxx b/sfx2/inc/sfx2/sidebar/EnumContext.hxx
index 48e27fb..ad53d87 100644
--- a/sfx2/inc/sfx2/sidebar/EnumContext.hxx
+++ b/sfx2/inc/sfx2/sidebar/EnumContext.hxx
@@ -129,6 +129,9 @@ public:
     sal_Int32 GetCombinedContext_DI(void) const;
 
     const ::rtl::OUString& GetApplicationName (void) const;
+    Application GetApplication (void) const;
+    Application GetApplication_DI (void) const;
+
     const ::rtl::OUString& GetContextName (void) const;
 
     bool operator == (const EnumContext aOther);
diff --git a/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx b/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
new file mode 100644
index 0000000..0f97943
--- /dev/null
+++ b/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
@@ -0,0 +1,105 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef SFX_SIDEBAR_TOOLBOX_HXX
+#define SFX_SIDEBAR_TOOLBOX_HXX
+
+#include "sfx2/dllapi.h"
+#include "vcl/toolbox.hxx"
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XToolbarController.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <map>
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace sfx2 { namespace sidebar {
+
+/** The sidebar tool box has two responsibilities:
+    1. Coordinated location, size, and other states with its parent
+       background window.
+    2. Create and handle tool bar controller for its items.
+*/
+class SFX2_DLLPUBLIC SidebarToolBox
+    : public ToolBox
+{
+public:
+    /** Create a new tool box.
+        When a valid XFrame is given then the tool box will handle its
+        buttons and drop-downs.  Otherwise the caller has to do that.
+    */
+    SidebarToolBox (
+        Window* pParentWindow,
+        const ResId& rResId,
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+    virtual ~SidebarToolBox (void);
+
+    void SetBorderWindow (const Window* pBorderWindow);
+    virtual void Paint (const Rectangle& rRect);
+
+    virtual Point GetPosPixel (void) const;
+    virtual void SetPosSizePixel (
+        long nX,
+        long nY,
+        long nWidth,
+        long nHeight,
+        sal_uInt16 nFlags);
+    virtual long Notify (NotifyEvent& rEvent);
+
+    cssu::Reference<css::frame::XToolbarController> GetControllerForItemId (
+        const sal_uInt16 nItemId) const;
+    sal_uInt16 GetItemIdForSubToolbarName (
+        const ::rtl::OUString& rsCOmmandName) const;
+
+private:
+    bool mbParentIsBorder;
+    Image maItemSeparator;
+    class ItemDescriptor
+    {
+    public:
+        cssu::Reference<css::frame::XToolbarController> mxController;
+        css::util::URL maURL;
+        rtl::OUString msCurrentCommand;
+        cssu::Reference<css::frame::XDispatch> mxDispatch;
+    };
+    typedef ::std::map<sal_uInt16, ItemDescriptor> ControllerContainer;
+    ControllerContainer maControllers;
+
+    DECL_LINK(DropDownClickHandler, ToolBox*);
+    DECL_LINK(ClickHandler, ToolBox*);
+    DECL_LINK(DoubleClickHandler, ToolBox*);
+    DECL_LINK(SelectHandler, ToolBox*);
+    DECL_LINK(Activate, ToolBox*);
+    DECL_LINK(Deactivate, ToolBox*);
+
+    void CreateController (
+        const sal_uInt16 nItemId,
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+    void UpdateIcons (
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/sfx2/source/sidebar/ControlFactory.cxx b/sfx2/source/sidebar/ControlFactory.cxx
index ccfdbaf..d35bf33 100644
--- a/sfx2/source/sidebar/ControlFactory.cxx
+++ b/sfx2/source/sidebar/ControlFactory.cxx
@@ -25,7 +25,7 @@
 
 #include "MenuButton.hxx"
 #include "TabItem.hxx"
-#include "SidebarToolBox.hxx"
+#include "sfx2/sidebar/SidebarToolBox.hxx"
 #include "ToolBoxBackground.hxx"
 #include "CustomImageRadioButton.hxx"
 #include <vcl/toolbox.hxx>
@@ -50,11 +50,27 @@ ImageRadioButton* ControlFactory::CreateTabItem (Window* pParentWindow)
 
 
 
-ToolBox* ControlFactory::CreateToolBox (
+SidebarToolBox* ControlFactory::CreateToolBox (
     Window* pParentWindow,
     const ResId& rResId)
 {
-    SidebarToolBox* pToolBox = new SidebarToolBox(pParentWindow, rResId);
+    SidebarToolBox* pToolBox = new SidebarToolBox(pParentWindow, rResId, NULL);
+    pToolBox->SetBorderWindow(pParentWindow);
+
+    pToolBox->Invalidate();
+
+    return pToolBox;
+}
+
+
+
+
+SidebarToolBox* ControlFactory::CreateToolBox (
+    Window* pParentWindow,
+    const ResId& rResId,
+    const cssu::Reference<css::frame::XFrame>& rxFrame)
+{
+    SidebarToolBox* pToolBox = new SidebarToolBox(pParentWindow, rResId, rxFrame);
     pToolBox->SetBorderWindow(pParentWindow);
 
     pToolBox->Invalidate();
diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx
new file mode 100644
index 0000000..aeea2e6
--- /dev/null
+++ b/sfx2/source/sidebar/ControllerFactory.cxx
@@ -0,0 +1,108 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "precompiled_sfx2.hxx"
+
+#include "sfx2/sidebar/ControllerFactory.hxx"
+#include "sfx2/sidebar/CommandInfoProvider.hxx"
+#include "sfx2/sidebar/Tools.hxx"
+
+#include <com/sun/star/frame/XToolbarController.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <framework/sfxhelperfunctions.hxx>
+#include <svtools/generictoolboxcontroller.hxx>
+#include <comphelper/processfactory.hxx>
+
+
+using namespace css;
+using namespace cssu;
+using ::rtl::OUString;
+
+
+namespace sfx2 { namespace sidebar {
+
+Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
+    ToolBox* pToolBox,
+    const sal_uInt16 nItemId,
+    const OUString& rsCommandName,
+    const Reference<frame::XFrame>& rxFrame)
+{
+    // Create a controller for the new item.
+    Reference<frame::XToolbarController> xController(
+        static_cast<XWeak*>(::framework::CreateToolBoxController(
+                rxFrame,
+                pToolBox,
+                nItemId,
+                rsCommandName)),
+            UNO_QUERY);
+    if ( ! xController.is())
+        xController.set(
+            static_cast<XWeak*>(new svt::GenericToolboxController(
+                    ::comphelper::getProcessServiceFactory(),
+                    rxFrame,
+                    pToolBox,
+                    nItemId,
+                    rsCommandName)),
+            UNO_QUERY);
+
+    // Initialize the controller with eg a service factory.
+    Reference<lang::XInitialization> xInitialization (xController, UNO_QUERY);
+    if (xInitialization.is())
+    {
+        beans::PropertyValue aPropValue;
+        std::vector<Any> aPropertyVector;
+
+        aPropValue.Name = A2S("Frame");
+        aPropValue.Value <<= rxFrame;
+        aPropertyVector.push_back(makeAny(aPropValue));
+
+        aPropValue.Name = A2S("ServiceManager");
+        aPropValue.Value <<= ::comphelper::getProcessServiceFactory();
+        aPropertyVector.push_back(makeAny(aPropValue));
+
+        aPropValue.Name = A2S("CommandURL");
+        aPropValue.Value <<= rsCommandName;
+        aPropertyVector.push_back(makeAny(aPropValue));
+
+        Sequence<Any> aArgs (comphelper::containerToSequence(aPropertyVector));
+        xInitialization->initialize(aArgs);
+    }
+
+    Reference<util::XUpdatable> xUpdatable (xController, UNO_QUERY);
+    if (xUpdatable.is())
+        xUpdatable->update();
+
+    // Add label.
+    if (xController.is())
+    {
+        const OUString sLabel (sfx2::sidebar::CommandInfoProvider::Instance().GetLabelForCommand(
+                rsCommandName,
+                rxFrame));
+        pToolBox->SetQuickHelpText(nItemId, sLabel);
+        pToolBox->EnableItem(nItemId);
+    }
+
+    return xController;
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/EnumContext.cxx b/sfx2/source/sidebar/EnumContext.cxx
index 78c5536..89968d9 100644
--- a/sfx2/source/sidebar/EnumContext.cxx
+++ b/sfx2/source/sidebar/EnumContext.cxx
@@ -88,23 +88,39 @@ sal_Int32 EnumContext::GetCombinedContext (void) const
 
 sal_Int32 EnumContext::GetCombinedContext_DI (void) const
 {
-    switch (meApplication)
-    {
-        case Application_Draw:
-        case Application_Impress:
-            return CombinedEnumContext(Application_DrawImpress, meContext);
-
-        case Application_Writer:
-        case Application_WriterGlobal:
-        case Application_WriterWeb:
-        case Application_WriterXML:
-        case Application_WriterForm:
-        case Application_WriterReport:
-            return CombinedEnumContext(Application_WriterVariants, meContext);
-
-        default:
-            return CombinedEnumContext(meApplication, meContext);
-    }
+    return CombinedEnumContext(GetApplication_DI(), meContext);
+}
+
+
+
+
+EnumContext::Application EnumContext::GetApplication_DI (void) const
+{
+     switch (meApplication)
+     {
+         case Application_Draw:
+         case Application_Impress:
+            return Application_DrawImpress;
+
+         case Application_Writer:
+         case Application_WriterGlobal:
+         case Application_WriterWeb:
+         case Application_WriterXML:
+         case Application_WriterForm:
+         case Application_WriterReport:
+             return Application_WriterVariants;
+
+         default:
+             return meApplication;
+     }
+}
+
+
+
+
+EnumContext::Application EnumContext::GetApplication (void) const
+{
+    return meApplication;
 }
 
 
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 3e5c05e..910e6dd 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -580,7 +580,8 @@ void SidebarController::SwitchToDeck (
             aNewPanels[nWriteIndex] = CreatePanel(
                 rPanelContexDescriptor.msId,
                 mpCurrentDeck->GetPanelParentWindow(),
-                rPanelContexDescriptor.mbIsInitiallyVisible);
+                rPanelContexDescriptor.mbIsInitiallyVisible,
+                rContext);
             bHasPanelSetChanged = true;
         }
         if (aNewPanels[nWriteIndex] != NULL)
@@ -649,7 +650,8 @@ bool SidebarController::ArePanelSetsEqual (
 SharedPanel SidebarController::CreatePanel (
     const OUString& rsPanelId,
     ::Window* pParentWindow,
-    const bool bIsInitiallyExpanded)
+    const bool bIsInitiallyExpanded,
+    const Context& rContext)
 {
     const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
     if (pPanelDescriptor == NULL)
@@ -667,7 +669,8 @@ SharedPanel SidebarController::CreatePanel (
     Reference<ui::XUIElement> xUIElement (CreateUIElement(
             pPanel->GetComponentInterface(),
             pPanelDescriptor->msImplementationURL,
-            pPanelDescriptor->mbWantsCanvas));
+            pPanelDescriptor->mbWantsCanvas,
+            rContext));
     if (xUIElement.is())
     {
         // Initialize the panel and add it to the active deck.
@@ -687,7 +690,8 @@ SharedPanel SidebarController::CreatePanel (
 Reference<ui::XUIElement> SidebarController::CreateUIElement (
     const Reference<awt::XWindowPeer>& rxWindow,
     const ::rtl::OUString& rsImplementationURL,
-    const bool bWantsCanvas)
+    const bool bWantsCanvas,
+    const Context& rContext)
 {
     try
     {
@@ -710,6 +714,8 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement (
             Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetSpriteCanvas());
             aCreationArguments.put("Canvas", makeAny(xCanvas));
         }
+        aCreationArguments.put("ApplicationName", makeAny(rContext.msApplication));
+        aCreationArguments.put("ContextName", makeAny(rContext.msContext));
 
         Reference<ui::XUIElement> xUIElement(
             xUIElementFactory->createUIElement(
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 8a2f6c7..dfa588c 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -169,11 +169,13 @@ private:
     cssu::Reference<css::ui::XUIElement> CreateUIElement (
         const cssu::Reference<css::awt::XWindowPeer>& rxWindow,
         const ::rtl::OUString& rsImplementationURL,
-        const bool bWantsCanvas);
+        const bool bWantsCanvas,
+        const Context& rContext);
     SharedPanel CreatePanel (
         const ::rtl::OUString& rsPanelId,
         ::Window* pParentWindow,
-        const bool bIsInitiallyExpanded);
+        const bool bIsInitiallyExpanded,
+        const Context& rContext);
     void SwitchToDeck (
         const DeckDescriptor& rDeckDescriptor,
         const Context& rContext);
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index 17eef2f..30a0dab 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -21,8 +21,9 @@
 
 #include "precompiled_sfx2.hxx"
 
-#include "SidebarToolBox.hxx"
+#include "sfx2/sidebar/SidebarToolBox.hxx"
 #include "ToolBoxBackground.hxx"
+#include "sfx2/sidebar/ControllerFactory.hxx"
 #include "sfx2/sidebar/Theme.hxx"
 #include "sfx2/sidebar/Tools.hxx"
 
@@ -31,6 +32,7 @@
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
 
 
 namespace sfx2 { namespace sidebar {
@@ -38,13 +40,32 @@ namespace sfx2 { namespace sidebar {
 
 SidebarToolBox::SidebarToolBox (
     Window* pParentWindow,
-    const ResId& rResId)
+    const ResId& rResId,
+    const cssu::Reference<css::frame::XFrame>& rxFrame)
     : ToolBox(pParentWindow, rResId),
       mbParentIsBorder(false),
       maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator))
 {
     SetBackground(Wallpaper());
     SetPaintTransparent(true);
+
+    if (rxFrame.is())
+    {
+        const sal_uInt16 nItemCount (GetItemCount());
+        for (sal_uInt16 nItemIndex=0; nItemIndex<nItemCount; ++nItemIndex)
+            CreateController(GetItemId(nItemIndex), rxFrame);
+        UpdateIcons(rxFrame);
+
+        SetSizePixel(CalcWindowSizePixel());
+
+        SetDropdownClickHdl(LINK(this, SidebarToolBox, DropDownClickHandler));
+        SetClickHdl(LINK(this, SidebarToolBox, ClickHandler));
+        SetDoubleClickHdl(LINK(this, SidebarToolBox, DoubleClickHandler));
+        SetSelectHdl(LINK(this, SidebarToolBox, SelectHandler));
+        SetActivateHdl(LINK(this, SidebarToolBox, Activate));
+        SetDeactivateHdl(LINK(this, SidebarToolBox, Deactivate));
+    }
+
 #ifdef DEBUG
     SetText(A2S("SidebarToolBox"));
 #endif
@@ -55,6 +76,24 @@ SidebarToolBox::SidebarToolBox (
 
 SidebarToolBox::~SidebarToolBox (void)
 {
+    ControllerContainer aControllers;
+    aControllers.swap(maControllers);
+    for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
+         iController!=iEnd;
+         ++iController)
+    {
+        Reference<lang::XComponent> xComponent (iController->second.mxController, UNO_QUERY);
+        if (xComponent.is())
+            xComponent->dispose();
+    }
+
+    SetDropdownClickHdl(Link());
+    SetClickHdl(Link());
+    SetDoubleClickHdl(Link());
+    SetSelectHdl(Link());
+    SetActivateHdl(Link());
+    SetDeactivateHdl(Link());
+
 }
 
 
@@ -173,4 +212,158 @@ long SidebarToolBox::Notify (NotifyEvent& rEvent)
 }
 
 
+
+
+void SidebarToolBox::CreateController (
+    const sal_uInt16 nItemId,
+    const cssu::Reference<css::frame::XFrame>& rxFrame)
+{
+    ItemDescriptor aDescriptor;
+
+    const OUString sCommandName (GetItemCommand(nItemId));
+
+    aDescriptor.mxController = sfx2::sidebar::ControllerFactory::CreateToolBoxController(
+        this,
+        nItemId,
+        sCommandName,
+        rxFrame);
+    aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(sCommandName);
+    aDescriptor.msCurrentCommand = sCommandName;
+    aDescriptor.mxDispatch = sfx2::sidebar::Tools::GetDispatch(rxFrame, aDescriptor.maURL);
+
+    if (aDescriptor.mxController.is() && aDescriptor.mxDispatch.is())
+        maControllers.insert(::std::make_pair(nItemId, aDescriptor));
+}
+
+
+
+
+Reference<frame::XToolbarController> SidebarToolBox::GetControllerForItemId (const sal_uInt16 nItemId) const
+{
+    ControllerContainer::const_iterator iController (maControllers.find(nItemId));
+    if (iController != maControllers.end())
+        return iController->second.mxController;
+    else
+        return NULL;
+}
+
+
+
+
+void SidebarToolBox::UpdateIcons (const Reference<frame::XFrame>& rxFrame)
+{
+    const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge());
+    const bool bIsHighContrastActive (sfx2::sidebar::Theme::IsHighContrastMode());
+
+    for (ControllerContainer::iterator iController(maControllers.begin()), iEnd(maControllers.end());
+         iController!=iEnd;
+         ++iController)
+    {
+        const ::rtl::OUString sCommandURL (iController->second.msCurrentCommand);
+        Image aImage (framework::GetImageFromURL(rxFrame, sCommandURL, bBigImages, bIsHighContrastActive));
+        SetItemImage(iController->first, aImage);
+    }
+}
+
+
+
+
+sal_uInt16 SidebarToolBox::GetItemIdForSubToolbarName (const OUString& rsSubToolbarName) const
+{
+    for (ControllerContainer::const_iterator iController(maControllers.begin()), iEnd(maControllers.end());
+         iController!=iEnd;
+         ++iController)
+    {
+        Reference<frame::XToolbarController> xController (iController->second.mxController);
+        Reference<frame::XSubToolbarController> xSubToolbarController (xController, UNO_QUERY);
+        if (xSubToolbarController.is())
+        {
+            const OUString sName (xSubToolbarController->getSubToolbarName());
+            if (sName.equals(rsSubToolbarName))
+                return iController->first;
+        }
+    }
+    return 0;
+}
+
+
+
+IMPL_LINK(SidebarToolBox, DropDownClickHandler, ToolBox*, pToolBox)
+{
+    if (pToolBox != NULL)
+    {
+        Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
+        if (xController.is())
+        {
+            Reference<awt::XWindow> xWindow = xController->createPopupWindow();
+            if (xWindow.is() )
+                xWindow->setFocus();
+        }
+    }
+    return 1;
+}
+
+
+
+
+IMPL_LINK(SidebarToolBox, ClickHandler, ToolBox*, pToolBox)
+{
+    if (pToolBox == NULL)
+        return 0;
+
+    Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
+    if (xController.is())
+        xController->click();
+
+    return 1;
+}
+
+
+
+
+IMPL_LINK(SidebarToolBox, DoubleClickHandler, ToolBox*, pToolBox)
+{
+    if (pToolBox == NULL)
+        return 0;
+
+    Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
+    if (xController.is())
+        xController->doubleClick();
+
+    return 1;
+}
+
+
+
+
+IMPL_LINK(SidebarToolBox, SelectHandler, ToolBox*, pToolBox)
+{
+    if (pToolBox == NULL)
+        return 0;
+
+    Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
+    if (xController.is())
+        xController->execute((sal_Int16)pToolBox->GetModifier());
+
+    return 1;
+}
+
+
+
+
+IMPL_LINK(SidebarToolBox, Activate, ToolBox*, EMPTYARG)
+{
+    return 1;
+}
+
+
+
+
+IMPL_LINK(SidebarToolBox, Deactivate, ToolBox*, EMPTYARG)
+{
+    return 1;
+}
+
+
+
 } } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/ToolBoxBackground.cxx b/sfx2/source/sidebar/ToolBoxBackground.cxx
index 77d3b4b..bc457ab 100755
--- a/sfx2/source/sidebar/ToolBoxBackground.cxx
+++ b/sfx2/source/sidebar/ToolBoxBackground.cxx
@@ -138,10 +138,6 @@ IMPL_LINK(ToolBoxBackground, WindowEventHandler, VclWindowEvent*, pEvent)
                     Hide();
                 break;
 
-            case SFX_HINT_DYING:
-                doLazyDelete();
-                break;
-
             default:
                 break;
         }
diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx
index 6b1ac6b..c141111 100644
--- a/svx/source/sidebar/PanelFactory.cxx
+++ b/svx/source/sidebar/PanelFactory.cxx
@@ -118,6 +118,9 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
     Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>()));
     const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
     SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
+    ::sfx2::sidebar::EnumContext aContext (
+        aArguments.getOrDefault("ApplicationName", OUString()),
+        aArguments.getOrDefault("ContextName", OUString()));
 
     ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
     if ( ! xParentWindow.is() || pParentWindow==NULL)
@@ -139,7 +142,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
 #define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s))
     if (DoesResourceEndWith("/TextPropertyPanel"))
     {
-        pControl = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings);
+        pControl = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings, aContext);
     }
     else if (DoesResourceEndWith("/ParaPropertyPanel"))
     {
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.cxx b/svx/source/sidebar/insert/InsertPropertyPanel.cxx
index 2403f43..c2e7235 100755
--- a/svx/source/sidebar/insert/InsertPropertyPanel.cxx
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.cxx
@@ -28,6 +28,7 @@
 #include <sfx2/sidebar/Theme.hxx>
 #include <sfx2/sidebar/Tools.hxx>
 #include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/ControllerFactory.hxx>
 
 #include <svx/dialmgr.hxx>
 #include <svtools/miscopt.hxx>
@@ -45,6 +46,7 @@
 using namespace css;
 using namespace cssu;
 using ::rtl::OUString;
+using ::sfx2::sidebar::SidebarToolBox;
 
 namespace svx { namespace sidebar {
 
@@ -56,20 +58,17 @@ InsertPropertyPanel::InsertPropertyPanel (
         mpStandardShapesBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
         mpStandardShapesToolBox(sfx2::sidebar::ControlFactory::CreateToolBox(
                 mpStandardShapesBackground.get(),
-                SVX_RES(TB_INSERT_STANDARD))),
+                SVX_RES(TB_INSERT_STANDARD),
+                rxFrame)),
         mpCustomShapesBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
         mpCustomShapesToolBox(sfx2::sidebar::ControlFactory::CreateToolBox(
                 mpCustomShapesBackground.get(),
-                SVX_RES(TB_INSERT_CUSTOM))),
-        maControllers(),
+                SVX_RES(TB_INSERT_CUSTOM),
+                rxFrame)),
         mxFrame(rxFrame)
 {
-    SetupToolBox(*mpStandardShapesToolBox);
-    SetupToolBox(*mpCustomShapesToolBox);
     FreeResource();
 
-    UpdateIcons();
-
     mpStandardShapesToolBox->Show();
     mpCustomShapesToolBox->Show();
 
@@ -85,17 +84,6 @@ InsertPropertyPanel::InsertPropertyPanel (
 
 InsertPropertyPanel::~InsertPropertyPanel (void)
 {
-    ControllerContainer aControllers;
-    aControllers.swap(maControllers);
-    for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
-         iController!=iEnd;
-         ++iController)
-    {
-        Reference<lang::XComponent> xComponent (iController->second.mxController, UNO_QUERY);
-        if (xComponent.is())
-            xComponent->dispose();
-    }
-
     // Remove window child listener.
     Window* pTopWindow = this;
     while (pTopWindow->GetParent() != NULL)
@@ -111,88 +99,6 @@ InsertPropertyPanel::~InsertPropertyPanel (void)
 
 
 
-void InsertPropertyPanel::SetupToolBox (ToolBox& rToolBox)
-{
-    const sal_uInt16 nItemCount (rToolBox.GetItemCount());
-    for (sal_uInt16 nItemIndex=0; nItemIndex<nItemCount; ++nItemIndex)
-        CreateController(rToolBox.GetItemId(nItemIndex));
-
-    rToolBox.SetDropdownClickHdl(LINK(this, InsertPropertyPanel, DropDownClickHandler));
-    rToolBox.SetClickHdl(LINK(this, InsertPropertyPanel, ClickHandler));
-    rToolBox.SetDoubleClickHdl(LINK(this, InsertPropertyPanel, DoubleClickHandler));
-    rToolBox.SetSelectHdl(LINK(this, InsertPropertyPanel, SelectHandler));
-    rToolBox.SetActivateHdl(LINK(this, InsertPropertyPanel, Activate));
-    rToolBox.SetDeactivateHdl(LINK(this, InsertPropertyPanel, Deactivate));
-
-    rToolBox.SetSizePixel(rToolBox.CalcWindowSizePixel());
-}
-
-
-
-
-IMPL_LINK(InsertPropertyPanel, DropDownClickHandler, ToolBox*, pToolBox)
-{
-    if (pToolBox != NULL)
-    {
-        Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
-        if (xController.is())
-        {
-            Reference<awt::XWindow> xWindow = xController->createPopupWindow();
-            if (xWindow.is() )
-                xWindow->setFocus();
-        }
-    }
-    return 1;
-}
-
-
-
-
-IMPL_LINK(InsertPropertyPanel, ClickHandler, ToolBox*, pToolBox)
-{
-    if (pToolBox == NULL)
-        return 0;
-
-    Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
-    if (xController.is())
-        xController->click();
-
-    return 1;
-}
-
-
-
-
-IMPL_LINK(InsertPropertyPanel, DoubleClickHandler, ToolBox*, pToolBox)
-{
-    if (pToolBox == NULL)
-        return 0;
-
-    Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
-    if (xController.is())
-        xController->doubleClick();
-
-    return 1;
-}
-
-
-
-
-IMPL_LINK(InsertPropertyPanel, SelectHandler, ToolBox*, pToolBox)
-{
-    if (pToolBox == NULL)
-        return 0;
-
-    Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
-    if (xController.is())
-        xController->execute((sal_Int16)pToolBox->GetModifier());
-
-    return 1;
-}
-
-
-
-
 IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent)
 {
     // We will be getting a lot of window events (well, basically all
@@ -205,7 +111,9 @@ IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent)
     if (pEvent->GetId() != VCLEVENT_TOOLBOX_SELECT)
         return 1;
 
-    ToolBox* pToolBox = dynamic_cast<ToolBox*>(dynamic_cast<VclWindowEvent*>(pEvent)->GetWindow());
+    Window* pWindow = dynamic_cast<VclWindowEvent*>(pEvent)->GetWindow();
+    Window* pParent = pWindow->GetParent();
+    ToolBox* pToolBox = dynamic_cast<ToolBox*>(pWindow);
     if (pToolBox == NULL)
         return 1;
 
@@ -222,201 +130,29 @@ IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent)
     if (nId == 0)
         return 1;
 
-    // Get toolbar controller.
-    const sal_uInt16 nItemId (GetItemIdForSubToolbarName(aURL.Path));
-    Reference<frame::XSubToolbarController> xController (GetControllerForItemId(nItemId), UNO_QUERY);
+    SidebarToolBox* pSidebarToolBox = dynamic_cast<SidebarToolBox*>(mpStandardShapesToolBox.get());
+    if (pSidebarToolBox == NULL)
+        return 1;
+    sal_uInt16 nItemId (pSidebarToolBox->GetItemIdForSubToolbarName(aURL.Path));
+    if (nItemId == 0)
+    {
+        pSidebarToolBox = dynamic_cast<SidebarToolBox*>(mpCustomShapesToolBox.get());
+        if (pSidebarToolBox == NULL)
+            return 1;
+        nItemId = pSidebarToolBox->GetItemIdForSubToolbarName(aURL.Path);
+        if (nItemId == 0)
+            return 1;
+    }
+
+    Reference<frame::XSubToolbarController> xController (pSidebarToolBox->GetControllerForItemId(nItemId), UNO_QUERY);
     if ( ! xController.is())
         return 1;
 
     const OUString sCommand (pToolBox->GetItemCommand(nId));
-    ControllerContainer::iterator iController (maControllers.find(nItemId));
-    if (iController != maControllers.end())
-        iController->second.msCurrentCommand = sCommand;
     xController->functionSelected(sCommand);
 
-    const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge());
-    const bool bIsHighContrastActive (sfx2::sidebar::Theme::IsHighContrastMode());
-    Image aImage (framework::GetImageFromURL(mxFrame, sCommand, bBigImages, bIsHighContrastActive));
-    pToolBox->SetItemImage(iController->first, aImage);
-
-    return 1;
-}
-
-
-
-
-IMPL_LINK(InsertPropertyPanel, Activate, ToolBox*, EMPTYARG)
-{
-    return 1;
-}
-
-
-
-
-IMPL_LINK(InsertPropertyPanel, Deactivate, ToolBox*, EMPTYARG)
-{
     return 1;
 }
 
 
-
-
-void InsertPropertyPanel::CreateController (
-    const sal_uInt16 nItemId)
-{
-    ToolBox* pToolBox = GetToolBoxForItemId(nItemId);
-    if (pToolBox != NULL)
-    {
-        ItemDescriptor aDescriptor;
-
-        const OUString sCommandName (pToolBox->GetItemCommand(nItemId));
-
-        // Create a controller for the new item.
-        aDescriptor.mxController.set(
-            static_cast<XWeak*>(::framework::CreateToolBoxController(
-                    mxFrame,
-                    pToolBox,
-                    nItemId,
-                    sCommandName)),
-            UNO_QUERY);
-        if ( ! aDescriptor.mxController.is())
-            aDescriptor.mxController.set(
-                static_cast<XWeak*>(new svt::GenericToolboxController(
-                        ::comphelper::getProcessServiceFactory(),
-                        mxFrame,
-                        pToolBox,
-                        nItemId,
-                        sCommandName)),
-                UNO_QUERY);
-        if ( ! aDescriptor.mxController.is())
-            return;
-
-        // Get dispatch object for the command.
-        aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(sCommandName);
-        aDescriptor.msCurrentCommand = sCommandName;
-        aDescriptor.mxDispatch = sfx2::sidebar::Tools::GetDispatch(mxFrame, aDescriptor.maURL);
-        if ( ! aDescriptor.mxDispatch.is())
-            return;
-
-        // Initialize the controller with eg a service factory.
-        Reference<lang::XInitialization> xInitialization (aDescriptor.mxController, UNO_QUERY);
-        if (xInitialization.is())
-        {
-            beans::PropertyValue aPropValue;
-            std::vector<Any> aPropertyVector;
-
-            aPropValue.Name = A2S("Frame");
-            aPropValue.Value <<= mxFrame;
-            aPropertyVector.push_back(makeAny(aPropValue));
-
-            aPropValue.Name = A2S("ServiceManager");
-            aPropValue.Value <<= ::comphelper::getProcessServiceFactory();
-            aPropertyVector.push_back(makeAny(aPropValue));
-
-            aPropValue.Name = A2S("CommandURL");
-            aPropValue.Value <<= sCommandName;
-            aPropertyVector.push_back(makeAny(aPropValue));
-
-            Sequence<Any> aArgs (comphelper::containerToSequence(aPropertyVector));
-            xInitialization->initialize(aArgs);
-        }
-
-        Reference<util::XUpdatable> xUpdatable (aDescriptor.mxController, UNO_QUERY);
-        if (xUpdatable.is())
-            xUpdatable->update();
-
-        // Add label.
-        const OUString sLabel (sfx2::sidebar::CommandInfoProvider::Instance().GetLabelForCommand(
-                sCommandName,
-                mxFrame));
-        pToolBox->SetQuickHelpText(nItemId, sLabel);
-
-        // Add item to toolbox.
-        pToolBox->EnableItem(nItemId);
-        maControllers.insert(::std::make_pair(nItemId, aDescriptor));
-    }
-}
-
-
-
-
-ToolBox* InsertPropertyPanel::GetToolBoxForItemId (const sal_uInt16 nItemId) const
-{
-    switch(nItemId)
-    {
-        case TBI_STANDARD_LINE:
-        case TBI_STANDARD_ARROW:
-        case TBI_STANDARD_RECTANGLE:
-        case TBI_STANDARD_ELLIPSE:
-        case TBI_STANDARD_TEXT:
-        case TBI_STANDARD_LINES:
-        case TBI_STANDARD_CONNECTORS:
-        case TBI_STANDARD_ARROWS:
-            return mpStandardShapesToolBox.get();
-
-        case TBI_CUSTOM_BASICS:
-        case TBI_CUSTOM_SYMBOLS:
-        case TBI_CUSTOM_ARROWS:
-        case TBI_CUSTOM_FLOWCHARTS:
-        case TBI_CUSTOM_CALLOUTS:
-        case TBI_CUSTOM_STARS:
-            return mpCustomShapesToolBox.get();
-
-        default:
-            return NULL;
-    }
-}
-
-
-
-
-Reference<frame::XToolbarController> InsertPropertyPanel::GetControllerForItemId (const sal_uInt16 nItemId) const
-{
-    ControllerContainer::const_iterator iController (maControllers.find(nItemId));
-    if (iController != maControllers.end())
-        return iController->second.mxController;
-    else
-        return NULL;
-}
-
-
-
-
-sal_uInt16 InsertPropertyPanel::GetItemIdForSubToolbarName (const OUString& rsSubToolbarName) const
-{
-    for (ControllerContainer::const_iterator iController(maControllers.begin()), iEnd(maControllers.end());
-         iController!=iEnd;
-         ++iController)
-    {
-        Reference<frame::XSubToolbarController> xSubToolbarController (iController->second.mxController, UNO_QUERY);
-        if (xSubToolbarController.is())
-            if (xSubToolbarController->getSubToolbarName().equals(rsSubToolbarName))
-                return iController->first;
-    }
-    return NULL;
-}
-
-
-
-
-void InsertPropertyPanel::UpdateIcons (void)
-{
-    const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge());
-    const bool bIsHighContrastActive (sfx2::sidebar::Theme::IsHighContrastMode());
-
-    for (ControllerContainer::iterator iController(maControllers.begin()), iEnd(maControllers.end());
-         iController!=iEnd;
-         ++iController)
-    {
-        const ::rtl::OUString sCommandURL (iController->second.msCurrentCommand);
-        Image aImage (framework::GetImageFromURL(mxFrame, sCommandURL, bBigImages, bIsHighContrastActive));
-        ToolBox* pToolBox = GetToolBoxForItemId(iController->first);
-        if (pToolBox != NULL)
-            pToolBox->SetItemImage(iController->first, aImage);
-    }
-}
-
-
-
-
 } } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.hxx b/svx/source/sidebar/insert/InsertPropertyPanel.hxx
index 6ae5412..a97e473 100755
--- a/svx/source/sidebar/insert/InsertPropertyPanel.hxx
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.hxx
@@ -53,41 +53,9 @@ private:
     ::boost::scoped_ptr<ToolBox> mpStandardShapesToolBox;
     ::boost::scoped_ptr<Window> mpCustomShapesBackground;
     ::boost::scoped_ptr<ToolBox> mpCustomShapesToolBox;
-    class ItemDescriptor
-    {
-    public:
-        cssu::Reference<css::frame::XToolbarController> mxController;
-        css::util::URL maURL;
-        rtl::OUString msCurrentCommand;
-        cssu::Reference<css::frame::XDispatch> mxDispatch;
-    };
-    typedef ::std::map<sal_uInt16, ItemDescriptor> ControllerContainer;
-    ControllerContainer maControllers;
     const cssu::Reference<css::frame::XFrame> mxFrame;
 
-    /** Add listeners to toolbox and update its size to match its
-        content.
-    */
-    void SetupToolBox (ToolBox& rToolBox);
-    cssu::Reference<css::frame::XToolbarController> GetControllerForItemId (
-        const sal_uInt16 nItemId) const;
-    ToolBox* GetToolBoxForItemId (const sal_uInt16 nItemId) const;
-    sal_uInt16 GetItemIdForSubToolbarName (
-        const ::rtl::OUString& rsCOmmandName) const;
-
-    /** Create toolbox controller for one item.
-    */
-    void CreateController (
-        const sal_uInt16 nItemId);
-    void UpdateIcons (void);
-
-    DECL_LINK(DropDownClickHandler, ToolBox*);
-    DECL_LINK(ClickHandler, ToolBox*);
-    DECL_LINK(DoubleClickHandler, ToolBox*);
-    DECL_LINK(SelectHandler, ToolBox*);
     DECL_LINK(WindowEventListener, VclSimpleEvent*);
-    DECL_LINK(Activate, ToolBox*);
-    DECL_LINK(Deactivate, ToolBox*);
 };
 
 
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index b5a6519..808b0e8 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -44,7 +44,9 @@
 #include <sfx2/viewsh.hxx>
 #include <sfx2/sidebar/ResourceDefinitions.hrc>
 #include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/ControllerFactory.hxx>
 #include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/SidebarToolBox.hxx>
 #include "sfx2/imagemgr.hxx"
 #include <svtools/ctrltool.hxx>
 #include <svtools/unitconv.hxx>
@@ -92,36 +94,6 @@ namespace
     }
 } // end of anonymous namespace
 
-PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent)
-{
-    const ResId aResId(SVX_RES(STR_AUTOMATICE));
-
-    return new ColorControl(
-        pParent,
-        mpBindings,
-        SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
-        SVX_RES(VS_FONT_COLOR),
-        ::boost::bind(GetAutomaticColor),
-        ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2),
-        pParent,
-        &aResId);
-}
-
-PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent)
-{
-    const ResId aResId(SVX_RES(STR_AUTOMATICE));
-
-    return new ColorControl(
-        pParent,
-        mpBindings,
-        SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
-        SVX_RES(VS_FONT_COLOR),
-        ::boost::bind(GetAutomaticColor),
-        ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2),
-        pParent,
-        &aResId);
-}
-
 long TextPropertyPanel::GetSelFontSize()
 {
     long nH = 240;
@@ -135,7 +107,8 @@ long TextPropertyPanel::GetSelFontSize()
 TextPropertyPanel* TextPropertyPanel::Create (
     Window* pParent,
     const cssu::Reference<css::frame::XFrame>& rxFrame,
-    SfxBindings* pBindings)
+    SfxBindings* pBindings,
+    const ::sfx2::sidebar::EnumContext& rContext)
 {
     if (pParent == NULL)
         throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0);
@@ -147,7 +120,8 @@ TextPropertyPanel* TextPropertyPanel::Create (
     return new TextPropertyPanel(
         pParent,
         rxFrame,
-        pBindings);
+        pBindings,
+        rContext);
 }
 
 
@@ -159,7 +133,8 @@ TextPropertyPanel* TextPropertyPanel::Create (
 TextPropertyPanel::TextPropertyPanel (
     Window* pParent,
     const cssu::Reference<css::frame::XFrame>& rxFrame,
-    SfxBindings* pBindings)
+    SfxBindings* pBindings,
+    const ::sfx2::sidebar::EnumContext& rContext)
     :   Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
         mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
         maFontSizeBox       (this, SVX_RES(MB_SBFONT_FONTSIZE)),
@@ -186,11 +161,15 @@ TextPropertyPanel::TextPropertyPanel (
         mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
         mpToolBoxFontColor(ControlFactory::CreateToolBox(
                 mpToolBoxFontColorBackground.get(),
-                SVX_RES(TB_FONTCOLOR))),
+                rContext.GetApplication_DI() == sfx2::sidebar::EnumContext::Application_WriterVariants
+                    ? SVX_RES(TB_FONTCOLOR_SW)
+                    : SVX_RES(TB_FONTCOLOR),
+                rxFrame)),
         mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
         mpToolBoxHighlight(ControlFactory::CreateToolBox(
                 mpToolBoxHighlightBackground.get(),
-                SVX_RES(TB_HIGHLIGHT))),
+                SVX_RES(TB_HIGHLIGHT),
+                rxFrame)),
         mpFontColorUpdater(),
         mpHighlightUpdater(),
 
@@ -201,12 +180,10 @@ TextPropertyPanel::TextPropertyPanel (
         maUnderlineControl  (SID_ATTR_CHAR_UNDERLINE,   *pBindings, *this, A2S("Underline"),    rxFrame),
         maStrikeControl     (SID_ATTR_CHAR_STRIKEOUT,   *pBindings, *this, A2S("Strikeout"),    rxFrame),
         maShadowControl     (SID_ATTR_CHAR_SHADOWED,    *pBindings, *this, A2S("Shadowed"),     rxFrame),
-        maFontColorControl  (SID_ATTR_CHAR_COLOR,       *pBindings, *this, A2S("Color"),        rxFrame),
         maScriptControlSw   (SID_ATTR_CHAR_ESCAPEMENT,  *pBindings, *this, A2S("Escapement"),   rxFrame),
         maSuperScriptControl(SID_SET_SUPER_SCRIPT,      *pBindings, *this, A2S("SuperScript"),  rxFrame),
         maSubScriptControl  (SID_SET_SUB_SCRIPT,        *pBindings, *this, A2S("SubScript"),    rxFrame),
         maSpacingControl    (SID_ATTR_CHAR_KERNING,     *pBindings, *this, A2S("Spacing"),      rxFrame),
-        maHighlightControl  (SID_ATTR_BRUSH_CHAR, *pBindings, *this, A2S("CharacterBackgroundPattern"),rxFrame),
         maSDFontGrow        (SID_GROW_FONT_SIZE,        *pBindings, *this, A2S("Grow"),         rxFrame),
         maSDFontShrink      (SID_SHRINK_FONT_SIZE,      *pBindings, *this, A2S("Shrink"),       rxFrame),
 
@@ -215,13 +192,12 @@ TextPropertyPanel::TextPropertyPanel (
         mbFocusOnFontSizeCtrl(false),
         maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
         maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
-        maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
-        maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
         mxFrame(rxFrame),
         maContext(),
         mpBindings(pBindings)
 {
     Initialize();
+
     FreeResource();
 }
 
@@ -361,10 +337,8 @@ void TextPropertyPanel::Initialize (void)
     SetupToolboxItems();
     InitToolBoxIncDec();
     InitToolBoxFont();
-    InitToolBoxFontColor();
     InitToolBoxScript();
     InitToolBoxSpacing();
-    InitToolBoxHighlight();
 
 #ifdef HAS_IA2
     mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox);
@@ -389,27 +363,13 @@ void TextPropertyPanel::Initialize (void)
     mbPostureAvailable = true;
     mbWeightAvailable = true;
     meUnderline = UNDERLINE_NONE;
-    meUnderlineColor = COL_AUTO;   //
-    maColor = COL_BLACK;
-    mbColorAvailable = true;
-    maBackColor = COL_AUTO;
-    mbBackColorAvailable = true;
+    meUnderlineColor = COL_AUTO;
     meEscape = SVX_ESCAPEMENT_OFF;
     mbSuper = false;
     mbSub = false;
     mbKernAvailable = true;
     mbKernLBAvailable = true;
     mlKerning = 0;
-    mpFontColorUpdater.reset(new ToolboxButtonColorUpdater(
-            SID_ATTR_CHAR_COLOR,
-            TBI_FONTCOLOR,
-            mpToolBoxFontColor.get(),
-            TBX_UPDATER_MODE_CHAR_COLOR_NEW));
-    mpHighlightUpdater.reset(new ToolboxButtonColorUpdater(
-            SID_ATTR_BRUSH_CHAR,
-            TBI_HIGHLIGHT,
-            mpToolBoxHighlight.get(),
-            TBX_UPDATER_MODE_CHAR_COLOR_NEW));
 
     //set handler
     mpFontNameBox->SetBindings(mpBindings);
@@ -463,17 +423,6 @@ void TextPropertyPanel::InitToolBoxIncDec()
 
 
 
-void TextPropertyPanel::InitToolBoxFontColor()
-{
-    Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() );
-    mpToolBoxFontColor->SetOutputSizePixel( aTbxSize );
-    mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY );
-
-    Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl);
-    mpToolBoxFontColor->SetDropdownClickHdl ( aLink );
-    mpToolBoxFontColor->SetSelectHdl ( aLink );
-
-}
 void TextPropertyPanel::InitToolBoxScript()
 {
     Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() );
@@ -498,16 +447,6 @@ void TextPropertyPanel::InitToolBoxSpacing()
     mpToolBoxSpacing->SetDropdownClickHdl ( aLink );
     mpToolBoxSpacing->SetSelectHdl( aLink );
 }
-void TextPropertyPanel::InitToolBoxHighlight()
-{
-    Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() );
-    mpToolBoxHighlight->SetOutputSizePixel( aTbxSize );
-    mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY );
-
-    Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl);
-    mpToolBoxHighlight->SetDropdownClickHdl ( aLink );
-    mpToolBoxHighlight->SetSelectHdl( aLink );
-}
 
 
 
@@ -523,7 +462,6 @@ void TextPropertyPanel::SetupToolboxItems (void)
     maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, TBI_STRIKEOUT);
     maShadowControl.SetupToolBoxItem(*mpToolBoxFont, TBI_SHADOWED);
 
-    maFontColorControl.SetupToolBoxItem(*mpToolBoxFontColor, TBI_FONTCOLOR);
     //for sw
     maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUPER_SW);
     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUB_SW);
@@ -531,7 +469,6 @@ void TextPropertyPanel::SetupToolboxItems (void)
     maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUPER);
     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUB);
     maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, TBI_SPACING);
-    maHighlightControl.SetupToolBoxItem(*mpToolBoxHighlight, TBI_HIGHLIGHT);
 }
 
 
@@ -795,22 +732,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
 
 
 
-IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox)
-{
-    const sal_uInt16 nId = pToolBox->GetCurItemId();
-    if(nId == TBI_FONTCOLOR)
-    {
-        pToolBox->SetItemDown( nId, true );
-
-        maFontColorPopup.Show(*pToolBox);
-        maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable);
-    }
-    return 0;
-}
-
-
-
-
 IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
 {
     const sal_uInt16 nId = pToolBox->GetCurItemId();
@@ -876,21 +797,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
 
 
 
-IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox)
-{
-    const sal_uInt16 nId = pToolBox->GetCurItemId();
-    if(nId == TBI_HIGHLIGHT)
-    {
-        pToolBox->SetItemDown( nId, true );
-        maBrushColorPopup.Show(*pToolBox);
-        maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
-
-    }
-    return 0;
-}
-
-
-
 IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
 {
     const sal_uInt16 nId = pToolBox->GetCurItemId();
@@ -1084,44 +990,6 @@ void TextPropertyPanel::NotifyItemUpdate (
                     : STATE_NOCHECK);
             break;
 
-        case SID_ATTR_CHAR_COLOR:
-            if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
-            {
-                const SvxColorItem* pItem =  (const SvxColorItem*)pState;
-                maColor = pItem->GetValue();
-                mbColorAvailable = true;
-                if (mpFontColorUpdater)
-                    mpFontColorUpdater->Update(maColor);
-            }
-            else
-            {
-                mbColorAvailable = false;
-                maColor.SetColor(COL_AUTO);
-                if (mpFontColorUpdater)
-                    mpFontColorUpdater->Update(maColor);
-            }
-            mpToolBoxFontColor->EnableItem(TBI_FONTCOLOR, bIsEnabled);
-            break;
-
-        case SID_ATTR_BRUSH_CHAR:
-            if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem))
-            {
-                const SvxBrushItem* pItem =  (const SvxBrushItem*)pState;
-                maBackColor = pItem->GetColor();
-                mbBackColorAvailable = true;
-                if (mpHighlightUpdater)
-                    mpHighlightUpdater->Update(maBackColor);
-            }
-            else
-            {
-                mbBackColorAvailable = false;
-                maBackColor.SetColor(COL_AUTO);
-                if (mpHighlightUpdater)
-                    mpHighlightUpdater->Update(maBackColor);
-            }
-            mpToolBoxHighlight->EnableItem(TBI_HIGHLIGHT, bIsEnabled);
-            break;
-
         case SID_ATTR_CHAR_ESCAPEMENT:
         {
             bool bIsItemEnabled (true);
@@ -1295,9 +1163,6 @@ void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
         case SID_ATTR_CHAR_SHADOWED:
             maShadowControl.RequestUpdate();
             break;
-        case SID_ATTR_CHAR_COLOR:
-            maFontColorControl.RequestUpdate();
-            break;
         case SID_ATTR_CHAR_ESCAPEMENT:
             maScriptControlSw.RequestUpdate();
             break;
@@ -1310,9 +1175,6 @@ void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
         case SID_ATTR_CHAR_KERNING:
             maSpacingControl.RequestUpdate();
             break;
-        case SID_ATTR_BRUSH_CHAR:
-            maHighlightControl.RequestUpdate();
-            break;
         case SID_GROW_FONT_SIZE:
             maSDFontGrow.RequestUpdate();
             break;
@@ -1326,24 +1188,6 @@ void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
 
 
 
-void TextPropertyPanel::SetFontColor (
-    const String& /* rsColorName */,
-    const Color aColor)
-{
-    SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR);
-    mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
-    maColor = aColor;
-}
-
-void TextPropertyPanel::SetBrushColor (
-    const String& /* rsColorName */,
-    const Color aColor)
-{
-    SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR);
-    mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L);
-    maBackColor = aColor;
-}
-
 Color& TextPropertyPanel::GetUnderlineColor()
 {
     return meUnderlineColor;
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hrc b/svx/source/sidebar/text/TextPropertyPanel.hrc
index 266cce0..f6ca48c 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hrc
+++ b/svx/source/sidebar/text/TextPropertyPanel.hrc
@@ -34,11 +34,11 @@
 #define TB_FONT                 4
 #define TB_INCREASE_DECREASE    5
 #define TB_FONTCOLOR            6
-#define TB_SCRIPT_SW            7
+#define TB_FONTCOLOR_SW         7
 #define TB_HIGHLIGHT            8
 #define TB_SPACING              9
 #define TB_SCRIPT               10
-
+#define TB_SCRIPT_SW            11
 
 #define TBI_FONTCOLOR           50
 #define TBI_BOLD                51
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx
index 8b2781b..c7487aa 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -26,6 +26,7 @@
 #include <sfx2/sidebar/SidebarPanelBase.hxx>
 #include <sfx2/sidebar/ControllerItem.hxx>
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 
 #include <svtools/ctrlbox.hxx>
 #include <svx/tbxcolorupdate.hxx>
@@ -33,6 +34,7 @@
 #include <editeng/fhgtitem.hxx>
 
 #include <com/sun/star/ui/XSidebar.hpp>
+#include <com/sun/star/frame/XToolbarController.hpp>
 
 #include <boost/scoped_ptr.hpp>
 #include "TextCharacterSpacingPopup.hxx"
@@ -58,7 +60,8 @@ public:
     static TextPropertyPanel* Create (
         Window* pParent,
         const cssu::Reference<css::frame::XFrame>& rxFrame,
-        SfxBindings* pBindings);
+        SfxBindings* pBindings,
+        const ::sfx2::sidebar::EnumContext& rContext);
 
     virtual void DataChanged (const DataChangedEvent& rEvent);
 
@@ -67,8 +70,6 @@ public:
     void SetSpacing(long nKern);
     void EndSpacingPopupMode (void);
     void EndUnderlinePopupMode (void);
-    void SetFontColor (const String& rsColorName,const Color aColor);
-    void SetBrushColor (const String& rsColorName,const Color aColor);
     void SetUnderline(FontUnderline eUnderline);
     Color& GetUnderlineColor();
     void SetDefaultUnderline(FontUnderline eUnderline);
@@ -113,12 +114,10 @@ private:
     ::sfx2::sidebar::ControllerItem maUnderlineControl;
     ::sfx2::sidebar::ControllerItem maStrikeControl;
     ::sfx2::sidebar::ControllerItem maShadowControl;
-    ::sfx2::sidebar::ControllerItem maFontColorControl;
     ::sfx2::sidebar::ControllerItem maScriptControlSw;
     ::sfx2::sidebar::ControllerItem maSuperScriptControl;
     ::sfx2::sidebar::ControllerItem maSubScriptControl;
     ::sfx2::sidebar::ControllerItem maSpacingControl;
-    ::sfx2::sidebar::ControllerItem maHighlightControl;
     ::sfx2::sidebar::ControllerItem maSDFontGrow;
     ::sfx2::sidebar::ControllerItem maSDFontShrink;
 
@@ -130,10 +129,6 @@ private:
     FontStrikeout               meStrike;
     bool mbWeightAvailable;
     bool mbPostureAvailable;
-    Color                       maColor;
-    bool mbColorAvailable;
-    Color                       maBackColor;
-    bool mbBackColorAvailable;
     SvxEscapement               meEscape;  //for sw
     bool                        mbSuper;
     bool                        mbSub;
@@ -147,8 +142,6 @@ private:
     bool mbFocusOnFontSizeCtrl;
     TextCharacterSpacingPopup maCharSpacePopup;
     TextUnderlinePopup maUnderlinePopup;
-    ColorPopup maFontColorPopup;
-    ColorPopup maBrushColorPopup;
 
     cssu::Reference<css::frame::XFrame> mxFrame;
     ::sfx2::sidebar::EnumContext maContext;
@@ -157,26 +150,21 @@ private:
     TextPropertyPanel (
         Window* pParent,
         const cssu::Reference<css::frame::XFrame>& rxFrame,
-        SfxBindings* pBindings);
+        SfxBindings* pBindings,
+        const ::sfx2::sidebar::EnumContext& rContext);
     virtual ~TextPropertyPanel (void);
 
 
     PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
-    PopupControl* CreateFontColorPopupControl (PopupContainer* pParent);
-    PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent);
     PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
     DECL_LINK(SpacingClickHdl, ToolBox*);
-    DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker
-    DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
     DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
 
     void Initialize (void);
     void SetupToolboxItems (void);
     void InitToolBoxFont();
     void InitToolBoxIncDec();
-    void InitToolBoxFontColor();
     void InitToolBoxScript();
-    void InitToolBoxHighlight();
     void InitToolBoxSpacing();
 
     DECL_LINK(FontSelHdl, FontNameBox *);
diff --git a/svx/source/sidebar/text/TextPropertyPanel.src b/svx/source/sidebar/text/TextPropertyPanel.src
index 9e33ed8..d860d65 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.src
+++ b/svx/source/sidebar/text/TextPropertyPanel.src
@@ -153,7 +153,6 @@ Control RID_SIDEBAR_TEXT_PANEL
         Pos = MAP_APPFONT (X3, THIRD_LINE_Y) ;
         Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ;
         TabStop = TRUE ;
-        Text = "Font Color" ;
         ItemList =
         {
             ToolBoxItem
@@ -165,6 +164,24 @@ Control RID_SIDEBAR_TEXT_PANEL
             };
         };
     };
+    ToolBox TB_FONTCOLOR_SW
+    {
+        HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR;
+        SVLook = TRUE ;
+        Pos = MAP_APPFONT (X3, THIRD_LINE_Y) ;
+        Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ;
+        TabStop = TRUE ;
+        ItemList =
+        {
+            ToolBoxItem
+            {
+                Identifier = TBI_FONTCOLOR ;
+                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR;
+                DropDown = TRUE ;
+                Command = ".uno:FontColor";
+            };
+        };
+    };
 
     ToolBox TB_HIGHLIGHT
     {
@@ -181,7 +198,7 @@ Control RID_SIDEBAR_TEXT_PANEL
                 Identifier = TBI_HIGHLIGHT ;
                 HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR;
                 DropDown = TRUE ;
-                Command = ".uno:CharacterBackgroundPattern";
+                Command = ".uno:BackColor";
             };
         };
     };


More information about the Libreoffice-commits mailing list