[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sw/source

Jan Holesovsky kendy at suse.cz
Wed Apr 3 06:48:34 PDT 2013


 sw/source/core/docnode/ndtbl.cxx |   51 ++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 27 deletions(-)

New commits:
commit 715323ece4c1c96714f6de51f98f5c58f30e5147
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Wed Apr 3 11:44:28 2013 +0200

    Keep semantics, but improve readibility.
    
    Change-Id: I32c18cb7b080f4847118a2d7e8d77dcd2bbce308
    Reviewed-on: https://gerrit.libreoffice.org/3186
    Reviewed-by: Thomas Arnhold <thomas at arnhold.org>
    Tested-by: Thomas Arnhold <thomas at arnhold.org>

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 252ac7f..08b710a 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -4022,39 +4022,36 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, sal_Bool bCallUpdate )
             SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rBox.GetFrmFmt();
             SfxItemSet aBoxSet( GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_VALUE );
 
-            sal_Bool bSetNumFmt = IsInsTblFormatNum(), bLockModify = sal_True;
-            if( bSetNumFmt )
+            sal_Bool bSetNumFmt = IsInsTblFormatNum();
+            sal_Bool bLockModify = sal_True;
+
+            if( bSetNumFmt && !IsInsTblChangeNumFormat() )
             {
-                if( !IsInsTblChangeNumFormat() )
+                if( !pNumFmtItem )
+                    bSetNumFmt = sal_False;
+                else
                 {
-                    if( !pNumFmtItem )
-                        bSetNumFmt = sal_False;
+                    sal_uLong nOldNumFmt = ((SwTblBoxNumFormat*)pNumFmtItem)->GetValue();
+                    SvNumberFormatter* pNumFmtr = GetNumberFormatter();
+
+                    short nFmtType = pNumFmtr->GetType( nFmtIdx );
+                    if( nFmtType == pNumFmtr->GetType( nOldNumFmt ) || NUMBERFORMAT_NUMBER == nFmtType )
+                        // Current and specified NumFormat match
+                        // -> keep old Format
+                        nFmtIdx = nOldNumFmt;
                     else
-                    {
-                        sal_uLong nOldNumFmt = ((SwTblBoxNumFormat*)pNumFmtItem)->
-                                            GetValue();
-                        SvNumberFormatter* pNumFmtr = GetNumberFormatter();
-
-                        short nFmtType = pNumFmtr->GetType( nFmtIdx );
-                        if( nFmtType == pNumFmtr->GetType( nOldNumFmt ) ||
-                            NUMBERFORMAT_NUMBER == nFmtType )
-                            // Current and specified NumFormat match
-                            // -> keep old Format
-                            nFmtIdx = nOldNumFmt;
-                        else
-                            // Current and specified NumFormat do not match
-                            // -> insert as Text
-                            bLockModify = bSetNumFmt = sal_False;
-                    }
+                        // Current and specified NumFormat do not match
+                        // -> insert as Text
+                        bLockModify = bSetNumFmt = sal_False;
                 }
+            }
 
-                if( bSetNumFmt )
-                {
-                    pBoxFmt = (SwTableBoxFmt*)rBox.ClaimFrmFmt();
+            if( bSetNumFmt )
+            {
+                pBoxFmt = (SwTableBoxFmt*)rBox.ClaimFrmFmt();
 
-                    aBoxSet.Put( SwTblBoxValue( fNumber ));
-                    aBoxSet.Put( SwTblBoxNumFormat( nFmtIdx ));
-                }
+                aBoxSet.Put( SwTblBoxValue( fNumber ));
+                aBoxSet.Put( SwTblBoxNumFormat( nFmtIdx ));
             }
 
             // It's not enough to only reset the Formula.


More information about the Libreoffice-commits mailing list