include/vcl/IPrioritable.hxx             |    7 +++++++
 include/vcl/layout.hxx                   |    2 --
 sfx2/source/notebookbar/DropdownBox.cxx  |    1 +
 sfx2/source/notebookbar/DropdownBox.hxx  |    8 +++++---
 sfx2/source/notebookbar/PriorityHBox.cxx |   17 ++++++++---------
 vcl/source/window/layout.cxx             |    2 --
 6 files changed, 21 insertions(+), 16 deletions(-)

New commits:
commit 76fbd18a515e531f1d238ab0b405212a032c53f2
Author: Szymon Kłos <eszka...@gmail.com>
Date:   Mon Apr 10 19:29:59 2017 +0200

    Notebookbar: remove dependency between all containers and IPrioritable
    
    Change-Id: I92bff0d68470763c88172744e82d9b5915ffb6f1
    Reviewed-on: https://gerrit.libreoffice.org/36387
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/include/vcl/IPrioritable.hxx b/include/vcl/IPrioritable.hxx
index 11146681ee65..dda8bbd31fa8 100644
--- a/include/vcl/IPrioritable.hxx
+++ b/include/vcl/IPrioritable.hxx
@@ -23,6 +23,10 @@ protected:
     }
 
 public:
+    virtual ~IPrioritable()
+    {
+    }
+
     int GetPriority() const
     {
         return m_nPriority;
@@ -33,6 +37,9 @@ public:
         m_nPriority = nPriority;
     }
 
+    virtual void HideContent() = 0;
+    virtual void ShowContent() = 0;
+
 private:
     int m_nPriority;
 };
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index f401fcda888c..28c6464c0257 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -14,7 +14,6 @@
 #include <vcl/button.hxx>
 #include <vcl/dialog.hxx>
 #include <vcl/fixed.hxx>
-#include <vcl/IPrioritable.hxx>
 #include <vcl/scrbar.hxx>
 #include <vcl/split.hxx>
 #include <vcl/vclmedit.hxx>
@@ -24,7 +23,6 @@
 #include <set>
 
 class VCL_DLLPUBLIC VclContainer : public vcl::Window,
-                                   public vcl::IPrioritable,
                                    public vcl::IContext
 {
 public:
diff --git a/sfx2/source/notebookbar/DropdownBox.cxx 
b/sfx2/source/notebookbar/DropdownBox.cxx
index 63aba3f33f70..981a220b0959 100644
--- a/sfx2/source/notebookbar/DropdownBox.cxx
+++ b/sfx2/source/notebookbar/DropdownBox.cxx
@@ -113,6 +113,7 @@ public:
 
 DropdownBox::DropdownBox(vcl::Window *pParent)
     : VclHBox(pParent)
+    , IPrioritable()
     , m_bInFullView(true)
 {
     m_pButton = VclPtr<PushButton>::Create(this, WB_FLATBUTTON);
diff --git a/sfx2/source/notebookbar/DropdownBox.hxx 
b/sfx2/source/notebookbar/DropdownBox.hxx
index cabd38f5183b..6a34ae6d7705 100644
--- a/sfx2/source/notebookbar/DropdownBox.hxx
+++ b/sfx2/source/notebookbar/DropdownBox.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SFX2_NOTEBOOKBAR_DROPDOWNBOX_HXX
 
 #include <vcl/builderfactory.hxx>
+#include <vcl/IPrioritable.hxx>
 #include <vcl/layout.hxx>
 #include <sfx2/dllapi.h>
 #include <sfx2/viewfrm.hxx>
@@ -30,7 +31,8 @@
 
 class Popup;
 
-class SFX2_DLLPUBLIC DropdownBox : public VclHBox
+class SFX2_DLLPUBLIC DropdownBox : public VclHBox,
+                                   public vcl::IPrioritable
 {
 private:
     bool m_bInFullView;
@@ -42,8 +44,8 @@ public:
     virtual ~DropdownBox() override;
     virtual void dispose() override;
 
-    void HideContent();
-    void ShowContent();
+    void HideContent() override;
+    void ShowContent() override;
 
 private:
     DECL_LINK(PBClickHdl, Button*, void);
diff --git a/sfx2/source/notebookbar/PriorityHBox.cxx 
b/sfx2/source/notebookbar/PriorityHBox.cxx
index de2e7b9bb201..fde027bb3364 100644
--- a/sfx2/source/notebookbar/PriorityHBox.cxx
+++ b/sfx2/source/notebookbar/PriorityHBox.cxx
@@ -41,7 +41,7 @@ class SFX2_DLLPUBLIC PriorityHBox : public VclHBox
 private:
     bool m_bInitialized;
 
-    std::vector<IPrioritable*> m_aSortedChilds;
+    std::vector<vcl::IPrioritable*> m_aSortedChilds;
 
 public:
     explicit PriorityHBox(vcl::Window *pParent)
@@ -69,8 +69,7 @@ public:
 
             bool bAllwaysExpanded = true;
 
-            IPrioritable* pPrioritable = pChild->GetType() == 
WindowType::CONTAINER ?
-                dynamic_cast<IPrioritable*>(pChild) : nullptr;
+            vcl::IPrioritable* pPrioritable = 
dynamic_cast<vcl::IPrioritable*>(pChild);
             if (pPrioritable && pPrioritable->GetPriority() != 
VCL_PRIORITY_DEFAULT)
                 bAllwaysExpanded = false;
 
@@ -98,11 +97,12 @@ public:
         auto pChild = m_aSortedChilds.begin();
         while (nCurrentWidth > nWidth && pChild != m_aSortedChilds.end())
         {
-            DropdownBox* pBox = static_cast<DropdownBox*>(*pChild);
+            // ATM DropdownBox is the only one derived class from IPrioritable
+            DropdownBox* pDropdownBox = static_cast<DropdownBox*>(*pChild);
 
-            nCurrentWidth -= pBox->GetOutputWidthPixel() + get_spacing();
-            pBox->HideContent();
-            nCurrentWidth += pBox->GetOutputWidthPixel() + get_spacing();
+            nCurrentWidth -= pDropdownBox->GetOutputWidthPixel() + 
get_spacing();
+            pDropdownBox->HideContent();
+            nCurrentWidth += pDropdownBox->GetOutputWidthPixel() + 
get_spacing();
 
             pChild++;
         }
@@ -154,8 +154,7 @@ public:
             vcl::Window* pChild = GetChild(i);
 
             // Add only containers which have explicitly assigned priority.
-            IPrioritable* pPrioritable = pChild->GetType() == 
WindowType::CONTAINER ?
-                dynamic_cast<IPrioritable*>(pChild) : nullptr;
+            vcl::IPrioritable* pPrioritable = 
dynamic_cast<vcl::IPrioritable*>(pChild);
             if (pPrioritable && pPrioritable->GetPriority() != 
VCL_PRIORITY_DEFAULT)
                 m_aSortedChilds.push_back(pPrioritable);
         }
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 54cbb04dcb7b..66c00f288f67 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -11,7 +11,6 @@
 #include <o3tl/enumarray.hxx>
 #include <o3tl/enumrange.hxx>
 #include <vcl/dialog.hxx>
-#include <vcl/IPrioritable.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
@@ -26,7 +25,6 @@
 
 VclContainer::VclContainer(vcl::Window *pParent, WinBits nStyle)
     : Window(WindowType::CONTAINER)
-    , IPrioritable()
     , m_bLayoutDirty(true)
 {
     ImplInit(pParent, nStyle, nullptr);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to