summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2011-04-01 15:14:14 +0200
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2011-04-06 22:32:33 +0200
commit16431d950e573101ff8eb31c054346422d18c516 (patch)
tree85656b87e3a70ad2499df7d790a741d009293d62
parent8989755c4193529cdc143938a00d5d7b53640271 (diff)
sw: move all layout dumping in the SwFrm::dumpAsXml to allow calls from gdb
-rw-r--r--sw/source/core/inc/frame.hxx4
-rw-r--r--sw/source/core/layout/tabfrm.cxx2
-rw-r--r--sw/source/core/text/porlin.hxx3
-rw-r--r--sw/source/core/text/portxt.hxx4
-rw-r--r--sw/source/core/text/xmldump.cxx79
-rw-r--r--sw/source/core/undo/SwUndoPageDesc.cxx20
-rw-r--r--sw/source/ui/docvw/edtwin.cxx10
7 files changed, 22 insertions, 100 deletions
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index c4e097762c..88d9b13f0a 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -906,7 +906,9 @@ public:
public:
#if OSL_DEBUG_LEVEL > 1
- virtual void dumpAsXml(xmlTextWriterPtr writer);
+ /** if writer is NULL, dumps the layout structure as XML in layout.xml
+ */
+ virtual void dumpAsXml(xmlTextWriterPtr writer = NULL );
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
void dumpChildrenAsXml(xmlTextWriterPtr writer);
#endif
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 93cbfc356d..aaa73cab89 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1568,7 +1568,7 @@ bool SwCntntFrm::CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave,
}
#if OSL_DEBUG_LEVEL > 1
- OSL_FAIL( "LoopControl in SwCntntFrm::CalcLowers" )
+ OSL_FAIL( "LoopControl in SwCntntFrm::CalcLowers" );
#endif
}
}
diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx
index 8d9693fdb9..6a45c56ba0 100644
--- a/sw/source/core/text/porlin.hxx
+++ b/sw/source/core/text/porlin.hxx
@@ -200,9 +200,6 @@ public:
// Accessibility: pass information about this portion to the PortionHandler
virtual void HandlePortion( SwPortionHandler& rPH ) const;
-#if OSL_DEBUG_LEVEL > 1
- void dumpPortionAsXml(sal_uInt16 ofs, String& aText, xmlTextWriter* writer);
-#endif
OUTPUT_OPERATOR
};
diff --git a/sw/source/core/text/portxt.hxx b/sw/source/core/text/portxt.hxx
index 5fe9a939b5..43ed29d7fc 100644
--- a/sw/source/core/text/portxt.hxx
+++ b/sw/source/core/text/portxt.hxx
@@ -67,10 +67,6 @@ public:
// Accessibility: pass information about this portion to the PortionHandler
virtual void HandlePortion( SwPortionHandler& rPH ) const;
-#if OSL_DEBUG_LEVEL > 1
- void dumpPortionAsXml(sal_uInt16 ofs, String& aText, xmlTextWriter* writer);
-#endif
-
OUTPUT_OPERATOR
DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion)
};
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 3209fbadac..949ffc485d 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -130,80 +130,28 @@ class XmlPortionDumper:public SwPortionHandler
#if OSL_DEBUG_LEVEL > 1
-void SwTxtPortion::dumpPortionAsXml( xub_StrLen ofs, XubString & /*aText */,
- xmlTextWriterPtr writer )
+namespace
{
- xmlTextWriterStartElement( writer, BAD_CAST( "SwTxtPortion" ) );
- xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ofs" ), "%i", ofs );
- xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "len" ), "%i",
- ( int ) this->GetLen( ) );
-
- xmlTextWriterEndElement( writer );
-}
-
-void SwLinePortion::dumpPortionAsXml( xub_StrLen ofs, XubString & /*aText */,
- xmlTextWriterPtr writer )
-{
- xmlTextWriterStartElement( writer, BAD_CAST( "SwLinePortion" ) );
- xmlTextWriterWriteFormatAttribute( writer,
- BAD_CAST( "nWhichPor" ),
- "%04X",
- ( int ) this->GetWhichPor( ) );
- xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ofs" ), "%i", ofs );
- xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "len" ), "%i",
- ( int ) this->GetLen( ) );
- xmlTextWriterEndElement( writer );
-}
-
-void SwLineLayout::dumpLineAsXml( xmlTextWriterPtr writer,
- xub_StrLen & ofs, XubString & aText )
-{ // not used any longer...
- xmlTextWriterStartElement( writer, BAD_CAST( "SwLineLayout" ) );
- SwLinePortion *portion = this;
- while ( portion != NULL )
+ xmlTextWriterPtr lcl_createDefaultWriter()
{
- portion->dumpPortionAsXml( ofs, aText, writer );
- ofs += portion->GetLen( );
- portion = portion->GetPortion( );
+ xmlTextWriterPtr writer = xmlNewTextWriterFilename( "layout.xml", 0 );
+ xmlTextWriterStartDocument(writer, NULL, NULL, NULL);
+ return writer;
}
- xmlTextWriterEndElement( writer );
-}
-
-
-void SwParaPortion::dumpAsXml( xmlTextWriterPtr writer, SwTxtFrm * pTxtFrm )
-{
- xmlTextWriterStartElement( writer, BAD_CAST( "SwParaPortion" ) );
- SwParaPortion *pPara = this;
- if ( pPara && pTxtFrm )
+ void lcl_freeWriter( xmlTextWriterPtr writer )
{
- xub_StrLen ofs = 0;
- XubString & aText = ( String & ) pTxtFrm->GetTxt( );
- if ( pTxtFrm->IsFollow( ) )
- ofs += pTxtFrm->GetOfst( );
-
- SwLineLayout *pLine = pPara;
- while ( pLine )
- {
- xmlTextWriterStartElement( writer, BAD_CAST( "line" ) );
- SwLinePortion *pPor = pLine->GetFirstPortion( );
- while ( pPor )
- {
- pPor->dumpPortionAsXml( ofs, aText, writer );
- ofs += pPor->GetLen( );
- pPor = pPor->GetPortion( );
- }
-
- xmlTextWriterEndElement( writer ); // line
- pLine = pLine->GetNext( );
- }
+ xmlTextWriterEndDocument(writer);
+ xmlFreeTextWriter( writer );
}
- xmlTextWriterEndElement( writer );
}
-
void SwFrm::dumpAsXml( xmlTextWriterPtr writer )
{
+ bool bCreateWriter = ( NULL == writer );
+ if ( bCreateWriter )
+ writer = lcl_createDefaultWriter();
+
const char *name = NULL;
switch ( GetType( ) )
@@ -286,6 +234,9 @@ void SwFrm::dumpAsXml( xmlTextWriterPtr writer )
}
xmlTextWriterEndElement( writer );
}
+
+ if ( bCreateWriter )
+ lcl_freeWriter( writer );
}
void SwFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx
index c8f9b0cc84..cb79448fff 100644
--- a/sw/source/core/undo/SwUndoPageDesc.cxx
+++ b/sw/source/core/undo/SwUndoPageDesc.cxx
@@ -41,12 +41,12 @@
#include <fmtcntnt.hxx>
#include <fmthdft.hxx>
-#ifdef DEBUG
+#if OSL_DEBUG_LEVEL > 1
#include <ndindex.hxx>
#endif
-#ifdef DEBUG
+#if OSL_DEBUG_LEVEL > 1
// Pure debug help function to have a quick look at the header/footer attributes.
void DebugHeaderFooterContent( const SwPageDesc& rPageDesc )
{
@@ -64,10 +64,6 @@ void DebugHeaderFooterContent( const SwPageDesc& rPageDesc )
SwFrmFmt* pHeaderFmt = rHead.GetHeaderFmt();
if( pHeaderFmt )
{
- nHeaderCount = pHeaderFmt->GetClientCount();
- {
- int nHeaderCount = 0;
- }
const SwFmtCntnt* pCntnt = &pHeaderFmt->GetCntnt();
if( pCntnt->GetCntntIdx() )
nHeaderMaster = pCntnt->GetCntntIdx()->GetIndex();
@@ -77,10 +73,6 @@ void DebugHeaderFooterContent( const SwPageDesc& rPageDesc )
SwFrmFmt* pLeftHeaderFmt = rLeftHead.GetHeaderFmt();
if( pLeftHeaderFmt )
{
- nLeftHeaderCount = pLeftHeaderFmt->GetClientCount();
- {
- int nLeftHeaderCount = 0;
- }
const SwFmtCntnt* pLeftCntnt = &pLeftHeaderFmt->GetCntnt();
if( pLeftCntnt->GetCntntIdx() )
nHeaderLeft = pLeftCntnt->GetCntntIdx()->GetIndex();
@@ -93,10 +85,6 @@ void DebugHeaderFooterContent( const SwPageDesc& rPageDesc )
SwFrmFmt* pFooterFmt = rFoot.GetFooterFmt();
if( pFooterFmt )
{
- nFooterCount = pFooterFmt->GetClientCount();
- {
- int nFooterCount = 0;
- }
const SwFmtCntnt* pCntnt = &pFooterFmt->GetCntnt();
if( pCntnt->GetCntntIdx() )
nFooterMaster = pCntnt->GetCntntIdx()->GetIndex();
@@ -106,10 +94,6 @@ void DebugHeaderFooterContent( const SwPageDesc& rPageDesc )
SwFrmFmt* pLeftFooterFmt = rLeftFoot.GetFooterFmt();
if( pLeftFooterFmt )
{
- nLeftFooterCount = pLeftFooterFmt->GetClientCount();
- {
- int nLeftFooterCount = 0;
- }
const SwFmtCntnt* pLeftCntnt = &pLeftFooterFmt->GetCntnt();
if( pLeftCntnt->GetCntntIdx() )
nFooterLeft = pLeftCntnt->GetCntntIdx()->GetIndex();
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 4710481dd0..8bed836e01 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -1284,15 +1284,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
if (rKEvt.GetKeyCode().GetCode() == KEY_F12)
{
SwRootFrm* pLayout = GetView().GetDocShell()->GetWrtShell()->GetLayout();
- xmlTextWriterPtr writer = xmlNewTextWriterFilename("layout.xml", 0);
- if (writer!=NULL)
- {
- printf("dumping layout in \"layout.xml\"\n");
- xmlTextWriterStartDocument(writer, NULL, NULL, NULL);
- pLayout->dumpAsXml(writer);
- xmlTextWriterEndDocument(writer);
- xmlFreeTextWriter(writer);
- }
+ pLayout->dumpAsXml( );
return;
}
#endif