diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-07-15 09:44:54 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-10-29 10:22:39 +0200 |
commit | e0f594e96ea0b3b9a81dfbd21f80d03ae5c94805 (patch) | |
tree | f7bf68235f2dbf978261d1e464a371c69774fe07 /vcl | |
parent | 232e9bf2aa0221e0aa0bbcb9fd7018bfc3d40db0 (diff) |
jsdialog: dump FixedImage
Change-Id: I9803558fa19ef5e508817d5db0bdeb54827f63d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118969
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124222
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/fixed.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
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: */ |