Kaydet (Commit) 2a3ef82d authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann

122927: adjusting change made for 121126 - allow formatting of boolean formula result as number,

but force it, if formatting code contains string/text section

Review by: Clarence Guo <clarence dot guo dot bj at gmail dot com>
üst 1a078f35
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <sfx2/objsh.hxx> #include <sfx2/objsh.hxx>
#include <svl/smplhint.hxx> #include <svl/smplhint.hxx>
#include <svl/zforlist.hxx> #include <svl/zforlist.hxx>
#include <svl/zformat.hxx>
#include "cellform.hxx" #include "cellform.hxx"
#include "cell.hxx" #include "cell.hxx"
...@@ -129,7 +130,9 @@ void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, String& rStr ...@@ -129,7 +130,9 @@ void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, String& rStr
rString.Erase(); rString.Erase();
else if ( pFCell->IsValue() ) else if ( pFCell->IsValue() )
{ {
if(pFCell->GetFormatType() == NUMBERFORMAT_LOGICAL) const SvNumberformat* pNumFmt = rFormatter.GetEntry( nFormat );
const bool bHasTextFormatCode = pNumFmt != NULL && pNumFmt->HasTextFormatCode();
if( pFCell->GetFormatType() == NUMBERFORMAT_LOGICAL && bHasTextFormatCode )
{ {
String aCellString; String aCellString;
double fValue = pFCell->GetValue(); double fValue = pFCell->GetValue();
......
...@@ -159,6 +159,9 @@ public: ...@@ -159,6 +159,9 @@ public:
void SetNatNumDate( sal_Bool bDate ) { aNatNum.SetDate( bDate ); } void SetNatNumDate( sal_Bool bDate ) { aNatNum.SetDate( bDate ); }
const SvNumberNatNum& GetNatNum() const { return aNatNum; } const SvNumberNatNum& GetNatNum() const { return aNatNum; }
// check, if the format code contains a subformat for text
const bool HasTextFormatCode() const;
private: private:
ImpSvNumberformatInfo aI; // Hilfsstruct fuer die restlichen Infos ImpSvNumberformatInfo aI; // Hilfsstruct fuer die restlichen Infos
String sColorName; // color name String sColorName; // color name
...@@ -332,6 +335,9 @@ public: ...@@ -332,6 +335,9 @@ public:
// Whether a new SYMBOLTYPE_CURRENCY is contained in the format // Whether a new SYMBOLTYPE_CURRENCY is contained in the format
sal_Bool HasNewCurrency() const; sal_Bool HasNewCurrency() const;
// check, if the format code contains a subformat for text
const bool HasTextFormatCode() const;
// Build string from NewCurrency for saving it SO50 compatible // Build string from NewCurrency for saving it SO50 compatible
void Build50Formatstring( String& rStr ) const; void Build50Formatstring( String& rStr ) const;
......
...@@ -406,6 +406,10 @@ sal_Bool ImpSvNumFor::HasNewCurrency() const ...@@ -406,6 +406,10 @@ sal_Bool ImpSvNumFor::HasNewCurrency() const
return sal_False; return sal_False;
} }
const bool ImpSvNumFor::HasTextFormatCode() const
{
return aI.eScannedType == NUMBERFORMAT_TEXT;
}
sal_Bool ImpSvNumFor::GetNewCurrencySymbol( String& rSymbol, sal_Bool ImpSvNumFor::GetNewCurrencySymbol( String& rSymbol,
String& rExtension ) const String& rExtension ) const
...@@ -1718,6 +1722,15 @@ sal_Bool SvNumberformat::HasNewCurrency() const ...@@ -1718,6 +1722,15 @@ sal_Bool SvNumberformat::HasNewCurrency() const
return sal_False; return sal_False;
} }
const bool SvNumberformat::HasTextFormatCode() const
{
for ( sal_uInt16 j=0; j<4; j++ )
{
if ( NumFor[j].HasTextFormatCode() )
return true;
}
return false;
}
sal_Bool SvNumberformat::GetNewCurrencySymbol( String& rSymbol, sal_Bool SvNumberformat::GetNewCurrencySymbol( String& rSymbol,
String& rExtension ) const String& rExtension ) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment