include/vcl/fixed.hxx | 2 ++ vcl/source/control/fixed.cxx | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+)
New commits: commit 867a720a5667f5bedc7bae88da46e78ac40edc41 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: Thu Jul 15 12:44:03 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> diff --git a/include/vcl/fixed.hxx b/include/vcl/fixed.hxx index ee52c7c400d9..c7af3c0325bf 100644 --- a/include/vcl/fixed.hxx +++ b/include/vcl/fixed.hxx @@ -106,6 +106,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; }; #endif // INCLUDED_VCL_FIXED_HXX diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index fbeddc78188b..dae7699d350f 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -17,15 +17,18 @@ * 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 <controldata.hxx> #include <tools/json_writer.hxx> +#include <tools/stream.hxx> #define FIXEDLINE_TEXT_BORDER 4 @@ -973,4 +976,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: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits