diff options
author | Shubham Goyal <22shubh22@gmail.com> | 2019-07-25 07:56:59 +0530 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-08-22 13:45:28 +0200 |
commit | 437fe778a81f3c39b8b259acd2d960c285d4f244 (patch) | |
tree | 2097fb4382d96889af6f1263e42703b938375822 /xmloff/source/draw/shapeexport.cxx | |
parent | bf1638f8fc629fa211a8c57f962b9a3c4c40152f (diff) |
QR Code : ODF import/export
Change-Id: I6c1ae63a89d5ed34d2fa245279d4552949bb64a7
Reviewed-on: https://gerrit.libreoffice.org/74853
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'xmloff/source/draw/shapeexport.cxx')
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 4de9defd61be..e6728b798ecc 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -64,6 +64,8 @@ #include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/drawing/XCustomShapeEngine.hpp> #include <com/sun/star/drawing/XGluePointsSupplier.hpp> +#include <com/sun/star/drawing/QRCode.hpp> +#include <com/sun/star/drawing/QRCodeErrorCorrection.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/graphic/XGraphic.hpp> @@ -91,6 +93,8 @@ #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> +#include <rtl/strbuf.hxx> +#include <rtl/ustring.hxx> #include <sal/log.hxx> #include <sax/tools/converter.hxx> @@ -1285,6 +1289,40 @@ void XMLShapeExport::ImpExportSignatureLine(const uno::Reference<drawing::XShape true); } +void XMLShapeExport::ImpExportQRCode(const uno::Reference<drawing::XShape>& xShape) +{ + uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY); + + uno::Any aAny = xPropSet->getPropertyValue("QRCodeProperties"); + + css::drawing::QRCode aQRCode; + if(aAny >>= aQRCode) + { + mrExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_STRING_VALUE, aQRCode.Payload); + /* Export QR Code as per customised schema, @see OpenDocument-schema-v1.3+libreoffice */ + OUString temp; + switch(aQRCode.ErrorCorrection){ + case css::drawing::QRCodeErrorCorrection::LOW : + temp = "low"; + break; + case css::drawing::QRCodeErrorCorrection::MEDIUM: + temp = "medium"; + break; + case css::drawing::QRCodeErrorCorrection::QUARTILE: + temp = "quartile"; + break; + case css::drawing::QRCodeErrorCorrection::HIGH: + temp = "high"; + break; + } + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_QRCODE_ERROR_CORRECTION, temp); + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_QRCODE_BORDER, OUStringBuffer(20).append(aQRCode.Border).makeStringAndClear()); + + SvXMLElementExport aQRCodeElement(mrExport, XML_NAMESPACE_LO_EXT, XML_QRCODE, true, + true); + } +} + void XMLShapeExport::ExportGraphicDefaults() { rtl::Reference<XMLStyleExport> aStEx(new XMLStyleExport(mrExport, mrExport.GetAutoStylePool().get())); @@ -2443,9 +2481,12 @@ void XMLShapeExport::ImpExportGraphicObjectShape( GetExport().GetImageMapExport().Export( xPropSet ); ImpExportDescription( xShape ); // #i68101# - // Signature Line - needs to be after the images! + // Signature Line, QR Code - needs to be after the images! if (GetExport().getDefaultVersion() > SvtSaveOptions::ODFVER_012) + { ImpExportSignatureLine(xShape); + ImpExportQRCode(xShape); + } } void XMLShapeExport::ImpExportChartShape( |