[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - chart2/source chart2/uiconfig

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Sat Nov 14 01:13:38 UTC 2020


 chart2/source/controller/sidebar/ChartElementsPanel.cxx |   39 ++++++++++++
 chart2/source/controller/sidebar/ChartElementsPanel.hxx |    4 +
 chart2/uiconfig/ui/sidebarelements.ui                   |   49 +++++++++++++---
 3 files changed, 83 insertions(+), 9 deletions(-)

New commits:
commit b831f4e0ffb45b7e0fbe3ce034302a75162e3297
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Oct 14 16:18:17 2020 +0200
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sat Nov 14 02:12:40 2020 +0100

    chart2: Add the possibility to edit title & subtitle from the sidebar.
    
    Change-Id: I4be15acbc2127ebb6eca8864a0209ba57b488100
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104313
    Tested-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105614
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>

diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 14fd14dad5d5..68175acd46d2 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -277,7 +277,9 @@ ChartElementsPanel::ChartElementsPanel(
     mbModelValid(true)
 {
     get(mpCBTitle,  "checkbutton_title");
+    get(mpEditTitle, "edit_title");
     get(mpCBSubtitle,  "checkbutton_subtitle");
+    get(mpEditSubtitle, "edit_subtitle");
     get(mpCBXAxis,  "checkbutton_x_axis");
     get(mpCBXAxisTitle,  "checkbutton_x_axis_title");
     get(mpCBYAxis,  "checkbutton_y_axis");
@@ -319,7 +321,9 @@ void ChartElementsPanel::dispose()
     css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
     xBroadcaster->removeModifyListener(mxListener);
     mpCBTitle.clear();
+    mpEditTitle.clear();
     mpCBSubtitle.clear();
+    mpEditSubtitle.clear();
     mpCBXAxis.clear();
     mpCBXAxisTitle.clear();
     mpCBYAxis.clear();
@@ -374,6 +378,10 @@ void ChartElementsPanel::Initialize()
     mpCBGridHorizontalMinor->SetClickHdl(aLink);
 
     mpLBLegendPosition->SetSelectHdl(LINK(this, ChartElementsPanel, LegendPosHdl));
+
+    Link<Edit&, void> aEditLink = LINK(this, ChartElementsPanel, EditHdl);
+    mpEditTitle->SetModifyHdl(aEditLink);
+    mpEditSubtitle->SetModifyHdl(aEditLink);
 }
 
 namespace {
@@ -416,8 +424,23 @@ void ChartElementsPanel::updateData()
 
     mpCBLegend->Check(isLegendVisible(mxModel));
     mpBoxLegend->Enable( isLegendVisible(mxModel) );
-    mpCBTitle->Check(isTitleVisisble(mxModel, TitleHelper::MAIN_TITLE));
-    mpCBSubtitle->Check(isTitleVisisble(mxModel, TitleHelper::SUB_TITLE));
+
+    bool hasTitle = isTitleVisisble(mxModel, TitleHelper::MAIN_TITLE);
+    mpCBTitle->Check(hasTitle);
+    if (!mpEditTitle->HasFocus())
+    {
+        mpEditTitle->SetText(TitleHelper::getCompleteString(TitleHelper::getTitle(TitleHelper::MAIN_TITLE, mxModel)));
+        mpEditTitle->Enable(hasTitle);
+    }
+
+    bool hasSubtitle = isTitleVisisble(mxModel, TitleHelper::SUB_TITLE);
+    mpCBSubtitle->Check(hasSubtitle);
+    if (!mpEditSubtitle->HasFocus())
+    {
+        mpEditSubtitle->SetText(TitleHelper::getCompleteString(TitleHelper::getTitle(TitleHelper::SUB_TITLE, mxModel)));
+        mpEditSubtitle->Enable(hasSubtitle);
+    }
+
     mpCBXAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::X_AXIS_TITLE));
     mpCBYAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::Y_AXIS_TITLE));
     mpCBZAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::Z_AXIS_TITLE));
@@ -577,6 +600,18 @@ IMPL_LINK(ChartElementsPanel, CheckBoxHdl, Button*, pButton, void)
         setGridVisible(mxModel, GridType::HOR_MINOR, bChecked);
 }
 
