[Libreoffice-commits] core.git: cui/source include/vcl sc/IwyuFilter_sc.yaml sc/source vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 28 20:02:18 UTC 2020


 cui/source/options/treeopt.cxx |   10 +++-------
 include/vcl/weldutils.hxx      |    3 +++
 sc/IwyuFilter_sc.yaml          |    1 -
 sc/source/ui/app/inputwin.cxx  |    8 ++++----
 vcl/source/app/weldutils.cxx   |    9 +++++++++
 5 files changed, 19 insertions(+), 12 deletions(-)

New commits:
commit e08b4144d9d0f0b05ef0f1c51c111d5a56e616a5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Aug 28 16:36:00 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Aug 28 22:01:29 2020 +0200

    move GetMinimumEditHeight calc to weldutils and reuse in calc
    
    Change-Id: I3980bbaf269260243c8fcd8fe95cc03deac144ee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101558
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 55447259e940..f96f0ceefab3 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -100,6 +100,7 @@
 #include <unotools/viewoptions.hxx>
 #include <vcl/help.hxx>
 #include <vcl/svapp.hxx>
+#include <vcl/weldutils.hxx>
 #include <vcl/window.hxx>
 #include <sal/log.hxx>
 
@@ -483,13 +484,8 @@ void OfaTreeOptionsDialog::InitWidgets()
     xTabBox = m_xBuilder->weld_container("box");
     Size aSize(xTreeLB->get_approximate_digit_width() * 82, xTreeLB->get_height_rows(30));
 #if HAVE_FEATURE_GPGME
-    {
-        // load this little .ui just to measure the height of an Entry
-        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xDialog.get(), "cui/ui/namedialog.ui"));
-        std::unique_ptr<weld::Entry> xEntry(xBuilder->weld_entry("name_entry"));
-        // tdf#115015: make enough space for crypto settings (approx. 14 text edits + padding)
-        aSize.setHeight((xEntry->get_preferred_size().Height() + 6) * 14);
-    }
+    // tdf#115015: make enough space for crypto settings (approx. 14 text edits + padding)
+    aSize.setHeight((weld::GetMinimumEditHeight() + 6) * 14);
 #endif
     xTabBox->set_size_request(aSize.Width(), aSize.Height());
     xTreeLB->set_size_request(xTreeLB->get_approximate_digit_width() * 30, aSize.Height());
diff --git a/include/vcl/weldutils.hxx b/include/vcl/weldutils.hxx
index 8a57ecead9b8..7eb4334e0156 100644
--- a/include/vcl/weldutils.hxx
+++ b/include/vcl/weldutils.hxx
@@ -364,6 +364,9 @@ VCL_DLLPUBLIC bool IsEntryVisible(const weld::TreeView& rTreeView, const weld::T
 
 // A Parent's Children are turned into Children of the Parent which comes next in hierarchy
 VCL_DLLPUBLIC void RemoveParentKeepChildren(weld::TreeView& rTreeView, weld::TreeIter& rParent);
+
+// return the min height of a weld::Entry
+VCL_DLLPUBLIC int GetMinimumEditHeight();
 }
 
 #endif
diff --git a/sc/IwyuFilter_sc.yaml b/sc/IwyuFilter_sc.yaml
index fe1d0457229e..3510a5f15b57 100644
--- a/sc/IwyuFilter_sc.yaml
+++ b/sc/IwyuFilter_sc.yaml
@@ -446,7 +446,6 @@ excludelist:
     sc/source/ui/inc/colorformat.hxx:
     # Needed for VclPtr type
     - svx/colorbox.hxx
-    - vcl/edit.hxx
     sc/source/ui/inc/condformatdlg.hxx:
     # Needed for typedef
     - condformatdlgentry.hxx
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 299f79e1a9b9..04c8f8769c53 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -39,11 +39,11 @@
 #include <editeng/scriptspaceitem.hxx>
 #include <vcl/commandevent.hxx>
 #include <vcl/cursor.hxx>
-#include <vcl/edit.hxx>
 #include <vcl/help.hxx>
 #include <vcl/settings.hxx>
 #include <svl/stritem.hxx>
 #include <vcl/svapp.hxx>
+#include <vcl/weldutils.hxx>
 #include <unotools/charclass.hxx>
 
 #include <inputwin.hxx>
@@ -1585,9 +1585,9 @@ ScTextWnd::ScTextWnd(ScTextWndGroup* pParent, ScTabViewShell* pViewSh)
     aTextFont.SetWeight(WEIGHT_NORMAL);
 
     Size aSize(1, GetPixelHeightForLines(1));
-    Size aMinEditSize(Edit::GetMinimumEditSize());
-    if(aMinEditSize.Height() > aSize.Height())
-        aSize.setHeight(aMinEditSize.Height());
+    auto nMinEditHeight = weld::GetMinimumEditHeight();
+    if (nMinEditHeight > aSize.Height())
+        aSize.setHeight(nMinEditHeight);
 
     SetSizePixel(aSize);
     SetBackground(aBgColor);
diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx
index 8b5532fccc8b..ee074df63d93 100644
--- a/vcl/source/app/weldutils.cxx
+++ b/vcl/source/app/weldutils.cxx
@@ -479,6 +479,15 @@ PatternFormatter::~PatternFormatter()
     m_rEntry.connect_changed(Link<weld::Entry&, void>());
     m_rEntry.connect_focus_out(Link<weld::Widget&, void>());
 }
+
+int GetMinimumEditHeight()
+{
+    // load this little .ui just to measure the height of an Entry
+    std::unique_ptr<weld::Builder> xBuilder(
+        Application::CreateBuilder(nullptr, "cui/ui/namedialog.ui"));
+    std::unique_ptr<weld::Entry> xEntry(xBuilder->weld_entry("name_entry"));
+    return xEntry->get_preferred_size().Height();
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list