Kaydet (Commit) 00754461 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

make color button work in chart line sidebar panel

Change-Id: I2148fd9953b283945d2a1bcf24dbc47964b659ae
üst 5cabc2c0
...@@ -247,7 +247,7 @@ ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent, ...@@ -247,7 +247,7 @@ ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent,
mxSelectionListener(new ChartSidebarSelectionListener(this)), mxSelectionListener(new ChartSidebarSelectionListener(this)),
mbUpdate(true), mbUpdate(true),
mbModelValid(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}; std::vector<ObjectType> aAcceptedTypes { OBJECTTYPE_PAGE, OBJECTTYPE_DIAGRAM, OBJECTTYPE_DATA_SERIES, OBJECTTYPE_TITLE, OBJECTTYPE_LEGEND};
mxSelectionListener->setAcceptedTypes(aAcceptedTypes); mxSelectionListener->setAcceptedTypes(aAcceptedTypes);
......
...@@ -61,10 +61,11 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet( ...@@ -61,10 +61,11 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet(
ChartColorWrapper::ChartColorWrapper( ChartColorWrapper::ChartColorWrapper(
css::uno::Reference<css::frame::XModel> xModel, css::uno::Reference<css::frame::XModel> xModel,
SvxColorToolBoxControl* pControl): SvxColorToolBoxControl* pControl,
const OUString& rName):
mxModel(xModel), mxModel(xModel),
mpControl(pControl), mpControl(pControl),
maPropertyName("FillColor") maPropertyName(rName)
{ {
} }
......
...@@ -23,7 +23,8 @@ private: ...@@ -23,7 +23,8 @@ private:
public: public:
ChartColorWrapper(css::uno::Reference<css::frame::XModel> xModel, ChartColorWrapper(css::uno::Reference<css::frame::XModel> xModel,
SvxColorToolBoxControl* pControl); SvxColorToolBoxControl* pControl,
const OUString& rPropertyName);
void operator()(const OUString& rCommand, const Color& rColor); void operator()(const OUString& rCommand, const Color& rColor);
......
...@@ -18,12 +18,22 @@ ...@@ -18,12 +18,22 @@
#include <svx/xlntrit.hxx> #include <svx/xlntrit.hxx>
#include <svx/unomid.hxx> #include <svx/unomid.hxx>
#include <svx/tbcontrl.hxx>
#include <sfx2/sidebar/SidebarToolBox.hxx>
#include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp>
namespace chart { namespace sidebar { namespace chart { namespace sidebar {
namespace { 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) OUString getCID(css::uno::Reference<css::frame::XModel> xModel)
{ {
css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController()); css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
...@@ -122,7 +132,8 @@ ChartLinePanel::ChartLinePanel(vcl::Window* pParent, ...@@ -122,7 +132,8 @@ ChartLinePanel::ChartLinePanel(vcl::Window* pParent,
mxListener(new ChartSidebarModifyListener(this)), mxListener(new ChartSidebarModifyListener(this)),
mxSelectionListener(new ChartSidebarSelectionListener(this)), mxSelectionListener(new ChartSidebarSelectionListener(this)),
mbUpdate(true), 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}; std::vector<ObjectType> aAcceptedTypes { OBJECTTYPE_PAGE, OBJECTTYPE_DIAGRAM, OBJECTTYPE_DATA_SERIES, OBJECTTYPE_TITLE, OBJECTTYPE_LEGEND};
mxSelectionListener->setAcceptedTypes(aAcceptedTypes); mxSelectionListener->setAcceptedTypes(aAcceptedTypes);
...@@ -155,6 +166,9 @@ void ChartLinePanel::Initialize() ...@@ -155,6 +166,9 @@ void ChartLinePanel::Initialize()
if (xSelectionSupplier.is()) if (xSelectionSupplier.is())
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get()); xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get());
SvxColorToolBoxControl* pToolBoxColor = getColorToolBoxControl(mpTBColor.get());
pToolBoxColor->setColorSelectFunction(maLineColorWrapper);
setMapUnit(SFX_MAPUNIT_100TH_MM); setMapUnit(SFX_MAPUNIT_100TH_MM);
updateData(); updateData();
} }
...@@ -185,6 +199,8 @@ void ChartLinePanel::updateData() ...@@ -185,6 +199,8 @@ void ChartLinePanel::updateData()
XLineDashItem aDashItem; XLineDashItem aDashItem;
aDashItem.PutValue(aLineDash, MID_LINEDASH); aDashItem.PutValue(aLineDash, MID_LINEDASH);
updateLineDash(false, true, &aDashItem); updateLineDash(false, true, &aDashItem);
maLineColorWrapper.updateData();
} }
void ChartLinePanel::modelInvalid() void ChartLinePanel::modelInvalid()
...@@ -214,6 +230,8 @@ void ChartLinePanel::updateModel( ...@@ -214,6 +230,8 @@ void ChartLinePanel::updateModel(
mxModel = xModel; mxModel = xModel;
mbModelValid = true; mbModelValid = true;
maLineColorWrapper.updateModel(mxModel);
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW); css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener); xBroadcasterNew->addModifyListener(mxListener);
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "ChartSidebarModifyListener.hxx" #include "ChartSidebarModifyListener.hxx"
#include "ChartSidebarSelectionListener.hxx" #include "ChartSidebarSelectionListener.hxx"
#include "ChartColorWrapper.hxx"
class XFillFloatTransparenceItem; class XFillFloatTransparenceItem;
class XFillTransparenceItem; class XFillTransparenceItem;
...@@ -96,6 +97,7 @@ private: ...@@ -96,6 +97,7 @@ private:
bool mbUpdate; bool mbUpdate;
bool mbModelValid; bool mbModelValid;
ChartColorWrapper maLineColorWrapper;
}; };
} } // end of namespace svx::sidebar } } // end of namespace svx::sidebar
......
...@@ -54,6 +54,12 @@ namespace ...@@ -54,6 +54,12 @@ namespace
} //end of anonymous namespace } //end of anonymous namespace
namespace sfx2 { namespace sidebar {
class SidebarToolBox;
} }
namespace svx namespace svx
{ {
namespace sidebar namespace sidebar
...@@ -112,6 +118,10 @@ protected: ...@@ -112,6 +118,10 @@ protected:
void setMapUnit(SfxMapUnit eMapUnit); void setMapUnit(SfxMapUnit eMapUnit);
protected:
VclPtr<sfx2::sidebar::SidebarToolBox> mpTBColor;
private: private:
//ui controls //ui controls
VclPtr<FixedText> mpFTWidth; VclPtr<FixedText> mpFTWidth;
......
...@@ -165,6 +165,7 @@ LinePropertyPanelBase::LinePropertyPanelBase( ...@@ -165,6 +165,7 @@ LinePropertyPanelBase::LinePropertyPanelBase(
{ {
get(mpFTWidth, "widthlabel"); get(mpFTWidth, "widthlabel");
get(mpTBWidth, "width"); get(mpTBWidth, "width");
get(mpTBColor, "color");
get(mpFTStyle, "stylelabel"); get(mpFTStyle, "stylelabel");
get(mpLBStyle, "linestyle"); get(mpLBStyle, "linestyle");
get(mpFTTransparency, "translabel"); get(mpFTTransparency, "translabel");
...@@ -191,6 +192,7 @@ void LinePropertyPanelBase::dispose() ...@@ -191,6 +192,7 @@ void LinePropertyPanelBase::dispose()
{ {
mpFTWidth.clear(); mpFTWidth.clear();
mpTBWidth.clear(); mpTBWidth.clear();
mpTBColor.clear();
mpFTStyle.clear(); mpFTStyle.clear();
mpLBStyle.clear(); mpLBStyle.clear();
mpFTTransparency.clear(); mpFTTransparency.clear();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment