diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-10-10 08:13:51 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-10-14 08:15:31 +0200 |
commit | 075f20a4b696f9e85d11dc977806e41a49e6de61 (patch) | |
tree | 30827954123e3dd54764c74ccad37302f05b2816 /sc | |
parent | 03ec3b7dd11656c8b64a94efb172e17d97ea662e (diff) |
Add document-level option to lock down content extraction
Setting this option will prevent copying/dragging any content from LO
to another program or even another LO window.
Change-Id: Ifbc032a4fa69ac1a17d4b500f5a30f5399d84ed7
Reviewed-on: https://gerrit.libreoffice.org/80586
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/drawfunc/drawsh2.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 8 |
4 files changed, 23 insertions, 0 deletions
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index 4f7c591339bb..a3da77fd7296 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -147,6 +147,12 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // disable functions rSet.DisableItem( SID_FLIP_VERTICAL ); } + if (pViewData->GetViewShell()->isContentExtractionLocked()) + { + rSet.DisableItem(SID_COPY); + rSet.DisableItem(SID_CUT); + } + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); const size_t nMarkCount = rMarkList.GetMarkCount(); diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 92910b2dea87..17f8321d58e2 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -466,6 +466,12 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) if (!bCanDoThesaurus) rSet.DisableItem( SID_THESAURUS ); } + + if (pViewData->GetViewShell()->isContentExtractionLocked()) + { + rSet.DisableItem(SID_COPY); + rSet.DisableItem(SID_CUT); + } } IMPL_LINK( ScDrawTextObjectBar, ClipboardChanged, TransferableDataHelper*, pDataHelper, void ) diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 6554b63c6e7f..949c81e47a3d 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -211,6 +211,8 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) bDisable = false; break; case SID_CUT: // cut + bDisable = !bSimpleArea || GetViewData()->GetViewShell()->isContentExtractionLocked(); + break; case FID_INS_CELL: // insert cells, just simple selection bDisable = (!bSimpleArea); break; @@ -271,6 +273,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) //! work is to be done once more if ( !(!bEditable && bOnlyNotBecauseOfMatrix) ) bNeedEdit = false; // allowed when protected/ReadOnly + bDisable = GetViewData()->GetViewShell()->isContentExtractionLocked(); break; case SID_AUTOFORMAT: // Autoformat, at least 3x3 selected diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 8cda154cd702..6e0b40269d09 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -817,6 +817,14 @@ void ScEditShell::GetState( SfxItemSet& rSet ) case SID_INSERT_FIELD_TITLE: case SID_INSERT_FIELD_DATE_VAR: break; + case SID_COPY: + case SID_CUT: + if (pViewData->GetViewShell()->isContentExtractionLocked()) + { + rSet.DisableItem(SID_COPY); + rSet.DisableItem(SID_CUT); + } + break; } nWhich = aIter.NextWhich(); |