include/sfx2/sfx.hrc | 1 + sfx2/source/view/view.src | 4 ++++ sfx2/source/view/viewfrm.cxx | 31 +++++++++++++++++-------------- 3 files changed, 22 insertions(+), 14 deletions(-)
New commits: commit 3b94229fb74dfe43e2b7349d6f580dc375f28814 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Nov 17 15:39:36 2016 +0100 sfx2: let .uno:SignPDF result in a custom infobar text To make the intention a bit more explicit. Change-Id: I70ce053b9f068a2288e4a05eba55fb3e2451b561 Reviewed-on: https://gerrit.libreoffice.org/30935 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc index 1cd4462..df38599 100644 --- a/include/sfx2/sfx.hrc +++ b/include/sfx2/sfx.hrc @@ -154,6 +154,7 @@ #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_READONLY_PDF (RID_SFX_START+138) #define STR_ACCTITLE_PRODUCTIVITYTOOLS (RID_SFX_START+157) #define SFX_THUMBNAIL_TEXT (RID_SFX_START+158) diff --git a/sfx2/source/view/view.src b/sfx2/source/view/view.src index 31991bf..0826609 100644 --- a/sfx2/source/view/view.src +++ b/sfx2/source/view/view.src @@ -90,6 +90,10 @@ String STR_READONLY_DOCUMENT { Text [ en-US ] = "This document is open in read-only mode." ; }; +String STR_READONLY_PDF +{ + Text [ en-US ] = "This PDF is open in read-only mode to allow signing the existing file." ; +}; String STR_CLASSIFIED_DOCUMENT { diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 18022ec..660e0d5 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1149,23 +1149,26 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } else { - SfxInfoBarWindow* pInfoBar = AppendInfoBar("readonly", SfxResId(STR_READONLY_DOCUMENT)); + bool bSignPDF = false; + SfxMedium* pMedium = m_xObjSh->GetMedium(); + if (pMedium && !pMedium->IsOriginallyReadOnly()) + { + std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter(); + bSignPDF = pFilter && pFilter->GetName() == "draw_pdf_import"; + } + + SfxInfoBarWindow* pInfoBar = AppendInfoBar("readonly", SfxResId(bSignPDF ? STR_READONLY_PDF : STR_READONLY_DOCUMENT)); if (pInfoBar) { - SfxMedium* pMedium = m_xObjSh->GetMedium(); - if (pMedium && !pMedium->IsOriginallyReadOnly()) + if (bSignPDF) { - std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter(); - if (pFilter && pFilter->GetName() == "draw_pdf_import") - { - // SID_SIGNPDF opened a read-write PDF - // read-only for signing purposes. - VclPtrInstance<PushButton> xSignButton(&GetWindow()); - xSignButton->SetText(SfxResId(STR_READONLY_SIGN)); - xSignButton->SetSizePixel(xSignButton->GetOptimalSize()); - xSignButton->SetClickHdl(LINK(this, SfxViewFrame, SignDocumentHandler)); - pInfoBar->addButton(xSignButton); - } + // SID_SIGNPDF opened a read-write PDF + // read-only for signing purposes. + VclPtrInstance<PushButton> xSignButton(&GetWindow()); + xSignButton->SetText(SfxResId(STR_READONLY_SIGN)); + xSignButton->SetSizePixel(xSignButton->GetOptimalSize()); + xSignButton->SetClickHdl(LINK(this, SfxViewFrame, SignDocumentHandler)); + pInfoBar->addButton(xSignButton); } VclPtrInstance<PushButton> xBtn(&GetWindow()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits