include/vcl/layout.hxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
New commits: commit 3dcf7a3d221290b290aca4a7f4cb691322873fb6 Author: Szymon Kłos <[email protected]> AuthorDate: Tue Jun 16 08:07:04 2020 +0200 Commit: Szymon Kłos <[email protected]> CommitDate: Wed Jun 24 11:38:38 2020 +0200 jsdialog: generate JSON for drawing area Change-Id: Ic9402f0f7c891868790b657cd7e9860e46f3e8e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96852 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96985 Tested-by: Jenkins diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index 67e856fabdca..1081415fc4cf 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -22,7 +22,12 @@ #include <vcl/vclptr.hxx> #include <vcl/IContext.hxx> #include <vcl/commandevent.hxx> +#include <tools/stream.hxx> +#include <vcl/cvtgrf.hxx> +#include <comphelper/base64.hxx> +#include <vcl/virdev.hxx> #include <set> +#include <boost/property_tree/json_parser.hpp> class ScrollBar; class ScrollBar; @@ -802,6 +807,26 @@ public: m_xTransferHelper = rHelper; m_nDragAction = eDNDConstants; } + boost::property_tree::ptree DumpAsPropertyTree() override + { + 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; + } }; //Get first window of a pTopLevel window as _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
