summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/formulacell.cxx2
-rw-r--r--sc/source/filter/inc/unitconverter.hxx3
-rw-r--r--sc/source/filter/oox/sheetdatabuffer.cxx12
-rw-r--r--sc/source/filter/oox/unitconverter.cxx16
4 files changed, 23 insertions, 10 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index c0fead29568e..26ae95956d93 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -683,7 +683,7 @@ ScFormulaCell::ScFormulaCell(
nSeenInIteration(0),
cMatrixFlag ( cInd ),
nFormatType(xGroup->mnFormatType),
- bDirty(false),
+ bDirty(true),
bChanged( false ),
bRunning( false ),
bCompile( false ),
diff --git a/sc/source/filter/inc/unitconverter.hxx b/sc/source/filter/inc/unitconverter.hxx
index 88921d1ceb5b..dbd642403ba1 100644
--- a/sc/source/filter/inc/unitconverter.hxx
+++ b/sc/source/filter/inc/unitconverter.hxx
@@ -88,6 +88,9 @@ public:
/** Returns a BIFF error code from the passed error string. */
sal_uInt8 calcBiffErrorCode( const OUString& rErrorCode ) const;
+ /** Returns an error string from the passed BIFF error code. */
+ const OUString& calcErrorString( sal_uInt8 nErrorCode ) const;
+
private:
/** Adds an error code to the internal maps. */
void addErrorCode( sal_uInt8 nErrorCode, const OUString& rErrorCode );
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index b3963df1ec09..eaab100ed52d 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -209,18 +209,14 @@ void SheetDataBuffer::setBooleanCell( const CellModel& rModel, bool bValue )
void SheetDataBuffer::setErrorCell( const CellModel& rModel, const OUString& rErrorCode )
{
- setErrorCell( rModel, getUnitConverter().calcBiffErrorCode( rErrorCode ) );
+ // Using the formula compiler now we can simply pass on the error string.
+ getFormulaBuffer().setCellFormula( rModel.maCellAddr, rErrorCode);
+ setCellFormat( rModel );
}
void SheetDataBuffer::setErrorCell( const CellModel& rModel, sal_uInt8 nErrorCode )
{
- OUStringBuffer aBuf;
- aBuf.append('{');
- aBuf.append(BiffHelper::calcDoubleFromError(nErrorCode));
- aBuf.append('}');
-
- getFormulaBuffer().setCellFormula(rModel.maCellAddr, aBuf.makeStringAndClear());
- setCellFormat( rModel );
+ setErrorCell( rModel, getUnitConverter().calcErrorString( nErrorCode));
}
void SheetDataBuffer::setDateCell( const CellModel& rModel, const OUString& rDateString )
diff --git a/sc/source/filter/oox/unitconverter.cxx b/sc/source/filter/oox/unitconverter.cxx
index 55ba77fe15e3..2eff67678064 100644
--- a/sc/source/filter/oox/unitconverter.cxx
+++ b/sc/source/filter/oox/unitconverter.cxx
@@ -120,7 +120,7 @@ UnitConverter::UnitConverter( const WorkbookHelper& rHelper ) :
addErrorCode( BIFF_ERR_REF, "#REF!" );
addErrorCode( BIFF_ERR_NAME, "#NAME?" );
addErrorCode( BIFF_ERR_NUM, "#NUM!" );
- addErrorCode( BIFF_ERR_NA, "#NA" );
+ addErrorCode( BIFF_ERR_NA, "#N/A" );
}
void UnitConverter::finalizeImport()
@@ -226,6 +226,20 @@ sal_uInt8 UnitConverter::calcBiffErrorCode( const OUString& rErrorCode ) const
return (aIt == maOoxErrCodes.end()) ? BIFF_ERR_NA : aIt->second;
}
+const OUString& UnitConverter::calcErrorString( sal_uInt8 nErrorCode ) const
+{
+ OoxErrorCodeMap::const_iterator iFail( maOoxErrCodes.end());
+ for (OoxErrorCodeMap::const_iterator aIt( maOoxErrCodes.begin()); aIt != maOoxErrCodes.end(); ++aIt)
+ {
+ if (aIt->second == nErrorCode)
+ return aIt->first;
+ if (aIt->second == BIFF_ERR_NA)
+ iFail = aIt;
+ }
+ assert(iFail != maOoxErrCodes.end()); // BIFF_ERR_NA really should be in the map..
+ return iFail->first;
+}
+
void UnitConverter::addErrorCode( sal_uInt8 nErrorCode, const OUString& rErrorCode )
{
maOoxErrCodes[ rErrorCode ] = nErrorCode;