summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-03-01 18:11:22 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-03-01 19:15:12 +0100
commitbbfe81f4548db29d18d5fd1d1850d520ebddee16 (patch)
tree506685f67949764f3d22db80d0488384b0127d90 /sw
parent76f52699d792872cbe06271db43ce86800d604f0 (diff)
Extract SwNode::dumpAsXml() from nodedump
Change-Id: Icb6221c82e5040f7e9e9545e75c26267454a10eb
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/node.hxx2
-rw-r--r--sw/source/core/docnode/node.cxx32
-rw-r--r--sw/source/core/docnode/nodedump.cxx36
3 files changed, 33 insertions, 37 deletions
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index f744c415bf51..4013b2596915 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -283,7 +283,7 @@ public:
* Dumps the node structure to the given destination (file nodes.xml in the current directory by default)
* @since 3.5
*/
- virtual void dumpAsXml( xmlTextWriterPtr writer = NULL ) const;
+ virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
private:
SwNode( const SwNode & rNodes ) SAL_DELETED_FUNCTION;
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 2f3db3597986..d27ce9b1f9e1 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -844,6 +844,38 @@ sal_uInt8 SwNode::HasPrevNextLayNode() const
return nRet;
}
+void SwNode::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ const char* pName = "???";
+ switch (GetNodeType())
+ {
+ case ND_ENDNODE:
+ pName = "end";
+ break;
+ case ND_STARTNODE:
+ case ND_TEXTNODE:
+ abort(); // overridden
+ case ND_TABLENODE:
+ pName = "table";
+ break;
+ case ND_GRFNODE:
+ pName = "grf";
+ break;
+ case ND_OLENODE:
+ pName = "ole";
+ break;
+ }
+ xmlTextWriterStartElement(pWriter, BAD_CAST(pName));
+
+ xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(GetNodeType()).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr()));
+
+ xmlTextWriterEndElement(pWriter);
+ if (GetNodeType() == ND_ENDNODE)
+ xmlTextWriterEndElement(pWriter); // end start node
+}
+
SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType,
SwStartNodeType eSttNd )
: SwNode( rWhere, nNdType ), eSttNdTyp( eSttNd )
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 1faa9e244f8e..fa66e90d999d 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -91,11 +91,6 @@ void WriterHelper::writeFormatAttribute( const char* attribute, const char* form
xmlTextWriterWriteVFormatAttribute( writer, BAD_CAST( attribute ), format, va );
va_end( va );
}
-
-// Hack: somehow conversion from "..." to va_list does
-// bomb on two string litterals in the format.
-static const char* TMP_FORMAT = "%" SAL_PRIuUINTPTR;
-
}
void SwFldTypes::dumpAsXml( xmlTextWriterPtr w ) const
@@ -139,35 +134,4 @@ void SwFldTypes::dumpAsXml( xmlTextWriterPtr w ) const
writer.endElement();
}
-void SwNode::dumpAsXml( xmlTextWriterPtr w ) const
-{
- WriterHelper writer( w );
- const char* name = "???";
- switch( GetNodeType())
- {
- case ND_ENDNODE:
- name = "end";
- break;
- case ND_STARTNODE:
- case ND_TEXTNODE:
- abort(); // overridden
- case ND_TABLENODE:
- name = "table";
- break;
- case ND_GRFNODE:
- name = "grf";
- break;
- case ND_OLENODE:
- name = "ole";
- break;
- }
- writer.startElement( name );
- writer.writeFormatAttribute( "ptr", "%p", this );
- writer.writeFormatAttribute( "type", "0x%04x", GetNodeType() );
- writer.writeFormatAttribute( "index", TMP_FORMAT, GetIndex() );
- writer.endElement();
- if( GetNodeType() == ND_ENDNODE )
- writer.endElement(); // end start node
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */