Kaydet (Commit) 01573913 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: include SwFldTypes in doc model dump

Change-Id: I62a86c1615ccddb23e658e01423dce8634156ffe
üst 48796657
......@@ -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*> {
......
......@@ -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 );
......
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