[Libreoffice-commits] core.git: include/vcl vcl/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 18 11:18:54 UTC 2021


 include/vcl/toolkit/fixed.hxx |    2 ++
 vcl/source/control/fixed.cxx  |   20 ++++++++++++++++++++
 2 files changed, 22 insertions(+)

New commits:
commit f926356e1f48a461eb3157c1020de0bd48f76080
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Jul 15 09:44:54 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Aug 18 13:18:18 2021 +0200

    jsdialog: dump FixedImage
    
    Change-Id: I9803558fa19ef5e508817d5db0bdeb54827f63d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118969
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120629
    Tested-by: Jenkins

diff --git a/include/vcl/toolkit/fixed.hxx b/include/vcl/toolkit/fixed.hxx
index 8d82039f1f56..5e0cc38f5dba 100644
--- a/include/vcl/toolkit/fixed.hxx
+++ b/include/vcl/toolkit/fixed.hxx
@@ -173,6 +173,8 @@ public:
     virtual bool    set_property(const OString &rKey, const OUString &rValue) override;
 
     static Image loadThemeImage(const OUString &rFileName);
+
+    void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index b40e82048aae..6be690d5c5ae 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -17,14 +17,17 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <vcl/cvtgrf.hxx>
 #include <vcl/decoview.hxx>
 #include <vcl/event.hxx>
 #include <vcl/toolkit/fixed.hxx>
 #include <vcl/settings.hxx>
 
+#include <comphelper/base64.hxx>
 #include <comphelper/string.hxx>
 #include <sal/log.hxx>
 #include <tools/json_writer.hxx>
+#include <tools/stream.hxx>
 
 #define FIXEDLINE_TEXT_BORDER    4
 
@@ -963,4 +966,21 @@ bool FixedImage::set_property(const OString &rKey, const OUString &rValue)
     return true;
 }
 
+void FixedImage::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
+{
+    rJsonWriter.put("type", "image");
+    if (!!maImage)
+    {
+        SvMemoryStream aOStm(6535, 6535);
+        if(GraphicConverter::Export(aOStm, maImage.GetBitmapEx(), 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);
+            rJsonWriter.put("image", aBuffer.makeStringAndClear());
+        }
+    }
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list