summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-02-16 12:20:08 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-02-16 12:35:20 +0100
commit015739132e0260ccaa18ea286b2ab2ee4a7e162f (patch)
treebffaacce5a32f777cd8b22b41891f131b7217d88 /sw
parent48796657514ac9c82e95def273ab4b0fa2cb248f (diff)
sw: include SwFldTypes in doc model dump
Change-Id: I62a86c1615ccddb23e658e01423dce8634156ffe
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/docary.hxx2
-rw-r--r--sw/source/core/docnode/nodedump.cxx44
2 files changed, 46 insertions, 0 deletions
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 7212c067315b..3ce50c0b4275 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -44,6 +44,7 @@ namespace com { namespace sun { namespace star { namespace i18n {
}}}}
#include <swtypes.hxx>
+#include <ndarr.hxx>
/** provides some methods for generic operations on lists that contain
SwFmt* subclasses. */
@@ -114,6 +115,7 @@ public:
/// the destructor will free all objects still in the vector
~SwFldTypes();
sal_uInt16 GetPos(const SwFieldType* pFieldType) const;
+ void dumpAsXml(xmlTextWriterPtr w);
};
class SwTOXTypes : public std::vector<SwTOXType*> {
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index e4e43a37612d..81b356682f53 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -29,6 +29,10 @@
#include "doc.hxx"
#include "ndtxt.hxx"
#include "MarkManager.hxx"
+#include "docary.hxx"
+#include "switerator.hxx"
+#include "fmtfld.hxx"
+#include "docufld.hxx"
#include <libxml/encoding.h>
#include <libxml/xmlwriter.h>
@@ -117,6 +121,7 @@ void SwDoc::dumpAsXml( xmlTextWriterPtr w )
writer.writeFormatAttribute( "ptr", "%p", this );
m_pNodes->dumpAsXml( writer );
pMarkManager->dumpAsXml( writer );
+ pFldTypes->dumpAsXml( writer );
writer.endElement();
}
@@ -145,6 +150,45 @@ void MarkManager::dumpAsXml( xmlTextWriterPtr w )
} // namespace mark
} // namespace sw
+void SwFldTypes::dumpAsXml( xmlTextWriterPtr w )
+{
+ WriterHelper writer(w);
+ writer.startElement("swfldtypes");
+ sal_uInt16 nCount = size();
+ for (sal_uInt16 nType = 0; nType < nCount; ++nType)
+ {
+ const SwFieldType *pCurType = (*this)[nType];
+ SwIterator<SwFmtFld, SwFieldType> aIter(*pCurType);
+ for (const SwFmtFld* pCurFldFmt = aIter.First(); pCurFldFmt; pCurFldFmt = aIter.Next())
+ {
+ writer.startElement("swfmtfld");
+ writer.writeFormatAttribute("ptr", "%p", pCurFldFmt);
+ writer.writeFormatAttribute("pTxtAttr", "%p", pCurFldFmt->GetTxtFld());
+ const char* name = "???";
+ switch(pCurFldFmt->GetFld()->GetTyp()->Which())
+ {
+ case RES_POSTITFLD:
+ name = "swpostitfield";
+ break;
+ default:
+ SAL_INFO("sw.core", "unhandled field type " << pCurFldFmt->GetFld()->GetTyp()->Which());
+ break;
+ }
+ writer.startElement(name);
+ writer.writeFormatAttribute("ptr", "%p", pCurFldFmt->GetFld());
+ if (pCurFldFmt->GetFld()->GetTyp()->Which() == RES_POSTITFLD)
+ {
+ const SwPostItField* pField = dynamic_cast<const SwPostItField*>(pCurFldFmt->GetFld());
+ OString txt8 = OUStringToOString(pField->GetName(), RTL_TEXTENCODING_UTF8);
+ writer.writeFormatAttribute("name", "%s", BAD_CAST( txt8.getStr()));
+ }
+ writer.endElement();
+ writer.endElement();
+ }
+ }
+ writer.endElement();
+}
+
void SwNodes::dumpAsXml( xmlTextWriterPtr w )
{
WriterHelper writer( w );