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 .
22 #include "editattr.hxx"
23 #include "edtspell.hxx"
24 #include "eerdll2.hxx"
25 #include <editeng/svxfont.hxx>
26 #include <svl/itemset.hxx>
27 #include <svl/style.hxx>
28 #include <svl/itempool.hxx>
29 #include <svl/languageoptions.hxx>
30 #include <tools/lineend.hxx>
31 #include <o3tl/typed_flags_set.hxx>
38 enum class TextRotation
;
41 #define CHARPOSGROW 16
44 void CreateFont( SvxFont
& rFont
, const SfxItemSet
& rSet
, bool bSearchInParent
= true, SvtScriptType nScriptType
= SvtScriptType::NONE
);
45 sal_uInt16
GetScriptItemId( sal_uInt16 nItemId
, SvtScriptType nScriptType
);
46 bool IsScriptItemValid( sal_uInt16 nItemId
, short nScriptType
);
48 EditCharAttrib
* MakeCharAttrib( SfxItemPool
& rPool
, const SfxPoolItem
& rAttr
, sal_Int32 nS
, sal_Int32 nE
);
58 EPaM() : nPara(0), nIndex(0) {}
59 EPaM( sal_Int32 nP
, sal_Int32 nI
) : nPara(nP
), nIndex(nI
) {}
60 EPaM( const EPaM
& r
) : nPara(r
.nPara
), nIndex(r
.nIndex
) {}
61 EPaM
& operator = ( const EPaM
& r
) { nPara
= r
.nPara
; nIndex
= r
.nIndex
; return *this; }
62 inline bool operator == ( const EPaM
& r
) const;
63 inline bool operator < ( const EPaM
& r
) const;
66 inline bool EPaM::operator < ( const EPaM
& r
) const
68 return ( nPara
< r
.nPara
) || ( ( nPara
== r
.nPara
) && nIndex
< r
.nIndex
);
71 inline bool EPaM::operator == ( const EPaM
& r
) const
73 return ( nPara
== r
.nPara
) && ( nIndex
== r
.nIndex
);
76 struct ScriptTypePosInfo
82 ScriptTypePosInfo( short Type
, sal_Int32 Start
, sal_Int32 End
)
90 typedef std::vector
<ScriptTypePosInfo
> ScriptTypePosInfos
;
92 struct WritingDirectionInfo
98 WritingDirectionInfo( sal_uInt8 Type
, sal_Int32 Start
, sal_Int32 End
)
107 typedef std::vector
<WritingDirectionInfo
> WritingDirectionInfos
;
109 class ContentAttribsInfo
112 typedef std::vector
<std::unique_ptr
<EditCharAttrib
> > CharAttribsType
;
114 SfxItemSet aPrevParaAttribs
;
115 CharAttribsType aPrevCharAttribs
;
118 ContentAttribsInfo( const SfxItemSet
& rParaAttribs
);
120 const SfxItemSet
& GetPrevParaAttribs() const { return aPrevParaAttribs
; }
121 const CharAttribsType
& GetPrevCharAttribs() const { return aPrevCharAttribs
; }
123 void RemoveAllCharAttribsFromPool(SfxItemPool
& rPool
) const;
124 void AppendCharAttrib(EditCharAttrib
* pNew
);
129 typedef std::vector
<Color
> SvxColorList
;
137 typedef std::vector
<const SfxPoolItem
*> DummyItemList
;
138 DummyItemList aItemPool
;
139 sal_Int32 CurrentItem
;
143 const SfxPoolItem
* First();
144 const SfxPoolItem
* Next();
145 sal_Int32
Count() { return aItemPool
.size(); };
146 void Insert( const SfxPoolItem
* pItem
);
147 void Clear() { aItemPool
.clear(); };
155 SfxStyleSheet
* pStyle
;
156 SfxItemSet aAttribSet
;
159 ContentAttribs( SfxItemPool
& rItemPool
);
161 void dumpAsXml(xmlTextWriterPtr pWriter
) const;
163 SvxTabStop
FindTabStop( sal_Int32 nCurPos
, sal_uInt16 nDefTab
);
164 SfxItemSet
& GetItems() { return aAttribSet
; }
165 const SfxItemSet
& GetItems() const { return aAttribSet
; }
166 const SfxStyleSheet
* GetStyleSheet() const { return pStyle
; }
167 SfxStyleSheet
* GetStyleSheet() { return pStyle
; }
168 void SetStyleSheet( SfxStyleSheet
* pS
);
170 const SfxPoolItem
& GetItem( sal_uInt16 nWhich
) const;
172 const T
& GetItem( TypedWhichId
<T
> nWhich
) const
174 return static_cast<const T
&>(GetItem(sal_uInt16(nWhich
)));
176 bool HasItem( sal_uInt16 nWhich
) const;
184 typedef std::vector
<std::unique_ptr
<EditCharAttrib
> > AttribsType
;
187 AttribsType aAttribs
;
188 SvxFont aDefFont
; // faster than ever from the pool!
189 bool bHasEmptyAttribs
;
195 void dumpAsXml(xmlTextWriterPtr pWriter
) const;
197 void DeleteEmptyAttribs( SfxItemPool
& rItemPool
);
199 const EditCharAttrib
* FindAttrib( sal_uInt16 nWhich
, sal_Int32 nPos
) const;
200 EditCharAttrib
* FindAttrib( sal_uInt16 nWhich
, sal_Int32 nPos
);
201 const EditCharAttrib
* FindNextAttrib( sal_uInt16 nWhich
, sal_Int32 nFromPos
) const;
202 EditCharAttrib
* FindEmptyAttrib( sal_uInt16 nWhich
, sal_Int32 nPos
);
203 const EditCharAttrib
* FindFeature( sal_Int32 nPos
) const;
206 void ResortAttribs();
207 void OptimizeRanges( SfxItemPool
& rItemPool
);
209 sal_Int32
Count() const;
211 void InsertAttrib( EditCharAttrib
* pAttrib
);
213 SvxFont
& GetDefFont() { return aDefFont
; }
215 bool HasEmptyAttribs() const { return bHasEmptyAttribs
; }
216 void SetHasEmptyAttribs(bool b
);
217 bool HasBoundingAttrib( sal_Int32 nBound
) const;
218 bool HasAttrib( sal_Int32 nStartPos
, sal_Int32 nEndPos
) const;
220 AttribsType
& GetAttribs() { return aAttribs
;}
221 const AttribsType
& GetAttribs() const { return aAttribs
;}
223 void Remove(const EditCharAttrib
* p
);
224 void Remove(sal_Int32 nPos
);
226 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
227 static void DbgCheckAttribs(CharAttribList
const& rAttribs
);
237 ContentAttribs aContentAttribs
;
238 CharAttribList aCharAttribList
;
239 std::unique_ptr
<WrongList
> mpWrongList
;
241 void UnExpandPosition( sal_Int32
&rStartPos
, bool bBiasStart
);
244 ContentNode( SfxItemPool
& rItemPool
);
245 ContentNode( const OUString
& rStr
, const ContentAttribs
& rContentAttribs
);
247 ContentNode(const ContentNode
&) = delete;
248 ContentNode
& operator=(const ContentNode
&) = delete;
250 void dumpAsXml(xmlTextWriterPtr pWriter
) const;
252 ContentAttribs
& GetContentAttribs() { return aContentAttribs
; }
253 const ContentAttribs
& GetContentAttribs() const { return aContentAttribs
; }
254 CharAttribList
& GetCharAttribs() { return aCharAttribList
; }
255 const CharAttribList
& GetCharAttribs() const { return aCharAttribList
; }
257 void ExpandAttribs( sal_Int32 nIndex
, sal_Int32 nNewChars
, SfxItemPool
& rItemPool
);
258 void CollapseAttribs( sal_Int32 nIndex
, sal_Int32 nDelChars
, SfxItemPool
& rItemPool
);
259 void AppendAttribs( ContentNode
* pNextNode
);
260 void CopyAndCutAttribs( ContentNode
* pPrevNode
, SfxItemPool
& rPool
, bool bKeepEndingAttribs
);
262 void SetStyleSheet( SfxStyleSheet
* pS
, bool bRecalcFont
= true );
263 void SetStyleSheet( SfxStyleSheet
* pS
, const SvxFont
& rFontFromStyle
);
264 SfxStyleSheet
* GetStyleSheet() { return aContentAttribs
.GetStyleSheet(); }
266 void CreateDefFont();
268 void EnsureWrongList();
269 WrongList
* GetWrongList();
270 const WrongList
* GetWrongList() const;
271 void SetWrongList( WrongList
* p
);
273 void CreateWrongList();
274 void DestroyWrongList();
276 bool IsFeature( sal_Int32 nPos
) const;
278 sal_Int32
Len() const;
279 const OUString
& GetString() const { return maString
;}
281 /// return length including expanded fields
282 sal_uLong
GetExpandedLen() const;
283 /// return content including expanded fields
284 OUString
GetExpandedText(sal_Int32 nStartPos
= 0, sal_Int32 nEndPos
= -1) const;
285 /// re-write offsets in the expanded text to string offsets
286 void UnExpandPositions( sal_Int32
&rStartPos
, sal_Int32
&rEndPos
);
288 void SetChar(sal_Int32 nPos
, sal_Unicode c
);
289 void Insert(const OUString
& rStr
, sal_Int32 nPos
);
290 void Append(const OUString
& rStr
);
291 void Erase(sal_Int32 nPos
);
292 void Erase(sal_Int32 nPos
, sal_Int32 nCount
);
293 OUString
Copy(sal_Int32 nPos
) const;
294 OUString
Copy(sal_Int32 nPos
, sal_Int32 nCount
) const;
295 sal_Unicode
GetChar(sal_Int32 nPos
) const;
308 EditPaM(ContentNode
* p
, sal_Int32 n
);
310 const ContentNode
* GetNode() const { return pNode
;}
311 ContentNode
* GetNode() { return pNode
;}
312 void SetNode(ContentNode
* p
);
314 sal_Int32
GetIndex() const { return nIndex
; }
315 void SetIndex( sal_Int32 n
) { nIndex
= n
; }
317 bool DbgIsBuggy( EditDoc
const & rDoc
) const;
319 friend bool operator == ( const EditPaM
& r1
, const EditPaM
& r2
);
320 friend bool operator != ( const EditPaM
& r1
, const EditPaM
& r2
);
321 bool operator !() const { return !pNode
&& !nIndex
; }
324 enum class PortionKind
333 enum class DeleteMode
{
334 Simple
, RestOfWord
, RestOfContent
337 enum class AsianCompressionFlags
{
340 PunctuationLeft
= 0x02,
341 PunctuationRight
= 0x04,
344 template<> struct typed_flags
<AsianCompressionFlags
> : is_typed_flags
<AsianCompressionFlags
, 0x07> {};
349 // struct ExtraPortionInfos
351 struct ExtraPortionInfo
353 tools::Long nOrgWidth
;
354 tools::Long nWidthFullCompression
;
356 tools::Long nPortionOffsetX
;
358 sal_uInt16 nMaxCompression100thPercent
;
360 AsianCompressionFlags nAsianCompressionTypes
;
361 bool bFirstCharIsRightPunktuation
;
364 std::unique_ptr
<tools::Long
[]> pOrgDXArray
;
365 std::vector
< sal_Int32
> lineBreaksList
;
371 void SaveOrgDXArray( const tools::Long
* pDXArray
, sal_Int32 nLen
);
379 std::unique_ptr
<ExtraPortionInfo
> xExtraInfos
;
383 sal_uInt8 nRightToLeftLevel
;
384 sal_Unicode nExtraValue
;
388 TextPortion( sal_Int32 nL
)
391 , nKind( PortionKind::TEXT
)
392 , nRightToLeftLevel( 0 )
397 TextPortion( const TextPortion
& r
)
401 , nRightToLeftLevel( r
.nRightToLeftLevel
)
402 , nExtraValue( r
.nExtraValue
)
407 sal_Int32
GetLen() const { return nLen
; }
408 void SetLen( sal_Int32 nL
) { nLen
= nL
; }
410 Size
& GetSize() { return aOutSz
; }
411 const Size
& GetSize() const { return aOutSz
; }
413 void SetKind(PortionKind n
) { nKind
= n
; }
414 PortionKind
GetKind() const { return nKind
; }
416 void SetRightToLeftLevel( sal_uInt8 n
) { nRightToLeftLevel
= n
; }
417 sal_uInt8
GetRightToLeftLevel() const { return nRightToLeftLevel
; }
418 bool IsRightToLeft() const { return (nRightToLeftLevel
&1); }
420 sal_Unicode
GetExtraValue() const { return nExtraValue
; }
421 void SetExtraValue( sal_Unicode n
) { nExtraValue
= n
; }
423 ExtraPortionInfo
* GetExtraInfos() const { return xExtraInfos
.get(); }
424 void SetExtraInfos( ExtraPortionInfo
* p
) { xExtraInfos
.reset(p
); }
429 class TextPortionList
431 typedef std::vector
<std::unique_ptr
<TextPortion
> > PortionsType
;
432 PortionsType maPortions
;
439 sal_Int32
FindPortion(
440 sal_Int32 nCharPos
, sal_Int32
& rPortionStart
, bool bPreferStartingPortion
= false) const;
441 sal_Int32
GetStartPos(sal_Int32 nPortion
);
442 void DeleteFromPortion(sal_Int32 nDelFrom
);
443 sal_Int32
Count() const;
444 const TextPortion
& operator[](sal_Int32 nPos
) const;
445 TextPortion
& operator[](sal_Int32 nPos
);
447 void Append(TextPortion
* p
);
448 void Insert(sal_Int32 nPos
, TextPortion
* p
);
449 void Remove(sal_Int32 nPos
);
450 sal_Int32
GetPos(const TextPortion
* p
) const;
460 typedef std::vector
<tools::Long
> CharPosArrayType
;
463 CharPosArrayType aPositions
;
464 tools::Long nTxtWidth
;
465 tools::Long nStartPosX
;
466 sal_Int32 nStart
; // could be replaced by nStartPortion
467 sal_Int32 nEnd
; // could be replaced by nEndPortion
468 sal_Int32 nStartPortion
;
469 sal_Int32 nEndPortion
;
470 sal_uInt16 nHeight
; // Total height of the line
471 sal_uInt16 nTxtHeight
; // Pure Text height
472 sal_uInt16 nMaxAscent
;
473 bool bHangingPunctuation
:1;
474 bool bInvalid
:1; // for skillful formatting
478 EditLine( const EditLine
& );
481 bool IsIn( sal_Int32 nIndex
) const
482 { return ( (nIndex
>= nStart
) && ( nIndex
< nEnd
) ); }
484 bool IsIn( sal_Int32 nIndex
, bool bInclEnd
) const
485 { return ( ( nIndex
>= nStart
) && ( bInclEnd
? ( nIndex
<= nEnd
) : ( nIndex
< nEnd
) ) ); }
487 void SetStart( sal_Int32 n
) { nStart
= n
; }
488 sal_Int32
GetStart() const { return nStart
; }
489 sal_Int32
& GetStart() { return nStart
; }
491 void SetEnd( sal_Int32 n
) { nEnd
= n
; }
492 sal_Int32
GetEnd() const { return nEnd
; }
493 sal_Int32
& GetEnd() { return nEnd
; }
495 void SetStartPortion( sal_Int32 n
) { nStartPortion
= n
; }
496 sal_Int32
GetStartPortion() const { return nStartPortion
; }
497 sal_Int32
& GetStartPortion() { return nStartPortion
; }
499 void SetEndPortion( sal_Int32 n
) { nEndPortion
= n
; }
500 sal_Int32
GetEndPortion() const { return nEndPortion
; }
501 sal_Int32
& GetEndPortion() { return nEndPortion
; }
503 void SetHeight( sal_uInt16 nH
, sal_uInt16 nTxtH
= 0 );
504 sal_uInt16
GetHeight() const { return nHeight
; }
505 sal_uInt16
GetTxtHeight() const { return nTxtHeight
; }
507 void SetTextWidth( tools::Long n
) { nTxtWidth
= n
; }
508 tools::Long
GetTextWidth() const { return nTxtWidth
; }
510 void SetMaxAscent( sal_uInt16 n
) { nMaxAscent
= n
; }
511 sal_uInt16
GetMaxAscent() const { return nMaxAscent
; }
513 void SetHangingPunctuation( bool b
) { bHangingPunctuation
= b
; }
514 bool IsHangingPunctuation() const { return bHangingPunctuation
; }
516 sal_Int32
GetLen() const { return nEnd
- nStart
; }
518 tools::Long
GetStartPosX() const { return nStartPosX
; }
519 void SetStartPosX( tools::Long start
);
520 Size
CalcTextSize( ParaPortion
& rParaPortion
);
522 bool IsInvalid() const { return bInvalid
; }
523 bool IsValid() const { return !bInvalid
; }
524 void SetInvalid() { bInvalid
= true; }
525 void SetValid() { bInvalid
= false; }
527 bool IsEmpty() const { return nEnd
<= nStart
; }
529 CharPosArrayType
& GetCharPosArray() { return aPositions
;}
530 const CharPosArrayType
& GetCharPosArray() const { return aPositions
;}
532 EditLine
* Clone() const;
534 EditLine
& operator = ( const EditLine
& rLine
);
535 friend bool operator == ( const EditLine
& r1
, const EditLine
& r2
);
542 typedef std::vector
<std::unique_ptr
<EditLine
> > LinesType
;
550 void DeleteFromLine(sal_Int32 nDelFrom
);
551 sal_Int32
FindLine(sal_Int32 nChar
, bool bInclEnd
);
552 sal_Int32
Count() const;
553 const EditLine
& operator[](sal_Int32 nPos
) const;
554 EditLine
& operator[](sal_Int32 nPos
);
556 void Append(EditLine
* p
);
557 void Insert(sal_Int32 nPos
, EditLine
* p
);
564 friend class ImpEditEngine
; // to adjust the height
566 EditLineList aLineList
;
567 TextPortionList aTextPortionList
;
571 ScriptTypePosInfos aScriptInfos
;
572 WritingDirectionInfos aWritingDirectionInfos
;
574 sal_Int32 nInvalidPosStart
;
575 sal_Int32 nFirstLineOffset
; // For Writer-LineSpacing-Interpretation
577 sal_Int32 nInvalidDiff
;
580 bool bSimple
: 1; // only linear Tap
581 bool bVisible
: 1; // Belongs to the node!
582 bool bForceRepaint
: 1;
584 ParaPortion( const ParaPortion
& ) = delete;
587 ParaPortion( ContentNode
* pNode
);
590 sal_Int32
GetLineNumber( sal_Int32 nIndex
) const;
592 EditLineList
& GetLines() { return aLineList
; }
593 const EditLineList
& GetLines() const { return aLineList
; }
595 bool IsInvalid() const { return bInvalid
; }
596 bool IsSimpleInvalid() const { return bSimple
; }
597 void SetValid() { bInvalid
= false; bSimple
= true;}
599 bool MustRepaint() const { return bForceRepaint
; }
600 void SetMustRepaint( bool bRP
) { bForceRepaint
= bRP
; }
602 sal_Int32
GetBulletX() const { return nBulletX
; }
603 void SetBulletX( sal_Int32 n
) { nBulletX
= n
; }
605 void MarkInvalid( sal_Int32 nStart
, sal_Int32 nDiff
);
606 void MarkSelectionInvalid( sal_Int32 nStart
);
608 void SetVisible( bool bVisible
);
609 bool IsVisible() const { return bVisible
; }
611 bool IsEmpty() { return GetTextPortions().Count() == 1 && GetTextPortions()[0].GetLen() == 0; }
613 tools::Long
GetHeight() const { return ( bVisible
? nHeight
: 0 ); }
614 sal_Int32
GetFirstLineOffset() const { return ( bVisible
? nFirstLineOffset
: 0 ); }
615 void ResetHeight() { nHeight
= 0; nFirstLineOffset
= 0; }
617 ContentNode
* GetNode() const { return pNode
; }
618 TextPortionList
& GetTextPortions() { return aTextPortionList
; }
619 const TextPortionList
& GetTextPortions() const { return aTextPortionList
; }
621 sal_Int32
GetInvalidPosStart() const { return nInvalidPosStart
; }
622 short GetInvalidDiff() const { return nInvalidDiff
; }
624 void CorrectValuesBehindLastFormattedLine( sal_Int32 nLastFormattedLine
);
625 #if OSL_DEBUG_LEVEL > 0
626 static bool DbgCheckTextPortions(ParaPortion
const&);
632 class ParaPortionList
634 mutable sal_Int32 nLastCache
;
635 std::vector
<std::unique_ptr
<ParaPortion
>> maPortions
;
641 tools::Long
GetYOffset(const ParaPortion
* pPPortion
) const;
642 sal_Int32
FindParagraph(tools::Long nYOffset
) const;
644 const ParaPortion
* SafeGetObject(sal_Int32 nPos
) const;
645 ParaPortion
* SafeGetObject(sal_Int32 nPos
);
647 sal_Int32
GetPos(const ParaPortion
* p
) const;
648 ParaPortion
* operator[](sal_Int32 nPos
);
649 const ParaPortion
* operator[](sal_Int32 nPos
) const;
651 std::unique_ptr
<ParaPortion
> Release(sal_Int32 nPos
);
652 void Remove(sal_Int32 nPos
);
653 void Insert(sal_Int32 nPos
, std::unique_ptr
<ParaPortion
> p
);
654 void Append(std::unique_ptr
<ParaPortion
> p
);
655 sal_Int32
Count() const;
657 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
659 static void DbgCheck(ParaPortionList
const&, EditDoc
const& rDoc
);
672 EditSelection(); // No constructor and destructor
673 // are automatically executed correctly!
674 EditSelection( const EditPaM
& rStartAndAnd
);
675 EditSelection( const EditPaM
& rStart
, const EditPaM
& rEnd
);
677 EditPaM
& Min() { return aStartPaM
; }
678 EditPaM
& Max() { return aEndPaM
; }
680 const EditPaM
& Min() const { return aStartPaM
; }
681 const EditPaM
& Max() const { return aEndPaM
; }
683 bool HasRange() const { return aStartPaM
!= aEndPaM
; }
684 bool IsInvalid() const { return !aStartPaM
|| !aEndPaM
; }
685 bool DbgIsBuggy( EditDoc
const & rDoc
) const;
687 void Adjust( const EditDoc
& rNodes
);
689 EditSelection
& operator = ( const EditPaM
& r
);
690 bool operator == ( const EditSelection
& r
) const
691 { return ( aStartPaM
== r
.aStartPaM
) && ( aEndPaM
== r
.aEndPaM
); }
692 bool operator != ( const EditSelection
& r
) const { return !( r
== *this ); }
697 class DeletedNodeInfo
700 ContentNode
* mpInvalidNode
;
701 sal_Int32 nInvalidParagraph
;
704 DeletedNodeInfo( ContentNode
* pNode
, sal_Int32 nPos
)
705 : mpInvalidNode(pNode
)
706 , nInvalidParagraph(nPos
)
710 ContentNode
* GetNode() const { return mpInvalidNode
; }
711 sal_Int32
GetPosition() const { return nInvalidParagraph
; }
719 mutable sal_Int32 nLastCache
;
720 std::vector
<std::unique_ptr
<ContentNode
> > maContents
;
722 SfxItemPool
* pItemPool
;
723 Link
<LinkParamNone
*,void> aModifyHdl
;
725 SvxFont aDefFont
; //faster than ever from the pool!!
728 TextRotation mnRotation
;
729 bool bIsFixedCellHeight
:1;
733 bool bDisableAttributeExpanding
:1;
736 void ImplDestroyContents();
739 EditDoc( SfxItemPool
* pItemPool
);
742 void dumpAsXml(xmlTextWriterPtr pWriter
) const;
743 void ClearSpellErrors();
745 bool IsModified() const { return bModified
; }
746 void SetModified( bool b
);
748 void DisableAttributeExpanding() { bDisableAttributeExpanding
= true; }
750 void SetModifyHdl( const Link
<LinkParamNone
*,void>& rLink
) { aModifyHdl
= rLink
; }
752 void CreateDefFont( bool bUseStyles
);
753 const SvxFont
& GetDefFont() const { return aDefFont
; }
755 void SetDefTab( sal_uInt16 nTab
) { nDefTab
= nTab
? nTab
: DEFTAB
; }
756 sal_uInt16
GetDefTab() const { return nDefTab
; }
758 void SetVertical( bool bVertical
) { bIsVertical
= bVertical
; }
759 bool IsVertical() const;
760 bool IsTopToBottom() const;
761 bool GetDirectVertical() const;
762 void SetRotation( TextRotation nRotation
) { mnRotation
= nRotation
; }
763 TextRotation
GetRotation() const { return mnRotation
; }
765 void SetFixedCellHeight( bool bUseFixedCellHeight
) { bIsFixedCellHeight
= bUseFixedCellHeight
; }
766 bool IsFixedCellHeight() const { return bIsFixedCellHeight
; }
769 EditPaM
RemoveText();
770 void RemoveChars( EditPaM aPaM
, sal_Int32 nChars
);
771 EditPaM
InsertText( EditPaM aPaM
, const OUString
& rStr
);
772 EditPaM
InsertParaBreak( EditPaM aPaM
, bool bKeepEndingAttribs
);
773 EditPaM
InsertFeature( EditPaM aPaM
, const SfxPoolItem
& rItem
);
774 EditPaM
ConnectParagraphs( ContentNode
* pLeft
, ContentNode
* pRight
);
776 OUString
GetText( LineEnd eEnd
) const;
777 sal_uLong
GetTextLen() const;
779 OUString
GetParaAsString( sal_Int32 nNode
) const;
780 static OUString
GetParaAsString(const ContentNode
* pNode
, sal_Int32 nStartPos
= 0, sal_Int32 nEndPos
= -1);
782 EditPaM
GetStartPaM() const;
783 EditPaM
GetEndPaM() const;
785 SfxItemPool
& GetItemPool() { return *pItemPool
; }
786 const SfxItemPool
& GetItemPool() const { return *pItemPool
; }
788 void RemoveItemsFromPool(const ContentNode
& rNode
);
790 void InsertAttrib( const SfxPoolItem
& rItem
, ContentNode
* pNode
, sal_Int32 nStart
, sal_Int32 nEnd
);
791 void InsertAttrib( ContentNode
* pNode
, sal_Int32 nStart
, sal_Int32 nEnd
, const SfxPoolItem
& rPoolItem
);
792 void InsertAttribInSelection( ContentNode
* pNode
, sal_Int32 nStart
, sal_Int32 nEnd
, const SfxPoolItem
& rPoolItem
);
793 bool RemoveAttribs( ContentNode
* pNode
, sal_Int32 nStart
, sal_Int32 nEnd
, sal_uInt16 nWhich
);
794 bool RemoveAttribs( ContentNode
* pNode
, sal_Int32 nStart
, sal_Int32 nEnd
, EditCharAttrib
*& rpStarting
, EditCharAttrib
*& rpEnding
, sal_uInt16 nWhich
);
795 static void FindAttribs( ContentNode
* pNode
, sal_Int32 nStartPos
, sal_Int32 nEndPos
, SfxItemSet
& rCurSet
);
797 sal_Int32
GetPos(const ContentNode
* pNode
) const;
798 const ContentNode
* GetObject(sal_Int32 nPos
) const;
799 ContentNode
* GetObject(sal_Int32 nPos
);
800 sal_Int32
Count() const;
801 const ContentNode
* operator[](sal_Int32 nPos
) const;
802 ContentNode
* operator[](sal_Int32 nPos
);
803 void Insert(sal_Int32 nPos
, ContentNode
* p
);
805 void Remove(sal_Int32 nPos
);
807 void Release(sal_Int32 nPos
);
809 static OUString
GetSepStr( LineEnd eEnd
);
812 inline EditCharAttrib
* GetAttrib(CharAttribList::AttribsType
& rAttribs
, sal_Int32 nAttr
)
814 return (nAttr
< static_cast<sal_Int32
>(rAttribs
.size())) ? rAttribs
[nAttr
].get() : nullptr;
817 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
818 void CheckOrderedList(const CharAttribList::AttribsType
& rAttribs
);
821 class EditEngineItemPool final
: public SfxItemPool
824 std::shared_ptr
<DefItems
> m_xDefItems
;
826 EditEngineItemPool();
828 virtual ~EditEngineItemPool() override
;
831 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */