summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-06-24 12:08:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-06-24 17:47:28 +0200
commit0e498d7862e07b9f665b796e1386737f1bdb9b29 (patch)
treea095886d9964e33ee64321e2f815c810369f02ab /vcl
parent322b1250117f86cf7280caae751478ffefd02e3a (diff)
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/layout.cxx21
1 files changed, 21 insertions, 0 deletions
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<VirtualDevice> 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<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: */