openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1521885 - in /openoffice/trunk/main: sc/source/core/tool/cellform.cxx svl/inc/svl/zformat.hxx svl/source/numbers/zformat.cxx
Date Wed, 11 Sep 2013 14:54:24 GMT
Author: orw
Date: Wed Sep 11 14:54:23 2013
New Revision: 1521885

URL: http://svn.apache.org/r1521885
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>


Modified:
    openoffice/trunk/main/sc/source/core/tool/cellform.cxx
    openoffice/trunk/main/svl/inc/svl/zformat.hxx
    openoffice/trunk/main/svl/source/numbers/zformat.cxx

Modified: openoffice/trunk/main/sc/source/core/tool/cellform.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/core/tool/cellform.cxx?rev=1521885&r1=1521884&r2=1521885&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/core/tool/cellform.cxx (original)
+++ openoffice/trunk/main/sc/source/core/tool/cellform.cxx Wed Sep 11 14:54:23 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/trunk/main/svl/inc/svl/zformat.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svl/inc/svl/zformat.hxx?rev=1521885&r1=1521884&r2=1521885&view=diff
==============================================================================
--- openoffice/trunk/main/svl/inc/svl/zformat.hxx (original)
+++ openoffice/trunk/main/svl/inc/svl/zformat.hxx Wed Sep 11 14:54:23 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/trunk/main/svl/source/numbers/zformat.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svl/source/numbers/zformat.cxx?rev=1521885&r1=1521884&r2=1521885&view=diff
==============================================================================
--- openoffice/trunk/main/svl/source/numbers/zformat.cxx (original)
+++ openoffice/trunk/main/svl/source/numbers/zformat.cxx Wed Sep 11 14:54:23 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



Mime
View raw message