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

Generated by: LCOV version 1.10