[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/vcl

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 23 04:16:28 UTC 2020


 include/vcl/layout.hxx |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

New commits:
commit 13bf45f1d3d0289efaf64b724a3c8e4e70cfeb7f
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jun 16 08:07:04 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jun 23 06:15:57 2020 +0200

    jsdialog: generate JSON for drawing area
    
    Change-Id: Ic9402f0f7c891868790b657cd7e9860e46f3e8e8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96852
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 57ca15260f05..48114541280e 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 VCL_DLLPUBLIC VclContainer : public vcl::Window,
                                    public vcl::IContext
@@ -786,6 +791,26 @@ public:
     {
         m_aQueryTooltipHdl = rLink;
     }
+    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


More information about the Libreoffice-commits mailing list