sc: handle classification during copy&paste

This is the same feature as done for sw and sd internal copy already.

Change-Id: I6b8bd1228510fb2fb65ed1c2ab5e8307c38664b2
This commit is contained in:
Miklos Vajna
2016-03-11 13:40:59 +01:00
parent 9db5512084
commit e75979eaed

View File

@@ -15,12 +15,34 @@
#include "dpobject.hxx" #include "dpobject.hxx"
#include "globstr.hrc" #include "globstr.hrc"
#include "clipparam.hxx" #include "clipparam.hxx"
#include "clipoptions.hxx"
#include "rangelst.hxx" #include "rangelst.hxx"
#include "viewutil.hxx" #include "viewutil.hxx"
#include "markdata.hxx" #include "markdata.hxx"
#include <gridwin.hxx> #include <gridwin.hxx>
#include <vcl/waitobj.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 ) 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. // For multi-range paste, we paste values by default.
nFlags &= ~InsertDeleteFlags::FORMULA; nFlags &= ~InsertDeleteFlags::FORMULA;
pTabViewShell->PasteFromClip( nFlags, pClipDoc, if (lcl_checkClassification(pClipDoc, pThisDoc))
ScPasteFunc::NONE, false, false, false, INS_NONE, InsertDeleteFlags::NONE, pTabViewShell->PasteFromClip( nFlags, pClipDoc,
bShowDialog ); // allow warning dialog ScPasteFunc::NONE, false, false, false, INS_NONE, InsertDeleteFlags::NONE,
bShowDialog ); // allow warning dialog
} }
} }
pTabViewShell->CellContentChanged(); // => PasteFromSystem() ??? pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???