LCOV - code coverage report
Current view: top level - sw/source/core/docnode - nodedump.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 617 0.2 %
Date: 2014-11-03 Functions: 2 27 7.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include "doc.hxx"
      11             : #include "drawdoc.hxx"
      12             : #include <IDocumentDrawModelAccess.hxx>
      13             : #include <IDocumentRedlineAccess.hxx>
      14             : #include <IDocumentFieldsAccess.hxx>
      15             : #include <IDocumentState.hxx>
      16             : #include <UndoManager.hxx>
      17             : #include "ndtxt.hxx"
      18             : #include "MarkManager.hxx"
      19             : #include "docary.hxx"
      20             : #include "switerator.hxx"
      21             : #include "fmtfld.hxx"
      22             : #include "docufld.hxx"
      23             : #include "txatbase.hxx"
      24             : #include "fmtautofmt.hxx"
      25             : #include "fmtcntnt.hxx"
      26             : #include "fmtornt.hxx"
      27             : #include "fmtfsize.hxx"
      28             : #include "charfmt.hxx"
      29             : #include "frmfmt.hxx"
      30             : #include "fmtanchr.hxx"
      31             : #include "fmtsrnd.hxx"
      32             : #include "paratr.hxx"
      33             : #include "redline.hxx"
      34             : #include "section.hxx"
      35             : #include "fmtclds.hxx"
      36             : #include "fmtpdsc.hxx"
      37             : #include "pagedesc.hxx"
      38             : #include "fchrfmt.hxx"
      39             : #include <swmodule.hxx>
      40             : #include <svl/itemiter.hxx>
      41             : #include <svl/intitem.hxx>
      42             : #include <editeng/charrotateitem.hxx>
      43             : #include <editeng/rsiditem.hxx>
      44             : #include <editeng/fontitem.hxx>
      45             : #include <editeng/fhgtitem.hxx>
      46             : #include <editeng/editobj.hxx>
      47             : #include <editeng/outlobj.hxx>
      48             : #include <svx/xdef.hxx>
      49             : #include <svx/svdpage.hxx>
      50             : #include <svx/svdmodel.hxx>
      51             : #include <svx/xfillit0.hxx>
      52             : #include <tools/datetimeutils.hxx>
      53             : 
      54             : #include <libxml/encoding.h>
      55             : #include <libxml/xmlwriter.h>
      56             : #include <boost/optional.hpp>
      57             : #include <rtl/strbuf.hxx>
      58             : 
      59             : using namespace com::sun::star;
      60             : 
      61             : namespace
      62             : {
      63             : 
      64             : // Small helper class to ensure that we write to nodes.xml if nothing
      65             : // has been explicitly specified.
      66             : // Always use at the beginning of dumpAsXml().
      67             : // Also, there are some functions to save typing.
      68             : class WriterHelper
      69             : {
      70             : public:
      71             :     WriterHelper( xmlTextWriterPtr );
      72             :     ~WriterHelper();
      73           0 :     operator xmlTextWriterPtr() { return writer;}
      74             :     void startElement( const char* element );
      75             :     void endElement();
      76             :     void writeFormatAttribute( const char* attribute, const char* format, ... )
      77             : #ifdef LIBXML_ATTR_FORMAT
      78             :         LIBXML_ATTR_FORMAT(3,4)
      79             : #endif
      80             :         ;
      81             : private:
      82             :     xmlTextWriterPtr writer;
      83             :     bool owns;
      84             : };
      85             : 
      86           0 : WriterHelper::WriterHelper( xmlTextWriterPtr w )
      87             :     : writer( w )
      88           0 :     , owns( false )
      89             : {
      90           0 :     if( writer == NULL )
      91             :     {
      92           0 :         writer = xmlNewTextWriterFilename( "nodes.xml", 0 );
      93           0 :         xmlTextWriterStartDocument( writer, NULL, NULL, NULL );
      94           0 :         owns = true;
      95             :     }
      96           0 : }
      97             : 
      98           0 : WriterHelper::~WriterHelper()
      99             : {
     100           0 :     if( owns )
     101             :     {
     102           0 :         xmlTextWriterEndDocument( writer );
     103           0 :         xmlFreeTextWriter( writer );
     104             :     }
     105           0 : }
     106             : 
     107             : 
     108           0 : void WriterHelper::startElement( const char* element )
     109             : {
     110           0 :     xmlTextWriterStartElement( writer, BAD_CAST( element ));
     111           0 : }
     112             : 
     113           0 : void WriterHelper::endElement()
     114             : {
     115           0 :     xmlTextWriterEndElement( writer );
     116           0 : }
     117             : 
     118           0 : void WriterHelper::writeFormatAttribute( const char* attribute, const char* format, ... )
     119             : {
     120             :     va_list va;
     121           0 :     va_start( va, format );
     122           0 :     xmlTextWriterWriteVFormatAttribute( writer, BAD_CAST( attribute ), format, va );
     123           0 :     va_end( va );
     124           0 : }
     125             : 
     126             : // Hack: somehow conversion from "..." to va_list does
     127             : // bomb on two string litterals in the format.
     128             : static const char* TMP_FORMAT = "%" SAL_PRIuUINTPTR;
     129             : static const char* TMP_FORMAT_I32 = "%" SAL_PRIdINT32;
     130             : 
     131             : }
     132             : 
     133             : void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet);
     134             : 
     135           0 : void lcl_dumpSdrModel(WriterHelper& writer, const SdrModel* pModel)
     136             : {
     137           0 :     writer.startElement("sdrModel");
     138           0 :     writer.writeFormatAttribute("ptr", "%p", pModel);
     139           0 :     if (pModel)
     140             :     {
     141           0 :         const SdrPage* pPage = pModel->GetPage(0);
     142           0 :         writer.startElement("sdrPage");
     143           0 :         writer.writeFormatAttribute("ptr", "%p", pPage);
     144           0 :         if (pPage)
     145             :         {
     146           0 :             const size_t nObjCount = pPage->GetObjCount();
     147           0 :             for (size_t i = 0; i < nObjCount; ++i)
     148             :             {
     149           0 :                 const SdrObject* pObject = pPage->GetObj(i);
     150           0 :                 writer.startElement("sdrObject");
     151           0 :                 writer.writeFormatAttribute("ptr", "%p", pObject);
     152           0 :                 if (pObject)
     153             :                 {
     154           0 :                     writer.writeFormatAttribute("symbol", "%s", BAD_CAST(typeid(*pObject).name()));
     155           0 :                     writer.writeFormatAttribute("name", "%s", BAD_CAST(OUStringToOString(pObject->GetName(), RTL_TEXTENCODING_UTF8).getStr()));
     156           0 :                     writer.writeFormatAttribute("title", "%s", BAD_CAST(OUStringToOString(pObject->GetTitle(), RTL_TEXTENCODING_UTF8).getStr()));
     157           0 :                     writer.writeFormatAttribute("description", "%s", BAD_CAST(OUStringToOString(pObject->GetDescription(), RTL_TEXTENCODING_UTF8).getStr()));
     158           0 :                     writer.writeFormatAttribute("nOrdNum", TMP_FORMAT, pObject->GetOrdNumDirect());
     159             : 
     160           0 :                     const OutlinerParaObject* pOutliner = pObject->GetOutlinerParaObject();
     161           0 :                     writer.startElement("outliner");
     162           0 :                     writer.writeFormatAttribute("ptr", "%p", pOutliner);
     163           0 :                     if (pOutliner)
     164             :                     {
     165           0 :                         const EditTextObject& rEditObj = pOutliner->GetTextObject();
     166           0 :                         sal_Int32 nPara = rEditObj.GetParagraphCount();
     167           0 :                         for (sal_Int32 j = 0; j < nPara; ++j)
     168             :                         {
     169           0 :                             writer.startElement("paragraph");
     170           0 :                             xmlTextWriterWriteString(writer, BAD_CAST(OUStringToOString(rEditObj.GetText(j), RTL_TEXTENCODING_UTF8).getStr()));
     171           0 :                             writer.endElement();
     172             :                         }
     173             :                     }
     174           0 :                     writer.endElement();
     175             :                 }
     176           0 :                 writer.endElement();
     177             :             }
     178             :         }
     179           0 :         writer.endElement();
     180             :     }
     181           0 :     writer.endElement();
     182           0 : }
     183             : 
     184           0 : void SwDoc::dumpAsXml( xmlTextWriterPtr w ) const
     185             : {
     186           0 :     WriterHelper writer( w );
     187           0 :     writer.startElement( "doc" );
     188           0 :     writer.writeFormatAttribute( "ptr", "%p", this );
     189           0 :     m_pNodes->dumpAsXml( writer );
     190           0 :     mpMarkManager->dumpAsXml( writer );
     191           0 :     m_pUndoManager->dumpAsXml(writer);
     192           0 :     getIDocumentFieldsAccess().GetFldTypes()->dumpAsXml( writer );
     193           0 :     mpTxtFmtCollTbl->dumpAsXml( writer );
     194           0 :     mpCharFmtTbl->dumpAsXml( writer );
     195           0 :     mpFrmFmtTbl->dumpAsXml( writer, "frmFmtTbl" );
     196           0 :     mpSpzFrmFmtTbl->dumpAsXml( writer, "spzFrmFmtTbl" );
     197           0 :     mpSectionFmtTbl->dumpAsXml( writer );
     198           0 :     mpNumRuleTbl->dumpAsXml( writer );
     199           0 :     getIDocumentRedlineAccess().GetRedlineTbl().dumpAsXml( writer );
     200           0 :     getIDocumentRedlineAccess().GetExtraRedlineTbl().dumpAsXml( writer );
     201           0 :     lcl_dumpSdrModel( writer, getIDocumentDrawModelAccess().GetDrawModel() );
     202             : 
     203           0 :     writer.startElement("mbModified");
     204           0 :     writer.writeFormatAttribute("value", TMP_FORMAT, static_cast<int>(getIDocumentState().IsModified()));
     205           0 :     writer.endElement();
     206             : 
     207           0 :     writer.endElement();
     208           0 : }
     209             : 
     210             : namespace sw {
     211             : namespace mark {
     212           0 : void MarkManager::dumpAsXml( xmlTextWriterPtr w ) const
     213             : {
     214           0 :     WriterHelper writer(w);
     215           0 :     writer.startElement("markManager");
     216           0 :     if (!m_vBookmarks.empty())
     217             :     {
     218           0 :         writer.startElement("bookmarks");
     219           0 :         for (const_iterator_t it = m_vBookmarks.begin(); it != m_vBookmarks.end(); ++it)
     220             :         {
     221           0 :             pMark_t pMark = *it;
     222           0 :             writer.startElement("bookmark");
     223           0 :             writer.writeFormatAttribute("startNode", TMP_FORMAT, pMark->GetMarkStart().nNode.GetIndex());
     224           0 :             writer.writeFormatAttribute("startOffset", TMP_FORMAT_I32, pMark->GetMarkStart().nContent.GetIndex());
     225           0 :             writer.writeFormatAttribute("endNode", TMP_FORMAT, pMark->GetMarkEnd().nNode.GetIndex());
     226           0 :             writer.writeFormatAttribute("endOffset", TMP_FORMAT_I32, pMark->GetMarkEnd().nContent.GetIndex());
     227           0 :             OString txt8 = OUStringToOString(pMark->GetName(), RTL_TEXTENCODING_UTF8);
     228           0 :             writer.writeFormatAttribute("name", "%s", BAD_CAST( txt8.getStr()));
     229           0 :             writer.endElement();
     230           0 :         }
     231           0 :         writer.endElement();
     232             :     }
     233             : 
     234           0 :     if (!m_vFieldmarks.empty())
     235             :     {
     236           0 :         writer.startElement("fieldmarks");
     237           0 :         for (const_iterator_t it = m_vFieldmarks.begin(); it != m_vFieldmarks.end(); ++it)
     238             :         {
     239           0 :             pMark_t pMark = *it;
     240           0 :             writer.startElement("fieldmark");
     241           0 :             writer.writeFormatAttribute("startNode", TMP_FORMAT, pMark->GetMarkStart().nNode.GetIndex());
     242           0 :             writer.writeFormatAttribute("startOffset", TMP_FORMAT_I32, pMark->GetMarkStart().nContent.GetIndex());
     243           0 :             writer.writeFormatAttribute("endNode", TMP_FORMAT, pMark->GetMarkEnd().nNode.GetIndex());
     244           0 :             writer.writeFormatAttribute("endOffset", TMP_FORMAT_I32, pMark->GetMarkEnd().nContent.GetIndex());
     245           0 :             OString txt8 = OUStringToOString(pMark->GetName(), RTL_TEXTENCODING_UTF8);
     246           0 :             writer.writeFormatAttribute("name", "%s", BAD_CAST( txt8.getStr()));
     247           0 :             writer.endElement();
     248           0 :         }
     249           0 :         writer.endElement();
     250             :     }
     251             : 
     252           0 :     if (!m_vAnnotationMarks.empty())
     253             :     {
     254           0 :         writer.startElement("annotationmarks");
     255           0 :         for (const_iterator_t it = m_vAnnotationMarks.begin(); it != m_vAnnotationMarks.end(); ++it)
     256             :         {
     257           0 :             pMark_t pMark = *it;
     258           0 :             writer.startElement("annotationmark");
     259           0 :             writer.writeFormatAttribute("startNode", TMP_FORMAT, pMark->GetMarkStart().nNode.GetIndex());
     260           0 :             writer.writeFormatAttribute("startOffset", TMP_FORMAT_I32, pMark->GetMarkStart().nContent.GetIndex());
     261           0 :             writer.writeFormatAttribute("endNode", TMP_FORMAT, pMark->GetMarkEnd().nNode.GetIndex());
     262           0 :             writer.writeFormatAttribute("endOffset", TMP_FORMAT_I32, pMark->GetMarkEnd().nContent.GetIndex());
     263           0 :             OString txt8 = OUStringToOString(pMark->GetName(), RTL_TEXTENCODING_UTF8);
     264           0 :             writer.writeFormatAttribute("name", "%s", BAD_CAST( txt8.getStr()));
     265           0 :             writer.endElement();
     266           0 :         }
     267           0 :         writer.endElement();
     268             :     }
     269           0 :     writer.endElement();
     270           0 : }
     271             : } // namespace mark
     272             : } // namespace sw
     273             : 
     274           0 : void SwFldTypes::dumpAsXml( xmlTextWriterPtr w ) const
     275             : {
     276           0 :     WriterHelper writer(w);
     277           0 :     writer.startElement("swfldtypes");
     278           0 :     sal_uInt16 nCount = size();
     279           0 :     for (sal_uInt16 nType = 0; nType < nCount; ++nType)
     280             :     {
     281           0 :         const SwFieldType *pCurType = (*this)[nType];
     282           0 :         SwIterator<SwFmtFld, SwFieldType> aIter(*pCurType);
     283           0 :         for (const SwFmtFld* pCurFldFmt = aIter.First(); pCurFldFmt; pCurFldFmt = aIter.Next())
     284             :         {
     285           0 :             writer.startElement("swfmtfld");
     286           0 :             writer.writeFormatAttribute("ptr", "%p", pCurFldFmt);
     287           0 :             writer.writeFormatAttribute("pTxtAttr", "%p", pCurFldFmt->GetTxtFld());
     288           0 :             const char* name = "FIXME_unhandledfield";
     289           0 :             switch(pCurFldFmt->GetField()->GetTyp()->Which())
     290             :             {
     291           0 :                 case RES_PAGENUMBERFLD: name = "swpagenumberfield"; break;
     292           0 :                 case RES_POSTITFLD: name = "swpostitfield"; break;
     293           0 :                 case RES_DATETIMEFLD: name = "swdatetimefield"; break;
     294             :                 default:
     295             :                     SAL_INFO("sw.core", "unhandled field type " << pCurFldFmt->GetField()->GetTyp()->Which());
     296           0 :                     break;
     297             :             }
     298           0 :             writer.startElement(name);
     299           0 :             writer.writeFormatAttribute("ptr", "%p", pCurFldFmt->GetField());
     300           0 :             const SwPostItField* pField = NULL;
     301           0 :             if (pCurFldFmt->GetField()->GetTyp()->Which() == RES_POSTITFLD)
     302           0 :                 pField = dynamic_cast<const SwPostItField*>(pCurFldFmt->GetField());
     303           0 :             if (pField)
     304             :             {
     305           0 :                 OString txt8 = OUStringToOString(pField->GetName(), RTL_TEXTENCODING_UTF8);
     306           0 :                 writer.writeFormatAttribute("name", "%s", BAD_CAST( txt8.getStr()));
     307             :             }
     308           0 :             writer.endElement();
     309           0 :             writer.endElement();
     310             :         }
     311           0 :     }
     312           0 :     writer.endElement();
     313           0 : }
     314             : 
     315           0 : void SwNodes::dumpAsXml( xmlTextWriterPtr w ) const
     316             : {
     317           0 :     WriterHelper writer( w );
     318           0 :     writer.startElement( "swnodes" );
     319           0 :     writer.writeFormatAttribute( "ptr", "%p", this );
     320           0 :     for( unsigned int i = 0; i < Count(); ++i )
     321             :     {
     322           0 :         ( *this )[ i ]->dumpAsXml( writer );
     323             :     }
     324           0 :     writer.endElement();
     325           0 : }
     326             : 
     327           0 : void SwNode::dumpAsXml( xmlTextWriterPtr w ) const
     328             : {
     329           0 :     WriterHelper writer( w );
     330           0 :     const char* name = "???";
     331           0 :     switch( GetNodeType())
     332             :     {
     333             :         case ND_ENDNODE:
     334           0 :             name = "end";
     335           0 :             break;
     336             :         case ND_STARTNODE:
     337             :         case ND_TEXTNODE:
     338           0 :             abort(); // overridden
     339             :         case ND_TABLENODE:
     340           0 :             name = "table";
     341           0 :             break;
     342             :         case ND_GRFNODE:
     343           0 :             name = "grf";
     344           0 :             break;
     345             :         case ND_OLENODE:
     346           0 :             name = "ole";
     347           0 :             break;
     348             :     }
     349           0 :     writer.startElement( name );
     350           0 :     writer.writeFormatAttribute( "ptr", "%p", this );
     351           0 :     writer.writeFormatAttribute( "type", "0x%04x", GetNodeType() );
     352           0 :     writer.writeFormatAttribute( "index", TMP_FORMAT, GetIndex() );
     353           0 :     writer.endElement();
     354           0 :     if( GetNodeType() == ND_ENDNODE )
     355           0 :         writer.endElement(); // end start node
     356           0 : }
     357             : 
     358           0 : void SwStartNode::dumpAsXml( xmlTextWriterPtr w ) const
     359             : {
     360           0 :     WriterHelper writer( w );
     361           0 :     const char* name = "???";
     362           0 :     switch( GetNodeType() )
     363             :     {
     364             :         case ND_TABLENODE:
     365           0 :             name = "table";
     366           0 :             break;
     367             :         case ND_SECTIONNODE:
     368           0 :             name = "section";
     369           0 :             break;
     370             :         default:
     371           0 :             switch( GetStartNodeType())
     372             :             {
     373             :                 case SwNormalStartNode:
     374           0 :                     name = "start";
     375           0 :                     break;
     376             :                 case SwTableBoxStartNode:
     377           0 :                     name = "tablebox";
     378           0 :                     break;
     379             :                 case SwFlyStartNode:
     380           0 :                     name = "fly";
     381           0 :                     break;
     382             :                 case SwFootnoteStartNode:
     383           0 :                     name = "footnote";
     384           0 :                     break;
     385             :                 case SwHeaderStartNode:
     386           0 :                     name = "header";
     387           0 :                     break;
     388             :                 case SwFooterStartNode:
     389           0 :                     name = "footer";
     390           0 :                     break;
     391             :             }
     392           0 :             break;
     393             :     }
     394           0 :     writer.startElement( name );
     395           0 :     writer.writeFormatAttribute( "ptr", "%p", this );
     396           0 :     writer.writeFormatAttribute( "type", "0x%04x", GetNodeType() );
     397           0 :     writer.writeFormatAttribute( "index", TMP_FORMAT, GetIndex() );
     398             : 
     399           0 :     if (IsTableNode())
     400             :     {
     401           0 :         writer.startElement("attrset");
     402           0 :         const SwAttrSet& rAttrSet = GetTableNode()->GetTable().GetFrmFmt()->GetAttrSet();
     403           0 :         lcl_dumpSfxItemSet(writer, &rAttrSet);
     404           0 :         writer.endElement();
     405           0 :     }
     406             : 
     407             :     // writer.endElement(); - it is a start node, so don't end, will make xml better nested
     408           0 : }
     409             : 
     410           0 : void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
     411             : {
     412           0 :     SfxItemIter aIter(*pSet);
     413           0 :     const SfxPoolItem* pItem = aIter.FirstItem();
     414           0 :     while (pItem)
     415             :     {
     416           0 :         writer.startElement("item");
     417           0 :         writer.writeFormatAttribute("whichId", TMP_FORMAT, pItem->Which());
     418           0 :         const char* pWhich = 0;
     419           0 :         boost::optional<OString> oValue;
     420           0 :         switch (pItem->Which())
     421             :         {
     422           0 :             case RES_CHRATR_POSTURE: pWhich = "character posture"; break;
     423           0 :             case RES_CHRATR_WEIGHT: pWhich = "character weight"; break;
     424           0 :             case RES_CHRATR_CJK_POSTURE: pWhich = "character cjk posture"; break;
     425           0 :             case RES_CHRATR_CJK_WEIGHT: pWhich = "character cjk weight"; break;
     426           0 :             case RES_CHRATR_CTL_POSTURE: pWhich = "character ctl posture"; break;
     427           0 :             case RES_CHRATR_CTL_WEIGHT: pWhich = "character ctl weight"; break;
     428             :             case RES_CHRATR_RSID:
     429             :             {
     430           0 :                 pWhich = "character rsid";
     431           0 :                 css::uno::Any aAny;
     432           0 :                 static_cast<const SvxRsidItem*>(pItem)->QueryValue(aAny);
     433           0 :                 oValue = OString::number(aAny.get<sal_uInt32>());
     434           0 :                 break;
     435             :             }
     436           0 :             case RES_CHRATR_ROTATE: pWhich = "character rotation"; oValue = OString::number(static_cast<const SvxCharRotateItem*>(pItem)->GetValue()); break;
     437           0 :             case RES_PARATR_OUTLINELEVEL: pWhich = "paragraph outline level"; oValue = OString::number(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); break;
     438           0 :             case RES_PARATR_NUMRULE: pWhich = "paragraph numbering rule"; oValue = OUStringToOString(static_cast<const SwNumRuleItem*>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8); break;
     439           0 :             case RES_CHRATR_FONT: pWhich = "character font"; oValue = OUStringToOString(static_cast<const SvxFontItem*>(pItem)->GetFamilyName(), RTL_TEXTENCODING_UTF8); break;
     440           0 :             case RES_CHRATR_BACKGROUND: pWhich = "character background"; break;
     441           0 :             case RES_CHRATR_CTL_FONT: pWhich = "character ctl font"; break;
     442             :             case RES_CHRATR_FONTSIZE:
     443             :             {
     444           0 :                 pWhich = "character font size";
     445           0 :                 const SvxFontHeightItem* pFontHeightItem = static_cast<const SvxFontHeightItem*>(pItem);
     446           0 :                 oValue = "nHeight: " + OString::number(pFontHeightItem->GetHeight()) + ", nProp: " + OString::number(pFontHeightItem->GetProp());
     447           0 :                 break;
     448             :             }
     449             :             case RES_CNTNT:
     450             :             {
     451           0 :                 pWhich = "content";
     452           0 :                 const SwFmtCntnt* pCntnt = static_cast<const SwFmtCntnt*>(pItem);
     453           0 :                 oValue = "node index: " + OString::number(pCntnt->GetCntntIdx()->GetNode().GetIndex());
     454           0 :                 break;
     455             :             }
     456             :             case RES_FRM_SIZE:
     457             :             {
     458           0 :                 pWhich = "frame size";
     459           0 :                 const SwFmtFrmSize* pSize = static_cast<const SwFmtFrmSize*>(pItem);
     460           0 :                 oValue = "height size type: " + OString::number(pSize->GetHeightSizeType()) + ", width size type: " + OString::number(pSize->GetWidthSizeType());
     461           0 :                 break;
     462             :             }
     463             :             case RES_VERT_ORIENT:
     464             :             {
     465           0 :                 pWhich = "frame vertical orientation";
     466           0 :                 const SwFmtVertOrient* pOrient = static_cast<const SwFmtVertOrient*>(pItem);
     467           0 :                 oValue = "orient: " + OString::number(pOrient->GetVertOrient()) + ", relation: " + OString::number(pOrient->GetRelationOrient()) + ", position: " + OString::number(pOrient->GetPos());
     468           0 :                 break;
     469             :             }
     470             :             case RES_HORI_ORIENT:
     471             :             {
     472           0 :                 pWhich = "frame horizontal orientation";
     473           0 :                 const SwFmtHoriOrient* pOrient = static_cast<const SwFmtHoriOrient*>(pItem);
     474           0 :                 oValue = "orient: " + OString::number(pOrient->GetHoriOrient()) + ", relation: " + OString::number(pOrient->GetRelationOrient()) + ", position: " + OString::number(pOrient->GetPos());
     475           0 :                 break;
     476             :             }
     477             :             case RES_ANCHOR:
     478             :             {
     479           0 :                 pWhich = "frame anchor";
     480           0 :                 const SwFmtAnchor* pAnchor = static_cast<const SwFmtAnchor*>(pItem);
     481           0 :                 switch (pAnchor->GetAnchorId())
     482             :                 {
     483             :                 case FLY_AT_PARA:
     484           0 :                     oValue = "anchor type: at-para";
     485           0 :                     break;
     486             :                 case FLY_AS_CHAR:
     487           0 :                     oValue = "anchor type: as-char";
     488           0 :                     break;
     489             :                 case FLY_AT_PAGE:
     490           0 :                     oValue = "anchor type: at-page";
     491           0 :                     break;
     492             :                 case FLY_AT_FLY:
     493           0 :                     oValue = "anchor type: at-fly";
     494           0 :                     break;
     495             :                 case FLY_AT_CHAR:
     496           0 :                     oValue = "anchor type: at-char";
     497           0 :                     break;
     498             :                 default:
     499           0 :                     oValue = "anchor type: " + OString::number(pAnchor->GetAnchorId());
     500           0 :                     break;
     501             :                 }
     502           0 :                 const SwPosition* pPosition = pAnchor->GetCntntAnchor();
     503           0 :                 if (pPosition)
     504           0 :                     oValue = *oValue + ", node index: " + OString::number(pPosition->nNode.GetNode().GetIndex()) + ", index: " + OString::number(pPosition->nContent.GetIndex());
     505           0 :                 break;
     506             :             }
     507             :             case RES_SURROUND:
     508             :             {
     509           0 :                 pWhich = "frame surround";
     510           0 :                 const SwFmtSurround* pSurround = static_cast<const SwFmtSurround*>(pItem);
     511           0 :                 switch (pSurround->GetSurround())
     512             :                 {
     513             :                 case SURROUND_NONE:
     514           0 :                     oValue = "none";
     515           0 :                     break;
     516             :                 case SURROUND_THROUGHT:
     517           0 :                     oValue = "throught";
     518           0 :                     break;
     519             :                 case SURROUND_PARALLEL:
     520           0 :                     oValue = "parallel";
     521           0 :                     break;
     522             :                 case SURROUND_IDEAL:
     523           0 :                     oValue = "ideal";
     524           0 :                     break;
     525             :                 case SURROUND_LEFT:
     526           0 :                     oValue = "left";
     527           0 :                     break;
     528             :                 case SURROUND_RIGHT:
     529           0 :                     oValue = "right";
     530           0 :                     break;
     531             :                 case SURROUND_END:
     532           0 :                     oValue = "end";
     533           0 :                     break;
     534             :                 }
     535           0 :                 break;
     536             :             }
     537             :             case RES_FOLLOW_TEXT_FLOW:
     538             :             {
     539           0 :                 pWhich = "frame follow text flow";
     540           0 :                 break;
     541             :             }
     542             :             case RES_WRAP_INFLUENCE_ON_OBJPOS:
     543             :             {
     544           0 :                 pWhich = "frame wrap influence on object position";
     545           0 :                 break;
     546             :             }
     547             :             case XATTR_FILLSTYLE:
     548             :             {
     549           0 :                 pWhich = "fill style";
     550           0 :                 const XFillStyleItem* pFillStyleItem = static_cast<const XFillStyleItem*>(pItem);
     551           0 :                 switch (pFillStyleItem->GetValue())
     552             :                 {
     553             :                 default:
     554             :                 case drawing::FillStyle_NONE:
     555           0 :                     oValue = "none";
     556           0 :                     break;
     557             :                 case drawing::FillStyle_SOLID:
     558           0 :                     oValue = "solid";
     559           0 :                     break;
     560             :                 case drawing::FillStyle_GRADIENT:
     561           0 :                     oValue = "gradient";
     562           0 :                     break;
     563             :                 case drawing::FillStyle_HATCH:
     564           0 :                     oValue = "hatch";
     565           0 :                     break;
     566             :                 case drawing::FillStyle_BITMAP:
     567           0 :                     oValue = "bitmap";
     568           0 :                     break;
     569             :                 }
     570           0 :                 break;
     571             :             }
     572             :             case XATTR_FILLCOLOR:
     573           0 :                 pWhich = "fill color";
     574           0 :                 break;
     575             :             case XATTR_FILLBITMAP:
     576           0 :                 pWhich = "fill bitmap";
     577           0 :                 break;
     578             :             case XATTR_FILLTRANSPARENCE:
     579           0 :                 pWhich = "fill transparence";
     580           0 :                 break;
     581             :             case XATTR_FILLBMP_TILE:
     582           0 :                 pWhich = "fill bitmap tile";
     583           0 :                 break;
     584             :             case XATTR_FILLBMP_POS:
     585           0 :                 pWhich = "fill bitmap position";
     586           0 :                 break;
     587             :             case XATTR_FILLBMP_STRETCH:
     588           0 :                 pWhich = "fill bitmap stretch";
     589           0 :                 break;
     590             :             case RES_COL:
     591             :             {
     592           0 :                 pWhich = "columns formatting";
     593           0 :                 const SwFmtCol* pFmtCol = static_cast<const SwFmtCol*>(pItem);
     594           0 :                 oValue = "number of columns: " + OString::number(pFmtCol->GetColumns().size());
     595           0 :                 break;
     596             :             }
     597             :             case RES_PROTECT:
     598           0 :                 pWhich = "protect";
     599           0 :                 break;
     600             :             case RES_EDIT_IN_READONLY:
     601           0 :                 pWhich = "edit in read-only";
     602           0 :                 break;
     603             :             case RES_COLUMNBALANCE:
     604           0 :                 pWhich = "column balance";
     605           0 :                 break;
     606             :             case RES_LR_SPACE:
     607           0 :                 pWhich = "left-right space";
     608           0 :                 break;
     609             :             case RES_UL_SPACE:
     610           0 :                 pWhich = "upper-lower space";
     611           0 :                 break;
     612             :             case RES_SHADOW:
     613           0 :                 pWhich = "shadow";
     614           0 :                 break;
     615             :             case RES_PAGEDESC:
     616           0 :                 pWhich = "page description";
     617           0 :                 const SwFmtPageDesc* pFmt = static_cast<const SwFmtPageDesc*>(pItem);
     618           0 :                 if (pFmt->GetPageDesc())
     619           0 :                     oValue = "name: " + OUStringToOString(pFmt->GetPageDesc()->GetName(), RTL_TEXTENCODING_UTF8);
     620           0 :                 break;
     621             :         }
     622           0 :         if (pWhich)
     623           0 :             writer.writeFormatAttribute("which", "%s", BAD_CAST(pWhich));
     624           0 :         if (oValue)
     625           0 :             writer.writeFormatAttribute("value", "%s", BAD_CAST(oValue->getStr()));
     626           0 :         pItem = aIter.NextItem();
     627           0 :         writer.endElement();
     628           0 :     }
     629           0 : }
     630             : 
     631           0 : void SwFrmFmts::dumpAsXml(xmlTextWriterPtr w, const char* pName) const
     632             : {
     633           0 :     WriterHelper writer(w);
     634           0 :     if (size())
     635             :     {
     636           0 :         writer.startElement(pName);
     637           0 :         for (size_t i = 0; i < size(); ++i)
     638             :         {
     639           0 :             SwFrmFmt* pFmt = static_cast<SwFrmFmt*>(GetFmt(i));
     640           0 :             writer.startElement("swfrmfmt");
     641           0 :             OString aName = OUStringToOString(pFmt->GetName(), RTL_TEXTENCODING_UTF8);
     642           0 :             writer.writeFormatAttribute("ptr", "%p", pFmt);
     643           0 :             writer.writeFormatAttribute("name", "%s", BAD_CAST(aName.getStr()));
     644             : 
     645           0 :             writer.writeFormatAttribute("whichId", TMP_FORMAT, pFmt->Which());
     646           0 :             const char* pWhich = 0;
     647           0 :             switch (pFmt->Which())
     648             :             {
     649             :             case RES_FLYFRMFMT:
     650           0 :                 pWhich = "fly frame format";
     651           0 :                 break;
     652             :             case RES_DRAWFRMFMT:
     653           0 :                 pWhich = "draw frame format";
     654           0 :                 break;
     655             :             }
     656           0 :             if (pWhich)
     657           0 :                 writer.writeFormatAttribute("which", "%s", BAD_CAST(pWhich));
     658             : 
     659           0 :             lcl_dumpSfxItemSet(writer, &pFmt->GetAttrSet());
     660           0 :             writer.endElement();
     661           0 :         }
     662           0 :         writer.endElement();
     663           0 :     }
     664           0 : }
     665             : 
     666           0 : void SwCharFmts::dumpAsXml(xmlTextWriterPtr w) const
     667             : {
     668           0 :     WriterHelper writer(w);
     669           0 :     if (size())
     670             :     {
     671           0 :         writer.startElement("swcharfmts");
     672           0 :         for (size_t i = 0; i < size(); ++i)
     673             :         {
     674           0 :             SwCharFmt* pFmt = static_cast<SwCharFmt*>(GetFmt(i));
     675           0 :             writer.startElement("swcharfmt");
     676           0 :             OString aName = OUStringToOString(pFmt->GetName(), RTL_TEXTENCODING_UTF8);
     677           0 :             writer.writeFormatAttribute("name", "%s", BAD_CAST(aName.getStr()));
     678             : 
     679           0 :             lcl_dumpSfxItemSet(writer, &pFmt->GetAttrSet());
     680           0 :             writer.endElement();
     681           0 :         }
     682           0 :         writer.endElement();
     683           0 :     }
     684           0 : }
     685             : 
     686           0 : void SwSectionFmts::dumpAsXml(xmlTextWriterPtr w) const
     687             : {
     688           0 :     WriterHelper writer(w);
     689           0 :     if (size())
     690             :     {
     691           0 :         writer.startElement("swsectionfmts");
     692           0 :         for (size_t i = 0; i < size(); ++i)
     693             :         {
     694           0 :             SwSectionFmt* pFmt = static_cast<SwSectionFmt*>(GetFmt(i));
     695           0 :             writer.startElement("swsectionfmt");
     696           0 :             lcl_dumpSfxItemSet(writer, &pFmt->GetAttrSet());
     697           0 :             writer.endElement();
     698             :         }
     699           0 :         writer.endElement();
     700           0 :     }
     701           0 : }
     702             : 
     703           0 : void SwTxtFmtColls::dumpAsXml(xmlTextWriterPtr w) const
     704             : {
     705           0 :     WriterHelper writer(w);
     706           0 :     if (size())
     707             :     {
     708           0 :         writer.startElement("swtxtfmtcolls");
     709           0 :         for (size_t i = 0; i < size(); ++i)
     710             :         {
     711           0 :             SwTxtFmtColl* pColl = static_cast<SwTxtFmtColl*>(GetFmt(i));
     712           0 :             writer.startElement("swtxtfmtcoll");
     713           0 :             OString aName = OUStringToOString(pColl->GetName(), RTL_TEXTENCODING_UTF8);
     714           0 :             writer.writeFormatAttribute("name", "%s", BAD_CAST(aName.getStr()));
     715             : 
     716           0 :             lcl_dumpSfxItemSet(writer, &pColl->GetAttrSet());
     717           0 :             writer.endElement();
     718           0 :         }
     719           0 :         writer.endElement();
     720           0 :     }
     721           0 : }
     722             : 
     723           0 : void SwNumRule::dumpAsXml(xmlTextWriterPtr w) const
     724             : {
     725           0 :      WriterHelper writer(w);
     726           0 :      writer.startElement("swnumrule");
     727           0 :      OString aName = OUStringToOString(GetName(), RTL_TEXTENCODING_UTF8);
     728           0 :      writer.writeFormatAttribute("name", "%s", BAD_CAST(aName.getStr()));
     729           0 :      writer.writeFormatAttribute("isautorule", TMP_FORMAT, IsAutoRule() ? 1 : 0);
     730           0 :      if (GetPoolFmtId() != USHRT_MAX)
     731           0 :          writer.writeFormatAttribute("poolfmtid", TMP_FORMAT, GetPoolFmtId());
     732           0 :      writer.endElement();
     733           0 : }
     734             : 
     735           0 : void SwNumRuleTbl::dumpAsXml(xmlTextWriterPtr w) const
     736             : {
     737           0 :     if (!empty())
     738             :     {
     739           0 :         WriterHelper writer(w);
     740           0 :         writer.startElement("swnumruletbl");
     741           0 :         for (size_t i = 0; i < size(); ++i)
     742           0 :             operator[](i)->dumpAsXml(w);
     743           0 :         writer.endElement();
     744             :     }
     745           0 : }
     746             : 
     747           0 : void SwTxtNode::dumpAsXml( xmlTextWriterPtr w ) const
     748             : {
     749           0 :     WriterHelper writer( w );
     750           0 :     writer.startElement( "text" );
     751           0 :     writer.writeFormatAttribute( "ptr", "%p", this );
     752           0 :     writer.writeFormatAttribute( "index", TMP_FORMAT, GetIndex() );
     753           0 :     OUString txt = GetTxt();
     754           0 :     for( int i = 0; i < 32; ++i )
     755           0 :         txt = txt.replace( i, '*' );
     756           0 :     OString txt8 = OUStringToOString( txt, RTL_TEXTENCODING_UTF8 );
     757           0 :     writer.startElement("inner_text");
     758           0 :     xmlTextWriterWriteString( writer, BAD_CAST( txt8.getStr()));
     759           0 :     writer.endElement( );
     760             : 
     761           0 :     if (GetFmtColl())
     762             :     {
     763           0 :         SwTxtFmtColl* pColl = static_cast<SwTxtFmtColl*>(GetFmtColl());
     764           0 :         writer.startElement("swtxtfmtcoll");
     765           0 :         OString aName = OUStringToOString(pColl->GetName(), RTL_TEXTENCODING_UTF8);
     766           0 :         writer.writeFormatAttribute("name", "%s", BAD_CAST(aName.getStr()));
     767           0 :         writer.endElement();
     768             :     }
     769             : 
     770           0 :     if (HasSwAttrSet())
     771             :     {
     772           0 :         writer.startElement("attrset");
     773           0 :         const SwAttrSet& rAttrSet = GetSwAttrSet();
     774           0 :         lcl_dumpSfxItemSet(writer, &rAttrSet);
     775           0 :         writer.endElement();
     776             :     }
     777             : 
     778           0 :     if (HasHints())
     779             :     {
     780           0 :         writer.startElement("hints");
     781           0 :         const SwpHints& rHints = GetSwpHints();
     782           0 :         for (size_t i = 0; i < rHints.Count(); ++i)
     783             :         {
     784           0 :             writer.startElement("hint");
     785           0 :             const SwTxtAttr* pHint = rHints.GetTextHint(i);
     786             : 
     787           0 :             if (pHint->GetStart())
     788           0 :                 writer.writeFormatAttribute("start", TMP_FORMAT, pHint->GetStart());
     789           0 :             if (pHint->End())
     790           0 :                 writer.writeFormatAttribute("end", TMP_FORMAT, *pHint->End());
     791           0 :             writer.writeFormatAttribute("whichId", TMP_FORMAT, pHint->Which());
     792             : 
     793           0 :             const char* pWhich = 0;
     794           0 :             boost::optional<OString> oValue;
     795           0 :             switch (pHint->Which())
     796             :             {
     797             :                 case RES_TXTATR_AUTOFMT:
     798           0 :                     pWhich = "autofmt";
     799           0 :                     break;
     800             :                 case RES_TXTATR_ANNOTATION:
     801           0 :                     pWhich = "annotation";
     802           0 :                     break;
     803             :                 case RES_TXTATR_FLYCNT:
     804           0 :                     pWhich = "fly content";
     805           0 :                     break;
     806             :                 case RES_TXTATR_CHARFMT:
     807             :                 {
     808           0 :                     pWhich = "character format";
     809           0 :                     if (SwCharFmt* pCharFmt = pHint->GetCharFmt().GetCharFmt())
     810           0 :                         oValue = "name: " + OUStringToOString(pCharFmt->GetName(), RTL_TEXTENCODING_UTF8);
     811           0 :                     break;
     812             :                 }
     813             :                 default:
     814           0 :                     break;
     815             :             }
     816           0 :             if (pWhich)
     817           0 :                 writer.writeFormatAttribute("which", "%s", BAD_CAST(pWhich));
     818           0 :             if (oValue)
     819           0 :                 writer.writeFormatAttribute("value", "%s", BAD_CAST(oValue->getStr()));
     820             : 
     821           0 :             if (pHint->Which() == RES_TXTATR_AUTOFMT)
     822             :             {
     823           0 :                 boost::shared_ptr<SfxItemSet> const pSet(pHint->GetAutoFmt().GetStyleHandle());
     824           0 :                 writer.startElement("autofmt");
     825           0 :                 lcl_dumpSfxItemSet(writer, pSet.get());
     826           0 :                 writer.endElement();
     827             :             }
     828             : 
     829           0 :             writer.endElement();
     830           0 :         }
     831           0 :         writer.endElement();
     832             :     }
     833           0 :     if (GetNumRule())
     834           0 :         GetNumRule()->dumpAsXml(w);
     835             : 
     836           0 :     writer.endElement();
     837           0 : }
     838             : 
     839           0 : void SwRedlineTbl::dumpAsXml( xmlTextWriterPtr w ) const
     840             : {
     841           0 :     WriterHelper writer( w );
     842             : 
     843           0 :     writer.startElement( "swredlinetbl" );
     844           0 :     writer.writeFormatAttribute( "ptr", "%p", this );
     845             : 
     846           0 :     const SwRedlineTbl& redlineTbl = (*this);
     847             : 
     848           0 :     for( sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < size(); ++nCurRedlinePos )
     849             :     {
     850           0 :         const SwRangeRedline* pRedline = redlineTbl[ nCurRedlinePos ];
     851             : 
     852           0 :         writer.startElement( "swredline" );
     853           0 :         writer.writeFormatAttribute( "ptr", "%p", pRedline );
     854             : 
     855           0 :         OString aId( OString::number( pRedline->GetSeqNo() ) );
     856           0 :         const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( pRedline->GetAuthor() ) );
     857           0 :         OString aAuthor( OUStringToOString( rAuthor, RTL_TEXTENCODING_UTF8 ) );
     858           0 :         OString aDate( DateTimeToOString( pRedline->GetTimeStamp() ) );
     859           0 :         OString sRedlineType;
     860           0 :         switch( pRedline->GetType() )
     861             :         {
     862             :             case nsRedlineType_t::REDLINE_INSERT:
     863           0 :                 sRedlineType = "REDLINE_INSERT";
     864           0 :                 break;
     865             :             case nsRedlineType_t::REDLINE_DELETE:
     866           0 :                 sRedlineType = "REDLINE_DELETE";
     867           0 :                 break;
     868             :             case nsRedlineType_t::REDLINE_FORMAT:
     869           0 :                 sRedlineType = "REDLINE_FORMAT";
     870           0 :                 break;
     871             :             default:
     872           0 :                 sRedlineType = "UNKNOWN";
     873           0 :                 break;
     874             :         }
     875           0 :         writer.writeFormatAttribute( "id", "%s", BAD_CAST(aId.getStr()) );
     876           0 :         writer.writeFormatAttribute( "author", "%s", BAD_CAST(aAuthor.getStr()) );
     877           0 :         writer.writeFormatAttribute( "date", "%s", BAD_CAST(aDate.getStr()) );
     878           0 :         writer.writeFormatAttribute( "type", "%s", BAD_CAST(sRedlineType.getStr()) );
     879             :         {
     880           0 :             const SwPosition* pStart = pRedline->Start();
     881             : 
     882           0 :             writer.startElement( "swposition_start" );
     883             :             //writer.writeFormatAttribute( "ptr", "%p", pStart );
     884             :             {
     885           0 :                 const SwNodeIndex pStartNodeIndex = pStart->nNode;
     886             :                 //writer.startElement( "swnodeindex" );
     887             :                 //writer.writeFormatAttribute( "ptr", "%p", &pStartNodeIndex );
     888             :                 {
     889           0 :                     const SwNode&     pStartSwNode      = pStartNodeIndex.GetNode();
     890             :                     //writer.startElement( "swnode" );
     891             :                     //writer.writeFormatAttribute( "ptr", "%p", &pStartSwNode );
     892             :                     //writer.writeFormatAttribute( "type", "%d", pStartSwNode.GetNodeType() );
     893             :                     //writer.endElement( );    // swnode
     894           0 :                     writer.writeFormatAttribute( "swnode_type", TMP_FORMAT, pStartSwNode.GetNodeType() );
     895             : 
     896           0 :                     writer.writeFormatAttribute( "paragraph_index", "%d", (int)pStartNodeIndex.GetIndex() );
     897             : 
     898           0 :                     const SwIndex&    pStartContent   = pStart->nContent;
     899             :                     //writer.startElement( "swindex" );
     900             :                     //writer.writeFormatAttribute( "ptr", "%p", &pStartContent );
     901             :                     //writer.writeFormatAttribute( "content_index", "%d", pStartContent.GetIndex() );
     902             :                     //writer.endElement( );    // swindex
     903           0 :                     writer.writeFormatAttribute( "character_index", TMP_FORMAT_I32, pStartContent.GetIndex() );
     904           0 :                 }
     905             :                 //writer.endElement( );    // swnodeindex
     906             :             }
     907           0 :             writer.endElement( );    // swposition_start
     908             : 
     909             :             const SwPosition* pEnd;
     910           0 :             bool bEndIsMark = false;
     911           0 :             if ( pStart == pRedline->GetPoint() )
     912             :             {
     913             :                 // End = Mark
     914           0 :                 pEnd = pRedline->GetMark();
     915           0 :                 bEndIsMark = true;
     916             :             }
     917             :             else
     918             :             {
     919             :                 // End = Point
     920           0 :                 pEnd = pRedline->GetPoint();
     921             :             }
     922             : 
     923           0 :             writer.startElement( "swposition_end" );
     924             :             //writer.writeFormatAttribute( "ptr", "%p", pStart );
     925             :             {
     926           0 :                 const SwNodeIndex pEndNodeIndex = pEnd->nNode;
     927             :                 //writer.startElement( "swnodeindex" );
     928             :                 //writer.writeFormatAttribute( "ptr", "%p", &pEndNodeIndex );
     929             :                 {
     930           0 :                     const SwNode&     pEndSwNode      = pEndNodeIndex.GetNode();
     931             :                     //writer.startElement( "swnode" );
     932             :                     //writer.writeFormatAttribute( "ptr", "%p", &pEndSwNode );
     933             :                     //writer.writeFormatAttribute( "type", "%d", pEndSwNode.GetNodeType() );
     934             :                     //writer.endElement( );    // swnode
     935           0 :                     writer.writeFormatAttribute( "swnode_type", TMP_FORMAT, pEndSwNode.GetNodeType() );
     936             : 
     937           0 :                     writer.writeFormatAttribute( "paragraph_index", "%d", (int)pEndNodeIndex.GetIndex() );
     938             : 
     939           0 :                     const SwIndex&    pEndContent   = pEnd->nContent;
     940             :                     //writer.startElement( "swindex" );
     941             :                     //writer.writeFormatAttribute( "ptr", "%p", &pEndContent );
     942             :                     //writer.writeFormatAttribute( "content_index", "%d", pEndContent.GetIndex() );
     943             :                     //writer.endElement( );    // swindex
     944           0 :                     writer.writeFormatAttribute( "character_index", TMP_FORMAT_I32, pEndContent.GetIndex() );
     945           0 :                 }
     946             :                 //writer.endElement( );    // swnodeindex
     947             :             }
     948           0 :             writer.writeFormatAttribute( "end_is", "%s", BAD_CAST(bEndIsMark ? "mark" : "point"));
     949           0 :             writer.endElement( );    // swposition_end
     950             : 
     951             :             //const SwRedlineData& aRedlineData = pRedline->GetRedlineData();
     952           0 :             const SwRedlineExtraData* pExtraRedlineData = pRedline->GetExtraData();
     953           0 :             writer.startElement( "extra_redline_data" );
     954             :             {
     955           0 :                 const SwRedlineExtraData_FmtColl*           pExtraData_FmtColl           = dynamic_cast<const SwRedlineExtraData_FmtColl*>(pExtraRedlineData);
     956           0 :                 const SwRedlineExtraData_Format*            pExtraData_Format            = dynamic_cast<const SwRedlineExtraData_Format*>(pExtraRedlineData);
     957           0 :                 const SwRedlineExtraData_FormattingChanges* pExtraData_FormattingChanges = dynamic_cast<const SwRedlineExtraData_FormattingChanges*>(pExtraRedlineData);
     958           0 :                 if (pExtraData_FmtColl)
     959           0 :                     writer.writeFormatAttribute( "extra_data_type", "%s", BAD_CAST( "fmt coll" ) );
     960           0 :                 else if (pExtraData_Format)
     961           0 :                     writer.writeFormatAttribute( "extra_data_type", "%s", BAD_CAST( "format" ) );
     962           0 :                 else if (pExtraData_FormattingChanges)
     963           0 :                     writer.writeFormatAttribute( "extra_data_type", "%s", BAD_CAST( "formatting changes" ) );
     964             :                 else
     965           0 :                     writer.writeFormatAttribute( "extra_data_type", "%s", BAD_CAST( "UNKNOWN" ) );
     966             :             }
     967           0 :             writer.endElement( );    // extra_redline_data
     968             :         }
     969             : 
     970           0 :         writer.endElement( );    // extra_redline_data
     971           0 :     }
     972             : 
     973           0 :     writer.endElement( );    // swredlinetbl
     974           0 : }
     975             : 
     976           0 : void SwExtraRedlineTbl::dumpAsXml( xmlTextWriterPtr w ) const
     977             : {
     978           0 :     WriterHelper writer( w );
     979             : 
     980           0 :     writer.startElement( "swextraredlinetbl" );
     981           0 :     writer.writeFormatAttribute( "ptr", "%p", this );
     982             : 
     983           0 :     const SwExtraRedlineTbl& extraRedlineTbl = (*this);
     984             : 
     985           0 :     for( sal_uInt16 nCurExtraRedlinePos = 0; nCurExtraRedlinePos < GetSize(); ++nCurExtraRedlinePos )
     986             :     {
     987           0 :         const SwExtraRedline* pExtraRedline = extraRedlineTbl.GetRedline( nCurExtraRedlinePos );
     988             : 
     989           0 :         writer.startElement( "swextraredline" );
     990             :         {
     991           0 :             const SwTableRowRedline*           pTableRowRedline           = dynamic_cast<const SwTableRowRedline*>(pExtraRedline);
     992           0 :             const SwTableCellRedline*          pTableCellRedline          = dynamic_cast<const SwTableCellRedline*>(pExtraRedline);
     993           0 :             if (pTableRowRedline)
     994           0 :                 writer.writeFormatAttribute( "extra_redline_type", "%s", BAD_CAST( "table row" ) );
     995           0 :             else if (pTableCellRedline)
     996           0 :                 writer.writeFormatAttribute( "extra_redline_type", "%s", BAD_CAST( "table cell" ) );
     997             :             else
     998           0 :                 writer.writeFormatAttribute( "extra_redline_type", "%s", BAD_CAST( "UNKNOWN" ) );
     999             :         }
    1000           0 :         writer.endElement( );    // extra_redline_data
    1001             :     }
    1002             : 
    1003           0 :     writer.endElement( );    // swextraredlinetbl
    1004           0 : }
    1005             : 
    1006           0 : void lcl_dumpSfxUndoAction(WriterHelper& writer, SfxUndoAction* pAction)
    1007             : {
    1008           0 :     writer.startElement("undoAction");
    1009           0 :     writer.writeFormatAttribute("symbol", "%s", BAD_CAST(typeid(*pAction).name()));
    1010           0 :     writer.writeFormatAttribute("comment", "%s", BAD_CAST(OUStringToOString(pAction->GetComment(), RTL_TEXTENCODING_UTF8).getStr()));
    1011             : 
    1012           0 :     if (SfxListUndoAction* pList = dynamic_cast<SfxListUndoAction*>(pAction))
    1013             :     {
    1014           0 :         writer.startElement("list");
    1015           0 :         writer.writeFormatAttribute("size", TMP_FORMAT, pList->aUndoActions.size());
    1016           0 :         for (size_t i = 0; i < pList->aUndoActions.size(); ++i)
    1017           0 :             lcl_dumpSfxUndoAction(writer, pList->aUndoActions[i].pAction);
    1018           0 :         writer.endElement();
    1019             :     }
    1020             : 
    1021           0 :     writer.endElement();
    1022           0 : }
    1023             : 
    1024           0 : void sw::UndoManager::dumpAsXml(xmlTextWriterPtr w)
    1025             : {
    1026           0 :     WriterHelper writer(w);
    1027             : 
    1028           0 :     writer.startElement("m_pUndoManager");
    1029           0 :     writer.writeFormatAttribute("nUndoActionCount", TMP_FORMAT, GetUndoActionCount());
    1030             : 
    1031           0 :     for (size_t i = 0; i < GetUndoActionCount(); ++i)
    1032           0 :         lcl_dumpSfxUndoAction(writer, GetUndoAction(i));
    1033             : 
    1034           0 :     writer.endElement();
    1035         270 : }
    1036             : 
    1037             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10