Kaydet (Commit) 0772e9af authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

layout dumper: dump anchored objects too

üst 408f9e77
...@@ -193,6 +193,10 @@ class SW_DLLPUBLIC SwAnchoredDrawObject : public SwAnchoredObject ...@@ -193,6 +193,10 @@ class SW_DLLPUBLIC SwAnchoredDrawObject : public SwAnchoredObject
// new Loop control // new Loop control
void ValidateThis() { mbValidPos = true; } void ValidateThis() { mbValidPos = true; }
/** The element name to show in the XML dump.
*/
virtual const char* getElementName( ) { return "SwAnchoredDrawObject"; }
}; };
#endif #endif
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <tools/rtti.hxx> #include <tools/rtti.hxx>
#include <swtypes.hxx> #include <swtypes.hxx>
#include <swrect.hxx> #include <swrect.hxx>
#include <libxml/xmlwriter.h>
class SdrObject; class SdrObject;
class SwFrm; class SwFrm;
...@@ -551,6 +552,15 @@ class SW_DLLPUBLIC SwAnchoredObject ...@@ -551,6 +552,15 @@ class SW_DLLPUBLIC SwAnchoredObject
@return Point - determined relative position @return Point - determined relative position
*/ */
Point GetRelPosToLine() const; Point GetRelPosToLine() const;
/** Dump a bunch of useful data to an XML representation to ease
layout understanding, debugging and testing.
*/
virtual void dumpAsXml( xmlTextWriterPtr pWriter );
/** The element name to show in the XML dump.
*/
virtual const char* getElementName( ) { return "SwAnchoredObject"; }
}; };
// ============================================================================ // ============================================================================
......
...@@ -282,6 +282,8 @@ public: ...@@ -282,6 +282,8 @@ public:
// 'SwFlyFrmFmt *' after calls to this function. The casting is now done in this function.) // 'SwFlyFrmFmt *' after calls to this function. The casting is now done in this function.)
virtual const SwFlyFrmFmt *GetFmt() const; virtual const SwFlyFrmFmt *GetFmt() const;
virtual SwFlyFrmFmt *GetFmt(); virtual SwFlyFrmFmt *GetFmt();
virtual void dumpAsXml( xmlTextWriterPtr writer ) { SwLayoutFrm::dumpAsXml( writer ); };
}; };
#endif #endif
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include "porlin.hxx" #include "porlin.hxx"
#include "porlay.hxx" #include "porlay.hxx"
#include "portxt.hxx" #include "portxt.hxx"
#include "sortedobjs.hxx"
#include <anchoredobject.hxx>
#include <libxml/xmlwriter.h> #include <libxml/xmlwriter.h>
#include <SwPortionHandler.hxx> #include <SwPortionHandler.hxx>
...@@ -283,6 +285,22 @@ void SwFrm::dumpAsXml( xmlTextWriterPtr writer ) ...@@ -283,6 +285,22 @@ void SwFrm::dumpAsXml( xmlTextWriterPtr writer )
dumpAsXmlAttributes( writer ); dumpAsXmlAttributes( writer );
// Dump Anchored objects if any
SwSortedObjs* pAnchored = GetDrawObjs();
if ( pAnchored && pAnchored->Count( ) > 0 )
{
xmlTextWriterStartElement( writer, BAD_CAST( "anchored" ) );
for ( sal_uInt32 i = 0, len = pAnchored->Count(); i < len; i++ )
{
SwAnchoredObject* pObject = (*pAnchored)[i];
pObject->dumpAsXml( writer );
}
xmlTextWriterEndElement( writer );
}
// Dump the children
if ( IsTxtFrm( ) ) if ( IsTxtFrm( ) )
{ {
SwTxtFrm *pTxtFrm = ( SwTxtFrm * ) this; SwTxtFrm *pTxtFrm = ( SwTxtFrm * ) this;
...@@ -328,6 +346,21 @@ void SwFrm::dumpChildrenAsXml( xmlTextWriterPtr writer ) ...@@ -328,6 +346,21 @@ void SwFrm::dumpChildrenAsXml( xmlTextWriterPtr writer )
} }
} }
void SwAnchoredObject::dumpAsXml( xmlTextWriterPtr writer )
{
bool bCreateWriter = ( NULL == writer );
if ( bCreateWriter )
writer = lcl_createDefaultWriter();
xmlTextWriterStartElement( writer, BAD_CAST( getElementName() ) );
xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ptr" ), "%p", this );
xmlTextWriterEndElement( writer );
if ( bCreateWriter )
lcl_freeWriter( writer );
}
void SwTxtFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer ) void SwTxtFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
{ {
SwFrm::dumpAsXmlAttributes( writer ); SwFrm::dumpAsXmlAttributes( writer );
......
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