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 SvtMiscOptions m_aToolbarOptions
;
35 weld::Toolbar
* m_pToolbar
;
36 weld::Builder
* m_pBuilder
;
39 DECL_DLLPRIVATE_LINK(SelectHdl
, const OString
&, void);
40 DECL_DLLPRIVATE_LINK(ToggleMenuHdl
, const OString
&, void);
41 DECL_DLLPRIVATE_LINK(ChangedIconSizeHandler
, LinkParamNone
*, void);
43 void CreateController(const OUString
& rCommand
);
44 static vcl::ImageType
GetIconSize();
46 typedef std::map
<OUString
, css::uno::Reference
<css::frame::XToolbarController
>>
48 ControllerContainer maControllers
;
51 // fill in the label and icons for actions and dispatch the action on item click
52 ToolbarUnoDispatcher(weld::Toolbar
& rToolbar
, weld::Builder
& rBuilder
,
53 const css::uno::Reference
<css::frame::XFrame
>& rFrame
,
54 bool bSideBar
= true);
56 css::uno::Reference
<css::frame::XToolbarController
>
57 GetControllerForCommand(const OUString
& rCommand
) const;
59 css::uno::Reference
<css::frame::XFrame
> GetFrame() const { return m_xFrame
; }
62 ~ToolbarUnoDispatcher();
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */