summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpanoskorovesis <panoskorovesis@outlook.com>2021-07-08 12:31:33 +0300
committerpanoskorovesis <panoskorovesis@outlook.com>2021-07-08 12:31:33 +0300
commit781c04a264818f803d1fc7ade3518227637fa2c1 (patch)
tree5e76ba058412d495332ef91d7c5bb0413c60fc87
parentc11866c7667122dd21d4c5dd76d207e3a9ed3fc5 (diff)
Add Handler for MetaText Read
The handler separates the MetaTextAction::Read from metaact.hxx Read implementation is now in SvmReader.hxx Change-Id: Ic0692799bc89b226dc8d1d8f4f97155e421ab40e
-rw-r--r--include/vcl/filter/SvmReader.hxx1
-rw-r--r--include/vcl/metaact.hxx4
-rw-r--r--vcl/source/filter/svm/SvmReader.cxx30
3 files changed, 34 insertions, 1 deletions
diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx
index 0259dd03503c..ea3d9a31fd63 100644
--- a/include/vcl/filter/SvmReader.hxx
+++ b/include/vcl/filter/SvmReader.hxx
@@ -51,6 +51,7 @@ public:
rtl::Reference<MetaAction> PolyLineHandler();
rtl::Reference<MetaAction> PolygonHandler();
rtl::Reference<MetaAction> PolyPolygonHandler();
+ rtl::Reference<MetaAction> TextHandler(ImplMetaReadData* pData);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index aca0c4e2c493..96c15ff23213 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -522,6 +522,10 @@ public:
const OUString& GetText() const { return maStr; }
sal_Int32 GetIndex() const { return mnIndex; }
sal_Int32 GetLen() const { return mnLen; }
+ void SetPoint(Point& rPt) { maPt = rPt; }
+ void SetText(OUString& rStr) { maStr = rStr; }
+ void SetIndex(sal_Int32 rIndex) { mnIndex = rIndex; }
+ void SetLen(sal_Int32 rLen) { mnLen = rLen; }
};
class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaTextArrayAction final : public MetaAction
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx
index ffd17c5761ee..6fbd043d9ad1 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -195,7 +195,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData)
return PolyPolygonHandler();
break;
case MetaActionType::TEXT:
- pAction = new MetaTextAction;
+ return TextHandler(pData);
break;
case MetaActionType::TEXTARRAY:
pAction = new MetaTextArrayAction;
@@ -638,4 +638,32 @@ rtl::Reference<MetaAction> SvmReader::PolyPolygonHandler()
return pAction;
}
+
+rtl::Reference<MetaAction> SvmReader::TextHandler(ImplMetaReadData* pData)
+{
+ auto pAction = new MetaTextAction();
+
+ VersionCompatRead aCompat(mrStream);
+ TypeSerializer aSerializer(mrStream);
+
+ Point aPoint;
+ aSerializer.readPoint(aPoint);
+ OUString aStr;
+ aStr = mrStream.ReadUniOrByteString(pData->meActualCharSet);
+ sal_uInt16 nTmpIndex(0);
+ mrStream.ReadUInt16(nTmpIndex);
+ sal_uInt16 nTmpLen(0);
+ mrStream.ReadUInt16(nTmpLen);
+
+ pAction->SetPoint(aPoint);
+ pAction->SetIndex(nTmpIndex);
+ pAction->SetLen(nTmpLen);
+
+ if (aCompat.GetVersion() >= 2) // Version 2
+ aStr = read_uInt16_lenPrefixed_uInt16s_ToOUString(mrStream);
+
+ pAction->SetText(aStr);
+
+ return pAction;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */