diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2017-04-10 19:29:59 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2017-04-12 22:25:53 +0200 |
commit | 76fbd18a515e531f1d238ab0b405212a032c53f2 (patch) | |
tree | a95ceaed7c36e3f3a7e248547dfa7225fd773dda | |
parent | c5603ba6d9d97d62d68cdbda4e2f06527db7092e (diff) |
Notebookbar: remove dependency between all containers and IPrioritable
Change-Id: I92bff0d68470763c88172744e82d9b5915ffb6f1
Reviewed-on: https://gerrit.libreoffice.org/36387
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r-- | include/vcl/IPrioritable.hxx | 7 | ||||
-rw-r--r-- | include/vcl/layout.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/notebookbar/DropdownBox.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/notebookbar/DropdownBox.hxx | 8 | ||||
-rw-r--r-- | sfx2/source/notebookbar/PriorityHBox.cxx | 17 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 2 |
6 files changed, 21 insertions, 16 deletions
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); |