diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-08-20 03:14:08 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-08-20 03:15:57 +0200 |
commit | 00754461516416f8ee59ec97632bff84f4d9b155 (patch) | |
tree | 14a380a2d98a2d00764f0e4fd24a9ec99f638c1e /chart2 | |
parent | 5cabc2c06d9e5dd7c414b79a5728420cf2eb43fe (diff) |
make color button work in chart line sidebar panel
Change-Id: I2148fd9953b283945d2a1bcf24dbc47964b659ae
Diffstat (limited to 'chart2')
5 files changed, 27 insertions, 5 deletions
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx index 28bad2fe4e1d..294bcc5b3269 100644 --- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx +++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx @@ -247,7 +247,7 @@ ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent, mxSelectionListener(new ChartSidebarSelectionListener(this)), mbUpdate(true), mbModelValid(true), - maFillColorWrapper(mxModel, getColorToolBoxControl(mpToolBoxColor.get())) + maFillColorWrapper(mxModel, getColorToolBoxControl(mpToolBoxColor.get()), "FillColor") { std::vector<ObjectType> aAcceptedTypes { OBJECTTYPE_PAGE, OBJECTTYPE_DIAGRAM, OBJECTTYPE_DATA_SERIES, OBJECTTYPE_TITLE, OBJECTTYPE_LEGEND}; mxSelectionListener->setAcceptedTypes(aAcceptedTypes); diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx b/chart2/source/controller/sidebar/ChartColorWrapper.cxx index beeb85df3c72..bd5fd67f0def 100644 --- a/chart2/source/controller/sidebar/ChartColorWrapper.cxx +++ b/chart2/source/controller/sidebar/ChartColorWrapper.cxx @@ -61,10 +61,11 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet( ChartColorWrapper::ChartColorWrapper( css::uno::Reference<css::frame::XModel> xModel, - SvxColorToolBoxControl* pControl): + SvxColorToolBoxControl* pControl, + const OUString& rName): mxModel(xModel), mpControl(pControl), - maPropertyName("FillColor") + maPropertyName(rName) { } diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.hxx b/chart2/source/controller/sidebar/ChartColorWrapper.hxx index b0f90710e138..045f94783cec 100644 --- a/chart2/source/controller/sidebar/ChartColorWrapper.hxx +++ b/chart2/source/controller/sidebar/ChartColorWrapper.hxx @@ -23,7 +23,8 @@ private: public: ChartColorWrapper(css::uno::Reference<css::frame::XModel> xModel, - SvxColorToolBoxControl* pControl); + SvxColorToolBoxControl* pControl, + const OUString& rPropertyName); void operator()(const OUString& rCommand, const Color& rColor); diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx index d025c5ebdd75..55753bd6d027 100644 --- a/chart2/source/controller/sidebar/ChartLinePanel.cxx +++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx @@ -18,12 +18,22 @@ #include <svx/xlntrit.hxx> #include <svx/unomid.hxx> +#include <svx/tbcontrl.hxx> +#include <sfx2/sidebar/SidebarToolBox.hxx> + #include <com/sun/star/view/XSelectionSupplier.hpp> namespace chart { namespace sidebar { namespace { +SvxColorToolBoxControl* getColorToolBoxControl(sfx2::sidebar::SidebarToolBox* pToolBoxColor) +{ + css::uno::Reference<css::frame::XToolbarController> xController = pToolBoxColor->GetFirstController(); + SvxColorToolBoxControl* pToolBoxColorControl = dynamic_cast<SvxColorToolBoxControl*>(xController.get()); + return pToolBoxColorControl; +} + OUString getCID(css::uno::Reference<css::frame::XModel> xModel) { css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController()); @@ -122,7 +132,8 @@ ChartLinePanel::ChartLinePanel(vcl::Window* pParent, mxListener(new ChartSidebarModifyListener(this)), mxSelectionListener(new ChartSidebarSelectionListener(this)), mbUpdate(true), - mbModelValid(true) + mbModelValid(true), + maLineColorWrapper(mxModel, getColorToolBoxControl(mpTBColor.get()), "LineColor") { std::vector<ObjectType> aAcceptedTypes { OBJECTTYPE_PAGE, OBJECTTYPE_DIAGRAM, OBJECTTYPE_DATA_SERIES, OBJECTTYPE_TITLE, OBJECTTYPE_LEGEND}; mxSelectionListener->setAcceptedTypes(aAcceptedTypes); @@ -155,6 +166,9 @@ void ChartLinePanel::Initialize() if (xSelectionSupplier.is()) xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get()); + SvxColorToolBoxControl* pToolBoxColor = getColorToolBoxControl(mpTBColor.get()); + pToolBoxColor->setColorSelectFunction(maLineColorWrapper); + setMapUnit(SFX_MAPUNIT_100TH_MM); updateData(); } @@ -185,6 +199,8 @@ void ChartLinePanel::updateData() XLineDashItem aDashItem; aDashItem.PutValue(aLineDash, MID_LINEDASH); updateLineDash(false, true, &aDashItem); + + maLineColorWrapper.updateData(); } void ChartLinePanel::modelInvalid() @@ -214,6 +230,8 @@ void ChartLinePanel::updateModel( mxModel = xModel; mbModelValid = true; + maLineColorWrapper.updateModel(mxModel); + css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW); xBroadcasterNew->addModifyListener(mxListener); diff --git a/chart2/source/controller/sidebar/ChartLinePanel.hxx b/chart2/source/controller/sidebar/ChartLinePanel.hxx index 1b614b09d501..3c7e4749c1d3 100644 --- a/chart2/source/controller/sidebar/ChartLinePanel.hxx +++ b/chart2/source/controller/sidebar/ChartLinePanel.hxx @@ -30,6 +30,7 @@ #include "ChartSidebarModifyListener.hxx" #include "ChartSidebarSelectionListener.hxx" +#include "ChartColorWrapper.hxx" class XFillFloatTransparenceItem; class XFillTransparenceItem; @@ -96,6 +97,7 @@ private: bool mbUpdate; bool mbModelValid; + ChartColorWrapper maLineColorWrapper; }; } } // end of namespace svx::sidebar |