LCOV - code coverage report
Current view: top level - sw/inc - ndtxt.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 53 55 96.4 %
Date: 2015-06-13 12:38:46 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 SwTextFormatColl;
      48             : class SwContentFrm;
      49             : class SwTextField;
      50             : class SwTextInputField;
      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             : /// SwTextNode is a paragraph in the document model.
      73             : class SW_DLLPUBLIC SwTextNode: public SwContentNode, public ::sfx2::Metadatable
      74             : {
      75             :     friend class SwContentNode;
      76             :     /// For creating the first TextNode.
      77             :     friend class SwDoc;         ///< CTOR and AppendTextNode()
      78             :     friend class SwNodes;
      79             :     friend class SwTextFrm;
      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 SwTextNode( const SwNodeIndex &rWhere, SwTextFormatColl *pTextColl,
     122             :                              const SfxItemSet* pAutoAttr = 0 );
     123             : 
     124             :     /// Copies the attributes at nStart to pDest.
     125             :     SAL_DLLPRIVATE void CopyAttr( SwTextNode *pDest, const sal_Int32 nStart, const sal_Int32 nOldPos);
     126             : 
     127             :     SAL_DLLPRIVATE SwTextNode* _MakeNewTextNode( const SwNodeIndex&, bool bNext = true,
     128             :                                 bool bChgFollow = true );
     129             : 
     130             :     SAL_DLLPRIVATE void CutImpl(
     131             :           SwTextNode * 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 MoveTextAttr_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    48557031 :     inline bool IsCalcHiddenCharFlags() const
     144    48557031 :         { return m_bRecalcHiddenCharFlags; }
     145       81864 :     inline void SetHiddenCharAttribute( bool bNewHiddenCharsHidePara, bool bNewContainsHiddenChars ) const
     146             :     {
     147       81864 :         m_bHiddenCharsHidePara = bNewHiddenCharsHidePara;
     148       81864 :         m_bContainsHiddenChars = bNewContainsHiddenChars;
     149       81864 :         m_bRecalcHiddenCharFlags = false;
     150       81864 :     }
     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_FormatToTextAttr(const SfxItemSet& i_rAttrSet);
     181             : 
     182             :     const SwTextInputField* GetOverlappingInputField( const SwTextAttr& rTextAttr ) const;
     183             : 
     184             :     void DelFrms_TextNodePart();
     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 TextFormatCollections 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 SwContentNode::GetAttr;
     215             : 
     216   364148024 :     const OUString& GetText() 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      556441 :     inline       SwpHints *GetpSwpHints()       { return m_pSwpHints; }
     225      401745 :     inline const SwpHints *GetpSwpHints() const { return m_pSwpHints; }
     226   189413776 :     inline       bool   HasHints() const { return m_pSwpHints != nullptr; }
     227             :     inline       SwpHints &GetOrCreateSwpHints();
     228             : 
     229             :     virtual ~SwTextNode();
     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 SwInsertFlags nMode
     250             :                          = SwInsertFlags::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 SwInsertFlags nMode = SwInsertFlags::DEFAULT );
     258             : 
     259             :     /** delete all attributes.
     260             :         If neither pSet nor nWhich is given, delete all attributes (except
     261             :         refmarks, toxmarks, meta) in range.
     262             :         @param rIdx     start position
     263             :         @param nLen     range in which attributes will be deleted
     264             :         @param pSet     if not 0, delete only attributes contained in pSet
     265             :         @param nWhich   if not 0, delete only attributes with matching which
     266             :         @param bInclRefToxMark
     267             :             refmarks, toxmarks, and metas will be ignored unless this is true
     268             :         ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
     269             :         @param bExactRange From the attributes included in the range, delete
     270             :         only the ones which have exactly same range. Don't delete the ones
     271             :         which are simply included in the range.
     272             :      */
     273             :     void RstTextAttr(
     274             :         const SwIndex &rIdx,
     275             :         const sal_Int32 nLen,
     276             :         const sal_uInt16 nWhich = 0,
     277             :         const SfxItemSet* pSet = 0,
     278             :         const bool bInclRefToxMark = false,
     279             :         const bool bExactRange = false );
     280             :     void    GCAttr();
     281             : 
     282             :     // Delete text attribute (needs to be deregistered at Pool!)
     283             :     void    DestroyAttr( SwTextAttr* pAttr );
     284             : 
     285             :     // delete all attributes from SwpHintsArray.
     286             :     void    ClearSwpHintsArr( bool bDelFields );
     287             : 
     288             :     /// initialize the hints after file loading (which takes shortcuts)
     289             :     void    FileLoadedInitHints();
     290             : 
     291             :     /// Insert pAttr into hints array. @return true iff inserted successfully
     292             :     bool    InsertHint( SwTextAttr * const pAttr,
     293             :                   const SetAttrMode nMode = SetAttrMode::DEFAULT );
     294             :     /// create new text attribute from rAttr and insert it
     295             :     /// @return     inserted hint; 0 if not sure the hint is inserted
     296             :     SwTextAttr* InsertItem( SfxPoolItem& rAttr,
     297             :                   const sal_Int32 nStart, const sal_Int32 nEnd,
     298             :                   const SetAttrMode nMode = SetAttrMode::DEFAULT );
     299             : 
     300             :     /** Set these attributes at TextNode. If the whole range is comprised
     301             :        set them only in AutoAttrSet (SwContentNode::SetAttr). */
     302             :     bool SetAttr( const SfxItemSet& rSet,
     303             :                   sal_Int32 nStt, sal_Int32 nEnd,
     304             :                   const SetAttrMode nMode = SetAttrMode::DEFAULT );
     305             :     /** Query the attributes of textnode over the range.
     306             :        Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
     307             :        If <bMergeIndentValuesOfNumRule> == true, the indent attributes of
     308             :        the corresponding list level of an applied list style is merged into
     309             :        the requested item set as a LR-SPACE item, if <bOnlyTextAttr> == false,
     310             :        corresponding node has not its own indent attributes and the
     311             :        position-and-space mode of the list level is SvxNumberFormat::LABEL_ALIGNMENT. */
     312             :     bool GetAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
     313             :                   const bool bOnlyTextAttr  = false,
     314             :                   const bool bGetFromChrFormat = true,
     315             :                   const bool bMergeIndentValuesOfNumRule = false ) const;
     316             : 
     317             :     /// Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
     318             :     void FormatToTextAttr( SwTextNode* pNd );
     319             : 
     320             :     /// delete all attributes of type nWhich at nStart (opt. end nEnd)
     321             :     void DeleteAttributes( const sal_uInt16 nWhich,
     322             :                   const sal_Int32 nStart, const sal_Int32 nEnd = 0 );
     323             :     /// delete the attribute pTextAttr
     324             :     void DeleteAttribute ( SwTextAttr * const pTextAttr );
     325             : 
     326             :     /** Actions on text and attributes.
     327             :        introduce optional parameter to control, if all attributes have to be copied. */
     328             :     void CopyText( SwTextNode * const pDest,
     329             :                const SwIndex &rStart,
     330             :                const sal_Int32 nLen,
     331             :                const bool bForceCopyOfAllAttrs = false );
     332             :     void CopyText( SwTextNode * const pDest,
     333             :                const SwIndex &rDestStart,
     334             :                const SwIndex &rStart,
     335             :                sal_Int32 nLen,
     336             :                const bool bForceCopyOfAllAttrs = false );
     337             : 
     338             :     void        CutText(SwTextNode * const pDest,
     339             :                     const SwIndex & rStart, const sal_Int32 nLen);
     340             :     inline void CutText(SwTextNode * const pDest, const SwIndex &rDestStart,
     341             :                     const SwIndex & rStart, const sal_Int32 nLen);
     342             : 
     343             :     /// replace nDelLen characters at rStart with rText
     344             :     /// in case the replacement does not fit, it is partially inserted up to
     345             :     /// the capacity of the node
     346             :     void ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen,
     347             :             const OUString & rText );
     348             :     void ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen,
     349             :             const OUString& rText,
     350             :             const ::com::sun::star::uno::Sequence<sal_Int32>& rOffsets );
     351             : 
     352             :     /// Virtual methods from ContentNode.
     353             :     virtual SwContentFrm *MakeFrm( SwFrm* ) SAL_OVERRIDE;
     354             :     virtual SwContentNode *SplitContentNode( const SwPosition & ) SAL_OVERRIDE;
     355             :     virtual SwContentNode *JoinNext() SAL_OVERRIDE;
     356             :     virtual SwContentNode *JoinPrev() SAL_OVERRIDE;
     357             : 
     358             :     SwContentNode *AppendNode( const SwPosition & );
     359             : 
     360             :     /// When appropriate set DontExpand-flag at INet or character styles respectively.
     361             :     bool DontExpandFormat( const SwIndex& rIdx, bool bFlag = true,
     362             :                         bool bFormatToTextAttributes = true );
     363             : 
     364             :     enum GetTextAttrMode {
     365             :         DEFAULT,    /// DEFAULT: (Start <= nIndex <  End)
     366             :         EXPAND,     /// EXPAND : (Start <  nIndex <= End)
     367             :         PARENT,     /// PARENT : (Start <  nIndex <  End)
     368             :     };
     369             : 
     370             :     /** get the innermost text attribute covering position nIndex.
     371             :         @param nWhich   only attribute with this id is returned.
     372             :         @param eMode    the predicate for matching (@see GetTextAttrMode).
     373             : 
     374             :         ATTENTION: this function is not well-defined for those
     375             :         hints of which several may cover a single position, like
     376             :         RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
     377             :      */
     378             :     SwTextAttr *GetTextAttrAt(
     379             :         sal_Int32 const nIndex,
     380             :         RES_TXTATR const nWhich,
     381             :         enum GetTextAttrMode const eMode = DEFAULT ) const;
     382             : 
     383             :     /** get the innermost text attributes covering position nIndex.
     384             :         @param nWhich   only attributes with this id are returned.
     385             :         @param eMode    the predicate for matching (@see GetTextAttrMode).
     386             :      */
     387             :     ::std::vector<SwTextAttr *> GetTextAttrsAt(
     388             :         sal_Int32 const nIndex,
     389             :         RES_TXTATR const nWhich,
     390             :         enum GetTextAttrMode const eMode = DEFAULT ) const;
     391             : 
     392             :     /** get the text attribute at position nIndex which owns
     393             :         the dummy character CH_TXTATR_* at that position, if one exists.
     394             :         @param nIndex   the position in the text
     395             :         @param nWhich   if different from RES_TXTATR_END, return only
     396             :                         attribute with given which id
     397             :         @return the text attribute at nIndex of type nWhich, if it exists
     398             :     */
     399             :     SwTextAttr *GetTextAttrForCharAt(
     400             :         const sal_Int32 nIndex,
     401             :         const RES_TXTATR nWhich = RES_TXTATR_END ) const;
     402             : 
     403             :     SwTextField* GetFieldTextAttrAt(
     404             :         const sal_Int32 nIndex,
     405             :         const bool bIncludeInputFieldAtStart = false ) const;
     406             : 
     407             :     OUString GetCurWord(sal_Int32) const;
     408             :     bool Spell(SwSpellArgs*);
     409             :     bool Convert( SwConversionArgs & );
     410             : 
     411             :     inline SwTextFormatColl *GetTextColl() const;
     412             :     virtual SwFormatColl *ChgFormatColl( SwFormatColl* ) SAL_OVERRIDE;
     413             :     void _ChgTextCollUpdateNum( const SwTextFormatColl* pOld,
     414             :                                 const SwTextFormatColl* pNew );
     415             : 
     416             :     /** Copy collection with all auto formats to dest-node.
     417             :         The latter might be in an other document!
     418             :        (Method in ndcopy.cxx!!). */
     419             :     void CopyCollFormat( SwTextNode& rDestNd );
     420             : 
     421             :     // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF:
     422             : 
     423             :     /**
     424             :        Returns numbering rule of this text node.
     425             : 
     426             :        @param bInParent     serach in parent attributes, too
     427             : 
     428             :        @return numbering rule of this text node or NULL if none is set
     429             :      */
     430             :     SwNumRule *GetNumRule(bool bInParent = true) const;
     431             : 
     432    26402233 :     inline const SwNodeNum* GetNum() const
     433             :     {
     434    26402233 :         return mpNodeNum;
     435             :     }
     436             : 
     437             :     SwNumberTree::tNumberVector GetNumberVector() const;
     438             : 
     439             :     /**
     440             :        Returns if this text node is an outline.
     441             : 
     442             :        @retval true      this text node is an outline
     443             :        @retval false     else
     444             :      */
     445             :     bool IsOutline() const;
     446             : 
     447             :     bool IsOutlineStateChanged() const;
     448             : 
     449             :     void UpdateOutlineState();
     450             : 
     451             :     /**
     452             :        Notify this textnode that its numbering rule has changed.
     453             :      */
     454             :     void NumRuleChgd();
     455             : 
     456             :     /** Returns outline of numbering string
     457             : 
     458             :         Introduce parameter <_bInclPrefixAndSuffixStrings> in order to control,
     459             :         if the prefix and the suffix strings have to been included or not.
     460             : 
     461             :         @param _bInclPrefixAndSuffixStrings
     462             :         optional input parameter - boolean indicating, if the prefix and the
     463             :         suffix strings have to been included or not. default value = <true>
     464             : 
     465             :         @param _nRestrictToThisLevel
     466             :         optional input parameter - unsigned integer indicating the maximum outline
     467             :         level to which the output string must be restricted to. Default value is
     468             :         MAXLEVEL
     469             :     */
     470             :     OUString GetNumString( const bool _bInclPrefixAndSuffixStrings = true,
     471             :             const unsigned int _nRestrictToThisLevel = MAXLEVEL ) const;
     472             : 
     473             :     /**
     474             :        Returns the additional indents of this text node and its numbering.
     475             : 
     476             :        @param bTextLeft  ???
     477             : 
     478             :        @return additional indents
     479             :      */
     480             :      long GetLeftMarginWithNum( bool bTextLeft = false ) const;
     481             : 
     482             :     /**
     483             :        Returns the combined first line indent of this text node and
     484             :        its numbering.
     485             : 
     486             :        @param the first line indent of this text node taking the
     487             :                numbering into account (return parameter)
     488             : 
     489             :        @retval true   this node has SwNodeNum and has numbering rule
     490             :        @retval false  else
     491             :      */
     492             :     bool GetFirstLineOfsWithNum( short& rFirstOffset ) const;
     493             : 
     494             :     SwTwips GetAdditionalIndentForStartingNewList() const;
     495             : 
     496             :     void ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const;
     497             : 
     498             :     /** return left margin for tab stop position calculation
     499             : 
     500             :         Needed for text formatting
     501             :         Method considers new list level attributes, which also can provide a left margin value
     502             :     */
     503             :     long GetLeftMarginForTabCalculation() const;
     504             : 
     505             :     /** Returns if this text node has a number.
     506             : 
     507             :         This text node has a number if it has a SwNodeNum and a
     508             :         numbering rule and the numbering format specified for the
     509             :         level of the SwNodeNum is of an enumeration type.
     510             : 
     511             :         @retval true    This text node has a number.
     512             :         @retval false   else
     513             :      */
     514             :     bool HasNumber() const;
     515             : 
     516             :     /** Returns if this text node has a bullet.
     517             : 
     518             :         This text node has a bullet if it has a SwNodeNum and a
     519             :         numbering rule and the numbering format specified for the
     520             :         level of the SwNodeNum is of a bullet type.
     521             : 
     522             :         @retval true    This text node has a bullet.
     523             :         @retval false   else
     524             :      */
     525             :     bool HasBullet() const;
     526             : 
     527             :     /** Returns is this text node is numbered.
     528             : 
     529             :         This node is numbered if it has a SwNodeNum and it has a
     530             :         numbering rule and has not a hidden SwNodeNum.
     531             : 
     532             :         ATTENTION: Returns true even if the SwNumFormat has type
     533             :         SVX_NUM_NUMBER_NONE.
     534             : 
     535             :         @retval true      This node is numbered.
     536             :         @retval false     else
     537             :      */
     538             :     bool IsNumbered() const;
     539             : 
     540             :     /** Returns if this text node has a marked label.
     541             : 
     542             :         @retval true       This text node has a marked label.
     543             :         @retval false      else
     544             :      */
     545             :     bool HasMarkedLabel() const;
     546             : 
     547             :     /** Sets the list level of this text node.
     548             : 
     549             :         Side effect, when the text node is a list item:
     550             :         The text node's representation in the list tree (<SwNodeNum> instance)
     551             :         is updated.
     552             : 
     553             :         @param nLevel level to set
     554             :     */
     555             :     void SetAttrListLevel(int nLevel);
     556             : 
     557             :     bool HasAttrListLevel() const;
     558             : 
     559             :     int GetAttrListLevel() const;
     560             : 
     561             :     /** Returns the actual list level of this text node, when it is a list item
     562             : 
     563             :         @return the actual list level of this text node, if it is a list item,
     564             :                -1 otherwise
     565             :     */
     566             :     int GetActualListLevel() const;
     567             : 
     568             :     /**
     569             :        Returns outline level of this text node.
     570             : 
     571             :        If a text node has an outline number (i.e. it has an SwNodeNum
     572             :        and a outline numbering rule) the outline level is the level of
     573             :        this SwNodeNum.
     574             : 
     575             :        If a text node has no outline number and has a paragraph style
     576             :        attached the outline level is the outline level of the
     577             :        paragraph style.
     578             : 
     579             :        Otherwise the text node has no outline level (NO_NUMBERING).
     580             : 
     581             :        NOTE: The outline level of text nodes is subject to change. The
     582             :        plan is to have an SwTextNode::nOutlineLevel member that is
     583             :        updated from a paragraph style upon appliance of that paragraph
     584             :        style.
     585             : 
     586             :        @return outline level or NO_NUMBERING if there is no outline level
     587             :      */
     588             :     int GetAttrOutlineLevel() const;
     589             : 
     590             :     /**
     591             :        Sets the out line level *at* a text node.
     592             : 
     593             :        @param nLevel     the level to be set
     594             : 
     595             :        If the text node has an outline number the level is set at the
     596             :        outline number.
     597             : 
     598             :        If the text node has no outline number but has a paragraph
     599             :        style applied the outline level is set at the paragraph style.
     600             : 
     601             :        NOTE: This is subject to change, see GetOutlineLevel.
     602             :      */
     603             :     void SetAttrOutlineLevel(int nLevel);
     604             : 
     605       18486 :     bool IsEmptyListStyleDueToSetOutlineLevelAttr() { return mbEmptyListStyleSetDueToSetOutlineLevelAttr;}
     606             :     void SetEmptyListStyleDueToSetOutlineLevelAttr();
     607             :     void ResetEmptyListStyleDueToResetOutlineLevelAttr();
     608             : 
     609             :     /**
     610             :        Returns the width of leading tabs/blanks in this paragraph.
     611             :        This space will be converted into numbering indent if the paragraph
     612             :        is set to be numbered.
     613             : 
     614             :        @return     the width of the leading whitespace
     615             :      */
     616             :     SwTwips GetWidthOfLeadingTabs() const;
     617             : 
     618             :     /**
     619             :        Returns if the paragraph has a visible numbering or bullet.
     620             :        This includes all kinds of numbering/bullet/outlines.
     621             :        Note: This function returns false, if the numbering format is
     622             :        SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted.
     623             : 
     624             :        @return     true if the paragraph has a visible numbering/bullet/outline
     625             :      */
     626             :     bool HasVisibleNumberingOrBullet() const;
     627             : 
     628             :     void SetListId(OUString const& rListId);
     629             :     OUString GetListId() const;
     630             : 
     631             :     /** Determines, if the list level indent attributes can be applied to the
     632             :         paragraph.
     633             : 
     634             :         The list level indents can be applied to the paragraph under the one
     635             :         of following conditions:
     636             :         - the list style is directly applied to the paragraph and the paragraph
     637             :           has no own indent attributes.
     638             :         - the list style is applied to the paragraph through one of its paragraph
     639             :           styles, the paragraph has no own indent attributes and on the paragraph
     640             :           style hierarchy from the paragraph to the paragraph style with the
     641             :           list style no indent attributes are found.
     642             : 
     643             :         @return boolean
     644             :     */
     645             :     bool AreListLevelIndentsApplicable() const;
     646             : 
     647             :     /** Retrieves the list tab stop position, if the paragraph's list level defines
     648             :         one and this list tab stop has to merged into the tap stops of the paragraph
     649             : 
     650             :         @param nListTabStopPosition
     651             :         output parameter - containing the list tab stop position
     652             : 
     653             :         @return boolean - indicating, if a list tab stop position is provided
     654             :     */
     655             :     bool GetListTabStopPosition( long& nListTabStopPosition ) const;
     656             : 
     657             :     /** Retrieves the character following the list label, if the paragraph's
     658             :         list level defines one.
     659             : 
     660             :         @return the list tab stop position as string
     661             :     */
     662             :     OUString GetLabelFollowedBy() const;
     663             : 
     664             :     // END OF BULLET/NUMBERING/OUTLINE STUFF:
     665             : 
     666             :     void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const;
     667             : 
     668             :     sal_uInt16 GetLang( const sal_Int32 nBegin, const sal_Int32 nLen = 0,
     669             :                     sal_uInt16 nScript = 0 ) const;
     670             : 
     671             :     /// in ndcopy.cxx
     672             :     bool IsSymbol( const sal_Int32 nBegin ) const; // In itratr.cxx.
     673             :     virtual SwContentNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const SAL_OVERRIDE;
     674             : 
     675             :     /// Interactive hyphenation: we find TextFrm and call its CalcHyph.
     676             :     bool Hyphenate( SwInterHyphInfo &rHyphInf );
     677             :     void DelSoftHyph( const sal_Int32 nStart, const sal_Int32 nEnd );
     678             : 
     679             :     /** add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating,
     680             :        when <bWithNum = true> that a space is inserted after the string for
     681             :        the list label.
     682             :        add 5th optional parameter <bWithSpacesForLevel> indicating, if additional
     683             :        spaces are inserted in front of the expanded text string depending on
     684             :        the list level. */
     685             :     OUString GetExpandText(  const sal_Int32 nIdx = 0,
     686             :                             const sal_Int32 nLen = -1,
     687             :                             const bool bWithNum = false,
     688             :                             const bool bAddSpaceAfterListLabelStr = false,
     689             :                             const bool bWithSpacesForLevel = false,
     690             :                             const bool bWithFootnote = true ) const;
     691             :     bool GetExpandText( SwTextNode& rDestNd, const SwIndex* pDestIdx = 0,
     692             :                            sal_Int32 nIdx = 0, sal_Int32 nLen = -1,
     693             :                            bool bWithNum = false, bool bWithFootnote = true,
     694             :                            bool bReplaceTabsWithSpaces = false ) const;
     695             : 
     696             :     OUString GetRedlineText( sal_Int32 nIdx = 0,
     697             :                           sal_Int32 nLen = SAL_MAX_INT32,
     698             :                           bool bExpandFields = false,
     699             :                           bool bWithNum = false ) const;
     700             : 
     701             :     /** @return actual count of initial chars for initial-function.
     702             :        If nWishLen == 0 that of first word. */
     703             :     sal_Int32 GetDropLen(sal_Int32 nWishLen) const;
     704             : 
     705             :     /// Passes back info needed on the dropcap dimensions
     706             :     bool GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescent) const;
     707             : 
     708             :     /// Hidden Paragraph Field:
     709        1239 :     inline bool CalcHiddenParaField()
     710        1239 :         { return m_pSwpHints && m_pSwpHints->CalcHiddenParaField(); }
     711             :     /// set CalcVisible flags
     712           0 :     inline void SetCalcHiddenParaField()
     713           0 :         { if (m_pSwpHints) m_pSwpHints->SetCalcHiddenParaField(); }
     714             : 
     715             :     /// is the paragraph visible?
     716    12040033 :     inline bool HasHiddenParaField() const
     717    12040033 :         { return m_pSwpHints && m_pSwpHints->HasHiddenParaField(); }
     718             : 
     719             :     /// Hidden Paragraph Field:
     720             : 
     721   109112456 :     inline bool HasHiddenCharAttribute( bool bWholePara ) const
     722             :     {
     723   109112456 :         if ( m_bRecalcHiddenCharFlags )
     724       34175 :             CalcHiddenCharFlags();
     725   109112456 :         return bWholePara ? m_bHiddenCharsHidePara : m_bContainsHiddenChars;
     726             :     }
     727             : 
     728      254631 :     inline void SetCalcHiddenCharFlags() const
     729      254631 :         { m_bRecalcHiddenCharFlags = true; }
     730             : 
     731             :     /** @return if the node is hidden due to
     732             :        1. HiddenParaField
     733             :        2. HiddenCharAttribute
     734             :        3. HiddenSection */
     735             : 
     736             :     bool IsHidden() const;
     737             : 
     738             :     TYPEINFO_OVERRIDE(); // fuer rtti
     739             : 
     740             :     /// override SwIndexReg
     741             :     virtual void Update(
     742             :         SwIndex const & rPos,
     743             :         const sal_Int32 nChangeLen,
     744             :         const bool bNegative = false,
     745             :         const bool bDelete = false ) SAL_OVERRIDE;
     746             : 
     747             :     /// change text to Upper/Lower/Hiragana/Katagana/...
     748             :     void TransliterateText( utl::TransliterationWrapper& rTrans,
     749             :                             sal_Int32 nStart, sal_Int32 nEnd,
     750             :                             SwUndoTransliterate* pUndo = 0 );
     751             : 
     752             :     /// count words in given range - returns true if we refreshed out count
     753             :     bool CountWords( SwDocStat& rStat, sal_Int32 nStart, sal_Int32 nEnd ) const;
     754             : 
     755             :     /** Checks some global conditions like loading or destruction of document
     756             :        to economize notifications */
     757             :     bool IsNotificationEnabled() const;
     758             : 
     759             :     /// Checks a temporary notification blocker and the global conditons of IsNotificationEnabled()
     760             :     bool IsNotifiable() const;
     761             : 
     762             :     void SetListRestart( bool bRestart );
     763             :     bool IsListRestart() const;
     764             : 
     765             :     void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum );
     766             :     bool HasAttrListRestartValue() const;
     767             :     SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const;
     768             :     SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const;
     769             : 
     770             :     void SetCountedInList( bool bCounted );
     771             :     bool IsCountedInList() const;
     772             : 
     773             :     void AddToList();
     774             :     void RemoveFromList();
     775             :     bool IsInList() const;
     776             : 
     777             :     bool IsFirstOfNumRule() const;
     778             : 
     779             :     sal_uInt16 GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd ) const;
     780             : 
     781             :     SAL_DLLPRIVATE ::com::sun::star::uno::WeakReference<
     782       38025 :         ::com::sun::star::text::XTextContent> const& GetXParagraph() const
     783       38025 :             { return m_wXParagraph; }
     784       33554 :     SAL_DLLPRIVATE void SetXParagraph(::com::sun::star::uno::Reference<
     785             :                     ::com::sun::star::text::XTextContent> const& xParagraph)
     786       33554 :             { m_wXParagraph = xParagraph; }
     787             : 
     788             :     /// sfx2::Metadatable
     789             :     virtual ::sfx2::IXmlIdRegistry& GetRegistry() SAL_OVERRIDE;
     790             :     virtual bool IsInClipboard() const SAL_OVERRIDE;
     791             :     virtual bool IsInUndo() const SAL_OVERRIDE;
     792             :     virtual bool IsInContent() const SAL_OVERRIDE;
     793             :     virtual ::com::sun::star::uno::Reference<
     794             :         ::com::sun::star::rdf::XMetadatable > MakeUnoObject() SAL_OVERRIDE;
     795             : 
     796             :     bool IsCollapse() const;
     797             : 
     798             :     virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
     799             : 
     800             :     sal_uInt32 GetRsid( sal_Int32 nStt, sal_Int32 nEnd ) const;
     801             :     sal_uInt32 GetParRsid() const;
     802             : 
     803             :     bool CompareRsid( const SwTextNode &rTextNode, sal_Int32 nStt1, sal_Int32 nStt2,
     804             :             sal_Int32 nEnd1 = 0,  sal_Int32 nEnd2 = 0 ) const;
     805             :     bool CompareParRsid( const SwTextNode &rTextNode ) const;
     806             : 
     807      110874 :     DECL_FIXEDMEMPOOL_NEWDEL(SwTextNode)
     808             : 
     809             :     //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
     810             :     virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const SAL_OVERRIDE;
     811             : 
     812             :     /// In MS Word, the font underline setting of the paragraph end position wont affect the formatting of numbering, so we ignore it
     813             :     static bool IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich);
     814             : };
     815             : 
     816         399 : inline SwpHints & SwTextNode::GetSwpHints()
     817             : {
     818             :     assert( m_pSwpHints );
     819         399 :     return *m_pSwpHints;
     820             : }
     821        2360 : inline const SwpHints &SwTextNode::GetSwpHints() const
     822             : {
     823             :     assert( m_pSwpHints );
     824        2360 :     return *m_pSwpHints;
     825             : }
     826             : 
     827      232345 : inline SwpHints& SwTextNode::GetOrCreateSwpHints()
     828             : {
     829      232345 :     if ( !m_pSwpHints )
     830             :     {
     831       72844 :         m_pSwpHints = new SwpHints;
     832             :     }
     833      232345 :     return *m_pSwpHints;
     834             : }
     835             : 
     836      189902 : inline void SwTextNode::TryDeleteSwpHints()
     837             : {
     838      189902 :     if ( m_pSwpHints && m_pSwpHints->CanBeDeleted() )
     839             :     {
     840       54875 :         DELETEZ( m_pSwpHints );
     841             :     }
     842      189902 : }
     843             : 
     844      179998 : inline SwTextFormatColl* SwTextNode::GetTextColl() const
     845             : {
     846      179998 :     return static_cast<SwTextFormatColl*>(const_cast<SwModify*>(GetRegisteredIn()));
     847             : }
     848             : 
     849             : /// Inline methods from Node.hxx
     850     2145574 : inline SwTextNode *SwNode::GetTextNode()
     851             : {
     852     2145574 :      return ND_TEXTNODE == nNodeType ? static_cast<SwTextNode*>(this) : 0;
     853             : }
     854             : 
     855   272343374 : inline const SwTextNode *SwNode::GetTextNode() const
     856             : {
     857   272343374 :      return ND_TEXTNODE == nNodeType ? static_cast<const SwTextNode*>(this) : 0;
     858             : }
     859             : 
     860             : inline void
     861         232 : SwTextNode::CutText(SwTextNode * const pDest, const SwIndex & rDestStart,
     862             :                     const SwIndex & rStart, const sal_Int32 nLen)
     863             : {
     864         232 :     CutImpl( pDest, rDestStart, rStart, nLen, true );
     865         232 : }
     866             : 
     867      162708 : inline sal_Int32 SwTextNode::GetSpaceLeft() const
     868             : {
     869             :     // do not fill the String up to the max - need to be able to have a
     870             :     // SwPosition "behind" the last character, i.e., at index TXTNODE_MAX + 1
     871      162708 :     const sal_Int32 TXTNODE_MAX = SAL_MAX_INT32 - 2;
     872      162708 :     return TXTNODE_MAX-m_Text.getLength();
     873             : }
     874             : 
     875             : #endif
     876             : 
     877             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11