tdf#130857 qt weld: Support "Java Start Parameters" dialog
[LibreOffice.git] / include / sfx2 / sidebar / SidebarPanelBase.hxx
blobc1c99cd24a1906d5a6b05ec6f3da41990907dc06
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 #pragma once
21 #include <sal/config.h>
23 #include <memory>
25 #include <sfx2/dllapi.h>
27 #include <comphelper/compbase.hxx>
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>
35 class PanelLayout;
37 namespace sfx2::sidebar {
39 class Panel;
41 typedef comphelper::WeakComponentImplHelper<css::ui::XContextChangeEventListener,
42 css::ui::XUIElement,
43 css::ui::XToolPanel,
44 css::ui::XSidebarPanel,
45 css::ui::XUpdateModel>
46 SidebarPanelBaseInterfaceBase;
48 /** Base class for sidebar panels that provides some convenience
49 functionality.
51 class SFX2_DLLPUBLIC SidebarPanelBase final : public SidebarPanelBaseInterfaceBase
53 public:
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);
59 // XContextChangeEventListener
60 virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) override;
62 // XEventListener
63 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override;
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;
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;
76 // XSidebarPanel
77 virtual css::ui::LayoutSize SAL_CALL getHeightForWidth(sal_Int32 nWidth) override;
78 virtual sal_Int32 SAL_CALL getMinimalWidth() override;
80 // XUpdateModel
81 virtual void SAL_CALL updateModel(const css::uno::Reference<css::frame::XModel>& xModel) override;
83 void SetParentPanel(sfx2::sidebar::Panel* pPanel);
85 private:
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;
89 SidebarPanelBase(const SidebarPanelBase&) = delete;
90 SidebarPanelBase& operator=( const SidebarPanelBase& ) = delete;
92 virtual void disposing(std::unique_lock<std::mutex>&) override;
94 css::uno::Reference<css::frame::XFrame> mxFrame;
95 std::unique_ptr<PanelLayout> mxControl;
96 const OUString msResourceURL;
97 const css::ui::LayoutSize maLayoutSize;
100 } // end of namespace sfx2::sidebar
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */