Branch libreoffice-5-0-4
[LibreOffice.git] / sfx2 / source / sidebar / Panel.hxx
blob52e6e49018cfd9a73193bc38000dd8e05f55517d
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 "Context.hxx"
23 #include <vcl/window.hxx>
25 #include <com/sun/star/ui/XUIElement.hpp>
26 #include <com/sun/star/ui/XSidebarPanel.hpp>
28 #include <boost/scoped_ptr.hpp>
29 #include <boost/shared_ptr.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 virtual ~Panel();
45 virtual void dispose() SAL_OVERRIDE;
47 PanelTitleBar* GetTitleBar() const;
48 bool IsTitleBarOptional() const { return mbIsTitleBarOptional;}
49 void SetUIElement (const css::uno::Reference<css::ui::XUIElement>& rxElement);
50 css::uno::Reference<css::ui::XSidebarPanel> GetPanelComponent() const { return mxPanelComponent;}
51 css::uno::Reference<css::awt::XWindow> GetElementWindow();
52 void SetExpanded (const bool bIsExpanded);
53 bool IsExpanded() const { return mbIsExpanded;}
54 bool HasIdPredicate (const OUString& rsId) const;
55 const OUString& GetId() const { return msPanelId;}
57 virtual void Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE;
58 virtual void Resize() SAL_OVERRIDE;
59 virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE;
60 virtual void Activate() SAL_OVERRIDE;
61 virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
63 private:
64 const OUString msPanelId;
65 VclPtr<PanelTitleBar> mpTitleBar;
66 const bool mbIsTitleBarOptional;
67 css::uno::Reference<css::ui::XUIElement> mxElement;
68 css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
69 bool mbIsExpanded;
70 const std::function<void()> maDeckLayoutTrigger;
71 const std::function<Context()> maContextAccess;
73 typedef std::vector<VclPtr<Panel> > SharedPanelContainer;
75 } } // end of namespace sfx2::sidebar
77 #endif
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */