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 | |
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>
-rw-r--r-- | cui/source/dialogs/QrCodeGenDialog.cxx | 29 | ||||
-rw-r--r-- | sd/sdi/_drvwsh.sdi | 10 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 15 | ||||
-rw-r--r-- | sd/source/ui/view/drviews7.cxx | 14 | ||||
-rw-r--r-- | sd/uiconfig/sdraw/menubar/menubar.xml | 1 | ||||
-rw-r--r-- | sd/uiconfig/sdraw/popupmenu/graphic.xml | 1 | ||||
-rw-r--r-- | sd/uiconfig/simpress/menubar/menubar.xml | 1 | ||||
-rw-r--r-- | sd/uiconfig/simpress/popupmenu/graphic.xml | 1 |
8 files changed, 67 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"); + } } } diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index 25ebcceb66cc..b96c1557546f 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -2809,5 +2809,15 @@ interface DrawView ExecMethod = ExecCtrl ; StateMethod = GetMenuState ; ] + SID_INSERT_QRCODE + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] + SID_EDIT_QRCODE + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index e81ff4b62bce..6902cba6d812 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -100,6 +100,7 @@ #include <unotools/useroptions.hxx> +#include <vcl/abstdlg.hxx> #include <vcl/graph.hxx> #include <vcl/svapp.hxx> #include <vcl/unohelp2.hxx> @@ -119,6 +120,7 @@ #include <svx/xtable.hxx> #include <svx/svdobj.hxx> #include <svx/SvxColorChildWindow.hxx> +#include <svx/svxids.hrc> #include <editeng/outlobj.hxx> #include <editeng/flstitem.hxx> #include <editeng/scripttypeitem.hxx> @@ -3404,6 +3406,19 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } break; + case SID_INSERT_QRCODE: + case SID_EDIT_QRCODE: + { + VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); + const uno::Reference<frame::XModel> xModel = GetViewShellBase().GetController()->getModel(); + ScopedVclPtr<AbstractQrCodeGenDialog> pDlg(pFact->CreateQrCodeGenDialog( + GetFrameWeld(), xModel, rReq.GetSlot() == SID_EDIT_QRCODE)); + pDlg->Execute(); + Cancel(); + rReq.Ignore (); + } + break; + default: { SAL_WARN( "sd.ui", "Slot without function" ); diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 0405b91f1387..0671905ba363 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -325,6 +325,20 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); const size_t nMarkCount = rMarkList.GetMarkCount(); + if( nMarkCount == 1 ) + { + bool bDisable = true; + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + if( dynamic_cast<const SdrGrafObj*>( pObj) && ( static_cast<SdrGrafObj*>(pObj)->getQrCode())) + { + bDisable = false; + } + if(bDisable) + { + rSet.DisableItem(SID_EDIT_QRCODE); + } + } + //format paintbrush FuFormatPaintBrush::GetMenuState( *this, rSet ); diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml index 579869a296b4..9f2686f325b7 100644 --- a/sd/uiconfig/sdraw/menubar/menubar.xml +++ b/sd/uiconfig/sdraw/menubar/menubar.xml @@ -211,6 +211,7 @@ <menu:menuitem menu:id=".uno:InsertAnnotation"/> <menu:menuitem menu:id=".uno:InsertObjectFloatingFrame" menu:style="text"/> <menu:menuitem menu:id=".uno:FontworkGalleryFloater"/> + <menu:menuitem menu:id=".uno:InsertQrCode"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HyperlinkDialog"/> <menu:menuitem menu:id=".uno:InsertSymbol" menu:style="text"/> diff --git a/sd/uiconfig/sdraw/popupmenu/graphic.xml b/sd/uiconfig/sdraw/popupmenu/graphic.xml index 38a367993e14..2ac8d1c54d30 100644 --- a/sd/uiconfig/sdraw/popupmenu/graphic.xml +++ b/sd/uiconfig/sdraw/popupmenu/graphic.xml @@ -71,6 +71,7 @@ <menu:menuitem menu:id=".uno:LeaveGroup"/> <menu:menuitem menu:id=".uno:Break"/> <menu:menuseparator/> + <menu:menuitem menu:id=".uno:EditQrCode"/> <menu:menuitem menu:id=".uno:NameGroup"/> <menu:menuitem menu:id=".uno:ObjectTitleDescription"/> <menu:menuseparator/> diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index a152b8ac52ba..6b383c2a5513 100644 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -243,6 +243,7 @@ <menu:menuitem menu:id=".uno:InsertAnnotation"/> <menu:menuitem menu:id=".uno:InsertObjectFloatingFrame" menu:style="text"/> <menu:menuitem menu:id=".uno:FontworkGalleryFloater"/> + <menu:menuitem menu:id=".uno:InsertQrCode"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HyperlinkDialog"/> <menu:menuitem menu:id=".uno:InsertSymbol"/> diff --git a/sd/uiconfig/simpress/popupmenu/graphic.xml b/sd/uiconfig/simpress/popupmenu/graphic.xml index 6a6176e080b2..3c5d2b98ee88 100644 --- a/sd/uiconfig/simpress/popupmenu/graphic.xml +++ b/sd/uiconfig/simpress/popupmenu/graphic.xml @@ -71,6 +71,7 @@ <menu:menuitem menu:id=".uno:LeaveGroup"/> <menu:menuitem menu:id=".uno:Break"/> <menu:menuseparator/> + <menu:menuitem menu:id=".uno:EditQrCode"/> <menu:menuitem menu:id=".uno:NameGroup"/> <menu:menuitem menu:id=".uno:ObjectTitleDescription"/> <menu:menuseparator/> |