summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/uiview/viewdlg2.cxx32
-rw-r--r--sw/source/uibase/uiview/viewstat.cxx11
2 files changed, 43 insertions, 0 deletions
diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx
index 5d2d756803b1..40263d66b9f0 100644
--- a/sw/source/uibase/uiview/viewdlg2.cxx
+++ b/sw/source/uibase/uiview/viewdlg2.cxx
@@ -26,6 +26,7 @@
#include <fldmgr.hxx>
#include <expfld.hxx>
#include <modcfg.hxx>
+#include <com/sun/star/drawing/QRCode.hpp>
#include <swmodule.hxx>
#include <view.hxx>
@@ -67,6 +68,16 @@ void SwView::ExecDlgExt(SfxRequest const &rReq)
pDialog->Execute();
break;
}
+ case SID_INSERT_QRCODE:
+ case SID_EDIT_QRCODE:
+ {
+ VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
+ const uno::Reference<frame::XModel> xModel(GetCurrentDocument());
+ ScopedVclPtr<AbstractQrCodeGenDialog> pDialog(pFact->CreateQrCodeGenDialog(
+ GetFrameWeld(), xModel, rReq.GetSlot() == SID_EDIT_QRCODE));
+ pDialog->Execute();
+ break;
+ }
case SID_SIGN_SIGNATURELINE:
{
VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
@@ -132,6 +143,27 @@ bool SwView::isSignatureLineSigned()
return pGraphic->isSignatureLineSigned();
}
+bool SwView::isQRCodeSelected()
+{
+ SwWrtShell& rSh = GetWrtShell();
+ SdrView* pSdrView = rSh.GetDrawView();
+ if (!pSdrView)
+ return false;
+
+ if (pSdrView->GetMarkedObjectCount() != 1)
+ return false;
+
+ SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
+ if (!pPickObj)
+ return false;
+
+ SdrGrafObj* pGraphic = dynamic_cast<SdrGrafObj*>(pPickObj);
+ if (!pGraphic)
+ return false;
+
+ return pGraphic->getQrCode() != nullptr;
+}
+
void SwView::AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId)
{
SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx
index f43e511636ef..c901557a145b 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -117,6 +117,17 @@ void SwView::GetState(SfxItemSet &rSet)
if (!isSignatureLineSelected() || isSignatureLineSigned())
rSet.DisableItem(nWhich);
break;
+ case SID_INSERT_QRCODE:
+ if( !( m_nSelectionType & SelectionType::Text ||
+ m_nSelectionType & SelectionType::NumberList ) )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_EDIT_QRCODE:
+ if (!isQRCodeSelected())
+ rSet.DisableItem(nWhich);
+ break;
case FN_INSERT_CAPTION:
{
// There are captions for graphics, OLE objects, frames and tables