Return-Path: X-Original-To: apmail-openoffice-commits-archive@www.apache.org Delivered-To: apmail-openoffice-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 374F210433 for ; Wed, 11 Sep 2013 14:54:50 +0000 (UTC) Received: (qmail 60693 invoked by uid 500); 11 Sep 2013 14:54:49 -0000 Delivered-To: apmail-openoffice-commits-archive@openoffice.apache.org Received: (qmail 60640 invoked by uid 500); 11 Sep 2013 14:54:49 -0000 Mailing-List: contact commits-help@openoffice.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openoffice.apache.org Delivered-To: mailing list commits@openoffice.apache.org Received: (qmail 60632 invoked by uid 99); 11 Sep 2013 14:54:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Sep 2013 14:54:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Sep 2013 14:54:45 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 65315238888A; Wed, 11 Sep 2013 14:54:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@openoffice.apache.org From: orw@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130911145424.65315238888A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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 #include #include +#include #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