[Libreoffice-commits] core.git: 2 commits - chart2/source include/svx svx/source

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Aug 19 18:16:28 PDT 2015


 chart2/source/controller/sidebar/ChartAreaPanel.cxx    |    2 -
 chart2/source/controller/sidebar/ChartColorWrapper.cxx |    5 ++--
 chart2/source/controller/sidebar/ChartColorWrapper.hxx |    3 +-
 chart2/source/controller/sidebar/ChartLinePanel.cxx    |   20 ++++++++++++++++-
 chart2/source/controller/sidebar/ChartLinePanel.hxx    |    2 +
 chart2/source/model/main/DataPointProperties.cxx       |    9 +++++++
 include/svx/sidebar/LinePropertyPanelBase.hxx          |   10 ++++++++
 svx/source/sidebar/line/LinePropertyPanelBase.cxx      |    2 +
 8 files changed, 48 insertions(+), 5 deletions(-)

New commits:
commit 00754461516416f8ee59ec97632bff84f4d9b155
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Aug 20 03:14:08 2015 +0200

    make color button work in chart line sidebar panel
    
    Change-Id: I2148fd9953b283945d2a1bcf24dbc47964b659ae

diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 28bad2f..294bcc5 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 beeb85d..bd5fd67 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 b0f9071..045f947 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 d025c5e..55753bd 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 1b614b0..3c7e474 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
diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx
index ef41457..a5f4a99 100644
--- a/include/svx/sidebar/LinePropertyPanelBase.hxx
+++ b/include/svx/sidebar/LinePropertyPanelBase.hxx
@@ -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;
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index d6fa20e..b875cce 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -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();
commit 5cabc2c06d9e5dd7c414b79a5728420cf2eb43fe
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Aug 20 03:14:36 2015 +0200

    make sure that LineColor is supported for data series
    
    Change-Id: I1ae96c7b6adf5a90f96d7dddc20d7fb241e78445

diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx
index f09cf47..8c13183 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -204,6 +204,15 @@ void DataPointProperties::AddPropertiesToVector(
                   | beans::PropertyAttribute::MAYBEVOID ));
 
     // Line Properties
+
+    rOutProperties.push_back(
+        Property( "LineColor",
+                  PROP_DATAPOINT_BORDER_COLOR,
+                  cppu::UnoType<sal_Int32>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEVOID
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
+
     rOutProperties.push_back(
         Property( "LineStyle",
                   LinePropertiesHelper::PROP_LINE_STYLE,


More information about the Libreoffice-commits mailing list