[Libreoffice-commits] core.git: include/vcl vcl/source

panoskorovesis (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 9 09:50:05 UTC 2021


 include/vcl/filter/SvmReader.hxx    |    1 +
 include/vcl/metaact.hxx             |    3 +++
 vcl/source/filter/svm/SvmReader.cxx |   27 ++++++++++++++++++++++++++-
 3 files changed, 30 insertions(+), 1 deletion(-)

New commits:
commit c46aba4341744ce7b0bf91ba86805687898c21a4
Author:     panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Thu Jul 8 13:35:24 2021 +0300
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Jul 9 11:49:32 2021 +0200

    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 at gmail.com>

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: */


More information about the Libreoffice-commits mailing list