[Libreoffice-commits] core.git: include/vcl vcl/source
panoskorovesis (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 8 06:59:46 UTC 2021
include/vcl/filter/SvmReader.hxx | 1 +
include/vcl/metaact.hxx | 2 ++
vcl/source/filter/svm/SvmReader.cxx | 31 ++++++++++++++++++++++++++++++-
3 files changed, 33 insertions(+), 1 deletion(-)
New commits:
commit 8f962ddc45ca4f6825b41f2786f9fd219b4c1586
Author: panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Wed Jul 7 15:45:12 2021 +0300
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Jul 8 08:58:57 2021 +0200
Add handler for MetaPolyLine Read
The handler separates the MetaPolyLine::Read from metaact.hxx
Read implementation is now in SvmReader.hxx
Change-Id: Ic800b13cdca5bc6ffc00f1564e5a05303c445c5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118566
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
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: */
More information about the Libreoffice-commits
mailing list