summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-06-08 12:17:19 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-06-08 11:44:05 +0000
commita106165e7fd39215c4717e1486aef05f6af9180f (patch)
treeb4c953b89820c43165b301dea1ae5ba73a67e4e1 /svx
parent7f25ccc81a35d2a89880cacf7835aa4b875f2ab2 (diff)
Related: tdf#100269 sd xml dump: expose layout of table shapes
So that it's possible to assert the layout from cppunit tests. Change-Id: I09631f978ed44bb1c27806089b6d69c70db643c3 Reviewed-on: https://gerrit.libreoffice.org/26054 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/table/svdotable.cxx21
-rw-r--r--svx/source/table/tablelayouter.cxx29
-rw-r--r--svx/source/table/tablelayouter.hxx2
3 files changed, 52 insertions, 0 deletions
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 8c707110e513..36fa94ff6d2f 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -57,6 +57,7 @@
#include "svx/xflftrit.hxx"
#include "svx/xfltrit.hxx"
#include <cppuhelper/implbase.hxx>
+#include <libxml/xmlwriter.h>
using ::com::sun::star::uno::Any;
@@ -238,6 +239,7 @@ public:
void connectTableStyle();
void disconnectTableStyle();
virtual bool isInUse() override;
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const;
private:
static SdrTableObjImpl* lastLayoutTable;
static Rectangle lastLayoutInputRectangle;
@@ -624,6 +626,14 @@ bool SdrTableObjImpl::isInUse()
return mpTableObj && mpTableObj->IsInserted();
}
+void SdrTableObjImpl::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("sdrTableObjImpl"));
+ if (mpLayouter)
+ mpLayouter->dumpAsXml(pWriter);
+ xmlTextWriterEndElement(pWriter);
+}
+
// XEventListener
@@ -2497,6 +2507,17 @@ void SdrTableObj::uno_unlock()
mpImpl->mxTable->unlockBroadcasts();
}
+void SdrTableObj::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("sdrTableObj"));
+ xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+
+ SdrObject::dumpAsXml(pWriter);
+
+ mpImpl->dumpAsXml(pWriter);
+
+ xmlTextWriterEndElement(pWriter);
+}
} }
diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
index 0f6208c54f1d..ae87f5044ad3 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/table/XMergeableCell.hpp>
#include <tools/gen.hxx>
+#include <libxml/xmlwriter.h>
#include "cell.hxx"
#include "cellrange.hxx"
@@ -1121,6 +1122,34 @@ void TableLayouter::DistributeRows( ::Rectangle& rArea, sal_Int32 nFirstRow, sal
}
}
+void TableLayouter::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("tableLayouter"));
+
+ xmlTextWriterStartElement(pWriter, BAD_CAST("columns"));
+ for (const auto& rColumn : maColumns)
+ rColumn.dumpAsXml(pWriter);
+ xmlTextWriterEndElement(pWriter);
+
+ xmlTextWriterStartElement(pWriter, BAD_CAST("rows"));
+ for (const auto& rRow : maRows)
+ rRow.dumpAsXml(pWriter);
+ xmlTextWriterEndElement(pWriter);
+
+ xmlTextWriterEndElement(pWriter);
+}
+
+void TableLayouter::Layout::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("layout"));
+
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("pos"), BAD_CAST(OString::number(mnPos).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("size"), BAD_CAST(OString::number(mnSize).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("minSize"), BAD_CAST(OString::number(mnMinSize).getStr()));
+
+ xmlTextWriterEndElement(pWriter);
+}
+
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/table/tablelayouter.hxx b/svx/source/table/tablelayouter.hxx
index b38345588a54..0ab692c2591c 100644
--- a/svx/source/table/tablelayouter.hxx
+++ b/svx/source/table/tablelayouter.hxx
@@ -96,6 +96,7 @@ public:
void DistributeColumns( ::Rectangle& rArea, sal_Int32 nFirstCol, sal_Int32 nLastCol );
void DistributeRows( ::Rectangle& rArea, sal_Int32 nFirstRow, sal_Int32 nLastRow );
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const;
private:
CellRef getCell( const CellPos& rPos ) const;
@@ -125,6 +126,7 @@ private:
Layout() : mnPos( 0 ), mnSize( 0 ), mnMinSize( 0 ) {}
void clear() { mnPos = 0; mnSize = 0; mnMinSize = 0; }
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const;
};
typedef std::vector< Layout > LayoutVector;