LibreOffice Module sfx2 (master) 1
SidebarPanelBase.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 <sal/config.h>
22
23#include <memory>
24
25#include <sfx2/dllapi.h>
26
28
29#include <com/sun/star/ui/XContextChangeEventListener.hpp>
30#include <com/sun/star/ui/XUIElement.hpp>
31#include <com/sun/star/ui/XToolPanel.hpp>
32#include <com/sun/star/ui/XSidebarPanel.hpp>
33#include <com/sun/star/ui/XUpdateModel.hpp>
34
35class PanelLayout;
36
37namespace sfx2::sidebar {
38
39class Panel;
40
41typedef comphelper::WeakComponentImplHelper<css::ui::XContextChangeEventListener,
42 css::ui::XUIElement,
43 css::ui::XToolPanel,
44 css::ui::XSidebarPanel,
45 css::ui::XUpdateModel>
47
52{
53public:
54 static css::uno::Reference<css::ui::XUIElement> Create(const OUString& rsResourceURL,
55 const css::uno::Reference<css::frame::XFrame>& rxFrame,
56 std::unique_ptr<PanelLayout> xControl,
57 const css::ui::LayoutSize& rLayoutSize);
58
59 // XContextChangeEventListener
60 virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) override;
61
62 // XEventListener
63 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override;
64
65 // XUIElement
66 virtual css::uno::Reference<css::frame::XFrame> SAL_CALL getFrame() override;
67 virtual OUString SAL_CALL getResourceURL() override;
68 virtual sal_Int16 SAL_CALL getType() override;
69 virtual css::uno::Reference<css::uno::XInterface> SAL_CALL getRealInterface() override;
70
71 // XToolPanel
72 virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL createAccessible(
73 const css::uno::Reference<css::accessibility::XAccessible>& rxParentAccessible) override;
74 virtual css::uno::Reference<css::awt::XWindow> SAL_CALL getWindow() override;
75
76 // XSidebarPanel
77 virtual css::ui::LayoutSize SAL_CALL getHeightForWidth(sal_Int32 nWidth) override;
78 virtual sal_Int32 SAL_CALL getMinimalWidth() override;
79
80 // XUpdateModel
81 virtual void SAL_CALL updateModel(const css::uno::Reference<css::frame::XModel>& xModel) override;
82
83 void SetParentPanel(sfx2::sidebar::Panel* pPanel);
84
85private:
86 SidebarPanelBase(OUString sResourceURL, css::uno::Reference<css::frame::XFrame> xFrame,
87 std::unique_ptr<PanelLayout> xControl, const css::ui::LayoutSize& rLayoutSize);
88 virtual ~SidebarPanelBase() override;
91
92 virtual void disposing(std::unique_lock<std::mutex>&) override;
93
94 css::uno::Reference<css::frame::XFrame> mxFrame;
95 std::unique_ptr<PanelLayout> mxControl;
96 const OUString msResourceURL;
97 const css::ui::LayoutSize maLayoutSize;
98};
99
100} // end of namespace sfx2::sidebar
101
102/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class is the base for the Widget Layout-based sidebar panels.
Definition: PanelLayout.hxx:22
Multiple panels form a single deck.
Definition: Panel.hxx:54
Base class for sidebar panels that provides some convenience functionality.
SidebarPanelBase(const SidebarPanelBase &)=delete
const css::ui::LayoutSize maLayoutSize
css::uno::Reference< css::frame::XFrame > mxFrame
SidebarPanelBase & operator=(const SidebarPanelBase &)=delete
std::unique_ptr< PanelLayout > mxControl
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
comphelper::WeakComponentImplHelper< css::ui::XContextChangeEventListener, css::ui::XUIElement, css::ui::XToolPanel, css::ui::XSidebarPanel, css::ui::XUpdateModel > SidebarPanelBaseInterfaceBase
bool getType(BSTR name, Type &type)
Reference< XFrame > xFrame
Reference< XModel > xModel