diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-11-11 11:08:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-11-11 17:24:53 +0100 |
commit | a8a064d11c05feed83f05b0ce8209f7054afd804 (patch) | |
tree | 3a64572d1d12d64b707c50607056f405c3615fcf | |
parent | 33d966ecc1f9fc44016cdeeed15dbaf6bda68eda (diff) |
sc: rowcol: tdf#50916 convert mark data structures
Change-Id: I9b706c9bcc2925f72cc024142ffe72af5ddea82a
Reviewed-on: https://gerrit.libreoffice.org/82419
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
46 files changed, 258 insertions, 231 deletions
diff --git a/sc/inc/markarr.hxx b/sc/inc/markarr.hxx index edc1d7962d9a..97b68b0ac86a 100644 --- a/sc/inc/markarr.hxx +++ b/sc/inc/markarr.hxx @@ -43,12 +43,13 @@ class ScMarkArray SCSIZE nCount; SCSIZE nLimit; std::unique_ptr<ScMarkEntry[]> pData; + SCROW mnMaxRow; friend class ScMarkArrayIter; friend class ScDocument; // for FillInfo public: - ScMarkArray(); + ScMarkArray(SCROW nMaxRow); ScMarkArray( ScMarkArray&& rArray ) noexcept; ScMarkArray( const ScMarkArray& rArray ); ~ScMarkArray(); diff --git a/sc/inc/markdata.hxx b/sc/inc/markdata.hxx index b605c8a1bbf7..5929586036d4 100644 --- a/sc/inc/markdata.hxx +++ b/sc/inc/markdata.hxx @@ -59,11 +59,13 @@ private: ScRangeList aBottomEnvelope; // list of ranges in the bottom envelope of the multi selection ScRangeList aLeftEnvelope; // list of ranges in the left envelope of the multi selection ScRangeList aRightEnvelope; // list of ranges in the right envelope of the multi selection + SCROW mnMaxRow; + SCCOL mnMaxCol; public: - ScMarkData(); + ScMarkData(SCROW nMaxRow, SCCOL nMaxCol); ScMarkData(const ScMarkData& rData); - ScMarkData(const ScRangeList& rList); + ScMarkData(SCROW nMaxRow, SCCOL nMaxCol, const ScRangeList& rList); ~ScMarkData(); ScMarkData& operator=(const ScMarkData& rData); diff --git a/sc/inc/markmulti.hxx b/sc/inc/markmulti.hxx index 386f7b135f5a..cc0363edb798 100644 --- a/sc/inc/markmulti.hxx +++ b/sc/inc/markmulti.hxx @@ -34,11 +34,13 @@ private: typedef std::vector<ScMarkArray> MapType; MapType aMultiSelContainer; ScMarkArray aRowSel; + SCROW mnMaxRow; + SCCOL mnMaxCol; friend class ScMultiSelIter; public: - ScMultiSel(); + ScMultiSel(SCROW nMaxRow, SCCOL nMaxCol); ScMultiSel( const ScMultiSel& rMultiSel ); ~ScMultiSel(); diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index 6f3b0622366b..71adbe5c8c8d 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -88,7 +88,7 @@ void ScCopyPasteTest::testCopyPasteXLS() ScRefFlags nRes = aSrcRange.Parse("B2:C5", &rDoc, rDoc.GetAddressConvention()); CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID)); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aSrcRange); pViewShell->GetViewData().GetMarkData().SetMarkArea(aSrcRange); diff --git a/sc/qa/unit/mark_test.cxx b/sc/qa/unit/mark_test.cxx index ad6124c82530..400392d7873c 100644 --- a/sc/qa/unit/mark_test.cxx +++ b/sc/qa/unit/mark_test.cxx @@ -135,7 +135,7 @@ void Test::testSimpleMark( const ScRange& rRange, const ScRange& rSelectionCover const ScRangeList& rLeftEnvelope, const ScRangeList& rRightEnvelope, const ScRangeList& rTopEnvelope, const ScRangeList& rBottomEnvelope ) { - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); CPPUNIT_ASSERT( !aMark.IsMarked() && !aMark.IsMultiMarked() ); aMark.SetMarkArea( rRange ); @@ -240,8 +240,8 @@ void Test::testSimpleMark_Row() void Test::testMultiMark( const MultiMarkTestData& rMarksData ) { - ScMarkData aMark; - ScMultiSel aMultiSel; + ScMarkData aMark(MAXROW, MAXCOL); + ScMultiSel aMultiSel(MAXROW, MAXCOL); CPPUNIT_ASSERT( !aMark.IsMarked() && !aMark.IsMultiMarked() ); CPPUNIT_ASSERT_EQUAL( SCCOL(0), aMultiSel.GetMultiSelectionCount() ); CPPUNIT_ASSERT( !aMultiSel.HasAnyMarks() ); @@ -817,7 +817,7 @@ void Test::testMultiMark_NegativeMarking() void Test::testInsertTabBeforeSelected() { - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); aMark.InsertTab(0); CPPUNIT_ASSERT_EQUAL(SCTAB(1), aMark.GetSelectCount()); @@ -826,7 +826,7 @@ void Test::testInsertTabBeforeSelected() void Test::testInsertTabAfterSelected() { - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); aMark.InsertTab(1); CPPUNIT_ASSERT_EQUAL(SCTAB(1), aMark.GetSelectCount()); @@ -835,7 +835,7 @@ void Test::testInsertTabAfterSelected() void Test::testDeleteTabBeforeSelected() { - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(1); aMark.DeleteTab(0); CPPUNIT_ASSERT_EQUAL(SCTAB(1), aMark.GetSelectCount()); @@ -844,7 +844,7 @@ void Test::testDeleteTabBeforeSelected() void Test::testDeleteTabAfterSelected() { - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); aMark.DeleteTab(1); CPPUNIT_ASSERT_EQUAL(SCTAB(1), aMark.GetSelectCount()); @@ -863,14 +863,14 @@ void Test::testScMarkArraySearch() { // empty { - ScMarkArray ar; + ScMarkArray ar(MAXROW); testScMarkArraySearch_check(ar, -1, false, 0); testScMarkArraySearch_check(ar, 100, false, 0); } // one range { - ScMarkArray ar; + ScMarkArray ar(MAXROW); ar.SetMarkArea(10, 20, true); // 0-9,10-20,21+ @@ -891,7 +891,7 @@ void Test::testScMarkArraySearch() // three ranges { - ScMarkArray ar; + ScMarkArray ar(MAXROW); ar.SetMarkArea(10, 20, true); ar.SetMarkArea(21, 30, true); ar.SetMarkArea(50, 100, true); @@ -912,7 +912,7 @@ void Test::testScMarkArraySearch() // three single-row ranges { - ScMarkArray ar; + ScMarkArray ar(MAXROW); ar.SetMarkArea(4, 4, true); ar.SetMarkArea(6, 6, true); ar.SetMarkArea(8, 8, true); @@ -932,7 +932,7 @@ void Test::testScMarkArraySearch() // one range { - ScMarkArray ar; + ScMarkArray ar(MAXROW); ar.SetMarkArea(10, MAXROW, true); // 0-10,11+ diff --git a/sc/qa/unit/parallelism.cxx b/sc/qa/unit/parallelism.cxx index 965220e572d6..9af1daaca9e0 100644 --- a/sc/qa/unit/parallelism.cxx +++ b/sc/qa/unit/parallelism.cxx @@ -104,7 +104,7 @@ ScUndoCut* ScParallelismTest::cutToClip(ScDocShell& rDocSh, const ScRange& rRang ScDocument* pSrcDoc = &rDocSh.GetDocument(); ScClipParam aClipParam(rRange, true); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(rRange); pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark, false, false); @@ -135,7 +135,7 @@ ScUndoCut* ScParallelismTest::cutToClip(ScDocShell& rDocSh, const ScRange& rRang void ScParallelismTest::pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc) { - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(rDestRange); pDestDoc->CopyFromClip(rDestRange, aMark, InsertDeleteFlags::ALL, nullptr, pClipDoc); } @@ -884,7 +884,7 @@ void ScParallelismTest::testFormulaGroupsInCyclesAndWithSelfReference() m_pDoc->SetAutoCalc(true); const ScRange aChangeRange(1, 1, 0, 1, 4, 0); // B2:B5 - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Set up clip document. diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 8524db0273ff..cba2aa701ce5 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -798,7 +798,7 @@ void ScFiltersTest::testFormulaDepDeleteContentsODS() // Delete D2:D5. ScDocFunc& rFunc = xDocSh->GetDocFunc(); ScRange aRange(3,1,0,3,4,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aRange); aMark.MarkToMulti(); bool bGood = rFunc.DeleteContents(aMark, InsertDeleteFlags::ALL, true, true); @@ -2832,7 +2832,7 @@ void ScFiltersTest::testOptimalHeightReset() // delete content of A1 ScRange aDelRange(0,0,0,0,0,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aDelRange); bool bRet = rFunc.DeleteContents( aMark, InsertDeleteFlags::ALL, false, true ); CPPUNIT_ASSERT_MESSAGE("DeleteContents failed", bRet); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index e3fdc96c32d4..ae28aadeae31 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -366,7 +366,7 @@ void Test::testRangeList() void Test::testMarkData() { - ScMarkData aMarkData; + ScMarkData aMarkData(MAXROW, MAXCOL); // Empty mark. Nothing is selected. std::vector<sc::ColRowSpan> aSpans = aMarkData.GetMarkedRowSpans(); @@ -599,7 +599,7 @@ void Test::testSelectionFunction() ScRangeList aRanges; aRanges.push_back(ScRange(1,1,0,1,7,0)); // B2:B8 aRanges.push_back(ScRange(3,1,0,3,7,0)); // D2:D8 - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.MarkFromRangeList(aRanges, true); struct Check @@ -658,7 +658,7 @@ void Test::testSelectionFunction() } // Make sure that when no selection is present, use the current cursor position. - ScMarkData aEmpty; + ScMarkData aEmpty(MAXROW, MAXCOL); { // D3 (numeric cell containing 5.) @@ -747,7 +747,7 @@ void Test::testMarkedCellIteration() m_pDoc->SetFormula(ScAddress(2,2,0), "=SUM(1,2,3)", m_pDoc->GetGrammar()); // Select A1:C5. - ScMarkData aMarkData; + ScMarkData aMarkData(MAXROW, MAXCOL); aMarkData.SetMarkArea(ScRange(0,0,0,2,4,0)); aMarkData.MarkToMulti(); // TODO : we shouldn't have to do this. @@ -1881,7 +1881,7 @@ void Test::testMatrixComparisonWithErrors() // Create a matrix formula in B3:B4 referencing A1:A2 and doing a greater // than comparison on it's values. Error value must be propagated. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(1, 2, 1, 3, aMark, "=A1:A2>0"); @@ -1899,7 +1899,7 @@ void Test::testMatrixConditionalBooleanResult() // Create matrix formulas in A1:B1,A2:B2,A3:B3,A4:B4 producing mixed // boolean and numeric results in an unformatted area. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula( 0,0, 1,0, aMark, "=IF({1,0};TRUE();42)"); // {TRUE,42} m_pDoc->InsertMatrixFormula( 0,1, 1,1, aMark, "=IF({0,1};TRUE();42)"); // {42,1} aim for {42,TRUE} @@ -1931,7 +1931,7 @@ void Test::testEnterMixedMatrix() m_pDoc->SetValue(1, 1, 0, val); // Create a matrix range in A4:B5 referencing A1:B2. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(0, 3, 1, 4, aMark, "=A1:B2"); @@ -1958,7 +1958,7 @@ void Test::testMatrixEditable() // A3:A4 is a matrix. ScRange aMatRange(0,2,0,0,3,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aMatRange); m_pDoc->InsertMatrixFormula(0, 2, 0, 3, aMark, "=TRANSPOSE(A1:B1)"); @@ -3340,7 +3340,7 @@ void Test::testCopyPaste() ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO)); pUndoDoc->InitUndo(m_pDoc, 1, 1, true, true); std::unique_ptr<ScUndoPaste> pUndo(createUndoPaste(getDocShell(), aRange, std::move(pUndoDoc))); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aRange); m_pDoc->CopyFromClip(aRange, aMark, InsertDeleteFlags::ALL, nullptr, &aClipDoc); @@ -3466,7 +3466,7 @@ void Test::testCopyPasteAsLink() copyToClip(m_pDoc, aRange, &aClipDoc); aRange = ScRange(1,1,1,1,3,1); // Paste to B2:B4 on Sheet2. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aRange); // Paste range as link. m_pDoc->CopyFromClip(aRange, aMark, InsertDeleteFlags::CONTENTS, nullptr, &aClipDoc, true, true); @@ -3525,7 +3525,7 @@ void Test::testCopyPasteTranspose() aNewClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::ALL, false); ScRange aDestRange(3,1,1,3,3,1);//target: Sheet2.D2:D4 - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aDestRange); m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::ALL, nullptr, pTransClip.get()); pTransClip.reset(); @@ -3580,7 +3580,7 @@ void Test::testCopyPasteMultiRange() } } - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Copy A2:B2, A4:B4, and A6:B6 to clipboard. @@ -3677,7 +3677,7 @@ void Test::testCopyPasteSkipEmpty() ScRange aSrcRange(0,0,0,0,4,0); ScRange aDestRange(1,0,0,1,4,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aDestRange); // Put some texts in B1:B5. @@ -3810,7 +3810,7 @@ void Test::testCopyPasteSkipEmpty2() // Paste to A3 with the skip empty option set. This used to freeze. (fdo#77735) ScRange aDestRange(0,2,0,2,2,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aDestRange); m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::ALL, nullptr, &aClipDoc, false, false, true, true); @@ -3834,7 +3834,7 @@ void Test::testCutPasteRefUndo() // A2 references B2. m_pDoc->SetString(ScAddress(0,1,0), "=B2"); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Set up clip document for cutting of B2. @@ -3911,7 +3911,7 @@ void Test::testCutPasteGroupRefUndo() CPPUNIT_ASSERT_EQUAL_MESSAGE("Initial formula failure", OUString::createFromAscii(aDataCheck[i][1]), aString); } - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Set up clip document. @@ -4034,7 +4034,7 @@ void Test::testUndoCut() CPPUNIT_ASSERT_EQUAL(111.0, m_pDoc->GetValue(0,3,0)); // Select A1:A3. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); ScRange aRange(0,0,0,0,2,0); aMark.SetMarkArea(aRange); aMark.MarkToMulti(); @@ -4148,7 +4148,7 @@ void Test::testCopyPasteRelativeFormula() // Select and copy B3:B4 to the clipboard. ScRange aRange(1,2,0,1,3,0); ScClipParam aClipParam(aRange, false); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aRange); ScDocument aClipDoc(SCDOCMODE_CLIP); m_pDoc->CopyToClip(aClipParam, &aClipDoc, &aMark, false, false); @@ -4203,7 +4203,7 @@ void Test::testCopyPasteRepeatOneFormula() m_pDoc->InsertTab(0, "Test"); ScDocument aClipDoc(SCDOCMODE_CLIP); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); // Insert values in A1:B10. for (SCROW i = 0; i < 10; ++i) @@ -4359,7 +4359,7 @@ void Test::testMergedCells() m_pDoc->ExtendMerge( 1, 1, nEndCol, nEndRow, 0); CPPUNIT_ASSERT_MESSAGE("did not merge cells", nEndCol == 3 && nEndRow == 3); ScRange aRange(0,2,0,MAXCOL,2,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aRange); getDocShell().GetDocFunc().InsertCells(aRange, &aMark, INS_INSROWS_BEFORE, true, true); m_pDoc->ExtendMerge(1, 1, nEndCol, nEndRow, 0); @@ -4546,7 +4546,7 @@ void Test::testSearchCells() SvxSearchItem aItem(SID_SEARCH_ITEM); aItem.SetSearchString("A"); aItem.SetCommand(SvxSearchCmd::FIND_ALL); - ScMarkData aMarkData; + ScMarkData aMarkData(MAXROW, MAXCOL); aMarkData.SelectOneTable(0); SCCOL nCol = 0; SCROW nRow = 0; @@ -4686,7 +4686,7 @@ void Test::testAutoFill() m_pDoc->SetValue(0,0,0,1); - ScMarkData aMarkData; + ScMarkData aMarkData(MAXROW, MAXCOL); aMarkData.SelectTable(0, true); m_pDoc->Fill( 0, 0, 0, 0, nullptr, aMarkData, 5); @@ -4806,7 +4806,7 @@ void Test::testAutoFillSimple() m_pDoc->SetValue(0, 0, 0, 1); m_pDoc->SetString(0, 1, 0, "=10"); - ScMarkData aMarkData; + ScMarkData aMarkData(MAXROW, MAXCOL); aMarkData.SelectTable(0, true); m_pDoc->Fill( 0, 0, 0, 1, nullptr, aMarkData, 6, FILL_TO_BOTTOM, FILL_AUTO); @@ -4896,13 +4896,13 @@ void Test::testCopyPasteFormulasExternalDoc() ScRange aRange(0,0,0,0,5,0); ScClipParam aClipParam(aRange, false); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aRange); ScDocument aClipDoc(SCDOCMODE_CLIP); m_pDoc->CopyToClip(aClipParam, &aClipDoc, &aMark, false, false); aRange = ScRange(1,1,1,1,6,1); - ScMarkData aMarkData2; + ScMarkData aMarkData2(MAXROW, MAXCOL); aMarkData2.SetMarkArea(aRange); rExtDoc.CopyFromClip(aRange, aMarkData2, InsertDeleteFlags::ALL, nullptr, &aClipDoc); @@ -4951,13 +4951,13 @@ void Test::testCopyPasteReferencesExternalDoc() ScRange aRange(0,2,0,0,5,0); ScClipParam aClipParam(aRange, false); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aRange); ScDocument aClipDoc(SCDOCMODE_CLIP); m_pDoc->CopyToClip(aClipParam, &aClipDoc, &aMark, false, false); aRange = ScRange(0,0,0,0,3,0); - ScMarkData aMarkData2; + ScMarkData aMarkData2(MAXROW, MAXCOL); aMarkData2.SetMarkArea(aRange); rExtDoc.CopyFromClip(aRange, aMarkData2, InsertDeleteFlags::ALL, nullptr, &aClipDoc); @@ -5258,7 +5258,7 @@ void Test::testNoteDeleteRow() // Delete row 2. ScDocFunc& rDocFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); rDocFunc.DeleteCells(ScRange(0,1,0,MAXCOL,1,0), &aMark, DelCellCmd::CellsUp, true); @@ -5362,7 +5362,7 @@ void Test::testNoteLifeCycle() ScClipParam aClipParam(aPos, false); ScDocument aClipDoc(SCDOCMODE_CLIP); - ScMarkData aMarkData; + ScMarkData aMarkData(MAXROW, MAXCOL); aMarkData.SelectOneTable(0); m_pDoc->CopyToClip(aClipParam, &aClipDoc, &aMarkData, false, true); @@ -5497,7 +5497,7 @@ void Test::testNoteCopyPaste() pNote->SetText(aPos, "Note2"); // Copy B2:B4 to clipboard. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); ScRange aCopyRange(1,1,0,1,3,0); ScDocument aClipDoc(SCDOCMODE_CLIP); @@ -5988,7 +5988,7 @@ void Test::testDeleteContents() // Delete D2:D6. ScRange aRange(3,1,0,3,5,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); aMark.SetMarkArea(aRange); @@ -6019,7 +6019,7 @@ void Test::testTransliterateText() m_pDoc->SetString(ScAddress(0,2,0), "Oscar"); // Change them to uppercase. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(ScRange(0,0,0,0,2,0)); ScDocFunc& rFunc = getDocShell().GetDocFunc(); rFunc.TransliterateText( @@ -6396,7 +6396,7 @@ void Test::testCopyPasteMatrixFormula() m_pDoc->SetValue(ScAddress(3,2,0), 11.0); // D3 // Insert matrix formula to A1 - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(0, 0, 0, 0, aMark, "=COUNTIF(ISBLANK(B1:D1);TRUE())"); m_pDoc->CalcAll(); @@ -6480,7 +6480,7 @@ void Test::testUndoDataAnchor() //pDrawLayer->BeginCalcUndo(false); // Insert a new row at row 3. ScDocFunc& rFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); rFunc.InsertCells(ScRange( 0, aOldStart.Row() - 1, 0, MAXCOL, aOldStart.Row(), 0 ), &aMark, INS_INSROWS_BEFORE, true, true); @@ -6680,7 +6680,7 @@ void Test::printRange(ScDocument* pDoc, const ScRange& rRange, const char* pCapt void Test::clearRange(ScDocument* pDoc, const ScRange& rRange) { - ScMarkData aMarkData; + ScMarkData aMarkData(MAXROW, MAXCOL); aMarkData.SetMarkArea(rRange); pDoc->DeleteArea( rRange.aStart.Col(), rRange.aStart.Row(), @@ -6698,7 +6698,7 @@ ScUndoCut* Test::cutToClip(ScDocShell& rDocSh, const ScRange& rRange, ScDocument ScDocument* pSrcDoc = &rDocSh.GetDocument(); ScClipParam aClipParam(rRange, true); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(rRange); pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark, false, false); @@ -6730,21 +6730,21 @@ ScUndoCut* Test::cutToClip(ScDocShell& rDocSh, const ScRange& rRange, ScDocument void Test::copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* pClipDoc) { ScClipParam aClipParam(rRange, false); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(rRange); pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark, false, false); } void Test::pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc) { - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(rDestRange); pDestDoc->CopyFromClip(rDestRange, aMark, InsertDeleteFlags::ALL, nullptr, pClipDoc); } void Test::pasteOneCellFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc, InsertDeleteFlags eFlags) { - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(rDestRange); sc::CopyFromClipContext aCxt(*pDestDoc, nullptr, pClipDoc, eFlags, false, false); aCxt.setDestRange(rDestRange.aStart.Col(), rDestRange.aStart.Row(), @@ -6757,7 +6757,7 @@ void Test::pasteOneCellFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScUndoPaste* Test::createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, ScDocumentUniquePtr pUndoDoc) { ScDocument& rDoc = rDocSh.GetDocument(); - ScMarkData aMarkData; + ScMarkData aMarkData(MAXROW, MAXCOL); aMarkData.SetMarkArea(rRange); std::unique_ptr<ScRefUndoData> pRefUndoData(new ScRefUndoData(&rDoc)); @@ -7004,7 +7004,7 @@ void Test::testProtectedSheetEditByRow() // Try to delete row 3. It should fail. ScRange aRow3(0,2,0,MAXCOL,2,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); bool bDeleted = rDocFunc.DeleteCells(aRow3, &aMark, DelCellCmd::Rows, true); CPPUNIT_ASSERT_MESSAGE("deletion of row 3 should fail.", !bDeleted); @@ -7042,7 +7042,7 @@ void Test::testProtectedSheetEditByRow() { // Insert matrix into B2:C3. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(1); m_pDoc->InsertMatrixFormula(1, 1, 2, 2, aMark, "={1;2|3;4}"); @@ -7080,7 +7080,7 @@ void Test::testProtectedSheetEditByColumn() // Try to delete column C. It should fail. ScRange aCol3(2,0,0,2,MAXROW,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); bool bDeleted = rDocFunc.DeleteCells(aCol3, &aMark, DelCellCmd::Cols, true); CPPUNIT_ASSERT_MESSAGE("deletion of column 3 should fail.", !bDeleted); @@ -7118,7 +7118,7 @@ void Test::testProtectedSheetEditByColumn() { // Insert matrix into B2:C3. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(1); m_pDoc->InsertMatrixFormula(1, 1, 2, 2, aMark, "={1;2|3;4}"); diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index 7392943f7f3e..6fbcb54a4880 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -33,7 +33,7 @@ void Test::testCopyPasteSkipEmptyConditionalFormatting() ScRange aDestRange(0,0,0,1,2,0); ScRange aSrcRange(3,3,0,5,4,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(aDestRange); m_pDoc->SetValue(0,0,0,1); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 7952c0c46e58..6bbe59d067ea 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -1260,7 +1260,7 @@ void Test::testFormulaCompilerImplicitIntersection1ParamNoChange() { if (rCase.bMatrixFormula) { - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); SCCOL nColStart = rCase.aCellAddress.Col(); SCROW nRowStart = rCase.aCellAddress.Row(); @@ -2241,7 +2241,7 @@ void Test::testFormulaRefUpdateInsertRows() CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,4,0))); // Insert rows over rows 1:2. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); ScDocFunc& rFunc = getDocShell().GetDocFunc(); rFunc.InsertCells(ScRange(0,0,0,m_pDoc->MaxCol(),1,0), &aMark, INS_INSROWS_BEFORE, false, true); @@ -2396,7 +2396,7 @@ void Test::testFormulaRefUpdateInsertColumns() CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(2,3,0))); // Insert columns over A:B. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); ScDocFunc& rFunc = getDocShell().GetDocFunc(); rFunc.InsertCells(ScRange(0,0,0,1,m_pDoc->MaxRow(),0), &aMark, INS_INSCOLS_BEFORE, false, true); @@ -2994,7 +2994,7 @@ void Test::testFormulaRefUpdateDeleteContent() // Delete B2. ScDocFunc& rFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(ScAddress(1,1,0)); rFunc.DeleteContents(aMark, InsertDeleteFlags::CONTENTS, true, true); @@ -3034,7 +3034,7 @@ void Test::testFormulaRefUpdateDeleteAndShiftLeft() CPPUNIT_ASSERT_EQUAL(15.0, m_pDoc->GetValue(aPos)); // Delete columns D:E (middle of the reference). - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); ScDocFunc& rFunc = getDocShell().GetDocFunc(); bool bDeleted = rFunc.DeleteCells(ScRange(3,0,0,4,m_pDoc->MaxRow(),0), &aMark, DelCellCmd::CellsLeft, true); @@ -3169,7 +3169,7 @@ void Test::testFormulaRefUpdateDeleteAndShiftLeft2() funcCheckOriginal(); // Delete Column A. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); ScDocFunc& rFunc = getDocShell().GetDocFunc(); bool bDeleted = rFunc.DeleteCells(ScRange(0,0,0,0,m_pDoc->MaxRow(),0), &aMark, DelCellCmd::CellsLeft, true); @@ -3208,7 +3208,7 @@ void Test::testFormulaRefUpdateDeleteAndShiftUp() CPPUNIT_ASSERT_EQUAL(15.0, m_pDoc->GetValue(aPos)); // Delete rows 4:5 (middle of the reference). - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); ScDocFunc& rFunc = getDocShell().GetDocFunc(); bool bDeleted = rFunc.DeleteCells(ScRange(0,3,0,m_pDoc->MaxCol(),4,0), &aMark, DelCellCmd::CellsUp, true); @@ -3549,7 +3549,7 @@ void Test::testFormulaRefUpdateNameExpandRef() // Insert a new row at row 4, which should expand the named range to A1:A4. ScDocFunc& rFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); rFunc.InsertCells(ScRange(0,3,0,m_pDoc->MaxCol(),3,0), &aMark, INS_INSROWS_BEFORE, false, true); ScRangeData* pName = m_pDoc->GetRangeName()->findByUpperName("MYRANGE"); @@ -3663,7 +3663,7 @@ void Test::testFormulaRefUpdateNameExpandRef2() // Insert a new row at row 4, which should expand the named range to A1:A4. ScDocFunc& rFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Insert a new column at column 3, which should expand the named @@ -3708,7 +3708,7 @@ void Test::testFormulaRefUpdateNameDeleteRow() ScDocFunc& rFunc = getDocShell().GetDocFunc(); // Delete row 3. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); rFunc.DeleteCells(ScRange(0,2,0,m_pDoc->MaxCol(),2,0), &aMark, DelCellCmd::CellsUp, true); @@ -3773,7 +3773,7 @@ void Test::testFormulaRefUpdateNameDeleteRow() m_pDoc->InsertTab(1, "test2"); - ScMarkData aMark2; + ScMarkData aMark2(MAXROW, MAXCOL); aMark2.SelectOneTable(1); rFunc.DeleteCells(ScRange(0,2,1,m_pDoc->MaxCol(),2,1), &aMark2, DelCellCmd::CellsUp, true); @@ -4094,7 +4094,7 @@ void Test::testFormulaRefUpdateValidity() CPPUNIT_ASSERT_MESSAGE("Initial list is incorrect.", bGood); ScDocFunc& rFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Insert a new column at Column B, to move the list from C2:C4 to D2:D4. @@ -4218,7 +4218,7 @@ void Test::testMultipleOperations() aParam.aRefFormulaCell = ScRefAddress(1,0,0); aParam.aRefFormulaEnd = aParam.aRefFormulaCell; aParam.aRefColCell = ScRefAddress(0,0,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SetMarkArea(ScRange(0,2,0,1,4,0)); // Select A3:B5. m_pDoc->InsertTableOp(aParam, 0, 2, 1, 4, aMark); CPPUNIT_ASSERT_EQUAL(20.0, m_pDoc->GetValue(1,2,0)); @@ -4303,7 +4303,7 @@ void Test::testFuncCOUNT() CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(aPos)); // Matrix in C1. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(2, 0, 2, 0, aMark, "=COUNT(SEARCH(\"a\";{\"a\";\"b\";\"a\"}))"); // Check that the #VALUE! error of "a" not found in "b" is not counted. @@ -4408,7 +4408,7 @@ void Test::testFuncROW() // Insert a new row at row 4. ScDocFunc& rFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); rFunc.InsertCells(ScRange(0,3,0,m_pDoc->MaxCol(),3,0), &aMark, INS_INSROWS_BEFORE, false, true); ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "ROW(A6)", "Wrong formula!"); @@ -4620,7 +4620,7 @@ void Test::testFuncMIN() m_pDoc->SetValue(ScAddress(1,1,0), 2.0); // Matrix in C1:C2. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(2, 0, 2, 1, aMark, "=MIN(IF(A1:A2=\"c\";B1:B2))"); @@ -4832,7 +4832,7 @@ void Test::testFuncCOUNTIF() // Another test case adopted from tdf#99291, empty array elements should // not match empty cells, but cells with 0. clearSheet(m_pDoc, 0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(0,0, 0,1, aMark, "=COUNTIF(B1:B5;C1:C2)"); // As we will be testing for 0.0 values, check that formulas are actually present. @@ -4870,7 +4870,7 @@ void Test::testFuncIF() CPPUNIT_ASSERT_EQUAL(OUString("not two"), m_pDoc->GetString(ScAddress(0,0,0))); // Test nested IF in array/matrix if the nested IF condition is a scalar. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(0,2, 1,2, aMark, "=IF({1;0};IF(1;23);42)"); // Results must be 23 and 42. @@ -4987,7 +4987,7 @@ void Test::testFuncIFERROR() // Create a matrix range in last two rows of the range above, actual data // of the placeholders. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(0, 20 + nRows-2, 0, 20 + nRows-1, aMark, "=IFERROR(3*A11:A12;1998)"); @@ -5170,7 +5170,7 @@ void Test::testFuncLEN() // Leave A1:A3 empty, and insert an array of LEN in B1:B3 that references // these empty cells. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(1, 0, 1, 2, aMark, "=LEN(A1:A3)"); @@ -6118,7 +6118,7 @@ void Test::testFormulaDepTrackingDeleteRow() // Delete row 2. ScDocFunc& rFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); rFunc.DeleteCells(ScRange(0,1,0,m_pDoc->MaxCol(),1,0), &aMark, DelCellCmd::CellsUp, true); @@ -6176,7 +6176,7 @@ void Test::testFormulaDepTrackingDeleteCol() // Delete column A. A1, B1, A3:A4 and B3:B4 should all show #REF!. ScDocFunc& rFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); rFunc.DeleteCells(ScRange(0,0,0,0,m_pDoc->MaxRow(),0), &aMark, DelCellCmd::CellsLeft, true); @@ -6261,7 +6261,7 @@ void Test::testFormulaMatrixResultUpdate() // Set a numeric value to A1. m_pDoc->SetValue(ScAddress(0,0,0), 11.0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(1, 0, 1, 0, aMark, "=A1"); CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(ScAddress(1,0,0))); @@ -6633,7 +6633,7 @@ void Test::testExternalRefFunctions() FormulaError nErr = pFC->GetErrCode(); CPPUNIT_ASSERT_EQUAL_MESSAGE("huge external range reference expected to yield FormulaError::MatrixSize", int(FormulaError::MatrixSize), static_cast<int>(nErr)); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(0,0,0,0, aMark, "'file:///extdata.fake'#Data.B1:AMJ1048575"); pFC = m_pDoc->GetFormulaCell( ScAddress(0,0,0)); @@ -6890,7 +6890,7 @@ void Test::testFuncFORMULA() } // Matrix in D4:D6, no intersection with B1:B3 - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(3, 3, 3, 5, aMark, "=FORMULA(B1:B3)"); for (size_t i=0; i < SAL_N_ELEMENTS(aChecks); ++i) @@ -6906,7 +6906,7 @@ void Test::testFuncTableRef() sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc. m_pDoc->InsertTab(0, "Sheet1"); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); ScDocFunc& rDocFunc = getDocShell().GetDocFunc(); @@ -8120,7 +8120,7 @@ void Test::testFormulaErrorPropagation() m_pDoc->InsertTab(0, "Sheet1"); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); ScAddress aPos, aPos2; const OUString aTRUE("TRUE"); @@ -8213,7 +8213,7 @@ public: std::function<double(SCROW )> const & lExpected ) const { ScDocument aClipDoc(SCDOCMODE_CLIP); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); ScAddress aPos(nColumn, m_nStart1, 0); m_pDoc->SetString(aPos, rFormula); @@ -8334,7 +8334,7 @@ void Test::testTdf97587() } ScDocument aClipDoc(SCDOCMODE_CLIP); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); ScAddress aPos(1, 0, 0); m_pDoc->SetString(aPos, "=SUM(A1:A10)"); @@ -8372,7 +8372,7 @@ void Test::testMatConcat() } } - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(0, 12, 9, 21, aMark, "=A1:J10&A1:J10"); @@ -8435,7 +8435,7 @@ void Test::testMatConcatReplication() } } - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(0, 12, 9, 21, aMark, "=A1:J10&A1:J1"); @@ -8607,7 +8607,7 @@ void Test::testFuncSUMIFS() insertRangeData(m_pDoc, ScAddress(0,0,0), aData); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Matrix formula in C8:C10 with SUMIFS m_pDoc->InsertMatrixFormula(2, 7, 2, 9, aMark, "=SUMIFS(B1:B7;A1:A7;A9:A11)"); @@ -8768,7 +8768,7 @@ void Test::testFuncRefListArraySUBTOTAL() m_pDoc->SetValue(0,5,0, 32.0); // A6 // Matrix in B7:B9, individual SUM of A2:A3, A3:A4 and A4:A5 - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(1, 6, 1, 8, aMark, "=SUBTOTAL(9;OFFSET(A1;ROW(1:3);0;2))"); ScAddress aPos(1,6,0); @@ -8888,7 +8888,7 @@ void Test::testFuncJumpMatrixArrayIF() }; // A7:B9 insertRangeData(m_pDoc, ScAddress(0,6,0), aData); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Matrix in C10, summing B7,B9 @@ -8917,7 +8917,7 @@ void Test::testFuncJumpMatrixArrayOFFSET() }; insertRangeData(m_pDoc, ScAddress(0,0,0), aData); // A1:A3 - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Matrix in C5:C7, COLUMN()-3 here offsets by 0 but the entire expression diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 5086af6515ee..7cb85e8c9bbf 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -675,7 +675,7 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow() // Delete row 3. This will merge the two formula groups. ScDocFunc& rFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); rFunc.DeleteCells(ScRange(0,2,0,MAXCOL,2,0), &aMark, DelCellCmd::Rows, true); @@ -788,7 +788,7 @@ void Test::testSharedFormulasRefUpdateExternal() // Delete rows 1 and 2. This should not change the references in the formula cells below. ScDocFunc& rDocFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); rDocFunc.DeleteCells(ScRange(0,0,0,MAXCOL,1,0), &aMark, DelCellCmd::CellsUp, true); @@ -902,7 +902,7 @@ void Test::testSharedFormulasInsertRow() // Insert a new row at row 3. ScDocFunc& rFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); rFunc.InsertCells(ScRange(0,2,0,MAXCOL,2,0), &aMark, INS_INSROWS_BEFORE, true, true); @@ -1023,7 +1023,7 @@ void Test::testSharedFormulasDeleteColumns() FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); ScDocFunc& rFunc = getDocShell().GetDocFunc(); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // First, test a single cell case. A value in B1 and formula in C1. @@ -2262,7 +2262,7 @@ void Test::testSharedFormulaUpdateOnReplacement() // Set up an undo object for deleting A4. ScRange aUndoRange(0,3,0,0,3,0); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); aMark.SetMultiMarkArea(aUndoRange); ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO)); @@ -2404,7 +2404,7 @@ void Test::testSharedFormulaDeleteTopCell() CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue( ScAddress(0,1,0))); // Delete cell A1. - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); getDocShell().GetDocFunc().DeleteCell( ScAddress(0,0,0), aMark, InsertDeleteFlags::CONTENTS, false); // Check it's gone. @@ -2439,7 +2439,7 @@ void Test::testSharedFormulaCutCopyMoveIntoRef() const ScAddress aOrgPos(0,0,0); insertRangeData( m_pDoc, aOrgPos, aData); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Set up clip document. @@ -2486,7 +2486,7 @@ void Test::testSharedFormulaCutCopyMoveIntoRef() aPos.IncRow(); } - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Set up clip document. @@ -2553,7 +2553,7 @@ void Test::testSharedFormulaCutCopyMoveWithRef() const ScAddress aOrgPos(0,0,0); insertRangeData( m_pDoc, aOrgPos, aData); - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); ScAddress aPos( ScAddress::UNINITIALIZED); @@ -2647,7 +2647,7 @@ void Test::testSharedFormulaCutCopyMoveWithinRun() aPos.IncRow(); } - ScMarkData aMark; + ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); // Set up clip document. diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 97626a397e87..14302b32e90f 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -2231,7 +2231,7 @@ ScRangeList ScConditionalFormatList::GetCombinedRange() const void ScConditionalFormatList::RemoveFromDocument(ScDocument* pDoc) const { ScRangeList aRange = GetCombinedRange(); - ScMarkData aMark; + ScMarkData aMark(pDoc->MaxRow(), pDoc->MaxCol()); aMark.MarkFromRangeList(aRange, true); sal_uInt16 const pItems[2] = { sal_uInt16(ATTR_CONDITIONAL),0}; pDoc->ClearSelectionItems(pItems, aMark); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index ca62ddab9235..7271fdef0d43 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -105,6 +105,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : pFormulaTrack( nullptr ), pEOFormulaTrack( nullptr ), pPreviewCellStyle( nullptr ), + maPreviewSelection(MAXROW, MAXCOL), nUnoObjectId( 0 ), nRangeOverflowType( 0 ), aCurTextWidthCalcPos(MaxCol(),0,0), diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx index 3db2c9544b2d..83aca1a37d2f 100644 --- a/sc/source/core/data/markarr.cxx +++ b/sc/source/core/data/markarr.cxx @@ -24,9 +24,10 @@ #include <osl/diagnose.h> -ScMarkArray::ScMarkArray() : +ScMarkArray::ScMarkArray(SCROW nMaxRow) : nCount( 0 ), - nLimit( 0 ) + nLimit( 0 ), + mnMaxRow( nMaxRow ) { // special case "no marks" with pData = NULL } @@ -56,7 +57,7 @@ void ScMarkArray::Reset( bool bMarked, SCSIZE nNeeded ) nLimit = nNeeded; nCount = 1; pData.reset( new ScMarkEntry[nNeeded] ); - pData[0].nRow = MAXROW; + pData[0].nRow = mnMaxRow; pData[0].bMarked = bMarked; } @@ -111,7 +112,7 @@ void ScMarkArray::SetMarkArea( SCROW nStartRow, SCROW nEndRow, bool bMarked ) { if (ValidRow(nStartRow) && ValidRow(nEndRow)) { - if ((nStartRow == 0) && (nEndRow == MAXROW)) + if ((nStartRow == 0) && (nEndRow == mnMaxRow)) { Reset(bMarked); } @@ -143,7 +144,7 @@ void ScMarkArray::SetMarkArea( SCROW nStartRow, SCROW nEndRow, bool bMarked ) } SCSIZE ni; // number of entries in beginning - SCSIZE nInsert; // insert position (MAXROW+1 := no insert) + SCSIZE nInsert; // insert position (mnMaxRow+1 := no insert) bool bCombined = false; bool bSplit = false; if ( nStartRow > 0 ) @@ -254,7 +255,7 @@ void ScMarkArray::Set( const std::vector<ScMarkEntry> & rMarkEntries ) nLimit = nCount; pData.reset( new ScMarkEntry[nLimit] ); memcpy(pData.get(), rMarkEntries.data(), sizeof(ScMarkEntry) * rMarkEntries.size()); - pData[nCount-1] = ScMarkEntry{MAXROW, false}; + pData[nCount-1] = ScMarkEntry{mnMaxRow, false}; } bool ScMarkArray::IsAllMarked( SCROW nStartRow, SCROW nEndRow ) const @@ -279,7 +280,7 @@ bool ScMarkArray::HasOneMark( SCROW& rStartRow, SCROW& rEndRow ) const if ( pData[0].bMarked ) { rStartRow = 0; - rEndRow = MAXROW; + rEndRow = mnMaxRow; bRet = true; } } @@ -293,7 +294,7 @@ bool ScMarkArray::HasOneMark( SCROW& rStartRow, SCROW& rEndRow ) const else { rStartRow = pData[0].nRow + 1; - rEndRow = MAXROW; + rEndRow = mnMaxRow; } bRet = true; } @@ -335,6 +336,7 @@ ScMarkArray& ScMarkArray::operator=( const ScMarkArray& rOther ) pData.reset(); nCount = nLimit = rOther.nCount; + mnMaxRow = rOther.mnMaxRow; return *this; } @@ -343,6 +345,7 @@ ScMarkArray& ScMarkArray::operator=(ScMarkArray&& rOther) noexcept nCount = rOther.nCount; nLimit = rOther.nLimit; pData = std::move( rOther.pData ); + mnMaxRow = rOther.mnMaxRow; rOther.nCount = 0; rOther.nLimit = 0; return *this; @@ -398,7 +401,7 @@ SCROW ScMarkArray::GetMarkEnd( SCROW nRow, bool bUp ) const void ScMarkArray::Shift(SCROW nStartRow, long nOffset) { - if (!pData || nOffset == 0 || nStartRow > MAXROW) + if (!pData || nOffset == 0 || nStartRow > mnMaxRow) return; for (size_t i=0; i < nCount; ++i) @@ -412,9 +415,9 @@ void ScMarkArray::Shift(SCROW nStartRow, long nOffset) { rEntry.nRow = 0; } - else if (rEntry.nRow > MAXROW) + else if (rEntry.nRow > mnMaxRow) { - rEntry.nRow = MAXROW; + rEntry.nRow = mnMaxRow; } } } diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx index 33c833e191ec..66f067648bb1 100644 --- a/sc/source/core/data/markdata.cxx +++ b/sc/source/core/data/markdata.cxx @@ -32,9 +32,11 @@ #include <mdds/flat_segment_tree.hpp> -ScMarkData::ScMarkData() : +ScMarkData::ScMarkData(SCROW nMaxRow, SCCOL nMaxCol) : maTabMarked(), - aMultiSel() + aMultiSel(nMaxRow, nMaxCol), + mnMaxRow(nMaxRow), + mnMaxCol(nMaxCol) { ResetMark(); } @@ -47,7 +49,9 @@ ScMarkData::ScMarkData(const ScMarkData& rData) : aTopEnvelope( rData.aTopEnvelope ), aBottomEnvelope( rData.aBottomEnvelope ), aLeftEnvelope( rData.aLeftEnvelope ), - aRightEnvelope( rData.aRightEnvelope ) + aRightEnvelope( rData.aRightEnvelope ), + mnMaxRow( rData.mnMaxRow ), + mnMaxCol( rData.mnMaxCol ) { bMarked = rData.bMarked; bMultiMarked = rData.bMultiMarked; @@ -73,6 +77,8 @@ ScMarkData& ScMarkData::operator=(const ScMarkData& rData) maTabMarked = rData.maTabMarked; aMultiSel = rData.aMultiSel; + mnMaxRow = rData.mnMaxRow; + mnMaxCol = rData.mnMaxCol; return *this; } @@ -305,10 +311,10 @@ bool ScMarkData::IsColumnMarked( SCCOL nCol ) const if ( bMarked && !bMarkIsNeg && aMarkRange.aStart.Col() <= nCol && aMarkRange.aEnd.Col() >= nCol && - aMarkRange.aStart.Row() == 0 && aMarkRange.aEnd.Row() == MAXROW ) + aMarkRange.aStart.Row() == 0 && aMarkRange.aEnd.Row() == mnMaxRow ) return true; - if ( bMultiMarked && aMultiSel.IsAllMarked( nCol, 0, MAXROW ) ) + if ( bMultiMarked && aMultiSel.IsAllMarked( nCol, 0, mnMaxRow ) ) return true; return false; @@ -320,7 +326,7 @@ bool ScMarkData::IsRowMarked( SCROW nRow ) const //TODO: GetMarkRowRanges for completely marked rows if ( bMarked && !bMarkIsNeg && - aMarkRange.aStart.Col() == 0 && aMarkRange.aEnd.Col() == MAXCOL && + aMarkRange.aStart.Col() == 0 && aMarkRange.aEnd.Col() == mnMaxCol && aMarkRange.aStart.Row() <= nRow && aMarkRange.aEnd.Row() >= nRow ) return true; @@ -359,7 +365,10 @@ void ScMarkData::MarkFromRangeList( const ScRangeList& rList, bool bReset ) /** Optimise the case of constructing from a range list, speeds up import. */ -ScMarkData::ScMarkData(const ScRangeList& rList) +ScMarkData::ScMarkData(SCROW nMaxRow, SCCOL nMaxCol, const ScRangeList& rList) + : aMultiSel(nMaxRow, nMaxCol), + mnMaxRow(nMaxRow), + mnMaxCol(nMaxCol) { ResetMark(); @@ -470,7 +479,7 @@ std::vector<sc::ColRowSpan> ScMarkData::GetMarkedRowSpans() const typedef mdds::flat_segment_tree<SCCOLROW, bool> SpansType; ScRangeList aRanges = GetMarkedRanges(); - SpansType aSpans(0, MAXROW+1, false); + SpansType aSpans(0, mnMaxRow+1, false); SpansType::const_iterator itPos = aSpans.begin(); for (size_t i = 0, n = aRanges.size(); i < n; ++i) @@ -493,7 +502,7 @@ std::vector<sc::ColRowSpan> ScMarkData::GetMarkedColSpans() const { // Use segment tree to merge marked with multi marked. typedef mdds::flat_segment_tree<SCCOLROW, bool> SpansType; - SpansType aSpans(0, MAXCOL+1, false); + SpansType aSpans(0, mnMaxCol+1, false); SpansType::const_iterator itPos = aSpans.begin(); do { @@ -577,7 +586,7 @@ bool ScMarkData::IsAllMarked( const ScRange& rRange ) const SCROW nEndRow = rRange.aEnd.Row(); bool bOk = true; - if ( nStartCol == 0 && nEndCol == MAXCOL ) + if ( nStartCol == 0 && nEndCol == mnMaxCol ) return aMultiSel.IsRowRangeMarked( nStartRow, nEndRow ); for (SCCOL nCol=nStartCol; nCol<=nEndCol && bOk; nCol++) @@ -690,13 +699,13 @@ void ScMarkData::GetSelectionCover( ScRange& rRange ) SCCOL nStartCol = aMultiRange.aStart.Col(), nEndCol = aMultiRange.aEnd.Col(); PutInOrder( nStartCol, nEndCol ); nStartCol = ( nStartCol == 0 ) ? nStartCol : nStartCol - 1; - nEndCol = ( nEndCol == MAXCOL ) ? nEndCol : nEndCol + 1; + nEndCol = ( nEndCol == mnMaxCol ) ? nEndCol : nEndCol + 1; std::unique_ptr<ScFlatBoolRowSegments> pPrevColMarkedRows; std::unique_ptr<ScFlatBoolRowSegments> pCurColMarkedRows; std::unordered_map<SCROW,ScFlatBoolColSegments> aRowToColSegmentsInTopEnvelope; std::unordered_map<SCROW,ScFlatBoolColSegments> aRowToColSegmentsInBottomEnvelope; ScFlatBoolRowSegments aNoRowsMarked; - aNoRowsMarked.setFalse( 0, MAXROW ); + aNoRowsMarked.setFalse( 0, mnMaxRow ); bool bPrevColUnMarked = false; @@ -707,7 +716,7 @@ void ScMarkData::GetSelectionCover( ScRange& rRange ) if ( !bCurColUnMarked ) { pCurColMarkedRows.reset( new ScFlatBoolRowSegments() ); - pCurColMarkedRows->setFalse( 0, MAXROW ); + pCurColMarkedRows->setFalse( 0, mnMaxRow ); ScMultiSelIter aMultiIter( aMultiSel, nCol ); ScFlatBoolRowSegments::ForwardIterator aPrevItr( pPrevColMarkedRows ? *pPrevColMarkedRows @@ -796,7 +805,7 @@ void ScMarkData::GetSelectionCover( ScRange& rRange ) lcl_AddRanges( rRange, aAddRange ); // Top envelope aRowToColSegmentsInTopEnvelope[nTop - 1].setTrue( nCol, nCol ); } - if( nBottom < MAXROW ) + if( nBottom < mnMaxRow ) { ScRange aAddRange(nCol, nBottom + 1, aMultiRange.aStart.Tab(), nCol, nBottom + 1, aMultiRange.aStart.Tab()); @@ -805,7 +814,7 @@ void ScMarkData::GetSelectionCover( ScRange& rRange ) } } - while( nTopPrev <= MAXROW && nBottomPrev <= MAXROW && ( nCol > nStartCol ) ) + while( nTopPrev <= mnMaxRow && nBottomPrev <= mnMaxRow && ( nCol > nStartCol ) ) { bool bRangeMarked; const bool bHasValue = aPrevItr1.getValue( nTopPrev, bRangeMarked ); @@ -833,7 +842,7 @@ void ScMarkData::GetSelectionCover( ScRange& rRange ) bool bRangeMarked = false; ScFlatBoolRowSegments::ForwardIterator aPrevItr( pPrevColMarkedRows ? *pPrevColMarkedRows : aNoRowsMarked); - while( nTopPrev <= MAXROW && nBottomPrev <= MAXROW ) + while( nTopPrev <= mnMaxRow && nBottomPrev <= mnMaxRow ) { const bool bHasValue = aPrevItr.getValue(nTopPrev, bRangeMarked); assert(bHasValue); (void)bHasValue; @@ -909,12 +918,12 @@ void ScMarkData::GetSelectionCover( ScRange& rRange ) aTopEnvelope.push_back( ScRange( nCol1, nRow1 - 1, nTab1, nCol2, nRow1 - 1, nTab2 ) ); --nRow1New; } - if( nCol2 < MAXCOL ) + if( nCol2 < mnMaxCol ) { aRightEnvelope.push_back( ScRange( nCol2 + 1, nRow1, nTab1, nCol2 + 1, nRow2, nTab2 ) ); ++nCol2New; } - if( nRow2 < MAXROW ) + if( nRow2 < mnMaxRow ) { aBottomEnvelope.push_back( ScRange( nCol1, nRow2 + 1, nTab1, nCol2, nRow2 + 1, nTab2 ) ); ++nRow2New; diff --git a/sc/source/core/data/markmulti.cxx b/sc/source/core/data/markmulti.cxx index 644dfad21f6c..465d60546e9c 100644 --- a/sc/source/core/data/markmulti.cxx +++ b/sc/source/core/data/markmulti.cxx @@ -26,14 +26,19 @@ #include <algorithm> -ScMultiSel::ScMultiSel() +ScMultiSel::ScMultiSel(SCROW nMaxRow, SCCOL nMaxCol) + : aRowSel(nMaxRow), + mnMaxRow(nMaxRow), + mnMaxCol(nMaxCol) { } ScMultiSel::ScMultiSel( const ScMultiSel& rOther ) + : aRowSel(rOther.aRowSel) { - aRowSel = rOther.aRowSel; aMultiSelContainer = rOther.aMultiSelContainer; + mnMaxRow = rOther.mnMaxRow; + mnMaxCol = rOther.mnMaxCol; } ScMultiSel::~ScMultiSel() @@ -44,6 +49,8 @@ ScMultiSel& ScMultiSel::operator=(const ScMultiSel& rOther) { aRowSel = rOther.aRowSel; aMultiSelContainer = rOther.aMultiSelContainer; + mnMaxRow = rOther.mnMaxRow; + mnMaxCol = rOther.mnMaxCol; return *this; } @@ -175,7 +182,7 @@ SCROW ScMultiSel::GetNextMarked( SCCOL nCol, SCROW nRow, bool bUp ) const void ScMultiSel::MarkAllCols( SCROW nStartRow, SCROW nEndRow ) { - aMultiSelContainer.resize(MAXCOL+1); + aMultiSelContainer.resize(MAXCOL+1, ScMarkArray(mnMaxRow)); for ( SCCOL nCol = MAXCOL; nCol >= 0; --nCol ) { aMultiSelContainer[nCol].SetMarkArea( nStartRow, nEndRow, true ); @@ -233,7 +240,7 @@ void ScMultiSel::SetMarkArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, S } if (nEndCol >= static_cast<SCCOL>(aMultiSelContainer.size())) - aMultiSelContainer.resize(nEndCol+1); + aMultiSelContainer.resize(nEndCol+1, ScMarkArray(mnMaxRow)); for ( SCCOL nColIter = nEndCol; nColIter >= nStartCol; --nColIter ) aMultiSelContainer[nColIter].SetMarkArea( nStartRow, nEndRow, bMark ); } @@ -295,7 +302,7 @@ void ScMultiSel::Set( ScRangeList const & rList ) ++i; } - aMultiSelContainer.resize(nMaxCol+1); + aMultiSelContainer.resize(nMaxCol+1, ScMarkArray(mnMaxRow)); for (SCCOL nCol = 0; nCol<=nMaxCol; ++nCol) if (!aMarkEntriesPerCol[nCol].empty()) { @@ -320,7 +327,7 @@ bool ScMultiSel::IsRowRangeMarked( SCROW nStartRow, SCROW nEndRow ) const ScMarkArray ScMultiSel::GetMarkArray( SCCOL nCol ) const { ScMultiSelIter aMultiIter( *this, nCol ); - ScMarkArray aMarkArray; + ScMarkArray aMarkArray(mnMaxRow); SCROW nTop, nBottom; while( aMultiIter.Next( nTop, nBottom ) ) aMarkArray.SetMarkArea( nTop, nBottom, true ); @@ -366,7 +373,7 @@ void ScMultiSel::ShiftCols(SCCOL nStartCol, long nColOffset) nDestCol = MAXCOL; } if (nDestCol >= static_cast<SCCOL>(aMultiSelContainer.size())) - aMultiSelContainer.resize(nDestCol); + aMultiSelContainer.resize(nDestCol, ScMarkArray(mnMaxRow)); aMultiSelContainer[nDestCol] = aSourceArray; ++nCol; } @@ -382,7 +389,7 @@ void ScMultiSel::ShiftCols(SCCOL nStartCol, long nColOffset) rNewCol = rStartPos; rNewCol.Intersect(rPrevPos); if (nStartCol + nColOffset >= static_cast<SCCOL>(aNewMultiSel.aMultiSelContainer.size())) - aNewMultiSel.aMultiSelContainer.resize(nStartCol + nColOffset); + aNewMultiSel.aMultiSelContainer.resize(nStartCol + nColOffset, ScMarkArray(mnMaxRow)); for (long i = 1; i < nColOffset; ++i) aMultiSelContainer[nStartCol + i] = rNewCol; } @@ -418,7 +425,7 @@ ScMultiSelIter::ScMultiSelIter( const ScMultiSel& rMultiSel, SCCOL nCol ) : if (bHasMarks1 && bHasMarks2) { pRowSegs.reset( new ScFlatBoolRowSegments); - pRowSegs->setFalse( 0, MAXROW ); + pRowSegs->setFalse( 0, rMultiSel.mnMaxRow ); { ScMarkArrayIter aMarkIter( &rMultiSel.aRowSel ); SCROW nTop, nBottom; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index da2193a68160..2b300d8e0448 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1429,7 +1429,7 @@ const ScRangeList* ScTable::GetScenarioRanges() const if (!pScenarioRanges) { const_cast<ScTable*>(this)->pScenarioRanges.reset(new ScRangeList); - ScMarkData aMark; + ScMarkData aMark(pDocument->MaxRow(), pDocument->MaxCol()); MarkScenarioIn( aMark, ScScenarioFlags::NONE ); // always aMark.FillRangeListWithMarks( pScenarioRanges.get(), false ); } diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index b509b167308f..f9254836a6a3 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -1835,7 +1835,7 @@ void ScChangeActionContent::PutValueToDoc( aRange.aEnd.IncCol( nC-1 ); if ( nR > 1 ) aRange.aEnd.IncRow( nR-1 ); - ScMarkData aDestMark; + ScMarkData aDestMark(pDoc->MaxRow(), pDoc->MaxCol()); aDestMark.SelectOneTable( aPos.Tab() ); aDestMark.SetMarkArea( aRange ); pDoc->InsertMatrixFormula( aPos.Col(), aPos.Row(), diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 70603454b68d..44fa0292f69d 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -1276,6 +1276,7 @@ XclExpXct::XclExpXct( const XclExpRoot& rRoot, const OUString& rTabName, sal_uInt16 nSBTab, ScExternalRefCache::TableTypeRef const & xCacheTable ) : XclExpRoot( rRoot ), mxCacheTable( xCacheTable ), + maUsedCells( MAXROW, MAXCOL ), maBoundRange( ScAddress::INITIALIZE_INVALID ), maTabName( rTabName ), mnSBTab( nSBTab ) diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index 956b1db6bbc8..5e1d077a4de3 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -564,7 +564,7 @@ bool ScAccessibleCell::IsDropdown() const if ( nTab+1<nTabCount && mpDoc->IsScenario(nTab+1) && !mpDoc->IsScenario(nTab) ) { SCTAB i; - ScMarkData aMarks; + ScMarkData aMarks(mpDoc->MaxRow(), mpDoc->MaxCol()); for (i=nTab+1; i<nTabCount && mpDoc->IsScenario(i); i++) mpDoc->MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame ); ScRangeList aRanges; diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 62db9a961102..88f80d77f272 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -646,7 +646,7 @@ ScDocShell* ScTransferObj::GetSourceDocShell() ScMarkData ScTransferObj::GetSourceMarkData() const { - ScMarkData aMarkData; + ScMarkData aMarkData(m_pDoc->MaxRow(), m_pDoc->MaxCol()); ScCellRangesBase* pRangesObj = comphelper::getUnoTunnelImplementation<ScCellRangesBase>( m_xDragSourceRanges ); if (pRangesObj) { @@ -671,7 +671,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) pDocSh->DoInitNew(); ScDocument& rDestDoc = pDocSh->GetDocument(); - ScMarkData aDestMark; + ScMarkData aDestMark(rDestDoc.MaxRow(), rDestDoc.MaxCol()); aDestMark.SelectTable( 0, true ); rDestDoc.SetDocOptions( m_pDoc->GetDocOptions() ); // #i42666# diff --git a/sc/source/ui/dataprovider/dataprovider.cxx b/sc/source/ui/dataprovider/dataprovider.cxx index 34b4631c8614..e75fb326a64c 100644 --- a/sc/source/ui/dataprovider/dataprovider.cxx +++ b/sc/source/ui/dataprovider/dataprovider.cxx @@ -237,7 +237,7 @@ void ScDBDataManager::WriteToDoc(ScDocument& rDoc) SCROW nRowSize = std::min<SCROW>(aDestRange.aEnd.Row() - aDestRange.aStart.Row(), nEndRow); aDestRange.aEnd.SetRow(aDestRange.aStart.Row() + nRowSize); - ScMarkData aMark; + ScMarkData aMark(mpDoc->MaxRow(), mpDoc->MaxCol()); aMark.SelectTable(0, true); mpDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::CONTENTS, nullptr, &rDoc); ScDocShell* pDocShell = static_cast<ScDocShell*>(mpDoc->GetDocumentShell()); diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index fab53d07bd8c..366f17198650 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -374,7 +374,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, { ScRange const & rTokenRange( aSourceRanges[nRange]); SCTAB nSrcTab = rTokenRange.aStart.Tab(); - ScMarkData aSourceMark; + ScMarkData aSourceMark(rSrcDoc.MaxRow(), rSrcDoc.MaxCol()); aSourceMark.SelectOneTable( nSrcTab ); // selecting for CopyToClip aSourceMark.SetMarkArea( rTokenRange ); @@ -394,7 +394,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, aNewTokenRange.aEnd.SetCol( aNewTokenRange.aStart.Col() + (rTokenRange.aEnd.Col() - rTokenRange.aStart.Col()) ); aNewTokenRange.aEnd.SetRow( aNewTokenRange.aStart.Row() + (rTokenRange.aEnd.Row() - rTokenRange.aStart.Row()) ); - ScMarkData aDestMark; + ScMarkData aDestMark(rDoc.MaxRow(), rDoc.MaxCol()); aDestMark.SelectOneTable( nDestTab ); aDestMark.SetMarkArea( aNewTokenRange ); rDoc.CopyFromClip( aNewTokenRange, aDestMark, InsertDeleteFlags::ALL, nullptr, &aClipDoc, false ); diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 77c8b507277a..b4dff2ee24b8 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -837,7 +837,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, aOldForm.aEnd.SetRow( aOldDest.aEnd.Row() ); rDoc.FitBlock( aOldForm, aNewForm, false ); - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); aMark.SelectOneTable(nDestTab); SCROW nFStartY = aLocalParam.nRow1 + ( aLocalParam.bHasHeader ? 1 : 0 ); diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 5bba7356a653..4e95f43169c2 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -471,7 +471,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, pUndoDBData.reset(new ScDBData( *pDBData )); } - ScMarkData aNewMark; + ScMarkData aNewMark(rDoc.MaxRow(), rDoc.MaxCol()); aNewMark.SelectOneTable( nTab ); if (bRecord) @@ -535,7 +535,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, nEndCol+nFormulaCols, nEndRow, nTab, InsertDeleteFlags::ATTRIB, false, rDoc); // fill formulas - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); aMark.SelectOneTable(nTab); sal_uLong nProgCount = nFormulaCols; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 957b515759fb..1a2a61e263fa 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1184,7 +1184,7 @@ void ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine, aPattern.GetItemSet().ClearItem( ATTR_HOR_JUSTIFY ); // wasn't removed above if no edit object if ( aPattern.GetItemSet().Count() > 0 ) { - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); aMark.SelectTable( rPos.Tab(), true ); aMark.SetMarkArea( ScRange( rPos ) ); ApplyAttributes( aMark, aPattern, bApi ); @@ -1740,7 +1740,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); if (pTabMark) aMark = *pTabMark; else @@ -2245,7 +2245,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, if (!rDoc.IsUndoEnabled()) bRecord = false; - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); if (pTabMark) aMark = *pTabMark; else @@ -2827,7 +2827,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, ScDocumentUniquePtr pClipDoc(new ScDocument(SCDOCMODE_CLIP)); - ScMarkData aSourceMark; + ScMarkData aSourceMark(rDoc.MaxRow(), rDoc.MaxCol()); for (nTab=nStartTab; nTab<=nEndTab; nTab++) aSourceMark.SelectTable( nTab, true ); // select source aSourceMark.SetMarkArea( rSource ); @@ -2948,7 +2948,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, bool bSourceHeight = false; // adjust heights? if (bCut) { - ScMarkData aDelMark; // only for tables + ScMarkData aDelMark(rDoc.MaxRow(), rDoc.MaxCol()); // only for tables for (nTab=nStartTab; nTab<=nEndTab; nTab++) { rDoc.DeleteAreaTab( nStartCol,nStartRow, nOldEndCol,nOldEndRow, nTab, InsertDeleteFlags::ALL ); @@ -2983,7 +2983,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, ScRange aPasteDest( nDestCol, nDestRow, nDestTab, nDestEndCol, nDestEndRow, nDestEndTab ); - ScMarkData aDestMark; + ScMarkData aDestMark(rDoc.MaxRow(), rDoc.MaxCol()); for (nTab=nDestTab; nTab<=nDestEndTab; nTab++) aDestMark.SelectTable( nTab, true ); // select destination aDestMark.SetMarkArea( aPasteDest ); @@ -3733,7 +3733,7 @@ bool ScDocFunc::SetWidthOrHeight( if (bRecord) { - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); aMark.SelectOneTable( nTab ); rDocShell.GetUndoManager()->AddUndoAction( std::make_unique<ScUndoWidthOrHeight>( @@ -4169,7 +4169,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark, bool bRecord = true; if (!rDoc.IsUndoEnabled()) bRecord = false; - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); if (pTabMark) aMark = *pTabMark; else @@ -4283,7 +4283,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark, SCROW nEndRow = rRange.aEnd.Row(); SCTAB nEndTab = rRange.aEnd.Tab(); - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); if (pTabMark) aMark = *pTabMark; else @@ -4370,7 +4370,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark, if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); if (pTabMark) aMark = *pTabMark; else @@ -4514,7 +4514,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark, if (!rDoc.IsUndoEnabled()) bRecord = false; - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); if (pTabMark) aMark = *pTabMark; else @@ -4627,7 +4627,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark, if (!rDoc.IsUndoEnabled()) bRecord = false; - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); if (pTabMark) aMark = *pTabMark; else @@ -4760,7 +4760,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); if (pTabMark) aMark = *pTabMark; else @@ -5439,7 +5439,7 @@ void ScDocFunc::ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd aFormula = aFormula.copy(1, aFormula.getLength()-2); - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); aMark.SetMarkArea( rOldRange ); aMark.SelectTable( nTab, true ); ScRange aNewRange( rOldRange.aStart, rNewEnd ); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 556d4645f50b..0fd41c54d957 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1602,7 +1602,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) m_aDocument.GetCellArea( nTab, nEndCol, nEndRow ); aColWidthRange.aEnd.SetCol( nEndCol ); aColWidthRange.aEnd.SetRow( nEndRow ); - ScMarkData aMark; + ScMarkData aMark(m_aDocument.MaxRow(), m_aDocument.MaxCol()); aMark.SetMarkArea( aColWidthRange ); aMark.MarkToMulti(); diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index efeff05e94e7..ea851d9b9d1b 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -442,7 +442,7 @@ void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore ) if ( nUpdateTab >= nTabCount ) nUpdateTab = nTabCount-1; // nUpdateTab is inclusive - ScMarkData aUpdateSheets; + ScMarkData aUpdateSheets(m_aDocument.MaxRow(), m_aDocument.MaxCol()); SCTAB nTab; for (nTab=0; nTab<=nUpdateTab; ++nTab) if ( m_aDocument.IsPendingRowHeights( nTab ) ) @@ -681,7 +681,7 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord ) if ( m_aDocument.TestCopyScenario( nSrcTab, nTab ) ) // test cell protection { ScDocShellModificator aModificator( *this ); - ScMarkData aScenMark; + ScMarkData aScenMark(m_aDocument.MaxRow(), m_aDocument.MaxCol()); m_aDocument.MarkScenario( nSrcTab, nTab, aScenMark ); ScRange aMultiRange; aScenMark.GetMultiMarkArea( aMultiRange ); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 0619425319be..1f3e733809cd 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -258,7 +258,7 @@ void ScImportExport::EndPaste(bool bAutoRowHeight) ScDocumentUniquePtr pRedoDoc(new ScDocument( SCDOCMODE_UNDO )); pRedoDoc->InitUndo( pDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() ); pDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL | InsertDeleteFlags::NOCAPTIONS, false, *pRedoDoc); - ScMarkData aDestMark; + ScMarkData aDestMark(pRedoDoc->MaxRow(), pRedoDoc->MaxCol()); aDestMark.SetMarkArea(aRange); pDocSh->GetUndoManager()->AddUndoAction( std::make_unique<ScUndoPaste>(pDocSh, aRange, aDestMark, std::move(pUndoDoc), std::move(pRedoDoc), InsertDeleteFlags::ALL, nullptr)); @@ -1935,7 +1935,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) pDoc->CheckLinkFormulaNeedingCheck(*xCode); if ( ch == 'M' ) { - ScMarkData aMark; + ScMarkData aMark(pDoc->MaxRow(), pDoc->MaxCol()); aMark.SelectTable( aPos.Tab(), true ); pDoc->InsertMatrixFormula( nCol, nRow, nRefCol, nRefRow, aMark, EMPTY_OUSTRING, xCode.get() ); diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx index cbdcefb7d893..7da2e6128493 100644 --- a/sc/source/ui/drawfunc/futext3.cxx +++ b/sc/source/ui/drawfunc/futext3.cxx @@ -160,7 +160,7 @@ void FuText::StopEditMode() // Make sure the former area of the note anchor is invalidated. ScRangeList aRangeList(aNotePos); - ScMarkData aMarkData(aRangeList); + ScMarkData aMarkData(rDoc.MaxRow(), rDoc.MaxCol(), aRangeList); rViewShell.UpdateSelectionArea(aMarkData); } else if( bNewNote || bDeleteNote ) diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index c6038662e754..bb3168956dd2 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -1251,11 +1251,11 @@ static void lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScCo static void lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, ScDragSrc nFlags, vcl::Window* pWin ) { - ScMarkData aMark; + ScDocument& rSrcDoc = pSrcShell->GetDocument(); + ScMarkData aMark(rSrcDoc.MaxRow(), rSrcDoc.MaxCol()); aMark.SelectTable( rRange.aStart.Tab(), true ); aMark.SetMarkArea( rRange ); - ScDocument& rSrcDoc = pSrcShell->GetDocument(); if ( !rSrcDoc.HasSelectedBlockMatrixFragment( rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row(), aMark ) ) diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 89816cfe9042..7c07be1f45be 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -465,7 +465,7 @@ void ScUndoDeleteCells::DoChange( const bool bUndo ) aWorkRange.aEnd.SetCol(rDoc.MaxCol()); if ( eCmd==DelCellCmd::Rows || eCmd==DelCellCmd::CellsUp ) aWorkRange.aEnd.SetRow(rDoc.MaxRow()); - ScMarkData aMarkData; + ScMarkData aMarkData(rDoc.MaxRow(), rDoc.MaxCol()); aMarkData.SelectOneTable( aWorkRange.aStart.Tab() ); ScPatternAttr aPattern( rDoc.GetPool() ); aPattern.GetItemSet().Put( ScMergeFlagAttr() ); @@ -1083,7 +1083,7 @@ void ScUndoPaste::DoChange(bool bUndo) ScRange& rDrawRange = aDrawRanges[i]; rDoc.ExtendMerge(rDrawRange, true); // only needed for single sheet (text/rtf etc.) ScRangeList aRangeList(rDrawRange); - ScMarkData aData(aRangeList); + ScMarkData aData(rDoc.MaxRow(), rDoc.MaxCol(), aRangeList); if (bPaintAll) { rDrawRange.aStart.SetCol(0); @@ -1408,7 +1408,7 @@ void ScUndoDragDrop::Redo() of drawing undo actions. */ SCTAB nTab; - ScMarkData aSourceMark; + ScMarkData aSourceMark(rDoc.MaxRow(), rDoc.MaxCol()); for (nTab=aSrcRange.aStart.Tab(); nTab<=aSrcRange.aEnd.Tab(); nTab++) aSourceMark.SelectTable( nTab, true ); @@ -1427,7 +1427,7 @@ void ScUndoDragDrop::Redo() PaintArea( aSrcPaintRange, nExtFlags ); } - ScMarkData aDestMark; + ScMarkData aDestMark(rDoc.MaxRow(), rDoc.MaxCol()); for (nTab=aDestRange.aStart.Tab(); nTab<=aDestRange.aEnd.Tab(); nTab++) aDestMark.SelectTable( nTab, true ); @@ -1917,7 +1917,7 @@ void ScUndoEnterMatrix::Redo() ScDocument& rDoc = pDocShell->GetDocument(); - ScMarkData aDestMark; + ScMarkData aDestMark(rDoc.MaxRow(), rDoc.MaxCol()); aDestMark.SelectOneTable( aBlockRange.aStart.Tab() ); aDestMark.SetMarkArea( aBlockRange ); @@ -2365,7 +2365,7 @@ void ScUndoBorder::Undo() BeginUndo(); ScDocument& rDoc = pDocShell->GetDocument(); - ScMarkData aMarkData; + ScMarkData aMarkData(rDoc.MaxRow(), rDoc.MaxCol()); aMarkData.MarkFromRangeList(*xRanges, false); xUndoDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData); pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE ); @@ -2384,7 +2384,7 @@ void ScUndoBorder::Redo() ScRange const & rRange = (*xRanges)[i]; SCTAB nTab = rRange.aStart.Tab(); - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); aMark.SetMarkArea( rRange ); aMark.SelectTable( nTab, true ); diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 215d7e20a3de..1459e4dd482d 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -859,7 +859,7 @@ void ScUndoAutoFormat::Redo() sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev); for (SCTAB nTab=nStartZ; nTab<=nEndZ; nTab++) { - ScMarkData aDestMark; + ScMarkData aDestMark(rDoc.MaxRow(), rDoc.MaxCol()); aDestMark.SelectOneTable( nTab ); aDestMark.SetMarkArea( ScRange( nStartX, nStartY, nTab, nEndX, nEndY, nTab ) ); aDestMark.MarkToMulti(); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 0d53d2ad2bfa..34aba2fd2769 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1070,7 +1070,7 @@ void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& r rDoc.CopyToDocument(rRange, InsertDeleteFlags::ATTRIB, false, *pUndoDoc); } - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); aMark.SetMarkArea( rRange ); aMark.SelectTable( nTab, true ); @@ -1211,7 +1211,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, if ( pUndoDoc ) { - ScMarkData aDestMark; + ScMarkData aDestMark(rDoc.MaxRow(), rDoc.MaxCol()); aDestMark.SelectOneTable( nTab ); rDocShell.GetUndoManager()->AddUndoAction( std::make_unique<ScUndoPaste>( @@ -1308,7 +1308,7 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange, if ( pUndoDoc ) { - ScMarkData aDestMark; + ScMarkData aDestMark(rDoc.MaxRow(), rDoc.MaxCol()); aDestMark.SelectOneTable( nTab ); rDocShell.GetUndoManager()->AddUndoAction( std::make_unique<ScUndoPaste>( &rDocShell, @@ -1522,7 +1522,7 @@ const ScMarkData* ScCellRangesBase::GetMarkData() { if (!pMarkData) { - pMarkData.reset( new ScMarkData(aRanges) ); + pMarkData.reset( new ScMarkData(GetDocument()->MaxRow(), GetDocument()->MaxCol(), aRanges) ); } return pMarkData.get(); } @@ -2450,7 +2450,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE SvxBoxInfoItem aInner(ATTR_BORDER_INNER); ScDocument& rDoc = pDocShell->GetDocument(); - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); aMark.SetMarkArea( rFirst ); aMark.SelectTable( rFirst.aStart.Tab(), true ); rDoc.GetSelectionFrame( aMark, aOuter, aInner ); @@ -3412,7 +3412,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC { ScDocument& rDoc = pDocShell->GetDocument(); - ScMarkData aMarkData; + ScMarkData aMarkData(rDoc.MaxRow(), rDoc.MaxCol()); // select matching cells for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i ) @@ -3501,7 +3501,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryFormulaC { ScDocument& rDoc = pDocShell->GetDocument(); - ScMarkData aMarkData; + ScMarkData aMarkData(rDoc.MaxRow(), rDoc.MaxCol()); // select matching cells for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i ) @@ -3555,7 +3555,7 @@ uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl( size_t nRangeCount = aRanges.size(); size_t i; ScDocument& rDoc = pDocShell->GetDocument(); - ScMarkData aMarkData; + ScMarkData aMarkData(rDoc.MaxRow(), rDoc.MaxCol()); SCCOLROW nCmpPos = bColumnDiff ? static_cast<SCCOLROW>(aCompare.Row) : static_cast<SCCOLROW>(aCompare.Column); @@ -3685,7 +3685,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryPreceden bFound = false; // aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used - ScMarkData aMarkData; + ScMarkData aMarkData(rDoc.MaxRow(), rDoc.MaxCol()); aMarkData.MarkFromRangeList( aNewRanges, false ); aMarkData.MarkToMulti(); // needed for IsAllMarked @@ -3734,7 +3734,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependen bFound = false; // aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used - ScMarkData aMarkData; + ScMarkData aMarkData(rDoc.MaxRow(), rDoc.MaxCol()); aMarkData.MarkFromRangeList( aNewRanges, false ); aMarkData.MarkToMulti(); // needed for IsAllMarked @@ -4168,7 +4168,7 @@ void SAL_CALL ScCellRangesObj::removeRangeAddress( const table::CellRangeAddress aNotSheetRanges.push_back( rRanges[ i ] ); } } - ScMarkData aMarkData; + ScMarkData aMarkData(GetDocument()->MaxRow(), GetDocument()->MaxCol()); aMarkData.MarkFromRangeList( aSheetRanges, false ); ScRange aRange(static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), @@ -4321,7 +4321,7 @@ static bool lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl& rNamedEntries, if ( (nParse & ( ScRefFlags::VALID | ScRefFlags::TAB_3D )) == ( ScRefFlags::VALID | ScRefFlags::TAB_3D )) { - ScMarkData aMarkData; + ScMarkData aMarkData(pDocSh->GetDocument().MaxRow(), pDocSh->GetDocument().MaxCol()); aMarkData.MarkFromRangeList( rRanges, false ); aMarkData.MarkToMulti(); // needed for IsAllMarked if ( aMarkData.IsAllMarked( aCellRange ) ) @@ -4339,7 +4339,7 @@ static bool lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl& rNamedEntries, // test if named entry is contained in rRanges const ScRange& rComp = rNamedEntry.GetRange(); - ScMarkData aMarkData; + ScMarkData aMarkData(pDocSh->GetDocument().MaxRow(), pDocSh->GetDocument().MaxCol()); aMarkData.MarkFromRangeList( rRanges, false ); aMarkData.MarkToMulti(); // needed for IsAllMarked if ( aMarkData.IsAllMarked( rComp ) ) @@ -4388,7 +4388,7 @@ void SAL_CALL ScCellRangesObj::removeByName( const OUString& aName ) } if ( bValid ) { - ScMarkData aMarkData; + ScMarkData aMarkData(GetDocument()->MaxRow(), GetDocument()->MaxCol()); aMarkData.MarkFromRangeList( rRanges, false ); for ( size_t i = 0, nDiffCount = aDiff.size(); i < nDiffCount; i++ ) @@ -4881,7 +4881,7 @@ void ScCellRangeObj::SetArrayFormula_Impl(const OUString& rFormula, else { // empty string -> erase array formula - ScMarkData aMark; + ScMarkData aMark(GetDocument()->MaxRow(), GetDocument()->MaxCol()); aMark.SetMarkArea( aRange ); aMark.SelectTable( aRange.aStart.Tab(), true ); pDocSh->GetDocFunc().DeleteContents( aMark, InsertDeleteFlags::CONTENTS, true, true ); @@ -4956,7 +4956,7 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula else { // empty sequence -> erase array formula - ScMarkData aMark; + ScMarkData aMark(pDocSh->GetDocument().MaxRow(), pDocSh->GetDocument().MaxCol()); aMark.SetMarkArea( aRange ); aMark.SelectTable( aRange.aStart.Tab(), true ); pDocSh->GetDocFunc().DeleteContents( aMark, InsertDeleteFlags::CONTENTS, true, true ); @@ -7689,7 +7689,7 @@ void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAd if (rDoc.IsScenario(nTab)) { - ScMarkData aMarkData; + ScMarkData aMarkData(rDoc.MaxRow(), rDoc.MaxCol()); aMarkData.SelectTable( nTab, true ); for (const table::CellRangeAddress& rRange : rScenRanges) @@ -8732,7 +8732,7 @@ void ScCellsEnumeration::CheckPos_Impl() { if (!pMark) { - pMark.reset( new ScMarkData ); + pMark.reset( new ScMarkData(rDoc.MaxRow(), rDoc.MaxCol()) ); pMark->MarkFromRangeList(aRanges, false); pMark->MarkToMulti(); // needed for GetNextMarkedCell } @@ -8756,7 +8756,7 @@ void ScCellsEnumeration::Advance_Impl() OSL_ENSURE(!bAtEnd,"too much Advance_Impl"); if (!pMark) { - pMark.reset( new ScMarkData ); + pMark.reset( new ScMarkData(pDocShell->GetDocument().MaxRow(), pDocShell->GetDocument().MaxCol()) ); pMark->MarkFromRangeList( aRanges, false ); pMark->MarkToMulti(); // needed for GetNextMarkedCell } diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx index 82cbe769fb34..6f18ed237c76 100644 --- a/sc/source/ui/unoobj/cursuno.cxx +++ b/sc/source/ui/unoobj/cursuno.cxx @@ -338,7 +338,7 @@ void SAL_CALL ScCellCursorObj::gotoNext() aOneRange.PutInOrder(); ScAddress aCursor(aOneRange.aStart); // always use start of block - ScMarkData aMark; // not used with bMarked=FALSE + ScMarkData aMark(GetDocument()->MaxRow(), GetDocument()->MaxCol()); // not used with bMarked=FALSE SCCOL nNewX = aCursor.Col(); SCROW nNewY = aCursor.Row(); SCTAB nTab = aCursor.Tab(); @@ -360,7 +360,7 @@ void SAL_CALL ScCellCursorObj::gotoPrevious() aOneRange.PutInOrder(); ScAddress aCursor(aOneRange.aStart); // always use start of block - ScMarkData aMark; // not used with bMarked=FALSE + ScMarkData aMark(GetDocument()->MaxRow(), GetDocument()->MaxCol()); // not used with bMarked=FALSE SCCOL nNewX = aCursor.Col(); SCROW nNewY = aCursor.Row(); SCTAB nTab = aCursor.Tab(); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 9b0ae9763001..b55803ab5104 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1572,7 +1572,7 @@ sal_Int32 SAL_CALL ScModelObj::getRendererCount(const uno::Any& aSelection, static_cast< sheet::XSpreadsheetDocument* >(this) ); } - ScMarkData aMark; + ScMarkData aMark(GetDocument()->MaxRow(), GetDocument()->MaxCol()); ScPrintSelectionStatus aStatus; OUString aPagesStr; bool bRenderToGraphic = false; @@ -1662,7 +1662,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 static_cast< sheet::XSpreadsheetDocument* >(this) ); } - ScMarkData aMark; + ScMarkData aMark(pDocShell->GetDocument().MaxRow(), pDocShell->GetDocument().MaxCol()); ScPrintSelectionStatus aStatus; OUString aPagesStr; // #i115266# if FillRenderMarkData fails, keep nTotalPages at 0, but still handle getRenderer(0) below @@ -1910,7 +1910,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec static_cast< sheet::XSpreadsheetDocument* >(this) ); } - ScMarkData aMark; + ScMarkData aMark(pDocShell->GetDocument().MaxRow(), pDocShell->GetDocument().MaxCol()); ScPrintSelectionStatus aStatus; OUString aPagesStr; bool bRenderToGraphic = false; @@ -3086,7 +3086,7 @@ void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& r //! separate method with ScMarkData? Then change HasChangesListeners back. if ( rOperation == "cell-change" && pDocShell ) { - ScMarkData aMarkData; + ScMarkData aMarkData(pDocShell->GetDocument().MaxRow(), pDocShell->GetDocument().MaxCol()); aMarkData.MarkFromRangeList( rRanges, false ); ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nTabCount = rDoc.GetTableCount(); @@ -4454,7 +4454,7 @@ void SAL_CALL ScAnnotationsObj::removeByIndex( sal_Int32 nIndex ) ScAddress aPos; if ( GetAddressByIndex_Impl( nIndex, aPos ) ) { - ScMarkData aMarkData; + ScMarkData aMarkData(pDocShell->GetDocument().MaxRow(), pDocShell->GetDocument().MaxCol()); aMarkData.SelectTable( aPos.Tab(), true ); aMarkData.SetMultiMarkArea( ScRange(aPos) ); @@ -4585,7 +4585,7 @@ void SAL_CALL ScScenariosObj::addNewByName( const OUString& aName, SolarMutexGuard aGuard; if ( pDocShell ) { - ScMarkData aMarkData; + ScMarkData aMarkData(pDocShell->GetDocument().MaxRow(), pDocShell->GetDocument().MaxCol()); aMarkData.SelectTable( nTab, true ); for (const table::CellRangeAddress& rRange : aRanges) diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 89680f3e7a28..128811bf1ae7 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -142,7 +142,7 @@ static bool lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange, nDestTab ) ); ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP )); - ScMarkData aSourceMark; + ScMarkData aSourceMark(pSrcDoc->MaxRow(), pSrcDoc->MaxCol()); aSourceMark.SelectOneTable( nSrcTab ); // for CopyToClip aSourceMark.SetMarkArea( rSrcRange ); ScClipParam aClipParam(rSrcRange, false); @@ -157,7 +157,7 @@ static bool lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange, pClipDoc->ApplyPatternAreaTab( 0,0, pClipDoc->MaxCol(), pClipDoc->MaxRow(), nSrcTab, aPattern ); } - ScMarkData aDestMark; + ScMarkData aDestMark(pDestDoc->MaxRow(), pDestDoc->MaxCol()); aDestMark.SelectOneTable( nDestTab ); aDestMark.SetMarkArea( aNewRange ); pDestDoc->CopyFromClip( aNewRange, aDestMark, InsertDeleteFlags::ALL & ~InsertDeleteFlags::FORMULA, nullptr, pClipDoc.get(), false ); diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index e658059837aa..cbe375af50bf 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -5280,7 +5280,7 @@ ScVbaRange::setStyle( const uno::Any& _style ) uno::Reference< excel::XRange > ScVbaRange::PreviousNext( bool bIsPrevious ) { - ScMarkData markedRange; + ScMarkData markedRange(getScDocument().MaxRow(), getScDocument().MaxCol()); ScRange refRange; RangeHelper thisRange( mxRange ); diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx index e6b3fbc146dc..d2c6a882658c 100644 --- a/sc/source/ui/vba/vbaworksheets.cxx +++ b/sc/source/ui/vba/vbaworksheets.cxx @@ -498,7 +498,8 @@ void ScVbaWorksheets::PrintPreview( const css::uno::Any& /*EnableChanges*/ ) { ScPreviewShell* pPrvShell = static_cast< ScPreviewShell* >( pShell ); ScPreview* pPrvView = pPrvShell->GetPreview(); - ScMarkData aMarkData; + const ScDocument& rDoc = *pViewShell->GetViewData().GetDocument(); + ScMarkData aMarkData(rDoc.MaxRow(), rDoc.MaxCol()); sal_Int32 nElems = getCount(); for ( sal_Int32 nItem = 1; nItem <= nElems; ++nItem ) { diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index f2fab305f9aa..44ef3d49c330 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2401,7 +2401,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScViewData* pData = GetViewData(); ScMarkData& rMark = pData->GetMarkData(); ScDocument* pDoc = pData->GetDocument(); - ScMarkData aNewMark; + ScMarkData aNewMark(pDoc->MaxRow(), pDoc->MaxCol()); ScRangeList aRangeList; for (auto const& rTab : rMark.GetSelectedTabs()) diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 0f72c2954a1b..c286b7b5d173 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5385,7 +5385,7 @@ bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScenRang //! cache the Ranges in Table!!!! - ScMarkData aMarks; + ScMarkData aMarks(pDoc->MaxRow(), pDoc->MaxCol()); for (SCTAB i=nTab+1; i<nTabCount && pDoc->IsScenario(i); i++) pDoc->MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame ); ScRangeList aRanges; diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index acaa81842a97..d0e530be77e8 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -198,7 +198,7 @@ static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, S //! cache the ranges in table!!!! - ScMarkData aMarks; + ScMarkData aMarks(pDoc->MaxRow(), pDoc->MaxCol()); for (SCTAB i=nTab+1; i<nTabCount && pDoc->IsScenario(i); i++) pDoc->MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame ); ScRangeListRef xRanges = new ScRangeList; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 97dbaacfac2a..5cdb89ec4890 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -732,7 +732,7 @@ ScSplitPos ScViewDataTable::SanitizeWhichActive() const ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) : nPPTX(0.0), nPPTY(0.0), - mpMarkData(new ScMarkData), + mpMarkData(new ScMarkData(pDocSh->GetDocument().MaxRow(), pDocSh->GetDocument().MaxCol()) ), pDocShell ( pDocSh ), pDoc ( nullptr ), pView ( pViewSh ), diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index cf1cd4656ed4..0778c2b5a710 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -142,7 +142,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow, rDoc.CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, InsertDeleteFlags::ALL|InsertDeleteFlags::NOCAPTIONS, false, *pRedoDoc ); ScRange aMarkRange(nStartCol, nStartRow, nTab, nStartCol, nEndRow, nTab); - ScMarkData aDestMark; + ScMarkData aDestMark(rDoc.MaxRow(), rDoc.MaxCol()); aDestMark.SetMarkArea( aMarkRange ); pDocSh->GetUndoManager()->AddUndoAction( std::make_unique<ScUndoPaste>( pDocSh, aMarkRange, aDestMark, diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 1cffceff6e57..cdac007fc8df 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -139,7 +139,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, if (!rSrcDoc.HasTable(nSrcTab)) nSrcTab = 0; - ScMarkData aSrcMark; + ScMarkData aSrcMark(rSrcDoc.MaxRow(), rSrcDoc.MaxCol()); aSrcMark.SelectOneTable( nSrcTab ); // for CopyToClip ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP )); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 7ed93ac0b0b4..21d10fcd1726 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -213,7 +213,7 @@ void ScViewFunc::DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab, if ( !pSource->GetItem(ATTR_MERGE).IsMerged() ) { ScRange aRange( nCol, nRow, nTab, nCol, nRow, nTab ); - ScMarkData aMark; + ScMarkData aMark(rDoc.MaxRow(), rDoc.MaxCol()); aMark.SetMarkArea( aRange ); ScDocFunc &rFunc = GetViewData().GetDocFunc(); @@ -552,7 +552,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const sal_uInt32 nFormat = pFormatter->GetStandardFormat( SvNumFormatType::NUMBER, nLang); ScPatternAttr aPattern( pDoc->GetPool()); aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nFormat)); - ScMarkData aMark; + ScMarkData aMark(pDoc->MaxRow(), pDoc->MaxCol()); aMark.SelectTable( i, true); aMark.SetMarkArea( ScRange( aPos)); rFunc.ApplyAttributes( aMark, aPattern, false); |