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 : #ifndef INCLUDED_VCL_TEXTDATA_HXX
21 : #define INCLUDED_VCL_TEXTDATA_HXX
22 :
23 : #include <rtl/ustring.hxx>
24 : #include <svl/smplhint.hxx>
25 : #include <vcl/dllapi.h>
26 :
27 : // for Notify, if all paragraphs were deleted
28 : #define TEXT_PARA_ALL 0xFFFFFFFF
29 :
30 : class TextPaM
31 : {
32 : private:
33 : sal_uLong mnPara;
34 : sal_uInt16 mnIndex;
35 :
36 : public:
37 542 : TextPaM() { mnPara = 0, mnIndex = 0; }
38 334 : TextPaM( sal_uLong nPara, sal_uInt16 nIndex ) { mnPara = nPara, mnIndex = nIndex; }
39 :
40 834 : sal_uLong GetPara() const { return mnPara; }
41 1074 : sal_uLong& GetPara() { return mnPara; }
42 :
43 584 : sal_uInt16 GetIndex() const { return mnIndex; }
44 480 : sal_uInt16& GetIndex() { return mnIndex; }
45 :
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;
50 : };
51 :
52 1708 : inline bool TextPaM::operator == ( const TextPaM& rPaM ) const
53 : {
54 1708 : return ( mnPara == rPaM.mnPara ) && ( mnIndex == rPaM.mnIndex );
55 : }
56 :
57 800 : inline bool TextPaM::operator != ( const TextPaM& rPaM ) const
58 : {
59 800 : return !( *this == rPaM );
60 : }
61 :
62 4 : inline bool TextPaM::operator < ( const TextPaM& rPaM ) const
63 : {
64 12 : return ( mnPara < rPaM.mnPara ) ||
65 12 : ( ( mnPara == rPaM.mnPara ) && mnIndex < rPaM.mnIndex );
66 : }
67 :
68 0 : inline bool TextPaM::operator > ( const TextPaM& rPaM ) const
69 : {
70 0 : return ( mnPara > rPaM.mnPara ) ||
71 0 : ( ( mnPara == rPaM.mnPara ) && mnIndex > rPaM.mnIndex );
72 : }
73 :
74 : class VCL_DLLPUBLIC TextSelection
75 : {
76 : private:
77 : TextPaM maStartPaM;
78 : TextPaM maEndPaM;
79 :
80 : public:
81 : TextSelection();
82 : TextSelection( const TextPaM& rPaM );
83 : TextSelection( const TextPaM& rStart, const TextPaM& rEnd );
84 :
85 0 : const TextPaM& GetStart() const { return maStartPaM; }
86 413 : TextPaM& GetStart() { return maStartPaM; }
87 :
88 46 : const TextPaM& GetEnd() const { return maEndPaM; }
89 469 : TextPaM& GetEnd() { return maEndPaM; }
90 :
91 : void Justify();
92 :
93 796 : bool HasRange() const { return maStartPaM != maEndPaM; }
94 :
95 : inline bool operator == ( const TextSelection& rSel ) const;
96 : inline bool operator != ( const TextSelection& rSel ) const;
97 : };
98 :
99 456 : inline bool TextSelection::operator == ( const TextSelection& rSel ) const
100 : {
101 456 : return ( ( maStartPaM == rSel.maStartPaM ) && ( maEndPaM == rSel.maEndPaM ) );
102 : }
103 :
104 456 : inline bool TextSelection::operator != ( const TextSelection& rSel ) const
105 : {
106 456 : return !( *this == rSel );
107 : }
108 :
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
120 :
121 : #define TEXT_HINT_VIEWSCROLLED 100
122 : #define TEXT_HINT_VIEWSELECTIONCHANGED 101
123 : #define TEXT_HINT_VIEWCARETCHANGED 102
124 :
125 1581 : class VCL_DLLPUBLIC TextHint : public SfxSimpleHint
126 : {
127 : private:
128 : sal_uLong mnValue;
129 :
130 : public:
131 : TextHint( sal_uLong nId );
132 : TextHint( sal_uLong nId, sal_uLong nValue );
133 :
134 4 : sal_uLong GetValue() const { return mnValue; }
135 : };
136 :
137 : struct TEIMEInfos
138 : {
139 : OUString aOldTextAfterStartPos;
140 : sal_uInt16* pAttribs;
141 : TextPaM aPos;
142 : sal_Int32 nLen;
143 : bool bCursor;
144 : bool bWasCursorOverwrite;
145 :
146 : TEIMEInfos(const TextPaM& rPos, const OUString& rOldTextAfterStartPos);
147 : ~TEIMEInfos();
148 :
149 : void CopyAttribs(const sal_uInt16* pA, sal_Int32 nL);
150 : void DestroyAttribs();
151 : };
152 :
153 : #endif // INCLUDED_VCL_TEXTDATA_HXX
154 :
155 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|