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

Generated by: LCOV version 1.10