1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef SW_NDTXT_HXX 24 #define SW_NDTXT_HXX 25 26 #include <cppuhelper/weakref.hxx> 27 28 #include "swdllapi.h" 29 #include <error.h> 30 #include <node.hxx> 31 #include <hintids.hxx> 32 #include <ndhints.hxx> 33 #include <errhdl.hxx> 34 #include <modeltoviewhelper.hxx> 35 #include <SwNumberTreeTypes.hxx> 36 #include <IDocumentContentOperations.hxx> 37 38 #include <sfx2/Metadatable.hxx> 39 40 #include <vector> 41 #include <set> 42 43 class SfxHint; 44 class SwNumRule; 45 class SwNodeNum; 46 class SwList; 47 class SvxLRSpaceItem; 48 49 namespace utl { 50 class TransliterationWrapper; 51 } 52 53 class SwTxtFmtColl; 54 class SwCntntFrm; 55 class SwTxtFld; // Fuer GetTxtFld() 56 class SfxItemSet; 57 class SwUndoTransliterate; 58 59 60 struct SwSpellArgs; // for Spell(), splargs.hxx 61 struct SwConversionArgs; // for Convert(), splargs.hxx 62 class SwInterHyphInfo; // for Hyphenate(), splargs.hxx 63 class SwWrongList; // fuer OnlineSpelling 64 class SwGrammarMarkUp; 65 class OutputDevice; 66 class SwScriptInfo; 67 struct SwDocStat; 68 struct SwParaIdleData_Impl; 69 70 namespace com { namespace sun { namespace star { 71 namespace uno { 72 template < class > class Sequence; 73 } 74 namespace text { class XTextContent; } 75 } } } 76 77 typedef std::set< xub_StrLen > SwSoftPageBreakList; 78 79 // -------------------- 80 // SwTxtNode 81 // -------------------- 82 class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable 83 { 84 85 // fuer das Erzeugen des ersten TextNode 86 friend class SwDoc; // CTOR und AppendTxtNode() 87 friend class SwNodes; 88 friend class SwTxtFrm; 89 friend class SwScriptInfo; 90 91 //Kann 0 sein, nur dann nicht 0 wenn harte Attribute drin stehen. 92 //Also niemals direkt zugreifen! 93 SwpHints *m_pSwpHints; 94 95 // --> OD 2005-11-02 #i51089 - TUNING# 96 mutable SwNodeNum* mpNodeNum; // Numerierung fuer diesen Absatz 97 // <-- 98 XubString m_Text; 99 100 SwParaIdleData_Impl* m_pParaIdleData_Impl; 101 102 // Some of the chars this para are hidden. Paragraph has to be reformatted 103 // on changing the view to print preview. 104 mutable bool m_bContainsHiddenChars : 1; 105 // The whole paragraph is hidden because of the hidden text attribute 106 mutable bool m_bHiddenCharsHidePara : 1; 107 // The last two flags have to be recalculated if this flag is set: 108 mutable bool m_bRecalcHiddenCharFlags : 1; 109 110 mutable bool m_bLastOutlineState : 1; 111 bool m_bNotifiable; 112 113 // sal_uInt8 nOutlineLevel; //#outline level, removed by zhaojianwei. 114 // --> OD 2008-11-19 #i70748# 115 bool mbEmptyListStyleSetDueToSetOutlineLevelAttr; 116 // <-- 117 118 // --> OD 2008-03-27 #refactorlists# 119 // boolean, indicating that a <SetAttr(..)> or <ResetAttr(..)> or 120 // <ResetAllAttr(..)> method is running. 121 // Needed to avoid duplicate handling of attribute change actions. 122 bool mbInSetOrResetAttr; 123 // <-- 124 // --> OD 2008-05-06 #refactorlists# 125 // pointer to the list, to whose the text node is added to 126 SwList* mpList; 127 // <-- 128 /// #i111677# cached expansion (for clipboard) 129 ::std::auto_ptr< ::rtl::OUString > m_pNumStringCache; 130 131 ::com::sun::star::uno::WeakReference< 132 ::com::sun::star::text::XTextContent> m_wXParagraph; 133 134 SW_DLLPRIVATE SwTxtNode( const SwNodeIndex &rWhere, SwTxtFmtColl *pTxtColl, 135 const SfxItemSet* pAutoAttr = 0 ); 136 137 // Kopiert die Attribute an nStart nach pDest. 138 SW_DLLPRIVATE void CopyAttr( SwTxtNode *pDest, const xub_StrLen nStart, const xub_StrLen nOldPos); 139 140 SW_DLLPRIVATE SwTxtNode* _MakeNewTxtNode( const SwNodeIndex&, sal_Bool bNext = sal_True, 141 sal_Bool bChgFollow = sal_True ); 142 143 SW_DLLPRIVATE void CutImpl( 144 SwTxtNode * const pDest, const SwIndex & rDestStart, 145 const SwIndex & rStart, /*const*/ xub_StrLen nLen, 146 const bool bUpdate = true ); 147 148 // Verlagere alles umfassende harte Attribute in den AttrSet des Absatzes 149 SW_DLLPRIVATE void MoveTxtAttr_To_AttrSet(); // wird von SplitNode gerufen. 150 151 // lege den spz. AttrSet an 152 SW_DLLPRIVATE virtual void NewAttrSet( SwAttrPool& ); 153 154 SW_DLLPRIVATE void Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt, 155 xub_StrLen nEndPos, sal_Bool bExpandFlds ) const; 156 157 // Optimization: Asking for information about hidden characters at SwScriptInfo 158 // updates these flags. 159 inline bool IsCalcHiddenCharFlags() const 160 { return m_bRecalcHiddenCharFlags; } 161 inline void SetHiddenCharAttribute( bool bNewHiddenCharsHidePara, bool bNewContainsHiddenChars ) const 162 { 163 m_bHiddenCharsHidePara = bNewHiddenCharsHidePara; 164 m_bContainsHiddenChars = bNewContainsHiddenChars; 165 m_bRecalcHiddenCharFlags = false; 166 } 167 168 SW_DLLPRIVATE void CalcHiddenCharFlags() const; 169 170 SW_DLLPRIVATE SwNumRule * _GetNumRule(sal_Bool bInParent = sal_True) const; 171 172 SW_DLLPRIVATE void SetLanguageAndFont( const SwPaM &rPaM, 173 LanguageType nLang, sal_uInt16 nLangWhichId, 174 const Font *pFont, sal_uInt16 nFontWhichId ); 175 176 // 177 // Start: Data collected during idle time 178 // 179 SW_DLLPRIVATE void SetParaNumberOfWords( sal_uLong nTmpWords ) const; 180 SW_DLLPRIVATE sal_uLong GetParaNumberOfWords() const; 181 SW_DLLPRIVATE void SetParaNumberOfChars( sal_uLong nTmpChars ) const; 182 SW_DLLPRIVATE sal_uLong GetParaNumberOfChars() const; 183 SW_DLLPRIVATE void InitSwParaStatistics( bool bNew ); 184 185 /** create number for this text node, if not already existing 186 187 OD 2005-11-02 #i51089 - TUNING# 188 OD 2007-10-26 #i83479# - made private 189 190 @return number of this node 191 */ 192 SwNodeNum* CreateNum() const; 193 194 inline void TryDeleteSwpHints(); 195 196 SW_DLLPRIVATE void impl_FmtToTxtAttr(const SfxItemSet& i_rAttrSet); 197 198 public: 199 bool IsWordCountDirty() const; 200 bool IsWrongDirty() const; 201 bool IsGrammarCheckDirty() const; 202 bool IsSmartTagDirty() const; // SMARTTAGS 203 bool IsAutoCompleteWordDirty() const; 204 void SetWordCountDirty( bool bNew ) const; 205 void SetWrongDirty( bool bNew ) const; 206 void SetGrammarCheckDirty( bool bNew ) const; 207 void SetSmartTagDirty( bool bNew ) const; // SMARTTAGS 208 void SetAutoCompleteWordDirty( bool bNew ) const; 209 void SetWrong( SwWrongList* pNew, bool bDelete = true ); 210 SwWrongList* GetWrong(); 211 // --> OD 2008-05-23 #i71360# 212 const SwWrongList* GetWrong() const; 213 // <-- 214 void SetGrammarCheck( SwGrammarMarkUp* pNew, bool bDelete = true ); 215 SwGrammarMarkUp* GetGrammarCheck(); 216 // SMARTTAGS 217 void SetSmartTags( SwWrongList* pNew, bool bDelete = true ); 218 SwWrongList* GetSmartTags(); 219 //Modify here for #119405, by easyfan, 2012-05-24 220 bool TryCharSetExpandToNum(const SfxItemSet& pCharSet); 221 //End of modification, by easyfan 222 223 // 224 // End: Data collected during idle time 225 // 226 protected: 227 // fuers Umhaengen der TxtFmtCollections (Outline-Nummerierung!!) 228 virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); 229 virtual void SwClientNotify( const SwModify&, const SfxHint& ); 230 231 public: 232 using SwCntntNode::GetAttr; 233 234 const String& GetTxt() const { return m_Text; } 235 236 // getters for SwpHints 237 inline SwpHints &GetSwpHints(); 238 inline const SwpHints &GetSwpHints() const; 239 inline SwpHints *GetpSwpHints() { return m_pSwpHints; } 240 inline const SwpHints *GetpSwpHints() const { return m_pSwpHints; } 241 inline bool HasHints() const { return m_pSwpHints ? true : false; } 242 inline SwpHints &GetOrCreateSwpHints(); 243 244 virtual ~SwTxtNode(); 245 246 virtual xub_StrLen Len() const; 247 248 // steht in itratr 249 void GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax, sal_uLong &rAbs, 250 OutputDevice* pOut = 0 ) const; 251 252 // --> OD 2008-03-13 #refactorlists# 253 // overriding to handle change of certain paragraph attributes 254 virtual sal_Bool SetAttr( const SfxPoolItem& ); 255 virtual sal_Bool SetAttr( const SfxItemSet& rSet ); 256 virtual sal_Bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ); 257 virtual sal_Bool ResetAttr( const SvUShorts& rWhichArr ); 258 virtual sal_uInt16 ResetAllAttr(); 259 // <-- 260 261 /// insert text content 262 void InsertText( const XubString & rStr, const SwIndex & rIdx, 263 const enum IDocumentContentOperations::InsertFlags nMode 264 = IDocumentContentOperations::INS_DEFAULT ); 265 266 /** delete text content 267 ATTENTION: must not be called with a range that overlaps the start of 268 an attribute with both extent and dummy char 269 */ 270 void EraseText ( const SwIndex &rIdx, const xub_StrLen nCount = STRING_LEN, 271 const enum IDocumentContentOperations::InsertFlags nMode 272 = IDocumentContentOperations::INS_DEFAULT ); 273 274 /** delete all attributes. 275 If neither pSet nor nWhich is given, delete all attributes (except 276 refmarks, toxmarks, meta) in range. 277 @param rIdx start position 278 @param nLen range in which attributes will be deleted 279 @param pSet if not 0, delete only attributes contained in pSet 280 @param nWhich if not 0, delete only attributes with matching which 281 @param bInclRefToxMark 282 refmarks, toxmarks, and metas will be ignored unless this is true 283 ATTENTION: setting bInclRefToxMark is only allowed from UNDO! 284 */ 285 void RstAttr( const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich = 0, 286 const SfxItemSet* pSet = 0, sal_Bool bInclRefToxMark = sal_False ); 287 void GCAttr(); 288 289 // loesche das Text-Attribut (muss beim Pool abgemeldet werden!) 290 void DestroyAttr( SwTxtAttr* pAttr ); 291 292 // loesche alle Attribute aus dem SwpHintsArray. 293 void ClearSwpHintsArr( bool bDelFields ); 294 295 /// Insert pAttr into hints array. @return true iff inserted successfully 296 bool InsertHint( SwTxtAttr * const pAttr, 297 const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT ); 298 /// create new text attribute from rAttr and insert it 299 /// @return inserted hint; 0 if not sure the hint is inserted 300 SwTxtAttr* InsertItem( SfxPoolItem& rAttr, 301 const xub_StrLen nStart, const xub_StrLen nEnd, 302 const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT ); 303 304 // setze diese Attribute am TextNode. Wird der gesamte Bereich umspannt, 305 // dann setze sie nur im AutoAttrSet (SwCntntNode:: SetAttr) 306 sal_Bool SetAttr( const SfxItemSet& rSet, 307 xub_StrLen nStt, xub_StrLen nEnd, 308 const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT ); 309 // erfrage die Attribute vom TextNode ueber den Bereich 310 // --> OD 2008-01-16 #newlistlevelattrs# 311 // Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>. 312 // If <bMergeIndentValuesOfNumRule> == sal_True, the indent attributes of 313 // the corresponding list level of an applied list style is merged into 314 // the requested item set as a LR-SPACE item, if <bOnlyTxtAttr> == sal_False, 315 // corresponding node has not its own indent attributes and the 316 // position-and-space mode of the list level is SvxNumberFormat::LABEL_ALIGNMENT. 317 sal_Bool GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, 318 sal_Bool bOnlyTxtAttr = sal_False, 319 sal_Bool bGetFromChrFmt = sal_True, 320 const bool bMergeIndentValuesOfNumRule = false ) const; 321 // <-- 322 323 // uebertrage Attribute eines AttrSets ( AutoFmt ) in das SwpHintsArray 324 void FmtToTxtAttr( SwTxtNode* pNd ); 325 326 /// delete all attributes of type nWhich at nStart (opt. end nEnd) 327 void DeleteAttributes( const sal_uInt16 nWhich, 328 const xub_StrLen nStart, const xub_StrLen nEnd = 0 ); 329 /// delete the attribute pTxtAttr 330 void DeleteAttribute ( SwTxtAttr * const pTxtAttr ); 331 332 // Aktionen auf Text und Attributen 333 // --> OD 2008-11-18 #i96213# 334 // introduce optional parameter to control, if all attributes have to be copied. 335 void CopyText( SwTxtNode * const pDest, 336 const SwIndex &rStart, 337 const xub_StrLen nLen, 338 const bool bForceCopyOfAllAttrs = false ); 339 void CopyText( SwTxtNode * const pDest, 340 const SwIndex &rDestStart, 341 const SwIndex &rStart, 342 xub_StrLen nLen, 343 const bool bForceCopyOfAllAttrs = false ); 344 // <-- 345 346 void CutText(SwTxtNode * const pDest, 347 const SwIndex & rStart, const xub_StrLen nLen); 348 inline void CutText(SwTxtNode * const pDest, const SwIndex &rDestStart, 349 const SwIndex & rStart, const xub_StrLen nLen); 350 351 /// replace nDelLen characters at rStart with rText 352 void ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen, 353 const XubString& rText ); 354 void ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen, const XubString& rText, 355 const ::com::sun::star::uno::Sequence<sal_Int32>& rOffsets ); 356 357 // virtuelle Methoden aus dem CntntNode 358 virtual SwCntntFrm *MakeFrm( SwFrm* ); 359 virtual SwCntntNode *SplitCntntNode( const SwPosition & ); 360 virtual SwCntntNode *JoinNext(); 361 virtual SwCntntNode *JoinPrev(); 362 363 SwCntntNode *AppendNode( const SwPosition & ); 364 365 // setze ggf. das DontExpand-Flag an INet bzw. Zeichenvorlagen 366 sal_Bool DontExpandFmt( const SwIndex& rIdx, bool bFlag = true, 367 sal_Bool bFmtToTxtAttributes = sal_True ); 368 369 enum GetTxtAttrMode { 370 DEFAULT, /// DEFAULT: (Start < nIndex <= End) 371 EXPAND, /// EXPAND : (Start <= nIndex < End) 372 PARENT, /// PARENT : (Start < nIndex < End) 373 }; 374 375 /** get the innermost text attribute covering position nIndex. 376 @param nWhich only attribute with this id is returned. 377 @param eMode the predicate for matching (@see GetTxtAttrMode). 378 379 ATTENTION: this function is not well-defined for those 380 hints of which several may cover a single position, like 381 RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK 382 */ 383 SwTxtAttr *GetTxtAttrAt(xub_StrLen const nIndex, RES_TXTATR const nWhich, 384 enum GetTxtAttrMode const eMode = DEFAULT) const; 385 386 /** get the innermost text attributes covering position nIndex. 387 @param nWhich only attributes with this id are returned. 388 @param eMode the predicate for matching (@see GetTxtAttrMode). 389 */ 390 ::std::vector<SwTxtAttr *> GetTxtAttrsAt(xub_StrLen const nIndex, 391 RES_TXTATR const nWhich, 392 enum GetTxtAttrMode const eMode = DEFAULT) const; 393 394 /** get the text attribute at position nIndex which owns 395 the dummy character CH_TXTATR_* at that position, if one exists. 396 @param nIndex the position in the text 397 @param nWhich if different from RES_TXTATR_END, return only 398 attribute with given which id 399 @return the text attribute at nIndex of type nWhich, if it exists 400 */ 401 SwTxtAttr *GetTxtAttrForCharAt( const xub_StrLen nIndex, 402 const RES_TXTATR nWhich = RES_TXTATR_END ) const; 403 404 // Aktuelles Wort zurueckliefern 405 XubString GetCurWord(xub_StrLen) const; 406 sal_uInt16 Spell(SwSpellArgs*); 407 sal_uInt16 Convert( SwConversionArgs & ); 408 409 inline SwTxtFmtColl *GetTxtColl() const; 410 virtual SwFmtColl *ChgFmtColl( SwFmtColl* ); 411 void _ChgTxtCollUpdateNum( const SwTxtFmtColl* pOld, 412 const SwTxtFmtColl* pNew ); 413 414 // kopiere die Collection mit allen Autoformaten zum Dest-Node 415 // dieser kann auch in einem anderen Dokument stehen! 416 // (Methode steht im ndcopy.cxx!!) 417 void CopyCollFmt( SwTxtNode& rDestNd ); 418 419 //const SwNodeNum* _GetNodeNum() const { return pNdNum; } 420 421 // 422 // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF: 423 // 424 425 /** 426 Returns numbering rule of this text node. 427 428 @param bInParent serach in parent attributes, too 429 430 @return numbering rule of this text node or NULL if none is set 431 */ 432 SwNumRule *GetNumRule(sal_Bool bInParent = sal_True) const; 433 434 inline const SwNodeNum* GetNum() const 435 { 436 return mpNodeNum; 437 } 438 439 SwNumberTree::tNumberVector GetNumberVector() const; 440 441 /** 442 Returns if this text node is an outline. 443 444 @retval true this text node is an outline 445 @retval false else 446 */ 447 bool IsOutline() const; 448 449 bool IsOutlineStateChanged() const; 450 451 void UpdateOutlineState(); 452 453 /** -> #i23730# 454 455 Returns if this text node may be numbered. 456 457 A text node may be numbered if 458 - it has no SwNodeNum 459 - it has a SwNodeNum and it has a numbering rule and the according 460 SwNumFmt defines a numbering type that is an enumeration. 461 462 @retval sal_True this text node may be numbered 463 @retval sal_False else 464 */ 465 //sal_Bool MayBeNumbered() const; 466 467 /** 468 Notify this textnode that its numbering rule has changed. 469 */ 470 void NumRuleChgd(); 471 472 /** Returns outline of numbering string 473 474 OD 2005-11-17 #128041# 475 Introduce parameter <_bInclPrefixAndSuffixStrings> in order to control, 476 if the prefix and the suffix strings have to been included or not. 477 478 @param _bInclPrefixAndSuffixStrings 479 optional input parameter - boolean indicating, if the prefix and the 480 suffix strings have to been included or not. default value = <true> 481 482 @param _nRestrictToThisLevel 483 optional input parameter - unsigned integer indicating the maximum outline 484 level to which the output string must be restricted to. Default value is 485 MAXLEVEL 486 */ 487 XubString GetNumString( const bool _bInclPrefixAndSuffixStrings = true, const unsigned int _nRestrictToThisLevel = MAXLEVEL ) const; 488 489 /** 490 Returns the additional indents of this text node and its numbering. 491 492 @param bTxtLeft ??? 493 494 @return additional indents 495 */ 496 long GetLeftMarginWithNum( sal_Bool bTxtLeft = sal_False ) const; 497 498 /** 499 Returns the combined first line indent of this text node and 500 its numbering. 501 502 @param the first line indent of this text node taking the 503 numbering into account (return parameter) 504 505 @retval sal_True this node has SwNodeNum and has numbering rule 506 @retval sal_False else 507 */ 508 sal_Bool GetFirstLineOfsWithNum( short& rFirstOffset ) const; 509 510 // --> OD 2010-01-05 #b6884103# 511 SwTwips GetAdditionalIndentForStartingNewList() const; 512 // <-- 513 514 // --> OD 2008-12-02 #i96772# 515 void ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const; 516 // <-- 517 518 /** return left margin for tab stop position calculation 519 520 OD 2008-06-30 #i91133# 521 Needed for text formatting 522 Method considers new list level attributes, which also can provide a left margin value 523 524 @author OD 525 */ 526 long GetLeftMarginForTabCalculation() const; 527 528 /** -> #i29560 529 Returns if this text node has a number. 530 531 This text node has a number if it has a SwNodeNum and a 532 numbering rule and the numbering format specified for the 533 level of the SwNodeNum is of an enumeration type. 534 535 @retval sal_True This text node has a number. 536 @retval sal_False else 537 */ 538 sal_Bool HasNumber() const; 539 540 /** -> #i29560 541 Returns if this text node has a bullet. 542 543 This text node has a bullet if it has a SwNodeNum and a 544 numbering rule and the numbering format specified for the 545 level of the SwNodeNum is of a bullet type. 546 547 @retval sal_True This text node has a bullet. 548 @retval sal_False else 549 */ 550 sal_Bool HasBullet() const; 551 552 /** -> #i27615# 553 Returns is this text node is numbered. 554 555 This node is numbered if it has a SwNodeNum and it has a 556 numbering rule and has not a hidden SwNodeNum. 557 558 ATTENTION: Returns sal_True even if the SwNumFmt has type 559 SVX_NUM_NUMBER_NONE. 560 561 @retval sal_True This node is numbered. 562 @retval sal_False else 563 */ 564 sal_Bool IsNumbered() const; 565 566 /** -> #i27615# 567 Returns if this text node has a marked label. 568 569 @retval true This text node has a marked label. 570 @retval false else 571 */ 572 bool HasMarkedLabel() const; 573 574 /** Sets the list level of this text node. 575 576 Side effect, when the text node is a list item: 577 The text node's representation in the list tree (<SwNodeNum> instance) 578 is updated. 579 580 @param nLevel level to set 581 */ 582 void SetAttrListLevel(int nLevel); 583 584 bool HasAttrListLevel() const; 585 586 int GetAttrListLevel() const; 587 588 /** Returns the actual list level of this text node, when it is a list item 589 590 @return the actual list level of this text node, if it is a list item, 591 -1 otherwise 592 */ 593 int GetActualListLevel() const; 594 595 /** 596 Returns outline level of this text node. 597 598 If a text node has an outline number (i.e. it has an SwNodeNum 599 and a outline numbering rule) the outline level is the level of 600 this SwNodeNum. 601 602 If a text node has no outline number and has a paragraph style 603 attached the outline level is the outline level of the 604 paragraph style. 605 606 Otherwise the text node has no outline level (NO_NUMBERING). 607 608 NOTE: The outline level of text nodes is subject to change. The 609 plan is to have an SwTxtNode::nOutlineLevel member that is 610 updated from a paragraph style upon appliance of that paragraph 611 style. 612 613 @return outline level or NO_NUMBERING if there is no outline level 614 */ 615 int GetAttrOutlineLevel() const;//#OutlineLevel,added by zhaojianwei 616 617 /** 618 Sets the out line level *at* a text node. 619 620 @param nLevel the level to be set 621 622 If the text node has an outline number the level is set at the 623 outline number. 624 625 If the text node has no outline number but has a paragraph 626 style applied the outline level is set at the paragraph style. 627 628 NOTE: This is subject to change, see GetOutlineLevel. 629 */ 630 //void SetOutlineLevel(int nLevel); 631 void SetAttrOutlineLevel(int nLevel);//#OutlineLevel,added by zhaojianwei 632 633 // --> OD 2008-11-19 #i70748# 634 bool IsEmptyListStyleDueToSetOutlineLevelAttr(); 635 void SetEmptyListStyleDueToSetOutlineLevelAttr(); 636 void ResetEmptyListStyleDueToResetOutlineLevelAttr(); 637 // <-- 638 639 /** 640 Returns the width of leading tabs/blanks in this paragraph. 641 This space will be converted into numbering indent if the paragraph 642 is set to be numbered. 643 644 @return the width of the leading whitespace 645 */ 646 sal_uInt16 GetWidthOfLeadingTabs() const; 647 648 649 /** 650 Returns if the paragraph has a visible numbering or bullet. 651 This includes all kinds of numbering/bullet/outlines. 652 Note: This function returns false, if the numbering format is 653 SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted. 654 655 @return sal_True if the paragraph has a visible numbering/bullet/outline 656 */ 657 bool HasVisibleNumberingOrBullet() const; 658 659 // --> OD 2008-02-19 #refactorlists# 660 void SetListId( const String sListId ); 661 String GetListId() const; 662 // <-- 663 664 /** Determines, if the list level indent attributes can be applied to the 665 paragraph. 666 667 OD 2008-01-17 #newlistlevelattrs# 668 The list level indents can be applied to the paragraph under the one 669 of following conditions: 670 - the list style is directly applied to the paragraph and the paragraph 671 has no own indent attributes. 672 - the list style is applied to the paragraph through one of its paragraph 673 styles, the paragraph has no own indent attributes and on the paragraph 674 style hierarchy from the paragraph to the paragraph style with the 675 list style no indent attributes are found. 676 677 @author OD 678 679 @return boolean 680 */ 681 bool AreListLevelIndentsApplicable() const; 682 683 /** Retrieves the list tab stop position, if the paragraph's list level defines 684 one and this list tab stop has to merged into the tap stops of the paragraph 685 686 OD 2008-01-17 #newlistlevelattrs# 687 688 @author OD 689 690 @param nListTabStopPosition 691 output parameter - containing the list tab stop position 692 693 @return boolean - indicating, if a list tab stop position is provided 694 */ 695 bool GetListTabStopPosition( long& nListTabStopPosition ) const; 696 697 /** Retrieves the character following the list label, if the paragraph's 698 list level defines one. 699 700 OD 2008-01-17 #newlistlevelattrs# 701 702 @author OD 703 704 @return XubString - the list tab stop position 705 */ 706 XubString GetLabelFollowedBy() const; 707 708 // 709 // END OF BULLET/NUMBERING/OUTLINE STUFF: 710 // 711 712 void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const; 713 714 sal_uInt16 GetLang( const xub_StrLen nBegin, const xub_StrLen nLen = 0, 715 sal_uInt16 nScript = 0 ) const; 716 717 // steht in ndcopy.cxx 718 sal_Bool IsSymbol( const xub_StrLen nBegin ) const; // steht in itratr.cxx 719 virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const; 720 721 // interaktive Trennung: wir finden den TxtFrm und rufen sein CalcHyph 722 sal_Bool Hyphenate( SwInterHyphInfo &rHyphInf ); 723 void DelSoftHyph( const xub_StrLen nStart, const xub_StrLen nEnd ); 724 725 // --> OD 2007-11-15 #i83479# 726 // add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating, 727 // when <bWithNum = true> that a space is inserted after the string for 728 // the list label. 729 // add 5th optional parameter <bWithSpacesForLevel> indicating, if additional 730 // spaces are inserted in front of the expanded text string depending on 731 // the list level. 732 XubString GetExpandTxt( const xub_StrLen nIdx = 0, 733 const xub_StrLen nLen = STRING_LEN, 734 const bool bWithNum = false, 735 const bool bAddSpaceAfterListLabelStr = false, 736 const bool bWithSpacesForLevel = false ) const; 737 // <-- 738 sal_Bool GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx = 0, 739 xub_StrLen nIdx = 0, xub_StrLen nLen = STRING_LEN, 740 sal_Bool bWithNum = sal_False, sal_Bool bWithFtn = sal_True, 741 sal_Bool bReplaceTabsWithSpaces = sal_False ) const; 742 743 /* 744 * 745 */ 746 const ModelToViewHelper::ConversionMap* 747 BuildConversionMap( rtl::OUString& rExpandText ) const; 748 749 XubString GetRedlineTxt( xub_StrLen nIdx = 0, 750 xub_StrLen nLen = STRING_LEN, 751 sal_Bool bExpandFlds = sal_False, 752 sal_Bool bWithNum = sal_False ) const; 753 //Liefert fuer die Initalfunktion tatsaechliche Anzahl der Initialzeichen 754 //bei nWishLen == 0 die des ersten Wortes 755 sal_uInt16 GetDropLen( sal_uInt16 nWishLen) const; 756 757 // Passes back info needed on the dropcap dimensions 758 bool GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescent) const; 759 760 // Hidden Paragraph Field: 761 inline bool CalcHiddenParaField() 762 { return m_pSwpHints ? m_pSwpHints->CalcHiddenParaField() : false; } 763 // set CalcVisible flags 764 inline void SetCalcHiddenParaField() 765 { if (m_pSwpHints) m_pSwpHints->SetCalcHiddenParaField(); } 766 767 // is the paragraph visible? 768 inline bool HasHiddenParaField() const 769 { return m_pSwpHints ? m_pSwpHints->HasHiddenParaField() : false; } 770 771 // 772 // Hidden Paragraph Field: 773 // 774 inline bool HasHiddenCharAttribute( bool bWholePara ) const 775 { 776 if ( m_bRecalcHiddenCharFlags ) 777 CalcHiddenCharFlags(); 778 return bWholePara ? m_bHiddenCharsHidePara : m_bContainsHiddenChars; 779 } 780 781 inline void SetCalcHiddenCharFlags() const 782 { m_bRecalcHiddenCharFlags = true; } 783 784 // --> FME 2004-06-08 #i12836# enhanced pdf 785 // 786 // Returns if the node is hidden due to 787 // 1. HiddenParaField 788 // 2. HiddenCharAttribute 789 // 3. HiddenSection 790 // 791 bool IsHidden() const; 792 // <-- 793 794 TYPEINFO(); // fuer rtti 795 796 // override SwIndexReg 797 virtual void Update( SwIndex const & rPos, const xub_StrLen nChangeLen, 798 const bool bNegative = false, const bool bDelete = false ); 799 800 // change text to Upper/Lower/Hiragana/Katagana/... 801 void TransliterateText( utl::TransliterationWrapper& rTrans, 802 xub_StrLen nStart, xub_StrLen nEnd, 803 SwUndoTransliterate* pUndo = 0 ); 804 805 // count words in given range 806 void CountWords( SwDocStat& rStat, xub_StrLen nStart, xub_StrLen nEnd ) const; 807 808 // Checks some global conditions like loading or destruction of document 809 // to economize notifications 810 bool IsNotificationEnabled() const; 811 812 // Checks a temporary notification blocker and the global conditons of IsNotificationEnabled() 813 bool IsNotifiable() const; 814 815 void SetListRestart( bool bRestart ); 816 // --> OD 2005-11-02 #i51089 - TUNING# 817 bool IsListRestart() const; 818 // <-- 819 820 void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum ); 821 bool HasAttrListRestartValue() const; 822 SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const; 823 SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const; 824 825 void SetCountedInList( bool bCounted ); 826 bool IsCountedInList() const; 827 828 // --> OD 2008-03-13 #refactorlists# 829 // void SyncNumberAndNumRule(); 830 // void UnregisterNumber(); 831 void AddToList(); 832 void RemoveFromList(); 833 bool IsInList() const; 834 // <-- 835 836 bool IsFirstOfNumRule() const; 837 838 sal_uInt16 GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) const; 839 840 SW_DLLPRIVATE ::com::sun::star::uno::WeakReference< 841 ::com::sun::star::text::XTextContent> const& GetXParagraph() const 842 { return m_wXParagraph; } 843 SW_DLLPRIVATE void SetXParagraph(::com::sun::star::uno::Reference< 844 ::com::sun::star::text::XTextContent> const& xParagraph) 845 { m_wXParagraph = xParagraph; } 846 847 // sfx2::Metadatable 848 virtual ::sfx2::IXmlIdRegistry& GetRegistry(); 849 virtual bool IsInClipboard() const; 850 virtual bool IsInUndo() const; 851 virtual bool IsInContent() const; 852 virtual ::com::sun::star::uno::Reference< 853 ::com::sun::star::rdf::XMetadatable > MakeUnoObject(); 854 855 DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode) 856 }; 857 858 //----------------------------------------------------------------------------- 859 860 inline SwpHints & SwTxtNode::GetSwpHints() 861 { 862 ASSERT_ID( m_pSwpHints, ERR_NOHINTS); 863 return *m_pSwpHints; 864 } 865 inline const SwpHints &SwTxtNode::GetSwpHints() const 866 { 867 ASSERT_ID( m_pSwpHints, ERR_NOHINTS); 868 return *m_pSwpHints; 869 } 870 871 inline SwpHints& SwTxtNode::GetOrCreateSwpHints() 872 { 873 if ( !m_pSwpHints ) 874 { 875 m_pSwpHints = new SwpHints; 876 } 877 return *m_pSwpHints; 878 } 879 880 inline void SwTxtNode::TryDeleteSwpHints() 881 { 882 if ( m_pSwpHints && m_pSwpHints->CanBeDeleted() ) 883 { 884 DELETEZ( m_pSwpHints ); 885 } 886 } 887 888 inline SwTxtFmtColl* SwTxtNode::GetTxtColl() const 889 { 890 return static_cast<SwTxtFmtColl*>(const_cast<SwModify*>(GetRegisteredIn())); 891 } 892 893 // fuer den IBM-Compiler nicht inlinen wg. 42876 894 #ifndef ICC 895 // Inline Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !! 896 inline SwTxtNode *SwNode::GetTxtNode() 897 { 898 return ND_TEXTNODE == nNodeType ? static_cast<SwTxtNode*>(this) : 0; 899 } 900 inline const SwTxtNode *SwNode::GetTxtNode() const 901 { 902 return ND_TEXTNODE == nNodeType ? static_cast<const SwTxtNode*>(this) : 0; 903 } 904 #endif 905 906 inline void 907 SwTxtNode::CutText(SwTxtNode * const pDest, const SwIndex & rDestStart, 908 const SwIndex & rStart, const xub_StrLen nLen) 909 { 910 CutImpl( pDest, rDestStart, rStart, nLen, true ); 911 } 912 913 #endif 914