summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-05-03 22:54:53 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-06-02 03:24:56 +0200
commit267f7a630b33f02a8dfda55945ee10b2c5f615f9 (patch)
tree84ac0190572da721ef74c5d8a9eb4033775fe79e
parentddade7a4751b9b7f6459f48ffdf3dedf31d151f3 (diff)
preparations for inherited number format removal
Without inherited number format these calls are unnecessary. Change-Id: I359cb217eb32d98df29bb6d2c0fbb14367e30425
-rw-r--r--sc/inc/document.hxx8
-rw-r--r--sc/inc/formulacell.hxx2
-rw-r--r--sc/source/core/data/dociter.cxx25
-rw-r--r--sc/source/core/data/document.cxx7
-rw-r--r--sc/source/core/tool/interpr4.cxx4
-rw-r--r--sc/source/core/tool/interpr5.cxx4
-rw-r--r--sc/source/filter/html/htmlexp.cxx3
-rw-r--r--sc/source/ui/app/inputhdl.cxx4
-rw-r--r--sc/source/ui/docshell/docsh8.cxx6
-rw-r--r--sc/source/ui/view/output2.cxx14
10 files changed, 12 insertions, 65 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index d7d63f713a20..eb29deaa2f7f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -849,13 +849,7 @@ public:
SC_DLLPUBLIC sal_uInt32 GetNumberFormat( const ScAddress& ) const;
void SetNumberFormat( const ScAddress& rPos, sal_uInt32 nNumberFormat );
- /**
- * If no number format attribute is set and a formula cell pointer is
- * passed, the calculated number format of the formula cell is returned.
- * pCell may be NULL.
- */
- SC_DLLPUBLIC void GetNumberFormatInfo( short& nType, sal_uLong& nIndex,
- const ScAddress& rPos, const ScFormulaCell* pCell ) const;
+ void GetNumberFormatInfo( short& nType, sal_uLong& nIndex, const ScAddress& rPos ) const;
void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormula ) const;
const ScTokenArray* GetFormulaTokens( const ScAddress& rPos ) const;
SC_DLLPUBLIC const ScFormulaCell* GetFormulaCell( const ScAddress& rPos ) const;
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 4ff97f3b2fa1..9dce5fa77508 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -216,8 +216,6 @@ public:
sal_uInt16 GetErrCode(); // interpret first if necessary
sal_uInt16 GetRawError(); // don't interpret, just return code or result error
short GetFormatType() const { return nFormatType; }
- void GetFormatInfo( short& nType, sal_uLong& nIndex ) const
- { nType = nFormatType; nIndex = nFormatIndex; }
sal_uInt8 GetMatrixFlag() const { return cMatrixFlag; }
ScTokenArray* GetCode() const { return pCode; }
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index b834a0c33b66..8f6d1c2eaa2f 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -415,27 +415,7 @@ void ScValueIterator::GetCurNumFmtInfo( short& nType, sal_uLong& nIndex )
{
const ScColumn* pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
nNumFmtIndex = pCol->GetNumberFormat( nRow );
- if ( (nNumFmtIndex % SV_COUNTRY_LANGUAGE_OFFSET) == 0 )
- {
- const ScBaseCell* pCell;
- SCSIZE nIdx = nColRow - 1;
- // Something might have rearranged; be on the safe side
- if ( nIdx < pCol->maItems.size() && pCol->maItems[nIdx].nRow == nRow )
- pCell = pCol->maItems[nIdx].pCell;
- else
- {
- if ( pCol->Search( nRow, nIdx ) )
- pCell = pCol->maItems[nIdx].pCell;
- else
- pCell = NULL;
- }
- if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
- ((const ScFormulaCell*)pCell)->GetFormatInfo( nNumFmtType, nNumFmtIndex );
- else
- nNumFmtType = pDoc->GetFormatTable()->GetType( nNumFmtIndex );
- }
- else
- nNumFmtType = pDoc->GetFormatTable()->GetType( nNumFmtIndex );
+ nNumFmtType = pDoc->GetFormatTable()->GetType( nNumFmtIndex );
bNumValid = true;
}
nType = nNumFmtType;
@@ -612,8 +592,7 @@ bool ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value& rValue)
rValue.mfValue = ((ScFormulaCell*)pCell)->GetValue();
rValue.mbIsNumber = true;
mpDoc->GetNumberFormatInfo( nNumFmtType,
- nNumFmtIndex, ScAddress(nCol, nRow, nTab),
- static_cast<ScFormulaCell*>(pCell));
+ nNumFmtIndex, ScAddress(nCol, nRow, nTab));
rValue.mnError = ((ScFormulaCell*)pCell)->GetErrCode();
return true; // Found it!
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 9a9201c56fbe..e1997fe22be5 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3321,16 +3321,13 @@ void ScDocument::SetNumberFormat( const ScAddress& rPos, sal_uInt32 nNumberForma
}
void ScDocument::GetNumberFormatInfo( short& nType, sal_uLong& nIndex,
- const ScAddress& rPos, const ScFormulaCell* pCell ) const
+ const ScAddress& rPos ) const
{
SCTAB nTab = rPos.Tab();
if ( nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
{
nIndex = maTabs[nTab]->GetNumberFormat( rPos );
- if ( (nIndex % SV_COUNTRY_LANGUAGE_OFFSET) == 0 && pCell)
- pCell->GetFormatInfo(nType, nIndex);
- else
- nType = GetFormatTable()->GetType( nIndex );
+ nType = GetFormatTable()->GetType( nIndex );
}
else
{
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index adbf2685cb9e..5b654b72b3bd 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -464,7 +464,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, ScRefCellValue&
{
fValue = pFCell->GetValue();
pDok->GetNumberFormatInfo( nCurFmtType, nCurFmtIndex,
- rPos, pFCell );
+ rPos );
}
else
{
@@ -980,7 +980,7 @@ void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString,
{
bool bInherited = (aCell.meType == CELLTYPE_FORMULA);
if (pRetTypeExpr && pRetIndexExpr)
- pDok->GetNumberFormatInfo(*pRetTypeExpr, *pRetIndexExpr, rAddress, (bInherited ? aCell.mpFormula : NULL));
+ pDok->GetNumberFormatInfo(*pRetTypeExpr, *pRetIndexExpr, rAddress);
PushTempToken( new ScEmptyCellToken( bInherited, bDisplayEmptyAsString));
return;
}
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index fc904a4d5648..df47cf0d7a31 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -3293,7 +3293,7 @@ void ScInterpreter::ScMatRef()
else
{
PushDouble(nMatVal.fVal); // handles DoubleError
- pDok->GetNumberFormatInfo(nCurFmtType, nCurFmtIndex, aAdr, aCell.mpFormula);
+ pDok->GetNumberFormatInfo(nCurFmtType, nCurFmtIndex, aAdr);
nFuncFmtType = nCurFmtType;
nFuncFmtIndex = nCurFmtIndex;
}
@@ -3312,7 +3312,7 @@ void ScInterpreter::ScMatRef()
OUString aVal = aCell.mpFormula->GetString();
PushString( aVal );
}
- pDok->GetNumberFormatInfo(nCurFmtType, nCurFmtIndex, aAdr, aCell.mpFormula);
+ pDok->GetNumberFormatInfo(nCurFmtType, nCurFmtIndex, aAdr);
nFuncFmtType = nCurFmtType;
nFuncFmtIndex = nCurFmtIndex;
}
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index af79ad720337..603dfee65738 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -1065,9 +1065,6 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
break;
case CELLTYPE_FORMULA:
fVal = aCell.mpFormula->GetValue();
- if ( (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 )
- nFormat = ScGlobal::GetStandardFormat( fVal, *pFormatter,
- nFormat, aCell.mpFormula->GetFormatType() );
break;
default:
OSL_FAIL( "value data with unsupported cell type" );
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index e1f551b655fd..90cba301d99f 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1372,8 +1372,8 @@ void ScInputHandler::FormulaPreview()
EditView* pActiveView = pTopView ? pTopView : pTableView;
if ( pActiveView && pActiveViewSh )
{
- String aPart = pActiveView->GetSelected();
- if (!aPart.Len())
+ OUString aPart = pActiveView->GetSelected();
+ if (aPart.isEmpty())
aPart = pEngine->GetText(0);
ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocShell()->GetDocument();
aValue = lcl_Calculate( aPart, pDoc, aCursorPos );
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 120b3863dfed..2eb7b253dd7d 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -628,12 +628,6 @@ void lcl_GetColumnTypes(
{
sal_uInt32 nFormat;
pDoc->GetNumberFormat( nCol, nFirstDataRow, nTab, nFormat );
- if (aCell.meType == CELLTYPE_FORMULA && ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0))
- {
- nFormat = ScGlobal::GetStandardFormat(
- aCell.mpFormula->GetValue(), *pNumFmt, nFormat,
- aCell.mpFormula->GetFormatType());
- }
switch ( pNumFmt->GetType( nFormat ) )
{
case NUMBERFORMAT_LOGICAL :
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 33432fa796a2..1f93b5e712f7 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -596,15 +596,6 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScRefCellValue& rCell, long nWidth
// If it's formula, the result must be a value.
if (!pFCell->IsValue())
return;
-
- if (pFCell->GetFormatType() != NUMBERFORMAT_NUMBER)
- {
- // Make sure the format type implicitly set by the interpreter is
- // of pure numeric type. We don't want to adjust date and time
- // values here.
- SetHashText();
- return;
- }
}
sal_uLong nFormat = GetResultValueFormat(rCell);
@@ -798,10 +789,7 @@ sal_uLong ScDrawStringsVars::GetResultValueFormat( const ScRefCellValue& rCell )
// Get the effective number format, including formula result types.
// This assumes that a formula cell has already been calculated.
- if ((nValueFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 && rCell.meType == CELLTYPE_FORMULA)
- return rCell.mpFormula->GetStandardFormat(*pOutput->mpDoc->GetFormatTable(), nValueFormat);
- else
- return nValueFormat;
+ return nValueFormat;
}
//==================================================================