diff options
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/inc/tabvwsh.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshb.cxx | 48 |
2 files changed, 50 insertions, 0 deletions
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 64951da8ab4c..3e863a3881bb 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_TABVWSH_HXX #define INCLUDED_SC_SOURCE_UI_INC_TABVWSH_HXX +#include <com/sun/star/drawing/QRCode.hpp> #include <formula/errorcodes.hxx> #include <formula/opcode.hxx> #include <svx/fmshell.hxx> @@ -171,6 +172,7 @@ private: void DoReadUserDataSequence( const css::uno::Sequence< css::beans::PropertyValue >& rSettings ); bool IsSignatureLineSelected(); bool IsSignatureLineSigned(); + bool IsQRCodeSelected(); DECL_LINK( SimpleRefClose, const OUString*, void ); DECL_LINK( SimpleRefDone, const OUString&, void ); diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index cc7492d8a17a..8c7cc954f009 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/embed/EmbedMisc.hpp> #include <com/sun/star/embed/EmbedStates.hpp> #include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <com/sun/star/drawing/QRCode.hpp> #include <vcl/errinf.hxx> #include <sfx2/app.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -370,6 +371,18 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) break; } + case SID_INSERT_QRCODE: + case SID_EDIT_QRCODE: + { + const uno::Reference<frame::XModel> xModel( GetViewData().GetDocShell()->GetBaseModel() ); + + VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); + ScopedVclPtr<AbstractQrCodeGenDialog> pDialog(pFact->CreateQrCodeGenDialog( + pWin->GetFrameWeld(), xModel, rReq.GetSlot() == SID_EDIT_QRCODE)); + pDialog->Execute(); + break; + } + case SID_OBJECTRESIZE: { // the server would like to change the client size @@ -523,6 +536,15 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) rSet.DisableItem(nWhich); break; + case SID_INSERT_QRCODE: + if ( bTabProt || bShared || (pSdrView && pSdrView->GetMarkedObjectCount() != 0)) + rSet.DisableItem( nWhich ); + break; + case SID_EDIT_QRCODE: + if (!IsQRCodeSelected()) + rSet.DisableItem(nWhich); + break; + case SID_INSERT_GRAPHIC: if (bTabProt || bShared) { @@ -577,6 +599,32 @@ bool ScTabViewShell::IsSignatureLineSelected() return pGraphic->isSignatureLine(); } +bool ScTabViewShell::IsQRCodeSelected() +{ + SdrView* pSdrView = GetSdrView(); + 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; + + if(pGraphic->getQrCode()) + { + return true; + } + else{ + return false; + } +} + bool ScTabViewShell::IsSignatureLineSigned() { SdrView* pSdrView = GetSdrView(); |