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

Factor out SdrObject::dumpAsXml() from SwDoc::dumpAsXml()

Change-Id: I043f740c73f1b39d81383f4f1eab2aae009ac2ba
üst 1e514c8d
...@@ -961,6 +961,8 @@ public: ...@@ -961,6 +961,8 @@ public:
OString stringify() const; OString stringify() const;
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
protected: protected:
// Sets a new UNO shape // Sets a new UNO shape
// //
......
...@@ -87,6 +87,7 @@ $(eval $(call gb_Library_use_externals,svxcore,\ ...@@ -87,6 +87,7 @@ $(eval $(call gb_Library_use_externals,svxcore,\
icu_headers \ icu_headers \
mesa_headers \ mesa_headers \
glew \ glew \
libxml2 \
)) ))
ifeq ($(OS),MACOSX) ifeq ($(OS),MACOSX)
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <drawinglayer/processor2d/linegeometryextractor2d.hxx> #include <drawinglayer/processor2d/linegeometryextractor2d.hxx>
#include <editeng/editeng.hxx> #include <editeng/editeng.hxx>
#include <editeng/eeitem.hxx> #include <editeng/eeitem.hxx>
#include <editeng/outlobj.hxx>
#include <math.h> #include <math.h>
#include <sfx2/objface.hxx> #include <sfx2/objface.hxx>
#include <sfx2/objsh.hxx> #include <sfx2/objsh.hxx>
...@@ -133,6 +134,7 @@ ...@@ -133,6 +134,7 @@
#include <svdobjuserdatalist.hxx> #include <svdobjuserdatalist.hxx>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <libxml/xmlwriter.h>
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -1750,6 +1752,22 @@ OString SdrObject::stringify() const ...@@ -1750,6 +1752,22 @@ OString SdrObject::stringify() const
return aString.makeStringAndClear(); return aString.makeStringAndClear();
} }
void SdrObject::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("sdrObject"));
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", BAD_CAST(typeid(*this).name()));
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("name"), "%s", BAD_CAST(GetName().toUtf8().getStr()));
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("title"), "%s", BAD_CAST(GetTitle().toUtf8().getStr()));
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("description"), "%s", BAD_CAST(GetDescription().toUtf8().getStr()));
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nOrdNum"), "%" SAL_PRIuUINT32, GetOrdNumDirect());
if (const OutlinerParaObject* pOutliner = GetOutlinerParaObject())
pOutliner->dumpAsXml(pWriter);
xmlTextWriterEndElement(pWriter);
}
bool SdrObject::BegTextEdit(SdrOutliner& /*rOutl*/) bool SdrObject::BegTextEdit(SdrOutliner& /*rOutl*/)
{ {
return false; return false;
......
...@@ -147,21 +147,8 @@ void lcl_dumpSdrModel(WriterHelper& writer, const SdrModel* pModel) ...@@ -147,21 +147,8 @@ void lcl_dumpSdrModel(WriterHelper& writer, const SdrModel* pModel)
const size_t nObjCount = pPage->GetObjCount(); const size_t nObjCount = pPage->GetObjCount();
for (size_t i = 0; i < nObjCount; ++i) for (size_t i = 0; i < nObjCount; ++i)
{ {
const SdrObject* pObject = pPage->GetObj(i); if (const SdrObject* pObject = pPage->GetObj(i))
writer.startElement("sdrObject"); pObject->dumpAsXml(writer);
writer.writeFormatAttribute("ptr", "%p", pObject);
if (pObject)
{
writer.writeFormatAttribute("symbol", "%s", BAD_CAST(typeid(*pObject).name()));
writer.writeFormatAttribute("name", "%s", BAD_CAST(OUStringToOString(pObject->GetName(), RTL_TEXTENCODING_UTF8).getStr()));
writer.writeFormatAttribute("title", "%s", BAD_CAST(OUStringToOString(pObject->GetTitle(), RTL_TEXTENCODING_UTF8).getStr()));
writer.writeFormatAttribute("description", "%s", BAD_CAST(OUStringToOString(pObject->GetDescription(), RTL_TEXTENCODING_UTF8).getStr()));
writer.writeFormatAttribute("nOrdNum", TMP_FORMAT, pObject->GetOrdNumDirect());
if (const OutlinerParaObject* pOutliner = pObject->GetOutlinerParaObject())
pOutliner->dumpAsXml(writer);
}
writer.endElement();
} }
} }
writer.endElement(); writer.endElement();
......
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