Line data Source code
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 :
21 : #include <string.h>
22 :
23 : #include <vcl/cmdevt.hxx>
24 :
25 0 : CommandExtTextInputData::CommandExtTextInputData( const XubString& rText,
26 : const sal_uInt16* pTextAttr,
27 : xub_StrLen nCursorPos,
28 : sal_uInt16 nCursorFlags,
29 : xub_StrLen nDeltaStart,
30 : xub_StrLen nOldTextLen,
31 : sal_Bool bOnlyCursor ) :
32 0 : maText( rText )
33 : {
34 0 : if ( pTextAttr && maText.Len() )
35 : {
36 0 : mpTextAttr = new sal_uInt16[maText.Len()];
37 0 : memcpy( mpTextAttr, pTextAttr, maText.Len()*sizeof(sal_uInt16) );
38 : }
39 : else
40 0 : mpTextAttr = NULL;
41 0 : mnCursorPos = nCursorPos;
42 0 : mnDeltaStart = nDeltaStart;
43 0 : mnOldTextLen = nOldTextLen;
44 0 : mnCursorFlags = nCursorFlags;
45 0 : mbOnlyCursor = bOnlyCursor;
46 0 : }
47 :
48 : // -----------------------------------------------------------------------
49 :
50 0 : CommandExtTextInputData::CommandExtTextInputData( const CommandExtTextInputData& rData ) :
51 0 : maText( rData.maText )
52 : {
53 0 : if ( rData.mpTextAttr && maText.Len() )
54 : {
55 0 : mpTextAttr = new sal_uInt16[maText.Len()];
56 0 : memcpy( mpTextAttr, rData.mpTextAttr, maText.Len()*sizeof(sal_uInt16) );
57 : }
58 : else
59 0 : mpTextAttr = NULL;
60 0 : mnCursorPos = rData.mnCursorPos;
61 0 : mnDeltaStart = rData.mnDeltaStart;
62 0 : mnOldTextLen = rData.mnOldTextLen;
63 0 : mnCursorFlags = rData.mnCursorFlags;
64 0 : mbOnlyCursor = rData.mbOnlyCursor;
65 0 : }
66 :
67 : // -----------------------------------------------------------------------
68 :
69 0 : CommandExtTextInputData::~CommandExtTextInputData()
70 : {
71 0 : if ( mpTextAttr )
72 0 : delete [] mpTextAttr;
73 0 : }
74 :
75 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|