summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-21 17:02:31 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-10-01 09:54:38 +0200
commit77960eb573e548816064690c5b1de5ca18ae9cbd (patch)
tree21507a1fcf5289ea29704377bab9c5b2ab848cd8 /cui
parent0f77b8a44e7ee5541c97304d37f0c52cd8275cba (diff)
add an explicit --disable-qrcodegen configure option
Change-Id: If8e965fa955aecdb9e7011bdddc690de9cad0c4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103120 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103157 Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/QrCodeGenDialog.cxx21
-rw-r--r--cui/source/inc/QrCodeGenDialog.hxx4
2 files changed, 22 insertions, 3 deletions
diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx
index 85ed9309df9c..7f3f6a806cf5 100644
--- a/cui/source/dialogs/QrCodeGenDialog.cxx
+++ b/cui/source/dialogs/QrCodeGenDialog.cxx
@@ -17,11 +17,13 @@
#include <utility>
#include <vcl/svapp.hxx>
+#if ENABLE_QRCODEGEN
#if defined(SYSTEM_QRCODEGEN)
#include <qrcodegen/QrCode.hpp>
#else
#include <QrCode.hpp>
#endif
+#endif
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
@@ -56,7 +58,9 @@ using namespace css::sheet;
using namespace css::text;
using namespace css::drawing;
using namespace css::graphic;
+#if ENABLE_QRCODEGEN
using namespace qrcodegen;
+#endif
QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel,
bool bEditExisting)
@@ -68,7 +72,9 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel
m_xBuilder->weld_radio_button("button_quartile"),
m_xBuilder->weld_radio_button("button_high") }
, m_xSpinBorder(m_xBuilder->weld_spin_button("edit_border"))
+#if ENABLE_QRCODEGEN
, mpParent(pParent)
+#endif
{
if (!bEditExisting)
{
@@ -104,6 +110,7 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel
short QrCodeGenDialog::run()
{
+#if ENABLE_QRCODEGEN
short nRet;
while (true)
{
@@ -127,10 +134,14 @@ short QrCodeGenDialog::run()
break;
}
return nRet;
+#else
+ return RET_CANCEL;
+#endif
}
void QrCodeGenDialog::Apply()
{
+#if ENABLE_QRCODEGEN
css::drawing::QRCode aQRCode;
aQRCode.Payload = m_xEdittext->get_text();
@@ -250,13 +261,12 @@ void QrCodeGenDialog::Apply()
//Not implemented for math,base and other apps.
throw uno::RuntimeException("Not implemented");
}
+#endif
}
OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, long aQRECC, int aQRBorder)
{
-#if ENABLE_FUZZERS
- return OUString();
-#else
+#if ENABLE_QRCODEGEN
//Select ECC:: value from aQrECC
qrcodegen::QrCode::Ecc bqrEcc = qrcodegen::QrCode::Ecc::LOW;
@@ -293,6 +303,11 @@ OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, long aQRECC, int aQRB
std::string svg = qr0.toSvgString(aQRBorder);
//cstring to OUString
return OUString::createFromAscii(svg.c_str());
+#else
+ (void)aQRText;
+ (void)aQRECC;
+ (void)aQRBorder;
+ return OUString();
#endif
}
diff --git a/cui/source/inc/QrCodeGenDialog.hxx b/cui/source/inc/QrCodeGenDialog.hxx
index 563182d7a043..832662837d57 100644
--- a/cui/source/inc/QrCodeGenDialog.hxx
+++ b/cui/source/inc/QrCodeGenDialog.hxx
@@ -9,6 +9,8 @@
#ifndef INCLUDED_CUI_INC_QRCODEGENDIALOG_HXX
#define INCLUDED_CUI_INC_QRCODEGENDIALOG_HXX
+#include <config_qrcodegen.h>
+
#include <vcl/weld.hxx>
#include <com/sun/star/frame/XModel.hpp>
@@ -32,7 +34,9 @@ private:
std::unique_ptr<weld::Entry> m_xEdittext;
std::unique_ptr<weld::RadioButton> m_xECC[4];
std::unique_ptr<weld::SpinButton> m_xSpinBorder;
+#if ENABLE_QRCODEGEN
weld::Widget* mpParent;
+#endif
css::uno::Reference<css::beans::XPropertySet> m_xExistingShapeProperties;