[Libreoffice-commits] core.git: include/formula sc/source sc/uiconfig

Katarina Behrens Katarina.Behrens at cib.de
Tue Jul 21 11:20:51 PDT 2015


 include/formula/grammar.hxx                       |    6 +++++-
 sc/source/core/tool/interpr1.cxx                  |   14 +++++++++++---
 sc/source/ui/optdlg/calcoptionsdlg.cxx            |    4 ++++
 sc/source/ui/unoobj/confuno.cxx                   |    2 ++
 sc/uiconfig/scalc/ui/formulacalculationoptions.ui |    1 +
 5 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit abe178814489286aa45dc0799df50e650a78bc9d
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Mon Jul 20 22:07:53 2015 +0200

    tdf#92256: Introducing CONV_A1_XL_A1 address pseudoconvention
    
    a special case for INDIRECT function interpretation. Does what
    OOo used to do, interprets formula using CONV_OOO first, failing
    that, tries CONV_XL_A1
    
    Change-Id: I4281ab2bb7164607206c0b8e51f7e63a1fc2db9a
    Reviewed-on: https://gerrit.libreoffice.org/17255
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/include/formula/grammar.hxx b/include/formula/grammar.hxx
index 4f6a2bc..618db98 100644
--- a/include/formula/grammar.hxx
+++ b/include/formula/grammar.hxx
@@ -43,7 +43,11 @@ public:
 
         CONV_LOTUS_A1,      /* external? 3d? A1.B2 <placeholder/> */
 
-        CONV_LAST   /* for loops, must always be last */
+        CONV_LAST,   /* for loops, must always be last */
+
+        // not a real address convention, a special case for INDIRECT function interpretation
+        // only -> try using CONV_OOO, failing that CONV_XL_A1
+        CONV_A1_XL_A1
     };
 
     //! CONV_UNSPECIFIED is a negative value!
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index b464da4..31e98b1 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7036,12 +7036,18 @@ void ScInterpreter::ScIndirect()
             // Overwrite the config and try Excel R1C1.
             eConv = FormulaGrammar::CONV_XL_R1C1;
         }
-        const ScAddress::Details aDetails( eConv, aPos );
+
+        bool bTryXlA1 = (eConv == FormulaGrammar::CONV_A1_XL_A1);
+
+        const ScAddress::Details aDetails( bTryXlA1 ? FormulaGrammar::CONV_OOO : eConv, aPos );
+        const ScAddress::Details aDetailsXlA1( FormulaGrammar::CONV_XL_A1, aPos );
         SCTAB nTab = aPos.Tab();
         OUString sRefStr = GetString().getString();
         ScRefAddress aRefAd, aRefAd2;
         ScAddress::ExternalInfo aExtInfo;
-        if (ConvertDoubleRef(pDok, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo))
+        if ( ConvertDoubleRef(pDok, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo) ||
+             ( bTryXlA1 && ConvertDoubleRef(pDok, sRefStr, nTab, aRefAd,
+                                            aRefAd2, aDetailsXlA1, &aExtInfo) ) )
         {
             if (aExtInfo.mbExternal)
             {
@@ -7053,7 +7059,9 @@ void ScInterpreter::ScIndirect()
             else
                 PushDoubleRef( aRefAd, aRefAd2);
         }
-        else if (ConvertSingleRef(pDok, sRefStr, nTab, aRefAd, aDetails, &aExtInfo))
+        else if ( ConvertSingleRef(pDok, sRefStr, nTab, aRefAd, aDetails, &aExtInfo) ||
+                  ( bTryXlA1 && ConvertSingleRef (pDok, sRefStr, nTab, aRefAd,
+                                                  aDetailsXlA1, &aExtInfo) ) )
         {
             if (aExtInfo.mbExternal)
             {
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index d49fb65..6f2de0b 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -46,6 +46,8 @@ formula::FormulaGrammar::AddressConvention toAddressConvention(sal_Int32 nPos)
             return formula::FormulaGrammar::CONV_XL_A1;
         case 3:
             return formula::FormulaGrammar::CONV_XL_R1C1;
+        case 4:
+            return formula::FormulaGrammar::CONV_A1_XL_A1;
         case 0:
         default:
             ;
@@ -64,6 +66,8 @@ sal_Int32 toSelectedItem( formula::FormulaGrammar::AddressConvention eConv )
             return 2;
         case formula::FormulaGrammar::CONV_XL_R1C1:
             return 3;
+        case formula::FormulaGrammar::CONV_A1_XL_A1:
+            return 4;
         default:
             ;
     }
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index 82f2502..5d0385e 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -311,6 +311,7 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
                     case 0: // CONV_OOO
                     case 2: // CONV_XL_A1
                     case 3: // CONV_XL_R1C1
+                    case 7: // CONV_A1_XL_A1
                         aCalcConfig.meStringRefAddressSyntax = static_cast<formula::FormulaGrammar::AddressConvention>( nUno );
                         break;
                     default:
@@ -467,6 +468,7 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr
                 case formula::FormulaGrammar::CONV_OOO:
                 case formula::FormulaGrammar::CONV_XL_A1:
                 case formula::FormulaGrammar::CONV_XL_R1C1:
+                case formula::FormulaGrammar::CONV_A1_XL_A1:
                      aRet <<= static_cast<sal_Int16>( aConv );
                      break;
 
diff --git a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
index 20cfab0..59641e6 100644
--- a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
+++ b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
@@ -86,6 +86,7 @@
                           <item id="1">Calc A1</item>
                           <item id="2">Excel A1</item>
                           <item id="3">Excel R1C1</item>
+                          <item id="4">Calc A1 | Excel A1</item>
                         </items>
                       </object>
                       <packing>


More information about the Libreoffice-commits mailing list