extend dumpAsXml to EditDoc
Change-Id: I71464b20c5897a2af3b4069f7f0963ef55dcd8c4
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include <vcl/svapp.hxx>
|
#include <vcl/svapp.hxx>
|
||||||
|
|
||||||
#include <svl/grabbagitem.hxx>
|
#include <svl/grabbagitem.hxx>
|
||||||
|
#include <libxml/xmlwriter.h>
|
||||||
#include <editeng/svxfont.hxx>
|
#include <editeng/svxfont.hxx>
|
||||||
#include <editeng/flditem.hxx>
|
#include <editeng/flditem.hxx>
|
||||||
#include <editeng/fontitem.hxx>
|
#include <editeng/fontitem.hxx>
|
||||||
@@ -68,6 +69,15 @@ void EditCharAttrib::SetFont( SvxFont&, OutputDevice* )
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditCharAttrib::dumpAsXml(xmlTextWriterPtr pWriter) const
|
||||||
|
{
|
||||||
|
xmlTextWriterStartElement(pWriter, BAD_CAST("editCharAttrib"));
|
||||||
|
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nStart"), "%d", nStart);
|
||||||
|
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nEnd"), "%d", nEnd);
|
||||||
|
pItem->dumpAsXml(pWriter);
|
||||||
|
xmlTextWriterEndElement(pWriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// class EditCharAttribFont
|
// class EditCharAttribFont
|
||||||
|
|
||||||
|
@@ -80,6 +80,8 @@ public:
|
|||||||
EditCharAttrib(const EditCharAttrib&) = delete;
|
EditCharAttrib(const EditCharAttrib&) = delete;
|
||||||
EditCharAttrib& operator=(const EditCharAttrib&) = delete;
|
EditCharAttrib& operator=(const EditCharAttrib&) = delete;
|
||||||
|
|
||||||
|
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
|
||||||
|
|
||||||
sal_uInt16 Which() const { return pItem->Which(); }
|
sal_uInt16 Which() const { return pItem->Which(); }
|
||||||
const SfxPoolItem* GetItem() const { return pItem; }
|
const SfxPoolItem* GetItem() const { return pItem; }
|
||||||
|
|
||||||
|
@@ -63,6 +63,7 @@
|
|||||||
#include <tools/stream.hxx>
|
#include <tools/stream.hxx>
|
||||||
#include <tools/debug.hxx>
|
#include <tools/debug.hxx>
|
||||||
#include <com/sun/star/i18n/ScriptType.hpp>
|
#include <com/sun/star/i18n/ScriptType.hpp>
|
||||||
|
#include <libxml/xmlwriter.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@@ -1856,6 +1857,16 @@ void ContentNode::DestroyWrongList()
|
|||||||
mpWrongList.reset();
|
mpWrongList.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContentNode::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
||||||
|
{
|
||||||
|
xmlTextWriterStartElement(pWriter, BAD_CAST("contentNode"));
|
||||||
|
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("maString"), BAD_CAST(maString.toUtf8().getStr()));
|
||||||
|
aContentAttribs.dumpAsXml(pWriter);
|
||||||
|
aCharAttribList.dumpAsXml(pWriter);
|
||||||
|
xmlTextWriterEndElement(pWriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ContentAttribs::ContentAttribs( SfxItemPool& rPool )
|
ContentAttribs::ContentAttribs( SfxItemPool& rPool )
|
||||||
: pStyle(nullptr)
|
: pStyle(nullptr)
|
||||||
, aAttribSet( rPool, EE_PARA_START, EE_CHAR_END )
|
, aAttribSet( rPool, EE_PARA_START, EE_CHAR_END )
|
||||||
@@ -1930,6 +1941,13 @@ bool ContentAttribs::HasItem( sal_uInt16 nWhich ) const
|
|||||||
return bHasItem;
|
return bHasItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContentAttribs::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
||||||
|
{
|
||||||
|
xmlTextWriterStartElement(pWriter, BAD_CAST("contentAttribs"));
|
||||||
|
aAttribSet.dumpAsXml(pWriter);
|
||||||
|
xmlTextWriterEndElement(pWriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ItemList::ItemList() : CurrentItem( 0 )
|
ItemList::ItemList() : CurrentItem( 0 )
|
||||||
{
|
{
|
||||||
@@ -2718,6 +2736,31 @@ void EditDoc::FindAttribs( ContentNode* pNode, sal_Int32 nStartPos, sal_Int32 nE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditDoc::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
||||||
|
{
|
||||||
|
bool bOwns = false;
|
||||||
|
if (!pWriter)
|
||||||
|
{
|
||||||
|
pWriter = xmlNewTextWriterFilename("editdoc.xml", 0);
|
||||||
|
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
||||||
|
bOwns = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlTextWriterStartElement(pWriter, BAD_CAST("editDoc"));
|
||||||
|
for (auto const & i : maContents)
|
||||||
|
{
|
||||||
|
i->dumpAsXml(pWriter);
|
||||||
|
}
|
||||||
|
xmlTextWriterEndElement(pWriter);
|
||||||
|
|
||||||
|
if (bOwns)
|
||||||
|
{
|
||||||
|
xmlTextWriterEndDocument(pWriter);
|
||||||
|
xmlFreeTextWriter(pWriter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct LessByStart : std::binary_function<std::unique_ptr<EditCharAttrib>, std::unique_ptr<EditCharAttrib>, bool>
|
struct LessByStart : std::binary_function<std::unique_ptr<EditCharAttrib>, std::unique_ptr<EditCharAttrib>, bool>
|
||||||
@@ -3017,6 +3060,14 @@ void CharAttribList::DbgCheckAttribs(CharAttribList const& rAttribs)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void CharAttribList::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
||||||
|
{
|
||||||
|
xmlTextWriterStartElement(pWriter, BAD_CAST("charAttribList"));
|
||||||
|
for (auto const & i : aAttribs) {
|
||||||
|
i->dumpAsXml(pWriter);
|
||||||
|
}
|
||||||
|
xmlTextWriterEndElement(pWriter);
|
||||||
|
}
|
||||||
|
|
||||||
EditEngineItemPool::EditEngineItemPool( bool bPersistenRefCounts )
|
EditEngineItemPool::EditEngineItemPool( bool bPersistenRefCounts )
|
||||||
: SfxItemPool( "EditEngineItemPool", EE_ITEMS_START, EE_ITEMS_END,
|
: SfxItemPool( "EditEngineItemPool", EE_ITEMS_START, EE_ITEMS_END,
|
||||||
|
@@ -164,6 +164,8 @@ public:
|
|||||||
ContentAttribs( const ContentAttribs& );
|
ContentAttribs( const ContentAttribs& );
|
||||||
~ContentAttribs(); // only for larger Tabs
|
~ContentAttribs(); // only for larger Tabs
|
||||||
|
|
||||||
|
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
|
||||||
|
|
||||||
SvxTabStop FindTabStop( sal_Int32 nCurPos, sal_uInt16 nDefTab );
|
SvxTabStop FindTabStop( sal_Int32 nCurPos, sal_uInt16 nDefTab );
|
||||||
SfxItemSet& GetItems() { return aAttribSet; }
|
SfxItemSet& GetItems() { return aAttribSet; }
|
||||||
const SfxItemSet& GetItems() const { return aAttribSet; }
|
const SfxItemSet& GetItems() const { return aAttribSet; }
|
||||||
@@ -194,6 +196,8 @@ public:
|
|||||||
CharAttribList();
|
CharAttribList();
|
||||||
~CharAttribList();
|
~CharAttribList();
|
||||||
|
|
||||||
|
void dumpAsXml(struct _xmlTextWriter* pWriter = nullptr) const;
|
||||||
|
|
||||||
void DeleteEmptyAttribs( SfxItemPool& rItemPool );
|
void DeleteEmptyAttribs( SfxItemPool& rItemPool );
|
||||||
|
|
||||||
const EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const;
|
const EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const;
|
||||||
@@ -248,6 +252,8 @@ public:
|
|||||||
ContentNode(const ContentNode&) = delete;
|
ContentNode(const ContentNode&) = delete;
|
||||||
ContentNode& operator=(const ContentNode&) = delete;
|
ContentNode& operator=(const ContentNode&) = delete;
|
||||||
|
|
||||||
|
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
|
||||||
|
|
||||||
ContentAttribs& GetContentAttribs() { return aContentAttribs; }
|
ContentAttribs& GetContentAttribs() { return aContentAttribs; }
|
||||||
const ContentAttribs& GetContentAttribs() const { return aContentAttribs; }
|
const ContentAttribs& GetContentAttribs() const { return aContentAttribs; }
|
||||||
CharAttribList& GetCharAttribs() { return aCharAttribList; }
|
CharAttribList& GetCharAttribs() { return aCharAttribList; }
|
||||||
@@ -747,6 +753,7 @@ public:
|
|||||||
EditDoc( SfxItemPool* pItemPool );
|
EditDoc( SfxItemPool* pItemPool );
|
||||||
~EditDoc();
|
~EditDoc();
|
||||||
|
|
||||||
|
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
|
||||||
void ClearSpellErrors();
|
void ClearSpellErrors();
|
||||||
|
|
||||||
bool IsModified() const { return bModified; }
|
bool IsModified() const { return bModified; }
|
||||||
|
@@ -458,6 +458,14 @@ void EditTextObject::Dump() const
|
|||||||
|
|
||||||
void EditTextObject::dumpAsXml(xmlTextWriterPtr pWriter) const
|
void EditTextObject::dumpAsXml(xmlTextWriterPtr pWriter) const
|
||||||
{
|
{
|
||||||
|
bool bOwns = false;
|
||||||
|
if (!pWriter)
|
||||||
|
{
|
||||||
|
pWriter = xmlNewTextWriterFilename("editTextObject.xml", 0);
|
||||||
|
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
||||||
|
bOwns = true;
|
||||||
|
}
|
||||||
|
|
||||||
xmlTextWriterStartElement(pWriter, BAD_CAST("editTextObject"));
|
xmlTextWriterStartElement(pWriter, BAD_CAST("editTextObject"));
|
||||||
sal_Int32 nCount = GetParagraphCount();
|
sal_Int32 nCount = GetParagraphCount();
|
||||||
for (sal_Int32 i = 0; i < nCount; ++i)
|
for (sal_Int32 i = 0; i < nCount; ++i)
|
||||||
@@ -467,6 +475,12 @@ void EditTextObject::dumpAsXml(xmlTextWriterPtr pWriter) const
|
|||||||
xmlTextWriterEndElement(pWriter);
|
xmlTextWriterEndElement(pWriter);
|
||||||
}
|
}
|
||||||
xmlTextWriterEndElement(pWriter);
|
xmlTextWriterEndElement(pWriter);
|
||||||
|
|
||||||
|
if (bOwns)
|
||||||
|
{
|
||||||
|
xmlTextWriterEndDocument(pWriter);
|
||||||
|
xmlFreeTextWriter(pWriter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// from SfxItemPoolUser
|
// from SfxItemPoolUser
|
||||||
|
Reference in New Issue
Block a user