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 /sw | |
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 'sw')
-rw-r--r-- | sw/qa/python/check_xmodel.py | 4 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtdd.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/shells/annotsh.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/drwtxtex.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 7 |
7 files changed, 21 insertions, 6 deletions
diff --git a/sw/qa/python/check_xmodel.py b/sw/qa/python/check_xmodel.py index c5374c03c350..a71fdf9bc142 100644 --- a/sw/qa/python/check_xmodel.py +++ b/sw/qa/python/check_xmodel.py @@ -32,12 +32,14 @@ class TestXModel(unittest.TestCase): p1 = PropertyValue(Name="SuggestedSaveAsName", Value="prettyFileName") p2 = PropertyValue(Name="SuggestedSaveAsDir", Value="/my/dir") - xDoc.setArgs([p1, p2]) + p3 = PropertyValue(Name="LockContentExtraction", Value=True) + xDoc.setArgs([p1, p2, p3]) # Make sure that all properties are returned with getArgs() args = xDoc.getArgs() self.assertTrue(p1 in args) self.assertTrue(p2 in args) + self.assertTrue(p3 in args) xDoc.close(True) diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 20639bacd8bf..67a5d390c2e0 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1108,6 +1108,9 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) int SwTransferable::Copy( bool bIsCut ) { + if (m_pWrtShell->GetView().isContentExtractionLocked()) + return 0; + int nRet = PrepareForCopy( bIsCut ); if ( nRet ) { diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx index 2a4fdb2eb9e9..f9488aca1b38 100644 --- a/sw/source/uibase/docvw/edtdd.cxx +++ b/sw/source/uibase/docvw/edtdd.cxx @@ -66,6 +66,9 @@ void SwEditWin::StopDDTimer(SwWrtShell *pSh, const Point &rPt) void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel ) { + if (m_rView.isContentExtractionLocked()) + return; + SwWrtShell &rSh = m_rView.GetWrtShell(); if( rSh.GetDrawView() ) { diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 0c5467c16075..e6478adf3292 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -983,13 +983,13 @@ void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet) { case SID_CUT: { - if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) || !pOLV->HasSelection() ) + if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus() == SwPostItHelper::DELETED) rSet.DisableItem( nWhich ); - break; + [[fallthrough]]; } case SID_COPY: { - if( !pOLV->HasSelection() ) + if (!pOLV->HasSelection() || rView.isContentExtractionLocked()) rSet.DisableItem( nWhich ); break; } diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 8da42ad496d4..89f4e3a00824 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -462,7 +462,7 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet) } [[fallthrough]]; case SID_COPY: - if( !bCopy ) + if( !bCopy || GetView().isContentExtractionLocked()) rSet.DisableItem( nWhich ); break; diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index c975ecebfbae..702a08a3bedd 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -1144,7 +1144,7 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet) { case SID_CUT: case SID_COPY: - if( !bCopy ) + if( !bCopy || GetView().isContentExtractionLocked()) rSet.DisableItem( nWhich ); break; diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 06ed752d11a3..57b37a1d7ef6 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1964,6 +1964,13 @@ void SwTextShell::GetState( SfxItemSet &rSet ) rSet.DisableItem(nWhich); } break; + case SID_COPY: + case SID_CUT: + { + if (GetShell().GetView().isContentExtractionLocked()) + rSet.DisableItem(nWhich); + break; + } } nWhich = aIter.NextWhich(); } |