summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-03-10 08:58:00 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-07 17:42:43 +0200
commit37a9579cbe8325dea3749a39a9bf1cf8cf487adc (patch)
tree2e3a820703a0318e5b6308553e19537801a55b4b /sw
parent8dffc2fb27939bc2c9f8b7f80dca395657fe3c83 (diff)
sfx2: make SfxClassificationHelper not require a full doc shell
So that input filters can build their own doc properties and can also use CheckPaste() without having the full original document around. (cherry picked from commit e75f6e549eb825c310d16d11babf0fba5ee7fd7a) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx Change-Id: I0b8a63702f73ce04e8728a360b56ab9d1ca67af1
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx16
-rw-r--r--sw/source/core/edit/edfcol.cxx2
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx2
3 files changed, 15 insertions, 5 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index d3b5d471768f..14a2d93dd31d 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -3227,6 +3227,16 @@ void SwUiWriterTest::testTdf84695()
CPPUNIT_ASSERT_EQUAL(OUString("a"), xShape->getString());
}
+namespace
+{
+
+int checkShells(SwDocShell* pSource, SwDocShell* pDestination)
+{
+ return int(SfxClassificationHelper::CheckPaste(pSource->getDocProperties(), pDestination->getDocProperties()));
+}
+
+}
+
void SwUiWriterTest::testClassificationPaste()
{
SwDocShell* pSourceShell = createDoc()->GetDocShell();
@@ -3236,17 +3246,17 @@ void SwUiWriterTest::testClassificationPaste()
SwDocShell* pDestinationShell = createDoc()->GetDocShell();
// Not classified source, not classified destination.
- CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::None), int(SfxClassificationHelper::CheckPaste(*pSourceShell, *pDestinationShell)));
+ CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::None), checkShells(pSourceShell, pDestinationShell));
// Classified source, not classified destination.
uno::Sequence<beans::PropertyValue> aInternalOnly = comphelper::InitPropertySequence({{"Name", uno::makeAny(OUString("Internal Only"))}});
lcl_dispatchCommand(xSourceComponent, ".uno:ClassificationApply", aInternalOnly);
- CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::TargetDocNotClassified), int(SfxClassificationHelper::CheckPaste(*pSourceShell, *pDestinationShell)));
+ CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::TargetDocNotClassified), checkShells(pSourceShell, pDestinationShell));
// Classified source and classified destination -- internal only has a higher level than confidential.
uno::Sequence<beans::PropertyValue> aConfidential = comphelper::InitPropertySequence({{"Name", uno::makeAny(OUString("Confidential"))}});
lcl_dispatchCommand(mxComponent, ".uno:ClassificationApply", aConfidential);
- CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::DocClassificationTooLow), int(SfxClassificationHelper::CheckPaste(*pSourceShell, *pDestinationShell)));
+ CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::DocClassificationTooLow), checkShells(pSourceShell, pDestinationShell));
xSourceComponent->dispose();
}
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 193cf5a99294..e95449e75137 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -177,7 +177,7 @@ void SwEditShell::SetClassification(const OUString& rName)
if (!pDocShell)
return;
- SfxClassificationHelper aHelper(*pDocShell);
+ SfxClassificationHelper aHelper(pDocShell->getDocProperties());
bool bHadWatermark = !aHelper.GetDocumentWatermark().isEmpty();
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index fa3333207e4a..724a99f1a040 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -3242,7 +3242,7 @@ bool lcl_checkClassification(SwDoc* pSourceDoc, SwDoc* pDestinationDoc)
if (!pSourceShell || !pDestinationShell)
return true;
- switch (SfxClassificationHelper::CheckPaste(*pSourceShell, *pDestinationShell))
+ switch (SfxClassificationHelper::CheckPaste(pSourceShell->getDocProperties(), pDestinationShell->getDocProperties()))
{
case SfxClassificationCheckPasteResult::None:
{