[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Tue Mar 19 20:59:51 PDT 2013
sc/inc/cellform.hxx | 6 +
sc/inc/document.hxx | 11 +-
sc/source/core/data/documen4.cxx | 2
sc/source/core/data/document.cxx | 19 ++-
sc/source/core/tool/cellform.cxx | 98 ++++++++++++++++++
sc/source/core/tool/chartarr.cxx | 116 ++++++++--------------
sc/source/filter/xml/xmlcelli.cxx | 68 ++++++------
sc/source/filter/xml/xmlexprt.cxx | 39 +++----
sc/source/ui/Accessibility/AccessibleCellBase.cxx | 6 -
sc/source/ui/unoobj/chart2uno.cxx | 15 --
10 files changed, 229 insertions(+), 151 deletions(-)
New commits:
commit acc9ac65bf2a2abe324f034077bebb06270ede98
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Mar 20 00:01:54 2013 -0400
Reduce use of ScValueCell outside ScDocument.
Change-Id: Ia1a39016e1389e551169ae8dda179cb38d30a42a
diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx
index 6b76c7d..e6314fc 100644
--- a/sc/inc/cellform.hxx
+++ b/sc/inc/cellform.hxx
@@ -26,6 +26,8 @@
class ScBaseCell;
class SvNumberFormatter;
class Color;
+class ScDocument;
+class ScAddress;
enum ScForceTextFmt {
ftDontForce, // numbers as numbers
@@ -45,6 +47,10 @@ public:
ScForceTextFmt eForceTextFmt = ftDontForce,
bool bUseStarFormat = false );
+ static OUString GetString(
+ const ScDocument& rDoc, const ScAddress& rPos, sal_uLong nFormat,
+ Color** ppColor, SvNumberFormatter& rFormatter, bool bNullVals = true,
+ bool bFormula = false, ScForceTextFmt eForceTextFmt = ftDontForce, bool bUseStarFormat = false );
static void GetInputString( ScBaseCell* pCell, sal_uLong nFormat, rtl::OUString& rString,
SvNumberFormatter& rFormatter );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index efecd06..6d00287 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -798,15 +798,16 @@ public:
SCCOL nCol1, SCROW nRow1,
SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark);
- SC_DLLPUBLIC OUString GetString( SCCOL nCol, SCROW nRow, SCTAB nTab );
+ SC_DLLPUBLIC OUString GetString( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
+ OUString GetString( const ScAddress& rPos ) const;
SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString );
SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, rtl::OUString& rString );
sal_uInt16 GetStringForFormula( const ScAddress& rPos, rtl::OUString& rString );
- SC_DLLPUBLIC double GetValue( const ScAddress& );
- SC_DLLPUBLIC double GetValue( const SCCOL nCol, SCROW nRow, SCTAB nTab) { ScAddress aAdr(nCol, nRow, nTab); return GetValue(aAdr);}
- SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue );
+ SC_DLLPUBLIC double GetValue( const ScAddress& rPos ) const;
+ SC_DLLPUBLIC double GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab ) const { ScAddress aAdr(nCol, nRow, nTab); return GetValue(aAdr);}
+ SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue ) const;
SC_DLLPUBLIC const EditTextObject* GetEditText( const ScAddress& rPos ) const;
- SC_DLLPUBLIC double RoundValueAsShown( double fVal, sal_uLong nFormat );
+ SC_DLLPUBLIC double RoundValueAsShown( double fVal, sal_uInt32 nFormat ) const;
SC_DLLPUBLIC void GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab,
sal_uInt32& rFormat ) const;
sal_uInt32 GetNumberFormat( const ScRange& rRange ) const;
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 6bd34a4..b34cc07 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -526,7 +526,7 @@ bool ScDocument::GetSelectionFunction( ScSubTotalFunc eFunc,
return !aData.bError;
}
-double ScDocument::RoundValueAsShown( double fVal, sal_uLong nFormat )
+double ScDocument::RoundValueAsShown( double fVal, sal_uInt32 nFormat ) const
{
short nType;
if ( (nType = GetFormatTable()->GetType( nFormat )) != NUMBERFORMAT_DATE
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 4515b2c..bdef0e0 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3035,7 +3035,7 @@ void ScDocument::SetValue( const ScAddress& rPos, double fVal )
maTabs[rPos.Tab()]->SetValue(rPos.Col(), rPos.Row(), fVal);
}
-OUString ScDocument::GetString( SCCOL nCol, SCROW nRow, SCTAB nTab )
+OUString ScDocument::GetString( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
{
if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
{
@@ -3047,6 +3047,16 @@ OUString ScDocument::GetString( SCCOL nCol, SCROW nRow, SCTAB nTab )
return EMPTY_OUSTRING;
}
+OUString ScDocument::GetString( const ScAddress& rPos ) const
+{
+ if (!TableExists(rPos.Tab()))
+ return EMPTY_OUSTRING;
+
+ OUString aStr;
+ maTabs[rPos.Tab()]->GetString(rPos.Col(), rPos.Row(), aStr);
+ return aStr;
+}
+
void ScDocument::GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rString )
{
if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
@@ -3116,7 +3126,7 @@ sal_uInt16 ScDocument::GetStringForFormula( const ScAddress& rPos, OUString& rSt
}
-void ScDocument::GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue )
+void ScDocument::GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue ) const
{
if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
rValue = maTabs[nTab]->GetValue( nCol, nRow );
@@ -3133,11 +3143,11 @@ const EditTextObject* ScDocument::GetEditText( const ScAddress& rPos ) const
return maTabs[nTab]->GetEditText(rPos.Col(), rPos.Row());
}
-double ScDocument::GetValue( const ScAddress& rPos )
+double ScDocument::GetValue( const ScAddress& rPos ) const
{
SCTAB nTab = rPos.Tab();
if ( nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
- return maTabs[nTab]->GetValue( rPos );
+ return maTabs[nTab]->GetValue(rPos.Col(), rPos.Row());
return 0.0;
}
@@ -3277,7 +3287,6 @@ ScBaseCell* ScDocument::GetCell( const ScAddress& rPos ) const
return NULL;
}
-
bool ScDocument::HasStringData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
{
if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 54d3245..254bb43 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -32,8 +32,6 @@
// Err527 Workaround
const ScFormulaCell* pLastFormulaTreeTop = 0;
-// -----------------------------------------------------------------------
-
void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, OUString& rString,
Color** ppColor, SvNumberFormatter& rFormatter,
sal_Bool bNullVals,
@@ -145,6 +143,102 @@ void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, OUString& rS
}
}
+OUString ScCellFormat::GetString(
+ const ScDocument& rDoc, const ScAddress& rPos, sal_uLong nFormat, Color** ppColor,
+ SvNumberFormatter& rFormatter, bool bNullVals, bool bFormula, ScForceTextFmt eForceTextFmt,
+ bool bUseStarFormat )
+{
+ OUString aString;
+ *ppColor = NULL;
+
+ CellType eType = rDoc.GetCellType(rPos);
+ switch (eType)
+ {
+ case CELLTYPE_STRING:
+ {
+ OUString aCellString = rDoc.GetString(rPos);
+ rFormatter.GetOutputString(aCellString, nFormat, aString, ppColor, bUseStarFormat);
+ }
+ break;
+ case CELLTYPE_EDIT:
+ {
+ OUString aCellString = rDoc.GetString(rPos);
+ rFormatter.GetOutputString(aCellString, nFormat, aString, ppColor);
+ }
+ break;
+ case CELLTYPE_VALUE:
+ {
+ double nValue = rDoc.GetValue(rPos);
+ if (!bNullVals && nValue == 0.0) aString = OUString();
+ else
+ {
+ if (eForceTextFmt == ftCheck)
+ {
+ if (nFormat && rFormatter.IsTextFormat(nFormat)) eForceTextFmt = ftForce;
+ }
+ if (eForceTextFmt == ftForce)
+ {
+ OUString aTemp;
+ rFormatter.GetOutputString(nValue, 0, aTemp, ppColor);
+ rFormatter.GetOutputString(aTemp, nFormat, aString, ppColor);
+ }
+ else rFormatter.GetOutputString(nValue, nFormat, aString, ppColor, bUseStarFormat);
+ }
+ }
+ break;
+ case CELLTYPE_FORMULA:
+ {
+ ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(rDoc.GetCell(rPos));
+ if (bFormula)
+ {
+ pFCell->GetFormula(aString);
+ }
+ else
+ {
+ // A macro started from the interpreter, which has
+ // access to Formular Cells, becomes a CellText, even if
+ // that triggers further interpretation, except if those
+ // cells are already being interpreted.
+ // IdleCalc generally doesn't trigger futher interpretation,
+ // as not to get Err522 (circular).
+ if (pFCell->GetDocument()->IsInInterpreter() &&
+ (!pFCell->GetDocument()->GetMacroInterpretLevel()
+ || pFCell->IsRunning()))
+ {
+ aString = OUString("...");
+ }
+ else
+ {
+ sal_uInt16 nErrCode = pFCell->GetErrCode();
+
+ // get the number format only after interpretation (GetErrCode):
+ if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) nFormat = pFCell->GetStandardFormat(rFormatter,
+ nFormat);
+
+ if (nErrCode != 0) aString = ScGlobal::GetErrorString(nErrCode);
+ else if (pFCell->IsEmptyDisplayedAsString()) aString = OUString();
+ else if (pFCell->IsValue())
+ {
+ double fValue = pFCell->GetValue();
+ if (!bNullVals && fValue == 0.0) aString = OUString();
+ else if (pFCell->IsHybridValueCell()) aString = pFCell->GetString();
+ else rFormatter.GetOutputString(fValue, nFormat, aString, ppColor, bUseStarFormat);
+ }
+ else
+ {
+ OUString aCellString = pFCell->GetString();
+ rFormatter.GetOutputString(aCellString, nFormat, aString, ppColor, bUseStarFormat);
+ }
+ }
+ }
+ }
+ break;
+ default:
+ ;
+ }
+ return aString;
+}
+
void ScCellFormat::GetInputString( ScBaseCell* pCell, sal_uLong nFormat, OUString& rString,
SvNumberFormatter& rFormatter )
{
diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx
index cd49af3..e88c6c1 100644
--- a/sc/source/core/tool/chartarr.cxx
+++ b/sc/source/core/tool/chartarr.cxx
@@ -114,6 +114,40 @@ ScMemChart* ScChartArray::CreateMemChart()
return CreateMemChartMulti(); // kann 0 Range besser ab als Single
}
+namespace {
+
+double getCellValue( const ScDocument& rDoc, const ScAddress& rPos, double fDefault, bool bCalcAsShown )
+{
+ double fRet = fDefault;
+
+ CellType eType = rDoc.GetCellType(rPos);
+ switch (eType)
+ {
+ case CELLTYPE_VALUE:
+ {
+ fRet = rDoc.GetValue(rPos);
+ if (bCalcAsShown && fRet != 0.0)
+ {
+ sal_uInt32 nFormat = rDoc.GetNumberFormat(rPos);
+ fRet = rDoc.RoundValueAsShown(fRet, nFormat);
+ }
+ }
+ break;
+ case CELLTYPE_FORMULA:
+ {
+ ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(rDoc.GetCell(rPos));
+ if (!pFCell->GetErrCode() && pFCell->IsValue())
+ fRet = pFCell->GetValue();
+ }
+ break;
+ default:
+ ;
+ }
+ return fRet;
+}
+
+}
+
ScMemChart* ScChartArray::CreateMemChartSingle()
{
SCSIZE nCol;
@@ -221,35 +255,13 @@ ScMemChart* ScChartArray::CreateMemChartSingle()
if ( bValidData )
{
bool bCalcAsShown = pDocument->GetDocOptions().IsCalcAsShown();
- ScBaseCell* pCell;
for (nCol=0; nCol<nColCount; nCol++)
{
for (nRow=0; nRow<nRowCount; nRow++)
{
- double nVal = DBL_MIN; // Hack for Chart to recognize empty cells
-
- pDocument->GetCell( aCols[nCol], aRows[nRow], nTab1, pCell );
- if (pCell)
- {
- CellType eType = pCell->GetCellType();
- if (eType == CELLTYPE_VALUE)
- {
- nVal = ((ScValueCell*)pCell)->GetValue();
- if ( bCalcAsShown && nVal != 0.0 )
- {
- sal_uInt32 nFormat;
- pDocument->GetNumberFormat( aCols[nCol],
- aRows[nRow], nTab1, nFormat );
- nVal = pDocument->RoundValueAsShown( nVal, nFormat );
- }
- }
- else if (eType == CELLTYPE_FORMULA)
- {
- ScFormulaCell* pFCell = (ScFormulaCell*)pCell;
- if ( (pFCell->GetErrCode() == 0) && pFCell->IsValue() )
- nVal = pFCell->GetValue();
- }
- }
+ // DBL_MIN is a Hack for Chart to recognize empty cells.
+ ScAddress aPos(aCols[nCol], aRows[nRow], nTab1);
+ double nVal = getCellValue(*pDocument, aPos, DBL_MIN, bCalcAsShown);
pMemChart->SetData(static_cast<short>(nCol), static_cast<short>(nRow), nVal);
}
}
@@ -358,29 +370,10 @@ ScMemChart* ScChartArray::CreateMemChartMulti()
{
double nVal = DBL_MIN; // Hack for Chart to recognize empty cells
const ScAddress* pPos = GetPositionMap()->GetPosition( nIndex );
- if ( pPos )
- { // sonst: Luecke
- ScBaseCell* pCell = pDocument->GetCell( *pPos );
- if (pCell)
- {
- CellType eType = pCell->GetCellType();
- if (eType == CELLTYPE_VALUE)
- {
- nVal = ((ScValueCell*)pCell)->GetValue();
- if ( bCalcAsShown && nVal != 0.0 )
- {
- sal_uLong nFormat = pDocument->GetNumberFormat( *pPos );
- nVal = pDocument->RoundValueAsShown( nVal, nFormat );
- }
- }
- else if (eType == CELLTYPE_FORMULA)
- {
- ScFormulaCell* pFCell = (ScFormulaCell*)pCell;
- if ( (pFCell->GetErrCode() == 0) && pFCell->IsValue() )
- nVal = pFCell->GetValue();
- }
- }
- }
+ if (pPos)
+ // otherwise: Gap
+ nVal = getCellValue(*pDocument, *pPos, DBL_MIN, bCalcAsShown);
+
pMemChart->SetData(static_cast<short>(nCol), static_cast<short>(nRow), nVal);
}
}
@@ -391,29 +384,10 @@ ScMemChart* ScChartArray::CreateMemChartMulti()
{
double nVal = DBL_MIN; // Hack for Chart to recognize empty cells
const ScAddress* pPos = GetPositionMap()->GetPosition( nIndex );
- if ( pPos )
- { // otherwise: Gap
- ScBaseCell* pCell = pDocument->GetCell( *pPos );
- if (pCell)
- {
- CellType eType = pCell->GetCellType();
- if (eType == CELLTYPE_VALUE)
- {
- nVal = ((ScValueCell*)pCell)->GetValue();
- if ( bCalcAsShown && nVal != 0.0 )
- {
- sal_uLong nFormat = pDocument->GetNumberFormat( *pPos );
- nVal = pDocument->RoundValueAsShown( nVal, nFormat );
- }
- }
- else if (eType == CELLTYPE_FORMULA)
- {
- ScFormulaCell* pFCell = (ScFormulaCell*)pCell;
- if ( (pFCell->GetErrCode() == 0) && pFCell->IsValue() )
- nVal = pFCell->GetValue();
- }
- }
- }
+ if (pPos)
+ // otherwise: Gap
+ nVal = getCellValue(*pDocument, *pPos, DBL_MIN, bCalcAsShown);
+
pMemChart->SetData(static_cast<short>(nCol), static_cast<short>(nRow), nVal);
}
}
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 6d376a7..86abcfb 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1093,22 +1093,17 @@ void ScXMLTableRowCellContext::PutValueCell( const ScAddress& rCurrentPos )
ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
SetFormulaCell(pFCell);
}
-
}
else //regular value cell
{
- // #i62435# Initialize the value cell's script type
- // if the default style's number format is latin-only.
- // If the cell uses a different format, the script type
- // will be reset when the style is applied.
+ // #i62435# Initialize the value cell's script type if the default
+ // style's number format is latin-only. If the cell uses a different
+ // format, the script type will be reset when the style is applied.
- ScBaseCell* pNewCell = new ScValueCell(fValue);
ScDocument* pDoc = rXMLImport.GetDocument();
+ pDoc->SetValue(rCurrentPos, fValue);
if ( rXMLImport.IsLatinDefaultStyle() )
pDoc->SetScriptType(rCurrentPos, SCRIPTTYPE_LATIN);
- pDoc->PutCell(
- rCurrentPos.Col(), rCurrentPos.Row(),
- rCurrentPos.Tab(), pNewCell );
}
rXMLImport.ProgressBarIncrement(false);
}
@@ -1227,38 +1222,43 @@ bool ScXMLTableRowCellContext::CellsAreRepeated() const
namespace {
// from ScCellObj::GetOutputString_Imp(). all of it may not be necessary.
-rtl::OUString getOutputString(ScDocument* pDoc, const ScAddress& aCellPos)
+OUString getOutputString( ScDocument* pDoc, const ScAddress& aCellPos )
{
- rtl::OUString aVal;
- if ( pDoc )
+ if (!pDoc)
+ return EMPTY_OUSTRING;
+
+ CellType eType = pDoc->GetCellType(aCellPos);
+ switch (eType)
{
- ScBaseCell* pCell = pDoc->GetCell( aCellPos );
- if ( pCell && pCell->GetCellType() != CELLTYPE_NOTE )
+ case CELLTYPE_NONE:
+ case CELLTYPE_NOTE:
+ return EMPTY_OUSTRING;
+ case CELLTYPE_EDIT:
{
- if ( pCell->GetCellType() == CELLTYPE_EDIT )
+ // GetString an der EditCell macht Leerzeichen aus Umbruechen,
+ // hier werden die Umbrueche aber gebraucht
+ const EditTextObject* pData = pDoc->GetEditText(aCellPos);
+ if (pData)
{
- // GetString an der EditCell macht Leerzeichen aus Umbruechen,
- // hier werden die Umbrueche aber gebraucht
- const EditTextObject* pData = static_cast<ScEditCell*>(pCell)->GetData();
- if (pData)
- {
- EditEngine& rEngine = pDoc->GetEditEngine();
- rEngine.SetText( *pData );
- aVal = rEngine.GetText( LINEEND_LF );
- }
- // Edit-Zellen auch nicht per NumberFormatter formatieren
- // (passend zur Ausgabe)
- }
- else
- {
- // wie in GetString am Dokument (column)
- Color* pColor;
- sal_uLong nNumFmt = pDoc->GetNumberFormat( aCellPos );
- ScCellFormat::GetString( pCell, nNumFmt, aVal, &pColor, *pDoc->GetFormatTable() );
+ EditEngine& rEngine = pDoc->GetEditEngine();
+ rEngine.SetText(*pData);
+ return rEngine.GetText(LINEEND_LF);
}
+ // Edit-Zellen auch nicht per NumberFormatter formatieren
+ // (passend zur Ausgabe)
+ }
+ break;
+ default:
+ {
+ // wie in GetString am Dokument (column)
+ Color* pColor;
+ sal_uLong nNumFmt = pDoc->GetNumberFormat(aCellPos);
+ return ScCellFormat::GetString(
+ *pDoc, aCellPos, nNumFmt, &pColor, *pDoc->GetFormatTable());
}
}
- return aVal;
+
+ return EMPTY_OUSTRING;
}
}
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 3fd048b..dd727ae 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -183,30 +183,31 @@ OUString lcl_GetRawString( ScDocument* pDoc, const ScAddress& rPos )
{
// return text/edit cell string content, with line feeds in edit cells
- String aVal; // document uses tools-strings
- if (pDoc)
+ if (!pDoc)
+ return EMPTY_OUSTRING;
+
+ switch (pDoc->GetCellType(rPos))
{
- ScBaseCell* pCell = pDoc->GetCell( rPos );
- if (pCell)
+ case CELLTYPE_STRING:
+ return pDoc->GetString(rPos);
+ case CELLTYPE_EDIT:
{
- CellType eType = pCell->GetCellType();
- if ( eType == CELLTYPE_STRING )
- aVal = static_cast<ScStringCell*>(pCell)->GetString(); // string cell: content
- else if ( eType == CELLTYPE_EDIT )
- {
- // edit cell: text with line breaks
- const EditTextObject* pData = static_cast<ScEditCell*>(pCell)->GetData();
- if (pData)
- {
- EditEngine& rEngine = pDoc->GetEditEngine();
- rEngine.SetText( *pData );
- aVal = rEngine.GetText( LINEEND_LF );
- }
- }
+ const EditTextObject* pData = pDoc->GetEditText(rPos);
+ if (!pData)
+ return EMPTY_OUSTRING;
+
+ EditEngine& rEngine = pDoc->GetEditEngine();
+ rEngine.SetText(*pData);
+ return rEngine.GetText(LINEEND_LF);
}
+ break;
+ default:
+ ;
}
- return aVal;
+
+ return EMPTY_OUSTRING;
}
+
} // anonymous namespace
//----------------------------------------------------------------------------
diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
index b9a0e08..a109f4f 100644
--- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
@@ -244,10 +244,10 @@ sal_Bool SAL_CALL
ScAccessibleCellBase::setCurrentValue( const uno::Any& aNumber )
throw (uno::RuntimeException)
{
- SolarMutexGuard aGuard;
+ SolarMutexGuard aGuard;
IsObjectValid();
double fValue = 0;
- sal_Bool bResult(false);
+ bool bResult = false;
if((aNumber >>= fValue) && mpDoc && mpDoc->GetDocumentShell())
{
uno::Reference<XAccessibleStateSet> xParentStates;
@@ -259,7 +259,7 @@ sal_Bool SAL_CALL
if (IsEditable(xParentStates))
{
ScDocShell* pDocShell = (ScDocShell*) mpDoc->GetDocumentShell();
- bResult = pDocShell->GetDocFunc().PutCell( maCellAddress, new ScValueCell(fValue), sal_True );
+ bResult = pDocShell->GetDocFunc().PutCell( maCellAddress, new ScValueCell(fValue), true);
}
}
return bResult;
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 9282a27..fcb7121 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2597,24 +2597,17 @@ void ScChart2DataSequence::BuildDataCache()
++nDataCount;
ScAddress aAdr(nCol, nRow, nTab);
- ScBaseCell* pCell = m_pDocument->GetCell(aAdr);
- if (!pCell)
- continue;
-
- if (pCell->HasStringData())
- rItem.maString = pCell->GetStringData();
- else
- rItem.maString = m_pDocument->GetString(nCol, nRow, nTab);
+ rItem.maString = m_pDocument->GetString(aAdr);
- switch (pCell->GetCellType())
+ switch (m_pDocument->GetCellType(aAdr))
{
case CELLTYPE_VALUE:
- rItem.mfValue = static_cast< ScValueCell*>(pCell)->GetValue();
+ rItem.mfValue = m_pDocument->GetValue(aAdr);
rItem.mbIsValue = true;
break;
case CELLTYPE_FORMULA:
{
- ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
+ ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(m_pDocument->GetCell(aAdr));
sal_uInt16 nErr = pFCell->GetErrCode();
if (nErr)
break;
More information about the Libreoffice-commits
mailing list