summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docnew.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/doc/docnew.cxx')
-rw-r--r--sw/source/core/doc/docnew.cxx205
1 files changed, 116 insertions, 89 deletions
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index a674beb9fde6..cae96a360491 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -19,20 +19,21 @@
#include <sal/config.h>
-#include <mutex>
#include <string_view>
#include <config_features.h>
+#include <config_fuzzers.h>
#include <o3tl/sorted_vector.hxx>
#include <doc.hxx>
#include <proofreadingiterator.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
-#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
+#include <comphelper/configuration.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/random.hxx>
#include <sfx2/viewfrm.hxx>
@@ -43,7 +44,7 @@
#include <sfx2/linkmgr.hxx>
#include <editeng/ulspitem.hxx>
#include <editeng/lrspitem.hxx>
-#include <svl/zforlist.hxx>
+#include <svl/numformat.hxx>
#include <unotools/lingucfg.hxx>
#include <svx/svdpage.hxx>
#include <fmtcntnt.hxx>
@@ -75,7 +76,8 @@
#include <mvsave.hxx>
#include <istyleaccess.hxx>
#include "swstylemanager.hxx"
-#include <IGrammarContact.hxx>
+#include <GrammarContact.hxx>
+#include <OnlineAccessibilityCheck.hxx>
#include <tblafmt.hxx>
#include <MarkManager.hxx>
#include <UndoManager.hxx>
@@ -105,14 +107,18 @@
#include <sfx2/Metadatable.hxx>
#include <fmtmeta.hxx>
+#include <textcontentcontrol.hxx>
#include <svx/xfillit0.hxx>
#include <unotools/configmgr.hxx>
#include <i18nlangtag/mslangid.hxx>
+#include <svl/setitem.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::document;
+constexpr OUStringLiteral DEFAULT_CHAR_FORMAT_NAME = u"Character style";
+
/*
* global functions...
*/
@@ -189,7 +195,7 @@ static void lcl_DelFormatIndices( SwFormat const * pFormat )
if ( rFormatContent.GetContentIdx() )
rFormatContent.SetNewContentIdx( nullptr );
SwFormatAnchor &rFormatAnchor = const_cast<SwFormatAnchor&>(pFormat->GetAnchor());
- if ( rFormatAnchor.GetContentAnchor() )
+ if ( rFormatAnchor.GetAnchorNode() )
rFormatAnchor.SetAnchor( nullptr );
}
@@ -199,8 +205,10 @@ static void lcl_DelFormatIndices( SwFormat const * pFormat )
SwDoc::SwDoc()
: m_pNodes(new SwNodes(*this)),
mpAttrPool(new SwAttrPool(this)),
+ maOLEModifiedIdle( "sw::SwDoc maOLEModifiedIdle" ),
mpMarkManager(new ::sw::mark::MarkManager(*this)),
m_pMetaFieldManager(new ::sw::MetaFieldManager()),
+ m_pContentControlManager(new ::SwContentControlManager()),
m_pDocumentDrawModelManager( new ::sw::DocumentDrawModelManager( *this ) ),
m_pDocumentRedlineManager( new ::sw::DocumentRedlineManager( *this ) ),
m_pDocumentStateManager( new ::sw::DocumentStateManager( *this ) ),
@@ -223,14 +231,14 @@ SwDoc::SwDoc()
mpDfltFrameFormat( new SwFrameFormat( GetAttrPool(), "Frameformat", nullptr ) ),
mpEmptyPageFormat( new SwFrameFormat( GetAttrPool(), "Empty Page", mpDfltFrameFormat.get() ) ),
mpColumnContFormat( new SwFrameFormat( GetAttrPool(), "Columncontainer", mpDfltFrameFormat.get() ) ),
- mpDfltCharFormat( new SwCharFormat( GetAttrPool(), "Character style", nullptr ) ),
+ mpDfltCharFormat( new SwCharFormat( GetAttrPool(), DEFAULT_CHAR_FORMAT_NAME, nullptr ) ),
mpDfltTextFormatColl( new SwTextFormatColl( GetAttrPool(), "Paragraph style" ) ),
mpDfltGrfFormatColl( new SwGrfFormatColl( GetAttrPool(), "Graphikformatvorlage" ) ),
- mpFrameFormatTable( new SwFrameFormats() ),
+ mpFrameFormatTable( new sw::FrameFormats<SwFrameFormat*>() ),
mpCharFormatTable( new SwCharFormats ),
- mpSpzFrameFormatTable( new SwFrameFormats() ),
+ mpSpzFrameFormatTable( new sw::FrameFormats<sw::SpzFrameFormat*>() ),
mpSectionFormatTable( new SwSectionFormats ),
- mpTableFrameFormatTable( new SwFrameFormats() ),
+ mpTableFrameFormatTable( new sw::TableFrameFormats() ),
mpTextFormatCollTable( new SwTextFormatColls() ),
mpGrfFormatCollTable( new SwGrfFormatColls() ),
mpTOXTypes( new SwTOXTypes ),
@@ -244,9 +252,9 @@ SwDoc::SwDoc()
mpNumberFormatter( nullptr ),
mpNumRuleTable( new SwNumRuleTable ),
mpExtInputRing( nullptr ),
- mpGrammarContact(createGrammarContact()),
+ mpGrammarContact(new sw::GrammarContact),
+ mpOnlineAccessibilityCheck(new sw::OnlineAccessibilityCheck(*this)),
mpCellStyles(new SwCellStyleTable),
- m_pXmlIdRegistry(),
mReferenceCount(0),
mbDtor(false),
mbCopyIsMove(false),
@@ -267,7 +275,6 @@ SwDoc::SwDoc()
mbIsPrepareSelAll(false),
meDictionaryMissing( MissingDictionary::Undefined ),
mbContainsAtPageObjWithContentAnchor(false), //#i119292#, fdo#37024
-
meDocType(DOCTYPE_NATIVE)
{
// The DrawingLayer ItemPool which is used as 2nd pool for Writer documents' pool
@@ -296,7 +303,7 @@ SwDoc::SwDoc()
*/
/* Formats */
mpFrameFormatTable->push_back(mpDfltFrameFormat.get());
- mpCharFormatTable->push_back(mpDfltCharFormat.get());
+ mpCharFormatTable->insert(mpDfltCharFormat.get());
/* FormatColls */
// TXT
@@ -325,16 +332,15 @@ SwDoc::SwDoc()
mpOutlineRule->SetCountPhantoms( !GetDocumentSettingManager().get(DocumentSettingId::OLD_NUMBERING) );
new SwTextNode(
- SwNodeIndex(GetUndoManager().GetUndoNodes().GetEndOfContent()),
+ GetUndoManager().GetUndoNodes().GetEndOfContent(),
mpDfltTextFormatColl.get() );
- new SwTextNode( SwNodeIndex( GetNodes().GetEndOfContent() ),
+ new SwTextNode( GetNodes().GetEndOfContent(),
getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ));
maOLEModifiedIdle.SetPriority( TaskPriority::LOWEST );
maOLEModifiedIdle.SetInvokeHandler( LINK( this, SwDoc, DoUpdateModifiedOLE ));
- maOLEModifiedIdle.SetDebugName( "sw::SwDoc maOLEModifiedIdle" );
-#if HAVE_FEATURE_DBCONNECTIVITY
+#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
// Create DBManager
m_pOwnDBManager.reset(new SwDBManager(this));
m_pDBManager = m_pOwnDBManager.get();
@@ -348,7 +354,7 @@ SwDoc::SwDoc()
// pass empty item set containing the paragraph's list attributes
// as ignorable items to the stype manager.
{
- SfxItemSet aIgnorableParagraphItems( GetAttrPool(), svl::Items<RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1>{});
+ SfxItemSetFixed<RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1> aIgnorableParagraphItems( GetAttrPool() );
mpStyleAccess = createStyleManager( &aIgnorableParagraphItems );
}
@@ -366,7 +372,7 @@ SwDoc::SwDoc()
}
mnRsidRoot = mnRsid;
- if (!utl::ConfigManager::IsFuzzing())
+ if (!comphelper::IsFuzzing())
{
// Make sure that in case the document language is not set, then we don't return
// LANGUAGE_DONTKNOW, but the UI locale.
@@ -385,6 +391,8 @@ SwDoc::SwDoc()
}
getIDocumentState().ResetModified();
+
+ s_pLast = this;
}
/**
@@ -394,6 +402,10 @@ SwDoc::SwDoc()
*/
SwDoc::~SwDoc()
{
+ s_pLast = nullptr;
+
+ mxVbaFind.clear();
+
// nothing here should create Undo actions!
GetIDocumentUndoRedo().DoUndo(false);
@@ -403,6 +415,7 @@ SwDoc::~SwDoc()
}
mpGrammarContact.reset();
+ mpOnlineAccessibilityCheck.reset();
getIDocumentTimerAccess().StopIdling(); // stop idle timer
@@ -445,9 +458,9 @@ SwDoc::~SwDoc()
// The ChapterNumbers/Numbers need to be deleted before the styles
// or we update all the time!
- m_pNodes->m_pOutlineNodes->clear();
+ m_pNodes->m_aOutlineNodes.clear();
SwNodes & rUndoNodes( GetUndoManager().GetUndoNodes() );
- rUndoNodes.m_pOutlineNodes->clear();
+ rUndoNodes.m_aOutlineNodes.clear();
mpFootnoteIdxs->clear();
@@ -463,15 +476,13 @@ SwDoc::~SwDoc()
SwPaM* pTmp = mpExtInputRing;
mpExtInputRing = nullptr;
while( pTmp->GetNext() != pTmp )
+ {
+ // coverity[deref_arg] - the SwPaM delete moves a new entry into GetNext()
delete pTmp->GetNext();
+ }
delete pTmp;
}
- for(auto& pType : *mpTOXTypes)
- pType->CallSwClientNotify(sw::DocumentDyingHint());
- mpTOXTypes->clear();
- mpDefTOXBases.reset();
-
// Any of the FrameFormats can still have indices registered.
// These need to be destroyed now at the latest.
for( SwFrameFormat* pFormat : *mpFrameFormatTable )
@@ -495,6 +506,14 @@ SwDoc::~SwDoc()
m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() );
rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() );
+ // clear TOX after nodes - TOXMarks are gone now so SwTOXType has no clients
+ for (const auto& pType : *mpTOXTypes)
+ {
+ pType->CallSwClientNotify(sw::DocumentDyingHint());
+ }
+ mpTOXTypes->clear();
+ mpDefTOXBases.reset();
+
// Delete Formats, make it permanent some time in the future
// Delete for Collections
@@ -531,9 +550,8 @@ SwDoc::~SwDoc()
* now.
*/
mpFrameFormatTable->erase( mpFrameFormatTable->begin() );
- mpCharFormatTable->erase( mpCharFormatTable->begin() );
-#if HAVE_FEATURE_DBCONNECTIVITY
+#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
// On load, SwDBManager::setEmbeddedName() may register a data source.
// If we have an embedded one, then sDataSource points to the registered name, so revoke it here.
if (!m_pOwnDBManager->getEmbeddedName().isEmpty() && !maDBData.sDataSource.isEmpty())
@@ -672,15 +690,15 @@ void SwDoc::ClearDoc()
SwNodeIndex aSttIdx( *GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
// create the first one over and over again (without attributes/style etc.
- SwTextNode* pFirstNd = GetNodes().MakeTextNode( aSttIdx, mpDfltTextFormatColl.get() );
+ SwTextNode* pFirstNd = GetNodes().MakeTextNode( aSttIdx.GetNode(), mpDfltTextFormatColl.get() );
if( getIDocumentLayoutAccess().GetCurrentViewShell() )
{
// set the layout to the dummy pagedesc
pFirstNd->SetAttr( SwFormatPageDesc( pDummyPgDsc ));
- SwPosition aPos( *pFirstNd, SwIndex( pFirstNd ));
- SwPaM const tmpPaM(aSttIdx, SwNodeIndex(GetNodes().GetEndOfContent()));
+ SwPosition aPos( *pFirstNd );
+ SwPaM const tmpPaM(aSttIdx.GetNode(), GetNodes().GetEndOfContent());
::PaMCorrAbs(tmpPaM, aPos);
}
@@ -728,7 +746,7 @@ void SwDoc::ClearDoc()
mpTextFormatCollTable->DeleteAndDestroy(2, mpTextFormatCollTable->size());
mpTextFormatCollTable->DeleteAndDestroy(1, mpTextFormatCollTable->size());
mpGrfFormatCollTable->DeleteAndDestroy(1, mpGrfFormatCollTable->size());
- mpCharFormatTable->DeleteAndDestroy(1, mpCharFormatTable->size());
+ mpCharFormatTable->DeleteAndDestroyAll(/*keepDefault*/true);
if( getIDocumentLayoutAccess().GetCurrentViewShell() )
{
@@ -800,14 +818,6 @@ void SwDoc::WriteLayoutCache( SvStream& rStream )
SwLayoutCache::Write( rStream, *this );
}
-IGrammarContact* getGrammarContact( const SwTextNode& rTextNode )
-{
- const SwDoc& rDoc = rTextNode.GetDoc();
- if (rDoc.IsInDtor())
- return nullptr;
- return rDoc.getGrammarContact();
-}
-
::sfx2::IXmlIdRegistry&
SwDoc::GetXmlIdRegistry()
{
@@ -843,27 +853,37 @@ void SwDoc::InitTOXTypes()
void SwDoc::ReplaceDefaults(const SwDoc& rSource)
{
// copy property defaults
- const sal_uInt16 aRangeOfDefaults[] =
- {
- RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ static const WhichRangesContainer aRangeOfDefaults(svl::Items<
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_PARATR_BEGIN, RES_PARATR_END-1,
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- XATTR_START, XATTR_END-1,
- 0
- };
+ XATTR_START, XATTR_END-1
+ >);
SfxItemSet aNewDefaults(GetAttrPool(), aRangeOfDefaults);
- for (auto nRange = 0; aRangeOfDefaults[nRange] != 0; nRange += 2)
+ for (const WhichPair& rPair : aRangeOfDefaults)
{
- for (sal_uInt16 nWhich = aRangeOfDefaults[nRange];
- nWhich <= aRangeOfDefaults[nRange + 1]; ++nWhich)
+ for (sal_uInt16 nWhich = rPair.first;
+ nWhich <= rPair.second; ++nWhich)
{
- const SfxPoolItem& rSourceAttr =
- rSource.mpAttrPool->GetDefaultItem(nWhich);
- if (rSourceAttr != mpAttrPool->GetDefaultItem(nWhich))
+ const SfxPoolItem& rSourceAttr(rSource.mpAttrPool->GetUserOrPoolDefaultItem(nWhich));
+ const SfxPoolItem& rDestAttr(mpAttrPool->GetUserOrPoolDefaultItem(nWhich));
+ bool bEqual(SfxPoolItem::areSame(rSourceAttr, rDestAttr));
+
+ if (!bEqual && rSourceAttr.isSetItem() && rDestAttr.isSetItem())
+ {
+ // the normal SfxSetItem::operator== returns false when pools are different,
+ // which will always be the case here. Use the compare without pool
+ // comparison - the chances that the defaults in pools of the same type are
+ // equal are high, and cloning them is expensive
+ bEqual = static_cast<const SfxSetItem&>(rSourceAttr).GetItemSet().Equals(
+ static_cast<const SfxSetItem&>(rDestAttr).GetItemSet(), false);
+ }
+
+ if (!bEqual)
aNewDefaults.Put(rSourceAttr);
}
}
@@ -879,12 +899,12 @@ 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
-SfxObjectShell* SwDoc::CreateCopy( bool bCallInitNew, bool bEmpty ) const
+rtl::Reference<SfxObjectShell> SwDoc::CreateCopy(bool bCallInitNew, bool bEmpty) const
{
SAL_INFO( "sw.pageframe", "(SwDoc::CreateCopy in" );
rtl::Reference<SwDoc> xRet( new SwDoc );
@@ -892,7 +912,7 @@ SfxObjectShell* SwDoc::CreateCopy( bool bCallInitNew, bool bEmpty ) const
// we have to use pointer here, since the callee has to decide whether
// SfxObjectShellLock or SfxObjectShellRef should be used sometimes the
// object will be returned with refcount set to 0 ( if no DoInitNew is done )
- SfxObjectShell* pRetShell = new SwDocShell( *xRet, SfxObjectCreateMode::STANDARD );
+ rtl::Reference<SfxObjectShell> pRetShell = new SwDocShell(*xRet, SfxObjectCreateMode::STANDARD);
if( bCallInitNew )
{
// it could happen that DoInitNew creates model,
@@ -906,6 +926,14 @@ SfxObjectShell* SwDoc::CreateCopy( bool bCallInitNew, bool bEmpty ) const
xRet->ReplaceStyles(*this);
+ uno::Reference<beans::XPropertySet> const xThisSet(
+ GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> const xRetSet(
+ pRetShell->GetBaseModel(), uno::UNO_QUERY_THROW);
+ uno::Sequence<beans::PropertyValue> aInteropGrabBag;
+ xThisSet->getPropertyValue("InteropGrabBag") >>= aInteropGrabBag;
+ xRetSet->setPropertyValue("InteropGrabBag", uno::Any(aInteropGrabBag));
+
if( !bEmpty )
{
#ifdef DBG_UTIL
@@ -1023,15 +1051,15 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
#ifdef DBG_UTIL
SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType())
<< std::dec << " " << aSourceIdx.GetNode().GetIndex() );
- aSourceIdx++;
+ ++aSourceIdx;
SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType())
<< std::dec << " " << aSourceIdx.GetNode().GetIndex() );
if ( aSourceIdx.GetNode().GetNodeType() != SwNodeType::End ) {
- aSourceIdx++;
+ ++aSourceIdx;
SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType()) << std::dec );
- aSourceIdx--;
+ --aSourceIdx;
}
- aSourceIdx--;
+ --aSourceIdx;
SAL_INFO( "sw.docappend", ".." );
SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceEndIdx.GetNode().GetNodeType())
<< std::dec << " " << aSourceEndIdx.GetNode().GetIndex() );
@@ -1082,19 +1110,19 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
{
SwNodeIndex aBreakIdx( GetNodes().GetEndOfContent(), -1 );
SwPosition aBreakPos( aBreakIdx );
- // InsertPageBreak just works on SwTextNode nodes, so make
- // sure the last node is one!
- bool bIsTextNode = aBreakIdx.GetNode().IsTextNode();
- if ( !bIsTextNode )
- getIDocumentContentOperations().AppendTextNode( aBreakPos );
- const OUString name = pTargetPageDesc->GetName();
- pTargetShell->InsertPageBreak( &name, nStartPageNumber );
- if ( !bIsTextNode )
- {
- pTargetShell->SttEndDoc( false );
- --aBreakIdx;
- GetNodes().Delete( aBreakIdx );
- }
+ // insert new node - will be removed at the end...
+ // (don't SplitNode() as it may move flys to the wrong node)
+ getIDocumentContentOperations().AppendTextNode(aBreakPos);
+ SwFormatPageDesc pageDesc(pTargetPageDesc);
+ pageDesc.SetNumOffset(nStartPageNumber);
+ // set break on the last paragraph
+ getIDocumentContentOperations().InsertPoolItem(SwPaM(aBreakPos),
+ pageDesc, SetAttrMode::DEFAULT, pTargetShell->GetLayout());
+ // tdf#148309 move to the last node - so that the "flush page break"
+ // code below will format the frame of the node with the page break,
+ // which is required for new page frames to be created! Else layout
+ // performance will be terrible.
+ pTargetShell->SttEndDoc(false);
// There is now a new empty text node on the new page. If it has
// any marks, those are from the previous page: move them back
@@ -1108,7 +1136,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
// Collect the marks starting or ending at this text node.
o3tl::sorted_vector<sw::mark::IMark*> aSeenMarks;
IDocumentMarkAccess* pMarkAccess = getIDocumentMarkAccess();
- for (const SwIndex* pIndex = pTextNode->GetFirstIndex(); pIndex; pIndex = pIndex->GetNext())
+ for (const SwContentIndex* pIndex = pTextNode->GetFirstIndex(); pIndex; pIndex = pIndex->GetNext())
{
sw::mark::IMark* pMark = const_cast<sw::mark::IMark*>(pIndex->GetMark());
if (!pMark)
@@ -1125,6 +1153,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
if ( !bDeletePrevious )
{
SAL_INFO( "sw.pageframe", "(Flush pagebreak AKA EndAllAction" );
+ assert(pTargetShell->GetCursor()->GetPoint()->GetNode().GetTextNode()->GetSwAttrSet().HasItem(RES_PAGEDESC));
pTargetShell->EndAllAction();
SAL_INFO( "sw.pageframe", "Flush changes AKA EndAllAction)" );
pTargetShell->StartAllAction();
@@ -1139,15 +1168,14 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
SwNodeIndex aFixupIdx( GetNodes().GetEndOfContent(), -1 );
// append at the end of document / content
- SwNodeIndex aTargetIdx( GetNodes().GetEndOfContent() );
- SwPaM aInsertPam( aTargetIdx );
+ SwPaM aInsertPam( GetNodes().GetEndOfContent() );
#ifdef DBG_UTIL
- SAL_INFO( "sw.docappend", "Pam-Nd: " << aCpyPam.GetNode().GetIndex() - aCpyPam.GetNode( false ).GetIndex() + 1
- << " (0x" << std::hex << static_cast<int>(aCpyPam.GetNode( false ).GetNodeType()) << std::dec
- << " " << aCpyPam.GetNode( false ).GetIndex()
- << " - 0x" << std::hex << static_cast<int>(aCpyPam.GetNode().GetNodeType()) << std::dec
- << " " << aCpyPam.GetNode().GetIndex() << ")" );
+ SAL_INFO( "sw.docappend", "Pam-Nd: " << aCpyPam.GetPointNode().GetIndex() - aCpyPam.GetMarkNode().GetIndex() + 1
+ << " (0x" << std::hex << static_cast<int>(aCpyPam.GetMarkNode().GetNodeType()) << std::dec
+ << " " << aCpyPam.GetMarkNode().GetIndex()
+ << " - 0x" << std::hex << static_cast<int>(aCpyPam.GetPointNode().GetNodeType()) << std::dec
+ << " " << aCpyPam.GetPointNode().GetIndex() << ")" );
#endif
GetIDocumentUndoRedo().StartUndo( SwUndoId::INSGLOSSARY, nullptr );
@@ -1165,9 +1193,9 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
SwPosition& rInsPos = *aInsertPam.GetPoint();
{
- SwNodeIndex aIndexBefore(rInsPos.nNode);
+ SwNodeIndex aIndexBefore(rInsPos.GetNode());
- aIndexBefore--;
+ --aIndexBefore;
#ifdef DBG_UTIL
SAL_INFO( "sw.docappend", "CopyRange In: " << CNTNT_DOC( this ) );
#endif
@@ -1178,16 +1206,15 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
#endif
++aIndexBefore;
- SwPaM aPaM(SwPosition(aIndexBefore),
- SwPosition(rInsPos.nNode));
+ SwPaM aPaM(aIndexBefore.GetNode(), rInsPos.GetNode());
aPaM.GetDoc().MakeUniqueNumRules(aPaM);
// Update the rsid of each pasted text node
SwNodes &rDestNodes = GetNodes();
- sal_uLong const nEndIdx = aPaM.End()->nNode.GetIndex();
+ SwNodeOffset const nEndIdx = aPaM.End()->GetNodeIndex();
- for (sal_uLong nIdx = aPaM.Start()->nNode.GetIndex();
+ for (SwNodeOffset nIdx = aPaM.Start()->GetNodeIndex();
nIdx <= nEndIdx; ++nIdx)
{
SwTextNode *const pTextNode = rDestNodes[nIdx]->GetTextNode();
@@ -1197,7 +1224,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
@@ -1209,7 +1236,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
// find the first node allowed to contain a RES_PAGEDESC
while (true) {
- aFixupIdx++;
+ ++aFixupIdx;
SwNode &node = aFixupIdx.GetNode();
if ( node.IsTextNode() ) {
@@ -1278,7 +1305,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
}
// finally copy page bound frames
- for ( auto pCpyFormat : *rSource.GetSpzFrameFormats() )
+ for(sw::SpzFrameFormat* pCpyFormat: *rSource.GetSpzFrameFormats())
{
const SwFrameFormat& rCpyFormat = *pCpyFormat;
SwFormatAnchor aAnchor( rCpyFormat.GetAnchor() );