summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpanoskorovesis <panoskorovesis@outlook.com>2021-07-31 14:07:45 +0300
committerTomaž Vajngerl <quikee@gmail.com>2021-08-02 15:51:57 +0200
commit940ef7d652f0916adf7c3499682e6f81b86404c8 (patch)
treee38ac0485531cdd93d5a330d13e1d666021ce09d
parentcada12ebaf09ed764ca9762949cd05c42f162d23 (diff)
Add Handler for PolyLine Write
The handler separates MetaPolyLineAction::Write from metaact.hxx Write implementation is now in SvmWriter.hxx Change-Id: I62a3d6d70b33966f0096260aa01f3790a3e87e55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119737 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--include/vcl/filter/SvmWriter.hxx1
-rw-r--r--vcl/source/filter/svm/SvmWriter.cxx25
2 files changed, 26 insertions, 0 deletions
diff --git a/include/vcl/filter/SvmWriter.hxx b/include/vcl/filter/SvmWriter.hxx
index cc7d07295643..891c3853e1ba 100644
--- a/include/vcl/filter/SvmWriter.hxx
+++ b/include/vcl/filter/SvmWriter.hxx
@@ -48,4 +48,5 @@ public:
void ArcHandler(MetaArcAction* pAction);
void PieHandler(MetaPieAction* pAction);
void ChordHandler(MetaChordAction* pAction);
+ void PolyLineHandler(MetaPolyLineAction* pAction);
}; \ No newline at end of file
diff --git a/vcl/source/filter/svm/SvmWriter.cxx b/vcl/source/filter/svm/SvmWriter.cxx
index 6b5843369d36..eb64c40e7fdd 100644
--- a/vcl/source/filter/svm/SvmWriter.cxx
+++ b/vcl/source/filter/svm/SvmWriter.cxx
@@ -141,6 +141,13 @@ void SvmWriter::MetaActionHandler(MetaAction* pAction, ImplMetaWriteData* pData)
}
break;
+ case MetaActionType::POLYLINE:
+ {
+ auto* pMetaAction = static_cast<MetaPolyLineAction*>(pAction);
+ PolyLineHandler(pMetaAction);
+ }
+ break;
+
/* default case prevents test failure and will be
removed once all the handlers are completed */
default:
@@ -244,4 +251,22 @@ void SvmWriter::ChordHandler(MetaChordAction* pAction)
aSerializer.writePoint(pAction->GetStartPoint());
aSerializer.writePoint(pAction->GetEndPoint());
}
+
+void SvmWriter::PolyLineHandler(MetaPolyLineAction* pAction)
+{
+ mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
+
+ VersionCompatWrite aCompat(mrStream, 3);
+
+ tools::Polygon aSimplePoly;
+ pAction->GetPolygon().AdaptiveSubdivide(aSimplePoly);
+
+ WritePolygon(mrStream, aSimplePoly); // Version 1
+ WriteLineInfo(mrStream, pAction->GetLineInfo()); // Version 2
+
+ bool bHasPolyFlags = pAction->GetPolygon().HasFlags(); // Version 3
+ mrStream.WriteBool(bHasPolyFlags);
+ if (bHasPolyFlags)
+ pAction->GetPolygon().Write(mrStream);
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */