1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 // MyEDITDATA, wegen exportiertem EditData
21 #ifndef INCLUDED_EDITENG_EDITDATA_HXX
22 #define INCLUDED_EDITENG_EDITDATA_HXX
24 #include <rtl/ustring.hxx>
25 #include <editeng/editengdllapi.h>
26 #include <i18nlangtag/lang.h>
27 #include <editeng/ESelection.hxx>
32 template<typename T
> class SvParser
;
34 enum class HtmlTokenId
: sal_Int16
;
36 enum class EETextFormat
{ Text
= 0x20, Rtf
, Html
= 0x32, Xml
};
37 enum class EEHorizontalTextDirection
{ Default
, L2R
, R2L
};
38 enum class EESelectionMode
{ Std
, Hidden
};
39 // EESelectionMode::Hidden can be used to completely hide the selection. This is useful e.g. when you want show the selection
40 // only as long as your window (which the edit view works on) has the focus
41 enum class EESpellState
{ Ok
, NoSpeller
, ErrorFound
};
42 enum class EEAnchorMode
{
43 TopLeft
, TopHCenter
, TopRight
,
44 VCenterLeft
, VCenterHCenter
, VCenterRight
,
45 BottomLeft
, BottomHCenter
, BottomRight
};
47 enum class EERemoveParaAttribsMode
{ RemoveAll
, RemoveCharItems
, RemoveNone
};
49 EDITENG_DLLPUBLIC
extern const size_t EE_APPEND
;
51 // Error messages for Read / Write Method
52 #define EE_READWRITE_WRONGFORMAT ErrCode(ErrCodeArea::Svx, 1)
54 #define EDITUNDO_REMOVECHARS 100
55 #define EDITUNDO_CONNECTPARAS 101
56 #define EDITUNDO_MOVEPARAGRAPHS 103
57 #define EDITUNDO_INSERTFEATURE 104
58 #define EDITUNDO_SPLITPARA 105
59 #define EDITUNDO_INSERTCHARS 106
60 #define EDITUNDO_DELCONTENT 107
61 #define EDITUNDO_DELETE 108
62 #define EDITUNDO_CUT 109
63 #define EDITUNDO_PASTE 110
64 #define EDITUNDO_INSERT 111
65 #define EDITUNDO_MOVEPARAS 113
66 #define EDITUNDO_PARAATTRIBS 114
67 #define EDITUNDO_ATTRIBS 115
68 #define EDITUNDO_DRAGANDDROP 116
69 #define EDITUNDO_READ 117
70 #define EDITUNDO_STYLESHEET 118
71 #define EDITUNDO_REPLACEALL 119
72 #define EDITUNDO_RESETATTRIBS 121
73 #define EDITUNDO_INDENTBLOCK 122
74 #define EDITUNDO_UNINDENTBLOCK 123
75 #define EDITUNDO_MARKSELECTION 124
76 #define EDITUNDO_TRANSLITERATE 125
78 #define EDITUNDO_USER 200
80 struct EDITENG_DLLPUBLIC EFieldInfo
82 std::unique_ptr
<SvxFieldItem
> pFieldItem
;
83 OUString aCurrentText
;
84 EPaM aPosition
= EPaM::NotFound();
87 EFieldInfo( const SvxFieldItem
& rFieldItem
, sal_Int32 nPara
, sal_Int32 nPos
);
90 EFieldInfo( const EFieldInfo
& );
91 EFieldInfo
& operator= ( const EFieldInfo
& );
94 enum class RtfImportState
{
95 Start
, End
, // only pParser, nPara, nIndex
96 NextToken
, UnknownAttr
, // nToken+nTokenValue
101 enum class HtmlImportState
{
102 Start
, End
, // only pParser, nPara, nIndex
106 InsertPara
, InsertField
// -
109 struct HtmlImportInfo
111 SvParser
<HtmlTokenId
>* pParser
;
112 ESelection aSelection
;
113 HtmlImportState eState
;
119 HtmlImportInfo( HtmlImportState eState
, SvParser
<HtmlTokenId
>* pPrsrs
, const ESelection
& rSel
);
125 SvParser
<int>* pParser
;
126 ESelection aSelection
;
127 RtfImportState eState
;
132 RtfImportInfo( RtfImportState eState
, SvParser
<int>* pPrsrs
, const ESelection
& rSel
);
135 struct ParagraphInfos
138 : nFirstLineHeight( 0 )
139 , nFirstLineTextHeight ( 0 )
140 , nFirstLineMaxAscent( 0 )
144 sal_uInt16 nFirstLineHeight
;
145 sal_uInt16 nFirstLineTextHeight
;
146 sal_uInt16 nFirstLineMaxAscent
;
148 bool bValid
; // A query during formatting is not valid!
151 struct ScalingParameters
155 double fSpacingX
= 1.0;
156 double fSpacingY
= 1.0;
158 bool operator==(const ScalingParameters
& rOther
) const = default;
159 bool areValuesDefault()
161 return fFontX
== 1.0 && fFontY
== 1.0 && fSpacingX
== 1.0 && fSpacingY
== 1.0;
167 const SfxPoolItem
* pAttr
;
171 EECharAttrib(sal_Int32 nSt
, sal_Int32 nE
, const SfxPoolItem
* pA
= nullptr)
179 struct MoveParagraphsInfo
181 sal_Int32 nStartPara
;
185 MoveParagraphsInfo( sal_Int32 nS
, sal_Int32 nE
, sal_Int32 nD
)
186 { nStartPara
= nS
; nEndPara
= nE
; nDestPara
= nD
; }
189 struct PasteOrDropInfos
191 sal_Int32 nStartPara
;
194 PasteOrDropInfos() : nStartPara(-1), nEndPara(-1) {}
199 /// EditEngine text was modified
200 EE_NOTIFY_TEXTMODIFIED
,
202 /// A paragraph was inserted into the EditEngine
203 EE_NOTIFY_PARAGRAPHINSERTED
,
205 /// A paragraph was removed from the EditEngine
206 EE_NOTIFY_PARAGRAPHREMOVED
,
208 /// Multiple paragraphs have been removed from the EditEngine
209 EE_NOTIFY_PARAGRAPHSMOVED
,
211 /// The height of at least one paragraph has changed
212 EE_NOTIFY_TextHeightChanged
,
214 /// The view area of the EditEngine scrolled
215 EE_NOTIFY_TEXTVIEWSCROLLED
,
217 /// The selection and/or the cursor position has changed
218 EE_NOTIFY_TEXTVIEWSELECTIONCHANGED
,
220 /// The EditEngine is in a valid state again. Process pending notifications.
221 EE_NOTIFY_PROCESSNOTIFICATIONS
,
223 EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA
228 EENotifyType eNotificationType
;
230 sal_Int32 nParagraph
= EE_PARA_MAX
; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED
232 sal_Int32 nParam1
= 0;
233 sal_Int32 nParam2
= 0;
235 EENotify(EENotifyType eType
) { eNotificationType
= eType
; }
243 LanguageType nLang
= LANGUAGE_DONTKNOW
;
244 sal_Int32 nStart
= -1;
250 #endif // INCLUDED_EDITENG_EDITDATA_HXX
252 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */