[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/qa sc/source

2014-09-23 Thread Kohei Yoshida
 sc/qa/unit/ucalc_pivottable.cxx  |   52 +++
 sc/source/core/data/dpoutput.cxx |9 ++
 2 files changed, 35 insertions(+), 26 deletions(-)

New commits:
commit 358fdd8ef44fbddbb24dc603a6c0c6037885f1b0
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Sep 17 11:24:56 2014 -0400

bnc#592918: Display data description in pivot table.

When there are no column fields and exactly one data field.

Change-Id: I10d2af7e626f98a4d8a981e078e99e7da9207d1c
(cherry picked from commit 902564bfe52e7699cefc80b3334c2eb0a8cacdcf)
Reviewed-on: https://gerrit.libreoffice.org/11493
Reviewed-by: Andras Timar andras.ti...@collabora.com
Tested-by: Andras Timar andras.ti...@collabora.com

diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx
index 00e83b9..65ed2fd 100644
--- a/sc/qa/unit/ucalc_pivottable.cxx
+++ b/sc/qa/unit/ucalc_pivottable.cxx
@@ -1107,7 +1107,7 @@ void Test::testPivotTableNormalGrouping()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][2] = {
-{ Name, 0 },
+{ Name, Sum - Value },
 { A, 1 },
 { B, 2 },
 { C, 3 },
@@ -1155,7 +1155,7 @@ void Test::testPivotTableNormalGrouping()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][3] = {
-{ Name2, Name, 0 },
+{ Name2, Name, Sum - Value },
 { D, D, 4 },
 { E, E, 5 },
 { F, F, 6 },
@@ -1192,7 +1192,7 @@ void Test::testPivotTableNormalGrouping()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][3] = {
-{ Name2, Name, 0 },
+{ Name2, Name, Sum - Value },
 { G, G, 7 },
 { Group1, A, 1 },
 { 0,B, 2 },
@@ -1289,7 +1289,7 @@ void Test::testPivotTableNumberGrouping()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][2] = {
-{ Order, 0 },
+{ Order, Sum - Score },
 { 30,   423 },
 { 30-39, 87  },
 { 40-49, 241 },
@@ -1404,7 +1404,7 @@ void Test::testPivotTableDateGrouping()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][4] = {
-{ Years, Quarters, Date, 0 },
+{ Years, Quarters, Date, Sum - Value },
 { 2011, Q1, Jan, 1 },
 { 0, 0, Mar, 2 },
 { 0,  Q3, Sep, 7 },
@@ -1436,7 +1436,7 @@ void Test::testPivotTableDateGrouping()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][4] = {
-{ Years, Quarters, Date, 0 },
+{ Years, Quarters, Date, Sum - Value },
 { 2011, Q1, Jan, 1 },
 { 0, 0, Mar, 2 },
 { 0,  Q3, Sep, 7 },
@@ -1460,7 +1460,7 @@ void Test::testPivotTableDateGrouping()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][2] = {
-{ Date, 0 },
+{ Date, Sum - Value },
 { 2011-01-01, 1 },
 { 2011-03-02, 2 },
 { 2011-09-03, 7 },
@@ -1528,7 +1528,7 @@ void Test::testPivotTableEmptyRows()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][2] = {
-{ Name, 0 },
+{ Name, Sum - Value },
 { A, 1 },
 { B, 2 },
 { C, 3 },
@@ -1551,7 +1551,7 @@ void Test::testPivotTableEmptyRows()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][2] = {
-{ Name, 0 },
+{ Name, Sum - Value },
 { A, 1 },
 { B, 2 },
 { C, 3 },
@@ -1578,7 +1578,7 @@ void Test::testPivotTableEmptyRows()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][2] = {
-{ Name, 0 },
+{ Name, Sum - Value },
 { B, 3 },
 { C, 3 },
 { D, 4 },
@@ -1656,7 +1656,7 @@ void Test::testPivotTableTextNumber()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][2] = {
-{ Name, 0 },
+{ Name, Sum - Value },
 { 0001, 1 },
 { 0002, 2 },
 { 0003, 3 },
@@ -1715,7 +1715,7 @@ void Test::testPivotTableCaseInsensitiveStrings()
 {
 // Expected output table content.  0 = empty cell
 const char* aOutputCheck[][2] = {
-{ Name, 0 },
+{ Name, Sum - Value },
 { A, 3 },
 { Total Result, 3 },
 };
@@ -1878,7 +1878,7 @@ void Test::testPivotTableFieldReference()
 {
 // Expected output table content.  0 = empty cell
 const char* 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/qa sc/source

2014-01-01 Thread Michael Meeks
 sc/qa/unit/ucalc.cxx   |   13 +
 sc/qa/unit/ucalc.hxx   |2 ++
 sc/source/core/data/column.cxx |3 ++-
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 74fcb90dc73e235934fc19d39b7d7b0bf07cc8a5
Author: Michael Meeks michael.me...@collabora.com
Date:   Wed Jan 1 11:07:46 2014 +

fdo#73021 - avoid call crash on spell-check + unit test.

Change-Id: I3588ef45617bda440f970e54274cc0985b7baed5

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 2b04ea4..abf872c 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1638,6 +1638,19 @@ void Test::testEnterMixedMatrix()
 m_pDoc-DeleteTab(0);
 }
 
+void Test::testCellCopy()
+{
+m_pDoc-InsertTab(0, TestTab);
+ScAddress aSrc(0,0,0);
+ScAddress aDest(0,1,0);
+OUString aStr(please copy me);
+m_pDoc-SetString(aSrc, aStr);
+CPPUNIT_ASSERT_EQUAL(m_pDoc-GetString(aSrc), aStr);
+// copy to self - why not ?
+m_pDoc-CopyCellToDocument(aSrc,aDest,*m_pDoc);
+CPPUNIT_ASSERT_EQUAL(m_pDoc-GetString(aDest), aStr);
+}
+
 void Test::testSheetCopy()
 {
 m_pDoc-InsertTab(0, TestTab);
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index b877e02..efefad2 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -213,6 +213,7 @@ public:
  */
 void testPivotTableDocFunc();
 
+void testCellCopy();
 void testSheetCopy();
 void testSheetMove();
 void testExternalRef();
@@ -350,6 +351,7 @@ public:
 CPPUNIT_TEST(testPivotTableNumStability);
 CPPUNIT_TEST(testPivotTableFieldReference);
 CPPUNIT_TEST(testPivotTableDocFunc);
+CPPUNIT_TEST(testCellCopy);
 CPPUNIT_TEST(testSheetCopy);
 CPPUNIT_TEST(testSheetMove);
 CPPUNIT_TEST(testExternalRef);
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 921ff25..e852e1f 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1564,7 +1564,8 @@ void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW 
nDestRow, ScColumn rDes
 rDestCol.maCellTextAttrs.set(nDestRow, 
maCellTextAttrs.getsc::CellTextAttr(nSrcRow));
 ScPostIt* pNote = maCellNotes.getScPostIt*(nSrcRow);
 rDestCol.maCellNotes.set(nDestRow, pNote);
-pNote-UpdateCaptionPos(ScAddress(rDestCol.nCol, nDestRow, 
rDestCol.nTab));
+if (pNote)
+pNote-UpdateCaptionPos(ScAddress(rDestCol.nCol, nDestRow, 
rDestCol.nTab));
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/qa sc/source

2013-12-27 Thread Kohei Yoshida
 sc/qa/unit/ucalc.cxx   |   41 +
 sc/qa/unit/ucalc.hxx   |2 ++
 sc/source/core/data/column.cxx |   11 +++
 3 files changed, 50 insertions(+), 4 deletions(-)

New commits:
commit dbd8709af0545b0372c28c5ff36effba68bca580
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Fri Dec 27 17:33:52 2013 -0500

fdo#72874: Strip const-ness from pointer value when setting it to storage.

Else the pointer type would get demoted to a boolean type which would cause
the boolean version of overloaded function to get picked.

Change-Id: Ided7e8c67ef84b4323c8ad1123e0a2c30ce37e01
(cherry picked from commit 21f053e2dd2867489a4d5823d9210c4368f4d115)

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 107825b..2b04ea4 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4096,6 +4096,47 @@ void Test::testSortWithFormulaRefs()
 pDoc-DeleteTab(1);
 }
 
+void Test::testSortWithStrings()
+{
+m_pDoc-InsertTab(0, Test);
+
+ScFieldEditEngine rEE = m_pDoc-GetEditEngine();
+rEE.SetText(Val1);
+m_pDoc-SetString(ScAddress(1,1,0), Header);
+m_pDoc-SetString(ScAddress(1,2,0), Val2);
+m_pDoc-SetEditText(ScAddress(1,3,0), rEE.CreateTextObject());
+
+CPPUNIT_ASSERT_EQUAL(OUString(Header), 
m_pDoc-GetString(ScAddress(1,1,0)));
+CPPUNIT_ASSERT_EQUAL(OUString(Val2), 
m_pDoc-GetString(ScAddress(1,2,0)));
+CPPUNIT_ASSERT_EQUAL(OUString(Val1), 
m_pDoc-GetString(ScAddress(1,3,0)));
+
+ScSortParam aParam;
+aParam.nCol1 = 1;
+aParam.nCol2 = 1;
+aParam.nRow1 = 1;
+aParam.nRow2 = 3;
+aParam.bHasHeader = true;
+aParam.maKeyState[0].bDoSort = true;
+aParam.maKeyState[0].bAscending = true;
+aParam.maKeyState[0].nField = 1;
+
+m_pDoc-Sort(0, aParam, false, NULL);
+
+CPPUNIT_ASSERT_EQUAL(OUString(Header), 
m_pDoc-GetString(ScAddress(1,1,0)));
+CPPUNIT_ASSERT_EQUAL(OUString(Val1), 
m_pDoc-GetString(ScAddress(1,2,0)));
+CPPUNIT_ASSERT_EQUAL(OUString(Val2), 
m_pDoc-GetString(ScAddress(1,3,0)));
+
+aParam.maKeyState[0].bAscending = false;
+
+m_pDoc-Sort(0, aParam, false, NULL);
+
+CPPUNIT_ASSERT_EQUAL(OUString(Header), 
m_pDoc-GetString(ScAddress(1,1,0)));
+CPPUNIT_ASSERT_EQUAL(OUString(Val2), 
m_pDoc-GetString(ScAddress(1,2,0)));
+CPPUNIT_ASSERT_EQUAL(OUString(Val1), 
m_pDoc-GetString(ScAddress(1,3,0)));
+
+m_pDoc-DeleteTab(0);
+}
+
 void Test::testSort()
 {
 OUString aTabName1(test1);
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 1e2a483..b877e02 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -275,6 +275,7 @@ public:
 void testFindAreaPosColRight();
 void testSort();
 void testSortWithFormulaRefs();
+void testSortWithStrings();
 void testShiftCells();
 void testNoteDeleteRow();
 void testNoteDeleteCol();
@@ -384,6 +385,7 @@ public:
 CPPUNIT_TEST(testFindAreaPosColRight);
 CPPUNIT_TEST(testSort);
 CPPUNIT_TEST(testSortWithFormulaRefs);
+CPPUNIT_TEST(testSortWithStrings);
 CPPUNIT_TEST(testShiftCells);
 CPPUNIT_TEST(testNoteDeleteRow);
 CPPUNIT_TEST(testNoteDeleteCol);
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index a8f4d91..921ff25 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -916,7 +916,8 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
 break;
 case CELLTYPE_EDIT:
 {
-it1 = maCells.set(it1, nRow1, aCell2.mpEditText);
+it1 = maCells.set(
+it1, nRow1, 
const_castEditTextObject*(aCell2.mpEditText));
 EditTextObject* p;
 maCells.release(it1, nRow2, p);
 }
@@ -999,7 +1000,8 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
 break;
 case CELLTYPE_EDIT:
 {
-it1 = maCells.set(it1, nRow1, aCell2.mpEditText);
+it1 = maCells.set(
+it1, nRow1, 
const_castEditTextObject*(aCell2.mpEditText));
 EditTextObject* p;
 it1 = maCells.release(it1, nRow2, p);
 }
@@ -1031,7 +1033,8 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
 break;
 case CELLTYPE_EDIT:
 {
-it1 = maCells.set(it1, nRow1, aCell2.mpEditText);
+it1 = maCells.set(
+it1, nRow1, 
const_castEditTextObject*(aCell2.mpEditText));
 EditTextObject* p;
 it1 = maCells.release(it1, nRow2, p); // prevent it being 
overwritten.
 }
@@ -1079,7 +1082,7 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
 ;
 }
 
-maCells.set(it1, nRow2, aCell1.mpEditText);
+maCells.set(it1, nRow2, 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/qa sc/source

2013-12-11 Thread Kohei Yoshida
 sc/qa/unit/ucalc.cxx|   38 ++
 sc/qa/unit/ucalc.hxx|4 +++-
 sc/source/core/data/column3.cxx |2 +-
 3 files changed, 42 insertions(+), 2 deletions(-)

New commits:
commit 01e4c7a68289a0c820ab08c1d447f1779e8adde7
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Dec 11 18:37:42 2013 -0500

Fix paste as link, and a test case to catch it in the future.

Change-Id: I55fd3fabb7594ee2c635cc0b02dbf506bd5ab3df
(cherry picked from commit 4f94e6c20b2fee11429d7cbaef6b6fd1880317b2)

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 681283c..107825b 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3167,6 +3167,44 @@ void Test::testCopyPaste()
 m_pDoc-DeleteTab(0);
 }
 
+void Test::testCopyPasteAsLink()
+{
+sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // Turn on auto calc.
+
+m_pDoc-InsertTab(0, Sheet1);
+m_pDoc-InsertTab(1, Sheet2);
+
+m_pDoc-SetValue(ScAddress(0,0,0), 1); // A1
+m_pDoc-SetValue(ScAddress(0,1,0), 2); // A2
+m_pDoc-SetValue(ScAddress(0,2,0), 3); // A3
+
+ScRange aRange(0,0,0,0,2,0); // Copy A1:A3 to clip.
+ScDocument aClipDoc(SCDOCMODE_CLIP);
+copyToClip(m_pDoc, aRange, aClipDoc);
+
+aRange = ScRange(1,1,1,1,3,1); // Paste to B2:B4 on Sheet2.
+ScMarkData aMark;
+aMark.SetMarkArea(aRange);
+// Paste range as link.
+m_pDoc-CopyFromClip(aRange, aMark, IDF_CONTENTS, NULL, aClipDoc, true, 
true);
+
+// Check pasted content to make sure they reference the correct cells.
+ScFormulaCell* pFC = m_pDoc-GetFormulaCell(ScAddress(1,1,1));
+CPPUNIT_ASSERT_MESSAGE(This should be a formula cell., pFC);
+CPPUNIT_ASSERT_EQUAL(1.0, pFC-GetValue());
+
+pFC = m_pDoc-GetFormulaCell(ScAddress(1,2,1));
+CPPUNIT_ASSERT_MESSAGE(This should be a formula cell., pFC);
+CPPUNIT_ASSERT_EQUAL(2.0, pFC-GetValue());
+
+pFC = m_pDoc-GetFormulaCell(ScAddress(1,3,1));
+CPPUNIT_ASSERT_MESSAGE(This should be a formula cell., pFC);
+CPPUNIT_ASSERT_EQUAL(3.0, pFC-GetValue());
+
+m_pDoc-DeleteTab(1);
+m_pDoc-DeleteTab(0);
+}
+
 void Test::testCopyPasteTranspose()
 {
 
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 1298e73..1e2a483 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -220,6 +220,7 @@ public:
 void testDataArea();
 void testAutofilter();
 void testCopyPaste();
+void testCopyPasteAsLink();
 void testCopyPasteTranspose();
 void testMoveBlock();
 void testCopyPasteRelativeFormula();
@@ -361,8 +362,9 @@ public:
 CPPUNIT_TEST(testToggleRefFlag);
 CPPUNIT_TEST(testAutofilter);
 CPPUNIT_TEST(testCopyPaste);
-CPPUNIT_TEST(testMoveBlock);
+CPPUNIT_TEST(testCopyPasteAsLink);
 CPPUNIT_TEST(testCopyPasteTranspose);
+CPPUNIT_TEST(testMoveBlock);
 CPPUNIT_TEST(testCopyPasteRelativeFormula);
 CPPUNIT_TEST(testMergedCells);
 CPPUNIT_TEST(testUpdateReference);
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 7a7f0a7..921fd43 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -690,7 +690,7 @@ class CopyCellsFromClipHandler
 
 void insertRefCell(SCROW nSrcRow, SCROW nDestRow)
 {
-ScAddress aSrcPos(mnCol, nSrcRow, mnTab);
+ScAddress aSrcPos(mnSrcCol, nSrcRow, mnSrcTab);
 ScAddress aDestPos(mnCol, nDestRow, mnTab);
 ScSingleRefData aRef;
 aRef.InitAddress(aSrcPos);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/qa sc/source

2013-11-27 Thread Noel Power
 sc/qa/unit/subsequent_export-test.cxx  |4 +--
 sc/source/filter/excel/excrecds.cxx|   30 ++---
 sc/source/filter/oox/worksheetsettings.cxx |   30 ++---
 3 files changed, 32 insertions(+), 32 deletions(-)

New commits:
commit bf35ce3f91c8ee3f06a7a6c7a10dd17f05198ce5
Author: Noel Power noel.po...@suse.com
Date:   Thu Nov 21 18:12:50 2013 +

fdo#70499 selectn of lock/unlocked cells with worksheet protection reversed

The ooxml spec documentation is rather confusing ( for me at least ) and the
sense of the of the sheetProtection attributes as described seems reversed 
to
how I read it ( or maybe it is the equivelant option in ScTableProtection 
that
operates with the reverse sense shrug  ) In anycase the import ( and 
export )
have been adjusted to take that into consideration, also the export now 
actually
deals with the defaults correctly.

Change-Id: Ia69567b8898b39c9d171486cfa800e1748c5814b

diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 0e8ff65..ad2e2ee 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -800,8 +800,8 @@ void ScExportTest::testSheetProtectionXLSX()
 CPPUNIT_ASSERT( (sal_uInt8)aHash[1] == 61 );
 }
 // we could flesh out this check I guess
-CPPUNIT_ASSERT ( pTabProtect-isOptionEnabled( 
ScTableProtection::OBJECTS ) );
-CPPUNIT_ASSERT ( pTabProtect-isOptionEnabled( 
ScTableProtection::SCENARIOS ) );
+CPPUNIT_ASSERT ( !pTabProtect-isOptionEnabled( 
ScTableProtection::OBJECTS ) );
+CPPUNIT_ASSERT ( !pTabProtect-isOptionEnabled( 
ScTableProtection::SCENARIOS ) );
 }
 xDocSh-DoClose();
 }
diff --git a/sc/source/filter/excel/excrecds.cxx 
b/sc/source/filter/excel/excrecds.cxx
index 232371b..01b2432a 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -520,21 +520,21 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream 
rStrm )
 rWorksheet-singleElement( XML_sheetProtection,
 XML_sheet,  XclXmlUtils::ToPsz( true ),
 XML_password, sHash.getStr(),
-XML_objects, pTabProtect-isOptionEnabled( 
ScTableProtection::OBJECTS ) ? XclXmlUtils::ToPsz( true ) : NULL,
-XML_scenarios, pTabProtect-isOptionEnabled( 
ScTableProtection::SCENARIOS ) ? XclXmlUtils::ToPsz( true ) : NULL,
-XML_formatCells, pTabProtect-isOptionEnabled( 
ScTableProtection::FORMAT_CELLS ) ? NULL : XclXmlUtils::ToPsz( true ),
-XML_formatColumns, pTabProtect-isOptionEnabled( 
ScTableProtection::FORMAT_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ),
-XML_formatRows, pTabProtect-isOptionEnabled( 
ScTableProtection::FORMAT_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ),
-XML_insertColumns, pTabProtect-isOptionEnabled( 
ScTableProtection::INSERT_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ),
-XML_insertRows, pTabProtect-isOptionEnabled( 
ScTableProtection::INSERT_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ),
-XML_insertHyperlinks, pTabProtect-isOptionEnabled( 
ScTableProtection::INSERT_HYPERLINKS ) ? NULL : XclXmlUtils::ToPsz( true ),
-XML_deleteColumns, pTabProtect-isOptionEnabled( 
ScTableProtection::DELETE_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ),
-XML_deleteRows, pTabProtect-isOptionEnabled( 
ScTableProtection::DELETE_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ),
-XML_selectLockedCells, pTabProtect-isOptionEnabled( 
ScTableProtection::SELECT_LOCKED_CELLS ) ? XclXmlUtils::ToPsz( true ) : NULL,
-XML_sort, pTabProtect-isOptionEnabled( ScTableProtection::SORT ) 
? NULL : XclXmlUtils::ToPsz( true ),
-XML_autoFilter, pTabProtect-isOptionEnabled( 
ScTableProtection::AUTOFILTER ) ? NULL : XclXmlUtils::ToPsz( true ),
-XML_pivotTables, pTabProtect-isOptionEnabled( 
ScTableProtection::PIVOT_TABLES ) ? NULL : XclXmlUtils::ToPsz( true ),
-XML_selectUnlockedCells, pTabProtect-isOptionEnabled( 
ScTableProtection::SELECT_UNLOCKED_CELLS ) ? XclXmlUtils::ToPsz( true ) : NULL,
+XML_objects, pTabProtect-isOptionEnabled( 
ScTableProtection::OBJECTS ) ? NULL : XclXmlUtils::ToPsz( true ),
+XML_scenarios, pTabProtect-isOptionEnabled( 
ScTableProtection::SCENARIOS ) ? NULL : XclXmlUtils::ToPsz( true ),
+XML_formatCells, pTabProtect-isOptionEnabled( 
ScTableProtection::FORMAT_CELLS ) ? XclXmlUtils::ToPsz( false ) : NULL,
+XML_formatColumns, pTabProtect-isOptionEnabled( 
ScTableProtection::FORMAT_COLUMNS ) ? XclXmlUtils::ToPsz( false ) : NULL,
+XML_formatRows, pTabProtect-isOptionEnabled( 
ScTableProtection::FORMAT_ROWS ) ? XclXmlUtils::ToPsz( false ) : NULL,
+XML_insertColumns, pTabProtect-isOptionEnabled( 
ScTableProtection::INSERT_COLUMNS ) ? XclXmlUtils::ToPsz( false ) : NULL,

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/qa sc/source

2013-11-26 Thread Kohei Yoshida
 sc/qa/unit/ucalc_formula.cxx|   19 +++
 sc/source/core/data/column2.cxx |   10 +-
 2 files changed, 24 insertions(+), 5 deletions(-)

New commits:
commit 507d348454f6fd2d6475d2878bbc56efd9d73ca1
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Nov 26 20:34:45 2013 -0500

Fix additional bugs in the vector array fetching code.

And a test case to catch it.

Change-Id: I233269822b383afa9783bdc7318eddee31d1eaa3

diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index ff89dbe..a51308c 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -451,6 +451,25 @@ void Test::testFetchVectorRefArray()
 CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 2, 
baz));
 CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 3, 
quack));
 
+// Column H starts with formula cells.
+for (SCROW i = 0; i  10; ++i)
+m_pDoc-SetString(ScAddress(7,i,0), =ROW());
+
+m_pDoc-CalcAll();
+aArray = m_pDoc-FetchVectorRefArray(ScAddress(7,3,0), 3); // H4:H6
+CPPUNIT_ASSERT_MESSAGE(Failed to fetch vector ref array., 
aArray.isValid());
+CPPUNIT_ASSERT_MESSAGE(Array should have a numeric array., 
aArray.mpNumericArray);
+CPPUNIT_ASSERT_MESSAGE(Array should NOT have a string array., 
!aArray.mpStringArray);
+CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 0, 4.0));
+CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 1, 5.0));
+CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 2, 6.0));
+
+aArray = m_pDoc-FetchVectorRefArray(ScAddress(7,4,0), 10); // H5:H15
+CPPUNIT_ASSERT_MESSAGE(Failed to fetch vector ref array., 
aArray.isValid());
+CPPUNIT_ASSERT_MESSAGE(Array should have a numeric array., 
aArray.mpNumericArray);
+CPPUNIT_ASSERT_MESSAGE(Array should NOT have a string array., 
!aArray.mpStringArray);
+CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 0, 5.0));
+
 m_pDoc-DeleteTab(0);
 }
 
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 65d6c88..24cd615 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2752,9 +2752,9 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( 
SCROW nRow1, SCROW nRow2
 const double* pNum = NULL;
 rtl_uString** pStr = NULL;
 if (pColArray-mpNumArray)
-pNum = (*pColArray-mpNumArray)[0];
+pNum = (*pColArray-mpNumArray)[nRow1];
 if (pColArray-mpStrArray)
-pStr = (*pColArray-mpStrArray)[0];
+pStr = (*pColArray-mpStrArray)[nRow1];
 
 return formula::VectorRefArray(pNum, pStr);
 }
@@ -2772,9 +2772,9 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( 
SCROW nRow1, SCROW nRow2
 const double* pNum = NULL;
 rtl_uString** pStr = NULL;
 if (pColArray-mpNumArray)
-pNum = (*pColArray-mpNumArray)[0];
+pNum = (*pColArray-mpNumArray)[nRow1];
 if (pColArray-mpStrArray)
-pStr = (*pColArray-mpStrArray)[0];
+pStr = (*pColArray-mpStrArray)[nRow1];
 
 return formula::VectorRefArray(pNum, pStr);
 }
@@ -2790,7 +2790,7 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( 
SCROW nRow1, SCROW nRow2
 return formula::VectorRefArray();
 
 if (static_castsize_t(nRow2)  itBlk-size)
-return formula::VectorRefArray((*pColArray-mpNumArray)[0]);
+return 
formula::VectorRefArray((*pColArray-mpNumArray)[nRow1]);
 
 // Fill the remaining array with values from the following blocks.
 size_t nPos = itBlk-size;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits