Author: orw
Date: Wed Sep 11 15:06:35 2013
New Revision: 1521894
URL: http://svn.apache.org/r1521894
Log:
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>
cherry-picked from trunk
Modified:
openoffice/branches/AOO401/ (props changed)
openoffice/branches/AOO401/main/ (props changed)
openoffice/branches/AOO401/main/sc/source/core/tool/cellform.cxx
openoffice/branches/AOO401/main/svl/inc/svl/zformat.hxx
openoffice/branches/AOO401/main/svl/source/numbers/zformat.cxx
Propchange: openoffice/branches/AOO401/
------------------------------------------------------------------------------
Merged /openoffice/trunk:r1521885
Propchange: openoffice/branches/AOO401/main/
------------------------------------------------------------------------------
Merged /openoffice/trunk/main:r1521885
Modified: openoffice/branches/AOO401/main/sc/source/core/tool/cellform.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO401/main/sc/source/core/tool/cellform.cxx?rev=1521894&r1=1521893&r2=1521894&view=diff
==============================================================================
--- openoffice/branches/AOO401/main/sc/source/core/tool/cellform.cxx (original)
+++ openoffice/branches/AOO401/main/sc/source/core/tool/cellform.cxx Wed Sep 11
15:06:35 2013
@@ -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
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();
Modified: openoffice/branches/AOO401/main/svl/inc/svl/zformat.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO401/main/svl/inc/svl/zformat.hxx?rev=1521894&r1=1521893&r2=1521894&view=diff
==============================================================================
--- openoffice/branches/AOO401/main/svl/inc/svl/zformat.hxx (original)
+++ openoffice/branches/AOO401/main/svl/inc/svl/zformat.hxx Wed Sep 11 15:06:35
2013
@@ -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;
Modified: openoffice/branches/AOO401/main/svl/source/numbers/zformat.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO401/main/svl/source/numbers/zformat.cxx?rev=1521894&r1=1521893&r2=1521894&view=diff
==============================================================================
--- openoffice/branches/AOO401/main/svl/source/numbers/zformat.cxx (original)
+++ openoffice/branches/AOO401/main/svl/source/numbers/zformat.cxx Wed Sep 11
15:06:35 2013
@@ -406,6 +406,10 @@ sal_Bool ImpSvNumFor::HasNewCurrency() c
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(
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