diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-03-11 13:40:59 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-03-11 13:42:07 +0100 |
commit | e75979eaed5c417da5f33f7259f070afbaa674b8 (patch) | |
tree | d8406f115779d2c2e8245a31fe476033011064f4 /sc/source | |
parent | 9db5512084bb0df58322d755b7b1770a9779ab57 (diff) |
sc: handle classification during copy&paste
This is the same feature as done for sw and sd internal copy already.
Change-Id: I6b8bd1228510fb2fb65ed1c2ab5e8307c38664b2
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/view/cliputil.cxx | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx index bb4fc02966ce..c79d1738c742 100644 --- a/sc/source/ui/view/cliputil.cxx +++ b/sc/source/ui/view/cliputil.cxx @@ -15,12 +15,34 @@ #include "dpobject.hxx" #include "globstr.hrc" #include "clipparam.hxx" +#include "clipoptions.hxx" #include "rangelst.hxx" #include "viewutil.hxx" #include "markdata.hxx" #include <gridwin.hxx> #include <vcl/waitobj.hxx> +#include <sfx2/classificationhelper.hxx> + +namespace +{ + +/// Paste only if SfxClassificationHelper recommends so. +bool lcl_checkClassification(ScDocument* pSourceDoc, ScDocument* pDestinationDoc) +{ + if (!pSourceDoc || !pDestinationDoc) + return true; + + ScClipOptions* pSourceOptions = pSourceDoc->GetClipOptions(); + SfxObjectShell* pDestinationShell = pDestinationDoc->GetDocumentShell(); + if (!pSourceOptions || !pDestinationShell) + return true; + + SfxClassificationCheckPasteResult eResult = SfxClassificationHelper::CheckPaste(pSourceOptions->m_xDocumentProperties, pDestinationShell->getDocProperties()); + return SfxClassificationHelper::ShowPasteInfo(eResult); +} + +} void ScClipUtil::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, bool bShowDialog ) { @@ -64,9 +86,10 @@ void ScClipUtil::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTab // For multi-range paste, we paste values by default. nFlags &= ~InsertDeleteFlags::FORMULA; - pTabViewShell->PasteFromClip( nFlags, pClipDoc, - ScPasteFunc::NONE, false, false, false, INS_NONE, InsertDeleteFlags::NONE, - bShowDialog ); // allow warning dialog + if (lcl_checkClassification(pClipDoc, pThisDoc)) + pTabViewShell->PasteFromClip( nFlags, pClipDoc, + ScPasteFunc::NONE, false, false, false, INS_NONE, InsertDeleteFlags::NONE, + bShowDialog ); // allow warning dialog } } pTabViewShell->CellContentChanged(); // => PasteFromSystem() ??? |