diff options
author | panoskorovesis <panoskorovesis@outlook.com> | 2021-07-15 12:23:31 +0300 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-07-27 08:07:46 +0200 |
commit | 913cb8b32eb5346699770d52d288e02cc090011e (patch) | |
tree | 6b228897a4b874f819e5a1273f348269cba7930d /vcl | |
parent | 96294b206f02c9856dbcb8a21a0b20ce1180dd8c (diff) |
Add Handler for Comment Read
The handler separates MetaCommentAction::Read from metaact.hxx
Read implementation is now in SvmReader.hxx
Change-Id: Ic37db0ecb30482b3503ede88cd9d72de2ed0efde
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119194
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/svm/SvmReader.cxx | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx index 675bba95f7da..587b31809c7d 100644 --- a/vcl/source/filter/svm/SvmReader.cxx +++ b/vcl/source/filter/svm/SvmReader.cxx @@ -311,7 +311,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData) return RefPointHandler(); break; case MetaActionType::COMMENT: - pAction = new MetaCommentAction; + return CommentHandler(); break; case MetaActionType::LAYOUTMODE: pAction = new MetaLayoutModeAction; @@ -1377,4 +1377,41 @@ rtl::Reference<MetaAction> SvmReader::RefPointHandler() return pAction; } + +rtl::Reference<MetaAction> SvmReader::CommentHandler() +{ + auto pAction = new MetaCommentAction(); + + VersionCompatRead aCompat(mrStream); + OString aComment; + aComment = read_uInt16_lenPrefixed_uInt8s_ToOString(mrStream); + sal_Int32 nValue; + sal_uInt32 nDataSize; + mrStream.ReadInt32(nValue).ReadUInt32(nDataSize); + + if (nDataSize > mrStream.remainingSize()) + { + SAL_WARN("vcl.gdi", "Parsing error: " << mrStream.remainingSize() << " available data, but " + << nDataSize << " claimed, truncating"); + nDataSize = mrStream.remainingSize(); + } + + SAL_INFO("vcl.gdi", "MetaCommentAction::Read " << aComment); + + std::unique_ptr<sal_uInt8[]> pData; + pData.reset(); + + if (nDataSize) + { + pData.reset(new sal_uInt8[nDataSize]); + mrStream.ReadBytes(pData.get(), nDataSize); + } + + pAction->SetComment(aComment); + pAction->SetDataSize(nDataSize); + pAction->SetValue(nValue); + pAction->SetData(pData.get(), nDataSize); + + return pAction; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |