Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/source/app/customweld.cxx
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
#include <comphelper/OAccessible.hxx>
11
#include <vcl/weld/customweld.hxx>
12
#include <vcl/weld/Builder.hxx>
13
14
namespace weld
15
{
16
0
CustomWidgetController::~CustomWidgetController() {}
17
18
IMPL_LINK_NOARG(CustomWidgetController, DragBeginHdl, weld::DrawingArea&, bool)
19
0
{
20
0
    return StartDrag();
21
0
}
22
23
CustomWeld::CustomWeld(weld::Builder& rBuilder, const OUString& rDrawingId,
24
                       CustomWidgetController& rWidgetController)
25
0
    : m_rWidgetController(rWidgetController)
26
0
    , m_xDrawingArea(rBuilder.weld_drawing_area(rDrawingId, rWidgetController.CreateAccessible(),
27
0
                                                rWidgetController.GetUITestFactory(),
28
0
                                                &rWidgetController))
29
0
{
30
0
    m_rWidgetController.SetDrawingArea(m_xDrawingArea.get());
31
0
    m_xDrawingArea->connect_size_allocate(LINK(this, CustomWeld, DoResize));
32
0
    m_xDrawingArea->connect_draw(LINK(this, CustomWeld, DoPaint));
33
0
    m_xDrawingArea->connect_mouse_press(LINK(this, CustomWeld, DoMouseButtonDown));
34
0
    m_xDrawingArea->connect_mouse_move(LINK(this, CustomWeld, DoMouseMove));
35
0
    m_xDrawingArea->connect_mouse_release(LINK(this, CustomWeld, DoMouseButtonUp));
36
0
    m_xDrawingArea->connect_focus_in(LINK(this, CustomWeld, DoGetFocus));
37
0
    m_xDrawingArea->connect_focus_out(LINK(this, CustomWeld, DoLoseFocus));
38
0
    m_xDrawingArea->connect_key_press(LINK(this, CustomWeld, DoKeyPress));
39
    // tdf#143909 if we accept input, then we need to listen for key releases as well
40
    // so that they are forwarded to any potential input methods that activated on
41
    // key press.
42
0
    m_xDrawingArea->connect_key_release(LINK(this, CustomWeld, DoKeyRelease));
43
0
    m_xDrawingArea->connect_focus_rect(LINK(this, CustomWeld, DoFocusRect));
44
0
    m_xDrawingArea->connect_style_updated(LINK(this, CustomWeld, DoStyleUpdated));
45
0
    m_xDrawingArea->connect_command(LINK(this, CustomWeld, DoCommand));
46
0
    m_xDrawingArea->connect_query_tooltip(LINK(this, CustomWeld, DoRequestHelp));
47
0
    m_xDrawingArea->connect_im_context_get_surrounding(LINK(this, CustomWeld, DoGetSurrounding));
48
0
    m_xDrawingArea->connect_im_context_delete_surrounding(
49
0
        LINK(this, CustomWeld, DoDeleteSurrounding));
50
0
}
51
52
IMPL_LINK(CustomWeld, DoResize, const Size&, rSize, void)
53
0
{
54
0
    m_rWidgetController.SetOutputSizePixel(rSize);
55
0
    m_rWidgetController.Resize();
56
0
}
57
58
IMPL_LINK(CustomWeld, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
59
0
{
60
0
    m_rWidgetController.Paint(aPayload.first, aPayload.second);
61
0
}
62
63
IMPL_LINK(CustomWeld, DoMouseButtonDown, const MouseEvent&, rMEvt, bool)
64
0
{
65
0
    return m_rWidgetController.MouseButtonDown(rMEvt);
66
0
}
67
68
IMPL_LINK(CustomWeld, DoMouseMove, const MouseEvent&, rMEvt, bool)
69
0
{
70
0
    return m_rWidgetController.MouseMove(rMEvt);
71
0
}
72
73
IMPL_LINK(CustomWeld, DoMouseButtonUp, const MouseEvent&, rMEvt, bool)
74
0
{
75
0
    return m_rWidgetController.MouseButtonUp(rMEvt);
76
0
}
77
78
0
IMPL_LINK_NOARG(CustomWeld, DoGetFocus, weld::Widget&, void) { m_rWidgetController.GetFocus(); }
79
80
0
IMPL_LINK_NOARG(CustomWeld, DoLoseFocus, weld::Widget&, void) { m_rWidgetController.LoseFocus(); }
81
82
IMPL_LINK(CustomWeld, DoKeyPress, const KeyEvent&, rKEvt, bool)
83
0
{
84
0
    return m_rWidgetController.KeyInput(rKEvt);
85
0
}
86
87
IMPL_LINK(CustomWeld, DoKeyRelease, const KeyEvent&, rKEvt, bool)
88
0
{
89
0
    return m_rWidgetController.KeyUp(rKEvt);
90
0
}
91
92
IMPL_LINK_NOARG(CustomWeld, DoFocusRect, weld::Widget&, tools::Rectangle)
93
0
{
94
0
    return m_rWidgetController.GetFocusRect();
95
0
}
96
97
IMPL_LINK_NOARG(CustomWeld, DoStyleUpdated, weld::Widget&, void)
98
0
{
99
0
    m_rWidgetController.StyleUpdated();
100
0
}
101
102
IMPL_LINK(CustomWeld, DoCommand, const CommandEvent&, rPos, bool)
103
0
{
104
0
    return m_rWidgetController.Command(rPos);
105
0
}
106
107
IMPL_LINK(CustomWeld, DoRequestHelp, tools::Rectangle&, rHelpArea, OUString)
108
0
{
109
0
    return m_rWidgetController.RequestHelp(rHelpArea);
110
0
}
111
112
IMPL_LINK(CustomWeld, DoGetSurrounding, OUString&, rSurrounding, int)
113
0
{
114
0
    return m_rWidgetController.GetSurroundingText(rSurrounding);
115
0
}
116
117
IMPL_LINK(CustomWeld, DoDeleteSurrounding, const Selection&, rSelection, bool)
118
0
{
119
0
    return m_rWidgetController.DeleteSurroundingText(rSelection);
120
0
}
121
}
122
123
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */