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/.
10 #ifndef INCLUDED_SFX2_WELDUTILS_HXX
11 #define INCLUDED_SFX2_WELDUTILS_HXX
13 #include <com/sun/star/frame/XFrame.hpp>
14 #include <com/sun/star/frame/XToolbarController.hpp>
16 #include <com/sun/star/uno/Reference.hxx>
17 #include <tools/link.hxx>
18 #include <sfx2/dllapi.h>
19 #include <svtools/miscopt.hxx>
20 #include <vcl/weld.hxx>
30 class SFX2_DLLPUBLIC ToolbarUnoDispatcher
33 css::uno::Reference
<css::frame::XFrame
> m_xFrame
;
34 css::uno::Reference
<css::lang::XComponent
> m_xImageController
;
35 SvtMiscOptions m_aToolbarOptions
;
36 weld::Toolbar
* m_pToolbar
;
37 weld::Builder
* m_pBuilder
;
40 DECL_DLLPRIVATE_LINK(SelectHdl
, const OUString
&, void);
41 DECL_DLLPRIVATE_LINK(ToggleMenuHdl
, const OUString
&, void);
42 DECL_DLLPRIVATE_LINK(ChangedIconSizeHandler
, LinkParamNone
*, void);
44 void CreateController(const OUString
& rCommand
);
45 static vcl::ImageType
GetIconSize();
47 typedef std::map
<OUString
, css::uno::Reference
<css::frame::XToolbarController
>>
49 ControllerContainer maControllers
;
52 // fill in the label and icons for actions and dispatch the action on item click
53 ToolbarUnoDispatcher(weld::Toolbar
& rToolbar
, weld::Builder
& rBuilder
,
54 const css::uno::Reference
<css::frame::XFrame
>& rFrame
,
55 bool bSideBar
= true);
57 css::uno::Reference
<css::frame::XToolbarController
>
58 GetControllerForCommand(const OUString
& rCommand
) const;
60 const css::uno::Reference
<css::frame::XFrame
>& GetFrame() const { return m_xFrame
; }
63 ~ToolbarUnoDispatcher();
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */