diff options
author | panoskorovesis <panoskorovesis@outlook.com> | 2021-07-08 09:42:43 +0300 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-07-09 11:45:35 +0200 |
commit | e9d92a40bd59954d6716e889f4925319f4ab322e (patch) | |
tree | 24c4d41ae5a3188001b5d0047b4ae9d33e60d92c | |
parent | 7699d89a5e8a442a77504260d70048392110b232 (diff) |
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 <quikee@gmail.com>
-rw-r--r-- | include/vcl/filter/SvmReader.hxx | 1 | ||||
-rw-r--r-- | include/vcl/metaact.hxx | 1 | ||||
-rw-r--r-- | vcl/source/filter/svm/SvmReader.cxx | 24 |
3 files changed, 25 insertions, 1 deletions
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: */ |