diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-10-22 11:32:09 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-10-23 12:17:00 +0200 |
commit | ec0a3db0cbb5413d10e70c9843e679bbf2327c15 (patch) | |
tree | b014c4a8d600fa2e7ee50b01f2ec80df34e57772 /sfx2/source/view/viewsh.cxx | |
parent | 942d1d2ea59bf4605f2c464a6b29c967fa9f8de8 (diff) |
Add document-level option to lock down file export
Setting this option will disable any export command
(File->Export*, File->Send*, graphic/chart export context menu,
save as, mailmerge wizard, ...)
Change-Id: I07a2a3b9179b494ac839e7d1e407194600679aa1
Reviewed-on: https://gerrit.libreoffice.org/81316
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sfx2/source/view/viewsh.cxx')
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 4866fcabc4bc..e8638badac64 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -673,16 +673,27 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) { switch ( nSID ) { -#if HAVE_FEATURE_MACOSX_SANDBOX + case SID_BLUETOOTH_SENDDOC: case SID_MAIL_SENDDOC: case SID_MAIL_SENDDOCASFORMAT: case SID_MAIL_SENDDOCASMS: case SID_MAIL_SENDDOCASOOO: case SID_MAIL_SENDDOCASPDF: + { +#if HAVE_FEATURE_MACOSX_SANDBOX rSet.DisableItem(nSID); - break; #endif + if (isExportLocked()) + rSet.DisableItem(nSID); + break; + } + case SID_WEBHTML: + { + if (isExportLocked()) + rSet.DisableItem(nSID); + break; + } // Printer functions case SID_PRINTDOC: case SID_PRINTDOCDIRECT: @@ -1745,6 +1756,15 @@ bool SfxViewShell::isContentExtractionLocked() return aArgs.getOrDefault("LockContentExtraction", false); } +bool SfxViewShell::isExportLocked() +{ + Reference<XModel> xModel = GetCurrentDocument(); + if (!xModel.is()) + return false; + comphelper::NamedValueCollection aArgs(xModel->getArgs()); + return aArgs.getOrDefault("LockExport", false); +} + Reference < XController > SfxViewShell::GetController() const { return pImpl->m_pController.get(); |