summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <orw@apache.org>2013-09-11 14:54:23 +0000
committerOliver-Rainer Wittmann <orw@apache.org>2013-09-11 14:54:23 +0000
commit2a3ef82d52df74abf39e17f5e5f9f12f9a985cb3 (patch)
treee36e9fb0edfb2dfe8710c1a9106444287408acdf
parent1a078f3584e8a288c0ec33f176638406423ade63 (diff)
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>
Notes
Notes: reject: see 51bac3e464cdd4fb0afb9b7d1c2a2d7f85ec92ed
-rw-r--r--sc/source/core/tool/cellform.cxx5
-rw-r--r--svl/inc/svl/zformat.hxx6
-rw-r--r--svl/source/numbers/zformat.cxx13
3 files changed, 23 insertions, 1 deletions
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 010643c6e474..f8bef323a788 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -28,6 +28,7 @@
#include <sfx2/objsh.hxx>
#include <svl/smplhint.hxx>
#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
#include "cellform.hxx"
#include "cell.hxx"
@@ -129,7 +130,9 @@ void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, String& rStr
rString.Erase();
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;
double fValue = pFCell->GetValue();
diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx
index cf9f40b26336..1f0becdda7af 100644
--- a/svl/inc/svl/zformat.hxx
+++ b/svl/inc/svl/zformat.hxx
@@ -159,6 +159,9 @@ public:
void SetNatNumDate( sal_Bool bDate ) { aNatNum.SetDate( bDate ); }
const SvNumberNatNum& GetNatNum() const { return aNatNum; }
+ // check, if the format code contains a subformat for text
+ const bool HasTextFormatCode() const;
+
private:
ImpSvNumberformatInfo aI; // Hilfsstruct fuer die restlichen Infos
String sColorName; // color name
@@ -332,6 +335,9 @@ public:
// Whether a new SYMBOLTYPE_CURRENCY is contained in the format
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
void Build50Formatstring( String& rStr ) const;
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index c11a7595138c..e8df25ed6b72 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -406,6 +406,10 @@ sal_Bool ImpSvNumFor::HasNewCurrency() const
return sal_False;
}
+const bool ImpSvNumFor::HasTextFormatCode() const
+{
+ return aI.eScannedType == NUMBERFORMAT_TEXT;
+}
sal_Bool ImpSvNumFor::GetNewCurrencySymbol( String& rSymbol,
String& rExtension ) const
@@ -1718,6 +1722,15 @@ sal_Bool SvNumberformat::HasNewCurrency() const
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,
String& rExtension ) const