1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: editdata.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MyEDITDATA, wegen exportiertem EditData
32 #ifndef _MyEDITDATA_HXX
33 #define _MyEDITDATA_HXX
35 #ifndef _STRING_HXX //autogen
36 #include <tools/string.hxx>
39 #include <bf_svtools/svarray.hxx>
49 enum EETextFormat
{ EE_FORMAT_TEXT
= 0x20, EE_FORMAT_RTF
, EE_FORMAT_BIN
= 0x31, EE_FORMAT_HTML
, EE_FORMAT_XML
};
50 enum EEHorizontalTextDirection
{ EE_HTEXTDIR_DEFAULT
, EE_HTEXTDIR_L2R
, EE_HTEXTDIR_R2L
};
51 enum EESelectionMode
{ EE_SELMODE_STD
, EE_SELMODE_TXTONLY
};
52 enum EESpellState
{ EE_SPELL_OK
, EE_SPELL_NOLANGUAGE
, EE_SPELL_LANGUAGENOTINSTALLED
, EE_SPELL_NOSPELLER
, EE_SPELL_ERRORFOUND
};
54 ANCHOR_TOP_LEFT
, ANCHOR_VCENTER_LEFT
, ANCHOR_BOTTOM_LEFT
,
55 ANCHOR_TOP_HCENTER
, ANCHOR_VCENTER_HCENTER
, ANCHOR_BOTTOM_HCENTER
,
56 ANCHOR_TOP_RIGHT
, ANCHOR_VCENTER_RIGHT
, ANCHOR_BOTTOM_RIGHT
};
58 #define EE_PARA_NOT_FOUND 0xFFFF
59 #define EE_PARA_APPEND 0xFFFF
60 #define EE_PARA_ALL 0xFFFF
61 #define EE_APPEND 0xFFFF
62 #define EE_INDEX_NOT_FOUND 0xFFFF
64 // Fehlermeldungen fuer Read/Write-Methode
65 #define EE_READWRITE_OK (SVSTREAM_OK)
66 #define EE_READWRITE_WRONGFORMAT (SVSTREAM_ERRBASE_USER+1)
67 #define EE_READWRITE_GENERALERROR (SVSTREAM_ERRBASE_USER+2)
69 #define EDITUNDO_START 100
70 #define EDITUNDO_REMOVECHARS 100
71 #define EDITUNDO_CONNECTPARAS 101
72 #define EDITUNDO_REMOVEFEATURE 102
73 #define EDITUNDO_MOVEPARAGRAPHS 103
74 #define EDITUNDO_INSERTFEATURE 104
75 #define EDITUNDO_SPLITPARA 105
76 #define EDITUNDO_INSERTCHARS 106
77 #define EDITUNDO_DELCONTENT 107
78 #define EDITUNDO_DELETE 108
79 #define EDITUNDO_CUT 109
80 #define EDITUNDO_PASTE 110
81 #define EDITUNDO_INSERT 111
82 #define EDITUNDO_SRCHANDREPL 112
83 #define EDITUNDO_MOVEPARAS 113
84 #define EDITUNDO_PARAATTRIBS 114
85 #define EDITUNDO_ATTRIBS 115
86 #define EDITUNDO_DRAGANDDROP 116
87 #define EDITUNDO_READ 117
88 #define EDITUNDO_STYLESHEET 118
89 #define EDITUNDO_REPLACEALL 119
90 #define EDITUNDO_STRETCH 120
91 #define EDITUNDO_RESETATTRIBS 121
92 #define EDITUNDO_INDENTBLOCK 122
93 #define EDITUNDO_UNINDENTBLOCK 123
94 #define EDITUNDO_MARKSELECTION 124
95 #define EDITUNDO_TRANSLITERATE 125
96 #define EDITUNDO_END 125
98 #define EDITUNDO_USER 200
100 #define EE_COMPATIBLEMODE_PARAGRAPHSPACING_SUMMATION 0x0001
101 #define EE_COMPATIBLEMODE_PARAGRAPHSPACING_BEFOREFIRSTPARAGRAPH 0x0002
107 class EditTextObject
;
109 #define RGCHK_NONE 0 // Keine Korrektur der ViusArea beim Scrollen
110 #define RGCHK_NEG 1 // Keine neg. ViusArea beim Scrollen
111 #define RGCHK_PAPERSZ1 2 // VisArea muss in Papierbreite,Texthoehe liegen
120 nPara
= EE_PARA_NOT_FOUND
;
121 nIndex
= EE_INDEX_NOT_FOUND
;
124 EPosition( USHORT nPara_
, xub_StrLen nPos_
)
130 EPosition( const EPosition
& rPosition
)
132 nPara
= rPosition
.nPara
;
133 nIndex
= rPosition
.nIndex
;
140 xub_StrLen nStartPos
;
144 ESelection() { nStartPara
= 0; nStartPos
= 0; nEndPara
= 0; nEndPos
= 0; }
146 ESelection( USHORT nStPara
, xub_StrLen nStPos
, USHORT nEPara
, xub_StrLen nEPos
)
148 nStartPara
= nStPara
;
154 ESelection( USHORT nPara
, xub_StrLen nPos
)
162 ESelection( const ESelection
& r
)
164 nStartPara
= r
.nStartPara
;
165 nStartPos
= r
.nStartPos
;
166 nEndPara
= r
.nEndPara
;
170 ESelection
& operator = ( const ESelection
& r
)
172 nStartPara
= r
.nStartPara
;
173 nStartPos
= r
.nStartPos
;
174 nEndPara
= r
.nEndPara
;
180 BOOL
IsEqual( const ESelection
& rS
);
181 BOOL
IsLess( const ESelection
& rS
);
182 BOOL
IsGreater( const ESelection
& rS
);
184 BOOL
HasRange() const;
187 inline BOOL
ESelection::HasRange() const
189 return ( nStartPara
!= nEndPara
) || ( nStartPos
!= nEndPos
);
192 inline sal_Bool
ESelection::IsZero()
194 return ( ( nStartPara
== 0 ) && ( nStartPos
== 0 ) &&
195 ( nEndPara
== 0 ) && ( nEndPos
== 0 ) );
198 inline sal_Bool
ESelection::IsEqual( const ESelection
& rS
)
200 return ( ( nStartPara
== rS
.nStartPara
) && ( nStartPos
== rS
.nStartPos
) &&
201 ( nEndPara
== rS
.nEndPara
) && ( nEndPos
== rS
.nEndPos
) );
204 inline sal_Bool
ESelection::IsLess( const ESelection
& rS
)
206 // Selektion muss justiert sein.
207 // => Nur pueffen, ob Ende von 'this' < Start von rS
209 if ( ( nEndPara
< rS
.nStartPara
) ||
210 ( ( nEndPara
== rS
.nStartPara
) && ( nEndPos
< rS
.nStartPos
) && !IsEqual( rS
) ) )
217 inline sal_Bool
ESelection::IsGreater( const ESelection
& rS
)
219 // Selektion muss justiert sein.
220 // => Nur pueffen, ob Ende von 'this' > Start von rS
222 if ( ( nStartPara
> rS
.nEndPara
) ||
223 ( ( nStartPara
== rS
.nEndPara
) && ( nStartPos
> rS
.nEndPos
) && !IsEqual( rS
) ) )
230 inline void ESelection::Adjust()
232 sal_Bool bSwap
= sal_False
;
233 if ( nStartPara
> nEndPara
)
235 else if ( ( nStartPara
== nEndPara
) && ( nStartPos
> nEndPos
) )
240 sal_uInt16 nSPar
= nStartPara
; sal_uInt16 nSPos
= nStartPos
;
241 nStartPara
= nEndPara
; nStartPos
= nEndPos
;
242 nEndPara
= nSPar
; nEndPos
= nSPos
;
248 SvxFieldItem
* pFieldItem
;
253 EFieldInfo( const SvxFieldItem
& rFieldItem
, USHORT nPara
, USHORT nPos
);
256 EFieldInfo( const EFieldInfo
& );
259 // -----------------------------------------------------------------------
262 RTFIMP_START
, RTFIMP_END
, // nur pParser, nPara, nIndex
263 RTFIMP_NEXTTOKEN
, RTFIMP_UNKNOWNATTR
, // nToken+nTokenValue
264 RTFIMP_SETATTR
, // pAttrs
265 RTFIMP_INSERTTEXT
, // aText
266 RTFIMP_INSERTPARA
, // -
267 HTMLIMP_START
, HTMLIMP_END
, // nur pParser, nPara, nIndex
268 HTMLIMP_NEXTTOKEN
, HTMLIMP_UNKNOWNATTR
, // nToken
269 HTMLIMP_SETATTR
, // pAttrs
270 HTMLIMP_INSERTTEXT
, // aText
271 HTMLIMP_INSERTPARA
, HTMLIMP_INSERTFIELD
// -
277 ESelection aSelection
;
285 void* pAttrs
; // RTF: SvxRTFItemStackType*, HTML: SfxItemSet*
287 ImportInfo( ImportState eState
, SvParser
* pPrsrs
, const ESelection
& rSel
);
291 #define EE_SEARCH_WORDONLY 0x0001
292 #define EE_SEARCH_EXACT 0x0002
293 #define EE_SEARCH_BACKWARD 0x0004
294 #define EE_SEARCH_INSELECTION 0x0008
295 #define EE_SEARCH_REGEXPR 0x0010
296 #define EE_SEARCH_PATTERN 0x0020
298 struct ParagraphInfos
303 USHORT nFirstLineStartX
;
305 USHORT nFirstLineOffset
;
306 USHORT nFirstLineHeight
;
307 USHORT nFirstLineTextHeight
;
308 USHORT nFirstLineMaxAscent
;
310 BOOL bValid
; // Bei einer Abfrage waehrend der Formatierung ungueltig!
315 const SfxPoolItem
* pAttr
;
322 SV_DECL_VARARR( EECharAttribArray
, EECharAttrib
, 0, 4 )//STRIP008 ;
324 struct MoveParagraphsInfo
330 MoveParagraphsInfo( USHORT nS
, USHORT nE
, USHORT nD
)
331 { nStartPara
= nS
; nEndPara
= nE
; nDestPara
= nD
; }
334 #define EE_ACTION_PASTE 1
335 #define EE_ACTION_DROP 2
337 struct PasteOrDropInfos
342 SfxStyleSheet
* pLevel0Style
;
343 SfxStyleSheet
* pLevelNStyle
;
346 { nStartPara
= 0xFFFF; nEndPara
= 0xFFFF;
347 pLevel0Style
= NULL
; pLevelNStyle
= NULL
; nAction
= 0; }
352 /// EditEngine text was modified
353 EE_NOTIFY_TEXTMODIFIED
,
355 /// A paragraph was inserted into the EditEngine
356 EE_NOTIFY_PARAGRAPHINSERTED
,
358 /// A paragraph was removed from the EditEngine
359 EE_NOTIFY_PARAGRAPHREMOVED
,
361 /// Multiple paragraphs have been removed from the EditEngine
362 EE_NOTIFY_PARAGRAPHSMOVED
,
364 /// The height of at least one paragraph has changed
365 EE_NOTIFY_TEXTHEIGHTCHANGED
,
367 /// The view area of the EditEngine scrolled
368 EE_NOTIFY_TEXTVIEWSCROLLED
,
370 /// The selection and/or the cursor position has changed
371 EE_NOTIFY_TEXTVIEWSELECTIONCHANGED
,
373 /** Denotes the beginning of a collected amount of EditEngine
374 notification events. This event itself is not queued, but sent
377 EE_NOTIFY_BLOCKNOTIFICATION_START
,
379 /** Denotes the end of a collected amount of EditEngine
380 notification events. After this event, the queue is empty, and
381 a high-level operation such as "insert paragraph" is finished
383 EE_NOTIFY_BLOCKNOTIFICATION_END
,
385 /// Denotes the beginning of a high-level action triggered by a key press
386 EE_NOTIFY_INPUT_START
,
388 /// Denotes the end of a high-level action triggered by a key press
394 EENotifyType eNotificationType
;
395 EditEngine
* pEditEngine
;
398 USHORT nParagraph
; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED
403 EENotify( EENotifyType eType
)
404 { eNotificationType
= eType
; pEditEngine
= NULL
; pEditView
= NULL
; nParagraph
= EE_PARA_NOT_FOUND
; nParam1
= 0; nParam2
= 0; }
407 }//end of namespace binfilter
408 #endif // _MyEDITDATA_HXX