diff options
author | Daniel Bankston <daniel.e.bankston@gmail.com> | 2012-06-05 15:07:27 -0500 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-06-17 17:04:01 +0200 |
commit | b39e4d439b6b0b7fad177967cadac3b822d5eb9f (patch) | |
tree | 666f4a142893df4b2db849829e9e97c1d3d48220 /sc | |
parent | a789ba1b71845c63e3bee770cd108001aa44c8ce (diff) |
Reduce amount of casts between SCCOL, SCROW, and sal_Int32
Change-Id: If20c7ae8e90b41521215072a83654e6e90502129
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 29 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.hxx | 10 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlrowi.cxx | 4 |
3 files changed, 21 insertions, 22 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index df877839f490..952fc6619670 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -110,8 +110,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), @@ -151,22 +151,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); @@ -402,8 +402,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; } @@ -541,8 +540,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) @@ -771,7 +770,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( @@ -791,7 +789,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; @@ -817,14 +815,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) ) @@ -1057,8 +1055,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 858270afc671..e8fecfd0ce03 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 09180ebc9d7e..bd84cdd69078 100644 --- a/sc/source/filter/xml/xmlrowi.cxx +++ b/sc/source/filter/xml/xmlrowi.cxx @@ -129,7 +129,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 ); } @@ -139,7 +139,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 ); } |