/src/libreoffice/include/vcl/weld/DrawingArea.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ |
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 | | #pragma once |
11 | | |
12 | | #include <vcl/dllapi.h> |
13 | | #include <vcl/weld/Widget.hxx> |
14 | | |
15 | | #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> |
16 | | |
17 | | class InputContext; |
18 | | class OutputDevice; |
19 | | enum class PointerStyle; |
20 | | |
21 | | using a11yrelationset = css::uno::Reference<css::accessibility::XAccessibleRelationSet>; |
22 | | |
23 | | namespace comphelper |
24 | | { |
25 | | class OAccessible; |
26 | | } |
27 | | |
28 | | namespace rtl |
29 | | { |
30 | | template <class reference_type> class Reference; |
31 | | } |
32 | | |
33 | | namespace vcl |
34 | | { |
35 | | typedef OutputDevice RenderContext; |
36 | | } |
37 | | |
38 | | namespace weld |
39 | | { |
40 | | class VCL_DLLPUBLIC DrawingArea : virtual public Widget |
41 | | { |
42 | | public: |
43 | | typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> draw_args; |
44 | | |
45 | | protected: |
46 | | Link<draw_args, void> m_aDrawHdl; |
47 | | Link<Widget&, tools::Rectangle> m_aGetFocusRectHdl; |
48 | | Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl; |
49 | | // if handler returns true, drag is disallowed |
50 | | Link<DrawingArea&, bool> m_aDragBeginHdl; |
51 | | // return position of cursor, fill OUString& with surrounding text |
52 | | Link<OUString&, int> m_aGetSurroundingHdl; |
53 | | // attempt to delete the range, return true if successful |
54 | | Link<const Selection&, bool> m_aDeleteSurroundingHdl; |
55 | | |
56 | | OUString signal_query_tooltip(tools::Rectangle& rHelpArea) |
57 | 0 | { |
58 | 0 | return m_aQueryTooltipHdl.Call(rHelpArea); |
59 | 0 | } |
60 | | |
61 | | int signal_im_context_get_surrounding(OUString& rSurroundingText) |
62 | 0 | { |
63 | 0 | if (!m_aGetSurroundingHdl.IsSet()) |
64 | 0 | return -1; |
65 | 0 | return m_aGetSurroundingHdl.Call(rSurroundingText); |
66 | 0 | } |
67 | | |
68 | | bool signal_im_context_delete_surrounding(const Selection& rRange) |
69 | 0 | { |
70 | 0 | return m_aDeleteSurroundingHdl.Call(rRange); |
71 | 0 | } |
72 | | |
73 | | public: |
74 | 0 | void connect_draw(const Link<draw_args, void>& rLink) { m_aDrawHdl = rLink; } |
75 | | void connect_focus_rect(const Link<Widget&, tools::Rectangle>& rLink) |
76 | 0 | { |
77 | 0 | m_aGetFocusRectHdl = rLink; |
78 | 0 | } |
79 | | void connect_query_tooltip(const Link<tools::Rectangle&, OUString>& rLink) |
80 | 0 | { |
81 | 0 | m_aQueryTooltipHdl = rLink; |
82 | 0 | } |
83 | 0 | void connect_drag_begin(const Link<DrawingArea&, bool>& rLink) { m_aDragBeginHdl = rLink; } |
84 | | void connect_im_context_get_surrounding(const Link<OUString&, int>& rLink) |
85 | 0 | { |
86 | 0 | m_aGetSurroundingHdl = rLink; |
87 | 0 | } |
88 | | void connect_im_context_delete_surrounding(const Link<const Selection&, bool>& rLink) |
89 | 0 | { |
90 | 0 | m_aDeleteSurroundingHdl = rLink; |
91 | 0 | } |
92 | | virtual void queue_draw() = 0; |
93 | | virtual void queue_draw_area(int x, int y, int width, int height) = 0; |
94 | | |
95 | | virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rTransferable, |
96 | | sal_uInt8 eDNDConstants) |
97 | | = 0; |
98 | | |
99 | | virtual void set_cursor(PointerStyle ePointerStyle) = 0; |
100 | | |
101 | | virtual Point get_pointer_position() const = 0; |
102 | | |
103 | | virtual void set_input_context(const InputContext& rInputContext) = 0; |
104 | | virtual void im_context_set_cursor_location(const tools::Rectangle& rCursorRect, |
105 | | int nExtTextInputWidth) |
106 | | = 0; |
107 | | |
108 | | // use return here just to generate matching VirtualDevices |
109 | | virtual OutputDevice& get_ref_device() = 0; |
110 | | |
111 | | virtual rtl::Reference<comphelper::OAccessible> get_accessible_parent() = 0; |
112 | | virtual a11yrelationset get_accessible_relation_set() = 0; |
113 | | virtual AbsoluteScreenPixelPoint get_accessible_location_on_screen() = 0; |
114 | | }; |
115 | | } |
116 | | |
117 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |