From 01e37e3e5626551b6e8d261e357afcea1ba7c758 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 22 Jun 2020 16:45:03 +0200 Subject: use tools::JsonWriter for dumping property tree Change-Id: I8f55af19ba10b71bd621e69b27000ab7cb565309 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96677 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/source/window/layout.cxx | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'vcl/source/window/layout.cxx') diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index af7208c52cb8..f09563fddaad 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -27,6 +27,7 @@ #include #include #include +#include VclContainer::VclContainer(vcl::Window *pParent, WinBits nStyle) : Window(WindowType::CONTAINER) @@ -360,11 +361,10 @@ bool VclBox::set_property(const OString &rKey, const OUString &rValue) return true; } -boost::property_tree::ptree VclBox::DumpAsPropertyTree() +void VclBox::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) { - boost::property_tree::ptree aTree(VclContainer::DumpAsPropertyTree()); - aTree.put("vertical", m_bVerticalContainer); - return aTree; + VclContainer::DumpAsPropertyTree(rJsonWriter); + rJsonWriter.put("vertical", m_bVerticalContainer); } sal_uInt16 VclBox::getDefaultAccessibleRole() const @@ -1308,11 +1308,10 @@ void VclGrid::setAllocation(const Size& rAllocation) } } -boost::property_tree::ptree VclGrid::DumpAsPropertyTree() +void VclGrid::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) { - boost::property_tree::ptree aTree(VclContainer::DumpAsPropertyTree()); - aTree.put("type", "grid"); - return aTree; + VclContainer::DumpAsPropertyTree(rJsonWriter); + rJsonWriter.put("type", "grid"); } bool toBool(const OUString &rValue) @@ -1493,11 +1492,10 @@ OUString VclFrame::getDefaultAccessibleName() const return VclBin::getDefaultAccessibleName(); } -boost::property_tree::ptree VclFrame::DumpAsPropertyTree() +void VclFrame::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) { - boost::property_tree::ptree aTree(VclBin::DumpAsPropertyTree()); - aTree.put("type", "frame"); - return aTree; + VclBin::DumpAsPropertyTree(rJsonWriter); + rJsonWriter.put("type", "frame"); } Size VclAlignment::calculateRequisition() const @@ -2855,25 +2853,24 @@ VclScrolledWindow::~VclScrolledWindow() disposeOnce(); } -boost::property_tree::ptree VclDrawingArea::DumpAsPropertyTree() +void VclDrawingArea::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) { - boost::property_tree::ptree aTree(Control::DumpAsPropertyTree()); - aTree.put("type", "drawingarea"); + Control::DumpAsPropertyTree(rJsonWriter); + rJsonWriter.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()); + rJsonWriter.put("image", aBuffer.makeStringAndClear()); } - return aTree; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.1