sc/qa/unit/data/contentCSV/repeatedColumns.csv | 1 sc/qa/unit/data/ods/repeatedColumns.ods |binary sc/qa/unit/subsequent_filters-test.cxx | 16 ++++++++++++ sc/source/filter/xml/xmlcelli.cxx | 33 +++++++++++-------------- sc/source/filter/xml/xmlcelli.hxx | 6 +--- sc/source/filter/xml/xmlrowi.cxx | 4 +-- 6 files changed, 36 insertions(+), 24 deletions(-)
New commits: commit 870bccb97838e175febf22b8103503097c59bf58 Author: Daniel Bankston <daniel.e.banks...@gmail.com> Date: Tue Jun 5 21:30:25 2012 -0500 Fix repeating columns Change-Id: I35d8cc824bf7efceae6225432d5a261bd3883211 diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 08868c3..9e309f7 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -822,14 +822,14 @@ void ScXMLTableRowCellContext::EndElement() for (SCCOL i = 0; i < nCellsRepeated; ++i) { - aScCurrentPos.SetCol( aScCurrentPos.Col() + i ); + aScCurrentPos.SetCol( aScCellPos.Col() + i ); if (i > 0) rTables.AddColumn(false); if (!bIsEmpty) { for (SCROW j = 0; j < nRepeatedRows; ++j) { - aScCurrentPos.SetRow( aScCurrentPos.Row() + j ); + aScCurrentPos.SetRow( aScCellPos.Row() + j ); if( (aScCurrentPos.Col() == 0) && (j > 0) ) { rTables.AddRow(); commit 2d5b89ab94b5b960a14f4385b5631ad905c464a9 Author: Daniel Bankston <daniel.e.banks...@gmail.com> Date: Tue Jun 5 20:18:09 2012 -0500 Commit files used in repeated columns unit test Change-Id: Ie8e9a3a3f36caa55f495ef7a6670b73ebe9e2086 diff --git a/sc/qa/unit/data/contentCSV/repeatedColumns.csv b/sc/qa/unit/data/contentCSV/repeatedColumns.csv new file mode 100644 index 0000000..ffcf6c2 --- /dev/null +++ b/sc/qa/unit/data/contentCSV/repeatedColumns.csv @@ -0,0 +1 @@ +test,test,test,test,test,test diff --git a/sc/qa/unit/data/ods/repeatedColumns.ods b/sc/qa/unit/data/ods/repeatedColumns.ods new file mode 100644 index 0000000..f1e7b69 Binary files /dev/null and b/sc/qa/unit/data/ods/repeatedColumns.ods differ commit 9e7989cc8009eb008a09d5e78a80855088b54b7c Author: Daniel Bankston <daniel.e.banks...@gmail.com> Date: Tue Jun 5 20:16:00 2012 -0500 Added unit test for repeated columns in ODS import. Change-Id: Idf3cf3a1f6fd1487c83470a9e5df4c940ee64c73 diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index da349f7..cfe32e0 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -112,6 +112,7 @@ public: void testBugFixesXLS(); void testBugFixesXLSX(); void testBrokenQuotesCSV(); + void testRepeatedColumnsODS(); //change this test file only in excel and not in calc void testSharedFormulaXLSX(); @@ -137,6 +138,7 @@ public: CPPUNIT_TEST(testBugFixesODS); CPPUNIT_TEST(testBugFixesXLS); CPPUNIT_TEST(testBugFixesXLSX); + CPPUNIT_TEST(testRepeatedColumnsODS); #if 0 CPPUNIT_TEST(testBrokenQuotesCSV); #endif @@ -629,6 +631,20 @@ void ScFiltersTest::testBugFixesXLSX() xDocSh->DoClose(); } +void ScFiltersTest::testRepeatedColumnsODS() +{ + const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("repeatedColumns.")); + ScDocShellRef xDocSh = loadDoc( aFileNameBase, 0); + + ScDocument* pDoc = xDocSh->GetDocument(); + + rtl::OUString aCSVFileName; + createCSVPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("repeatedColumns.")), aCSVFileName); + testFile(aCSVFileName, pDoc, 0); + + xDocSh->DoClose(); +} + void ScFiltersTest::testBrokenQuotesCSV() { const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("fdo48621_broken_quotes.")); commit adfc8c78a2514ab6f4ba8821cbdbb237014eab70 Author: Daniel Bankston <daniel.e.banks...@gmail.com> Date: Tue Jun 5 20:10:01 2012 -0500 Remove comments Change-Id: I257a18325c3f385e14bed88aca6bdd2a8eba30b1 diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx index e8fecfd..3e624ee 100644 --- a/sc/source/filter/xml/xmlcelli.hxx +++ b/sc/source/filter/xml/xmlcelli.hxx @@ -60,10 +60,6 @@ class ScXMLTableRowCellContext : public SvXMLImportContext ScMyImpDetectiveObjVec* pDetectiveObjVec; ScMyImpCellRangeSource* pCellRangeSource; double fValue; - //~ sal_Int32 nMergedRows, nMergedCols; - //~ sal_Int32 nMatrixRows, nMatrixCols; - //~ sal_Int32 nRepeatedRows; - //~ sal_Int32 nCellsRepeated; SCROW nMergedRows, nMatrixRows, nRepeatedRows; SCCOL nMergedCols, nMatrixCols, nCellsRepeated; ScXMLImport& rXMLImport; commit 891d6b636f9c7a2d41505b2729deb1135215598e Author: Daniel Bankston <daniel.e.banks...@gmail.com> Date: Tue Jun 5 15:07:27 2012 -0500 Reduce amount of casts between SCCOL, SCROW, and sal_Int32 Change-Id: If20c7ae8e90b41521215072a83654e6e90502129 diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index e6cf759..08868c3 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -115,8 +115,8 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport, pCellRangeSource(NULL), fValue(0.0), nMergedRows(1), - nMergedCols(1), nRepeatedRows(nTempRepeatedRows), + nMergedCols(1), nCellsRepeated(1), rXMLImport((ScXMLImport&)rImport), eGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT), @@ -156,22 +156,22 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport, break; case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS: bIsMerged = true; - nMergedRows = sValue.toInt32(); + nMergedRows = static_cast<SCROW>(sValue.toInt32()); break; case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS: bIsMerged = true; - nMergedCols = sValue.toInt32(); + nMergedCols = static_cast<SCCOL>(sValue.toInt32()); break; case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_COLS: bIsMatrix = true; - nMatrixCols = sValue.toInt32(); + nMatrixCols = static_cast<SCCOL>(sValue.toInt32()); break; case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_ROWS: bIsMatrix = true; - nMatrixRows = sValue.toInt32(); + nMatrixRows = static_cast<SCROW>(sValue.toInt32()); break; case XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED: - nCellsRepeated = std::max( sValue.toInt32(), (sal_Int32) 1 ); + nCellsRepeated = static_cast<SCCOL>(std::max( sValue.toInt32(), (sal_Int32) 1 )); break; case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE: nCellType = GetScImport().GetCellType(sValue); @@ -407,8 +407,7 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr } OSL_ENSURE(bHasSubTable, "it should be a subtable"); pContext = new ScXMLTableContext( rXMLImport , nPrefix, - rLName, xAttrList, - true, nMergedCols); + rLName, xAttrList, true, static_cast<sal_Int32>(nMergedCols) ); nMergedCols = 1; bIsMerged = false; } @@ -546,8 +545,8 @@ void ScXMLTableRowCellContext::SetCellProperties(const uno::Reference<table::XCe ScUnoConversion::FillApiAddress( aCellAddress, aScCellAddress ); if (CellExists(aCellAddress) && pContentValidationName && !pContentValidationName->isEmpty()) { - sal_Int32 nBottom = aCellAddress.Row + nRepeatedRows - 1; - sal_Int32 nRight = aCellAddress.Column + nCellsRepeated - 1; + sal_Int32 nBottom = aCellAddress.Row + static_cast<sal_Int32>(nRepeatedRows) - 1; + sal_Int32 nRight = aCellAddress.Column + static_cast<sal_Int32>(nCellsRepeated) - 1; if (nBottom > MAXROW) nBottom = MAXROW; if (nRight > MAXCOL) @@ -776,7 +775,6 @@ void ScXMLTableRowCellContext::EndElement() UniReference< XMLTextImportHelper > aTextImport = rXMLImport.GetTextImport(); if (aTextImport->GetCursor().is()) { - //aTextImport->GetCursor()->gotoEnd(false); if( aTextImport->GetCursor()->goLeft( 1, true ) ) { aTextImport->GetText()->insertString( @@ -796,7 +794,7 @@ void ScXMLTableRowCellContext::EndElement() if (xCellRange.is()) { if (bIsMerged) - DoMerge(aScCellPos, static_cast<SCCOL>(nMergedCols - 1), static_cast<SCROW>(nMergedRows - 1)); + DoMerge(aScCellPos, nMergedCols - 1, nMergedRows - 1); if ( !pOUFormula ) { ::boost::optional< rtl::OUString > pOUText; @@ -822,14 +820,14 @@ void ScXMLTableRowCellContext::EndElement() mxAnnotationData.get() || pDetectiveObjVec || pCellRangeSource) bIsEmpty = false; - for (sal_Int32 i = 0; i < nCellsRepeated; ++i) + for (SCCOL i = 0; i < nCellsRepeated; ++i) { aScCurrentPos.SetCol( aScCurrentPos.Col() + i ); if (i > 0) rTables.AddColumn(false); if (!bIsEmpty) { - for (sal_Int32 j = 0; j < nRepeatedRows; ++j) + for (SCROW j = 0; j < nRepeatedRows; ++j) { aScCurrentPos.SetRow( aScCurrentPos.Row() + j ); if( (aScCurrentPos.Col() == 0) && (j > 0) ) @@ -1062,8 +1060,7 @@ void ScXMLTableRowCellContext::EndElement() if (nMatrixCols > 0 && nMatrixRows > 0) { rTables.AddMatrixRange( - aScCellPos.Col(), - aScCellPos.Row(), + aScCellPos.Col(), aScCellPos.Row(), aScCellPos.Col() + nMatrixCols - 1, aScCellPos.Row() + nMatrixRows - 1, pOUFormula->first, pOUFormula->second, eGrammar); diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx index 858270a..e8fecfd 100644 --- a/sc/source/filter/xml/xmlcelli.hxx +++ b/sc/source/filter/xml/xmlcelli.hxx @@ -60,10 +60,12 @@ class ScXMLTableRowCellContext : public SvXMLImportContext ScMyImpDetectiveObjVec* pDetectiveObjVec; ScMyImpCellRangeSource* pCellRangeSource; double fValue; - sal_Int32 nMergedRows, nMergedCols; - sal_Int32 nMatrixRows, nMatrixCols; - sal_Int32 nRepeatedRows; - sal_Int32 nCellsRepeated; + //~ sal_Int32 nMergedRows, nMergedCols; + //~ sal_Int32 nMatrixRows, nMatrixCols; + //~ sal_Int32 nRepeatedRows; + //~ sal_Int32 nCellsRepeated; + SCROW nMergedRows, nMatrixRows, nRepeatedRows; + SCCOL nMergedCols, nMatrixCols, nCellsRepeated; ScXMLImport& rXMLImport; formula::FormulaGrammar::Grammar eGrammar; sal_Int16 nCellType; diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx index edfe4e5..e2b055a 100644 --- a/sc/source/filter/xml/xmlrowi.cxx +++ b/sc/source/filter/xml/xmlrowi.cxx @@ -135,7 +135,7 @@ SvXMLImportContext *ScXMLTableRowContext::CreateChildContext( sal_uInt16 nPrefix { bHasCell = true; pContext = new ScXMLTableRowCellContext( GetScImport(), nPrefix, - rLName, xAttrList, false, nRepeatedRows + rLName, xAttrList, false, static_cast<SCROW>(nRepeatedRows) //this ); } @@ -145,7 +145,7 @@ SvXMLImportContext *ScXMLTableRowContext::CreateChildContext( sal_uInt16 nPrefix { bHasCell = true; pContext = new ScXMLTableRowCellContext( GetScImport(), nPrefix, - rLName, xAttrList, true, nRepeatedRows + rLName, xAttrList, true, static_cast<SCROW>(nRepeatedRows) //this ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits