include/vcl/fixed.hxx | 2 ++ vcl/source/control/fixed.cxx | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+)
New commits: commit e0f594e96ea0b3b9a81dfbd21f80d03ae5c94805 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: Fri Oct 29 10:22:39 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/+/124222 diff --git a/include/vcl/fixed.hxx b/include/vcl/fixed.hxx index 00ae91c7624a..2a83c2488c89 100644 --- a/include/vcl/fixed.hxx +++ b/include/vcl/fixed.hxx @@ -177,6 +177,8 @@ public: virtual bool set_property(const OString &rKey, const OUString &rValue) override; static Image loadThemeImage(const OUString &rFileName); + + boost::property_tree::ptree DumpAsPropertyTree() override; }; #endif // INCLUDED_VCL_FIXED_HXX diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index c5eb075a8e0d..6bf24d6fc8bc 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/fixed.hxx> #include <vcl/settings.hxx> +#include <comphelper/base64.hxx> #include <comphelper/string.hxx> #include <sal/log.hxx> #include <controldata.hxx> #include <boost/property_tree/ptree.hpp> +#include <tools/stream.hxx> #define FIXEDLINE_TEXT_BORDER 4 @@ -970,4 +973,26 @@ bool FixedImage::set_property(const OString &rKey, const OUString &rValue) return true; } +boost::property_tree::ptree FixedImage::DumpAsPropertyTree() +{ + boost::property_tree::ptree aTree = Control::DumpAsPropertyTree(); + + aTree.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); + aTree.put("image", aBuffer.makeStringAndClear()); + } + } + + return aTree; +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */