Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/sfx2/weldutils.hxx
Line
Count
Source
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/XToolbarController.hpp>
14
15
#include <com/sun/star/uno/Reference.hxx>
16
#include <tools/link.hxx>
17
#include <sfx2/dllapi.h>
18
#include <svtools/miscopt.hxx>
19
20
#include <map>
21
22
namespace com::sun::star::frame
23
{
24
class XFrame;
25
}
26
namespace vcl
27
{
28
enum class ImageType;
29
}
30
31
namespace weld
32
{
33
class Builder;
34
class Toolbar;
35
}
36
37
class SFX2_DLLPUBLIC ToolbarUnoDispatcher
38
{
39
private:
40
    css::uno::Reference<css::frame::XFrame> m_xFrame;
41
    css::uno::Reference<css::lang::XComponent> m_xImageController;
42
    SvtMiscOptions m_aToolbarOptions;
43
    weld::Toolbar* m_pToolbar;
44
    weld::Builder* m_pBuilder;
45
    bool m_bSideBar;
46
47
    DECL_LINK(SelectHdl, const OUString&, void);
48
    DECL_DLLPRIVATE_LINK(ToggleMenuHdl, const OUString&, void);
49
    DECL_DLLPRIVATE_LINK(ChangedIconSizeHandler, LinkParamNone*, void);
50
51
    void CreateController(const OUString& rCommand);
52
    static vcl::ImageType GetIconSize();
53
54
    typedef std::map<OUString, css::uno::Reference<css::frame::XToolbarController>>
55
        ControllerContainer;
56
    ControllerContainer maControllers;
57
58
public:
59
    // fill in the label and icons for actions and dispatch the action on item click
60
    ToolbarUnoDispatcher(weld::Toolbar& rToolbar, weld::Builder& rBuilder,
61
                         const css::uno::Reference<css::frame::XFrame>& rFrame,
62
                         bool bSideBar = true);
63
64
    css::uno::Reference<css::frame::XToolbarController>
65
    GetControllerForCommand(const OUString& rCommand) const;
66
67
0
    const css::uno::Reference<css::frame::XFrame>& GetFrame() const { return m_xFrame; }
68
69
    void dispose();
70
    ~ToolbarUnoDispatcher();
71
};
72
73
#endif
74
75
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */