diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc index 020f82bcb1d0..1cd446269016 100644 --- a/include/sfx2/sfx.hrc +++ b/include/sfx2/sfx.hrc @@ -153,6 +153,7 @@ #define STR_CLASSIFIED_INTELLECTUAL_PROPERTY (RID_SFX_START+134) #define STR_CLASSIFIED_NATIONAL_SECURITY (RID_SFX_START+135) #define STR_CLASSIFIED_EXPORT_CONTROL (RID_SFX_START+136) +#define STR_READONLY_SIGN (RID_SFX_START+137) #define STR_ACCTITLE_PRODUCTIVITYTOOLS (RID_SFX_START+157) #define SFX_THUMBNAIL_TEXT (RID_SFX_START+158) diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index fcfdf3161750..1702e22020f0 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -78,6 +78,7 @@ protected: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; DECL_LINK( SwitchReadOnlyHandler, Button*, void ); + DECL_LINK(SignDocumentHandler, Button*, void); SAL_DLLPRIVATE void KillDispatcher_Impl(); virtual ~SfxViewFrame() override; diff --git a/sfx2/source/view/view.src b/sfx2/source/view/view.src index 8384544b2e85..31991bf84946 100644 --- a/sfx2/source/view/view.src +++ b/sfx2/source/view/view.src @@ -131,4 +131,9 @@ String STR_READONLY_EDIT Text[ en-US ] = "Edit Document"; }; +String STR_READONLY_SIGN +{ + Text[ en-US ] = "Sign Document"; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index d6bd18598e2b..0f7b11db6be7 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1152,6 +1152,22 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) SfxInfoBarWindow* pInfoBar = AppendInfoBar("readonly", SfxResId(STR_READONLY_DOCUMENT)); if (pInfoBar) { + SfxMedium* pMedium = m_xObjSh->GetMedium(); + if (pMedium && !pMedium->IsOriginallyReadOnly()) + { + std::shared_ptr pFilter = pMedium->GetFilter(); + if (pFilter && pFilter->GetName() == "draw_pdf_import") + { + // SID_SIGNPDF opened a read-write PDF + // read-only for signing purposes. + VclPtrInstance xSignButton(&GetWindow()); + xSignButton->SetText(SfxResId(STR_READONLY_SIGN)); + xSignButton->SetSizePixel(xSignButton->GetOptimalSize()); + xSignButton->SetClickHdl(LINK(this, SfxViewFrame, SignDocumentHandler)); + pInfoBar->addButton(xSignButton); + } + } + VclPtrInstance xBtn(&GetWindow()); xBtn->SetText(SfxResId(STR_READONLY_EDIT)); xBtn->SetSizePixel(xBtn->GetOptimalSize()); @@ -1251,6 +1267,10 @@ IMPL_LINK_NOARG(SfxViewFrame, SwitchReadOnlyHandler, Button*, void) GetDispatcher()->Execute(SID_EDITDOC); } +IMPL_LINK_NOARG(SfxViewFrame, SignDocumentHandler, Button*, void) +{ + GetDispatcher()->Execute(SID_SIGNATURE); +} void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) {