Kaydet (Commit) 3b9361a9 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski Kaydeden (comit) Björn Michaelsen

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/10969Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@canonical.com>
üst c808802e
...@@ -891,6 +891,13 @@ void SwDoc::ReplaceCompatabilityOptions(const SwDoc& rSource) ...@@ -891,6 +891,13 @@ void SwDoc::ReplaceCompatabilityOptions(const SwDoc& rSource)
m_pDocumentSettingManager->ReplaceCompatibilityOptions(rSource.GetDocumentSettingManager()); 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 SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
{ {
SwDoc* pRet = new SwDoc; SwDoc* pRet = new SwDoc;
...@@ -914,7 +921,14 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const ...@@ -914,7 +921,14 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
pRet->ReplaceStyles(*this); 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); 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 // remove the temporary shell if it is there as it was done before
pRet->SetTmpDocShell( (SfxObjectShell*)NULL ); pRet->SetTmpDocShell( (SfxObjectShell*)NULL );
...@@ -944,9 +958,35 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber, ...@@ -944,9 +958,35 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
else else
aCpyPam = SwPaM( aSourceIdx, aSourceEndIdx ); 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(); SwWrtShell* pTargetShell = GetDocShell()->GetWrtShell();
sal_uInt16 nPhysPageNumber = 0; sal_uInt16 nPhysPageNumber = 0;
if ( pTargetShell ) { if ( pTargetShell ) {
#ifdef DBG_UTIL
SAL_INFO( "sw.docappend", "Has target write shell" );
#endif
pTargetShell->StartAllAction(); pTargetShell->StartAllAction();
// Otherwise we have to handle SwDummySectionNodes as first node // Otherwise we have to handle SwDummySectionNodes as first node
...@@ -963,7 +1003,13 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber, ...@@ -963,7 +1003,13 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
// We always start on an odd physical page number // We always start on an odd physical page number
if (1 == nPhysPageNumber % 2) if (1 == nPhysPageNumber % 2)
nPhysPageNumber++; 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 // -1, otherwise aFixupIdx would move to new EOC
SwNodeIndex aFixupIdx( GetNodes().GetEndOfContent(), -1 ); SwNodeIndex aFixupIdx( GetNodes().GetEndOfContent(), -1 );
...@@ -972,6 +1018,13 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber, ...@@ -972,6 +1018,13 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
SwNodeIndex aTargetIdx( GetNodes().GetEndOfContent() ); SwNodeIndex aTargetIdx( GetNodes().GetEndOfContent() );
SwPaM aInsertPam( aTargetIdx ); 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->GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL );
this->getIDocumentFieldsAccess().LockExpFlds(); this->getIDocumentFieldsAccess().LockExpFlds();
...@@ -987,9 +1040,14 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber, ...@@ -987,9 +1040,14 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
SwNodeIndex aIndexBefore(rInsPos.nNode); SwNodeIndex aIndexBefore(rInsPos.nNode);
aIndexBefore--; aIndexBefore--;
#ifdef DBG_UTIL
SAL_INFO( "sw.docappend", "CopyRange In: " << CNTNT_DOC( this ) );
#endif
rSource.getIDocumentContentOperations().CopyRange( aCpyPam, rInsPos, true ); rSource.getIDocumentContentOperations().CopyRange( aCpyPam, rInsPos, true );
// Note: aCpyPam is invalid now // Note: aCpyPam is invalid now
#ifdef DBG_UTIL
SAL_INFO( "sw.docappend", "CopyRange Out: " << CNTNT_DOC( this ) );
#endif
++aIndexBefore; ++aIndexBefore;
SwPaM aPaM(SwPosition(aIndexBefore), SwPaM aPaM(SwPosition(aIndexBefore),
...@@ -1039,8 +1097,18 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber, ...@@ -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 // just update the original instead of overwriting
SwFmtPageDesc *aDesc = static_cast< SwFmtPageDesc* >( pNewItem ); 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 ) if ( nStartPageNumber )
aDesc->SetNumOffset( nStartPageNumber ); aDesc->SetNumOffset( nStartPageNumber );
if ( pTargetPageDesc ) if ( pTargetPageDesc )
...@@ -1051,6 +1119,9 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber, ...@@ -1051,6 +1119,9 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
pFmt->SetFmtAttr( *aDesc ); pFmt->SetFmtAttr( *aDesc );
delete pNewItem; delete pNewItem;
#ifdef DBG_UTIL
SAL_INFO( "sw.docappend", "Idx " << CNTNT_IDX( aDelIdx ) );
#endif
iDelNodes++; iDelNodes++;
} }
...@@ -1064,6 +1135,11 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber, ...@@ -1064,6 +1135,11 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
if ( pTargetShell ) if ( pTargetShell )
pTargetShell->SttEndDoc( false ); pTargetShell->SttEndDoc( false );
aDelIdx -= (iDelNodes - 1); 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 ); GetNodes().Delete( aDelIdx, iDelNodes );
} }
} }
...@@ -1076,6 +1152,10 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber, ...@@ -1076,6 +1152,10 @@ void SwDoc::Append( const SwDoc& rSource, sal_uInt16 nStartPageNumber,
SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() ); SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
if (FLY_AT_PAGE != aAnchor.GetAnchorId()) if (FLY_AT_PAGE != aAnchor.GetAnchorId())
continue; continue;
#ifdef DBG_UTIL
SAL_INFO( "sw.docappend", "PaAn: " << aAnchor.GetPageNum()
<< " => " << aAnchor.GetPageNum() + nPhysPageNumber );
#endif
if ( nPhysPageNumber ) if ( nPhysPageNumber )
aAnchor.SetPageNum( aAnchor.GetPageNum() + nPhysPageNumber ); aAnchor.SetPageNum( aAnchor.GetPageNum() + nPhysPageNumber );
this->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); this->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment