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 SAL_DLLPRIVATE
Panel(const PanelDescriptor
& rPanelDescriptor
, weld::Widget
* pParentWindow
,
57 const bool bIsInitiallyExpanded
, Deck
* pDeck
,
58 std::function
<Context()> aContextAccess
,
59 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
);
61 SAL_DLLPRIVATE
~Panel();
63 SAL_DLLPRIVATE PanelTitleBar
* GetTitleBar() const;
64 SAL_DLLPRIVATE
weld::Box
* GetContents() const;
65 SAL_DLLPRIVATE
void Show(bool bShow
);
66 bool IsTitleBarOptional() const { return mbIsTitleBarOptional
; }
67 SAL_DLLPRIVATE
void SetUIElement(const css::uno::Reference
<css::ui::XUIElement
>& rxElement
);
68 const css::uno::Reference
<css::ui::XSidebarPanel
>& GetPanelComponent() const
70 return mxPanelComponent
;
72 SAL_DLLPRIVATE
const css::uno::Reference
<css::awt::XWindow
>& GetElementParentWindow();
73 SAL_DLLPRIVATE
css::uno::Reference
<css::awt::XWindow
> GetElementWindow();
74 SAL_DLLPRIVATE
void SetExpanded(const bool bIsExpanded
);
75 bool IsExpanded() const { return mbIsExpanded
; }
76 SAL_DLLPRIVATE
bool HasIdPredicate(std::u16string_view rsId
) const;
77 const OUString
& GetId() const { return msPanelId
; }
78 const OUString
& GetTitle() const { return msTitle
; }
79 void TriggerDeckLayouting();
81 SAL_DLLPRIVATE
void SetHeightPixel(int nHeight
);
83 SAL_DLLPRIVATE
bool get_extents(tools::Rectangle
& rExtents
) const;
85 /// Set whether a panel should be present but invisible / inactive
86 SAL_DLLPRIVATE
void SetLurkMode(bool bLurk
);
87 bool IsLurking() const { return mbLurking
; }
89 SAL_DLLPRIVATE
void set_margin_top(int nMargin
);
90 SAL_DLLPRIVATE
void set_margin_bottom(int nMargin
);
91 SAL_DLLPRIVATE
void set_vexpand(bool bExpand
);
93 SAL_DLLPRIVATE
weld::Window
* GetFrameWeld();
95 SAL_DLLPRIVATE
void DataChanged();
98 std::unique_ptr
<weld::Builder
> mxBuilder
;
99 const OUString msPanelId
;
100 const OUString msTitle
;
101 const bool mbIsTitleBarOptional
;
102 const bool mbWantsAWT
;
103 css::uno::Reference
<css::ui::XUIElement
> mxElement
;
104 css::uno::Reference
<css::ui::XSidebarPanel
> mxPanelComponent
;
107 const std::function
<Context()> maContextAccess
;
108 const css::uno::Reference
<css::frame::XFrame
>& mxFrame
;
109 weld::Widget
* mpParentWindow
;
111 std::unique_ptr
<weld::Box
> mxContainer
;
112 std::unique_ptr
<PanelTitleBar
> mxTitleBar
;
113 std::unique_ptr
<weld::Box
> mxContents
;
114 css::uno::Reference
<css::awt::XWindow
> mxXWindow
;
116 DECL_DLLPRIVATE_LINK(DumpAsPropertyTreeHdl
, tools::JsonWriter
&, void);
119 typedef std::vector
<std::shared_ptr
<Panel
>> SharedPanelContainer
;
121 } // end of namespace sfx2::sidebar
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */