[Libreoffice-commits] core.git: vcl/inc vcl/jsdialog vcl/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 28 07:16:05 UTC 2021
vcl/inc/jsdialog/jsdialogbuilder.hxx | 4 ++++
vcl/jsdialog/jsdialogbuilder.cxx | 20 ++++++++++++++++++++
vcl/source/control/button.cxx | 14 ++++++++++++++
3 files changed, 38 insertions(+)
New commits:
commit 1ec5a1300632a5455416b6cbb090d8c48353d939
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jun 14 10:07:02 2021 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Jul 28 09:15:31 2021 +0200
jsdialog: dump internal image for buttons
Change-Id: I53687f67042490c19d1056c74619d43566bf1289
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117132
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/+/119562
Tested-by: Jenkins
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 75bdf667cc58..78534ea8c29a 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -623,6 +623,10 @@ class JSMenuButton : public JSWidget<SalInstanceMenuButton, ::MenuButton>
public:
JSMenuButton(JSDialogSender* pSender, ::MenuButton* pMenuButton, SalInstanceBuilder* pBuilder,
bool bTakeOwnership);
+
+ virtual void set_label(const OUString& rText) override;
+ virtual void set_image(VirtualDevice* pDevice) override;
+ virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 335b9cfc23d7..02e794808c78 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1425,4 +1425,24 @@ JSMenuButton::JSMenuButton(JSDialogSender* pSender, ::MenuButton* pMenuButton,
{
}
+void JSMenuButton::set_label(const OUString& rText)
+{
+ OUString aPreviousLabel = get_label();
+ SalInstanceMenuButton::set_label(rText);
+ if (aPreviousLabel != rText)
+ sendUpdate();
+}
+
+void JSMenuButton::set_image(VirtualDevice* pDevice)
+{
+ SalInstanceMenuButton::set_image(pDevice);
+ sendUpdate();
+}
+
+void JSMenuButton::set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage)
+{
+ SalInstanceMenuButton::set_image(rImage);
+ sendUpdate();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 897d55618151..ac867a292533 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -20,6 +20,7 @@
#include <tools/poly.hxx>
#include <vcl/builder.hxx>
+#include <vcl/cvtgrf.hxx>
#include <vcl/image.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/decoview.hxx>
@@ -42,11 +43,13 @@
#include <vclstatuslistener.hxx>
#include <osl/diagnose.h>
+#include <comphelper/base64.hxx>
#include <comphelper/dispatchcommand.hxx>
#include <comphelper/lok.hxx>
#include <officecfg/Office/Common.hxx>
#include <boost/property_tree/ptree.hpp>
#include <tools/json_writer.hxx>
+#include <tools/stream.hxx>
using namespace css;
@@ -580,6 +583,17 @@ void Button::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
{
Control::DumpAsPropertyTree(rJsonWriter);
rJsonWriter.put("text", GetText());
+ if (HasImage())
+ {
+ SvMemoryStream aOStm(6535, 6535);
+ if(GraphicConverter::Export(aOStm, GetModeImage().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());
+ }
+ }
}
IMPL_STATIC_LINK( Button, dispatchCommandHandler, Button*, pButton, void )
More information about the Libreoffice-commits
mailing list