sc/source/ui/formdlg/dwfunctr.cxx     |   12 -
 sc/source/ui/inc/dwfunctr.hxx         |    2 
 sc/uiconfig/scalc/ui/functionpanel.ui |  232 +++++++++++++++-------------------
 3 files changed, 111 insertions(+), 135 deletions(-)

New commits:
commit 7fc96ad09520abea4833ed7410fd3a2d1b63d7b1
Author:     Rafael Lima <rafael.palma.l...@gmail.com>
AuthorDate: Mon Sep 26 00:46:00 2022 +0200
Commit:     Rafael Lima <rafael.palma.l...@gmail.com>
CommitDate: Thu Oct 13 22:32:04 2022 +0200

    tdf#150473 Wrap text and set min size for Function description
    
    This patch does the following changes to the Functions sidebar in Calc:
    
    1) The function description now uses a TextView instead of a Label so that 
the text can now wrap. This is important because many descriptions are long and 
require more than a single line of text.
    
    2) The minimum size of the description TextView is set to 6 lines of text. 
Because there's no easy way to set this minimum size (since it is inside a 
Slider control), then the following rule was applied.
    - If the user resizes the slider to less than 6 rows (in this case, moves 
it down), the next time a new function is clicked the slider is positioned so 
that 6 lines of text become visible.
    - Moving the slider up, thus giving more space to the description view is 
still allowed as prior to this patch.
    
    Change-Id: I52dfa8bef52b645fdce379408e6b790f6e8e5dea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140507
    Tested-by: Jenkins
    Tested-by: Heiko Tietze <heiko.tie...@documentfoundation.org>
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>

diff --git a/sc/source/ui/formdlg/dwfunctr.cxx 
b/sc/source/ui/formdlg/dwfunctr.cxx
index 424c0ee99ca8..438f8fb70e24 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -49,17 +49,17 @@ ScFunctionWin::ScFunctionWin(weld::Widget* pParent)
     , xCatBox(m_xBuilder->weld_combo_box("category"))
     , xFuncList(m_xBuilder->weld_tree_view("funclist"))
     , xInsertButton(m_xBuilder->weld_button("insert"))
-    , xFiFuncDesc(m_xBuilder->weld_label("funcdesc"))
+    , xFiFuncDesc(m_xBuilder->weld_text_view("funcdesc"))
     , xConfigListener(new 
comphelper::ConfigurationListener("/org.openoffice.Office.Calc/Formula/Syntax"))
     , 
xConfigChange(std::make_unique<EnglishFunctionNameChange>(xConfigListener, 
this))
     , pFuncDesc(nullptr)
 {
-    xFuncList->set_size_request(-1, xFuncList->get_height_rows(10));
-
     InitLRUList();
 
     nArgs=0;
-    xFiFuncDesc->set_size_request(-1, 5 * xFiFuncDesc->get_text_height());
+
+    // Description box has a height of 8 lines of text
+    xFiFuncDesc->set_size_request(-1, 8 * xFiFuncDesc->get_text_height());
 
     xCatBox->connect_changed(LINK( this, ScFunctionWin, SelComboHdl));
     xFuncList->connect_changed(LINK( this, ScFunctionWin, SelTreeHdl));
@@ -162,7 +162,7 @@ void ScFunctionWin::UpdateLRUList()
 
 void ScFunctionWin::SetDescription()
 {
-    xFiFuncDesc->set_label(OUString());
+    xFiFuncDesc->set_text(OUString());
     const ScFuncDesc* pDesc =
              weld::fromId<const ScFuncDesc*>(xFuncList->get_selected_id());
     if (pDesc)
@@ -175,7 +175,7 @@ void ScFunctionWin::SetDescription()
             "\n\n" +
             *pDesc->mxFuncDesc;
 
-        xFiFuncDesc->set_label(aBuf);
+        xFiFuncDesc->set_text(aBuf);
     }
 }
 
diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx
index eda067e0b93a..9b984b918e11 100644
--- a/sc/source/ui/inc/dwfunctr.hxx
+++ b/sc/source/ui/inc/dwfunctr.hxx
@@ -46,7 +46,7 @@ private:
     std::unique_ptr<weld::ComboBox> xCatBox;
     std::unique_ptr<weld::TreeView> xFuncList;
     std::unique_ptr<weld::Button> xInsertButton;
-    std::unique_ptr<weld::Label> xFiFuncDesc;
+    std::unique_ptr<weld::TextView> xFiFuncDesc;
 
     rtl::Reference<comphelper::ConfigurationListener> xConfigListener;
     std::unique_ptr<EnglishFunctionNameChange> xConfigChange;
