summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpanoskorovesis <panoskorovesis@outlook.com>2021-07-09 13:28:47 +0300
committerpanoskorovesis <panoskorovesis@outlook.com>2021-07-09 13:28:47 +0300
commit8c0f4a9befc322ae2854377540220c1dd8eaef54 (patch)
tree1d3eca87d82e5f1e6c507f8c41634e5b8d08e47c
parenta59e3e78193c7d82d6c9fe98ffbd0bcc65b4ba73 (diff)
Add Handler for Bmp Read
The handler separates MetaBmpAction::Read from metaact.hxx Read implementation is now in SvmReader.hxx Change-Id: I60b9c2fbe9c5e23e0f1a05c4aa96565e3d14c403
-rw-r--r--include/vcl/filter/SvmReader.hxx1
-rw-r--r--include/vcl/metaact.hxx2
-rw-r--r--vcl/source/filter/svm/SvmReader.cxx20
3 files changed, 22 insertions, 1 deletions
diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx
index fd8d81ce7295..c34c7db1df4e 100644
--- a/include/vcl/filter/SvmReader.hxx
+++ b/include/vcl/filter/SvmReader.hxx
@@ -56,6 +56,7 @@ public:
rtl::Reference<MetaAction> StretchTextHandler(ImplMetaReadData* pData);
rtl::Reference<MetaAction> TextRectHandler(ImplMetaReadData* pData);
rtl::Reference<MetaAction> TextLineHandler();
+ rtl::Reference<MetaAction> BmpHandler();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index 731e901bd622..464f2b32777e 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -720,6 +720,8 @@ public:
const Bitmap& GetBitmap() const { return maBmp; }
const Point& GetPoint() const { return maPt; }
+ void SetBitmap(Bitmap& rBmp) { maBmp = rBmp; }
+ void SetPoint(Point& rPt) { maPt = rPt; }
};
class VCL_DLLPUBLIC MetaBmpScaleAction final : public MetaAction
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx
index 43cd2e0e354a..8f2c503ffc7b 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -21,6 +21,7 @@
#include <sal/log.hxx>
#include <tools/stream.hxx>
#include <tools/vcompat.hxx>
+#include <vcl/dibtools.hxx>
#include <vcl/TypeSerializer.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/metaact.hxx>
@@ -210,7 +211,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData)
return TextLineHandler();
break;
case MetaActionType::BMP:
- pAction = new MetaBmpAction;
+ return BmpHandler();
break;
case MetaActionType::BMPSCALE:
pAction = new MetaBmpScaleAction;
@@ -834,4 +835,21 @@ rtl::Reference<MetaAction> SvmReader::TextLineHandler()
return pAction;
}
+
+rtl::Reference<MetaAction> SvmReader::BmpHandler()
+{
+ auto pAction = new MetaBmpAction();
+
+ VersionCompatRead aCompat(mrStream);
+ Bitmap aBmp;
+ ReadDIB(aBmp, mrStream, true);
+ TypeSerializer aSerializer(mrStream);
+ Point aPoint;
+ aSerializer.readPoint(aPoint);
+
+ pAction->SetBitmap(aBmp);
+ pAction->SetPoint(aPoint);
+
+ return pAction;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */