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

Generated by: LCOV version 1.10