summaryrefslogtreecommitdiff
path: root/include/sfx2/sidebar
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-12 14:25:34 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-18 15:17:59 +0100
commitf9cf66b39ea00afc66ae79ca46cd9071f3598cb8 (patch)
tree4b488119c57d9e1ea3250e55af2df8769dc014f0 /include/sfx2/sidebar
parent3b544a311d6ab22e1e04c45a841d5f24d5c6b325 (diff)
weld the sidebar deck
Change-Id: Idc6710df7e59bcb5f61fca783e0cc0666cb13a1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112404 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/sfx2/sidebar')
-rw-r--r--include/sfx2/sidebar/Deck.hxx47
-rw-r--r--include/sfx2/sidebar/FocusManager.hxx10
-rw-r--r--include/sfx2/sidebar/Panel.hxx47
-rw-r--r--include/sfx2/sidebar/PanelLayout.hxx2
-rw-r--r--include/sfx2/sidebar/SidebarController.hxx4
-rw-r--r--include/sfx2/sidebar/Theme.hxx7
6 files changed, 54 insertions, 63 deletions
diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index 5122d7a63470..76f92f8da88c 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -19,15 +19,14 @@
#pragma once
#include <sfx2/sidebar/Panel.hxx>
-
-#include <vcl/window.hxx>
-
-class ScrollBar;
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/weld.hxx>
namespace sfx2::sidebar
{
class DeckDescriptor;
class DeckTitleBar;
+class SidebarDockingWindow;
/** This is the parent window of the panels.
It displays the deck title.
@@ -35,25 +34,25 @@ class DeckTitleBar;
A deck consists of multiple panels.
E.g. Properties, Styles, Navigator.
*/
-class Deck final : public vcl::Window
+class Deck final : public InterimItemWindow
{
public:
- Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow,
+ Deck(const DeckDescriptor& rDeckDescriptor, SidebarDockingWindow* pParentWindow,
const std::function<void()>& rCloserAction);
virtual ~Deck() override;
virtual void dispose() override;
const OUString& GetId() const { return msId; }
- VclPtr<DeckTitleBar> const& GetTitleBar() const;
+ DeckTitleBar* GetTitleBar() const;
tools::Rectangle GetContentArea() const;
void ResetPanels(const SharedPanelContainer& rPanels);
const SharedPanelContainer& GetPanels() const { return maPanels; }
- Panel* GetPanel(std::u16string_view panelId);
+ std::shared_ptr<Panel> GetPanel(std::u16string_view panelId);
void RequestLayout();
- vcl::Window* GetPanelParentWindow();
+ weld::Widget* GetPanelParentWindow();
/** Try to make the panel completely visible.
When the whole panel does not fit then make its top visible
@@ -61,28 +60,15 @@ public:
*/
void ShowPanel(const Panel& rPanel);
- virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
- virtual void Paint(vcl::RenderContext& rRenderContext,
- const tools::Rectangle& rUpdateArea) override;
virtual void DataChanged(const DataChangedEvent& rEvent) override;
- virtual bool EventNotify(NotifyEvent& rEvent) override;
+
virtual void Resize() override;
virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; }
- class ScrollContainerWindow final : public vcl::Window
- {
- public:
- ScrollContainerWindow(vcl::Window* pParentWindow);
- virtual void Paint(vcl::RenderContext& rRenderContext,
- const tools::Rectangle& rUpdateArea) override;
- void SetSeparators(const ::std::vector<sal_Int32>& rSeparators);
-
- private:
- std::vector<sal_Int32> maSeparators;
- };
+ SidebarDockingWindow* GetDockingWindow() const { return mxParentWindow; }
private:
void RequestLayoutInternal();
@@ -92,14 +78,11 @@ private:
sal_Int32 mnMinimalWidth;
sal_Int32 mnMinimalHeight;
SharedPanelContainer maPanels;
- VclPtr<DeckTitleBar> mpTitleBar;
- VclPtr<vcl::Window> mpScrollClipWindow;
- VclPtr<ScrollContainerWindow> mpScrollContainer;
- VclPtr<vcl::Window> mpFiller;
- VclPtr<ScrollBar> mpVerticalScrollBar;
-
- DECL_LINK(HandleVerticalScrollBarChange, ScrollBar*, void);
- bool ProcessWheelEvent(CommandEvent const* pCommandEvent);
+
+ VclPtr<SidebarDockingWindow> mxParentWindow;
+ std::unique_ptr<DeckTitleBar> mxTitleBar;
+ std::unique_ptr<weld::ScrolledWindow> mxVerticalScrollBar;
+ std::unique_ptr<weld::Container> mxContents;
};
} // end of namespace sfx2::sidebar
diff --git a/include/sfx2/sidebar/FocusManager.hxx b/include/sfx2/sidebar/FocusManager.hxx
index d20e7c4466bf..fd5d2e879e01 100644
--- a/include/sfx2/sidebar/FocusManager.hxx
+++ b/include/sfx2/sidebar/FocusManager.hxx
@@ -20,6 +20,7 @@
#include <sfx2/sidebar/Panel.hxx>
#include <tools/link.hxx>
+#include <vcl/vclevent.hxx>
#include <vcl/keycod.hxx>
namespace weld {
@@ -64,12 +65,13 @@ public:
void GrabFocus();
void GrabFocusPanel();
- void SetDeckTitle(DeckTitleBar* pDeckTitleBar);
+ void SetDeck(Deck* pDeck);
void SetPanels(const SharedPanelContainer& rPanels);
void SetButtons(const std::vector<weld::Widget*>& rButtons);
private:
- VclPtr<DeckTitleBar> mpDeckTitleBar;
+ VclPtr<Deck> mxDeck;
+ DeckTitleBar* mpDeckTitleBar;
SharedPanelContainer maPanels;
std::vector<weld::Widget*> maButtons;
const std::function<void(const Panel&)> maShowPanelFunctor;
@@ -94,7 +96,6 @@ private:
/** Listen for key events for panels and buttons.
*/
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
- DECL_LINK(ChildEventListener, VclWindowEvent&, void);
void ClearPanels();
void ClearButtons();
@@ -125,13 +126,12 @@ private:
void FocusButton(const sal_Int32 nButtonIndex);
void MoveFocusInsidePanel(const FocusLocation& rLocation,
const sal_Int32 nDirection);
- void MoveFocusInsideDeckTitle(const FocusLocation& rLocation,
+ bool MoveFocusInsideDeckTitle(const FocusLocation& rLocation,
const sal_Int32 nDirection);
bool HandleKeyEvent(const vcl::KeyCode& rKeyCode,
const FocusLocation& rLocation);
- FocusLocation GetFocusLocation(const vcl::Window& rWindow) const;
FocusLocation GetFocusLocation() const;
};
diff --git a/include/sfx2/sidebar/Panel.hxx b/include/sfx2/sidebar/Panel.hxx
index 28fa9cdda1b7..8ab43b330130 100644
--- a/include/sfx2/sidebar/Panel.hxx
+++ b/include/sfx2/sidebar/Panel.hxx
@@ -19,9 +19,7 @@
#pragma once
#include <sfx2/dllapi.h>
-
-#include <vcl/InterimItemWindow.hxx>
-
+#include <vcl/weld.hxx>
#include <vector>
namespace com::sun::star::frame
@@ -43,27 +41,28 @@ class XWindow;
namespace sfx2::sidebar
{
+class Context;
+class Deck;
class PanelDescriptor;
class PanelTitleBar;
-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 InterimItemWindow
+class SFX2_DLLPUBLIC Panel final
{
public:
- Panel(const PanelDescriptor& rPanelDescriptor, vcl::Window* pParentWindow,
- const bool bIsInitiallyExpanded, const std::function<void()>& rDeckLayoutTrigger,
+ Panel(const PanelDescriptor& rPanelDescriptor, weld::Widget* pParentWindow,
+ const bool bIsInitiallyExpanded, Deck* pDeck,
const std::function<Context()>& rContextAccess,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- virtual ~Panel() override;
- virtual void dispose() override;
+ ~Panel();
PanelTitleBar* GetTitleBar() const;
- void ShowTitlebar(bool bShowTitlebar);
+ weld::Container* GetContents() const;
+ void Show(bool bShow);
bool IsTitleBarOptional() const { return mbIsTitleBarOptional; }
void SetUIElement(const css::uno::Reference<css::ui::XUIElement>& rxElement);
const css::uno::Reference<css::ui::XSidebarPanel>& GetPanelComponent() const
@@ -76,32 +75,48 @@ public:
bool IsExpanded() const { return mbIsExpanded; }
bool HasIdPredicate(std::u16string_view rsId) const;
const OUString& GetId() const { return msPanelId; }
- void TriggerDeckLayouting() { maDeckLayoutTrigger(); }
+ const OUString& GetTitle() const { return msTitle; }
+ void TriggerDeckLayouting();
+
+ void SetHeightPixel(int nHeight);
+
+ bool get_extents(tools::Rectangle& rExtents) const;
/// Set whether a panel should be present but invisible / inactive
void SetLurkMode(bool bLurk);
bool IsLurking() const { return mbLurking; }
- virtual void DataChanged(const DataChangedEvent& rEvent) override;
- virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
- virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
+ void set_margin_top(int nMargin);
+ void set_margin_bottom(int nMargin);
+ void set_vexpand(bool bExpand);
+
+ weld::Window* GetFrameWeld();
+
+ void DataChanged();
private:
+ std::unique_ptr<weld::Builder> mxBuilder;
const OUString msPanelId;
+ const OUString msTitle;
const bool mbIsTitleBarOptional;
const bool mbWantsAWT;
css::uno::Reference<css::ui::XUIElement> mxElement;
css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
bool mbIsExpanded;
bool mbLurking;
- const std::function<void()> maDeckLayoutTrigger;
const std::function<Context()> maContextAccess;
const css::uno::Reference<css::frame::XFrame>& mxFrame;
+ weld::Widget* mpParentWindow;
+ VclPtr<Deck> mxDeck;
+ std::unique_ptr<weld::Container> mxContainer;
std::unique_ptr<PanelTitleBar> mxTitleBar;
std::unique_ptr<weld::Container> mxContents;
css::uno::Reference<css::awt::XWindow> mxXWindow;
+
+ DECL_LINK(DumpAsPropertyTreeHdl, tools::JsonWriter&, void);
};
-typedef std::vector<VclPtr<Panel>> SharedPanelContainer;
+
+typedef std::vector<std::shared_ptr<Panel>> SharedPanelContainer;
} // end of namespace sfx2::sidebar
diff --git a/include/sfx2/sidebar/PanelLayout.hxx b/include/sfx2/sidebar/PanelLayout.hxx
index b03ebf97bb22..e5630180f99e 100644
--- a/include/sfx2/sidebar/PanelLayout.hxx
+++ b/include/sfx2/sidebar/PanelLayout.hxx
@@ -21,9 +21,9 @@ namespace tools { class JsonWriter; }
class SFX2_DLLPUBLIC PanelLayout
{
protected:
- VclPtr<sfx2::sidebar::Panel> m_xPanel;
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Container> m_xContainer;
+ sfx2::sidebar::Panel* m_pPanel;
virtual void DataChanged(const DataChangedEvent& rEvent);
virtual void DumpAsPropertyTree(tools::JsonWriter&);
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index 8bcaa858ff1c..7c0b4294ad18 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -239,9 +239,9 @@ private:
void CreatePanels(
std::u16string_view rDeckId,
const Context& rContext);
- VclPtr<Panel> CreatePanel (
+ std::shared_ptr<Panel> CreatePanel (
std::u16string_view rsPanelId,
- vcl::Window* pParentWindow,
+ weld::Widget* pParentWindow,
const bool bIsInitiallyExpanded,
const Context& rContext,
const VclPtr<Deck>& pDeck);
diff --git a/include/sfx2/sidebar/Theme.hxx b/include/sfx2/sidebar/Theme.hxx
index ebacb4322c62..5d01fc445ed6 100644
--- a/include/sfx2/sidebar/Theme.hxx
+++ b/include/sfx2/sidebar/Theme.hxx
@@ -57,8 +57,6 @@ public:
Image_Color_,
- Color_DeckTitleFont,
- Color_PanelTitleFont,
Color_Highlight,
Color_HighlightText,
Color_DeckBackground,
@@ -66,16 +64,11 @@ public:
Color_PanelBackground,
Color_PanelTitleBarBackground,
Color_TabBarBackground,
- Color_HorizontalBorder,
- Color_VerticalBorder,
- Color_DropDownBackground,
Color_Int_,
- Int_DeckTitleBarHeight,
Int_DeckBorderSize,
Int_DeckSeparatorHeight,
- Int_PanelTitleBarHeight,
Int_DeckLeftPadding,
Int_DeckTopPadding,
Int_DeckRightPadding,