diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-11-07 10:24:41 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-11-07 13:46:57 +0100 |
commit | 055be3f4be764e445064effabf06de9d1ed819f7 (patch) | |
tree | 0b2f908a8bc6ffb34ff6f2ae7472dfc4a7e95cc2 /sfx2/source/dialog | |
parent | e53168c6875223d718df49e23b733ad6f40e0b7f (diff) |
sfx2: introduce a new .uno:SignPDF
It's similar to File -> Open, but the file picker only offers PDF files
in this case, and the import is read-only -- i.e. it's the import
equivalent of .uno:ExportToPDF.
Change-Id: I7be9d6711e0ea93643e538575c0604d41cff9b26
Diffstat (limited to 'sfx2/source/dialog')
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 7771124e98a8..c54a0df748a4 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -2593,16 +2593,24 @@ ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType, const css::uno::Sequence< OUString >& rBlackList ) { ErrCode nRet; - FileDialogHelper aDialog( nDialogType, nFlags, - rFact, nDialog, SfxFilterFlags::NONE, SfxFilterFlags::NONE, rStandardDir, rBlackList ); + std::unique_ptr<FileDialogHelper> pDialog; + // Sign existing PDF: only works with PDF files and they are opened + // read-only to discourage editing (which would invalidate existing + // signatures). + if (nFlags & FileDialogFlags::SignPDF) + pDialog.reset(new FileDialogHelper(nDialogType, nFlags, SfxResId(STR_SFX_FILTERNAME_PDF).toString(), "pdf", rStandardDir, rBlackList)); + else + pDialog.reset(new FileDialogHelper(nDialogType, nFlags, rFact, nDialog, SfxFilterFlags::NONE, SfxFilterFlags::NONE, rStandardDir, rBlackList)); OUString aPath; if ( pPath ) aPath = *pPath; - nRet = aDialog.Execute( rpURLList, rpSet, rFilter, aPath ); + nRet = pDialog->Execute(rpURLList, rpSet, rFilter, aPath); DBG_ASSERT( rFilter.indexOf(": ") == -1, "Old filter name used!"); + if (rpSet && nFlags & FileDialogFlags::SignPDF) + rpSet->Put(SfxBoolItem(SID_DOC_READONLY, true)); return nRet; } |