xref: /aoo42x/main/vcl/source/window/cmdevt.cxx (revision 9f62ea84)
1*9f62ea84SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9f62ea84SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9f62ea84SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9f62ea84SAndrew Rist  * distributed with this work for additional information
6*9f62ea84SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9f62ea84SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9f62ea84SAndrew Rist  * "License"); you may not use this file except in compliance
9*9f62ea84SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9f62ea84SAndrew Rist  *
11*9f62ea84SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9f62ea84SAndrew Rist  *
13*9f62ea84SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9f62ea84SAndrew Rist  * software distributed under the License is distributed on an
15*9f62ea84SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9f62ea84SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9f62ea84SAndrew Rist  * specific language governing permissions and limitations
18*9f62ea84SAndrew Rist  * under the License.
19*9f62ea84SAndrew Rist  *
20*9f62ea84SAndrew Rist  *************************************************************/
21*9f62ea84SAndrew Rist 
22*9f62ea84SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_vcl.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _STRING_H
28cdf0e10cSrcweir #include <string.h>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #ifndef _SV_CMDEVT_HXX
32cdf0e10cSrcweir #include <vcl/cmdevt.hxx>
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir 
35cdf0e10cSrcweir // =======================================================================
36cdf0e10cSrcweir 
CommandExtTextInputData()37cdf0e10cSrcweir CommandExtTextInputData::CommandExtTextInputData()
38cdf0e10cSrcweir {
39cdf0e10cSrcweir 	mpTextAttr		= NULL;
40cdf0e10cSrcweir 	mnCursorPos 	= 0;
41cdf0e10cSrcweir 	mnDeltaStart	= 0;
42cdf0e10cSrcweir 	mnOldTextLen	= 0;
43cdf0e10cSrcweir 	mnCursorFlags	= 0;
44cdf0e10cSrcweir 	mbOnlyCursor	= sal_False;
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
47cdf0e10cSrcweir // -----------------------------------------------------------------------
48cdf0e10cSrcweir 
CommandExtTextInputData(const XubString & rText,const sal_uInt16 * pTextAttr,xub_StrLen nCursorPos,sal_uInt16 nCursorFlags,xub_StrLen nDeltaStart,xub_StrLen nOldTextLen,sal_Bool bOnlyCursor)49cdf0e10cSrcweir CommandExtTextInputData::CommandExtTextInputData( const XubString& rText,
50cdf0e10cSrcweir 												  const sal_uInt16* pTextAttr,
51cdf0e10cSrcweir 												  xub_StrLen nCursorPos,
52cdf0e10cSrcweir 												  sal_uInt16 nCursorFlags,
53cdf0e10cSrcweir 												  xub_StrLen nDeltaStart,
54cdf0e10cSrcweir 												  xub_StrLen nOldTextLen,
55cdf0e10cSrcweir 												  sal_Bool bOnlyCursor ) :
56cdf0e10cSrcweir 	maText( rText )
57cdf0e10cSrcweir {
58cdf0e10cSrcweir 	if ( pTextAttr && maText.Len() )
59cdf0e10cSrcweir 	{
60cdf0e10cSrcweir 		mpTextAttr = new sal_uInt16[maText.Len()];
61cdf0e10cSrcweir 		memcpy( mpTextAttr, pTextAttr, maText.Len()*sizeof(sal_uInt16) );
62cdf0e10cSrcweir 	}
63cdf0e10cSrcweir 	else
64cdf0e10cSrcweir 		mpTextAttr = NULL;
65cdf0e10cSrcweir 	mnCursorPos 	= nCursorPos;
66cdf0e10cSrcweir 	mnDeltaStart	= nDeltaStart;
67cdf0e10cSrcweir 	mnOldTextLen	= nOldTextLen;
68cdf0e10cSrcweir 	mnCursorFlags	= nCursorFlags;
69cdf0e10cSrcweir 	mbOnlyCursor	= bOnlyCursor;
70cdf0e10cSrcweir }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir // -----------------------------------------------------------------------
73cdf0e10cSrcweir 
CommandExtTextInputData(const CommandExtTextInputData & rData)74cdf0e10cSrcweir CommandExtTextInputData::CommandExtTextInputData( const CommandExtTextInputData& rData ) :
75cdf0e10cSrcweir 	maText( rData.maText )
76cdf0e10cSrcweir {
77cdf0e10cSrcweir 	if ( rData.mpTextAttr && maText.Len() )
78cdf0e10cSrcweir 	{
79cdf0e10cSrcweir 		mpTextAttr = new sal_uInt16[maText.Len()];
80cdf0e10cSrcweir 		memcpy( mpTextAttr, rData.mpTextAttr, maText.Len()*sizeof(sal_uInt16) );
81cdf0e10cSrcweir 	}
82cdf0e10cSrcweir 	else
83cdf0e10cSrcweir 		mpTextAttr = NULL;
84cdf0e10cSrcweir 	mnCursorPos 	= rData.mnCursorPos;
85cdf0e10cSrcweir 	mnDeltaStart	= rData.mnDeltaStart;
86cdf0e10cSrcweir 	mnOldTextLen	= rData.mnOldTextLen;
87cdf0e10cSrcweir 	mnCursorFlags	= rData.mnCursorFlags;
88cdf0e10cSrcweir 	mbOnlyCursor	= rData.mbOnlyCursor;
89cdf0e10cSrcweir }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir // -----------------------------------------------------------------------
92cdf0e10cSrcweir 
~CommandExtTextInputData()93cdf0e10cSrcweir CommandExtTextInputData::~CommandExtTextInputData()
94cdf0e10cSrcweir {
95cdf0e10cSrcweir 	if ( mpTextAttr )
96cdf0e10cSrcweir 		delete [] mpTextAttr;
97cdf0e10cSrcweir }
98