Coverage Report

Created: 2025-11-16 09:57

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