summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-11-08 09:12:47 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-11-08 13:40:34 +0100
commitb58e3de0cd9111b824e31ee4da3df8db0b58f857 (patch)
tree0af8fba9db9675376dc6f9773e8791964383066e /sfx2
parentb2318479c8635af8e022ff4f844e85a1f6b9f4de (diff)
sfx2: let .uno:SignPDF add a matching button to the infobar
When the user uses .uno:SignPDF to open a PDF file in read-only mode, then the infobar now has a "Sign Document" button, which is a shortcut for the File -> Digital Signatures -> Digital Signatures menu item. Change-Id: I2953a5cb1252c5ff1c395d45c54db1a97b39433e
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/view.src5
-rw-r--r--sfx2/source/view/viewfrm.cxx20
2 files changed, 25 insertions, 0 deletions
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<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);
+ }
+ }
+
VclPtrInstance<PushButton> 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 )
{