[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - cui/source

Seth Chaiklin (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 28 21:24:01 UTC 2020


 cui/source/inc/numpages.hxx      |    3 +++
 cui/source/tabpages/numpages.cxx |   29 ++++++++++++++++++++++++-----
 2 files changed, 27 insertions(+), 5 deletions(-)

New commits:
commit e65aeb1c9fdc84e6b0645bea067cdbe2de28a052
Author:     Seth Chaiklin <sdc.blanco at youmail.dk>
AuthorDate: Tue Jan 21 16:38:25 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 28 22:23:37 2020 +0100

    tdf#127112 repair "sticky" levels in Customize numbering style dialog
    
    Change-Id: Ifa841e7b63b28d6e0f84f5cd6b1800481b36425b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87646
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 6582a81fc873..008d1a575221 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -223,6 +223,8 @@ class SvxNumOptionsTabPage : public SfxTabPage
 
     Size                aInitSize[SVX_MAX_NUM];
 
+    ImplSVEvent*        m_pLevelHdlEvent;
+
     bool                bLastWidthModified  : 1;
     bool                bModified           : 1;
     bool                bPreset             : 1;
@@ -282,6 +284,7 @@ class SvxNumOptionsTabPage : public SfxTabPage
 
     DECL_LINK(NumberTypeSelectHdl_Impl, weld::ComboBox&, void);
     DECL_LINK(LevelHdl_Impl, weld::TreeView&, void);
+    DECL_LINK(LevelHdl, void *, void);
     DECL_LINK(PopupActivateHdl_Impl, weld::ToggleButton&, void);
     DECL_LINK(GraphicHdl_Impl, const OString&, void);
     DECL_LINK(BulletHdl_Impl, weld::Button&, void);
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index d7985b5ef5a6..61a1664b728d 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1050,6 +1050,7 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, voi
 SvxNumOptionsTabPage::SvxNumOptionsTabPage(TabPageParent pParent,
                                const SfxItemSet& rSet)
     : SfxTabPage(pParent, "cui/ui/numberingoptionspage.ui", "NumberingOptionsPage", &rSet)
+    , m_pLevelHdlEvent(nullptr)
     , bLastWidthModified(false)
     , bModified(false)
     , bPreset(false)
@@ -1151,6 +1152,11 @@ void SvxNumOptionsTabPage::dispose()
     m_xBulColLB.reset();
     pActNum.reset();
     pSaveNum.reset();
+    if (m_pLevelHdlEvent)
+    {
+        Application::RemoveUserEvent(m_pLevelHdlEvent);
+        m_pLevelHdlEvent = nullptr;
+    }
     SfxTabPage::dispose();
 }
 
@@ -1194,6 +1200,7 @@ void    SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet)
     {
         nActNumLvl = nTmpNumLvl;
         sal_uInt16 nMask = 1;
+        m_xLevelLB->unselect_all();
         if (nActNumLvl == SAL_MAX_UINT16)
             m_xLevelLB->select(pActNum->GetLevelCount());
         if(nActNumLvl != SAL_MAX_UINT16)
@@ -1589,17 +1596,29 @@ void SvxNumOptionsTabPage::SwitchNumberType( sal_uInt8 nType )
     m_xOrientLB->set_sensitive(bEnableBitmap);
 }
 
-IMPL_LINK(SvxNumOptionsTabPage, LevelHdl_Impl, weld::TreeView&, rBox, void)
+IMPL_LINK_NOARG(SvxNumOptionsTabPage, LevelHdl_Impl, weld::TreeView&, void)
 {
+    if (m_pLevelHdlEvent)
+        return;
+    // tdf#127112 (borrowing tdf#127120 solution) multiselection may be implemented by deselect follow by select so
+    // fire off the handler to happen on next event loop and only process the
+    // final state
+    m_pLevelHdlEvent = Application::PostUserEvent(LINK(this, SvxNumOptionsTabPage, LevelHdl));
+}
+
+IMPL_LINK_NOARG(SvxNumOptionsTabPage, LevelHdl, void*, void)
+{
+    m_pLevelHdlEvent = nullptr;
+
     sal_uInt16 nSaveNumLvl = nActNumLvl;
     nActNumLvl = 0;
-    auto aSelectedRows = rBox.get_selected_rows();
+    std::vector<int> aSelectedRows = m_xLevelLB->get_selected_rows();
     if (std::find(aSelectedRows.begin(), aSelectedRows.end(), pActNum->GetLevelCount()) != aSelectedRows.end() &&
         (aSelectedRows.size() == 1 || nSaveNumLvl != 0xffff))
     {
         nActNumLvl = 0xFFFF;
         for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
-            rBox.unselect(i);
+             m_xLevelLB->unselect(i);
     }
     else if (!aSelectedRows.empty())
     {
@@ -1610,7 +1629,7 @@ IMPL_LINK(SvxNumOptionsTabPage, LevelHdl_Impl, weld::TreeView&, rBox, void)
                 nActNumLvl |= nMask;
             nMask <<= 1;
         }
-        rBox.unselect(pActNum->GetLevelCount());
+        m_xLevelLB->unselect(pActNum->GetLevelCount());
     }
     else
     {
@@ -1620,7 +1639,7 @@ IMPL_LINK(SvxNumOptionsTabPage, LevelHdl_Impl, weld::TreeView&, rBox, void)
         {
             if(nActNumLvl & nMask)
             {
-                rBox.select(i);
+                m_xLevelLB->select(i);
                 break;
             }
             nMask <<=1;


More information about the Libreoffice-commits mailing list