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/.
12 #include <vcl/syswin.hxx>
13 #include <vcl/ctrl.hxx>
14 #include <vcl/notebookbar/NotebookBarAddonsMerger.hxx>
15 #include <vcl/settings.hxx>
19 namespace com::sun::star::ui
{ class XContextChangeEventListener
; }
21 class NotebookBarContextChangeEventListener
;
22 class NotebookbarContextControl
;
26 /// This implements Widget Layout-based notebook-like menu bar.
27 class VCL_DLLPUBLIC NotebookBar final
: public Control
, public VclBuilderContainer
29 friend class NotebookBarContextChangeEventListener
;
31 NotebookBar(Window
* pParent
, const OUString
& rID
, const OUString
& rUIXMLDescription
,
32 const css::uno::Reference
<css::frame::XFrame
>& rFrame
,
33 const NotebookBarAddonsItem
& aNotebookBarAddonsItem
);
34 virtual ~NotebookBar() override
;
35 virtual void dispose() override
;
37 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
38 virtual Size
GetOptimalSize() const override
;
39 virtual void setPosSizePixel(tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
, PosSizeFlags nFlags
= PosSizeFlags::All
) override
;
40 virtual void Resize() override
;
42 void SetSystemWindow(SystemWindow
* pSystemWindow
);
44 void StateChanged(const StateChangedType nStateChange
) override
;
46 void DataChanged(const DataChangedEvent
& rDCEvt
) override
;
48 void SetupListener(bool bListen
);
50 bool IsWelded() const { return m_bIsWelded
; }
51 VclPtr
<vcl::Window
>& GetMainContainer() { return m_xVclContentArea
; }
52 const OUString
& GetUIFilePath() const { return m_sUIXMLDescription
; }
53 void SetDisposeCallback(const Link
<const SfxViewShell
*, void> rDisposeCallback
, const SfxViewShell
* pViewShell
);
56 VclPtr
<SystemWindow
> m_pSystemWindow
;
57 rtl::Reference
<NotebookBarContextChangeEventListener
> m_pEventListener
;
58 std::vector
<NotebookbarContextControl
*> m_pContextContainers
;
59 const SfxViewShell
* m_pViewShell
;
61 VclPtr
<vcl::Window
> m_xVclContentArea
;
63 OUString m_sUIXMLDescription
;
64 Link
<const SfxViewShell
*, void> m_rDisposeLink
;
66 AllSettings DefaultSettings
;
67 AllSettings PersonaSettings
;
69 void UpdateBackground();
71 void UpdateDefaultSettings();
72 void UpdatePersonaSettings();
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */