summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/qa/unit/ucalc.cxx13
-rw-r--r--sc/qa/unit/ucalc.hxx1
-rw-r--r--sc/qa/unit/ucalc_condformat.cxx5
3 files changed, 16 insertions, 3 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 0db6a1c270be..f103f7d10306 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -34,6 +34,7 @@
#include "dbdata.hxx"
#include "reftokenhelper.hxx"
#include "userdat.hxx"
+#include "clipcontext.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
@@ -6135,6 +6136,18 @@ void Test::pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocu
pDestDoc->CopyFromClip(rDestRange, aMark, InsertDeleteFlags::ALL, nullptr, pClipDoc);
}
+void Test::pasteOneCellFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc, InsertDeleteFlags eFlags)
+{
+ ScMarkData aMark;
+ aMark.SetMarkArea(rDestRange);
+ sc::CopyFromClipContext aCxt(*pDestDoc, nullptr, pClipDoc, eFlags, false, false);
+ aCxt.setDestRange(rDestRange.aStart.Col(), rDestRange.aStart.Row(),
+ rDestRange.aEnd.Col(), rDestRange.aEnd.Row());
+ aCxt.setTabRange(rDestRange.aStart.Tab(), rDestRange.aEnd.Tab());
+ pDestDoc->CopyOneCellFromClip(aCxt, rDestRange.aStart.Col(), rDestRange.aStart.Row(),
+ rDestRange.aEnd.Col(), rDestRange.aEnd.Row());
+}
+
ScUndoPaste* Test::createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pUndoDoc)
{
ScDocument& rDoc = rDocSh.GetDocument();
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index b66110c7b7ff..cbc99810634f 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -47,6 +47,7 @@ public:
static void clearSheet(ScDocument* pDoc, SCTAB nTab);
static void copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* pClipDoc);
static void pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc);
+ static void pasteOneCellFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc, InsertDeleteFlags eFlags = InsertDeleteFlags::ALL);
static ScUndoPaste* createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pUndoDoc);
/**
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 93ce111cefd6..66f9a1254dc2 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -317,7 +317,7 @@ void Test::testCondCopyPasteSingleCell()
copyToClip(m_pDoc, ScRange(0,0,0,0,0,0), &aClipDoc);
ScRange aTargetRange(4,4,0,4,4,0);
- pasteFromClip(m_pDoc, aTargetRange, &aClipDoc);
+ pasteOneCellFromClip(m_pDoc, aTargetRange, &aClipDoc);
ScConditionalFormat* pPastedFormat = m_pDoc->GetCondFormat(4,4,0);
CPPUNIT_ASSERT(pPastedFormat);
@@ -349,9 +349,8 @@ void Test::testCondCopyPasteSingleCellToRange()
ScDocument aClipDoc(SCDOCMODE_CLIP);
copyToClip(m_pDoc, ScRange(0,0,0,0,0,0), &aClipDoc);
-
ScRange aTargetRange(4,4,0,5,8,0);
- pasteFromClip(m_pDoc, aTargetRange, &aClipDoc);
+ pasteOneCellFromClip(m_pDoc, aTargetRange, &aClipDoc);
std::set<sal_uLong> aCondFormatIndices;
for(SCROW nRow = 4; nRow <= 8; ++nRow)