Branch libreoffice-5-0-4
[LibreOffice.git] / include / vcl / textdata.hxx
blobfe37fbd3b4c72414e6106b853ca956f02b736731
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 .
20 #ifndef INCLUDED_VCL_TEXTDATA_HXX
21 #define INCLUDED_VCL_TEXTDATA_HXX
23 #include <rtl/ustring.hxx>
24 #include <svl/smplhint.hxx>
25 #include <vcl/dllapi.h>
27 // for Notify, if all paragraphs were deleted
28 #define TEXT_PARA_ALL 0xFFFFFFFF
30 class TextPaM
32 private:
33 sal_uLong mnPara;
34 sal_uInt16 mnIndex;
36 public:
37 TextPaM() { mnPara = 0, mnIndex = 0; }
38 TextPaM( sal_uLong nPara, sal_uInt16 nIndex ) { mnPara = nPara, mnIndex = nIndex; }
40 sal_uLong GetPara() const { return mnPara; }
41 sal_uLong& GetPara() { return mnPara; }
43 sal_uInt16 GetIndex() const { return mnIndex; }
44 sal_uInt16& GetIndex() { return mnIndex; }
46 inline bool operator == ( const TextPaM& rPaM ) const;
47 inline bool operator != ( const TextPaM& rPaM ) const;
48 inline bool operator < ( const TextPaM& rPaM ) const;
49 inline bool operator > ( const TextPaM& rPaM ) const;
52 inline bool TextPaM::operator == ( const TextPaM& rPaM ) const
54 return ( mnPara == rPaM.mnPara ) && ( mnIndex == rPaM.mnIndex );
57 inline bool TextPaM::operator != ( const TextPaM& rPaM ) const
59 return !( *this == rPaM );
62 inline bool TextPaM::operator < ( const TextPaM& rPaM ) const
64 return ( mnPara < rPaM.mnPara ) ||
65 ( ( mnPara == rPaM.mnPara ) && mnIndex < rPaM.mnIndex );
68 inline bool TextPaM::operator > ( const TextPaM& rPaM ) const
70 return ( mnPara > rPaM.mnPara ) ||
71 ( ( mnPara == rPaM.mnPara ) && mnIndex > rPaM.mnIndex );
74 class VCL_DLLPUBLIC TextSelection
76 private:
77 TextPaM maStartPaM;
78 TextPaM maEndPaM;
80 public:
81 TextSelection();
82 TextSelection( const TextPaM& rPaM );
83 TextSelection( const TextPaM& rStart, const TextPaM& rEnd );
85 const TextPaM& GetStart() const { return maStartPaM; }
86 TextPaM& GetStart() { return maStartPaM; }
88 const TextPaM& GetEnd() const { return maEndPaM; }
89 TextPaM& GetEnd() { return maEndPaM; }
91 void Justify();
93 bool HasRange() const { return maStartPaM != maEndPaM; }
95 inline bool operator == ( const TextSelection& rSel ) const;
96 inline bool operator != ( const TextSelection& rSel ) const;
99 inline bool TextSelection::operator == ( const TextSelection& rSel ) const
101 return ( ( maStartPaM == rSel.maStartPaM ) && ( maEndPaM == rSel.maEndPaM ) );
104 inline bool TextSelection::operator != ( const TextSelection& rSel ) const
106 return !( *this == rSel );
109 #define TEXT_HINT_PARAINSERTED 1
110 #define TEXT_HINT_PARAREMOVED 2
111 #define TEXT_HINT_PARACONTENTCHANGED 3
112 #define TEXT_HINT_TEXTHEIGHTCHANGED 4
113 #define TEXT_HINT_FORMATPARA 5
114 #define TEXT_HINT_TEXTFORMATTED 6
115 #define TEXT_HINT_MODIFIED 7
116 #define TEXT_HINT_BLOCKNOTIFICATION_START 8
117 #define TEXT_HINT_BLOCKNOTIFICATION_END 9
118 #define TEXT_HINT_INPUT_START 10
119 #define TEXT_HINT_INPUT_END 11
121 #define TEXT_HINT_VIEWSCROLLED 100
122 #define TEXT_HINT_VIEWSELECTIONCHANGED 101
123 #define TEXT_HINT_VIEWCARETCHANGED 102
125 class VCL_DLLPUBLIC TextHint : public SfxSimpleHint
127 private:
128 sal_uLong mnValue;
130 public:
131 TextHint( sal_uLong nId );
132 TextHint( sal_uLong nId, sal_uLong nValue );
134 sal_uLong GetValue() const { return mnValue; }
137 struct TEIMEInfos
139 OUString aOldTextAfterStartPos;
140 sal_uInt16* pAttribs;
141 TextPaM aPos;
142 sal_Int32 nLen;
143 bool bCursor;
144 bool bWasCursorOverwrite;
146 TEIMEInfos(const TextPaM& rPos, const OUString& rOldTextAfterStartPos);
147 ~TEIMEInfos();
149 void CopyAttribs(const sal_uInt16* pA, sal_Int32 nL);
150 void DestroyAttribs();
153 #endif // INCLUDED_VCL_TEXTDATA_HXX
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */