[Libreoffice-commits] core.git: sfx2/source

Szymon Kłos eszkadev at gmail.com
Tue Mar 7 12:07:31 UTC 2017


 sfx2/source/notebookbar/DropdownBox.cxx |   34 ++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

New commits:
commit b57d06315175c7aabfde6c02ee4f122cfbef10e8
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Tue Mar 7 12:19:02 2017 +0100

    Notebookbar: don't show unnecessary separators in the popup
    
    Change-Id: I89d11e2859676696e7bc0751ae9e71e5ae939a79
    Reviewed-on: https://gerrit.libreoffice.org/34945
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <eszkadev at gmail.com>

diff --git a/sfx2/source/notebookbar/DropdownBox.cxx b/sfx2/source/notebookbar/DropdownBox.cxx
index 705103a..97d63a7 100644
--- a/sfx2/source/notebookbar/DropdownBox.cxx
+++ b/sfx2/source/notebookbar/DropdownBox.cxx
@@ -57,6 +57,7 @@ public:
 
     virtual void PopupModeEnd() override
     {
+        hideSeparators(false);
         for (int i = 0; i < m_pBox->GetChildCount(); i++)
         {
             m_pBox->GetChild(i)->Hide();
@@ -65,6 +66,37 @@ public:
         FloatingWindow::PopupModeEnd();
     }
 
+    void hideSeparators(bool bHide = true)
+    {
+        // separator on the beginning
+        Window* pWindow = m_pBox->GetChild(0);
+        while (pWindow && pWindow->GetType() == WindowType::CONTAINER)
+        {
+            pWindow = pWindow->GetChild(0);
+        }
+        if (pWindow && pWindow->GetType() == WindowType::FIXEDLINE)
+        {
+            if (bHide)
+                pWindow->Hide();
+            else
+                pWindow->Show();
+        }
+
+        // separator on the end
+        pWindow = m_pBox->GetChild(m_pBox->GetChildCount() - 1);
+        while (pWindow && pWindow->GetType() == WindowType::CONTAINER)
+        {
+            pWindow = pWindow->GetChild(pWindow->GetChildCount() - 1);
+        }
+        if (pWindow && pWindow->GetType() == WindowType::FIXEDLINE)
+        {
+            if (bHide)
+                pWindow->Hide();
+            else
+                pWindow->Show();
+        }
+    }
+
     void dispose() override
     {
         m_pBox.disposeAndClear();
@@ -150,6 +182,8 @@ IMPL_LINK(DropdownBox, PBClickHdl, Button*, /*pButton*/, void)
         }
     }
 
+    m_pPopup->hideSeparators(true);
+
     m_pPopup->getBox()->set_height_request(GetSizePixel().Height());
 
     long x = GetPosPixel().getX();


More information about the Libreoffice-commits mailing list