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,
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);
......
......@@ -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)
{
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
......@@ -54,6 +54,12 @@ namespace
} //end of anonymous namespace
namespace sfx2 { namespace sidebar {
class SidebarToolBox;
} }
namespace svx
{
namespace sidebar
......@@ -112,6 +118,10 @@ protected:
void setMapUnit(SfxMapUnit eMapUnit);
protected:
VclPtr<sfx2::sidebar::SidebarToolBox> mpTBColor;
private:
//ui controls
VclPtr<FixedText> mpFTWidth;
......
......@@ -165,6 +165,7 @@ LinePropertyPanelBase::LinePropertyPanelBase(
{
get(mpFTWidth, "widthlabel");
get(mpTBWidth, "width");
get(mpTBColor, "color");
get(mpFTStyle, "stylelabel");
get(mpLBStyle, "linestyle");
get(mpFTTransparency, "translabel");
......@@ -191,6 +192,7 @@ void LinePropertyPanelBase::dispose()
{
mpFTWidth.clear();
mpTBWidth.clear();
mpTBColor.clear();
mpFTStyle.clear();
mpLBStyle.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