summaryrefslogtreecommitdiff
path: root/sw/source/uibase/dochdl
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-03-09 10:58:25 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-03-09 14:18:28 +0100
commit76e2cede5a415df8d3e7a874f56be7a0b5953e12 (patch)
treee7eafef3b01fad3fd36f1dc97484d9f414102941 /sw/source/uibase/dochdl
parent644ace4143fe2576bfd71c8ab3da9d666d6523bb (diff)
Move copy/paste classification check from sw to sfx2
So that it's easy to unit test it and other apps can use it as well in the future. Change-Id: I38d601924b7fbb17615ff6e9c031a71b40777c4c
Diffstat (limited to 'sw/source/uibase/dochdl')
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx29
1 files changed, 11 insertions, 18 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 04c3ae1e25b8..fb46de918bfe 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -3222,33 +3222,26 @@ bool lcl_checkClassification(SwDoc* pSourceDoc, SwDoc* pDestinationDoc)
if (!pSourceShell || !pDestinationShell)
return true;
- bool bSourceClassified = SfxClassificationHelper::IsClassified(*pSourceShell);
- if (!bSourceClassified)
- // No classification on the source side. Return early, regardless the
- // state of the destination side.
+ switch (SfxClassificationHelper::CheckPaste(*pSourceShell, *pDestinationShell))
+ {
+ case SfxClassificationCheckPasteResult::None:
+ {
return true;
-
- bool bDestinationClassified = SfxClassificationHelper::IsClassified(*pDestinationShell);
- if (bSourceClassified && !bDestinationClassified)
+ }
+ break;
+ case SfxClassificationCheckPasteResult::TargetDocNotClassified:
{
- // Paste from a classified document to a non-classified one -> deny.
ScopedVclPtrInstance<MessageDialog>::Create(nullptr, SW_RES(STR_TARGET_DOC_NOT_CLASSIFIED), VCL_MESSAGE_INFO)->Execute();
return false;
}
-
- // Remaining case: paste between two classified documents.
- SfxClassificationHelper aSource(*pSourceShell);
- SfxClassificationHelper aDestination(*pDestinationShell);
- if (aSource.GetImpactScale() != aDestination.GetImpactScale())
- // It's possible to compare them if they have the same scale.
- return true;
-
- if (aSource.GetImpactLevel() > aDestination.GetImpactLevel())
+ break;
+ case SfxClassificationCheckPasteResult::DocClassificationTooLow:
{
- // Paste from a doc that has higher classification -> deny.
ScopedVclPtrInstance<MessageDialog>::Create(nullptr, SW_RES(STR_DOC_CLASSIFICATION_TOO_LOW), VCL_MESSAGE_INFO)->Execute();
return false;
}
+ break;
+ }
return true;
}