[Libreoffice-commits] core.git: Branch 'feature/jsdialogs' - vcl/source
Szymon Kłos (via logerrit)
logerrit at kemper.freedesktop.org
Thu Sep 26 13:43:17 UTC 2019
vcl/source/window/toolbox2.cxx | 15 +++++++++++++++
1 file changed, 15 insertions(+)
New commits:
commit 59098f0893b2716f2939452efb27fea1fefa7497
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Sep 26 15:34:18 2019 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Sep 26 15:34:18 2019 +0200
jsdialogs: send images for toolbox items
Change-Id: I28a430271058290729cb254f2912341d32298590
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 4aecf7abfaa6..886f9a5a360e 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -35,6 +35,9 @@
#include <svdata.hxx>
#include <brdwin.hxx>
#include <toolbox.h>
+#include <tools/stream.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <comphelper/base64.hxx>
#include <unotools/confignode.hxx>
@@ -1778,6 +1781,18 @@ boost::property_tree::ptree ToolBox::DumpAsPropertyTree()
{
boost::property_tree::ptree aEntry;
int nId = GetItemId(i);
+
+ Image aImage = GetItemImage(nId);
+ SvMemoryStream aOStm(65535, 65535);
+
+ if(GraphicConverter::Export(aOStm, aImage.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);
+ aEntry.put("image", aBuffer.makeStringAndClear());
+ }
+
aEntry.put("type", "toolitem");
aEntry.put("text", GetItemText(nId));
aEntry.put("command", GetItemCommand(nId));
More information about the Libreoffice-commits
mailing list