Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / include / sfx2 / sidebar / Panel.hxx
blob2cb5e6c9e9a1ea41ab3701f531a3c31987bc6f01
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_PANEL_HXX
20 #define INCLUDED_SFX2_SOURCE_SIDEBAR_PANEL_HXX
22 #include <sfx2/sidebar/Context.hxx>
24 #include <vcl/window.hxx>
26 #include <com/sun/star/ui/XUIElement.hpp>
27 #include <com/sun/star/ui/XSidebarPanel.hpp>
28 #include <com/sun/star/frame/XFrame.hpp>
30 #include <vector>
32 namespace sfx2 { namespace sidebar {
34 class PanelDescriptor;
35 class TitleBar;
36 class PanelTitleBar;
38 class Panel : public vcl::Window
40 public:
41 Panel(const PanelDescriptor& rPanelDescriptor, vcl::Window* pParentWindow,
42 const bool bIsInitiallyExpanded, const std::function<void()>& rDeckLayoutTrigger,
43 const std::function<Context()>& rContextAccess,
44 const css::uno::Reference<css::frame::XFrame>& rxFrame);
46 virtual ~Panel();
47 virtual void dispose() override;
49 PanelTitleBar* GetTitleBar() const;
50 bool IsTitleBarOptional() const { return mbIsTitleBarOptional;}
51 void SetUIElement (const css::uno::Reference<css::ui::XUIElement>& rxElement);
52 const css::uno::Reference<css::ui::XSidebarPanel>& GetPanelComponent() const { return mxPanelComponent;}
53 css::uno::Reference<css::awt::XWindow> GetElementWindow();
54 void SetExpanded (const bool bIsExpanded);
55 bool IsExpanded() const { return mbIsExpanded;}
56 bool HasIdPredicate (const OUString& rsId) const;
57 const OUString& GetId() const { return msPanelId;}
59 virtual void Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) override;
60 virtual void Resize() override;
61 virtual void DataChanged (const DataChangedEvent& rEvent) override;
62 virtual void Activate() override;
63 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
65 private:
66 const OUString msPanelId;
67 VclPtr<PanelTitleBar> mpTitleBar;
68 const bool mbIsTitleBarOptional;
69 css::uno::Reference<css::ui::XUIElement> mxElement;
70 css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
71 bool mbIsExpanded;
72 const std::function<void()> maDeckLayoutTrigger;
73 const std::function<Context()> maContextAccess;
75 const css::uno::Reference<css::frame::XFrame>& mxFrame;
78 typedef std::vector<VclPtr<Panel> > SharedPanelContainer;
80 } } // end of namespace sfx2::sidebar
82 #endif
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */