sc/qa/unit/helper/qahelper.cxx | 6 ++++ sc/qa/unit/helper/qahelper.hxx | 2 + sc/qa/unit/ucalc.cxx | 41 ++++++++++++++++++++++++++++++ sc/qa/unit/ucalc.hxx | 4 ++ sc/source/ui/view/tabview2.cxx | 56 +++++++++++++++++++++++++++++++++++------ 5 files changed, 101 insertions(+), 8 deletions(-)
New commits: commit 93d22efb334ad85fd02deb83ec1baf538cf0cba3 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri Sep 27 17:28:47 2013 +0200 ignore hidden row/columns when navigating, fdo#45020 Change-Id: I597d7dbef07479f66894c7fce5ee21f340b43120 diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 4566805..bcce76e 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -79,18 +79,38 @@ void moveCursorByProtRule( { for (SCCOL i = 0; i < nMovX && rCol < MAXCOL; ++i) { - if (!isCellQualified(pDoc, rCol+1, rRow, nTab, bSelectLocked, bSelectUnlocked)) + SCCOL nNewUnhiddenCol = rCol + 1; + SCCOL nEndCol = 0; + while(pDoc->ColHidden(nNewUnhiddenCol, nTab, NULL, &nEndCol)) + { + if(nNewUnhiddenCol >= MAXCOL) + return; + + nNewUnhiddenCol = nEndCol +1; + } + + if (!isCellQualified(pDoc, nNewUnhiddenCol, rRow, nTab, bSelectLocked, bSelectUnlocked)) break; - ++rCol; + rCol = nNewUnhiddenCol; } } else if (nMovX < 0) { for (SCCOL i = 0; i > nMovX && rCol > 0; --i) { - if (!isCellQualified(pDoc, rCol-1, rRow, nTab, bSelectLocked, bSelectUnlocked)) + SCCOL nNewUnhiddenCol = rCol - 1; + SCCOL nStartCol = 0; + while(pDoc->ColHidden(nNewUnhiddenCol, nTab, &nStartCol)) + { + if(nNewUnhiddenCol <= 0) + return; + + nNewUnhiddenCol = nStartCol - 1; + } + + if (!isCellQualified(pDoc, nNewUnhiddenCol, rRow, nTab, bSelectLocked, bSelectUnlocked)) break; - --rCol; + rCol = nNewUnhiddenCol; } } @@ -98,18 +118,38 @@ void moveCursorByProtRule( { for (SCROW i = 0; i < nMovY && rRow < MAXROW; ++i) { - if (!isCellQualified(pDoc, rCol, rRow+1, nTab, bSelectLocked, bSelectUnlocked)) + SCROW nNewUnhiddenRow = rRow + 1; + SCROW nEndRow = 0; + while(pDoc->RowHidden(nNewUnhiddenRow, nTab, NULL, &nEndRow)) + { + if(nNewUnhiddenRow >= MAXROW) + return; + + nNewUnhiddenRow = nEndRow + 1; + } + + if (!isCellQualified(pDoc, rCol, nNewUnhiddenRow, nTab, bSelectLocked, bSelectUnlocked)) break; - ++rRow; + rRow = nNewUnhiddenRow; } } else if (nMovY < 0) { for (SCROW i = 0; i > nMovY && rRow > 0; --i) { - if (!isCellQualified(pDoc, rCol, rRow-1, nTab, bSelectLocked, bSelectUnlocked)) + SCROW nNewUnhiddenRow = rRow - 1; + SCROW nStartRow = 0; + while(pDoc->RowHidden(nNewUnhiddenRow, nTab, &nStartRow)) + { + if(nNewUnhiddenRow <= 0) + return; + + nNewUnhiddenRow = nStartRow - 1; + } + + if (!isCellQualified(pDoc, rCol, nNewUnhiddenRow, nTab, bSelectLocked, bSelectUnlocked)) break; - --rRow; + rRow = nNewUnhiddenRow; } } } commit 690228ad4dd4cf10ad6292686d4aad8dcc9e2793 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed Sep 25 21:40:33 2013 +0200 add a unit test for fdo#66646 Change-Id: I15bef4e0422261ec473263ac8fc239604146f864 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 4331073..b0b6f32 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4202,6 +4202,27 @@ void Test::testCondFormatInsertRow() m_pDoc->DeleteTab(0); } +void Test::testMixData() +{ + m_pDoc->InsertTab(0, "Test"); + + m_pDoc->SetValue(1,0,0,2); + m_pDoc->SetValue(0,1,0,3); + ScDocument aClipDoc(SCDOCMODE_CLIP); + copyToClip(m_pDoc, ScRange(0,0,0,1,0,0), &aClipDoc); + + ScDocument aMixDoc(SCDOCMODE_CLIP); + copyToClip(m_pDoc, ScRange(0,1,0,1,1,0), &aMixDoc); + + pasteFromClip(m_pDoc, ScRange(0,1,0,1,1,0), &aClipDoc); + m_pDoc->MixDocument(ScRange(0,1,0,1,1,0), 1, false, &aMixDoc); + + CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(1,1,0)); + CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(0,1,0)); + + m_pDoc->DeleteTab(0); +} + void Test::printRange(ScDocument* pDoc, const ScRange& rRange, const char* pCaption) { SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row(); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 698d683..3c46cab 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -224,6 +224,8 @@ public: void testSharedFormulasCopyPaste(); void testFormulaPosition(); + void testMixData(); + /** * Make sure the sheet streams are invalidated properly. */ commit 1e2bbf4bc723a9838bb8786908682ea2dd841866 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed Sep 25 20:52:38 2013 +0200 add test case for fdo#69720 Change-Id: Ib89a596f0e28cacc9ae180d23b9995e524c45b52 diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 8139363..0de8b6b 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -55,6 +55,12 @@ std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList) return rStrm; } +std::ostream& operator<<(std::ostream& rStrm, const Color& rColor) +{ + rStrm << "Color: R:" << rColor.GetRed() << " G:" << rColor.GetGreen() << " B: << rColor.GetBlue()"; + return rStrm; +} + FileFormat aFileFormats[] = { { "ods" , "calc8", "", ODS_FORMAT_TYPE }, { "xls" , "MS Excel 97", "calc_MS_EXCEL_97", XLS_FORMAT_TYPE }, diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 7bcf519..8d0f27d 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -97,6 +97,8 @@ std::ostream& operator<<(std::ostream& rStrm, const ScRange& rRange); std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList); +std::ostream& operator<<(std::ostream& rStrm, const Color& rColor); + // Why is this here and not in osl, and using the already existing file // handling APIs? Do we really want to add arbitrary new file handling // wrappers here and there (and then having to handle the Android (and diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index e5e6198..4331073 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -56,6 +56,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <editeng/boxitem.hxx> +#include <editeng/brushitem.hxx> #include <svx/svdograf.hxx> #include <svx/svdpage.hxx> @@ -3857,6 +3858,25 @@ void Test::testDeleteCol() pDoc->DeleteTab(0); } +void Test::testDeleteArea() +{ + ScDocument* pDoc = getDocShell().GetDocument(); + pDoc->InsertTab(0, "Test"); + + pDoc->SetValue(0,0,0,3.2); + pDoc->ApplyAttr(0,0,0,SvxBrushItem(Color(COL_LIGHTRED), ATTR_BACKGROUND)); + + ScMarkData aMark; + ScRange aRange(0,0,0,0,0,0); + aMark.SetMarkArea(aRange); + pDoc->DeleteArea(0,0,0,0,aMark, IDF_CONTENTS); + const SfxPoolItem* pItem = pDoc->GetAttr(0,0,0,ATTR_BACKGROUND); + CPPUNIT_ASSERT(pItem); + CPPUNIT_ASSERT_EQUAL(Color(COL_LIGHTRED), static_cast<const SvxBrushItem*>(pItem)->GetColor()); + + pDoc->DeleteTab(0); +} + void Test::testAnchoredRotatedShape() { OUString aTabName("TestTab"); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index e97bb8d..698d683 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -267,6 +267,7 @@ public: void testShiftCells(); void testDeleteRow(); void testDeleteCol(); + void testDeleteArea(); void testAnchoredRotatedShape(); void testCellTextWidth(); void testEditTextIterator(); @@ -367,6 +368,7 @@ public: CPPUNIT_TEST(testShiftCells); CPPUNIT_TEST(testDeleteRow); CPPUNIT_TEST(testDeleteCol); + CPPUNIT_TEST(testDeleteArea); CPPUNIT_TEST(testAnchoredRotatedShape); CPPUNIT_TEST(testCellTextWidth); CPPUNIT_TEST(testEditTextIterator); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits