From 275443f052887f67a6d459d443293690daa3ae24 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 10 Mar 2016 15:04:25 +0100 Subject: sfx2 classification: merge common code from sw and writerfilter The two versions were almost a duplicate. Change-Id: I3148150d62484a55fc8d59ca354998f211435c0b --- sfx2/source/view/classificationhelper.cxx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'sfx2') diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index 2abcff8eda27..fc1d236d54b1 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include using namespace com::sun::star; @@ -454,6 +455,34 @@ SfxClassificationCheckPasteResult SfxClassificationHelper::CheckPaste(const uno: return SfxClassificationCheckPasteResult::None; } +bool SfxClassificationHelper::ShowPasteInfo(SfxClassificationCheckPasteResult eResult) +{ + switch (eResult) + { + case SfxClassificationCheckPasteResult::None: + { + return true; + } + break; + case SfxClassificationCheckPasteResult::TargetDocNotClassified: + { + if (!Application::IsHeadlessModeEnabled()) + ScopedVclPtrInstance::Create(nullptr, SfxResId(STR_TARGET_DOC_NOT_CLASSIFIED), VCL_MESSAGE_INFO)->Execute(); + return false; + } + break; + case SfxClassificationCheckPasteResult::DocClassificationTooLow: + { + if (!Application::IsHeadlessModeEnabled()) + ScopedVclPtrInstance::Create(nullptr, SfxResId(STR_DOC_CLASSIFICATION_TOO_LOW), VCL_MESSAGE_INFO)->Execute(); + return false; + } + break; + } + + return true; +} + SfxClassificationHelper::SfxClassificationHelper(const uno::Reference& xDocumentProperties) : m_pImpl(o3tl::make_unique(xDocumentProperties)) { -- cgit