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

panoskorovesis (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 5 06:56:17 UTC 2021


 include/vcl/filter/SvmReader.hxx    |    4 ++++
 include/vcl/metaact.hxx             |    2 ++
 vcl/source/filter/svm/SvmReader.cxx |   24 +++++++++++++++++++++++-
 3 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 0779fd344afee8c8ea182e3f97c971663bef3632
Author:     panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Thu Jul 1 13:07:58 2021 +0300
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Jul 5 08:55:46 2021 +0200

    Add Handler for MetaLineColor Read
    
    The handler seperates the read method from MetaAct.hxx
    Required set methods are added.
    
    Change-Id: I070af28711c111d60b3af3ae23fd8d6e93429cf7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118217
    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 229fb3ca1d36..0c2b01d79ee1 100644
--- a/include/vcl/filter/SvmReader.hxx
+++ b/include/vcl/filter/SvmReader.hxx
@@ -29,11 +29,15 @@ class VCL_DLLPUBLIC SvmReader
 private:
     SvStream& mrStream;
 
+protected:
+    void ReadColor(::Color& rColor);
+
 public:
     SvmReader(SvStream& rIStm);
 
     SvStream& Read(GDIMetaFile& rMetaFile, ImplMetaReadData* pData = nullptr);
     rtl::Reference<MetaAction> MetaActionHandler(ImplMetaReadData* pData);
+    rtl::Reference<MetaAction> LineColorHandler();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index c37b7ab98aa2..1829340e63db 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -1223,6 +1223,8 @@ public:
 
     const Color&        GetColor() const { return maColor; }
     bool                IsSetting() const { return mbSet; }
+    void                SetColor(Color& rColor) { maColor = rColor; }
+    void                SetSetting(bool rSet) { mbSet = rSet; }
 };
 
 class VCL_DLLPUBLIC MetaFillColorAction final : public MetaAction
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx
index e8455ea4de33..a8b55b3eab46 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -261,7 +261,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData)
             pAction = new MetaMoveClipRegionAction;
             break;
         case MetaActionType::LINECOLOR:
-            pAction = new MetaLineColorAction;
+            return LineColorHandler();
             break;
         case MetaActionType::FILLCOLOR:
             pAction = new MetaFillColorAction;
@@ -331,4 +331,26 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData)
     return pAction;
 }
 
+void SvmReader::ReadColor(Color& rColor)
+{
+    sal_uInt32 nTmp;
+    mrStream.ReadUInt32(nTmp);
+    rColor = ::Color(ColorTransparency, nTmp);
+}
+
+rtl::Reference<MetaAction> SvmReader::LineColorHandler()
+{
+    auto pAction = new MetaLineColorAction();
+
+    VersionCompatRead aCompat(mrStream);
+    Color aColor;
+    ReadColor(aColor);
+    bool aBool;
+    mrStream.ReadCharAsBool(aBool);
+
+    pAction->SetSetting(aBool);
+    pAction->SetColor(aColor);
+
+    return pAction;
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list