summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpanoskorovesis <panoskorovesis@outlook.com>2021-07-08 09:42:43 +0300
committerpanoskorovesis <panoskorovesis@outlook.com>2021-07-08 09:42:43 +0300
commit77255f4a9ef1f7c6baf4c17f0fc5d582d86db548 (patch)
tree148dcb1d3640556e7c0d830ef05e12b1fa0a7919
parent88ee421aec6d5fc550df41be3fb6227ead174f55 (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
-rw-r--r--include/vcl/filter/SvmReader.hxx1
-rw-r--r--include/vcl/metaact.hxx1
-rw-r--r--vcl/source/filter/svm/SvmReader.cxx24
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: */