summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorscito <info@scito.ch>2021-05-28 13:56:29 +0200
committerEike Rathke <erack@redhat.com>2021-06-04 12:18:56 +0200
commit940dad058c199c6b6990ad313db5a17758a19c65 (patch)
treeeb1f2d76afda509ad3bd2f7ddc31d733d4dc5b77 /sc
parent6c879cd2dc4517c8ee9dbff0f228f95702e7f88b (diff)
tdf#141683 fix missing flag in multi sel pasted transposed as links
For transpose, the links for option 'as links' will be set during TransposeClip(). Thus, formulas will be created. So, the formula flag must be set for subsequent copying to the document. This flag must be set in the multi range selection code path for transposed as links. I've adapted the tests. Unfortunately, this fix cannot be tested directly with automatic tests. However, the same behavior is applied in the unit tests. Change-Id: Ia16a8371894a784fc7fcfa1c7b5242f552bef956 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116332 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/ucalc_copypaste.cxx40
-rw-r--r--sc/source/ui/view/viewfun3.cxx6
2 files changed, 24 insertions, 22 deletions
diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx
index 18f1bb07c970..f38f59afd74b 100644
--- a/sc/qa/unit/ucalc_copypaste.cxx
+++ b/sc/qa/unit/ucalc_copypaste.cxx
@@ -1059,7 +1059,7 @@ void TestCopyPaste::testCopyPasteSpecialAsLinkFilteredTranspose()
}
// tdf#141683
-// InsertDeleteFlags::CONTENTS
+// InsertDeleteFlags::VALUE
void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkTranspose()
{
const SCTAB srcSheet = 0;
@@ -1090,14 +1090,14 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkTranspose()
// transpose
ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP));
- aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::CONTENTS, true, false);
+ aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::VALUE, true, false);
ScRange aDestRange(1, 1, destSheet, 2, 4, destSheet); // Paste to B2:C5 on Sheet2.
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SetMarkArea(aDestRange);
- m_pDoc->CopyMultiRangeFromClip(ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::CONTENTS,
- pTransClip.get(), true, false /* false fixes tdf#141683 */,
- false, false);
+ m_pDoc->CopyMultiRangeFromClip(
+ ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::VALUE | InsertDeleteFlags::FORMULA,
+ pTransClip.get(), true, false /* false fixes tdf#141683 */, false, false);
pTransClip.reset();
OUString aString;
@@ -1149,7 +1149,7 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkTranspose()
}
// tdf#141683
-// InsertDeleteFlags::CONTENTS
+// InsertDeleteFlags::VALUE
void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose()
{
const SCTAB srcSheet = 0;
@@ -1217,7 +1217,7 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose()
printRange(m_pDoc, aClipParam.getWholeRange(), "Src range");
// transpose
ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP));
- aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::CONTENTS, true, false);
+ aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::VALUE, true, false);
printRange(&aClipDoc, ScRange(0, 0, 0, 4, 5, 0), "Base doc (&aClipDoc)");
printRange(pTransClip.get(), ScRange(0, 0, 0, 3, 3, 0),
@@ -1225,9 +1225,9 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose()
ScRange aDestRange(1, 1, destSheet, 3, 4, destSheet); // Paste to B2:D5 on Sheet2.
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SetMarkArea(aDestRange);
- m_pDoc->CopyMultiRangeFromClip(ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::CONTENTS,
- pTransClip.get(), true, false /* false fixes tdf#141683 */,
- false, false);
+ m_pDoc->CopyMultiRangeFromClip(
+ ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::VALUE | InsertDeleteFlags::FORMULA,
+ pTransClip.get(), true, false /* false fixes tdf#141683 */, false, false);
pTransClip.reset();
printRange(m_pDoc, aDestRange, "Transposed dest sheet");
@@ -1301,7 +1301,7 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose()
}
// tdf#141683
-// InsertDeleteFlags::CONTENTS
+// InsertDeleteFlags::VALUE
void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkTranspose()
{
const SCTAB srcSheet = 0;
@@ -1332,14 +1332,14 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkTranspose()
// transpose
ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP));
- aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::CONTENTS, true, false);
+ aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::VALUE, true, false);
ScRange aDestRange(1, 1, destSheet, 4, 2, destSheet); // Paste to B2:E3 on Sheet2.
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SetMarkArea(aDestRange);
- m_pDoc->CopyMultiRangeFromClip(ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::CONTENTS,
- pTransClip.get(), true, false /* false fixes tdf#141683 */,
- false, false);
+ m_pDoc->CopyMultiRangeFromClip(
+ ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::VALUE | InsertDeleteFlags::FORMULA,
+ pTransClip.get(), true, false /* false fixes tdf#141683 */, false, false);
pTransClip.reset();
OUString aString;
@@ -1391,7 +1391,7 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkTranspose()
}
// tdf#141683
-// InsertDeleteFlags::CONTENTS
+// InsertDeleteFlags::VALUE
void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkFilteredTranspose()
{
const SCTAB srcSheet = 0;
@@ -1446,14 +1446,14 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkFilteredTranspose()
// transpose
ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP));
- aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::CONTENTS, true, false);
+ aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::VALUE, true, false);
ScRange aDestRange(1, 1, destSheet, 4, 2, destSheet); // Paste to B2:E3 on Sheet2.
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SetMarkArea(aDestRange);
- m_pDoc->CopyMultiRangeFromClip(ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::CONTENTS,
- pTransClip.get(), true, false /* false fixes tdf#141683 */,
- false, false);
+ m_pDoc->CopyMultiRangeFromClip(
+ ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::VALUE | InsertDeleteFlags::FORMULA,
+ pTransClip.get(), true, false /* false fixes tdf#141683 */, false, false);
pTransClip.reset();
OUString aString;
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 5f5cb8ac4b36..b4e8744cfe0d 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1578,9 +1578,11 @@ bool ScViewFunc::PasteMultiRangesFromClip(InsertDeleteFlags nFlags, ScDocument*
if (rDoc.IsUndoEnabled())
rDoc.BeginDrawUndo();
- InsertDeleteFlags nNoObjFlags = nFlags & ~InsertDeleteFlags::OBJECTS;
+ InsertDeleteFlags nCopyFlags = nFlags & ~InsertDeleteFlags::OBJECTS;
// in case of transpose, links were added in TransposeClip()
- rDoc.CopyMultiRangeFromClip(rCurPos, aMark, nNoObjFlags, pClipDoc, true, bAsLink && !bTranspose,
+ if (bAsLink && bTranspose)
+ nCopyFlags |= InsertDeleteFlags::FORMULA;
+ rDoc.CopyMultiRangeFromClip(rCurPos, aMark, nCopyFlags, pClipDoc, true, bAsLink && !bTranspose,
bIncludeFiltered, bSkipEmpty);
if (pMixDoc)