sc/source/core/data/column.cxx | 16 ++++++++-------- sc/source/core/data/column2.cxx | 5 ++--- sc/source/core/data/column3.cxx | 6 +++--- sc/source/core/data/document.cxx | 2 +- sc/source/core/data/table1.cxx | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-)
New commits: commit 195ad38d8b839b6248ef4205a3bd6f7ed97a5ad1 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Mar 15 21:22:02 2013 -0400 Actually unknown script type doesn't equal empty script type (0). Let's differentiate the two types. A new cell starts with an unknown script type, whereas empty cells have a script type of 0 (empty). Change-Id: Id66857100ed213c5cfc37e48789448d94e97a5d2 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 404dc48..e8a39ad 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -61,23 +61,23 @@ ScNeededSizeOptions::ScNeededSizeOptions() : void ScColumn::SwapScriptTypes( ScriptType& rSrc, SCROW nSrcRow, ScriptType& rDest, SCROW nDestRow ) { - unsigned short nSrcVal = SC_SCRIPTTYPE_UNKNOWN; - unsigned short nDestVal = SC_SCRIPTTYPE_UNKNOWN; + unsigned short nSrcVal = 0; + unsigned short nDestVal = 0; if (!rSrc.is_empty(nSrcRow)) nSrcVal = rSrc.get<unsigned short>(nSrcRow); if (!rDest.is_empty(nDestRow)) nDestVal = rDest.get<unsigned short>(nDestRow); - if (nDestVal == SC_SCRIPTTYPE_UNKNOWN) - rSrc.set_empty(nSrcRow, nSrcRow); - else + if (nDestVal) rSrc.set(nSrcRow, nDestVal); - - if (nSrcVal == SC_SCRIPTTYPE_UNKNOWN) - rDest.set_empty(nDestRow, nDestRow); else + rSrc.set_empty(nSrcRow, nSrcRow); + + if (nSrcVal) rDest.set(nDestRow, nSrcVal); + else + rDest.set_empty(nDestRow, nDestRow); } ScColumn::ScColumn() : diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 92263af..3301542 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1509,7 +1509,7 @@ void ScColumn::SetTextWidth(SCROW nRow, unsigned short nWidth) sal_uInt8 ScColumn::GetScriptType( SCROW nRow ) const { if (!ValidRow(nRow) || maScriptTypes.is_empty(nRow)) - return SC_SCRIPTTYPE_UNKNOWN; + return 0; return maScriptTypes.get<unsigned short>(nRow); } @@ -1519,8 +1519,7 @@ void ScColumn::SetScriptType( SCROW nRow, sal_uInt8 nType ) if (!ValidRow(nRow)) return; - if (nType == SC_SCRIPTTYPE_UNKNOWN) - // empty element represents unknown script type. + if (!nType) maScriptTypes.set_empty(nRow, nRow); else maScriptTypes.set<unsigned short>(nRow, nType); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 3c1dc96..28340a2 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -97,7 +97,7 @@ void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell ) } maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY); - maScriptTypes.set_empty(nRow, nRow); // empty element represents unknown script state. + maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN); CellStorageModified(); } // When we insert from the Clipboard we still have wrong (old) References! @@ -143,7 +143,7 @@ void ScColumn::Append( SCROW nRow, ScBaseCell* pCell ) maItems.back().nRow = nRow; maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY); - maScriptTypes.set_empty(nRow, nRow); // empty element represents unknown script state. + maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN); CellStorageModified(); } @@ -1447,7 +1447,7 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString, pOldCell->Delete(); maItems[i].pCell = pNewCell; // Replace maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY); - maScriptTypes.set_empty(nRow, nRow); // empty element represents unknown script state. + maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN); CellStorageModified(); if ( pNewCell->GetCellType() == CELLTYPE_FORMULA ) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 1d75d56..16d4277 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -5717,7 +5717,7 @@ sal_uInt8 ScDocument::GetScriptType( const ScAddress& rPos ) const if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab]) return maTabs[nTab]->GetScriptType(rPos.Col(), rPos.Row()); - return SC_SCRIPTTYPE_UNKNOWN; + return 0; } void ScDocument::SetScriptType( const ScAddress& rPos, sal_uInt8 nType ) diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index cfe0e57..38d705c 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -2083,7 +2083,7 @@ sal_uLong ScTable::AddCondFormat( ScConditionalFormat* pNew ) sal_uInt8 ScTable::GetScriptType( SCCOL nCol, SCROW nRow ) const { if (!ValidCol(nCol)) - return SC_SCRIPTTYPE_UNKNOWN; + return 0; return aCol[nCol].GetScriptType(nRow); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits