1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <sfx2/dllapi.h>
22 #include <vcl/weld.hxx>
25 namespace com::sun::star::frame
29 namespace com::sun::star::ui
33 namespace com::sun::star::ui
37 namespace com::sun::star::awt
42 namespace sfx2::sidebar
46 class PanelDescriptor
;
50 * Multiple panels form a single deck.
51 * E.g. the Properties deck has panels like Styles, Character, paragraph.
53 class SFX2_DLLPUBLIC Panel final
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
);
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
69 return mxPanelComponent
;
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();
80 void SetHeightPixel(int nHeight
);
82 bool get_extents(tools::Rectangle
& rExtents
) const;
84 /// Set whether a panel should be present but invisible / inactive
85 void SetLurkMode(bool bLurk
);
86 bool IsLurking() const { return mbLurking
; }
88 void set_margin_top(int nMargin
);
89 void set_margin_bottom(int nMargin
);
90 void set_vexpand(bool bExpand
);
92 weld::Window
* GetFrameWeld();
97 std::unique_ptr
<weld::Builder
> mxBuilder
;
98 const OUString msPanelId
;
99 const OUString msTitle
;
100 const bool mbIsTitleBarOptional
;
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
;
108 weld::Widget
* mpParentWindow
;
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
;
115 DECL_DLLPRIVATE_LINK(DumpAsPropertyTreeHdl
, tools::JsonWriter
&, void);
118 typedef std::vector
<std::shared_ptr
<Panel
>> SharedPanelContainer
;
120 } // end of namespace sfx2::sidebar
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */