[Libreoffice-commits] core.git: 3 commits - sc/inc sc/qa sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Sat Mar 8 15:11:16 PST 2014


 sc/inc/formulacell.hxx                          |    1 
 sc/qa/unit/data/contentCSV/cachedValue.csv      |    2 
 sc/qa/unit/data/ods/formula-delete-contents.ods |binary
 sc/source/core/data/column.cxx                  |    6 
 sc/source/core/data/column2.cxx                 |    7 
 sc/source/core/data/formulacell.cxx             |    6 
 sc/source/core/tool/interpr4.cxx                |    3 
 sc/source/filter/xml/xmlcelli.cxx               |    8 
 sc/source/filter/xml/xmlcelli.hxx               |    1 
 sc/source/ui/view/viewfunc.cxx                  |  351 +++++++++++-------------
 10 files changed, 196 insertions(+), 189 deletions(-)

New commits:
commit 3cea6bb57757ce085f01f0b86b000cfc0592dca7
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Sat Mar 8 17:40:32 2014 -0500

    More consistent number format inheritence policy.
    
    The new policy is to always inherit number format of a formula cell
    from its reference unless the cell already has an explicit number format
    set.
    
    Also to avoid recalculating formula cells on load just because they have
    the 'General' number format.  This leads to excessive re-calculation of
    formula cells upon load even when the cells already have results cached.
    
    Change-Id: I28128d3fef296e09e62bea72e8aab75de9876239

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 6f3c555..f2bc36c 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -210,6 +210,7 @@ public:
     void SetNeedsListening( bool bVar );
     void SetNeedsDirty( bool bVar );
     void SetNeedNumberFormat( bool bVal );
+    bool NeedsNumberFormat() const;
     short GetFormatType() const;
     void            Compile(const OUString& rFormula,
                             bool bNoListening = false,
diff --git a/sc/qa/unit/data/contentCSV/cachedValue.csv b/sc/qa/unit/data/contentCSV/cachedValue.csv
index 7fed884..597eda1 100644
--- a/sc/qa/unit/data/contentCSV/cachedValue.csv
+++ b/sc/qa/unit/data/contentCSV/cachedValue.csv
@@ -1,2 +1,2 @@
 1.00,200.00%,$3.00,1/3/00,00:00,6.00E+000,7 1/5,TRUE,9,1000%,01-10
-1,200.00%,$3.00,01/03/00,12:00:00 AM,6.00E+000,7 1/5,TRUE,9,1000.00%,01/10/00
+1.00,200.00%,$3.00,1/3/00,12:00:00 AM,6.00E+000,7 1/5,TRUE,9,1000.00%,01-10
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index b7fd479..8b74fcf 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -3121,8 +3121,12 @@ public:
     {
         sal_uInt32 nFormat = mrCol.GetNumberFormat(nRow);
         if( (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0)
+            // Non-default number format is set.
             pCell->SetNeedNumberFormat(false);
-        else
+        else if (pCell->NeedsNumberFormat())
+            pCell->SetDirtyVar();
+
+        if (pCell->GetMatrixFlag())
             pCell->SetDirtyVar();
 
         pCell->CompileXML(mrCxt, mrProgress);
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 38eb94e..8b4b619 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2749,12 +2749,7 @@ void ScColumn::SetFormulaResults( SCROW nRow, const formula::FormulaTokenRef* pR
 
 void ScColumn::SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat )
 {
-    short eOldType = pDocument->GetFormatTable()->GetType(
-        (sal_uLong)((SfxUInt32Item*)GetAttr(nRow, ATTR_VALUE_FORMAT))->GetValue());
-
-    short eNewType = pDocument->GetFormatTable()->GetType(nNumberFormat);
-    if (!pDocument->GetFormatTable()->IsCompatible(eOldType, eNewType))
-        ApplyAttr(nRow, SfxUInt32Item(ATTR_VALUE_FORMAT, nNumberFormat));
+    ApplyAttr(nRow, SfxUInt32Item(ATTR_VALUE_FORMAT, nNumberFormat));
 }
 
 const ScFormulaCell* ScColumn::FetchFormulaCell( SCROW nRow ) const
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index c8aa429..5b23770 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -976,6 +976,12 @@ void ScFormulaCell::SetNeedsDirty( bool bVar )
 }
 
 void ScFormulaCell::SetNeedNumberFormat( bool bVal ) { mbNeedsNumberFormat = bVal; }
+
+bool ScFormulaCell::NeedsNumberFormat() const
+{
+    return mbNeedsNumberFormat;
+}
+
 short ScFormulaCell::GetFormatType() const { return nFormatType; }
 
 void ScFormulaCell::Compile( const OUString& rFormula, bool bNoListening,
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index c1be178..6a50c76 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4486,9 +4486,6 @@ StackVar ScInterpreter::Interpret()
     }
     else
         nRetFmtType = NUMBERFORMAT_NUMBER;
-    // inherit the format index only for currency formats
-    if ( nRetFmtType != NUMBERFORMAT_CURRENCY )
-        nRetFmtIndex = 0;
 
     if (nGlobalError && GetStackType() != svError )
         PushError( nGlobalError);
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index be0a75e..c61657e 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -163,7 +163,8 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
     mbPossibleErrorCell(false),
     mbCheckWithCompilerForError(false),
     mbEditEngineHasText(false),
-    mbHasFormatRuns(false)
+    mbHasFormatRuns(false),
+    mbHasStyle(false)
 {
     rtl::math::setNan(&fValue); // NaN by default
 
@@ -185,6 +186,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
         {
             case XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME:
                 pStyleName = new OUString(sValue);
+                mbHasStyle = true;
             break;
             case XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME:
                 OSL_ENSURE(!maContentValidationName, "here should be only one Validation Name");
@@ -1376,7 +1378,9 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
             ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, *pCode, eGrammar, MM_NONE);
             SetFormulaCell(pNewCell);
             rDoc.setFormulaCell(rCellPos, pNewCell);
-            pNewCell->SetNeedNumberFormat( true );
+
+            // Re-calculate to get number format only when style is not set.
+            pNewCell->SetNeedNumberFormat(!mbHasStyle);
         }
         else if ( aText[0] == '\'' && aText.getLength() > 1 )
         {
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index 15c95fb..6fbcca5 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -94,6 +94,7 @@ class ScXMLTableRowCellContext : public ScXMLImportContext
     bool mbCheckWithCompilerForError;
     bool mbEditEngineHasText;
     bool mbHasFormatRuns;
+    bool mbHasStyle;
 
     sal_Int16 GetCellType(const OUString& sOUValue) const;
 
commit 5d2e7cbf6433ecced0ecac46b3abdaf97b82880b
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Sat Mar 8 16:27:32 2014 -0500

    This test file had wrong cached formula result stored.
    
    It didn't get flagged before because we would always recalc all formula cells
    with 'General' number format on load...
    
    Change-Id: I36e71534b65f3f088415cd518af04696892f76dd

diff --git a/sc/qa/unit/data/ods/formula-delete-contents.ods b/sc/qa/unit/data/ods/formula-delete-contents.ods
index 4b125fd..95bb847 100644
Binary files a/sc/qa/unit/data/ods/formula-delete-contents.ods and b/sc/qa/unit/data/ods/formula-delete-contents.ods differ
commit 1c27b0a4fafc525ed704f4348d5f214b5ef2a764
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Sat Mar 8 13:23:12 2014 -0500

    Reduce indentation by early bail-out.
    
    Change-Id: Iaac628d2629bf1ff96fd1709e358ae9eed3fca02

diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index e3f6171..a96c4e6 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -357,229 +357,228 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
     ScDocShellModificator aModificator( *pDocSh );
 
     ScEditableTester aTester( pDoc, nCol,nRow, nCol,nRow, rMark );
-    if (aTester.IsEditable())
+    if (!aTester.IsEditable())
     {
-        if ( bRecord )
-            rFunc.EnterListAction( STR_UNDO_ENTERDATA );
+        ErrorMessage(aTester.GetMessageId());
+        PaintArea(nCol, nRow, nCol, nRow);        // possibly the edit-engine is still painted there
+        return;
+    }
 
-        bool bFormula = false;
+    if ( bRecord )
+        rFunc.EnterListAction( STR_UNDO_ENTERDATA );
 
-        // a single '=' character is handled as string (needed for special filters)
-        if ( rString.getLength() > 1 )
+    bool bFormula = false;
+
+    // a single '=' character is handled as string (needed for special filters)
+    if ( rString.getLength() > 1 )
+    {
+        if ( rString[0] == '=' )
+        {
+            // handle as formula
+            bFormula = true;
+        }
+        else if ( rString[0] == '+' || rString[0] == '-' )
         {
-            if ( rString[0] == '=' )
+            // if there is more than one leading '+' or '-' character, remove the additional ones
+            sal_Int32 nIndex = 1;
+            sal_Int32 nLen = rString.getLength();
+            while ( nIndex < nLen && ( rString[ nIndex ] == '+' || rString[ nIndex ] == '-' ) )
             {
-                // handle as formula
-                bFormula = true;
+                ++nIndex;
             }
-            else if ( rString[0] == '+' || rString[0] == '-' )
-            {
-                // if there is more than one leading '+' or '-' character, remove the additional ones
-                sal_Int32 nIndex = 1;
-                sal_Int32 nLen = rString.getLength();
-                while ( nIndex < nLen && ( rString[ nIndex ] == '+' || rString[ nIndex ] == '-' ) )
-                {
-                    ++nIndex;
-                }
-                OUString aString = rString.replaceAt( 1, nIndex - 1, "" );
+            OUString aString = rString.replaceAt( 1, nIndex - 1, "" );
 
-                // if the remaining part without the leading '+' or '-' character
-                // is non-empty and not a number, handle as formula
-                if ( aString.getLength() > 1 )
+            // if the remaining part without the leading '+' or '-' character
+            // is non-empty and not a number, handle as formula
+            if ( aString.getLength() > 1 )
+            {
+                sal_uInt32 nFormat = 0;
+                pDoc->GetNumberFormat( nCol, nRow, nTab, nFormat );
+                SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+                double fNumber = 0;
+                if ( !pFormatter->IsNumberFormat( aString, nFormat, fNumber ) )
                 {
-                    sal_uInt32 nFormat = 0;
-                    pDoc->GetNumberFormat( nCol, nRow, nTab, nFormat );
-                    SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-                    double fNumber = 0;
-                    if ( !pFormatter->IsNumberFormat( aString, nFormat, fNumber ) )
-                    {
-                        bFormula = true;
-                    }
+                    bFormula = true;
                 }
             }
         }
+    }
 
-        bool bNumFmtChanged = false;
-        if ( bFormula )
-        {   // formula, compile with autoCorrection
-            i = rMark.GetFirstSelected();
-            ScAddress aPos( nCol, nRow, i );
-            ScCompiler aComp( pDoc, aPos);
-            aComp.SetGrammar(pDoc->GetGrammar());
+    bool bNumFmtChanged = false;
+    if ( bFormula )
+    {   // formula, compile with autoCorrection
+        i = rMark.GetFirstSelected();
+        ScAddress aPos( nCol, nRow, i );
+        ScCompiler aComp( pDoc, aPos);
+        aComp.SetGrammar(pDoc->GetGrammar());
 //2do: enable/disable autoCorrection via calcoptions
-            aComp.SetAutoCorrection( true );
-            if ( rString[0] == '+' || rString[0] == '-' )
+        aComp.SetAutoCorrection( true );
+        if ( rString[0] == '+' || rString[0] == '-' )
+        {
+            aComp.SetExtendedErrorDetection( ScCompiler::EXTENDED_ERROR_DETECTION_NAME_BREAK );
+        }
+        OUString aFormula( rString );
+        ScTokenArray* pArr;
+        bool bAgain;
+        do
+        {
+            bAgain = false;
+            bool bAddEqual = false;
+            ScTokenArray* pArrFirst = pArr = aComp.CompileString( aFormula );
+            bool bCorrected = aComp.IsCorrected();
+            if ( bCorrected )
+            {   // try to parse with first parser-correction
+                pArr = aComp.CompileString( aComp.GetCorrectedFormula() );
+            }
+            if ( !pArr->GetCodeError() )
             {
-                aComp.SetExtendedErrorDetection( ScCompiler::EXTENDED_ERROR_DETECTION_NAME_BREAK );
+                bAddEqual = true;
+                aComp.CompileTokenArray();
+                bCorrected |= aComp.IsCorrected();
             }
-            OUString aFormula( rString );
-            ScTokenArray* pArr;
-            bool bAgain;
-            do
+            if ( bCorrected )
             {
-                bAgain = false;
-                bool bAddEqual = false;
-                ScTokenArray* pArrFirst = pArr = aComp.CompileString( aFormula );
-                bool bCorrected = aComp.IsCorrected();
-                if ( bCorrected )
-                {   // try to parse with first parser-correction
-                    pArr = aComp.CompileString( aComp.GetCorrectedFormula() );
+                OUString aCorrectedFormula;
+                if ( bAddEqual )
+                {
+                    aCorrectedFormula = "=" + aComp.GetCorrectedFormula();
                 }
-                if ( !pArr->GetCodeError() )
+                else
+                    aCorrectedFormula = aComp.GetCorrectedFormula();
+                short nResult;
+                if ( aCorrectedFormula.getLength() == 1 )
+                    nResult = RET_NO;   // empty formula, just '='
+                else
                 {
-                    bAddEqual = true;
-                    aComp.CompileTokenArray();
-                    bCorrected |= aComp.IsCorrected();
+                    OUString aMessage( ScResId( SCSTR_FORMULA_AUTOCORRECTION ) );
+                    aMessage += aCorrectedFormula;
+                    nResult = QueryBox( GetViewData()->GetDialogParent(),
+                                            WinBits(WB_YES_NO | WB_DEF_YES),
+                                            aMessage ).Execute();
                 }
-                if ( bCorrected )
+                if ( nResult == RET_YES )
                 {
-                    OUString aCorrectedFormula;
-                    if ( bAddEqual )
-                    {
-                        aCorrectedFormula = "=" + aComp.GetCorrectedFormula();
-                    }
-                    else
-                        aCorrectedFormula = aComp.GetCorrectedFormula();
-                    short nResult;
-                    if ( aCorrectedFormula.getLength() == 1 )
-                        nResult = RET_NO;   // empty formula, just '='
-                    else
-                    {
-                        OUString aMessage( ScResId( SCSTR_FORMULA_AUTOCORRECTION ) );
-                        aMessage += aCorrectedFormula;
-                        nResult = QueryBox( GetViewData()->GetDialogParent(),
-                                                WinBits(WB_YES_NO | WB_DEF_YES),
-                                                aMessage ).Execute();
-                    }
-                    if ( nResult == RET_YES )
-                    {
-                        aFormula = aCorrectedFormula;
-                        if ( pArr != pArrFirst )
-                            delete pArrFirst;
-                        bAgain = true;
-                    }
-                    else
+                    aFormula = aCorrectedFormula;
+                    if ( pArr != pArrFirst )
+                        delete pArrFirst;
+                    bAgain = true;
+                }
+                else
+                {
+                    if ( pArr != pArrFirst )
                     {
-                        if ( pArr != pArrFirst )
-                        {
-                            delete pArr;
-                            pArr = pArrFirst;
-                        }
+                        delete pArr;
+                        pArr = pArrFirst;
                     }
                 }
-            } while ( bAgain );
-            // to be used in multiple tabs, the formula must be compiled anew
-            // via ScFormulaCell copy-ctor because of RangeNames,
-            // the same code-array for all cells is not possible.
-            // If the array has an error, (it) must be RPN-erased in the newly generated
-            // cellst and the error be set explicitly, so that
-            // via FormulaCell copy-ctor and Interpreter it will be, when possible,
-            // ironed out again, too intelligent.. e.g.: =1))
-            sal_uInt16 nError = pArr->GetCodeError();
-            if ( !nError )
-            {
-                //  update list of recent functions with all functions that
-                //  are not within parentheses
+            }
+        } while ( bAgain );
+        // to be used in multiple tabs, the formula must be compiled anew
+        // via ScFormulaCell copy-ctor because of RangeNames,
+        // the same code-array for all cells is not possible.
+        // If the array has an error, (it) must be RPN-erased in the newly generated
+        // cellst and the error be set explicitly, so that
+        // via FormulaCell copy-ctor and Interpreter it will be, when possible,
+        // ironed out again, too intelligent.. e.g.: =1))
+        sal_uInt16 nError = pArr->GetCodeError();
+        if ( !nError )
+        {
+            //  update list of recent functions with all functions that
+            //  are not within parentheses
 
-                ScModule* pScMod = SC_MOD();
-                ScAppOptions aAppOpt = pScMod->GetAppOptions();
-                bool bOptChanged = false;
+            ScModule* pScMod = SC_MOD();
+            ScAppOptions aAppOpt = pScMod->GetAppOptions();
+            bool bOptChanged = false;
 
-                formula::FormulaToken** ppToken = pArr->GetArray();
-                sal_uInt16 nTokens = pArr->GetLen();
-                sal_uInt16 nLevel = 0;
-                for (sal_uInt16 nTP=0; nTP<nTokens; nTP++)
-                {
-                    formula::FormulaToken* pTok = ppToken[nTP];
-                    OpCode eOp = pTok->GetOpCode();
-                    if ( eOp == ocOpen )
-                        ++nLevel;
-                    else if ( eOp == ocClose && nLevel )
-                        --nLevel;
-                    if ( nLevel == 0 && pTok->IsFunction() &&
-                            lcl_AddFunction( aAppOpt, sal::static_int_cast<sal_uInt16>( eOp ) ) )
-                        bOptChanged = true;
-                }
+            formula::FormulaToken** ppToken = pArr->GetArray();
+            sal_uInt16 nTokens = pArr->GetLen();
+            sal_uInt16 nLevel = 0;
+            for (sal_uInt16 nTP=0; nTP<nTokens; nTP++)
+            {
+                formula::FormulaToken* pTok = ppToken[nTP];
+                OpCode eOp = pTok->GetOpCode();
+                if ( eOp == ocOpen )
+                    ++nLevel;
+                else if ( eOp == ocClose && nLevel )
+                    --nLevel;
+                if ( nLevel == 0 && pTok->IsFunction() &&
+                        lcl_AddFunction( aAppOpt, sal::static_int_cast<sal_uInt16>( eOp ) ) )
+                    bOptChanged = true;
+            }
 
-                if ( bOptChanged )
-                {
-                    pScMod->SetAppOptions(aAppOpt);
-                    pScMod->RecentFunctionsChanged();
-                }
+            if ( bOptChanged )
+            {
+                pScMod->SetAppOptions(aAppOpt);
+                pScMod->RecentFunctionsChanged();
             }
+        }
 
-            ScFormulaCell aCell(pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE);
-            delete pArr;
+        ScFormulaCell aCell(pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE);
+        delete pArr;
 
-            SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-            ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
-            for (; itr != itrEnd; ++itr)
+        SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+        ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
+        for (; itr != itrEnd; ++itr)
+        {
+            i = *itr;
+            aPos.SetTab( i );
+            sal_uLong nIndex = (sal_uLong) ((SfxUInt32Item*) pDoc->GetAttr(
+                nCol, nRow, i, ATTR_VALUE_FORMAT ))->GetValue();
+            if ( pFormatter->GetType( nIndex ) == NUMBERFORMAT_TEXT ||
+                 ( ( rString[0] == '+' || rString[0] == '-' ) && nError && rString == aFormula ) )
             {
-                i = *itr;
-                aPos.SetTab( i );
-                sal_uLong nIndex = (sal_uLong) ((SfxUInt32Item*) pDoc->GetAttr(
-                    nCol, nRow, i, ATTR_VALUE_FORMAT ))->GetValue();
-                if ( pFormatter->GetType( nIndex ) == NUMBERFORMAT_TEXT ||
-                     ( ( rString[0] == '+' || rString[0] == '-' ) && nError && rString == aFormula ) )
+                if ( pData )
                 {
-                    if ( pData )
-                    {
-                        // A clone of pData will be stored in the cell.
-                        rFunc.SetEditCell(aPos, *pData, true);
-                    }
-                    else
-                        rFunc.SetStringCell(aPos, aFormula, true);
+                    // A clone of pData will be stored in the cell.
+                    rFunc.SetEditCell(aPos, *pData, true);
                 }
                 else
+                    rFunc.SetStringCell(aPos, aFormula, true);
+            }
+            else
+            {
+                ScFormulaCell* pCell = new ScFormulaCell( aCell, *pDoc, aPos );
+                if ( nError )
                 {
-                    ScFormulaCell* pCell = new ScFormulaCell( aCell, *pDoc, aPos );
-                    if ( nError )
-                    {
-                        pCell->GetCode()->DelRPN();
-                        pCell->SetErrCode( nError );
-                        if(pCell->GetCode()->IsHyperLink())
-                            pCell->GetCode()->SetHyperLink(false);
-                    }
-                    rFunc.SetFormulaCell(aPos, pCell, true);
+                    pCell->GetCode()->DelRPN();
+                    pCell->SetErrCode( nError );
+                    if(pCell->GetCode()->IsHyperLink())
+                        pCell->GetCode()->SetHyperLink(false);
                 }
+                rFunc.SetFormulaCell(aPos, pCell, true);
             }
         }
-        else
+    }
+    else
+    {
+        ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
+        for ( ; itr != itrEnd; ++itr )
         {
-            ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
-            for ( ; itr != itrEnd; ++itr )
+            bool bNumFmtSet = false;
+            rFunc.SetNormalString( bNumFmtSet, ScAddress( nCol, nRow, *itr ), rString, false );
+            if (bNumFmtSet)
             {
-                bool bNumFmtSet = false;
-                rFunc.SetNormalString( bNumFmtSet, ScAddress( nCol, nRow, *itr ), rString, false );
-                if (bNumFmtSet)
-                {
-                    /* FIXME: if set on any sheet results in changed only on
-                     * sheet nTab for TestFormatArea() and DoAutoAttributes() */
-                    bNumFmtChanged = true;
-                }
+                /* FIXME: if set on any sheet results in changed only on
+                 * sheet nTab for TestFormatArea() and DoAutoAttributes() */
+                bNumFmtChanged = true;
             }
         }
+    }
 
-        bool bAutoFormat = TestFormatArea(nCol, nRow, nTab, bNumFmtChanged);
+    bool bAutoFormat = TestFormatArea(nCol, nRow, nTab, bNumFmtChanged);
 
-        if (bAutoFormat)
-            DoAutoAttributes(nCol, nRow, nTab, bNumFmtChanged, bRecord);
+    if (bAutoFormat)
+        DoAutoAttributes(nCol, nRow, nTab, bNumFmtChanged, bRecord);
 
-        pDocSh->UpdateOle(GetViewData());
+    pDocSh->UpdateOle(GetViewData());
 
-        HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow);
+    HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow);
 
-        if ( bRecord )
-            rFunc.EndListAction();
+    if ( bRecord )
+        rFunc.EndListAction();
 
-        aModificator.SetDocumentModified();
-        lcl_PostRepaintCondFormat( pDoc->GetCondFormat( nCol, nRow, nTab ), pDocSh );
-    }
-    else
-    {
-        ErrorMessage(aTester.GetMessageId());
-        PaintArea( nCol, nRow, nCol, nRow );        // possibly the edit-engine is still painted there
-    }
+    aModificator.SetDocumentModified();
+    lcl_PostRepaintCondFormat( pDoc->GetCondFormat( nCol, nRow, nTab ), pDocSh );
 }
 
 // enter value in single cell (on nTab only)


More information about the Libreoffice-commits mailing list