LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/inc - ndtxt.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 49 51 96.1 %
Date: 2013-07-09 Functions: 23 24 95.8 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10