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 /sfx2 | |
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>
Diffstat (limited to 'sfx2')
-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 |
3 files changed, 14 insertions, 12 deletions
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); } |