1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <vcl/commandevent.hxx>
24 CommandExtTextInputData::CommandExtTextInputData( const OUString
& rText
,
25 const ExtTextInputAttr
* pTextAttr
, sal_Int32 nCursorPos
, sal_uInt16 nCursorFlags
,
29 if ( pTextAttr
&& !maText
.isEmpty() )
31 mpTextAttr
.reset( new ExtTextInputAttr
[maText
.getLength()] );
32 memcpy( mpTextAttr
.get(), pTextAttr
, maText
.getLength()*sizeof(ExtTextInputAttr
) );
35 mnCursorPos
= nCursorPos
;
36 mnCursorFlags
= nCursorFlags
;
37 mbOnlyCursor
= bOnlyCursor
;
40 CommandExtTextInputData::CommandExtTextInputData( const CommandExtTextInputData
& rData
) :
41 maText( rData
.maText
)
43 if ( rData
.mpTextAttr
&& !maText
.isEmpty() )
45 mpTextAttr
.reset( new ExtTextInputAttr
[maText
.getLength()] );
46 memcpy( mpTextAttr
.get(), rData
.mpTextAttr
.get(), maText
.getLength()*sizeof(ExtTextInputAttr
) );
49 mnCursorPos
= rData
.mnCursorPos
;
50 mnCursorFlags
= rData
.mnCursorFlags
;
51 mbOnlyCursor
= rData
.mbOnlyCursor
;
54 CommandExtTextInputData::~CommandExtTextInputData()
58 CommandInputContextData::CommandInputContextData( LanguageType eLang
)
63 CommandWheelData::CommandWheelData()
68 mnWheelMode
= CommandWheelMode::NONE
;
71 mbDeltaIsPixel
= false;
74 CommandWheelData::CommandWheelData( long nWheelDelta
, long nWheelNotchDelta
,
76 CommandWheelMode nWheelMode
, sal_uInt16 nKeyModifier
,
77 bool bHorz
, bool bDeltaIsPixel
)
79 mnDelta
= nWheelDelta
;
80 mnNotchDelta
= nWheelNotchDelta
;
81 mnLines
= nScrollLines
;
82 mnWheelMode
= nWheelMode
;
83 mnCode
= nKeyModifier
;
85 mbDeltaIsPixel
= bDeltaIsPixel
;
88 CommandScrollData::CommandScrollData( long nDeltaX
, long nDeltaY
)
94 CommandModKeyData::CommandModKeyData( sal_uInt16 nCode
, bool bDown
)
100 CommandSelectionChangeData::CommandSelectionChangeData( sal_uLong nStart
, sal_uLong nEnd
)
106 CommandEvent::CommandEvent()
109 mnCommand
= CommandEventId::NONE
;
110 mbMouseEvent
= false;
113 CommandEvent::CommandEvent( const Point
& rMousePos
,
114 CommandEventId nCmd
, bool bMEvt
, const void* pCmdData
) :
117 mpData
= const_cast<void*>(pCmdData
);
119 mbMouseEvent
= bMEvt
;
122 const CommandExtTextInputData
* CommandEvent::GetExtTextInputData() const
124 if ( mnCommand
== CommandEventId::ExtTextInput
)
125 return static_cast<const CommandExtTextInputData
*>(mpData
);
130 const CommandWheelData
* CommandEvent::GetWheelData() const
132 if ( mnCommand
== CommandEventId::Wheel
)
133 return static_cast<const CommandWheelData
*>(mpData
);
138 const CommandScrollData
* CommandEvent::GetAutoScrollData() const
140 if ( mnCommand
== CommandEventId::AutoScroll
)
141 return static_cast<const CommandScrollData
*>(mpData
);
146 const CommandModKeyData
* CommandEvent::GetModKeyData() const
148 if( mnCommand
== CommandEventId::ModKeyChange
)
149 return static_cast<const CommandModKeyData
*>(mpData
);
154 const CommandDialogData
* CommandEvent::GetDialogData() const
156 if( mnCommand
== CommandEventId::ShowDialog
)
157 return static_cast<const CommandDialogData
*>(mpData
);
162 CommandMediaData
* CommandEvent::GetMediaData() const
164 if( mnCommand
== CommandEventId::Media
)
165 return static_cast<CommandMediaData
*>(mpData
);
170 const CommandSelectionChangeData
* CommandEvent::GetSelectionChangeData() const
172 if( mnCommand
== CommandEventId::SelectionChange
)
173 return static_cast<const CommandSelectionChangeData
*>(mpData
);
178 const CommandSwipeData
* CommandEvent::GetSwipeData() const
180 if( mnCommand
== CommandEventId::Swipe
)
181 return static_cast<const CommandSwipeData
*>(mpData
);
186 const CommandLongPressData
* CommandEvent::GetLongPressData() const
188 if( mnCommand
== CommandEventId::LongPress
)
189 return static_cast<const CommandLongPressData
*>(mpData
);
194 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */