include/vcl/toolkit/fixed.hxx | 2 ++ vcl/source/control/fixed.cxx | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+)
New commits: commit f926356e1f48a461eb3157c1020de0bd48f76080 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Jul 15 09:44:54 2021 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Wed Aug 18 13:18:18 2021 +0200 jsdialog: dump FixedImage Change-Id: I9803558fa19ef5e508817d5db0bdeb54827f63d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118969 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120629 Tested-by: Jenkins diff --git a/include/vcl/toolkit/fixed.hxx b/include/vcl/toolkit/fixed.hxx index 8d82039f1f56..5e0cc38f5dba 100644 --- a/include/vcl/toolkit/fixed.hxx +++ b/include/vcl/toolkit/fixed.hxx @@ -173,6 +173,8 @@ public: virtual bool set_property(const OString &rKey, const OUString &rValue) override; static Image loadThemeImage(const OUString &rFileName); + + void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index b40e82048aae..6be690d5c5ae 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -17,14 +17,17 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <vcl/cvtgrf.hxx> #include <vcl/decoview.hxx> #include <vcl/event.hxx> #include <vcl/toolkit/fixed.hxx> #include <vcl/settings.hxx> +#include <comphelper/base64.hxx> #include <comphelper/string.hxx> #include <sal/log.hxx> #include <tools/json_writer.hxx> +#include <tools/stream.hxx> #define FIXEDLINE_TEXT_BORDER 4 @@ -963,4 +966,21 @@ bool FixedImage::set_property(const OString &rKey, const OUString &rValue) return true; } +void FixedImage::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) +{ + rJsonWriter.put("type", "image"); + if (!!maImage) + { + SvMemoryStream aOStm(6535, 6535); + if(GraphicConverter::Export(aOStm, maImage.GetBitmapEx(), ConvertDataFormat::PNG) == ERRCODE_NONE) + { + css::uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aOStm.GetData()), aOStm.Tell()); + OUStringBuffer aBuffer("data:image/png;base64,"); + ::comphelper::Base64::encode(aBuffer, aSeq); + rJsonWriter.put("image", aBuffer.makeStringAndClear()); + } + } +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */