include/vcl/filter/SvmReader.hxx | 1 + include/vcl/metaact.hxx | 1 + vcl/source/filter/svm/SvmReader.cxx | 24 +++++++++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-)
New commits: commit e9d92a40bd59954d6716e889f4925319f4ab322e Author: panoskorovesis <panoskorove...@outlook.com> AuthorDate: Thu Jul 8 09:42:43 2021 +0300 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Fri Jul 9 11:45:35 2021 +0200 Add Handler for MetaPolygon Read The handler separates the MetaPolygonAction::Read from metaact.hxx Read implementation is now in SvmReader.hxx Change-Id: I2b186acba2ca485b664568c155268cb3921a6a4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118598 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx index f5da5b6e9f5c..57e97a923df4 100644 --- a/include/vcl/filter/SvmReader.hxx +++ b/include/vcl/filter/SvmReader.hxx @@ -49,6 +49,7 @@ public: rtl::Reference<MetaAction> PieHandler(); rtl::Reference<MetaAction> ChordHandler(); rtl::Reference<MetaAction> PolyLineHandler(); + rtl::Reference<MetaAction> PolygonHandler(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx index 4578c791d61e..94d45ee0365f 100644 --- a/include/vcl/metaact.hxx +++ b/include/vcl/metaact.hxx @@ -457,6 +457,7 @@ public: virtual void Scale( double fScaleX, double fScaleY ) override; const tools::Polygon& GetPolygon() const { return maPoly; } + void SetPolygon(tools::Polygon& rPoly) { maPoly = rPoly; } }; class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaPolyPolygonAction final : public MetaAction diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx index 5406e786dfaf..4e4242665c6e 100644 --- a/vcl/source/filter/svm/SvmReader.cxx +++ b/vcl/source/filter/svm/SvmReader.cxx @@ -189,7 +189,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData) return PolyLineHandler(); break; case MetaActionType::POLYGON: - pAction = new MetaPolygonAction; + return PolygonHandler(); break; case MetaActionType::POLYPOLYGON: pAction = new MetaPolyPolygonAction; @@ -570,4 +570,26 @@ rtl::Reference<MetaAction> SvmReader::PolyLineHandler() return pAction; } + +rtl::Reference<MetaAction> SvmReader::PolygonHandler() +{ + auto pAction = new MetaPolygonAction(); + + VersionCompatRead aCompat(mrStream); + + tools::Polygon aPolygon; + ReadPolygon(mrStream, aPolygon); // Version 1 + + if (aCompat.GetVersion() >= 2) // Version 2 + { + sal_uInt8 bHasPolyFlags(0); + mrStream.ReadUChar(bHasPolyFlags); + if (bHasPolyFlags) + aPolygon.Read(mrStream); + } + + pAction->SetPolygon(aPolygon); + + return pAction; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits