LibreOffice Module sfx2 (master) 1
Panel.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#pragma once
20
21#include <sfx2/dllapi.h>
22#include <vcl/weld.hxx>
23#include <vector>
24
26{
27class XFrame;
28}
29namespace com::sun::star::ui
30{
31class XSidebarPanel;
32}
33namespace com::sun::star::ui
34{
35class XUIElement;
36}
37namespace com::sun::star::awt
38{
39class XWindow;
40}
41
42namespace sfx2::sidebar
43{
44class Context;
45class Deck;
46class PanelDescriptor;
47class PanelTitleBar;
48
54{
55public:
56 Panel(const PanelDescriptor& rPanelDescriptor, weld::Widget* pParentWindow,
57 const bool bIsInitiallyExpanded, Deck* pDeck, std::function<Context()> aContextAccess,
58 const css::uno::Reference<css::frame::XFrame>& rxFrame);
59
60 ~Panel();
61
62 PanelTitleBar* GetTitleBar() const;
63 weld::Box* GetContents() const;
64 void Show(bool bShow);
65 bool IsTitleBarOptional() const { return mbIsTitleBarOptional; }
66 void SetUIElement(const css::uno::Reference<css::ui::XUIElement>& rxElement);
67 const css::uno::Reference<css::ui::XSidebarPanel>& GetPanelComponent() const
68 {
69 return mxPanelComponent;
70 }
71 const css::uno::Reference<css::awt::XWindow>& GetElementParentWindow();
72 css::uno::Reference<css::awt::XWindow> GetElementWindow();
73 void SetExpanded(const bool bIsExpanded);
74 bool IsExpanded() const { return mbIsExpanded; }
75 bool HasIdPredicate(std::u16string_view rsId) const;
76 const OUString& GetId() const { return msPanelId; }
77 const OUString& GetTitle() const { return msTitle; }
78 void TriggerDeckLayouting();
79
80 void SetHeightPixel(int nHeight);
81
82 bool get_extents(tools::Rectangle& rExtents) const;
83
85 void SetLurkMode(bool bLurk);
86 bool IsLurking() const { return mbLurking; }
87
88 void set_margin_top(int nMargin);
89 void set_margin_bottom(int nMargin);
90 void set_vexpand(bool bExpand);
91
93
94 void DataChanged();
95
96private:
97 std::unique_ptr<weld::Builder> mxBuilder;
98 const OUString msPanelId;
99 const OUString msTitle;
101 const bool mbWantsAWT;
102 css::uno::Reference<css::ui::XUIElement> mxElement;
103 css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
106 const std::function<Context()> maContextAccess;
107 const css::uno::Reference<css::frame::XFrame>& mxFrame;
110 std::unique_ptr<weld::Box> mxContainer;
111 std::unique_ptr<PanelTitleBar> mxTitleBar;
112 std::unique_ptr<weld::Box> mxContents;
113 css::uno::Reference<css::awt::XWindow> mxXWindow;
114
115 DECL_DLLPRIVATE_LINK(DumpAsPropertyTreeHdl, tools::JsonWriter&, void);
116};
117
118typedef std::vector<std::shared_ptr<Panel>> SharedPanelContainer;
119
120} // end of namespace sfx2::sidebar
121
122/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This is the parent window of the panels.
Definition: Deck.hxx:38
Multiple panels form a single deck.
Definition: Panel.hxx:54
const std::function< Context()> maContextAccess
Definition: Panel.hxx:106
weld::Widget * mpParentWindow
Definition: Panel.hxx:108
DECL_DLLPRIVATE_LINK(DumpAsPropertyTreeHdl, tools::JsonWriter &, void)
std::unique_ptr< weld::Box > mxContents
Definition: Panel.hxx:112
const bool mbIsTitleBarOptional
Definition: Panel.hxx:100
const css::uno::Reference< css::ui::XSidebarPanel > & GetPanelComponent() const
Definition: Panel.hxx:67
bool IsExpanded() const
Definition: Panel.hxx:74
std::unique_ptr< weld::Box > mxContainer
Definition: Panel.hxx:110
css::uno::Reference< css::awt::XWindow > mxXWindow
Definition: Panel.hxx:113
VclPtr< Deck > mxDeck
Definition: Panel.hxx:109
const css::uno::Reference< css::frame::XFrame > & mxFrame
Definition: Panel.hxx:107
css::uno::Reference< css::ui::XSidebarPanel > mxPanelComponent
Definition: Panel.hxx:103
const OUString msTitle
Definition: Panel.hxx:99
const OUString & GetId() const
Definition: Panel.hxx:76
bool IsLurking() const
Definition: Panel.hxx:86
const bool mbWantsAWT
Definition: Panel.hxx:101
bool IsTitleBarOptional() const
Definition: Panel.hxx:65
std::unique_ptr< weld::Builder > mxBuilder
Definition: Panel.hxx:97
const OUString msPanelId
Definition: Panel.hxx:98
const OUString & GetTitle() const
Definition: Panel.hxx:77
std::unique_ptr< PanelTitleBar > mxTitleBar
Definition: Panel.hxx:111
css::uno::Reference< css::ui::XUIElement > mxElement
Definition: Panel.hxx:102
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
std::vector< std::shared_ptr< Panel > > SharedPanelContainer
Definition: Panel.hxx:118