Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / vcl / source / window / cmdevt.cxx
blob15f6d06ffcb0d43b842de25cbea1338f990b7b28
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
21 #include <string.h>
23 #include <vcl/cmdevt.hxx>
25 CommandExtTextInputData::CommandExtTextInputData( const OUString& rText,
26 const sal_uInt16* pTextAttr,
27 sal_Int32 nCursorPos,
28 sal_uInt16 nCursorFlags,
29 sal_Int32 nDeltaStart,
30 sal_Int32 nOldTextLen,
31 sal_Bool bOnlyCursor ) :
32 maText( rText )
34 if ( pTextAttr && !maText.isEmpty() )
36 mpTextAttr = new sal_uInt16[maText.getLength()];
37 memcpy( mpTextAttr, pTextAttr, maText.getLength()*sizeof(sal_uInt16) );
39 else
40 mpTextAttr = NULL;
41 mnCursorPos = nCursorPos;
42 mnDeltaStart = nDeltaStart;
43 mnOldTextLen = nOldTextLen;
44 mnCursorFlags = nCursorFlags;
45 mbOnlyCursor = bOnlyCursor;
48 // -----------------------------------------------------------------------
50 CommandExtTextInputData::CommandExtTextInputData( const CommandExtTextInputData& rData ) :
51 maText( rData.maText )
53 if ( rData.mpTextAttr && !maText.isEmpty() )
55 mpTextAttr = new sal_uInt16[maText.getLength()];
56 memcpy( mpTextAttr, rData.mpTextAttr, maText.getLength()*sizeof(sal_uInt16) );
58 else
59 mpTextAttr = NULL;
60 mnCursorPos = rData.mnCursorPos;
61 mnDeltaStart = rData.mnDeltaStart;
62 mnOldTextLen = rData.mnOldTextLen;
63 mnCursorFlags = rData.mnCursorFlags;
64 mbOnlyCursor = rData.mbOnlyCursor;
67 // -----------------------------------------------------------------------
69 CommandExtTextInputData::~CommandExtTextInputData()
71 if ( mpTextAttr )
72 delete [] mpTextAttr;
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */