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 <sal/config.h>
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>
37 namespace sfx2::sidebar
{
41 typedef comphelper::WeakComponentImplHelper
<css::ui::XContextChangeEventListener
,
44 css::ui::XSidebarPanel
,
45 css::ui::XUpdateModel
>
46 SidebarPanelBaseInterfaceBase
;
48 /** Base class for sidebar panels that provides some convenience
51 class SFX2_DLLPUBLIC SidebarPanelBase final
: public SidebarPanelBaseInterfaceBase
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
;
63 virtual void SAL_CALL
disposing (const css::lang::EventObject
& rEvent
) override
;
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
;
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
;
77 virtual css::ui::LayoutSize SAL_CALL
getHeightForWidth(sal_Int32 nWidth
) override
;
78 virtual sal_Int32 SAL_CALL
getMinimalWidth() override
;
81 virtual void SAL_CALL
updateModel(const css::uno::Reference
<css::frame::XModel
>& xModel
) override
;
83 void SetParentPanel(sfx2::sidebar::Panel
* pPanel
);
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: */