[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - cui/source cui/uiconfig vcl/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Sun Dec 13 13:42:25 UTC 2020


 cui/source/options/fontsubs.cxx |   45 ++++++++++++++++------------------------
 cui/uiconfig/ui/optfontspage.ui |    6 +++--
 vcl/source/control/edit.cxx     |    7 +++++-
 3 files changed, 29 insertions(+), 29 deletions(-)

New commits:
commit c4fb3b2a36ae044906b79012a33ee43ec989778a
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sat Dec 12 20:47:37 2020 +0100
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Sun Dec 13 14:41:48 2020 +0100

    tdf#138857 fix font replacement table GUI
    
    - fix the get_text calls missed in tdf#136534, so combo box entry
      and table selection are synced again
    - unselect the table row, if the combo box entry doesn't match
      anymore the selected table row.
    - empty the combo box entries on multiple selection (allowd for
      mass delete only)
    - move the "apply replacement table" checkbox before the table
    - also change the comboboxes's sensitivity when toggling the
      "apply replacement table" checkbox.
    
    Change-Id: Ib509e46e3a468ece6ab20e6be41c04caec3265ae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107642
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit 579cf9548615e8535a0569a8eb4cdf325fbbbac7)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107621
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index b067aaf05f80..d94112822f65 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -227,7 +227,7 @@ void  SvxFontSubstTabPage::Reset( const SfxItemSet* )
     m_xCheckLB->set_sort_column(2);
     m_xCheckLB->set_sort_indicator(TRISTATE_TRUE, 2);
 
-    CheckEnable();
+    SelectHdl(m_xFont1CB.get());
 
     //fill font name box first
     m_xNonPropFontsOnlyCB->set_active(
@@ -271,7 +271,7 @@ namespace
     {
         for (int i = 0, nEntryCount = rTreeView.n_children(); i < nEntryCount; ++i)
         {
-            if (rTreeView.get_text(i, 3) == rCol)
+            if (rTreeView.get_text(i, 2) == rCol)
                 return i;
         }
         return -1;
@@ -282,7 +282,7 @@ namespace
         int nRow = findText(rTreeView, rCol1);
         if (nRow == -1)
             return false;
-        return rTreeView.get_text(nRow, 4) == rCol2;
+        return rTreeView.get_text(nRow, 3) == rCol2;
     }
 }
 
@@ -323,12 +323,18 @@ void SvxFontSubstTabPage::SelectHdl(const weld::Widget* pWin)
 
     if (pWin == m_xCheckLB.get())
     {
-        if (m_xCheckLB->count_selected_rows() == 1)
+        const int nSelectedRowCount = m_xCheckLB->count_selected_rows();
+        if (nSelectedRowCount == 1)
         {
             int nRow = m_xCheckLB->get_selected_index();
             m_xFont1CB->set_entry_text(m_xCheckLB->get_text(nRow, 2));
             m_xFont2CB->set_entry_text(m_xCheckLB->get_text(nRow, 3));
         }
+        else if (nSelectedRowCount > 1)
+        {
+            m_xFont1CB->set_entry_text(OUString());
+            m_xFont2CB->set_entry_text(OUString());
+        }
     }
 
     if (pWin == m_xFont1CB.get())
@@ -344,6 +350,8 @@ void SvxFontSubstTabPage::SelectHdl(const weld::Widget* pWin)
                 m_xCheckLB->select(nPos);
             }
         }
+        else
+            m_xCheckLB->unselect_all();
     }
 
     CheckEnable();
@@ -370,13 +378,15 @@ void SvxFontSubstTabPage::CheckEnable()
 {
     bool bEnableAll = m_xUseTableCB->get_active();
     m_xCheckLB->set_sensitive(bEnableAll);
+    m_xFont1CB->set_sensitive(bEnableAll);
+    m_xFont2CB->set_sensitive(bEnableAll);
+
+    bool bApply = bEnableAll, bDelete = bEnableAll;
+
     if (bEnableAll)
     {
-        bool bApply, bDelete;
-
         int nEntry = m_xCheckLB->get_selected_index();
 
-        // because of OS/2 optimization error (Bug #56267) a bit more intricate:
         if (m_xFont1CB->get_active_text().isEmpty() || m_xFont2CB->get_active_text().isEmpty())
             bApply = false;
         else if (m_xFont1CB->get_active_text() == m_xFont2CB->get_active_text())
@@ -389,27 +399,10 @@ void SvxFontSubstTabPage::CheckEnable()
             bApply = true;
 
         bDelete = nEntry != -1;
-
-        m_xApply->set_sensitive(bApply);
-        m_xDelete->set_sensitive(bDelete);
     }
 
-    if (bEnableAll)
-    {
-        if (!m_xCheckLB->get_sensitive())
-        {
-            m_xCheckLB->set_sensitive(true);
-            SelectHdl(m_xFont1CB.get());
-        }
-    }
-    else
-    {
-        if (m_xCheckLB->get_sensitive())
-        {
-            m_xCheckLB->set_sensitive(false);
-            m_xCheckLB->unselect_all();
-        }
-    }
+    m_xApply->set_sensitive(bApply);
+    m_xDelete->set_sensitive(bDelete);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/uiconfig/ui/optfontspage.ui b/cui/uiconfig/ui/optfontspage.ui
index 854ac5055ae7..4f716f6b584d 100644
--- a/cui/uiconfig/ui/optfontspage.ui
+++ b/cui/uiconfig/ui/optfontspage.ui
@@ -258,6 +258,7 @@
                     </child>
                     <child>
                       <object class="GtkComboBoxText" id="font2">
+                        <property name="sensitive">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
@@ -281,6 +282,7 @@
                     </child>
                     <child>
                       <object class="GtkComboBoxText" id="font1">
+                        <property name="sensitive">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
@@ -311,7 +313,7 @@
                   <packing>
                     <property name="expand">True</property>
                     <property name="fill">True</property>
-                    <property name="position">0</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
                 <child>
@@ -332,7 +334,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">1</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
               </object>
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 0484797de298..9a8d8b5990f1 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2576,7 +2576,12 @@ OUString Edit::GetText() const
     if ( mpSubEdit )
         return mpSubEdit->GetText();
     else
-        return maText.toString();
+    {
+        if (!maText.isEmpty())
+            return maText.toString();
+        else
+            return OUString();
+    }
 }
 
 void Edit::SetCursorAtLast(){


More information about the Libreoffice-commits mailing list