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: editdoc.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 ************************************************************************/
34 #ifndef _COM_SUN_STAR_I18N_XEXTENDEDINPUTSEQUENCECHECKER_HDL_
35 #include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
38 #include <editattr.hxx>
39 #include <edtspell.hxx>
40 #include <svx/svxfont.hxx>
41 #include <svtools/itemset.hxx>
42 #include <svtools/style.hxx>
43 #include <svtools/itempool.hxx>
44 #include <tools/table.hxx>
50 DBG_NAMEEX( EE_TextPortion
)
52 #define CHARPOSGROW 16
55 void CreateFont( SvxFont
& rFont
, const SfxItemSet
& rSet
, bool bSearchInParent
= true, short nScriptType
= 0 );
56 USHORT
GetScriptItemId( USHORT nItemId
, short nScriptType
);
57 BOOL
IsScriptItemValid( USHORT nItemId
, short nScriptType
);
59 EditCharAttrib
* MakeCharAttrib( SfxItemPool
& rPool
, const SfxPoolItem
& rAttr
, USHORT nS
, USHORT nE
);
69 EPaM() { nPara
= 0; nIndex
= 0; }
70 EPaM( USHORT nP
, USHORT nI
) { nPara
= nP
; nIndex
= nI
; }
71 EPaM( const EPaM
& r
) { nPara
= r
.nPara
; nIndex
= r
.nIndex
; }
72 EPaM
& operator = ( const EPaM
& r
) { nPara
= r
.nPara
; nIndex
= r
.nIndex
; return *this; }
73 inline BOOL
operator == ( const EPaM
& r
) const;
74 inline BOOL
operator < ( const EPaM
& r
) const;
77 inline BOOL
EPaM::operator < ( const EPaM
& r
) const
79 return ( ( nPara
< r
.nPara
) ||
80 ( ( nPara
== r
.nPara
) && nIndex
< r
.nIndex
) ) ? TRUE
: FALSE
;
83 inline BOOL
EPaM::operator == ( const EPaM
& r
) const
85 return ( ( nPara
== r
.nPara
) && ( nIndex
== r
.nIndex
) ) ? TRUE
: FALSE
;
88 struct ScriptTypePosInfo
94 ScriptTypePosInfo( short _Type
, USHORT _Start
, USHORT _End
)
102 SV_DECL_VARARR( ScriptTypePosInfos
, ScriptTypePosInfo
, 0, 4 )
104 struct WritingDirectionInfo
110 WritingDirectionInfo( BYTE _Type
, USHORT _Start
, USHORT _End
)
118 SV_DECL_VARARR( WritingDirectionInfos
, WritingDirectionInfo
, 0, 4 )
120 typedef EditCharAttrib
* EditCharAttribPtr
;
121 SV_DECL_PTRARR( CharAttribArray
, EditCharAttribPtr
, 0, 4 )
123 class ContentAttribsInfo
126 SfxItemSet aPrevParaAttribs
;
127 CharAttribArray aPrevCharAttribs
;
130 ContentAttribsInfo( const SfxItemSet
& rParaAttribs
);
132 const SfxItemSet
& GetPrevParaAttribs() const { return aPrevParaAttribs
; }
133 const CharAttribArray
& GetPrevCharAttribs() const { return aPrevCharAttribs
; }
135 CharAttribArray
& GetPrevCharAttribs() { return aPrevCharAttribs
; }
138 typedef ContentAttribsInfo
* ContentAttribsInfoPtr
;
139 SV_DECL_PTRARR( ContentInfoArray
, ContentAttribsInfoPtr
, 1, 1 )
141 // ----------------------------------------------------------------------
142 // class SvxFontTable
143 // ----------------------------------------------------------------------
144 DECLARE_TABLE( DummyFontTable
, SvxFontItem
* )
145 class SvxFontTable
: public DummyFontTable
151 ULONG
GetId( const SvxFontItem
& rFont
);
154 // ----------------------------------------------------------------------
155 // class SvxColorList
156 // ----------------------------------------------------------------------
157 typedef ContentNode
* ContentNodePtr
;
158 DECLARE_LIST( DummyColorList
, SvxColorItem
* )
159 class SvxColorList
: public DummyColorList
165 ULONG
GetId( const SvxColorItem
& rColor
);
168 // ----------------------------------------------------------------------
170 // ----------------------------------------------------------------------
171 typedef const SfxPoolItem
* ConstPoolItemPtr
;
172 DECLARE_LIST( DummyItemList
, ConstPoolItemPtr
)
173 class ItemList
: public DummyItemList
176 const SfxPoolItem
* FindAttrib( USHORT nWhich
);
179 // -------------------------------------------------------------------------
180 // class ContentAttribs
181 // -------------------------------------------------------------------------
185 SfxStyleSheet
* pStyle
;
186 SfxItemSet aAttribSet
;
189 ContentAttribs( SfxItemPool
& rItemPool
);
190 ContentAttribs( const ContentAttribs
& );
191 ~ContentAttribs(); // erst bei umfangreicheren Tabs
193 SvxTabStop
FindTabStop( long nCurPos
, USHORT nDefTab
);
194 SfxItemSet
& GetItems() { return aAttribSet
; }
195 SfxStyleSheet
* GetStyleSheet() const { return pStyle
; }
196 void SetStyleSheet( SfxStyleSheet
* pS
);
198 const SfxPoolItem
& GetItem( USHORT nWhich
);
199 BOOL
HasItem( USHORT nWhich
);
202 // -------------------------------------------------------------------------
203 // class CharAttribList
204 // -------------------------------------------------------------------------
208 CharAttribArray aAttribs
;
209 SvxFont aDefFont
; // schneller, als jedesmal vom Pool!
210 BOOL bHasEmptyAttribs
;
212 CharAttribList( const CharAttribList
& ) {;}
218 void DeleteEmptyAttribs( SfxItemPool
& rItemPool
);
219 void RemoveItemsFromPool( SfxItemPool
* pItemPool
);
221 EditCharAttrib
* FindAttrib( USHORT nWhich
, USHORT nPos
);
222 EditCharAttrib
* FindNextAttrib( USHORT nWhich
, USHORT nFromPos
) const;
223 EditCharAttrib
* FindEmptyAttrib( USHORT nWhich
, USHORT nPos
);
224 EditCharAttrib
* FindFeature( USHORT nPos
) const;
227 void ResortAttribs();
228 void OptimizeRanges( SfxItemPool
& rItemPool
);
230 USHORT
Count() { return aAttribs
.Count(); }
231 void Clear() { aAttribs
.Remove( 0, aAttribs
.Count()); }
232 void InsertAttrib( EditCharAttrib
* pAttrib
);
234 SvxFont
& GetDefFont() { return aDefFont
; }
236 BOOL
HasEmptyAttribs() const { return bHasEmptyAttribs
; }
237 BOOL
& HasEmptyAttribs() { return bHasEmptyAttribs
; }
238 BOOL
HasBoundingAttrib( USHORT nBound
);
239 BOOL
HasAttrib( USHORT nWhich
) const;
240 BOOL
HasAttrib( USHORT nStartPos
, USHORT nEndPos
) const;
242 CharAttribArray
& GetAttribs() { return aAttribs
; }
243 const CharAttribArray
& GetAttribs() const { return aAttribs
; }
246 BOOL
DbgCheckAttribs();
249 // -------------------------------------------------------------------------
251 // -------------------------------------------------------------------------
252 class ContentNode
: public XubString
255 ContentAttribs aContentAttribs
;
256 CharAttribList aCharAttribList
;
257 WrongList
* pWrongList
;
260 ContentNode( SfxItemPool
& rItemPool
);
261 ContentNode( const XubString
& rStr
, const ContentAttribs
& rContentAttribs
);
264 ContentAttribs
& GetContentAttribs() { return aContentAttribs
; }
265 CharAttribList
& GetCharAttribs() { return aCharAttribList
; }
267 void ExpandAttribs( USHORT nIndex
, USHORT nNewChars
, SfxItemPool
& rItemPool
);
268 void CollapsAttribs( USHORT nIndex
, USHORT nDelChars
, SfxItemPool
& rItemPool
);
269 void AppendAttribs( ContentNode
* pNextNode
);
270 void CopyAndCutAttribs( ContentNode
* pPrevNode
, SfxItemPool
& rPool
, BOOL bKeepEndingAttribs
);
272 void SetStyleSheet( SfxStyleSheet
* pS
, BOOL bRecalcFont
= TRUE
);
273 void SetStyleSheet( SfxStyleSheet
* pS
, const SvxFont
& rFontFromStyle
);
274 SfxStyleSheet
* GetStyleSheet() { return aContentAttribs
.GetStyleSheet(); }
276 void CreateDefFont();
278 WrongList
* GetWrongList() { return pWrongList
; }
279 void SetWrongList( WrongList
* p
);
281 void CreateWrongList();
282 void DestroyWrongList();
284 BOOL
IsFeature( USHORT nPos
) const { return ( GetChar( nPos
) == CH_FEATURE
); }
287 typedef ContentNode
* ContentNodePtr
;
288 SV_DECL_PTRARR( DummyContentList
, ContentNodePtr
, 0, 4 )
290 class ContentList
: public DummyContentList
294 ContentList() : DummyContentList( 0, 4 ), nLastCache(0) {}
295 USHORT
GetPos( const ContentNodePtr
&rPtr
) const;
298 // -------------------------------------------------------------------------
300 // -------------------------------------------------------------------------
308 EditPaM() { pNode
= NULL
; nIndex
= 0; }
309 EditPaM( ContentNode
* p
, USHORT n
) { pNode
= p
; nIndex
= n
; }
311 ContentNode
* GetNode() const { return pNode
; }
312 void SetNode( ContentNode
* p
) { pNode
= p
; }
314 USHORT
GetIndex() const { return nIndex
; }
315 USHORT
& GetIndex() { return nIndex
; }
316 void SetIndex( USHORT n
) { nIndex
= n
; }
318 BOOL
IsParaStart() const { return nIndex
== 0; }
319 BOOL
IsParaEnd() const { return nIndex
== pNode
->Len(); }
321 BOOL
DbgIsBuggy( EditDoc
& rDoc
);
323 EditPaM
& operator = ( const EditPaM
& rPaM
);
324 friend BOOL
operator == ( const EditPaM
& r1
, const EditPaM
& r2
);
325 friend BOOL
operator != ( const EditPaM
& r1
, const EditPaM
& r2
);
328 #define PORTIONKIND_TEXT 0
329 #define PORTIONKIND_TAB 1
330 #define PORTIONKIND_LINEBREAK 2
331 #define PORTIONKIND_FIELD 3
332 #define PORTIONKIND_HYPHENATOR 4
333 // #define PORTIONKIND_EXTRASPACE 5
335 #define DELMODE_SIMPLE 0
336 #define DELMODE_RESTOFWORD 1
337 #define DELMODE_RESTOFCONTENT 2
339 #define CHAR_NORMAL 0x00
340 #define CHAR_KANA 0x01
341 #define CHAR_PUNCTUATIONLEFT 0x02
342 #define CHAR_PUNCTUATIONRIGHT 0x04
344 // -------------------------------------------------------------------------
345 // struct ExtraPortionInfos
346 // -------------------------------------------------------------------------
347 struct ExtraPortionInfo
350 long nWidthFullCompression
;
352 long nPortionOffsetX
;
354 USHORT nMaxCompression100thPercent
;
356 BYTE nAsianCompressionTypes
;
357 BOOL bFirstCharIsRightPunktuation
;
360 sal_Int32
* pOrgDXArray
;
366 void SaveOrgDXArray( const sal_Int32
* pDXArray
, USHORT nLen
);
367 void DestroyOrgDXArray();
371 // -------------------------------------------------------------------------
373 // -------------------------------------------------------------------------
377 ExtraPortionInfo
* pExtraInfos
;
382 sal_Unicode nExtraValue
;
385 TextPortion() { DBG_CTOR( EE_TextPortion
, 0 );
386 pExtraInfos
= NULL
; nLen
= 0; nKind
= PORTIONKIND_TEXT
; nExtraValue
= 0; nRightToLeft
= FALSE
;}
389 TextPortion( USHORT nL
) : aOutSz( -1, -1 )
390 { DBG_CTOR( EE_TextPortion
, 0 );
391 pExtraInfos
= NULL
; nLen
= nL
; nKind
= PORTIONKIND_TEXT
; nExtraValue
= 0; nRightToLeft
= FALSE
;}
392 TextPortion( const TextPortion
& r
) : aOutSz( r
.aOutSz
)
393 { DBG_CTOR( EE_TextPortion
, 0 );
394 pExtraInfos
= NULL
; nLen
= r
.nLen
; nKind
= r
.nKind
; nExtraValue
= r
.nExtraValue
; nRightToLeft
= r
.nRightToLeft
; }
396 ~TextPortion() { DBG_DTOR( EE_TextPortion
, 0 ); delete pExtraInfos
; }
398 USHORT
GetLen() const { return nLen
; }
399 USHORT
& GetLen() { return nLen
; }
400 void SetLen( USHORT nL
) { nLen
= nL
; }
402 Size
& GetSize() { return aOutSz
; }
403 Size
GetSize() const { return aOutSz
; }
405 BYTE
& GetKind() { return nKind
; }
406 BYTE
GetKind() const { return nKind
; }
408 void SetRightToLeft( BYTE b
) { nRightToLeft
= b
; }
409 BYTE
GetRightToLeft() const { return nRightToLeft
; }
410 BOOL
IsRightToLeft() const { return (nRightToLeft
&1); }
412 sal_Unicode
GetExtraValue() const { return nExtraValue
; }
413 void SetExtraValue( sal_Unicode n
) { nExtraValue
= n
; }
415 BOOL
HasValidSize() const { return aOutSz
.Width() != (-1); }
417 ExtraPortionInfo
* GetExtraInfos() const { return pExtraInfos
; }
418 void SetExtraInfos( ExtraPortionInfo
* p
) { delete pExtraInfos
; pExtraInfos
= p
; }
421 // -------------------------------------------------------------------------
422 // class TextPortionList
423 // -------------------------------------------------------------------------
424 typedef TextPortion
* TextPortionPtr
;
425 SV_DECL_PTRARR( TextPortionArray
, TextPortionPtr
, 0, 8 )
427 class TextPortionList
: public TextPortionArray
434 USHORT
FindPortion( USHORT nCharPos
, USHORT
& rPortionStart
, BOOL bPreferStartingPortion
= FALSE
);
435 USHORT
GetStartPos( USHORT nPortion
);
436 void DeleteFromPortion( USHORT nDelFrom
);
441 SV_DECL_VARARR( CharPosArray
, sal_Int32
, 0, CHARPOSGROW
)
443 // ------------------------------------------------------------------------
445 // -------------------------------------------------------------------------
449 CharPosArray aPositions
;
452 USHORT nStart
; // koennte durch nStartPortion ersetzt werden
453 USHORT nEnd
; // koennte durch nEndPortion ersetzt werden
454 USHORT nStartPortion
;
456 USHORT nHeight
; // Gesamthoehe der Zeile
457 USHORT nTxtHeight
; // Reine Texthoehe
458 USHORT nCrsrHeight
; // Bei Konturfluss hohe Zeilen => Cursor zu groá.
460 BOOL bHangingPunctuation
;
461 BOOL bInvalid
; // fuer geschickte Formatierung
465 EditLine( const EditLine
& );
468 BOOL
IsIn( USHORT nIndex
) const
469 { return ( (nIndex
>= nStart
) && ( nIndex
< nEnd
) ); }
471 BOOL
IsIn( USHORT nIndex
, BOOL bInclEnd
) const
472 { return ( ( nIndex
>= nStart
) && ( bInclEnd
? ( nIndex
<= nEnd
) : ( nIndex
< nEnd
) ) ); }
474 void SetStart( USHORT n
) { nStart
= n
; }
475 USHORT
GetStart() const { return nStart
; }
476 USHORT
& GetStart() { return nStart
; }
478 void SetEnd( USHORT n
) { nEnd
= n
; }
479 USHORT
GetEnd() const { return nEnd
; }
480 USHORT
& GetEnd() { return nEnd
; }
482 void SetStartPortion( USHORT n
) { nStartPortion
= n
; }
483 USHORT
GetStartPortion() const { return nStartPortion
; }
484 USHORT
& GetStartPortion() { return nStartPortion
; }
486 void SetEndPortion( USHORT n
) { nEndPortion
= n
; }
487 USHORT
GetEndPortion() const { return nEndPortion
; }
488 USHORT
& GetEndPortion() { return nEndPortion
; }
490 void SetHeight( USHORT nH
, USHORT nTxtH
= 0, USHORT nCrsrH
= 0 )
492 nTxtHeight
= ( nTxtH
? nTxtH
: nH
);
493 nCrsrHeight
= ( nCrsrH
? nCrsrH
: nTxtHeight
);
495 USHORT
GetHeight() const { return nHeight
; }
496 USHORT
GetTxtHeight() const { return nTxtHeight
; }
497 USHORT
GetCrsrHeight() const { return nCrsrHeight
; }
499 void SetTextWidth( long n
) { nTxtWidth
= n
; }
500 long GetTextWidth() const { return nTxtWidth
; }
502 void SetMaxAscent( USHORT n
) { nMaxAscent
= n
; }
503 USHORT
GetMaxAscent() const { return nMaxAscent
; }
505 void SetHangingPunctuation( BOOL b
) { bHangingPunctuation
= b
; }
506 BOOL
IsHangingPunctuation() const { return bHangingPunctuation
; }
508 USHORT
GetLen() const { return nEnd
- nStart
; }
510 USHORT
GetStartPosX() const { return nStartPosX
; }
511 void SetStartPosX( USHORT start
) { nStartPosX
= start
; }
513 Size
CalcTextSize( ParaPortion
& rParaPortion
);
515 BOOL
IsInvalid() const { return bInvalid
; }
516 BOOL
IsValid() const { return !bInvalid
; }
517 void SetInvalid() { bInvalid
= TRUE
; }
518 void SetValid() { bInvalid
= FALSE
; }
520 BOOL
IsEmpty() const { return (nEnd
> nStart
) ? FALSE
: TRUE
; }
522 CharPosArray
& GetCharPosArray() { return aPositions
; }
524 EditLine
* Clone() const;
526 EditLine
& operator = ( const EditLine
& rLine
);
527 friend BOOL
operator == ( const EditLine
& r1
, const EditLine
& r2
);
528 friend BOOL
operator != ( const EditLine
& r1
, const EditLine
& r2
);
532 // -------------------------------------------------------------------------
534 // -------------------------------------------------------------------------
535 typedef EditLine
* EditLinePtr
;
536 SV_DECL_PTRARR( LineArray
, EditLinePtr
, 0, 4 )
538 class EditLineList
: public LineArray
545 void DeleteFromLine( USHORT nDelFrom
);
546 USHORT
FindLine( USHORT nChar
, BOOL bInclEnd
);
549 // -------------------------------------------------------------------------
551 // -------------------------------------------------------------------------
554 friend class ImpEditEngine
; // zum Einstellen der Hoehe
556 EditLineList aLineList
;
557 TextPortionList aTextPortionList
;
561 ScriptTypePosInfos aScriptInfos
;
562 WritingDirectionInfos aWritingDirectionInfos
;
564 USHORT nInvalidPosStart
;
565 USHORT nFirstLineOffset
; // Fuer Writer-LineSpacing-Interpretation
570 BOOL bSimple
: 1; // nur lineares Tippen
571 BOOL bVisible
: 1; // MT 05/00: Gehoert an den Node!!!
572 BOOL bForceRepaint
: 1;
574 ParaPortion( const ParaPortion
& );
577 ParaPortion( ContentNode
* pNode
);
580 USHORT
GetLineNumber( USHORT nIndex
);
582 EditLineList
& GetLines() { return aLineList
; }
584 BOOL
IsInvalid() const { return bInvalid
; }
585 BOOL
IsSimpleInvalid() const { return bSimple
; }
586 void SetValid() { bInvalid
= FALSE
; bSimple
= TRUE
;}
588 BOOL
MustRepaint() const { return bForceRepaint
; }
589 void SetMustRepaint( BOOL bRP
) { bForceRepaint
= bRP
; }
591 USHORT
GetBulletX() const { return nBulletX
; }
592 void SetBulletX( USHORT n
) { nBulletX
= n
; }
594 void MarkInvalid( USHORT nStart
, short nDiff
);
595 void MarkSelectionInvalid( USHORT nStart
, USHORT nEnd
);
597 void SetVisible( BOOL bVisible
);
598 BOOL
IsVisible() { return bVisible
; }
600 long GetHeight() const { return ( bVisible
? nHeight
: 0 ); }
601 USHORT
GetFirstLineOffset() const { return ( bVisible
? nFirstLineOffset
: 0 ); }
602 void ResetHeight() { nHeight
= 0; nFirstLineOffset
= 0; }
604 ContentNode
* GetNode() const { return pNode
; }
605 TextPortionList
& GetTextPortions() { return aTextPortionList
; }
607 USHORT
GetInvalidPosStart() const { return nInvalidPosStart
; }
608 short GetInvalidDiff() const { return nInvalidDiff
; }
610 void CorrectValuesBehindLastFormattedLine( USHORT nLastFormattedLine
);
612 BOOL
DbgCheckTextPortions();
615 typedef ParaPortion
* ParaPortionPtr
;
616 SV_DECL_PTRARR( DummyParaPortionList
, ParaPortionPtr
, 0, 4 )
618 // -------------------------------------------------------------------------
619 // class ParaPortionList
620 // -------------------------------------------------------------------------
621 class ParaPortionList
: public DummyParaPortionList
629 long GetYOffset( ParaPortion
* pPPortion
);
630 USHORT
FindParagraph( long nYOffset
);
632 inline ParaPortion
* SaveGetObject( USHORT nPos
) const
633 { return ( nPos
< Count() ) ? GetObject( nPos
) : 0; }
635 USHORT
GetPos( const ParaPortionPtr
&rPtr
) const;
638 void DbgCheck( EditDoc
& rDoc
);
641 // -------------------------------------------------------------------------
642 // class EditSelection
643 // -------------------------------------------------------------------------
651 EditSelection(); // kein CCTOR und DTOR, geht autom. richtig!
652 EditSelection( const EditPaM
& rStartAndAnd
);
653 EditSelection( const EditPaM
& rStart
, const EditPaM
& rEnd
);
655 EditPaM
& Min() { return aStartPaM
; }
656 EditPaM
& Max() { return aEndPaM
; }
658 const EditPaM
& Min() const { return aStartPaM
; }
659 const EditPaM
& Max() const { return aEndPaM
; }
661 BOOL
HasRange() const { return aStartPaM
!= aEndPaM
; }
662 BOOL
IsInvalid() const;
663 BOOL
DbgIsBuggy( EditDoc
& rDoc
);
665 BOOL
Adjust( const ContentList
& rNodes
);
667 EditSelection
& operator = ( const EditPaM
& r
);
668 BOOL
operator == ( const EditSelection
& r
) const
669 { return ( ( aStartPaM
== r
.aStartPaM
) && ( aEndPaM
== r
.aEndPaM
) )
671 BOOL
operator != ( const EditSelection
& r
) const { return !( r
== *this ); }
674 // -------------------------------------------------------------------------
675 // class DeletedNodeInfo
676 // -------------------------------------------------------------------------
677 class DeletedNodeInfo
680 ULONG nInvalidAdressPtr
;
681 USHORT nInvalidParagraph
;
684 DeletedNodeInfo( ULONG nInvAdr
, USHORT nPos
)
685 { nInvalidAdressPtr
= nInvAdr
;
686 nInvalidParagraph
= nPos
; }
688 ULONG
GetInvalidAdress() { return nInvalidAdressPtr
; }
689 USHORT
GetPosition() { return nInvalidParagraph
; }
692 typedef DeletedNodeInfo
* DeletedNodeInfoPtr
;
693 SV_DECL_PTRARR( DeletedNodesList
, DeletedNodeInfoPtr
, 0, 4 )
695 // -------------------------------------------------------------------------
697 // -------------------------------------------------------------------------
698 class EditDoc
: public ContentList
701 SfxItemPool
* pItemPool
;
704 SvxFont aDefFont
; //schneller, als jedesmal vom Pool!
707 BOOL bIsFixedCellHeight
;
713 void ImplDestroyContents();
716 EditDoc( SfxItemPool
* pItemPool
);
719 BOOL
IsModified() const { return bModified
; }
720 void SetModified( BOOL b
);
722 void SetModifyHdl( const Link
& rLink
) { aModifyHdl
= rLink
; }
723 Link
GetModifyHdl() const { return aModifyHdl
; }
725 void CreateDefFont( BOOL bUseStyles
);
726 const SvxFont
& GetDefFont() { return aDefFont
; }
728 void SetDefTab( USHORT nTab
) { nDefTab
= nTab
? nTab
: DEFTAB
; }
729 USHORT
GetDefTab() const { return nDefTab
; }
731 void SetVertical( BOOL bVertical
) { bIsVertical
= bVertical
; }
732 BOOL
IsVertical() const { return bIsVertical
; }
734 void SetFixedCellHeight( BOOL bUseFixedCellHeight
) { bIsFixedCellHeight
= bUseFixedCellHeight
; }
735 BOOL
IsFixedCellHeight() const { return bIsFixedCellHeight
; }
738 EditPaM
RemoveText();
739 EditPaM
RemoveChars( EditPaM aPaM
, USHORT nChars
);
740 void InsertText( const EditPaM
& rPaM
, xub_Unicode c
);
741 EditPaM
InsertText( EditPaM aPaM
, const XubString
& rStr
);
742 EditPaM
InsertParaBreak( EditPaM aPaM
, BOOL bKeepEndingAttribs
);
743 EditPaM
InsertFeature( EditPaM aPaM
, const SfxPoolItem
& rItem
);
744 EditPaM
ConnectParagraphs( ContentNode
* pLeft
, ContentNode
* pRight
);
746 String
GetText( LineEnd eEnd
) const;
747 ULONG
GetTextLen() const;
749 XubString
GetParaAsString( USHORT nNode
) const;
750 XubString
GetParaAsString( ContentNode
* pNode
, USHORT nStartPos
= 0, USHORT nEndPos
= 0xFFFF, BOOL bResolveFields
= TRUE
) const;
752 inline EditPaM
GetStartPaM() const;
753 inline EditPaM
GetEndPaM() const;
755 SfxItemPool
& GetItemPool() { return *pItemPool
; }
756 const SfxItemPool
& GetItemPool() const { return *pItemPool
; }
758 void RemoveItemsFromPool( ContentNode
* pNode
);
760 void InsertAttrib( const SfxPoolItem
& rItem
, ContentNode
* pNode
, USHORT nStart
, USHORT nEnd
);
761 void InsertAttrib( ContentNode
* pNode
, USHORT nStart
, USHORT nEnd
, const SfxPoolItem
& rPoolItem
);
762 void InsertAttribInSelection( ContentNode
* pNode
, USHORT nStart
, USHORT nEnd
, const SfxPoolItem
& rPoolItem
);
763 BOOL
RemoveAttribs( ContentNode
* pNode
, USHORT nStart
, USHORT nEnd
, USHORT nWhich
= 0 );
764 BOOL
RemoveAttribs( ContentNode
* pNode
, USHORT nStart
, USHORT nEnd
, EditCharAttrib
*& rpStarting
, EditCharAttrib
*& rpEnding
, USHORT nWhich
= 0 );
765 void FindAttribs( ContentNode
* pNode
, USHORT nStartPos
, USHORT nEndPos
, SfxItemSet
& rCurSet
);
767 USHORT
GetPos( ContentNode
* pNode
) const { return ContentList::GetPos(pNode
); }
768 ContentNode
* SaveGetObject( USHORT nPos
) const { return ( nPos
< Count() ) ? GetObject( nPos
) : 0; }
770 static XubString
GetSepStr( LineEnd eEnd
);
773 inline EditPaM
EditDoc::GetStartPaM() const
775 return EditPaM( GetObject( 0 ), 0 );
778 inline EditPaM
EditDoc::GetEndPaM() const
780 ContentNode
* pLastNode
= GetObject( Count()-1 );
781 return EditPaM( pLastNode
, pLastNode
->Len() );
784 inline EditCharAttrib
* GetAttrib( const CharAttribArray
& rAttribs
, USHORT nAttr
)
786 return ( nAttr
< rAttribs
.Count() ) ? rAttribs
[nAttr
] : 0;
789 BOOL
CheckOrderedList( CharAttribArray
& rAttribs
, BOOL bStart
);
791 // -------------------------------------------------------------------------
792 // class EditEngineItemPool
793 // -------------------------------------------------------------------------
794 class EditEngineItemPool
: public SfxItemPool
797 EditEngineItemPool( BOOL bPersistenRefCounts
);
799 virtual ~EditEngineItemPool();
802 virtual SvStream
& Store( SvStream
& rStream
) const;
805 #endif // _EDITDOC_HXX