diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-19 09:08:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-21 15:25:56 +0200 |
commit | 5f9ffc31cd1b5433c354c7d39ce1d80fa0e57fc8 (patch) | |
tree | 8736f233563535eb3aa5fa019bb92a9970970428 | |
parent | 81debfba86b1d67d1c2e0ecd9c10ca35c3e7de5e (diff) |
introduce SwNodeOffset strong typedef
for indexing into node children. Replaces various usage
of sal_uLong, tools::Long, sal_uInt32 with an underlying
type of sal_Int32.
Also add a NODE_OFFSET_MAX constant to replace usage
of ULONG_MAX
Change-Id: I2f466922e1ebc19029bb2883d2b29aa4c0614170
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123892
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
246 files changed, 1622 insertions, 1556 deletions
diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx index 99da34854751..fb8af7657132 100644 --- a/sw/inc/IDocumentFieldsAccess.hxx +++ b/sw/inc/IDocumentFieldsAccess.hxx @@ -22,6 +22,7 @@ #include <sal/types.h> #include <tools/solar.h> +#include "nodeoffset.hxx" class SwFieldTypes; class SwFieldType; @@ -114,7 +115,7 @@ namespace com::sun::star::uno { class Any; } SwNode (see parameter pChk) is (?) part of the private data structure of SwDoc and should not be exposed */ - virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen) = 0; + virtual bool SetFieldsDirty(bool b, const SwNode* pChk, SwNodeOffset nLen) = 0; virtual void SetFixFields(const DateTime* pNewDateTime) = 0; @@ -122,7 +123,7 @@ namespace com::sun::star::uno { class Any; } // (Node [ + css::ucb::Content]). // A generated list of all fields may be passed along too // (if the address != 0 and the pointer == 0 a new list will be returned). - virtual void FieldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_Int32 nLastCnt) = 0; + virtual void FieldsToCalc(SwCalc& rCalc, SwNodeOffset nLastNd, sal_Int32 nLastCnt) = 0; virtual void FieldsToCalc(SwCalc& rCalc, const SetGetExpField& rToThisField, SwRootFrame const* pLayout) = 0; diff --git a/sw/inc/SwUndoField.hxx b/sw/inc/SwUndoField.hxx index 9abf8a49295e..d6145d63127b 100644 --- a/sw/inc/SwUndoField.hxx +++ b/sw/inc/SwUndoField.hxx @@ -29,7 +29,7 @@ class SwMsgPoolItem; class SwUndoField : public SwUndo { - sal_uLong m_nNodeIndex; + SwNodeOffset m_nNodeIndex; sal_Int32 m_nOffset; protected: diff --git a/sw/inc/ToxTabStopTokenHandler.hxx b/sw/inc/ToxTabStopTokenHandler.hxx index 158c2129b0ef..89a74fe6e65b 100644 --- a/sw/inc/ToxTabStopTokenHandler.hxx +++ b/sw/inc/ToxTabStopTokenHandler.hxx @@ -14,6 +14,7 @@ #include <rtl/ustring.hxx> #include <editeng/tstpitem.hxx> +#include "nodeoffset.hxx" struct SwFormToken; class SwPageDesc; @@ -70,7 +71,7 @@ public: * @param tabstopReferencePolicy * How tab stops are positioned. (#i21237) The default behavior is to place tab stops relative to the page. */ - DefaultToxTabStopTokenHandler(sal_uInt32 indexOfSectionNode, const SwPageDesc& defaultPageDescription, + DefaultToxTabStopTokenHandler(SwNodeOffset indexOfSectionNode, const SwPageDesc& defaultPageDescription, bool tabPositionIsRelativeToParagraphIndent, TabStopReferencePolicy referencePolicy); @@ -100,7 +101,7 @@ private: tools::Long CalculatePageMarginFromPageDescription(const SwTextNode& targetNode) const; - sal_uInt32 mIndexOfSectionNode; + SwNodeOffset mIndexOfSectionNode; const SwPageDesc& mDefaultPageDescription; bool mTabPositionIsRelativeToParagraphIndent; TabStopReferencePolicy mTabStopReferencePolicy; diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 14507f20097c..4ff84bff5d93 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -188,7 +188,7 @@ private: tools::Long m_nUpDownX; /**< try to move the cursor on up/down always in the same column */ tools::Long m_nLeftFramePos; - sal_uLong m_nCurrentNode; // save CursorPos at Start-Action + SwNodeOffset m_nCurrentNode; // save CursorPos at Start-Action sal_Int32 m_nCurrentContent; SwNodeType m_nCurrentNdTyp; diff --git a/sw/inc/ddefld.hxx b/sw/inc/ddefld.hxx index 3e7d91479b56..a9ca4db81b52 100644 --- a/sw/inc/ddefld.hxx +++ b/sw/inc/ddefld.hxx @@ -40,9 +40,9 @@ namespace sw }; struct InRangeSearchHint final : public SfxHint { - const sal_uLong m_nSttNd, m_nEndNd; + const SwNodeOffset m_nSttNd, m_nEndNd; bool& m_rIsInRange; - InRangeSearchHint(const sal_uLong nSttNd, const sal_uLong nEndNd, bool& rIsInRange) + InRangeSearchHint(const SwNodeOffset nSttNd, const SwNodeOffset nEndNd, bool& rIsInRange) : m_nSttNd(nSttNd), m_nEndNd(nEndNd), m_rIsInRange(rIsInRange) {} }; } diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index a09b74f4b16b..20edaec0d1ed 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -932,7 +932,7 @@ public: const SfxItemSet* pSet = nullptr, bool bExpand = false, SwRootFrame const* pLayout = nullptr ); - void InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd, + void InsertTableOf( SwNodeOffset nSttNd, SwNodeOffset nEndNd, const SwTOXBase& rTOX, const SfxItemSet* pSet ); static SwTOXBase* GetCurTOX( const SwPosition& rPos ); @@ -1144,8 +1144,8 @@ public: /** Move selected paragraphs (not only numberings) according to offsets. (if negative: go to doc start). */ - bool MoveParagraph(SwPaM&, tools::Long nOffset, bool bIsOutlMv = false); - bool MoveParagraphImpl(SwPaM&, tools::Long nOffset, bool bIsOutlMv, SwRootFrame const*); + bool MoveParagraph(SwPaM&, SwNodeOffset nOffset, bool bIsOutlMv = false); + bool MoveParagraphImpl(SwPaM&, SwNodeOffset nOffset, bool bIsOutlMv, SwRootFrame const*); bool NumOrNoNum( const SwNodeIndex& rIdx, bool bDel = false); @@ -1308,7 +1308,7 @@ public: // Insert label. If a FlyFormat is created, return it. SwFlyFrameFormat* InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator, const OUString& rNumberingSeparator, - const bool bBefore, const sal_uInt16 nId, const sal_uLong nIdx, + const bool bBefore, const sal_uInt16 nId, const SwNodeOffset nIdx, const OUString& rCharacterStyle, const bool bCpyBrd ); SwFlyFrameFormat* InsertDrawLabel( diff --git a/sw/inc/edglbldc.hxx b/sw/inc/edglbldc.hxx index 9ab0bf4e4b6b..67dc4e805183 100644 --- a/sw/inc/edglbldc.hxx +++ b/sw/inc/edglbldc.hxx @@ -35,14 +35,14 @@ enum GlobalDocContentType { class SwGlblDocContent { GlobalDocContentType m_eType; - sal_uLong m_nDocPos; + SwNodeOffset m_nDocPos; union { const SwTOXBase* pTOX; const SwSection* pSect; } m_PTR; public: - SwGlblDocContent( sal_uLong nPos ); + SwGlblDocContent( SwNodeOffset nPos ); SwGlblDocContent( const SwTOXBaseSection* pTOX ); SwGlblDocContent( const SwSection* pSect ); @@ -52,7 +52,7 @@ public: { return GLBLDOC_SECTION == m_eType ? m_PTR.pSect : nullptr; } const SwTOXBase* GetTOX() const { return GLBLDOC_TOXBASE == m_eType ? m_PTR.pTOX : nullptr; } - sal_uLong GetDocPos() const { return m_nDocPos; } + SwNodeOffset GetDocPos() const { return m_nDocPos; } /// For sorting. bool operator==( const SwGlblDocContent& rCmp ) const diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx index b9bc4a480aa1..a4292dd464be 100644 --- a/sw/inc/edimp.hxx +++ b/sw/inc/edimp.hxx @@ -28,9 +28,9 @@ class SwNodeIndex; struct SwPamRange { - sal_uLong nStart, nEnd; + SwNodeOffset nStart, nEnd; - SwPamRange( sal_uLong nS, sal_uLong nE ) : nStart( nS ), nEnd( nE ) {} + SwPamRange( SwNodeOffset nS, SwNodeOffset nE ) : nStart( nS ), nEnd( nE ) {} bool operator==( const SwPamRange& rRg ) const { return nStart == rRg.nStart; } diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index cea1eab10691..f3f645580135 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -521,7 +521,7 @@ public: void NumUpDown( bool bDown = true ); - bool MoveParagraph( tools::Long nOffset = 1); + bool MoveParagraph( SwNodeOffset nOffset = SwNodeOffset(1)); bool MoveNumParas( bool bUpperLower, bool bUpperLeft ); /// Switch on/off of numbering via Delete/Backspace. diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index e38122ec390d..5e0dc3378ee4 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -22,6 +22,7 @@ #include <i18nlangtag/lang.h> #include "swdllapi.h" #include "calbck.hxx" +#include "nodeoffset.hxx" #include <cppuhelper/weakref.hxx> #include <editeng/svxenum.hxx> @@ -278,7 +279,7 @@ public: SwFormatField* FindFormatForPostItId(sal_uInt32 nPostItId) const; void CollectPostIts(std::vector<SwFormatField*>& rvFormatFields, IDocumentRedlineAccess const& rIDRA, bool HideRedlines); bool HasHiddenInformationNotes() const; - void GatherNodeIndex(std::vector<sal_uLong>& rvNodeIndex); + void GatherNodeIndex(std::vector<SwNodeOffset>& rvNodeIndex); void GatherRefFields(std::vector<SwGetRefField*>& rvRFields, const sal_uInt16 nTyp); void GatherFields(std::vector<SwFormatField*>& rvFormatFields, bool bCollectOnlyInDocNodes=true) const; }; diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index 706026120aaa..fdceaeacb73b 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -27,6 +27,7 @@ #include "swdllapi.h" #include "calbck.hxx" #include "reffld.hxx" +#include "nodeoffset.hxx" class SwField; class SwTextField; @@ -58,8 +59,8 @@ namespace sw { HasHiddenInformationNotesHint(bool& rbHasHiddenInformationNotes) : m_rbHasHiddenInformationNotes(rbHasHiddenInformationNotes) {}; }; struct GatherNodeIndexHint final : SfxHint { - std::vector<sal_uLong>& m_rvNodeIndex; - GatherNodeIndexHint(std::vector<sal_uLong>& rvNodeIndex) : m_rvNodeIndex(rvNodeIndex) {}; + std::vector<SwNodeOffset>& m_rvNodeIndex; + GatherNodeIndexHint(std::vector<SwNodeOffset>& rvNodeIndex) : m_rvNodeIndex(rvNodeIndex) {}; }; struct GatherRefFieldsHint final : SfxHint { std::vector<SwGetRefField*>& m_rvRFields; diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index dea24da0ca81..5393af72e776 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -30,6 +30,7 @@ #include "ndtyp.hxx" #include <rtl/ustring.hxx> #include <o3tl/sorted_vector.hxx> +#include "nodeoffset.hxx" class Graphic; class GraphicObject; @@ -93,10 +94,10 @@ class SW_DLLPUBLIC SwNodes final friend class ::sw::DocumentContentOperationsManager; SwNodeIndex* m_vIndices; ///< ring of all indices on nodes. - void RemoveNode( sal_uLong nDelPos, sal_uLong nLen, bool bDel ); + void RemoveNode( SwNodeOffset nDelPos, SwNodeOffset nLen, bool bDel ); void InsertNode( SwNode* pNode, const SwNodeIndex& rPos ); - void InsertNode( SwNode* pNode, sal_uLong nPos ); + void InsertNode( SwNode* pNode, SwNodeOffset nPos ); SwDoc& m_rMyDoc; ///< This Doc contains the nodes-array. @@ -112,9 +113,9 @@ class SW_DLLPUBLIC SwNodes final // Actions on the nodes. static void SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEnd ); - void DelNodes( const SwNodeIndex& rStart, sal_uLong nCnt = 1 ); + void DelNodes( const SwNodeIndex& rStart, SwNodeOffset nCnt = SwNodeOffset(1) ); - void ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSize, + void ChgNode( SwNodeIndex const & rDelPos, SwNodeOffset nSize, SwNodeIndex& rInsPos, bool bNewFrames ); void UpdateOutlineIdx( const SwNode& ); ///< Update all OutlineNodes starting from Node. @@ -134,14 +135,14 @@ public: typedef std::vector<SwNodeRange> NodeRanges_t; typedef std::vector<NodeRanges_t> TableRanges_t; - SwNode* operator[]( sal_uLong n ) const; // defined in node.hxx + SwNode* operator[]( SwNodeOffset n ) const; // defined in node.hxx - sal_uLong Count() const { return BigPtrArray::Count(); } + SwNodeOffset Count() const { return SwNodeOffset(BigPtrArray::Count()); } void ForEach( FnForEach_SwNodes fnForEach, void* pArgs = nullptr ) { - ForEach( 0, BigPtrArray::Count(), fnForEach, pArgs ); + ForEach( SwNodeOffset(0), Count(), fnForEach, pArgs ); } - void ForEach( sal_uLong nStt, sal_uLong nEnd, FnForEach_SwNodes fnForEach, void* pArgs ); + void ForEach( SwNodeOffset nStt, SwNodeOffset nEnd, FnForEach_SwNodes fnForEach, void* pArgs ); void ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd, FnForEach_SwNodes fnForEach, void* pArgs ); @@ -164,7 +165,7 @@ public: bool IsDocNodes() const; static sal_uInt16 GetSectionLevel(const SwNodeIndex &rIndex); - void Delete(const SwNodeIndex &rPos, sal_uLong nNodes = 1); + void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes = SwNodeOffset(1)); bool MoveNodes( const SwNodeRange&, SwNodes& rNodes, const SwNodeIndex&, bool bNewFrames = true ); @@ -264,7 +265,7 @@ public: bool TableToText( const SwNodeRange& rRange, sal_Unicode cCh, SwUndoTableToText* ); /// Is in untbl.cxx and may called only by Undo-object. - SwTableNode* UndoTableToText( sal_uLong nStt, sal_uLong nEnd, + SwTableNode* UndoTableToText( SwNodeOffset nStt, SwNodeOffset nEnd, const SwTableToTextSaves& rSavedData ); /** Insert a new box in the line before InsPos. Its format diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx index 303a7801ca6f..7d03b0bcadaf 100644 --- a/sw/inc/ndindex.hxx +++ b/sw/inc/ndindex.hxx @@ -26,15 +26,13 @@ #include "node.hxx" #include "ring.hxx" #include "ndarr.hxx" +#include "nodeoffset.hxx" /// Marks a node in the document model. class SW_DLLPUBLIC SwNodeIndex final : public sw::Ring<SwNodeIndex> { SwNode * m_pNode; - // These are not allowed! - SwNodeIndex( SwNodes& rNds, sal_uInt16 nIdx ) = delete; - SwNodeIndex( SwNodes& rNds, int nIdx ) = delete; void RegisterIndex( SwNodes& rNodes ) { if(!rNodes.m_vIndices) @@ -51,12 +49,14 @@ class SW_DLLPUBLIC SwNodeIndex final : public sw::Ring<SwNodeIndex> } public: - SwNodeIndex( SwNodes& rNds, sal_uLong nIdx = 0 ) + SwNodeIndex( SwNodes& rNds, sal_Int32 nIdx ) : SwNodeIndex(rNds, SwNodeOffset(nIdx)) {} + SwNodeIndex( SwNodes& rNds, SwNodeOffset nIdx = SwNodeOffset(0) ) : m_pNode( rNds[ nIdx ] ) { RegisterIndex( rNds ); }; - SwNodeIndex( const SwNodeIndex& rIdx, tools::Long nDiff = 0 ) + SwNodeIndex( const SwNodeIndex& rIdx, sal_Int32 nDiff ) : SwNodeIndex(rIdx, SwNodeOffset(nDiff)) {} + SwNodeIndex( const SwNodeIndex& rIdx, SwNodeOffset nDiff = SwNodeOffset(0) ) : sw::Ring<SwNodeIndex>() { if( nDiff ) @@ -66,7 +66,8 @@ public: RegisterIndex( m_pNode->GetNodes() ); } - SwNodeIndex( const SwNode& rNd, tools::Long nDiff = 0 ) + SwNodeIndex( const SwNode& rNd, sal_Int32 nDiff ) : SwNodeIndex(rNd, SwNodeOffset(nDiff)) {} + SwNodeIndex( const SwNode& rNd, SwNodeOffset nDiff = SwNodeOffset(0) ) { if( nDiff ) m_pNode = rNd.GetNodes()[ rNd.GetIndex() + nDiff ]; @@ -78,13 +79,13 @@ public: virtual ~SwNodeIndex() override { DeRegisterIndex( m_pNode->GetNodes() ); } - inline sal_uLong operator++(); - inline sal_uLong operator--(); - inline sal_uLong operator++(int); - inline sal_uLong operator--(int); + inline SwNodeOffset operator++(); + inline SwNodeOffset operator--(); + inline SwNodeOffset operator++(int); + inline SwNodeOffset operator--(int); - inline sal_uLong operator+=( sal_uLong ); - inline sal_uLong operator-=( sal_uLong ); + inline SwNodeOffset operator+=( SwNodeOffset ); + inline SwNodeOffset operator-=( SwNodeOffset ); inline bool operator< ( const SwNodeIndex& ) const; inline bool operator<=( const SwNodeIndex& ) const; @@ -93,23 +94,24 @@ public: inline bool operator==( const SwNodeIndex& ) const; inline bool operator!=( const SwNodeIndex& ) const; - inline bool operator< ( sal_uLong ) const; - inline bool operator<=( sal_uLong ) const; - inline bool operator> ( sal_uLong ) const; - inline bool operator>=( sal_uLong ) const; - inline bool operator==( sal_uLong ) const; - inline bool operator!=( sal_uLong ) const; + inline bool operator< ( SwNodeOffset ) const; + inline bool operator<=( SwNodeOffset ) const; + inline bool operator> ( SwNodeOffset ) const; + inline bool operator>=( SwNodeOffset ) const; + inline bool operator==( SwNodeOffset ) const; + inline bool operator!=( SwNodeOffset ) const; - inline SwNodeIndex& operator=( sal_uLong ); + inline SwNodeIndex& operator=( SwNodeOffset ); inline SwNodeIndex& operator=( const SwNodeIndex& ); inline SwNodeIndex& operator=( const SwNode& ); - // Return value of index as sal_uLong. - inline sal_uLong GetIndex() const; + // Return value of index as SwNodeOffset. + inline SwNodeOffset GetIndex() const; // Enables assignments without creation of a temporary object. - inline SwNodeIndex& Assign( SwNodes const & rNds, sal_uLong ); - inline SwNodeIndex& Assign( const SwNode& rNd, tools::Long nOffset = 0 ); + inline SwNodeIndex& Assign( SwNodes const & rNds, SwNodeOffset ); + SwNodeIndex& Assign( const SwNode& rNd, sal_Int32 nOffset ) { return Assign(rNd, SwNodeOffset(nOffset)); } + inline SwNodeIndex& Assign( const SwNode& rNd, SwNodeOffset nOffset = SwNodeOffset(0) ); // Gets pointer on NodesArray. inline const SwNodes& GetNodes() const; @@ -121,7 +123,7 @@ public: inline std::ostream &operator <<(std::ostream& s, const SwNodeIndex& index) { - return s << "SwNodeIndex (node " << index.GetIndex() << ")"; + return s << "SwNodeIndex (node " << sal_Int32(index.GetIndex()) << ")"; }; // SwRange @@ -137,19 +139,19 @@ public: SwNodeRange( const SwNodeRange &rRange ) : aStart( rRange.aStart ), aEnd( rRange.aEnd ) {}; - SwNodeRange( SwNodes& rNds, sal_uLong nSttIdx, sal_uLong nEndIdx = 0 ) + SwNodeRange( SwNodes& rNds, SwNodeOffset nSttIdx, SwNodeOffset nEndIdx = SwNodeOffset(0) ) : aStart( rNds, nSttIdx ), aEnd( rNds, nEndIdx ) {}; - SwNodeRange( const SwNodeIndex& rS, tools::Long nSttDiff, const SwNodeIndex& rE, tools::Long nEndDiff = 0 ) + SwNodeRange( const SwNodeIndex& rS, SwNodeOffset nSttDiff, const SwNodeIndex& rE, SwNodeOffset nEndDiff = SwNodeOffset(0) ) : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff ) {}; - SwNodeRange( const SwNode& rS, tools::Long nSttDiff, const SwNode& rE, tools::Long nEndDiff = 0 ) + SwNodeRange( const SwNode& rS, SwNodeOffset nSttDiff, const SwNode& rE, SwNodeOffset nEndDiff = SwNodeOffset(0) ) : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff ) {}; }; // For inlines node.hxx is needed which in turn needs this one. // Therefore all inlines accessing m_pNode are implemented here. -inline sal_uLong SwNodeIndex::GetIndex() const +inline SwNodeOffset SwNodeIndex::GetIndex() const { return m_pNode->GetIndex(); } @@ -161,27 +163,27 @@ inline SwNodes& SwNodeIndex::GetNodes() { return m_pNode->GetNodes(); } -inline bool SwNodeIndex::operator< ( sal_uLong const nOther ) const +inline bool SwNodeIndex::operator< ( SwNodeOffset const nOther ) const { return m_pNode->GetIndex() < nOther; } -inline bool SwNodeIndex::operator<=( sal_uLong const nOther ) const +inline bool SwNodeIndex::operator<=( SwNodeOffset const nOther ) const { return m_pNode->GetIndex() <= nOther; } -inline bool SwNodeIndex::operator> ( sal_uLong const nOther ) const +inline bool SwNodeIndex::operator> ( SwNodeOffset const nOther ) const { return m_pNode->GetIndex() > nOther; } -inline bool SwNodeIndex::operator>=( sal_uLong const nOther ) const +inline bool SwNodeIndex::operator>=( SwNodeOffset const nOther ) const { return m_pNode->GetIndex() >= nOther; } -inline bool SwNodeIndex::operator==( sal_uLong const nOther ) const +inline bool SwNodeIndex::operator==( SwNodeOffset const nOther ) const { return m_pNode->GetIndex() == nOther; } -inline bool SwNodeIndex::operator!=( sal_uLong const nOther ) const +inline bool SwNodeIndex::operator!=( SwNodeOffset const nOther ) const { return m_pNode->GetIndex() != nOther; } @@ -210,41 +212,41 @@ inline bool SwNodeIndex::operator!=( const SwNodeIndex& rIdx ) const return m_pNode != rIdx.m_pNode; } -inline sal_uLong SwNodeIndex::operator++() +inline SwNodeOffset SwNodeIndex::operator++() { - m_pNode = GetNodes()[ m_pNode->GetIndex()+1 ]; + m_pNode = GetNodes()[ m_pNode->GetIndex() + 1 ]; return m_pNode->GetIndex(); } -inline sal_uLong SwNodeIndex::operator--() +inline SwNodeOffset SwNodeIndex::operator--() { - m_pNode = GetNodes()[ m_pNode->GetIndex()-1 ]; + m_pNode = GetNodes()[ m_pNode->GetIndex() - 1 ]; return m_pNode->GetIndex(); } -inline sal_uLong SwNodeIndex::operator++(int) +inline SwNodeOffset SwNodeIndex::operator++(int) { - sal_uLong nOldIndex = m_pNode->GetIndex(); + SwNodeOffset nOldIndex = m_pNode->GetIndex(); m_pNode = GetNodes()[ nOldIndex + 1 ]; return nOldIndex; } -inline sal_uLong SwNodeIndex::operator--(int) +inline SwNodeOffset SwNodeIndex::operator--(int) { - sal_uLong nOldIndex = m_pNode->GetIndex(); + SwNodeOffset nOldIndex = m_pNode->GetIndex(); m_pNode = GetNodes()[ nOldIndex - 1 ]; return nOldIndex; } -inline sal_uLong SwNodeIndex::operator+=( sal_uLong const nOffset ) +inline SwNodeOffset SwNodeIndex::operator+=( SwNodeOffset const nOffset ) { m_pNode = GetNodes()[ m_pNode->GetIndex() + nOffset ]; return m_pNode->GetIndex(); } -inline sal_uLong SwNodeIndex::operator-=( sal_uLong const nOffset ) +inline SwNodeOffset SwNodeIndex::operator-=( SwNodeOffset const nOffset ) { m_pNode = GetNodes()[ m_pNode->GetIndex() - nOffset ]; return m_pNode->GetIndex(); } -inline SwNodeIndex& SwNodeIndex::operator=( sal_uLong const nNew ) +inline SwNodeIndex& SwNodeIndex::operator=( SwNodeOffset const nNew ) { m_pNode = GetNodes()[ nNew ]; return *this; @@ -269,13 +271,13 @@ SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd ) return *this; } -SwNodeIndex& SwNodeIndex::Assign( SwNodes const & rNds, sal_uLong nIdx ) +SwNodeIndex& SwNodeIndex::Assign( SwNodes const & rNds, SwNodeOffset nIdx ) { *this = *rNds[ nIdx ]; return *this; } -SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, tools::Long nOffset ) +SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, SwNodeOffset nOffset ) { *this = rNd; diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index d3320d995d06..42360271e808 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -233,7 +233,7 @@ public: virtual sal_Int32 Len() const override; /// Is in itratr. - void GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax, sal_uLong &rAbs ) const; + void GetMinMaxSize( SwNodeOffset nIndex, sal_uLong& rMin, sal_uLong &rMax, sal_uLong &rAbs ) const; /// overriding to handle change of certain paragraph attributes virtual bool SetAttr( const SfxPoolItem& ) override; diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index df30db2b9f9e..bdcc9c801a49 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -28,6 +28,7 @@ #include "ndtyp.hxx" #include "index.hxx" #include "fmtcol.hxx" +#include "nodeoffset.hxx" #include <memory> #include <vector> @@ -115,7 +116,7 @@ protected: SwNode( const SwNodeIndex &rWhere, const SwNodeType nNodeId ); /// for the initial StartNode - SwNode( SwNodes& rNodes, sal_uLong nPos, const SwNodeType nNodeId ); + SwNode( SwNodes& rNodes, SwNodeOffset nPos, const SwNodeType nNodeId ); public: /** the = 0 forces the class to be an abstract base class, but the dtor can be still called @@ -128,11 +129,11 @@ public: sal_uInt16 GetSectionLevel() const; - inline sal_uLong StartOfSectionIndex() const; + inline SwNodeOffset StartOfSectionIndex() const; const SwStartNode* StartOfSectionNode() const { return m_pStartOfSection; } SwStartNode* StartOfSectionNode() { return m_pStartOfSection; } - inline sal_uLong EndOfSectionIndex() const; + inline SwNodeOffset EndOfSectionIndex() const; inline const SwEndNode* EndOfSectionNode() const; inline SwEndNode* EndOfSectionNode(); @@ -280,7 +281,7 @@ public: /** Search PageDesc with which this node is formatted. If layout is existent search over layout, else only the hard way is left: search over the nodes to the front!! */ - const SwPageDesc* FindPageDesc( size_t* pPgDescNdIdx = nullptr ) const; + const SwPageDesc* FindPageDesc( SwNodeOffset* pPgDescNdIdx = nullptr ) const; /// If node is in a fly return the respective format. SwFrameFormat* GetFlyFormat() const; @@ -288,7 +289,7 @@ public: /// If node is in a table return the respective table box. SwTableBox* GetTableBox() const; - sal_uLong GetIndex() const { return GetPos(); } + SwNodeOffset GetIndex() const { return SwNodeOffset(GetPos()); } const SwTextNode* FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const* pLayout = nullptr) const; @@ -319,7 +320,7 @@ class SAL_DLLPUBLIC_RTTI SwStartNode: public SwNode SwStartNodeType m_eStartNodeType; /// for the initial StartNode - SwStartNode( SwNodes& rNodes, sal_uLong nPos ); + SwStartNode( SwNodes& rNodes, SwNodeOffset nPos ); protected: SwStartNode( const SwNodeIndex &rWhere, @@ -346,7 +347,7 @@ class SwEndNode final : public SwNode friend class SwSectionNode; ///< To enable creation of its EndNote. /// for the initial StartNode - SwEndNode( SwNodes& rNodes, sal_uLong nPos, SwStartNode& rSttNd ); + SwEndNode( SwNodes& rNodes, SwNodeOffset nPos, SwStartNode& rSttNd ); SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd ); @@ -671,11 +672,11 @@ inline const SwSectionNode* SwNode::FindSectionNode() const { return const_cast<SwNode*>(this)->FindSectionNode(); } -inline sal_uLong SwNode::StartOfSectionIndex() const +inline SwNodeOffset SwNode::StartOfSectionIndex() const { return m_pStartOfSection->GetIndex(); } -inline sal_uLong SwNode::EndOfSectionIndex() const +inline SwNodeOffset SwNode::EndOfSectionIndex() const { const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : m_pStartOfSection; return pStNd->m_pEndOfSection->GetIndex(); @@ -730,9 +731,9 @@ inline SwPlaceholderNode::SwPlaceholderNode(const SwNodeIndex &rWhere) { } -inline SwNode* SwNodes::operator[]( sal_uLong n ) const +inline SwNode* SwNodes::operator[]( SwNodeOffset n ) const { - return static_cast<SwNode*>(BigPtrArray::operator[] ( n )); + return static_cast<SwNode*>(BigPtrArray::operator[] ( sal_Int32(n) )); } #endif diff --git a/sw/inc/nodeoffset.hxx b/sw/inc/nodeoffset.hxx new file mode 100644 index 000000000000..0911fdb67b23 --- /dev/null +++ b/sw/inc/nodeoffset.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#pragma once + +#include <sal/config.h> +#include "swdllapi.h" +#include <o3tl/strong_int.hxx> +#include <iostream> + +typedef o3tl::strong_int<sal_Int32, struct Tag_SwNodeOffset> SwNodeOffset; + +/* Just to make it easier to write arithmetic with these types */ +template <typename T> +typename std::enable_if<std::is_signed<T>::value, SwNodeOffset>::type operator+(SwNodeOffset a, T n) +{ + return a + SwNodeOffset(n); +} + +/* Just to make it easier to write arithmetic with these types */ +template <typename T> +typename std::enable_if<std::is_signed<T>::value, SwNodeOffset>::type operator-(SwNodeOffset a, T n) +{ + return a - SwNodeOffset(n); +} + +inline SwNodeOffset abs(const SwNodeOffset& a) { return a > SwNodeOffset(0) ? a : -a; } +inline SwNodeOffset min(const SwNodeOffset& a, const SwNodeOffset& b) { return a > b ? a : b; } + +constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32); + +SW_DLLPUBLIC std::ostream& operator<<(std::ostream& s, const SwNodeOffset& index); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index 7e64a4665a9f..7c45c59740d1 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -24,6 +24,7 @@ #include "index.hxx" #include "ndindex.hxx" #include "swdllapi.h" +#include "nodeoffset.hxx" #include <iostream> @@ -147,9 +148,9 @@ public: explicit SwPaM( const SwPosition& rPos, SwPaM* pRing = nullptr ); SwPaM( const SwPosition& rMk, const SwPosition& rPt, SwPaM* pRing = nullptr ); SwPaM( const SwNodeIndex& rMk, const SwNodeIndex& rPt, - tools::Long nMkOffset = 0, tools::Long nPtOffset = 0, SwPaM* pRing = nullptr ); + SwNodeOffset nMkOffset = SwNodeOffset(0), SwNodeOffset nPtOffset = SwNodeOffset(0), SwPaM* pRing = nullptr ); SwPaM( const SwNode& rMk, const SwNode& rPt, - tools::Long nMkOffset = 0, tools::Long nPtOffset = 0, SwPaM* pRing = nullptr ); + SwNodeOffset nMkOffset = SwNodeOffset(0), SwNodeOffset nPtOffset = SwNodeOffset(0), SwPaM* pRing = nullptr ); SwPaM( const SwNodeIndex& rMk, sal_Int32 nMkContent, const SwNodeIndex& rPt, sal_Int32 nPtContent, SwPaM* pRing = nullptr ); SwPaM( const SwNode& rMk, sal_Int32 nMkContent, diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx index 5b4f3319ca05..6bc06b60507c 100644 --- a/sw/inc/postithelper.hxx +++ b/sw/inc/postithelper.hxx @@ -25,6 +25,7 @@ #include <vcl/vclptr.hxx> #include <tools/solar.h> #include "SidebarWindowsTypes.hxx" +#include "nodeoffset.hxx" class SfxBroadcaster; class SwRootFrame; @@ -43,7 +44,7 @@ struct SwLayoutInfo SwRect mPosition; // optional start of the annotation - sal_uLong mnStartNodeIdx; + SwNodeOffset mnStartNodeIdx; sal_Int32 mnStartContent; SwRect mPageFrame; diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index 5a25a7d83aff..0c5b8408d54c 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -231,7 +231,7 @@ public: void ShowOriginal(sal_uInt16 nLoop, size_t nMyPos, bool bForced = false); /// Calculates the intersection with text node number nNdIdx. - void CalcStartEnd(sal_uLong nNdIdx, sal_Int32& rStart, sal_Int32& rEnd) const; + void CalcStartEnd(SwNodeOffset nNdIdx, sal_Int32& rStart, sal_Int32& rEnd) const; enum class Invalidation { Add, Remove }; /// Initiate the layout. diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index d1b015a772a8..1c82db956315 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -455,7 +455,7 @@ public: // Create new PaM at position. static std::shared_ptr<SwUnoCursor> NewUnoCursor(SwDoc & rDoc, - sal_uLong const nStartIdx, sal_uLong const nEndIdx); + SwNodeOffset const nStartIdx, SwNodeOffset const nEndIdx); // If applicable copy a local file into internet. bool CopyLocalFileToINet( OUString& rFileNm ); diff --git a/sw/inc/swbaslnk.hxx b/sw/inc/swbaslnk.hxx index 3604c15119d6..092994fbfc63 100644 --- a/sw/inc/swbaslnk.hxx +++ b/sw/inc/swbaslnk.hxx @@ -54,7 +54,7 @@ public: using SvBaseLink::SetObjType; bool IsRecursion( const SwBaseLink* pChkLnk ) const; - virtual bool IsInRange( sal_uLong nSttNd, sal_uLong nEndNd ) const; + virtual bool IsInRange( SwNodeOffset nSttNd, SwNodeOffset nEndNd ) const; void SetNoDataFlag() { m_bNoDataFlag = true; } bool ChkNoDataFlag() { const bool bRet = m_bNoDataFlag; m_bNoDataFlag = false; return bRet; } diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index cd2b4ac74ed7..f36e0167d5c3 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -241,7 +241,7 @@ public: // internal, used by SwCursor::SaveState() etc. struct SwCursor_SavePos final { - sal_uLong nNode; + SwNodeOffset nNode; sal_Int32 nContent; SwCursor_SavePos( const SwCursor& rCursor ) @@ -254,8 +254,8 @@ class SwTableCursor : public virtual SwCursor { protected: - sal_uLong m_nTablePtNd; - sal_uLong m_nTableMkNd; + SwNodeOffset m_nTablePtNd; + SwNodeOffset m_nTableMkNd; sal_Int32 m_nTablePtCnt; sal_Int32 m_nTableMkCnt; SwSelBoxes m_SelectedBoxes; diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 3347e04993e1..f358d348ab5f 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -27,6 +27,7 @@ #include "swrect.hxx" #include "swtblfmt.hxx" #include "docary.hxx" +#include "nodeoffset.hxx" #include <memory> #include <vector> @@ -291,8 +292,8 @@ public: void CopyHeadlineIntoTable( SwTableNode& rTableNd ); // Get box, whose start index is set on nBoxStt. - SwTableBox* GetTableBox( sal_uLong nSttIdx ); - const SwTableBox* GetTableBox( sal_uLong nSttIdx ) const + SwTableBox* GetTableBox( SwNodeOffset nSttIdx ); + const SwTableBox* GetTableBox( SwNodeOffset nSttIdx ) const { return const_cast<SwTable*>(this)->GetTableBox( nSttIdx ); } // Returns true if table contains nestings. @@ -456,7 +457,7 @@ public: void RemoveFromTable(); const SwStartNode *GetSttNd() const { return m_pStartNode; } - sal_uLong GetSttIdx() const; + SwNodeOffset GetSttIdx() const; // it doesn't contain box content bool IsEmpty() const; @@ -479,7 +480,7 @@ public: // Contains box contents, that can be formatted as a number? bool HasNumContent( double& rNum, sal_uInt32& rFormatIndex, bool& rIsEmptyTextNd ) const; - sal_uLong IsValidNumTextNd( bool bCheckAttr = true ) const; + SwNodeOffset IsValidNumTextNd( bool bCheckAttr = true ) const; // If a table formula is set, test if box contents is congruent with number. // (For Redo of change of NumFormat!). bool IsNumberChanged() const; diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx index 2e7ea18740a3..6cf772f7734d 100644 --- a/sw/inc/undobj.hxx +++ b/sw/inc/undobj.hxx @@ -26,6 +26,7 @@ #include <tools/solar.h> #include "SwRewriter.hxx" #include "swundo.hxx" +#include "nodeoffset.hxx" #include <o3tl/typed_flags_set.hxx> #include <optional> @@ -61,9 +62,9 @@ protected: bool m_bCacheComment; mutable std::optional<OUString> maComment; - static void RemoveIdxFromSection( SwDoc&, sal_uLong nSttIdx, const sal_uLong* pEndIdx = nullptr ); + static void RemoveIdxFromSection( SwDoc&, SwNodeOffset nSttIdx, const SwNodeOffset* pEndIdx = nullptr ); static void RemoveIdxFromRange( SwPaM& rPam, bool bMoveNext ); - static void RemoveIdxRel( sal_uLong, const SwPosition& ); + static void RemoveIdxRel( SwNodeOffset, const SwPosition& ); static bool CanRedlineGroup( SwRedlineSaveDatas& rCurr, const SwRedlineSaveDatas& rCheck, @@ -172,10 +173,10 @@ protected: // MoveFrom: moves from the UndoNodesArray into the NodesArray. static void MoveToUndoNds( SwPaM& rPam, SwNodeIndex* pNodeIdx, - sal_uLong* pEndNdIdx = nullptr ); - static void MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx, + SwNodeOffset* pEndNdIdx = nullptr ); + static void MoveFromUndoNds( SwDoc& rDoc, SwNodeOffset nNodeIdx, SwPosition& rInsPos, - const sal_uLong* pEndNdIdx = nullptr, + const SwNodeOffset* pEndNdIdx = nullptr, bool bForceCreateFrames = false); // These two methods move the SPoint back/forth from PaM. With it @@ -201,12 +202,12 @@ class SwUndoSaveSection : private SwUndoSaveContent { std::unique_ptr<SwNodeIndex> m_pMovedStart; std::unique_ptr<SwRedlineSaveDatas> m_pRedlineSaveData; - sal_uLong m_nMoveLen; // Index into UndoNodes-Array. - sal_uLong m_nStartPos; + SwNodeOffset m_nMoveLen; // Index into UndoNodes-Array. + SwNodeOffset m_nStartPos; protected: SwNodeIndex* GetMvSttIdx() const { return m_pMovedStart.get(); } - sal_uLong GetMvNodeCnt() const { return m_nMoveLen; } + SwNodeOffset GetMvNodeCnt() const { return m_nMoveLen; } public: SwUndoSaveSection(); @@ -227,7 +228,7 @@ public: class SwUndRng { public: - sal_uLong m_nSttNode, m_nEndNode; + SwNodeOffset m_nSttNode, m_nEndNode; sal_Int32 m_nSttContent, m_nEndContent; SwUndRng(); @@ -244,7 +245,7 @@ class SwUndoInsLayFormat; namespace sw { std::optional<std::vector<SwFrameFormat*>> -GetFlysAnchoredAt(SwDoc & rDoc, sal_uLong nSttNode); +GetFlysAnchoredAt(SwDoc & rDoc, SwNodeOffset nSttNode); } @@ -255,10 +256,10 @@ class SwUndoInserts : public SwUndo, public SwUndRng, private SwUndoSaveContent std::optional<std::vector<SwFrameFormat*>> m_pFrameFormats; std::vector< std::shared_ptr<SwUndoInsLayFormat> > m_FlyUndos; std::unique_ptr<SwRedlineData> m_pRedlineData; - int m_nDeleteTextNodes; + SwNodeOffset m_nDeleteTextNodes; protected: - sal_uLong m_nNodeDiff; + SwNodeOffset m_nNodeDiff; /// start of Content in UndoNodes for Redo std::unique_ptr<SwNodeIndex> m_pUndoNodeIndex; sal_uInt16 m_nSetPos; // Start in the history list. @@ -273,10 +274,10 @@ public: // Set destination range after reading. void SetInsertRange( const SwPaM&, bool bScanFlys = true, - int nDeleteTextNodes = 1); + SwNodeOffset nDeleteTextNodes = SwNodeOffset(1)); static bool IsCreateUndoForNewFly(SwFormatAnchor const& rAnchor, - sal_uLong const nStartNode, sal_uLong const nEndNode); + SwNodeOffset const nStartNode, SwNodeOffset const nEndNode); std::vector<SwFrameFormat*> * GetFlysAnchoredAt() { return m_pFrameFormats ? &*m_pFrameFormats : nullptr; } void dumpAsXml(xmlTextWriterPtr pWriter) const override; @@ -298,7 +299,7 @@ class SwUndoFlyBase : public SwUndo, private SwUndoSaveSection { protected: SwFrameFormat* m_pFrameFormat; // The saved FlyFormat. - sal_uLong m_nNodePagePos; + SwNodeOffset m_nNodePagePos; sal_Int32 m_nContentPos; // Page at/in paragraph. RndStdIds m_nRndId; bool m_bDelFormat; // Delete saved format. @@ -309,7 +310,7 @@ protected: SwUndoFlyBase( SwFrameFormat* pFormat, SwUndoId nUndoId ); SwNodeIndex* GetMvSttIdx() const { return SwUndoSaveSection::GetMvSttIdx(); } - sal_uLong GetMvNodeCnt() const { return SwUndoSaveSection::GetMvNodeCnt(); } + SwNodeOffset GetMvNodeCnt() const { return SwUndoSaveSection::GetMvNodeCnt(); } public: virtual ~SwUndoFlyBase() override; @@ -319,10 +320,10 @@ public: class SwUndoInsLayFormat final : public SwUndoFlyBase { - sal_uLong mnCursorSaveIndexPara; // Cursor position + SwNodeOffset mnCursorSaveIndexPara; // Cursor position sal_Int32 mnCursorSaveIndexPos; // for undo public: - SwUndoInsLayFormat( SwFrameFormat* pFormat, sal_uLong nNodeIdx, sal_Int32 nCntIdx ); + SwUndoInsLayFormat( SwFrameFormat* pFormat, SwNodeOffset nNodeIdx, sal_Int32 nCntIdx ); virtual ~SwUndoInsLayFormat() override; diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx index 174fb70486f2..5742f230c1c4 100644 --- a/sw/qa/core/frmedt/frmedt.cxx +++ b/sw/qa/core/frmedt/frmedt.cxx @@ -51,9 +51,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testTextboxReanchor) SwFrameFormat* pTextFrameFormat = FindFrameFormat(pTextFrameObj); CPPUNIT_ASSERT_EQUAL(OUString("Frame2"), pTextFrameFormat->GetName()); SwFrameFormat* pDrawShapeFormat = FindFrameFormat(pDrawShape); - sal_uLong nOldAnchor = pDrawShapeFormat->GetAnchor().GetContentAnchor()->nNode.GetIndex(); + SwNodeOffset nOldAnchor = pDrawShapeFormat->GetAnchor().GetContentAnchor()->nNode.GetIndex(); pShell->FindAnchorPos(pTextFrameObj->GetLastBoundRect().Center(), true); - sal_uLong nNewAnchor = pDrawShapeFormat->GetAnchor().GetContentAnchor()->nNode.GetIndex(); + SwNodeOffset nNewAnchor = pDrawShapeFormat->GetAnchor().GetContentAnchor()->nNode.GetIndex(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 6 // - Actual : 9 diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 4c839d061f0f..c43d068152b6 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1470,7 +1470,7 @@ void SwDocTest::testMarkMove() // cut some text { SwNodeIndex aIdx(m_pDoc->GetNodes().GetEndOfContent(), -1); - SwPaM aPaM(aIdx, aIdx, -1); + SwPaM aPaM(aIdx, aIdx, SwNodeOffset(-1)); aPaM.GetPoint()->nContent += 5; aPaM.GetMark()->nContent += 6; m_pDoc->getIDocumentContentOperations().DeleteAndJoin(aPaM); diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 761cfdf7d4b7..e38df1d0c479 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -198,7 +198,7 @@ void Test::testLinkedGraphicRT() // Find the image bool bImageFound = false; Graphic aGraphic; - for (sal_uLong nIndex = 0; nIndex < aNodes.Count(); ++nIndex) + for (SwNodeOffset nIndex(0); nIndex < aNodes.Count(); ++nIndex) { if (aNodes[nIndex]->IsGrfNode()) { @@ -1692,7 +1692,7 @@ void Test::testDateFormField() sal_Unicode vEnSpaces[ODF_FORMFIELD_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194}; CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString(vEnSpaces, 5), sCurrentDate); - CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_uLong(9), pFieldmark->GetMarkStart().nNode.GetIndex()); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), SwNodeOffset(9), pFieldmark->GetMarkStart().nNode.GetIndex()); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(5), pFieldmark->GetMarkStart().nContent.GetIndex()); } else if (nIndex == 1) // The second has the default format @@ -1701,7 +1701,7 @@ void Test::testDateFormField() CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString("en-US"), sLang); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString("06/12/19"), sCurrentDate); - CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_uLong(9), pFieldmark->GetMarkStart().nNode.GetIndex()); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), SwNodeOffset(9), pFieldmark->GetMarkStart().nNode.GetIndex()); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(20), pFieldmark->GetMarkStart().nContent.GetIndex()); } else if (nIndex == 2) // The third one has special format @@ -1710,7 +1710,7 @@ void Test::testDateFormField() CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString("hu-HU"), sLang); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString("2019. febr. 12."), sCurrentDate); - CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_uLong(9), pFieldmark->GetMarkStart().nNode.GetIndex()); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), SwNodeOffset(9), pFieldmark->GetMarkStart().nNode.GetIndex()); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(40), pFieldmark->GetMarkStart().nContent.GetIndex()); } @@ -1720,7 +1720,7 @@ void Test::testDateFormField() CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString("bm-ML"), sLang); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString("[select date]"), sCurrentDate); - CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_uLong(9), pFieldmark->GetMarkStart().nNode.GetIndex()); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), SwNodeOffset(9), pFieldmark->GetMarkStart().nNode.GetIndex()); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(62), pFieldmark->GetMarkStart().nContent.GetIndex()); } @@ -1730,7 +1730,7 @@ void Test::testDateFormField() CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString("en-US"), sLang); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString(""), sCurrentDate); - CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_uLong(9), pFieldmark->GetMarkStart().nNode.GetIndex()); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), SwNodeOffset(9), pFieldmark->GetMarkStart().nNode.GetIndex()); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(82), pFieldmark->GetMarkStart().nContent.GetIndex()); } diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx index 5490f5178319..86ad0a7b5cfd 100644 --- a/sw/qa/extras/htmlimport/htmlimport.cxx +++ b/sw/qa/extras/htmlimport/htmlimport.cxx @@ -78,7 +78,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImage) CPPUNIT_ASSERT(xGraphic.is()); CPPUNIT_ASSERT(xGraphic->getType() != graphic::GraphicType::EMPTY); - for (int n = 0; ; n++) + for (SwNodeOffset n(0); ; n++) { SwNode* pNode = pDoc->GetNodes()[ n ]; if (SwGrfNode *pGrfNode = pNode->GetGrfNode()) diff --git a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx index 586c07b1e534..69aeba0003af 100644 --- a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx +++ b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx @@ -63,7 +63,7 @@ void SearchResultLocatorTest::testSearchResultLocator() sw::search::SearchResultLocator aLocator(pDoc); std::vector<sw::search::SearchIndexData> aDataVector; - aDataVector.emplace_back(sw::search::NodeType::WriterNode, 14); + aDataVector.emplace_back(sw::search::NodeType::WriterNode, SwNodeOffset(14)); sw::search::LocationResult aResult = aLocator.find(aDataVector); CPPUNIT_ASSERT_EQUAL(size_t(1), aResult.maRectangles.size()); @@ -146,7 +146,7 @@ void SearchResultLocatorTest::testSearchResultLocatorForSdrObjects() sw::search::SearchResultLocator aLocator(pDoc); std::vector<sw::search::SearchIndexData> aDataVector; - aDataVector.emplace_back(sw::search::NodeType::CommonNode, 1, u"Circle"); + aDataVector.emplace_back(sw::search::NodeType::CommonNode, SwNodeOffset(1), u"Circle"); sw::search::LocationResult aResult = aLocator.find(aDataVector); CPPUNIT_ASSERT_EQUAL(size_t(1), aResult.maRectangles.size()); diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index de9cd406ee90..1b7ad51d71c2 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2735,7 +2735,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testBtlrCell) SwPosition aCellStart = *pWrtShell->GetCursor()->Start(); // Test that pressing "up" at the start of the cell goes to the next character position. - sal_uLong nNodeIndex = pWrtShell->GetCursor()->Start()->nNode.GetIndex(); + SwNodeOffset nNodeIndex = pWrtShell->GetCursor()->Start()->nNode.GetIndex(); sal_Int32 nIndex = pWrtShell->GetCursor()->Start()->nContent.GetIndex(); KeyEvent aKeyEvent(0, KEY_UP); SwEditWin& rEditWin = pShell->GetView()->GetEditWin(); @@ -3418,7 +3418,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128399) SwCursorMoveState aState(CursorMoveState::NONE); pLayout->GetModelPositionForViewPoint(&aPosition, aPoint, &aState); // Second row is +3: end node, start node and the first text node in the 2nd row. - sal_uLong nExpected = aFirstRow.nNode.GetIndex() + 3; + SwNodeOffset nExpected = aFirstRow.nNode.GetIndex() + 3; // Without the accompanying fix in place, this test would have failed with: // - Expected: 14 diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx index e1d1ed0aa248..e1fee48d74da 100644 --- a/sw/qa/extras/mailmerge/mailmerge.cxx +++ b/sw/qa/extras/mailmerge/mailmerge.cxx @@ -554,13 +554,13 @@ DECLARE_SHELL_MAILMERGE_TEST(testTdf92623, "tdf92623.odt", "10-testing-addresses // and it's a TEXT_FIELDMARK CPPUNIT_ASSERT_EQUAL( sal_Int32(IDocumentMarkAccess::MarkType::TEXT_FIELDMARK), sal_Int32(IDocumentMarkAccess::GetType( **mark )) ); - sal_uLong src_pos = (*mark)->GetMarkPos().nNode.GetIndex(); + SwNodeOffset src_pos = (*mark)->GetMarkPos().nNode.GetIndex(); // Get the size of the document in nodes SwDoc *doc = pTextDoc->GetDocShell()->GetDoc(); - sal_uLong size = doc->GetNodes().GetEndOfContent().GetIndex() - doc->GetNodes().GetEndOfExtras().GetIndex(); - CPPUNIT_ASSERT_EQUAL( sal_uLong(13), size ); - size -= 2; // For common start and end nodes + SwNodeOffset size = doc->GetNodes().GetEndOfContent().GetIndex() - doc->GetNodes().GetEndOfExtras().GetIndex(); + CPPUNIT_ASSERT_EQUAL( SwNodeOffset(13), size ); + size -= SwNodeOffset(2); // For common start and end nodes // Iterate over all field marks in the target document and check that they // are positioned at a multitude of the document size @@ -571,15 +571,15 @@ DECLARE_SHELL_MAILMERGE_TEST(testTdf92623, "tdf92623.odt", "10-testing-addresses // as the helping uno bookmark from the mail merge is left in the doc // TODO should be fixed! CPPUNIT_ASSERT_EQUAL(sal_Int32(20), pIDMA->getAllMarksCount()); - std::set<sal_uLong> pages; + std::set<SwNodeOffset> pages; sal_Int32 countFieldMarks = 0; for( mark = pIDMA->getAllMarksBegin(); mark != pIDMA->getAllMarksEnd(); ++mark ) { IDocumentMarkAccess::MarkType markType = IDocumentMarkAccess::GetType( **mark ); if( markType == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK ) { - sal_uLong pos = (*mark)->GetMarkPos().nNode.GetIndex() - src_pos; - CPPUNIT_ASSERT_EQUAL(sal_uLong(0), pos % size); + SwNodeOffset pos = (*mark)->GetMarkPos().nNode.GetIndex() - src_pos; + CPPUNIT_ASSERT_EQUAL(SwNodeOffset(0), pos % size); CPPUNIT_ASSERT(pages.insert(pos).second); countFieldMarks++; } @@ -644,17 +644,17 @@ DECLARE_SHELL_MAILMERGE_TEST(test_sections_first_last, "sections_first_last.odt" // Get the size of the document in nodes SwDoc *pDoc = pTextDoc->GetDocShell()->GetDoc(); - sal_uLong nSize = pDoc->GetNodes().GetEndOfContent().GetIndex() - pDoc->GetNodes().GetEndOfExtras().GetIndex(); - nSize -= 2; // The common start and end node - CPPUNIT_ASSERT_EQUAL( sal_uLong(13), nSize ); + SwNodeOffset nSize = pDoc->GetNodes().GetEndOfContent().GetIndex() - pDoc->GetNodes().GetEndOfExtras().GetIndex(); + nSize -= SwNodeOffset(2); // The common start and end node + CPPUNIT_ASSERT_EQUAL( SwNodeOffset(13), nSize ); SwXTextDocument* pTextDocMM = dynamic_cast<SwXTextDocument *>(mxMMComponent.get()); CPPUNIT_ASSERT(pTextDocMM); SwDoc *pDocMM = pTextDocMM->GetDocShell()->GetDoc(); - sal_uLong nSizeMM = pDocMM->GetNodes().GetEndOfContent().GetIndex() - pDocMM->GetNodes().GetEndOfExtras().GetIndex(); - nSizeMM -= 2; - CPPUNIT_ASSERT_EQUAL( sal_uLong(10 * nSize), nSizeMM ); + SwNodeOffset nSizeMM = pDocMM->GetNodes().GetEndOfContent().GetIndex() - pDocMM->GetNodes().GetEndOfExtras().GetIndex(); + nSizeMM -= SwNodeOffset(2); + CPPUNIT_ASSERT_EQUAL( SwNodeOffset(10) * nSize, nSizeMM ); CPPUNIT_ASSERT_EQUAL( sal_uInt16(19), pDocMM->GetDocShell()->GetWrtShell()->GetPhyPageNum() ); @@ -950,7 +950,7 @@ DECLARE_SHELL_MAILMERGE_TEST(testTdf62364, "tdf62364.odt", "10-testing-addresses { for (int nodeIndex = 0; nodeIndex<4; nodeIndex++) { - SwNode* aNode = rNodes[9 + pageIndex * 4 + nodeIndex]; + SwNode* aNode = rNodes[SwNodeOffset(9 + pageIndex * 4 + nodeIndex)]; CPPUNIT_ASSERT_EQUAL(true, aNode->IsTextNode()); const SwTextNode* pTextNode = aNode->GetTextNode(); @@ -974,7 +974,7 @@ DECLARE_SHELL_MAILMERGE_TEST(tdf125522_shell, "tdf125522.odt", "10-testing-addre CPPUNIT_ASSERT(pTextDoc); const auto & rNodes = pTextDoc->GetDocShell()->GetDoc()->GetNodes(); - for (sal_uLong nodeIndex = 0; nodeIndex<rNodes.Count(); nodeIndex++) + for (SwNodeOffset nodeIndex(0); nodeIndex<rNodes.Count(); nodeIndex++) { SwNode* aNode = rNodes[nodeIndex]; if (aNode->StartOfSectionNode()) @@ -1110,9 +1110,9 @@ DECLARE_SHELL_MAILMERGE_TEST(testTdf121168, "section_ps.odt", "4_v01.ods", "Tabe CPPUNIT_ASSERT_EQUAL(sal_uInt16(7), pTextDoc->GetDocShell()->GetWrtShell()->GetPhyPageNum()); SwDoc* pDocMM = pTextDoc->GetDocShell()->GetDoc(); - sal_uLong nSizeMM = pDocMM->GetNodes().GetEndOfContent().GetIndex() + SwNodeOffset nSizeMM = pDocMM->GetNodes().GetEndOfContent().GetIndex() - pDocMM->GetNodes().GetEndOfExtras().GetIndex() - 2; - CPPUNIT_ASSERT_EQUAL(sal_uLong(16), nSizeMM); + CPPUNIT_ASSERT_EQUAL(SwNodeOffset(16), nSizeMM); // All even pages should be empty, all sub-documents have one page const SwRootFrame* pLayout = pDocMM->getIDocumentLayoutAccess().GetCurrentLayout(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 1eeb60366093..484c5a71b639 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -1050,7 +1050,7 @@ DECLARE_OOXMLEXPORT_TEST(testInvalidDateFormField, "invalid_date_form_field.docx CPPUNIT_ASSERT_EQUAL(OUString("en-US"), sLang); CPPUNIT_ASSERT_EQUAL(OUString(""), sCurrentDate); - CPPUNIT_ASSERT_EQUAL(sal_uLong(9), pFieldmark->GetMarkStart().nNode.GetIndex()); + CPPUNIT_ASSERT_EQUAL(SwNodeOffset(9), pFieldmark->GetMarkStart().nNode.GetIndex()); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), pFieldmark->GetMarkStart().nContent.GetIndex()); } else if (nIndex == 1) // The second has wrong date @@ -1059,7 +1059,7 @@ DECLARE_OOXMLEXPORT_TEST(testInvalidDateFormField, "invalid_date_form_field.docx CPPUNIT_ASSERT_EQUAL(OUString("en-US"), sLang); CPPUNIT_ASSERT_EQUAL(OUString("2019.06.34"), sCurrentDate); - CPPUNIT_ASSERT_EQUAL(sal_uLong(9), pFieldmark->GetMarkStart().nNode.GetIndex()); + CPPUNIT_ASSERT_EQUAL(SwNodeOffset(9), pFieldmark->GetMarkStart().nNode.GetIndex()); CPPUNIT_ASSERT_EQUAL(sal_Int32(15), pFieldmark->GetMarkStart().nContent.GetIndex()); } else // The third one has wrong local @@ -1068,7 +1068,7 @@ DECLARE_OOXMLEXPORT_TEST(testInvalidDateFormField, "invalid_date_form_field.docx CPPUNIT_ASSERT_EQUAL(OUString("xxxx"), sLang); CPPUNIT_ASSERT_EQUAL(OUString("2019.06.11"), sCurrentDate); - CPPUNIT_ASSERT_EQUAL(sal_uLong(9), pFieldmark->GetMarkStart().nNode.GetIndex()); + CPPUNIT_ASSERT_EQUAL(SwNodeOffset(9), pFieldmark->GetMarkStart().nNode.GetIndex()); CPPUNIT_ASSERT_EQUAL(sal_Int32(35), pFieldmark->GetMarkStart().nContent.GetIndex()); } ++nIndex; diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 7cb2f5cdb5ff..66dda7f8500c 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -113,10 +113,12 @@ DECLARE_RTFEXPORT_TEST(testAnchoredAtSamePosition, "anchor.fodt") sal_Int32 const nIndex(mbExported ? 4 : 3); CPPUNIT_ASSERT_EQUAL(RndStdIds::FLY_AT_CHAR, rFlys[0]->GetAnchor().GetAnchorId()); - CPPUNIT_ASSERT_EQUAL(sal_uLong(12), rFlys[0]->GetAnchor().GetContentAnchor()->nNode.GetIndex()); + CPPUNIT_ASSERT_EQUAL(SwNodeOffset(12), + rFlys[0]->GetAnchor().GetContentAnchor()->nNode.GetIndex()); CPPUNIT_ASSERT_EQUAL(nIndex, rFlys[0]->GetAnchor().GetContentAnchor()->nContent.GetIndex()); CPPUNIT_ASSERT_EQUAL(RndStdIds::FLY_AT_CHAR, rFlys[1]->GetAnchor().GetAnchorId()); - CPPUNIT_ASSERT_EQUAL(sal_uLong(12), rFlys[1]->GetAnchor().GetContentAnchor()->nNode.GetIndex()); + CPPUNIT_ASSERT_EQUAL(SwNodeOffset(12), + rFlys[1]->GetAnchor().GetContentAnchor()->nNode.GetIndex()); CPPUNIT_ASSERT_EQUAL(nIndex, rFlys[1]->GetAnchor().GetContentAnchor()->nContent.GetIndex()); } diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 9eaca7d123a7..3080b0bfd3f2 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -620,12 +620,12 @@ void SwTiledRenderingTest::testSearch() SwXTextDocument* pXTextDocument = createDoc("search.odt"); SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); pWrtShell->GetSfxViewShell()->setLibreOfficeKitViewCallback(this); - std::size_t nNode = pWrtShell->getShellCursor(false)->Start()->nNode.GetNode().GetIndex(); + SwNodeOffset nNode = pWrtShell->getShellCursor(false)->Start()->nNode.GetNode().GetIndex(); // First hit, in the second paragraph, before the shape. lcl_search(false); CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject()); - std::size_t nActual = pWrtShell->getShellCursor(false)->Start()->nNode.GetNode().GetIndex(); + SwNodeOffset nActual = pWrtShell->getShellCursor(false)->Start()->nNode.GetNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual); /// Make sure we get search result selection for normal find as well, not only find all. CPPUNIT_ASSERT(!m_aSearchResultSelection.empty()); diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index dbcb8edd3e1c..f155485eebd2 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -801,7 +801,7 @@ void SwUiWriterTest::testImportRTF() CPPUNIT_ASSERT(pRTFReader != nullptr); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, aReader.Read(*pRTFReader)); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(OUString("fooHello world!"), pDoc->GetNodes()[nIndex - 1]->GetTextNode()->GetText()); CPPUNIT_ASSERT_EQUAL(OUString("bar"), pDoc->GetNodes()[nIndex]->GetTextNode()->GetText()); } @@ -1150,13 +1150,13 @@ void SwUiWriterTest::testCp1000071() const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); CPPUNIT_ASSERT_EQUAL( SwRedlineTable::size_type( 2 ), rTable.size()); - sal_uLong redlineStart0NodeIndex = rTable[ 0 ]->Start()->nNode.GetIndex(); + SwNodeOffset redlineStart0NodeIndex = rTable[ 0 ]->Start()->nNode.GetIndex(); sal_Int32 redlineStart0Index = rTable[ 0 ]->Start()->nContent.GetIndex(); - sal_uLong redlineEnd0NodeIndex = rTable[ 0 ]->End()->nNode.GetIndex(); + SwNodeOffset redlineEnd0NodeIndex = rTable[ 0 ]->End()->nNode.GetIndex(); sal_Int32 redlineEnd0Index = rTable[ 0 ]->End()->nContent.GetIndex(); - sal_uLong redlineStart1NodeIndex = rTable[ 1 ]->Start()->nNode.GetIndex(); + SwNodeOffset redlineStart1NodeIndex = rTable[ 1 ]->Start()->nNode.GetIndex(); sal_Int32 redlineStart1Index = rTable[ 1 ]->Start()->nContent.GetIndex(); - sal_uLong redlineEnd1NodeIndex = rTable[ 1 ]->End()->nNode.GetIndex(); + SwNodeOffset redlineEnd1NodeIndex = rTable[ 1 ]->End()->nNode.GetIndex(); sal_Int32 redlineEnd1Index = rTable[ 1 ]->End()->nContent.GetIndex(); // Change the document layout to be 2 columns, and then undo. @@ -1397,7 +1397,7 @@ void SwUiWriterTest::testAutoCorr() //Normal AutoCorrect pWrtShell->Insert("tset"); pWrtShell->AutoCorrect(corr, cIns); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(OUString("Test "), static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); //AutoCorrect with change style to bolt @@ -1442,7 +1442,7 @@ void SwUiWriterTest::testTdf83260() rUndoManager.Undo(); } // check that every text node has a layout frame - for (sal_uLong i = 0; i < pDoc->GetNodes().Count(); ++i) + for (SwNodeOffset i(0); i < pDoc->GetNodes().Count(); ++i) { if (SwTextNode const*const pNode = pDoc->GetNodes()[i]->GetTextNode()) { @@ -1453,7 +1453,7 @@ void SwUiWriterTest::testTdf83260() { rUndoManager.Redo(); } - for (sal_uLong i = 0; i < pDoc->GetNodes().Count(); ++i) + for (SwNodeOffset i(0); i < pDoc->GetNodes().Count(); ++i) { if (SwTextNode const*const pNode = pDoc->GetNodes()[i]->GetTextNode()) { @@ -1464,7 +1464,7 @@ void SwUiWriterTest::testTdf83260() { rUndoManager.Undo(); } - for (sal_uLong i = 0; i < pDoc->GetNodes().Count(); ++i) + for (SwNodeOffset i(0); i < pDoc->GetNodes().Count(); ++i) { if (SwTextNode const*const pNode = pDoc->GetNodes()[i]->GetTextNode()) { @@ -3213,7 +3213,7 @@ void SwUiWriterTest::testTdf74363() const sal_Unicode cChar = ' '; pWrtShell->AutoCorrect(corr, cChar); //The word should be capitalized due to autocorrect - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(OUString("Testing "), static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); } @@ -3470,13 +3470,13 @@ void SwUiWriterTest::testTdf75137() SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwShellCursor* pShellCursor = pWrtShell->getShellCursor(true); pWrtShell->InsertFootnote("This is first footnote"); - sal_uLong firstIndex = pShellCursor->GetNode().GetIndex(); + SwNodeOffset firstIndex = pShellCursor->GetNode().GetIndex(); pShellCursor->GotoFootnoteAnchor(); pWrtShell->InsertFootnote("This is second footnote"); pWrtShell->Up(false); - sal_uLong secondIndex = pShellCursor->GetNode().GetIndex(); + SwNodeOffset secondIndex = pShellCursor->GetNode().GetIndex(); pWrtShell->Down(false); - sal_uLong thirdIndex = pShellCursor->GetNode().GetIndex(); + SwNodeOffset thirdIndex = pShellCursor->GetNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(firstIndex, thirdIndex); CPPUNIT_ASSERT(firstIndex != secondIndex); } diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index dc7d8b8ecf8e..e64abd60658a 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -576,7 +576,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136453) SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf136453.fodt"); SwWrtShell* const pWrtShell(pDoc->GetDocShell()->GetWrtShell()); - sal_uLong const nNodes(pDoc->GetNodes().Count()); + SwNodeOffset const nNodes(pDoc->GetNodes().Count()); pWrtShell->SttEndDoc(false); pWrtShell->SetMark(); @@ -1486,8 +1486,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf108687_tabstop) { SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf108687_tabstop.odt"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - sal_Int32 nStartIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); - CPPUNIT_ASSERT_EQUAL(sal_Int32(9), nStartIndex); + SwNodeOffset nStartIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + CPPUNIT_ASSERT_EQUAL(SwNodeOffset(9), nStartIndex); // Now pressing 'tab' should jump to the radio buttons. SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get()); @@ -4064,7 +4064,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testShapePageMove) CPPUNIT_ASSERT(pBodyFrame->IsLayoutFrame()); SwFrame* pTextFrame = static_cast<SwLayoutFrame*>(pBodyFrame)->GetLower(); CPPUNIT_ASSERT(pTextFrame->IsTextFrame()); - sal_uLong nNodeIndex = static_cast<SwTextFrame*>(pTextFrame)->GetTextNodeFirst()->GetIndex(); + SwNodeOffset nNodeIndex = static_cast<SwTextFrame*>(pTextFrame)->GetTextNodeFirst()->GetIndex(); // Without the accompanying fix in place, this test would have failed with "Expected: 13; // Actual: 12", i.e. the shape was anchored to the last paragraph of the 1st page, not to a @@ -4906,7 +4906,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf143904) SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {}); pWrtShell->Down(false); @@ -4929,7 +4929,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf90069) SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {}); pWrtShell->Down(false); @@ -4952,7 +4952,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109266) SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); SwTextNode* pTextNode = static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex]); CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsum..."), pTextNode->GetText()); diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 94e12529847d..4f8740cf9101 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -2113,14 +2113,13 @@ void SwUiWriterTest4::testLinesMoveBackwardsInSectionInTable() SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "lines-in-section-in-table.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 2); - sal_uInt32 nPara4Node - = getXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell[1]/section/txt[last()]", - "txtNodeIndex") - .toUInt32(); + SwNodeOffset nPara4Node( + getXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell[1]/section/txt[last()]", "txtNodeIndex") + .toUInt32()); CPPUNIT_ASSERT_EQUAL(OUString("4"), pDoc->GetNodes()[nPara4Node]->GetTextNode()->GetText()); - sal_uInt32 nPara5Node - = getXPath(pXmlDoc, "/root/page[2]/body/tab/row/cell[1]/section/txt[1]", "txtNodeIndex") - .toUInt32(); + SwNodeOffset nPara5Node( + getXPath(pXmlDoc, "/root/page[2]/body/tab/row/cell[1]/section/txt[1]", "txtNodeIndex") + .toUInt32()); CPPUNIT_ASSERT_EQUAL(OUString("5"), pDoc->GetNodes()[nPara5Node]->GetTextNode()->GetText()); // Remove paragraph "4". @@ -2134,10 +2133,9 @@ void SwUiWriterTest4::testLinesMoveBackwardsInSectionInTable() // Assert that paragraph "5" is now moved back to page 1 and is the last paragraph there. discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - sal_uInt32 nPage1LastNode - = getXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell[1]/section/txt[last()]", - "txtNodeIndex") - .toUInt32(); + SwNodeOffset nPage1LastNode( + getXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell[1]/section/txt[last()]", "txtNodeIndex") + .toUInt32()); // This was "3", paragraph "4" was deleted, but "5" was not moved backwards from page 2. CPPUNIT_ASSERT_EQUAL(OUString("5"), pDoc->GetNodes()[nPage1LastNode]->GetTextNode()->GetText()); #endif @@ -2266,15 +2264,15 @@ void SwUiWriterTest4::testTdf113686() SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf113686.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 2); - sal_uInt32 nPage1LastNode - = getXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell[1]/tab/row/cell[1]/txt[last()]", - "txtNodeIndex") - .toUInt32(); + SwNodeOffset nPage1LastNode( + getXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell[1]/tab/row/cell[1]/txt[last()]", + "txtNodeIndex") + .toUInt32()); CPPUNIT_ASSERT_EQUAL(OUString("Table2:A1-P10"), pDoc->GetNodes()[nPage1LastNode]->GetTextNode()->GetText()); - sal_uInt32 nPage2FirstNode - = getXPath(pXmlDoc, "/root/page[2]/body/tab/row/cell[1]/section/txt[1]", "txtNodeIndex") - .toUInt32(); + SwNodeOffset nPage2FirstNode( + getXPath(pXmlDoc, "/root/page[2]/body/tab/row/cell[1]/section/txt[1]", "txtNodeIndex") + .toUInt32()); CPPUNIT_ASSERT_EQUAL(OUString("Table1:A1"), pDoc->GetNodes()[nPage2FirstNode]->GetTextNode()->GetText()); @@ -2379,17 +2377,16 @@ void SwUiWriterTest4::testSectionInTableInTable4() SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf113520.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 3); - sal_uInt32 nPage1LastNode - = getXPath(pXmlDoc, - "/root/page[1]/body/tab/row/cell[1]/tab/row/cell[1]/section/txt[last()]", - "txtNodeIndex") - .toUInt32(); + SwNodeOffset nPage1LastNode( + getXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell[1]/tab/row/cell[1]/section/txt[last()]", + "txtNodeIndex") + .toUInt32()); CPPUNIT_ASSERT_EQUAL(OUString("Section1:P10"), pDoc->GetNodes()[nPage1LastNode]->GetTextNode()->GetText()); - sal_uInt32 nPage3FirstNode - = getXPath(pXmlDoc, "/root/page[3]/body/tab/row/cell[1]/tab/row/cell[1]/section/txt[1]", - "txtNodeIndex") - .toUInt32(); + SwNodeOffset nPage3FirstNode( + getXPath(pXmlDoc, "/root/page[3]/body/tab/row/cell[1]/tab/row/cell[1]/section/txt[1]", + "txtNodeIndex") + .toUInt32()); CPPUNIT_ASSERT_EQUAL(OUString("Section1:P23"), pDoc->GetNodes()[nPage3FirstNode]->GetTextNode()->GetText()); @@ -2425,10 +2422,10 @@ void SwUiWriterTest4::testTdf112160() // Assert that the A2 cell is on page 1. SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf112160.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_uInt32 nA2CellNode - = getXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/section/txt[last()]", - "txtNodeIndex") - .toUInt32(); + SwNodeOffset nA2CellNode(getXPath(pXmlDoc, + "/root/page[1]/body/tab/row[2]/cell[1]/section/txt[last()]", + "txtNodeIndex") + .toUInt32()); CPPUNIT_ASSERT_EQUAL(OUString("Table1.A2"), pDoc->GetNodes()[nA2CellNode]->GetTextNode()->GetText()); @@ -2448,7 +2445,7 @@ void SwUiWriterTest4::testTdf112160() .toUInt32(); // This was Table1.C2, Table1.D2 was moved to the next page, unexpected. CPPUNIT_ASSERT_EQUAL(OUString("Table1.D2"), - pDoc->GetNodes()[nD2CellNode]->GetTextNode()->GetText()); + pDoc->GetNodes()[SwNodeOffset(nD2CellNode)]->GetTextNode()->GetText()); #endif } @@ -2888,7 +2885,7 @@ void SwUiWriterTest4::testTdf51223() SwDoc* pDoc = createSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); pWrtShell->Insert("i"); pWrtShell->SplitNode(true); CPPUNIT_ASSERT_EQUAL(OUString("I"), @@ -3186,7 +3183,7 @@ void SwUiWriterTest4::testRedlineAutoCorrect() SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); pWrtShell->AutoCorrect(corr, ' '); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); // tdf#83419 This was "Ts " removing the deletion of "t" silently by sentence capitalization OUString sReplaced("ts "); @@ -3264,7 +3261,7 @@ void SwUiWriterTest4::testRedlineAutoCorrect2() SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); pWrtShell->Insert("..."); pWrtShell->AutoCorrect(corr, ' '); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); // This was "LoremLorem,…," (duplicating the deleted comma, but without deletion) // Don't replace, if a redline starts or ends within the text. @@ -3292,7 +3289,7 @@ void SwUiWriterTest4::testEmojiAutoCorrect() SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); pWrtShell->Insert(":snowman"); pWrtShell->AutoCorrect(corr, ':'); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); OUString sReplaced = u"☃Lorem,"; nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); @@ -3323,7 +3320,7 @@ void SwUiWriterTest4::testTdf108423() const sal_Unicode cChar = '\''; pWrtShell->AutoCorrect(corr, cChar); // The word "i" should be capitalized due to autocorrect, followed by a typographical apostrophe - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); OUString sIApostrophe(u"I\u2019"); CPPUNIT_ASSERT_EQUAL(sIApostrophe, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); @@ -3342,7 +3339,7 @@ void SwUiWriterTest4::testTdf106164() pWrtShell->Insert(u"we\u2019re"); const sal_Unicode cChar = ' '; pWrtShell->AutoCorrect(corr, cChar); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(OUString(u"We\u2019re "), static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); } @@ -3356,7 +3353,7 @@ void SwUiWriterTest4::testTdf54409() pWrtShell->Insert(u"\u201Ctset"); const sal_Unicode cChar = ' '; pWrtShell->AutoCorrect(corr, cChar); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); OUString sReplaced(u"\u201Ctest "); CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); // testing autocorrect of test" -> test" with typographical double quotation mark U+201D @@ -3380,7 +3377,7 @@ void SwUiWriterTest4::testTdf38394() pWrtShell->Insert(u"l\u2019"); const sal_Unicode cChar = '"'; pWrtShell->AutoCorrect(corr, cChar); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); OUString sReplaced(u"l\u2019« "); CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); // tdf#132301 autocorrect of qu'« @@ -3399,7 +3396,7 @@ void SwUiWriterTest4::testTdf59666() pWrtShell->Insert(u"\u03C0"); const sal_Unicode cChar = ' '; pWrtShell->AutoCorrect(corr, cChar); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(OUString(u"\u03C0 "), static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); } @@ -3414,7 +3411,7 @@ void SwUiWriterTest4::testTdf133524() // >> pWrtShell->Insert(u">"); pWrtShell->AutoCorrect(corr, '>'); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); OUString sReplaced(u"»"); CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); // << @@ -3465,7 +3462,7 @@ void SwUiWriterTest4::testTdf133524_Romanian() // Example: „Sentence and «word».” // opening primary level quote pWrtShell->AutoCorrect(corr, '"'); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); OUString sReplaced(u"„"); CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); // opening second level quote @@ -3503,7 +3500,7 @@ void SwUiWriterTest4::testTdf128860() SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); pWrtShell->Insert(u"‚word"); pWrtShell->AutoCorrect(corr, '\''); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); OUString sReplaced(u"‚word‘"); CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); // Us apostrophe without preceding starting quote: word' -> word’ @@ -3526,7 +3523,7 @@ void SwUiWriterTest4::testTdf123786() SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); pWrtShell->Insert(u"„слово"); pWrtShell->AutoCorrect(corr, '\''); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); OUString sReplaced(u"„слово“"); CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); // Us apostrophe without preceding starting quote: word' -> word’ @@ -3550,7 +3547,7 @@ void SwUiWriterTest4::testTdf133589() SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); pWrtShell->Insert(u"székely"); pWrtShell->AutoCorrect(corr, ' '); - sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); OUString sReplaced(u"𐳥𐳋𐳓𐳉𐳗 "); CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); // disambiguate consonants: asszony -> asz|szony diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 94f2c1753793..07341ff7e15e 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -1381,7 +1381,7 @@ DECLARE_WW8EXPORT_TEST(testRES_MIRROR_GRAPH_BOTH, "tdf56321_flipImage_both.doc") SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); CPPUNIT_ASSERT(pDoc); - for (int n = 0; ; n++) + for (SwNodeOffset n(0); ; n++) { SwNode* pNode = pDoc->GetNodes()[ n ]; if (SwGrfNode *pGrfNode = pNode->GetGrfNode()) diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 0a585dc5e43b..7eb0c9f6b221 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -113,7 +113,7 @@ CPPUNIT_TEST_FIXTURE(Test, testImageLazyRead0size) // bitmap. SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - SwNode* pNode = pDoc->GetNodes()[6]; + SwNode* pNode = pDoc->GetNodes()[SwNodeOffset(6)]; SwGrfNode* pGrfNode = pNode->GetGrfNode(); CPPUNIT_ASSERT(pGrfNode); // Without the accompanying fix in place, this test would have failed with: @@ -198,7 +198,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf125281) // Load a .doc file which has an embedded .emf image. SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - SwNode* pNode = pDoc->GetNodes()[6]; + SwNode* pNode = pDoc->GetNodes()[SwNodeOffset(6)]; CPPUNIT_ASSERT(pNode->IsGrfNode()); SwGrfNode* pGrfNode = pNode->GetGrfNode(); const Graphic& rGraphic = pGrfNode->GetGrf(); diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index 071b2baf06c1..03162a0a33ad 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -936,7 +936,7 @@ void AccessibilityCheck::check() auto const& pNodes = m_pDoc->GetNodes(); SwNode* pNode = nullptr; - for (sal_uLong n = 0; n < pNodes.Count(); ++n) + for (SwNodeOffset n(0); n < pNodes.Count(); ++n) { pNode = pNodes[n]; if (pNode) diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx index d2c7aac44a9e..d2d3217c9297 100644 --- a/sw/source/core/access/accframebase.cxx +++ b/sw/source/core/access/accframebase.cxx @@ -295,7 +295,7 @@ bool SwAccessibleFrameBase::GetSelectedState( ) if( pCursor != nullptr ) { const SwTextNode* pNode = pPos->nNode.GetNode().GetTextNode(); - sal_uLong nHere = pNode->GetIndex(); + SwNodeOffset nHere = pNode->GetIndex(); // iterate over ring SwPaM* pRingStart = pCursor; @@ -306,9 +306,9 @@ bool SwAccessibleFrameBase::GetSelectedState( ) { // check whether nHere is 'inside' pCursor SwPosition* pStart = pCursor->Start(); - sal_uLong nStartIndex = pStart->nNode.GetIndex(); + SwNodeOffset nStartIndex = pStart->nNode.GetIndex(); SwPosition* pEnd = pCursor->End(); - sal_uLong nEndIndex = pEnd->nNode.GetIndex(); + SwNodeOffset nEndIndex = pEnd->nNode.GetIndex(); if( ( nHere >= nStartIndex ) && (nHere <= nEndIndex) ) { if( rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR ) diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index c1c4eebcfb2e..62a5f61c5c2b 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1229,8 +1229,8 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() { const SwTextNode* pNode = pPos->nNode.GetNode().GetTextNode(); SwTextFrame const*const pFrame(static_cast<SwTextFrame*>(pNode->getLayoutFrame(pVSh->GetLayout()))); - sal_uLong nFirstNode(pFrame->GetTextNodeFirst()->GetIndex()); - sal_uLong nLastNode; + SwNodeOffset nFirstNode(pFrame->GetTextNodeFirst()->GetIndex()); + SwNodeOffset nLastNode; if (sw::MergedPara const*const pMerged = pFrame->GetMergedPara()) { nLastNode = pMerged->pLastNode->GetIndex(); @@ -1240,7 +1240,7 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() nLastNode = nFirstNode; } - sal_uLong nHere = pNode->GetIndex(); + SwNodeOffset nHere = pNode->GetIndex(); for(SwPaM& rTmpCursor : pCursor->GetRingContainer()) { @@ -1250,9 +1250,9 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() bMarked = true; // check whether nHere is 'inside' pCursor SwPosition* pStart = rTmpCursor.Start(); - sal_uLong nStartIndex = pStart->nNode.GetIndex(); + SwNodeOffset nStartIndex = pStart->nNode.GetIndex(); SwPosition* pEnd = rTmpCursor.End(); - sal_uLong nEndIndex = pEnd->nNode.GetIndex(); + SwNodeOffset nEndIndex = pEnd->nNode.GetIndex(); if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex)) { if( rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR ) diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 6be041d8c585..9ac2fa8bfc89 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -2968,8 +2968,8 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getSelectedPortionCount( ) { // get SwPosition for my node SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(GetFrame())); - sal_uLong nFirstNode(pFrame->GetTextNodeFirst()->GetIndex()); - sal_uLong nLastNode; + SwNodeOffset nFirstNode(pFrame->GetTextNodeFirst()->GetIndex()); + SwNodeOffset nLastNode; if (sw::MergedPara const*const pMerged = pFrame->GetMergedPara()) { nLastNode = pMerged->pLastNode->GetIndex(); @@ -2987,9 +2987,9 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getSelectedPortionCount( ) { // check whether frame's node(s) are 'inside' pCursor SwPosition* pStart = rTmpCursor.Start(); - sal_uLong nStartIndex = pStart->nNode.GetIndex(); + SwNodeOffset nStartIndex = pStart->nNode.GetIndex(); SwPosition* pEnd = rTmpCursor.End(); - sal_uLong nEndIndex = pEnd->nNode.GetIndex(); + SwNodeOffset nEndIndex = pEnd->nNode.GetIndex(); if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex)) { nSelected++; @@ -3042,8 +3042,8 @@ sal_Bool SAL_CALL SwAccessibleParagraph::removeSelection( sal_Int32 selectionInd // get SwPosition for my node SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(GetFrame())); - sal_uLong nFirstNode(pFrame->GetTextNodeFirst()->GetIndex()); - sal_uLong nLastNode; + SwNodeOffset nFirstNode(pFrame->GetTextNodeFirst()->GetIndex()); + SwNodeOffset nLastNode; if (sw::MergedPara const*const pMerged = pFrame->GetMergedPara()) { nLastNode = pMerged->pLastNode->GetIndex(); @@ -3062,9 +3062,9 @@ sal_Bool SAL_CALL SwAccessibleParagraph::removeSelection( sal_Int32 selectionInd { // check whether frame's node(s) are 'inside' pCursor SwPosition* pStart = pCursor->Start(); - sal_uLong nStartIndex = pStart->nNode.GetIndex(); + SwNodeOffset nStartIndex = pStart->nNode.GetIndex(); SwPosition* pEnd = pCursor->End(); - sal_uLong nEndIndex = pEnd->nNode.GetIndex(); + SwNodeOffset nEndIndex = pEnd->nNode.GetIndex(); if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex)) { if( nSelected == 0 ) @@ -3348,8 +3348,8 @@ bool SwAccessibleParagraph::GetSelectionAtIndex( { // get SwPosition for my node SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(GetFrame())); - sal_uLong nFirstNode(pFrame->GetTextNodeFirst()->GetIndex()); - sal_uLong nLastNode; + SwNodeOffset nFirstNode(pFrame->GetTextNodeFirst()->GetIndex()); + SwNodeOffset nLastNode; if (sw::MergedPara const*const pMerged = pFrame->GetMergedPara()) { nLastNode = pMerged->pLastNode->GetIndex(); @@ -3367,9 +3367,9 @@ bool SwAccessibleParagraph::GetSelectionAtIndex( { // check whether frame's node(s) are 'inside' pCursor SwPosition* pStart = rTmpCursor.Start(); - sal_uLong nStartIndex = pStart->nNode.GetIndex(); + SwNodeOffset nStartIndex = pStart->nNode.GetIndex(); SwPosition* pEnd = rTmpCursor.End(); - sal_uLong nEndIndex = pEnd->nNode.GetIndex(); + SwNodeOffset nEndIndex = pEnd->nNode.GetIndex(); if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex)) { if (!pSelection || *pSelection == 0) diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx index 56288c840bbe..81685b777033 100644 --- a/sw/source/core/attr/hints.cxx +++ b/sw/source/core/attr/hints.cxx @@ -179,7 +179,7 @@ void SwFindNearestNode::CheckNode( const SwNode& rNd ) { if( &m_pNode->GetNodes() == &rNd.GetNodes() ) { - sal_uLong nIdx = rNd.GetIndex(); + SwNodeOffset nIdx = rNd.GetIndex(); if( nIdx < m_pNode->GetIndex() && ( !m_pFound || nIdx > m_pFound->GetIndex() ) && nIdx > rNd.GetNodes().GetEndOfExtras().GetIndex() ) diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx index 7fe9b5571a43..3fa1eaec186e 100644 --- a/sw/source/core/bastyp/index.cxx +++ b/sw/source/core/bastyp/index.cxx @@ -388,4 +388,9 @@ std::ostream& operator <<(std::ostream& s, const SwIndex& index) return s << "SwIndex offset (" << index.GetIndex() << ")"; } +std::ostream& operator <<(std::ostream& s, const SwNodeOffset& index) +{ + return s << sal_Int32(index); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx index 6e7863d7dc7d..2945b018bb8b 100644 --- a/sw/source/core/crsr/bookmark.cxx +++ b/sw/source/core/crsr/bookmark.cxx @@ -59,11 +59,11 @@ namespace sw::mark SwPosition const& rStartPos(rMark.GetMarkStart()); SwPosition const& rEndPos(rMark.GetMarkEnd()); SwNodes const& rNodes(rStartPos.nNode.GetNodes()); - sal_uLong const nStartNode(rStartPos.nNode.GetIndex()); - sal_uLong const nEndNode(rEndPos.nNode.GetIndex()); + SwNodeOffset const nStartNode(rStartPos.nNode.GetIndex()); + SwNodeOffset const nEndNode(rEndPos.nNode.GetIndex()); int nFields(0); std::optional<SwPosition> ret; - for (sal_uLong n = nEndNode; nStartNode <= n; --n) + for (SwNodeOffset n = nEndNode; nStartNode <= n; --n) { SwNode *const pNode(rNodes[n]); if (pNode->IsTextNode()) @@ -292,7 +292,7 @@ namespace sw::mark OUString MarkBase::ToString( ) const { return "Mark: ( Name, [ Node1, Index1 ] ): ( " + m_aName + ", [ " - + OUString::number( GetMarkPos().nNode.GetIndex( ) ) + ", " + + OUString::number( sal_Int32(GetMarkPos().nNode.GetIndex()) ) + ", " + OUString::number( GetMarkPos().nContent.GetIndex( ) ) + " ] )"; } @@ -513,9 +513,9 @@ namespace sw::mark OUString Fieldmark::ToString( ) const { return "Fieldmark: ( Name, Type, [ Nd1, Id1 ], [ Nd2, Id2 ] ): ( " + m_aName + ", " - + m_aFieldname + ", [ " + OUString::number( GetMarkPos().nNode.GetIndex( ) ) + + m_aFieldname + ", [ " + OUString::number( sal_Int32(GetMarkPos().nNode.GetIndex( )) ) + ", " + OUString::number( GetMarkPos( ).nContent.GetIndex( ) ) + " ], [" - + OUString::number( GetOtherMarkPos().nNode.GetIndex( ) ) + ", " + + OUString::number( sal_Int32(GetOtherMarkPos().nNode.GetIndex( )) ) + ", " + OUString::number( GetOtherMarkPos( ).nContent.GetIndex( ) ) + " ] ) "; } diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index 955622409af8..50a1fc99eec9 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -106,7 +106,7 @@ SwCallLink::~SwCallLink() COVERITY_NOEXCEPT_FALSE const SwDoc *pDoc=m_rShell.GetDoc(); const SwContentNode *pNode = nullptr; - if ( pDoc && m_nNode < pDoc->GetNodes( ).Count( ) ) + if ( pDoc && sal_Int32(m_nNode) < sal_Int32(pDoc->GetNodes( ).Count( )) ) { pNode = pDoc->GetNodes()[m_nNode]->GetContentNode(); } @@ -114,7 +114,7 @@ SwCallLink::~SwCallLink() COVERITY_NOEXCEPT_FALSE sal_Int32 nCmp, nCurrentContent = pCurrentCursor->GetPoint()->nContent.GetIndex(); SwNodeType nNdWhich = pCNd->GetNodeType(); - sal_uLong nCurrentNode = pCurrentCursor->GetPoint()->nNode.GetIndex(); + SwNodeOffset nCurrentNode = pCurrentCursor->GetPoint()->nNode.GetIndex(); // Register the Shell as dependent at the current Node. By doing this all // attribute changes can be signaled over the link. diff --git a/sw/source/core/crsr/callnk.hxx b/sw/source/core/crsr/callnk.hxx index e3875ddfa08b..ccac918e51ca 100644 --- a/sw/source/core/crsr/callnk.hxx +++ b/sw/source/core/crsr/callnk.hxx @@ -23,6 +23,7 @@ #include <tools/long.hxx> #include <tools/solar.h> #include <ndtyp.hxx> +#include <nodeoffset.hxx> class SwCursorShell; class SwTextNode; @@ -32,7 +33,7 @@ class SwCallLink { public: SwCursorShell & m_rShell; - sal_uLong m_nNode; + SwNodeOffset m_nNode; tools::Long m_nLeftFramePos; sal_Int32 m_nContent; SwNodeType m_nNodeType; diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 1a59b16ba2de..ae7b2c81133d 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2549,7 +2549,7 @@ OUString SwCursorShell::GetSelText() const OUStringBuffer buf; SwPosition const*const pStart(m_pCurrentCursor->Start()); SwPosition const*const pEnd(m_pCurrentCursor->End()); - for (sal_uLong i = pStart->nNode.GetIndex(); i <= pEnd->nNode.GetIndex(); ++i) + for (SwNodeOffset i = pStart->nNode.GetIndex(); i <= pEnd->nNode.GetIndex(); ++i) { SwNode const& rNode(*pStart->nNode.GetNodes()[i]); assert(!rNode.IsEndNode()); @@ -2849,7 +2849,7 @@ void SwCursorShell::ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing ) else { pTmpDel->GetPoint()->nContent.Assign(nullptr, 0); - pTmpDel->GetPoint()->nNode = 0; + pTmpDel->GetPoint()->nNode = SwNodeOffset(0); pTmpDel->DeleteMark(); } pTmpDel = nullptr; @@ -2911,7 +2911,7 @@ void SwCursorShell::ParkCursor( const SwNodeIndex &rIdx ) if ( pTableNd ) { pTCursor->GetPoint()->nContent.Assign(nullptr, 0); - pTCursor->GetPoint()->nNode = 0; + pTCursor->GetPoint()->nNode = SwNodeOffset(0); pTCursor->DeleteMark(); pSh->m_pCurrentCursor->GetPoint()->nNode = *pTableNd; } @@ -3056,7 +3056,7 @@ bool SwCursorShell::ShouldWait() const return true; SwPaM* pPam = GetCursor(); - return pPam->Start()->nNode.GetIndex() + 10 < + return pPam->Start()->nNode.GetIndex() + SwNodeOffset(10) < pPam->End()->nNode.GetIndex(); } @@ -3124,7 +3124,7 @@ bool SwCursorShell::FindValidContentNode( bool bOnlyText ) // first check for frames SwNodeIndex& rNdIdx = m_pCurrentCursor->GetPoint()->nNode; - sal_uLong nNdIdx = rNdIdx.GetIndex(); // keep backup + SwNodeOffset nNdIdx = rNdIdx.GetIndex(); // keep backup SwNodes& rNds = mxDoc->GetNodes(); SwContentNode* pCNd = rNdIdx.GetNode().GetContentNode(); const SwContentFrame * pFrame; diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index e2e5822a3103..b7ec27fcb6a2 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -400,7 +400,7 @@ bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) Point aPt; SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() ); if( !bNext ) - aFndPos.nNode = 0; + aFndPos.nNode = SwNodeOffset(0); SetGetExpField aFndGEF( aFndPos ), aCurGEF( rPos ); { @@ -466,7 +466,7 @@ bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) { if( bNext ) { - rPos.nNode = 0; + rPos.nNode = SwNodeOffset(0); rPos.nContent = 0; aCurGEF = SetGetExpField( rPos ); SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped ); @@ -518,7 +518,7 @@ bool SwCursorShell::GotoNxtPrvTOXMark( bool bNext ) Point aPt; SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() ); if( !bNext ) - aFndPos.nNode = 0; + aFndPos.nNode = SwNodeOffset(0); SetGetExpField aFndGEF( aFndPos ), aCurGEF( rPos ); if( rPos.nNode.GetIndex() < GetDoc()->GetNodes().GetEndOfExtras().GetIndex() ) @@ -568,7 +568,7 @@ bool SwCursorShell::GotoNxtPrvTOXMark( bool bNext ) { if ( bNext ) { - rPos.nNode = 0; + rPos.nNode = SwNodeOffset(0); rPos.nContent = 0; aCurGEF = SetGetExpField( rPos ); SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped ); @@ -1828,7 +1828,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, pTextNd->SwContentNode::GetAttr( aSet ); rContentAtPos.sStr = "Pos: ("; - rContentAtPos.sStr += OUString::number( aPos.nNode.GetIndex()); + rContentAtPos.sStr += OUString::number( sal_Int32(aPos.nNode.GetIndex())); rContentAtPos.sStr += ":"; rContentAtPos.sStr += OUString::number( aPos.nContent.GetIndex()); rContentAtPos.sStr += ")"; @@ -2463,7 +2463,7 @@ bool SwCursorShell::SelectNxtPrvHyperlink( bool bNext ) SwNodes& rNds = GetDoc()->GetNodes(); const SwNode* pBodyEndNd = &rNds.GetEndOfContent(); const SwNode* pBodySttNd = pBodyEndNd->StartOfSectionNode(); - sal_uLong nBodySttNdIdx = pBodySttNd->GetIndex(); + SwNodeOffset nBodySttNdIdx = pBodySttNd->GetIndex(); Point aPt; SetGetExpField aCmpPos( SwPosition( bNext ? *pBodyEndNd : *pBodySttNd ) ); diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 79405979143b..9cd8a59dbd06 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -903,8 +903,8 @@ bool DoSearch(SwPaM & rSearchPam, if( (bSrchForward || pSttNd != &rNdIdx.GetNode()) && rSearchPam.Move(fnMoveForward, GoInContent) && (!bSrchForward || pSttNd != &rSearchPam.GetPoint()->nNode.GetNode()) && - 1 == std::abs(static_cast<int>(rSearchPam.GetPoint()->nNode.GetIndex() - - rSearchPam.GetMark()->nNode.GetIndex()))) + SwNodeOffset(1) == abs(rSearchPam.GetPoint()->nNode.GetIndex() - + rSearchPam.GetMark()->nNode.GetIndex())) { // if backward search, switch point and mark if( !bSrchForward ) diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index cb0a624bb83e..4add6f1ee201 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -186,7 +186,7 @@ SwDoc& SwPosition::GetDoc() const void SwPosition::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwPosition")); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nNode"), BAD_CAST(OString::number(nNode.GetIndex()).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nNode"), BAD_CAST(OString::number(sal_Int32(nNode.GetIndex())).getStr())); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nContent"), BAD_CAST(OString::number(nContent.GetIndex()).getStr())); (void)xmlTextWriterEndElement(pWriter); } @@ -202,9 +202,9 @@ enum CHKSECTION { Chk_Both, Chk_One, Chk_None }; } -static CHKSECTION lcl_TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, const SwNode& rEndNd ) +static CHKSECTION lcl_TstIdx( SwNodeOffset nSttIdx, SwNodeOffset nEndIdx, const SwNode& rEndNd ) { - sal_uLong nStt = rEndNd.StartOfSectionIndex(), nEnd = rEndNd.GetIndex(); + SwNodeOffset nStt = rEndNd.StartOfSectionIndex(), nEnd = rEndNd.GetIndex(); CHKSECTION eSec = nStt < nSttIdx && nEnd >= nSttIdx ? Chk_One : Chk_None; if( nStt < nEndIdx && nEnd >= nEndIdx ) return( eSec == Chk_One ? Chk_Both : Chk_One ); @@ -212,7 +212,7 @@ static CHKSECTION lcl_TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, const SwNode } static bool lcl_ChkOneRange( CHKSECTION eSec, bool bChkSections, - const SwNode& rBaseEnd, sal_uLong nStt, sal_uLong nEnd ) + const SwNode& rBaseEnd, SwNodeOffset nStt, SwNodeOffset nEnd ) { if( eSec != Chk_Both ) return false; @@ -241,7 +241,7 @@ static bool lcl_ChkOneRange( CHKSECTION eSec, bool bChkSections, pNd = pTmp; } - sal_uLong nSttIdx = pNd->GetIndex(), nEndIdx = pNd->EndOfSectionIndex(); + SwNodeOffset nSttIdx = pNd->GetIndex(), nEndIdx = pNd->EndOfSectionIndex(); return nSttIdx <= nStt && nStt <= nEndIdx && nSttIdx <= nEnd && nEnd <= nEndIdx; } @@ -260,7 +260,7 @@ bool CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd, bool bChkSection ) { const SwNodes& rNds = rStt.GetNodes(); - sal_uLong nStt = rStt.GetIndex(), nEnd = rEnd.GetIndex(); + SwNodeOffset nStt = rStt.GetIndex(), nEnd = rEnd.GetIndex(); CHKSECTION eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfContent() ); if( Chk_None != eSec ) return eSec == Chk_Both; @@ -308,7 +308,7 @@ SwContentNode* GoNextNds( SwNodeIndex* pIdx, bool bChk ) SwContentNode* pNd = aIdx.GetNodes().GoNext( &aIdx ); if( pNd ) { - if( bChk && 1 != aIdx.GetIndex() - pIdx->GetIndex() && + if( bChk && SwNodeOffset(1) != aIdx.GetIndex() - pIdx->GetIndex() && !CheckNodesRange( *pIdx, aIdx, true ) ) pNd = nullptr; else @@ -323,7 +323,7 @@ SwContentNode* GoPreviousNds( SwNodeIndex * pIdx, bool bChk ) SwContentNode* pNd = SwNodes::GoPrevious( &aIdx ); if( pNd ) { - if( bChk && 1 != pIdx->GetIndex() - aIdx.GetIndex() && + if( bChk && SwNodeOffset(1) != pIdx->GetIndex() - aIdx.GetIndex() && !CheckNodesRange( *pIdx, aIdx, true ) ) pNd = nullptr; else @@ -353,7 +353,7 @@ SwPaM::SwPaM( const SwPosition& rMark, const SwPosition& rPoint, SwPaM* pRing ) } SwPaM::SwPaM( const SwNodeIndex& rMark, const SwNodeIndex& rPoint, - tools::Long nMarkOffset, tools::Long nPointOffset, SwPaM* pRing ) + SwNodeOffset nMarkOffset, SwNodeOffset nPointOffset, SwPaM* pRing ) : Ring( pRing ) , m_Bound1( rMark ) , m_Bound2( rPoint ) @@ -374,7 +374,7 @@ SwPaM::SwPaM( const SwNodeIndex& rMark, const SwNodeIndex& rPoint, } SwPaM::SwPaM( const SwNode& rMark, const SwNode& rPoint, - tools::Long nMarkOffset, tools::Long nPointOffset, SwPaM* pRing ) + SwNodeOffset nMarkOffset, SwNodeOffset nPointOffset, SwPaM* pRing ) : Ring( pRing ) , m_Bound1( rMark ) , m_Bound2( rPoint ) @@ -687,11 +687,11 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const // check for protected section inside the selection if( !bRet ) { - sal_uLong nSttIdx = GetMark()->nNode.GetIndex(), + SwNodeOffset nSttIdx = GetMark()->nNode.GetIndex(), nEndIdx = GetPoint()->nNode.GetIndex(); if( nEndIdx <= nSttIdx ) { - sal_uLong nTmp = nSttIdx; + SwNodeOffset nTmp = nSttIdx; nSttIdx = nEndIdx; nEndIdx = nTmp; } @@ -699,7 +699,7 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const // If a protected section should be between nodes, then the // selection needs to contain already x nodes. // (TextNd, SectNd, TextNd, EndNd, TextNd ) - if( nSttIdx + 3 < nEndIdx ) + if( nSttIdx + SwNodeOffset(3) < nEndIdx ) { const SwSectionFormats& rFormats = GetDoc().GetSections(); for( SwSectionFormats::size_type n = rFormats.size(); n; ) @@ -709,7 +709,7 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const { const SwFormatContent& rContent = pFormat->GetContent(false); OSL_ENSURE( rContent.GetContentIdx(), "where is the SectionNode?" ); - sal_uLong nIdx = rContent.GetContentIdx()->GetIndex(); + SwNodeOffset nIdx = rContent.GetContentIdx()->GetIndex(); if( nSttIdx <= nIdx && nEndIdx >= nIdx && rContent.GetContentIdx()->GetNode().GetNodes().IsDocNodes() ) { diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index c799a0da3551..6f4ed5f01ed0 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -85,7 +85,7 @@ struct PercentHdl explicit PercentHdl( const SwPaM& rPam ) : pDSh( rPam.GetDoc().GetDocShell() ) { - sal_uLong nStt, nEnd; + sal_Int32 nStt, nEnd; if( rPam.GetPoint()->nNode == rPam.GetMark()->nNode ) { bNodeIdx = false; @@ -95,8 +95,8 @@ struct PercentHdl else { bNodeIdx = true; - nStt = rPam.GetMark()->nNode.GetIndex(); - nEnd = rPam.GetPoint()->nNode.GetIndex(); + nStt = sal_Int32(rPam.GetMark()->nNode.GetIndex()); + nEnd = sal_Int32(rPam.GetPoint()->nNode.GetIndex()); } nActPos = nStt; bBack = (nStt > nEnd ); @@ -114,9 +114,9 @@ struct PercentHdl void NextPos( SwPosition const & rPos ) const { - sal_uLong nPos; + sal_Int32 nPos; if( bNodeIdx ) - nPos = rPos.nNode.GetIndex(); + nPos = sal_Int32(rPos.nNode.GetIndex()); else nPos = rPos.nContent.GetIndex(); ::SetProgressState( bBack ? nActPos - nPos : nPos, pDSh ); @@ -301,11 +301,11 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) // is there a protected section in the section? if( HasMark() && bSkipOverProtectSections) { - sal_uLong nSttIdx = GetMark()->nNode.GetIndex(), + SwNodeOffset nSttIdx = GetMark()->nNode.GetIndex(), nEndIdx = GetPoint()->nNode.GetIndex(); if( nEndIdx <= nSttIdx ) { - sal_uLong nTmp = nSttIdx; + SwNodeOffset nTmp = nSttIdx; nSttIdx = nEndIdx; nEndIdx = nTmp; } @@ -319,7 +319,7 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) { const SwFormatContent& rContent = pFormat->GetContent(false); OSL_ENSURE( rContent.GetContentIdx(), "No SectionNode?" ); - sal_uLong nIdx = rContent.GetContentIdx()->GetIndex(); + SwNodeOffset nIdx = rContent.GetContentIdx()->GetIndex(); if( nSttIdx <= nIdx && nEndIdx >= nIdx ) { // if it is no linked section then we cannot select it @@ -451,7 +451,7 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) if ( pInputFieldTextAttrAtPoint != pInputFieldTextAttrAtMark ) { - const sal_uLong nRefNodeIdx = + const SwNodeOffset nRefNodeIdx = ( SwCursorSelOverFlags::Toggle & eFlags ) ? m_vSavePos.back().nNode : GetMark()->nNode.GetIndex(); @@ -506,8 +506,8 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) ? m_vSavePos.back().nNode : GetMark()->nNode.GetIndex()); do { // loop for table after table - sal_uLong nSEIdx = pPtNd->EndOfSectionIndex(); - sal_uLong nSttEndTable = nSEIdx + 1; + SwNodeOffset nSEIdx = pPtNd->EndOfSectionIndex(); + SwNodeOffset nSttEndTable = nSEIdx + 1; if( bSelTop ) nSttEndTable = rNds[ nSEIdx ]->StartOfSectionIndex() - 1; @@ -1122,7 +1122,7 @@ void SwCursor::FillFindPos( SwDocPositions ePos, SwPosition& rPos ) const bIsStart = false; break; case SwDocPositions::OtherStart: - rPos.nNode = *rNds[ sal_uLong(0) ]; + rPos.nNode = *rNds[ SwNodeOffset(0) ]; pCNd = rNds.GoNext( &rPos.nNode ); break; case SwDocPositions::OtherEnd: @@ -2315,7 +2315,7 @@ bool SwCursor::MovePara(SwWhichPara fnWhichPara, SwMoveFnCollection const & fnPo { if ( pNd->IsTextNode() && pNd->GetNodes()[ pNd->GetIndex() + - (fnWhichPara == GoNextPara ? 1 : -1 ) ]->IsTextNode() ) + SwNodeOffset(fnWhichPara == GoNextPara ? 1 : -1 ) ]->IsTextNode() ) bShortCut = true; } @@ -2345,7 +2345,7 @@ void SwCursor::RestoreSavePos() { // This method is not supposed to be used in cases when nodes may be // deleted; detect such cases, but do not crash (example: fdo#40831). - sal_uLong uNodeCount = GetPoint()->nNode.GetNodes().Count(); + SwNodeOffset uNodeCount(GetPoint()->nNode.GetNodes().Count()); OSL_ENSURE(m_vSavePos.empty() || m_vSavePos.back().nNode < uNodeCount, "SwCursor::RestoreSavePos: invalid node: " "probably something was deleted; consider using SwUnoCursor instead"); @@ -2373,8 +2373,8 @@ SwTableCursor::SwTableCursor( const SwPosition &rPos ) { m_bParked = false; m_bChanged = false; - m_nTablePtNd = 0; - m_nTableMkNd = 0; + m_nTablePtNd = SwNodeOffset(0); + m_nTableMkNd = SwNodeOffset(0); m_nTablePtCnt = 0; m_nTableMkCnt = 0; } @@ -2385,7 +2385,7 @@ static bool lcl_SeekEntry(const SwSelBoxes& rTmp, SwStartNode const*const pSrch, size_t & o_rFndPos) { - sal_uLong nIdx = pSrch->GetIndex(); + SwNodeOffset nIdx = pSrch->GetIndex(); size_t nO = rTmp.size(); if( nO > 0 ) diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index 62c30c55f0dc..b6477cc60247 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -184,15 +184,15 @@ bool SwCursorShell::GotoFootnoteAnchor() return bRet; } -static bool CmpLE( const SwTextFootnote& rFootnote, sal_uLong nNd, sal_Int32 nCnt ) +static bool CmpLE( const SwTextFootnote& rFootnote, SwNodeOffset nNd, sal_Int32 nCnt ) { - const sal_uLong nTNd = rFootnote.GetTextNode().GetIndex(); + const SwNodeOffset nTNd = rFootnote.GetTextNode().GetIndex(); return nTNd < nNd || ( nTNd == nNd && rFootnote.GetStart() <= nCnt ); } -static bool CmpL( const SwTextFootnote& rFootnote, sal_uLong nNd, sal_Int32 nCnt ) +static bool CmpL( const SwTextFootnote& rFootnote, SwNodeOffset nNd, sal_Int32 nCnt ) { - const sal_uLong nTNd = rFootnote.GetTextNode().GetIndex(); + const SwNodeOffset nTNd = rFootnote.GetTextNode().GetIndex(); return nTNd < nNd || ( nTNd == nNd && rFootnote.GetStart() < nCnt ); } @@ -213,7 +213,7 @@ bool SwCursor::GotoNextFootnoteAnchor() // there is a footnote with this index, so search also for the next one if( nPos < rFootnoteArr.size() ) { - sal_uLong nNdPos = GetPoint()->nNode.GetIndex(); + SwNodeOffset nNdPos = GetPoint()->nNode.GetIndex(); const sal_Int32 nCntPos = GetPoint()->nContent.GetIndex(); pTextFootnote = rFootnoteArr[ nPos ]; @@ -284,7 +284,7 @@ bool SwCursor::GotoPrevFootnoteAnchor() if( rFootnoteArr.SeekEntry( GetPoint()->nNode, &nPos ) ) { // there is a footnote with this index, so search also for the next one - sal_uLong nNdPos = GetPoint()->nNode.GetIndex(); + SwNodeOffset nNdPos = GetPoint()->nNode.GetIndex(); const sal_Int32 nCntPos = GetPoint()->nContent.GetIndex(); pTextFootnote = rFootnoteArr[ nPos ]; diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx index 07d9061672aa..7d5617886800 100644 --- a/sw/source/core/crsr/trvlreg.cxx +++ b/sw/source/core/crsr/trvlreg.cxx @@ -35,10 +35,10 @@ bool GotoPrevRegion( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegi SwNodeIndex aIdx( rCurrentCursor.GetPoint()->nNode ); SwSectionNode* pNd = aIdx.GetNode().FindSectionNode(); if( pNd ) - aIdx.Assign( *pNd, - 1 ); + aIdx.Assign( *pNd, -1 ); SwNodeIndex aOldIdx = aIdx; - sal_uLong nLastNd = rCurrentCursor.GetDoc().GetNodes().Count() - 1; + SwNodeOffset nLastNd(rCurrentCursor.GetDoc().GetNodes().Count() - 1); do { while( aIdx.GetIndex() ) { @@ -113,7 +113,7 @@ bool GotoNextRegion( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegi aIdx.Assign( *pNd->EndOfSectionNode(), - 1 ); SwNodeIndex aOldIdx = aIdx; - sal_uLong nEndCount = aIdx.GetNode().GetNodes().Count()-1; + SwNodeOffset nEndCount = aIdx.GetNode().GetNodes().Count() - 1; do { while( aIdx.GetIndex() < nEndCount ) { @@ -131,7 +131,7 @@ bool GotoNextRegion( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegi if ( aIdx.GetIndex() == nEndCount ) { SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped ); - aIdx = 0; + aIdx = SwNodeOffset(0); continue; } diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 8bffbe3505fb..12b8eae08a78 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -471,7 +471,7 @@ static bool lcl_FindPrevCell( SwNodeIndex& rIdx, bool bInReadOnly ) rIdx = *pCNd; return true; // ok, not protected } - aTmp.Assign( *pCNd->StartOfSectionNode(), - 1 ); + aTmp.Assign( *pCNd->StartOfSectionNode(), -1 ); } } rIdx = *pCNd; @@ -497,11 +497,11 @@ bool GotoPrevTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable --aTmpIdx; if( pInnerTableNd == pTableNd ) - aIdx.Assign( *pTableNd, - 1 ); + aIdx.Assign( *pTableNd, -1 ); } SwNodeIndex aOldIdx = aIdx; - sal_uLong nLastNd = rCurrentCursor.GetDoc().GetNodes().Count() - 1; + SwNodeOffset nLastNd(rCurrentCursor.GetDoc().GetNodes().Count() - 1); do { while( aIdx.GetIndex() && nullptr == ( pTableNd = aIdx.GetNode().StartOfSectionNode()->GetTableNode()) ) @@ -570,7 +570,7 @@ bool GotoNextTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable aIdx.Assign( *pTableNd->EndOfSectionNode(), 1 ); SwNodeIndex aOldIdx = aIdx; - sal_uLong nLastNd = rCurrentCursor.GetDoc().GetNodes().Count() - 1; + SwNodeOffset nLastNd(rCurrentCursor.GetDoc().GetNodes().Count() - 1); do { while( aIdx.GetIndex() < nLastNd && nullptr == ( pTableNd = aIdx.GetNode().GetTableNode()) ) @@ -586,7 +586,7 @@ bool GotoNextTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable if ( aIdx.GetIndex() == nLastNd ) { SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped ); - aIdx = 0; + aIdx = SwNodeOffset(0); continue; } @@ -686,7 +686,7 @@ bool SwCursorShell::MoveTable( SwWhichTable fnWhichTable, SwMoveFnCollection con SwShellCursor* pCursor = m_pTableCursor ? m_pTableCursor : m_pCurrentCursor; bool bCheckPos; bool bRet; - sal_uLong nPtNd = 0; + SwNodeOffset nPtNd(0); sal_Int32 nPtCnt = 0; if ( !m_pTableCursor && m_pCurrentCursor->HasMark() ) @@ -829,7 +829,7 @@ bool SwCursorShell::CheckTableBoxContent( const SwPosition* pPos ) } // box has more than one paragraph - if( pChkBox && pSttNd->GetIndex() + 2 != pSttNd->EndOfSectionIndex() ) + if( pChkBox && pSttNd->GetIndex() + SwNodeOffset(2) != pSttNd->EndOfSectionIndex() ) pChkBox = nullptr; // destroy pointer before next action starts diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index ae4210aa563c..a2ff362cee03 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -51,9 +51,9 @@ namespace const int BEHIND_SAME_NODE = 3; // Same node index but content index behind given content index const int BEHIND_NODE = 4; // Position behind the given node index - int lcl_RelativePosition( const SwPosition& rPos, sal_uLong nNode, sal_Int32 nContent ) + int lcl_RelativePosition( const SwPosition& rPos, SwNodeOffset nNode, sal_Int32 nContent ) { - sal_uLong nIndex = rPos.nNode.GetIndex(); + SwNodeOffset nIndex = rPos.nNode.GetIndex(); int nReturn = BEFORE_NODE; if( nIndex == nNode ) { @@ -140,7 +140,7 @@ namespace { return m_aBkmkEntries.empty() && m_aRedlineEntries.empty() && m_aFlyEntries.empty() && m_aUnoCursorEntries.empty() && m_aShellCursorEntries.empty(); } - virtual void Save(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit=false) override + virtual void Save(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent, bool bSaveFlySplit=false) override { SaveBkmks(rDoc, nNode, nContent); SaveRedlines(rDoc, nNode, nContent); @@ -148,7 +148,7 @@ namespace SaveUnoCursors(rDoc, nNode, nContent); SaveShellCursors(rDoc, nNode, nContent); } - virtual void Restore(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false, bool bAtStart = false, RestoreMode eMode = RestoreMode::All) override + virtual void Restore(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nOffset=0, bool bAuto = false, bool bAtStart = false, RestoreMode eMode = RestoreMode::All) override { SwContentNode* pCNd = rDoc.GetNodes()[ nNode ]->GetContentNode(); updater_t aUpdater = OffsetUpdater(pCNd, nOffset); @@ -183,22 +183,22 @@ namespace } private: - void SaveBkmks(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent); + void SaveBkmks(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent); void RestoreBkmks(SwDoc& rDoc, updater_t const & rUpdater); - void SaveRedlines(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent); + void SaveRedlines(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent); void RestoreRedlines(SwDoc& rDoc, updater_t const & rUpdater); - void SaveFlys(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit); + void SaveFlys(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent, bool bSaveFlySplit); void RestoreFlys(SwDoc& rDoc, updater_t const & rUpdater, bool bAuto, bool bAtStart); - void SaveUnoCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent); + void SaveUnoCursors(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent); void RestoreUnoCursors(updater_t const & rUpdater); - void SaveShellCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent); + void SaveShellCursors(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent); void RestoreShellCursors(updater_t const & rUpdater); static const SwPosition& GetRightMarkPos(::sw::mark::IMark const * pMark, bool bOther) { return bOther ? pMark->GetOtherMarkPos() : pMark->GetMarkPos(); }; static void SetRightMarkPos(MarkBase* pMark, bool bOther, const SwPosition* const pPos) { bOther ? pMark->SetOtherMarkPos(*pPos) : pMark->SetMarkPos(*pPos); }; }; - void lcl_ChkPaM( std::vector<PaMEntry>& rPaMEntries, const sal_uLong nNode, const sal_Int32 nContent, SwPaM& rPaM, const bool bGetPoint, bool bSetMark) + void lcl_ChkPaM( std::vector<PaMEntry>& rPaMEntries, const SwNodeOffset nNode, const sal_Int32 nContent, SwPaM& rPaM, const bool bGetPoint, bool bSetMark) { const SwPosition* pPos = &rPaM.GetBound(bGetPoint); if( pPos->nNode.GetIndex() == nNode && pPos->nContent.GetIndex() < nContent ) @@ -207,12 +207,12 @@ namespace rPaMEntries.push_back(aEntry); } } - void lcl_ChkPaMBoth( std::vector<PaMEntry>& rPaMEntries, const sal_uLong nNode, const sal_Int32 nContent, SwPaM& rPaM) + void lcl_ChkPaMBoth( std::vector<PaMEntry>& rPaMEntries, const SwNodeOffset nNode, const sal_Int32 nContent, SwPaM& rPaM) { lcl_ChkPaM(rPaMEntries, nNode, nContent, rPaM, true, true); lcl_ChkPaM(rPaMEntries, nNode, nContent, rPaM, false, false); } - void lcl_ChkUnoCrsrPaMBoth(std::vector<PaMEntry>& rPaMEntries, const sal_uLong nNode, const sal_Int32 nContent, SwPaM& rPaM) + void lcl_ChkUnoCrsrPaMBoth(std::vector<PaMEntry>& rPaMEntries, const SwNodeOffset nNode, const sal_Int32 nContent, SwPaM& rPaM) { lcl_ChkPaM(rPaMEntries, nNode, nContent, rPaM, true, false); lcl_ChkPaM(rPaMEntries, nNode, nContent, rPaM, false, true); @@ -227,7 +227,7 @@ namespace #endif } -void ContentIdxStoreImpl::SaveBkmks(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent) +void ContentIdxStoreImpl::SaveBkmks(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent) { IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess(); const IDocumentMarkAccess::const_iterator_t ppBkmkEnd = pMarkAccess->getAllMarksEnd(); @@ -283,7 +283,7 @@ void ContentIdxStoreImpl::RestoreBkmks(SwDoc& rDoc, updater_t const & rUpdater) } } -void ContentIdxStoreImpl::SaveRedlines(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent) +void ContentIdxStoreImpl::SaveRedlines(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent) { SwRedlineTable const & rRedlineTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); tools::Long nIdx = 0; @@ -323,7 +323,7 @@ void ContentIdxStoreImpl::RestoreRedlines(SwDoc& rDoc, updater_t const & rUpdate } } -void ContentIdxStoreImpl::SaveFlys(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit) +void ContentIdxStoreImpl::SaveFlys(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent, bool bSaveFlySplit) { SwContentNode *pNode = rDoc.GetNodes()[nNode]->GetContentNode(); if( !pNode ) @@ -402,7 +402,7 @@ void ContentIdxStoreImpl::RestoreFlys(SwDoc& rDoc, updater_t const & rUpdater, b } } -void ContentIdxStoreImpl::SaveUnoCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent) +void ContentIdxStoreImpl::SaveUnoCursors(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent) { rDoc.cleanupUnoCursorTable(); for (const auto& pWeakUnoCursor : rDoc.mvUnoCursorTable) @@ -433,7 +433,7 @@ void ContentIdxStoreImpl::RestoreUnoCursors(updater_t const & rUpdater) } } -void ContentIdxStoreImpl::SaveShellCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent) +void ContentIdxStoreImpl::SaveShellCursors(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent) { SwCursorShell* pShell = rDoc.GetEditShell(); if( !pShell ) diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 2f0ae4676697..15ca25c6006c 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -98,8 +98,8 @@ namespace { // Copy method from SwDoc // Prevent copying into Flys that are anchored in the range - bool lcl_ChkFlyFly( SwDoc& rDoc, sal_uLong nSttNd, sal_uLong nEndNd, - sal_uLong nInsNd ) + bool lcl_ChkFlyFly( SwDoc& rDoc, SwNodeOffset nSttNd, SwNodeOffset nEndNd, + SwNodeOffset nInsNd ) { const SwFrameFormats& rFrameFormatTable = *rDoc.GetSpzFrameFormats(); @@ -137,19 +137,19 @@ namespace return false; } - SwNodeIndex InitDelCount(SwPaM const& rSourcePaM, sal_uLong & rDelCount) + SwNodeIndex InitDelCount(SwPaM const& rSourcePaM, SwNodeOffset & rDelCount) { SwNodeIndex const& rStart(rSourcePaM.Start()->nNode); // Special handling for SwDoc::AppendDoc if (rSourcePaM.GetDoc().GetNodes().GetEndOfExtras().GetIndex() + 1 == rStart.GetIndex()) { - rDelCount = 1; + rDelCount = SwNodeOffset(1); return SwNodeIndex(rStart, +1); } else { - rDelCount = 0; + rDelCount = SwNodeOffset(0); return rStart; } } @@ -165,10 +165,10 @@ namespace of "non-copy" nodes between rPam.Start() and rLastIdx. nNewIdx is the new position of interest. */ - void lcl_NonCopyCount( const SwPaM& rPam, SwNodeIndex& rLastIdx, const sal_uLong nNewIdx, sal_uLong& rDelCount ) + void lcl_NonCopyCount( const SwPaM& rPam, SwNodeIndex& rLastIdx, const SwNodeOffset nNewIdx, SwNodeOffset& rDelCount ) { - sal_uLong nStart = rPam.Start()->nNode.GetIndex(); - sal_uLong nEnd = rPam.End()->nNode.GetIndex(); + SwNodeOffset nStart = rPam.Start()->nNode.GetIndex(); + SwNodeOffset nEnd = rPam.End()->nNode.GetIndex(); if( rLastIdx.GetIndex() < nNewIdx ) // Moving forward? { // We never copy the StartOfContent node @@ -204,9 +204,9 @@ namespace const SwPosition& rOrigStt, const SwPosition& rCpyStt, SwPosition& rChgPos, - sal_uLong nDelCount ) + SwNodeOffset nDelCount ) { - sal_uLong nNdOff = rOrigPos.nNode.GetIndex(); + SwNodeOffset nNdOff = rOrigPos.nNode.GetIndex(); nNdOff -= rOrigStt.nNode.GetIndex(); nNdOff -= nDelCount; sal_Int32 nContentPos = rOrigPos.nContent.GetIndex(); @@ -279,7 +279,7 @@ namespace sw } } // We have to count the "non-copied" nodes... - sal_uLong nDelCount; + SwNodeOffset nDelCount; SwNodeIndex aCorrIdx(InitDelCount(rPam, nDelCount)); for(const sw::mark::IMark* const pMark : vMarksToCopy) { @@ -356,7 +356,7 @@ namespace std::unique_ptr<SwPaM> pDelPam; const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End(); // We have to count the "non-copied" nodes - sal_uLong nDelCount; + SwNodeOffset nDelCount; SwNodeIndex aCorrIdx(InitDelCount(rPam, nDelCount)); SwRedlineTable::size_type n = 0; @@ -512,17 +512,17 @@ namespace //local functions originally from sw/source/core/doc/docedt.cxx namespace sw { - void CalcBreaks(std::vector<std::pair<sal_uLong, sal_Int32>> & rBreaks, + void CalcBreaks(std::vector<std::pair<SwNodeOffset, sal_Int32>> & rBreaks, SwPaM const & rPam, bool const isOnlyFieldmarks) { - sal_uLong const nStartNode(rPam.Start()->nNode.GetIndex()); - sal_uLong const nEndNode(rPam.End()->nNode.GetIndex()); + SwNodeOffset const nStartNode(rPam.Start()->nNode.GetIndex()); + SwNodeOffset const nEndNode(rPam.End()->nNode.GetIndex()); SwNodes const& rNodes(rPam.GetPoint()->nNode.GetNodes()); IDocumentMarkAccess const& rIDMA(*rPam.GetDoc().getIDocumentMarkAccess()); - std::stack<std::tuple<sw::mark::IFieldmark const*, bool, sal_uLong, sal_Int32>> startedFields; + std::stack<std::tuple<sw::mark::IFieldmark const*, bool, SwNodeOffset, sal_Int32>> startedFields; - for (sal_uLong n = nStartNode; n <= nEndNode; ++n) + for (SwNodeOffset n = nStartNode; n <= nEndNode; ++n) { SwNode *const pNode(rNodes[n]); if (pNode->IsTextNode()) @@ -609,14 +609,14 @@ namespace sw while (!startedFields.empty()) { SwPosition const& rStart(std::get<0>(startedFields.top())->GetMarkStart()); - std::pair<sal_uLong, sal_Int32> const pos( + std::pair<SwNodeOffset, sal_Int32> const pos( rStart.nNode.GetIndex(), rStart.nContent.GetIndex()); auto it = std::lower_bound(rBreaks.begin(), rBreaks.end(), pos); assert(it == rBreaks.end() || *it != pos); rBreaks.insert(it, pos); if (std::get<1>(startedFields.top())) { - std::pair<sal_uLong, sal_Int32> const posSep( + std::pair<SwNodeOffset, sal_Int32> const posSep( std::get<2>(startedFields.top()), std::get<3>(startedFields.top())); it = std::lower_bound(rBreaks.begin(), rBreaks.end(), posSep); @@ -634,7 +634,7 @@ namespace bool lcl_DoWithBreaks(::sw::DocumentContentOperationsManager & rDocumentContentOperations, SwPaM & rPam, bool (::sw::DocumentContentOperationsManager::*pFunc)(SwPaM&, bool), const bool bForceJoinNext = false) { - std::vector<std::pair<sal_uLong, sal_Int32>> Breaks; + std::vector<std::pair<SwNodeOffset, sal_Int32>> Breaks; sw::CalcBreaks(Breaks, rPam); @@ -653,7 +653,7 @@ namespace bool bRet( true ); // iterate from end to start, to avoid invalidating the offsets! auto iter( Breaks.rbegin() ); - sal_uLong nOffset(0); + SwNodeOffset nOffset(0); SwNodes const& rNodes(rPam.GetPoint()->nNode.GetNodes()); SwPaM aPam( rSelectionEnd, rSelectionEnd ); // end node! SwPosition & rEnd( *aPam.End() ); @@ -701,7 +701,7 @@ namespace struct SaveRedline { SwRangeRedline* pRedl; - sal_uInt32 nStt, nEnd; + SwNodeOffset nStt, nEnd; sal_Int32 nSttCnt; sal_Int32 nEndCnt; @@ -711,8 +711,8 @@ namespace , nEndCnt(0) { const SwPosition* pStt = pR->Start(), - * pEnd = pR->End(); - sal_uInt32 nSttIdx = rSttIdx.GetIndex(); + * pEnd = pR->End(); + SwNodeOffset nSttIdx = rSttIdx.GetIndex(); nStt = pStt->nNode.GetIndex() - nSttIdx; nSttCnt = pStt->nContent.GetIndex(); if( pR->HasMark() ) @@ -721,9 +721,9 @@ namespace nEndCnt = pEnd->nContent.GetIndex(); } - pRedl->GetPoint()->nNode = 0; + pRedl->GetPoint()->nNode = SwNodeOffset(0); pRedl->GetPoint()->nContent.Assign( nullptr, 0 ); - pRedl->GetMark()->nNode = 0; + pRedl->GetMark()->nNode = SwNodeOffset(0); pRedl->GetMark()->nContent.Assign( nullptr, 0 ); } @@ -733,27 +733,27 @@ namespace , nEndCnt(0) { const SwPosition* pStt = pR->Start(), - * pEnd = pR->End(); - sal_uInt32 nSttIdx = rPos.nNode.GetIndex(); + * pEnd = pR->End(); + SwNodeOffset nSttIdx = rPos.nNode.GetIndex(); nStt = pStt->nNode.GetIndex() - nSttIdx; nSttCnt = pStt->nContent.GetIndex(); - if( nStt == 0 ) + if( nStt == SwNodeOffset(0) ) nSttCnt = nSttCnt - rPos.nContent.GetIndex(); if( pR->HasMark() ) { nEnd = pEnd->nNode.GetIndex() - nSttIdx; nEndCnt = pEnd->nContent.GetIndex(); - if( nEnd == 0 ) + if( nEnd == SwNodeOffset(0) ) nEndCnt = nEndCnt - rPos.nContent.GetIndex(); } - pRedl->GetPoint()->nNode = 0; + pRedl->GetPoint()->nNode = SwNodeOffset(0); pRedl->GetPoint()->nContent.Assign( nullptr, 0 ); - pRedl->GetMark()->nNode = 0; + pRedl->GetMark()->nNode = SwNodeOffset(0); pRedl->GetMark()->nContent.Assign( nullptr, 0 ); } - void SetPos( sal_uInt32 nInsPos ) + void SetPos( SwNodeOffset nInsPos ) { pRedl->GetPoint()->nNode = nInsPos + nStt; pRedl->GetPoint()->nContent.Assign( pRedl->GetContentNode(), nSttCnt ); @@ -767,11 +767,11 @@ namespace void SetPos( const SwPosition& aPos ) { pRedl->GetPoint()->nNode = aPos.nNode.GetIndex() + nStt; - pRedl->GetPoint()->nContent.Assign( pRedl->GetContentNode(), nSttCnt + ( nStt == 0 ? aPos.nContent.GetIndex() : 0 ) ); + pRedl->GetPoint()->nContent.Assign( pRedl->GetContentNode(), nSttCnt + ( nStt == SwNodeOffset(0) ? aPos.nContent.GetIndex() : 0 ) ); if( pRedl->HasMark() ) { pRedl->GetMark()->nNode = aPos.nNode.GetIndex() + nEnd; - pRedl->GetMark()->nContent.Assign( pRedl->GetContentNode(false), nEndCnt + ( nEnd == 0 ? aPos.nContent.GetIndex() : 0 ) ); + pRedl->GetMark()->nContent.Assign( pRedl->GetContentNode(false), nEndCnt + ( nEnd == SwNodeOffset(0) ? aPos.nContent.GetIndex() : 0 ) ); } } }; @@ -940,7 +940,7 @@ namespace rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); } - void lcl_RestoreRedlines(SwDoc& rDoc, sal_uInt32 const nInsPos, SaveRedlines_t& rArr) + void lcl_RestoreRedlines(SwDoc& rDoc, SwNodeOffset const nInsPos, SaveRedlines_t& rArr) { RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( ( eOld & ~RedlineFlags::Ignore) | RedlineFlags::On ); @@ -1967,7 +1967,7 @@ namespace mark { bool IsFieldmarkOverlap(SwPaM const& rPaM) { - std::vector<std::pair<sal_uLong, sal_Int32>> Breaks; + std::vector<std::pair<SwNodeOffset, sal_Int32>> Breaks; sw::CalcBreaks(Breaks, rPaM); return !Breaks.empty(); } @@ -2017,7 +2017,7 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, if (&rDoc == &m_rDoc && (flags & SwCopyFlags::CheckPosInFly)) { // Correct the Start-/EndNode - sal_uLong nStt = pStt->nNode.GetIndex(), + SwNodeOffset nStt = pStt->nNode.GetIndex(), nEnd = pEnd->nNode.GetIndex(), nDiff = nEnd - nStt +1; SwNode* pNd = m_rDoc.GetNodes()[ nStt ]; @@ -2135,11 +2135,11 @@ bool DocumentContentOperationsManager::DelFullPara( SwPaM& rPam ) { const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End(); const SwNode* pNd = &rStt.nNode.GetNode(); - sal_uInt32 nSectDiff = pNd->StartOfSectionNode()->EndOfSectionIndex() - + SwNodeOffset nSectDiff = pNd->StartOfSectionNode()->EndOfSectionIndex() - pNd->StartOfSectionIndex(); - sal_uInt32 nNodeDiff = rEnd.nNode.GetIndex() - rStt.nNode.GetIndex(); + SwNodeOffset nNodeDiff = rEnd.nNode.GetIndex() - rStt.nNode.GetIndex(); - if ( nSectDiff-2 <= nNodeDiff || m_rDoc.getIDocumentRedlineAccess().IsRedlineOn() || + if ( nSectDiff-SwNodeOffset(2) <= nNodeDiff || m_rDoc.getIDocumentRedlineAccess().IsRedlineOn() || /* #i9185# Prevent getting the node after the end node (see below) */ rEnd.nNode.GetIndex() + 1 == m_rDoc.GetNodes().Count() ) { @@ -2171,7 +2171,7 @@ bool DocumentContentOperationsManager::DelFullPara( SwPaM& rPam ) bool bSavePageBreak = false, bSavePageDesc = false; /* #i9185# This would lead to a segmentation fault if not caught above. */ - sal_uLong nNextNd = rEnd.nNode.GetIndex() + 1; + SwNodeOffset nNextNd = rEnd.nNode.GetIndex() + 1; SwTableNode *const pTableNd = m_rDoc.GetNodes()[ nNextNd ]->GetTableNode(); if( pTableNd && pNd->IsContentNode() ) @@ -2391,7 +2391,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos, { if (!pContentStore->Empty()) { - pContentStore->Restore(m_rDoc, pOrigNode->GetIndex()-1, 0, true, false, eMode); + pContentStore->Restore(m_rDoc, pOrigNode->GetIndex()-SwNodeOffset(1), 0, true, false, eMode); } }); pTNd = pTNd->SplitContentNode(rPos, &restoreFunc)->GetTextNode(); @@ -2417,7 +2417,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos, // correct the PaM! if( rPos.nNode == rPaM.GetMark()->nNode ) { - rPaM.GetMark()->nNode = rPos.nNode.GetIndex()-1; + rPaM.GetMark()->nNode = rPos.nNode.GetIndex()-SwNodeOffset(1); rPaM.GetMark()->nContent.Assign( pTNd, nMkContent ); } } @@ -2910,7 +2910,7 @@ void DocumentContentOperationsManager::TransliterateText( const SwPosition* pStt = rPaM.Start(), * pEnd = rPaM.End(); - sal_uLong nSttNd = pStt->nNode.GetIndex(), + SwNodeOffset nSttNd = pStt->nNode.GetIndex(), nEndNd = pEnd->nNode.GetIndex(); sal_Int32 nSttCnt = pStt->nContent.GetIndex(); sal_Int32 nEndCnt = pEnd->nContent.GetIndex(); @@ -3219,7 +3219,7 @@ SwDrawFrameFormat* DocumentContentOperationsManager::InsertDrawObj( if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { - m_rDoc.GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoInsLayFormat>(pFormat, 0, 0) ); + m_rDoc.GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoInsLayFormat>(pFormat, SwNodeOffset(0), 0) ); } m_rDoc.getIDocumentState().SetModified(); @@ -3264,7 +3264,7 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b // then insert a paragraph before it. if( bChkTableStart && !rPos.nContent.GetIndex() && pNode->IsTextNode() ) { - sal_uLong nPrevPos = rPos.nNode.GetIndex() - 1; + SwNodeOffset nPrevPos = rPos.nNode.GetIndex() - 1; const SwTableNode* pTableNd; const SwNode* pNd = m_rDoc.GetNodes()[ nPrevPos ]; if( pNd->IsStartNode() && @@ -3299,7 +3299,7 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b m_rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TEXT )); if( pTextNd ) { - const_cast<SwPosition&>(rPos).nNode = pTableNd->GetIndex()-1; + const_cast<SwPosition&>(rPos).nNode = pTableNd->GetIndex()-SwNodeOffset(1); const_cast<SwPosition&>(rPos).nContent.Assign( pTextNd, 0 ); // only add page breaks/styles to the body area @@ -3338,7 +3338,7 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b { if (!pContentStore->Empty()) { // move all bookmarks, TOXMarks, FlyAtCnt - pContentStore->Restore(m_rDoc, rPos.nNode.GetIndex()-1, 0, true, bAtStart && (eMode & sw::mark::RestoreMode::Flys), eMode); + pContentStore->Restore(m_rDoc, rPos.nNode.GetIndex()-SwNodeOffset(1), 0, true, bAtStart && (eMode & sw::mark::RestoreMode::Flys), eMode); } if (eMode & sw::mark::RestoreMode::NonFlys) { @@ -3412,7 +3412,7 @@ bool DocumentContentOperationsManager::ReplaceRange( SwPaM& rPam, const OUString // unfortunately replace works slightly differently from delete, // so we cannot use lcl_DoWithBreaks here... - std::vector<std::pair<sal_uLong, sal_Int32>> Breaks; + std::vector<std::pair<SwNodeOffset, sal_Int32>> Breaks; SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() ); aPam.Normalize(false); @@ -3450,7 +3450,7 @@ bool DocumentContentOperationsManager::ReplaceRange( SwPaM& rPam, const OUString bool bRet( true ); // iterate from end to start, to avoid invalidating the offsets! auto iter( Breaks.rbegin() ); - sal_uLong nOffset(0); + SwNodeOffset nOffset(0); SwNodes const& rNodes(rPam.GetPoint()->nNode.GetNodes()); OSL_ENSURE(aPam.GetPoint() == aPam.End(), "wrong!"); SwPosition & rEnd( *aPam.End() ); @@ -3612,7 +3612,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly( { SwPaM aRgTmp( rRg.aStart, rRg.aEnd ); SwPosition targetPos(SwNodeIndex(aSavePos, - rRg.aStart != rRg.aEnd ? +1 : 0)); + SwNodeOffset(rRg.aStart != rRg.aEnd ? +1 : 0))); if (pCopiedPaM && rRg.aStart != pCopiedPaM->first.Start()->nNode) { // there is 1 (partially selected, maybe) paragraph before @@ -3679,8 +3679,8 @@ void DocumentContentOperationsManager::CopyWithFlyInFly( // if it was the first node in the document so that MakeFrames() // will find the existing (wasn't deleted) frame on it SwNodeIndex const end(rInsPos, - (!isRecreateEndNode || isAtStartOfSection) - ? 0 : +1); + SwNodeOffset((!isRecreateEndNode || isAtStartOfSection) + ? 0 : +1)); ::MakeFrames(&rDest, aSavePos, end); } } @@ -3698,7 +3698,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly( !aTmpI.GetNode().IsEndNode() ) { // If the range starts with a SwStartNode, it isn't copied - sal_uInt16 offset = (rRg.aStart.GetNode().GetNodeType() != SwNodeType::Start) ? 1 : 0; + SwNodeOffset offset( (rRg.aStart.GetNode().GetNodeType() != SwNodeType::Start) ? 1 : 0 ); OSL_ENSURE( rInsPos.GetIndex() - aSavePos.GetIndex() == rRg.aEnd.GetIndex() - rRg.aStart.GetIndex() - 1 + offset, "An insufficient number of nodes were copied!" ); @@ -3754,8 +3754,8 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl( if ( !pAPos ) continue; bool bAdd = false; - sal_uLong nSkipAfter = pAPos->nNode.GetIndex(); - sal_uLong nStart = rRg.aStart.GetIndex(); + SwNodeOffset nSkipAfter = pAPos->nNode.GetIndex(); + SwNodeOffset nStart = rRg.aStart.GetIndex(); switch ( pAnchor->GetAnchorId() ) { case RndStdIds::FLY_AT_FLY: @@ -3896,7 +3896,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl( } else { - tools::Long nOffset = newPos.nNode.GetIndex() - rRg.aStart.GetIndex(); + SwNodeOffset nOffset = newPos.nNode.GetIndex() - rRg.aStart.GetIndex(); SwNodeIndex aIdx( rStartIdx, nOffset ); newPos.nNode = aIdx; } @@ -4376,7 +4376,7 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam) } // if the end is not a content node, delete it as well - sal_uInt32 nEnd = pEnd->nNode.GetIndex(); + SwNodeOffset nEnd = pEnd->nNode.GetIndex(); if( pCNd == nullptr ) nEnd++; @@ -4385,7 +4385,7 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam) // tdf#134436 delete section nodes like SwUndoDelete::SwUndoDelete SwNode *pTmpNd; while (pEnd == rPam.GetPoint() - && nEnd + 2 < m_rDoc.GetNodes().Count() + && nEnd + SwNodeOffset(2) < m_rDoc.GetNodes().Count() && (pTmpNd = m_rDoc.GetNodes()[nEnd + 1])->IsEndNode() && pTmpNd->StartOfSectionNode()->IsSectionNode() && aSttIdx <= pTmpNd->StartOfSectionNode()->GetIndex()) @@ -4559,7 +4559,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt SwIndex& rIdx = aDelPam.GetPoint()->nContent; rIdx.Assign( nullptr, 0 ); aDelPam.GetMark()->nContent = rIdx; - rPam.GetPoint()->nNode = 0; + rPam.GetPoint()->nNode = SwNodeOffset(0); rPam.GetPoint()->nContent = rIdx; *rPam.GetMark() = *rPam.GetPoint(); m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( eOld ); @@ -4747,7 +4747,7 @@ bool DocumentContentOperationsManager::CopyImpl(SwPaM& rPam, SwPosition& rPos, SwCopyFlags const flags, SwPaM *const pCopyRange) const { - std::vector<std::pair<sal_uLong, sal_Int32>> Breaks; + std::vector<std::pair<SwNodeOffset, sal_Int32>> Breaks; sw::CalcBreaks(Breaks, rPam, true); @@ -4762,7 +4762,7 @@ bool DocumentContentOperationsManager::CopyImpl(SwPaM& rPam, SwPosition& rPos, bool bFirst(true); // iterate from end to start, ... don't think it's necessary here? auto iter( Breaks.rbegin() ); - sal_uLong nOffset(0); + SwNodeOffset nOffset(0); SwNodes const& rNodes(rPam.GetPoint()->nNode.GetNodes()); SwPaM aPam( rSelectionEnd, rSelectionEnd ); // end node! SwPosition & rEnd( *aPam.End() ); @@ -4861,7 +4861,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo bool bCanMoveBack = pCopyPam->Move(fnMoveBackward, GoInContent); // If the position was shifted from more than one node, an end node has been skipped bool bAfterTable = false; - if ((rPos.nNode.GetIndex() - pCopyPam->GetPoint()->nNode.GetIndex()) > 1) + if ((rPos.nNode.GetIndex() - pCopyPam->GetPoint()->nNode.GetIndex()) > SwNodeOffset(1)) { // First go back to the original place pCopyPam->GetPoint()->nNode = rPos.nNode; @@ -4887,7 +4887,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo ( !bOneNode && !rPos.nContent.GetIndex() ) ); bool bCopyBookmarks = true; bool bCopyPageSource = false; - int nDeleteTextNodes = 0; + SwNodeOffset nDeleteTextNodes(0); // #i104585# copy outline num rule to clipboard (for ASCII filter) if (rDoc.IsClipBoard() && m_rDoc.GetOutlineNumRule()) @@ -4958,7 +4958,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo pCopyPam->Move( fnMoveBackward, GoInContent ); } - pDestTextNd = rDoc.GetNodes()[ aInsPos.GetIndex()-1 ]->GetTextNode(); + pDestTextNd = rDoc.GetNodes()[ aInsPos.GetIndex()-SwNodeOffset(1) ]->GetTextNode(); aDestIdx.Assign( pDestTextNd, pDestTextNd->GetText().getLength()); @@ -5056,7 +5056,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo // The end would also be moved else if( rPos == *pEnd ) { - rPos.nNode-=2; + rPos.nNode-=SwNodeOffset(2); rPos.nContent.Assign( rPos.nNode.GetNode().GetContentNode(), nContentEnd ); rPos.nNode++; diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index ff2f5168fa1e..b15e043aa795 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -980,8 +980,8 @@ void DocumentFieldsManager::UpdateExpFieldsImpl( // Make sure we don't hide all content, which would lead to a crash. First, count how many visible sections we have. int nShownSections = 0; - sal_uLong nContentStart = m_rDoc.GetNodes().GetEndOfContent().StartOfSectionIndex() + 1; - sal_uLong nContentEnd = m_rDoc.GetNodes().GetEndOfContent().GetIndex(); + SwNodeOffset nContentStart = m_rDoc.GetNodes().GetEndOfContent().StartOfSectionIndex() + 1; + SwNodeOffset nContentEnd = m_rDoc.GetNodes().GetEndOfContent().GetIndex(); SwSectionFormats& rSectFormats = m_rDoc.GetSections(); for( SwSectionFormats::size_type n = 0; n<rSectFormats.size(); ++n ) { @@ -1395,7 +1395,7 @@ SwDocUpdateField& DocumentFieldsManager::GetUpdateFields() const return *mpUpdateFields; } -bool DocumentFieldsManager::SetFieldsDirty( bool b, const SwNode* pChk, sal_uLong nLen ) +bool DocumentFieldsManager::SetFieldsDirty( bool b, const SwNode* pChk, SwNodeOffset nLen ) { // See if the supplied nodes actually contain fields. // If they don't, the flag doesn't need to be changed. @@ -1407,7 +1407,7 @@ bool DocumentFieldsManager::SetFieldsDirty( bool b, const SwNode* pChk, sal_uLon b = false; if( !nLen ) ++nLen; - sal_uLong nStt = pChk->GetIndex(); + SwNodeOffset nStt = pChk->GetIndex(); const SwNodes& rNds = pChk->GetNodes(); while( nLen-- ) { @@ -1574,7 +1574,7 @@ void DocumentFieldsManager::FieldsToCalc(SwCalc& rCalc, } void DocumentFieldsManager::FieldsToCalc(SwCalc& rCalc, - sal_uLong const nLastNd, sal_Int32 const nLastCnt) + SwNodeOffset const nLastNd, sal_Int32 const nLastCnt) { // create the sorted list of all SetFields mpUpdateFields->MakeFieldList( m_rDoc, mbNewFieldLst, GETFLD_CALC ); diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx index 17b5fb1e6923..c67e9e05e9a6 100644 --- a/sw/source/core/doc/DocumentLayoutManager.cxx +++ b/sw/source/core/doc/DocumentLayoutManager.cxx @@ -165,7 +165,7 @@ SwFrameFormat *DocumentLayoutManager::MakeLayoutFormat( RndStdIds eRequest, cons if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { m_rDoc.GetIDocumentUndoRedo().AppendUndo( - std::make_unique<SwUndoInsLayFormat>(pFormat, 0, 0)); + std::make_unique<SwUndoInsLayFormat>(pFormat, SwNodeOffset(0), 0)); } } break; @@ -252,7 +252,7 @@ void DocumentLayoutManager::DelLayoutFormat( SwFrameFormat *pFormat ) if ( pTable ) { std::vector<SwFrameFormat*> aToDeleteFrameFormats; - const sal_uLong nNodeIdxOfFlyFormat( pContentIdx->GetIndex() ); + const SwNodeOffset nNodeIdxOfFlyFormat( pContentIdx->GetIndex() ); for ( size_t i = 0; i < pTable->size(); ++i ) { @@ -380,7 +380,7 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat( { // Duplicate the content. const SwNode& rCSttNd = rSource.GetContent().GetContentIdx()->GetNode(); - SwNodeRange aRg( rCSttNd, 1, *rCSttNd.EndOfSectionNode() ); + SwNodeRange aRg( rCSttNd, SwNodeOffset(1), *rCSttNd.EndOfSectionNode() ); SwNodeIndex aIdx( m_rDoc.GetNodes().GetEndOfAutotext() ); SwStartNode* pSttNd = SwNodes::MakeEmptySection( aIdx, SwFlyStartNode ); @@ -418,7 +418,7 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat( if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { - m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsLayFormat>(pDest,0,0)); + m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsLayFormat>(pDest,SwNodeOffset(0),0)); } // Make sure that FlyFrames in FlyFrames are copied @@ -448,7 +448,7 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat( if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { - m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsLayFormat>(pDest,0,0)); + m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsLayFormat>(pDest,SwNodeOffset(0),0)); } } diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index c53fbb27aef9..c010a7c9aa49 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -476,8 +476,8 @@ bool DocumentLinksAdministrationManager::SelectServerObj( std::u16string_view rS } if( aPara.pTableNd ) { - rpRange.reset(new SwNodeRange( *aPara.pTableNd, 0, - *aPara.pTableNd->EndOfSectionNode(), 1 )); + rpRange.reset(new SwNodeRange( *aPara.pTableNd, SwNodeOffset(0), + *aPara.pTableNd->EndOfSectionNode(), SwNodeOffset(1) )); return true; } } @@ -492,7 +492,7 @@ bool DocumentLinksAdministrationManager::SelectServerObj( std::u16string_view rS SwNode* pNd = &pIdx->GetNode(); if( !pNd->IsNoTextNode() ) { - rpRange.reset(new SwNodeRange( *pNd, 1, *pNd->EndOfSectionNode() )); + rpRange.reset(new SwNodeRange( *pNd, SwNodeOffset(1), *pNd->EndOfSectionNode() )); return true; } } @@ -514,7 +514,7 @@ bool DocumentLinksAdministrationManager::SelectServerObj( std::u16string_view rS const SwOutlineNodes& rOutlNds = m_rDoc.GetNodes().GetOutLineNds(); SwOutlineNodes::size_type nTmpPos; (void)rOutlNds.Seek_Entry( pNd, &nTmpPos ); - rpRange.reset(new SwNodeRange( aPos.nNode, 0, aPos.nNode )); + rpRange.reset(new SwNodeRange( aPos.nNode, SwNodeOffset(0), aPos.nNode )); // look for the section's end, now for( ++nTmpPos; @@ -561,7 +561,7 @@ bool DocumentLinksAdministrationManager::SelectServerObj( std::u16string_view rS } if( aPara.pSectNd ) { - rpRange.reset(new SwNodeRange( *aPara.pSectNd, 1, + rpRange.reset(new SwNodeRange( *aPara.pSectNd, SwNodeOffset(1), *aPara.pSectNd->EndOfSectionNode() )); return true; diff --git a/sw/source/core/doc/DocumentOutlineNodesManager.cxx b/sw/source/core/doc/DocumentOutlineNodesManager.cxx index cd9729fa2d8b..8d02377276ff 100644 --- a/sw/source/core/doc/DocumentOutlineNodesManager.cxx +++ b/sw/source/core/doc/DocumentOutlineNodesManager.cxx @@ -63,7 +63,7 @@ OUString GetExpandTextMerged(SwRootFrame const*const pLayout, ExpandMode const mode(ExpandMode::HideDeletions | i_mode); OUStringBuffer ret(rNode.GetExpandText(pLayout, 0, -1, bWithNumber, bWithNumber, bWithSpacesForLevel, mode)); - for (sal_uLong i = rNode.GetIndex() + 1; + for (SwNodeOffset i = rNode.GetIndex() + 1; i <= pMerged->pLastNode->GetIndex(); ++i) { SwNode *const pTmp(rNode.GetNodes()[i]); diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 2d799dccc6eb..86bb73039577 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -160,7 +160,7 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam) SAL_WARN("sw.core", "UpdateFramesForAddDeleteRedline:: known pathology (or ChangesInRedline mode)"); return; } - for (sal_uLong j = pTableOrSectionNode->GetIndex(); j <= pTableOrSectionNode->EndOfSectionIndex(); ++j) + for (SwNodeOffset j = pTableOrSectionNode->GetIndex(); j <= pTableOrSectionNode->EndOfSectionIndex(); ++j) { pTableOrSectionNode->GetNodes()[j]->SetRedlineMergeFlag(SwNode::Merge::Hidden); } @@ -262,7 +262,7 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam) ? static_cast<SwStartNode*>(currentStart.nNode.GetNode().GetTableNode()) : static_cast<SwStartNode*>(currentStart.nNode.GetNode().GetSectionNode())); assert(pTableOrSectionNode); // known pathology - for (sal_uLong j = pTableOrSectionNode->GetIndex(); j <= pTableOrSectionNode->EndOfSectionIndex(); ++j) + for (SwNodeOffset j = pTableOrSectionNode->GetIndex(); j <= pTableOrSectionNode->EndOfSectionIndex(); ++j) { pTableOrSectionNode->GetNodes()[j]->SetRedlineMergeFlag(SwNode::Merge::None); } @@ -2630,7 +2630,7 @@ bool DocumentRedlineManager::DeleteRedline( const SwStartNode& rNode, bool bSave SwRedlineTable::size_type DocumentRedlineManager::GetRedlinePos( const SwNode& rNd, RedlineType nType ) const { - const sal_uLong nNdIdx = rNd.GetIndex(); + const SwNodeOffset nNdIdx = rNd.GetIndex(); // if the table only contains good (i.e. non-overlapping) data, we can do a binary search if (!maRedlineTable.HasOverlappingElements()) { @@ -2643,7 +2643,7 @@ SwRedlineTable::size_type DocumentRedlineManager::GetRedlinePos( const SwNode& r for( ; it != maRedlineTable.end(); ++it) { const SwRangeRedline* pTmp = *it; - sal_uLong nStart = pTmp->Start()->nNode.GetIndex(), + SwNodeOffset nStart = pTmp->Start()->nNode.GetIndex(), nEnd = pTmp->End()->nNode.GetIndex(); if( ( RedlineType::Any == nType || nType == pTmp->GetType()) && @@ -2659,9 +2659,9 @@ SwRedlineTable::size_type DocumentRedlineManager::GetRedlinePos( const SwNode& r for( SwRedlineTable::size_type n = 0; n < maRedlineTable.size() ; ++n ) { const SwRangeRedline* pTmp = maRedlineTable[ n ]; - sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(), + SwNodeOffset nPt = pTmp->GetPoint()->nNode.GetIndex(), nMk = pTmp->GetMark()->nNode.GetIndex(); - if( nPt < nMk ) { tools::Long nTmp = nMk; nMk = nPt; nPt = nTmp; } + if( nPt < nMk ) { SwNodeOffset nTmp = nMk; nMk = nPt; nPt = nTmp; } if( ( RedlineType::Any == nType || nType == pTmp->GetType()) && nMk <= nNdIdx && nNdIdx <= nPt ) @@ -2897,15 +2897,15 @@ void DocumentRedlineManager::AcceptRedlineParagraphFormatting( const SwPaM &rPam const SwPosition* pStt = rPam.Start(), * pEnd = rPam.End(); - const sal_uLong nSttIdx = pStt->nNode.GetIndex(); - const sal_uLong nEndIdx = pEnd->nNode.GetIndex(); + const SwNodeOffset nSttIdx = pStt->nNode.GetIndex(); + const SwNodeOffset nEndIdx = pEnd->nNode.GetIndex(); for( SwRedlineTable::size_type n = 0; n < maRedlineTable.size() ; ++n ) { const SwRangeRedline* pTmp = maRedlineTable[ n ]; - sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(), + SwNodeOffset nPt = pTmp->GetPoint()->nNode.GetIndex(), nMk = pTmp->GetMark()->nNode.GetIndex(); - if( nPt < nMk ) { tools::Long nTmp = nMk; nMk = nPt; nPt = nTmp; } + if( nPt < nMk ) { SwNodeOffset nTmp = nMk; nMk = nPt; nPt = nTmp; } if( RedlineType::ParagraphFormat == pTmp->GetType() && ( (nSttIdx <= nMk && nMk <= nEndIdx) || (nSttIdx <= nPt && nPt <= nEndIdx) ) ) diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx index ead31cbd332a..0dd547180fc9 100644 --- a/sw/source/core/doc/DocumentStatisticsManager.cxx +++ b/sw/source/core/doc/DocumentStatisticsManager.cxx @@ -107,7 +107,7 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(tools::Long nChars, mpDocStat->nPara = 0; // default is 1! // This is the inner loop - at least while the paras are dirty. - for( sal_uLong i = m_rDoc.GetNodes().Count(); i > 0 && nChars > 0; ) + for( SwNodeOffset i = m_rDoc.GetNodes().Count(); i > SwNodeOffset(0) && nChars > 0; ) { SwNode* pNd = m_rDoc.GetNodes()[ --i ]; switch( pNd->GetNodeType() ) diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index 8fafec98634c..d86f7612184d 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -318,7 +318,7 @@ static OUString lcl_dbg_out(const SwPosition & rPos) { OUString aStr = "( " + - OUString::number(rPos.nNode.GetIndex()) + + OUString::number(sal_Int32(rPos.nNode.GetIndex())) + ", " + OUString::number(rPos.nContent.GetIndex()) + ": " + @@ -487,7 +487,7 @@ static OUString lcl_dbg_out(const SwNode & rNode) OUString aTmpStr = "<node " "index=\"" + - OUString::number(rNode.GetIndex()) + + OUString::number(sal_Int32(rNode.GetIndex())) + "\"" " serial=\"" + OUString::number(rNode.GetSerial()) + @@ -597,7 +597,7 @@ static OUString lcl_dbg_out(const SwNode & rNode) const SwStartNode * pStartNode = dynamic_cast<const SwStartNode *> (&rNode); if (pStartNode != nullptr) - aTmpStr += OUString::number(pStartNode->EndOfSectionNode()->GetIndex()); + aTmpStr += OUString::number(sal_Int32(pStartNode->EndOfSectionNode()->GetIndex())); aTmpStr += "\"/>"; } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 1dec7c289674..a66eb953fcb2 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1186,7 +1186,7 @@ void SwDoc::InvalidateAutoCompleteFlag() o3tl::sorted_vector<SwRootFrame*> aAllLayouts = GetAllLayouts(); for( auto aLayout : aAllLayouts ) aLayout->AllInvalidateAutoCompleteWords(); - for( sal_uLong nNd = 1, nCnt = GetNodes().Count(); nNd < nCnt; ++nNd ) + for( SwNodeOffset nNd(1), nCnt = GetNodes().Count(); nNd < nCnt; ++nNd ) { SwTextNode* pTextNode = GetNodes()[ nNd ]->GetTextNode(); if ( pTextNode ) pTextNode->SetAutoCompleteWordDirty( true ); @@ -1226,14 +1226,14 @@ void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImp for( SwOutlineNodes::size_type i = 0; i < rOutNds.size(); ++i ) { ::SetProgressState( static_cast<tools::Long>(i), GetDocShell() ); - const sal_uLong nIndex = rOutNds[ i ]->GetIndex(); + const SwNodeOffset nIndex = rOutNds[ i ]->GetIndex(); const int nLvl = GetNodes()[ nIndex ]->GetTextNode()->GetAttrOutlineLevel()-1; if( nLvl > nLevel ) continue; - tools::Long nEndOfs = 1; + SwNodeOffset nEndOfs(1); sal_uInt8 nWish = nPara; - sal_uLong nNextOutNd = i + 1 < rOutNds.size() ? + SwNodeOffset nNextOutNd = i + 1 < rOutNds.size() ? rOutNds[ i + 1 ]->GetIndex() : GetNodes().Count(); bool bKeep = false; while( ( nWish || bKeep ) && nIndex + nEndOfs < nNextOutNd && @@ -1246,7 +1246,7 @@ void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImp ++nEndOfs; } - SwNodeRange aRange( *rOutNds[ i ], 0, *rOutNds[ i ], nEndOfs ); + SwNodeRange aRange( *rOutNds[ i ], SwNodeOffset(0), *rOutNds[ i ], nEndOfs ); GetNodes().Copy_( aRange, aEndOfDoc ); } const SwTextFormatColls *pColl = rExtDoc.GetTextFormatColls(); @@ -1275,7 +1275,7 @@ void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImp pNd->ChgFormatColl( pMyColl ); } if( !pNd->Len() && - pNd->StartOfSectionIndex()+2 < pNd->EndOfSectionIndex() ) + pNd->StartOfSectionIndex()+SwNodeOffset(2) < pNd->EndOfSectionIndex() ) { bDelete = true; rExtDoc.GetNodes().Delete( aIndx ); @@ -1298,8 +1298,8 @@ void RemoveOrDeleteContents(SwTextNode* pTextNd, IDocumentContentOperations& xOp // 1. removing the paragraph would result in an empty section or // 2. if the paragraph is the last paragraph in the section and // there is no paragraph in front of the paragraph: - if ((2 == pTextNd->EndOfSectionIndex() - pTextNd->StartOfSectionIndex()) - || (1 == pTextNd->EndOfSectionIndex() - pTextNd->GetIndex() + if ((SwNodeOffset(2) == pTextNd->EndOfSectionIndex() - pTextNd->StartOfSectionIndex()) + || (SwNodeOffset(1) == pTextNd->EndOfSectionIndex() - pTextNd->GetIndex() && !pTextNd->GetNodes()[pTextNd->GetIndex() - 1]->GetTextNode())) { xOperations.DeleteRange(aPam); @@ -1401,7 +1401,7 @@ bool SwDoc::RemoveInvisibleContent() } // Remove any hidden paragraph (hidden text attribute) - for( sal_uLong n = GetNodes().Count(); n; ) + for( SwNodeOffset n = GetNodes().Count(); n; ) { SwTextNode* pTextNd = GetNodes()[ --n ]->GetTextNode(); if ( pTextNd ) @@ -1412,7 +1412,7 @@ bool SwDoc::RemoveInvisibleContent() bRemoved = true; bRet = true; - if (2 == pTextNd->EndOfSectionIndex() - pTextNd->StartOfSectionIndex()) + if (SwNodeOffset(2) == pTextNd->EndOfSectionIndex() - pTextNd->StartOfSectionIndex()) { SwFrameFormat *const pFormat = pTextNd->StartOfSectionNode()->GetFlyFormat(); if (nullptr != pFormat) @@ -1540,7 +1540,7 @@ bool SwDoc::HasInvisibleContent() const return true; // Search for any hidden paragraph (hidden text attribute) - for( sal_uLong n = GetNodes().Count()-1; n; --n) + for( SwNodeOffset n = GetNodes().Count()-SwNodeOffset(1); n; --n) { SwTextNode* pTextNd = GetNodes()[ n ]->GetTextNode(); if ( pTextNd && @@ -1762,7 +1762,7 @@ OUString SwDoc::GetPaMDescr(const SwPaM & rPam) bool SwDoc::ContainsHiddenChars() const { - for( sal_uLong n = GetNodes().Count(); n; ) + for( SwNodeOffset n = GetNodes().Count(); n; ) { SwNode* pNd = GetNodes()[ --n ]; if ( pNd->IsTextNode() && pNd->GetTextNode()->HasHiddenCharAttribute( false ) ) diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 56510b143ab0..e9c0ce701eba 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -461,9 +461,9 @@ namespace const SwPosition* const pStPos = &pMark->GetMarkStart(); const SwPosition* const pEndPos = &pMark->GetMarkEnd(); SAL_INFO("sw.core", - pStPos->nNode.GetIndex() << "," << + sal_Int32(pStPos->nNode.GetIndex()) << "," << pStPos->nContent.GetIndex() << " " << - pEndPos->nNode.GetIndex() << "," << + sal_Int32(pEndPos->nNode.GetIndex()) << "," << pEndPos->nContent.GetIndex() << " " << typeid(*pMark).name() << " " << pMark->GetName()); @@ -555,9 +555,9 @@ namespace sw::mark pPos2 = rPaM.GetMark(); SAL_INFO("sw.core", rName << " " << - pPos1->nNode.GetIndex() << "," << + sal_Int32(pPos1->nNode.GetIndex() )<< "," << pPos1->nContent.GetIndex() << " " << - pPos2->nNode.GetIndex() << "," << + sal_Int32(pPos2->nNode.GetIndex()) << "," << pPos2->nContent.GetIndex()); } #endif @@ -1834,7 +1834,7 @@ SaveBookmark::SaveBookmark( } else { - m_nNode2 = ULONG_MAX; + m_nNode2 = NODE_OFFSET_MAX; m_nContent2 = -1; } } @@ -1848,7 +1848,7 @@ void SaveBookmark::SetInDoc( if(pIdx) aPam.GetPoint()->nContent = *pIdx; - if(ULONG_MAX != m_nNode2) + if(NODE_OFFSET_MAX != m_nNode2) { aPam.SetMark(); diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 97f7acc35dd7..bc6e3fc0c78b 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -93,8 +93,8 @@ private: std::unique_ptr<SwPaM> m_pInsertRing, m_pDelRing; - static sal_uLong PrevIdx( const SwNode* pNd ); - static sal_uLong NextIdx( const SwNode* pNd ); + static SwNodeOffset PrevIdx( const SwNode* pNd ); + static SwNodeOffset NextIdx( const SwNode* pNd ); vector<SwCompareLine> m_aLines; bool m_bRecordDiff; @@ -1218,7 +1218,7 @@ OUString SwCompareLine::GetText() const case SectionType::Content: if( rSect.IsProtect() ) sRet += OUString::number( - rSNd.EndOfSectionIndex() - rSNd.GetIndex() ); + sal_Int32(rSNd.EndOfSectionIndex() - rSNd.GetIndex()) ); break; case SectionType::ToxHeader: @@ -1408,7 +1408,7 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine, return bRet; } -sal_uLong CompareData::NextIdx( const SwNode* pNd ) +SwNodeOffset CompareData::NextIdx( const SwNode* pNd ) { if( pNd->IsStartNode() ) { @@ -1426,7 +1426,7 @@ sal_uLong CompareData::NextIdx( const SwNode* pNd ) return pNd->GetIndex() + 1; } -sal_uLong CompareData::PrevIdx( const SwNode* pNd ) +SwNodeOffset CompareData::PrevIdx( const SwNode* pNd ) { if( pNd->IsEndNode() ) { @@ -1452,11 +1452,11 @@ void CompareData::CheckRanges( CompareData& rData ) const SwNode& rSrcEndNd = rData.GetEndOfContent(); const SwNode& rDstEndNd = GetEndOfContent(); - sal_uLong nSrcSttIdx = NextIdx( rSrcEndNd.StartOfSectionNode() ); - sal_uLong nSrcEndIdx = rSrcEndNd.GetIndex(); + SwNodeOffset nSrcSttIdx = NextIdx( rSrcEndNd.StartOfSectionNode() ); + SwNodeOffset nSrcEndIdx = rSrcEndNd.GetIndex(); - sal_uLong nDstSttIdx = NextIdx( rDstEndNd.StartOfSectionNode() ); - sal_uLong nDstEndIdx = rDstEndNd.GetIndex(); + SwNodeOffset nDstSttIdx = NextIdx( rDstEndNd.StartOfSectionNode() ); + SwNodeOffset nDstEndIdx = rDstEndNd.GetIndex(); while( nSrcSttIdx < nSrcEndIdx && nDstSttIdx < nDstEndIdx ) { @@ -1515,17 +1515,17 @@ void CompareData::ShowDelete( sal_uLong nInsPos ) { SwNodeRange aRg( - rData.GetLine( nStt ).GetNode(), 0, - rData.GetLine( nEnd-1 ).GetEndNode(), 1 ); + rData.GetLine( nStt ).GetNode(), SwNodeOffset(0), + rData.GetLine( nEnd-1 ).GetEndNode(), SwNodeOffset(1) ); - sal_uInt16 nOffset = 0; + SwNodeOffset nOffset(0); std::optional<SwCompareLine> xLine; if( nInsPos >= 1 ) { if( GetLineCount() == nInsPos ) { xLine = GetLine( nInsPos-1 ); - nOffset = 1; + nOffset = SwNodeOffset(1); } else xLine = GetLine( nInsPos ); @@ -1542,7 +1542,7 @@ void CompareData::ShowDelete( else { pLineNd = &GetEndOfContent(); - nOffset = 0; + nOffset = SwNodeOffset(0); } SwNodeIndex aInsPos( *pLineNd, nOffset ); @@ -1557,7 +1557,7 @@ void CompareData::ShowDelete( // To avoid unwanted insertions of delete-redlines into these new redlines, what happens // especially at the end of the document, I reduce the SwPaM by one node. // Before the new redlines are inserted, they have to expand again. - SwPaM* pTmp = new SwPaM( aSavePos.GetNode(), aInsPos.GetNode(), 0, -1, m_pDelRing.get() ); + SwPaM* pTmp = new SwPaM( aSavePos.GetNode(), aInsPos.GetNode(), SwNodeOffset(0), SwNodeOffset(-1), m_pDelRing.get() ); if( !m_pDelRing ) m_pDelRing.reset(pTmp); @@ -2100,11 +2100,11 @@ tools::Long SwDoc::MergeDoc( const SwDoc& rDoc ) // look for all insert redlines from the SourceDoc and determine their position in the DestDoc std::vector<SaveMergeRedline> vRedlines; const SwRedlineTable& rSrcRedlTable = rSrcDoc.getIDocumentRedlineAccess().GetRedlineTable(); - sal_uLong nEndOfExtra = rSrcDoc.GetNodes().GetEndOfExtras().GetIndex(); - sal_uLong nMyEndOfExtra = GetNodes().GetEndOfExtras().GetIndex(); + SwNodeOffset nEndOfExtra = rSrcDoc.GetNodes().GetEndOfExtras().GetIndex(); + SwNodeOffset nMyEndOfExtra = GetNodes().GetEndOfExtras().GetIndex(); for(const SwRangeRedline* pRedl : rSrcRedlTable) { - sal_uLong nNd = pRedl->GetPoint()->nNode.GetIndex(); + SwNodeOffset nNd = pRedl->GetPoint()->nNode.GetIndex(); RedlineType eType = pRedl->GetType(); if( nEndOfExtra < nNd && ( RedlineType::Insert == eType || RedlineType::Delete == eType )) diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index a4de7277fc63..31058b4caf62 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -292,7 +292,7 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHe // the left or first header attribute. SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() ); SwStartNode* pSttNd = SwNodes::MakeEmptySection( aTmp, SwHeaderStartNode ); - SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), 0, + SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), SwNodeOffset(0), *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() ); aTmp = *pSttNd->EndOfSectionNode(); GetNodes().Copy_( aRange, aTmp, false ); @@ -366,7 +366,7 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFo // the left footer attribute. SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() ); SwStartNode* pSttNd = SwNodes::MakeEmptySection( aTmp, SwFooterStartNode ); - SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), 0, + SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), SwNodeOffset(0), *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() ); aTmp = *pSttNd->EndOfSectionNode(); GetNodes().Copy_( aRange, aTmp, false ); @@ -463,7 +463,7 @@ void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged ) { SwNodeIndex aIdx(*rCnt.GetContentIdx(), 0); pNode = &aIdx.GetNode(); - sal_uInt32 nEnd = pNode->EndOfSectionIndex(); + SwNodeOffset nEnd = pNode->EndOfSectionIndex(); while (aIdx < nEnd) { if (pNode->IsContentNode() && diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index b588a1db8eea..57fffff87b18 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -86,7 +86,7 @@ void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos, { aPos.nNode = rStartPos.nNode.GetIndex() + rSave.nNdDiff; aPos.nContent.Assign(dynamic_cast<SwIndexReg*>(&aPos.nNode.GetNode()), - rSave.nNdDiff == 0 + rSave.nNdDiff == SwNodeOffset(0) ? rStartPos.nContent.GetIndex() + rSave.nContentIndex : rSave.nContentIndex); } @@ -534,8 +534,8 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, pEndPos->nNode.GetNode().GetTextNode(), pEndPos->nContent, bGrammarCheck )); - sal_uLong nCurrNd = pSttPos->nNode.GetIndex(); - sal_uLong nEndNd = pEndPos->nNode.GetIndex(); + SwNodeOffset nCurrNd = pSttPos->nNode.GetIndex(); + SwNodeOffset nEndNd = pEndPos->nNode.GetIndex(); uno::Any aRet; if( nCurrNd <= nEndNd ) @@ -703,7 +703,7 @@ class SwHyphArgs : public SwInterHyphInfo sal_uInt16 *m_pPageCnt; sal_uInt16 *m_pPageSt; - sal_uInt32 m_nNode; + SwNodeOffset m_nNode; sal_Int32 m_nPamStart; sal_Int32 m_nPamLen; @@ -843,8 +843,8 @@ void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat ) const SwPosition* pStt = rPaM.Start(); const SwPosition* pEnd = rPaM.End(); - const sal_uLong nSttNd = pStt->nNode.GetIndex(); - const sal_uLong nEndNd = pEnd->nNode.GetIndex(); + const SwNodeOffset nSttNd = pStt->nNode.GetIndex(); + const SwNodeOffset nEndNd = pEnd->nNode.GetIndex(); const sal_Int32 nSttCnt = pStt->nContent.GetIndex(); const sal_Int32 nEndCnt = pEnd->nContent.GetIndex(); diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index dd4232885689..2a10c63debc9 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -129,7 +129,7 @@ SetGetExpField::SetGetExpField( const SwTableBox& rTBox ) m_eSetGetExpFieldType = TABLEBOX; m_CNTNT.pTBox = &rTBox; - m_nNode = 0; + m_nNode = SwNodeOffset(0); m_nContent = 0; if( rTBox.GetSttNd() ) { @@ -845,11 +845,11 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) { // In order for the frames to be created the right way, they have to be expanded // from top to bottom - std::vector<sal_uLong> aTmpArr; - std::vector<sal_uLong>::size_type nArrStt = 0; + std::vector<SwNodeOffset> aTmpArr; + std::vector<SwNodeOffset>::size_type nArrStt = 0; SwSectionFormats& rArr = rDoc.GetSections(); SwSectionNode* pSectNd = nullptr; - sal_uLong nSttContent = rDoc.GetNodes().GetEndOfExtras().GetIndex(); + SwNodeOffset nSttContent = rDoc.GetNodes().GetEndOfExtras().GetIndex(); for (SwSectionFormats::size_type n = rArr.size(); n; ) { @@ -859,7 +859,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) pSectNd = pSect->GetFormat()->GetSectionNode(); if( pSectNd ) { - sal_uLong nIdx = pSectNd->GetIndex(); + SwNodeOffset nIdx = pSectNd->GetIndex(); aTmpArr.push_back( nIdx ); if( nIdx < nSttContent ) ++nArrStt; diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 8293ef06bc31..6b73f1f756b5 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -1041,8 +1041,8 @@ SwChainRet SwDoc::Chainable( const SwFrameFormat &rSource, const SwFrameFormat & if( !pTextNd ) return SwChainRet::NOT_FOUND; - const sal_uLong nFlySttNd = pCntIdx->GetIndex(); - if( 2 != ( pCntIdx->GetNode().EndOfSectionIndex() - nFlySttNd ) || + const SwNodeOffset nFlySttNd = pCntIdx->GetIndex(); + if( SwNodeOffset(2) != ( pCntIdx->GetNode().EndOfSectionIndex() - nFlySttNd ) || pTextNd->GetText().getLength() ) { return SwChainRet::NOT_EMPTY; @@ -1057,8 +1057,8 @@ SwChainRet SwDoc::Chainable( const SwFrameFormat &rSource, const SwFrameFormat & continue; if ( nullptr == rAnchor.GetContentAnchor() ) continue; - sal_uLong nTstSttNd = rAnchor.GetContentAnchor()->nNode.GetIndex(); - if( nFlySttNd <= nTstSttNd && nTstSttNd < nFlySttNd + 2 ) + SwNodeOffset nTstSttNd = rAnchor.GetContentAnchor()->nNode.GetIndex(); + if( nFlySttNd <= nTstSttNd && nTstSttNd < nFlySttNd + SwNodeOffset(2) ) { return SwChainRet::NOT_EMPTY; } @@ -1072,7 +1072,7 @@ SwChainRet SwDoc::Chainable( const SwFrameFormat &rSource, const SwFrameFormat & // both in the same fly, header, footer or on the page? const SwFormatAnchor &rSrcAnchor = rSource.GetAnchor(), &rDstAnchor = rDest.GetAnchor(); - sal_uLong nEndOfExtras = GetNodes().GetEndOfExtras().GetIndex(); + SwNodeOffset nEndOfExtras = GetNodes().GetEndOfExtras().GetIndex(); bool bAllowed = false; if ( RndStdIds::FLY_AT_PAGE == rSrcAnchor.GetAnchorId() ) { diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index bbc450438034..42dfd707c556 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1405,7 +1405,7 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, ? SwHeaderStartNode : SwFooterStartNode ); const SwNode& rCSttNd = pContent->GetContentIdx()->GetNode(); - SwNodeRange aRg( rCSttNd, 0, *rCSttNd.EndOfSectionNode() ); + SwNodeRange aRg( rCSttNd, SwNodeOffset(0), *rCSttNd.EndOfSectionNode() ); aTmpIdx = *pSttNd->EndOfSectionNode(); rSrcNds.Copy_( aRg, aTmpIdx ); aTmpIdx = *pSttNd; diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index add4cd3e15a6..376994160e7d 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -436,9 +436,9 @@ bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr, SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout(); const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End(); - const sal_uLong nSttNd = pStt->nNode.GetIndex(); + const SwNodeOffset nSttNd = pStt->nNode.GetIndex(); const sal_Int32 nSttCnt = pStt->nContent.GetIndex(); - const sal_uLong nEndNd = pEnd->nNode.GetIndex(); + const SwNodeOffset nEndNd = pEnd->nNode.GetIndex(); const sal_Int32 nEndCnt = pEnd->nContent.GetIndex(); size_t nPos = 0; @@ -457,7 +457,7 @@ bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr, while( nPos < rFootnoteArr.size() ) { SwTextFootnote* pTextFootnote = rFootnoteArr[ nPos++ ]; - sal_uLong nIdx = SwTextFootnote_GetIndex(pTextFootnote); + SwNodeOffset nIdx = SwTextFootnote_GetIndex(pTextFootnote); if( nIdx >= nEndNd && ( nIdx != nEndNd || nEndCnt < pTextFootnote->GetStart() ) ) continue; @@ -491,7 +491,7 @@ bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr, while( nPos ) { SwTextFootnote* pTextFootnote = rFootnoteArr[ --nPos ]; - sal_uLong nIdx = SwTextFootnote_GetIndex(pTextFootnote); + SwNodeOffset nIdx = SwTextFootnote_GetIndex(pTextFootnote); if( nIdx <= nSttNd && ( nIdx != nSttNd || nSttCnt > pTextFootnote->GetStart() ) ) continue; diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 4ed288c79bf7..3f5546f9fe94 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -305,7 +305,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, if( mpOutlineRule ) pDoc->SetOutlineNumRule( *mpOutlineRule ); - SwNodeRange aRg( *pStartNd, 0, aEndIdx.GetNode() ); + SwNodeRange aRg( *pStartNd, SwNodeOffset(0), aEndIdx.GetNode() ); SwNodeIndex aTmpIdx( pDoc->GetNodes().GetEndOfContent() ); GetDocumentContentOperationsManager().CopyWithFlyInFly( aRg, aTmpIdx, nullptr, false, false); @@ -348,11 +348,11 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, { // Delete all nodes in the section and, in the "start node", // set the Link to the saved document. - sal_uLong nNodeDiff = aEndIdx.GetIndex() - + SwNodeOffset nNodeDiff = aEndIdx.GetIndex() - pStartNd->GetIndex() - 1; if( nNodeDiff ) { - SwPaM aTmp( *pStartNd, aEndIdx.GetNode(), 1, -1 ); + SwPaM aTmp( *pStartNd, aEndIdx.GetNode(), SwNodeOffset(1), SwNodeOffset(-1) ); aTmp.GetPoint()->nContent.Assign( nullptr, 0 ); aTmp.GetMark()->nContent.Assign( nullptr, 0 ); SwNodeIndex aSIdx( aTmp.GetMark()->nNode ); @@ -450,7 +450,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, // they are fully enclosed in [pSectNd,aEndIdx]. if( aEndIdx < pSectNd->EndOfSectionIndex() ) { - SwNodeRange aRg( *pSectNd, 1, aEndIdx, 1 ); + SwNodeRange aRg( *pSectNd, SwNodeOffset(1), aEndIdx, SwNodeOffset(1) ); SwNodeIndex aIdx( *pSectNd ); GetNodes().MoveNodes( aRg, GetNodes(), aIdx ); } diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx index 269d00ad88fc..15a54a63a9f5 100644 --- a/sw/source/core/doc/docglos.cxx +++ b/sw/source/core/doc/docglos.cxx @@ -164,7 +164,7 @@ bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry, aCpyPam.SetMark(); // till the nodes array's end - aCpyPam.GetPoint()->nNode = pGDoc->GetNodes().GetEndOfContent().GetIndex()-1; + aCpyPam.GetPoint()->nNode = pGDoc->GetNodes().GetEndOfContent().GetIndex()-SwNodeOffset(1); pContentNd = aCpyPam.GetContentNode(); aCpyPam.GetPoint()->nContent.Assign( pContentNd, pContentNd ? pContentNd->Len() : 0 ); @@ -177,7 +177,7 @@ bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry, SwStartNode* pBoxSttNd = const_cast<SwStartNode*>(rInsPos.nNode.GetNode(). FindTableBoxStartNode()); - if( pBoxSttNd && 2 == pBoxSttNd->EndOfSectionIndex() - + if( pBoxSttNd && SwNodeOffset(2) == pBoxSttNd->EndOfSectionIndex() - pBoxSttNd->GetIndex() && aCpyPam.GetPoint()->nNode != aCpyPam.GetMark()->nNode ) { diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 5c5d92a26270..7d3ad61e46b4 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -172,7 +172,7 @@ SwFlyFrameFormat* SwDoc::MakeFlySection_( const SwPosition& rAnchPos, // Create content and connect to the format. // Create ContentNode and put it into the autotext selection. - SwNodeRange aRange( GetNodes().GetEndOfAutotext(), -1, + SwNodeRange aRange( GetNodes().GetEndOfAutotext(), SwNodeOffset(-1), GetNodes().GetEndOfAutotext() ); GetNodes().SectionDown( &aRange, SwFlyStartNode ); @@ -275,7 +275,7 @@ SwFlyFrameFormat* SwDoc::MakeFlySection_( const SwPosition& rAnchPos, if (GetIDocumentUndoRedo().DoesUndo()) { - sal_uLong nNodeIdx = rAnchPos.nNode.GetIndex(); + SwNodeOffset nNodeIdx = rAnchPos.nNode.GetIndex(); const sal_Int32 nCntIdx = rAnchPos.nContent.GetIndex(); GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoInsLayFormat>( pFormat, nNodeIdx, nCntIdx )); @@ -385,7 +385,7 @@ SwFlyFrameFormat* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rS if( pSelBoxes->size() == rTable.GetTabSortBoxes().size() ) { // move the whole table - SwNodeRange aRg( *pTableNd, 0, *pTableNd->EndOfSectionNode(), 1 ); + SwNodeRange aRg( *pTableNd, SwNodeOffset(0), *pTableNd->EndOfSectionNode(), SwNodeOffset(1) ); // If we move the whole table and it is located within a // FlyFrame, the we create a TextNode after it. @@ -471,11 +471,11 @@ static bool lcl_TstFlyRange( const SwPaM* pPam, const SwPosition* pFlyPos, bool bOk = false; const SwPaM* pTmp = pPam; do { - const sal_uInt32 nFlyIndex = pFlyPos->nNode.GetIndex(); + const SwNodeOffset nFlyIndex = pFlyPos->nNode.GetIndex(); const SwPosition* pPaMStart = pTmp->Start(); const SwPosition* pPaMEnd = pTmp->End(); - const sal_uInt32 nPamStartIndex = pPaMStart->nNode.GetIndex(); - const sal_uInt32 nPamEndIndex = pPaMEnd->nNode.GetIndex(); + const SwNodeOffset nPamStartIndex = pPaMStart->nNode.GetIndex(); + const SwNodeOffset nPamEndIndex = pPaMEnd->nNode.GetIndex(); if (RndStdIds::FLY_AT_PARA == nAnchorId) bOk = (nPamStartIndex < nFlyIndex && nPamEndIndex > nFlyIndex) || (((nPamStartIndex == nFlyIndex) && (pPaMStart->nContent.GetIndex() == 0)) && @@ -632,7 +632,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable, SwUndoInsertLabel *const pUndo, SwLabelType const eType, std::u16string_view rText, std::u16string_view rSeparator, const OUString& rNumberingSeparator, - const bool bBefore, const sal_uInt16 nId, const sal_uLong nNdIdx, + const bool bBefore, const sal_uInt16 nId, const SwNodeOffset nNdIdx, const OUString& rCharacterStyle, const bool bCpyBrd ) { @@ -679,7 +679,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable, { SwStartNode *pSttNd = rDoc.GetNodes()[nNdIdx]->GetStartNode(); OSL_ENSURE( pSttNd, "No StartNode in InsertLabel." ); - sal_uLong nNode; + SwNodeOffset nNode; if( bBefore ) { nNode = pSttNd->GetIndex(); @@ -962,7 +962,7 @@ SwFlyFrameFormat * SwDoc::InsertLabel( SwLabelType const eType, OUString const& rText, OUString const& rSeparator, OUString const& rNumberingSeparator, - bool const bBefore, sal_uInt16 const nId, sal_uLong const nNdIdx, + bool const bBefore, sal_uInt16 const nId, SwNodeOffset const nNdIdx, OUString const& rCharacterStyle, bool const bCpyBrd ) { diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 1c2d6b3f3f96..c0a03a5b4c18 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -879,7 +879,7 @@ void SwDoc::ReplaceCompatibilityOptions(const SwDoc& rSource) #ifdef DBG_UTIL #define CNTNT_DOC( doc ) \ - ((doc)->GetNodes().GetEndOfContent().GetIndex() - (doc)->GetNodes().GetEndOfExtras().GetIndex() - 2) + ((doc)->GetNodes().GetEndOfContent().GetIndex() - (doc)->GetNodes().GetEndOfExtras().GetIndex() - SwNodeOffset(2)) #define CNTNT_IDX( idx ) \ ((idx).GetNode().GetIndex() - GetNodes().GetEndOfExtras().GetIndex() - 1) #endif @@ -1185,9 +1185,9 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu // Update the rsid of each pasted text node SwNodes &rDestNodes = GetNodes(); - sal_uLong const nEndIdx = aPaM.End()->nNode.GetIndex(); + SwNodeOffset const nEndIdx = aPaM.End()->nNode.GetIndex(); - for (sal_uLong nIdx = aPaM.Start()->nNode.GetIndex(); + for (SwNodeOffset nIdx = aPaM.Start()->nNode.GetIndex(); nIdx <= nEndIdx; ++nIdx) { SwTextNode *const pTextNode = rDestNodes[nIdx]->GetTextNode(); @@ -1197,7 +1197,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu } { - sal_uLong iDelNodes = 0; + SwNodeOffset iDelNodes(0); SwNodeIndex aDelIdx( aFixupIdx ); // we just need to set the new page description and reset numbering diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 60b8d82e7aa2..846277bbde98 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -540,7 +540,7 @@ bool SwDoc::MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type else pNd = GetNodes().GetOutLineNds()[ nCurrentPos + nOffset ]; - sal_uLong nNewPos = pNd->GetIndex(); + SwNodeOffset nNewPos = pNd->GetIndex(); // And now a correction of the insert position if necessary... SwNodeIndex aInsertPos( *pNd, -1 ); @@ -589,10 +589,10 @@ bool SwDoc::MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type // If a Position inside the special nodes array sections was calculated, // set it to document start instead. // Sections or Tables at the document start will be pushed backwards. - nNewPos = std::max( nNewPos, GetNodes().GetEndOfExtras().GetIndex() + 2 ); + nNewPos = std::max( nNewPos, GetNodes().GetEndOfExtras().GetIndex() + SwNodeOffset(2) ); - tools::Long nOffs = nNewPos - ( 0 < nOffset ? aEndRg.GetIndex() : aSttRg.GetIndex()); - SwPaM aPam( aSttRg, aEndRg, 0, -1 ); + SwNodeOffset nOffs = nNewPos - ( 0 < nOffset ? aEndRg.GetIndex() : aSttRg.GetIndex()); + SwPaM aPam( aSttRg, aEndRg, SwNodeOffset(0), SwNodeOffset(-1) ); return MoveParagraph( aPam, nOffs, true ); } @@ -1239,9 +1239,9 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM) bool bFirst = true; - const sal_uLong nStt = rPaM.Start()->nNode.GetIndex(); - const sal_uLong nEnd = rPaM.End()->nNode.GetIndex(); - for (sal_uLong n = nStt; n <= nEnd; n++) + const SwNodeOffset nStt = rPaM.Start()->nNode.GetIndex(); + const SwNodeOffset nEnd = rPaM.End()->nNode.GetIndex(); + for (SwNodeOffset n = nStt; n <= nEnd; n++) { SwTextNode * pCNd = GetNodes()[n]->GetTextNode(); @@ -1322,8 +1322,8 @@ void SwDoc::DelNumRules(const SwPaM& rPam, SwRootFrame const*const pLayout) { SwPaM aPam(rPam, nullptr); ExpandPamForParaPropsNodes(aPam, pLayout); - sal_uLong nStt = aPam.Start()->nNode.GetIndex(); - sal_uLong const nEnd = aPam.End()->nNode.GetIndex(); + SwNodeOffset nStt = aPam.Start()->nNode.GetIndex(); + SwNodeOffset const nEnd = aPam.End()->nNode.GetIndex(); SwUndoDelNum* pUndo; if (GetIDocumentUndoRedo().DoesUndo()) @@ -1554,7 +1554,7 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext, } while( bNext ? ( aIdx.GetIndex() < aIdx.GetNodes().Count() - 1 ) - : aIdx.GetIndex() != 0 ) + : aIdx.GetIndex() != SwNodeOffset(0) ) { if( aIdx.GetNode().IsTextNode() ) { @@ -1707,13 +1707,13 @@ bool SwDoc::NumUpDown(const SwPaM& rPam, bool bDown, SwRootFrame const*const pLa { SwPaM aPam(rPam, nullptr); ExpandPamForParaPropsNodes(aPam, pLayout); - sal_uLong nStt = aPam.Start()->nNode.GetIndex(); - sal_uLong const nEnd = aPam.End()->nNode.GetIndex(); + SwNodeOffset nStt = aPam.Start()->nNode.GetIndex(); + SwNodeOffset const nEnd = aPam.End()->nNode.GetIndex(); // -> outline nodes are promoted or demoted differently bool bOnlyOutline = true; bool bOnlyNonOutline = true; - for (sal_uLong n = nStt; n <= nEnd; n++) + for (SwNodeOffset n = nStt; n <= nEnd; n++) { SwTextNode * pTextNd = GetNodes()[n]->GetTextNode(); @@ -1746,7 +1746,7 @@ bool SwDoc::NumUpDown(const SwPaM& rPam, bool bDown, SwRootFrame const*const pLa Only promote or demote if all selected paragraphs are promotable resp. demotable. */ - for (sal_uLong nTmp = nStt; nTmp <= nEnd; ++nTmp) + for (SwNodeOffset nTmp = nStt; nTmp <= nEnd; ++nTmp) { SwTextNode* pTNd = GetNodes()[ nTmp ]->GetTextNode(); @@ -1780,7 +1780,7 @@ bool SwDoc::NumUpDown(const SwPaM& rPam, bool bDown, SwRootFrame const*const pLa } SwTextNode* pPrev = nullptr; - for(sal_uLong nTmp = nStt; nTmp <= nEnd; ++nTmp ) + for(SwNodeOffset nTmp = nStt; nTmp <= nEnd; ++nTmp ) { SwTextNode* pTNd = GetNodes()[ nTmp ]->GetTextNode(); @@ -1819,7 +1819,7 @@ bool SwDoc::NumUpDown(const SwPaM& rPam, bool bDown, SwRootFrame const*const pLa // this function doesn't contain any numbering-related code, but it is // primarily called to move numbering-relevant paragraphs around, hence // it will expand its selection to include full SwTextFrames. -bool SwDoc::MoveParagraph(SwPaM& rPam, tools::Long nOffset, bool const bIsOutlMv) +bool SwDoc::MoveParagraph(SwPaM& rPam, SwNodeOffset nOffset, bool const bIsOutlMv) { MakeAllOutlineContentTemporarilyVisible a(this); @@ -1840,12 +1840,12 @@ bool SwDoc::MoveParagraph(SwPaM& rPam, tools::Long nOffset, bool const bIsOutlMv if (nodes.first && nodes.first != &rPam.Start()->nNode.GetNode()) { assert(nodes.second); - if (nOffset < 0) + if (nOffset < SwNodeOffset(0)) { nOffset += rPam.Start()->nNode.GetIndex() - nodes.first->GetIndex(); - if (0 <= nOffset) // hack: there are callers that know what + if (SwNodeOffset(0) <= nOffset) // hack: there are callers that know what { // node they want; those should never need - nOffset = -1; // this; other callers just pass in -1 + nOffset = SwNodeOffset(-1); // this; other callers just pass in -1 } // and those should still move } if (!rPam.HasMark()) @@ -1860,12 +1860,12 @@ bool SwDoc::MoveParagraph(SwPaM& rPam, tools::Long nOffset, bool const bIsOutlMv if (nodes.second && nodes.second != &rPam.End()->nNode.GetNode()) { assert(nodes.first); - if (0 < nOffset) + if (SwNodeOffset(0) < nOffset) { nOffset -= nodes.second->GetIndex() - rPam.End()->nNode.GetIndex(); - if (nOffset <= 0) // hack: there are callers that know what + if (nOffset <= SwNodeOffset(0)) // hack: there are callers that know what { // node they want; those should never need - nOffset = +1; // this; other callers just pass in +1 + nOffset = SwNodeOffset(+1); // this; other callers just pass in +1 } // and those should still move } if (!rPam.HasMark()) @@ -1878,7 +1878,7 @@ bool SwDoc::MoveParagraph(SwPaM& rPam, tools::Long nOffset, bool const bIsOutlMv rPam.End()->nContent.Assign(nodes.second, nodes.second->GetTextNode()->Len()); } - if (nOffset > 0) + if (nOffset > SwNodeOffset(0)) { // sw_redlinehide: avoid moving into delete redline, skip forward if (GetNodes().GetEndOfContent().GetIndex() <= rPam.End()->nNode.GetIndex() + nOffset) { @@ -1904,7 +1904,7 @@ bool SwDoc::MoveParagraph(SwPaM& rPam, tools::Long nOffset, bool const bIsOutlMv } else { // sw_redlinehide: avoid moving into delete redline, skip backward - if (rPam.Start()->nNode.GetIndex() + nOffset < 1) + if (rPam.Start()->nNode.GetIndex() + nOffset < SwNodeOffset(1)) { return false; // can't move } @@ -1930,13 +1930,13 @@ bool SwDoc::MoveParagraph(SwPaM& rPam, tools::Long nOffset, bool const bIsOutlMv return MoveParagraphImpl(rPam, nOffset, bIsOutlMv, pLayout); } -bool SwDoc::MoveParagraphImpl(SwPaM& rPam, tools::Long const nOffset, +bool SwDoc::MoveParagraphImpl(SwPaM& rPam, SwNodeOffset const nOffset, bool const bIsOutlMv, SwRootFrame const*const pLayout) { const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End(); - sal_uLong nStIdx = pStt->nNode.GetIndex(); - sal_uLong nEndIdx = pEnd->nNode.GetIndex(); + SwNodeOffset nStIdx = pStt->nNode.GetIndex(); + SwNodeOffset nEndIdx = pEnd->nNode.GetIndex(); // Here are some sophisticated checks whether the wished PaM will be moved or not. // For moving outlines (bIsOutlMv) I've already done some checks, so here are two different @@ -1973,9 +1973,9 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, tools::Long const nOffset, return false; // A start node which ends behind the moved range => no. } - sal_uLong nInStIdx, nInEndIdx; - tools::Long nOffs = nOffset; - if( nOffset > 0 ) + SwNodeOffset nInStIdx, nInEndIdx; + SwNodeOffset nOffs = nOffset; + if( nOffset > SwNodeOffset(0) ) { nInEndIdx = nEndIdx; nEndIdx += nOffset; @@ -1984,7 +1984,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, tools::Long const nOffset, else { // Impossible to move to negative index - if( o3tl::make_unsigned(std::abs( nOffset )) > nStIdx) + if( abs( nOffset ) > nStIdx) return false; nInEndIdx = nStIdx - 1; @@ -2082,8 +2082,8 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, tools::Long const nOffset, SwDataChanged aTmp( rPam ); } - SwNodeIndex aIdx( nOffset > 0 ? pEnd->nNode : pStt->nNode, nOffs ); - SwNodeRange aMvRg( pStt->nNode, 0, pEnd->nNode, +1 ); + SwNodeIndex aIdx( nOffset > SwNodeOffset(0) ? pEnd->nNode : pStt->nNode, nOffs ); + SwNodeRange aMvRg( pStt->nNode, SwNodeOffset(0), pEnd->nNode, SwNodeOffset(+1) ); SwRangeRedline* pOwnRedl = nullptr; if( getIDocumentRedlineAccess().IsRedlineOn() ) @@ -2139,7 +2139,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, tools::Long const nOffset, rOrigPam.GetPoint()->nContent.Assign( rOrigPam.GetContentNode(), 0 ); bool bDelLastPara = !aInsPos.nNode.GetNode().IsContentNode(); - sal_uLong nOrigIdx = aIdx.GetIndex(); + SwNodeOffset nOrigIdx = aIdx.GetIndex(); /* When copying to a non-content node Copy will insert a paragraph before that node and insert before @@ -2174,7 +2174,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, tools::Long const nOffset, #ifndef NDEBUG size_t nRedlines(getIDocumentRedlineAccess().GetRedlineTable().size()); #endif - if (nOffset > 0) + if (nOffset > SwNodeOffset(0)) assert(aPam.End()->nNode.GetIndex() - aPam.Start()->nNode.GetIndex() + nOffset == aInsPos.nNode.GetIndex() - aPam.End()->nNode.GetIndex()); else assert(aPam.Start()->nNode.GetIndex() - aPam.End()->nNode.GetIndex() + nOffset == aInsPos.nNode.GetIndex() - aPam.End()->nNode.GetIndex()); @@ -2195,7 +2195,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, tools::Long const nOffset, SwRangeRedline* pNewRedline; { SwPaM pam(*pRedline, nullptr); - sal_uLong const nCurrentOffset( + SwNodeOffset const nCurrentOffset( nOrigIdx - aPam.Start()->nNode.GetIndex()); pam.GetPoint()->nNode += nCurrentOffset; pam.GetPoint()->nContent.Assign(pam.GetPoint()->nNode.GetNode().GetContentNode(), pam.GetPoint()->nContent.GetIndex()); @@ -2292,7 +2292,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, tools::Long const nOffset, getIDocumentRedlineAccess().SplitRedline(aTemp); } - sal_uLong nRedlSttNd(0), nRedlEndNd(0); + SwNodeOffset nRedlSttNd(0), nRedlEndNd(0); if( pOwnRedl ) { const SwPosition *pRStt = pOwnRedl->Start(), *pREnd = pOwnRedl->End(); @@ -2301,7 +2301,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, tools::Long const nOffset, } std::unique_ptr<SwUndoMoveNum> pUndo; - sal_uLong nMoved = 0; + SwNodeOffset nMoved(0); if (GetIDocumentUndoRedo().DoesUndo()) { pUndo.reset(new SwUndoMoveNum( rPam, nOffset, bIsOutlMv )); diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index a39b2fcc28ee..36501906a641 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1329,13 +1329,13 @@ void SwRangeRedline::ShowOriginal(sal_uInt16 nLoop, size_t nMyPos, bool /*bForce // trigger the Layout void SwRangeRedline::InvalidateRange(Invalidation const eWhy) { - sal_uLong nSttNd = Start()->nNode.GetIndex(), - nEndNd = End()->nNode.GetIndex(); + SwNodeOffset nSttNd = Start()->nNode.GetIndex(), + nEndNd = End()->nNode.GetIndex(); sal_Int32 nSttCnt = Start()->nContent.GetIndex(); sal_Int32 nEndCnt = End()->nContent.GetIndex(); SwNodes& rNds = GetDoc().GetNodes(); - for (sal_uLong n(nSttNd); n <= nEndNd; ++n) + for (SwNodeOffset n(nSttNd); n <= nEndNd; ++n) { SwNode* pNode = rNds[n]; @@ -1372,7 +1372,7 @@ void SwRangeRedline::InvalidateRange(Invalidation const eWhy) /** Calculates the start and end position of the intersection rTmp and text node nNdIdx */ -void SwRangeRedline::CalcStartEnd( sal_uLong nNdIdx, sal_Int32& rStart, sal_Int32& rEnd ) const +void SwRangeRedline::CalcStartEnd( SwNodeOffset nNdIdx, sal_Int32& rStart, sal_Int32& rEnd ) const { const SwPosition *pRStt = Start(), *pREnd = End(); if( pRStt->nNode < nNdIdx ) @@ -1587,7 +1587,7 @@ void SwRangeRedline::CopyToSection() else { SwNodeIndex aInsPos( *pSttNd->EndOfSectionNode() ); - SwNodeRange aRg( pStt->nNode, 0, pEnd->nNode, 1 ); + SwNodeRange aRg( pStt->nNode, SwNodeOffset(0), pEnd->nNode, SwNodeOffset(1) ); rDoc.GetDocumentContentOperationsManager().CopyWithFlyInFly(aRg, aInsPos); } } @@ -1730,8 +1730,8 @@ void SwRangeRedline::MoveFromSection(size_t nMyPos) const SwNode* pKeptContentSectNode( &m_pContentSect->GetNode() ); // #i95711# { SwPaM aPam( m_pContentSect->GetNode(), - *m_pContentSect->GetNode().EndOfSectionNode(), 1, - ( m_bDelLastPara ? -2 : -1 ) ); + *m_pContentSect->GetNode().EndOfSectionNode(), SwNodeOffset(1), + SwNodeOffset( m_bDelLastPara ? -2 : -1 ) ); SwContentNode* pCNd = aPam.GetContentNode(); if( pCNd ) aPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 38626edb3198..2c3ac9de29b5 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -243,7 +243,7 @@ OUString SwSortBoxElement::GetKey(sal_uInt16 nKey) const { // Iterate over all the Box's TextNodes const SwNode *pNd = nullptr, *pEndNd = pMyBox->GetSttNd()->EndOfSectionNode(); - for( sal_uLong nIdx = pMyBox->GetSttIdx() + 1; pNd != pEndNd; ++nIdx ) + for( SwNodeOffset nIdx = pMyBox->GetSttIdx() + 1; pNd != pEndNd; ++nIdx ) { pNd = pDoc->GetNodes()[ nIdx ]; if( pNd->IsTextNode() ) @@ -298,7 +298,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) // Check if only TextNodes are within the Selection { - sal_uLong nStart = pStart->nNode.GetIndex(), + SwNodeOffset nStart = pStart->nNode.GetIndex(), nEnd = pEnd->nNode.GetIndex(); while( nStart <= nEnd ) // Iterate over a selected range @@ -319,7 +319,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) // To-Do - add 'SwExtraRedlineTable' also ? if( getIDocumentRedlineAccess().IsRedlineOn() || (!getIDocumentRedlineAccess().IsIgnoreRedline() && !getIDocumentRedlineAccess().GetRedlineTable().empty() )) { - pRedlPam = new SwPaM( pStart->nNode, pEnd->nNode, -1, 1 ); + pRedlPam = new SwPaM( pStart->nNode, pEnd->nNode, SwNodeOffset(-1), SwNodeOffset(1) ); SwContentNode* pCNd = pRedlPam->GetContentNode( false ); if( pCNd ) pRedlPam->GetMark()->nContent = pCNd->Len(); @@ -348,7 +348,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) sal_Int32 nCLen = 0; if( !pCNd ) { - pCNd = GetNodes()[ aEndIdx.GetIndex()-1 ]->GetContentNode(); + pCNd = GetNodes()[ aEndIdx.GetIndex()-SwNodeOffset(1) ]->GetContentNode(); if( pCNd ) { nCLen = pCNd->Len(); @@ -379,7 +379,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) } // Now comes the tricky part: Move Nodes (and always keep Undo in mind) - sal_uLong nBeg = pStart->nNode.GetIndex(); + SwNodeOffset nBeg = pStart->nNode.GetIndex(); SwNodeRange aRg( aStart, aStart ); if( bUndo && !pRedlUndo ) @@ -390,7 +390,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) GetIDocumentUndoRedo().DoUndo(false); - size_t n = 0; + SwNodeOffset n(0); for (const auto& rElem : aSortSet) { aStart = nBeg + n; @@ -576,7 +576,7 @@ bool SwDoc::SortTable(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) // Restore table frames: // #i37739# A simple 'MakeFrames' after the node sorting // does not work if the table is inside a frame and has no prev/next. - const sal_uLong nIdx = pTableNd->GetIndex(); + const SwNodeOffset nIdx = pTableNd->GetIndex(); aNode2Layout.RestoreUpperFrames( GetNodes(), nIdx, nIdx + 1 ); // TL_CHART2: need to inform chart of probably changed cell names @@ -691,7 +691,7 @@ void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar, pUD->Insert( pSource->GetName(), pTar->GetName() ); // Set Pam source to the first ContentNode - SwNodeRange aRg( *pSource->GetSttNd(), 0, *pSource->GetSttNd() ); + SwNodeRange aRg( *pSource->GetSttNd(), SwNodeOffset(0), *pSource->GetSttNd() ); SwNode* pNd = pDoc->GetNodes().GoNext( &aRg.aStart ); // If the Cell (Source) wasn't moved @@ -706,10 +706,10 @@ void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar, // -> move and delete it SwNodeIndex aTar( *pTar->GetSttNd() ); pNd = pDoc->GetNodes().GoNext( &aTar ); // next ContentNode - sal_uLong nCount = pNd->EndOfSectionIndex() - pNd->StartOfSectionIndex(); + SwNodeOffset nCount = pNd->EndOfSectionIndex() - pNd->StartOfSectionIndex(); bool bDelFirst = false; - if( nCount == 2 ) + if( nCount == SwNodeOffset(2) ) { OSL_ENSURE( pNd->GetContentNode(), "No ContentNode"); bDelFirst = !pNd->GetContentNode()->Len() && bMovedBefore; @@ -717,7 +717,7 @@ void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar, if(!bDelFirst) { // We already have Content -> old Content Section Down - SwNodeRange aRgTar( aTar.GetNode(), 0, *pNd->EndOfSectionNode() ); + SwNodeRange aRgTar( aTar.GetNode(), SwNodeOffset(0), *pNd->EndOfSectionNode() ); pDoc->GetNodes().SectionDown( &aRgTar ); } diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index ad9271d9ad28..91fbbc03fe56 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -199,10 +199,10 @@ namespace { /// Travel between table of content Marks class CompareNodeContent { - sal_uLong m_nNode; + SwNodeOffset m_nNode; sal_Int32 m_nContent; public: - CompareNodeContent( sal_uLong nNd, sal_Int32 nCnt ) + CompareNodeContent( SwNodeOffset nNd, sal_Int32 nCnt ) : m_nNode( nNd ), m_nContent( nCnt ) {} bool operator==( const CompareNodeContent& rCmp ) const @@ -230,11 +230,11 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, { const SwTextTOXMark* pMark = rCurTOXMark.GetTextTOXMark(); - CompareNodeContent aAbsIdx(pMark ? pMark->GetpTextNd()->GetIndex() : 0, pMark ? pMark->GetStart() : 0); - CompareNodeContent aPrevPos( 0, 0 ); - CompareNodeContent aNextPos( ULONG_MAX, SAL_MAX_INT32 ); - CompareNodeContent aMax( 0, 0 ); - CompareNodeContent aMin( ULONG_MAX, SAL_MAX_INT32 ); + CompareNodeContent aAbsIdx(pMark ? pMark->GetpTextNd()->GetIndex() : SwNodeOffset(0), pMark ? pMark->GetStart() : 0); + CompareNodeContent aPrevPos( SwNodeOffset(0), 0 ); + CompareNodeContent aNextPos( NODE_OFFSET_MAX, SAL_MAX_INT32 ); + CompareNodeContent aMax( SwNodeOffset(0), 0 ); + CompareNodeContent aMin( NODE_OFFSET_MAX, SAL_MAX_INT32 ); const SwTOXMark* pNew = nullptr; const SwTOXMark* pMax = &rCurTOXMark; @@ -405,7 +405,7 @@ SwTOXBaseSection* SwDoc::InsertTableOf( const SwPaM& aPam, return pNewSection; } -void SwDoc::InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd, +void SwDoc::InsertTableOf( SwNodeOffset nSttNd, SwNodeOffset nEndNd, const SwTOXBase& rTOX, const SfxItemSet* pSet ) { @@ -799,8 +799,8 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, if ( !_bNewTOX && !pDefaultPageDesc ) { // determine page description of table-of-content - size_t nPgDescNdIdx = pSectNd->GetIndex() + 1; - size_t* pPgDescNdIdx = &nPgDescNdIdx; + SwNodeOffset nPgDescNdIdx = pSectNd->GetIndex() + 1; + SwNodeOffset* pPgDescNdIdx = &nPgDescNdIdx; pDefaultPageDesc = pSectNd->FindPageDesc( pPgDescNdIdx ); if ( nPgDescNdIdx < pSectNd->GetIndex() ) { @@ -1059,9 +1059,9 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, } // now create the new Frames - sal_uLong nIdx = pSectNd->GetIndex(); + SwNodeOffset nIdx = pSectNd->GetIndex(); // don't delete if index is empty - if(nIdx + 2 < pSectNd->EndOfSectionIndex()) + if(nIdx + SwNodeOffset(2) < pSectNd->EndOfSectionIndex()) rDoc.GetNodes().Delete( aInsPos ); aN2L.RestoreUpperFrames( rDoc.GetNodes(), nIdx, nIdx + 1 ); @@ -1431,7 +1431,7 @@ void SwTOXBaseSection::UpdateContent( SwTOXElement eMyType, SwDoc* pDoc = GetFormat()->GetDoc(); SwNodes& rNds = pDoc->GetNodes(); // on the 1st Node of the 1st Section - sal_uLong nIdx = rNds.GetEndOfAutotext().StartOfSectionIndex() + 2, + SwNodeOffset nIdx = rNds.GetEndOfAutotext().StartOfSectionIndex() + SwNodeOffset(2), nEndIdx = rNds.GetEndOfAutotext().GetIndex(); while( nIdx < nEndIdx ) @@ -1525,7 +1525,7 @@ void SwTOXBaseSection::UpdateContent( SwTOXElement eMyType, } } - nIdx = pNd->StartOfSectionNode()->EndOfSectionIndex() + 2; // 2 == End/Start Node + nIdx = pNd->StartOfSectionNode()->EndOfSectionIndex() + SwNodeOffset(2); // 2 == End/Start Node } } diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index 23ac77484004..e3b2767b6af2 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -272,11 +272,11 @@ SwExtTextInput* SwDoc::GetExtTextInput( const SwNode& rNd, SwExtTextInput* pRet = nullptr; if( mpExtInputRing ) { - sal_uLong nNdIdx = rNd.GetIndex(); + SwNodeOffset nNdIdx = rNd.GetIndex(); SwExtTextInput* pTmp = mpExtInputRing; do { - sal_uLong nStartNode = pTmp->Start()->nNode.GetIndex(), - nEndNode = pTmp->End()->nNode.GetIndex(); + SwNodeOffset nStartNode = pTmp->Start()->nNode.GetIndex(), + nEndNode = pTmp->End()->nNode.GetIndex(); sal_Int32 nStartCnt = pTmp->Start()->nContent.GetIndex(); sal_Int32 nEndCnt = pTmp->End()->nContent.GetIndex(); diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx index ce09a4cba229..1c8a0bf6b1b6 100644 --- a/sw/source/core/doc/ftnidx.cxx +++ b/sw/source/core/doc/ftnidx.cxx @@ -52,8 +52,8 @@ using sw::IsFootnoteDeleted; bool CompareSwFootnoteIdxs::operator()(SwTextFootnote* const& lhs, SwTextFootnote* const& rhs) const { - sal_uLong nIdxLHS = SwTextFootnote_GetIndex( lhs ); - sal_uLong nIdxRHS = SwTextFootnote_GetIndex( rhs ); + SwNodeOffset nIdxLHS = SwTextFootnote_GetIndex( lhs ); + SwNodeOffset nIdxRHS = SwTextFootnote_GetIndex( rhs ); return ( nIdxLHS == nIdxRHS && lhs->GetStart() < rhs->GetStart() ) || nIdxLHS < nIdxRHS; } @@ -90,9 +90,9 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt ) const SwOutlineNodes& rOutlNds = rDoc.GetNodes().GetOutLineNds(); const SwNode *pChapterStartHidden(&rDoc.GetNodes().GetEndOfExtras()); - sal_uLong nChapterStart(pChapterStartHidden->GetIndex()); - sal_uLong nChapterEnd(rDoc.GetNodes().GetEndOfContent().GetIndex()); - sal_uLong nChapterEndHidden(nChapterEnd); + SwNodeOffset nChapterStart(pChapterStartHidden->GetIndex()); + SwNodeOffset nChapterEnd(rDoc.GetNodes().GetEndOfContent().GetIndex()); + SwNodeOffset nChapterEndHidden(nChapterEnd); if( !rOutlNds.empty() ) { // Find the Chapter's start, which contains rStt @@ -156,7 +156,7 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt ) for( ; nPos < size(); ++nPos ) { pTextFootnote = (*this)[ nPos ]; - sal_uLong const nNode(pTextFootnote->GetTextNode().GetIndex()); + SwNodeOffset const nNode(pTextFootnote->GetTextNode().GetIndex()); if (nChapterEndHidden <= nNode) break; @@ -192,7 +192,7 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt ) size_t nEndNo = 1; size_t nFootnoteNoHidden = 1; size_t nEndNoHidden = 1; - sal_uLong nUpdNdIdx = rStt.GetIndex(); + SwNodeOffset nUpdNdIdx = rStt.GetIndex(); for( nPos = 0; nPos < size(); ++nPos ) { pTextFootnote = (*this)[ nPos ]; @@ -302,7 +302,7 @@ void SwFootnoteIdxs::UpdateAllFootnote() { if ( rOutlNds[ n ]->GetTextNode()->GetAttrOutlineLevel() == 1 ) { - sal_uLong nCapStt = rOutlNds[ n ]->GetIndex(); // Start of a new chapter + SwNodeOffset nCapStt = rOutlNds[ n ]->GetIndex(); // Start of a new chapter for( ; nFootnoteIdx < size(); ++nFootnoteIdx ) { pTextFootnote = (*this)[ nFootnoteIdx ]; @@ -408,7 +408,7 @@ void SwFootnoteIdxs::UpdateAllFootnote() SwTextFootnote* SwFootnoteIdxs::SeekEntry( const SwNodeIndex& rPos, size_t* pFndPos ) const { - sal_uLong nIdx = rPos.GetIndex(); + SwNodeOffset nIdx = rPos.GetIndex(); size_t nO = size(); size_t nU = 0; @@ -418,7 +418,7 @@ SwTextFootnote* SwFootnoteIdxs::SeekEntry( const SwNodeIndex& rPos, size_t* pFnd while( nU <= nO ) { const size_t nM = nU + ( nO - nU ) / 2; - sal_uLong nNdIdx = SwTextFootnote_GetIndex( (*this)[ nM ] ); + SwNodeOffset nNdIdx = SwTextFootnote_GetIndex( (*this)[ nM ] ); if( nNdIdx == nIdx ) { if( pFndPos ) diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index 1c46a8ffdac7..19f8e330587a 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -413,7 +413,7 @@ SwFrameFormat *SwHTMLTableLayout::FindFlyFrameFormat() const static void lcl_GetMinMaxSize( sal_uLong& rMinNoAlignCnts, sal_uLong& rMaxNoAlignCnts, sal_uLong& rAbsMinNoAlignCnts, - SwTextNode const *pTextNd, sal_uLong nIdx, bool bNoBreak ) + SwTextNode const *pTextNd, SwNodeOffset nIdx, bool bNoBreak ) { pTextNd->GetMinMaxSize( nIdx, rMinNoAlignCnts, rMaxNoAlignCnts, rAbsMinNoAlignCnts ); @@ -486,7 +486,7 @@ void SwHTMLTableLayout::AutoLayoutPass1() if( pSttNd ) { const SwDoc& rDoc = pSttNd->GetDoc(); - sal_uLong nIdx = pSttNd->GetIndex(); + SwNodeOffset nIdx = pSttNd->GetIndex(); while (!rDoc.GetNodes()[nIdx]->IsEndNode()) { SwTextNode *pTextNd = (rDoc.GetNodes()[nIdx])->GetTextNode(); diff --git a/sw/source/core/doc/list.cxx b/sw/source/core/doc/list.cxx index d4841ebb73db..8ae6ecc1c18f 100644 --- a/sw/source/core/doc/list.cxx +++ b/sw/source/core/doc/list.cxx @@ -32,7 +32,7 @@ SwList::SwList( const OUString& sListId, mnMarkedListLevel( MAXLEVEL ) { // create empty list trees for the document ranges - const SwNode* pNode = rNodes[0]; + const SwNode* pNode = rNodes[SwNodeOffset(0)]; do { SwPaM aPam( *pNode, *pNode->EndOfSectionNode() ); @@ -45,7 +45,7 @@ SwList::SwList( const OUString& sListId, pNode = pNode->EndOfSectionNode(); if (pNode != &rNodes.GetEndOfContent()) { - sal_uLong nIndex = pNode->GetIndex(); + SwNodeOffset nIndex = pNode->GetIndex(); nIndex++; pNode = rNodes[nIndex]; } diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index d9bb20079701..37389e750c5c 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -128,7 +128,7 @@ void SwServerObject::SendDataChanged( const SwPosition& rPos ) } if( pNd ) { - sal_uLong nNd = rPos.nNode.GetIndex(); + SwNodeOffset nNd = rPos.nNode.GetIndex(); bCall = pNd->GetIndex() < nNd && nNd < pNd->EndOfSectionIndex(); } @@ -180,7 +180,7 @@ void SwServerObject::SendDataChanged( const SwPaM& rRange ) bool SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const { - sal_uLong nSttNd = 0, nEndNd = 0; + SwNodeOffset nSttNd(0), nEndNd(0); const SwNode* pNd = nullptr; const SwNodes* pNds = nullptr; diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index e0db7464470f..52d3348f2408 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -501,10 +501,10 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, // First copy the new content and then delete the old one. // Do not create empty Sections, otherwise they will be deleted! std::unique_ptr< SwNodeRange > pRg( pCpyBox ? - new SwNodeRange ( *pCpyBox->GetSttNd(), 1, + new SwNodeRange ( *pCpyBox->GetSttNd(), SwNodeOffset(1), *pCpyBox->GetSttNd()->EndOfSectionNode() ) : nullptr ); - SwNodeIndex aInsIdx( *pDstBox->GetSttNd(), bDelContent ? 1 : + SwNodeIndex aInsIdx( *pDstBox->GetSttNd(), bDelContent ? SwNodeOffset(1) : pDstBox->GetSttNd()->EndOfSectionIndex() - pDstBox->GetSttIdx() ); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index d32e9f2af3e0..139e85aeb565 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -1086,7 +1086,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn // !! If this is changed we need to adapt the Undo, too !!! bool bMoveNodes = true; { - sal_uLong nSttNd = pLastBox->GetSttIdx() + 1, + SwNodeOffset nSttNd = pLastBox->GetSttIdx() + 1, nEndNd = pLastBox->GetSttNd()->EndOfSectionIndex(); while( nSttNd < nEndNd ) if( !rDoc.GetNodes()[ nSttNd++ ]->IsTextNode() ) @@ -1135,10 +1135,10 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn if( bMoveNodes ) { const SwNode* pEndNd = pLastBox->GetSttNd()->EndOfSectionNode(); - if( pLastBox->GetSttIdx()+2 != pEndNd->GetIndex() ) + if( pLastBox->GetSttIdx()+SwNodeOffset(2) != pEndNd->GetIndex() ) { // Move TextNodes - SwNodeRange aRg( *pLastBox->GetSttNd(), +2, *pEndNd ); + SwNodeRange aRg( *pLastBox->GetSttNd(), SwNodeOffset(+2), *pEndNd ); pLastBox = pNewLine->GetTabBoxes()[0]; // reset SwNodeIndex aInsPos( *pLastBox->GetSttNd(), 1 ); rDoc.GetNodes().MoveNodes(aRg, rDoc.GetNodes(), aInsPos, false); @@ -1922,7 +1922,7 @@ static void lcl_CopyBoxToDoc(FndBox_ const& rFndBox, CpyPara *const pCpyPara) } } SwDoc* pFromDoc = rFndBox.GetBox()->GetFrameFormat()->GetDoc(); - SwNodeRange aCpyRg( *rFndBox.GetBox()->GetSttNd(), 1, + SwNodeRange aCpyRg( *rFndBox.GetBox()->GetSttNd(), SwNodeOffset(1), *rFndBox.GetBox()->GetSttNd()->EndOfSectionNode() ); SwNodeIndex aInsIdx( *pBox->GetSttNd(), 1 ); diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 5865b34661ce..3b572229b4d7 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -128,14 +128,14 @@ namespace { struct CopyTable { SwDoc& m_rDoc; - sal_uLong m_nOldTableSttIdx; + SwNodeOffset m_nOldTableSttIdx; MapTableFrameFormats& m_rMapArr; SwTableLine* m_pInsLine; SwTableBox* m_pInsBox; SwTableNode *m_pTableNd; const SwTable *m_pOldTable; - CopyTable(SwDoc& rDc, MapTableFrameFormats& rArr, sal_uLong nOldStt, + CopyTable(SwDoc& rDc, MapTableFrameFormats& rArr, SwNodeOffset nOldStt, SwTableNode& rTableNd, const SwTable* pOldTable) : m_rDoc(rDc), m_nOldTableSttIdx(nOldStt), m_rMapArr(rArr), m_pInsLine(nullptr), m_pInsBox(nullptr), m_pTableNd(&rTableNd), m_pOldTable(pOldTable) @@ -297,7 +297,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc& rDoc, const SwNodeIndex& rIdx ) const } // First copy the content of the tables, we will later assign the // boxes/lines and create the frames - SwNodeRange aRg( *this, +1, *EndOfSectionNode() ); + SwNodeRange aRg( *this, SwNodeOffset(+1), *EndOfSectionNode() ); // If there is a table in this table, the table format for the outer table // does not seem to be used, because the table does not have any contents yet diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 5c28a2c82365..48a5b0af4700 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -113,7 +113,7 @@ static bool lcl_IsInSameTableBox( SwNodes const & _rNds, // Find the Box's StartNode const SwTableSortBoxes& rSortBoxes = pTableNd->GetTable().GetTabSortBoxes(); - sal_uLong nIdx = _rNd.GetIndex(); + SwNodeOffset nIdx = _rNd.GetIndex(); for (size_t n = 0; n < rSortBoxes.size(); ++n) { const SwStartNode* pNd = rSortBoxes[ n ]->GetSttNd(); @@ -328,7 +328,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, // To-Do - add 'SwExtraRedlineTable' also ? if( getIDocumentRedlineAccess().IsRedlineOn() || (!getIDocumentRedlineAccess().IsIgnoreRedline() && !getIDocumentRedlineAccess().GetRedlineTable().empty() )) { - SwPaM aPam( *pNewSectNode->EndOfSectionNode(), *pNewSectNode, 1 ); + SwPaM aPam( *pNewSectNode->EndOfSectionNode(), *pNewSectNode, SwNodeOffset(1) ); if( getIDocumentRedlineAccess().IsRedlineOn() ) { getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( RedlineType::Insert, aPam ), true); @@ -410,7 +410,7 @@ sal_uInt16 SwDoc::IsInsRegionAvailable( const SwPaM& rRange, && pEnd->nContent.GetIndex() == pCNd->Len() ) { SwNodeIndex aIdx( pStt->nNode, -1 ); - sal_uLong nCmp = pEnd->nNode.GetIndex(); + SwNodeOffset nCmp = pEnd->nNode.GetIndex(); const SwStartNode* pPrvNd; const SwEndNode* pNxtNd; while( nullptr != ( pPrvNd = (pNd = &aIdx.GetNode())->GetSectionNode() ) && @@ -572,7 +572,7 @@ void SwDoc::DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes ) // as the Section DTOR tries to delete it's format itself. mpSectionFormatTable->erase( itFormatPos ); //FEATURE::CONDCOLL - sal_uLong nCnt = 0, nSttNd = 0; + SwNodeOffset nCnt(0), nSttNd(0); if( pIdx && &GetNodes() == &pIdx->GetNodes() && nullptr != (pSectNd = pIdx->GetNode().GetSectionNode() )) { @@ -746,7 +746,7 @@ void SwDoc::UpdateSection( size_t const nPos, SwSectionData & rNewData, getIDocumentState().SetModified(); } -void sw_DeleteFootnote( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd ) +void sw_DeleteFootnote( SwSectionNode *pNd, SwNodeOffset nStt, SwNodeOffset nEnd ) { SwFootnoteIdxs& rFootnoteArr = pNd->GetDoc().GetFootnoteIdxs(); if( rFootnoteArr.empty() ) @@ -860,7 +860,7 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, // aInsPos is at the moment the Position where my EndNode will be inserted const SwStartNode* pStartNode = aInsPos.GetNode().StartOfSectionNode(); // This StartNode should be in front of me, but if not, I want to survive - sal_uLong nMyIndex = pSectNd->GetIndex(); + SwNodeOffset nMyIndex = pSectNd->GetIndex(); if( pStartNode->GetIndex() > nMyIndex ) // Suspicious! { const SwNode* pTemp; @@ -927,18 +927,18 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, } // Set the right StartNode for all in this Area - sal_uLong nEnd = pSectNd->EndOfSectionIndex(); - sal_uLong nStart = pSectNd->GetIndex()+1; - sal_uLong nSkipIdx = ULONG_MAX; - for( sal_uLong n = nStart; n < nEnd; ++n ) + SwNodeOffset nEnd = pSectNd->EndOfSectionIndex(); + SwNodeOffset nStart = pSectNd->GetIndex()+1; + SwNodeOffset nSkipIdx = NODE_OFFSET_MAX; + for( SwNodeOffset n = nStart; n < nEnd; ++n ) { SwNode* pNd = (*this)[n]; // Attach all Sections in the NodeSection underneath the new one - if( ULONG_MAX == nSkipIdx ) + if( NODE_OFFSET_MAX == nSkipIdx ) pNd->m_pStartOfSection = pSectNd; else if( n >= nSkipIdx ) - nSkipIdx = ULONG_MAX; + nSkipIdx = NODE_OFFSET_MAX; if( pNd->IsStartNode() ) { @@ -955,7 +955,7 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, if( pNd->IsTableNode() ) static_cast<SwTableNode*>(pNd)->DelFrames(); - if( ULONG_MAX == nSkipIdx ) + if( NODE_OFFSET_MAX == nSkipIdx ) nSkipIdx = pNd->EndOfSectionIndex(); } } @@ -969,7 +969,7 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, { if( pNode2Layout ) { - sal_uLong nIdx = pSectNd->GetIndex(); + SwNodeOffset nIdx = pSectNd->GetIndex(); pNode2Layout->RestoreUpperFrames( pSectNd->GetNodes(), nIdx, nIdx + 1 ); delete pNode2Layout; } @@ -1186,7 +1186,7 @@ void SwSectionNode::MakeOwnFrames(SwNodeIndex* pIdxBehind, SwNodeIndex* pEndIdx) void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/, bool const bForce) { - sal_uLong nStt = GetIndex()+1, nEnd = EndOfSectionIndex(); + SwNodeOffset nStt = GetIndex()+1, nEnd = EndOfSectionIndex(); if( nStt >= nEnd ) { return ; @@ -1272,7 +1272,7 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc& rDoc, const SwNodeIndex& rIdx ) c if( !pNewSect->IsEditInReadonlyFlag() && GetSection().IsEditInReadonly() ) pNewSect->SetEditInReadonly(); - SwNodeRange aRg( *this, +1, *EndOfSectionNode() ); // Where am I? + SwNodeRange aRg( *this, SwNodeOffset(+1), *EndOfSectionNode() ); // Where am I? rNds.Copy_( aRg, aInsPos, false ); // Delete all Frames from the copied Area. They are created when creating @@ -1302,7 +1302,7 @@ bool SwSectionNode::IsContentHidden() const OSL_ENSURE( !m_pSection->IsHidden(), "That's simple: Hidden Section => Hidden Content" ); SwNodeIndex aTmp( *this, 1 ); - sal_uLong nEnd = EndOfSectionIndex(); + SwNodeOffset nEnd = EndOfSectionIndex(); while( aTmp < nEnd ) { if( aTmp.GetNode().IsSectionNode() ) @@ -1347,8 +1347,8 @@ void SwSectionNode::NodesArrChgd() : pDoc->GetDfltFrameFormat() ); // Set the right StartNode for all in this Area - sal_uLong nStart = GetIndex()+1, nEnd = EndOfSectionIndex(); - for( sal_uLong n = nStart; n < nEnd; ++n ) + SwNodeOffset nStart = GetIndex()+1, nEnd = EndOfSectionIndex(); + for( SwNodeOffset n = nStart; n < nEnd; ++n ) { // Make up the Format's nesting pSectNd = rNds[ n ]->GetSectionNode(); diff --git a/sw/source/core/docnode/ndsect.hxx b/sw/source/core/docnode/ndsect.hxx index 286f9d35c1e0..fe663a89e4e6 100644 --- a/sw/source/core/docnode/ndsect.hxx +++ b/sw/source/core/docnode/ndsect.hxx @@ -21,10 +21,11 @@ #define INCLUDED_SW_SOURCE_CORE_DOCNODE_NDSECT_HXX #include <tools/solar.h> +#include <nodeoffset.hxx> class SwSectionNode; -void sw_DeleteFootnote(SwSectionNode* pNd, sal_uLong nStt, sal_uLong nEnd); +void sw_DeleteFootnote(SwSectionNode* pNd, SwNodeOffset nStt, SwNodeOffset nEnd); #endif diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index adad7a89f30e..2ff83dfb8ce3 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -214,7 +214,7 @@ static SwTableBoxFormat *lcl_CreateAFormatBoxFormat( SwDoc &rDoc, std::vector<Sw SwTableNode* SwDoc::IsIdxInTable(const SwNodeIndex& rIdx) { SwTableNode* pTableNd = nullptr; - sal_uLong nIndex = rIdx.GetIndex(); + SwNodeOffset nIndex = rIdx.GetIndex(); do { SwNode* pNd = GetNodes()[ nIndex ]->StartOfSectionNode(); pTableNd = pNd->GetTableNode(); @@ -242,7 +242,7 @@ bool SwNodes::InsBoxen( SwTableNode* pTableNd, OSL_ENSURE( pLine, "No valid Line" ); // Move Index after the Line's last Box - sal_uLong nIdxPos = 0; + SwNodeOffset nIdxPos(0); SwTableBox *pPrvBox = nullptr, *pNxtBox = nullptr; if( !pLine->GetTabBoxes().empty() ) { @@ -540,7 +540,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTableOpts, SwTableBox *pBox = new SwTableBox( pBoxF, aNdIdx, pLine); rBoxes.insert( rBoxes.begin() + i, pBox ); - aNdIdx += 3; // StartNode, TextNode, EndNode == 3 Nodes + aNdIdx += SwNodeOffset(3); // StartNode, TextNode, EndNode == 3 Nodes } } // Insert Frames @@ -550,7 +550,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTableOpts, // To-Do - add 'SwExtraRedlineTable' also ? if( getIDocumentRedlineAccess().IsRedlineOn() || (!getIDocumentRedlineAccess().IsIgnoreRedline() && !getIDocumentRedlineAccess().GetRedlineTable().empty() )) { - SwPaM aPam( *pTableNd->EndOfSectionNode(), *pTableNd, 1 ); + SwPaM aPam( *pTableNd->EndOfSectionNode(), *pTableNd, SwNodeOffset(1) ); if( getIDocumentRedlineAccess().IsRedlineOn() ) getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( RedlineType::Insert, aPam ), true); else @@ -634,7 +634,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, // See if the selection contains a Table const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End(); { - sal_uLong nCnt = pStt->nNode.GetIndex(); + SwNodeOffset nCnt = pStt->nNode.GetIndex(); for( ; nCnt <= pEnd->nNode.GetIndex(); ++nCnt ) if( !GetNodes()[ nCnt ]->IsTextNode() ) return nullptr; @@ -809,8 +809,8 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, SwTableAutoFormatUpdateFlags::Char, nullptr ); if( aCharSet.Count() ) { - sal_uLong nSttNd = pBox->GetSttIdx()+1; - sal_uLong nEndNd = pBox->GetSttNd()->EndOfSectionIndex(); + SwNodeOffset nSttNd = pBox->GetSttIdx()+1; + SwNodeOffset nEndNd = pBox->GetSttNd()->EndOfSectionIndex(); for( ; nSttNd < nEndNd; ++nSttNd ) { SwContentNode* pNd = GetNodes()[ nSttNd ]->GetContentNode(); @@ -868,7 +868,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, } } - sal_uLong nIdx = pTableNd->GetIndex(); + SwNodeOffset nIdx = pTableNd->GetIndex(); aNode2Layout.RestoreUpperFrames( GetNodes(), nIdx, nIdx + 1 ); { @@ -886,7 +886,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, getIDocumentState().SetEnableSetModified(bEnableSetModified); getIDocumentState().SetModified(); - getIDocumentFieldsAccess().SetFieldsDirty(true, nullptr, 0); + getIDocumentFieldsAccess().SetFieldsDirty(true, nullptr, SwNodeOffset(0)); return &rNdTable; } @@ -1022,7 +1022,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, SwNodeIndex aEndIdx( rRange.aEnd, -1 ); for( nLines = 0, nBoxes = 0; aSttIdx.GetIndex() < aEndIdx.GetIndex(); - aSttIdx += 2, nLines++, nBoxes = 0 ) + aSttIdx += SwNodeOffset(2), nLines++, nBoxes = 0 ) { SwTextNode* pTextNd = aSttIdx.GetNode().GetTextNode(); OSL_ENSURE( pTextNd, "Only add TextNodes to the Table" ); @@ -1274,12 +1274,12 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > delete pBoxFormat; } - sal_uLong nIdx = pTableNd->GetIndex(); + SwNodeOffset nIdx = pTableNd->GetIndex(); aNode2Layout.RestoreUpperFrames( GetNodes(), nIdx, nIdx + 1 ); getIDocumentState().SetEnableSetModified(bEnableSetModified); getIDocumentState().SetModified(); - getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); return &rNdTable; } @@ -1413,7 +1413,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, for( const auto& rCell : rRow ) { - const SwNodeIndex aTmpIdx( rCell.aStart, 0 ); + const SwNodeIndex aTmpIdx( rCell.aStart,0 ); SwNodeIndex aCellEndIdx(rCell.aEnd); ++aCellEndIdx; @@ -1465,13 +1465,13 @@ bool SwDoc::TableToText( const SwTableNode* pTableNd, sal_Unicode cCh ) if( pESh && pESh->IsTableMode() ) pESh->ClearMark(); - SwNodeRange aRg( *pTableNd, 0, *pTableNd->EndOfSectionNode() ); + SwNodeRange aRg( *pTableNd, SwNodeOffset(0), *pTableNd->EndOfSectionNode() ); std::unique_ptr<SwUndoTableToText> pUndo; SwNodeRange* pUndoRg = nullptr; if (GetIDocumentUndoRedo().DoesUndo()) { GetIDocumentUndoRedo().ClearRedo(); - pUndoRg = new SwNodeRange( aRg.aStart, -1, aRg.aEnd, +1 ); + pUndoRg = new SwNodeRange( aRg.aStart, SwNodeOffset(-1), aRg.aEnd, SwNodeOffset(+1) ); pUndo.reset(new SwUndoTableToText( pTableNd->GetTable(), cCh )); } @@ -1541,7 +1541,7 @@ static void lcl_DelBox( SwTableBox* pBox, DelTabPara* pDelPara ) else { SwDoc& rDoc = pDelPara->rNds.GetDoc(); - SwNodeRange aDelRg( *pBox->GetSttNd(), 0, + SwNodeRange aDelRg( *pBox->GetSttNd(), SwNodeOffset(0), *pBox->GetSttNd()->EndOfSectionNode() ); // Delete the Section pDelPara->rNds.SectionUp( &aDelRg ); @@ -1551,7 +1551,7 @@ static void lcl_DelBox( SwTableBox* pBox, DelTabPara* pDelPara ) if (nullptr != pCurTextNd) { // Join the current text node with the last from the previous box if possible - sal_uLong nNdIdx = aDelRg.aStart.GetIndex(); + SwNodeOffset nNdIdx = aDelRg.aStart.GetIndex(); --aDelRg.aStart; if( pDelPara->pLastNd == &aDelRg.aStart.GetNode() ) { @@ -1646,7 +1646,7 @@ bool SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh, SectionUp( &aDelRg ); // Delete this Section and by that the Table // #i28006# - sal_uLong nStt = aDelRg.aStart.GetIndex(), nEnd = aDelRg.aEnd.GetIndex(); + SwNodeOffset nStt = aDelRg.aStart.GetIndex(), nEnd = aDelRg.aEnd.GetIndex(); if( !pFrameNd ) { pNode2Layout->RestoreUpperFrames( *this, @@ -1757,7 +1757,7 @@ bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind ) { getIDocumentState().SetModified(); ::ClearFEShellTabCols(*this, nullptr); - getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); } } @@ -1812,7 +1812,7 @@ bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind ) { getIDocumentState().SetModified(); ::ClearFEShellTabCols(*this, nullptr); - getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); } } @@ -1900,7 +1900,7 @@ void SwDoc::DeleteRow( const SwCursor& rCursor ) pNextBox = pNextBox->FindPreviousBox( pTableNd->GetTable(), pNextBox ); } - sal_uLong nIdx; + SwNodeOffset nIdx; if( pNextBox ) // Place the Cursor here nIdx = pNextBox->GetSttIdx() + 1; else // Else after the Table @@ -1985,8 +1985,8 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) } // Are we deleting the whole Table? - const sal_uLong nTmpIdx1 = pTableNd->GetIndex(); - const sal_uLong nTmpIdx2 = aSelBoxes.back()->GetSttNd()->EndOfSectionIndex() + 1; + const SwNodeOffset nTmpIdx1 = pTableNd->GetIndex(); + const SwNodeOffset nTmpIdx2 = aSelBoxes.back()->GetSttNd()->EndOfSectionIndex() + 1; if( pTableNd->GetTable().GetTabSortBoxes().size() == aSelBoxes.size() && aSelBoxes[0]->GetSttIdx()-1 == nTmpIdx1 && nTmpIdx2 == pTableNd->EndOfSectionIndex() ) @@ -1997,8 +1997,8 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) const SwStartNode* pSttNd = aIdx.GetNode().GetStartNode(); if( pSttNd ) { - const sal_uLong nTableEnd = pTableNd->EndOfSectionIndex() + 1; - const sal_uLong nSectEnd = pSttNd->EndOfSectionIndex(); + const SwNodeOffset nTableEnd = pTableNd->EndOfSectionIndex() + 1; + const SwNodeOffset nSectEnd = pSttNd->EndOfSectionIndex(); if( nTableEnd == nSectEnd ) { if( SwFlyStartNode == pSttNd->GetStartNodeType() ) @@ -2045,7 +2045,7 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) // Move hard PageBreaks to the succeeding Node bool bSavePageBreak = false, bSavePageDesc = false; - sal_uLong nNextNd = pTableNd->EndOfSectionIndex()+1; + SwNodeOffset nNextNd = pTableNd->EndOfSectionIndex()+1; SwContentNode* pNextNd = GetNodes()[ nNextNd ]->GetContentNode(); if( pNextNd ) { @@ -2115,7 +2115,7 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(); getIDocumentState().SetModified(); - getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); return true; } @@ -2149,7 +2149,7 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(); getIDocumentState().SetModified(); - getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); } } @@ -2176,7 +2176,7 @@ bool SwDoc::SplitTable( const SwSelBoxes& rBoxes, bool bVert, sal_uInt16 nCnt, if( dynamic_cast<const SwDDETable*>( &rTable) != nullptr) return false; - std::vector<sal_uLong> aNdsCnts; + std::vector<SwNodeOffset> aNdsCnts; SwTableSortBoxes aTmpLst; std::unique_ptr<SwUndoTableNdsChg> pUndo; if (GetIDocumentUndoRedo().DoesUndo()) @@ -2214,7 +2214,7 @@ bool SwDoc::SplitTable( const SwSelBoxes& rBoxes, bool bVert, sal_uInt16 nCnt, GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(); getIDocumentState().SetModified(); - getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); } } @@ -2326,7 +2326,7 @@ TableMergeErr SwDoc::MergeTable( SwPaM& rPam ) nRet = TableMergeErr::Ok; getIDocumentState().SetModified(); - getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); if( pUndo ) { GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) ); @@ -3075,7 +3075,7 @@ void sw_BoxSetSplitBoxFormats( SwTableBox* pBox, SwCollectTableLineBoxes* pSplPa SwContentNode* pDNd = aIdx.GetNodes().GoNext( &aIdx ); // If the Node is alone in the Section - if( 2 == pDNd->EndOfSectionIndex() - + if( SwNodeOffset(2) == pDNd->EndOfSectionIndex() - pDNd->StartOfSectionIndex() ) { pSplPara->AddToUndoHistory( *pDNd ); @@ -3121,7 +3121,7 @@ void SwDoc::SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eHdlnM } { - sal_uLong nSttIdx = pNd->FindTableBoxStartNode()->GetIndex(); + SwNodeOffset nSttIdx = pNd->FindTableBoxStartNode()->GetIndex(); // Find top-level Line SwTableBox* pBox = rTable.GetTableBox( nSttIdx ); @@ -3235,7 +3235,7 @@ void SwDoc::SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eHdlnM GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTNd); GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pNew); - getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); } static bool lcl_ChgTableSize( SwTable& rTable ) @@ -3348,7 +3348,7 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, bool bAfter, if( !pTNd || pNd->IsTableNode() ) return nullptr; - sal_uLong nSttIdx = pNd->FindTableBoxStartNode()->GetIndex(); + SwNodeOffset nSttIdx = pNd->FindTableBoxStartNode()->GetIndex(); // Find this Box/top-level line SwTable& rTable = pTNd->GetTable(); @@ -3514,7 +3514,7 @@ bool SwDoc::MergeTable( const SwPosition& rPos, bool bWithPrev, sal_uInt16 nMode GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(); getIDocumentState().SetModified(); - getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); } return bRet; } @@ -3596,8 +3596,8 @@ bool SwNodes::MergeTable( const SwNodeIndex& rPos, bool bWithPrev, } while( pBoxNd != pTableEndNd ); pBoxNd->m_pStartOfSection = pTableNd; - aIdx -= 2; - DelNodes( aIdx, 2 ); + aIdx -= SwNodeOffset(2); + DelNodes( aIdx, SwNodeOffset(2) ); // tweak the conditional styles at the first inserted Line const SwTableLine* pFirstLn = rTable.GetTabLines()[ nOldSize ]; @@ -3686,8 +3686,8 @@ static bool lcl_SetAFormatBox(FndBox_ & rBox, SetAFormatTabPara *pSetPara, bool if (aCharSet.Count()) { - sal_uLong nSttNd = pSetBox->GetSttIdx()+1; - sal_uLong nEndNd = pSetBox->GetSttNd()->EndOfSectionIndex(); + SwNodeOffset nSttNd = pSetBox->GetSttIdx()+1; + SwNodeOffset nEndNd = pSetBox->GetSttNd()->EndOfSectionIndex(); for (; nSttNd < nEndNd; ++nSttNd) { SwContentNode* pNd = pDoc->GetNodes()[ nSttNd ]->GetContentNode(); @@ -3806,7 +3806,7 @@ bool SwDoc::SetTableAutoFormat(const SwSelBoxes& rBoxes, const SwTableAutoFormat } getIDocumentState().SetModified(); - getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); return true; } @@ -4246,7 +4246,7 @@ void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode ) { SwStartNode* pSttNd = rNode.GetNode().FindSttNodeByType( SwTableBoxStartNode ); if( nullptr == pSttNd || - 2 != pSttNd->EndOfSectionIndex() - pSttNd->GetIndex()) + SwNodeOffset(2) != pSttNd->EndOfSectionIndex() - pSttNd->GetIndex()) return; SwTableBox* pBox = pSttNd->FindTableNode()->GetTable(). @@ -4357,7 +4357,7 @@ bool SwDoc::InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes, } return false; } - aPos.nNode -= 1; // Set to the Table's EndNode + aPos.nNode -= SwNodeOffset(1); // Set to the Table's EndNode pSrcTableNd = aPos.nNode.GetNode().FindTableNode(); } @@ -4418,7 +4418,7 @@ bool SwDoc::InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes, if( bRet ) { getIDocumentState().SetModified(); - getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); } return bRet; } @@ -4508,7 +4508,7 @@ void SwDoc::UnProtectTables( const SwPaM& rPam ) nullptr != (pTableNd = pTable->GetTableNode() ) && pTableNd->GetNodes().IsDocNodes() ) { - sal_uLong nTableIdx = pTableNd->GetIndex(); + SwNodeOffset nTableIdx = pTableNd->GetIndex(); // Check whether the Table is within the Selection if( bHasSel ) diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index e2598a1a53bd..20fa89f3fb70 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -270,12 +270,12 @@ static sal_uInt16 ClearItem_BC( std::shared_ptr<const SfxItemSet>& rpAttrSet, sal_uInt16 SwNode::GetSectionLevel() const { // EndNode of a BaseSection? They are always 0! - if( IsEndNode() && 0 == m_pStartOfSection->StartOfSectionIndex() ) + if( IsEndNode() && SwNodeOffset(0) == m_pStartOfSection->StartOfSectionIndex() ) return 0; sal_uInt16 nLevel; const SwNode* pNode = IsStartNode() ? this : m_pStartOfSection; - for( nLevel = 1; 0 != pNode->StartOfSectionIndex(); ++nLevel ) + for( nLevel = 1; SwNodeOffset(0) != pNode->StartOfSectionIndex(); ++nLevel ) pNode = pNode->m_pStartOfSection; return IsEndNode() ? nLevel-1 : nLevel; } @@ -318,7 +318,7 @@ SwNode::SwNode( const SwNodeIndex &rWhere, const SwNodeType nNdType ) * @param nPos position within the array where the node will be inserted * @param nNdType the type of node to insert */ -SwNode::SwNode( SwNodes& rNodes, sal_uLong nPos, const SwNodeType nNdType ) +SwNode::SwNode( SwNodes& rNodes, SwNodeOffset nPos, const SwNodeType nNdType ) : m_nNodeType( nNdType ) , m_nAFormatNumLvl( 0 ) , m_bIgnoreDontExpand( false) @@ -471,7 +471,7 @@ bool SwNode::IsProtect() const /// Find the PageDesc that is used to format this node. If the Layout is available, /// we search through that. Else we can only do it the hard way by searching onwards through the nodes. -const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const +const SwPageDesc* SwNode::FindPageDesc( SwNodeOffset* pPgDescNdIdx ) const { if ( !GetNodes().IsDocNodes() ) { @@ -902,7 +902,7 @@ void SwNode::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr())); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr())); switch (GetNodeType()) { @@ -960,7 +960,7 @@ SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const SwNodeType nNdType, m_pEndOfSection = reinterpret_cast<SwEndNode*>(this); } -SwStartNode::SwStartNode( SwNodes& rNodes, sal_uLong nPos ) +SwStartNode::SwStartNode( SwNodes& rNodes, SwNodeOffset nPos ) : SwNode( rNodes, nPos, SwNodeType::Start ), m_eStartNodeType( SwNormalStartNode ) { if( !nPos ) @@ -976,7 +976,7 @@ void SwStartNode::CheckSectionCondColl() const { //FEATURE::CONDCOLL SwNodeIndex aIdx( *this ); - sal_uLong nEndIdx = EndOfSectionIndex(); + SwNodeOffset nEndIdx = EndOfSectionIndex(); const SwNodes& rNds = GetNodes(); SwContentNode* pCNd; while( nullptr != ( pCNd = rNds.GoNext( &aIdx )) && pCNd->GetIndex() < nEndIdx ) @@ -1023,7 +1023,7 @@ void SwStartNode::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterStartElement(pWriter, BAD_CAST(pName)); (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr())); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr())); if (IsTableNode()) { @@ -1062,7 +1062,7 @@ SwEndNode::SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd ) m_pStartOfSection->m_pEndOfSection = this; } -SwEndNode::SwEndNode( SwNodes& rNds, sal_uLong nPos, SwStartNode& rSttNd ) +SwEndNode::SwEndNode( SwNodes& rNds, SwNodeOffset nPos, SwStartNode& rSttNd ) : SwNode( rNds, nPos, SwNodeType::End ) { m_pStartOfSection = &rSttNd; @@ -1437,7 +1437,7 @@ void SwContentNode::DelFrames(SwRootFrame const*const pLayout) // otherwise pointer should have been updated to a different node assert(this == pMerged->pLastNode); assert(pMerged->extents.empty()); - for (sal_uLong i = pMerged->pLastNode->GetIndex() - 1;; + for (SwNodeOffset i = pMerged->pLastNode->GetIndex() - 1;; --i) { assert(pMerged->pFirstNode->GetIndex() <= i); @@ -1456,7 +1456,7 @@ void SwContentNode::DelFrames(SwRootFrame const*const pLayout) { // tdf#130680 find the previous node that is a // listener of pMerged; see CheckParaRedlineMerge() - for (sal_uLong i = GetIndex() - 1; + for (SwNodeOffset i = GetIndex() - 1; this == pMerged->pLastNode; --i) { SwNode *const pNode = GetNodes()[i]; @@ -1854,7 +1854,7 @@ bool SwContentNode::CanJoinPrev( SwNodeIndex* pIdx ) const ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() ))) --aIdx; - if (0 == aIdx.GetIndex()) + if (SwNodeOffset(0) == aIdx.GetIndex()) return false; if (!lcl_CheckMaxLength(*pNd, *this)) { diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx index e44c7d2f3083..591fc6541f4f 100644 --- a/sw/source/core/docnode/node2lay.cxx +++ b/sw/source/core/docnode/node2lay.cxx @@ -39,7 +39,7 @@ class SwNode2LayImpl std::unique_ptr<SwIterator<SwFrame, sw::BroadcastingModify, sw::IteratorMode::UnwrapMulti>> mpIter; sw::BroadcastingModify* mpMod; std::vector<SwFrame*> mvUpperFrames; // To collect the Upper - sal_uLong mnIndex; // The Index of the to-be-inserted Nodes + SwNodeOffset mnIndex; // The Index of the to-be-inserted Nodes bool mbMaster : 1; // true => only Master, false => only Frames without Follow bool mbInit : 1; // Did we already call First() at SwClient? @@ -47,12 +47,12 @@ class SwNode2LayImpl SwNode2LayImpl& operator=(const SwNode2LayImpl&) = delete; public: - SwNode2LayImpl( const SwNode& rNode, sal_uLong nIdx, bool bSearch ); + SwNode2LayImpl( const SwNode& rNode, SwNodeOffset nIdx, bool bSearch ); SwFrame* NextFrame(); // Returns the next "useful" Frame SwLayoutFrame* UpperFrame( SwFrame* &rpFrame, const SwNode &rNode ); void SaveUpperFrames(); // Saves (and locks if needed) the pUpper // Inserts a Frame under every pUpper of the array - void RestoreUpperFrames( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd ); + void RestoreUpperFrames( SwNodes& rNds, SwNodeOffset nStt, SwNodeOffset nEnd ); SwFrame* GetFrame( const Point* pDocPos ) const; }; @@ -84,7 +84,7 @@ static SwNode* GoNextWithFrame(const SwNodes& rNodes, SwNodeIndex *pIdx) ++aTmp; } - if( aTmp == rNodes.Count()-1 ) + if( aTmp == rNodes.Count()-SwNodeOffset(1) ) pNd = nullptr; else if( pNd ) (*pIdx) = aTmp; @@ -134,7 +134,7 @@ static SwNode* GoPreviousWithFrame(SwNodeIndex *pIdx) * Content or TableNode. * We insert before or after it. */ -SwNode2LayImpl::SwNode2LayImpl( const SwNode& rNode, sal_uLong nIdx, bool bSearch ) +SwNode2LayImpl::SwNode2LayImpl( const SwNode& rNode, SwNodeOffset nIdx, bool bSearch ) : mnIndex( nIdx ), mbInit( false ) { const SwNode* pNd; @@ -337,7 +337,7 @@ SwLayoutFrame* SwNode2LayImpl::UpperFrame( SwFrame* &rpFrame, const SwNode &rNod return pUpper; } -void SwNode2LayImpl::RestoreUpperFrames( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd ) +void SwNode2LayImpl::RestoreUpperFrames( SwNodes& rNds, SwNodeOffset nStt, SwNodeOffset nEnd ) { SwNode* pNd; SwDoc& rDoc = rNds.GetDoc(); @@ -425,7 +425,7 @@ SwFrame* SwNode2LayImpl::GetFrame( const Point* pDocPos ) const return mpMod ? ::GetFrameOfModify(nullptr, *mpMod, FRM_ALL, nullptr, pDocPos ? &tmp : nullptr) : nullptr; } -SwNode2Layout::SwNode2Layout( const SwNode& rNd, sal_uLong nIdx ) +SwNode2Layout::SwNode2Layout( const SwNode& rNd, SwNodeOffset nIdx ) : m_pImpl( new SwNode2LayImpl( rNd, nIdx, false ) ) { } @@ -437,7 +437,7 @@ SwNode2LayoutSaveUpperFrames::SwNode2LayoutSaveUpperFrames(const SwNode& rNd) } void SwNode2LayoutSaveUpperFrames::RestoreUpperFrames( - SwNodes& rNds, sal_uLong const nStt, sal_uLong const nEnd) + SwNodes& rNds, SwNodeOffset const nStt, SwNodeOffset const nEnd) { m_pImpl->RestoreUpperFrames( rNds, nStt, nEnd ); } diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index f720b29f3289..92e3692ec6bc 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -61,7 +61,7 @@ SwNodes::SwNodes( SwDoc& rDocument ) { m_bInNodesDel = m_bInDelUpdOutline = false; - sal_uLong nPos = 0; + SwNodeOffset nPos(0); SwStartNode* pSttNd = new SwStartNode( *this, nPos++ ); m_pEndOfPostIts = new SwEndNode( *this, nPos++, *pSttNd ); @@ -110,21 +110,21 @@ SwNodes::~SwNodes() m_pEndOfContent.reset(); } -void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz, +void SwNodes::ChgNode( SwNodeIndex const & rDelPos, SwNodeOffset nSz, SwNodeIndex& rInsPos, bool bNewFrames ) { // no need for frames in the UndoArea SwNodes& rNds = rInsPos.GetNodes(); - const SwNode* pPrevInsNd = rNds[ rInsPos.GetIndex() -1 ]; + const SwNode* pPrevInsNd = rNds[ rInsPos.GetIndex() -SwNodeOffset(1) ]; // declare all fields as invalid, updating will happen // in the idle-handler of the doc if( GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, &rDelPos.GetNode(), nSz ) && &rNds.GetDoc() != &GetDoc() ) - rNds.GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + rNds.GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); // NEVER include nodes from the RedLineArea - sal_uLong nNd = rInsPos.GetIndex(); + SwNodeOffset nNd = rInsPos.GetIndex(); bool bInsOutlineIdx = ( rNds.GetEndOfRedlines().StartOfSectionNode()->GetIndex() >= nNd || nNd >= rNds.GetEndOfRedlines().GetIndex() ); @@ -133,9 +133,9 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz, { // Move order: from front to back, so that new entries are added at // first position, thus, deletion position stays the same - const sal_uLong nDiff = rDelPos.GetIndex() < rInsPos.GetIndex() ? 0 : 1; + const SwNodeOffset nDiff(rDelPos.GetIndex() < rInsPos.GetIndex() ? 0 : 1); - for( sal_uLong n = rDelPos.GetIndex(); nSz; n += nDiff, --nSz ) + for( SwNodeOffset n = rDelPos.GetIndex(); nSz; n += nDiff, --nSz ) { SwNodeIndex aDelIdx( *this, n ); SwNode& rNd = aDelIdx.GetNode(); @@ -157,7 +157,7 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz, } } - BigPtrArray::Move( aDelIdx.GetIndex(), rInsPos.GetIndex() ); + BigPtrArray::Move( sal_Int32(aDelIdx.GetIndex()), sal_Int32(rInsPos.GetIndex()) ); if( rNd.IsTextNode() ) { @@ -193,7 +193,7 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz, bSavePersData = bRestPersData = true; OUString sNumRule; - for( sal_uLong n = 0; n < nSz; n++ ) + for( SwNodeOffset n(0); n < nSz; n++ ) { SwNode* pNd = &rDelPos.GetNode(); @@ -239,7 +239,7 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz, pTextNd->RemoveFromList(); } - RemoveNode( rDelPos.GetIndex(), 1, false ); // move indices + RemoveNode( rDelPos.GetIndex(), SwNodeOffset(1), false ); // move indices SwContentNode * pCNd = pNd->GetContentNode(); rNds.InsertNode( pNd, rInsPos ); @@ -344,9 +344,9 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz, // declare all fields as invalid, updating will happen // in the idle-handler of the doc - GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); if( &rNds.GetDoc() != &GetDoc() ) - rNds.GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + rNds.GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); if( bNewFrames ) bNewFrames = &GetDoc().GetNodes() == &rNds && @@ -401,7 +401,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, const SwNodeIndex& aIndex, bool bNewFrames ) { SwNode * pCurrentNode; - if( aIndex == 0 || + if( aIndex == SwNodeOffset(0) || ( (pCurrentNode = &aIndex.GetNode())->GetStartNode() && !pCurrentNode->StartOfSectionIndex() )) return false; @@ -430,13 +430,13 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, if( this == &rNodes ) { - if( ( aIndex.GetIndex()-1 >= aRg.aStart.GetIndex() && - aIndex.GetIndex()-1 < aRg.aEnd.GetIndex()) || - ( aIndex.GetIndex()-1 == aRg.aEnd.GetIndex() ) ) + if( ( aIndex.GetIndex()-SwNodeOffset(1) >= aRg.aStart.GetIndex() && + aIndex.GetIndex()-SwNodeOffset(1) < aRg.aEnd.GetIndex()) || + ( aIndex.GetIndex()-SwNodeOffset(1) == aRg.aEnd.GetIndex() ) ) return false; } - sal_uLong nInsPos = 0; // counter for tmp array + SwNodeOffset nInsPos(0); // counter for tmp array // array as a stack, storing all StartOfSelections SwStartNodePointers aSttNdStack; @@ -448,7 +448,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, SwStartNode* pStartNode = aIdx.GetNode().m_pStartOfSection; aSttNdStack.insert( aSttNdStack.begin(), pStartNode ); - SwNodeRange aOrigInsPos( aIdx, -1, aIdx ); // original insertion position + SwNodeRange aOrigInsPos( aIdx, SwNodeOffset(-1), aIdx ); // original insertion position // call DelFrames/MakeFrames for the upmost SectionNode int nSectNdCnt = 0; @@ -469,7 +469,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, SwNodeIndex aSwIndex( aRg.aEnd, 1 ); ChgNode( aSwIndex, nInsPos, aIdx, bNewFrames ); aIdx -= nInsPos; - nInsPos = 0; + nInsPos = SwNodeOffset(0); } SwStartNode* pSttNd = pCurrentNode->m_pStartOfSection; @@ -483,7 +483,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, aRg.aEnd -= nInsPos; // NEVER include nodes from the RedLineArea - sal_uLong nNd = aIdx.GetIndex(); + SwNodeOffset nNd = aIdx.GetIndex(); bool bInsOutlineIdx = ( rNodes.GetEndOfRedlines(). StartOfSectionNode()->GetIndex() >= nNd || nNd >= rNodes.GetEndOfRedlines().GetIndex() ); @@ -496,7 +496,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // move all Start/End/ContentNodes // ContentNodes: delete also the frames! pTableNd->m_pStartOfSection = aIdx.GetNode().m_pStartOfSection; - for( sal_uLong n = 0; n < nInsPos; ++n ) + for( SwNodeOffset n(0); n < nInsPos; ++n ) { SwNodeIndex aMvIdx( aRg.aEnd, 1 ); SwContentNode* pCNd = nullptr; @@ -516,7 +516,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, pCNd = nullptr; } - BigPtrArray::Move( aMvIdx.GetIndex(), aIdx.GetIndex() ); + BigPtrArray::Move( sal_Int32(aMvIdx.GetIndex()), sal_Int32(aIdx.GetIndex()) ); if( bInsOutlineIdx && pCNd ) m_pOutlineNodes->insert( pCNd ); @@ -536,7 +536,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // (copying the array and deleting all found ones eases // searching) SwNodeIndex aMvIdx( aRg.aEnd, 1 ); - for( sal_uLong n = 0; n < nInsPos; ++n ) + for( SwNodeOffset n(0); n < nInsPos; ++n ) { SwNode* pNd = &aMvIdx.GetNode(); @@ -545,7 +545,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, if( bOutlNd ) m_pOutlineNodes->erase( pNd ); - RemoveNode( aMvIdx.GetIndex(), 1, false ); + RemoveNode( aMvIdx.GetIndex(), SwNodeOffset(1), false ); pNd->m_pStartOfSection = pSttNode; rNodes.InsertNode( pNd, aIdx ); @@ -588,7 +588,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, pTableNd->MakeOwnFrames(&aTmp); } aIdx -= nInsPos; - nInsPos = 0; + nInsPos = SwNodeOffset(0); } else if( pSttNd->GetIndex() < aRg.aStart.GetIndex() ) { @@ -645,14 +645,14 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, pSctNd->DelFrames(nullptr, true); } - RemoveNode( aRg.aEnd.GetIndex(), 1, false ); // delete EndNode - sal_uLong nSttPos = pSttNd->GetIndex(); + RemoveNode( aRg.aEnd.GetIndex(), SwNodeOffset(1), false ); // delete EndNode + SwNodeOffset nSttPos = pSttNd->GetIndex(); // this StartNode will be removed later SwStartNode* pTmpSttNd = new SwStartNode( *this, nSttPos+1 ); pTmpSttNd->m_pStartOfSection = pSttNd->m_pStartOfSection; - RemoveNode( nSttPos, 1, false ); // delete SttNode + RemoveNode( nSttPos, SwNodeOffset(1), false ); // delete SttNode pSttNd->m_pStartOfSection = aIdx.GetNode().m_pStartOfSection; rNodes.InsertNode( pSttNd, aIdx ); @@ -692,7 +692,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, SwNodeIndex aSwIndex( aRg.aEnd, 1 ); ChgNode( aSwIndex, nInsPos, aIdx, bNewFrames ); aIdx -= nInsPos; - nInsPos = 0; + nInsPos = SwNodeOffset(0); } new SwPlaceholderNode(aIdx); --aRg.aEnd; @@ -730,7 +730,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, ++aRg.aEnd; { SwNodeIndex aCntIdx( aRg.aEnd ); - for( sal_uLong n = 0; n < nInsPos; n++, ++aCntIdx) + for( SwNodeOffset n(0); n < nInsPos; n++, ++aCntIdx) aCntIdx.GetNode().m_pStartOfSection = pTmpStt; } @@ -751,7 +751,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, SwNodeIndex aSwIndex( aRg.aEnd, 1 ); ChgNode( aSwIndex, nInsPos, aIdx, bNewFrames ); aIdx -= nInsPos+1; - nInsPos = 0; + nInsPos = SwNodeOffset(0); } else // all nodes between StartNode and EndNode were moved { @@ -763,10 +763,10 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, SwNodeIndex aSwIndex( aRg.aEnd, 1 ); ChgNode( aSwIndex, nInsPos, aIdx, bNewFrames ); aIdx -= nInsPos+1; // before inserted StartNode - nInsPos = 0; + nInsPos = SwNodeOffset(0); // remove pointer from node array - RemoveNode( aRg.aEnd.GetIndex(), 1, true ); + RemoveNode( aRg.aEnd.GetIndex(), SwNodeOffset(1), true ); --aRg.aEnd; SwSectionNode* pSectNd = aSttNdStack[ nLevel ]->GetSectionNode(); @@ -786,7 +786,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, ->GetNodeType() && pCurrentNode->StartOfSectionIndex() && pTmpNode->StartOfSectionNode() == pCurrentNode ) { - DelNodes( aRg.aEnd, 2 ); + DelNodes( aRg.aEnd, SwNodeOffset(2) ); --aRg.aEnd; } } @@ -834,7 +834,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, SwNodeIndex aSwIndex( aRg.aEnd, 1 ); ChgNode( aSwIndex, nInsPos, aIdx, bNewFrames ); aIdx -= nInsPos; - nInsPos = 0; + nInsPos = SwNodeOffset(0); } SwNode* pTmpNd = &aIdx.GetNode(); if( pTmpNd->IsSectionNode() || @@ -866,7 +866,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, if( ( pCurrentNode = &aRg.aStart.GetNode())->GetStartNode() && pCurrentNode->StartOfSectionIndex() && aRg.aEnd.GetNode().GetEndNode() ) - DelNodes( aRg.aStart, 2 ); + DelNodes( aRg.aStart, SwNodeOffset(2) ); // initialize numbering update ++aOrigInsPos.aStart; @@ -978,8 +978,8 @@ void SwNodes::SectionUp(SwNodeRange *pRange) { // there was a pairwise reset, adjust only those in the range SwStartNode* pTmpSttNd = pCurrentNode->m_pStartOfSection; - RemoveNode( pRange->aStart.GetIndex(), 1, true ); - RemoveNode( pRange->aEnd.GetIndex(), 1, true ); + RemoveNode( pRange->aStart.GetIndex(), SwNodeOffset(1), true ); + RemoveNode( pRange->aEnd.GetIndex(), SwNodeOffset(1), true ); SwNodeIndex aTmpIdx( pRange->aStart ); while( aTmpIdx < pRange->aEnd ) @@ -1075,18 +1075,18 @@ void SwNodes::SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEn * @param rIndex position to delete at (unchanged afterwards) * @param nNodes number of nodes to delete (default: 1) */ -void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) +void SwNodes::Delete(const SwNodeIndex &rIndex, SwNodeOffset nNodes) { int nLevel = 0; // level counter SwNode * pCurrentNode; - sal_uLong nCnt = Count() - rIndex.GetIndex() - 1; + SwNodeOffset nCnt = Count() - rIndex.GetIndex() - 1; if( nCnt > nNodes ) nCnt = nNodes; - if( nCnt == 0 ) // no count -> return + if( nCnt == SwNodeOffset(0) ) // no count -> return return; - SwNodeRange aRg( rIndex, 0, rIndex, nCnt-1 ); + SwNodeRange aRg( rIndex, SwNodeOffset(0), rIndex, nCnt-1 ); // check if [rIndex..rIndex + nCnt] is larger than the range if( ( !aRg.aStart.GetNode().StartOfSectionIndex() && !aRg.aStart.GetIndex() ) || @@ -1101,7 +1101,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) !pCurrentNode->m_pStartOfSection->IsTableNode() )) --aRg.aEnd; - nCnt = 0; + nCnt = SwNodeOffset(0); //TODO: check/improve comment // increase start so that we are able to use "<" (using "<=" might cause // problems if aEnd == aStart and aEnd is deleted, so aEnd <= aStart) @@ -1154,7 +1154,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) else { RemoveNode( aRg.aEnd.GetIndex()+1, nCnt, true ); // delete - nCnt = 0; + nCnt = SwNodeOffset(0); --aRg.aEnd; // before the EndNode nLevel++; } @@ -1168,13 +1168,13 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) // now delete array ++aRg.aEnd; RemoveNode( aRg.aEnd.GetIndex(), nCnt, true ); - nCnt = 0; + nCnt = SwNodeOffset(0); } } else // remove all nodes between start and end node (incl. both) { RemoveNode( aRg.aEnd.GetIndex(), nCnt + 2, true ); // delete array - nCnt = 0; + nCnt = SwNodeOffset(0); nLevel--; } @@ -1187,7 +1187,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) pCurrentNode->StartOfSectionIndex() ) { // remove end and start node - DelNodes( aRg.aEnd, 2 ); + DelNodes( aRg.aEnd, SwNodeOffset(2) ); pTmpNode = aRg.aEnd.GetNode().GetEndNode(); --aRg.aEnd; } @@ -1217,7 +1217,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) } ++aRg.aEnd; - if( nCnt != 0 ) + if( nCnt != SwNodeOffset(0) ) RemoveNode( aRg.aEnd.GetIndex(), nCnt, true ); // delete the rest // delete all empty start/end node pairs @@ -1226,7 +1226,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) pCurrentNode->StartOfSectionIndex() ) // but none of the holy 5. (???) { - DelNodes( aRg.aStart, 2 ); // delete start and end node + DelNodes( aRg.aStart, SwNodeOffset(2) ); // delete start and end node --aRg.aStart; } @@ -1261,7 +1261,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) sal_uInt16 SwNodes::GetSectionLevel(const SwNodeIndex &rIdx) { // special treatment for 1st Node - if(rIdx == 0) return 1; + if(rIdx == SwNodeOffset(0)) return 1; // no recursion! This calls a SwNode::GetSectionLevel (missing "s") return rIdx.GetNode().GetSectionLevel(); } @@ -1329,9 +1329,9 @@ SwContentNode* SwNodes::GoPrevious(SwNodeIndex *pIdx) * @param rStart starting position in this nodes array * @param nCnt number of nodes to delete */ -void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt ) +void SwNodes::DelNodes( const SwNodeIndex & rStart, SwNodeOffset nCnt ) { - sal_uLong nSttIdx = rStart.GetIndex(); + SwNodeOffset nSttIdx = rStart.GetIndex(); if( !nSttIdx && nCnt == GetEndOfContent().GetIndex()+1 ) { @@ -1347,7 +1347,7 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt ) while( *ppEndNdArr ) { nSttIdx = (*ppEndNdArr)->StartOfSectionIndex() + 1; - sal_uLong nEndIdx = (*ppEndNdArr)->GetIndex(); + SwNodeOffset nEndIdx = (*ppEndNdArr)->GetIndex(); if( nSttIdx != nEndIdx ) RemoveNode( nSttIdx, nEndIdx - nSttIdx, true ); @@ -1358,7 +1358,7 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt ) else { int bUpdateNum = 0; - for( sal_uLong n = nSttIdx, nEnd = nSttIdx + nCnt; n < nEnd; ++n ) + for( SwNodeOffset n = nSttIdx, nEnd = nSttIdx + nCnt; n < nEnd; ++n ) { SwNode* pNd = (*this)[ n ]; @@ -1470,8 +1470,8 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) if( !pEnd->nNode.GetNode().IsContentNode() ) { bOneNd = true; - sal_uLong nSttNdIdx = pStt->nNode.GetIndex() + 1; - const sal_uLong nEndNdIdx = pEnd->nNode.GetIndex(); + SwNodeOffset nSttNdIdx = pStt->nNode.GetIndex() + 1; + const SwNodeOffset nEndNdIdx = pEnd->nNode.GetIndex(); for( ; nSttNdIdx < nEndNdIdx; ++nSttNdIdx ) { if( (*this)[ nSttNdIdx ]->IsContentNode() ) @@ -1627,7 +1627,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) if( aEndIdx != aSttIdx ) { // move the nodes into the NodesArray - const sal_uLong nSttDiff = aSttIdx.GetIndex() - pStt->nNode.GetIndex(); + const SwNodeOffset nSttDiff = aSttIdx.GetIndex() - pStt->nNode.GetIndex(); SwNodeRange aRg( aSttIdx, aEndIdx ); MoveNodes( aRg, rNodes, rPos.nNode ); @@ -1663,7 +1663,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange, SwDoc& rDoc = rIndex.GetNode().GetDoc(); SwNode * pCurrentNode; - if( rIndex == 0 || + if( rIndex == SwNodeOffset(0) || ( (pCurrentNode = &rIndex.GetNode())->GetStartNode() && !pCurrentNode->StartOfSectionIndex() )) return; @@ -1677,16 +1677,16 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange, ++aRg.aStart; const SwNode *aEndNode = &aRg.aEnd.GetNode(); - int nIsEndOfContent = (aEndNode == &aEndNode->GetNodes().GetEndOfContent()) ? 1 : 0; + SwNodeOffset nIsEndOfContent((aEndNode == &aEndNode->GetNodes().GetEndOfContent()) ? 1 : 0); - if (0 == nIsEndOfContent) + if (SwNodeOffset(0) == nIsEndOfContent) { // if aEnd-1 points to no ContentNode, search previous one --aRg.aEnd; // #i107142#: if aEnd is start node of a special section, do nothing. // Otherwise this could lead to crash: going through all previous // special section nodes and then one before the first. - if (aRg.aEnd.GetNode().StartOfSectionIndex() != 0) + if (aRg.aEnd.GetNode().StartOfSectionIndex() != SwNodeOffset(0)) { while( ((pCurrentNode = & aRg.aEnd.GetNode())->GetStartNode() && !pCurrentNode->IsSectionNode() ) || @@ -1717,8 +1717,8 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange, SwNodeIndex aOrigInsPos( rIndex, -1 ); // original insertion position int nLevel = 0; // level counter - for( tools::Long nNodeCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex(); - nNodeCnt > 0; --nNodeCnt ) + for( SwNodeOffset nNodeCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex(); + nNodeCnt > SwNodeOffset(0); --nNodeCnt ) { pCurrentNode = &aRg.aStart.GetNode(); switch( pCurrentNode->GetNodeType() ) @@ -1729,13 +1729,13 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange, rDoc.GetNodes().GetEndOfInserts().StartOfSectionIndex() < aInsPos.GetIndex() ) { - const tools::Long nDistance = + const SwNodeOffset nDistance = pCurrentNode->EndOfSectionIndex() - aRg.aStart.GetIndex(); if (nDistance < nNodeCnt) nNodeCnt -= nDistance; else - nNodeCnt = 1; + nNodeCnt = SwNodeOffset(1); // insert a DummyNode for a TableNode if( bTableInsDummyNode ) @@ -1751,7 +1751,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange, new SwPlaceholderNode(aInsPos); SwStartNode* pSttNd = aRg.aStart.GetNode().GetStartNode(); - CopyNodes( SwNodeRange( *pSttNd, + 1, + CopyNodes( SwNodeRange( *pSttNd, SwNodeOffset(+ 1), *pSttNd->EndOfSectionNode() ), aInsPos, bNewFrames ); @@ -1770,11 +1770,11 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange, SwNodeIndex nStt( aInsPos, -1 ); SwTableNode* pTableNd = static_cast<SwTableNode*>(pCurrentNode)-> MakeCopy( rDoc, aInsPos ); - const tools::Long nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2; + const SwNodeOffset nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2; if (nDistance < nNodeCnt) nNodeCnt -= nDistance; else - nNodeCnt = 1 - nIsEndOfContent; + nNodeCnt = SwNodeOffset(1) - nIsEndOfContent; aRg.aStart = pCurrentNode->EndOfSectionIndex(); @@ -1798,11 +1798,11 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange, SwSectionNode* pSectNd = static_cast<SwSectionNode*>(pCurrentNode)-> MakeCopy( rDoc, aInsPos ); - const tools::Long nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2; + const SwNodeOffset nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2; if (nDistance < nNodeCnt) nNodeCnt -= nDistance; else - nNodeCnt = 1 - nIsEndOfContent; + nNodeCnt = SwNodeOffset(1) - nIsEndOfContent; aRg.aStart = pCurrentNode->EndOfSectionIndex(); if( bNewFrames && pSectNd && @@ -1827,13 +1827,13 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange, --nLevel; ++aInsPos; // EndNode already exists } - else if( 1 == nNodeCnt && 1 == nIsEndOfContent ) + else if( SwNodeOffset(1) == nNodeCnt && SwNodeOffset(1) == nIsEndOfContent ) // we have reached the EndOfContent node - nothing to do! continue; else if( !pCurrentNode->m_pStartOfSection->IsSectionNode() ) { // create a section at the original InsertPosition - SwNodeRange aTmpRg( aOrigInsPos, 1, aInsPos ); + SwNodeRange aTmpRg( aOrigInsPos, SwNodeOffset(1), aInsPos ); rDoc.GetNodes().SectionDown( &aTmpRg, pCurrentNode->m_pStartOfSection->GetStartNodeType() ); } @@ -1876,7 +1876,7 @@ void SwNodes::DelDummyNodes( const SwNodeRange& rRg ) while( aIdx.GetIndex() < rRg.aEnd.GetIndex() ) { if (SwNodeType::PlaceHolder == aIdx.GetNode().GetNodeType()) - RemoveNode( aIdx.GetIndex(), 1, true ); + RemoveNode( aIdx.GetIndex(), SwNodeOffset(1), true ); else ++aIdx; } @@ -1971,7 +1971,7 @@ SwContentNode* SwNodes::GoPrevSection( SwNodeIndex * pIdx, bool bFirst = true; SwNodeIndex aTmp( *pIdx ); const SwNode* pNd; - while( aTmp > 0 ) + while( aTmp > SwNodeOffset(0) ) { pNd = & aTmp.GetNode(); if (SwNodeType::End == pNd->GetNodeType()) @@ -2155,19 +2155,19 @@ SwNode* SwNodes::FindPrvNxtFrameNode( SwNodeIndex& rFrameIdx, return pFrameNd; } -void SwNodes::ForEach( sal_uLong nStart, sal_uLong nEnd, +void SwNodes::ForEach( SwNodeOffset nStart, SwNodeOffset nEnd, FnForEach_SwNodes fn, void* pArgs ) { - if( nEnd > m_nSize ) - nEnd = m_nSize; + if( nEnd > SwNodeOffset(m_nSize) ) + nEnd = SwNodeOffset(m_nSize); if( nStart >= nEnd ) return; - sal_uInt16 cur = Index2Block( nStart ); + sal_uInt16 cur = Index2Block( sal_Int32(nStart) ); BlockInfo** pp = m_ppInf.get() + cur; BlockInfo* p = *pp; - sal_uInt16 nElem = sal_uInt16( nStart - p->nStart ); + sal_uInt16 nElem = sal_uInt16( sal_Int32(nStart) - p->nStart ); auto pElem = p->mvData.begin() + nElem; nElem = p->nElem - nElem; for(;;) @@ -2192,12 +2192,12 @@ void SwNodes::ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd, ForEach( rStart.GetIndex(), rEnd.GetIndex(), fnForEach, pArgs ); } -void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel ) +void SwNodes::RemoveNode( SwNodeOffset nDelPos, SwNodeOffset nSz, bool bDel ) { #ifndef NDEBUG SwNode *const pFirst((*this)[nDelPos]); #endif - for (sal_uLong nCnt = 0; nCnt < nSz; nCnt++) + for (SwNodeOffset nCnt(0); nCnt < nSz; nCnt++) { SwNode* pNode = (*this)[ nDelPos + nCnt ]; SwTextNode * pTextNd = pNode->GetTextNode(); @@ -2209,7 +2209,7 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel ) // so their anchor still points to correct node when deleted! // NOTE: this will call RemoveNode() recursively! // so adjust our indexes to account for removed nodes - sal_uLong const nPos = pTextNd->GetIndex(); + SwNodeOffset const nPos = pTextNd->GetIndex(); SwpHints *const pHints(pTextNd->GetpSwpHints()); if (pHints) { @@ -2226,7 +2226,7 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel ) { pTextNd->DeleteAttribute(pHint); } // pHints may be dead now - sal_uLong const nDiff = nPos - pTextNd->GetIndex(); + SwNodeOffset const nDiff = nPos - pTextNd->GetIndex(); if (nDiff) { nDelPos -= nDiff; @@ -2246,12 +2246,12 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel ) } } - sal_uLong nEnd = nDelPos + nSz; + SwNodeOffset nEnd = nDelPos + nSz; SwNode* pNew = (*this)[ nEnd ]; for (SwNodeIndex& rIndex : m_vIndices->GetRingContainer()) { - sal_uLong const nIdx = rIndex.GetIndex(); + SwNodeOffset const nIdx = rIndex.GetIndex(); if (nDelPos <= nIdx && nIdx < nEnd) rIndex = *pNew; } @@ -2259,7 +2259,7 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel ) std::vector<BigPtrEntry> aTempEntries; if( bDel ) { - sal_uLong nCnt = nSz; + SwNodeOffset nCnt = nSz; BigPtrEntry *pDel = (*this)[ nDelPos+nCnt-1 ], *pPrev = (*this)[ nDelPos+nCnt-2 ]; // set temporary object @@ -2267,14 +2267,14 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel ) // call Remove recursively, e.g. for character bound frames. However, // since there happens way too much here, this temporary object was // inserted that will be deleted in Remove again (see Bug 55406) - aTempEntries.resize(nCnt); + aTempEntries.resize(sal_Int32(nCnt)); while( nCnt-- ) { delete pDel; pDel = pPrev; sal_uLong nPrevNdIdx = pPrev->GetPos(); - BigPtrEntry* pTempEntry = &aTempEntries[nCnt]; + BigPtrEntry* pTempEntry = &aTempEntries[sal_Int32(nCnt)]; BigPtrArray::Replace( nPrevNdIdx+1, pTempEntry ); if( nCnt ) pPrev = BigPtrArray::operator []( nPrevNdIdx - 1 ); @@ -2282,22 +2282,22 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel ) // aTempEntries, so the downcast to SwNode* in // SwNodes::operator[] would be illegal (and unnecessary) } - nDelPos = pDel->GetPos() + 1; + nDelPos = SwNodeOffset(pDel->GetPos() + 1); } - BigPtrArray::Remove( nDelPos, nSz ); + BigPtrArray::Remove( sal_Int32(nDelPos), sal_Int32(nSz) ); } void SwNodes::InsertNode( SwNode* pNode, const SwNodeIndex& rPos ) { BigPtrEntry* pIns = pNode; - BigPtrArray::Insert( pIns, rPos.GetIndex() ); + BigPtrArray::Insert( pIns, sal_Int32(rPos.GetIndex()) ); } -void SwNodes::InsertNode( SwNode* pNode, sal_uLong nPos ) +void SwNodes::InsertNode( SwNode* pNode, SwNodeOffset nPos ) { BigPtrEntry* pIns = pNode; - BigPtrArray::Insert( pIns, nPos ); + BigPtrArray::Insert( pIns, sal_Int32(nPos) ); } // ->#112139# @@ -2307,11 +2307,11 @@ SwNode * SwNodes::DocumentSectionStartNode(SwNode * pNode) const { SwNodeIndex aIdx(*pNode); - if (aIdx <= (*this)[0]->EndOfSectionIndex()) - pNode = (*this)[0]; + if (aIdx <= (*this)[SwNodeOffset(0)]->EndOfSectionIndex()) + pNode = (*this)[SwNodeOffset(0)]; else { - while ((*this)[0] != pNode->StartOfSectionNode()) + while ((*this)[SwNodeOffset(0)] != pNode->StartOfSectionNode()) pNode = pNode->StartOfSectionNode(); } } @@ -2332,7 +2332,7 @@ bool SwNodes::IsDocNodes() const void SwNodes::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwNodes")); - for (sal_uLong i = 0; i < Count(); ++i) + for (SwNodeOffset i(0); i < Count(); ++i) (*this)[i]->dumpAsXml(pWriter); (void)xmlTextWriterEndElement(pWriter); } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 4efc335d4f33..ec77917bd30d 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -81,7 +81,7 @@ namespace { const OUString& rMimeType, const css::uno::Any & rValue ) override; virtual const SwNode* GetAnchor() const override; - virtual bool IsInRange( sal_uLong nSttNd, sal_uLong nEndNd ) const override; + virtual bool IsInRange( SwNodeOffset nSttNd, SwNodeOffset nEndNd ) const override; SwSectionNode* GetSectNode() { @@ -658,7 +658,7 @@ SwSectionFormat::~SwSectionFormat() CallSwClientNotify( SwSectionFrameMoveAndDeleteHint( true ) ); // Raise the Section up - SwNodeRange aRg( *pSectNd, 0, *pSectNd->EndOfSectionNode() ); + SwNodeRange aRg( *pSectNd, SwNodeOffset(0), *pSectNd->EndOfSectionNode() ); GetDoc()->GetNodes().SectionUp( &aRg ); } LockModify(); @@ -693,8 +693,8 @@ void SwSectionFormat::DelFrames() pLast = aIter.Next(); } - sal_uLong nEnd = pSectNd->EndOfSectionIndex(); - sal_uLong nStart = pSectNd->GetIndex()+1; + SwNodeOffset nEnd = pSectNd->EndOfSectionIndex(); + SwNodeOffset nStart = pSectNd->GetIndex()+1; sw_DeleteFootnote( pSectNd, nStart, nEnd ); } if( !pIdx ) @@ -1275,7 +1275,7 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& rUpdLnk, SwSectionNode& rSe } } else if( pSrcDoc != pDoc ) - pCpyRg.reset(new SwNodeRange( pSrcDoc->GetNodes().GetEndOfExtras(), 2, + pCpyRg.reset(new SwNodeRange( pSrcDoc->GetNodes().GetEndOfExtras(), SwNodeOffset(2), pSrcDoc->GetNodes().GetEndOfContent() )); // #i81653# @@ -1304,7 +1304,7 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& rUpdLnk, SwSectionNode& rSe // Delete last Node, only if it was copied successfully // (the Section contains more than one Node) - if( 2 < pSectNd->EndOfSectionIndex() - pSectNd->GetIndex() ) + if( SwNodeOffset(2) < pSectNd->EndOfSectionIndex() - pSectNd->GetIndex() ) { aSave = rInsPos; pPam->Move( fnMoveBackward, GoInNode ); @@ -1523,7 +1523,7 @@ void SwSection::BreakLink() const SwNode* SwIntrnlSectRefLink::GetAnchor() const { return m_rSectFormat.GetSectionNode(); } -bool SwIntrnlSectRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd ) const +bool SwIntrnlSectRefLink::IsInRange( SwNodeOffset nSttNd, SwNodeOffset nEndNd ) const { SwStartNode* pSttNd = m_rSectFormat.GetSectionNode(); return pSttNd && diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx index 1929575a94c6..5a5967c879ab 100644 --- a/sw/source/core/docnode/swbaslnk.cxx +++ b/sw/source/core/docnode/swbaslnk.cxx @@ -312,7 +312,7 @@ bool SwBaseLink::IsRecursion( const SwBaseLink* pChkLnk ) const return false; } -bool SwBaseLink::IsInRange( sal_uLong, sal_uLong ) const +bool SwBaseLink::IsInRange( SwNodeOffset, SwNodeOffset ) const { // Not Graphic or OLE Links // Fields or Sections have their own derivation! diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index 5ee956672643..63f9229566c1 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -586,7 +586,7 @@ void SwAutoCorrDoc::SaveCpltSttWord( ACFlags nFlag, sal_Int32 nPos, const OUString& rExceptWord, sal_Unicode cChar ) { - sal_uLong nNode = m_pIndex ? m_pIndex->GetIndex() : m_rCursor.GetPoint()->nNode.GetIndex(); + SwNodeOffset nNode = m_pIndex ? m_pIndex->GetIndex() : m_rCursor.GetPoint()->nNode.GetIndex(); LanguageType eLang = GetLanguage(nPos); m_rEditSh.GetDoc()->SetAutoCorrExceptWord( std::make_unique<SwAutoCorrExceptWord>( nFlag, nNode, nPos, rExceptWord, cChar, eLang )); diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index e4f226bfe535..791430271b07 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -95,7 +95,7 @@ class SwAutoFormat SwTextNode* m_pCurTextNd; // the current TextNode SwTextFrame* m_pCurTextFrame; // frame of the current TextNode bool m_bIsRightToLeft; // text direction of the current frame - sal_uLong m_nEndNdIdx; // for the percentage-display + SwNodeOffset m_nEndNdIdx; // for the percentage-display mutable std::unique_ptr<CharClass> m_pCharClass; // Character classification mutable LanguageType m_eCharClassLang; @@ -332,7 +332,7 @@ void SwAutoFormat::GoNextPara() } while( !pNewNd->IsTextNode() ); if( !m_aFlags.bAFormatByInput ) - ::SetProgressState( m_aNdIdx.GetIndex() + m_nEndNdIdx - m_aEndNdIdx.GetIndex(), + ::SetProgressState( sal_Int32(m_aNdIdx.GetIndex() + m_nEndNdIdx - m_aEndNdIdx.GetIndex()), m_pDoc->GetDocShell() ); m_pCurTextNd = static_cast<SwTextNode*>(pNewNd); @@ -2239,7 +2239,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const & SwNodeIndex const * pSttNd, SwNodeIndex const * pEndNd ) : m_aFlags( rFlags ), m_aDelPam( pEdShell->GetDoc()->GetNodes().GetEndOfExtras() ), - m_aNdIdx( pEdShell->GetDoc()->GetNodes().GetEndOfExtras(), +1 ), + m_aNdIdx( pEdShell->GetDoc()->GetNodes().GetEndOfExtras(), SwNodeOffset(+1) ), m_aEndNdIdx( pEdShell->GetDoc()->GetNodes().GetEndOfContent() ), m_pEditShell( pEdShell ), m_pDoc( pEdShell->GetDoc() ), @@ -2288,8 +2288,8 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const & if( !m_aFlags.bAFormatByInput ) { m_nEndNdIdx = m_aEndNdIdx.GetIndex(); - ::StartProgress( STR_STATSTR_AUTOFORMAT, m_aNdIdx.GetIndex(), - m_nEndNdIdx, + ::StartProgress( STR_STATSTR_AUTOFORMAT, sal_Int32(m_aNdIdx.GetIndex()), + sal_Int32(m_nEndNdIdx), m_pDoc->GetDocShell() ); } @@ -2351,7 +2351,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const & if (m_aFlags.bDelEmptyNode && !HasObjects(*m_pCurTextFrame)) { bEmptyLine = true; - sal_uLong nOldCnt = m_pDoc->GetNodes().Count(); + SwNodeOffset nOldCnt = m_pDoc->GetNodes().Count(); DelEmptyLine(); // Was there really a deletion of a node? if( nOldCnt != m_pDoc->GetNodes().Count() ) diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index 86d9763599bc..b249deb336f0 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -105,12 +105,12 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet, continue; } - sal_uLong nSttNd = rCurrentPaM.Start()->nNode.GetIndex(), - nEndNd = rCurrentPaM.End()->nNode.GetIndex(); + SwNodeOffset nSttNd = rCurrentPaM.Start()->nNode.GetIndex(), + nEndNd = rCurrentPaM.End()->nNode.GetIndex(); sal_Int32 nSttCnt = rCurrentPaM.Start()->nContent.GetIndex(); sal_Int32 nEndCnt = rCurrentPaM.End()->nContent.GetIndex(); - if( nEndNd - nSttNd >= getMaxLookup() ) + if( sal_Int32(nEndNd - nSttNd) >= getMaxLookup() ) { rSet.ClearItem(); rSet.InvalidateAllItems(); @@ -119,7 +119,7 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet, // at first node the node enter his values into the GetSet (Initial) // all additional nodes are additional merged to GetSet - for( sal_uLong n = nSttNd; n <= nEndNd; ++n ) + for( SwNodeOffset n = nSttNd; n <= nEndNd; ++n ) { SwNode* pNd = GetDoc()->GetNodes()[ n ]; switch( pNd->GetNodeType() ) @@ -191,7 +191,7 @@ void SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const { // for all the point and mark (selections) // get the start and the end node of the current selection - sal_uLong nSttNd = rCurrentPaM.GetMark()->nNode.GetIndex(), + SwNodeOffset nSttNd = rCurrentPaM.GetMark()->nNode.GetIndex(), nEndNd = rCurrentPaM.GetPoint()->nNode.GetIndex(); // reverse start and end if there number aren't sorted correctly @@ -201,7 +201,7 @@ void SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const // for all the nodes in the current selection // get the node (paragraph) attributes // and merge them in rSet - for( sal_uLong n = nSttNd; n <= nEndNd; ++n ) + for( SwNodeOffset n = nSttNd; n <= nEndNd; ++n ) { // get the node SwNode* pNd = GetDoc()->GetNodes()[ n ]; @@ -249,11 +249,11 @@ SwTextFormatColl* SwEditShell::GetPaMTextFormatColl( SwPaM* pPaM ) const { // for all the point and mark (selections) // get the start and the end node of the current selection - sal_uLong nSttNd = rCurrentPaM.Start()->nNode.GetIndex(), - nEndNd = rCurrentPaM.End()->nNode.GetIndex(); + SwNodeOffset nSttNd = rCurrentPaM.Start()->nNode.GetIndex(), + nEndNd = rCurrentPaM.End()->nNode.GetIndex(); // for all the nodes in the current Point and Mark - for( sal_uLong n = nSttNd; n <= nEndNd; ++n ) + for( SwNodeOffset n = nSttNd; n <= nEndNd; ++n ) { // get the node SwNode* pNd = GetDoc()->GetNodes()[ n ]; @@ -289,7 +289,7 @@ std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> SwEditShell { // for all the point and mark (selections) // get the start and the end node of the current selection - sal_uLong nSttNd = rCurrentPaM.Start()->nNode.GetIndex(), + SwNodeOffset nSttNd = rCurrentPaM.Start()->nNode.GetIndex(), nEndNd = rCurrentPaM.End()->nNode.GetIndex(); sal_Int32 nSttCnt = rCurrentPaM.Start()->nContent.GetIndex(); sal_Int32 nEndCnt = rCurrentPaM.End()->nContent.GetIndex(); @@ -298,7 +298,7 @@ std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> SwEditShell const SfxPoolItem* pItem = nullptr; // for all the nodes in the current selection - for( sal_uLong n = nSttNd; n <= nEndNd; ++n ) + for( SwNodeOffset n = nSttNd; n <= nEndNd; ++n ) { SwNode* pNd = GetDoc()->GetNodes()[ n ]; if( pNd->IsTextNode() ) @@ -503,11 +503,11 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { - sal_uLong nSttNd = rPaM.Start()->nNode.GetIndex(), - nEndNd = rPaM.End()->nNode.GetIndex(); + SwNodeOffset nSttNd = rPaM.Start()->nNode.GetIndex(), + nEndNd = rPaM.End()->nNode.GetIndex(); SwContentNode* pCNd; - for( sal_uLong n = nSttNd; bRet && n <= nEndNd; ++n ) + for( SwNodeOffset n = nSttNd; bRet && n <= nEndNd; ++n ) { pCNd = GetDoc()->GetNodes()[ n ]->GetTextNode(); if( nullptr != pCNd ) @@ -706,7 +706,7 @@ SvtScriptType SwEditShell::GetScriptType() const } else { - sal_uLong nEndIdx = pEnd->nNode.GetIndex(); + SwNodeOffset nEndIdx = pEnd->nNode.GetIndex(); SwNodeIndex aIdx( pStt->nNode ); for( ; aIdx.GetIndex() <= nEndIdx; ++aIdx ) if( aIdx.GetNode().IsTextNode() ) diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index ece88ce9d74a..cfc7453a902a 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -87,7 +87,7 @@ void SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const // and finally add the dummies (other text) SwNode* pNd; - sal_uLong nSttIdx = pMyDoc->GetNodes().GetEndOfExtras().GetIndex() + 2; + SwNodeOffset nSttIdx = pMyDoc->GetNodes().GetEndOfExtras().GetIndex() + 2; for( SwGlblDocContents::size_type n = 0; n < rArr.size(); ++n ) { const SwGlblDocContent& rNew = *rArr[ n ]; @@ -111,7 +111,7 @@ void SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const // Should the end also be set? if( !rArr.empty() ) { - sal_uLong nNdEnd = pMyDoc->GetNodes().GetEndOfContent().GetIndex(); + SwNodeOffset nNdEnd = pMyDoc->GetNodes().GetEndOfContent().GetIndex(); for( ; nSttIdx < nNdEnd; ++nSttIdx ) if( ( pNd = pMyDoc->GetNodes()[ nSttIdx ])->IsContentNode() || pNd->IsSectionNode() || pNd->IsTableNode() ) @@ -248,7 +248,7 @@ void SwEditShell::DeleteGlobalDocContent( const SwGlblDocContents& rArr , SwDoc* pMyDoc = GetDoc(); const SwGlblDocContent& rDelPos = *rArr[ nDelPos ]; - sal_uLong nDelIdx = rDelPos.GetDocPos(); + SwNodeOffset nDelIdx = rDelPos.GetDocPos(); if( 1 == rArr.size() ) { // we need at least one node! @@ -356,7 +356,7 @@ void SwEditShell::GotoGlobalDocContent( const SwGlblDocContent& rPos ) EndCursorMove(); } -SwGlblDocContent::SwGlblDocContent( sal_uLong nPos ) +SwGlblDocContent::SwGlblDocContent( SwNodeOffset nPos ) { m_eType = GLBLDOC_UNKNOWN; m_PTR.pTOX = nullptr; @@ -369,7 +369,7 @@ SwGlblDocContent::SwGlblDocContent( const SwTOXBaseSection* pTOX ) m_PTR.pTOX = pTOX; const SwSectionNode* pSectNd = pTOX->GetFormat()->GetSectionNode(); - m_nDocPos = pSectNd ? pSectNd->GetIndex() : 0; + m_nDocPos = pSectNd ? pSectNd->GetIndex() : SwNodeOffset(0); } SwGlblDocContent::SwGlblDocContent( const SwSection* pSect ) @@ -378,7 +378,7 @@ SwGlblDocContent::SwGlblDocContent( const SwSection* pSect ) m_PTR.pSect = pSect; const SwSectionNode* pSectNd = pSect->GetFormat()->GetSectionNode(); - m_nDocPos = pSectNd ? pSectNd->GetIndex() : 0; + m_nDocPos = pSectNd ? pSectNd->GetIndex() : SwNodeOffset(0); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index f945017da201..c72104c7b4e3 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -464,7 +464,7 @@ OUString SwEditShell::GetDropText( const sal_Int32 nChars ) const { // if a multi selection exists, search for the first line // -> it is the cursor with the lowest index - sal_uLong nIndex = pCursor->GetMark()->nNode.GetIndex(); + SwNodeOffset nIndex = pCursor->GetMark()->nNode.GetIndex(); bool bPrev = true; SwPaM* pLast = pCursor; SwPaM* pTemp = pCursor; @@ -475,7 +475,7 @@ OUString SwEditShell::GetDropText( const sal_Int32 nChars ) const if ( bPrev ) { pTemp = pPrev2; - sal_uLong nTemp = pPrev2->GetMark()->nNode.GetIndex(); + SwNodeOffset nTemp = pPrev2->GetMark()->nNode.GetIndex(); if ( nTemp < nIndex ) { nIndex = nTemp; @@ -768,8 +768,8 @@ void SwEditShell::SetNumberingRestart() else MakeFindRange(SwDocPositions::OtherStart, SwDocPositions::OtherEnd, pCursor); // extra content SwPosition* pSttPos = pCursor->Start(), *pEndPos = pCursor->End(); - sal_uLong nCurrNd = pSttPos->nNode.GetIndex(); - sal_uLong nEndNd = pEndPos->nNode.GetIndex(); + SwNodeOffset nCurrNd = pSttPos->nNode.GetIndex(); + SwNodeOffset nEndNd = pEndPos->nNode.GetIndex(); if( nCurrNd <= nEndNd ) { SwContentFrame* pContentFrame; @@ -851,7 +851,7 @@ sal_uInt16 SwEditShell::GetLineCount() SwContentNode* pCNd; SwContentFrame *pContentFrame = nullptr; - aStart = 0; + aStart = SwNodeOffset(0); while( nullptr != ( pCNd = GetDoc()->GetNodes().GoNextSection( &aStart, true, false )) ) diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index a1f40783c455..8e46f915c35e 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -160,9 +160,9 @@ bool SwEditShell::SelectionHasNumber() const { aRangeArr.SetPam( n, aPam ); { - sal_uInt32 nStt = aPam.Start()->nNode.GetIndex(), - nEnd = aPam.End()->nNode.GetIndex(); - for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++) + SwNodeOffset nStt = aPam.Start()->nNode.GetIndex(), + nEnd = aPam.End()->nNode.GetIndex(); + for (SwNodeOffset nPos = nStt; nPos<=nEnd; nPos++) { pTextNd = mxDoc->GetNodes()[nPos]->GetTextNode(); if (pTextNd) @@ -205,9 +205,9 @@ bool SwEditShell::SelectionHasBullet() const { aRangeArr.SetPam( n, aPam ); { - sal_uInt32 nStt = aPam.Start()->nNode.GetIndex(), - nEnd = aPam.End()->nNode.GetIndex(); - for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++) + SwNodeOffset nStt = aPam.Start()->nNode.GetIndex(), + nEnd = aPam.End()->nNode.GetIndex(); + for (SwNodeOffset nPos = nStt; nPos<=nEnd; nPos++) { pTextNd = mxDoc->GetNodes()[nPos]->GetTextNode(); if (pTextNd) @@ -386,7 +386,7 @@ void SwEditShell::SetIndent(short nIndent, const SwPosition & rPos) EndAllAction(); } -bool SwEditShell::MoveParagraph( tools::Long nOffset ) +bool SwEditShell::MoveParagraph( SwNodeOffset nOffset ) { StartAllAction(); @@ -440,7 +440,7 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft ) if( bUpperLower ) { // on top of the next numbering - tools::Long nOffset = 0; + SwNodeOffset nOffset(0); const SwNode* pNd; if( bUpperLeft ) // move up @@ -451,7 +451,7 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft ) aCursor.GetMark()->nNode.GetIndex(); else { - sal_uLong nStt = aPos.nNode.GetIndex(), nIdx = nStt - 1; + SwNodeOffset nStt = aPos.nNode.GetIndex(), nIdx = nStt - 1; if (SwTextNode const*const pStt = aPos.nNode.GetNode().GetTextNode()) { @@ -475,7 +475,7 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft ) if( aCursor.GetNode().IsTextNode() && pOrig == aCursor.GetNode().GetTextNode()->GetNumRule() ) { - sal_uLong nStt = aCursor.GetPoint()->nNode.GetIndex(), nIdx = nStt+1; + SwNodeOffset nStt = aCursor.GetPoint()->nNode.GetIndex(), nIdx = nStt+1; if (SwTextNode const*const pStt = aCursor.GetPoint()->nNode.GetNode().GetTextNode()) { std::pair<SwTextNode *, SwTextNode *> nodes( @@ -516,12 +516,12 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft ) } if( nStt == nIdx || !GetDoc()->GetNodes()[ nIdx ]->IsTextNode() ) - nOffset = 1; + nOffset = SwNodeOffset(1); else nOffset = nIdx - nStt; } else - nOffset = 1; + nOffset = SwNodeOffset(1); } if( nOffset ) diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index bbc58b2747a7..71541b4de96d 100644 --- a/sw/source/core/edit/edsect.cxx +++ b/sw/source/core/edit/edsect.cxx @@ -406,7 +406,7 @@ void SwEditShell::DoSpecialInsert() // adjust insert position to insert before start nodes and after end // nodes SwNodeIndex aInsertIndex( *pInsertNode, - pInsertNode->IsStartNode() ? -1 : 0 ); + SwNodeOffset(pInsertNode->IsStartNode() ? -1 : 0) ); SwPosition aInsertPos( aInsertIndex ); // insert a new text node, and set the cursor diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index 7fac4d6721ee..3ac95530292f 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -205,8 +205,8 @@ bool SwEditShell::IsTextToTableAvailable() const bOnlyText = true; // check if selection is in listing - sal_uLong nStt = rPaM.Start()->nNode.GetIndex(), - nEnd = rPaM.End()->nNode.GetIndex(); + SwNodeOffset nStt = rPaM.Start()->nNode.GetIndex(), + nEnd = rPaM.End()->nNode.GetIndex(); for( ; nStt <= nEnd; ++nStt ) if( !GetDoc()->GetNodes()[ nStt ]->IsTextNode() ) @@ -404,8 +404,8 @@ bool SwEditShell::IsTableBoxTextFormat() const return GetDoc()->GetNumberFormatter()->IsTextFormat( nFormat ); } - sal_uLong nNd = pBox->IsValidNumTextNd(); - if( ULONG_MAX == nNd ) + SwNodeOffset nNd = pBox->IsValidNumTextNd(); + if( NODE_OFFSET_MAX == nNd ) return true; const OUString& rText = GetDoc()->GetNodes()[ nNd ]->GetTextNode()->GetText(); @@ -431,8 +431,8 @@ OUString SwEditShell::GetTableBoxText() const pBox = static_cast<SwCellFrame*>(pFrame)->GetTabBox(); } - sal_uLong nNd; - if( pBox && ULONG_MAX != ( nNd = pBox->IsValidNumTextNd() ) ) + SwNodeOffset nNd; + if( pBox && NODE_OFFSET_MAX != ( nNd = pBox->IsValidNumTextNd() ) ) sRet = GetDoc()->GetNodes()[ nNd ]->GetTextNode()->GetText(); } return sRet; diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index e21469f6408b..293a5f9f7960 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -151,11 +151,11 @@ bool SwEditShell::HasOtherCnt() const const SwNode *pNd; pNd = &rNds.GetEndOfInserts(); - if ( 1 != (pNd->GetIndex() - pNd->StartOfSectionIndex()) ) + if ( SwNodeOffset(1) != (pNd->GetIndex() - pNd->StartOfSectionIndex()) ) return true; pNd = &rNds.GetEndOfAutotext(); - return 1 != (pNd->GetIndex() - pNd->StartOfSectionIndex()); + return SwNodeOffset(1) != (pNd->GetIndex() - pNd->StartOfSectionIndex()); } SwActContext::SwActContext(SwEditShell *pShell) diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index 9e07a8afa9bf..2e060e4ae377 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -55,7 +55,7 @@ public: const OUString& rMimeType, const css::uno::Any & rValue ) override; virtual const SwNode* GetAnchor() const override; - virtual bool IsInRange( sal_uLong nSttNd, sal_uLong nEndNd ) const override; + virtual bool IsInRange( SwNodeOffset nSttNd, SwNodeOffset nEndNd ) const override; }; } @@ -176,7 +176,7 @@ const SwNode* SwIntrnlRefLink::GetAnchor() const return pNd; } -bool SwIntrnlRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd ) const +bool SwIntrnlRefLink::IsInRange( SwNodeOffset nSttNd, SwNodeOffset nEndNd ) const { bool bInRange = false; m_rFieldType.CallSwClientNotify(sw::InRangeSearchHint(nSttNd, nEndNd, bInRange)); diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index 84a7cfd2d293..5feda6df9769 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -168,7 +168,7 @@ void SwDDETable::ChangeContent() const IDocumentSettingAccess& rIDSA = GetFrameFormat()->getIDocumentSettingAccess(); SwDoc* pDoc = GetFrameFormat()->GetDoc(); if( AUTOUPD_FIELD_AND_CHARTS == rIDSA.getFieldUpdateFlags(true) ) - pDoc->getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); + pDoc->getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); } SwDDEFieldType* SwDDETable::GetDDEFieldType() diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index c5363c826c39..8fbbf1596034 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -195,7 +195,7 @@ bool SwFieldType::HasHiddenInformationNotes() const return bHasHiddenInformationNotes; } -void SwFieldType::GatherNodeIndex(std::vector<sal_uLong>& rvNodeIndex) +void SwFieldType::GatherNodeIndex(std::vector<SwNodeOffset>& rvNodeIndex) { CallSwClientNotify(sw::GatherNodeIndexHint(rvNodeIndex)); } diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx index b0143a291128..26d81b373a46 100644 --- a/sw/source/core/fields/postithelper.cxx +++ b/sw/source/core/fields/postithelper.cxx @@ -174,7 +174,7 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( } else { - o_rInfo.mnStartNodeIdx = 0; + o_rInfo.mnStartNodeIdx = SwNodeOffset(0); o_rInfo.mnStartContent = -1; } o_rInfo.mPageFrame = pPage->getFrameArea(); diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index b77effcf9b49..ee031ba3df9d 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -744,17 +744,17 @@ bool SwFEShell::Paste(SwDoc& rClpDoc, bool bNestedTable) // Creation of the list of insert positions std::vector< Insertion > aCopyVector; // The number of text portions of the rectangular selection - const sal_uInt32 nSelCount = aCpyPam.GetPoint()->nNode.GetIndex() + const SwNodeOffset nSelCount = aCpyPam.GetPoint()->nNode.GetIndex() - aCpyPam.GetMark()->nNode.GetIndex(); - sal_uInt32 nCount = nSelCount; + SwNodeOffset nCount = nSelCount; SwNodeIndex aClpIdx( aIdx ); SwPaM* pStartCursor = GetCursor(); SwPaM* pCurrCursor = pStartCursor; - sal_uInt32 nCursorCount = pStartCursor->GetRingContainer().size(); + SwNodeOffset nCursorCount( pStartCursor->GetRingContainer().size() ); // If the target selection is a multi-selection, often the last and first // cursor of the ring points to identical document positions. Then // we should avoid double insertion of text portions... - while( nCursorCount > 1 && *pCurrCursor->GetPoint() == + while( nCursorCount > SwNodeOffset(1) && *pCurrCursor->GetPoint() == *(pCurrCursor->GetPrev()->GetPoint()) ) { --nCursorCount; @@ -785,8 +785,8 @@ bool SwFEShell::Paste(SwDoc& rClpDoc, bool bNestedTable) if (aCursor.UpDown(false, ++nMove, nullptr, 0, *GetLayout())) aInsertPos = *aCursor.GetPoint(); else // if there is no paragraph we have to create it - bCompletePara = nCount > 0; - nCursorCount = 0; + bCompletePara = nCount > SwNodeOffset(0); + nCursorCount = SwNodeOffset(0); } else // as long as we find more insert positions in the cursor ring { // we'll take them @@ -808,7 +808,7 @@ bool SwFEShell::Paste(SwDoc& rClpDoc, bool bNestedTable) // text portion if( !nCount && nCursorCount ) { - nCount = std::min( nSelCount, nCursorCount ); + nCount = min( nSelCount, nCursorCount ); aIdx = aClpIdx; // Start of clipboard content } } @@ -817,7 +817,7 @@ bool SwFEShell::Paste(SwDoc& rClpDoc, bool bNestedTable) SwPosition& rInsPos = *item.second; SwPaM& rCopy = *item.first; const SwStartNode* pBoxNd = rInsPos.nNode.GetNode().FindTableBoxStartNode(); - if( pBoxNd && 2 == pBoxNd->EndOfSectionIndex() - pBoxNd->GetIndex() && + if( pBoxNd && SwNodeOffset(2) == pBoxNd->EndOfSectionIndex() - pBoxNd->GetIndex() && rCopy.GetPoint()->nNode != rCopy.GetMark()->nNode ) { // if more than one node will be copied into a cell @@ -1054,7 +1054,7 @@ bool SwFEShell::Paste(SwDoc& rClpDoc, bool bNestedTable) SwPosition& rInsPos = *rPaM.GetPoint(); const SwStartNode* pBoxNd = rInsPos.nNode.GetNode(). FindTableBoxStartNode(); - if( pBoxNd && 2 == pBoxNd->EndOfSectionIndex() - + if( pBoxNd && SwNodeOffset(2) == pBoxNd->EndOfSectionIndex() - pBoxNd->GetIndex() && aCpyPam.GetPoint()->nNode != aCpyPam.GetMark()->nNode ) { @@ -1082,9 +1082,9 @@ bool SwFEShell::Paste(SwDoc& rClpDoc, bool bNestedTable) // Update the rsid of each pasted text node. SwNodes &rDestNodes = GetDoc()->GetNodes(); - sal_uLong const nEndIdx = aPaM.End()->nNode.GetIndex(); + SwNodeOffset const nEndIdx = aPaM.End()->nNode.GetIndex(); - for (sal_uLong nIdx = aPaM.Start()->nNode.GetIndex(); + for (SwNodeOffset nIdx = aPaM.Start()->nNode.GetIndex(); nIdx <= nEndIdx; ++nIdx) { SwTextNode *const pTextNode = rDestNodes[nIdx]->GetTextNode(); diff --git a/sw/source/core/frmedt/feflyole.cxx b/sw/source/core/frmedt/feflyole.cxx index d13f74a92e60..efcbaaa1721e 100644 --- a/sw/source/core/frmedt/feflyole.cxx +++ b/sw/source/core/frmedt/feflyole.cxx @@ -52,7 +52,7 @@ SwFlyFrame *SwFEShell::FindFlyFrame( const uno::Reference < embed::XEmbeddedObje // No or wrong fly selected: we have to search. bool bExist = false; SwStartNode *pStNd; - sal_uLong nSttIdx = GetNodes().GetEndOfAutotext().StartOfSectionIndex() + 1, + SwNodeOffset nSttIdx = GetNodes().GetEndOfAutotext().StartOfSectionIndex() + 1, nEndIdx = GetNodes().GetEndOfAutotext().GetIndex(); while( nSttIdx < nEndIdx && nullptr != (pStNd = GetNodes()[ nSttIdx ]->GetStartNode()) ) diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 170b17f40364..f388067c27c5 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -427,7 +427,7 @@ bool SwFEShell::DeleteRow(bool bCompleteTable) pNextBox = pNextBox->FindPreviousBox( pTableNd->GetTable(), pNextBox ); } - sal_uLong nIdx; + SwNodeOffset nIdx; if( pNextBox ) // put cursor here nIdx = pNextBox->GetSttIdx() + 1; else // otherwise below the table diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 9cda400c1c80..0e9a0a2ca18e 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -433,7 +433,7 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const OUString &rText, con SwRewriter aRewriter(SwUndoInsertLabel::CreateRewriter(rText)); StartUndo(SwUndoId::INSERTLABEL, &aRewriter); - sal_uLong nIdx = 0; + SwNodeOffset nIdx(0); bool bInnerCntIsFly = false; SwFlyFrameFormat* pFlyFormat = nullptr; switch( eType ) @@ -557,7 +557,7 @@ bool SwFEShell::Sort(const SwSortOptions& rOpt) SwPosition* pEnd = pPam->End(); SwNodeIndex aPrevIdx( pStart->nNode, -1 ); - sal_uLong nOffset = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex(); + SwNodeOffset nOffset = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex(); const sal_Int32 nCntStt = pStart->nContent.GetIndex(); // Sorting diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 6a99841d1bdd..80b797384859 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -188,7 +188,7 @@ void GetTableSel( const SwCursor& rCursor, SwSelBoxes& rBoxes, const SwTableLines& rLines = rTable.GetTabLines(); const SwNode& rMarkNode = rCursor.GetNode( false ); - const sal_uLong nMarkSectionStart = rMarkNode.StartOfSectionIndex(); + const SwNodeOffset nMarkSectionStart = rMarkNode.StartOfSectionIndex(); const SwTableBox* pMarkBox = rTable.GetTableBox( nMarkSectionStart ); OSL_ENSURE( pMarkBox, "Point in table, mark outside?" ); @@ -904,7 +904,7 @@ bool IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam ) { // now check for paragraph bound flies const SwFrameFormats& rFormats = *rPam.GetDoc().GetSpzFrameFormats(); - sal_uLong nSttIdx = rPam.GetPoint()->nNode.GetIndex(), + SwNodeOffset nSttIdx = rPam.GetPoint()->nNode.GetIndex(), nEndIdx = rBox.GetSttNd()->EndOfSectionIndex(), nIdx; @@ -1361,7 +1361,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, for( const auto &rPt : aPosArr ) { aPam.GetPoint()->nNode.Assign( *rPt.pSelBox->GetSttNd()-> - EndOfSectionNode(), -1 ); + EndOfSectionNode(), SwNodeOffset(-1) ); SwContentNode* pCNd = aPam.GetContentNode(); aPam.GetPoint()->nContent.Assign( pCNd, pCNd ? pCNd->Len() : 0 ); diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx index 4d30a1736b0a..16d67c667cbb 100644 --- a/sw/source/core/inc/DocumentContentOperationsManager.hxx +++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx @@ -180,7 +180,7 @@ private: void CopyBookmarks(const SwPaM& rPam, const SwPosition& rTarget); -void CalcBreaks(std::vector<std::pair<sal_uLong, sal_Int32>> & rBreaks, +void CalcBreaks(std::vector<std::pair<SwNodeOffset, sal_Int32>> & rBreaks, SwPaM const & rPam, bool const isOnlyFieldmarks = false); } diff --git a/sw/source/core/inc/DocumentFieldsManager.hxx b/sw/source/core/inc/DocumentFieldsManager.hxx index db87948213db..43b15e31feff 100644 --- a/sw/source/core/inc/DocumentFieldsManager.hxx +++ b/sw/source/core/inc/DocumentFieldsManager.hxx @@ -53,9 +53,9 @@ public: virtual void UnlockExpFields() override; virtual bool IsExpFieldsLocked() const override; virtual SwDocUpdateField& GetUpdateFields() const override; - virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen) override; + virtual bool SetFieldsDirty(bool b, const SwNode* pChk, SwNodeOffset nLen) override; virtual void SetFixFields(const DateTime* pNewDateTime) override; - virtual void FieldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_Int32 nLastCnt) override; + virtual void FieldsToCalc(SwCalc& rCalc, SwNodeOffset nLastNd, sal_Int32 nLastCnt) override; virtual void FieldsToCalc(SwCalc& rCalc, const SetGetExpField& rToThisField, SwRootFrame const* pLayout) override; virtual void FieldsToExpand(SwHashTable<HashStr>& rTable, const SetGetExpField& rToThisField, SwRootFrame const& rLayout) override; virtual bool IsNewFieldLst() const override; diff --git a/sw/source/core/inc/SearchResultLocator.hxx b/sw/source/core/inc/SearchResultLocator.hxx index 8d146f87ecde..f8c30b77df5f 100644 --- a/sw/source/core/inc/SearchResultLocator.hxx +++ b/sw/source/core/inc/SearchResultLocator.hxx @@ -26,12 +26,13 @@ enum class NodeType struct SearchIndexData { NodeType meType = NodeType::Undefined; - sal_Int32 mnNodeIndex = 0; + SwNodeOffset mnNodeIndex{ 0 }; OUString maObjectName; SearchIndexData() {} - SearchIndexData(NodeType eType, sal_Int32 nNodeIndex, OUString const& aObjectName = OUString()) + SearchIndexData(NodeType eType, SwNodeOffset nNodeIndex, + OUString const& aObjectName = OUString()) : meType(eType) , mnNodeIndex(nNodeIndex) , maObjectName(aObjectName) diff --git a/sw/source/core/inc/SwUndoTOXChange.hxx b/sw/source/core/inc/SwUndoTOXChange.hxx index b3b5d57a88cc..a7aabf41e4e9 100644 --- a/sw/source/core/inc/SwUndoTOXChange.hxx +++ b/sw/source/core/inc/SwUndoTOXChange.hxx @@ -31,7 +31,7 @@ private: SwTOXBase m_Old; SwTOXBase m_New; - sal_uLong const m_nNodeIndex; + SwNodeOffset const m_nNodeIndex; public: SwUndoTOXChange(const SwDoc& rDoc, SwTOXBaseSection const& rTOX, const SwTOXBase& rNew); diff --git a/sw/source/core/inc/UndoAttribute.hxx b/sw/source/core/inc/UndoAttribute.hxx index 69f14b1c4642..ffe4c4f3206d 100644 --- a/sw/source/core/inc/UndoAttribute.hxx +++ b/sw/source/core/inc/UndoAttribute.hxx @@ -40,7 +40,7 @@ class SwUndoAttr final : public SwUndo, private SwUndRng const std::unique_ptr<SwHistory> m_pHistory; // History for Undo std::unique_ptr<SwRedlineData> m_pRedlineData; // Redlining std::unique_ptr<SwRedlineSaveDatas> m_pRedlineSaveData; - sal_uLong m_nNodeIndex; // Offset: for Redlining + SwNodeOffset m_nNodeIndex; // Offset: for Redlining const SetAttrMode m_nInsertFlags; // insert flags OUString m_aChrFormatName; @@ -87,7 +87,7 @@ class SwUndoFormatAttr final : public SwUndo friend class SwUndoDefaultAttr; OUString m_sFormatName; std::optional<SfxItemSet> m_oOldSet; // old attributes - sal_uLong m_nNodeIndex; + SwNodeOffset m_nNodeIndex; const sal_uInt16 m_nFormatWhich; const bool m_bSaveDrawPt; @@ -148,7 +148,7 @@ class SwUndoFormatResetAttr final : public SwUndo class SwUndoDontExpandFormat final : public SwUndo { - const sal_uLong m_nNodeIndex; + const SwNodeOffset m_nNodeIndex; const sal_Int32 m_nContentIndex; public: diff --git a/sw/source/core/inc/UndoCore.hxx b/sw/source/core/inc/UndoCore.hxx index 4f94a6b6cca0..bb60ddeedb3e 100644 --- a/sw/source/core/inc/UndoCore.hxx +++ b/sw/source/core/inc/UndoCore.hxx @@ -191,14 +191,14 @@ class SwUndoSetFlyFormat final : public SwUndo, public SwClient const OUString m_DerivedFromFormatName; const OUString m_NewFormatName; std::optional<SfxItemSet> m_oItemSet; // the re-/ set attributes - sal_uLong m_nOldNode, m_nNewNode; + SwNodeOffset m_nOldNode, m_nNewNode; sal_Int32 m_nOldContent, m_nNewContent; RndStdIds m_nOldAnchorType, m_nNewAnchorType; bool m_bAnchorChanged; void PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem ); void SwClientNotify(const SwModify&, const SfxHint&) override; - void GetAnchor( SwFormatAnchor& rAnhor, sal_uLong nNode, sal_Int32 nContent ); + void GetAnchor( SwFormatAnchor& rAnhor, SwNodeOffset nNode, sal_Int32 nContent ); public: SwUndoSetFlyFormat( SwFrameFormat& rFlyFormat, const SwFrameFormat& rNewFrameFormat ); diff --git a/sw/source/core/inc/UndoDelete.hxx b/sw/source/core/inc/UndoDelete.hxx index 9656d59e3ca6..1325dd373af7 100644 --- a/sw/source/core/inc/UndoDelete.hxx +++ b/sw/source/core/inc/UndoDelete.hxx @@ -46,10 +46,10 @@ class SwUndoDelete final OUString m_sTableName; - sal_uLong m_nNode; - sal_uLong m_nNdDiff; // difference of Nodes before/after Delete - sal_uLong m_nSectDiff; // diff. of Nodes before/after Move w/ SectionNodes - sal_uLong m_nReplaceDummy; // diff. to a temporary dummy object + SwNodeOffset m_nNode; + SwNodeOffset m_nNdDiff; // difference of Nodes before/after Delete + SwNodeOffset m_nSectDiff; // diff. of Nodes before/after Move w/ SectionNodes + SwNodeOffset m_nReplaceDummy; // diff. to a temporary dummy object sal_uInt16 m_nSetPos; bool m_bGroup : 1; // TRUE: is already Grouped; see CanGrouping() diff --git a/sw/source/core/inc/UndoInsert.hxx b/sw/source/core/inc/UndoInsert.hxx index 7263bbcafab4..f5d4a1343591 100644 --- a/sw/source/core/inc/UndoInsert.hxx +++ b/sw/source/core/inc/UndoInsert.hxx @@ -44,7 +44,7 @@ class SwUndoInsert final : public SwUndo, private SwUndoSaveContent std::optional<OUString> maText; std::optional<OUString> maUndoText; std::unique_ptr<SwRedlineData> m_pRedlData; - sal_uLong m_nNode; + SwNodeOffset m_nNode; sal_Int32 m_nContent, m_nLen; bool m_bIsWordDelim : 1; bool m_bIsAppend : 1; @@ -137,7 +137,7 @@ class SwUndoReRead final : public SwUndo std::unique_ptr<Graphic> mpGraphic; std::optional<OUString> maNm; std::optional<OUString> maFltr; - sal_uLong mnPosition; + SwNodeOffset mnPosition; MirrorGraph mnMirror; void SaveGraphicData( const SwGrfNode& ); @@ -163,7 +163,7 @@ class SwUndoInsertLabel final : public SwUndo struct { // for tables or TextFrames SwUndoDelete* pUndoInsNd; - sal_uLong nNode; + SwNodeOffset nNode; } NODE; }; @@ -210,7 +210,7 @@ public: virtual SwRewriter GetRewriter() const override; static SwRewriter CreateRewriter(const OUString &rStr); - void SetNodePos( sal_uLong nNd ) + void SetNodePos( SwNodeOffset nNd ) { if( SwLabelType::Object != m_eType ) NODE.nNode = nNd; } void SetUndoKeep() { m_bUndoKeep = true; } diff --git a/sw/source/core/inc/UndoNumbering.hxx b/sw/source/core/inc/UndoNumbering.hxx index 77567f772639..c5914fbd01ac 100644 --- a/sw/source/core/inc/UndoNumbering.hxx +++ b/sw/source/core/inc/UndoNumbering.hxx @@ -60,9 +60,9 @@ class SwUndoDelNum final : public SwUndo, private SwUndRng { struct NodeLevel { - sal_uLong index; + SwNodeOffset index; int level; - NodeLevel(sal_uLong idx, int lvl) : index(idx), level(lvl) {}; + NodeLevel(SwNodeOffset idx, int lvl) : index(idx), level(lvl) {}; }; std::vector<NodeLevel> m_aNodes; std::unique_ptr<SwHistory> m_pHistory; @@ -82,17 +82,17 @@ public: class SwUndoMoveNum final : public SwUndo, private SwUndRng { - sal_uLong m_nNewStart; - tools::Long m_nOffset; + SwNodeOffset m_nNewStart; + SwNodeOffset m_nOffset; public: - SwUndoMoveNum( const SwPaM& rPam, tools::Long nOffset, bool bIsOutlMv ); + SwUndoMoveNum( const SwPaM& rPam, SwNodeOffset nOffset, bool bIsOutlMv ); virtual void UndoImpl( ::sw::UndoRedoContext & ) override; virtual void RedoImpl( ::sw::UndoRedoContext & ) override; virtual void RepeatImpl( ::sw::RepeatContext & ) override; - void SetStartNode( sal_uLong nValue ) { m_nNewStart = nValue; } + void SetStartNode( SwNodeOffset nValue ) { m_nNewStart = nValue; } }; class SwUndoNumUpDown final : public SwUndo, private SwUndRng @@ -109,7 +109,7 @@ public: class SwUndoNumOrNoNum final : public SwUndo { - sal_uLong m_nIndex; + SwNodeOffset m_nIndex; bool mbNewNum, mbOldNum; public: @@ -123,7 +123,7 @@ public: class SwUndoNumRuleStart final : public SwUndo { - sal_uLong m_nIndex; + SwNodeOffset m_nIndex; sal_uInt16 m_nOldStart, m_nNewStart; bool m_bSetStartValue : 1; bool m_bFlag : 1; diff --git a/sw/source/core/inc/UndoOverwrite.hxx b/sw/source/core/inc/UndoOverwrite.hxx index 5f9d59d4f2fb..ddbf23262dee 100644 --- a/sw/source/core/inc/UndoOverwrite.hxx +++ b/sw/source/core/inc/UndoOverwrite.hxx @@ -35,7 +35,7 @@ class SwUndoOverwrite final : public SwUndo, private SwUndoSaveContent { OUString m_aDelStr, m_aInsStr; std::unique_ptr<SwRedlineSaveDatas> m_pRedlSaveData; - sal_uLong m_nStartNode; + SwNodeOffset m_nStartNode; sal_Int32 m_nStartContent; bool m_bInsChar : 1; // no Overwrite, but Insert bool m_bGroup : 1; // TRUE: is already grouped; evaluated in CanGrouping() diff --git a/sw/source/core/inc/UndoRedline.hxx b/sw/source/core/inc/UndoRedline.hxx index e5a0029f0aea..68ce25a27d0c 100644 --- a/sw/source/core/inc/UndoRedline.hxx +++ b/sw/source/core/inc/UndoRedline.hxx @@ -69,7 +69,7 @@ public: bool CanGrouping( const SwUndoRedlineDelete& rPrev ); // SwUndoTableCpyTable needs this information: - tools::Long NodeDiff() const { return m_nSttNode - m_nEndNode; } + SwNodeOffset NodeDiff() const { return m_nSttNode - m_nEndNode; } sal_Int32 ContentStart() const { return m_nSttContent; } void SetRedlineText(const OUString & rText); @@ -78,7 +78,7 @@ public: class SwUndoRedlineSort final : public SwUndoRedline { std::unique_ptr<SwSortOptions> m_pOpt; - sal_uLong m_nSaveEndNode; + SwNodeOffset m_nSaveEndNode; sal_Int32 m_nSaveEndContent; virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) override; diff --git a/sw/source/core/inc/UndoSection.hxx b/sw/source/core/inc/UndoSection.hxx index 1e514b0e2b0f..85b15a8b7eb0 100644 --- a/sw/source/core/inc/UndoSection.hxx +++ b/sw/source/core/inc/UndoSection.hxx @@ -46,12 +46,12 @@ private: std::unique_ptr<SwHistory> m_pHistory; std::unique_ptr<SwRedlineData> m_pRedlData; std::unique_ptr<SwRedlineSaveDatas> m_pRedlineSaveData; - sal_uLong m_nSectionNodePos; + SwNodeOffset m_nSectionNodePos; bool m_bSplitAtStart : 1; bool m_bSplitAtEnd : 1; bool m_bUpdateFootnote : 1; - void Join( SwDoc& rDoc, sal_uLong nNode ); + void Join( SwDoc& rDoc, SwNodeOffset nNode ); public: SwUndoInsSection(SwPaM const&, SwSectionData const&, @@ -64,7 +64,7 @@ public: virtual void RedoImpl( ::sw::UndoRedoContext & ) override; virtual void RepeatImpl( ::sw::RepeatContext & ) override; - void SetSectNdPos(sal_uLong const nPos) { m_nSectionNodePos = nPos; } + void SetSectNdPos(SwNodeOffset const nPos) { m_nSectionNodePos = nPos; } void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart); void SetUpdateFootnoteFlag(bool const bFlag) { m_bUpdateFootnote = bFlag; } }; @@ -83,7 +83,7 @@ private: std::unique_ptr<SwUndoDelSection> m_pTitleSectionUpdated; std::unique_ptr<SwUndoSaveSection, o3tl::default_delete<SwUndoSaveSection>> const m_pSaveSectionOriginal; std::unique_ptr<SwUndoSaveSection, o3tl::default_delete<SwUndoSaveSection>> const m_pSaveSectionUpdated; - sal_uLong const m_nStartIndex; + SwNodeOffset const m_nStartIndex; public: SwUndoUpdateIndex(SwTOXBaseSection &); diff --git a/sw/source/core/inc/UndoSort.hxx b/sw/source/core/inc/UndoSort.hxx index 70ec29ada13e..be474e01432c 100644 --- a/sw/source/core/inc/UndoSort.hxx +++ b/sw/source/core/inc/UndoSort.hxx @@ -36,7 +36,9 @@ struct SwSortUndoElement union { struct { sal_uLong nID; - sal_uLong nSource, nTarget; + // we cannot store these as SwNodeOffset (even though they are) + // because SwNodeOffset has no default constructor + sal_Int32 nSource, nTarget; } TXT; struct { OUString *pSource, *pTarget; @@ -48,10 +50,10 @@ struct SwSortUndoElement SORT_TXT_TBL.TBL.pSource = new OUString( aS ); SORT_TXT_TBL.TBL.pTarget = new OUString( aT ); } - SwSortUndoElement( sal_uLong nS, sal_uLong nT ) + SwSortUndoElement( SwNodeOffset nS, SwNodeOffset nT ) { - SORT_TXT_TBL.TXT.nSource = nS; - SORT_TXT_TBL.TXT.nTarget = nT; + SORT_TXT_TBL.TXT.nSource = sal_Int32(nS); + SORT_TXT_TBL.TXT.nTarget = sal_Int32(nT); SORT_TXT_TBL.TXT.nID = 0xffffffff; } ~SwSortUndoElement(); @@ -62,11 +64,11 @@ class SwUndoSort final : public SwUndo, private SwUndRng std::unique_ptr<SwSortOptions> m_pSortOptions; std::vector<std::unique_ptr<SwSortUndoElement>> m_SortList; std::unique_ptr<SwUndoAttrTable> m_pUndoAttrTable; - sal_uLong m_nTableNode; + SwNodeOffset m_nTableNode; public: SwUndoSort( const SwPaM&, const SwSortOptions& ); - SwUndoSort( sal_uLong nStt, sal_uLong nEnd, const SwTableNode&, + SwUndoSort( SwNodeOffset nStt, SwNodeOffset nEnd, const SwTableNode&, const SwSortOptions&, bool bSaveTable ); virtual ~SwUndoSort() override; @@ -76,7 +78,7 @@ public: virtual void RepeatImpl( ::sw::RepeatContext & ) override; void Insert( const OUString& rOrgPos, const OUString& rNewPos ); - void Insert( sal_uLong nOrgPos, sal_uLong nNewPos ); + void Insert( SwNodeOffset nOrgPos, SwNodeOffset nNewPos ); }; #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX diff --git a/sw/source/core/inc/UndoSplitMove.hxx b/sw/source/core/inc/UndoSplitMove.hxx index 361f1281d596..9cf2fda25af4 100644 --- a/sw/source/core/inc/UndoSplitMove.hxx +++ b/sw/source/core/inc/UndoSplitMove.hxx @@ -26,7 +26,7 @@ class SwUndoSplitNode final : public SwUndo { std::unique_ptr<SwHistory> m_pHistory; std::unique_ptr<SwRedlineData> m_pRedlineData; - sal_uLong m_nNode; + SwNodeOffset m_nNode; sal_Int32 m_nContent; bool m_bTableFlag : 1; bool m_bCheckTableStart : 1; @@ -49,7 +49,7 @@ class SwUndoMove final : public SwUndo, private SwUndRng, private SwUndoSaveCont // nDest... - destination range of move (after move!) // nIns... - source Position of move (after move!) // nMv... - destination position of move (before move!); for REDO - sal_uLong m_nDestStartNode, m_nDestEndNode, m_nInsPosNode, m_nMoveDestNode; + SwNodeOffset m_nDestStartNode, m_nDestEndNode, m_nInsPosNode, m_nMoveDestNode; sal_Int32 m_nDestStartContent, m_nDestEndContent, m_nInsPosContent, m_nMoveDestContent; sal_uInt16 m_nFootnoteStart; // StartPos of Footnotes in History @@ -73,8 +73,8 @@ public: const SwNodeIndex& rInsPos ); bool IsMoveRange() const { return m_bMoveRange; } - sal_uLong GetEndNode() const { return m_nEndNode; } - sal_uLong GetDestSttNode() const { return m_nDestStartNode; } + SwNodeOffset GetEndNode() const { return m_nEndNode; } + SwNodeOffset GetDestSttNode() const { return m_nDestStartNode; } sal_Int32 GetDestSttContent() const { return m_nDestStartContent; } void SetMoveRedlines( bool b ) { m_bMoveRedlines = b; } diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx index a1bcb4aaa082..6591b7e5e6cc 100644 --- a/sw/source/core/inc/UndoTable.hxx +++ b/sw/source/core/inc/UndoTable.hxx @@ -52,7 +52,7 @@ class SwUndoInsTable final : public SwUndo std::unique_ptr<std::vector<sal_uInt16>> m_pColumnWidth; std::unique_ptr<SwRedlineData> m_pRedlineData; std::unique_ptr<SwTableAutoFormat> m_pAutoFormat; - sal_uLong m_nStartNode; + SwNodeOffset m_nStartNode; sal_uInt16 m_nRows, m_nColumns; sal_uInt16 const m_nAdjust; @@ -75,7 +75,7 @@ class SwUndoTextToTable final : public SwUndo, public SwUndRng { OUString m_sTableName; SwInsertTableOptions m_aInsertTableOpts; - std::vector<sal_uLong> mvDelBoxes; + std::vector<SwNodeOffset> mvDelBoxes; std::unique_ptr<SwTableAutoFormat> m_pAutoFormat; SwHistory* m_pHistory; sal_Unicode m_cSeparator; @@ -104,7 +104,7 @@ class SwUndoTableToText final : public SwUndo std::unique_ptr<SaveTable> m_pTableSave; SwTableToTextSaves m_vBoxSaves; std::unique_ptr<SwHistory> m_pHistory; - sal_uLong m_nStartNode, m_nEndNode; + SwNodeOffset m_nStartNode, m_nEndNode; sal_Unicode m_cSeparator; sal_uInt16 m_nHeadlineRepeat; bool m_bCheckNumFormat : 1; @@ -119,13 +119,13 @@ public: virtual void RepeatImpl( ::sw::RepeatContext & ) override; void SetRange( const SwNodeRange& ); - void AddBoxPos( SwDoc& rDoc, sal_uLong nNdIdx, sal_uLong nEndIdx, + void AddBoxPos( SwDoc& rDoc, SwNodeOffset nNdIdx, SwNodeOffset nEndIdx, sal_Int32 nContentIdx = SAL_MAX_INT32); }; class SwUndoAttrTable final : public SwUndo { - sal_uLong m_nStartNode; + SwNodeOffset m_nStartNode; std::unique_ptr<SaveTable> m_pSaveTable; bool m_bClearTableCol : 1; @@ -143,7 +143,7 @@ class SwUndoTableNumFormat; class SwUndoTableAutoFormat final : public SwUndo { OUString m_TableStyleName; - sal_uLong m_nStartNode; + SwNodeOffset m_nStartNode; std::unique_ptr<SaveTable> m_pSaveTable; std::vector< std::shared_ptr<SwUndoTableNumFormat> > m_Undos; bool m_bSaveContentAttr; @@ -167,18 +167,18 @@ using SwUndoSaveSections = std::vector<std::unique_ptr<SwUndoSaveSection, o3tl:: class SwUndoTableNdsChg final : public SwUndo { std::unique_ptr<SaveTable> m_pSaveTable; - std::set<sal_uLong> m_Boxes; + std::set<SwNodeOffset> m_Boxes; struct BoxMove { - sal_uLong index; ///< Index of this box. + SwNodeOffset index; ///< Index of this box. bool hasMoved; ///< Has this box been moved already. - BoxMove(sal_uLong idx, bool moved=false) : index(idx), hasMoved(moved) {}; + BoxMove(SwNodeOffset idx, bool moved=false) : index(idx), hasMoved(moved) {}; bool operator<(const BoxMove& other) const { return index < other.index; }; }; std::optional< std::set<BoxMove> > m_xNewSttNds; std::unique_ptr<SwUndoSaveSections> m_pDelSects; tools::Long m_nMin, m_nMax; // for redo of delete column - sal_uLong m_nSttNode; + SwNodeOffset m_nSttNode; sal_uInt16 m_nCount; bool m_bFlag; bool m_bSameHeight; // only used for SplitRow @@ -200,7 +200,7 @@ public: void SaveNewBoxes( const SwTableNode& rTableNd, const SwTableSortBoxes& rOld ); void SaveNewBoxes( const SwTableNode& rTableNd, const SwTableSortBoxes& rOld, - const SwSelBoxes& rBoxes, const std::vector<sal_uLong> &rNodeCnts ); + const SwSelBoxes& rBoxes, const std::vector<SwNodeOffset> &rNodeCnts ); void SaveSection( SwStartNode* pSttNd ); void ReNewBoxes( const SwSelBoxes& rBoxes ); @@ -210,10 +210,10 @@ class SwUndoMove; class SwUndoTableMerge final : public SwUndo, private SwUndRng { - sal_uLong m_nTableNode; + SwNodeOffset m_nTableNode; std::unique_ptr<SaveTable> m_pSaveTable; - std::set<sal_uLong> m_Boxes; - std::vector<sal_uLong> m_aNewStartNodes; + std::set<SwNodeOffset> m_Boxes; + std::vector<SwNodeOffset> m_aNewStartNodes; std::vector<std::unique_ptr<SwUndoMove>> m_vMoves; std::unique_ptr<SwHistory> m_pHistory; @@ -229,7 +229,7 @@ public: void SetSelBoxes( const SwSelBoxes& rBoxes ); - void AddNewBox( sal_uLong nSttNdIdx ) + void AddNewBox( SwNodeOffset nSttNdIdx ) { m_aNewStartNodes.push_back( nSttNdIdx ); } void SaveCollection( const SwTableBox& rBox ); @@ -243,8 +243,8 @@ class SwUndoTableNumFormat final : public SwUndo sal_uLong m_nFormatIdx, m_nNewFormatIdx; double m_fNum, m_fNewNum; - sal_uLong m_nNode; - sal_uLong m_nNodePos; + SwNodeOffset m_nNode; + SwNodeOffset m_nNodePos; bool m_bNewFormat : 1; bool m_bNewFormula : 1; @@ -295,7 +295,7 @@ public: class SwUndoCpyTable final : public SwUndo { std::unique_ptr<SwUndoDelete> m_pDelete; - sal_uLong m_nTableNode; + SwNodeOffset m_nTableNode; public: SwUndoCpyTable(const SwDoc& rDoc); @@ -305,12 +305,12 @@ public: virtual void UndoImpl( ::sw::UndoRedoContext & ) override; virtual void RedoImpl( ::sw::UndoRedoContext & ) override; - void SetTableSttIdx( sal_uLong nIdx ) { m_nTableNode = nIdx; } + void SetTableSttIdx( SwNodeOffset nIdx ) { m_nTableNode = nIdx; } }; class SwUndoSplitTable final : public SwUndo { - sal_uLong m_nTableNode, m_nOffset; + SwNodeOffset m_nTableNode, m_nOffset; std::unique_ptr<SwSaveRowSpan> mpSaveRowSpan; // stores row span values at the splitting row std::unique_ptr<SaveTable> m_pSavedTable; std::unique_ptr<SwHistory> m_pHistory; @@ -328,7 +328,7 @@ public: virtual void RedoImpl( ::sw::UndoRedoContext & ) override; virtual void RepeatImpl( ::sw::RepeatContext & ) override; - void SetTableNodeOffset( sal_uLong nIdx ) { m_nOffset = nIdx - m_nTableNode; } + void SetTableNodeOffset( SwNodeOffset nIdx ) { m_nOffset = nIdx - m_nTableNode; } SwHistory* GetHistory() { return m_pHistory.get(); } void SaveFormula( SwHistory& rHistory ); }; @@ -336,7 +336,7 @@ public: class SwUndoMergeTable final : public SwUndo { OUString m_aName; - sal_uLong m_nTableNode; + SwNodeOffset m_nTableNode; std::unique_ptr<SaveTable> m_pSaveTable, m_pSaveHdl; std::unique_ptr<SwHistory> m_pHistory; sal_uInt16 m_nMode; @@ -357,7 +357,7 @@ public: class SwUndoTableHeadline final : public SwUndo { - sal_uLong m_nTableNode; + SwNodeOffset m_nTableNode; sal_uInt16 m_nOldHeadline; sal_uInt16 m_nNewHeadline; diff --git a/sw/source/core/inc/acorrect.hxx b/sw/source/core/inc/acorrect.hxx index ef826f78da04..2f0042650f87 100644 --- a/sw/source/core/inc/acorrect.hxx +++ b/sw/source/core/inc/acorrect.hxx @@ -25,6 +25,7 @@ #include <svl/itemset.hxx> #include <tools/solar.h> #include <editeng/svxacorr.hxx> +#include <nodeoffset.hxx> class SwEditShell; class SwPaM; @@ -95,7 +96,7 @@ public: class SwAutoCorrExceptWord { OUString m_sWord; - sal_uLong m_nNode; + SwNodeOffset m_nNode; ACFlags m_nFlags; sal_Int32 m_nContent; sal_Unicode m_cChar; @@ -103,7 +104,7 @@ class SwAutoCorrExceptWord bool m_bDeleted; public: - SwAutoCorrExceptWord(ACFlags nAFlags, sal_uLong nNd, sal_Int32 nContent, + SwAutoCorrExceptWord(ACFlags nAFlags, SwNodeOffset nNd, sal_Int32 nContent, const OUString& rWord, sal_Unicode cChr, LanguageType eLang) : m_sWord(rWord), m_nNode(nNd), m_nFlags(nAFlags), m_nContent(nContent), diff --git a/sw/source/core/inc/anchoredobjectposition.hxx b/sw/source/core/inc/anchoredobjectposition.hxx index 2a30da4d6c1c..a3668330006e 100644 --- a/sw/source/core/inc/anchoredobjectposition.hxx +++ b/sw/source/core/inc/anchoredobjectposition.hxx @@ -22,6 +22,7 @@ #include <swtypes.hxx> #include "frame.hxx" +#include <nodeoffset.hxx> class SdrObject; class SwFlyFrame; @@ -403,7 +404,7 @@ namespace objectpositioning bool DrawAsideFly( const SwFlyFrame* _pFly, const SwRect& _rObjRect, const SwFrame* _pObjContext, - const sal_uLong _nObjIndex, + const SwNodeOffset _nObjIndex, const bool _bEvenPage, const sal_Int16 _eHoriOrient, const sal_Int16 _eRelOrient diff --git a/sw/source/core/inc/docfld.hxx b/sw/source/core/inc/docfld.hxx index f17d5451c140..70d6e033dc0d 100644 --- a/sw/source/core/inc/docfld.hxx +++ b/sw/source/core/inc/docfld.hxx @@ -44,7 +44,7 @@ enum class SwFieldIds : sal_uInt16; // Update expression fields class SetGetExpField { - sal_uLong m_nNode; + SwNodeOffset m_nNode; union { const SwTextField* pTextField; const SwSection* pSection; @@ -96,7 +96,7 @@ public: const SwFlyFrameFormat* GetFlyFormat() const { return FLYFRAME == m_eSetGetExpFieldType ? m_CNTNT.pFlyFormat : nullptr; } - sal_uLong GetNode() const { return m_nNode; } + SwNodeOffset GetNode() const { return m_nNode; } sal_Int32 GetContent() const { return m_nContent; } const void* GetPointer() const { return m_CNTNT.pTextField; } @@ -140,7 +140,7 @@ class SwDocUpdateField std::unique_ptr<SetGetExpFields> m_pFieldSortList; ///< current field list for calculation SwHashTable<SwCalcFieldType> m_FieldTypeTable; - sal_uLong m_nNodes; ///< to check if the node count changed + SwNodeOffset m_nNodes; ///< to check if the node count changed int m_nFieldListGetMode; SwDoc& m_rDoc; diff --git a/sw/source/core/inc/docsort.hxx b/sw/source/core/inc/docsort.hxx index afe4fb1af530..82f14c9761b2 100644 --- a/sw/source/core/inc/docsort.hxx +++ b/sw/source/core/inc/docsort.hxx @@ -90,7 +90,7 @@ private: // sort text struct SwSortTextElement final : public SwSortElement { - sal_uLong nOrg; + SwNodeOffset nOrg; SwNodeIndex aPos; SwSortTextElement( const SwNodeIndex& rPos ); diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index c7e75565fd05..29eec3495080 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -56,10 +56,10 @@ constexpr tools::Long BROWSE_HEIGHT = 56700 * 10; // 10 Meters #define GRFNUM_YES 1 #define GRFNUM_REPLACE 2 -void AppendObjs( const SwFrameFormats *pTable, sal_uLong nIndex, +void AppendObjs( const SwFrameFormats *pTable, SwNodeOffset nIndex, SwFrame *pFrame, SwPageFrame *pPage, SwDoc* doc ); -void AppendObjsOfNode(SwFrameFormats const* pTable, sal_uLong nIndex, +void AppendObjsOfNode(SwFrameFormats const* pTable, SwNodeOffset nIndex, SwFrame * pFrame, SwPageFrame * pPage, SwDoc * pDoc, std::vector<sw::Extent>::const_iterator const* pIter, std::vector<sw::Extent>::const_iterator const* pEnd, @@ -140,8 +140,8 @@ SwFrame *SaveContent( SwLayoutFrame *pLay, SwFrame *pStart = nullptr ); void RestoreContent( SwFrame *pSav, SwLayoutFrame *pParent, SwFrame *pSibling ); // Get ContentNodes, create ContentFrames, and add them to LayFrame. -void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, sal_uLong nIndex, - bool bPages = false, sal_uLong nEndIndex = 0, +void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, SwNodeOffset nIndex, + bool bPages = false, SwNodeOffset nEndIndex = SwNodeOffset(0), SwFrame *pPrv = nullptr, sw::FrameMode eMode = sw::FrameMode::New); // Creation of frames for a specific section (uses InsertCnt_) diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx index 2debeab38aea..32af2d5b5fc8 100644 --- a/sw/source/core/inc/mvsave.hxx +++ b/sw/source/core/inc/mvsave.hxx @@ -62,8 +62,8 @@ namespace sw::mark OUString m_aHideCondition; vcl::KeyCode m_aCode; IDocumentMarkAccess::MarkType m_eOrigBkmType; - sal_uLong m_nNode1; - sal_uLong m_nNode2; + SwNodeOffset m_nNode1; + SwNodeOffset m_nNode2; sal_Int32 m_nContent1; sal_Int32 m_nContent2; std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo; @@ -78,8 +78,8 @@ namespace sw::mark virtual void Clear() =0; virtual bool Empty() =0; - virtual void Save(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit=false) =0; - virtual void Restore(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false, bool bAtStart = false, RestoreMode = RestoreMode::All) =0; + virtual void Save(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent, bool bSaveFlySplit=false) =0; + virtual void Restore(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nOffset=0, bool bAuto = false, bool bAtStart = false, RestoreMode = RestoreMode::All) =0; virtual void Restore(SwNode& rNd, sal_Int32 nLen, sal_Int32 nCorrLen, RestoreMode = RestoreMode::All) =0; virtual ~ContentIdxStore() {}; static std::shared_ptr<ContentIdxStore> Create(); @@ -101,11 +101,11 @@ void DelBookmarks(const SwNodeIndex& rStt, struct SaveFly { SwFrameFormat* pFrameFormat; /// the fly's frame format - sal_uLong nNdDiff; /// relative node difference + SwNodeOffset nNdDiff; /// relative node difference sal_Int32 nContentIndex; ///< index in node bool isAtInsertNode; ///< if true, anchor _at_ insert node index - SaveFly( sal_uLong nNodeDiff, sal_Int32 const nCntntIdx, SwFrameFormat* pFormat, bool bInsert ) + SaveFly( SwNodeOffset nNodeDiff, sal_Int32 const nCntntIdx, SwFrameFormat* pFormat, bool bInsert ) : pFrameFormat(pFormat) , nNdDiff(nNodeDiff) , nContentIndex(nCntntIdx) diff --git a/sw/source/core/inc/node2lay.hxx b/sw/source/core/inc/node2lay.hxx index ef0e2f03adee..2af3359a911c 100644 --- a/sw/source/core/inc/node2lay.hxx +++ b/sw/source/core/inc/node2lay.hxx @@ -58,7 +58,7 @@ class SwNode2Layout public: /// Use this ctor for inserting before/after rNd /// @param nIdx is the index of the to-be-inserted Node - SwNode2Layout(const SwNode& rNd, sal_uLong nIdx); + SwNode2Layout(const SwNode& rNd, SwNodeOffset nIdx); ~SwNode2Layout(); SwFrame* NextFrame(); SwLayoutFrame* UpperFrame(SwFrame*& rpFrame, const SwNode& rNode); @@ -75,7 +75,7 @@ public: SwNode2LayoutSaveUpperFrames(const SwNode& rNd); ~SwNode2LayoutSaveUpperFrames(); - void RestoreUpperFrames(SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd); + void RestoreUpperFrames(SwNodes& rNds, SwNodeOffset nStt, SwNodeOffset nEnd); }; #endif diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx index bc70e036fd43..75554884341e 100644 --- a/sw/source/core/inc/rolbck.hxx +++ b/sw/source/core/inc/rolbck.hxx @@ -92,10 +92,10 @@ public: class SwHistorySetFormat final : public SwHistoryHint { std::unique_ptr<SfxPoolItem> m_pAttr; - const sal_uLong m_nNodeIndex; + const SwNodeOffset m_nNodeIndex; public: - SwHistorySetFormat( const SfxPoolItem* pFormatHt, sal_uLong nNode ); + SwHistorySetFormat( const SfxPoolItem* pFormatHt, SwNodeOffset nNode ); virtual ~SwHistorySetFormat() override; virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) override; virtual OUString GetDescription() const override; @@ -105,11 +105,11 @@ public: class SwHistoryResetFormat final : public SwHistoryHint { - const sal_uLong m_nNodeIndex; + const SwNodeOffset m_nNodeIndex; const sal_uInt16 m_nWhich; public: - SwHistoryResetFormat( const SfxPoolItem* pFormatHt, sal_uLong nNodeIdx ); + SwHistoryResetFormat( const SfxPoolItem* pFormatHt, SwNodeOffset nNodeIdx ); virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) override; }; @@ -117,14 +117,14 @@ public: class SwHistorySetText final : public SwHistoryHint { std::unique_ptr<SfxPoolItem> m_pAttr; - const sal_uLong m_nNodeIndex; + const SwNodeOffset m_nNodeIndex; const sal_Int32 m_nStart; const sal_Int32 m_nEnd; bool m_bFormatIgnoreStart : 1; bool m_bFormatIgnoreEnd : 1; public: - SwHistorySetText( SwTextAttr* pTextHt, sal_uLong nNode ); + SwHistorySetText( SwTextAttr* pTextHt, SwNodeOffset nNode ); virtual ~SwHistorySetText() override; virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) override; @@ -137,12 +137,12 @@ class SwHistorySetTextField final : public SwHistoryHint std::unique_ptr<SwFieldType> m_pFieldType; const std::unique_ptr<SwFormatField> m_pField; - sal_uLong m_nNodeIndex; + SwNodeOffset m_nNodeIndex; sal_Int32 m_nPos; SwFieldIds m_nFieldWhich; public: - SwHistorySetTextField( const SwTextField* pTextField, sal_uLong nNode ); + SwHistorySetTextField( const SwTextField* pTextField, SwNodeOffset nNode ); virtual ~SwHistorySetTextField() override; virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) override; @@ -153,12 +153,12 @@ public: class SwHistorySetRefMark final : public SwHistoryHint { const OUString m_RefName; - const sal_uLong m_nNodeIndex; + const SwNodeOffset m_nNodeIndex; const sal_Int32 m_nStart; const sal_Int32 m_nEnd; public: - SwHistorySetRefMark( const SwTextRefMark* pTextHt, sal_uLong nNode ); + SwHistorySetRefMark( const SwTextRefMark* pTextHt, SwNodeOffset nNode ); virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) override; }; @@ -168,12 +168,12 @@ class SwHistorySetTOXMark final : public SwHistoryHint SwTOXMark m_TOXMark; const OUString m_TOXName; const TOXTypes m_eTOXTypes; - const sal_uLong m_nNodeIndex; + const SwNodeOffset m_nNodeIndex; const sal_Int32 m_nStart; const sal_Int32 m_nEnd; public: - SwHistorySetTOXMark( const SwTextTOXMark* pTextHt, sal_uLong nNode ); + SwHistorySetTOXMark( const SwTextTOXMark* pTextHt, SwNodeOffset nNode ); virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) override; bool IsEqual( const SwTOXMark& rCmp ) const; @@ -182,18 +182,18 @@ public: class SwHistoryResetText final : public SwHistoryHint { - const sal_uLong m_nNodeIndex; + const SwNodeOffset m_nNodeIndex; const sal_Int32 m_nStart; const sal_Int32 m_nEnd; const sal_uInt16 m_nAttr; public: SwHistoryResetText( sal_uInt16 nWhich, sal_Int32 nStt, sal_Int32 nEnd, - sal_uLong nNode ); + SwNodeOffset nNode ); virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) override; sal_uInt16 GetWhich() const { return m_nAttr; } - sal_uLong GetNode() const { return m_nNodeIndex; } + SwNodeOffset GetNode() const { return m_nNodeIndex; } sal_Int32 GetContent() const { return m_nStart; } }; @@ -202,12 +202,12 @@ class SwHistorySetFootnote final : public SwHistoryHint { const std::unique_ptr<SwUndoSaveSection, o3tl::default_delete<SwUndoSaveSection>> m_pUndo; const OUString m_FootnoteNumber; - sal_uLong m_nNodeIndex; + SwNodeOffset m_nNodeIndex; const sal_Int32 m_nStart; const bool m_bEndNote; public: - SwHistorySetFootnote( SwTextFootnote* pTextFootnote, sal_uLong nNode ); + SwHistorySetFootnote( SwTextFootnote* pTextFootnote, SwNodeOffset nNode ); SwHistorySetFootnote( const SwTextFootnote& ); virtual ~SwHistorySetFootnote() override; virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) override; @@ -219,11 +219,11 @@ public: class SwHistoryChangeFormatColl final : public SwHistoryHint { SwFormatColl * const m_pColl; - const sal_uLong m_nNodeIndex; + const SwNodeOffset m_nNodeIndex; const SwNodeType m_nNodeType; public: - SwHistoryChangeFormatColl( SwFormatColl* pColl, sal_uLong nNode, SwNodeType nNodeWhich ); + SwHistoryChangeFormatColl( SwFormatColl* pColl, SwNodeOffset nNode, SwNodeType nNodeWhich ); virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) override; }; @@ -257,8 +257,8 @@ class SwHistoryBookmark final : public SwHistoryHint bool m_bHidden; OUString m_aHideCondition; vcl::KeyCode m_aKeycode; - const sal_uLong m_nNode; - const sal_uLong m_nOtherNode; + const SwNodeOffset m_nNode; + const SwNodeOffset m_nOtherNode; const sal_Int32 m_nContent; const sal_Int32 m_nOtherContent; const bool m_bSavePos; @@ -279,7 +279,7 @@ class SwHistoryNoTextFieldmark final : public SwHistoryHint private: const OUString m_sType; - const sal_uLong m_nNode; + const SwNodeOffset m_nNode; const sal_Int32 m_nContent; }; @@ -295,11 +295,11 @@ class SwHistoryTextFieldmark final : public SwHistoryHint private: const OUString m_sName; const OUString m_sType; - const sal_uLong m_nStartNode; + const SwNodeOffset m_nStartNode; const sal_Int32 m_nStartContent; - const sal_uLong m_nEndNode; + const SwNodeOffset m_nEndNode; const sal_Int32 m_nEndContent; - /*const*/ sal_uLong m_nSepNode; + /*const*/ SwNodeOffset m_nSepNode; /*const*/ sal_Int32 m_nSepContent; }; @@ -307,10 +307,10 @@ class SwHistorySetAttrSet final : public SwHistoryHint { SfxItemSet m_OldSet; std::vector<sal_uInt16> m_ResetArray; - const sal_uLong m_nNodeIndex; + const SwNodeOffset m_nNodeIndex; public: - SwHistorySetAttrSet( const SfxItemSet& rSet, sal_uLong nNode, + SwHistorySetAttrSet( const SfxItemSet& rSet, SwNodeOffset nNode, const o3tl::sorted_vector<sal_uInt16> &rSetArr ); virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) override; @@ -319,7 +319,7 @@ public: class SwHistoryChangeFlyAnchor final : public SwHistoryHint { SwFrameFormat & m_rFormat; - const sal_uLong m_nOldNodeIndex; + const SwNodeOffset m_nOldNodeIndex; const sal_Int32 m_nOldContentIndex; public: @@ -367,9 +367,9 @@ public: bool TmpRollback( SwDoc* pDoc, sal_uInt16 nStart, bool ToFirst = true ); void Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, - sal_uLong nNodeIdx ); - void Add( SwTextAttr* pTextHt, sal_uLong nNodeIdx, bool bNewAttr ); - void Add( SwFormatColl*, sal_uLong nNodeIdx, SwNodeType nWhichNd ); + SwNodeOffset nNodeIdx ); + void Add( SwTextAttr* pTextHt, SwNodeOffset nNodeIdx, bool bNewAttr ); + void Add( SwFormatColl*, SwNodeOffset nNodeIdx, SwNodeType nWhichNd ); void Add( const ::sw::mark::IMark&, bool bSavePos, bool bSaveOtherPos ); void AddChangeFlyAnchor( SwFrameFormat& rFormat ); void AddDeleteFly( SwFrameFormat&, sal_uInt16& rSetPos ); @@ -399,12 +399,12 @@ public: // used by Undo classes (Delete/Overwrite/Inserts) void CopyAttr( SwpHints const * pHts, - const sal_uLong nNodeIdx, + const SwNodeOffset nNodeIdx, const sal_Int32 nStart, const sal_Int32 nEnd, const bool bCopyFields ); - void CopyFormatAttr( const SfxItemSet& rSet, sal_uLong nNodeIdx ); + void CopyFormatAttr( const SfxItemSet& rSet, SwNodeOffset nNodeIdx ); void dumpAsXml(xmlTextWriterPtr pWriter) const; }; @@ -414,7 +414,7 @@ class SwRegHistory final: public SwClient private: o3tl::sorted_vector<sal_uInt16> m_WhichIdSet; SwHistory * const m_pHistory; - sal_uLong m_nNodeIndex; + SwNodeOffset m_nNodeIndex; void MakeSetWhichIds(); @@ -433,7 +433,7 @@ public: void AddHint( SwTextAttr* pHt, const bool bNew ); void RegisterInModify( sw::BroadcastingModify* pRegIn, const SwNode& rNd ); - void ChangeNodeIndex( sal_uLong nNew ) { m_nNodeIndex = nNew; } + void ChangeNodeIndex( SwNodeOffset nNew ) { m_nNodeIndex = nNew; } }; #endif // INCLUDED_SW_SOURCE_CORE_INC_ROLBCK_HXX diff --git a/sw/source/core/inc/txmsrt.hxx b/sw/source/core/inc/txmsrt.hxx index 873e683c451e..e8fcfd4c01c2 100644 --- a/sw/source/core/inc/txmsrt.hxx +++ b/sw/source/core/inc/txmsrt.hxx @@ -127,7 +127,7 @@ struct SwTOXSortTabBase const SwTextNode* pTOXNd; const SwTextTOXMark* pTextMark; const SwTOXInternational* pTOXIntl; - sal_uLong nPos; + SwNodeOffset nPos; sal_Int32 nCntPos; sal_uInt16 nType; static SwTOIOptions nOpt; diff --git a/sw/source/core/inc/txtfly.hxx b/sw/source/core/inc/txtfly.hxx index 6d6b14f18c34..e5346fe3745b 100644 --- a/sw/source/core/inc/txtfly.hxx +++ b/sw/source/core/inc/txtfly.hxx @@ -24,6 +24,7 @@ #include <swtypes.hxx> #include <swrect.hxx> #include <com/sun/star/text/WrapTextMode.hpp> +#include <nodeoffset.hxx> #include <memory> #include <vector> @@ -126,7 +127,7 @@ class SwTextFly tools::Long m_nMinBottom; tools::Long m_nNextTop; /// Stores the upper edge of the "next" frame - sal_uLong m_nCurrFrameNodeIndex; + SwNodeOffset m_nCurrFrameNodeIndex; bool m_bOn : 1; bool m_bTopRule: 1; diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 7cbc3a4bfabd..fa1d9be39a0f 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -22,6 +22,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include "cntfrm.hxx" #include "TextFrameIndex.hxx" +#include <nodeoffset.hxx> #include <set> @@ -104,7 +105,7 @@ enum class FrameMode { New, Existing }; std::unique_ptr<sw::MergedPara> CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, FrameMode eMode); SwTextFrame * MakeTextFrame(SwTextNode & rNode, SwFrame *, sw::FrameMode eMode); -bool FrameContainsNode(SwContentFrame const& rFrame, sal_uLong nNodeIndex); +bool FrameContainsNode(SwContentFrame const& rFrame, SwNodeOffset nNodeIndex); bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode); SwTextNode * GetParaPropsNode(SwRootFrame const& rLayout, SwNodeIndex const& rNode); SwPosition GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos); @@ -133,7 +134,7 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam); void AddRemoveFlysAnchoredToFrameStartingAtNode( SwTextFrame & rFrame, SwTextNode & rTextNode, - std::set<sal_uLong> *pSkipped); + std::set<SwNodeOffset> *pSkipped); OUString GetExpandTextMerged(SwRootFrame const* pLayout, SwTextNode const& rNode, bool bWithNumber, diff --git a/sw/source/core/inc/unoflatpara.hxx b/sw/source/core/inc/unoflatpara.hxx index 86d2a11ca977..a0638d13f425 100644 --- a/sw/source/core/inc/unoflatpara.hxx +++ b/sw/source/core/inc/unoflatpara.hxx @@ -29,6 +29,7 @@ #include <svl/listener.hxx> #include <tools/solar.h> #include "unotextmarkup.hxx" +#include <nodeoffset.hxx> #include <set> @@ -138,8 +139,8 @@ private: const sal_Int32 mnType; const bool mbAutomatic; - sal_uLong mnCurrentNode; // used for non-automatic mode - sal_uLong mnEndNode; // used for non-automatic mode + SwNodeOffset mnCurrentNode; // used for non-automatic mode + SwNodeOffset mnEndNode; // used for non-automatic mode }; #endif diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 9d25671ee56a..bc77bcf38f14 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -186,7 +186,7 @@ static void lcl_DelHFFormat( SwClient *pToRemove, SwFrameFormat *pFormat ) // If there is a Cursor registered in one of the nodes, we need to call the // ParkCursor in an (arbitrary) shell. pNode = & aIdx.GetNode(); - sal_uInt32 nEnd = pNode->EndOfSectionIndex(); + SwNodeOffset nEnd = pNode->EndOfSectionIndex(); while ( aIdx < nEnd ) { if ( pNode->IsContentNode() && @@ -620,7 +620,7 @@ void SwFormatContent::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterWriteAttribute( pWriter, BAD_CAST("startNode"), - BAD_CAST(OString::number(m_pStartNode->GetNode().GetIndex()).getStr())); + BAD_CAST(OString::number(sal_Int32(m_pStartNode->GetNode().GetIndex())).getStr())); (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("startNodePtr"), "%p", &m_pStartNode->GetNode()); } @@ -3638,8 +3638,8 @@ void CheckAnchoredFlyConsistency(SwDoc const& rDoc) { #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG SwNodes const& rNodes(rDoc.GetNodes()); - sal_uLong const count(rNodes.Count()); - for (sal_uLong i = 0; i != count; ++i) + SwNodeOffset const count(rNodes.Count()); + for (SwNodeOffset i(0); i != count; ++i) { SwNode const*const pNode(rNodes[i]); std::vector<SwFrameFormat*> const & rFlys(pNode->GetAnchoredFlys()); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index ec53f551f135..a87b50adcae4 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1045,7 +1045,7 @@ bool SwTextNode::IsCollapse() const if (GetDoc().GetDocumentSettingManager().get( DocumentSettingId::COLLAPSE_EMPTY_CELL_PARA ) && GetText().isEmpty()) { - sal_uLong nIdx=GetIndex(); + SwNodeOffset nIdx=GetIndex(); const SwEndNode *pNdBefore=GetNodes()[nIdx-1]->GetEndNode(); const SwEndNode *pNdAfter=GetNodes()[nIdx+1]->GetEndNode(); diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx index 180125bb3b61..d6e582b0ed03 100644 --- a/sw/source/core/layout/dbg_lay.cxx +++ b/sw/source/core/layout/dbg_lay.cxx @@ -543,7 +543,7 @@ static OUString lcl_CellText(const SwCellFrame* pFrame) const SwEndNode* pEndNode = pStartNode->EndOfSectionNode(); const SwNodes& nodes = pStartNode->GetNodes(); - for (sal_uLong i = pStartNode->GetIndex(); i < nodes.Count(); i++) + for (SwNodeOffset i = pStartNode->GetIndex(); i < nodes.Count(); i++) { SwNode* pNode = nodes[i]; diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index c6b075e05e00..2ad57e726bc8 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -363,7 +363,7 @@ sal_uInt8 SwFlowFrame::BwdMoveNecessary( const SwPageFrame *pPage, const SwRect { const SwSortedObjs &rObjs = *pObjs; - sal_uLong nIndex = ULONG_MAX; + SwNodeOffset nIndex = NODE_OFFSET_MAX; for ( size_t i = 0; nRet < 3 && i < rObjs.size(); ++i ) { @@ -396,13 +396,13 @@ sal_uInt8 SwFlowFrame::BwdMoveNecessary( const SwPageFrame *pPage, const SwRect if ( rFormat.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PARA ) { // The index of the other one can be retrieved using the anchor attribute. - sal_uLong nTmpIndex = rFormat.GetAnchor().GetContentAnchor()->nNode.GetIndex(); + SwNodeOffset nTmpIndex = rFormat.GetAnchor().GetContentAnchor()->nNode.GetIndex(); // Now we're going to check whether the current paragraph before // the anchor of the displacing object sits in the text. If this // is the case, we don't try to evade it. // The index is being determined via SwFormatAnchor, because it's // getting quite expensive otherwise. - if( ULONG_MAX == nIndex ) + if( NODE_OFFSET_MAX == nIndex ) { const SwNode *pNode; if (m_rThis.IsTextFrame()) diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index b4c6c58ee06d..8a6cad12ecfc 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -214,7 +214,7 @@ void SwFlyFrame::InsertCnt() const SwFormatContent& rContent = GetFormat()->GetContent(); OSL_ENSURE( rContent.GetContentIdx(), ":-( no content prepared." ); - sal_uLong nIndex = rContent.GetContentIdx()->GetIndex(); + SwNodeOffset nIndex = rContent.GetContentIdx()->GetIndex(); // Lower() means SwColumnFrame; the Content then needs to be inserted into the (Column)BodyFrame ::InsertCnt_( Lower() ? static_cast<SwLayoutFrame*>(static_cast<SwLayoutFrame*>(Lower())->Lower()) : static_cast<SwLayoutFrame*>(this), GetFormat()->GetDoc(), nIndex ); @@ -524,7 +524,7 @@ void SwFlyFrame::UnchainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow ) // The Follow needs his own content to be served const SwFormatContent &rContent = pFollow->GetFormat()->GetContent(); OSL_ENSURE( rContent.GetContentIdx(), ":-( No content prepared." ); - sal_uLong nIndex = rContent.GetContentIdx()->GetIndex(); + SwNodeOffset nIndex = rContent.GetContentIdx()->GetIndex(); // Lower() means SwColumnFrame: this one contains another SwBodyFrame ::InsertCnt_( pFollow->Lower() ? const_cast<SwLayoutFrame*>(static_cast<const SwLayoutFrame*>(static_cast<const SwLayoutFrame*>(pFollow->Lower())->Lower())) : static_cast<SwLayoutFrame*>(pFollow), diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index fb1a5f8426fb..7bf3134370e9 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1073,7 +1073,7 @@ void AppendObj(SwFrame *const pFrame, SwPageFrame *const pPage, SwFrameFormat *c } } -static bool IsShown(sal_uLong const nIndex, +static bool IsShown(SwNodeOffset const nIndex, const SwFormatAnchor & rAnch, std::vector<sw::Extent>::const_iterator const*const pIter, std::vector<sw::Extent>::const_iterator const*const pEnd, @@ -1202,7 +1202,7 @@ void RemoveHiddenObjsOfNode(SwTextNode const& rNode, } } -void AppendObjsOfNode(SwFrameFormats const*const pTable, sal_uLong const nIndex, +void AppendObjsOfNode(SwFrameFormats const*const pTable, SwNodeOffset const nIndex, SwFrame *const pFrame, SwPageFrame *const pPage, SwDoc *const pDoc, std::vector<sw::Extent>::const_iterator const*const pIter, std::vector<sw::Extent>::const_iterator const*const pEnd, @@ -1249,7 +1249,7 @@ void AppendObjsOfNode(SwFrameFormats const*const pTable, sal_uLong const nIndex, } -void AppendObjs(const SwFrameFormats *const pTable, sal_uLong const nIndex, +void AppendObjs(const SwFrameFormats *const pTable, SwNodeOffset const nIndex, SwFrame *const pFrame, SwPageFrame *const pPage, SwDoc *const pDoc) { if (pFrame->IsTextFrame()) @@ -1267,10 +1267,10 @@ void AppendObjs(const SwFrameFormats *const pTable, sal_uLong const nIndex, { AppendObjsOfNode(pTable, pNode->GetIndex(), pFrame, pPage, pDoc, &iterFirst, &iter, pMerged->pFirstNode, pMerged->pLastNode); - sal_uLong const until = iter == pMerged->extents.end() + SwNodeOffset const until = iter == pMerged->extents.end() ? pMerged->pLastNode->GetIndex() + 1 : iter->pNode->GetIndex(); - for (sal_uLong i = pNode->GetIndex() + 1; i < until; ++i) + for (SwNodeOffset i = pNode->GetIndex() + 1; i < until; ++i) { // let's show at-para flys on nodes that contain start/end of // redline too, even if there's no text there @@ -1462,7 +1462,7 @@ static void lcl_SetPos( SwFrame& _rNewFrame, } void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, - sal_uLong nIndex, bool bPages, sal_uLong nEndIndex, + SwNodeOffset nIndex, bool bPages, SwNodeOffset nEndIndex, SwFrame *pPrv, sw::FrameMode const eMode ) { pDoc->getIDocumentTimerAccess().BlockIdling(); @@ -1501,7 +1501,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, // Attention: the SwLayHelper class uses references to the content-, // page-, layout-frame etc. and may change them! pPageMaker.reset(new SwLayHelper( pDoc, pFrame, pPrv, pPage, pLay, - pActualSection, nIndex, 0 == nEndIndex )); + pActualSection, nIndex, SwNodeOffset(0) == nEndIndex )); if( bStartPercent ) { const sal_uLong nPageCount = pPageMaker->CalcPageCount(); @@ -1558,7 +1558,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, // Do not consider the end node. The caller (Section/MakeFrames()) has to // ensure that the end of this range is positioned before EndIndex! - for ( ; nEndIndex == 0 || nIndex < nEndIndex; ++nIndex) + for ( ; nEndIndex == SwNodeOffset(0) || nIndex < nEndIndex; ++nIndex) { SwNode *pNd = pDoc->GetNodes()[nIndex]; if ( pNd->IsContentNode() ) @@ -1987,7 +1987,7 @@ void MakeFrames( SwDoc *pDoc, const SwNodeIndex &rSttIdx, bObjsDirect = false; SwNodeIndex aTmp( rSttIdx ); - sal_uLong nEndIdx = rEndIdx.GetIndex(); + SwNodeOffset nEndIdx = rEndIdx.GetIndex(); SwNode* pNd = pDoc->GetNodes().FindPrvNxtFrameNode( aTmp, pDoc->GetNodes()[ nEndIdx-1 ]); if ( pNd ) @@ -2025,7 +2025,7 @@ void MakeFrames( SwDoc *pDoc, const SwNodeIndex &rSttIdx, // If pFrame cannot be moved, it is not possible to move it to the next page. This applies // also for frames (in the first column of a frame pFrame is moveable) and column // sections of tables (also here pFrame is moveable). - bool bMoveNext = nEndIdx - rSttIdx.GetIndex() > 120; + bool bMoveNext = nEndIdx - rSttIdx.GetIndex() > SwNodeOffset(120); bool bAllowMove = !pFrame->IsInFly() && pFrame->IsMoveable() && (!pFrame->IsInTab() || pFrame->IsTabFrame() ); if ( bMoveNext && bAllowMove ) diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index 2d971400743d..a8e9bfa5a45c 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -106,7 +106,7 @@ SwHeadFootFrame::SwHeadFootFrame( SwFrameFormat * pFormat, SwFrame* pSib, SwFram // Have the objects created right now for header and footer bool bOld = bObjsDirect; bObjsDirect = true; - sal_uLong nIndex = rCnt.GetContentIdx()->GetIndex(); + SwNodeOffset nIndex = rCnt.GetContentIdx()->GetIndex(); ::InsertCnt_( this, pFormat->GetDoc(), ++nIndex ); bObjsDirect = bOld; } diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index 9af0d23ac69f..e5b1dc34146d 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -77,7 +77,7 @@ void SwLayoutCache::Read( SvStream &rStream ) } } -void SwLayCacheImpl::Insert( sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset ) +void SwLayCacheImpl::Insert( sal_uInt16 nType, SwNodeOffset nIndex, sal_Int32 nOffset ) { m_aType.push_back( nType ); mIndices.push_back( nIndex ); @@ -115,7 +115,7 @@ bool SwLayCacheImpl::Read( SvStream& rStream ) else nOffset = COMPLETE_STRING; aIo.CloseFlagRec(); - Insert( SW_LAYCACHE_IO_REC_PARA, nIndex, static_cast<sal_Int32>(nOffset) ); + Insert( SW_LAYCACHE_IO_REC_PARA, SwNodeOffset(nIndex), static_cast<sal_Int32>(nOffset) ); aIo.CloseRec(); break; } @@ -124,7 +124,7 @@ bool SwLayCacheImpl::Read( SvStream& rStream ) aIo.OpenFlagRec(); aIo.GetStream().ReadUInt32( nIndex ) .ReadUInt32( nOffset ); - Insert( SW_LAYCACHE_IO_REC_TABLE, nIndex, static_cast<sal_Int32>(nOffset) ); + Insert( SW_LAYCACHE_IO_REC_TABLE, SwNodeOffset(nIndex), static_cast<sal_Int32>(nOffset) ); aIo.CloseFlagRec(); aIo.CloseRec(); break; @@ -168,7 +168,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) SwLayCacheIoImpl aIo( rStream, true ); // We want to save the relative index, so we need the index // of the first content - sal_uLong nStartOfContent = rDoc.GetNodes().GetEndOfContent(). + SwNodeOffset nStartOfContent = rDoc.GetNodes().GetEndOfContent(). StartOfSectionNode()->GetIndex(); // The first page... SwPageFrame* pPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->Lower())); @@ -193,7 +193,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) { SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(pTmp)); assert(!pFrame->GetMergedPara()); - sal_uLong nNdIdx = pFrame->GetTextNodeFirst()->GetIndex(); + SwNodeOffset nNdIdx = pFrame->GetTextNodeFirst()->GetIndex(); if( nNdIdx > nStartOfContent ) { /* Open Paragraph Record */ @@ -202,7 +202,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) aIo.OpenFlagRec( bFollow ? 0x01 : 0x00, bFollow ? 8 : 4 ); nNdIdx -= nStartOfContent; - aIo.GetStream().WriteUInt32( nNdIdx ); + aIo.GetStream().WriteUInt32( sal_Int32(nNdIdx) ); if( bFollow ) aIo.GetStream().WriteUInt32( sal_Int32(static_cast<SwTextFrame*>(pTmp)->GetOffset()) ); aIo.CloseFlagRec(); @@ -235,7 +235,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) } while (true) { - sal_uLong nNdIdx = + SwNodeOffset nNdIdx = pTab->GetTable()->GetTableNode()->GetIndex(); if( nNdIdx > nStartOfContent ) { @@ -243,7 +243,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) aIo.OpenRec( SW_LAYCACHE_IO_REC_TABLE ); aIo.OpenFlagRec( 0, 8 ); nNdIdx -= nStartOfContent; - aIo.GetStream().WriteUInt32( nNdIdx ) + aIo.GetStream().WriteUInt32( sal_Int32(nNdIdx) ) .WriteUInt32( nOfst ); aIo.CloseFlagRec(); /* Close Table Record */ @@ -330,7 +330,7 @@ bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const if( pRootFrame ) { size_t nIndex = 0; - sal_uLong nStartOfContent = rDoc.GetNodes().GetEndOfContent(). + SwNodeOffset nStartOfContent = rDoc.GetNodes().GetEndOfContent(). StartOfSectionNode()->GetIndex(); const SwPageFrame* pPage = static_cast<const SwPageFrame*>(pRootFrame->Lower()); if( pPage ) @@ -351,7 +351,7 @@ bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(pTmp)); assert(!pFrame->GetMergedPara()); - sal_uLong nNdIdx = pFrame->GetTextNodeFirst()->GetIndex(); + SwNodeOffset nNdIdx = pFrame->GetTextNodeFirst()->GetIndex(); if( nNdIdx > nStartOfContent ) { bool bFollow = static_cast<const SwTextFrame*>(pTmp)->IsFollow(); @@ -390,7 +390,7 @@ bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const } do { - sal_uLong nNdIdx = + SwNodeOffset nNdIdx = pTab->GetTable()->GetTableNode()->GetIndex(); if( nNdIdx > nStartOfContent ) { @@ -468,7 +468,7 @@ SwActualSection::SwActualSection( SwActualSection *pUp, namespace { bool sanityCheckLayoutCache(SwLayCacheImpl const& rCache, - SwNodes const& rNodes, sal_uLong nNodeIndex) + SwNodes const& rNodes, SwNodeOffset nNodeIndex) { auto const nStartOfContent(rNodes.GetEndOfContent().StartOfSectionNode()->GetIndex()); nNodeIndex -= nStartOfContent; @@ -518,7 +518,7 @@ bool sanityCheckLayoutCache(SwLayCacheImpl const& rCache, */ SwLayHelper::SwLayHelper( SwDoc *pD, SwFrame* &rpF, SwFrame* &rpP, SwPageFrame* &rpPg, SwLayoutFrame* &rpL, std::unique_ptr<SwActualSection> &rpA, - sal_uLong nNodeIndex, bool bCache ) + SwNodeOffset nNodeIndex, bool bCache ) : mrpFrame( rpF ) , mrpPrv( rpP ) , mrpPage( rpPg ) @@ -546,13 +546,13 @@ SwLayHelper::SwLayHelper( SwDoc *pD, SwFrame* &rpF, SwFrame* &rpP, SwPageFrame* mpDoc->GetLayoutCache()->UnlockImpl(); mpImpl = nullptr; mnIndex = std::numeric_limits<size_t>::max(); - mnStartOfContent = USHRT_MAX; + mnStartOfContent = SwNodeOffset(USHRT_MAX); } } else { mnIndex = std::numeric_limits<size_t>::max(); - mnStartOfContent = ULONG_MAX; + mnStartOfContent = NODE_OFFSET_MAX; } } @@ -584,19 +584,19 @@ sal_uLong SwLayHelper::CalcPageCount() nPgCount = mpDoc->getIDocumentStatistics().GetDocStat().nPage; if ( nPgCount <= 10 ) // no page insertion for less than 10 pages nPgCount = 0; - sal_uLong nNdCount = mpDoc->getIDocumentStatistics().GetDocStat().nPara; + sal_Int32 nNdCount = mpDoc->getIDocumentStatistics().GetDocStat().nPara; if ( nNdCount <= 1 ) { //Estimates the number of paragraphs. - sal_uLong nTmp = mpDoc->GetNodes().GetEndOfContent().GetIndex() - + SwNodeOffset nTmp = mpDoc->GetNodes().GetEndOfContent().GetIndex() - mpDoc->GetNodes().GetEndOfExtras().GetIndex(); //Tables have a little overhead... - nTmp -= mpDoc->GetTableFrameFormats()->size() * 25; + nTmp -= SwNodeOffset(mpDoc->GetTableFrameFormats()->size() * 25); //Fly frames, too .. nTmp -= (mpDoc->GetNodes().GetEndOfAutotext().GetIndex() - - mpDoc->GetNodes().GetEndOfInserts().GetIndex()) / 3 * 5; - if ( nTmp > 0 ) - nNdCount = nTmp; + mpDoc->GetNodes().GetEndOfInserts().GetIndex()) / SwNodeOffset(3 * 5); + if ( nTmp > SwNodeOffset(0) ) + nNdCount = sal_Int32(nTmp); } if ( nNdCount > 100 ) // no estimation below this value { @@ -710,7 +710,7 @@ bool SwLayHelper::CheckInsertPage() * A really big table or long paragraph may contains more than * one page, in this case the needed count of pages will inserted. */ -bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex ) +bool SwLayHelper::CheckInsert( SwNodeOffset nNodeIndex ) { bool bRet = false; bool bLongTab = false; diff --git a/sw/source/core/layout/layhelp.hxx b/sw/source/core/layout/layhelp.hxx index 106fe4428013..5df151ae7e61 100644 --- a/sw/source/core/layout/layhelp.hxx +++ b/sw/source/core/layout/layhelp.hxx @@ -54,13 +54,13 @@ typedef std::vector<SwFlyCache> SwPageFlyCache; class SwLayCacheImpl { - std::vector<sal_uLong> mIndices; + std::vector<SwNodeOffset> mIndices; /// either a textframe character offset, or a row index inside a table std::deque<sal_Int32> m_aOffset; std::vector<sal_uInt16> m_aType; SwPageFlyCache m_FlyCache; bool m_bUseFlyCache; - void Insert( sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset ); + void Insert( sal_uInt16 nType, SwNodeOffset nIndex, sal_Int32 nOffset ); public: inline SwLayCacheImpl(); @@ -69,7 +69,7 @@ public: bool Read( SvStream& rStream ); - sal_uLong GetBreakIndex( size_t nIdx ) const { return mIndices[ nIdx ]; } + SwNodeOffset GetBreakIndex( size_t nIdx ) const { return mIndices[ nIdx ]; } sal_Int32 GetBreakOfst( size_t nIdx ) const { return m_aOffset[ nIdx ]; } sal_uInt16 GetBreakType( size_t nIdx ) const { return m_aType[ nIdx ]; } @@ -112,7 +112,7 @@ class SwLayHelper SwLayCacheImpl* mpImpl; sal_uLong mnMaxParaPerPage; sal_uLong mnParagraphCnt; - sal_uLong mnStartOfContent; + SwNodeOffset mnStartOfContent; size_t mnIndex; ///< the index in the page break array size_t mnFlyIdx; ///< the index in the fly cache array bool mbFirst : 1; @@ -120,10 +120,10 @@ class SwLayHelper public: SwLayHelper( SwDoc *pD, SwFrame* &rpF, SwFrame* &rpP, SwPageFrame* &rpPg, SwLayoutFrame* &rpL, std::unique_ptr<SwActualSection> &rpA, - sal_uLong nNodeIndex, bool bCache ); + SwNodeOffset nNodeIndex, bool bCache ); ~SwLayHelper(); sal_uLong CalcPageCount(); - bool CheckInsert( sal_uLong nNodeIndex ); + bool CheckInsert( SwNodeOffset nNodeIndex ); bool CheckInsertPage(); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index fcb3d2c3bcfb..95388db5c9ac 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1238,7 +1238,7 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK const SwFrameFormats *pTable = GetFormat()->GetDoc()->GetSpzFrameFormats(); if( !pTable->empty() ) { - sal_uLong nIndex; + SwNodeOffset nIndex; SwContentFrame* pFrame = pHeadline->ContainsContent(); while( pFrame ) { @@ -4908,7 +4908,7 @@ SwCellFrame::SwCellFrame(const SwTableBox &rBox, SwFrame* pSib, bool bInsertCont //Rows have to be present and those are added. if ( rBox.GetSttIdx() ) { - sal_uLong nIndex = rBox.GetSttIdx(); + SwNodeOffset nIndex = rBox.GetSttIdx(); ::InsertCnt_( this, rBox.GetFrameFormat()->GetDoc(), ++nIndex ); } else diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 8e060913913d..9ea1ac6702ee 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -4229,7 +4229,7 @@ void SwRootFrame::InvalidateAllObjPos() static void AddRemoveFlysForNode( SwTextFrame & rFrame, SwTextNode & rTextNode, - std::set<sal_uLong> *const pSkipped, + std::set<SwNodeOffset> *const pSkipped, const SwFrameFormats & rTable, SwPageFrame *const pPage, SwTextNode const*const pNode, @@ -4268,7 +4268,7 @@ namespace sw { /// already properly attached, so only the other nodes need handling here. void AddRemoveFlysAnchoredToFrameStartingAtNode( SwTextFrame & rFrame, SwTextNode & rTextNode, - std::set<sal_uLong> *const pSkipped) + std::set<SwNodeOffset> *const pSkipped) { auto const pMerged(rFrame.GetMergedPara()); if (!pMerged @@ -4294,10 +4294,10 @@ void AddRemoveFlysAnchoredToFrameStartingAtNode( AddRemoveFlysForNode(rFrame, rTextNode, pSkipped, rTable, pPage, pNode, iterFirst, iter, pMerged->pFirstNode, pMerged->pLastNode); - sal_uLong const until = iter == pMerged->extents.end() + SwNodeOffset const until = iter == pMerged->extents.end() ? pMerged->pLastNode->GetIndex() + 1 : iter->pNode->GetIndex(); - for (sal_uLong i = pNode->GetIndex() + 1; i < until; ++i) + for (SwNodeOffset i = pNode->GetIndex() + 1; i < until; ++i) { // let's show at-para flys on nodes that contain start/end of // redline too, even if there's no text there @@ -4323,11 +4323,11 @@ void AddRemoveFlysAnchoredToFrameStartingAtNode( static void UnHideRedlines(SwRootFrame & rLayout, SwNodes & rNodes, SwNode const& rEndOfSectionNode, - std::set<sal_uLong> *const pSkipped) + std::set<SwNodeOffset> *const pSkipped) { assert(rEndOfSectionNode.IsEndNode()); assert(rNodes[rEndOfSectionNode.StartOfSectionNode()->GetIndex() + 1]->IsCreateFrameWhenHidingRedlines()); // first node is never hidden - for (sal_uLong i = rEndOfSectionNode.StartOfSectionNode()->GetIndex() + 1; + for (SwNodeOffset i = rEndOfSectionNode.StartOfSectionNode()->GetIndex() + 1; i < rEndOfSectionNode.GetIndex(); ++i) { SwNode & rNode(*rNodes[i]); @@ -4414,7 +4414,7 @@ static void UnHideRedlines(SwRootFrame & rLayout, // iterate over nodes, not extents: if a node has // no extents now but did have extents initially, // its flys need their frames deleted too! - for (sal_uLong j = rTextNode.GetIndex() + 1; + for (SwNodeOffset j = rTextNode.GetIndex() + 1; j <= pMergedPara->pLastNode->GetIndex(); ++j) { SwNode *const pNode(rTextNode.GetNodes()[j]); @@ -4459,7 +4459,7 @@ static void UnHideRedlines(SwRootFrame & rLayout, && pRedline->GetType() == RedlineType::Delete && &pRedline->Start()->nNode.GetNode() == &rNode) { - for (sal_uLong j = rNode.GetIndex(); j <= rNode.EndOfSectionIndex(); ++j) + for (SwNodeOffset j = rNode.GetIndex(); j <= rNode.EndOfSectionIndex(); ++j) { rNode.GetNodes()[j]->SetRedlineMergeFlag(SwNode::Merge::Hidden); } @@ -4502,7 +4502,7 @@ static void UnHideRedlines(SwRootFrame & rLayout, assert(!rNode.IsContentNode() || !rNode.GetContentNode()->getLayoutFrame(&rLayout) || // FIXME: skip this assert in tables with deleted rows rNode.GetContentNode()->getLayoutFrame(&rLayout)->IsInTab()); - sal_uLong j = i + 1; + SwNodeOffset j = i + 1; for ( ; j < rEndOfSectionNode.GetIndex(); ++j) { if (rNodes[j]->IsCreateFrameWhenHidingRedlines()) @@ -4526,10 +4526,10 @@ static void UnHideRedlines(SwRootFrame & rLayout, static void UnHideRedlinesExtras(SwRootFrame & rLayout, SwNodes & rNodes, SwNode const& rEndOfExtraSectionNode, - std::set<sal_uLong> *const pSkipped) + std::set<SwNodeOffset> *const pSkipped) { assert(rEndOfExtraSectionNode.IsEndNode()); - for (sal_uLong i = rEndOfExtraSectionNode.StartOfSectionNode()->GetIndex() + for (SwNodeOffset i = rEndOfExtraSectionNode.StartOfSectionNode()->GetIndex() + 1; i < rEndOfExtraSectionNode.GetIndex(); ++i) { SwNode const& rStartNode(*rNodes[i]); @@ -4538,7 +4538,7 @@ static void UnHideRedlinesExtras(SwRootFrame & rLayout, SwNode const& rEndNode(*rStartNode.EndOfSectionNode()); bool bSkip(pSkipped && pSkipped->find(i) != pSkipped->end()); i = rEndNode.GetIndex(); - for (sal_uLong j = rStartNode.GetIndex() + 1; j < i; ++j) + for (SwNodeOffset j = rStartNode.GetIndex() + 1; j < i; ++j) { // note: SwStartNode has no way to access the frames, so check // whether the first content-node inside the section has frames @@ -4598,7 +4598,7 @@ static void UnHide(SwRootFrame & rLayout) // Flys before footnotes: because footnotes may contain flys but not // vice-versa; alas flys may contain flys, so we skip some of them // if they have already been created from scratch via their anchor flys. - std::set<sal_uLong> skippedFlys; + std::set<SwNodeOffset> skippedFlys; UnHideRedlinesExtras(rLayout, rNodes, rNodes.GetEndOfAutotext(), // when un-hiding, delay all fly frame creation to AppendAllObjs below rLayout.HasMergedParas() ? &skippedFlys : nullptr); diff --git a/sw/source/core/model/ModelTraverser.cxx b/sw/source/core/model/ModelTraverser.cxx index bb959a95dec6..b7d2b2200dd6 100644 --- a/sw/source/core/model/ModelTraverser.cxx +++ b/sw/source/core/model/ModelTraverser.cxx @@ -25,7 +25,7 @@ void ModelTraverser::traverse() auto const& pNodes = m_pDoc->GetNodes(); SwNode* pNode = nullptr; - for (sal_uLong n = 0; n < pNodes.Count(); ++n) + for (SwNodeOffset n(0); n < pNodes.Count(); ++n) { pNode = pNodes[n]; if (pNode) diff --git a/sw/source/core/model/SearchResultLocator.cxx b/sw/source/core/model/SearchResultLocator.cxx index 79ba42a97b7c..8ce21c7255ec 100644 --- a/sw/source/core/model/SearchResultLocator.cxx +++ b/sw/source/core/model/SearchResultLocator.cxx @@ -32,7 +32,7 @@ void SearchResultLocator::findOne(LocationResult& rResult, SearchIndexData const if (rSearchIndexData.meType == NodeType::WriterNode) { SwNodes const& rNodes = mpDocument->GetNodes(); - if (rSearchIndexData.mnNodeIndex >= sal_Int32(rNodes.Count())) + if (rSearchIndexData.mnNodeIndex >= rNodes.Count()) return; SwNode* pNode = rNodes[rSearchIndexData.mnNodeIndex]; @@ -118,10 +118,10 @@ bool SearchResultLocator::tryParseJSON(const char* pPayload, std::string sJsonObjectName = rEach.get<std::string>("object_name", ""); - sal_Int32 nIndex = rEach.get<sal_Int32>("index", -1); + SwNodeOffset nIndex(rEach.get<sal_Int32>("index", -1)); // Don't add search data elements that don't have valid data - if (eNodeType != sw::search::NodeType::Undefined && nIndex >= 0) + if (eNodeType != sw::search::NodeType::Undefined && nIndex >= SwNodeOffset(0)) { OUString sObjectName; if (!sJsonObjectName.empty()) @@ -169,7 +169,7 @@ bool SearchResultLocator::tryParseXML(const char* pPayload, if (!sType.isEmpty() && !sIndex.isEmpty()) { sw::search::SearchIndexData aData; - aData.mnNodeIndex = sIndex.toInt32(); + aData.mnNodeIndex = SwNodeOffset(sIndex.toInt32()); auto eNodeType = sw::search::NodeType::Undefined; if (sType == "writer") eNodeType = sw::search::NodeType::WriterNode; diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index c58d71d1f6f9..f8b153217455 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -971,7 +971,7 @@ SwTwips SwAnchoredObjectPosition::AdjustHoriRelPosForDrawAside( const sal_uInt32 nObjOrdNum = GetObject().GetOrdNum(); const SwPageFrame* pObjPage = rFlyAtContentFrame.FindPageFrame(); const SwFrame* pObjContext = ::FindContext( &rAnchorTextFrame, SwFrameType::Column ); - sal_uLong nObjIndex = rAnchorTextFrame.GetTextNodeFirst()->GetIndex(); + SwNodeOffset nObjIndex = rAnchorTextFrame.GetTextNodeFirst()->GetIndex(); SwOrderIter aIter( pObjPage ); const SwFlyFrame* pFly = static_cast<const SwVirtFlyDrawObj*>(aIter.Bottom())->GetFlyFrame(); while ( pFly && nObjOrdNum > pFly->GetVirtDrawObj()->GetOrdNumDirect() ) @@ -1066,7 +1066,7 @@ SwTwips SwAnchoredObjectPosition::AdjustHoriRelPosForDrawAside( bool SwAnchoredObjectPosition::DrawAsideFly( const SwFlyFrame* _pFly, const SwRect& _rObjRect, const SwFrame* _pObjContext, - const sal_uLong _nObjIndex, + const SwNodeOffset _nObjIndex, const bool _bEvenPage, const sal_Int16 _eHoriOrient, const sal_Int16 _eRelOrient @@ -1081,7 +1081,7 @@ bool SwAnchoredObjectPosition::DrawAsideFly( const SwFlyFrame* _pFly, aRectFnSet.BottomDist( _rObjRect, aRectFnSet.GetTop(_pFly->getFrameArea()) ) < 0 && ::FindContext( _pFly->GetAnchorFrame(), SwFrameType::Column ) == _pObjContext ) { - sal_uLong nOtherIndex = + SwNodeOffset nOtherIndex = static_cast<const SwTextFrame*>(_pFly->GetAnchorFrame())->GetTextNodeFirst()->GetIndex(); if (sw::FrameContainsNode(static_cast<SwTextFrame const&>(*_pFly->GetAnchorFrame()), _nObjIndex) || nOtherIndex < _nObjIndex) diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 024b73cdbbed..8f6929524f05 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -295,7 +295,7 @@ void SwOLENode::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwOLENode")); (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), - BAD_CAST(OString::number(GetIndex()).getStr())); + BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr())); GetOLEObj().dumpAsXml(pWriter); @@ -469,7 +469,7 @@ SwContentNode* SwOLENode::MakeCopy( SwDoc& rDoc, const SwNodeIndex& rIdx, bool) bool SwOLENode::IsInGlobalDocSection() const { // Find the "Body Anchor" - sal_uLong nEndExtraIdx = GetNodes().GetEndOfExtras().GetIndex(); + SwNodeOffset nEndExtraIdx = GetNodes().GetEndOfExtras().GetIndex(); const SwNode* pAnchorNd = this; do { SwFrameFormat* pFlyFormat = pAnchorNd->GetFlyFormat(); diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index a2506f59bd7c..a5556e83ecf3 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -2202,7 +2202,7 @@ void SwTable::ConvertSubtableBox(sal_uInt16 const nRow, sal_uInt16 const nBox) pDoc->GetNodes().MakeTextNode( SwNodeIndex(*pSourceBox->GetSttNd(), +1), pDoc->GetDfltTextFormatColl()); - SwNodeRange content(*pSourceBox->GetSttNd(), +2, + SwNodeRange content(*pSourceBox->GetSttNd(), SwNodeOffset(+2), *pSourceBox->GetSttNd()->EndOfSectionNode()); SwTableBox *const pNewBox(pNewLine->GetTabBoxes()[j+k]); SwNodeIndex insPos(*pNewBox->GetSttNd(), 1); diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index daa52cfc2da9..a67b05a48e2f 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -71,7 +71,7 @@ using namespace com::sun::star; #define COLFUZZY 20 static void ChgTextToNum( SwTableBox& rBox, const OUString& rText, const Color* pCol, - bool bChgAlign, sal_uLong nNdPos ); + bool bChgAlign, SwNodeOffset nNdPos ); sal_Int32 SwTableBox::getRowSpan() const { @@ -1380,7 +1380,7 @@ const SwTableBox* SwTable::GetTableBox( const OUString& rName, return pBox; } -SwTableBox* SwTable::GetTableBox( sal_uLong nSttIdx ) +SwTableBox* SwTable::GetTableBox( SwNodeOffset nSttIdx ) { // For optimizations, don't always process the entire SortArray. // Converting text to table, tries certain conditions @@ -1389,7 +1389,7 @@ SwTableBox* SwTable::GetTableBox( sal_uLong nSttIdx ) return nullptr; SwTableBox* pRet = nullptr; SwNodes& rNds = GetFrameFormat()->GetDoc()->GetNodes(); - sal_uLong nIndex = nSttIdx + 1; + SwNodeOffset nIndex = nSttIdx + 1; SwContentNode* pCNd = nullptr; SwTableNode* pTableNd = nullptr; @@ -1908,9 +1908,9 @@ bool SwTableBox::IsInHeadline( const SwTable* pTable ) const return pTable->GetTabLines()[ 0 ] == pLine; } -sal_uLong SwTableBox::GetSttIdx() const +SwNodeOffset SwTableBox::GetSttIdx() const { - return m_pStartNode ? m_pStartNode->GetIndex() : 0; + return m_pStartNode ? m_pStartNode->GetIndex() : SwNodeOffset(0); } bool SwTableBox::IsEmpty() const @@ -1993,14 +1993,14 @@ void SwTable::SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout> const& r) static void ChgTextToNum( SwTableBox& rBox, const OUString& rText, const Color* pCol, bool bChgAlign ) { - sal_uLong nNdPos = rBox.IsValidNumTextNd(); + SwNodeOffset nNdPos = rBox.IsValidNumTextNd(); ChgTextToNum( rBox,rText,pCol,bChgAlign,nNdPos); } void ChgTextToNum( SwTableBox& rBox, const OUString& rText, const Color* pCol, - bool bChgAlign,sal_uLong nNdPos ) + bool bChgAlign, SwNodeOffset nNdPos ) { - if( ULONG_MAX == nNdPos ) + if( NODE_OFFSET_MAX == nNdPos ) return; SwDoc* pDoc = rBox.GetFrameFormat()->GetDoc(); @@ -2126,8 +2126,8 @@ void ChgTextToNum( SwTableBox& rBox, const OUString& rText, const Color* pCol, static void ChgNumToText( SwTableBox& rBox, sal_uLong nFormat ) { - sal_uLong nNdPos = rBox.IsValidNumTextNd( false ); - if( ULONG_MAX == nNdPos ) + SwNodeOffset nNdPos = rBox.IsValidNumTextNd( false ); + if( NODE_OFFSET_MAX == nNdPos ) return; SwDoc* pDoc = rBox.GetFrameFormat()->GetDoc(); @@ -2268,8 +2268,8 @@ void SwTableBoxFormat::BoxAttributeChanged(SwTableBox& rBox, const SwTableBoxNum if(!pNewValue && SfxItemState::SET != GetItemState(RES_BOXATR_VALUE, false, reinterpret_cast<const SfxPoolItem**>(&pNewValue))) { // so far, no value has been set, so try to evaluate the content - sal_uLong nNdPos = rBox.IsValidNumTextNd(); - if(ULONG_MAX != nNdPos) + SwNodeOffset nNdPos = rBox.IsValidNumTextNd(); + if(NODE_OFFSET_MAX != nNdPos) { sal_uInt32 nTmpFormatIdx = nNewFormat; OUString aText(GetDoc()->GetNodes()[nNdPos] ->GetTextNode()->GetRedlineText()); @@ -2407,7 +2407,7 @@ void SwTableBoxFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint // something changed and some BoxAttribut remained in the set! if( pNewFormat || pNewFormula || pNewVal ) { - GetDoc()->getIDocumentFieldsAccess().SetFieldsDirty(true, nullptr, 0); + GetDoc()->getIDocumentFieldsAccess().SetFieldsDirty(true, nullptr, SwNodeOffset(0)); if(SfxItemState::SET == GetItemState(RES_BOXATR_FORMAT, false) || SfxItemState::SET == GetItemState(RES_BOXATR_VALUE, false) || @@ -2440,8 +2440,8 @@ bool SwTableBox::HasNumContent( double& rNum, sal_uInt32& rFormatIndex, bool& rIsEmptyTextNd ) const { bool bRet = false; - sal_uLong nNdPos = IsValidNumTextNd(); - if( ULONG_MAX != nNdPos ) + SwNodeOffset nNdPos = IsValidNumTextNd(); + if( NODE_OFFSET_MAX != nNdPos ) { OUString aText( m_pStartNode->GetNodes()[ nNdPos ]->GetTextNode()->GetRedlineText() ); // Keep Tabs @@ -2488,8 +2488,8 @@ bool SwTableBox::IsNumberChanged() const reinterpret_cast<const SfxPoolItem**>(&pNumFormat) )) pNumFormat = nullptr; - sal_uLong nNdPos; - if( pNumFormat && pValue && ULONG_MAX != ( nNdPos = IsValidNumTextNd() ) ) + SwNodeOffset nNdPos; + if( pNumFormat && pValue && NODE_OFFSET_MAX != ( nNdPos = IsValidNumTextNd() ) ) { OUString sNewText, sOldText( m_pStartNode->GetNodes()[ nNdPos ]-> GetTextNode()->GetRedlineText() ); @@ -2508,14 +2508,14 @@ bool SwTableBox::IsNumberChanged() const return bRet; } -sal_uLong SwTableBox::IsValidNumTextNd( bool bCheckAttr ) const +SwNodeOffset SwTableBox::IsValidNumTextNd( bool bCheckAttr ) const { - sal_uLong nPos = ULONG_MAX; + SwNodeOffset nPos = NODE_OFFSET_MAX; if( m_pStartNode ) { SwNodeIndex aIdx( *m_pStartNode ); - sal_uLong nIndex = aIdx.GetIndex(); - const sal_uLong nIndexEnd = m_pStartNode->GetNodes()[ nIndex ]->EndOfSectionIndex(); + SwNodeOffset nIndex = aIdx.GetIndex(); + const SwNodeOffset nIndexEnd = m_pStartNode->GetNodes()[ nIndex ]->EndOfSectionIndex(); const SwTextNode *pTextNode = nullptr; while( ++nIndex < nIndexEnd ) { @@ -2576,7 +2576,7 @@ sal_uLong SwTableBox::IsValidNumTextNd( bool bCheckAttr ) const { continue; } - nPos = ULONG_MAX; + nPos = NODE_OFFSET_MAX; break; } } @@ -2584,7 +2584,7 @@ sal_uLong SwTableBox::IsValidNumTextNd( bool bCheckAttr ) const } } else - nPos = ULONG_MAX; + nPos = NODE_OFFSET_MAX; } return nPos; } @@ -2618,11 +2618,11 @@ void SwTableBox::ActualiseValueBox() return; const sal_uLong nFormatId = static_cast<const SwTableBoxNumFormat*>(pFormatItem)->GetValue(); - sal_uLong nNdPos = ULONG_MAX; + SwNodeOffset nNdPos = NODE_OFFSET_MAX; SvNumberFormatter* pNumFormatr = pFormat->GetDoc()->GetNumberFormatter(); if( !pNumFormatr->IsTextFormat( nFormatId ) && - ULONG_MAX != (nNdPos = IsValidNumTextNd()) ) + NODE_OFFSET_MAX != (nNdPos = IsValidNumTextNd()) ) { double fVal = static_cast<const SwTableBoxValue*>(pValItem)->GetValue(); const Color* pCol = nullptr; diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index f9319a54770b..0eb130848f3d 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -831,7 +831,7 @@ bool SwTextFrame::UnitUp_( SwPaM *pPam, const SwTwips nOffset, // See comment in SwTextFrame::GetModelPositionForViewPoint() #if OSL_DEBUG_LEVEL > 0 - const sal_uLong nOldNode = pPam->GetPoint()->nNode.GetIndex(); + const SwNodeOffset nOldNode = pPam->GetPoint()->nNode.GetIndex(); #endif // The node should not be changed TextFrameIndex nTmpOfst = aLine.GetModelPositionForViewPoint(pPam->GetPoint(), @@ -1192,7 +1192,7 @@ bool SwTextFrame::UnitDown_(SwPaM *pPam, const SwTwips nOffset, aCharBox.Width( aCharBox.SSize().Width() / 2 ); #if OSL_DEBUG_LEVEL > 0 // See comment in SwTextFrame::GetModelPositionForViewPoint() - const sal_uLong nOldNode = pPam->GetPoint()->nNode.GetIndex(); + const SwNodeOffset nOldNode = pPam->GetPoint()->nNode.GetIndex(); #endif if ( pNextLine && ! bFirstOfDouble ) aLine.NextLine(); diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index d62fc192ebf2..5434e0038ac0 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -869,7 +869,7 @@ public: tools::Long m_nRightRest; // space not already covered by frames in the right margin tools::Long m_nLeftDiff; // Min/Max-difference of the frame in the left margin tools::Long m_nRightDiff; // Min/Max-difference of the frame in the right margin - sal_uLong m_nIndex; // index of the node + SwNodeOffset m_nIndex; // index of the node void Minimum( tools::Long nNew ) { if (nNew > m_nMinWidth) m_nMinWidth = nNew; @@ -901,7 +901,7 @@ static void lcl_MinMaxNode(SwFrameFormat* pNd, SwMinMaxNodeArgs& rIn) // Does the frame contain a table at the start or the end? const SwNodes& rNodes = pNd->GetDoc()->GetNodes(); const SwFormatContent& rFlyContent = pNd->GetContent(); - sal_uLong nStt = rFlyContent.GetContentIdx()->GetIndex(); + SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex(); SwTableNode* pTableNd = rNodes[nStt+1]->GetTableNode(); if( !pTableNd ) { @@ -1003,7 +1003,7 @@ static void lcl_MinMaxNode(SwFrameFormat* pNd, SwMinMaxNodeArgs& rIn) * Changing this method very likely requires changing of GetScalingOfSelectedText * This one is called exclusively from import filters, so there is no layout. */ -void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax, +void SwTextNode::GetMinMaxSize( SwNodeOffset nIndex, sal_uLong& rMin, sal_uLong &rMax, sal_uLong& rAbsMin ) const { SwViewShell const * pSh = GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell(); diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 556bae8ebd67..f843ef4da6b7 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -241,7 +241,7 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, pNode->SetRedlineMergeFlag(SwNode::Merge::First); } // else: was already set before int nLevel(0); - for (sal_uLong j = pNode->GetIndex() + 1; j < pEnd->nNode.GetIndex(); ++j) + for (SwNodeOffset j = pNode->GetIndex() + 1; j < pEnd->nNode.GetIndex(); ++j) { SwNode *const pTmp(pNode->GetNodes()[j]); if (nLevel == 0) @@ -311,7 +311,7 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, // * the first SwTextNode inside each start node of the previous point // Other (non-first) SwTextNodes in nested sections shouldn't be reset! int nLevel(0); - for (sal_uLong j = pNode->GetIndex() + 1; j < pNode->GetNodes().Count(); ++j) + for (SwNodeOffset j = pNode->GetIndex() + 1; j < pNode->GetNodes().Count(); ++j) { SwNode *const pTmp(pNode->GetNodes()[j]); if (!pTmp->IsCreateFrameWhenHidingRedlines()) @@ -673,7 +673,7 @@ SwRedlineItr::~SwRedlineItr() COVERITY_NOEXCEPT_FALSE // The return value of SwRedlineItr::Seek tells you if the current font // has been manipulated by leaving (-1) or accessing (+1) of a section short SwRedlineItr::Seek(SwFont& rFnt, - sal_uLong const nNode, sal_Int32 const nNew, sal_Int32 const nOld) + SwNodeOffset const nNode, sal_Int32 const nNew, sal_Int32 const nOld) { short nRet = 0; if( ExtOn() ) @@ -954,8 +954,8 @@ bool SwRedlineItr::ChkSpecialUnderline_() const } bool SwRedlineItr::CheckLine( - sal_uLong const nStartNode, sal_Int32 const nChkStart, - sal_uLong const nEndNode, sal_Int32 nChkEnd, OUString& rRedlineText, + SwNodeOffset const nStartNode, sal_Int32 const nChkStart, + SwNodeOffset const nEndNode, sal_Int32 nChkEnd, OUString& rRedlineText, bool& bRedlineEnd, RedlineType& eRedlineEnd, size_t* pAuthorAtPos) { // note: previously this would return true in the (!m_bShow && m_pExt) @@ -1069,7 +1069,7 @@ void SwExtend::ActualizeFont( SwFont &rFnt, ExtTextInputAttr nAttr ) rFnt.SetGreyWave( true ); } -short SwExtend::Enter(SwFont& rFnt, sal_uLong const nNode, sal_Int32 const nNew) +short SwExtend::Enter(SwFont& rFnt, SwNodeOffset const nNode, sal_Int32 const nNew) { OSL_ENSURE( !m_pFont, "SwExtend: Enter with Font" ); if (nNode != m_nNode) @@ -1085,7 +1085,7 @@ short SwExtend::Enter(SwFont& rFnt, sal_uLong const nNode, sal_Int32 const nNew) return 0; } -bool SwExtend::Leave_(SwFont& rFnt, sal_uLong const nNode, sal_Int32 const nNew) +bool SwExtend::Leave_(SwFont& rFnt, SwNodeOffset const nNode, sal_Int32 const nNew) { OSL_ENSURE(nNode == m_nNode && Inside(), "SwExtend: Leave without Enter"); if (nNode != m_nNode) @@ -1110,7 +1110,7 @@ bool SwExtend::Leave_(SwFont& rFnt, sal_uLong const nNode, sal_Int32 const nNew) return false; } -sal_Int32 SwExtend::Next(sal_uLong const nNode, sal_Int32 nNext) +sal_Int32 SwExtend::Next(SwNodeOffset const nNode, sal_Int32 nNext) { if (nNode != m_nNode) return nNext; diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx index 087df8bbbba8..5c301312640e 100644 --- a/sw/source/core/text/redlnitr.hxx +++ b/sw/source/core/text/redlnitr.hxx @@ -39,18 +39,18 @@ class SwExtend std::unique_ptr<SwFont> m_pFont; const std::vector<ExtTextInputAttr> &m_rArr; /// position of start of SwExtTextInput - sal_uLong const m_nNode; + SwNodeOffset const m_nNode; sal_Int32 const m_nStart; /// current position (inside) sal_Int32 m_nPos; /// position of end of SwExtTextInput (in same node as start) sal_Int32 const m_nEnd; - bool Leave_(SwFont& rFnt, sal_uLong nNode, sal_Int32 nNew); + bool Leave_(SwFont& rFnt, SwNodeOffset nNode, sal_Int32 nNew); bool Inside() const { return (m_nPos >= m_nStart && m_nPos < m_nEnd); } static void ActualizeFont( SwFont &rFnt, ExtTextInputAttr nAttr ); public: SwExtend(const std::vector<ExtTextInputAttr> &rArr, - sal_uLong const nNode, sal_Int32 const nStart) + SwNodeOffset const nNode, sal_Int32 const nStart) : m_rArr(rArr) , m_nNode(nNode) , m_nStart(nStart) @@ -59,10 +59,10 @@ public: {} bool IsOn() const { return m_pFont != nullptr; } void Reset() { m_pFont.reset(); m_nPos = COMPLETE_STRING; } - bool Leave(SwFont& rFnt, sal_uLong const nNode, sal_Int32 const nNew) + bool Leave(SwFont& rFnt, SwNodeOffset const nNode, sal_Int32 const nNew) { return m_pFont && Leave_(rFnt, nNode, nNew); } - short Enter(SwFont& rFnt, sal_uLong nNode, sal_Int32 nNew); - sal_Int32 Next(sal_uLong nNode, sal_Int32 nNext); + short Enter(SwFont& rFnt, SwNodeOffset nNode, sal_Int32 nNew); + sal_Int32 Next(SwNodeOffset nNode, sal_Int32 nNext); SwFont* GetFont() { return m_pFont.get(); } void UpdateFont(SwFont &rFont) { ActualizeFont(rFont, m_rArr[m_nPos - m_nStart]); } }; @@ -75,7 +75,7 @@ class SwRedlineItr std::unique_ptr<SfxItemSet> m_pSet; std::unique_ptr<SwExtend> m_pExt; // note: this isn't actually used in the merged-para (Hide) case - sal_uLong const m_nNdIdx; + SwNodeOffset const m_nNdIdx; SwRedlineTable::size_type const m_nFirst; SwRedlineTable::size_type m_nAct; sal_Int32 m_nStart; @@ -89,12 +89,12 @@ private: void Clear_( SwFont* pFnt ); bool ChkSpecialUnderline_() const; void FillHints( std::size_t nAuthor, RedlineType eType ); - short EnterExtend(SwFont& rFnt, sal_uLong const nNode, sal_Int32 const nNew) + short EnterExtend(SwFont& rFnt, SwNodeOffset const nNode, sal_Int32 const nNew) { if (m_pExt) return m_pExt->Enter(rFnt, nNode, nNew); return 0; } - sal_Int32 NextExtend(sal_uLong const nNode, sal_Int32 const nNext) { + sal_Int32 NextExtend(SwNodeOffset const nNode, sal_Int32 const nNext) { if (m_pExt) return m_pExt->Next(nNode, nNext); return nNext; } @@ -108,7 +108,7 @@ public: bool IsOn() const { return m_bOn || (m_pExt && m_pExt->IsOn()); } void Clear( SwFont* pFnt ) { if (m_bOn) Clear_( pFnt ); } void ChangeTextAttr( SwFont* pFnt, SwTextAttr const &rHt, bool bChg ); - short Seek(SwFont& rFnt, sal_uLong nNode, sal_Int32 nNew, sal_Int32 nOld); + short Seek(SwFont& rFnt, SwNodeOffset nNode, sal_Int32 nNew, sal_Int32 nOld); void Reset() { if (m_nAct != m_nFirst) m_nAct = SwRedlineTable::npos; if (m_pExt) m_pExt->Reset(); @@ -117,10 +117,10 @@ public: sal_Int32 nNext, SwTextNode const* pNode, SwRedlineTable::size_type & rAct); bool ChkSpecialUnderline() const { return IsOn() && ChkSpecialUnderline_(); } - bool CheckLine(sal_uLong nStartNode, sal_Int32 nChkStart, sal_uLong nEndNode, + bool CheckLine(SwNodeOffset nStartNode, sal_Int32 nChkStart, SwNodeOffset nEndNode, sal_Int32 nChkEnd, OUString& rRedlineText, bool& bRedlineEnd, RedlineType& eRedlineEnd, size_t* pAuthorAtPos = nullptr); - bool LeaveExtend(SwFont& rFnt, sal_uLong const nNode, sal_Int32 const nNew) + bool LeaveExtend(SwFont& rFnt, SwNodeOffset const nNode, sal_Int32 const nNew) { return m_pExt->Leave(rFnt, nNode, nNew); } bool ExtOn() { if (m_pExt) return m_pExt->IsOn(); diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index a73b756de73b..a34ccf863600 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -543,7 +543,7 @@ static const SwRangeRedline* lcl_GetRedlineAtNodeInsertionOrDeletion( const SwTe if( SwRedlineTable::npos != nRedlPos ) { - const sal_uLong nNdIdx = rTextNode.GetIndex(); + const SwNodeOffset nNdIdx = rTextNode.GetIndex(); const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); for( ; nRedlPos < rTable.size() ; ++nRedlPos ) { diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index f1b9886906e0..db792e4a1ebf 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -370,7 +370,7 @@ void SwTextFly::CtorInitTextFly( const SwTextFrame *pFrame ) m_bTopRule = true; m_nMinBottom = 0; m_nNextTop = 0; - m_nCurrFrameNodeIndex = ULONG_MAX; + m_nCurrFrameNodeIndex = NODE_OFFSET_MAX; } SwRect SwTextFly::GetFrame_( const SwRect &rRect ) const @@ -803,13 +803,13 @@ bool SwTextFly::GetTop( const SwAnchoredObject* _pAnchoredObj, // Compare indices: // The Index of the other is retrieved from the anchor attr. - sal_uLong nTmpIndex = rNewA.GetContentAnchor()->nNode.GetIndex(); + SwNodeOffset nTmpIndex = rNewA.GetContentAnchor()->nNode.GetIndex(); // Now check whether the current paragraph is before the anchor // of the displaced object in the text, then we don't have to // get out of its way. // If possible determine Index via SwFormatAnchor because // otherwise it's quite expensive. - if (ULONG_MAX == m_nCurrFrameNodeIndex) + if (NODE_OFFSET_MAX == m_nCurrFrameNodeIndex) m_nCurrFrameNodeIndex = m_pCurrFrame->GetTextNodeFirst()->GetIndex(); if (FrameContainsNode(*m_pCurrFrame, nTmpIndex) || nTmpIndex < m_nCurrFrameNodeIndex) diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index ebc777ee5219..eda5507c1ef7 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -285,15 +285,15 @@ namespace sw { } } - bool FrameContainsNode(SwContentFrame const& rFrame, sal_uLong const nNodeIndex) + bool FrameContainsNode(SwContentFrame const& rFrame, SwNodeOffset const nNodeIndex) { if (rFrame.IsTextFrame()) { SwTextFrame const& rTextFrame(static_cast<SwTextFrame const&>(rFrame)); if (sw::MergedPara const*const pMerged = rTextFrame.GetMergedPara()) { - sal_uLong const nFirst(pMerged->pFirstNode->GetIndex()); - sal_uLong const nLast(pMerged->pLastNode->GetIndex()); + SwNodeOffset const nFirst(pMerged->pFirstNode->GetIndex()); + SwNodeOffset const nLast(pMerged->pLastNode->GetIndex()); return (nFirst <= nNodeIndex && nNodeIndex <= nLast); } else @@ -812,7 +812,7 @@ void RemoveFootnotesForNode( } const SwFootnoteIdxs &rFootnoteIdxs = rTextNode.GetDoc().GetFootnoteIdxs(); size_t nPos = 0; - sal_uLong const nIndex = rTextNode.GetIndex(); + SwNodeOffset const nIndex = rTextNode.GetIndex(); rFootnoteIdxs.SeekEntry( rTextNode, &nPos ); if (nPos < rFootnoteIdxs.size()) { @@ -2116,7 +2116,7 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint) && m_pMergedPara->pFirstNode->GetIndex() <= pMoveText->pDestNode->GetIndex() && pMoveText->pDestNode->GetIndex() <= m_pMergedPara->pLastNode->GetIndex()) { // if it's not 2 nodes in merged frame, assume the target node doesn't have frames at all - assert(std::abs(static_cast<tools::Long>(rNode.GetIndex()) - static_cast<tools::Long>(pMoveText->pDestNode->GetIndex())) == 1); + assert(abs(rNode.GetIndex() - pMoveText->pDestNode->GetIndex()) == SwNodeOffset(1)); UpdateMergedParaForMove(*m_pMergedPara, *this, bRecalcFootnoteFlag, @@ -2608,7 +2608,7 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint) } // switch if( bSetFieldsDirty ) - GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, &rNode, 1 ); + GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, &rNode, SwNodeOffset(1) ); if ( bRecalcFootnoteFlag ) CalcFootnoteFlag(); diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index 621a1093107a..1e52e8fdbb68 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -431,11 +431,11 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const if (pMerged) { (void)xmlTextWriterStartElement( writer, BAD_CAST( "merged" ) ); - (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "paraPropsNodeIndex" ), "%" SAL_PRIuUINTPTR, pMerged->pParaPropsNode->GetIndex() ); + (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "paraPropsNodeIndex" ), "%" SAL_PRIdINT32, sal_Int32(pMerged->pParaPropsNode->GetIndex()) ); for (auto const& e : pMerged->extents) { (void)xmlTextWriterStartElement( writer, BAD_CAST( "extent" ) ); - (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), "%" SAL_PRIuUINTPTR, e.pNode->GetIndex() ); + (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), "%" SAL_PRIdINT32, sal_Int32(e.pNode->GetIndex()) ); (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "start" ), "%" SAL_PRIdINT32, e.nStart ); (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "end" ), "%" SAL_PRIdINT32, e.nEnd ); (void)xmlTextWriterEndElement( writer ); @@ -517,10 +517,6 @@ void SwFrame::dumpInfosAsXml( xmlTextWriterPtr writer ) const (void)xmlTextWriterEndElement( writer ); } -// Hack: somehow conversion from "..." to va_list does -// bomb on two string literals in the format. -const char* const TMP_FORMAT = "%" SAL_PRIuUINTPTR; - void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer ) const { (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ptr" ), "%p", this ); @@ -547,13 +543,13 @@ void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer ) const { SwSectionFrame const*const pFrame(static_cast<SwSectionFrame const*>(this)); SwSectionNode const*const pNode(pFrame->GetSection() ? pFrame->GetSection()->GetFormat()->GetSectionNode() : nullptr); - (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("sectionNodeIndex"), TMP_FORMAT, pNode ? pNode->GetIndex() : -1); + (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("sectionNodeIndex"), "%" SAL_PRIdINT32, pNode ? sal_Int32(pNode->GetIndex()) : -1); } if ( IsTextFrame( ) ) { const SwTextFrame *pTextFrame = static_cast<const SwTextFrame *>(this); const SwTextNode *pTextNode = pTextFrame->GetTextNodeFirst(); - (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), TMP_FORMAT, pTextNode->GetIndex() ); + (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), "%" SAL_PRIdINT32, sal_Int32(pTextNode->GetIndex()) ); OString aMode = "Horizontal"; if (IsVertLRBT()) diff --git a/sw/source/core/tox/ToxTabStopTokenHandler.cxx b/sw/source/core/tox/ToxTabStopTokenHandler.cxx index 06e351c5b48e..7c5bc84f3510 100644 --- a/sw/source/core/tox/ToxTabStopTokenHandler.cxx +++ b/sw/source/core/tox/ToxTabStopTokenHandler.cxx @@ -26,7 +26,7 @@ namespace sw { -DefaultToxTabStopTokenHandler::DefaultToxTabStopTokenHandler(sal_uInt32 indexOfSectionNode, +DefaultToxTabStopTokenHandler::DefaultToxTabStopTokenHandler(SwNodeOffset indexOfSectionNode, const SwPageDesc& defaultPageDescription, bool tabPositionIsRelativeToParagraphIndent, TabStopReferencePolicy referencePolicy) @@ -85,7 +85,7 @@ DefaultToxTabStopTokenHandler::HandleTabStopToken( tools::Long DefaultToxTabStopTokenHandler::CalculatePageMarginFromPageDescription(const SwTextNode& targetNode) const { - size_t nPgDescNdIdx = targetNode.GetIndex() + 1; + SwNodeOffset nPgDescNdIdx = targetNode.GetIndex() + 1; const SwPageDesc *pPageDesc = targetNode.FindPageDesc(&nPgDescNdIdx); if (!pPageDesc || nPgDescNdIdx < mIndexOfSectionNode) { // Use default page description, if none is found or the found one is given by a Node before the diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx index b1c3cd013d8a..ddf378e40ab5 100644 --- a/sw/source/core/tox/ToxTextGenerator.cxx +++ b/sw/source/core/tox/ToxTextGenerator.cxx @@ -402,7 +402,7 @@ ToxTextGenerator::HandleTextToken(const SwTOXSortTabBase& source, { // pSrc already copied above assert(pSrc == pMerged->pParaPropsNode); - for (sal_uLong i = pSrc->GetIndex() + 1; + for (SwNodeOffset i = pSrc->GetIndex() + 1; i <= pMerged->pLastNode->GetIndex(); ++i) { SwNode *const pTmp(pSrc->GetNodes()[i]); diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 6819aeb8b197..cabbad160e9d 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -636,7 +636,7 @@ void SwTOXPara::FillText( SwTextNode& rNd, const SwIndex& rInsPos, sal_uInt16, { // pSrc already copied above assert(pSrc == pMerged->pParaPropsNode); - for (sal_uLong i = pSrc->GetIndex() + 1; + for (SwNodeOffset i = pSrc->GetIndex() + 1; i <= pMerged->pLastNode->GetIndex(); ++i) { SwNode *const pTmp(pSrc->GetNodes()[i]); diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 4a2f455d9b91..82485f4c5d22 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -381,8 +381,8 @@ void SwTextFootnote::InvalidateNumberInLayout() if ( m_pStartNode ) { // must iterate over all TextNodes because of footnotes on other pages - sal_uLong nSttIdx = m_pStartNode->GetIndex() + 1; - sal_uLong nEndIdx = m_pStartNode->GetNode().EndOfSectionIndex(); + SwNodeOffset nSttIdx = m_pStartNode->GetIndex() + 1; + SwNodeOffset nEndIdx = m_pStartNode->GetNode().EndOfSectionIndex(); for( ; nSttIdx < nEndIdx; ++nSttIdx ) { SwNode* pNd; @@ -409,14 +409,14 @@ void SwTextFootnote::CopyFootnote( SwNodes &rDstNodes = rDstDoc.GetNodes(); // copy only the content of the section - SwNodeRange aRg( *m_pStartNode, 1, + SwNodeRange aRg( *m_pStartNode, SwNodeOffset(1), *m_pStartNode->GetNode().EndOfSectionNode() ); // insert at the end of rDest, i.e., the nodes are appended. // nDestLen contains number of ContentNodes in rDest _before_ copy. SwNodeIndex aStart( *(rDest.GetStartNode()) ); SwNodeIndex aEnd( *aStart.GetNode().EndOfSectionNode() ); - sal_uLong nDestLen = aEnd.GetIndex() - aStart.GetIndex() - 1; + SwNodeOffset nDestLen = aEnd.GetIndex() - aStart.GetIndex() - 1; m_pTextNode->GetDoc().GetDocumentContentOperationsManager().CopyWithFlyInFly(aRg, aEnd); @@ -587,14 +587,14 @@ void SwTextFootnote::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_pStartNode")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), - BAD_CAST(OString::number(m_pStartNode->GetIndex()).getStr())); + BAD_CAST(OString::number(sal_Int32(m_pStartNode->GetIndex())).getStr())); (void)xmlTextWriterEndElement(pWriter); } if (m_pTextNode) { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_pTextNode")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), - BAD_CAST(OString::number(m_pTextNode->GetIndex()).getStr())); + BAD_CAST(OString::number(sal_Int32(m_pTextNode->GetIndex())).getStr())); (void)xmlTextWriterEndElement(pWriter); } (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_nSeqNo")); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 8179e4139f46..33509d405aad 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -177,7 +177,7 @@ SwTextNode *SwNodes::MakeTextNode( const SwNodeIndex & rWhere, [[fallthrough]]; default: if( rWhere == aTmp ) - aTmp -= 2; + aTmp -= SwNodeOffset(2); else return pNode; break; @@ -367,7 +367,7 @@ void MoveMergedFlysAndFootnotes(std::vector<SwTextFrame*> const& rFrames, { lcl_ChangeFootnoteRef(rSecondNode); } - for (sal_uLong nIndex = rSecondNode.GetIndex() + 1; ; ++nIndex) + for (SwNodeOffset nIndex = rSecondNode.GetIndex() + 1; ; ++nIndex) { SwNode *const pTmp(rSecondNode.GetNodes()[nIndex]); if (pTmp->IsCreateFrameWhenHidingRedlines() || pTmp->IsEndNode()) @@ -843,9 +843,9 @@ void CheckResetRedlineMergeFlag(SwTextNode & rNode, Recreate const eRecreateMerg if (eRecreateMerged == sw::Recreate::Predecessor // tdf#135018 check that there is a predecessor node, i.e. rNode // isn't the first node after the body start node - && rNode.GetNodes()[rNode.GetIndex() - 1]->StartOfSectionIndex() != 0) + && rNode.GetNodes()[rNode.GetIndex() - 1]->StartOfSectionIndex() != SwNodeOffset(0)) { - for (sal_uLong i = rNode.GetIndex() - 1; ; --i) + for (SwNodeOffset i = rNode.GetIndex() - 1; ; --i) { SwNode *const pNode(rNode.GetNodes()[i]); assert(!pNode->IsStartNode()); @@ -3571,7 +3571,7 @@ OUString SwTextNode::GetRedlineText() const if( SwRedlineTable::npos != nRedlPos ) { // some redline-delete object exists for the node - const sal_uLong nNdIdx = GetIndex(); + const SwNodeOffset nNdIdx = GetIndex(); for( ; nRedlPos < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size() ; ++nRedlPos ) { const SwRangeRedline* pTmp = rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nRedlPos ]; @@ -5113,7 +5113,7 @@ void SwTextNode::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTextNode")); (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr())); OUString sText = GetText(); for (int i = 0; i < 32; ++i) diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 577e1726d1e0..88be32686deb 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -448,7 +448,7 @@ SwpHints::TryInsertNesting( SwTextNode & rNode, SwTextAttrNesting & rNewHint ) for (auto iter = SplitNew.begin(); iter != SplitNew.end(); ++iter) { SwPaM const temp(rNode, (*iter)->GetStart(), rNode, *(*iter)->GetEnd()); - std::vector<std::pair<sal_uLong, sal_Int32>> Breaks; + std::vector<std::pair<SwNodeOffset, sal_Int32>> Breaks; sw::CalcBreaks(Breaks, temp, true); if (!Breaks.empty()) { @@ -1441,9 +1441,9 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, const SetAttrMode nMode ) { // existing footnote: delete all layout frames of its // footnote section - sal_uLong nSttIdx = + SwNodeOffset nSttIdx = static_cast<SwTextFootnote*>(pAttr)->GetStartNode()->GetIndex(); - sal_uLong nEndIdx = rNodes[ nSttIdx++ ]->EndOfSectionIndex(); + SwNodeOffset nEndIdx = rNodes[ nSttIdx++ ]->EndOfSectionIndex(); for( ; nSttIdx < nEndIdx; ++nSttIdx ) { SwContentNode* pCNd = rNodes[ nSttIdx ]->GetContentNode(); diff --git a/sw/source/core/undo/SwUndoTOXChange.cxx b/sw/source/core/undo/SwUndoTOXChange.cxx index a2112f5b372b..5223e9993eca 100644 --- a/sw/source/core/undo/SwUndoTOXChange.cxx +++ b/sw/source/core/undo/SwUndoTOXChange.cxx @@ -26,7 +26,7 @@ namespace { - sal_uLong GetSectionNodeIndex(SwTOXBaseSection const& rTOX) + SwNodeOffset GetSectionNodeIndex(SwTOXBaseSection const& rTOX) { const SwSectionNode* pSectNd = rTOX.GetFormat()->GetSectionNode(); assert(pSectNd); @@ -48,7 +48,7 @@ SwUndoTOXChange::~SwUndoTOXChange() } // get the current ToXBase, which is not necessarily the same instance that existed there before -static SwTOXBase & GetTOX(SwDoc & rDoc, sal_uLong const nNodeIndex) +static SwTOXBase & GetTOX(SwDoc & rDoc, SwNodeOffset const nNodeIndex) { SwSectionNode *const pNode(rDoc.GetNodes()[nNodeIndex]->GetSectionNode()); assert(pNode); diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 990bebad2d58..3a5b459df880 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -538,7 +538,7 @@ void UndoManager::AddUndoAction(std::unique_ptr<SfxUndoAction> pAction, bool bTr } // if the undo nodes array is too large, delete some actions - while (UNDO_ACTION_LIMIT < GetUndoNodes().Count()) + while (UNDO_ACTION_LIMIT < sal_Int32(GetUndoNodes().Count())) { RemoveOldestUndoAction(); } diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 4b304c1ff845..85f92be47670 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -74,7 +74,7 @@ void SwHistoryHint::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterEndElement(pWriter); } -SwHistorySetFormat::SwHistorySetFormat( const SfxPoolItem* pFormatHt, sal_uLong nNd ) +SwHistorySetFormat::SwHistorySetFormat( const SfxPoolItem* pFormatHt, SwNodeOffset nNd ) : SwHistoryHint( HSTRY_SETFMTHNT ) , m_pAttr( pFormatHt->Clone() ) , m_nNodeIndex( nNd ) @@ -150,7 +150,7 @@ void SwHistorySetFormat::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwHistorySetFormat")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nNodeIndex"), - BAD_CAST(OString::number(m_nNodeIndex).getStr())); + BAD_CAST(OString::number(sal_Int32(m_nNodeIndex)).getStr())); SwHistoryHint::dumpAsXml(pWriter); if (m_pAttr) @@ -197,7 +197,7 @@ SwHistorySetFormat::~SwHistorySetFormat() { } -SwHistoryResetFormat::SwHistoryResetFormat(const SfxPoolItem* pFormatHt, sal_uLong nNodeIdx) +SwHistoryResetFormat::SwHistoryResetFormat(const SfxPoolItem* pFormatHt, SwNodeOffset nNodeIdx) : SwHistoryHint( HSTRY_RESETFMTHNT ) , m_nNodeIndex( nNodeIdx ) , m_nWhich( pFormatHt->Which() ) @@ -218,7 +218,7 @@ void SwHistoryResetFormat::SetInDoc( SwDoc* pDoc, bool ) } } -SwHistorySetText::SwHistorySetText( SwTextAttr* pTextHt, sal_uLong nNodePos ) +SwHistorySetText::SwHistorySetText( SwTextAttr* pTextHt, SwNodeOffset nNodePos ) : SwHistoryHint( HSTRY_SETTXTHNT ) , m_nNodeIndex( nNodePos ) , m_nStart( pTextHt->GetStart() ) @@ -279,7 +279,7 @@ void SwHistorySetText::SetInDoc( SwDoc* pDoc, bool ) } } -SwHistorySetTextField::SwHistorySetTextField( const SwTextField* pTextField, sal_uLong nNodePos ) +SwHistorySetTextField::SwHistorySetTextField( const SwTextField* pTextField, SwNodeOffset nNodePos ) : SwHistoryHint( HSTRY_SETTXTFLDHNT ) , m_pField( new SwFormatField( *pTextField->GetFormatField().GetField() ) ) { @@ -337,7 +337,7 @@ void SwHistorySetTextField::SetInDoc( SwDoc* pDoc, bool ) } } -SwHistorySetRefMark::SwHistorySetRefMark( const SwTextRefMark* pTextHt, sal_uLong nNodePos ) +SwHistorySetRefMark::SwHistorySetRefMark( const SwTextRefMark* pTextHt, SwNodeOffset nNodePos ) : SwHistoryHint( HSTRY_SETREFMARKHNT ) , m_RefName( pTextHt->GetRefMark().GetRefName() ) , m_nNodeIndex( nNodePos ) @@ -364,7 +364,7 @@ void SwHistorySetRefMark::SetInDoc( SwDoc* pDoc, bool ) } } -SwHistorySetTOXMark::SwHistorySetTOXMark( const SwTextTOXMark* pTextHt, sal_uLong nNodePos ) +SwHistorySetTOXMark::SwHistorySetTOXMark( const SwTextTOXMark* pTextHt, SwNodeOffset nNodePos ) : SwHistoryHint( HSTRY_SETTOXMARKHNT ) , m_TOXMark( pTextHt->GetTOXMark() ) , m_TOXName( m_TOXMark.GetTOXType()->GetTypeName() ) @@ -427,7 +427,7 @@ bool SwHistorySetTOXMark::IsEqual( const SwTOXMark& rCmp ) const } SwHistoryResetText::SwHistoryResetText( sal_uInt16 nWhich, - sal_Int32 nAttrStart, sal_Int32 nAttrEnd, sal_uLong nNodePos ) + sal_Int32 nAttrStart, sal_Int32 nAttrEnd, SwNodeOffset nNodePos ) : SwHistoryHint( HSTRY_RESETTXTHNT ) , m_nNodeIndex( nNodePos ), m_nStart( nAttrStart ), m_nEnd( nAttrEnd ) , m_nAttr( nWhich ) @@ -444,7 +444,7 @@ void SwHistoryResetText::SetInDoc( SwDoc* pDoc, bool ) } } -SwHistorySetFootnote::SwHistorySetFootnote( SwTextFootnote* pTextFootnote, sal_uLong nNodePos ) +SwHistorySetFootnote::SwHistorySetFootnote( SwTextFootnote* pTextFootnote, SwNodeOffset nNodePos ) : SwHistoryHint( HSTRY_SETFTNHNT ) , m_pUndo( new SwUndoSaveSection ) , m_FootnoteNumber( pTextFootnote->GetFootnote().GetNumStr() ) @@ -536,7 +536,7 @@ void SwHistorySetFootnote::SetInDoc( SwDoc* pDoc, bool ) } } -SwHistoryChangeFormatColl::SwHistoryChangeFormatColl( SwFormatColl* pFormatColl, sal_uLong nNd, +SwHistoryChangeFormatColl::SwHistoryChangeFormatColl( SwFormatColl* pFormatColl, SwNodeOffset nNd, SwNodeType nNodeWhich ) : SwHistoryHint( HSTRY_CHGFMTCOLL ) , m_pColl( pFormatColl ) @@ -609,9 +609,9 @@ SwHistoryBookmark::SwHistoryBookmark( , m_aName(rBkmk.GetName()) , m_bHidden(false) , m_nNode(bSavePos ? - rBkmk.GetMarkPos().nNode.GetIndex() : 0) + rBkmk.GetMarkPos().nNode.GetIndex() : SwNodeOffset(0)) , m_nOtherNode(bSaveOtherPos ? - rBkmk.GetOtherMarkPos().nNode.GetIndex() : 0) + rBkmk.GetOtherMarkPos().nNode.GetIndex() : SwNodeOffset(0)) , m_nContent(bSavePos ? rBkmk.GetMarkPos().nContent.GetIndex() : 0) , m_nOtherContent(bSaveOtherPos ? @@ -827,7 +827,7 @@ void SwHistoryTextFieldmark::ResetInDoc(SwDoc& rDoc) } SwHistorySetAttrSet::SwHistorySetAttrSet( const SfxItemSet& rSet, - sal_uLong nNodePos, const o3tl::sorted_vector<sal_uInt16> &rSetArr ) + SwNodeOffset nNodePos, const o3tl::sorted_vector<sal_uInt16> &rSetArr ) : SwHistoryHint( HSTRY_SETATTRSET ) , m_OldSet( rSet ) , m_ResetArray( 0, 4 ) @@ -1034,7 +1034,7 @@ SwHistory::~SwHistory() void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, - sal_uLong nNodeIdx) + SwNodeOffset nNodeIdx) { OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" ); const sal_uInt16 nWhich(pNewValue->Which()); @@ -1068,7 +1068,7 @@ void SwHistory::Add( } // FIXME: refactor the following "Add" methods (DRY)? -void SwHistory::Add( SwTextAttr* pHint, sal_uLong nNodeIdx, bool bNewAttr ) +void SwHistory::Add( SwTextAttr* pHint, SwNodeOffset nNodeIdx, bool bNewAttr ) { OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" ); @@ -1110,7 +1110,7 @@ void SwHistory::Add( SwTextAttr* pHint, sal_uLong nNodeIdx, bool bNewAttr ) m_SwpHstry.push_back( std::move(pHt) ); } -void SwHistory::Add( SwFormatColl* pColl, sal_uLong nNodeIdx, SwNodeType nWhichNd ) +void SwHistory::Add( SwFormatColl* pColl, SwNodeOffset nNodeIdx, SwNodeType nWhichNd ) { OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" ); @@ -1269,7 +1269,7 @@ sal_uInt16 SwHistory::SetTmpEnd( sal_uInt16 nNewTmpEnd ) void SwHistory::CopyFormatAttr( const SfxItemSet& rSet, - sal_uLong nNodeIdx) + SwNodeOffset nNodeIdx) { if(!rSet.Count()) return; @@ -1305,7 +1305,7 @@ void SwHistory::dumpAsXml(xmlTextWriterPtr pWriter) const void SwHistory::CopyAttr( SwpHints const * pHts, - const sal_uLong nNodeIdx, + const SwNodeOffset nNodeIdx, const sal_Int32 nStart, const sal_Int32 nEnd, const bool bCopyFields ) @@ -1362,7 +1362,7 @@ void SwHistory::CopyAttr( SwRegHistory::SwRegHistory( SwHistory* pHst ) : SwClient( nullptr ) , m_pHistory( pHst ) - , m_nNodeIndex( ULONG_MAX ) + , m_nNodeIndex( NODE_OFFSET_MAX ) { MakeSetWhichIds(); } diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index f49987130380..9d279860c086 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -658,7 +658,7 @@ SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxPoolItem& rAttr, : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange ) , m_AttrSet( rRange.GetDoc().GetAttrPool(), rAttr.Which(), rAttr.Which() ) , m_pHistory( new SwHistory ) - , m_nNodeIndex( ULONG_MAX ) + , m_nNodeIndex( NODE_OFFSET_MAX ) , m_nInsertFlags( nFlags ) { m_AttrSet.Put( rAttr ); @@ -678,7 +678,7 @@ SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxItemSet& rSet, : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange ) , m_AttrSet( rSet ) , m_pHistory( new SwHistory ) - , m_nNodeIndex( ULONG_MAX ) + , m_nNodeIndex( NODE_OFFSET_MAX ) , m_nInsertFlags( nFlags ) { // Save character style as a style name, not as a reference @@ -723,7 +723,7 @@ void SwUndoAttr::UndoImpl(::sw::UndoRedoContext & rContext) if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ) ) { SwPaM aPam(pDoc->GetNodes().GetEndOfContent()); - if ( ULONG_MAX != m_nNodeIndex ) { + if ( NODE_OFFSET_MAX != m_nNodeIndex ) { aPam.DeleteMark(); aPam.GetPoint()->nNode = m_nNodeIndex; aPam.GetPoint()->nContent.Assign( aPam.GetContentNode(), m_nSttContent ); @@ -789,7 +789,7 @@ void SwUndoAttr::RedoImpl(::sw::UndoRedoContext & rContext) rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld & ~RedlineFlags::Ignore ); rDoc.getIDocumentContentOperations().InsertItemSet( rPam, m_AttrSet, m_nInsertFlags ); - if ( ULONG_MAX != m_nNodeIndex ) { + if ( NODE_OFFSET_MAX != m_nNodeIndex ) { rPam.SetMark(); if ( rPam.Move( fnMoveBackward ) ) { rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlineData, rPam ), @@ -814,7 +814,7 @@ void SwUndoAttr::RemoveIdx( SwDoc& rDoc ) SwNodes& rNds = rDoc.GetNodes(); for ( sal_uInt16 n = 0; n < m_pHistory->Count(); ++n ) { sal_Int32 nContent = 0; - sal_uLong nNode = 0; + SwNodeOffset nNode(0); SwHistoryHint* pHstHint = (*m_pHistory)[ n ]; switch ( pHstHint->Which() ) { case HSTRY_RESETTXTHNT: { diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 953048f9edad..c698ca189634 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -52,7 +52,7 @@ ( == AUTO ), if the anchor frame has be moved via MoveNodes(..) and DelFrames(..) */ -static void lcl_MakeAutoFrames( const SwFrameFormats& rSpzArr, sal_uLong nMovedIndex ) +static void lcl_MakeAutoFrames( const SwFrameFormats& rSpzArr, SwNodeOffset nMovedIndex ) { for( size_t n = 0; n < rSpzArr.size(); ++n ) { @@ -73,7 +73,7 @@ static SwTextNode * FindFirstAndNextNode(SwDoc & rDoc, SwUndRng const& rRange, { // redlines are corrected now to exclude the deleted node assert(rRange.m_nEndContent == 0); - sal_uLong nEndOfRedline = 0; + SwNodeOffset nEndOfRedline(0); for (size_t i = 0; i < rRedlineSaveData.size(); ++i) { auto const& rRedline(rRedlineSaveData[i]); @@ -92,7 +92,7 @@ static SwTextNode * FindFirstAndNextNode(SwDoc & rDoc, SwUndRng const& rRange, { assert(o_rpFirstMergedDeletedTextNode); SwTextNode * pNextNode(nullptr); - for (sal_uLong i = rRange.m_nEndNode; /* i <= nEndOfRedline */; ++i) + for (SwNodeOffset i = rRange.m_nEndNode; /* i <= nEndOfRedline */; ++i) { SwNode *const pNode(rDoc.GetNodes()[i]); assert(!pNode->IsEndNode()); // cannot be both leaving section here *and* overlapping redline @@ -226,7 +226,7 @@ SwUndoDelete::SwUndoDelete( { DelContentIndex( *rPam.GetMark(), *rPam.GetPoint() ); ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); - if (m_nEndNode - m_nSttNode > 1) // check for fully selected nodes + if (m_nEndNode - m_nSttNode > SwNodeOffset(1)) // check for fully selected nodes { SwNodeIndex const start(pStt->nNode, +1); DelBookmarks(start, pEnd->nNode); @@ -329,7 +329,7 @@ SwUndoDelete::SwUndoDelete( // The dummy is needed because MoveNodes deletes empty // sections ++m_nReplaceDummy; - SwNodeRange aMvRg( *pEndTextNd, 0, *pEndTextNd, 1 ); + SwNodeRange aMvRg( *pEndTextNd, SwNodeOffset(0), *pEndTextNd, SwNodeOffset(1) ); SwPosition aSplitPos( *pEndTextNd ); ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo()); rDoc.getIDocumentContentOperations().SplitNode( aSplitPos, false ); @@ -337,14 +337,14 @@ SwUndoDelete::SwUndoDelete( --aRg.aEnd; } else - m_nReplaceDummy = 0; + m_nReplaceDummy = SwNodeOffset(0); } } if( m_bBackSp || bFullPara ) { // See above, the selection has to be expanded if there are "nearly // empty" sections and a replacement dummy has to be set if needed. - while( 1 < aRg.aStart.GetIndex() && + while( SwNodeOffset(1) < aRg.aStart.GetIndex() && ( (pTmpNd = rDocNds[ aRg.aStart.GetIndex()-1 ])->IsSectionNode() && pTmpNd->EndOfSectionIndex() < aRg.aEnd.GetIndex() ) ) --aRg.aStart; @@ -353,7 +353,7 @@ SwUndoDelete::SwUndoDelete( m_nReplaceDummy = m_nSttNode - m_nNdDiff - aRg.aStart.GetIndex(); if( m_nReplaceDummy ) { - SwNodeRange aMvRg( *pSttTextNd, 0, *pSttTextNd, 1 ); + SwNodeRange aMvRg( *pSttTextNd, SwNodeOffset(0), *pSttTextNd, SwNodeOffset(1) ); SwPosition aSplitPos( *pSttTextNd ); ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo()); rDoc.getIDocumentContentOperations().SplitNode( aSplitPos, false ); @@ -394,12 +394,12 @@ SwUndoDelete::SwUndoDelete( { if( m_bJoinNext ) { - SwNodeRange aMvRg( *pEndTextNd, 0, *pEndTextNd, 1 ); + SwNodeRange aMvRg( *pEndTextNd, SwNodeOffset(0), *pEndTextNd, SwNodeOffset(1) ); rDocNds.MoveNodes( aMvRg, rDocNds, aRg.aStart ); } else { - SwNodeRange aMvRg( *pSttTextNd, 0, *pSttTextNd, 1 ); + SwNodeRange aMvRg( *pSttTextNd, SwNodeOffset(0), *pSttTextNd, SwNodeOffset(1) ); rDocNds.MoveNodes( aMvRg, rDocNds, aRg.aEnd ); } } @@ -409,7 +409,7 @@ SwUndoDelete::SwUndoDelete( m_bJoinNext ? pEndTextNd->GetIndex() : pSttTextNd->GetIndex() ); } else - m_nNode = 0; // moved no node -> no difference at the end + m_nNode = SwNodeOffset(0); // moved no node -> no difference at the end // Are there any Nodes that got deleted before that (FootNotes // have ContentNodes)? @@ -437,7 +437,7 @@ SwUndoDelete::SwUndoDelete( bool SwUndoDelete::SaveContent( const SwPosition* pStt, const SwPosition* pEnd, SwTextNode* pSttTextNd, SwTextNode* pEndTextNd ) { - sal_uLong nNdIdx = pStt->nNode.GetIndex(); + SwNodeOffset nNdIdx = pStt->nNode.GetIndex(); // 1 - copy start in Start-String if( pSttTextNd ) { @@ -758,7 +758,7 @@ SwRewriter SwUndoDelete::GetRewriter() const { SwRewriter aResult; - if (m_nNode != 0) + if (m_nNode != SwNodeOffset(0)) { if (!m_sTableName.isEmpty()) { @@ -815,7 +815,7 @@ SwRewriter SwUndoDelete::GetRewriter() const } // Every object, anchored "AtContent" will be reanchored at rPos -static void lcl_ReAnchorAtContentFlyFrames( const SwFrameFormats& rSpzArr, const SwPosition &rPos, sal_uLong nOldIdx ) +static void lcl_ReAnchorAtContentFlyFrames( const SwFrameFormats& rSpzArr, const SwPosition &rPos, SwNodeOffset nOldIdx ) { if( rSpzArr.empty() ) return; @@ -844,7 +844,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) { SwDoc& rDoc = rContext.GetDoc(); - sal_uLong nCalcStt = m_nSttNode - m_nNdDiff; + SwNodeOffset nCalcStt = m_nSttNode - m_nNdDiff; if( m_nSectDiff && m_bBackSp ) nCalcStt += m_nSectDiff; @@ -877,7 +877,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) else pInsNd = nullptr; // do not delete Node! - bool bNodeMove = 0 != m_nNode; + bool bNodeMove = SwNodeOffset(0) != m_nNode; if( m_aEndStr ) { @@ -902,7 +902,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) if( m_aSttStr && !m_bFromTableCopy ) { - sal_uLong nOldIdx = aPos.nNode.GetIndex(); + SwNodeOffset nOldIdx = aPos.nNode.GetIndex(); rDoc.getIDocumentContentOperations().SplitNode( aPos, false ); // After the split all objects are anchored at the first // paragraph, but the pHistory of the fly frame formats relies @@ -930,7 +930,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) { if (m_nSttContent < pNd->GetText().getLength()) { - sal_uLong nOldIdx = aPos.nNode.GetIndex(); + SwNodeOffset nOldIdx = aPos.nNode.GetIndex(); rDoc.getIDocumentContentOperations().SplitNode( aPos, false ); if( m_bBackSp ) lcl_ReAnchorAtContentFlyFrames(*rDoc.GetSpzFrameFormats(), aPos, nOldIdx); @@ -941,8 +941,8 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) } if( m_nSectDiff ) { - sal_uLong nMoveIndex = aPos.nNode.GetIndex(); - int nDiff = 0; + SwNodeOffset nMoveIndex = aPos.nNode.GetIndex(); + SwNodeOffset nDiff(0); if( m_bJoinNext ) { nMoveIndex += m_nSectDiff + 1; @@ -954,7 +954,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) ++nDiff; } SwNodeIndex aMvIdx(rDoc.GetNodes(), nMoveIndex); - SwNodeRange aRg( aPos.nNode, 0 - nDiff, aPos.nNode, 1 - nDiff ); + SwNodeRange aRg( aPos.nNode, SwNodeOffset(0) - nDiff, aPos.nNode, SwNodeOffset(1) - nDiff ); --aPos.nNode; if( !m_bJoinNext ) pMovedNode = &aPos.nNode.GetNode(); @@ -964,7 +964,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) if( bNodeMove ) { - SwNodeRange aRange( *m_pMvStt, 0, *m_pMvStt, m_nNode ); + SwNodeRange aRange( *m_pMvStt, SwNodeOffset(0), *m_pMvStt, m_nNode ); SwNodeIndex aCopyIndex( aPos.nNode, -1 ); rDoc.GetUndoManager().GetUndoNodes().Copy_(aRange, aPos.nNode, // sw_redlinehide: delay creating frames: the flags on the @@ -974,7 +974,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) if( m_nReplaceDummy ) { - sal_uLong nMoveIndex; + SwNodeOffset nMoveIndex; if( m_bJoinNext ) { nMoveIndex = m_nEndNode - m_nNdDiff; @@ -986,7 +986,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) nMoveIndex = aPos.nNode.GetIndex() + m_nReplaceDummy + 1; } SwNodeIndex aMvIdx(rDoc.GetNodes(), nMoveIndex); - SwNodeRange aRg( aPos.nNode, 0, aPos.nNode, 1 ); + SwNodeRange aRg( aPos.nNode, SwNodeOffset(0), aPos.nNode, SwNodeOffset(1) ); pMovedNode = &aPos.nNode.GetNode(); // tdf#131684 without deleting frames rDoc.GetNodes().MoveNodes(aRg, rDoc.GetNodes(), aMvIdx, false); @@ -996,7 +996,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) if( m_aSttStr ) { - aPos.nNode = m_nSttNode - m_nNdDiff + ( m_bJoinNext ? 0 : m_nReplaceDummy ); + aPos.nNode = m_nSttNode - m_nNdDiff + ( m_bJoinNext ? SwNodeOffset(0) : m_nReplaceDummy ); SwTextNode * pTextNd = aPos.nNode.GetNode().GetTextNode(); // If more than a single Node got deleted, also all "Node" // attributes were saved @@ -1065,7 +1065,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) if( m_pRedlSaveData ) SetSaveData(rDoc, *m_pRedlSaveData); - sal_uLong delFullParaEndNode(m_nEndNode); + SwNodeOffset delFullParaEndNode(m_nEndNode); if (m_bDelFullPara && m_pRedlSaveData) { SwTextNode * pFirstMergedDeletedTextNode(nullptr); @@ -1103,7 +1103,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) } } } - else if (m_aSttStr && (!m_bFromTableCopy || 0 != m_nNode)) + else if (m_aSttStr && (!m_bFromTableCopy || SwNodeOffset(0) != m_nNode)) { // only now do we have redlines in the document again; fix up the split // frames @@ -1113,10 +1113,10 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) } // create frames after SetSaveData has recreated redlines - if (0 != m_nNode) + if (SwNodeOffset(0) != m_nNode) { // tdf#136453 only if section nodes at the start - if (m_bBackSp && m_nReplaceDummy != 0) + if (m_bBackSp && m_nReplaceDummy != SwNodeOffset(0)) { // tdf#134252 *first* create outer section frames // note: text node m_nSttNode currently has frame with an upper; @@ -1128,7 +1128,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) // tdf#121031 if the start node is a text node, it already has a frame; // if it's a table, it does not // tdf#109376 exception: end on non-text-node -> start node was inserted - assert(!m_bDelFullPara || (m_nSectDiff == 0)); + assert(!m_bDelFullPara || (m_nSectDiff == SwNodeOffset(0))); SwNodeIndex const start(rDoc.GetNodes(), m_nSttNode + ((m_bDelFullPara || !rDoc.GetNodes()[m_nSttNode]->IsTextNode() || pInsNd) ? 0 : 1)); diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 816ec4381076..2641e179d952 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -69,7 +69,7 @@ void SwUndRng::SetValues( const SwPaM& rPam ) else { // no selection !! - m_nEndNode = 0; + m_nEndNode = SwNodeOffset(0); m_nEndContent = COMPLETE_STRING; } @@ -113,8 +113,8 @@ SwPaM & SwUndRng::AddUndoRedoPaM( return rPaM; } -void SwUndo::RemoveIdxFromSection( SwDoc& rDoc, sal_uLong nSttIdx, - const sal_uLong* pEndIdx ) +void SwUndo::RemoveIdxFromSection( SwDoc& rDoc, SwNodeOffset nSttIdx, + const SwNodeOffset* pEndIdx ) { SwNodeIndex aIdx( rDoc.GetNodes(), nSttIdx ); SwNodeIndex aEndIdx( rDoc.GetNodes(), pEndIdx ? *pEndIdx @@ -150,7 +150,7 @@ void SwUndo::RemoveIdxFromRange( SwPaM& rPam, bool bMoveNext ) SwDoc::CorrAbs( rPam, *pEnd, true ); } -void SwUndo::RemoveIdxRel( sal_uLong nIdx, const SwPosition& rPos ) +void SwUndo::RemoveIdxRel( SwNodeOffset nIdx, const SwPosition& rPos ) { // Move only the Cursor. Bookmarks/TOXMarks/etc. are done by the corresponding // JoinNext/JoinPrev @@ -729,7 +729,7 @@ void SwUndoSaveContent::dumpAsXml(xmlTextWriterPtr pWriter) const // If pEndNdIdx is given, Undo/Redo calls -Ins/DelFly. In that case the whole // section should be moved. void SwUndoSaveContent::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx, - sal_uLong* pEndNdIdx ) + SwNodeOffset* pEndNdIdx ) { SwDoc& rDoc = rPaM.GetDoc(); ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); @@ -743,11 +743,11 @@ void SwUndoSaveContent::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx, const SwPosition* pStt = rPaM.Start(), *pEnd = rPaM.End(); - sal_uLong nTmpMvNode = aPos.nNode.GetIndex(); + SwNodeOffset nTmpMvNode = aPos.nNode.GetIndex(); if( pCpyNd || pEndNdIdx ) { - SwNodeRange aRg( pStt->nNode, 0, pEnd->nNode, 1 ); + SwNodeRange aRg( pStt->nNode, SwNodeOffset(0), pEnd->nNode, SwNodeOffset(1) ); rDoc.GetNodes().MoveNodes( aRg, rNds, aPos.nNode, true ); aPos.nContent = 0; --aPos.nNode; @@ -765,9 +765,9 @@ void SwUndoSaveContent::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx, *pNodeIdx = aPos.nNode; } -void SwUndoSaveContent::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx, +void SwUndoSaveContent::MoveFromUndoNds( SwDoc& rDoc, SwNodeOffset nNodeIdx, SwPosition& rInsPos, - const sal_uLong* pEndNdIdx, bool const bForceCreateFrames) + const SwNodeOffset* pEndNdIdx, bool const bForceCreateFrames) { // here comes the recovery SwNodes & rNds = rDoc.GetUndoManager().GetUndoNodes(); @@ -979,7 +979,7 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark, SwTextAttr* const pFlyHint = pTextNd->GetTextAttrForCharAt( pAPos->nContent.GetIndex()); assert(pFlyHint); - m_pHistory->Add( pFlyHint, 0, false ); + m_pHistory->Add( pFlyHint, SwNodeOffset(0), false ); // reset n so that no Format is skipped n = n >= rSpzArr.size() ? rSpzArr.size() : n+1; } @@ -1201,7 +1201,7 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark, // save a complete section into UndoNodes array SwUndoSaveSection::SwUndoSaveSection() - : m_nMoveLen( 0 ), m_nStartPos( ULONG_MAX ) + : m_nMoveLen( 0 ), m_nStartPos( NODE_OFFSET_MAX ) { } @@ -1266,7 +1266,7 @@ void SwUndoSaveSection::SaveSection( aPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); // Keep positions as SwIndex so that this section can be deleted in DTOR - sal_uLong nEnd; + SwNodeOffset nEnd; m_pMovedStart.reset(new SwNodeIndex(rRange.aStart)); MoveToUndoNds(aPam, m_pMovedStart.get(), &nEnd); m_nMoveLen = nEnd - m_pMovedStart->GetIndex() + 1; @@ -1275,7 +1275,7 @@ void SwUndoSaveSection::SaveSection( void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx, sal_uInt16 nSectType ) { - if( ULONG_MAX == m_nStartPos ) // was there any content? + if( NODE_OFFSET_MAX == m_nStartPos ) // was there any content? return; // check if the content is at the old position @@ -1294,16 +1294,16 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx, void SwUndoSaveSection::RestoreSection( SwDoc *const pDoc, const SwNodeIndex& rInsPos, bool bForceCreateFrames) { - if( ULONG_MAX == m_nStartPos ) // was there any content? + if( NODE_OFFSET_MAX == m_nStartPos ) // was there any content? return; SwPosition aInsPos( rInsPos ); - sal_uLong nEnd = m_pMovedStart->GetIndex() + m_nMoveLen - 1; + SwNodeOffset nEnd = m_pMovedStart->GetIndex() + m_nMoveLen - 1; MoveFromUndoNds(*pDoc, m_pMovedStart->GetIndex(), aInsPos, &nEnd, bForceCreateFrames); // destroy indices again, content was deleted from UndoNodes array m_pMovedStart.reset(); - m_nMoveLen = 0; + m_nMoveLen = SwNodeOffset(0); if( m_pRedlineSaveData ) { diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 87e6c00677cb..fa88f6179442 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -67,7 +67,7 @@ void SwUndoFlyBase::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwUndoFlyBase")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nNodePagePos"), - BAD_CAST(OString::number(m_nNodePagePos).getStr())); + BAD_CAST(OString::number(sal_Int32(m_nNodePagePos)).getStr())); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nContentPos"), BAD_CAST(OString::number(m_nContentPos).getStr())); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nRndId"), @@ -102,7 +102,7 @@ void SwUndoFlyBase::InsFly(::sw::UndoRedoContext & rContext, bool bShowSelFrame) if (RndStdIds::FLY_AT_PAGE == m_nRndId) { - aAnchor.SetPageNum( o3tl::narrowing<sal_uInt16>(m_nNodePagePos) ); + aAnchor.SetPageNum( o3tl::narrowing<sal_uInt16>(sal_Int32(m_nNodePagePos)) ); } else { @@ -260,7 +260,7 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc ) } else { - m_nNodePagePos = rAnchor.GetPageNum(); + m_nNodePagePos = SwNodeOffset(rAnchor.GetPageNum()); } m_pFrameFormat->ResetFormatAttr( RES_ANCHOR ); // delete anchor @@ -270,7 +270,7 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc ) rFlyFormats.erase( m_pFrameFormat ); } -SwUndoInsLayFormat::SwUndoInsLayFormat( SwFrameFormat* pFormat, sal_uLong nNodeIdx, sal_Int32 nCntIdx ) +SwUndoInsLayFormat::SwUndoInsLayFormat( SwFrameFormat* pFormat, SwNodeOffset nNodeIdx, sal_Int32 nCntIdx ) : SwUndoFlyBase( pFormat, RES_DRAWFRMFMT == pFormat->Which() ? SwUndoId::INSDRAWFMT : SwUndoId::INSLAYFMT ), mnCursorSaveIndexPara( nNodeIdx ), mnCursorSaveIndexPos( nCntIdx ) @@ -296,7 +296,7 @@ void SwUndoInsLayFormat::UndoImpl(::sw::UndoRedoContext & rContext) { assert(&rContent.GetContentIdx()->GetNodes() == &rDoc.GetNodes()); bool bRemoveIdx = true; - if( mnCursorSaveIndexPara > 0 ) + if( mnCursorSaveIndexPara > SwNodeOffset(0) ) { SwTextNode *const pNode = rDoc.GetNodes()[mnCursorSaveIndexPara]->GetTextNode(); @@ -441,7 +441,7 @@ SwRewriter SwUndoDelLayFormat::GetRewriter() const if (pDoc) { SwNodeIndex* pIdx = GetMvSttIdx(); - if( 1 == GetMvNodeCnt() && pIdx) + if( SwNodeOffset(1) == GetMvNodeCnt() && pIdx) { SwNode *const pNd = & pIdx->GetNode(); @@ -510,7 +510,7 @@ SwUndoSetFlyFormat::~SwUndoSetFlyFormat() } void SwUndoSetFlyFormat::GetAnchor( SwFormatAnchor& rAnchor, - sal_uLong nNode, sal_Int32 nContent ) + SwNodeOffset nNode, sal_Int32 nContent ) { RndStdIds nAnchorTyp = rAnchor.GetAnchorId(); if (RndStdIds::FLY_AT_PAGE != nAnchorTyp) diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index 8fd748dda95e..94146fef2a22 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -47,7 +47,7 @@ struct SwUndoGroupObjImpl { SwDrawFrameFormat* pFormat; SdrObject* pObj; - sal_uLong nNodeIdx; + SwNodeOffset nNodeIdx; }; // Draw-Objecte @@ -96,7 +96,7 @@ OUString SwSdrUndo::GetComment() const return m_pSdrUndo->GetComment(); } -static void lcl_SaveAnchor( SwFrameFormat* pFormat, sal_uLong& rNodePos ) +static void lcl_SaveAnchor( SwFrameFormat* pFormat, SwNodeOffset& rNodePos ) { const SwFormatAnchor& rAnchor = pFormat->GetAnchor(); if (!((RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId()) || @@ -134,7 +134,7 @@ static void lcl_SaveAnchor( SwFrameFormat* pFormat, sal_uLong& rNodePos ) pFormat->SetFormatAttr( SwFormatAnchor( rAnchor.GetAnchorId(), nContentPos ) ); } -static void lcl_RestoreAnchor( SwFrameFormat* pFormat, sal_uLong nNodePos ) +static void lcl_RestoreAnchor( SwFrameFormat* pFormat, SwNodeOffset nNodePos ) { const SwFormatAnchor& rAnchor = pFormat->GetAnchor(); if (!((RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId()) || diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index f1fc4b28a551..44800d1c132a 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -223,7 +223,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext) } else { - sal_uLong nNd = m_nNode; + SwNodeOffset nNd = m_nNode; sal_Int32 nCnt = m_nContent; if( m_nLen ) { @@ -344,7 +344,7 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext) else { // re-insert content again (first detach m_pUndoNodeIndex!) - sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex(); + SwNodeOffset const nMvNd = m_pUndoNodeIndex->GetIndex(); m_pUndoNodeIndex.reset(); MoveFromUndoNds(*pTmpDoc, nMvNd, *pPam->GetMark()); } @@ -481,7 +481,7 @@ class SwUndoReplace::Impl { OUString m_sOld; OUString m_sIns; - sal_uLong m_nSttNd, m_nEndNd, m_nOffset; + SwNodeOffset m_nSttNd, m_nEndNd, m_nOffset; sal_Int32 m_nSttCnt, m_nEndCnt, m_nSetPos, m_nSelEnd; bool m_bSplitNext : 1; bool m_bRegExp : 1; @@ -599,7 +599,7 @@ SwUndoReplace::Impl::Impl( m_nSetPos = m_pHistory->Count(); - sal_uLong nNewPos = pStt->nNode.GetIndex(); + SwNodeOffset nNewPos = pStt->nNode.GetIndex(); m_nOffset = m_nSttNd - nNewPos; if ( pNd->GetpSwpHints() ) @@ -615,7 +615,7 @@ SwUndoReplace::Impl::Impl( m_pHistory->Add( pNd->GetTextColl(), nNewPos, SwNodeType::Text ); SwTextNode* pNext = pEnd->nNode.GetNode().GetTextNode(); - sal_uLong nTmp = pNext->GetIndex(); + SwNodeOffset nTmp = pNext->GetIndex(); m_pHistory->CopyAttr( pNext->GetpSwpHints(), nTmp, 0, pNext->GetText().getLength(), true ); if( pNext->HasSwAttrSet() ) @@ -959,7 +959,7 @@ void SwUndoInsertLabel::RepeatImpl(::sw::RepeatContext & rContext) SwDoc & rDoc = rContext.GetDoc(); const SwPosition& rPos = *rContext.GetRepeatPaM().GetPoint(); - sal_uLong nIdx = 0; + SwNodeOffset nIdx(0); SwContentNode* pCNd = rPos.nNode.GetNode().GetContentNode(); if( pCNd ) @@ -1028,7 +1028,7 @@ void SwUndoInsertLabel::SetFlys( SwFrameFormat& rOldFly, SfxItemSet const & rChg { OBJECT.pUndoAttr = aTmp.ReleaseUndo().release(); } - OBJECT.pUndoFly = new SwUndoInsLayFormat( &rNewFly,0,0 ); + OBJECT.pUndoFly = new SwUndoInsLayFormat( &rNewFly, SwNodeOffset(0), 0 ); } } diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx index 04b10cb900a6..b727e565d72e 100644 --- a/sw/source/core/undo/unmove.cxx +++ b/sw/source/core/undo/unmove.cxx @@ -115,7 +115,7 @@ SwUndoMove::SwUndoMove( SwDoc& rDoc, const SwNodeRange& rRg, // FIXME: duplication of the method body of DelFootnote below // is the current move from ContentArea into the special section? - sal_uLong nContentStt = rDoc.GetNodes().GetEndOfAutotext().GetIndex(); + SwNodeOffset nContentStt = rDoc.GetNodes().GetEndOfAutotext().GetIndex(); if( m_nMoveDestNode < nContentStt && rRg.aStart.GetIndex() > nContentStt ) { // delete all footnotes since they are undesired there @@ -291,7 +291,7 @@ void SwUndoMove::DelFootnote( const SwPaM& rRange ) { // is the current move from ContentArea into the special section? SwDoc& rDoc = rRange.GetDoc(); - sal_uLong nContentStt = rDoc.GetNodes().GetEndOfAutotext().GetIndex(); + SwNodeOffset nContentStt = rDoc.GetNodes().GetEndOfAutotext().GetIndex(); if( m_nMoveDestNode < nContentStt && rRange.GetPoint()->nNode.GetIndex() >= nContentStt ) { diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx index cf09ad827d82..be0d6f4f4c66 100644 --- a/sw/source/core/undo/unnum.cxx +++ b/sw/source/core/undo/unnum.cxx @@ -50,7 +50,7 @@ SwUndoInsNum::SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule, m_sReplaceRule( rReplaceRule ), m_nLRSavePos( 0 ) { // No selection! - m_nEndNode = 0; + m_nEndNode = SwNodeOffset(0); m_nEndContent = COMPLETE_STRING; m_nSttNode = rPos.nNode.GetIndex(); m_nSttContent = rPos.nContent.GetIndex(); @@ -155,7 +155,8 @@ void SwUndoInsNum::SaveOldNumRule( const SwNumRule& rOld ) SwUndoDelNum::SwUndoDelNum( const SwPaM& rPam ) : SwUndo( SwUndoId::DELNUM, &rPam.GetDoc() ), SwUndRng( rPam ) { - m_aNodes.reserve( std::min<sal_uLong>(m_nEndNode - m_nSttNode, 255) ); + if (m_nEndNode > m_nSttNode) + m_aNodes.reserve( std::min<sal_Int32>(sal_Int32(m_nEndNode - m_nSttNode), 255) ); m_pHistory.reset( new SwHistory ); } @@ -202,7 +203,7 @@ void SwUndoDelNum::AddNode( const SwTextNode& rNd ) } } -SwUndoMoveNum::SwUndoMoveNum( const SwPaM& rPam, tools::Long nOff, bool bIsOutlMv ) +SwUndoMoveNum::SwUndoMoveNum( const SwPaM& rPam, SwNodeOffset nOff, bool bIsOutlMv ) : SwUndo( bIsOutlMv ? SwUndoId::OUTLINE_UD : SwUndoId::MOVENUM, &rPam.GetDoc() ), SwUndRng( rPam ), m_nNewStart( 0 ), m_nOffset( nOff ) @@ -213,7 +214,7 @@ SwUndoMoveNum::SwUndoMoveNum( const SwPaM& rPam, tools::Long nOff, bool bIsOutlM void SwUndoMoveNum::UndoImpl(::sw::UndoRedoContext & rContext) { - sal_uLong nTmpStt = m_nSttNode, nTmpEnd = m_nEndNode; + SwNodeOffset nTmpStt = m_nSttNode, nTmpEnd = m_nEndNode; if (m_nEndNode || m_nEndContent != COMPLETE_STRING) // section? { @@ -243,7 +244,7 @@ void SwUndoMoveNum::RepeatImpl(::sw::RepeatContext & rContext) if( SwUndoId::OUTLINE_UD == GetId() ) { rDoc.MoveOutlinePara(rContext.GetRepeatPaM(), - 0 < m_nOffset ? 1 : -1 ); + SwNodeOffset(0) < m_nOffset ? 1 : -1 ); } else { diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx index 4605acaf4fdc..20fa7a5b9a75 100644 --- a/sw/source/core/undo/unovwr.cxx +++ b/sw/source/core/undo/unovwr.cxx @@ -327,10 +327,10 @@ struct UndoTransliterate_Data OUString sText; std::unique_ptr<SwHistory> pHistory; std::unique_ptr<Sequence< sal_Int32 >> pOffsets; - sal_uLong nNdIdx; + SwNodeOffset nNdIdx; sal_Int32 nStart, nLen; - UndoTransliterate_Data( sal_uLong nNd, sal_Int32 nStt, sal_Int32 nStrLen, const OUString& rText ) + UndoTransliterate_Data( SwNodeOffset nNd, sal_Int32 nStt, sal_Int32 nStrLen, const OUString& rText ) : sText( rText ), nNdIdx( nNd ), nStart( nStt ), nLen( nStrLen ) {} diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index eb8caf02878c..b2cee7f58f3a 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -56,7 +56,7 @@ SwUndoRedline::SwUndoRedline( SwUndoId nUsrId, const SwPaM& rRange ) SetRedlineFlags( rDoc.getIDocumentRedlineAccess().GetRedlineFlags() ); } - sal_uLong nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex(); + SwNodeOffset nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex(); mpRedlSaveData.reset( new SwRedlineSaveDatas ); if( !FillSaveData( rRange, *mpRedlSaveData, false, SwUndoId::REJECT_REDLINE != mnUserId )) @@ -99,7 +99,7 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext) { // Nodes of the deletion range are in the newest invisible redlines. // Set all redlines visible and recover the original deletion range. - for (sal_uInt32 nNodes = 0; nNodes < m_nEndNode - m_nSttNode + 1; ++nNodes) + for (SwNodeOffset nNodes(0); nNodes < m_nEndNode - m_nSttNode + 1; ++nNodes) { SwRedlineTable::size_type nCurRedlinePos = 0; SwRangeRedline * pRedline(rTable[nCurRedlinePos]); @@ -124,7 +124,7 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext) pRedline->Show(1, rTable.GetPos(pRedline), /*bForced=*/true); // extend the range - if ( nNodes==0 ) + if ( nNodes == SwNodeOffset(0) ) rPam = *pRedline; else { @@ -139,7 +139,7 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext) if( mpRedlSaveData ) { - sal_uLong nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex(); + SwNodeOffset nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex(); SetSaveData(rDoc, *mpRedlSaveData); if( mbHiddenRedlines ) { @@ -173,7 +173,7 @@ void SwUndoRedline::RedoImpl(::sw::UndoRedoContext & rContext) SwPaM & rPam( AddUndoRedoPaM(rContext) ); if( mpRedlSaveData && mbHiddenRedlines ) { - sal_uLong nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex(); + SwNodeOffset nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex(); FillSaveData(rPam, *mpRedlSaveData, false, SwUndoId::REJECT_REDLINE != mnUserId ); nEndExtra -= rDoc.GetNodes().GetEndOfExtras().GetIndex(); @@ -307,7 +307,7 @@ void SwUndoRedlineSort::UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) SwPosition *const pEnd = rPam.End(); SwNodeIndex aPrevIdx( pStart->nNode, -1 ); - sal_uLong nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex(); + SwNodeOffset nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex(); if( !( RedlineFlags::ShowDelete & rDoc.getIDocumentRedlineAccess().GetRedlineFlags()) ) { @@ -357,7 +357,7 @@ void SwUndoRedlineSort::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) SwPosition* pEnd = pPam->End(); SwNodeIndex aPrevIdx( pStart->nNode, -1 ); - sal_uLong nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex(); + SwNodeOffset nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex(); const sal_Int32 nCntStt = pStart->nContent.GetIndex(); rDoc.SortText(rPam, *m_pOpt); diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index 9cc907084436..81255ed73cad 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -234,14 +234,14 @@ void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext) RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld & ~RedlineFlags::Ignore); - SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 ); + SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, SwNodeOffset(1) ); rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlData, aPam ), true); rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); } else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) && !rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() ) { - SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 ); + SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, SwNodeOffset(1) ); rDoc.getIDocumentRedlineAccess().SplitRedline( aPam ); } @@ -273,7 +273,7 @@ void SwUndoInsSection::RepeatImpl(::sw::RepeatContext & rContext) } } -void SwUndoInsSection::Join( SwDoc& rDoc, sal_uLong nNode ) +void SwUndoInsSection::Join( SwDoc& rDoc, SwNodeOffset nNode ) { SwNodeIndex aIdx( rDoc.GetNodes(), nNode ); SwTextNode* pTextNd = aIdx.GetNode().GetTextNode(); @@ -324,8 +324,8 @@ private: std::unique_ptr<SwTOXBase> const m_pTOXBase; /// set iff section is TOX std::optional<SfxItemSet> const m_oAttrSet; std::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo; - sal_uLong const m_nStartNode; - sal_uLong const m_nEndNode; + SwNodeOffset const m_nStartNode; + SwNodeOffset const m_nEndNode; public: SwUndoDelSection( @@ -429,7 +429,7 @@ class SwUndoUpdateSection private: std::unique_ptr<SwSectionData> m_pSectionData; std::optional<SfxItemSet> m_oAttrSet; - sal_uLong const m_nStartNode; + SwNodeOffset const m_nStartNode; bool const m_bOnlyAttrChanged; public: diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx index 0ba092994685..44468c16546d 100644 --- a/sw/source/core/undo/unsort.cxx +++ b/sw/source/core/undo/unsort.cxx @@ -49,7 +49,7 @@ SwUndoSort::SwUndoSort(const SwPaM& rRg, const SwSortOptions& rOpt) m_pSortOptions.reset( new SwSortOptions(rOpt) ); } -SwUndoSort::SwUndoSort( sal_uLong nStt, sal_uLong nEnd, const SwTableNode& rTableNd, +SwUndoSort::SwUndoSort( SwNodeOffset nStt, SwNodeOffset nEnd, const SwTableNode& rTableNd, const SwSortOptions& rOpt, bool bSaveTable ) : SwUndo(SwUndoId::SORT_TBL, &rTableNd.GetDoc()) { @@ -109,7 +109,7 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext) // Restore table frames: // #i37739# A simple 'MakeFrames' after the node sorting // does not work if the table is inside a frame and has no prev/next. - const sal_uLong nIdx = pTableNd->GetIndex(); + const SwNodeOffset nIdx = pTableNd->GetIndex(); aNode2Layout.RestoreUpperFrames( rDoc.GetNodes(), nIdx, nIdx + 1 ); } else @@ -127,7 +127,7 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext) { for (const std::unique_ptr<SwSortUndoElement> & j : m_SortList) { - if (j->SORT_TXT_TBL.TXT.nSource == m_nSttNode + i) + if (j->SORT_TXT_TBL.TXT.nSource == sal_Int32(m_nSttNode + SwNodeOffset(i))) { aIdxList.push_back( SwNodeIndex( rDoc.GetNodes(), j->SORT_TXT_TBL.TXT.nTarget ) ); @@ -138,8 +138,8 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext) for (size_t i = 0; i < m_SortList.size(); ++i) { - SwNodeIndex aIdx( rDoc.GetNodes(), m_nSttNode + i ); - SwNodeRange aRg( aIdxList[i], 0, aIdxList[i], 1 ); + SwNodeIndex aIdx( rDoc.GetNodes(), m_nSttNode + SwNodeOffset(i) ); + SwNodeRange aRg( aIdxList[i], SwNodeOffset(0), aIdxList[i], SwNodeOffset(1) ); rDoc.getIDocumentContentOperations().MoveNodeRange(aRg, aIdx, SwMoveFlags::DEFAULT); } @@ -190,7 +190,7 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext) // Restore table frames: // #i37739# A simple 'MakeFrames' after the node sorting // does not work if the table is inside a frame and has no prev/next. - const sal_uLong nIdx = pTableNd->GetIndex(); + const SwNodeOffset nIdx = pTableNd->GetIndex(); aNode2Layout.RestoreUpperFrames( rDoc.GetNodes(), nIdx, nIdx + 1 ); } else @@ -211,8 +211,8 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext) for (size_t i = 0; i < m_SortList.size(); ++i) { - SwNodeIndex aIdx( rDoc.GetNodes(), m_nSttNode + i); - SwNodeRange aRg( aIdxList[i], 0, aIdxList[i], 1 ); + SwNodeIndex aIdx( rDoc.GetNodes(), m_nSttNode + SwNodeOffset(i)); + SwNodeRange aRg( aIdxList[i], SwNodeOffset(0), aIdxList[i], SwNodeOffset(1) ); rDoc.getIDocumentContentOperations().MoveNodeRange(aRg, aIdx, SwMoveFlags::DEFAULT); } @@ -245,7 +245,7 @@ void SwUndoSort::Insert( const OUString& rOrgPos, const OUString& rNewPos) m_SortList.push_back(std::make_unique< SwSortUndoElement>(rOrgPos, rNewPos)); } -void SwUndoSort::Insert( sal_uLong nOrgPos, sal_uLong nNewPos) +void SwUndoSort::Insert( SwNodeOffset nOrgPos, SwNodeOffset nNewPos) { m_SortList.push_back(std::make_unique<SwSortUndoElement>(nOrgPos, nNewPos)); } diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index ae1c54569984..5587dfeb9b1c 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -83,7 +83,7 @@ typedef std::vector<std::shared_ptr<SfxItemSet> > SfxItemSets; struct UndoTableCpyTable_Entry { - sal_uLong nBoxIdx, nOffset; + SwNodeOffset nBoxIdx, nOffset; std::unique_ptr<SfxItemSet> pBoxNumAttr; std::unique_ptr<SwUndo> pUndo; @@ -170,7 +170,7 @@ class SaveBox friend class SaveLine; SaveBox* m_pNext; - sal_uLong m_nStartNode; + SwNodeOffset m_nStartNode; sal_Int32 m_nRowSpan; sal_uInt16 m_nItemSet; union @@ -206,15 +206,15 @@ So we need to remember not only the start node position but the end node positio struct SwTableToTextSave { - sal_uLong m_nSttNd; - sal_uLong m_nEndNd; + SwNodeOffset m_nSttNd; + SwNodeOffset m_nEndNd; sal_Int32 m_nContent; std::unique_ptr<SwHistory> m_pHstry; // metadata references for first and last paragraph in cell std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart; std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd; - SwTableToTextSave( SwDoc& rDoc, sal_uLong nNd, sal_uLong nEndIdx, sal_Int32 nContent ); + SwTableToTextSave( SwDoc& rDoc, SwNodeOffset nNd, SwNodeOffset nEndIdx, sal_Int32 nContent ); private: SwTableToTextSave(const SwTableToTextSave&) = delete; @@ -332,7 +332,7 @@ void SwUndoInsTable::RedoImpl(::sw::UndoRedoContext & rContext) !rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() ))) return; - SwPaM aPam( *pTableNode->EndOfSectionNode(), *pTableNode, 1 ); + SwPaM aPam( *pTableNode->EndOfSectionNode(), *pTableNode, SwNodeOffset(1) ); SwContentNode* pCNd = aPam.GetContentNode( false ); if( pCNd ) aPam.GetMark()->nContent.Assign( pCNd, 0 ); @@ -367,7 +367,7 @@ SwRewriter SwUndoInsTable::GetRewriter() const return aRewriter; } -SwTableToTextSave::SwTableToTextSave( SwDoc& rDoc, sal_uLong nNd, sal_uLong nEndIdx, sal_Int32 nCnt ) +SwTableToTextSave::SwTableToTextSave( SwDoc& rDoc, SwNodeOffset nNd, SwNodeOffset nEndIdx, sal_Int32 nCnt ) : m_nSttNd( nNd ), m_nEndNd( nEndIdx), m_nContent( nCnt ) { // keep attributes of the joined node @@ -424,7 +424,7 @@ SwUndoTableToText::SwUndoTableToText( const SwTable& rTable, sal_Unicode cCh ) m_pHistory.reset(new SwHistory); const SwTableNode* pTableNd = rTable.GetTableNode(); - sal_uLong nTableStt = pTableNd->GetIndex(), nTableEnd = pTableNd->EndOfSectionIndex(); + SwNodeOffset nTableStt = pTableNd->GetIndex(), nTableEnd = pTableNd->EndOfSectionIndex(); const SwFrameFormats& rFrameFormatTable = *pTableNd->GetDoc().GetSpzFrameFormats(); for( size_t n = 0; n < rFrameFormatTable.size(); ++n ) @@ -524,7 +524,7 @@ void SwUndoTableToText::UndoImpl(::sw::UndoRedoContext & rContext) } // located in untbl.cxx and only an Undo object is allowed to call it -SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd, +SwTableNode* SwNodes::UndoTableToText( SwNodeOffset nSttNd, SwNodeOffset nEndNd, const SwTableToTextSaves& rSavedData ) { SwNodeIndex aSttIdx( *this, nSttNd ); @@ -539,7 +539,7 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd, Delete all Frames attached to the nodes in that range. */ SwNode* pNd; { - sal_uLong n, nTmpEnd = aEndIdx.GetIndex(); + SwNodeOffset n, nTmpEnd = aEndIdx.GetIndex(); for( n = pTableNd->GetIndex() + 1; n < nTmpEnd; ++n ) { if( ( pNd = (*this)[ n ] )->IsContentNode() ) @@ -627,7 +627,7 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd, pSttNd->m_pStartOfSection = pTableNd; new SwEndNode( aEndIdx, *pSttNd ); - for( sal_uLong i = aSttIdx.GetIndex(); i < aEndIdx.GetIndex()-1; ++i ) + for( SwNodeOffset i = aSttIdx.GetIndex(); i < aEndIdx.GetIndex()-1; ++i ) { pNd = (*this)[ i ]; pNd->m_pStartOfSection = pSttNd; @@ -698,7 +698,7 @@ void SwUndoTableToText::SetRange( const SwNodeRange& rRg ) m_nEndNode = rRg.aEnd.GetIndex(); } -void SwUndoTableToText::AddBoxPos( SwDoc& rDoc, sal_uLong nNdIdx, sal_uLong nEndIdx, sal_Int32 nContentIdx ) +void SwUndoTableToText::AddBoxPos( SwDoc& rDoc, SwNodeOffset nNdIdx, SwNodeOffset nEndIdx, sal_Int32 nContentIdx ) { m_vBoxSaves.push_back(std::make_unique<SwTableToTextSave>(rDoc, nNdIdx, nEndIdx, nContentIdx)); } @@ -729,7 +729,7 @@ void SwUndoTextToTable::UndoImpl(::sw::UndoRedoContext & rContext) { SwDoc & rDoc = rContext.GetDoc(); - sal_uLong nTableNd = m_nSttNode; + SwNodeOffset nTableNd = m_nSttNode; if( m_nSttContent ) ++nTableNd; // Node was split previously SwNodeIndex aIdx( rDoc.GetNodes(), nTableNd ); @@ -1168,7 +1168,7 @@ void SaveLine::CreateNew( SwTable& rTable, SwTableBox& rParent, SaveTable& rSTab SaveBox::SaveBox(SaveBox* pPrev, const SwTableBox& rBox, SaveTable& rSTable) : m_pNext(nullptr) - , m_nStartNode(ULONG_MAX) + , m_nStartNode(NODE_OFFSET_MAX) , m_nRowSpan(0) { m_Ptrs.pLine = nullptr; @@ -1195,7 +1195,7 @@ SaveBox::SaveBox(SaveBox* pPrev, const SwTableBox& rBox, SaveTable& rSTable) SaveBox::~SaveBox() { - if (ULONG_MAX == m_nStartNode) // no EndBox + if (NODE_OFFSET_MAX == m_nStartNode) // no EndBox delete m_Ptrs.pLine; else delete m_Ptrs.pContentAttrs; @@ -1206,7 +1206,7 @@ void SaveBox::RestoreAttr( SwTableBox& rBox, SaveTable& rSTable ) { rSTable.NewFrameFormatForBox(rBox, m_nItemSet, rBox.GetFrameFormat()); - if (ULONG_MAX == m_nStartNode) // no EndBox + if (NODE_OFFSET_MAX == m_nStartNode) // no EndBox { if( rBox.GetTabLines().empty() ) { @@ -1233,8 +1233,8 @@ void SaveBox::RestoreAttr( SwTableBox& rBox, SaveTable& rSTable ) { SwNodes& rNds = rBox.GetFrameFormat()->GetDoc()->GetNodes(); sal_uInt16 nSet = 0; - sal_uLong nEnd = rBox.GetSttNd()->EndOfSectionIndex(); - for (sal_uLong n = m_nStartNode + 1; n < nEnd; ++n) + SwNodeOffset nEnd = rBox.GetSttNd()->EndOfSectionIndex(); + for (SwNodeOffset n = m_nStartNode + 1; n < nEnd; ++n) { SwContentNode* pCNd = rNds[ n ]->GetContentNode(); if( pCNd ) @@ -1260,16 +1260,16 @@ void SaveBox::RestoreAttr( SwTableBox& rBox, SaveTable& rSTable ) void SaveBox::SaveContentAttrs( SwDoc* pDoc ) { - if (ULONG_MAX == m_nStartNode) // no EndBox + if (NODE_OFFSET_MAX == m_nStartNode) // no EndBox { // continue in current line m_Ptrs.pLine->SaveContentAttrs(pDoc); } else { - sal_uLong nEnd = pDoc->GetNodes()[m_nStartNode]->EndOfSectionIndex(); + SwNodeOffset nEnd = pDoc->GetNodes()[m_nStartNode]->EndOfSectionIndex(); m_Ptrs.pContentAttrs = new SfxItemSets; - for (sal_uLong n = m_nStartNode + 1; n < nEnd; ++n) + for (SwNodeOffset n = m_nStartNode + 1; n < nEnd; ++n) { SwContentNode* pCNd = pDoc->GetNodes()[ n ]->GetContentNode(); if( pCNd ) @@ -1301,7 +1301,7 @@ void SaveBox::CreateNew( SwTable& rTable, SwTableLine& rParent, SaveTable& rSTab rSTable.m_aFrameFormats[m_nItemSet] = pFormat; } - if (ULONG_MAX == m_nStartNode) // no EndBox + if (NODE_OFFSET_MAX == m_nStartNode) // no EndBox { SwTableBox* pNew = new SwTableBox( pFormat, 1, &rParent ); rParent.GetTabBoxes().push_back( pNew ); @@ -1532,7 +1532,7 @@ static const SwTableLines& lcl_FindParentLines( const SwTable& rTable, void SwUndoTableNdsChg::SaveNewBoxes( const SwTableNode& rTableNd, const SwTableSortBoxes& rOld, const SwSelBoxes& rBoxes, - const std::vector<sal_uLong> &rNodeCnts ) + const std::vector<SwNodeOffset> &rNodeCnts ) { const SwTable& rTable = rTableNd.GetTable(); const SwTableSortBoxes& rTableBoxes = rTable.GetTabSortBoxes(); @@ -1590,7 +1590,7 @@ void SwUndoTableNdsChg::SaveNewBoxes( const SwTableNode& rTableNd, size_t nNdsPos = 0; while( rBoxes[ nNdsPos ] != pSourceBox ) ++nNdsPos; - sal_uLong nNodes = rNodeCnts[ nNdsPos ]; + SwNodeOffset nNodes = rNodeCnts[ nNdsPos ]; // When a new table cell is created, it either gets a new // node, or it gets node(s) from elsewhere. The undo must @@ -1604,7 +1604,7 @@ void SwUndoTableNdsChg::SaveNewBoxes( const SwTableNode& rTableNd, bool bNodesMoved = pSourceBox && ( nNodes != ( pSourceBox->GetSttNd()->EndOfSectionIndex() - pSourceBox->GetSttIdx() ) ) - && ( nNodes - 1 > nLineDiff ); + && ( nNodes - 1 > SwNodeOffset(nLineDiff) ); m_xNewSttNds->insert( BoxMove(pBox->GetSttIdx(), bNodesMoved) ); } } @@ -1643,7 +1643,7 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) SwChartDataProvider *pPCD = rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider(); SwSelBoxes aDelBoxes; - std::vector< std::pair<SwTableBox *, sal_uLong> > aDelNodes; + std::vector< std::pair<SwTableBox *, SwNodeOffset> > aDelNodes; if( IsDelBox() ) { // Trick: add missing boxes in any line, they will be connected @@ -1675,7 +1675,7 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) { --n; // delete box from table structure - sal_uLong nIdx = aTmp[n].index; + SwNodeOffset nIdx = aTmp[n].index; SwTableBox* pBox = pTableNd->GetTable().GetTableBox( nIdx ); OSL_ENSURE( pBox, "Where is my TableBox?" ); @@ -1689,7 +1689,7 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) if( aTmp[n].hasMoved ) { - SwNodeRange aRg( *pBox->GetSttNd(), 1, + SwNodeRange aRg( *pBox->GetSttNd(), SwNodeOffset(1), *pBox->GetSttNd()->EndOfSectionNode() ); SwTableLine* pLine = lcl_FindTableLine( pTableNd->GetTable(), *pBox ); @@ -1697,7 +1697,7 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) // adjust all StartNode indices size_t i = n; - sal_uLong nSttIdx = aInsPos.GetIndex() - 2, + SwNodeOffset nSttIdx = aInsPos.GetIndex() - 2, nNdCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex(); while( i && aTmp[ --i ].index > nSttIdx ) aTmp[ i ].index += nNdCnt; @@ -1719,7 +1719,7 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) std::set<BoxMove>::reverse_iterator it; for( it = m_xNewSttNds->rbegin(); it != m_xNewSttNds->rend(); ++it ) { - sal_uLong nIdx = (*it).index; + SwNodeOffset nIdx = (*it).index; SwTableBox* pBox = pTableNd->GetTable().GetTableBox( nIdx ); OSL_ENSURE( pBox, "Where's my table box?" ); // TL_CHART2: notify chart about box to be removed @@ -1736,7 +1736,7 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) // do this _after_ deleting Frames because disposing SwAccessible requires // connection to the nodes, see SwAccessibleChild::IsAccessible() - for (const std::pair<SwTableBox *, sal_uLong> & rDelNode : aDelNodes) + for (const std::pair<SwTableBox *, SwNodeOffset> & rDelNode : aDelNodes) { // first disconnect box from node, otherwise ~SwTableBox would // access pBox->pSttNd, deleted by DeleteSection @@ -1875,7 +1875,7 @@ void SwUndoTableMerge::UndoImpl(::sw::UndoRedoContext & rContext) for( size_t n = m_aNewStartNodes.size(); n; ) { // remove box from table structure - sal_uLong nIdx = m_aNewStartNodes[ --n ]; + SwNodeOffset nIdx = m_aNewStartNodes[ --n ]; if( !nIdx && n ) { @@ -2003,7 +2003,7 @@ void SwUndoTableMerge::SetSelBoxes( const SwSelBoxes& rBoxes ) } // as separator for inserts of new boxes after shifting - m_aNewStartNodes.push_back( sal_uLong(0) ); + m_aNewStartNodes.push_back( SwNodeOffset(0) ); // The new table model does not delete overlapped cells (by row span), // so the rBoxes array might be empty even some cells have been merged. @@ -2042,7 +2042,7 @@ SwUndoTableNumFormat::SwUndoTableNumFormat( const SwTableBox& rBox, m_nNodePos = rBox.IsValidNumTextNd( nullptr == pNewSet ); SwDoc* pDoc = rBox.GetFrameFormat()->GetDoc(); - if( ULONG_MAX != m_nNodePos ) + if( NODE_OFFSET_MAX != m_nNodePos ) { SwTextNode* pTNd = pDoc->GetNodes()[ m_nNodePos ]->GetTextNode(); @@ -2116,7 +2116,7 @@ void SwUndoTableNumFormat::UndoImpl(::sw::UndoRedoContext & rContext) pFormat->SetFormatAttr( *m_pBoxSet ); pBox->ChgFrameFormat( pFormat ); - if( ULONG_MAX == m_nNodePos ) + if( NODE_OFFSET_MAX == m_nNodePos ) return; SwTextNode* pTextNd = rDoc.GetNodes()[ m_nNodePos ]->GetTextNode(); @@ -2302,12 +2302,12 @@ void UndoTableCpyTable_Entry::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterStartElement(pWriter, BAD_CAST("nBoxIdx")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), - BAD_CAST(OString::number(nBoxIdx).getStr())); + BAD_CAST(OString::number(sal_Int32(nBoxIdx)).getStr())); (void)xmlTextWriterEndElement(pWriter); (void)xmlTextWriterStartElement(pWriter, BAD_CAST("nOffset")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), - BAD_CAST(OString::number(nOffset).getStr())); + BAD_CAST(OString::number(sal_Int32(nOffset)).getStr())); (void)xmlTextWriterEndElement(pWriter); if (pBoxNumAttr) @@ -2352,7 +2352,7 @@ void SwUndoTableCpyTable::UndoImpl(::sw::UndoRedoContext & rContext) for (size_t n = m_vArr.size(); n; ) { UndoTableCpyTable_Entry *const pEntry = m_vArr[ --n ].get(); - sal_uLong nSttPos = pEntry->nBoxIdx + pEntry->nOffset; + SwNodeOffset nSttPos = pEntry->nBoxIdx + pEntry->nOffset; SwStartNode* pSNd = rDoc.GetNodes()[ nSttPos ]->StartOfSectionNode(); if( !pTableNd ) pTableNd = pSNd->FindTableNode(); @@ -2511,7 +2511,7 @@ void SwUndoTableCpyTable::RedoImpl(::sw::UndoRedoContext & rContext) for (size_t n = 0; n < m_vArr.size(); ++n) { UndoTableCpyTable_Entry *const pEntry = m_vArr[ n ].get(); - sal_uLong nSttPos = pEntry->nBoxIdx + pEntry->nOffset; + SwNodeOffset nSttPos = pEntry->nBoxIdx + pEntry->nOffset; SwStartNode* pSNd = rDoc.GetNodes()[ nSttPos ]->StartOfSectionNode(); if( !pTableNd ) pTableNd = pSNd->FindTableNode(); @@ -2790,7 +2790,7 @@ void SwUndoCpyTable::UndoImpl(::sw::UndoRedoContext & rContext) pNextNd->SetAttr( *pItem ); } - SwPaM aPam( *pTNd, *pTNd->EndOfSectionNode(), 0 , 1 ); + SwPaM aPam( *pTNd, *pTNd->EndOfSectionNode(), SwNodeOffset(0) , SwNodeOffset(1) ); m_pDelete.reset( new SwUndoDelete( aPam, true ) ); } diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index ff25eb387c08..2e53ff2d9c20 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -38,7 +38,7 @@ namespace sw { std::optional<std::vector<SwFrameFormat*>> -GetFlysAnchoredAt(SwDoc & rDoc, sal_uLong const nSttNode) +GetFlysAnchoredAt(SwDoc & rDoc, SwNodeOffset const nSttNode) { std::optional<std::vector<SwFrameFormat*>> pFrameFormats; const size_t nArrLen = rDoc.GetSpzFrameFormats()->size(); @@ -112,7 +112,7 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam ) // Flys, anchored to any paragraph, but not first and last, are handled by DelContentIndex (see SwUndoInserts::UndoImpl) and are not stored in m_FlyUndos. void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool bScanFlys, - int const nDeleteTextNodes) + SwNodeOffset const nDeleteTextNodes) { const SwPosition* pTmpPos = rPam.End(); m_nEndNode = pTmpPos->nNode.GetIndex(); @@ -128,7 +128,7 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool bScanFlys, m_nSttContent = pTmpPos->nContent.GetIndex(); m_nDeleteTextNodes = nDeleteTextNodes; - if (m_nDeleteTextNodes == 0) // if a table selection is added... + if (m_nDeleteTextNodes == SwNodeOffset(0)) // if a table selection is added... { ++m_nSttNode; // ... then the CopyPam is not fully correct } @@ -153,7 +153,7 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool bScanFlys, m_pFrameFormats->end() == ( it = std::find( m_pFrameFormats->begin(), m_pFrameFormats->end(), pFormat ) ) ) { std::shared_ptr<SwUndoInsLayFormat> const pFlyUndo = - std::make_shared<SwUndoInsLayFormat>(pFormat, 0, 0); + std::make_shared<SwUndoInsLayFormat>(pFormat, SwNodeOffset(0), 0); m_FlyUndos.push_back(pFlyUndo); } else @@ -172,7 +172,7 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool bScanFlys, that the Undo/Redo run in inverse order. */ bool SwUndoInserts::IsCreateUndoForNewFly(SwFormatAnchor const& rAnchor, - sal_uLong const nStartNode, sal_uLong const nEndNode) + SwNodeOffset const nStartNode, SwNodeOffset const nEndNode) { assert(nStartNode <= nEndNode); @@ -258,7 +258,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) SwDoc& rDoc = rContext.GetDoc(); SwPaM& rPam = AddUndoRedoPaM(rContext); - m_nNodeDiff = 0; + m_nNodeDiff = SwNodeOffset(0); if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() )) rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, RedlineType::Any); @@ -293,7 +293,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) // indexes if (!m_FlyUndos.empty()) { - sal_uLong nTmp = rPam.GetPoint()->nNode.GetIndex(); + SwNodeOffset nTmp = rPam.GetPoint()->nNode.GetIndex(); for (size_t n = m_FlyUndos.size(); 0 < n; --n) { m_FlyUndos[ n-1 ]->UndoImpl(rContext); @@ -305,7 +305,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) { // are there Footnotes or ContentFlyFrames in text? m_nSetPos = m_pHistory->Count(); - sal_uLong nTmp = rPam.GetMark()->nNode.GetIndex(); + SwNodeOffset nTmp = rPam.GetMark()->nNode.GetIndex(); DelContentIndex(*rPam.GetMark(), *rPam.GetPoint(), DelContentType::AllMask|DelContentType::ExcludeFlyAtStartEnd); m_nNodeDiff += nTmp - rPam.GetMark()->nNode.GetIndex(); @@ -315,7 +315,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) new SwNodeIndex(rDoc.GetNodes().GetEndOfContent())); MoveToUndoNds(rPam, m_pUndoNodeIndex.get()); - if (m_nDeleteTextNodes == 0) + if (m_nDeleteTextNodes == SwNodeOffset(0)) { rPam.Move( fnMoveBackward, GoInContent ); } @@ -330,14 +330,14 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) if( !m_pTextFormatColl ) // if 0 than it's no TextNode -> delete { SwNodeIndex aDelIdx( rIdx ); - assert(0 < m_nDeleteTextNodes && m_nDeleteTextNodes < 3); - for (int i = 0; i < m_nDeleteTextNodes; ++i) + assert(SwNodeOffset(0) < m_nDeleteTextNodes && m_nDeleteTextNodes < SwNodeOffset(3)); + for (SwNodeOffset i(0); i < m_nDeleteTextNodes; ++i) { rPam.Move(fnMoveForward, GoInNode); } rPam.DeleteMark(); - for (int i = 0; i < m_nDeleteTextNodes; ++i) + for (SwNodeOffset i(0); i < m_nDeleteTextNodes; ++i) { RemoveIdxRel(aDelIdx.GetIndex() + i, *rPam.GetPoint()); } @@ -395,10 +395,10 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext) const bool bMvBkwrd = MovePtBackward(rPam); // re-insert content again (first detach m_pUndoNodeIndex!) - sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex(); + SwNodeOffset const nMvNd = m_pUndoNodeIndex->GetIndex(); m_pUndoNodeIndex.reset(); MoveFromUndoNds(rDoc, nMvNd, *rPam.GetMark()); - if (m_nDeleteTextNodes != 0) + if (m_nDeleteTextNodes != SwNodeOffset(0)) { MovePtForward(rPam, bMvBkwrd); } diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 4c096178bab4..582c09942c80 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -585,7 +585,7 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData OUString aChartTableName; const SwNodes& rNodes = m_pDoc->GetNodes(); - for( sal_uLong nN = rNodes.Count(); nN--; ) + for( SwNodeOffset nN = rNodes.Count(); nN--; ) { SwNode* pNode = rNodes[nN]; if( !pNode ) diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 5f49d500c305..a04004124dd1 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -456,7 +456,7 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getNextPara() else // non-automatic checking { const SwNodes& rNodes = mpDoc->GetNodes(); - const sal_uLong nMaxNodes = rNodes.Count(); + const SwNodeOffset nMaxNodes = rNodes.Count(); while ( mnCurrentNode < mnEndNode && mnCurrentNode < nMaxNodes ) { @@ -470,8 +470,8 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getNextPara() if ( mnCurrentNode == mnEndNode ) { - mnCurrentNode = 0; - mnEndNode = 0; + mnCurrentNode = SwNodeOffset(0); + mnEndNode = SwNodeOffset(0); } } } @@ -518,7 +518,7 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaAfter(co SwTextNode* pNextTextNode = nullptr; const SwNodes& rNodes = pCurrentNode->GetDoc().GetNodes(); - for( sal_uLong nCurrentNode = pCurrentNode->GetIndex() + 1; nCurrentNode < rNodes.Count(); ++nCurrentNode ) + for( SwNodeOffset nCurrentNode = pCurrentNode->GetIndex() + 1; nCurrentNode < rNodes.Count(); ++nCurrentNode ) { SwNode* pNd = rNodes[ nCurrentNode ]; pNextTextNode = dynamic_cast<SwTextNode*>(pNd); @@ -564,7 +564,7 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(c SwTextNode* pPrevTextNode = nullptr; const SwNodes& rNodes = pCurrentNode->GetDoc().GetNodes(); - for( sal_uLong nCurrentNode = pCurrentNode->GetIndex() - 1; nCurrentNode > 0; --nCurrentNode ) + for( SwNodeOffset nCurrentNode = pCurrentNode->GetIndex() - 1; nCurrentNode > SwNodeOffset(0); --nCurrentNode ) { SwNode* pNd = rNodes[ nCurrentNode ]; pPrevTextNode = dynamic_cast<SwTextNode*>(pNd); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 0f12e6f84c6c..d4f064751b4a 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -621,17 +621,17 @@ SwUnoCursorHelper::GetCurTextFormatColl(SwPaM & rPaM, const bool bConditional) SwPaM *pTmpCursor = &rPaM; do { - const sal_uLong nSttNd = pTmpCursor->Start()->nNode.GetIndex(); - const sal_uLong nEndNd = pTmpCursor->End()->nNode.GetIndex(); + const SwNodeOffset nSttNd = pTmpCursor->Start()->nNode.GetIndex(); + const SwNodeOffset nEndNd = pTmpCursor->End()->nNode.GetIndex(); - if( nEndNd - nSttNd >= nMaxLookup ) + if( nEndNd - nSttNd >= SwNodeOffset(nMaxLookup) ) { pFormat = nullptr; break; } const SwNodes& rNds = rPaM.GetDoc().GetNodes(); - for( sal_uLong n = nSttNd; n <= nEndNd; ++n ) + for( SwNodeOffset n = nSttNd; n <= nEndNd; ++n ) { SwTextNode const*const pNd = rNds[ n ]->GetTextNode(); if( pNd ) @@ -2810,7 +2810,7 @@ SwXTextCursor::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor) SwPosition & rEnd = *rUnoCursor.End(); SwNodeIndex aPrevIdx( rStart.nNode, -1 ); - const sal_uLong nOffset = rEnd.nNode.GetIndex() - rStart.nNode.GetIndex(); + const SwNodeOffset nOffset = rEnd.nNode.GetIndex() - rStart.nNode.GetIndex(); const sal_Int32 nCntStt = rStart.nContent.GetIndex(); rUnoCursor.GetDoc().SortText(rUnoCursor, aSortOpt); diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index a70dbb5722bd..1bfe4fae6ae3 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -303,10 +303,10 @@ void SwUnoCursorHelper::GetCursorAttr(SwPaM & rPam, { SwPosition const & rStart( *rCurrent.Start() ); SwPosition const & rEnd( *rCurrent.End() ); - const sal_uLong nSttNd = rStart.nNode.GetIndex(); - const sal_uLong nEndNd = rEnd .nNode.GetIndex(); + const SwNodeOffset nSttNd = rStart.nNode.GetIndex(); + const SwNodeOffset nEndNd = rEnd .nNode.GetIndex(); - if (nEndNd - nSttNd >= nMaxLookup) + if (nEndNd - nSttNd >= SwNodeOffset(nMaxLookup)) { rSet.ClearItem(); rSet.InvalidateAllItems(); @@ -315,7 +315,7 @@ void SwUnoCursorHelper::GetCursorAttr(SwPaM & rPam, // the first node inserts the values into the get set // all other nodes merge their values into the get set - for (sal_uLong n = nSttNd; n <= nEndNd; ++n) + for (SwNodeOffset n = nSttNd; n <= nEndNd; ++n) { SwNode *const pNd = rPam.GetDoc().GetNodes()[ n ]; switch (pNd->GetNodeType()) @@ -368,7 +368,7 @@ struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration /// embedded tables. SwStartNode const*const m_pOwnStartNode; SwTable const*const m_pOwnTable; - const sal_uLong m_nEndIndex; + const SwNodeOffset m_nEndIndex; sal_Int32 m_nFirstParaStart; sal_Int32 m_nLastParaEnd; bool m_bFirstParagraph; diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index a54a6ec885d7..f0d784658f57 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -208,7 +208,7 @@ uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName ) SwNodeIndex* pNodeIdx = m_rRedline.GetContentIdx(); if(pNodeIdx ) { - if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) ) + if ( SwNodeOffset(1) < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) ) { SwUnoCursor& rUnoCursor = GetCursor(); uno::Reference<text::XText> xRet = new SwXRedlineText(&rUnoCursor.GetDoc(), *pNodeIdx); @@ -320,7 +320,7 @@ uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties SwNodeIndex* pNodeIdx = rRedline.GetContentIdx(); if(pNodeIdx ) { - if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) ) + if ( SwNodeOffset(1) < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) ) { uno::Reference<text::XText> xRet = new SwXRedlineText(&rRedline.GetDoc(), *pNodeIdx); pRet[nPropIdx].Name = UNO_NAME_REDLINE_TEXT; @@ -451,7 +451,7 @@ uno::Any SwXRedline::getPropertyValue( const OUString& rPropertyName ) SwNodeIndex* pNodeIdx = m_pRedline->GetContentIdx(); if( pNodeIdx ) { - if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) ) + if ( SwNodeOffset(1) < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) ) { uno::Reference<text::XText> xRet = new SwXRedlineText(m_pDoc, *pNodeIdx); aRet <<= xRet; diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index cb370088e713..4ce35ed11d4a 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -698,8 +698,8 @@ void sw_setValue( SwXCell &rCell, double nVal ) if(!rCell.IsValid()) return; // first this text (maybe) needs to be deleted - sal_uLong nNdPos = rCell.m_pBox->IsValidNumTextNd(); - if(ULONG_MAX != nNdPos) + SwNodeOffset nNdPos = rCell.m_pBox->IsValidNumTextNd(); + if(NODE_OFFSET_MAX != nNdPos) sw_setString( rCell, OUString(), true ); // true == keep number format SwDoc* pDoc = rCell.GetDoc(); UnoActionContext aAction(pDoc); @@ -853,8 +853,8 @@ void SwXCell::setFormula(const OUString& rFormula) if(!IsValid()) return; // first this text (maybe) needs to be deleted - sal_uInt32 nNdPos = m_pBox->IsValidNumTextNd(); - if(USHRT_MAX == nNdPos) + SwNodeOffset nNdPos = m_pBox->IsValidNumTextNd(); + if(SwNodeOffset(USHRT_MAX) == nNdPos) sw_setString( *this, OUString(), true ); OUString sFormula(comphelper::string::stripStart(rFormula, ' ')); if( !sFormula.isEmpty() && '=' == sFormula[0] ) diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 82f9a00e6cde..2ad7fce679d8 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1142,7 +1142,7 @@ SwXText::getPropertyValue( if (nRedTableCount > 0) { SwStartNode const*const pStartNode = GetStartNode(); - const sal_uLong nOwnIndex = pStartNode->EndOfSectionIndex(); + const SwNodeOffset nOwnIndex = pStartNode->EndOfSectionIndex(); for (size_t nRed = 0; nRed < nRedTableCount; ++nRed) { SwRangeRedline const*const pRedline = rRedTable[nRed]; @@ -1944,9 +1944,9 @@ void SwXText::Impl::ConvertCell( else { // check the predecessor - const sal_uLong nStartCellNodeIndex = + const SwNodeOffset nStartCellNodeIndex = aStartCellPam.Start()->nNode.GetIndex(); - const sal_uLong nLastNodeEndIndex = pLastCell->aEnd.GetIndex(); + const SwNodeOffset nLastNodeEndIndex = pLastCell->aEnd.GetIndex(); if (nLastNodeEndIndex == nStartCellNodeIndex) { // same node as predecessor then equal nContent? @@ -1956,7 +1956,7 @@ void SwXText::Impl::ConvertCell( } m_pDoc->getIDocumentContentOperations().SplitNode(*aStartCellPam.Start(), false); - sal_uLong const nNewIndex(aStartCellPam.Start()->nNode.GetIndex()); + SwNodeOffset const nNewIndex(aStartCellPam.Start()->nNode.GetIndex()); if (nNewIndex != nStartCellNodeIndex) { // aStartCellPam now points to the 2nd node @@ -2279,7 +2279,7 @@ SwXText::copyText( { SwTextNode * pFirstNode; { - SwPaM temp(*pSource->GetStartNode(), *pSource->GetStartNode()->EndOfSectionNode(), +1, -1); + SwPaM temp(*pSource->GetStartNode(), *pSource->GetStartNode()->EndOfSectionNode(), SwNodeOffset(+1), SwNodeOffset(-1)); pFirstNode = temp.GetMark()->nNode.GetNode().GetTextNode(); if (pFirstNode) { diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index c2312effadcc..01cf3fd8cbef 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -160,7 +160,7 @@ ErrCode SwASCIIParser::CallParser() if (!m_bNewDoc) { const SwNodeIndex& rTmp = m_pPam->GetPoint()->nNode; - pInsPam.emplace( rTmp, rTmp, 0, -1 ); + pInsPam.emplace( rTmp, rTmp, SwNodeOffset(0), SwNodeOffset(-1) ); nSttContent = m_pPam->GetPoint()->nContent.GetIndex(); } diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx index 1bba438e87e8..e13b4efc9414 100644 --- a/sw/source/filter/ascii/wrtasc.cxx +++ b/sw/source/filter/ascii/wrtasc.cxx @@ -101,10 +101,10 @@ ErrCode SwASCWriter::WriteStream() case LINEEND_CRLF: m_sLineEnd = "\015\012"; break; } - tools::Long nMaxNode = m_pDoc->GetNodes().Count(); + SwNodeOffset nMaxNode = m_pDoc->GetNodes().Count(); if( m_bShowProgress ) - ::StartProgress( STR_STATSTR_W4WWRITE, 0, nMaxNode, m_pDoc->GetDocShell() ); + ::StartProgress( STR_STATSTR_W4WWRITE, 0, sal_Int32(nMaxNode), m_pDoc->GetDocShell() ); SwPaM* pPam = m_pOrigPam; @@ -191,7 +191,7 @@ ErrCode SwASCWriter::WriteStream() break; if( m_bShowProgress ) - ::SetProgressState( m_pCurrentPam->GetPoint()->nNode.GetIndex(), + ::SetProgressState( sal_Int32(m_pCurrentPam->GetPoint()->nNode.GetIndex()), m_pDoc->GetDocShell() ); // How far? } diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index fee1828cd453..c6cd47ace34a 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -108,7 +108,7 @@ bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode const e // does this range actually contain something? // empty range is allowed if at start of empty paragraph // fields are special: never have range, so leave them - sal_uLong nMk = rMkPos.m_nNode.GetIndex() + 1; + SwNodeOffset nMk = rMkPos.m_nNode.GetIndex() + 1; const SwNodes& rMkNodes = rMkPos.m_nNode.GetNodes(); if (nMk >= rMkNodes.Count()) return false; @@ -132,7 +132,7 @@ bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode const e rRegion.SetMark(); if (rMkPos.m_nNode != rPtPos.m_nNode) { - sal_uLong n = rPtPos.m_nNode.GetIndex() + 1; + SwNodeOffset n = rPtPos.m_nNode.GetIndex() + 1; SwNodes& rNodes = rRegion.GetPoint()->nNode.GetNodes(); if (n >= rNodes.Count()) return false; @@ -183,7 +183,7 @@ SwFltControlStack::~SwFltControlStack() // same paragraph further out by one character. void SwFltControlStack::MoveAttrs(const SwPosition& rPos, MoveAttrsMode eMode) { - sal_uLong nPosNd = rPos.nNode.GetIndex(); + SwNodeOffset nPosNd = rPos.nNode.GetIndex(); sal_uInt16 nPosCt = rPos.nContent.GetIndex() - 1; for (size_t i = 0, nCnt = m_Entries.size(); i < nCnt; ++i) @@ -432,7 +432,7 @@ static bool MakePoint(const SwFltStackEntry& rEntry, SwDoc& rDoc, // attribute's format needs to be set. rRegion.DeleteMark(); - sal_uLong nMk = rEntry.m_aMkPos.m_nNode.GetIndex() + 1; + SwNodeOffset nMk = rEntry.m_aMkPos.m_nNode.GetIndex() + 1; const SwNodes& rMkNodes = rEntry.m_aMkPos.m_nNode.GetNodes(); if (nMk >= rMkNodes.Count()) return false; diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 792ca0b69e3a..2321b6b4e9a7 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -170,7 +170,7 @@ ErrCode SwReader::Read( const Reader& rOptions ) { // set Pam to the previous node, so that it is not also moved const SwNodeIndex& rTmp = pPam->GetPoint()->nNode; - pUndoPam.emplace( rTmp, rTmp, 0, -1 ); + pUndoPam.emplace( rTmp, rTmp, SwNodeOffset(0), SwNodeOffset(-1) ); } // store for now all Fly's @@ -267,7 +267,7 @@ ErrCode SwReader::Read( const Reader& rOptions ) // UGLY: temp. enable undo mxDoc->GetIDocumentUndoRedo().DoUndo(true); mxDoc->GetIDocumentUndoRedo().AppendUndo( - std::make_unique<SwUndoInsLayFormat>( pFrameFormat,0,0 ) ); + std::make_unique<SwUndoInsLayFormat>( pFrameFormat, SwNodeOffset(0), 0 ) ); mxDoc->GetIDocumentUndoRedo().DoUndo(false); mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); } @@ -375,7 +375,7 @@ ErrCode SwReader::Read( const Reader& rOptions ) // not insert: set the redline mode read from settings.xml eOld = ePostReadRedlineFlags & ~RedlineFlags::Ignore; - mxDoc->getIDocumentFieldsAccess().SetFieldsDirty(false, nullptr, 0); + mxDoc->getIDocumentFieldsAccess().SetFieldsDirty(false, nullptr, SwNodeOffset(0)); } mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx index 06ac581de29c..a24de2416bcb 100644 --- a/sw/source/filter/docx/swdocxreader.cxx +++ b/sw/source/filter/docx/swdocxreader.cxx @@ -156,7 +156,7 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks ) SwNodeIndex aStart( *aDocEnd.GetNode().StartOfSectionNode(), 1 ); bool bIsAutoText = false; - if( aStart < aDocEnd && ( aDocEnd.GetIndex() - aStart.GetIndex() > 2 ) ) + if( aStart < aDocEnd && ( aDocEnd.GetIndex() - aStart.GetIndex() > SwNodeOffset(2) ) ) { SwTextFormatColl* pColl = pD->getIDocumentStylePoolAccess().GetTextCollFromPool (RES_POOLCOLL_STANDARD, false); diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index ae2e4bb69611..856148d9e115 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -2120,7 +2120,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) 40 == static_cast<const SvxFontHeightItem *>(pItem)->GetHeight() ) { // ... moreover, the 2pt font is set ... - sal_uLong nNdPos = rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex(); + SwNodeOffset nNdPos = rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex(); const SwNode *pNextNd = rWrt.m_pDoc->GetNodes()[nNdPos+1]; const SwNode *pPrevNd = rWrt.m_pDoc->GetNodes()[nNdPos-1]; bool bStdColl = nPoolId == RES_POOLCOLL_STANDARD; diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 001e8bca5dd5..6677b620f8d9 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -617,7 +617,7 @@ void SwHTMLParser::InsertComment( const OUString& rComment, const char *pTag ) { bMoveFwd = true; - sal_uLong nNodeIdx = m_pPam->GetPoint()->nNode.GetIndex(); + SwNodeOffset nNodeIdx = m_pPam->GetPoint()->nNode.GetIndex(); const sal_Int32 nIdx = m_pPam->GetPoint()->nContent.GetIndex(); for( auto i = m_aSetAttrTab.size(); i > 0; ) { diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index fc7bf6edbc80..73ab34c60616 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -194,7 +194,7 @@ sal_uInt16 SwHTMLWriter::GuessFrameType( const SwFrameFormat& rFrameFormat, eType = HTML_FRMTYPE_TEXT; const SwFormatContent& rFlyContent = rFrameFormat.GetContent(); - sal_uLong nStt = rFlyContent.GetContentIdx()->GetIndex()+1; + SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex()+1; const SwNode* pNd = m_pDoc->GetNodes()[ nStt ]; if( pNd->IsGrfNode() ) @@ -209,7 +209,7 @@ sal_uInt16 SwHTMLWriter::GuessFrameType( const SwFrameFormat& rFrameFormat, } else { - sal_uLong nEnd = m_pDoc->GetNodes()[nStt-1]->EndOfSectionIndex(); + SwNodeOffset nEnd = m_pDoc->GetNodes()[nStt-1]->EndOfSectionIndex(); const SfxPoolItem* pItem; const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet(); @@ -223,7 +223,7 @@ sal_uInt16 SwHTMLWriter::GuessFrameType( const SwFrameFormat& rFrameFormat, else if( pNd->IsTableNode() ) { const SwTableNode *pTableNd = pNd->GetTableNode(); - sal_uLong nTableEnd = pTableNd->EndOfSectionIndex(); + SwNodeOffset nTableEnd = pTableNd->EndOfSectionIndex(); if( nTableEnd+1 == nEnd ) { @@ -250,7 +250,7 @@ sal_uInt16 SwHTMLWriter::GuessFrameType( const SwFrameFormat& rFrameFormat, { for( auto & pHTMLPosFlyFrame : *m_pHTMLPosFlyFrames ) { - sal_uLong nIdx = pHTMLPosFlyFrame->GetNdIndex().GetIndex(); + SwNodeOffset nIdx = pHTMLPosFlyFrame->GetNdIndex().GetIndex(); bEmpty = (nIdx != nStt) && (nIdx != nStt-1); if( !bEmpty || nIdx > nStt ) break; @@ -355,7 +355,7 @@ void SwHTMLWriter::CollectFlyFrames() } } -bool SwHTMLWriter::OutFlyFrame( sal_uLong nNdIdx, sal_Int32 nContentIdx, HtmlPosition nPos, +bool SwHTMLWriter::OutFlyFrame( SwNodeOffset nNdIdx, sal_Int32 nContentIdx, HtmlPosition nPos, HTMLOutContext *pContext ) { bool bFlysLeft = false; // Are there still Flys left at the current node position? @@ -1540,8 +1540,8 @@ static Writer& OutHTML_FrameFormatTableNode( Writer& rWrt, const SwFrameFormat& SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt); const SwFormatContent& rFlyContent = rFrameFormat.GetContent(); - sal_uLong nStt = rFlyContent.GetContentIdx()->GetIndex()+1; - sal_uLong nEnd = rHTMLWrt.m_pDoc->GetNodes()[nStt-1]->EndOfSectionIndex(); + SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex()+1; + SwNodeOffset nEnd = rHTMLWrt.m_pDoc->GetNodes()[nStt-1]->EndOfSectionIndex(); OUString aCaption; bool bTopCaption = false; @@ -1559,7 +1559,7 @@ static Writer& OutHTML_FrameFormatTableNode( Writer& rWrt, const SwFrameFormat& OSL_ENSURE( pTableNd, "Frame does not contain a table" ); if( pTableNd ) { - sal_uLong nTableEnd = pTableNd->EndOfSectionIndex(); + SwNodeOffset nTableEnd = pTableNd->EndOfSectionIndex(); OSL_ENSURE( nTableEnd == nEnd - 1 || (nTableEnd == nEnd - 2 && !bTopCaption), "Invalid frame content for a table" ); @@ -1641,7 +1641,7 @@ static Writer & OutHTML_FrameFormatAsMulticol( Writer& rWrt, rHTMLWrt.IncIndentLevel(); // indent the content of Multicol const SwFormatContent& rFlyContent = rFrameFormat.GetContent(); - sal_uLong nStt = rFlyContent.GetContentIdx()->GetIndex(); + SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex(); const SwStartNode* pSttNd = rWrt.m_pDoc->GetNodes()[nStt]->GetStartNode(); OSL_ENSURE( pSttNd, "Where is the start node" ); @@ -1724,7 +1724,7 @@ static Writer& OutHTML_FrameFormatAsDivOrSpan( Writer& rWrt, rHTMLWrt.m_bLFPossible = true; const SwFormatContent& rFlyContent = rFrameFormat.GetContent(); - sal_uLong nStt = rFlyContent.GetContentIdx()->GetIndex(); + SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex(); // Output frame-anchored frames that are anchored to the start node rHTMLWrt.OutFlyFrame( nStt, 0, HtmlPosition::Any ); @@ -1899,7 +1899,7 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rF return rWrt; const SwFormatContent& rFlyContent = rFrameFormat.GetContent(); - sal_uLong nStt = rFlyContent.GetContentIdx()->GetIndex()+1; + SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex()+1; SwGrfNode *pGrfNd = rHTMLWrt.m_pDoc->GetNodes()[ nStt ]->GetGrfNode(); OSL_ENSURE( pGrfNd, "Grf node expected" ); if( !pGrfNd ) @@ -2097,7 +2097,7 @@ Writer& OutHTML_HeaderFooter( Writer& rWrt, const SwFrameFormat& rFrameFormat, } const SwFormatContent& rFlyContent = rFrameFormat.GetContent(); - sal_uLong nStt = rFlyContent.GetContentIdx()->GetIndex(); + SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex(); const SwStartNode* pSttNd = rWrt.m_pDoc->GetNodes()[nStt]->GetStartNode(); OSL_ENSURE( pSttNd, "Where is the start node" ); @@ -2199,7 +2199,7 @@ void SwHTMLWriter::AddLinkTarget( const OUString& rURL ) SwPosition aPos( *m_pCurrentPam->GetPoint() ); if( m_pDoc->GotoOutline( aPos, aOutline ) ) { - sal_uInt32 nIdx = aPos.nNode.GetIndex(); + SwNodeOffset nIdx = aPos.nNode.GetIndex(); decltype(m_aOutlineMarkPoss)::size_type nIns=0; while( nIns < m_aOutlineMarkPoss.size() && diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 3e30352f326b..eaf475ceb603 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -214,7 +214,7 @@ static bool lcl_html_isHTMLControl( sal_Int16 nClassId ) bool SwHTMLWriter::HasControls() const { - sal_uInt32 nStartIdx = m_pCurrentPam->GetPoint()->nNode.GetIndex(); + SwNodeOffset nStartIdx = m_pCurrentPam->GetPoint()->nNode.GetIndex(); size_t i = 0; // Skip all controls in front of the current paragraph @@ -242,7 +242,7 @@ void SwHTMLWriter::OutForm( bool bTag_On, const SwStartNode *pStartNd ) } uno::Reference< container::XIndexContainer > xNewFormComps; - sal_uInt32 nStartIdx = pStartNd ? pStartNd->GetIndex() + SwNodeOffset nStartIdx = pStartNd ? pStartNd->GetIndex() : m_pCurrentPam->GetPoint()->nNode.GetIndex(); // skip controls before the interesting area @@ -267,7 +267,7 @@ void SwHTMLWriter::OutForm( bool bTag_On, const SwStartNode *pStartNd ) uno::Reference< container::XIndexContainer > xCurrentFormComps;// current form in table const SwStartNode *pCurrentStNd = nullptr; // and the start node of a Control sal_Int32 nCurrentCtrls = 0; // and the found controls in it - sal_uInt32 nEndIdx = pStartNd->EndOfSectionIndex(); + SwNodeOffset nEndIdx = pStartNd->EndOfSectionIndex(); for( ; i < m_aHTMLControls.size() && m_aHTMLControls[i]->nNdIdx <= nEndIdx; i++ ) { @@ -1282,7 +1282,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, */ static void AddControl( HTMLControls& rControls, const SdrUnoObj& rFormObj, - sal_uInt32 nNodeIdx ) + SwNodeOffset nNodeIdx ) { const uno::Reference< awt::XControlModel >& xControlModel = rFormObj.GetUnoControlModel(); @@ -1358,7 +1358,7 @@ void SwHTMLWriter::GetControls() HTMLControl::HTMLControl( const uno::Reference< container::XIndexContainer > & rFormComps, - sal_uInt32 nIdx ) : + SwNodeOffset nIdx ) : xFormComps( rFormComps ), nNdIdx( nIdx ), nCount( 1 ) {} diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 592475dfa3cd..5c47810c4c59 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -113,8 +113,8 @@ void SwHTMLParser::ConnectImageMaps() { SwNodes& rNds = m_xDoc->GetNodes(); // on the first node of section #1 - sal_uLong nIdx = rNds.GetEndOfAutotext().StartOfSectionIndex() + 1; - sal_uLong nEndIdx = rNds.GetEndOfAutotext().GetIndex(); + SwNodeOffset nIdx = rNds.GetEndOfAutotext().StartOfSectionIndex() + 1; + SwNodeOffset nEndIdx = rNds.GetEndOfAutotext().GetIndex(); SwGrfNode* pGrfNd; while( m_nMissingImgMaps > 0 && nIdx < nEndIdx ) @@ -1357,7 +1357,7 @@ void SwHTMLParser::InsertBookmark( const OUString& rName ) bool SwHTMLParser::HasCurrentParaBookmarks( bool bIgnoreStack ) const { bool bHasMarks = false; - sal_uLong nNodeIdx = m_pPam->GetPoint()->nNode.GetIndex(); + SwNodeOffset nNodeIdx = m_pPam->GetPoint()->nNode.GetIndex(); // first step: are there still bookmark in the attribute-stack? // bookmarks are added to the end of the stack - thus we only have @@ -1386,7 +1386,7 @@ bool SwHTMLParser::HasCurrentParaBookmarks( bool bIgnoreStack ) const { const ::sw::mark::IMark* pBookmark = *ppMark; - const sal_uLong nBookNdIdx = pBookmark->GetMarkPos().nNode.GetIndex(); + const SwNodeOffset nBookNdIdx = pBookmark->GetMarkPos().nNode.GetIndex(); if( nBookNdIdx==nNodeIdx ) { bHasMarks = true; @@ -1407,7 +1407,7 @@ void SwHTMLParser::StripTrailingPara() bool bSetSmallFont = false; SwContentNode* pCNd = m_pPam->GetContentNode(); - sal_uLong nNodeIdx = m_pPam->GetPoint()->nNode.GetIndex(); + SwNodeOffset nNodeIdx = m_pPam->GetPoint()->nNode.GetIndex(); if( !m_pPam->GetPoint()->nContent.GetIndex() ) { if( pCNd && pCNd->StartOfSectionIndex() + 2 < @@ -1451,7 +1451,7 @@ void SwHTMLParser::StripTrailingPara() { ::sw::mark::IMark* pMark = *ppMark; - sal_uLong nBookNdIdx = pMark->GetMarkPos().nNode.GetIndex(); + SwNodeOffset nBookNdIdx = pMark->GetMarkPos().nNode.GetIndex(); if(nBookNdIdx==nNodeIdx) { SwNodeIndex nNewNdIdx(m_pPam->GetPoint()->nNode); diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx index 7fe8ec110661..7df3402dda35 100644 --- a/sw/source/filter/html/htmlnumwriter.cxx +++ b/sw/source/filter/html/htmlnumwriter.cxx @@ -37,7 +37,7 @@ void SwHTMLWriter::FillNextNumInfo() { m_pNextNumRuleInfo = nullptr; - sal_uLong nPos = m_pCurrentPam->GetPoint()->nNode.GetIndex() + 1; + SwNodeOffset nPos = m_pCurrentPam->GetPoint()->nNode.GetIndex() + 1; bool bTable = false; do @@ -98,7 +98,7 @@ Writer& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, { // If the list only consists of non-numbered text nodes, then don't start the list. bool bAtLeastOneNumbered = false; - sal_uLong nPos = rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex() + 1; + SwNodeOffset nPos = rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex() + 1; SwNumRule* pNumRule = nullptr; while (true) { @@ -147,7 +147,7 @@ Writer& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, bStartValue = true; if( rInfo.GetDepth() > 1 ) { - sal_uLong nPos = + SwNodeOffset nPos = rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex() + 1; do { @@ -340,7 +340,7 @@ Writer& OutHTML_NumberBulletListEnd( SwHTMLWriter& rWrt, { // If the list only consisted of non-numbered text nodes, then don't end the list. bool bAtLeastOneNumbered = false; - sal_uLong nPos = rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex() - 1; + SwNodeOffset nPos = rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex() - 1; SwNumRule* pNumRule = nullptr; while (true) { diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index cc10834228e9..fdd7bd675954 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1195,7 +1195,7 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt); const SwFormatContent& rFlyContent = rFrameFormat.GetContent(); - sal_uLong nStt = rFlyContent.GetContentIdx()->GetIndex()+1; + SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex()+1; SwOLENode *pOLENd = rHTMLWrt.m_pDoc->GetNodes()[ nStt ]->GetOLENode(); OSL_ENSURE( pOLENd, "OLE-Node expected" ); @@ -1457,7 +1457,7 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt); const SwFormatContent& rFlyContent = rFrameFormat.GetContent(); - sal_uLong nStt = rFlyContent.GetContentIdx()->GetIndex()+1; + SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex()+1; SwOLENode *pOLENd = rHTMLWrt.m_pDoc->GetNodes()[ nStt ]->GetOLENode(); OSL_ENSURE( pOLENd, "OLE-Node expected" ); diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index 99600517a0d4..9b212c0c5f4b 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -436,7 +436,7 @@ void SwHTMLParser::FixHeaderFooterDistance( bool bHeader, const SwFormatContent& rFlyContent = pHdFtFormat->GetContent(); const SwNodeIndex& rContentStIdx = *rFlyContent.GetContentIdx(); - sal_uLong nPrvNxtIdx; + SwNodeOffset nPrvNxtIdx; if( bHeader ) { nPrvNxtIdx = rContentStIdx.GetNode().EndOfSectionIndex()-1; @@ -794,7 +794,7 @@ void SwHTMLParser::InsertFlyFrame( const SfxItemSet& rItemSet, } void SwHTMLParser::MovePageDescAttrs( SwNode *pSrcNd, - sal_uLong nDestIdx, + SwNodeOffset nDestIdx, bool bFormatBreak ) { SwContentNode* pDestContentNd = diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index cbba52c6f119..7f39463b0fd6 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -5126,11 +5126,11 @@ std::shared_ptr<HTMLTable> SwHTMLParser::BuildTable(SvxAdjust eParentAdjust, // The last paragraph of the section is never part of the copy. // That's why the section needs to contain at least two paragraphs - if( pCapStNd->EndOfSectionIndex() - pCapStNd->GetIndex() > 2 ) + if( pCapStNd->EndOfSectionIndex() - pCapStNd->GetIndex() > SwNodeOffset(2) ) { // Don't copy start node and the last paragraph - SwNodeRange aSrcRg( *pCapStNd, 1, - *pCapStNd->EndOfSectionNode(), -1 ); + SwNodeRange aSrcRg( *pCapStNd, SwNodeOffset(1), + *pCapStNd->EndOfSectionNode(), SwNodeOffset(-1) ); bool bTop = m_xTable->IsTopCaption(); SwStartNode *pTableStNd = pTCntxt->GetTableNode(); diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index c083af828ba2..de0501203a92 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -269,7 +269,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, bool bHead = false; if( pSttNd ) { - sal_uLong nNdPos = pSttNd->GetIndex()+1; + SwNodeOffset nNdPos = pSttNd->GetIndex()+1; // determine the type of cell (TD/TH) SwNode* pNd; diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 25627a3f2d82..7250fb8e841d 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -610,7 +610,7 @@ SvParserState SwHTMLParser::CallParser() return eRet; } -bool SwHTMLParser::CanRemoveNode(sal_uLong nNodeIdx) const +bool SwHTMLParser::CanRemoveNode(SwNodeOffset nNodeIdx) const { const SwNode *pPrev = m_xDoc->GetNodes()[nNodeIdx - 1]; return pPrev->IsContentNode() || (pPrev->IsEndNode() && pPrev->StartOfSectionNode()->IsSectionNode()); @@ -805,7 +805,7 @@ void SwHTMLParser::Continue( HtmlTokenId nToken ) if( !pPos->nContent.GetIndex() && !bLFStripped ) { SwTextNode* pCurrentNd; - sal_uLong nNodeIdx = pPos->nNode.GetIndex(); + SwNodeOffset nNodeIdx = pPos->nNode.GetIndex(); bool bHasFlysOrMarks = HasCurrentParaFlys() || HasCurrentParaBookmarks( true ); @@ -2497,7 +2497,7 @@ void SwHTMLParser::AddParSpace() m_bNoParSpace = false; - sal_uLong nNdIdx = m_pPam->GetPoint()->nNode.GetIndex() - 1; + SwNodeOffset nNdIdx = m_pPam->GetPoint()->nNode.GetIndex() - 1; SwTextNode *pTextNode = m_xDoc->GetNodes()[nNdIdx]->GetTextNode(); if( !pTextNode ) @@ -2758,7 +2758,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, pAttr = m_aSetAttrTab[ --n ]; sal_uInt16 nWhich = pAttr->m_pItem->Which(); - sal_uLong nEndParaIdx = pAttr->GetEndParagraphIdx(); + SwNodeOffset nEndParaIdx = pAttr->GetEndParagraphIdx(); bool bSetAttr; if( bChkEnd ) { @@ -2782,7 +2782,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, { // Attributes in body nodes array section shouldn't be set if we are in a // special nodes array section, but vice versa it's possible. - sal_uLong nEndOfIcons = m_xDoc->GetNodes().GetEndOfExtras().GetIndex(); + SwNodeOffset nEndOfIcons = m_xDoc->GetNodes().GetEndOfExtras().GetIndex(); bSetAttr = nEndParaIdx < rEndIdx.GetIndex() || rEndIdx.GetIndex() > nEndOfIcons || nEndParaIdx <= nEndOfIcons; @@ -3014,7 +3014,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, OSL_ENSURE( RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId(), "Only At-Para flys need special handling" ); const SwPosition *pFlyPos = rAnchor.GetContentAnchor(); - sal_uLong nFlyParaIdx = pFlyPos->nNode.GetIndex(); + SwNodeOffset nFlyParaIdx = pFlyPos->nNode.GetIndex(); bool bMoveFly; if( bChkEnd ) { @@ -3024,7 +3024,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, } else { - sal_uLong nEndOfIcons = m_xDoc->GetNodes().GetEndOfExtras().GetIndex(); + SwNodeOffset nEndOfIcons = m_xDoc->GetNodes().GetEndOfExtras().GetIndex(); bMoveFly = nFlyParaIdx < rEndIdx.GetIndex() || rEndIdx.GetIndex() > nEndOfIcons || nFlyParaIdx <= nEndOfIcons; @@ -3366,8 +3366,8 @@ void SwHTMLParser::SplitAttrTab( std::shared_ptr<HTMLAttrTable> const & rNewAttr if( bMoveEndBack ) { - sal_uLong nOldEnd = nEndIdx.GetIndex(); - sal_uLong nTmpIdx; + SwNodeOffset nOldEnd = nEndIdx.GetIndex(); + SwNodeOffset nTmpIdx; if( ( nTmpIdx = m_xDoc->GetNodes().GetEndOfExtras().GetIndex()) >= nOldEnd || ( nTmpIdx = m_xDoc->GetNodes().GetEndOfAutotext().GetIndex()) >= nOldEnd ) { diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 6ed83640bad5..023a796b5f5c 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -157,8 +157,8 @@ public: HTMLAttr **pHd, const std::shared_ptr<HTMLAttrTable>& rAttrTab ); inline void SetStart( const SwPosition& rPos ); - sal_uInt32 GetStartParagraphIdx() const { return m_nStartPara.GetIndex(); } - sal_uInt32 GetEndParagraphIdx() const { return m_nEndPara.GetIndex(); } + SwNodeOffset GetStartParagraphIdx() const { return m_nStartPara.GetIndex(); } + SwNodeOffset GetEndParagraphIdx() const { return m_nEndPara.GetIndex(); } const SwNodeIndex& GetStartParagraph() const { return m_nStartPara; } const SwNodeIndex& GetEndParagraph() const { return m_nEndPara; } @@ -584,7 +584,7 @@ class SwHTMLParser : public SfxHTMLParser, public SvtListener short& nIndent ) const; void GetULSpaceFromContext( sal_uInt16 &rUpper, sal_uInt16 &rLower ) const; - void MovePageDescAttrs( SwNode *pSrcNd, sal_uLong nDestIdx, bool bFormatBreak ); + void MovePageDescAttrs( SwNode *pSrcNd, SwNodeOffset nDestIdx, bool bFormatBreak ); // Handling of tags at paragraph level @@ -868,7 +868,7 @@ private: // Remove empty paragraph at the PaM position void StripTrailingPara(); // If removing an empty node would corrupt the document - bool CanRemoveNode(sal_uLong nNodeIdx) const; + bool CanRemoveNode(SwNodeOffset nNodeIdx) const; // Are there fly frames in the current paragraph? bool HasCurrentParaFlys( bool bNoSurroundOnly = false, diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index a329b5c74f89..db4a0baad396 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -350,7 +350,7 @@ ErrCode SwHTMLWriter::WriteStream() } if( m_bShowProgress ) - ::StartProgress( STR_STATSTR_W4WWRITE, 0, m_pDoc->GetNodes().Count(), + ::StartProgress( STR_STATSTR_W4WWRITE, 0, sal_Int32(m_pDoc->GetNodes().Count()), m_pDoc->GetDocShell()); m_xDfltColor.reset(); @@ -588,7 +588,7 @@ static const SwFormatCol *lcl_html_GetFormatCol( const SwSection& rSection, return pCol; } -static bool lcl_html_IsMultiColStart( const SwHTMLWriter& rHTMLWrt, sal_uLong nIndex ) +static bool lcl_html_IsMultiColStart( const SwHTMLWriter& rHTMLWrt, SwNodeOffset nIndex ) { bool bRet = false; const SwSectionNode *pSectNd = @@ -604,7 +604,7 @@ static bool lcl_html_IsMultiColStart( const SwHTMLWriter& rHTMLWrt, sal_uLong nI return bRet; } -static bool lcl_html_IsMultiColEnd( const SwHTMLWriter& rHTMLWrt, sal_uLong nIndex ) +static bool lcl_html_IsMultiColEnd( const SwHTMLWriter& rHTMLWrt, SwNodeOffset nIndex ) { bool bRet = false; const SwEndNode *pEndNd = rHTMLWrt.m_pDoc->GetNodes()[nIndex]->GetEndNode(); @@ -743,8 +743,8 @@ static Writer& OutHTML_Section( Writer& rWrt, const SwSectionNode& rSectNd ) const SwSection *pSurrSection = nullptr; const SwFormatCol *pSurrCol = nullptr; - sal_uInt32 nSectSttIdx = rSectNd.GetIndex(); - sal_uInt32 nSectEndIdx = rSectNd.EndOfSectionIndex(); + SwNodeOffset nSectSttIdx = rSectNd.GetIndex(); + SwNodeOffset nSectEndIdx = rSectNd.EndOfSectionIndex(); const SwFormatCol *pCol = lcl_html_GetFormatCol( rSection, *pFormat ); if( pCol ) { @@ -781,7 +781,7 @@ static Writer& OutHTML_Section( Writer& rWrt, const SwSectionNode& rSectNd ) // The surrounding section must be closed before the current one is // opened, except that it start immediately before the current one or // another end immediately before the current one - if( pSurrCol && nSectSttIdx - pSurrSectNd->GetIndex() > 1 && + if( pSurrCol && nSectSttIdx - pSurrSectNd->GetIndex() > SwNodeOffset(1) && !lcl_html_IsMultiColEnd( rHTMLWrt, nSectSttIdx-1 ) ) lcl_html_OutSectionEndTag( rHTMLWrt ); @@ -804,7 +804,7 @@ static Writer& OutHTML_Section( Writer& rWrt, const SwSectionNode& rSectNd ) // The surrounding section must be started again, except that it ends // immediately behind the current one. if( pSurrCol && - pSurrSectNd->EndOfSectionIndex() - nSectEndIdx > 1 && + pSurrSectNd->EndOfSectionIndex() - nSectEndIdx > SwNodeOffset(1) && !lcl_html_IsMultiColStart( rHTMLWrt, nSectEndIdx+1 ) ) lcl_html_OutSectionStartTag( rHTMLWrt, *pSurrSection, *pSurrFormat, pSurrCol, true ); @@ -858,10 +858,10 @@ void SwHTMLWriter::Out_SwDoc( SwPaM* pPam ) break; ++m_pCurrentPam->GetPoint()->nNode; // move - sal_uInt32 nPos = m_pCurrentPam->GetPoint()->nNode.GetIndex(); + SwNodeOffset nPos = m_pCurrentPam->GetPoint()->nNode.GetIndex(); if( m_bShowProgress ) - ::SetProgressState( nPos, m_pDoc->GetDocShell() ); // How far ? + ::SetProgressState( sal_Int32(nPos), m_pDoc->GetDocShell() ); // How far ? /* If only the selected area should be saved, so only the complete * nodes should be saved, this means the first and n-th node @@ -946,8 +946,8 @@ static void OutBodyColor( const char* pTag, const SwFormat *pFormat, sal_uInt16 SwHTMLWriter::OutHeaderAttrs() { - sal_uLong nIdx = m_pCurrentPam->GetPoint()->nNode.GetIndex(); - sal_uLong nEndIdx = m_pCurrentPam->GetMark()->nNode.GetIndex(); + SwNodeOffset nIdx = m_pCurrentPam->GetPoint()->nNode.GetIndex(); + SwNodeOffset nEndIdx = m_pCurrentPam->GetMark()->nNode.GetIndex(); SwTextNode *pTextNd = nullptr; while( nIdx<=nEndIdx && @@ -1036,7 +1036,7 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs ) // In none HTML documents the first set template will be exported // and if none is set the default template - sal_uLong nNodeIdx = m_pCurrentPam->GetPoint()->nNode.GetIndex(); + SwNodeOffset nNodeIdx = m_pCurrentPam->GetPoint()->nNode.GetIndex(); while( nNodeIdx < m_pDoc->GetNodes().Count() ) { @@ -1153,7 +1153,7 @@ void SwHTMLWriter::OutBookmarks() pBookmark = pMarkAccess->getAllMarksBegin()[m_nBkmkTabPos]; // Output all bookmarks in this paragraph. The content position // for the moment isn't considered! - sal_uInt32 nNode = m_pCurrentPam->GetPoint()->nNode.GetIndex(); + SwNodeOffset nNode = m_pCurrentPam->GetPoint()->nNode.GetIndex(); while( m_nBkmkTabPos != -1 && pBookmark->GetMarkPos().nNode.GetIndex() == nNode ) { @@ -1497,8 +1497,8 @@ OString SwHTMLWriter::GetNamespace() const // Structure caches the current data of the writer to output a // other part of the document, like e.g. header/footer -HTMLSaveData::HTMLSaveData(SwHTMLWriter& rWriter, sal_uLong nStt, - sal_uLong nEnd, bool bSaveNum, +HTMLSaveData::HTMLSaveData(SwHTMLWriter& rWriter, SwNodeOffset nStt, + SwNodeOffset nEnd, bool bSaveNum, const SwFrameFormat *pFrameFormat) : rWrt(rWriter) , pOldPam(rWrt.m_pCurrentPam) diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 5365214b504d..bf6806b1ae95 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -191,10 +191,10 @@ struct HTMLControl { // the form to which the control belongs css::uno::Reference<css::container::XIndexContainer> xFormComps; - sal_uLong nNdIdx; // the node in which it's anchored + SwNodeOffset nNdIdx; // the node in which it's anchored sal_Int32 nCount; // how many controls are on the node - HTMLControl( const css::uno::Reference<css::container::XIndexContainer>& rForm, sal_uInt32 nIdx ); + HTMLControl( const css::uno::Reference<css::container::XIndexContainer>& rForm, SwNodeOffset nIdx ); ~HTMLControl(); // operators for the sort array @@ -284,7 +284,7 @@ public: std::set<OUString> m_aScriptParaStyles; // script dependent para styles std::set<OUString> m_aScriptTextStyles; // script dependent text styles std::vector<OUString> m_aOutlineMarks; - std::vector<sal_uInt32> m_aOutlineMarkPoss; + std::vector<SwNodeOffset> m_aOutlineMarkPoss; HTMLControls m_aHTMLControls; // the forms to be written SwHTMLFormatInfos m_CharFormatInfos; SwHTMLFormatInfos m_TextCollInfos; @@ -433,7 +433,7 @@ public: void OutHyperlinkHRefValue( const OUString& rURL ); // output the FlyFrame anchored at current position - bool OutFlyFrame( sal_uLong nNdIdx, sal_Int32 nContentIdx, + bool OutFlyFrame( SwNodeOffset nNdIdx, sal_Int32 nContentIdx, HtmlPosition nPos, HTMLOutContext *pContext = nullptr ); void OutFrameFormat( AllHtmlFlags nType, const SwFrameFormat& rFormat, const SdrObject *pSdrObj ); @@ -646,7 +646,7 @@ struct HTMLSaveData bool bOldOutFooter : 1; bool bOldOutFlyFrame : 1; - HTMLSaveData( SwHTMLWriter&, sal_uLong nStt, sal_uLong nEnd, + HTMLSaveData( SwHTMLWriter&, SwNodeOffset nStt, SwNodeOffset nEnd, bool bSaveNum=true, const SwFrameFormat *pFrameFormat=nullptr ); ~HTMLSaveData(); diff --git a/sw/source/filter/indexing/IndexingExport.cxx b/sw/source/filter/indexing/IndexingExport.cxx index 97e90b08bc89..7bc1b60e3b74 100644 --- a/sw/source/filter/indexing/IndexingExport.cxx +++ b/sw/source/filter/indexing/IndexingExport.cxx @@ -88,7 +88,7 @@ public: void handleTextNode(const SwTextNode* pTextNode) { - sal_Int64 nParentIndex = -1; + SwNodeOffset nParentIndex(-1); if (!maNodeStack.empty() && maNodeStack.back()) { nParentIndex = maNodeStack.back()->GetIndex(); @@ -98,10 +98,10 @@ public: if (rString.isEmpty()) return; m_rXmlWriter.startElement("paragraph"); - m_rXmlWriter.attribute("index", pTextNode->GetIndex()); + m_rXmlWriter.attribute("index", sal_Int32(pTextNode->GetIndex())); m_rXmlWriter.attribute("node_type", "writer"); - if (nParentIndex >= 0) - m_rXmlWriter.attribute("parent_index", nParentIndex); + if (nParentIndex >= SwNodeOffset(0)) + m_rXmlWriter.attribute("parent_index", sal_Int32(nParentIndex)); m_rXmlWriter.content(rString); m_rXmlWriter.endElement(); } @@ -147,7 +147,7 @@ public: OUString sName = pFormat->GetName(); m_rXmlWriter.startElement("object"); - m_rXmlWriter.attribute("index", pTableNode->GetIndex()); + m_rXmlWriter.attribute("index", sal_Int32(pTableNode->GetIndex())); m_rXmlWriter.attribute("name", sName); m_rXmlWriter.attribute("object_type", "table"); m_rXmlWriter.endElement(); @@ -158,7 +158,7 @@ public: void handleSectionNode(SwSectionNode* pSectionNode) { m_rXmlWriter.startElement("object"); - m_rXmlWriter.attribute("index", pSectionNode->GetIndex()); + m_rXmlWriter.attribute("index", sal_Int32(pSectionNode->GetIndex())); m_rXmlWriter.attribute("name", pSectionNode->GetSection().GetSectionName()); m_rXmlWriter.attribute("object_type", "section"); m_rXmlWriter.endElement(); diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index e3ba8cddc9f3..55f36351b918 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -59,7 +59,7 @@ namespace } } -typedef std::multimap<sal_uLong, const ::sw::mark::IMark*> SwBookmarkNodeTable; +typedef std::multimap<SwNodeOffset, const ::sw::mark::IMark*> SwBookmarkNodeTable; struct Writer_Impl { @@ -90,7 +90,7 @@ void Writer_Impl::RemoveFontList( SwDoc& rDoc ) void Writer_Impl::InsertBkmk(const ::sw::mark::IMark& rBkmk) { - sal_uLong nNd = rBkmk.GetMarkPos().nNode.GetIndex(); + SwNodeOffset nNd = rBkmk.GetMarkPos().nNode.GetIndex(); aBkmkNodePos.emplace( nNd, &rBkmk ); @@ -188,7 +188,7 @@ sal_Int32 Writer::FindPos_Bkmk(const SwPosition& rPos) const } std::shared_ptr<SwUnoCursor> -Writer::NewUnoCursor(SwDoc & rDoc, sal_uLong const nStartIdx, sal_uLong const nEndIdx) +Writer::NewUnoCursor(SwDoc & rDoc, SwNodeOffset const nStartIdx, SwNodeOffset const nEndIdx) { SwNodes *const pNds = &rDoc.GetNodes(); @@ -447,7 +447,7 @@ bool Writer::GetBookmarks(const SwContentNode& rNd, sal_Int32 nStt, { OSL_ENSURE( rArr.empty(), "there are still entries available" ); - sal_uLong nNd = rNd.GetIndex(); + SwNodeOffset nNd = rNd.GetIndex(); std::pair<SwBookmarkNodeTable::const_iterator, SwBookmarkNodeTable::const_iterator> aIterPair = m_pImpl->aBkmkNodePos.equal_range( nNd ); if( aIterPair.first != aIterPair.second ) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f94baf8806a7..ef525f45e816 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -325,8 +325,8 @@ void DocxAttributeOutput::WriteFloatingTable(ww8::Frame const* pParentFrame) m_aFloatingTablesOfParagraph.insert(&rFrameFormat); const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx(); - sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : 0; - sal_uLong nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0; + SwNodeOffset nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : SwNodeOffset(0); + SwNodeOffset nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : SwNodeOffset(0); //Save data here and restore when out of scope ExportDataSaveRestore aDataGuard(GetExport(), nStt, nEnd, pParentFrame); @@ -371,7 +371,7 @@ static void checkAndWriteFloatingTables(DocxAttributeOutput& rDocxAttributeOutpu continue; // go to the end of the table - sal_uLong aEndIndex = aStartNode.GetNode().EndOfSectionIndex(); + SwNodeOffset aEndIndex = aStartNode.GetNode().EndOfSectionIndex(); // go one deeper aEndIndex++; // this has to be the end of the content diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index ae5b7ca94fb1..0e07d34ed40e 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -459,8 +459,8 @@ tools::Polygon lcl_CreateContourPolygon(SdrObject* pSdrObj) } } // end anonymous namespace -ExportDataSaveRestore::ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, - ww8::Frame const* pParentFrame) +ExportDataSaveRestore::ExportDataSaveRestore(DocxExport& rExport, SwNodeOffset nStt, + SwNodeOffset nEnd, ww8::Frame const* pParentFrame) : m_rExport(rExport) { m_rExport.SaveData(nStt, nEnd); @@ -1701,8 +1701,8 @@ void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame) const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat(); const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx(); - sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : 0; - sal_uLong nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0; + SwNodeOffset nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : SwNodeOffset(0); + SwNodeOffset nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : SwNodeOffset(0); //Save data here and restore when out of scope ExportDataSaveRestore aDataGuard(m_pImpl->getExport(), nStt, nEnd, pParentFrame); @@ -1766,8 +1766,8 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat(); const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx(); - sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : 0; - sal_uLong nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0; + SwNodeOffset nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : SwNodeOffset(0); + SwNodeOffset nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : SwNodeOffset(0); //Save data here and restore when out of scope ExportDataSaveRestore aDataGuard(m_pImpl->getExport(), nStt, nEnd, pParentFrame); @@ -2067,8 +2067,8 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat(); const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx(); - sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : 0; - sal_uLong nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0; + SwNodeOffset nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : SwNodeOffset(0); + SwNodeOffset nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : SwNodeOffset(0); //Save data here and restore when out of scope ExportDataSaveRestore aDataGuard(m_pImpl->getExport(), nStt, nEnd, pParentFrame); diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx index f8c22167b11e..e6404f8eb423 100644 --- a/sw/source/filter/ww8/docxsdrexport.hxx +++ b/sw/source/filter/ww8/docxsdrexport.hxx @@ -15,6 +15,7 @@ #include <rtl/strbuf.hxx> #include <sax/fshelper.hxx> #include <tools/solar.h> +#include <nodeoffset.hxx> namespace rtl { @@ -39,7 +40,7 @@ class ExportDataSaveRestore private: DocxExport& m_rExport; public: - ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, ww8::Frame const* pParentFrame); + ExportDataSaveRestore(DocxExport& rExport, SwNodeOffset nStt, SwNodeOffset nEnd, ww8::Frame const* pParentFrame); ~ExportDataSaveRestore(); }; diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 55926c576d62..c7f7210addcd 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1935,8 +1935,9 @@ void RtfAttributeOutput::writeTextFrame(const ww8::Frame& rFrame, bool bTextBox) const SwFrameFormat& rFrameFormat = rFrame.GetFrameFormat(); const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx(); - sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : 0; - sal_uLong nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0; + SwNodeOffset nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : SwNodeOffset(0); + SwNodeOffset nEnd + = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : SwNodeOffset(0); m_rExport.SaveData(nStt, nEnd); m_rExport.m_pParentFrame = &rFrame; m_rExport.WriteText(); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 9396f2422db4..2be381a3dfb2 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1017,7 +1017,7 @@ void RtfExport::OutputTextNode(SwTextNode& rNode) m_nCurrentNodeIndex = rNode.GetIndex(); if (!m_bOutOutlineOnly || rNode.IsOutline()) MSWordExportBase::OutputTextNode(rNode); - m_nCurrentNodeIndex = 0; + m_nCurrentNodeIndex = SwNodeOffset(0); } void RtfExport::AppendSection(const SwPageDesc* pPageDesc, const SwSectionFormat* pFormat, diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx index 105f6305eba2..48b3379d4aa3 100644 --- a/sw/source/filter/ww8/rtfexport.hxx +++ b/sw/source/filter/ww8/rtfexport.hxx @@ -166,7 +166,7 @@ private: /// This is used by OutputFlyFrame_Impl() to control the written syntax bool m_bRTFFlySyntax; /// Index of the current SwTextNode, if any. - sal_uLong m_nCurrentNodeIndex; + SwNodeOffset m_nCurrentNodeIndex; public: rtl_TextEncoding GetDefaultEncoding() const { return m_eDefaultEncoding; } @@ -177,7 +177,7 @@ public: rtl_TextEncoding GetCurrentEncoding() const { return m_eCurrentEncoding; } void SetRTFFlySyntax(bool bRTFFlySyntax) { m_bRTFFlySyntax = bRTFFlySyntax; } bool GetRTFFlySyntax() const { return m_bRTFFlySyntax; } - sal_uLong GetCurrentNodeIndex() const { return m_nCurrentNodeIndex; } + SwNodeOffset GetCurrentNodeIndex() const { return m_nCurrentNodeIndex; } SvStream& Strm(); /// From now on, let Strm() return a memory stream, not a real one. void setStream(); diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index 33d910fcf8d2..64cb0d7959c7 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -140,9 +140,9 @@ namespace class anchoredto { private: - sal_uLong mnNode; + SwNodeOffset mnNode; public: - explicit anchoredto(sal_uLong nNode) : mnNode(nNode) {} + explicit anchoredto(SwNodeOffset nNode) : mnNode(nNode) {} bool operator()(const ww8::Frame &rFrame) const { return (mnNode == rFrame.GetPosition().nNode.GetNode().GetIndex()); @@ -756,7 +756,7 @@ namespace sw void MoveAttrFieldmarkInserted(SwFltPosition& rMkPos, SwFltPosition& rPtPos, const SwPosition& rPos) { sal_Int32 const nInserted = 2; // CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDSEP - sal_uLong nPosNd = rPos.nNode.GetIndex(); + SwNodeOffset nPosNd = rPos.nNode.GetIndex(); sal_Int32 nPosCt = rPos.nContent.GetIndex() - nInserted; bool const isPoint(rMkPos == rPtPos); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 1c21424cbe39..f33a52708a57 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -629,7 +629,7 @@ bool SwWW8AttrIter::IsWatermarkFrame() return false; } -bool SwWW8AttrIter::IsAnchorLinkedToThisNode( sal_uLong nNodePos ) +bool SwWW8AttrIter::IsAnchorLinkedToThisNode( SwNodeOffset nNodePos ) { if ( maFlyIter == maFlyFrames.end() ) return false; @@ -989,7 +989,7 @@ bool AttributeOutputBase::AnalyzeURL( const OUString& rUrl, const OUString& /*rT { if ( rBookmarkPair.first == sMark ) { - sMark = "_toc" + OUString::number( rBookmarkPair.second ); + sMark = "_toc" + OUString::number( sal_Int32(rBookmarkPair.second) ); break; } } @@ -1930,7 +1930,7 @@ bool MSWordExportBase::GetBookmarks( const SwTextNode& rNd, sal_Int32 nStt, sal_Int32 nEnd, IMarkVector& rArr ) { IDocumentMarkAccess* const pMarkAccess = m_rDoc.getIDocumentMarkAccess(); - sal_uLong nNd = rNd.GetIndex( ); + SwNodeOffset nNd = rNd.GetIndex( ); const sal_Int32 nMarks = pMarkAccess->getAllMarksCount(); for ( sal_Int32 i = 0; i < nMarks; i++ ) @@ -1978,7 +1978,7 @@ bool MSWordExportBase::GetAnnotationMarks( const SwWW8AttrIter& rAttrs, sal_Int3 sal_Int32 nEnd, IMarkVector& rArr ) { IDocumentMarkAccess* const pMarkAccess = m_rDoc.getIDocumentMarkAccess(); - sal_uLong nNd = rAttrs.GetNode().GetIndex(); + SwNodeOffset nNd = rAttrs.GetNode().GetIndex(); const sal_Int32 nMarks = pMarkAccess->getAnnotationMarksCount(); for ( sal_Int32 i = 0; i < nMarks; i++ ) @@ -2293,7 +2293,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) if ( 0 == pLine->GetBoxPos( pBox ) && pBox->GetSttNd() ) { // check if paragraph is first in that line: - if ( 1 == ( rNode.GetIndex() - pBox->GetSttNd()->GetIndex() ) ) + if ( SwNodeOffset(1) == ( rNode.GetIndex() - pBox->GetSttNd()->GetIndex() ) ) pLine->GetFrameFormat()->SetFormatAttr(SwFormatRowSplit(!bDontSplit)); } } @@ -2345,7 +2345,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) if ( aAttrIter.RequiresImplicitBookmark() ) { - OUString sBkmkName = "_toc" + OUString::number( rNode.GetIndex() ); + OUString sBkmkName = "_toc" + OUString::number( sal_Int32(rNode.GetIndex()) ); // Add a bookmark converted to a Word name. AppendBookmark( BookmarkToWord( sBkmkName ) ); } @@ -3088,7 +3088,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) if ( 0 == pLine->GetBoxPos( pBox ) && pBox->GetSttNd() ) { // check if paragraph is first in that line: - if ( 1 == ( rNode.GetIndex() - pBox->GetSttNd()->GetIndex() ) ) + if ( SwNodeOffset(1) == ( rNode.GetIndex() - pBox->GetSttNd()->GetIndex() ) ) { bool bSetAtPara = false; if ( bKeep ) @@ -3412,8 +3412,8 @@ void WW8AttributeOutput::OutputFlyFrame_Impl( const ww8::Frame& rFormat, const P // Fetch from node and last node the position in the section const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx(); - sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex()+1 : 0; - sal_uLong nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0; + SwNodeOffset nStt = pNodeIndex ? pNodeIndex->GetIndex()+1 : SwNodeOffset(0); + SwNodeOffset nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : SwNodeOffset(0); if( nStt >= nEnd ) // no range, hence no valid node return; diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 3e8f9ec79a11..9a5441d366aa 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -2101,8 +2101,8 @@ void MSWordExportBase::WriteHeaderFooterText( const SwFormat& rFormat, bool bHea { SwNodeIndex aIdx( *pSttIdx, 1 ), aEnd( *pSttIdx->GetNode().EndOfSectionNode() ); - sal_uLong nStart = aIdx.GetIndex(); - sal_uLong nEnd = aEnd.GetIndex(); + SwNodeOffset nStart = aIdx.GetIndex(); + SwNodeOffset nEnd = aEnd.GetIndex(); // range, i.e. valid node if ( nStart < nEnd ) diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 2aa94c7059b5..2c2f40db021e 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1423,7 +1423,8 @@ void WW8Export::AppendBookmarks( const SwTextNode& rNd, sal_Int32 nCurrentPos, s if( !GetWriter().GetBookmarks( rNd, nCurrentPos, nCurrentEnd, aArr )) return; - sal_uLong nNd = rNd.GetIndex(), nSttCP = Fc2Cp( Strm().Tell() ); + SwNodeOffset nNd = rNd.GetIndex(); + sal_uLong nSttCP = Fc2Cp( Strm().Tell() ); for(const ::sw::mark::IMark* p : aArr) { const ::sw::mark::IMark& rBkmk = *p; @@ -1794,13 +1795,13 @@ void WW8Export::WriteStringAsPara( const OUString& rText ) m_pChpPlc->AppendFkpEntry( nPos ); } -void MSWordExportBase::WriteSpecialText( sal_uLong nStart, sal_uLong nEnd, sal_uInt8 nTTyp ) +void MSWordExportBase::WriteSpecialText( SwNodeOffset nStart, SwNodeOffset nEnd, sal_uInt8 nTTyp ) { sal_uInt8 nOldTyp = m_nTextTyp; m_nTextTyp = nTTyp; auto const pOldPam = m_pCurPam; //!! Simply shifting the PaM without restoring should do the job too - sal_uLong nOldStart = m_nCurStart; - sal_uLong nOldEnd = m_nCurEnd; + SwNodeOffset nOldStart = m_nCurStart; + SwNodeOffset nOldEnd = m_nCurEnd; SwPaM* pOldEnd = m_pOrigPam; bool bOldPageDescs = m_bOutPageDescs; m_bOutPageDescs = false; @@ -1872,7 +1873,7 @@ void WW8Export::WriteChar( sal_Unicode c ) Strm().WriteUInt16( c ); } -void MSWordExportBase::SetCurPam(sal_uLong nStt, sal_uLong nEnd) +void MSWordExportBase::SetCurPam(SwNodeOffset nStt, SwNodeOffset nEnd) { m_nCurStart = nStt; m_nCurEnd = nEnd; @@ -1889,7 +1890,7 @@ void MSWordExportBase::SetCurPam(sal_uLong nStt, sal_uLong nEnd) m_pCurPam->Exchange(); } -void MSWordExportBase::SaveData( sal_uLong nStt, sal_uLong nEnd ) +void MSWordExportBase::SaveData( SwNodeOffset nStt, SwNodeOffset nEnd ) { MSWordSaveData aData; @@ -1944,7 +1945,7 @@ void MSWordExportBase::RestoreData() m_aSaveData.pop(); } -void WW8Export::SaveData( sal_uLong nStt, sal_uLong nEnd ) +void WW8Export::SaveData( SwNodeOffset nStt, SwNodeOffset nEnd ) { MSWordExportBase::SaveData( nStt, nEnd ); @@ -2743,9 +2744,9 @@ class TrackContentToExport { private: SwPaM *m_pCurPam; - sal_uLong m_nStart, m_nEnd; + SwNodeOffset m_nStart, m_nEnd; public: - TrackContentToExport(SwPaM *pCurPam, sal_uLong nCurStart, sal_uLong nCurEnd) + TrackContentToExport(SwPaM *pCurPam, SwNodeOffset nCurStart, SwNodeOffset nCurEnd) : m_pCurPam(pCurPam) , m_nStart(nCurStart) , m_nEnd(nCurEnd) @@ -2921,8 +2922,8 @@ void MSWordExportBase::WriteText() else ++m_pCurPam->GetPoint()->nNode; - sal_uLong nPos = m_pCurPam->GetPoint()->nNode.GetIndex(); - ::SetProgressState( nPos, m_pCurPam->GetDoc().GetDocShell() ); + SwNodeOffset nPos = m_pCurPam->GetPoint()->nNode.GetIndex(); + ::SetProgressState( sal_Int32(nPos), m_pCurPam->GetDoc().GetDocShell() ); } SAL_INFO( "sw.ww8.level2", "</WriteText>" ); @@ -3142,7 +3143,7 @@ void MSWordExportBase::AddLinkTarget(std::u16string_view rURL) return; sCmp = sCmp.toAsciiLowerCase(); - sal_uLong nIdx = 0; + SwNodeOffset nIdx(0); bool noBookmark = false; if( sCmp == "outline" ) @@ -3810,8 +3811,8 @@ ErrCode SwWW8Writer::WriteStorageImpl() if( pViewShell != nullptr ) pViewShell->CalcLayout(); - tools::Long nMaxNode = m_pDoc->GetNodes().Count(); - ::StartProgress( STR_STATSTR_W4WWRITE, 0, nMaxNode, m_pDoc->GetDocShell() ); + SwNodeOffset nMaxNode = m_pDoc->GetNodes().Count(); + ::StartProgress( STR_STATSTR_W4WWRITE, 0, sal_Int32(nMaxNode), m_pDoc->GetDocShell() ); // Respect table at the beginning of the document { diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index d65a16126f44..1051c8bf5fa4 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -406,7 +406,7 @@ private: HdFtPlcDrawObj& operator=(const HdFtPlcDrawObj&) = delete; }; -typedef std::pair<OUString, sal_uLong> aBookmarkPair; +typedef std::pair<OUString, SwNodeOffset> aBookmarkPair; class WW8_WrtRedlineAuthor : public sw::util::WrtRedlineAuthor { @@ -432,7 +432,7 @@ struct MSWordSaveData std::unique_ptr<ww::bytes> pOOld; ///< WW8Export only std::shared_ptr<SwUnoCursor> pOldPam; SwPaM* pOldEnd; - sal_uLong nOldStart, nOldEnd; + SwNodeOffset nOldStart, nOldEnd; const ww8::Frame* pOldFlyFormat; const SwPageDesc* pOldPageDesc; @@ -450,7 +450,7 @@ class MSWordExportBase { public: wwFontHelper m_aFontHelper; - std::vector<sal_uLong> m_aChapterFieldLocs; + std::vector<SwNodeOffset> m_aChapterFieldLocs; OUString m_aMainStg; std::vector<const SwTOXType*> m_aTOXArr; const SfxItemSet* m_pISet; // for double attributes @@ -572,7 +572,7 @@ public: bool m_bAddFootnoteTab; // only one aesthetic spacing tab per footnote SwDoc& m_rDoc; - sal_uLong m_nCurStart, m_nCurEnd; + SwNodeOffset m_nCurStart, m_nCurEnd; std::shared_ptr<SwUnoCursor> & m_pCurPam; SwPaM *m_pOrigPam; @@ -599,7 +599,7 @@ public: /// Set the pCurPam appropriately and call WriteText(). /// /// Used to export paragraphs in footnotes/endnotes/etc. - void WriteSpecialText( sal_uLong nStart, sal_uLong nEnd, sal_uInt8 nTTyp ); + void WriteSpecialText( SwNodeOffset nStart, SwNodeOffset nEnd, sal_uInt8 nTTyp ); /// Export the pool items to attributes (through an attribute output class). void ExportPoolItemsToCHP( ww8::PoolItems &rItems, sal_uInt16 nScript, const SvxFontItem *pFont, bool bWriteCombChars = false ); @@ -732,7 +732,7 @@ public: void SetCurItemSet( const SfxItemSet* pS ) { m_pISet = pS; } /// Remember some of the members so that we can recurse in WriteText(). - virtual void SaveData( sal_uLong nStt, sal_uLong nEnd ); + virtual void SaveData( SwNodeOffset nStt, SwNodeOffset nEnd ); /// Restore what was saved in SaveData(). virtual void RestoreData(); @@ -899,7 +899,7 @@ protected: const NfKeywordTable & GetNfKeywordTable(); - void SetCurPam(sal_uLong nStt, sal_uLong nEnd); + void SetCurPam(SwNodeOffset nStt, SwNodeOffset nEnd); /// Get background color of the document, if there is one. std::unique_ptr<SvxBrushItem> getBackground(); @@ -1181,7 +1181,7 @@ public: SvStream& Strm() const { return m_pWriter->Strm(); } /// Remember some of the members so that we can recurse in WriteText(). - virtual void SaveData( sal_uLong nStt, sal_uLong nEnd ) override; + virtual void SaveData( SwNodeOffset nStt, SwNodeOffset nEnd ) override; /// Restore what was saved in SaveData(). virtual void RestoreData() override; @@ -1559,7 +1559,7 @@ public: const SwFormatDrop& GetSwFormatDrop() const { return mrSwFormatDrop; } bool IsWatermarkFrame(); - bool IsAnchorLinkedToThisNode( sal_uLong nNodePos ); + bool IsAnchorLinkedToThisNode( SwNodeOffset nNodePos ); void SplitRun( sal_Int32 nSplitEndPos ); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 3f1d188fc09c..2f636f90540d 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -411,11 +411,11 @@ bool MSWordExportBase::ContentContainsChapterField(const SwFormatContent &rConte { SwNodeIndex aIdx( *pSttIdx, 1 ); SwNodeIndex aEnd( *pSttIdx->GetNode().EndOfSectionNode() ); - sal_uLong nStart = aIdx.GetIndex(); - sal_uLong nEnd = aEnd.GetIndex(); + SwNodeOffset nStart = aIdx.GetIndex(); + SwNodeOffset nEnd = aEnd.GetIndex(); //If the header/footer contains a chapter field bRet = std::any_of(m_aChapterFieldLocs.cbegin(), m_aChapterFieldLocs.cend(), - [nStart, nEnd](sal_uLong i) { return ( nStart <= i ) && ( i <= nEnd ); }); + [nStart, nEnd](SwNodeOffset i) { return ( nStart <= i ) && ( i <= nEnd ); }); } return bRet; } @@ -5703,9 +5703,9 @@ const SwRedlineData* AttributeOutputBase::GetParagraphMarkerRedline( const SwTex if ( pRedl->GetRedlineData().GetType() != aRedlineType ) continue; - sal_uLong uStartNodeIndex = pRedl->Start()->nNode.GetIndex(); - sal_uLong uEndNodeIndex = pRedl->End()->nNode.GetIndex(); - sal_uLong uNodeIndex = rNode.GetIndex(); + SwNodeOffset uStartNodeIndex = pRedl->Start()->nNode.GetIndex(); + SwNodeOffset uEndNodeIndex = pRedl->End()->nNode.GetIndex(); + SwNodeOffset uNodeIndex = rNode.GetIndex(); if( uStartNodeIndex <= uNodeIndex && uNodeIndex < uEndNodeIndex ) return &( pRedl->GetRedlineData() ); diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index d60dec44f25b..8de703570f9f 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -465,7 +465,7 @@ namespace if (!pNodeIndex) return SwNodeType::NONE; const SwNode& rCSttNd = pNodeIndex->GetNode(); - SwNodeRange aRg(rCSttNd, 1, *rCSttNd.EndOfSectionNode()); + SwNodeRange aRg(rCSttNd, SwNodeOffset(1), *rCSttNd.EndOfSectionNode()); return aRg.aStart.GetNode().GetNodeType(); } } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index cdb664bf611d..4179c07ec615 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1359,8 +1359,8 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, if (rEntry.MakeRegion(m_rDoc, aRegion, SwFltStackEntry::RegionMode::NoCheck)) { SvxLRSpaceItem aNewLR( *static_cast<SvxLRSpaceItem*>(rEntry.m_pAttr.get()) ); - sal_uLong nStart = aRegion.Start()->nNode.GetIndex(); - sal_uLong nEnd = aRegion.End()->nNode.GetIndex(); + SwNodeOffset nStart = aRegion.Start()->nNode.GetIndex(); + SwNodeOffset nEnd = aRegion.End()->nNode.GetIndex(); for(; nStart <= nEnd; ++nStart) { SwNode* pNode = m_rDoc.GetNodes()[ nStart ]; @@ -4636,8 +4636,8 @@ void wwSectionManager::InsertSegments() SwFormatPageDesc aDesc(SetSwFormatPageDesc(aIter, aStart, true)); if (aDesc.GetPageDesc()) { - sal_uLong nStart = aSectPaM.Start()->nNode.GetIndex(); - sal_uLong nEnd = aSectPaM.End()->nNode.GetIndex(); + SwNodeOffset nStart = aSectPaM.Start()->nNode.GetIndex(); + SwNodeOffset nEnd = aSectPaM.End()->nNode.GetIndex(); for(; nStart <= nEnd; ++nStart) { SwNode* pNode = mrReader.m_rDoc.GetNodes()[nStart]; @@ -5147,7 +5147,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss) } // suppress insertion of tables inside footnotes. - const sal_uLong nNd = pPos->nNode.GetIndex(); + const SwNodeOffset nNd = pPos->nNode.GetIndex(); m_bReadNoTable = ( nNd < m_rDoc.GetNodes().GetEndOfInserts().GetIndex() && m_rDoc.GetNodes().GetEndOfInserts().StartOfSectionIndex() < nNd ); } diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 6df597fe7cac..1391cbb47d15 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2764,7 +2764,7 @@ void WW8TabDesc::ParkPaM() return; } - sal_uLong nSttNd = pTabBox2->GetSttIdx() + 1, + SwNodeOffset nSttNd = pTabBox2->GetSttIdx() + 1, nEndNd = pTabBox2->GetSttNd()->EndOfSectionIndex(); if (m_pIo->m_pPaM->GetPoint()->nNode != nSttNd) @@ -3003,7 +3003,7 @@ void WW8TabDesc::SetPamInCell(short nWwCol, bool bPam) //or not so that we can collect paragraph properties over //all the cells, but in that case on the valid cell we do not //want to reset the fmt properties - sal_uLong nSttNd = m_pTabBox->GetSttIdx() + 1, + SwNodeOffset nSttNd = m_pTabBox->GetSttIdx() + 1, nEndNd = m_pTabBox->GetSttNd()->EndOfSectionIndex(); if (m_pIo->m_pPaM->GetPoint()->nNode != nSttNd) { diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index 73d24dd77b2f..575c822ceb87 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -663,7 +663,7 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo) // set content node (if necessary) if (nullptr != pRedlineInfo->pContentIndex) { - sal_uLong nPoint = aPaM.GetPoint()->nNode.GetIndex(); + SwNodeOffset nPoint = aPaM.GetPoint()->nNode.GetIndex(); if( nPoint < pRedlineInfo->pContentIndex->GetIndex() || nPoint > pRedlineInfo->pContentIndex->GetNode().EndOfSectionIndex() ) pRedline->SetContentIdx(pRedlineInfo->pContentIndex); diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 59f9e6bea81f..74754962c041 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -717,7 +717,7 @@ void SwXMLImport::endDocument() if( !pPos->nContent.GetIndex() ) { SwTextNode* pCurrNd; - sal_uLong nNodeIdx = pPos->nNode.GetIndex(); + SwNodeOffset nNodeIdx = pPos->nNode.GetIndex(); pDoc = &pPaM->GetDoc(); OSL_ENSURE( pPos->nNode.GetNode().IsContentNode(), @@ -876,7 +876,7 @@ void SwXMLImport::endDocument() #if 1 if (!pDoc) { pDoc = SwImport::GetDocFromXMLImport(*this); } - for (sal_uLong i = 0; i < pDoc->GetNodes().Count(); ++i) + for (SwNodeOffset i(0); i < pDoc->GetNodes().Count(); ++i) { if (SwTableNode *const pTableNode = pDoc->GetNodes()[i]->GetTableNode()) { @@ -950,7 +950,7 @@ void SwXMLImport::MergeListsAtDocumentInsertPosition(SwDoc *pDoc) if (! IsInsertMode() || ! m_pSttNdIdx->GetIndex()) return; - sal_uLong index = 1; + SwNodeOffset index(1); // the last node of the main document where we have inserted a document SwNode* const node1 = pDoc->GetNodes()[m_pSttNdIdx->GetIndex() + 0]; diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index a071ce35ec67..b7efd43a3dea 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1921,7 +1921,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox( // only one text node? SwNodeIndex aNodeIndex( *(pCell->GetStartNode()), 1 ); if( ( aNodeIndex.GetNode().EndOfSectionIndex() - - aNodeIndex.GetNode().StartOfSectionIndex() ) == 2 ) + aNodeIndex.GetNode().StartOfSectionIndex() ) == SwNodeOffset(2) ) { SwTextNode* pTextNode= aNodeIndex.GetNode().GetTextNode(); if( pTextNode != nullptr ) @@ -2712,7 +2712,7 @@ const SwStartNode *SwXMLTableContext::InsertTableSection( { pDoc = &const_cast<SwDoc&>(pEndNd->GetDoc()); } - sal_uInt32 nOffset = pPrevSttNd ? 1UL : 0UL; + SwNodeOffset nOffset(pPrevSttNd ? 1 : 0); SwNodeIndex aIdx( *pEndNd, nOffset ); SwTextFormatColl *pColl = pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD, false ); diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index d6db97fa36f7..0c8ebd8bf3c3 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -420,10 +420,10 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig rShell.MovePara(GoCurrPara, fnParaStart); } bool bSplitNode = !rShell.IsEndPara(); - sal_Int32 nMoves = rConfigItem.GetGreetingMoves(); - if( !bExample && 0 != nMoves ) + SwNodeOffset nMoves(rConfigItem.GetGreetingMoves()); + if( !bExample && SwNodeOffset(0) != nMoves ) { - if(nMoves < 0) + if(nMoves < SwNodeOffset(0)) { rShell.MoveParagraph( nMoves ); } @@ -669,7 +669,7 @@ IMPL_LINK_NOARG(SwMailMergeLayoutPage, ChangeAddressHdl_Impl, weld::MetricSpinBu IMPL_LINK(SwMailMergeLayoutPage, GreetingsHdl_Impl, weld::Button&, rButton, void) { bool bDown = &rButton == m_xDownPB.get(); - bool bMoved = m_pExampleWrtShell->MoveParagraph( bDown ? 1 : -1 ); + bool bMoved = m_pExampleWrtShell->MoveParagraph( SwNodeOffset(bDown ? 1 : -1) ); if (bMoved || bDown) m_pWizard->GetConfigItem().MoveGreeting(bDown ? 1 : -1 ); if(!bMoved && bDown) diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 2a8cea3e83f6..6ec1b994cfe1 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -440,7 +440,7 @@ sal_Bool SAL_CALL SwTransferable::isComplex() SwNodes& aNodes = m_pWrtShell->GetDoc()->GetNodes(); for (SwPaM& rPaM : m_pWrtShell->GetCursor()->GetRingContainer()) { - for (sal_uLong nIndex = rPaM.GetMark()->nNode.GetIndex(); + for (SwNodeOffset nIndex = rPaM.GetMark()->nNode.GetIndex(); nIndex <= rPaM.GetPoint()->nNode.GetIndex(); ++nIndex) { SwNode& rNd = *aNodes[nIndex]; @@ -1297,7 +1297,7 @@ void SwPasteContext::remember() // Set point to the previous node, so it is not moved. const SwNodeIndex& rNodeIndex = pCursor->GetPoint()->nNode; - m_pPaM.reset(new SwPaM(rNodeIndex, rNodeIndex, 0, -1)); + m_pPaM.reset(new SwPaM(rNodeIndex, rNodeIndex, SwNodeOffset(0), SwNodeOffset(-1))); m_nStartContent = pCursor->GetPoint()->nContent.GetIndex(); } diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 3bf0da22420a..aa44157ae7ab 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -644,7 +644,7 @@ void SwAnnotationWin::SetPosAndSize() // text range overlay maAnnotationTextRanges.clear(); - if ( mrSidebarItem.maLayoutInfo.mnStartNodeIdx != 0 + if ( mrSidebarItem.maLayoutInfo.mnStartNodeIdx != SwNodeOffset(0) && mrSidebarItem.maLayoutInfo.mnStartContent != -1 ) { const SwTextAnnotationField* pTextAnnotationField = diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 172f874e3b08..32c21634f2bd 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -548,7 +548,7 @@ bool SwPostItMgr::CalcRects() } const SwRect aOldAnchorRect( pItem->maLayoutInfo.mPosition ); const SwPostItHelper::SwLayoutStatus eOldLayoutStatus = pItem->mLayoutStatus; - const sal_uLong nOldStartNodeIdx( pItem->maLayoutInfo.mnStartNodeIdx ); + const SwNodeOffset nOldStartNodeIdx( pItem->maLayoutInfo.mnStartNodeIdx ); const sal_Int32 nOldStartContent( pItem->maLayoutInfo.mnStartContent ); { // update layout information diff --git a/sw/source/uibase/docvw/UnfloatTableButton.cxx b/sw/source/uibase/docvw/UnfloatTableButton.cxx index 4b92b153a70e..9621405679a6 100644 --- a/sw/source/uibase/docvw/UnfloatTableButton.cxx +++ b/sw/source/uibase/docvw/UnfloatTableButton.cxx @@ -172,7 +172,8 @@ void UnfloatTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/) } // Move the table outside of the text frame - SwNodeRange aRange(*pTableNode, 0, *pTableNode->EndOfSectionNode(), 1); + SwNodeRange aRange(*pTableNode, SwNodeOffset(0), *pTableNode->EndOfSectionNode(), + SwNodeOffset(1)); rDoc.getIDocumentContentOperations().MoveNodeRange(aRange, aInsertPos, SwMoveFlags::DEFAULT); // Remove the floating table's frame diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index e44b629c06d0..b38b0a521326 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -5628,9 +5628,9 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) if( pCursor ) { - sal_uLong nPosNodeIdx = pCursor->GetPoint()->nNode.GetIndex(); + SwNodeOffset nPosNodeIdx = pCursor->GetPoint()->nNode.GetIndex(); const sal_Int32 nPosIdx = pCursor->GetPoint()->nContent.GetIndex(); - sal_uLong nMarkNodeIdx = pCursor->GetMark()->nNode.GetIndex(); + SwNodeOffset nMarkNodeIdx = pCursor->GetMark()->nNode.GetIndex(); const sal_Int32 nMarkIdx = pCursor->GetMark()->nContent.GetIndex(); if( !rSh.GetCursor()->HasMark() ) diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index f59a4fe551e0..a330a8e1c3ab 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1323,7 +1323,7 @@ void SwTextShell::Execute(SfxRequest &rReq) case FN_NUM_BULLET_MOVEUP: if (!rWrtSh.IsAddMode()) - rWrtSh.MoveParagraph(-1); + rWrtSh.MoveParagraph(SwNodeOffset(-1)); rReq.Done(); break; case SID_RUBY_DIALOG: diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index f74d07f0398c..6fa6e6a6bd85 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -1917,7 +1917,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any& pDoc->SetInWriterfilterImport(bBool); if (bOld && !bBool) { - pDoc->getIDocumentFieldsAccess().SetFieldsDirty(false, nullptr, 0); + pDoc->getIDocumentFieldsAccess().SetFieldsDirty(false, nullptr, SwNodeOffset(0)); } } } diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 3e91ee202e21..a7aea176df5d 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -307,9 +307,9 @@ namespace } // Gets "YPos" for SwRegionContent, i.e. a number used to sort sections in Navigator's list -tools::Long getYPosForSection(const SwNodeIndex& rNodeIndex) +sal_Int32 getYPosForSection(const SwNodeIndex& rNodeIndex) { - sal_uLong nIndex = rNodeIndex.GetIndex(); + SwNodeOffset nIndex = rNodeIndex.GetIndex(); if (rNodeIndex.GetNodes().GetEndOfExtras().GetIndex() >= nIndex) { // Not a node of BodyText @@ -319,11 +319,11 @@ tools::Long getYPosForSection(const SwNodeIndex& rNodeIndex) // Get node index of anchor if (auto pSwPosition = pFlyFormat->GetAnchor().GetContentAnchor()) { - nIndex = getYPosForSection(pSwPosition->nNode); + return getYPosForSection(pSwPosition->nNode); } } } - return static_cast<tools::Long>(nIndex); + return sal_Int32(nIndex); } } // end of anonymous namespace |