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