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 <vcl/commandevent.hxx>
23 
25  const ExtTextInputAttr* pTextAttr, sal_Int32 nCursorPos, sal_uInt16 nCursorFlags,
26  bool bOnlyCursor)
27  : maText(rText)
28 {
29  if ( pTextAttr && !maText.isEmpty() )
30  {
31  mpTextAttr.reset( new ExtTextInputAttr[maText.getLength()] );
32  memcpy( mpTextAttr.get(), pTextAttr, maText.getLength()*sizeof(ExtTextInputAttr) );
33  }
34 
35  mnCursorPos = nCursorPos;
36  mnCursorFlags = nCursorFlags;
37  mbOnlyCursor = bOnlyCursor;
38 }
39 
41  maText( rData.maText )
42 {
43  if ( rData.mpTextAttr && !maText.isEmpty() )
44  {
45  mpTextAttr.reset( new ExtTextInputAttr[maText.getLength()] );
46  memcpy( mpTextAttr.get(), rData.mpTextAttr.get(), maText.getLength()*sizeof(ExtTextInputAttr) );
47  }
48 
49  mnCursorPos = rData.mnCursorPos;
51  mbOnlyCursor = rData.mbOnlyCursor;
52 }
53 
55 {
56 }
57 
59 {
60  mnDelta = 0;
61  mnNotchDelta = 0;
62  mnLines = 0.0;
64  mnCode = 0;
65  mbHorz = false;
66  mbDeltaIsPixel = false;
67 }
68 
69 CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDelta,
70  double nScrollLines,
71  CommandWheelMode nWheelMode, sal_uInt16 nKeyModifier,
72  bool bHorz, bool bDeltaIsPixel )
73 {
74  mnDelta = nWheelDelta;
75  mnNotchDelta = nWheelNotchDelta;
76  mnLines = nScrollLines;
77  mnWheelMode = nWheelMode;
78  mnCode = nKeyModifier;
79  mbHorz = bHorz;
80  mbDeltaIsPixel = bDeltaIsPixel;
81 }
82 
83 CommandScrollData::CommandScrollData( long nDeltaX, long nDeltaY )
84 {
85  mnDeltaX = nDeltaX;
86  mnDeltaY = nDeltaY;
87 }
88 
90 {
91  mbDown = bDown;
92  mnCode = nCode;
93 }
94 
96 {
97  mnStart = nStart;
98  mnEnd = nEnd;
99 }
100 
102 {
103  mpData = nullptr;
105  mbMouseEvent = false;
106 }
107 
109  CommandEventId nCmd, bool bMEvt, const void* pCmdData ) :
110  maPos( rMousePos )
111 {
112  mpData = const_cast<void*>(pCmdData);
113  mnCommand = nCmd;
114  mbMouseEvent = bMEvt;
115 }
116 
118 {
120  return static_cast<const CommandExtTextInputData*>(mpData);
121  else
122  return nullptr;
123 }
124 
126 {
128  return static_cast<const CommandWheelData*>(mpData);
129  else
130  return nullptr;
131 }
132 
134 {
136  return static_cast<const CommandScrollData*>(mpData);
137  else
138  return nullptr;
139 }
140 
142 {
144  return static_cast<const CommandModKeyData*>(mpData);
145  else
146  return nullptr;
147 }
148 
150 {
152  return static_cast<const CommandDialogData*>(mpData);
153  else
154  return nullptr;
155 }
156 
158 {
160  return static_cast<CommandMediaData*>(mpData);
161  else
162  return nullptr;
163 }
164 
166 {
168  return static_cast<const CommandSelectionChangeData*>(mpData);
169  else
170  return nullptr;
171 }
172 
174 {
176  return static_cast<const CommandSwipeData*>(mpData);
177  else
178  return nullptr;
179 }
180 
182 {
184  return static_cast<const CommandLongPressData*>(mpData);
185  else
186  return nullptr;
187 }
188 
190 {
192  return static_cast<const CommandGestureData*>(mpData);
193  else
194  return nullptr;
195 }
196 
197 
198 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const CommandSwipeData * GetSwipeData() const
CommandEventId
const CommandLongPressData * GetLongPressData() const
sal_uIntPtr sal_uLong
ModKeyFlags mnCode
ModKeyFlags
Definition: keycodes.hxx:163
const CommandWheelData * GetWheelData() const
const CommandScrollData * GetAutoScrollData() const
CommandSelectionChangeData(sal_uLong nStart, sal_uLong nEnd)
const CommandModKeyData * GetModKeyData() const
CommandEventId mnCommand
const CommandExtTextInputData * GetExtTextInputData() const
CommandModKeyData(ModKeyFlags nCode, bool bDown)
CommandWheelMode
std::unique_ptr< ExtTextInputAttr[]> mpTextAttr
CommandWheelMode mnWheelMode
const CommandGestureData * GetGestureData() const
CommandScrollData(long nDeltaX, long nDeltaY)
const CommandSelectionChangeData * GetSelectionChangeData() const
Text maText
CommandMediaData * GetMediaData() const
ExtTextInputAttr
CommandExtTextInputData(const OUString &rText, const ExtTextInputAttr *pTextAttr, sal_Int32 nCursorPos, sal_uInt16 nCursorFlags, bool bOnlyCursor)
const CommandDialogData * GetDialogData() const