diff options
author | Shubham Goyal <22shubh22@gmail.com> | 2019-08-16 11:59:01 +0530 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-08-19 16:12:22 +0200 |
commit | 3a95a2baee94e50e3f745990359fdeea65a422a8 (patch) | |
tree | 5db0feb06ebf64125c8c39b930b87d9c46e01cd5 /cui | |
parent | 41a01bbeb7b9cb448bf95b8a7d43a724267f8c64 (diff) |
Make QR code callable in Impress and Draw
Change-Id: If11686189b0665f3918821269dd73d122e632194
Reviewed-on: https://gerrit.libreoffice.org/77438
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/QrCodeGenDialog.cxx | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx index c0e9f565556e..661d36678c07 100644 --- a/cui/source/dialogs/QrCodeGenDialog.cxx +++ b/cui/source/dialogs/QrCodeGenDialog.cxx @@ -42,6 +42,9 @@ #include <com/sun/star/text/XTextViewCursor.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <config_fuzzers.h> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/drawing/XDrawView.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> using namespace css; using namespace css::uno; @@ -169,11 +172,10 @@ void QrCodeGenDialog::Apply() // Default anchoring xShapeProps->setPropertyValue("AnchorType", Any(TextContentAnchorType_AT_PARAGRAPH)); - const Reference<XServiceInfo> xServiceInfo(m_xModel, UNO_QUERY); + const Reference<XServiceInfo> xServiceInfo(m_xModel, UNO_QUERY_THROW); // Writer - const Reference<XTextDocument> xTextDocument(m_xModel, UNO_QUERY); - if (xTextDocument.is()) + if (xServiceInfo->supportsService("com.sun.star.text.TextDocument")) { Reference<XTextContent> xTextContent(xShape, UNO_QUERY_THROW); Reference<XTextViewCursorSupplier> xViewCursorSupplier(m_xModel->getCurrentController(), @@ -187,8 +189,7 @@ void QrCodeGenDialog::Apply() } // Calc - const Reference<XSpreadsheetDocument> xSpreadsheetDocument(m_xModel, UNO_QUERY); - if (xSpreadsheetDocument.is()) + else if (xServiceInfo->supportsService("com.sun.star.sheet.SpreadsheetDocument")) { Reference<XPropertySet> xSheetCell(m_xModel->getCurrentSelection(), UNO_QUERY_THROW); awt::Point aCellPosition; @@ -204,6 +205,24 @@ void QrCodeGenDialog::Apply() xShapes->add(xShape); return; } + + //Impress and Draw + else if (xServiceInfo->supportsService("com.sun.star.presentation.PresentationDocument") + || xServiceInfo->supportsService("com.sun.star.drawing.DrawingDocument")) + { + Reference<XDrawView> xView(m_xModel->getCurrentController(), UNO_QUERY_THROW); + Reference<XDrawPage> xPage(xView->getCurrentPage(), UNO_SET_THROW); + Reference<XShapes> xShapes(xPage, UNO_QUERY_THROW); + + xShapes->add(xShape); + return; + } + + else + { + //Not implemented for math,base and other apps. + throw uno::RuntimeException("Not implemented"); + } } } |