[Libreoffice-commits] core.git: Branch 'feature/sidebar' - 2 commits - include/sfx2 include/svx sfx2/Library_sfx.mk sfx2/source svx/inc svx/source
Caolán McNamara
caolanm at redhat.com
Wed May 15 01:36:52 PDT 2013
include/sfx2/sidebar/ControlFactory.hxx | 19
include/sfx2/sidebar/ControllerFactory.hxx | 47 ++
include/sfx2/sidebar/EnumContext.hxx | 3
include/sfx2/sidebar/SidebarToolBox.hxx | 101 ++++
include/svx/AffineMatrixItem.hxx | 54 ++
include/svx/XPropertyEntry.hxx | 47 ++
include/svx/nbdtmg.hxx | 376 ++++++++++++++++++
include/svx/nbdtmgfact.hxx | 33 +
include/svx/sdr/table/tablecontroller.hxx | 159 +++++++
include/svx/sidebar/ColorControl.hxx | 83 +++
include/svx/sidebar/ColorPopup.hxx | 51 ++
include/svx/sidebar/ContextChangeEventMultiplexer.hxx | 65 +++
include/svx/sidebar/Popup.hxx | 103 ++++
include/svx/sidebar/PopupContainer.hxx | 44 ++
include/svx/sidebar/PopupControl.hxx | 47 ++
include/svx/sidebar/SelectionAnalyzer.hxx | 67 +++
include/svx/sidebar/SelectionChangeHandler.hxx | 85 ++++
include/svx/sidebar/SidebarDialControl.hxx | 41 +
include/svx/sidebar/ValueSetWithTextControl.hxx | 157 +++++++
sfx2/Library_sfx.mk | 1
sfx2/source/sidebar/ControlFactory.cxx | 22 -
sfx2/source/sidebar/ControllerFactory.cxx | 104 ++++
sfx2/source/sidebar/EnumContext.cxx | 50 +-
sfx2/source/sidebar/SidebarController.cxx | 14
sfx2/source/sidebar/SidebarController.hxx | 6
sfx2/source/sidebar/SidebarToolBox.cxx | 201 +++++++++
sfx2/source/sidebar/SidebarToolBox.hxx | 53 --
sfx2/source/sidebar/ToolBoxBackground.cxx | 4
svx/inc/svx/AffineMatrixItem.hxx | 54 --
svx/inc/svx/XPropertyEntry.hxx | 47 --
svx/inc/svx/nbdtmg.hxx | 376 ------------------
svx/inc/svx/nbdtmgfact.hxx | 33 -
svx/inc/svx/sdr/table/tablecontroller.hxx | 159 -------
svx/inc/svx/sidebar/ColorControl.hxx | 83 ---
svx/inc/svx/sidebar/ColorPopup.hxx | 51 --
svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx | 65 ---
svx/inc/svx/sidebar/Popup.hxx | 103 ----
svx/inc/svx/sidebar/PopupContainer.hxx | 44 --
svx/inc/svx/sidebar/PopupControl.hxx | 47 --
svx/inc/svx/sidebar/SelectionAnalyzer.hxx | 67 ---
svx/inc/svx/sidebar/SelectionChangeHandler.hxx | 85 ----
svx/inc/svx/sidebar/SidebarDialControl.hxx | 41 -
svx/inc/svx/sidebar/ValueSetWithTextControl.hxx | 157 -------
svx/source/sidebar/PanelFactory.cxx | 5
svx/source/sidebar/insert/InsertPropertyPanel.cxx | 309 +-------------
svx/source/sidebar/insert/InsertPropertyPanel.hxx | 32 -
svx/source/sidebar/text/TextPropertyPanel.cxx | 190 ---------
svx/source/sidebar/text/TextPropertyPanel.hrc | 4
svx/source/sidebar/text/TextPropertyPanel.hxx | 24 -
svx/source/sidebar/text/TextPropertyPanel.src | 21 -
50 files changed, 2019 insertions(+), 2015 deletions(-)
New commits:
commit fe21e6ea13fc7bd97590d4d8060c77480461cac9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed May 15 09:10:25 2013 +0100
move some new includes files to new include locations
Change-Id: I34b18fb2e0f1eae01eff5b8e849dd5f5744335f6
diff --git a/svx/inc/svx/AffineMatrixItem.hxx b/include/svx/AffineMatrixItem.hxx
similarity index 100%
rename from svx/inc/svx/AffineMatrixItem.hxx
rename to include/svx/AffineMatrixItem.hxx
diff --git a/svx/inc/svx/XPropertyEntry.hxx b/include/svx/XPropertyEntry.hxx
similarity index 100%
rename from svx/inc/svx/XPropertyEntry.hxx
rename to include/svx/XPropertyEntry.hxx
diff --git a/svx/inc/svx/nbdtmg.hxx b/include/svx/nbdtmg.hxx
similarity index 100%
rename from svx/inc/svx/nbdtmg.hxx
rename to include/svx/nbdtmg.hxx
diff --git a/svx/inc/svx/nbdtmgfact.hxx b/include/svx/nbdtmgfact.hxx
similarity index 100%
rename from svx/inc/svx/nbdtmgfact.hxx
rename to include/svx/nbdtmgfact.hxx
diff --git a/svx/inc/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx
similarity index 100%
rename from svx/inc/svx/sdr/table/tablecontroller.hxx
rename to include/svx/sdr/table/tablecontroller.hxx
diff --git a/svx/inc/svx/sidebar/ColorControl.hxx b/include/svx/sidebar/ColorControl.hxx
similarity index 100%
rename from svx/inc/svx/sidebar/ColorControl.hxx
rename to include/svx/sidebar/ColorControl.hxx
diff --git a/svx/inc/svx/sidebar/ColorPopup.hxx b/include/svx/sidebar/ColorPopup.hxx
similarity index 100%
rename from svx/inc/svx/sidebar/ColorPopup.hxx
rename to include/svx/sidebar/ColorPopup.hxx
diff --git a/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx b/include/svx/sidebar/ContextChangeEventMultiplexer.hxx
similarity index 100%
rename from svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx
rename to include/svx/sidebar/ContextChangeEventMultiplexer.hxx
diff --git a/svx/inc/svx/sidebar/Popup.hxx b/include/svx/sidebar/Popup.hxx
similarity index 100%
rename from svx/inc/svx/sidebar/Popup.hxx
rename to include/svx/sidebar/Popup.hxx
diff --git a/svx/inc/svx/sidebar/PopupContainer.hxx b/include/svx/sidebar/PopupContainer.hxx
similarity index 100%
rename from svx/inc/svx/sidebar/PopupContainer.hxx
rename to include/svx/sidebar/PopupContainer.hxx
diff --git a/svx/inc/svx/sidebar/PopupControl.hxx b/include/svx/sidebar/PopupControl.hxx
similarity index 100%
rename from svx/inc/svx/sidebar/PopupControl.hxx
rename to include/svx/sidebar/PopupControl.hxx
diff --git a/svx/inc/svx/sidebar/SelectionAnalyzer.hxx b/include/svx/sidebar/SelectionAnalyzer.hxx
similarity index 100%
rename from svx/inc/svx/sidebar/SelectionAnalyzer.hxx
rename to include/svx/sidebar/SelectionAnalyzer.hxx
diff --git a/svx/inc/svx/sidebar/SelectionChangeHandler.hxx b/include/svx/sidebar/SelectionChangeHandler.hxx
similarity index 100%
rename from svx/inc/svx/sidebar/SelectionChangeHandler.hxx
rename to include/svx/sidebar/SelectionChangeHandler.hxx
diff --git a/svx/inc/svx/sidebar/SidebarDialControl.hxx b/include/svx/sidebar/SidebarDialControl.hxx
similarity index 100%
rename from svx/inc/svx/sidebar/SidebarDialControl.hxx
rename to include/svx/sidebar/SidebarDialControl.hxx
diff --git a/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx b/include/svx/sidebar/ValueSetWithTextControl.hxx
similarity index 100%
rename from svx/inc/svx/sidebar/ValueSetWithTextControl.hxx
rename to include/svx/sidebar/ValueSetWithTextControl.hxx
commit fe19401efc86522d8876130129ef46ec6cf7cb74
Author: Andre Fischer <af at apache.org>
Date: Tue May 14 15:21:57 2013 +0000
Resolves: #i122302# Use tool bar controls for color controls...
in text property panel
(cherry picked from commit 3b252796e1126b5ec1216082f55b8d12017eaeb1)
Conflicts:
sfx2/Package_inc.mk
sfx2/inc/sfx2/sidebar/ControlFactory.hxx
sfx2/inc/sfx2/sidebar/ControllerFactory.hxx
sfx2/inc/sfx2/sidebar/EnumContext.hxx
sfx2/source/sidebar/SidebarToolBox.cxx
svx/source/sidebar/insert/InsertPropertyPanel.cxx
svx/source/sidebar/insert/InsertPropertyPanel.hxx
svx/source/sidebar/text/TextPropertyPanel.cxx
Change-Id: Ifa1947c9e9bfdc3635dbb5b0c7a79f8ead613a90
diff --git a/include/sfx2/sidebar/ControlFactory.hxx b/include/sfx2/sidebar/ControlFactory.hxx
index 594c36c..3b286e9 100644
--- a/include/sfx2/sidebar/ControlFactory.hxx
+++ b/include/sfx2/sidebar/ControlFactory.hxx
@@ -19,21 +19,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/include/sfx2/sidebar/ControllerFactory.hxx
similarity index 58%
rename from sfx2/source/sidebar/SidebarToolBox.hxx
rename to include/sfx2/sidebar/ControllerFactory.hxx
index f76de46..030b050 100644
--- a/sfx2/source/sidebar/SidebarToolBox.hxx
+++ b/include/sfx2/sidebar/ControllerFactory.hxx
@@ -15,36 +15,30 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#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;
+
+class ToolBox;
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/include/sfx2/sidebar/EnumContext.hxx b/include/sfx2/sidebar/EnumContext.hxx
index b11f3bf..f45ecd9 100644
--- a/include/sfx2/sidebar/EnumContext.hxx
+++ b/include/sfx2/sidebar/EnumContext.hxx
@@ -125,6 +125,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/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx
new file mode 100644
index 0000000..37717ad
--- /dev/null
+++ b/include/sfx2/sidebar/SidebarToolBox.hxx
@@ -0,0 +1,101 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * 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 .
+ */
+#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/Library_sfx.mk b/sfx2/Library_sfx.mk
index a55c3c1..50ae57f 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -239,6 +239,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/source/sidebar/ControlFactory.cxx b/sfx2/source/sidebar/ControlFactory.cxx
index 43946e0..1a6f9a5 100644
--- a/sfx2/source/sidebar/ControlFactory.cxx
+++ b/sfx2/source/sidebar/ControlFactory.cxx
@@ -19,7 +19,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>
@@ -44,11 +44,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..e7463a8
--- /dev/null
+++ b/sfx2/source/sidebar/ControllerFactory.cxx
@@ -0,0 +1,104 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * 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 .
+ */
+#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 514cd13..d78d8cf 100644
--- a/sfx2/source/sidebar/EnumContext.cxx
+++ b/sfx2/source/sidebar/EnumContext.cxx
@@ -82,23 +82,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 b508cf4..c4ea537 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -572,7 +572,8 @@ void SidebarController::SwitchToDeck (
aNewPanels[nWriteIndex] = CreatePanel(
rPanelContexDescriptor.msId,
mpCurrentDeck->GetPanelParentWindow(),
- rPanelContexDescriptor.mbIsInitiallyVisible);
+ rPanelContexDescriptor.mbIsInitiallyVisible,
+ rContext);
bHasPanelSetChanged = true;
}
if (aNewPanels[nWriteIndex] != NULL)
@@ -641,7 +642,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)
@@ -659,7 +661,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.
@@ -679,7 +682,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
{
@@ -702,6 +706,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 5a4923f..df288bf 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -165,11 +165,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 bf07a30..ea4f910 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -15,16 +15,22 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#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"
#include <vcl/gradient.hxx>
+#include <svtools/miscopt.hxx>
+#include <framework/imageproducer.hxx>
+#include <com/sun/star/frame/XSubToolbarController.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
namespace sfx2 { namespace sidebar {
@@ -32,13 +38,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
@@ -49,6 +74,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());
+
}
@@ -167,4 +210,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 42aebbe..d98f709 100644
--- a/sfx2/source/sidebar/ToolBoxBackground.cxx
+++ b/sfx2/source/sidebar/ToolBoxBackground.cxx
@@ -132,10 +132,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 7b75844..4ac410d 100644
--- a/svx/source/sidebar/PanelFactory.cxx
+++ b/svx/source/sidebar/PanelFactory.cxx
@@ -114,6 +114,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)
@@ -135,7 +138,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 1207ebb..cbaca02 100644
--- a/svx/source/sidebar/insert/InsertPropertyPanel.cxx
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.cxx
@@ -22,6 +22,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>
@@ -39,6 +40,7 @@
using namespace css;
using namespace cssu;
using ::rtl::OUString;
+using ::sfx2::sidebar::SidebarToolBox;
namespace svx { namespace sidebar {
@@ -51,20 +53,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();
@@ -80,17 +79,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)
@@ -106,88 +94,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, ActivateToolBox));
- rToolBox.SetDeactivateHdl(LINK(this, InsertPropertyPanel, DeactivateToolBox));
-
- 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
@@ -200,7 +106,8 @@ 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();
+ ToolBox* pToolBox = dynamic_cast<ToolBox*>(pWindow);
if (pToolBox == NULL)
return 1;
@@ -217,199 +124,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());
- Image aImage (framework::GetImageFromURL(mxFrame, sCommand, bBigImages));
- pToolBox->SetItemImage(iController->first, aImage);
-
- return 1;
-}
-
-
-
-
-IMPL_LINK(InsertPropertyPanel, ActivateToolBox, ToolBox*, EMPTYARG)
-{
- return 1;
-}
-
-
-
-
-IMPL_LINK(InsertPropertyPanel, DeactivateToolBox, 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::getProcessComponentContext(),
- 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 0;
-}
-
-
-
-
-void InsertPropertyPanel::UpdateIcons (void)
-{
- const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge());
-
- 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));
- 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 a84bf1d..6f50d93 100644
--- a/svx/source/sidebar/insert/InsertPropertyPanel.hxx
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.hxx
@@ -49,41 +49,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(ActivateToolBox, ToolBox*);
- DECL_LINK(DeactivateToolBox, ToolBox*);
};
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index 3a67193..53ec527 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -39,7 +39,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>
@@ -86,36 +88,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;
@@ -129,7 +101,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);
@@ -141,7 +114,8 @@ TextPropertyPanel* TextPropertyPanel::Create (
return new TextPropertyPanel(
pParent,
rxFrame,
- pBindings);
+ pBindings,
+ rContext);
}
@@ -153,7 +127,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)),
@@ -180,12 +155,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(),
@@ -196,12 +174,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),
@@ -211,14 +187,12 @@ TextPropertyPanel::TextPropertyPanel (
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();
}
@@ -358,10 +332,8 @@ void TextPropertyPanel::Initialize (void)
SetupToolboxItems();
InitToolBoxIncDec();
InitToolBoxFont();
- InitToolBoxFontColor();
InitToolBoxScript();
InitToolBoxSpacing();
- InitToolBoxHighlight();
#ifdef HAS_IA2
mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox);
@@ -386,27 +358,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);
@@ -460,17 +418,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() );
@@ -495,16 +442,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 );
-}
@@ -520,7 +457,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);
@@ -528,7 +464,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);
}
@@ -792,22 +727,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();
@@ -873,21 +792,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();
@@ -1081,44 +985,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);
@@ -1292,9 +1158,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;
@@ -1307,9 +1170,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;
@@ -1323,24 +1183,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 0244ee5..36fc250 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hrc
+++ b/svx/source/sidebar/text/TextPropertyPanel.hrc
@@ -30,11 +30,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 e2f4dac..a7cc0dd 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -22,6 +22,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>
@@ -29,6 +30,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"
@@ -54,7 +56,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);
@@ -63,8 +66,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);
@@ -109,12 +110,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;
@@ -126,10 +125,6 @@ private:
FontStrikeout meStrike;
bool mbWeightAvailable;
bool mbPostureAvailable;
- Color maColor;
- bool mbColorAvailable;
- Color maBackColor;
- bool mbBackColorAvailable;
SvxEscapement meEscape; //for sw
bool mbSuper;
bool mbSub;
@@ -143,8 +138,6 @@ private:
bool mbFocusOnFontSizeCtrl;
TextCharacterSpacingPopup maCharSpacePopup;
TextUnderlinePopup maUnderlinePopup;
- ColorPopup maFontColorPopup;
- ColorPopup maBrushColorPopup;
cssu::Reference<css::frame::XFrame> mxFrame;
::sfx2::sidebar::EnumContext maContext;
@@ -153,26 +146,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 f4038fe..fcd10da 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.src
+++ b/svx/source/sidebar/text/TextPropertyPanel.src
@@ -149,7 +149,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
@@ -161,6 +160,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
{
@@ -177,7 +194,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