Author: leiw
Date: Thu Sep 27 06:56:02 2012
New Revision: 1390864

URL: http://svn.apache.org/viewvc?rev=1390864&view=rev
Log:
#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

Modified:
    incubator/ooo/trunk/main/sc/source/core/tool/cellform.cxx
    incubator/ooo/trunk/main/sc/source/filter/excel/xistyle.cxx
    incubator/ooo/trunk/main/svl/inc/svl/zforlist.hxx
    incubator/ooo/trunk/main/svl/source/numbers/zforlist.cxx

Modified: incubator/ooo/trunk/main/sc/source/core/tool/cellform.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/tool/cellform.cxx?rev=1390864&r1=1390863&r2=1390864&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/tool/cellform.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/tool/cellform.cxx Thu Sep 27 
06:56:02 2012
@@ -129,11 +129,25 @@ void ScCellFormat::GetString( ScBaseCell
                             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
                                                {

Modified: incubator/ooo/trunk/main/sc/source/filter/excel/xistyle.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/excel/xistyle.cxx?rev=1390864&r1=1390863&r2=1390864&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/excel/xistyle.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/excel/xistyle.cxx Thu Sep 27 
06:56:02 2012
@@ -1513,8 +1513,9 @@ 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;
-        pXF->ApplyPattern( nScCol1, nScRow1, nScCol2, nScRow2, nScTab, 
nForceScNumFmt );
+        //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 );
     }
 }
 

Modified: incubator/ooo/trunk/main/svl/inc/svl/zforlist.hxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svl/inc/svl/zforlist.hxx?rev=1390864&r1=1390863&r2=1390864&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svl/inc/svl/zforlist.hxx (original)
+++ incubator/ooo/trunk/main/svl/inc/svl/zforlist.hxx Thu Sep 27 06:56:02 2012
@@ -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;

Modified: incubator/ooo/trunk/main/svl/source/numbers/zforlist.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svl/source/numbers/zforlist.cxx?rev=1390864&r1=1390863&r2=1390864&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svl/source/numbers/zforlist.cxx (original)
+++ incubator/ooo/trunk/main/svl/source/numbers/zforlist.cxx Thu Sep 27 
06:56:02 2012
@@ -3043,6 +3043,8 @@ sal_uInt16 SvNumberFormatter::GetYear200
        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()


Reply via email to