diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2015-09-29 15:45:22 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-10-17 23:23:22 +0200 |
commit | 92e24ae6f1a53370534e1b61514d519533f0fb4b (patch) | |
tree | 0e73496b54d6ba69677ee2a59e1f12a888995cc8 /sc/source | |
parent | 1f2091e248c0ff8756ff75cf061270e75faf68f5 (diff) |
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)
Conflicts:
sc/qa/unit/subsequent_export-test.cxx
Change-Id: I1355031cdd63e2a5c50064531011be71ae7f7b8f
Reviewed-on: https://gerrit.libreoffice.org/19244
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit a54f0d6c980b880854458b7c685c04632acf91ac)
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 7 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookhelper.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 17 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.hxx | 1 |
4 files changed, 31 insertions, 4 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 68802aed005d..13e764d89436 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -7032,10 +7032,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 fc080cc0f8bf..2573a39f1d7c 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -797,6 +797,16 @@ void WorkbookHelper::finalizeWorkbookImport() sheets. Automatic numbering is set by passing the value 0. */ PropertySet aDefPageStyle( getStyleObject( "Default", true ) ); aDefPageStyle.setProperty< sal_Int16 >( PROP_FirstPageNumber, 0 ); + + // 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/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 226a27cb4681..d1bb29982160 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -3180,6 +3180,22 @@ void ScXMLImport::SetSheetNamedRanges() } } +void ScXMLImport::SetStringRefSyntaxIfMissing() +{ + if (!pDoc) + return; + + 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); + } +} + void SAL_CALL ScXMLImport::endDocument() throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, @@ -3226,6 +3242,7 @@ void SAL_CALL ScXMLImport::endDocument() SetLabelRanges(); SetNamedRanges(); SetSheetNamedRanges(); + SetStringRefSyntaxIfMissing(); if (mpPivotSources) // Process pivot table sources after the named ranges have been set. mpPivotSources->process(); diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx index c26a71016a81..97291ae9503e 100644 --- a/sc/source/filter/xml/xmlimprt.hxx +++ b/sc/source/filter/xml/xmlimprt.hxx @@ -1219,6 +1219,7 @@ public: void SetSheetNamedRanges(); void SetLabelRanges(); void AddDefaultNote( const com::sun::star::table::CellAddress& aCell ); + void SetStringRefSyntaxIfMissing(); /** Extracts the formula string, the formula grammar namespace URL, and a grammar enum value from the passed formula attribute value. |