summaryrefslogtreecommitdiff
path: root/sfx2/source/sidebar/Panel.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-02 16:18:43 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-11 14:29:54 +0100
commitd764415977ad65bb4a657ccada7c9b2c19b689e1 (patch)
tree8f2a84b795e9a4cf5036dae0984c9ed2937933a7 /sfx2/source/sidebar/Panel.cxx
parentfeb8164afa67d3e2e5fe27dd01c5101d6d0cb847 (diff)
merge panel and panel title
so one combined InterimItemWindow instead of two separate ones for each panel Change-Id: Ie8e1b6a28f124ef23cf88ec47442ccf15ab51d3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111903 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source/sidebar/Panel.cxx')
-rw-r--r--sfx2/source/sidebar/Panel.cxx49
1 files changed, 24 insertions, 25 deletions
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index 793ee94ab85b..7c66838b2d8e 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -47,9 +47,8 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor,
const bool bIsInitiallyExpanded,
const std::function<void()>& rDeckLayoutTrigger,
const std::function<Context()>& rContextAccess,
- const css::uno::Reference<css::frame::XFrame>& rxFrame
- )
- : Window(pParentWindow)
+ const css::uno::Reference<css::frame::XFrame>& rxFrame)
+ : InterimItemWindow(pParentWindow, "sfx/ui/panel.ui", "Panel")
, msPanelId(rPanelDescriptor.msId)
, mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional)
, mxElement()
@@ -59,15 +58,18 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor,
, maDeckLayoutTrigger(rDeckLayoutTrigger)
, maContextAccess(rContextAccess)
, mxFrame(rxFrame)
- , mpTitleBar(VclPtr<PanelTitleBar>::Create(rPanelDescriptor.msTitle, pParentWindow, this))
+ , mxTitleBar(new PanelTitleBar(rPanelDescriptor.msTitle, *m_xBuilder, this))
+ , mxContents(m_xBuilder->weld_container("contents"))
+ , mxXWindow(mxContents->CreateChildFrame())
{
SetText(rPanelDescriptor.msTitle);
+ mxContents->set_visible(mbIsExpanded);
}
Panel::~Panel()
{
disposeOnce();
- assert(!mpTitleBar);
+ assert(!mxTitleBar);
}
void Panel::SetLurkMode(bool bLurk)
@@ -85,7 +87,7 @@ void Panel::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
{
if (!IsLurking())
{
- vcl::Window::DumpAsPropertyTree(rJsonWriter);
+ InterimItemWindow::DumpAsPropertyTree(rJsonWriter);
rJsonWriter.put("type", "panel");
}
}
@@ -107,14 +109,23 @@ void Panel::dispose()
xComponent->dispose();
}
- mpTitleBar.disposeAndClear();
+ mxTitleBar.reset();
- vcl::Window::dispose();
+ mxXWindow->dispose();
+ mxXWindow.clear();
+ mxContents.reset();
+
+ InterimItemWindow::dispose();
+}
+
+PanelTitleBar* Panel::GetTitleBar() const
+{
+ return mxTitleBar.get();
}
-VclPtr<PanelTitleBar> const & Panel::GetTitleBar() const
+void Panel::ShowTitlebar(bool bShowTitlebar)
{
- return mpTitleBar;
+ mxTitleBar->Show(bShowTitlebar);
}
void Panel::SetUIElement (const Reference<ui::XUIElement>& rxElement)
@@ -134,7 +145,7 @@ void Panel::SetExpanded (const bool bIsExpanded)
return;
mbIsExpanded = bIsExpanded;
- mpTitleBar->UpdateExpandedState();
+ mxTitleBar->UpdateExpandedState();
maDeckLayoutTrigger();
if (maContextAccess && pSidebarController)
@@ -144,6 +155,8 @@ void Panel::SetExpanded (const bool bIsExpanded)
bIsExpanded,
maContextAccess());
}
+
+ mxContents->set_visible(mbIsExpanded);
}
bool Panel::HasIdPredicate (std::u16string_view rsId) const
@@ -151,20 +164,6 @@ bool Panel::HasIdPredicate (std::u16string_view rsId) const
return msPanelId == rsId;
}
-void Panel::Resize()
-{
- Window::Resize();
-
- // Forward new size to window of XUIElement.
- Reference<awt::XWindow> xElementWindow (GetElementWindow());
- if(xElementWindow.is())
- {
- const Size aSize(GetSizePixel());
- xElementWindow->setPosSize(0, 0, aSize.Width(), aSize.Height(),
- awt::PosSize::POSSIZE);
- }
-}
-
void Panel::DataChanged (const DataChangedEvent&)
{
Invalidate();