From 0e498d7862e07b9f665b796e1386737f1bdb9b29 Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Wed, 24 Jun 2020 12:08:12 +0200 Subject: Move DumpAsPropertyTree code to cxx file Change-Id: Ib450c860aa11f0e8be933de4c6e216ca9c0d0b5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97018 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/source/window/layout.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'vcl') diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 29c4cf0e7d41..af7208c52cb8 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -2855,4 +2855,25 @@ VclScrolledWindow::~VclScrolledWindow() disposeOnce(); } +boost::property_tree::ptree VclDrawingArea::DumpAsPropertyTree() +{ + boost::property_tree::ptree aTree(Control::DumpAsPropertyTree()); + aTree.put("type", "drawingarea"); + ScopedVclPtrInstance pDevice; + pDevice->SetOutputSize( GetSizePixel() ); + tools::Rectangle aRect(Point(0,0), GetSizePixel()); + Paint(*pDevice, aRect); + BitmapEx aImage = pDevice->GetBitmapEx( Point(0,0), GetSizePixel() ); + SvMemoryStream aOStm(65535, 65535); + + if(GraphicConverter::Export(aOStm, aImage, ConvertDataFormat::PNG) == ERRCODE_NONE) + { + css::uno::Sequence aSeq( static_cast(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: */ -- cgit