[Libreoffice-commits] core.git: include/svx svx/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 4 08:33:02 UTC 2019


 include/svx/ClassificationDialog.hxx       |    2 ++
 svx/source/dialog/ClassificationDialog.cxx |   17 ++++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit c371d8ba8960e7830027d4d8d9155bab94722952
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Apr 3 21:25:13 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Apr 4 10:32:32 2019 +0200

    expand async to allow it to resize to optimal size
    
    Change-Id: I87c413108a41f994c0e8d86f469fc361d4cd42e5
    Reviewed-on: https://gerrit.libreoffice.org/70220
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svx/ClassificationDialog.hxx b/include/svx/ClassificationDialog.hxx
index 2aaed9d16fca..0c083d794d41 100644
--- a/include/svx/ClassificationDialog.hxx
+++ b/include/svx/ClassificationDialog.hxx
@@ -30,6 +30,7 @@ private:
     const bool m_bPerParagraph;
     const std::function<void()> m_aParagraphSignHandler;
 
+    ImplSVEvent* m_nAsyncExpandEvent;
     sal_Int32 m_nCurrentSelectedCategory;
 
     std::vector<std::vector<ClassificationResult>> m_aRecentlyUsedValuesCollection;
@@ -61,6 +62,7 @@ private:
     DECL_LINK(EditWindowModifiedHdl, LinkParamNone*, void);
     DECL_STATIC_LINK(ClassificationDialog, ExpandedHdl, weld::Expander&, void);
     DECL_STATIC_LINK(ClassificationDialog, KeyInput, const KeyEvent&, bool);
+    DECL_LINK(OnAsyncExpandHdl, void*, void);
 
     void insertField(ClassificationType eType, OUString const & rString, OUString const & rFullString, OUString const & rIdentifier = OUString());
     void insertCategoryField(sal_Int32 nID);
diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx
index d83a6b044a54..9cde1e8c7249 100644
--- a/svx/source/dialog/ClassificationDialog.cxx
+++ b/svx/source/dialog/ClassificationDialog.cxx
@@ -23,8 +23,8 @@
 #include <config_folders.h>
 #include <tools/XmlWriter.hxx>
 #include <tools/XmlWalker.hxx>
-#include <vcl/builderfactory.hxx>
 #include <vcl/event.hxx>
+#include <vcl/svapp.hxx>
 #include <sfx2/objsh.hxx>
 
 #include <officecfg/Office/Common.hxx>
@@ -232,15 +232,26 @@ ClassificationDialog::ClassificationDialog(weld::Window* pParent, const bool bPe
     m_xRecentlyUsedListBox->set_size_request(m_xRecentlyUsedListBox->get_approximate_digit_width() * 5, -1);
     m_xRecentlyUsedListBox->connect_changed(LINK(this, ClassificationDialog, SelectRecentlyUsedHdl));
 
-    bool bExpand = officecfg::Office::Common::Classification::IntellectualPropertySectionExpanded::get();
-    m_xIntellectualPropertyExpander->set_expanded(bExpand);
     m_xIntellectualPropertyExpander->connect_expanded(LINK(this, ClassificationDialog, ExpandedHdl));
+    if (officecfg::Office::Common::Classification::IntellectualPropertySectionExpanded::get())
+        m_nAsyncExpandEvent = Application::PostUserEvent(LINK(this, ClassificationDialog, OnAsyncExpandHdl));
+    else
+        m_nAsyncExpandEvent = nullptr;
 
     m_xEditWindow->SetModifyHdl(LINK(this, ClassificationDialog, EditWindowModifiedHdl));
 }
 
+//do it async so gtk has a chance to shrink it to best size, otherwise its larger than min
+IMPL_LINK_NOARG(ClassificationDialog, OnAsyncExpandHdl, void*, void)
+{
+    m_nAsyncExpandEvent = nullptr;
+    m_xIntellectualPropertyExpander->set_expanded(true);
+}
+
 ClassificationDialog::~ClassificationDialog()
 {
+    if (m_nAsyncExpandEvent)
+        Application::RemoveUserEvent(m_nAsyncExpandEvent);
 }
 
 short ClassificationDialog::run()


More information about the Libreoffice-commits mailing list