summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Lei <leiw@apache.org>2012-09-27 05:56:02 +0000
committerWang Lei <leiw@apache.org>2012-09-27 05:56:02 +0000
commit51bac3e464cdd4fb0afb9b7d1c2a2d7f85ec92ed (patch)
tree7bf43b5f9a7c1406d3e4188bc0341306ef910415
parentad1186563ea12ce63dfdf738c332bf712084f633 (diff)
#i121126 User-definded format code is lost with a cell which value is TRUE or FALSE when importing xls file
Patch by: Zhang Lu Review by: Wang Lei
Notes
Notes: reject: wrong solution ignoring locale from number format
-rw-r--r--sc/source/core/tool/cellform.cxx22
-rw-r--r--sc/source/filter/excel/xistyle.cxx3
-rw-r--r--svl/inc/svl/zforlist.hxx3
-rw-r--r--svl/source/numbers/zforlist.cxx2
4 files changed, 25 insertions, 5 deletions
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 041855d8f1d2..010643c6e474 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -129,11 +129,25 @@ void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, String& rStr
rString.Erase();
else if ( pFCell->IsValue() )
{
- double fValue = pFCell->GetValue();
- if ( !bNullVals && fValue == 0.0 )
- rString.Erase();
+ if(pFCell->GetFormatType() == NUMBERFORMAT_LOGICAL)
+ {
+ String aCellString;
+ double fValue = pFCell->GetValue();
+ if(fValue)
+ aCellString = rFormatter.GetTrueString();
+ else
+ aCellString = rFormatter.GetFalseString();
+ rFormatter.GetOutputString( aCellString, nFormat, rString, ppColor );
+
+ }
else
- rFormatter.GetOutputString( fValue, nFormat, rString, ppColor );
+ {
+ double fValue = pFCell->GetValue();
+ if ( !bNullVals && fValue == 0.0 )
+ rString.Erase();
+ else
+ rFormatter.GetOutputString( fValue, nFormat, rString, ppColor );
+ }
}
else
{
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 239bdf5a805e..3025b24489fa 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1513,7 +1513,8 @@ void XclImpXFBuffer::ApplyPattern(
if( XclImpXF* pXF = GetXF( rXFIndex.GetXFIndex() ) )
{
// #108770# set 'Standard' number format for all Boolean cells
- sal_uLong nForceScNumFmt = rXFIndex.IsBoolCell() ? GetNumFmtBuffer().GetStdScNumFmt() : NUMBERFORMAT_ENTRY_NOT_FOUND;
+ //sal_uLong nForceScNumFmt = rXFIndex.IsBoolCell() ? GetNumFmtBuffer().GetStdScNumFmt() : NUMBERFORMAT_ENTRY_NOT_FOUND;
+ sal_uLong nForceScNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND;
pXF->ApplyPattern( nScCol1, nScRow1, nScCol2, nScRow2, nScTab, nForceScNumFmt );
}
}
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 2264665a7292..273ff62c649e 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -796,6 +796,9 @@ public:
/// Skip a NumberFormatter in stream, Chart needs this
static void SkipNumberFormatterInStream( SvStream& );
+ const String& GetTrueString();
+ const String& GetFalseString();
+
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager;
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 2e4e9e7ef9d9..683add241749 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -3043,6 +3043,8 @@ sal_uInt16 SvNumberFormatter::GetYear2000Default()
return (sal_uInt16) ::utl::MiscCfg().GetYear2000();
}
+const String& SvNumberFormatter::GetTrueString(){return pFormatScanner->GetTrueString();}
+const String& SvNumberFormatter::GetFalseString(){return pFormatScanner->GetFalseString();}
// static
const NfCurrencyTable& SvNumberFormatter::GetTheCurrencyTable()