diff options
author | panoskorovesis <panoskorovesis@outlook.com> | 2021-07-08 13:35:24 +0300 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-07-09 11:49:32 +0200 |
commit | c46aba4341744ce7b0bf91ba86805687898c21a4 (patch) | |
tree | 067fecef32ae01fc35c0c68bdba1b0832148bc34 | |
parent | 66ac7e94ea69cd62c256cae8d3ced82678ce6992 (diff) |
Add Handler for MetaTextRect Read
The handler separates MetaTextAction::Read from metaact.hxx
Read implementation is now in SvmReader.hxx
Change-Id: Ifa77ced87362204f946b36f95aebd3f72705ed5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118637
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 | 3 | ||||
-rw-r--r-- | vcl/source/filter/svm/SvmReader.cxx | 27 |
3 files changed, 30 insertions, 1 deletions
diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx index 230a725c0ca9..ab9654ea8d9a 100644 --- a/include/vcl/filter/SvmReader.hxx +++ b/include/vcl/filter/SvmReader.hxx @@ -54,6 +54,7 @@ public: rtl::Reference<MetaAction> TextHandler(ImplMetaReadData* pData); rtl::Reference<MetaAction> TextArrayHandler(ImplMetaReadData* pData); rtl::Reference<MetaAction> StretchTextHandler(ImplMetaReadData* pData); + rtl::Reference<MetaAction> TextRectHandler(ImplMetaReadData* pData); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx index 19ed80859f33..b6509c12aaf8 100644 --- a/include/vcl/metaact.hxx +++ b/include/vcl/metaact.hxx @@ -644,6 +644,9 @@ public: const tools::Rectangle& GetRect() const { return maRect; } const OUString& GetText() const { return maStr; } DrawTextFlags GetStyle() const { return mnStyle; } + void SetRect(tools::Rectangle& rRect) { maRect = rRect; } + void SetText(OUString& rStr) { maStr = rStr; } + void SetStyle(DrawTextFlags rStyle) { mnStyle = rStyle; } }; class SAL_DLLPUBLIC_RTTI MetaTextLineAction final : public MetaAction diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx index cea3409df856..1cfb6cd4ab75 100644 --- a/vcl/source/filter/svm/SvmReader.cxx +++ b/vcl/source/filter/svm/SvmReader.cxx @@ -204,7 +204,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData) return StretchTextHandler(pData); break; case MetaActionType::TEXTRECT: - pAction = new MetaTextRectAction; + return TextRectHandler(pData); break; case MetaActionType::TEXTLINE: pAction = new MetaTextLineAction; @@ -776,4 +776,29 @@ rtl::Reference<MetaAction> SvmReader::StretchTextHandler(ImplMetaReadData* pData return pAction; } + +rtl::Reference<MetaAction> SvmReader::TextRectHandler(ImplMetaReadData* pData) +{ + auto pAction = new MetaTextRectAction(); + + VersionCompatRead aCompat(mrStream); + TypeSerializer aSerializer(mrStream); + + tools::Rectangle aRect; + aSerializer.readRectangle(aRect); + OUString aStr; + aStr = mrStream.ReadUniOrByteString(pData->meActualCharSet); + sal_uInt16 nTmp; + mrStream.ReadUInt16(nTmp); + + pAction->SetRect(aRect); + pAction->SetStyle(static_cast<DrawTextFlags>(nTmp)); + + 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: */ |