Kaydet (Commit) 76fbd18a authored tarafından Szymon Kłos's avatar Szymon Kłos Kaydeden (comit) Szymon Kłos

Notebookbar: remove dependency between all containers and IPrioritable

Change-Id: I92bff0d68470763c88172744e82d9b5915ffb6f1
Reviewed-on: https://gerrit.libreoffice.org/36387Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSzymon Kłos <szymon.klos@collabora.com>
üst c5603ba6
...@@ -23,6 +23,10 @@ protected: ...@@ -23,6 +23,10 @@ protected:
} }
public: public:
virtual ~IPrioritable()
{
}
int GetPriority() const int GetPriority() const
{ {
return m_nPriority; return m_nPriority;
...@@ -33,6 +37,9 @@ public: ...@@ -33,6 +37,9 @@ public:
m_nPriority = nPriority; m_nPriority = nPriority;
} }
virtual void HideContent() = 0;
virtual void ShowContent() = 0;
private: private:
int m_nPriority; int m_nPriority;
}; };
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <vcl/dialog.hxx> #include <vcl/dialog.hxx>
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include <vcl/IPrioritable.hxx>
#include <vcl/scrbar.hxx> #include <vcl/scrbar.hxx>
#include <vcl/split.hxx> #include <vcl/split.hxx>
#include <vcl/vclmedit.hxx> #include <vcl/vclmedit.hxx>
...@@ -24,7 +23,6 @@ ...@@ -24,7 +23,6 @@
#include <set> #include <set>
class VCL_DLLPUBLIC VclContainer : public vcl::Window, class VCL_DLLPUBLIC VclContainer : public vcl::Window,
public vcl::IPrioritable,
public vcl::IContext public vcl::IContext
{ {
public: public:
......
...@@ -113,6 +113,7 @@ public: ...@@ -113,6 +113,7 @@ public:
DropdownBox::DropdownBox(vcl::Window *pParent) DropdownBox::DropdownBox(vcl::Window *pParent)
: VclHBox(pParent) : VclHBox(pParent)
, IPrioritable()
, m_bInFullView(true) , m_bInFullView(true)
{ {
m_pButton = VclPtr<PushButton>::Create(this, WB_FLATBUTTON); m_pButton = VclPtr<PushButton>::Create(this, WB_FLATBUTTON);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define INCLUDED_SFX2_NOTEBOOKBAR_DROPDOWNBOX_HXX #define INCLUDED_SFX2_NOTEBOOKBAR_DROPDOWNBOX_HXX
#include <vcl/builderfactory.hxx> #include <vcl/builderfactory.hxx>
#include <vcl/IPrioritable.hxx>
#include <vcl/layout.hxx> #include <vcl/layout.hxx>
#include <sfx2/dllapi.h> #include <sfx2/dllapi.h>
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
...@@ -30,7 +31,8 @@ ...@@ -30,7 +31,8 @@
class Popup; class Popup;
class SFX2_DLLPUBLIC DropdownBox : public VclHBox class SFX2_DLLPUBLIC DropdownBox : public VclHBox,
public vcl::IPrioritable
{ {
private: private:
bool m_bInFullView; bool m_bInFullView;
...@@ -42,8 +44,8 @@ public: ...@@ -42,8 +44,8 @@ public:
virtual ~DropdownBox() override; virtual ~DropdownBox() override;
virtual void dispose() override; virtual void dispose() override;
void HideContent(); void HideContent() override;
void ShowContent(); void ShowContent() override;
private: private:
DECL_LINK(PBClickHdl, Button*, void); DECL_LINK(PBClickHdl, Button*, void);
......
...@@ -41,7 +41,7 @@ class SFX2_DLLPUBLIC PriorityHBox : public VclHBox ...@@ -41,7 +41,7 @@ class SFX2_DLLPUBLIC PriorityHBox : public VclHBox
private: private:
bool m_bInitialized; bool m_bInitialized;
std::vector<IPrioritable*> m_aSortedChilds; std::vector<vcl::IPrioritable*> m_aSortedChilds;
public: public:
explicit PriorityHBox(vcl::Window *pParent) explicit PriorityHBox(vcl::Window *pParent)
...@@ -69,8 +69,7 @@ public: ...@@ -69,8 +69,7 @@ public:
bool bAllwaysExpanded = true; bool bAllwaysExpanded = true;
IPrioritable* pPrioritable = pChild->GetType() == WindowType::CONTAINER ? vcl::IPrioritable* pPrioritable = dynamic_cast<vcl::IPrioritable*>(pChild);
dynamic_cast<IPrioritable*>(pChild) : nullptr;
if (pPrioritable && pPrioritable->GetPriority() != VCL_PRIORITY_DEFAULT) if (pPrioritable && pPrioritable->GetPriority() != VCL_PRIORITY_DEFAULT)
bAllwaysExpanded = false; bAllwaysExpanded = false;
...@@ -98,11 +97,12 @@ public: ...@@ -98,11 +97,12 @@ public:
auto pChild = m_aSortedChilds.begin(); auto pChild = m_aSortedChilds.begin();
while (nCurrentWidth > nWidth && pChild != m_aSortedChilds.end()) 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(); nCurrentWidth -= pDropdownBox->GetOutputWidthPixel() + get_spacing();
pBox->HideContent(); pDropdownBox->HideContent();
nCurrentWidth += pBox->GetOutputWidthPixel() + get_spacing(); nCurrentWidth += pDropdownBox->GetOutputWidthPixel() + get_spacing();
pChild++; pChild++;
} }
...@@ -154,8 +154,7 @@ public: ...@@ -154,8 +154,7 @@ public:
vcl::Window* pChild = GetChild(i); vcl::Window* pChild = GetChild(i);
// Add only containers which have explicitly assigned priority. // Add only containers which have explicitly assigned priority.
IPrioritable* pPrioritable = pChild->GetType() == WindowType::CONTAINER ? vcl::IPrioritable* pPrioritable = dynamic_cast<vcl::IPrioritable*>(pChild);
dynamic_cast<IPrioritable*>(pChild) : nullptr;
if (pPrioritable && pPrioritable->GetPriority() != VCL_PRIORITY_DEFAULT) if (pPrioritable && pPrioritable->GetPriority() != VCL_PRIORITY_DEFAULT)
m_aSortedChilds.push_back(pPrioritable); m_aSortedChilds.push_back(pPrioritable);
} }
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <o3tl/enumarray.hxx> #include <o3tl/enumarray.hxx>
#include <o3tl/enumrange.hxx> #include <o3tl/enumrange.hxx>
#include <vcl/dialog.hxx> #include <vcl/dialog.hxx>
#include <vcl/IPrioritable.hxx>
#include <vcl/layout.hxx> #include <vcl/layout.hxx>
#include <vcl/msgbox.hxx> #include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
...@@ -26,7 +25,6 @@ ...@@ -26,7 +25,6 @@
VclContainer::VclContainer(vcl::Window *pParent, WinBits nStyle) VclContainer::VclContainer(vcl::Window *pParent, WinBits nStyle)
: Window(WindowType::CONTAINER) : Window(WindowType::CONTAINER)
, IPrioritable()
, m_bLayoutDirty(true) , m_bLayoutDirty(true)
{ {
ImplInit(pParent, nStyle, nullptr); ImplInit(pParent, nStyle, nullptr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment