[Libreoffice-commits] core.git: 3 commits - chart2/source officecfg/registry

Markus Mohrhard markus.mohrhard at googlemail.com
Thu Oct 22 14:49:43 PDT 2015


 chart2/source/controller/sidebar/ChartErrorBarPanel.cxx      |   25 +++++++----
 officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu |    3 +
 2 files changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 0348b94bef515f3a0efc4a39ec385baf4982e5fa
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Oct 22 23:47:28 2015 +0200

    provide more button for chart error bar sidebar panel, tdf#95055
    
    Change-Id: I4240631f98c51cc52a21a3ff551a339f22df11f3

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index d933003..92071f8 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -1226,6 +1226,9 @@
         <prop oor:name="DeckId" oor:type="xs:string">
           <value>ChartDeck</value>
         </prop>
+        <prop oor:name="DefaultMenuCommand">
+          <value>.uno:ChartProperties</value>
+        </prop>
         <prop oor:name="ContextList">
           <value oor:separator=";">
             Chart, ErrorBar, visible ;
commit 66a25e96ca961e676f34ad1c118f9673123f86cc
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Oct 22 01:33:07 2015 +0200

    make it harder to use the API wrongly, tdf#95056
    
    Change-Id: I07129285ac7f00513802a60c31d5de27f6f4a5d6

diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index f4b6635..04d5aef 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -45,6 +45,12 @@ namespace chart { namespace sidebar {
 
 namespace {
 
+enum class ErrorBarDirection
+{
+    POSITIVE,
+    NEGATIVE
+};
+
 css::uno::Reference<css::beans::XPropertySet> getErrorBarPropSet(
         css::uno::Reference<css::frame::XModel> xModel, const OUString& rCID)
 {
@@ -175,7 +181,7 @@ void setTypePos(css::uno::Reference<css::frame::XModel> xModel,
 }
 
 double getValue(css::uno::Reference<css::frame::XModel> xModel,
-        const OUString& rCID, bool bNeg)
+        const OUString& rCID, ErrorBarDirection eDir)
 {
     css::uno::Reference<css::beans::XPropertySet> xPropSet =
         getErrorBarPropSet(xModel, rCID);
@@ -184,7 +190,7 @@ double getValue(css::uno::Reference<css::frame::XModel> xModel,
         return 0;
 
     OUString aName = "PositiveError";
-    if (bNeg)
+    if (eDir == ErrorBarDirection::NEGATIVE)
         aName = "NegativeError";
 
     css::uno::Any aAny = xPropSet->getPropertyValue(aName);
@@ -199,7 +205,7 @@ double getValue(css::uno::Reference<css::frame::XModel> xModel,
 }
 
 void setValue(css::uno::Reference<css::frame::XModel> xModel,
-        const OUString& rCID, double nVal, bool bPos)
+        const OUString& rCID, double nVal, ErrorBarDirection eDir)
 {
     css::uno::Reference<css::beans::XPropertySet> xPropSet =
         getErrorBarPropSet(xModel, rCID);
@@ -208,7 +214,7 @@ void setValue(css::uno::Reference<css::frame::XModel> xModel,
         return;
 
     OUString aName = "PositiveError";
-    if (!bPos)
+    if (eDir == ErrorBarDirection::NEGATIVE)
         aName = "NegativeError";
 
     xPropSet->setPropertyValue(aName, css::uno::makeAny(nVal));
@@ -337,8 +343,8 @@ void ChartErrorBarPanel::updateData()
         else
             mpMFNeg->Disable();
 
-        double nValPos = getValue(mxModel, aCID, true);
-        double nValNeg = getValue(mxModel, aCID, false);
+        double nValPos = getValue(mxModel, aCID, ErrorBarDirection::POSITIVE);
+        double nValNeg = getValue(mxModel, aCID, ErrorBarDirection::NEGATIVE);
 
         mpMFPos->SetValue(nValPos);
         mpMFNeg->SetValue(nValNeg);
@@ -428,9 +434,9 @@ IMPL_LINK_TYPED(ChartErrorBarPanel, NumericFieldHdl, Edit&, rMetricField, void)
     OUString aCID = getCID(mxModel);
     double nVal = static_cast<NumericField&>(rMetricField).GetValue();
     if (&rMetricField == mpMFPos.get())
-        setValue(mxModel, aCID, nVal, true);
+        setValue(mxModel, aCID, nVal, ErrorBarDirection::POSITIVE);
     else if (&rMetricField == mpMFNeg.get())
-        setValue(mxModel, aCID, nVal, false);
+        setValue(mxModel, aCID, nVal, ErrorBarDirection::NEGATIVE);
 }
 
 }} // end of namespace ::chart::sidebar
commit 73cfe5fece97c90505a24a3fb6daae2e7e27fcef
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Oct 22 01:24:37 2015 +0200

    disable all error bar radion buttons in the beginning, tdf#95057
    
    Change-Id: I611a637038669fe855b4357045bff8d3eb5f8600

diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index 9b44f0d..f4b6635 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -286,6 +286,9 @@ void ChartErrorBarPanel::Initialize()
 {
     css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
     xBroadcaster->addModifyListener(mxListener);
+    mpRBNeg->Check(false);
+    mpRBPos->Check(false);
+    mpRBPosAndNeg->Check(false);
 
     updateData();
 


More information about the Libreoffice-commits mailing list