[Libreoffice-commits] core.git: include/sfx2 sfx2/inc sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 11 13:30:42 UTC 2021
include/sfx2/sidebar/Panel.hxx | 13 +--
sfx2/UIConfig_sfx.mk | 2
sfx2/inc/sidebar/PanelTitleBar.hxx | 14 ++-
sfx2/inc/sidebar/TitleBar.hxx | 28 ++++--
sfx2/source/sidebar/Deck.cxx | 3
sfx2/source/sidebar/DeckLayouter.cxx | 62 +++++++--------
sfx2/source/sidebar/FocusManager.cxx | 15 +--
sfx2/source/sidebar/Panel.cxx | 49 +++++-------
sfx2/source/sidebar/PanelTitleBar.cxx | 31 +++----
sfx2/source/sidebar/SidebarController.cxx | 5 -
sfx2/source/sidebar/TitleBar.cxx | 50 +++++++-----
sfx2/source/sidebar/UnoPanel.cxx | 4
sfx2/uiconfig/ui/panel.ui | 122 ++++++++++++++++++++++++++++++
sfx2/uiconfig/ui/paneltitlebar.ui | 96 -----------------------
14 files changed, 270 insertions(+), 224 deletions(-)
New commits:
commit d764415977ad65bb4a657ccada7c9b2c19b689e1
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Mar 2 16:18:43 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Mar 11 14:29:54 2021 +0100
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 at redhat.com>
diff --git a/include/sfx2/sidebar/Panel.hxx b/include/sfx2/sidebar/Panel.hxx
index ea4a81870744..cd820ff937b2 100644
--- a/include/sfx2/sidebar/Panel.hxx
+++ b/include/sfx2/sidebar/Panel.hxx
@@ -20,7 +20,7 @@
#include <sfx2/dllapi.h>
-#include <vcl/window.hxx>
+#include <vcl/InterimItemWindow.hxx>
#include <vector>
@@ -51,7 +51,7 @@ class Context;
* Multiple panels form a single deck.
* E.g. the Properties deck has panels like Styles, Character, paragraph.
*/
-class SFX2_DLLPUBLIC Panel final : public vcl::Window
+class SFX2_DLLPUBLIC Panel final : public InterimItemWindow
{
public:
Panel(const PanelDescriptor& rPanelDescriptor, vcl::Window* pParentWindow,
@@ -62,13 +62,15 @@ public:
virtual ~Panel() override;
virtual void dispose() override;
- VclPtr<PanelTitleBar> const& GetTitleBar() const;
+ PanelTitleBar* GetTitleBar() const;
+ void ShowTitlebar(bool bShowTitlebar);
bool IsTitleBarOptional() const { return mbIsTitleBarOptional; }
void SetUIElement(const css::uno::Reference<css::ui::XUIElement>& rxElement);
const css::uno::Reference<css::ui::XSidebarPanel>& GetPanelComponent() const
{
return mxPanelComponent;
}
+ css::uno::Reference<css::awt::XWindow> GetElementParentWindow() const { return mxXWindow; }
css::uno::Reference<css::awt::XWindow> GetElementWindow();
void SetExpanded(const bool bIsExpanded);
bool IsExpanded() const { return mbIsExpanded; }
@@ -80,7 +82,6 @@ public:
void SetLurkMode(bool bLurk);
bool IsLurking() const { return mbLurking; }
- virtual void Resize() override;
virtual void DataChanged(const DataChangedEvent& rEvent) override;
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
@@ -95,7 +96,9 @@ private:
const std::function<void()> maDeckLayoutTrigger;
const std::function<Context()> maContextAccess;
const css::uno::Reference<css::frame::XFrame>& mxFrame;
- VclPtr<PanelTitleBar> mpTitleBar;
+ std::unique_ptr<PanelTitleBar> mxTitleBar;
+ std::unique_ptr<weld::Container> mxContents;
+ css::uno::Reference<css::awt::XWindow> mxXWindow;
};
typedef std::vector<VclPtr<Panel>> SharedPanelContainer;
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index 7bdbd7a85a1e..a21bbeed53bb 100644
--- a/sfx2/UIConfig_sfx.mk
+++ b/sfx2/UIConfig_sfx.mk
@@ -52,7 +52,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
sfx2/uiconfig/ui/newstyle \
sfx2/uiconfig/ui/notebookbar \
sfx2/uiconfig/ui/optprintpage \
- sfx2/uiconfig/ui/paneltitlebar \
+ sfx2/uiconfig/ui/panel \
sfx2/uiconfig/ui/password \
sfx2/uiconfig/ui/notebookbarpopup \
sfx2/uiconfig/ui/printeroptionsdialog \
diff --git a/sfx2/inc/sidebar/PanelTitleBar.hxx b/sfx2/inc/sidebar/PanelTitleBar.hxx
index ff00eb9f9294..64a77833dddd 100644
--- a/sfx2/inc/sidebar/PanelTitleBar.hxx
+++ b/sfx2/inc/sidebar/PanelTitleBar.hxx
@@ -29,35 +29,39 @@ namespace sfx2::sidebar {
class Panel;
class PanelTitleBar final
- : public TitleBar
+ : public TitleBarBase
{
public:
- PanelTitleBar(const OUString& rsTitle, vcl::Window* pParentWindow, Panel* pPanel);
- virtual void dispose() override;
+ PanelTitleBar(const OUString& rsTitle, weld::Builder& rBuilder, Panel* pPanel);
virtual ~PanelTitleBar() override;
virtual void SetTitle (const OUString& rsTitle) override;
virtual OUString GetTitle() const override;
+ virtual bool GetVisible() const override;
void SetMoreOptionsCommand(const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
const css::uno::Reference<css::frame::XController>& rxController);
void UpdateExpandedState();
+ void Show(bool bShow)
+ {
+ mxTitlebar->set_visible(bShow);
+ }
weld::Expander& GetExpander()
{
return *mxExpander;
}
- virtual void DataChanged(const DataChangedEvent& rEvent) override;
-
private:
virtual void HandleToolBoxItemClick() override;
DECL_LINK(ExpandHdl, weld::Expander&, void);
+ std::unique_ptr<weld::Container> mxTitlebar;
std::unique_ptr<weld::Expander> mxExpander;
+
css::uno::Reference<css::frame::XToolbarController> mxController;
VclPtr<Panel> mpPanel;
diff --git a/sfx2/inc/sidebar/TitleBar.hxx b/sfx2/inc/sidebar/TitleBar.hxx
index 772b349b6a2c..425e859cc690 100644
--- a/sfx2/inc/sidebar/TitleBar.hxx
+++ b/sfx2/inc/sidebar/TitleBar.hxx
@@ -25,22 +25,19 @@
namespace sfx2::sidebar {
-class TitleBar : public InterimItemWindow
+class TitleBarBase
{
public:
- TitleBar(vcl::Window* pParentWindow,
- const OUString& rUIXMLDescription, const OString& rID,
- Theme::ThemeItem eThemeItem);
- virtual void dispose() override;
- virtual ~TitleBar() override;
+ TitleBarBase(weld::Builder& rBuilder, Theme::ThemeItem eThemeItem);
+ void reset();
+ virtual ~TitleBarBase();
virtual void SetTitle (const OUString& rsTitle) = 0;
virtual OUString GetTitle() const = 0;
+ virtual bool GetVisible() const = 0;
void SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon);
- virtual void DataChanged (const DataChangedEvent& rEvent) override;
-
weld::Toolbar& GetToolBox()
{
return *mxToolBox;
@@ -51,6 +48,7 @@ public:
}
protected:
+ weld::Builder& mrBuilder;
std::unique_ptr<weld::Image> mxAddonImage;
std::unique_ptr<weld::Toolbar> mxToolBox;
std::unique_ptr<ToolbarUnoDispatcher> mxToolBoxController;
@@ -61,6 +59,20 @@ protected:
DECL_LINK(SelectionHandler, const OString&, void);
};
+class TitleBar : public InterimItemWindow
+ , public TitleBarBase
+{
+public:
+ TitleBar(vcl::Window* pParentWindow,
+ const OUString& rUIXMLDescription, const OString& rID,
+ Theme::ThemeItem eThemeItem);
+ virtual void dispose() override;
+ virtual bool GetVisible() const override { return IsVisible(); }
+ virtual ~TitleBar() override;
+
+ virtual void DataChanged (const DataChangedEvent& rEvent) override;
+};
+
} // end of namespace sfx2::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 8578c398e3fa..0a3a925aa89c 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -349,9 +349,6 @@ void Deck::ShowPanel(const Panel& rPanel)
// Get vertical extent of the panel.
sal_Int32 nPanelTop (rPanel.GetPosPixel().Y());
const sal_Int32 nPanelBottom (nPanelTop + rPanel.GetSizePixel().Height() - 1);
- // Add the title bar into the extent.
- if (rPanel.GetTitleBar() && rPanel.GetTitleBar()->IsVisible())
- nPanelTop = rPanel.GetTitleBar()->GetPosPixel().Y();
// Determine what the new thumb position should be like.
// When the whole panel does not fit then make its top visible
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index bebc75e726ad..05098986b826 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -297,46 +297,39 @@ sal_Int32 PlacePanels (
nY += nDeckSeparatorHeight;
}
- // Place the title bar.
- VclPtr<PanelTitleBar> pTitleBar = rPanel.GetTitleBar();
- if (pTitleBar)
- {
- const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight) * rPanel.GetDPIScaleFactor());
+ const sal_Int32 nPanelTitleBarHeight(Theme::GetInteger(Theme::Int_PanelTitleBarHeight) * rPanel.GetDPIScaleFactor());
- if (iItem->mbShowTitleBar)
- {
- pTitleBar->setPosSizePixel(0, nY, nWidth, nPanelTitleBarHeight);
- pTitleBar->Show();
- nY += nPanelTitleBarHeight;
- }
- else
- {
- pTitleBar->Hide();
- }
- }
+ bool bShowTitlebar = iItem->mbShowTitleBar;
+ rPanel.ShowTitlebar(bShowTitlebar);
- if (rPanel.IsExpanded() && !rPanel.IsLurking())
+ bool bExpanded = rPanel.IsExpanded() && !rPanel.IsLurking();
+ if (bShowTitlebar || bExpanded)
{
rPanel.Show();
- // Determine the height of the panel depending on layout
- // mode and distributed heights.
- sal_Int32 nPanelHeight (0);
- switch(eMode)
+ sal_Int32 nPanelHeight(0);
+ if (bExpanded)
{
- case MinimumOrLarger:
- nPanelHeight = iItem->maLayoutSize.Minimum + iItem->mnDistributedHeight;
- break;
- case PreferredOrLarger:
- nPanelHeight = iItem->maLayoutSize.Preferred + iItem->mnDistributedHeight;
- break;
- case Preferred:
- nPanelHeight = iItem->maLayoutSize.Preferred;
- break;
- default:
- OSL_ASSERT(false);
- break;
+ // Determine the height of the panel depending on layout
+ // mode and distributed heights.
+ switch(eMode)
+ {
+ case MinimumOrLarger:
+ nPanelHeight = iItem->maLayoutSize.Minimum + iItem->mnDistributedHeight;
+ break;
+ case PreferredOrLarger:
+ nPanelHeight = iItem->maLayoutSize.Preferred + iItem->mnDistributedHeight;
+ break;
+ case Preferred:
+ nPanelHeight = iItem->maLayoutSize.Preferred;
+ break;
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
}
+ if (bShowTitlebar)
+ nPanelHeight += nPanelTitleBarHeight;
// Place the panel.
Point aNewPos(0, nY);
@@ -354,7 +347,10 @@ sal_Int32 PlacePanels (
else
{
rPanel.Hide();
+ }
+ if (!bExpanded)
+ {
// Add a separator below the collapsed panel, if it is the
// last panel in the deck.
if (iItem == rLayoutItems.end()-1)
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index 159bb27d6c05..b5132344db34 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -146,9 +146,6 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r
{
if (maPanels[nIndex] == &rWindow)
return FocusLocation(PC_PanelContent, nIndex);
- VclPtr<TitleBar> pTitleBar = maPanels[nIndex]->GetTitleBar();
- if (pTitleBar == &rWindow)
- return FocusLocation(PC_PanelTitle, nIndex);
}
return FocusLocation(PC_None, -1);
@@ -163,7 +160,7 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation() const
// Search the panels.
for (size_t nIndex = 0; nIndex < maPanels.size(); ++nIndex)
{
- VclPtr<PanelTitleBar> pTitleBar = maPanels[nIndex]->GetTitleBar();
+ PanelTitleBar* pTitleBar = maPanels[nIndex]->GetTitleBar();
if (!pTitleBar)
continue;
if (pTitleBar->GetExpander().has_focus())
@@ -199,7 +196,7 @@ void FocusManager::FocusDeckTitle()
bool FocusManager::IsDeckTitleVisible() const
{
- return mpDeckTitleBar != nullptr && mpDeckTitleBar->IsVisible();
+ return mpDeckTitleBar != nullptr && mpDeckTitleBar->GetVisible();
}
bool FocusManager::IsPanelTitleVisible (const sal_Int32 nPanelIndex) const
@@ -207,10 +204,10 @@ bool FocusManager::IsPanelTitleVisible (const sal_Int32 nPanelIndex) const
if (nPanelIndex<0 || nPanelIndex>=static_cast<sal_Int32>(maPanels.size()))
return false;
- VclPtr<TitleBar> pTitleBar = maPanels[nPanelIndex]->GetTitleBar();
+ TitleBarBase* pTitleBar = maPanels[nPanelIndex]->GetTitleBar();
if (!pTitleBar)
return false;
- return pTitleBar->IsVisible();
+ return pTitleBar->GetVisible();
}
void FocusManager::FocusPanel (
@@ -225,8 +222,8 @@ void FocusManager::FocusPanel (
}
Panel& rPanel (*maPanels[nPanelIndex]);
- VclPtr<PanelTitleBar> pTitleBar = rPanel.GetTitleBar();
- if (pTitleBar && pTitleBar->IsVisible())
+ PanelTitleBar* pTitleBar = rPanel.GetTitleBar();
+ if (pTitleBar && pTitleBar->GetVisible())
{
rPanel.SetExpanded(true);
pTitleBar->GetExpander().grab_focus();
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();
diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx
index ddde9ca7aa6f..2ac2a6f73a8f 100644
--- a/sfx2/source/sidebar/PanelTitleBar.cxx
+++ b/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -31,15 +31,17 @@ using namespace css::uno;
namespace sfx2::sidebar {
PanelTitleBar::PanelTitleBar(const OUString& rsTitle,
- vcl::Window* pParentWindow,
+ weld::Builder& rBuilder,
Panel* pPanel)
- : TitleBar(pParentWindow, "sfx/ui/paneltitlebar.ui", "PanelTitleBar",
- Theme::Color_PanelTitleBarBackground),
- mxExpander(m_xBuilder->weld_expander("expander")),
+ : TitleBarBase(rBuilder, Theme::Color_PanelTitleBarBackground),
+ mxTitlebar(rBuilder.weld_container("titlebar")),
+ mxExpander(rBuilder.weld_expander("expander")),
mpPanel(pPanel),
msIdent("button"),
msMoreOptionsCommand()
{
+ mxTitlebar->set_background(Theme::GetColor(meThemeItem));
+
mxExpander->set_label(rsTitle);
mxExpander->connect_expanded(LINK(this, PanelTitleBar, ExpandHdl));
@@ -52,6 +54,11 @@ PanelTitleBar::PanelTitleBar(const OUString& rsTitle,
#endif
}
+bool PanelTitleBar::GetVisible() const
+{
+ return mxTitlebar->get_visible();
+}
+
void PanelTitleBar::SetTitle(const OUString& rsTitle)
{
mxExpander->set_label(rsTitle);
@@ -68,11 +75,6 @@ void PanelTitleBar::UpdateExpandedState()
}
PanelTitleBar::~PanelTitleBar()
-{
- disposeOnce();
-}
-
-void PanelTitleBar::dispose()
{
Reference<lang::XComponent> xComponent(mxController, UNO_QUERY);
if (xComponent.is())
@@ -80,7 +82,8 @@ void PanelTitleBar::dispose()
mxController.clear();
mpPanel.clear();
mxExpander.reset();
- TitleBar::dispose();
+ mxTitlebar.reset();
+ reset();
}
void PanelTitleBar::SetMoreOptionsCommand(const OUString& rsCommandName,
@@ -106,7 +109,7 @@ void PanelTitleBar::SetMoreOptionsCommand(const OUString& rsCommandName,
xComponent->dispose();
mxController =
ControllerFactory::CreateToolBoxController(
- *mxToolBox, *m_xBuilder, msMoreOptionsCommand, rxFrame, rxController, true);
+ *mxToolBox, mrBuilder, msMoreOptionsCommand, rxFrame, rxController, true);
mxToolBox->show();
}
@@ -126,12 +129,6 @@ IMPL_LINK(PanelTitleBar, ExpandHdl, weld::Expander&, rExpander, void)
mpPanel->SetExpanded(rExpander.get_expanded());
}
-void PanelTitleBar::DataChanged (const DataChangedEvent& rEvent)
-{
- mxToolBox->set_item_icon_name(msIdent, "sfx2/res/symphony/morebutton.png");
- TitleBar::DataChanged(rEvent);
-}
-
} // end of namespace sfx2::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index be6572c85180..e6a24e3b632a 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -774,7 +774,7 @@ void SidebarController::CreatePanels(std::u16string_view rDeckId, const Context&
// Depending on the context we have to change the command
// for the "more options" dialog.
- VclPtr<PanelTitleBar> pTitleBar = aNewPanels[nWriteIndex]->GetTitleBar();
+ PanelTitleBar* pTitleBar = aNewPanels[nWriteIndex]->GetTitleBar();
if (pTitleBar)
{
pTitleBar->SetMoreOptionsCommand(
@@ -954,8 +954,9 @@ VclPtr<Panel> SidebarController::CreatePanel (
mxFrame);
// Create the XUIElement.
+ Reference<awt::XWindowPeer> xPeer(pPanel->GetElementParentWindow(), UNO_QUERY);
Reference<ui::XUIElement> xUIElement (CreateUIElement(
- pPanel->GetComponentInterface(),
+ xPeer,
xPanelDescriptor->msImplementationURL,
xPanelDescriptor->mbWantsCanvas,
rContext));
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx
index 615cb6de3b7b..b88b4e92e1db 100644
--- a/sfx2/source/sidebar/TitleBar.cxx
+++ b/sfx2/source/sidebar/TitleBar.cxx
@@ -21,47 +21,61 @@
namespace sfx2::sidebar {
-TitleBar::TitleBar(vcl::Window* pParentWindow,
- const OUString& rUIXMLDescription, const OString& rID,
- Theme::ThemeItem eThemeItem)
- : InterimItemWindow(pParentWindow, rUIXMLDescription, rID)
- , mxAddonImage(m_xBuilder->weld_image("addonimage"))
- , mxToolBox(m_xBuilder->weld_toolbar("toolbar"))
+TitleBarBase::TitleBarBase(weld::Builder& rBuilder, Theme::ThemeItem eThemeItem)
+ : mrBuilder(rBuilder)
+ , mxAddonImage(rBuilder.weld_image("addonimage"))
+ , mxToolBox(rBuilder.weld_toolbar("toolbar"))
, meThemeItem(eThemeItem)
{
- Color aBgColor = Theme::GetColor(meThemeItem);
- m_xContainer->set_background(aBgColor);
- mxToolBox->set_background(aBgColor);
+ mxToolBox->set_background(Theme::GetColor(meThemeItem));
- mxToolBox->connect_clicked(LINK(this, TitleBar, SelectionHandler));
+ mxToolBox->connect_clicked(LINK(this, TitleBarBase, SelectionHandler));
}
-TitleBar::~TitleBar()
+TitleBarBase::~TitleBarBase()
{
- disposeOnce();
}
-void TitleBar::dispose()
+void TitleBarBase::reset()
{
mxToolBox.reset();
mxAddonImage.reset();
- InterimItemWindow::dispose();
}
-void TitleBar::SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon)
+void TitleBarBase::SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon)
{
mxAddonImage->set_image(rIcon);
mxAddonImage->set_visible(rIcon.is());
}
-void TitleBar::DataChanged (const DataChangedEvent& /*rEvent*/)
+IMPL_LINK_NOARG(TitleBarBase, SelectionHandler, const OString&, void)
+{
+ HandleToolBoxItemClick();
+}
+
+TitleBar::TitleBar(vcl::Window* pParentWindow,
+ const OUString& rUIXMLDescription, const OString& rID,
+ Theme::ThemeItem eThemeItem)
+ : InterimItemWindow(pParentWindow, rUIXMLDescription, rID)
+ , TitleBarBase(*m_xBuilder, eThemeItem)
{
m_xContainer->set_background(Theme::GetColor(meThemeItem));
}
-IMPL_LINK_NOARG(TitleBar, SelectionHandler, const OString&, void)
+TitleBar::~TitleBar()
{
- HandleToolBoxItemClick();
+ disposeOnce();
+}
+
+void TitleBar::dispose()
+{
+ reset();
+ InterimItemWindow::dispose();
+}
+
+void TitleBar::DataChanged (const DataChangedEvent& /*rEvent*/)
+{
+ m_xContainer->set_background(Theme::GetColor(meThemeItem));
}
} // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/UnoPanel.cxx b/sfx2/source/sidebar/UnoPanel.cxx
index eee70429aa30..1170cbce1674 100644
--- a/sfx2/source/sidebar/UnoPanel.cxx
+++ b/sfx2/source/sidebar/UnoPanel.cxx
@@ -54,7 +54,7 @@ OUString SAL_CALL SfxUnoPanel::getTitle()
{
SolarMutexGuard aGuard;
- VclPtr<PanelTitleBar> pTitleBar = mpPanel->GetTitleBar();
+ PanelTitleBar* pTitleBar = mpPanel->GetTitleBar();
if (pTitleBar)
return pTitleBar->GetTitle();
else
@@ -71,7 +71,7 @@ void SAL_CALL SfxUnoPanel::setTitle( const OUString& newTitle )
if (xPanelDescriptor)
{
xPanelDescriptor->msTitle = newTitle;
- VclPtr<PanelTitleBar> pTitleBar = mpPanel->GetTitleBar();
+ PanelTitleBar* pTitleBar = mpPanel->GetTitleBar();
if (pTitleBar)
pTitleBar->SetTitle(newTitle);
}
diff --git a/sfx2/uiconfig/ui/panel.ui b/sfx2/uiconfig/ui/panel.ui
new file mode 100644
index 000000000000..689236e2eb28
--- /dev/null
+++ b/sfx2/uiconfig/ui/panel.ui
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
+<interface domain="sfx">
+ <requires lib="gtk+" version="3.20"/>
+ <!-- n-columns=1 n-rows=2 -->
+ <object class="GtkGrid" id="Panel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkBox" id="titlebar">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="addonimage">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="valign">center</property>
+ <property name="icon-name">missing-image</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkExpander" id="expander">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ <property name="label-fill">True</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="use-underline">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolbar" id="toolbar">
+ <property name="can-focus">False</property>
+ <property name="no-show-all">True</property>
+ <property name="toolbar-style">icons</property>
+ <property name="show-arrow">False</property>
+ <property name="icon_size">2</property>
+ <child>
+ <object class="GtkToolButton" id="button">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="tooltip-text" translatable="yes" context="paneltitlebar|SFX_STR_SIDEBAR_MORE_OPTIONS">More Options</property>
+ <property name="use-underline">True</property>
+ <property name="icon-name">sfx2/res/symphony/morebutton.png</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes" context="paneltitlebar|SFX_STR_SIDEBAR_MORE_OPTIONS">More Options</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+ <style>
+ <class name="small-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="contents">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ </object>
+</interface>
diff --git a/sfx2/uiconfig/ui/paneltitlebar.ui b/sfx2/uiconfig/ui/paneltitlebar.ui
deleted file mode 100644
index eac7c877cf2e..000000000000
--- a/sfx2/uiconfig/ui/paneltitlebar.ui
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
-<interface domain="sfx">
- <requires lib="gtk+" version="3.20"/>
- <object class="GtkBox" id="PanelTitleBar">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkImage" id="addonimage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="valign">center</property>
- <property name="icon-name">missing-image</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkExpander" id="expander">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="valign">center</property>
- <property name="hexpand">True</property>
- <property name="label-fill">True</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="vexpand">True</property>
- <property name="orientation">vertical</property>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="hexpand">True</property>
- <property name="use-underline">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolbar" id="toolbar">
- <property name="can-focus">False</property>
- <property name="no-show-all">True</property>
- <property name="toolbar-style">icons</property>
- <property name="show-arrow">False</property>
- <property name="icon_size">2</property>
- <child>
- <object class="GtkToolButton" id="button">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="tooltip-text" translatable="yes" context="paneltitlebar|SFX_STR_SIDEBAR_MORE_OPTIONS">More Options</property>
- <property name="use-underline">True</property>
- <property name="icon-name">sfx2/res/symphony/morebutton.png</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" context="paneltitlebar|SFX_STR_SIDEBAR_MORE_OPTIONS">More Options</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">False</property>
- </packing>
- </child>
- <style>
- <class name="small-button"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
-</interface>
More information about the Libreoffice-commits
mailing list