diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-09-28 18:50:40 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-09-28 18:56:22 +0200 |
commit | 3099c06f7bd565ba7e28503af51053ca3af3df52 (patch) | |
tree | 84e22275b5ca0c77e9553c34fa5bb4e23b717f59 | |
parent | 164b6ce7b27c0a9ec19019e7b078b9f8f382007d (diff) |
SwTxtNode::dumpAsXml: initial support for dumping the hints
Change-Id: I47c9343f1e55d9b06e8dc4b2359392090639d320
-rw-r--r-- | sw/source/core/docnode/nodedump.cxx | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 01ba1d2846cf..cc8b410965f7 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -14,6 +14,9 @@ #include "switerator.hxx" #include "fmtfld.hxx" #include "docufld.hxx" +#include "txatbase.hxx" +#include "fmtautofmt.hxx" +#include <svl/itemiter.hxx> #include <libxml/encoding.h> #include <libxml/xmlwriter.h> @@ -269,6 +272,63 @@ void SwTxtNode::dumpAsXml( xmlTextWriterPtr w ) txt = txt.replace( i, '*' ); OString txt8 = OUStringToOString( txt, RTL_TEXTENCODING_UTF8 ); xmlTextWriterWriteString( writer, BAD_CAST( txt8.getStr())); + + if (HasHints()) + { + writer.startElement("hints"); + SwpHints& rHints = GetSwpHints(); + for (sal_uInt16 i = 0; i < rHints.Count(); ++i) + { + writer.startElement("hint"); + SwTxtAttr* pHint = rHints.GetTextHint(i); + + writer.writeFormatAttribute("start", TMP_FORMAT, *pHint->GetStart()); + writer.writeFormatAttribute("end", TMP_FORMAT, *pHint->GetEnd()); + + const char* pWhich = "???"; + switch (pHint->Which()) + { + case RES_TXTATR_AUTOFMT: + pWhich = "autofmt"; + break; + default: + break; + } + writer.writeFormatAttribute("which", "%s", BAD_CAST(pWhich)); + + if (pHint->Which() == RES_TXTATR_AUTOFMT) + { + boost::shared_ptr<SfxItemSet> const pSet(pHint->GetAutoFmt().GetStyleHandle()); + writer.startElement("autofmt"); + SfxItemIter aIter(*pSet); + const SfxPoolItem* pItem = aIter.FirstItem(); + while (pItem) + { + writer.startElement("item"); + writer.writeFormatAttribute("whichId", TMP_FORMAT, pItem->Which()); + pWhich = 0; + switch (pItem->Which()) + { + case RES_CHRATR_POSTURE: pWhich = "posture"; break; + case RES_CHRATR_WEIGHT: pWhich = "weight"; break; + case RES_CHRATR_CJK_POSTURE: pWhich = "cjk posture"; break; + case RES_CHRATR_CJK_WEIGHT: pWhich = "cjk weight"; break; + case RES_CHRATR_CTL_POSTURE: pWhich = "ctl posture"; break; + case RES_CHRATR_CTL_WEIGHT: pWhich = "ctl weight"; break; + } + if (pWhich) + writer.writeFormatAttribute("which", "%s", BAD_CAST(pWhich)); + pItem = aIter.NextItem(); + writer.endElement(); + } + writer.endElement(); + } + + writer.endElement(); + } + writer.endElement(); + } + writer.endElement(); } |