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

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


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

New commits:
commit 31311b7df472903e2f16102663d5bad17d8371ca
Author:     panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Thu Jul 8 17:45:31 2021 +0300
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Jul 9 11:50:11 2021 +0200

    Add Handler for TextLine Read
    
    The handler separates MetaTextLineAction::Read from metaact.hxx
    Read implementation is now in SvmReader.hxx
    
    Change-Id: I360fb83b6b399905d8c08c8a7cd2bc587ae093ec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118653
    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 ab9654ea8d9a..fd8d81ce7295 100644
--- a/include/vcl/filter/SvmReader.hxx
+++ b/include/vcl/filter/SvmReader.hxx
@@ -55,6 +55,7 @@ public:
     rtl::Reference<MetaAction> TextArrayHandler(ImplMetaReadData* pData);
     rtl::Reference<MetaAction> StretchTextHandler(ImplMetaReadData* pData);
     rtl::Reference<MetaAction> TextRectHandler(ImplMetaReadData* pData);
+    rtl::Reference<MetaAction> TextLineHandler();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index b6509c12aaf8..731e901bd622 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -685,6 +685,11 @@ public:
     FontStrikeout       GetStrikeout() const { return meStrikeout; }
     FontLineStyle       GetUnderline() const { return meUnderline; }
     FontLineStyle       GetOverline()  const { return meOverline; }
+    void                SetStartPoint(Point& rPos) { maPos = rPos; }
+    void                SetWidth(tools::Long rWidth) { mnWidth = rWidth; }
+    void                SetStrikeout(FontStrikeout eStrikeout) { meStrikeout = eStrikeout; }
+    void                SetUnderline(FontLineStyle eUnderline) { meUnderline = eUnderline; }
+    void                SetOverline(FontLineStyle eOverline) { meOverline = eOverline; }
 };
 
 class VCL_DLLPUBLIC MetaBmpAction final : public MetaAction
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx
index 1cfb6cd4ab75..43cd2e0e354a 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -207,7 +207,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData)
             return TextRectHandler(pData);
             break;
         case MetaActionType::TEXTLINE:
-            pAction = new MetaTextLineAction;
+            return TextLineHandler();
             break;
         case MetaActionType::BMP:
             pAction = new MetaBmpAction;
@@ -801,4 +801,37 @@ rtl::Reference<MetaAction> SvmReader::TextRectHandler(ImplMetaReadData* pData)
 
     return pAction;
 }
+
+rtl::Reference<MetaAction> SvmReader::TextLineHandler()
+{
+    auto pAction = new MetaTextLineAction();
+
+    VersionCompatRead aCompat(mrStream);
+    TypeSerializer aSerializer(mrStream);
+
+    Point aPos;
+    aSerializer.readPoint(aPos);
+    sal_Int32 nTempWidth(0);
+    mrStream.ReadInt32(nTempWidth);
+
+    pAction->SetStartPoint(aPos);
+    pAction->SetWidth(nTempWidth);
+
+    sal_uInt32 nTempStrikeout(0);
+    mrStream.ReadUInt32(nTempStrikeout);
+    sal_uInt32 nTempUnderline(0);
+    mrStream.ReadUInt32(nTempUnderline);
+
+    pAction->SetStrikeout(static_cast<FontStrikeout>(nTempStrikeout));
+    pAction->SetUnderline(static_cast<FontLineStyle>(nTempUnderline));
+
+    if (aCompat.GetVersion() >= 2)
+    {
+        sal_uInt32 nTempOverline(0);
+        mrStream.ReadUInt32(nTempOverline);
+        pAction->SetOverline(static_cast<FontLineStyle>(nTempOverline));
+    }
+
+    return pAction;
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list