[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Nov 8 12:41:13 UTC 2016


 include/sfx2/sfx.hrc         |    1 +
 include/sfx2/viewfrm.hxx     |    1 +
 sfx2/source/view/view.src    |    5 +++++
 sfx2/source/view/viewfrm.cxx |   20 ++++++++++++++++++++
 4 files changed, 27 insertions(+)

New commits:
commit b58e3de0cd9111b824e31ee4da3df8db0b58f857
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 8 09:12:47 2016 +0100

    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

diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc
index 020f82b..1cd4462 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 fcfdf31..1702e22 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 8384544..31991bf 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 d6bd185..0f7b11d 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 )
 {


More information about the Libreoffice-commits mailing list