[Libreoffice-commits] core.git: sw/source
Jan-Marek Glogowski
glogow at fbihome.de
Wed Sep 10 04:07:12 PDT 2014
sw/source/core/doc/docnew.cxx | 82 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 81 insertions(+), 1 deletion(-)
New commits:
commit 3b9361a930d62430044ea0b746f4b5751dbb8d88
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Tue Jul 1 15:48:01 2014 +0200
Add debug messages for sw.{createcopy,docappend}
This adds a lot of SAL_INFO messages to SwDoc::CreateCopy and
SwDoc::Append.
Change-Id: Ie924e20698bec84482fcc5496175a9e29245729e
Reviewed-on: https://gerrit.libreoffice.org/10969
Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index ea9b136..fc7288b 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -891,6 +891,13 @@ void SwDoc::ReplaceCompatabilityOptions(const SwDoc& rSource)
m_pDocumentSettingManager->ReplaceCompatibilityOptions(rSource.GetDocumentSettingManager());
}
+#ifdef DBG_UTIL
+#define CNTNT_DOC( doc ) \
+ ((doc)->GetNodes().GetEndOfContent().GetIndex() - (doc)->GetNodes().GetEndOfExtras().GetIndex() - 2)
+#define CNTNT_IDX( idx ) \
+ ((idx).GetNode().GetIndex() - GetNodes().GetEndOfExtras().GetIndex() - 1)
+#endif
+
SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
{
SwDoc* pRet = new SwDoc;
@@ -914,7 +921,14 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
pRet->ReplaceStyles(*this);
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.createcopy", "CC-Nd-Src: " << CNTNT_DOC( this ) );
+ SAL_INFO( "sw.createcopy", "CC-Nd: " << CNTNT_DOC( pRet ) );
+#endif
pRet->Append(*this, 0, NULL, bCallInitNew);
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.createcopy", "CC-Nd: " << CNTNT_DOC( pRet ) );
+#endif
// remove the temporary shell if it is there as it was done before
pRet->SetTmpDocShell( (SfxObjectShell*)NULL );
@@ -944,9 +958,35 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
else
aCpyPam = SwPaM( aSourceIdx, aSourceEndIdx );
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceIdx.GetNode().GetNodeType()
+ << std::dec << " " << aSourceIdx.GetNode().GetIndex() );
+ aSourceIdx++;
+ SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceIdx.GetNode().GetNodeType()
+ << std::dec << " " << aSourceIdx.GetNode().GetIndex() );
+ if ( aSourceIdx.GetNode().GetNodeType() != ND_ENDNODE ) {
+ aSourceIdx++;
+ SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceIdx.GetNode().GetNodeType() << std::dec );
+ aSourceIdx--;
+ }
+ aSourceIdx--;
+ SAL_INFO( "sw.docappend", ".." );
+ SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceEndIdx.GetNode().GetNodeType()
+ << std::dec << " " << aSourceEndIdx.GetNode().GetIndex() );
+ aSourceEndIdx++;
+ SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceEndIdx.GetNode().GetNodeType()
+ << std::dec << " " << aSourceEndIdx.GetNode().GetIndex() );
+ aSourceEndIdx--;
+ SAL_INFO( "sw.docappend", "Src-Nd: " << CNTNT_DOC( &rSource ) );
+ SAL_INFO( "sw.docappend", "Nd: " << CNTNT_DOC( this ) );
+#endif
+
SwWrtShell* pTargetShell = GetDocShell()->GetWrtShell();
sal_uInt16 nPhysPageNumber = 0;
if ( pTargetShell ) {
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.docappend", "Has target write shell" );
+#endif
pTargetShell->StartAllAction();
// Otherwise we have to handle SwDummySectionNodes as first node
@@ -963,7 +1003,13 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
// We always start on an odd physical page number
if (1 == nPhysPageNumber % 2)
nPhysPageNumber++;
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.docappend", "PPNo " << nPhysPageNumber );
+#endif
}
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.docappend", "Nd: " << CNTNT_DOC( this ) );
+#endif
// -1, otherwise aFixupIdx would move to new EOC
SwNodeIndex aFixupIdx( GetNodes().GetEndOfContent(), -1 );
@@ -972,6 +1018,13 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
SwNodeIndex aTargetIdx( GetNodes().GetEndOfContent() );
SwPaM aInsertPam( aTargetIdx );
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.docappend", "Pam-Nd: " << aCpyPam.GetNode( true ).GetIndex() - aCpyPam.GetNode( false ).GetIndex() + 1
+ << " (0x" << std::hex << (int) aCpyPam.GetNode( false ).GetNodeType() << std::dec
+ << " " << aCpyPam.GetNode( false ).GetIndex()
+ << " - 0x" << std::hex << (int) aCpyPam.GetNode( true ).GetNodeType() << std::dec
+ << " " << aCpyPam.GetNode( true ).GetIndex() << ")" );
+#endif
this->GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL );
this->getIDocumentFieldsAccess().LockExpFlds();
@@ -987,9 +1040,14 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
SwNodeIndex aIndexBefore(rInsPos.nNode);
aIndexBefore--;
-
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.docappend", "CopyRange In: " << CNTNT_DOC( this ) );
+#endif
rSource.getIDocumentContentOperations().CopyRange( aCpyPam, rInsPos, true );
// Note: aCpyPam is invalid now
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.docappend", "CopyRange Out: " << CNTNT_DOC( this ) );
+#endif
++aIndexBefore;
SwPaM aPaM(SwPosition(aIndexBefore),
@@ -1039,8 +1097,18 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
}
}
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.docappend", "Idx Del " << CNTNT_IDX( aDelIdx ) );
+ SAL_INFO( "sw.docappend", "Idx Fix " << CNTNT_IDX( aFixupIdx ) );
+#endif
// just update the original instead of overwriting
SwFmtPageDesc *aDesc = static_cast< SwFmtPageDesc* >( pNewItem );
+#ifdef DBG_UTIL
+if ( aDesc->GetPageDesc() )
+ SAL_INFO( "sw.docappend", "PD Update " << aDesc->GetPageDesc()->GetName() );
+else
+ SAL_INFO( "sw.docappend", "PD New" );
+#endif
if ( nStartPageNumber )
aDesc->SetNumOffset( nStartPageNumber );
if ( pTargetPageDesc )
@@ -1051,6 +1119,9 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
pFmt->SetFmtAttr( *aDesc );
delete pNewItem;
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.docappend", "Idx " << CNTNT_IDX( aDelIdx ) );
+#endif
iDelNodes++;
}
@@ -1064,6 +1135,11 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
if ( pTargetShell )
pTargetShell->SttEndDoc( false );
aDelIdx -= (iDelNodes - 1);
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.docappend", "iDelNodes: " << iDelNodes
+ << " Idx: " << aDelIdx.GetNode().GetIndex()
+ << " EOE: " << GetNodes().GetEndOfExtras().GetIndex() );
+#endif
GetNodes().Delete( aDelIdx, iDelNodes );
}
}
@@ -1076,6 +1152,10 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
if (FLY_AT_PAGE != aAnchor.GetAnchorId())
continue;
+#ifdef DBG_UTIL
+ SAL_INFO( "sw.docappend", "PaAn: " << aAnchor.GetPageNum()
+ << " => " << aAnchor.GetPageNum() + nPhysPageNumber );
+#endif
if ( nPhysPageNumber )
aAnchor.SetPageNum( aAnchor.GetPageNum() + nPhysPageNumber );
this->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
More information about the Libreoffice-commits
mailing list