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 <sfx2/dllapi.h>
23 #include <cppuhelper/compbase.hxx>
24 #include <cppuhelper/basemutex.hxx>
26 #include <com/sun/star/ui/XContextChangeEventListener.hpp>
27 #include <com/sun/star/ui/XUIElement.hpp>
28 #include <com/sun/star/ui/XToolPanel.hpp>
29 #include <com/sun/star/ui/XSidebarPanel.hpp>
30 #include <com/sun/star/ui/XUpdateModel.hpp>
34 namespace sfx2::sidebar
{
38 typedef cppu::WeakComponentImplHelper
<css::ui::XContextChangeEventListener
,
41 css::ui::XSidebarPanel
,
42 css::ui::XUpdateModel
>
43 SidebarPanelBaseInterfaceBase
;
45 /** Base class for sidebar panels that provides some convenience
48 class SFX2_DLLPUBLIC SidebarPanelBase final
: private ::cppu::BaseMutex
,
49 public SidebarPanelBaseInterfaceBase
52 static css::uno::Reference
<css::ui::XUIElement
> Create(const OUString
& rsResourceURL
,
53 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
,
54 std::unique_ptr
<PanelLayout
> xControl
,
55 const css::ui::LayoutSize
& rLayoutSize
);
57 // XContextChangeEventListener
58 virtual void SAL_CALL
notifyContextChangeEvent (const css::ui::ContextChangeEventObject
& rEvent
) override
;
61 virtual void SAL_CALL
disposing (const css::lang::EventObject
& rEvent
) override
;
64 virtual css::uno::Reference
<css::frame::XFrame
> SAL_CALL
getFrame() override
;
65 virtual OUString SAL_CALL
getResourceURL() override
;
66 virtual sal_Int16 SAL_CALL
getType() override
;
67 virtual css::uno::Reference
<css::uno::XInterface
> SAL_CALL
getRealInterface() override
;
70 virtual css::uno::Reference
<css::accessibility::XAccessible
> SAL_CALL
createAccessible(
71 const css::uno::Reference
<css::accessibility::XAccessible
>& rxParentAccessible
) override
;
72 virtual css::uno::Reference
<css::awt::XWindow
> SAL_CALL
getWindow() override
;
75 virtual css::ui::LayoutSize SAL_CALL
getHeightForWidth(sal_Int32 nWidth
) override
;
76 virtual sal_Int32 SAL_CALL
getMinimalWidth() override
;
79 virtual void SAL_CALL
updateModel(const css::uno::Reference
<css::frame::XModel
>& xModel
) override
;
81 void SetParentPanel(sfx2::sidebar::Panel
* pPanel
);
84 SidebarPanelBase(const OUString
& rsResourceURL
, const css::uno::Reference
<css::frame::XFrame
>& rxFrame
,
85 std::unique_ptr
<PanelLayout
> xControl
, const css::ui::LayoutSize
& rLayoutSize
);
86 virtual ~SidebarPanelBase() override
;
87 SidebarPanelBase(const SidebarPanelBase
&) = delete;
88 SidebarPanelBase
& operator=( const SidebarPanelBase
& ) = delete;
90 virtual void SAL_CALL
disposing() override
;
92 css::uno::Reference
<css::frame::XFrame
> mxFrame
;
93 std::unique_ptr
<PanelLayout
> mxControl
;
94 const OUString msResourceURL
;
95 const css::ui::LayoutSize maLayoutSize
;
98 } // end of namespace sfx2::sidebar
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */