summaryrefslogtreecommitdiff
path: root/vcl/source/filter/svm/SvmWriter.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/filter/svm/SvmWriter.cxx')
-rw-r--r--vcl/source/filter/svm/SvmWriter.cxx41
1 files changed, 41 insertions, 0 deletions
diff --git a/vcl/source/filter/svm/SvmWriter.cxx b/vcl/source/filter/svm/SvmWriter.cxx
index 6a3a88f78b79..fc4945274d6e 100644
--- a/vcl/source/filter/svm/SvmWriter.cxx
+++ b/vcl/source/filter/svm/SvmWriter.cxx
@@ -155,6 +155,13 @@ void SvmWriter::MetaActionHandler(MetaAction* pAction, ImplMetaWriteData* pData)
}
break;
+ case MetaActionType::POLYPOLYGON:
+ {
+ auto* pMetaAction = static_cast<MetaPolyPolygonAction*>(pAction);
+ PolyPolygonHandler(pMetaAction);
+ }
+ break;
+
/* default case prevents test failure and will be
removed once all the handlers are completed */
default:
@@ -292,4 +299,38 @@ void SvmWriter::PolygonHandler(MetaPolygonAction* pAction)
if (bHasPolyFlags)
pAction->GetPolygon().Write(mrStream);
}
+
+void SvmWriter::PolyPolygonHandler(MetaPolyPolygonAction* pAction)
+{
+ mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
+
+ VersionCompatWrite aCompat(mrStream, 2);
+
+ sal_uInt16 nNumberOfComplexPolygons = 0;
+ sal_uInt16 i, nPolyCount = pAction->GetPolyPolygon().Count();
+
+ tools::Polygon aSimplePoly; // Version 1
+ mrStream.WriteUInt16(nPolyCount);
+ for (i = 0; i < nPolyCount; i++)
+ {
+ const tools::Polygon& rPoly = pAction->GetPolyPolygon().GetObject(i);
+ if (rPoly.HasFlags())
+ nNumberOfComplexPolygons++;
+ rPoly.AdaptiveSubdivide(aSimplePoly);
+ WritePolygon(mrStream, aSimplePoly);
+ }
+
+ mrStream.WriteUInt16(nNumberOfComplexPolygons); // Version 2
+ for (i = 0; nNumberOfComplexPolygons && (i < nPolyCount); i++)
+ {
+ const tools::Polygon& rPoly = pAction->GetPolyPolygon().GetObject(i);
+ if (rPoly.HasFlags())
+ {
+ mrStream.WriteUInt16(i);
+ rPoly.Write(mrStream);
+
+ nNumberOfComplexPolygons--;
+ }
+ }
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tephan Bergmann 2017-01-19new loplugin: useuniqueptr: unotools..xmlscriptNoel Grandin 2017-01-09New loplugin:externvar: xmlhelpStephan Bergmann