summaryrefslogtreecommitdiff
path: root/sfx2/source/notebookbar/DropdownBox.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/notebookbar/DropdownBox.cxx')
-rw-r--r--sfx2/source/notebookbar/DropdownBox.cxx90
1 files changed, 8 insertions, 82 deletions
diff --git a/sfx2/source/notebookbar/DropdownBox.cxx b/sfx2/source/notebookbar/DropdownBox.cxx
index aba34a36ab72..473e5c98be40 100644
--- a/sfx2/source/notebookbar/DropdownBox.cxx
+++ b/sfx2/source/notebookbar/DropdownBox.cxx
@@ -26,87 +26,6 @@
#define NOTEBOOK_HEADER_HEIGHT 30
/*
- * Popup - shows hidden content, controls are moved to this popup
- * and after close moved to the original parent
- */
-
-class Popup : public FloatingWindow
-{
-private:
- VclPtr<VclHBox> m_pBox;
- ScopedVclPtr<DropdownBox> m_pParent;
-
-public:
- explicit Popup(const VclPtr<DropdownBox>& pParent)
- : FloatingWindow(pParent, "Popup", "sfx/ui/notebookbarpopup.ui")
- , m_pParent(pParent)
- {
- get(m_pBox, "box");
- m_pBox->SetSizePixel(Size(100, 75));
- }
-
- virtual ~Popup() override
- {
- disposeOnce();
- }
-
- VclHBox* getBox()
- {
- return m_pBox.get();
- }
-
- virtual void PopupModeEnd() override
- {
- hideSeparators(false);
- for (int i = 0; i < m_pBox->GetChildCount(); i++)
- {
- m_pBox->GetChild(i)->Hide();
- m_pBox->GetChild(i)->SetParent(m_pParent);
- }
- FloatingWindow::PopupModeEnd();
- }
-
- void hideSeparators(bool bHide = true)
- {
- // separator on the beginning
- Window* pWindow = m_pBox->GetChild(0);
- while (pWindow && pWindow->GetType() == WindowType::CONTAINER)
- {
- pWindow = pWindow->GetChild(0);
- }
- if (pWindow && pWindow->GetType() == WindowType::FIXEDLINE)
- {
- if (bHide)
- pWindow->Hide();
- else
- pWindow->Show();
- }
-
- // separator on the end
- pWindow = m_pBox->GetChild(m_pBox->GetChildCount() - 1);
- while (pWindow && pWindow->GetType() == WindowType::CONTAINER)
- {
- pWindow = pWindow->GetChild(pWindow->GetChildCount() - 1);
- }
- if (pWindow && pWindow->GetType() == WindowType::FIXEDLINE)
- {
- if (bHide)
- pWindow->Hide();
- else
- pWindow->Show();
- }
- }
-
- void dispose() override
- {
- m_pBox.disposeAndClear();
- m_pParent.clear();
-
- FloatingWindow::dispose();
- }
-};
-
-/*
* DropdownBox - shows content or moves it to the popup
* which can be opened by clicking on a button
*/
@@ -152,6 +71,11 @@ void DropdownBox::HideContent()
}
}
+bool DropdownBox::IsHidden()
+{
+ return !m_bInFullView;
+}
+
void DropdownBox::ShowContent()
{
if (!m_bInFullView)
@@ -170,7 +94,7 @@ IMPL_LINK(DropdownBox, PBClickHdl, Button*, /*pButton*/, void)
if (m_pPopup)
m_pPopup.disposeAndClear();
- m_pPopup = VclPtr<Popup>::Create(this);
+ m_pPopup = VclPtr<NotebookbarPopup>::Create(this);
for (int i = 0; i < GetChildCount(); i++)
{
@@ -180,6 +104,8 @@ IMPL_LINK(DropdownBox, PBClickHdl, Button*, /*pButton*/, void)
pChild->Show();
pChild->SetParent(m_pPopup->getBox());
+ // count is decreased because we moved child
+ i--;
}
}