/src/libreoffice/include/editeng/editdata.hxx
Line | Count | Source |
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_EDITENG_EDITDATA_HXX |
21 | | #define INCLUDED_EDITENG_EDITDATA_HXX |
22 | | |
23 | | #include <rtl/ustring.hxx> |
24 | | #include <editeng/editengdllapi.h> |
25 | | #include <i18nlangtag/lang.h> |
26 | | #include <editeng/ESelection.hxx> |
27 | | #include <memory> |
28 | | |
29 | | class SfxPoolItem; |
30 | | template<typename T> class SvParser; |
31 | | class SvxFieldItem; |
32 | | enum class HtmlTokenId : sal_Int16; |
33 | | |
34 | | enum class EETextFormat { Text = 0x20, Rtf, Html = 0x32, Xml }; |
35 | | enum class EEHorizontalTextDirection { Default, L2R, R2L }; |
36 | | enum class EESelectionMode { Std, Hidden }; |
37 | | // EESelectionMode::Hidden can be used to completely hide the selection. This is useful e.g. when you want show the selection |
38 | | // only as long as your window (which the edit view works on) has the focus |
39 | | enum class EESpellState { Ok, NoSpeller, ErrorFound }; |
40 | | enum class EEAnchorMode { |
41 | | TopLeft, TopHCenter, TopRight, |
42 | | VCenterLeft, VCenterHCenter, VCenterRight, |
43 | | BottomLeft, BottomHCenter, BottomRight }; |
44 | | |
45 | | enum class EERemoveParaAttribsMode { RemoveAll, RemoveCharItems, RemoveNone }; |
46 | | |
47 | | EDITENG_DLLPUBLIC extern const size_t EE_APPEND; |
48 | | |
49 | | // Error messages for Read / Write Method |
50 | 9.22k | #define EE_READWRITE_WRONGFORMAT ErrCode(ErrCodeArea::Svx, 1) |
51 | | |
52 | 39.1k | #define EDITUNDO_REMOVECHARS 100 |
53 | 23.6k | #define EDITUNDO_CONNECTPARAS 101 |
54 | 0 | #define EDITUNDO_MOVEPARAGRAPHS 103 |
55 | 1.03M | #define EDITUNDO_INSERTFEATURE 104 |
56 | 848k | #define EDITUNDO_SPLITPARA 105 |
57 | 795k | #define EDITUNDO_INSERTCHARS 106 |
58 | 41.2k | #define EDITUNDO_DELCONTENT 107 |
59 | 31.4k | #define EDITUNDO_DELETE 108 |
60 | 31.4k | #define EDITUNDO_CUT 109 |
61 | 739k | #define EDITUNDO_PASTE 110 |
62 | 6.55M | #define EDITUNDO_INSERT 111 |
63 | 0 | #define EDITUNDO_MOVEPARAS 113 |
64 | 2.44M | #define EDITUNDO_PARAATTRIBS 114 |
65 | 233k | #define EDITUNDO_ATTRIBS 115 |
66 | 0 | #define EDITUNDO_DRAGANDDROP 116 |
67 | 1.06M | #define EDITUNDO_READ 117 |
68 | 1.55M | #define EDITUNDO_STYLESHEET 118 |
69 | 0 | #define EDITUNDO_REPLACEALL 119 |
70 | 5.91k | #define EDITUNDO_RESETATTRIBS 121 |
71 | 0 | #define EDITUNDO_INDENTBLOCK 122 |
72 | 0 | #define EDITUNDO_UNINDENTBLOCK 123 |
73 | 0 | #define EDITUNDO_MARKSELECTION 124 |
74 | 0 | #define EDITUNDO_TRANSLITERATE 125 |
75 | | |
76 | 5.85M | #define EDITUNDO_USER 200 |
77 | | |
78 | | struct EDITENG_DLLPUBLIC EFieldInfo |
79 | | { |
80 | | std::unique_ptr<SvxFieldItem> pFieldItem; |
81 | | OUString aCurrentText; |
82 | | EPaM aPosition = EPaM::NotFound(); |
83 | | |
84 | | EFieldInfo(); |
85 | | EFieldInfo( const SvxFieldItem& rFieldItem, sal_Int32 nPara, sal_Int32 nPos ); |
86 | | ~EFieldInfo(); |
87 | | |
88 | | EFieldInfo( const EFieldInfo& ); |
89 | | EFieldInfo& operator= ( const EFieldInfo& ); |
90 | | }; |
91 | | |
92 | | enum class RtfImportState { |
93 | | Start, End, // only pParser, nPara, nIndex |
94 | | NextToken, UnknownAttr, // nToken+nTokenValue |
95 | | SetAttr, // pAttrs |
96 | | InsertText, // aText |
97 | | InsertPara, // - |
98 | | }; |
99 | | enum class HtmlImportState { |
100 | | Start, End, // only pParser, nPara, nIndex |
101 | | NextToken, // nToken |
102 | | SetAttr, // pAttrs |
103 | | InsertText, // aText |
104 | | InsertPara, InsertField // - |
105 | | }; |
106 | | |
107 | | struct HtmlImportInfo |
108 | | { |
109 | | SvParser<HtmlTokenId>* pParser; |
110 | | ESelection aSelection; |
111 | | HtmlImportState eState; |
112 | | |
113 | | HtmlTokenId nToken; |
114 | | |
115 | | OUString aText; |
116 | | |
117 | | HtmlImportInfo( HtmlImportState eState, SvParser<HtmlTokenId>* pPrsrs, const ESelection& rSel ); |
118 | | ~HtmlImportInfo(); |
119 | | }; |
120 | | |
121 | | struct RtfImportInfo |
122 | | { |
123 | | SvParser<int>* pParser; |
124 | | ESelection aSelection; |
125 | | RtfImportState eState; |
126 | | |
127 | | int nToken; |
128 | | short nTokenValue; |
129 | | |
130 | | RtfImportInfo( RtfImportState eState, SvParser<int>* pPrsrs, const ESelection& rSel ); |
131 | | }; |
132 | | |
133 | | struct ParagraphInfos |
134 | | { |
135 | | ParagraphInfos() |
136 | 830k | : nFirstLineHeight( 0 ) |
137 | 830k | , nFirstLineTextHeight ( 0 ) |
138 | 830k | , nFirstLineMaxAscent( 0 ) |
139 | 830k | , bValid( false ) |
140 | 830k | {} |
141 | | |
142 | | sal_uInt16 nFirstLineHeight; |
143 | | sal_uInt16 nFirstLineTextHeight; |
144 | | sal_uInt16 nFirstLineMaxAscent; |
145 | | |
146 | | bool bValid; // A query during formatting is not valid! |
147 | | }; |
148 | | |
149 | | struct ScalingParameters |
150 | | { |
151 | | double fFontX = 1.0; |
152 | | double fFontY = 1.0; |
153 | | double fSpacingX = 1.0; |
154 | | double fSpacingY = 1.0; |
155 | | |
156 | 19.7M | bool operator==(const ScalingParameters& rOther) const = default; |
157 | | bool areValuesDefault() |
158 | 848 | { |
159 | 848 | return fFontX == 1.0 && fFontY == 1.0 && fSpacingX == 1.0 && fSpacingY == 1.0; |
160 | 848 | } |
161 | | }; |
162 | | |
163 | | struct EECharAttrib |
164 | | { |
165 | | const SfxPoolItem* pAttr; |
166 | | |
167 | | sal_Int32 nStart; |
168 | | sal_Int32 nEnd; |
169 | | EECharAttrib(sal_Int32 nSt, sal_Int32 nE, const SfxPoolItem* pA = nullptr) |
170 | | : pAttr(pA) |
171 | | , nStart(nSt) |
172 | | , nEnd(nE) |
173 | 0 | { |
174 | 0 | } |
175 | | }; |
176 | | |
177 | | struct MoveParagraphsInfo |
178 | | { |
179 | | sal_Int32 nStartPara; |
180 | | sal_Int32 nEndPara; |
181 | | sal_Int32 nDestPara; |
182 | | |
183 | | MoveParagraphsInfo( sal_Int32 nS, sal_Int32 nE, sal_Int32 nD ) |
184 | 0 | { nStartPara = nS; nEndPara = nE; nDestPara = nD; } |
185 | | }; |
186 | | |
187 | | struct PasteOrDropInfos |
188 | | { |
189 | | sal_Int32 nStartPara; |
190 | | sal_Int32 nEndPara; |
191 | | |
192 | 0 | PasteOrDropInfos() : nStartPara(-1), nEndPara(-1) {} |
193 | | }; |
194 | | |
195 | | enum EENotifyType |
196 | | { |
197 | | /// EditEngine text was modified |
198 | | EE_NOTIFY_TEXTMODIFIED, |
199 | | |
200 | | /// A paragraph was inserted into the EditEngine |
201 | | EE_NOTIFY_PARAGRAPHINSERTED, |
202 | | |
203 | | /// A paragraph was removed from the EditEngine |
204 | | EE_NOTIFY_PARAGRAPHREMOVED, |
205 | | |
206 | | /// Multiple paragraphs have been removed from the EditEngine |
207 | | EE_NOTIFY_PARAGRAPHSMOVED, |
208 | | |
209 | | /// The height of at least one paragraph has changed |
210 | | EE_NOTIFY_TextHeightChanged, |
211 | | |
212 | | /// The view area of the EditEngine scrolled |
213 | | EE_NOTIFY_TEXTVIEWSCROLLED, |
214 | | |
215 | | /// The selection and/or the cursor position has changed |
216 | | EE_NOTIFY_TEXTVIEWSELECTIONCHANGED, |
217 | | |
218 | | /// The EditEngine is in a valid state again. Process pending notifications. |
219 | | EE_NOTIFY_PROCESSNOTIFICATIONS, |
220 | | |
221 | | EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA |
222 | | }; |
223 | | |
224 | | struct EENotify |
225 | | { |
226 | | EENotifyType eNotificationType; |
227 | | |
228 | | sal_Int32 nParagraph = EE_PARA_MAX; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED |
229 | | |
230 | | sal_Int32 nParam1 = 0; |
231 | | sal_Int32 nParam2 = 0; |
232 | | |
233 | 4.41M | EENotify(EENotifyType eType) { eNotificationType = eType; } |
234 | | }; |
235 | | |
236 | | namespace editeng |
237 | | { |
238 | | |
239 | | struct LanguageSpan |
240 | | { |
241 | | LanguageType nLang = LANGUAGE_DONTKNOW; |
242 | | sal_Int32 nStart = -1; |
243 | | sal_Int32 nEnd = -1; |
244 | | }; |
245 | | |
246 | | } |
247 | | |
248 | | #endif // INCLUDED_EDITENG_EDITDATA_HXX |
249 | | |
250 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |