[Libreoffice-commits] core.git: sw/source

Jan-Marek Glogowski glogow at fbihome.de
Mon Aug 25 00:27:58 PDT 2014


 sw/source/core/docnode/nodedump.cxx |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

New commits:
commit a00778f9d3c1ad3e09ee6519e4523c9ff96f9920
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Aug 22 23:01:41 2014 +0200

    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

diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index f3041cf..40bbecb 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -33,6 +33,8 @@
 #include "redline.hxx"
 #include "section.hxx"
 #include "fmtclds.hxx"
+#include "fmtpdsc.hxx"
+#include "pagedesc.hxx"
 #include <swmodule.hxx>
 #include <svl/itemiter.hxx>
 #include <svl/intitem.hxx>
@@ -258,7 +260,7 @@ void SwFldTypes::dumpAsXml( xmlTextWriterPtr w ) const
             writer.startElement("swfmtfld");
             writer.writeFormatAttribute("ptr", "%p", pCurFldFmt);
             writer.writeFormatAttribute("pTxtAttr", "%p", pCurFldFmt->GetTxtFld());
-            const char* name = "???";
+            const char* name = "FIXME_unhandledfield";
             switch(pCurFldFmt->GetField()->GetTyp()->Which())
             {
                 case RES_PAGENUMBERFLD: name = "swpagenumberfield"; break;
@@ -321,6 +323,7 @@ void SwNode::dumpAsXml( xmlTextWriterPtr w )
     }
     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 )
@@ -365,8 +368,17 @@ void SwStartNode::dumpAsXml( xmlTextWriterPtr w )
     }
     writer.startElement( name );
     writer.writeFormatAttribute( "ptr", "%p", this );
+    writer.writeFormatAttribute( "type", "0x%04x", GetNodeType() );
     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
 }
 
@@ -575,6 +587,12 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
             case RES_SHADOW:
                 pWhich = "shadow";
                 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)
             writer.writeFormatAttribute("which", "%s", BAD_CAST(pWhich));


More information about the Libreoffice-commits mailing list