[Libreoffice-commits] core.git: chart2/source chart2/uiconfig

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 5 14:44:08 UTC 2018


 chart2/source/controller/dialogs/tp_SeriesToAxis.cxx                   |   10 +
 chart2/source/controller/dialogs/tp_SeriesToAxis.hxx                   |    1 
 chart2/source/controller/inc/SeriesOptionsItemConverter.hxx            |    2 
 chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx              |    3 
 chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx |   17 +++
 chart2/source/inc/chartview/ChartSfxItemIds.hxx                        |    3 
 chart2/source/view/main/ChartItemPool.cxx                              |    1 
 chart2/uiconfig/ui/tp_SeriesToAxis.ui                                  |   53 +++++++++-
 8 files changed, 87 insertions(+), 3 deletions(-)

New commits:
commit 19b2ed4dee1ec33ad55473d43bfcd0bfa194cbee
Author:     Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Wed Dec 5 04:34:39 2018 +0100
Commit:     Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Wed Dec 5 15:43:42 2018 +0100

    related tdf#51671, add UI options for new "hide legend entry" feature
    
    Change-Id: I4a9025e317dbd93fb45e676f266c555c72f4d18b
    Reviewed-on: https://gerrit.libreoffice.org/64614
    Tested-by: Jenkins
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
index 2cab39c84e8e..91f2255cf99e 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
@@ -53,6 +53,7 @@ SchOptionTabPage::SchOptionTabPage(TabPageParent pWindow,const SfxItemSet& rInAt
     , m_xRB_AssumeZero(m_xBuilder->weld_radio_button("RB_ASSUME_ZERO"))
     , m_xRB_ContinueLine(m_xBuilder->weld_radio_button("RB_CONTINUE_LINE"))
     , m_xCBIncludeHiddenCells(m_xBuilder->weld_check_button("CB_INCLUDE_HIDDEN_CELLS"))
+    , m_xCBHideLegendEntry(m_xBuilder->weld_check_button("CB_LEGEND_ENTRY_HIDDEN"))
 {
     m_xRbtAxis1->connect_toggled(LINK(this, SchOptionTabPage, EnableHdl));
     m_xRbtAxis2->connect_toggled(LINK(this, SchOptionTabPage, EnableHdl));
@@ -108,6 +109,9 @@ bool SchOptionTabPage::FillItemSet(SfxItemSet* rOutAttrs)
     if (m_xCBIncludeHiddenCells->get_visible())
         rOutAttrs->Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_xCBIncludeHiddenCells->get_active()));
 
+    if(m_xCBHideLegendEntry->get_visible())
+        rOutAttrs->Put(SfxBoolItem(SCHATTR_HIDE_LEGEND_ENTRY, m_xCBHideLegendEntry->get_active()));
+
     return true;
 }
 
@@ -215,6 +219,12 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
             m_xGrpPlotOptions->show(false);
     }
 
+    if (rInAttrs->GetItemState(SCHATTR_HIDE_LEGEND_ENTRY, true, &pPoolItem) == SfxItemState::SET)
+    {
+        bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+        m_xCBHideLegendEntry->set_active(bVal);
+    }
+
     AdaptControlPositionsAndVisibility();
 }
 
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
index 1f6a16aeac43..7ffbed77ca9d 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
@@ -70,6 +70,7 @@ private: //member
     std::unique_ptr<weld::RadioButton> m_xRB_AssumeZero;
     std::unique_ptr<weld::RadioButton> m_xRB_ContinueLine;
     std::unique_ptr<weld::CheckButton> m_xCBIncludeHiddenCells;
+    std::unique_ptr<weld::CheckButton> m_xCBHideLegendEntry;
 };
 
 } //namespace chart
diff --git a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
index ad8fd31cfd20..378956c47212 100644
--- a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
+++ b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
@@ -74,6 +74,8 @@ private:
 
     bool m_bSupportingPlottingOfHiddenCells;
     bool m_bIncludeHiddenCells;
+
+    bool m_bHideLegendEntry;
 };
 
 } //  namespace wrapper
diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
index b8c85f61c046..e7c0fca9b855 100644
--- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
+++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
@@ -130,7 +130,8 @@ const sal_uInt16 nTextLabelWhichPairs[] =
     SCHATTR_CLOCKWISE,SCHATTR_CLOCKWISE, \
     SCHATTR_MISSING_VALUE_TREATMENT,SCHATTR_MISSING_VALUE_TREATMENT, \
     SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS,SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, \
-    SCHATTR_INCLUDE_HIDDEN_CELLS,SCHATTR_INCLUDE_HIDDEN_CELLS
+    SCHATTR_INCLUDE_HIDDEN_CELLS,SCHATTR_INCLUDE_HIDDEN_CELLS, \
+    SCHATTR_HIDE_LEGEND_ENTRY,SCHATTR_HIDE_LEGEND_ENTRY
 
 const sal_uInt16 nSeriesOptionsWhichPairs[] =
 {
diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
index 7b98478e75b2..b289a16423ae 100644
--- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -74,6 +74,7 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
         , m_nMissingValueTreatment(0)
         , m_bSupportingPlottingOfHiddenCells(false)
         , m_bIncludeHiddenCells(true)
+        , m_bHideLegendEntry(false)
 {
     try
     {
@@ -156,6 +157,8 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
             {
             }
         }
+
+        m_bHideLegendEntry = !xPropertySet->getPropertyValue("ShowLegendEntry").get<bool>();
     }
     catch( const uno::Exception & )
     {
@@ -351,6 +354,15 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
             }
         }
         break;
+        case SCHATTR_HIDE_LEGEND_ENTRY:
+        {
+            bool bHideLegendEntry = static_cast<const SfxBoolItem &>(rItemSet.Get(nWhichId)).GetValue();
+            if (bHideLegendEntry != m_bHideLegendEntry)
+            {
+                GetPropertySet()->setPropertyValue("ShowLegendEntry", css::uno::makeAny(!bHideLegendEntry));
+            }
+        }
+        break;
     }
     return bChanged;
 }
@@ -422,6 +434,11 @@ void SeriesOptionsItemConverter::FillSpecialItem(
                 rOutItemSet.Put( SfxBoolItem(nWhichId, m_bIncludeHiddenCells) );
             break;
         }
+        case SCHATTR_HIDE_LEGEND_ENTRY:
+        {
+            rOutItemSet.Put(SfxBoolItem(nWhichId, m_bHideLegendEntry));
+            break;
+        }
         default:
             break;
    }
diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
index 8fbbaad8fa70..c1de0a8a6864 100644
--- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx
+++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
@@ -152,8 +152,9 @@
 #define SCHATTR_MISSING_VALUE_TREATMENT     TypedWhichId<SfxInt32Item>(SCHATTR_CHARTTYPE_START + 9)
 #define SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS TypedWhichId<SfxIntegerListItem>(SCHATTR_CHARTTYPE_START + 10)
 #define SCHATTR_INCLUDE_HIDDEN_CELLS    TypedWhichId<SfxBoolItem>(SCHATTR_CHARTTYPE_START + 11)
+#define SCHATTR_HIDE_LEGEND_ENTRY       TypedWhichId<SfxBoolItem>(SCHATTR_CHARTTYPE_START + 12)
 
-#define SCHATTR_CHARTTYPE_END           SCHATTR_INCLUDE_HIDDEN_CELLS
+#define SCHATTR_CHARTTYPE_END           SCHATTR_HIDE_LEGEND_ENTRY
 
 // items for transporting information to dialogs
 #define SCHATTR_MISC_START              (SCHATTR_CHARTTYPE_END + 1)
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index c2c325aa7106..894955bc10dd 100644
--- a/chart2/source/view/main/ChartItemPool.cxx
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -143,6 +143,7 @@ ChartItemPool::ChartItemPool():
     rPoolDefaults[SCHATTR_MISSING_VALUE_TREATMENT    - SCHATTR_START] = new SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT, 0);
     rPoolDefaults[SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, std::vector < sal_Int32 >() );
     rPoolDefaults[SCHATTR_INCLUDE_HIDDEN_CELLS - SCHATTR_START] = new SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, true);
+    rPoolDefaults[SCHATTR_HIDE_LEGEND_ENTRY - SCHATTR_START] = new SfxBoolItem(SCHATTR_HIDE_LEGEND_ENTRY, false);
 
     rPoolDefaults[SCHATTR_AXIS_FOR_ALL_SERIES  - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_FOR_ALL_SERIES, 0);
 
diff --git a/chart2/uiconfig/ui/tp_SeriesToAxis.ui b/chart2/uiconfig/ui/tp_SeriesToAxis.ui
index f5957b407eb0..e13855e46ccc 100644
--- a/chart2/uiconfig/ui/tp_SeriesToAxis.ui
+++ b/chart2/uiconfig/ui/tp_SeriesToAxis.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="chart">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkAdjustment" id="adjustmentGAP">
@@ -363,5 +363,56 @@
         <property name="position">2</property>
       </packing>
     </child>
+    <child>
+      <object class="GtkFrame" id="frameLegend">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label_xalign">0</property>
+        <property name="shadow_type">none</property>
+        <child>
+          <object class="GtkAlignment">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="left_padding">12</property>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkCheckButton" id="CB_LEGEND_ENTRY_HIDDEN">
+                    <property name="label" translatable="yes" context="tp_SeriesToAxis|CB_LEGEND_ENTRY_HIDDEN">Hide legend entry</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes" context="tp_SeriesToAxis|label4">Legend Entry</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">3</property>
+      </packing>
+    </child>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list