Return-Path: X-Original-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7347CD1DC for ; Thu, 21 Jun 2012 07:27:41 +0000 (UTC) Received: (qmail 57424 invoked by uid 500); 21 Jun 2012 07:27:41 -0000 Delivered-To: apmail-incubator-ooo-commits-archive@incubator.apache.org Received: (qmail 57349 invoked by uid 500); 21 Jun 2012 07:27:40 -0000 Mailing-List: contact ooo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-commits@incubator.apache.org Received: (qmail 57333 invoked by uid 99); 21 Jun 2012 07:27:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jun 2012 07:27:39 +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; Thu, 21 Jun 2012 07:27:38 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id AABD72388847; Thu, 21 Jun 2012 07:27:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1352432 - in /incubator/ooo/trunk/main/svl: inc/svl/zformat.hxx source/numbers/zformat.cxx Date: Thu, 21 Jun 2012 07:27:18 -0000 To: ooo-commits@incubator.apache.org From: leiw@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120621072718.AABD72388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: leiw Date: Thu Jun 21 07:27:18 2012 New Revision: 1352432 URL: http://svn.apache.org/viewvc?rev=1352432&view=rev Log: #i119964 - Number displays different from MS with the same format code Patch by: Zhang Lu Review by: Wang Lei Modified: incubator/ooo/trunk/main/svl/inc/svl/zformat.hxx incubator/ooo/trunk/main/svl/source/numbers/zformat.cxx Modified: incubator/ooo/trunk/main/svl/inc/svl/zformat.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svl/inc/svl/zformat.hxx?rev=1352432&r1=1352431&r2=1352432&view=diff ============================================================================== --- incubator/ooo/trunk/main/svl/inc/svl/zformat.hxx (original) +++ incubator/ooo/trunk/main/svl/inc/svl/zformat.hxx Thu Jun 21 07:27:18 2012 @@ -313,6 +313,18 @@ public: (eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_LT) || (eOp1 == NUMBERFORMAT_OP_NO && eOp2 == NUMBERFORMAT_OP_NO) ); } + // Whether the first subformat code is really for negative numbers + // or another limit set. + sal_Bool IsNegativeRealNegative2() const + { + return fLimit1 == 0.0 && fLimit2 == 0.0 && + ( (eOp2 == NUMBERFORMAT_OP_GT && eOp1 == NUMBERFORMAT_OP_LT) || + (eOp2 == NUMBERFORMAT_OP_EQ && eOp1 == NUMBERFORMAT_OP_LT) || + (eOp2 == NUMBERFORMAT_OP_GE && eOp1 == NUMBERFORMAT_OP_LT) || + (eOp2 == NUMBERFORMAT_OP_NO && eOp1 == NUMBERFORMAT_OP_LT) || + (eOp2 == NUMBERFORMAT_OP_NO && eOp1 == NUMBERFORMAT_OP_LE) || + (eOp2 == NUMBERFORMAT_OP_GT && eOp1 == NUMBERFORMAT_OP_LE)); + } // Whether the negative format is without a sign or not sal_Bool IsNegativeWithoutSign() const; Modified: incubator/ooo/trunk/main/svl/source/numbers/zformat.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svl/source/numbers/zformat.cxx?rev=1352432&r1=1352431&r2=1352432&view=diff ============================================================================== --- incubator/ooo/trunk/main/svl/source/numbers/zformat.cxx (original) +++ incubator/ooo/trunk/main/svl/source/numbers/zformat.cxx Thu Jun 21 07:27:18 2012 @@ -2129,9 +2129,12 @@ sal_Bool SvNumberformat::GetOutputString else nIx = 2; } - if (nIx == 1 && fNumber < 0.0 && // negatives Format - IsNegativeRealNegative() ) // ohne Vorzeichen + if (nIx == 1 && // negatives Format + IsNegativeRealNegative() && fNumber < 0.0) // ohne Vorzeichen fNumber = -fNumber; // Vorzeichen eliminieren + if(nIx == 0 && + IsNegativeRealNegative2() && fNumber < 0.0) + fNumber = -fNumber; *ppColor = NumFor[nIx].GetColor(); const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); const sal_uInt16 nAnz = NumFor[nIx].GetnAnz();