+IMPL_LINK(ChartElementsPanel, EditHdl, Edit&, rEdit, void)
+{
+    // title or subtitle?
+    TitleHelper::eTitleType aTitleType = TitleHelper::MAIN_TITLE;
+    if (&rEdit == mpEditSubtitle.get())
+        aTitleType = TitleHelper::SUB_TITLE;
+
+    // set it
+    OUString aText(rEdit.GetText());
+    TitleHelper::setCompleteString(aText, TitleHelper::getTitle(aTitleType, mxModel), comphelper::getProcessComponentContext());
+}
+
 IMPL_LINK_NOARG(ChartElementsPanel, LegendPosHdl, ListBox&, void)
 {
     sal_Int32 nPos = mpLBLegendPosition->GetSelectedEntryPos();
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index eca293645cc4..dfb624b48362 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -22,6 +22,7 @@
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
 #include <sfx2/sidebar/SidebarModelUpdate.hxx>
 #include <svx/sidebar/PanelLayout.hxx>
+#include <vcl/edit.hxx>
 #include <vcl/layout.hxx>
 #include "ChartSidebarModifyListener.hxx"
 #include <TitleHelper.hxx>
@@ -71,7 +72,9 @@ public:
 private:
     //ui controls
     VclPtr<CheckBox> mpCBTitle;
+    VclPtr<Edit>     mpEditTitle;
     VclPtr<CheckBox> mpCBSubtitle;
+    VclPtr<Edit>     mpEditSubtitle;
     VclPtr<CheckBox> mpCBXAxis;
     VclPtr<CheckBox> mpCBXAxisTitle;
     VclPtr<CheckBox> mpCBYAxis;
@@ -110,6 +113,7 @@ private:
     void setTitleVisible(TitleHelper::eTitleType eTitle, bool bVisible);
 
     DECL_LINK(CheckBoxHdl, Button*, void);
+    DECL_LINK(EditHdl, Edit&, void);
     DECL_LINK(LegendPosHdl, ListBox&, void);
 };
 
diff --git a/chart2/uiconfig/ui/sidebarelements.ui b/chart2/uiconfig/ui/sidebarelements.ui
index 9db51b35a5d7..2b1f57ba2d5e 100644
--- a/chart2/uiconfig/ui/sidebarelements.ui
+++ b/chart2/uiconfig/ui/sidebarelements.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="GtkGrid" id="ChartElementsPanel">
@@ -16,6 +16,7 @@
           <object class="GtkFrame" id="frame1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
             <property name="label_xalign">0</property>
             <property name="shadow_type">none</property>
             <child>
@@ -31,33 +32,67 @@
                     <property name="row_spacing">6</property>
                     <property name="column_spacing">6</property>
                     <child>
-                      <object class="GtkCheckButton" id="checkbutton_subtitle">
-                        <property name="label" translatable="yes" context="sidebarelements|checkbutton_subtitle">Subtitle</property>
+                      <object class="GtkCheckButton" id="checkbutton_title">
+                        <property name="label" translatable="yes" context="sidebarelements|checkbutton_title">Title</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
+                        <accessibility>
+                          <relation type="label-for" target="edit_title"/>
+                        </accessibility>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
+                        <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="checkbutton_title">
-                        <property name="label" translatable="yes" context="sidebarelements|checkbutton_title">Title</property>
+                      <object class="GtkCheckButton" id="checkbutton_subtitle">
+                        <property name="label" translatable="yes" context="sidebarelements|checkbutton_subtitle">Subtitle</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
+                        <accessibility>
+                          <relation type="label-for" target="edit_subtitle"/>
+                        </accessibility>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
+                        <property name="top_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="edit_title">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <accessibility>
+                          <relation type="labelled-by" target="checkbutton_title"/>
+                        </accessibility>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="edit_subtitle">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <accessibility>
+                          <relation type="labelled-by" target="checkbutton_subtitle"/>
+                        </accessibility>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">3</property>
                       </packing>
                     </child>
                   </object>


More information about the Libreoffice-commits mailing list