Kaydet (Commit) a00778f9 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski Kaydeden (comit) Miklos Vajna

Dump table attributes and page description items

Adds the SwPageDesc name to the dumpAsXml output of the
SwFmtPageDesc / RES_PAGEDESC SfxPoolItem and dumps the tables
attibutes.

Adtittionally this renames the unknown field name, so it doesn't
produce wrong XML output (blamed by "xmllint --format") and adds
the hex node type to the start and end node XML output.

Reviewed on:
	https://gerrit.libreoffice.org/11091

Change-Id: I3cde39d423e17909243675efdd39557a6bfffbd7
üst c5d47afc
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "redline.hxx" #include "redline.hxx"
#include "section.hxx" #include "section.hxx"
#include "fmtclds.hxx" #include "fmtclds.hxx"
#include "fmtpdsc.hxx"
#include "pagedesc.hxx"
#include <swmodule.hxx> #include <swmodule.hxx>
#include <svl/itemiter.hxx> #include <svl/itemiter.hxx>
#include <svl/intitem.hxx> #include <svl/intitem.hxx>
...@@ -258,7 +260,7 @@ void SwFldTypes::dumpAsXml( xmlTextWriterPtr w ) const ...@@ -258,7 +260,7 @@ void SwFldTypes::dumpAsXml( xmlTextWriterPtr w ) const
writer.startElement("swfmtfld"); writer.startElement("swfmtfld");
writer.writeFormatAttribute("ptr", "%p", pCurFldFmt); writer.writeFormatAttribute("ptr", "%p", pCurFldFmt);
writer.writeFormatAttribute("pTxtAttr", "%p", pCurFldFmt->GetTxtFld()); writer.writeFormatAttribute("pTxtAttr", "%p", pCurFldFmt->GetTxtFld());
const char* name = "???"; const char* name = "FIXME_unhandledfield";
switch(pCurFldFmt->GetField()->GetTyp()->Which()) switch(pCurFldFmt->GetField()->GetTyp()->Which())
{ {
case RES_PAGENUMBERFLD: name = "swpagenumberfield"; break; case RES_PAGENUMBERFLD: name = "swpagenumberfield"; break;
...@@ -321,6 +323,7 @@ void SwNode::dumpAsXml( xmlTextWriterPtr w ) ...@@ -321,6 +323,7 @@ void SwNode::dumpAsXml( xmlTextWriterPtr w )
} }
writer.startElement( name ); writer.startElement( name );
writer.writeFormatAttribute( "ptr", "%p", this ); writer.writeFormatAttribute( "ptr", "%p", this );
writer.writeFormatAttribute( "type", "0x%04x", GetNodeType() );
writer.writeFormatAttribute( "index", TMP_FORMAT, GetIndex() ); writer.writeFormatAttribute( "index", TMP_FORMAT, GetIndex() );
writer.endElement(); writer.endElement();
if( GetNodeType() == ND_ENDNODE ) if( GetNodeType() == ND_ENDNODE )
...@@ -365,8 +368,17 @@ void SwStartNode::dumpAsXml( xmlTextWriterPtr w ) ...@@ -365,8 +368,17 @@ void SwStartNode::dumpAsXml( xmlTextWriterPtr w )
} }
writer.startElement( name ); writer.startElement( name );
writer.writeFormatAttribute( "ptr", "%p", this ); writer.writeFormatAttribute( "ptr", "%p", this );
writer.writeFormatAttribute( "type", "0x%04x", GetNodeType() );
writer.writeFormatAttribute( "index", TMP_FORMAT, GetIndex() ); writer.writeFormatAttribute( "index", TMP_FORMAT, GetIndex() );
if (IsTableNode())
{
writer.startElement("attrset");
const SwAttrSet& rAttrSet = GetTableNode()->GetTable().GetFrmFmt()->GetAttrSet();
lcl_dumpSfxItemSet(writer, &rAttrSet);
writer.endElement();
}
// writer.endElement(); - it is a start node, so don't end, will make xml better nested // writer.endElement(); - it is a start node, so don't end, will make xml better nested
} }
...@@ -575,6 +587,12 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet) ...@@ -575,6 +587,12 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
case RES_SHADOW: case RES_SHADOW:
pWhich = "shadow"; pWhich = "shadow";
break; break;
case RES_PAGEDESC:
pWhich = "page description";
const SwFmtPageDesc* pFmt = static_cast<const SwFmtPageDesc*>(pItem);
if (pFmt->GetPageDesc())
oValue = "name: " + OUStringToOString(pFmt->GetPageDesc()->GetName(), RTL_TEXTENCODING_UTF8);
break;
} }
if (pWhich) if (pWhich)
writer.writeFormatAttribute("which", "%s", BAD_CAST(pWhich)); writer.writeFormatAttribute("which", "%s", BAD_CAST(pWhich));
......
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