You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2013/05/14 17:21:58 UTC

svn commit: r1482384 - in /openoffice/trunk/main: sfx2/ sfx2/inc/sfx2/sidebar/ sfx2/source/sidebar/ svx/source/sidebar/ svx/source/sidebar/insert/ svx/source/sidebar/text/

Author: af
Date: Tue May 14 15:21:57 2013
New Revision: 1482384

URL: http://svn.apache.org/r1482384
Log:
122302: Use tool bar controls for color controls in text property panel.

Added:
    openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControllerFactory.hxx
    openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
    openoffice/trunk/main/sfx2/source/sidebar/ControllerFactory.cxx
Removed:
    openoffice/trunk/main/sfx2/source/sidebar/SidebarToolBox.hxx
Modified:
    openoffice/trunk/main/sfx2/Library_sfx.mk
    openoffice/trunk/main/sfx2/Package_inc.mk
    openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControlFactory.hxx
    openoffice/trunk/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx
    openoffice/trunk/main/sfx2/source/sidebar/ControlFactory.cxx
    openoffice/trunk/main/sfx2/source/sidebar/EnumContext.cxx
    openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx
    openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx
    openoffice/trunk/main/sfx2/source/sidebar/SidebarToolBox.cxx
    openoffice/trunk/main/sfx2/source/sidebar/ToolBoxBackground.cxx
    openoffice/trunk/main/svx/source/sidebar/PanelFactory.cxx
    openoffice/trunk/main/svx/source/sidebar/insert/InsertPropertyPanel.cxx
    openoffice/trunk/main/svx/source/sidebar/insert/InsertPropertyPanel.hxx
    openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx
    openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hrc
    openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx
    openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src

