1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 */ 9 10 #ifndef INCLUDED_SFX2_WELDUTILS_HXX 11 #define INCLUDED_SFX2_WELDUTILS_HXX 12 13 #include <com/sun/star/frame/XFrame.hpp> 14 #include <com/sun/star/frame/XToolbarController.hpp> 15 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> 21 22 #include <map> 23 24 namespace weld 25 { 26 class Builder; 27 class Toolbar; 28 } 29 30 class SFX2_DLLPUBLIC ToolbarUnoDispatcher 31 { 32 private: 33 css::uno::Reference<css::frame::XFrame> m_xFrame; 34 SvtMiscOptions m_aToolbarOptions; 35 weld::Toolbar* m_pToolbar; 36 weld::Builder* m_pBuilder; 37 bool m_bSideBar; 38 39 DECL_LINK(SelectHdl, const OString&, void); 40 DECL_LINK(ToggleMenuHdl, const OString&, void); 41 DECL_LINK(ChangedIconSizeHandler, LinkParamNone*, void); 42 43 void CreateController(const OUString& rCommand); 44 vcl::ImageType GetIconSize() const; 45 46 typedef std::map<OUString, css::uno::Reference<css::frame::XToolbarController>> 47 ControllerContainer; 48 ControllerContainer maControllers; 49 50 public: 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); 55 56 css::uno::Reference<css::frame::XToolbarController> 57 GetControllerForCommand(const OUString& rCommand) const; 58 59 void dispose(); 60 ~ToolbarUnoDispatcher(); 61 }; 62 63 #endif 64 65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 66