diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-15 21:22:02 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-15 22:12:42 -0400 |
commit | e595fb27c6ba64fd5112d4fd919067f0205ccffa (patch) | |
tree | d0528986d6f25cf3795771abc05966c885158355 /sc | |
parent | e022d9eb46f5de13306da4a61b9899c79cf6170b (diff) |
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
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/column.cxx | 16 | ||||
-rw-r--r-- | sc/source/core/data/column2.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/column3.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/table1.cxx | 2 |
5 files changed, 15 insertions, 16 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 404dc485a246..e8a39ad580ad 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 92263af973b6..330154226f14 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 3c1dc965a091..28340a2e0251 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 1d75d56ec327..16d427790f6c 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 cfe0e57d995f..38d705c9100d 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); } |