diff options
-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 | 39 |
3 files changed, 43 insertions, 1 deletions
diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx index 3ef53c4a7962..f075e2899f6f 100644 --- a/include/vcl/filter/SvmReader.hxx +++ b/include/vcl/filter/SvmReader.hxx @@ -87,6 +87,7 @@ public: rtl::Reference<MetaAction> FloatTransparentHandler(ImplMetaReadData* pData); rtl::Reference<MetaAction> EPSHandler(); rtl::Reference<MetaAction> RefPointHandler(); + rtl::Reference<MetaAction> CommentHandler(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx index fe79942ac28e..be174299d1f1 100644 --- a/include/vcl/metaact.hxx +++ b/include/vcl/metaact.hxx @@ -1796,6 +1796,10 @@ public: sal_Int32 GetValue() const { return mnValue; } sal_uInt32 GetDataSize() const { return mnDataSize; } const sal_uInt8* GetData() const { return mpData.get(); } + void SetComment(const OString& rComment) { maComment = rComment; } + void SetValue(const sal_Int32 nValue) { mnValue = nValue; } + void SetDataSize(const sal_Int32 nDataSize) { mnDataSize = nDataSize; } + void SetData(const sal_uInt8* pData, const sal_uInt32 nDataSize) { ImplInitDynamicData(pData, nDataSize); } }; class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaLayoutModeAction final : public MetaAction 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: */ |