diff options
author | panoskorovesis <panoskorovesis@outlook.com> | 2021-07-08 12:31:33 +0300 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-07-09 11:47:22 +0200 |
commit | 1d873936b48c2f672a12b8a380860d691937b8b3 (patch) | |
tree | 4715d456cb13fa6e7d584a4ef782e657deb47ff9 | |
parent | 6cd8eeb66443dda80cf88205f33f184314d85c49 (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
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118610
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 | 4 | ||||
-rw-r--r-- | vcl/source/filter/svm/SvmReader.cxx | 30 |
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: */ |