diff options
author | panoskorovesis <panoskorovesis@outlook.com> | 2021-07-07 15:45:12 +0300 |
---|---|---|
committer | panoskorovesis <panoskorovesis@outlook.com> | 2021-07-07 15:45:12 +0300 |
commit | 88ee421aec6d5fc550df41be3fb6227ead174f55 (patch) | |
tree | 3d031c6d80b95e1c4204a36f4819d576382eec15 | |
parent | 2b4ac4768bda750439165b73104242065a72b68f (diff) |
Add handler for MetaPolyLine Read
The handler separates the MetaPolyLine::Read from metaact.hxx
Read implementation is now in SvmReader.hxx
Change-Id: Ic800b13cdca5bc6ffc00f1564e5a05303c445c5f
-rw-r--r-- | include/vcl/filter/SvmReader.hxx | 1 | ||||
-rw-r--r-- | include/vcl/metaact.hxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/svm/SvmReader.cxx | 31 |
3 files changed, 33 insertions, 1 deletions
diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx index 3b64225f37eb..f5da5b6e9f5c 100644 --- a/include/vcl/filter/SvmReader.hxx +++ b/include/vcl/filter/SvmReader.hxx @@ -48,6 +48,7 @@ public: rtl::Reference<MetaAction> ArcHandler(); rtl::Reference<MetaAction> PieHandler(); rtl::Reference<MetaAction> ChordHandler(); + rtl::Reference<MetaAction> PolyLineHandler(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx index d8b1f31b6a28..4578c791d61e 100644 --- a/include/vcl/metaact.hxx +++ b/include/vcl/metaact.hxx @@ -427,6 +427,8 @@ public: const tools::Polygon& GetPolygon() const { return maPoly; } const LineInfo& GetLineInfo() const { return maLineInfo; } + void SetLineInfo(LineInfo& rLineInfo) { maLineInfo = rLineInfo; } + void SetPolygon(tools::Polygon& rPoly) { maPoly = rPoly; } }; class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaPolygonAction final : public MetaAction diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx index 50d2ed8a7415..5406e786dfaf 100644 --- a/vcl/source/filter/svm/SvmReader.cxx +++ b/vcl/source/filter/svm/SvmReader.cxx @@ -186,7 +186,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData) return ChordHandler(); break; case MetaActionType::POLYLINE: - pAction = new MetaPolyLineAction; + return PolyLineHandler(); break; case MetaActionType::POLYGON: pAction = new MetaPolygonAction; @@ -541,4 +541,33 @@ rtl::Reference<MetaAction> SvmReader::ChordHandler() return pAction; } + +rtl::Reference<MetaAction> SvmReader::PolyLineHandler() +{ + auto pAction = new MetaPolyLineAction(); + + VersionCompatRead aCompat(mrStream); + + // Version 1 + tools::Polygon aPolygon; + ReadPolygon(mrStream, aPolygon); + + // Version 2 + if (aCompat.GetVersion() >= 2) + { + LineInfo aLineInfo; + ReadLineInfo(mrStream, aLineInfo); + pAction->SetLineInfo(aLineInfo); + } + if (aCompat.GetVersion() >= 3) + { + sal_uInt8 bHasPolyFlags(0); + mrStream.ReadUChar(bHasPolyFlags); + if (bHasPolyFlags) + aPolygon.Read(mrStream); + } + pAction->SetPolygon(aPolygon); + + return pAction; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |