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:
}
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;
};
......
......@@ -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:
......
......@@ -113,6 +113,7 @@ public:
DropdownBox::DropdownBox(vcl::Window *pParent)
: VclHBox(pParent)
, IPrioritable()
, m_bInFullView(true)
{
m_pButton = VclPtr<PushButton>::Create(this, WB_FLATBUTTON);
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
......
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