diff --git a/sc/uiconfig/scalc/ui/functionpanel.ui 
b/sc/uiconfig/scalc/ui/functionpanel.ui
index 7959ffebf870..380bf7b6b651 100644
--- a/sc/uiconfig/scalc/ui/functionpanel.ui
+++ b/sc/uiconfig/scalc/ui/functionpanel.ui
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.36.0 -->
+<!-- Generated with glade 3.40.0 -->
 <interface domain="sc">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkImage" id="image1">
     <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="icon_name">sc/res/fx.png</property>
+    <property name="can-focus">False</property>
+    <property name="icon-name">sc/res/fx.png</property>
   </object>
   <object class="GtkTreeStore" id="liststore1">
     <columns>
@@ -18,184 +18,160 @@
   <!-- n-columns=1 n-rows=1 -->
   <object class="GtkGrid" id="FunctionPanel">
     <property name="visible">True</property>
-    <property name="can_focus">False</property>
+    <property name="can-focus">False</property>
     <property name="hexpand">True</property>
     <property name="vexpand">True</property>
-    <property name="border_width">6</property>
     <child>
-      <!-- n-columns=1 n-rows=1 -->
+      <!-- n-columns=1 n-rows=2 -->
       <object class="GtkGrid">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
+        <property name="can-focus">False</property>
         <property name="hexpand">True</property>
         <property name="vexpand">True</property>
-        <property name="border_width">6</property>
-        <property name="row_spacing">6</property>
+        <property name="border-width">6</property>
+        <property name="row-spacing">6</property>
         <child>
-          <object class="GtkPaned" id="splitter">
+          <!-- n-columns=1 n-rows=2 -->
+          <object class="GtkGrid">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
+            <property name="can-focus">False</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
-            <property name="orientation">vertical</property>
-            <property name="wide_handle">True</property>
+            <property name="row-spacing">6</property>
             <child>
-              <!-- n-columns=1 n-rows=1 -->
+              <!-- n-columns=2 n-rows=1 -->
               <object class="GtkGrid">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="hexpand">True</property>
-                <property name="vexpand">True</property>
-                <property name="row_spacing">6</property>
+                <property name="column-spacing">12</property>
                 <child>
-                  <!-- n-columns=1 n-rows=1 -->
-                  <object class="GtkGrid">
+                  <object class="GtkButton" id="insert">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="column_spacing">12</property>
-                    <child>
-                      <object class="GtkButton" id="insert">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="can_default">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="tooltip_text" translatable="yes" 
context="functionpanel|insert|tooltip_text">Insert Function into calculation 
sheet</property>
-                        <property name="image">image1</property>
-                        <property name="always-show-image">True</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkComboBoxText" id="category">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
-                        <items>
-                          <item translatable="yes" 
context="functionpanel|category">Last Used</item>
-                          <item translatable="yes" 
context="functionpanel|category">All</item>
-                          <item translatable="yes" 
context="functionpanel|category">Database</item>
-                          <item translatable="yes" 
context="functionpanel|category">Date&amp;Time</item>
-                          <item translatable="yes" 
context="functionpanel|category">Financial</item>
-                          <item translatable="yes" 
context="functionpanel|category">Information</item>
-                          <item translatable="yes" 
context="functionpanel|category">Logical</item>
-                          <item translatable="yes" 
context="functionpanel|category">Mathematical</item>
-                          <item translatable="yes" 
context="functionpanel|category">Array</item>
-                          <item translatable="yes" 
context="functionpanel|category">Statistical</item>
-                          <item translatable="yes" 
context="functionpanel|category">Spreadsheet</item>
-                          <item translatable="yes" 
context="functionpanel|category">Text</item>
-                          <item translatable="yes" 
context="functionpanel|category">Add-in</item>
-                        </items>
-                        <child internal-child="accessible">
-                          <object class="AtkObject" id="category-atkobject">
-                            <property name="AtkObject::accessible-description" 
translatable="yes" context="functionpanel|extended_tip|category">Displays the 
available functions.</property>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
+                    <property name="can-focus">True</property>
+                    <property name="can-default">True</property>
+                    <property name="receives-default">True</property>
+                    <property name="tooltip-text" translatable="yes" 
context="functionpanel|insert|tooltip_text">Insert Function into calculation 
sheet</property>
+                    <property name="image">image1</property>
+                    <property name="always-show-image">True</property>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkScrolledWindow">
+                  <object class="GtkComboBoxText" id="category">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
+                    <property name="can-focus">False</property>
                     <property name="hexpand">True</property>
-                    <property name="vexpand">True</property>
-                    <property name="shadow_type">in</property>
-                    <child>
-                      <object class="GtkTreeView" id="funclist">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="vexpand">True</property>
-                        <property name="model">liststore1</property>
-                        <property name="headers_visible">False</property>
-                        <property name="headers_clickable">False</property>
-                        <property name="search_column">0</property>
-                        <property name="show_expanders">False</property>
-                        <child internal-child="selection">
-                          <object class="GtkTreeSelection" 
id="treeview-selection1"/>
-                        </child>
-                        <child>
-                          <object class="GtkTreeViewColumn" 
id="treeviewcolumn1">
-                            <child>
-                              <object class="GtkCellRendererText" 
id="cellrenderertext1"/>
-                              <attributes>
-                                <attribute name="text">0</attribute>
-                              </attributes>
-                            </child>
-                          </object>
-                        </child>
-                        <child internal-child="accessible">
-                          <object class="AtkObject" id="funclist-atkobject">
-                            <property name="AtkObject::accessible-description" 
translatable="yes" context="functionpanel|extended_tip|funclist">Displays the 
available functions.</property>
-                          </object>
-                        </child>
+                    <items>
+                      <item translatable="yes" 
context="functionpanel|category">Last Used</item>
+                      <item translatable="yes" 
context="functionpanel|category">All</item>
+                      <item translatable="yes" 
context="functionpanel|category">Database</item>
+                      <item translatable="yes" 
context="functionpanel|category">Date&amp;Time</item>
+                      <item translatable="yes" 
context="functionpanel|category">Financial</item>
+                      <item translatable="yes" 
context="functionpanel|category">Information</item>
+                      <item translatable="yes" 
context="functionpanel|category">Logical</item>
+                      <item translatable="yes" 
context="functionpanel|category">Mathematical</item>
+                      <item translatable="yes" 
context="functionpanel|category">Array</item>
+                      <item translatable="yes" 
context="functionpanel|category">Statistical</item>
+                      <item translatable="yes" 
context="functionpanel|category">Spreadsheet</item>
+                      <item translatable="yes" 
context="functionpanel|category">Text</item>
+                      <item translatable="yes" 
context="functionpanel|category">Add-in</item>
+                    </items>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="category-atkobject">
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="functionpanel|extended_tip|category">Displays the 
available functions.</property>
                       </object>
                     </child>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">1</property>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">0</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="resize">True</property>
-                <property name="shrink">True</property>
+                <property name="left-attach">0</property>
+                <property name="top-attach">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkScrolledWindow" id="funcscroll">
+              <object class="GtkScrolledWindow">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hscrollbar_policy">never</property>
-                <property name="vscrollbar_policy">never</property>
-                <property name="shadow_type">in</property>
+                <property name="can-focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="shadow-type">in</property>
                 <child>
-                  <object class="GtkViewport">
+                  <object class="GtkTreeView" id="funclist">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="model">liststore1</property>
+                    <property name="headers-visible">False</property>
+                    <property name="headers-clickable">False</property>
+                    <property name="search-column">0</property>
+                    <property name="show-expanders">False</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection"/>
+                    </child>
                     <child>
-                      <object class="GtkLabel" id="funcdesc">
-                        <property name="name">funcdesc</property>
-                        <property name="width_request">0</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes" 
context="functionpanel|funcdesc">label</property>
-                        <property name="wrap">True</property>
-                        <property name="xalign">0</property>
-                        <property name="yalign">0</property>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                        <child>
+                          <object class="GtkCellRendererText" 
id="cellrenderertext1"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="funclist-atkobject">
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="functionpanel|extended_tip|funclist">Displays the 
available functions.</property>
                       </object>
                     </child>
                   </object>
                 </child>
               </object>
               <packing>
-                <property name="resize">False</property>
-                <property name="shrink">True</property>
+                <property name="left-attach">0</property>
+                <property name="top-attach">1</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
+            <property name="left-attach">0</property>
+            <property name="top-attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkScrolledWindow" id="funcscroll">
+            <property name="visible">True</property>
+            <property name="can-focus">True</property>
+            <property name="valign">end</property>
+            <property name="shadow-type">in</property>
+            <child>
+              <object class="GtkTextView" id="funcdesc">
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="editable">False</property>
+                <property name="wrap-mode">word-char</property>
+                <property name="cursor-visible">False</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="left-attach">0</property>
+            <property name="top-attach">1</property>
           </packing>
         </child>
       </object>
       <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
+        <property name="left-attach">0</property>
+        <property name="top-attach">0</property>
       </packing>
     </child>
   </object>

Reply via email to