Modified: openoffice/trunk/main/sfx2/Library_sfx.mk
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/Library_sfx.mk?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/Library_sfx.mk (original)
+++ openoffice/trunk/main/sfx2/Library_sfx.mk Tue May 14 15:21:57 2013
@@ -224,6 +224,7 @@ $(eval $(call gb_Library_add_exception_o
 	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 \

Modified: openoffice/trunk/main/sfx2/Package_inc.mk
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/Package_inc.mk?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/Package_inc.mk (original)
+++ openoffice/trunk/main/sfx2/Package_inc.mk Tue May 14 15:21:57 2013
@@ -131,15 +131,16 @@ $(eval $(call gb_Package_add_file,sfx2_i
 $(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))
-

Modified: openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControlFactory.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControlFactory.hxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControlFactory.hxx (original)
+++ openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControlFactory.hxx Tue May 14 15:21:57 2013
@@ -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,

Added: openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControllerFactory.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControllerFactory.hxx?rev=1482384&view=auto
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControllerFactory.hxx (added)
+++ openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControllerFactory.hxx Tue May 14 15:21:57 2013
@@ -0,0 +1,49 @@
+/**************************************************************
+ * 
+ * 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_CONTROLLER_FACTORY_HXX
+#define SFX_SIDEBAR_CONTROLLER_FACTORY_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 {
+
+/** Convenience class for easy creation of toolbox controllers.
+*/
+class SFX2_DLLPUBLIC ControllerFactory
+{
+public:
+    static cssu::Reference<css::frame::XToolbarController> CreateToolBoxController(
+        ToolBox* pToolBox,
+        const sal_uInt16 nItemId,
+        const ::rtl::OUString& rsCommandName,
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif

Modified: openoffice/trunk/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx (original)
+++ openoffice/trunk/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx Tue May 14 15:21:57 2013
@@ -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);

Added: openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx?rev=1482384&view=auto
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx (added)
+++ openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx Tue May 14 15:21:57 2013
@@ -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

Modified: openoffice/trunk/main/sfx2/source/sidebar/ControlFactory.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/ControlFactory.cxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/ControlFactory.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/ControlFactory.cxx Tue May 14 15:21:57 2013
@@ -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::Create
 
 
 
-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();

Added: openoffice/trunk/main/sfx2/source/sidebar/ControllerFactory.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/ControllerFactory.cxx?rev=1482384&view=auto
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/ControllerFactory.cxx (added)
+++ openoffice/trunk/main/sfx2/source/sidebar/ControllerFactory.cxx Tue May 14 15:21:57 2013
@@ -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

Modified: openoffice/trunk/main/sfx2/source/sidebar/EnumContext.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/EnumContext.cxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/EnumContext.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/EnumContext.cxx Tue May 14 15:21:57 2013
@@ -88,23 +88,39 @@ sal_Int32 EnumContext::GetCombinedContex
 
 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;
 }
 
 

Modified: openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx Tue May 14 15:21:57 2013
@@ -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::ArePanelSetsEqua
 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::CreatePan
     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::CreatePan
 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> SidebarControl
             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(

Modified: openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx Tue May 14 15:21:57 2013
@@ -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);

Modified: openoffice/trunk/main/sfx2/source/sidebar/SidebarToolBox.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/SidebarToolBox.cxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/SidebarToolBox.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/SidebarToolBox.cxx Tue May 14 15:21:57 2013
@@ -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());
+
 }
 
 
@@ -171,6 +210,160 @@ long SidebarToolBox::Notify (NotifyEvent
     }
     return ToolBox::Notify(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

Modified: openoffice/trunk/main/sfx2/source/sidebar/ToolBoxBackground.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/ToolBoxBackground.cxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/ToolBoxBackground.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/ToolBoxBackground.cxx Tue May 14 15:21:57 2013
@@ -138,10 +138,6 @@ IMPL_LINK(ToolBoxBackground, WindowEvent
                     Hide();
                 break;
 
-            case SFX_HINT_DYING:
-                doLazyDelete();
-                break;
-                
             default:
                 break;
         }

Modified: openoffice/trunk/main/svx/source/sidebar/PanelFactory.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/PanelFactory.cxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/PanelFactory.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/PanelFactory.cxx Tue May 14 15:21:57 2013
@@ -118,6 +118,9 @@ Reference<ui::XUIElement> SAL_CALL Panel
     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 Panel
 #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"))
     {

Modified: openoffice/trunk/main/svx/source/sidebar/insert/InsertPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/insert/InsertPropertyPanel.cxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/insert/InsertPropertyPanel.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/insert/InsertPropertyPanel.cxx Tue May 14 15:21:57 2013
@@ -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::~InsertPropertyPane
 
 
 
-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, WindowEve
     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, WindowEve
     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

Modified: openoffice/trunk/main/svx/source/sidebar/insert/InsertPropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/insert/InsertPropertyPanel.hxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/insert/InsertPropertyPanel.hxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/insert/InsertPropertyPanel.hxx Tue May 14 15:21:57 2013
@@ -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*);
 };
 
 

Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx Tue May 14 15:21:57 2013
@@ -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::Cr
     return new TextPropertyPanel(
         pParent,
         rxFrame,
-        pBindings);
+        pBindings,
+        rContext);
 }
 
 
@@ -159,7 +133,8 @@ TextPropertyPanel* TextPropertyPanel::Cr
 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,28 +363,14 @@ 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);
     Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
@@ -463,17 +423,6 @@ void TextPropertyPanel::InitToolBoxIncDe
 
 
 
-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::InitToolBoxSpaci
     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::SetupToolboxItem
     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::SetupToolboxItem
     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, ToolBoxUnde
 
 
 
-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, ToolBoxScri
 
 
 
-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 (cons
         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 (cons
         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 (cons
 
 
 
-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;

Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hrc
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hrc?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hrc (original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hrc Tue May 14 15:21:57 2013
@@ -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

Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx Tue May 14 15:21:57 2013
@@ -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 *);

Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src?rev=1482384&r1=1482383&r2=1482384&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src (original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src Tue May 14 15:21:57 2013
@@ -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";
 			};
 		};
 	};