LibreOffice Module vcl (master) 1
commandevent.hxx
Go to the documentation of this file.
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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_VCL_COMMANDEVENT_HXX
21#define INCLUDED_VCL_COMMANDEVENT_HXX
22
23#include <memory>
24#include <tools/gen.hxx>
25#include <tools/solar.h>
26#include <vcl/dllapi.h>
27#include <vcl/keycodes.hxx>
29#include <rtl/ustring.hxx>
33
46
47enum class CommandEventId;
48
49enum class ExtTextInputAttr {
50 NONE = 0x0000,
51 GrayWaveline = 0x0010,
52 Underline = 0x0020,
53 BoldUnderline = 0x0040,
54 DottedUnderline = 0x0080,
55 DashDotUnderline = 0x0100,
56 DoubleUnderline = 0x0200,
57 Highlight = 0x0400,
58 RedText = 0x0800,
59 HalfToneText = 0x1000
60};
61namespace o3tl
62{
63 template<> struct typed_flags<ExtTextInputAttr> : is_typed_flags<ExtTextInputAttr, 0x1ff0> {};
64}
65
66#define EXTTEXTINPUT_CURSOR_INVISIBLE (sal_uInt16(0x0001))
67#define EXTTEXTINPUT_CURSOR_OVERWRITE (sal_uInt16(0x0002))
68
69
71{
72private:
74 void* mpData;
77
78public:
80 CommandEvent( const Point& rMousePos, CommandEventId nCmd,
81 bool bMEvt = false, const void* pCmdData = nullptr );
82
84 const Point& GetMousePosPixel() const { return maPos; }
85 bool IsMouseEvent() const { return mbMouseEvent; }
86 void* GetEventData() const { return mpData; }
87
88 const CommandExtTextInputData* GetExtTextInputData() const;
89 const CommandWheelData* GetWheelData() const;
90 const CommandScrollData* GetAutoScrollData() const;
91 const CommandModKeyData* GetModKeyData() const;
92 const CommandDialogData* GetDialogData() const;
93 CommandMediaData* GetMediaData() const;
94 const CommandSelectionChangeData* GetSelectionChangeData() const;
95 const CommandGestureSwipeData* GetGestureSwipeData() const;
96 const CommandGestureLongPressData* GetLongPressData() const;
97 const CommandGesturePanData* GetGesturePanData() const;
98 const CommandGestureZoomData* GetGestureZoomData() const;
99 const CommandGestureRotateData* GetGestureRotateData() const;
100};
101
103{
104private:
105 OUString maText;
106 std::unique_ptr<ExtTextInputAttr[]> mpTextAttr;
107 sal_Int32 mnCursorPos;
108 sal_uInt16 mnCursorFlags;
110
111public:
112 CommandExtTextInputData( OUString aText,
113 const ExtTextInputAttr* pTextAttr,
114 sal_Int32 nCursorPos,
115 sal_uInt16 nCursorFlags,
116 bool bOnlyCursor );
119
120 const OUString& GetText() const { return maText; }
121 const ExtTextInputAttr* GetTextAttr() const { return mpTextAttr.get(); }
122
123 sal_Int32 GetCursorPos() const { return mnCursorPos; }
124 bool IsCursorVisible() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_INVISIBLE) == 0; }
125 bool IsCursorOverwrite() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_OVERWRITE) != 0; }
126 bool IsOnlyCursorChanged() const { return mbOnlyCursor; }
127};
128
130{
131};
132
134{
135 NONE = 0,
136 SCROLL = 1,
137 ZOOM = 2,
138 DATAZOOM = 3
139};
140
141// Magic value used in mnLines field in CommandWheelData
142#define COMMAND_WHEEL_PAGESCROLL (sal_uLong(0xFFFFFFFF))
143
145{
146private:
149 double mnLines;
151 sal_uInt16 mnCode;
152 bool mbHorz;
154
155public:
157 CommandWheelData( tools::Long nWheelDelta, tools::Long nWheelNotchDelta,
158 double nScrollLines,
159 CommandWheelMode nWheelMode, sal_uInt16 nKeyModifier,
160 bool bHorz, bool bDeltaIsPixel = false );
161
162 tools::Long GetDelta() const { return mnDelta; }
163 tools::Long GetNotchDelta() const { return mnNotchDelta; }
164 double GetScrollLines() const { return mnLines; }
165 bool IsHorz() const { return mbHorz; }
166 bool IsDeltaPixel() const { return mbDeltaIsPixel; }
167
168 CommandWheelMode GetMode() const { return mnWheelMode; }
169
170 sal_uInt16 GetModifier() const
171 { return (mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); }
172 bool IsShift() const
173 { return ((mnCode & KEY_SHIFT) != 0); }
174 bool IsMod1() const
175 { return ((mnCode & KEY_MOD1) != 0); }
176 bool IsMod2() const
177 { return ((mnCode & KEY_MOD2) != 0); }
178};
179
181{
182private:
185
186public:
187 CommandScrollData( tools::Long nDeltaX, tools::Long nDeltaY );
188
189 tools::Long GetDeltaX() const { return mnDeltaX; }
190 tools::Long GetDeltaY() const { return mnDeltaY; }
191};
192
194{
195private:
196 bool mbDown;
198
199public:
200 CommandModKeyData( ModKeyFlags nCode, bool bDown );
201
202 bool IsDown() const { return mbDown; }
203 bool IsMod1() const { return bool(mnCode & ModKeyFlags::Mod1Msk); }
204 bool IsMod2() const { return bool(mnCode & ModKeyFlags::Mod2Msk); }
205 bool IsLeftShift() const { return bool(mnCode & ModKeyFlags::LeftShift); }
206 bool IsRightShift() const { return bool(mnCode & ModKeyFlags::RightShift); }
207};
208
209enum class ShowDialogId
210{
211 Preferences = 1,
212 About = 2,
213};
214
216{
218public:
220 : m_nDialogId( nDialogId )
221 {}
222
223 ShowDialogId GetDialogId() const { return m_nDialogId; }
224};
225
226// Media Commands
227enum class MediaCommand
228{
229 ChannelDown = 1, // Decrement the channel value, for example, for a TV or radio tuner.
230 ChannelUp = 2, // Increment the channel value, for example, for a TV or radio tuner.
231 NextTrack = 3, // Go to next media track/slide.
232 Pause = 4, // Pause. If already paused, take no further action. This is a direct PAUSE command that has no state.
233 Play = 5, // Begin playing at the current position. If already paused, it will resume. This is a direct PLAY command that has no state.
234 PlayPause = 6, // Play or pause playback.
235 PreviousTrack = 7, // Go to previous media track/slide.
236 Record = 8, // Begin recording the current stream.
237 Rewind = 9,// Go backward in a stream at a higher rate of speed.
238 Stop = 10,// Stop playback.
239 MicOnOffToggle = 11,// Toggle the microphone.
240 MicrophoneVolumeDown = 12,// Increase microphone volume.
241 MicrophoneVolumeMute = 13,// Mute the microphone.
242 MicrophoneVolumeUp = 14,// Decrease microphone volume.
243 VolumeDown = 15,// Lower the volume.
244 VolumeMute = 16,// Mute the volume.
245 VolumeUp = 17,// Raise the volume.
246 Menu = 18,// Button Menu pressed.
247 PlayHold = 20,// Button Play (long) pressed.
248 NextTrackHold = 21,// Button Right holding pressed.
249};
250
252{
255public:
257 : m_nMediaId(nMediaId)
258 , m_bPassThroughToOS(true)
259 {
260 }
261 MediaCommand GetMediaId() const { return m_nMediaId; }
262 void SetPassThroughToOS(bool bPassThroughToOS) { m_bPassThroughToOS = bPassThroughToOS; }
263 bool GetPassThroughToOS() const { return m_bPassThroughToOS; }
264};
265
267{
268private:
271
272public:
274
275 sal_uLong GetStart() const { return mnStart; }
276 sal_uLong GetEnd() const { return mnEnd; }
277};
278
280{
282public:
284 : mnVelocityX(0)
285 {
286 }
287 CommandGestureSwipeData(double nVelocityX)
288 : mnVelocityX(nVelocityX)
289 {
290 }
291 double getVelocityX() const { return mnVelocityX; }
292};
293
294
296{
297 double mnX;
298 double mnY;
299public:
301 : mnX(0)
302 , mnY(0)
303 {
304 }
305 CommandGestureLongPressData(double nX, double nY)
306 : mnX(nX)
307 , mnY(nY)
308 {
309 }
310 double getX() const { return mnX; }
311 double getY() const { return mnY; }
312};
313
315{
316public:
317 double const mfX;
318 double const mfY;
319 double const mfOffset;
322
323 CommandGesturePanData(double fX, double fY, GestureEventPanType eEventType, double fOffset,
324 PanningOrientation eOrientation)
325 : mfX(fX)
326 , mfY(fY)
327 , mfOffset(fOffset)
328 , meEventType(eEventType)
329 , meOrientation(eOrientation)
330 {}
331};
332
334{
335public:
336 const double mfX = 0;
337 const double mfY = 0;
339 const double mfScaleDelta = 0;
340
341 CommandGestureZoomData(double fX, double fY, GestureEventZoomType eEventType, double fScale)
342 : mfX(fX)
343 , mfY(fY)
344 , meEventType(eEventType)
345 , mfScaleDelta(fScale)
346 {}
347};
348
350{
351public:
352 const double mfX = 0;
353 const double mfY = 0;
355 const double mfAngleDelta = 0;
356
357 CommandGestureRotateData(double fX, double fY, GestureEventRotateType eEventType,
358 double fAngleDelta)
359 : mfX(fX)
360 , mfY(fY)
361 , meEventType(eEventType)
362 , mfAngleDelta(fAngleDelta)
363 {}
364};
365
367{
368 NONE = 0,
369 ContextMenu = 1,
370 StartDrag = 2,
371 Wheel = 3,
372 StartAutoScroll = 4,
373 AutoScroll = 5,
375 ExtTextInput = 8,
376 EndExtTextInput = 9,
378 CursorPos = 11,
379 PasteSelection = 12,
380 ModKeyChange = 13,
382 ShowDialog = 16,
383 Media = 17,
384 SelectionChange = 18,
387 GestureSwipe = 21,
388 GestureLongPress = 22,
389 GesturePan = 23,
390 GestureZoom = 24,
391 GestureRotate = 25,
392};
393
394#endif // INCLUDED_VCL_COMMANDEVENT_HXX
395
396/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
GestureEventPanType
PanningOrientation
GestureEventRotateType
GestureEventZoomType
Text maText
sal_Int16 mnCommand
ShowDialogId m_nDialogId
CommandDialogData(ShowDialogId nDialogId)
ShowDialogId GetDialogId() const
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
CommandEventId mnCommand
void * GetEventData() const
bool IsMouseEvent() const
sal_Int32 GetCursorPos() const
std::unique_ptr< ExtTextInputAttr[]> mpTextAttr
bool IsOnlyCursorChanged() const
const OUString & GetText() const
bool IsCursorOverwrite() const
const ExtTextInputAttr * GetTextAttr() const
bool IsCursorVisible() const
CommandGestureLongPressData(double nX, double nY)
PanningOrientation const meOrientation
CommandGesturePanData(double fX, double fY, GestureEventPanType eEventType, double fOffset, PanningOrientation eOrientation)
GestureEventPanType const meEventType
CommandGestureRotateData(double fX, double fY, GestureEventRotateType eEventType, double fAngleDelta)
double getVelocityX() const
CommandGestureSwipeData(double nVelocityX)
CommandGestureZoomData(double fX, double fY, GestureEventZoomType eEventType, double fScale)
MediaCommand GetMediaId() const
bool GetPassThroughToOS() const
MediaCommand m_nMediaId
CommandMediaData(MediaCommand nMediaId)
void SetPassThroughToOS(bool bPassThroughToOS)
bool IsRightShift() const
bool IsDown() const
bool IsMod2() const
bool IsMod1() const
ModKeyFlags mnCode
bool IsLeftShift() const
CommandModKeyData(ModKeyFlags nCode, bool bDown)
tools::Long GetDeltaX() const
CommandScrollData(tools::Long nDeltaX, tools::Long nDeltaY)
tools::Long GetDeltaY() const
tools::Long mnDeltaX
tools::Long mnDeltaY
sal_uLong GetStart() const
CommandSelectionChangeData(sal_uLong nStart, sal_uLong nEnd)
sal_uLong GetEnd() const
sal_uInt16 GetModifier() const
bool IsShift() const
tools::Long mnNotchDelta
tools::Long GetNotchDelta() const
tools::Long GetDelta() const
double GetScrollLines() const
CommandWheelMode mnWheelMode
bool IsMod2() const
bool IsDeltaPixel() const
tools::Long mnDelta
bool IsMod1() const
bool IsHorz() const
CommandWheelMode GetMode() const
Definition: menu.hxx:116
ExtTextInputAttr
#define EXTTEXTINPUT_CURSOR_OVERWRITE
MediaCommand
#define EXTTEXTINPUT_CURSOR_INVISIBLE
ShowDialogId
CommandWheelMode
CommandEventId
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
aCursorMoveIdle Stop()
constexpr sal_uInt16 KEY_MOD2
Definition: keycodes.hxx:32
constexpr sal_uInt16 KEY_MOD1
Definition: keycodes.hxx:31
ModKeyFlags
Definition: keycodes.hxx:166
constexpr sal_uInt16 KEY_SHIFT
Definition: keycodes.hxx:30
NONE
long Long
double mfY
double mfX
@ EndExtTextInput
@ InputContextChange
@ InputLanguageChange
@ GestureLongPress
@ QueryCharPosition
sal_uIntPtr sal_uLong