[Libreoffice-commits] core.git: Branch 'private/jmux/libreoffice-4-1-6+backports' - sc/qa sc/source

Katarina Behrens Katarina.Behrens at cib.de
Fri Oct 2 03:07:57 PDT 2015


 sc/qa/unit/ucalc.cxx                    |    6 +++---
 sc/source/core/tool/interpr1.cxx        |    7 +++----
 sc/source/filter/oox/workbookhelper.cxx |   10 ++++++++++
 sc/source/ui/unoobj/confuno.cxx         |   10 ++++++++++
 4 files changed, 26 insertions(+), 7 deletions(-)

New commits:
commit 9e8fd307401c0835f035b1221f95a0e87d711afd
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Sep 29 15:45:22 2015 +0200

    tdf#93688: Set CalcA1|ExcelA1 syntax only for imported docs
    
    those whose string ref syntax is unknown or can't be guessed i.e.
    don't use it for new documents (prefer user settings in that case)
    
    Reviewed-on: https://gerrit.libreoffice.org/18923
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    
    Conflicts:
    	sc/source/filter/oox/workbookhelper.cxx
    	sc/source/ui/unoobj/confuno.cxx
    
    Change-Id: I1355031cdd63e2a5c50064531011be71ae7f7b8f

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index d665b2c..472cacb 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1469,10 +1469,10 @@ void testFuncINDIRECT(ScDocument* pDoc)
 
     pDoc->CalcAll();
     {
-        // Default is to use compatibility mode, accept both Calc A1 and
-        // Excel A1 syntax
+        // Default (for new documents) is to use current formula syntax
+        // which is Calc A1
         const OUString* aChecks[] = {
-            &aTest, &aTest, &aRefErr, &aTest
+            &aTest, &aRefErr, &aRefErr, &aTest
         };
 
         for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 9c0a8c7..c90f07d 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7835,10 +7835,9 @@ void ScInterpreter::ScIndirect()
             // Use the current address syntax if unspecified.
             eConv = pDok->GetAddressConvention();
 
-        // either CONV_A1_XL_A1 was explicitly configured, or nothing at all
-        // was configured
-        bool bTryXlA1 = (eConv == FormulaGrammar::CONV_A1_XL_A1 ||
-                          !maCalcConfig.mbHasStringRefSyntax);
+        // either CONV_A1_XL_A1 was explicitly configured, or it wasn't possible
+        // to determine which syntax to use during doc import
+        bool bTryXlA1 = (eConv == FormulaGrammar::CONV_A1_XL_A1);
 
         if (nParamCount == 2 && 0.0 == ::rtl::math::approxFloor( GetDouble()))
         {
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index d8f9cb0..88ab454 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -723,6 +723,16 @@ void WorkbookHelper::finalizeWorkbookImport()
     StorageRef xVbaPrjStrg = mrBookGlob.getVbaProjectStorage();
     if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
         getBaseFilter().getVbaProject().importVbaProject( *xVbaPrjStrg, getBaseFilter().getGraphicHelper() );
+
+    // Has any string ref syntax been imported?
+    // If not, we need to take action
+    ScCalcConfig aCalcConfig = getScDocument().GetCalcConfig();
+
+    if ( !aCalcConfig.mbHasStringRefSyntax )
+    {
+        aCalcConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_A1_XL_A1;
+        getScDocument().SetCalcConfig(aCalcConfig);
+    }
 }
 
 // document model -------------------------------------------------------------
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index abcbdbc..d1a85d8 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -348,6 +348,16 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
                         pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
                 pDocShell->SetDocumentModified();
             }
+
+            ScCalcConfig aCalcConfig = pDoc->GetCalcConfig();
+
+            // Has any string ref syntax been imported?
+            // If not, we need to take action
+            if ( !aCalcConfig.mbHasStringRefSyntax )
+            {
+                aCalcConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_A1_XL_A1;
+                pDoc->SetCalcConfig(aCalcConfig);
+            }
         }
         else
             throw uno::RuntimeException();


More information about the Libreoffice-commits mailing list