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