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

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


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

New commits:
commit 66ac7e94ea69cd62c256cae8d3ced82678ce6992
Author:     panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Thu Jul 8 13:06:06 2021 +0300
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Jul 9 11:48:58 2021 +0200

    Add Handler for MetaStretchText Read
    
    The handler separates the MetaStretchTextAction::Read from metaact.hxx
    Read implementation is now in SvmReader.hxx
    
    Change-Id: I3c8627aa51254e8fc12167d726066060d007ac26
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118636
    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 7baae24379b0..230a725c0ca9 100644
--- a/include/vcl/filter/SvmReader.hxx
+++ b/include/vcl/filter/SvmReader.hxx
@@ -53,6 +53,7 @@ public:
     rtl::Reference<MetaAction> PolyPolygonHandler();
     rtl::Reference<MetaAction> TextHandler(ImplMetaReadData* pData);
     rtl::Reference<MetaAction> TextArrayHandler(ImplMetaReadData* pData);
+    rtl::Reference<MetaAction> StretchTextHandler(ImplMetaReadData* pData);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index 28a5373329c6..19ed80859f33 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -606,6 +606,11 @@ public:
     sal_uInt32      GetWidth() const { return mnWidth; }
     sal_Int32       GetIndex() const { return mnIndex; }
     sal_Int32       GetLen() const { return mnLen; }
+    void            SetPoint(Point& rPt) { maPt = rPt; }
+    void            SetText(OUString& rStr) { maStr = rStr; }
+    void            SetWidth(sal_uInt32 rWidth) { mnWidth = rWidth; }
+    void            SetIndex(sal_uInt32 rIndex) { mnIndex = rIndex; }
+    void            SetLen(sal_uInt32 rLen) { mnLen = rLen; }
 };
 
 class SAL_DLLPUBLIC_RTTI MetaTextRectAction final : public MetaAction
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx
index 74919c3b17d1..cea3409df856 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -201,7 +201,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData)
             return TextArrayHandler(pData);
             break;
         case MetaActionType::STRETCHTEXT:
-            pAction = new MetaStretchTextAction;
+            return StretchTextHandler(pData);
             break;
         case MetaActionType::TEXTRECT:
             pAction = new MetaTextRectAction;
@@ -745,4 +745,35 @@ rtl::Reference<MetaAction> SvmReader::TextArrayHandler(ImplMetaReadData* pData)
     pAction->SetDXArray(aArray.get());
     return pAction;
 }
+
+rtl::Reference<MetaAction> SvmReader::StretchTextHandler(ImplMetaReadData* pData)
+{
+    auto pAction = new MetaStretchTextAction();
+
+    VersionCompatRead aCompat(mrStream);
+    TypeSerializer aSerializer(mrStream);
+
+    Point aPoint;
+    aSerializer.readPoint(aPoint);
+    OUString aStr;
+    aStr = mrStream.ReadUniOrByteString(pData->meActualCharSet);
+    sal_uInt32 nTmpWidth;
+    mrStream.ReadUInt32(nTmpWidth);
+    sal_uInt16 nTmpIndex(0);
+    mrStream.ReadUInt16(nTmpIndex);
+    sal_uInt16 nTmpLen(0);
+    mrStream.ReadUInt16(nTmpLen);
+
+    pAction->SetPoint(aPoint);
+    pAction->SetWidth(nTmpWidth);
+    pAction->SetIndex(nTmpIndex);
+    pAction->SetLen(nTmpLen);
+
+    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