LibreOffice Module vcl (master) 1
commandevent.cxx
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#include <string.h>
21
22#include <utility>
23#include <vcl/commandevent.hxx>
24
26 const ExtTextInputAttr* pTextAttr, sal_Int32 nCursorPos, sal_uInt16 nCursorFlags,
27 bool bOnlyCursor)
28 : maText(std::move(aText))
29{
30 if ( pTextAttr && !maText.isEmpty() )
31 {
32 mpTextAttr.reset( new ExtTextInputAttr[maText.getLength()] );
33 memcpy( mpTextAttr.get(), pTextAttr, maText.getLength()*sizeof(ExtTextInputAttr) );
34 }
35
36 mnCursorPos = nCursorPos;
37 mnCursorFlags = nCursorFlags;
38 mbOnlyCursor = bOnlyCursor;
39}
40
42 maText( rData.maText )
43{
44 if ( rData.mpTextAttr && !maText.isEmpty() )
45 {
46 mpTextAttr.reset( new ExtTextInputAttr[maText.getLength()] );
47 memcpy( mpTextAttr.get(), rData.mpTextAttr.get(), maText.getLength()*sizeof(ExtTextInputAttr) );
48 }
49
53}
54
56{
57}
58
60{
61 mnDelta = 0;
62 mnNotchDelta = 0;
63 mnLines = 0.0;
65 mnCode = 0;
66 mbHorz = false;
67 mbDeltaIsPixel = false;
68}
69
71 double nScrollLines,
72 CommandWheelMode nWheelMode, sal_uInt16 nKeyModifier,
73 bool bHorz, bool bDeltaIsPixel )
74{
75 mnDelta = nWheelDelta;
76 mnNotchDelta = nWheelNotchDelta;
77 mnLines = nScrollLines;
78 mnWheelMode = nWheelMode;
79 mnCode = nKeyModifier;
80 mbHorz = bHorz;
81 mbDeltaIsPixel = bDeltaIsPixel;
82}
83
85{
86 mnDeltaX = nDeltaX;
87 mnDeltaY = nDeltaY;
88}
89
91{
92 mbDown = bDown;
93 mnCode = nCode;
94}
95
97{
98 mnStart = nStart;
99 mnEnd = nEnd;
100}
101
103{
104 mpData = nullptr;
106 mbMouseEvent = false;
107}
108
109CommandEvent::CommandEvent( const Point& rMousePos,
110 CommandEventId nCmd, bool bMEvt, const void* pCmdData ) :
111 maPos( rMousePos )
112{
113 mpData = const_cast<void*>(pCmdData);
114 mnCommand = nCmd;
115 mbMouseEvent = bMEvt;
116}
117
119{
121 return static_cast<const CommandExtTextInputData*>(mpData);
122 else
123 return nullptr;
124}
125
127{
129 return static_cast<const CommandWheelData*>(mpData);
130 else
131 return nullptr;
132}
133
135{
137 return static_cast<const CommandScrollData*>(mpData);
138 else
139 return nullptr;
140}
141
143{
145 return static_cast<const CommandModKeyData*>(mpData);
146 else
147 return nullptr;
148}
149
151{
153 return static_cast<const CommandDialogData*>(mpData);
154 else
155 return nullptr;
156}
157
159{
161 return static_cast<CommandMediaData*>(mpData);
162 else
163 return nullptr;
164}
165
167{
169 return static_cast<const CommandSelectionChangeData*>(mpData);
170 else
171 return nullptr;
172}
173
175{
177 return static_cast<const CommandGestureSwipeData*>(mpData);
178 else
179 return nullptr;
180}
181
183{
185 return static_cast<const CommandGestureLongPressData*>(mpData);
186 else
187 return nullptr;
188}
189
191{
193 return static_cast<const CommandGesturePanData*>(mpData);
194 else
195 return nullptr;
196}
197
199{
201 return static_cast<const CommandGestureZoomData*>(mpData);
202 else
203 return nullptr;
204}
205
207{
209 return static_cast<const CommandGestureRotateData*>(mpData);
210 else
211 return nullptr;
212}
213
214/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Text maText
const CommandGestureZoomData * GetGestureZoomData() const
const CommandWheelData * GetWheelData() const
const CommandGestureLongPressData * GetLongPressData() const
const CommandModKeyData * GetModKeyData() const
CommandMediaData * GetMediaData() const
const CommandGestureRotateData * GetGestureRotateData() const
const CommandSelectionChangeData * GetSelectionChangeData() const
const CommandDialogData * GetDialogData() const
const CommandGesturePanData * GetGesturePanData() const
const CommandScrollData * GetAutoScrollData() const
const CommandExtTextInputData * GetExtTextInputData() const
const CommandGestureSwipeData * GetGestureSwipeData() const
CommandEventId mnCommand
std::unique_ptr< ExtTextInputAttr[]> mpTextAttr
CommandExtTextInputData(OUString aText, const ExtTextInputAttr *pTextAttr, sal_Int32 nCursorPos, sal_uInt16 nCursorFlags, bool bOnlyCursor)
ModKeyFlags mnCode
CommandModKeyData(ModKeyFlags nCode, bool bDown)
CommandScrollData(tools::Long nDeltaX, tools::Long nDeltaY)
tools::Long mnDeltaX
tools::Long mnDeltaY
CommandSelectionChangeData(sal_uLong nStart, sal_uLong nEnd)
tools::Long mnNotchDelta
CommandWheelMode mnWheelMode
tools::Long mnDelta
ExtTextInputAttr
CommandWheelMode
CommandEventId
ModKeyFlags
Definition: keycodes.hxx:165
sal_uInt16 nCode
long Long
sal_uIntPtr sal_uLong