sc/source/filter/excel/excdoc.cxx | 12 ++++++++++-- sc/source/ui/unoobj/confuno.cxx | 28 +++++++++++++++++----------- 2 files changed, 27 insertions(+), 13 deletions(-)
New commits: commit e23e760d2f433b0924c0992002f48b1afcf58292 Author: Katarina Behrens <katarina.behr...@cib.de> Date: Wed Oct 28 15:00:51 2015 +0100 tdf#92256: Don't save CONV_UNSPECIFIED string ref syntax value The following scenario is how it breaks: 1. user has ExcelA1 as her formula syntax setting, CONV_UNSPECIFIED (that means "same as formula syntax") as her string ref syntax setting 2. she saves the document, it will now contain CONV_UNSPECIFIED value 3. someone else with CalcA1 formula syntax setting opens the document ... since it contains CONV_UNSPECIFIED "same as formula syntax" value, it will use his CalcA1 formula syntax value to evaluate INDIRECT func => #REF! Avoid this by reading formula syntax/grammar value, mapping it to matching string ref syntax and saving that instead of CONV_UNSPECIFIED Change-Id: I3cf08878ed8badc8719ee5be535c8fdbb7ba6d42 diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 81cd99d..7feb78a 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -823,15 +823,23 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm ) pExpChangeTrack->WriteXml( rStrm ); const ScCalcConfig& rCalcConfig = GetDoc().GetCalcConfig(); + formula::FormulaGrammar::AddressConvention eConv = rCalcConfig.meStringRefAddressSyntax; + + // don't save "unspecified" string ref syntax ... query formula grammar + // and save that instead + if( eConv == formula::FormulaGrammar::CONV_UNSPECIFIED) + { + eConv = GetDoc().GetAddressConvention(); + } // write if it has been read|imported or explicitly changed // or if ref syntax isn't what would be native for our file format // i.e. ExcelA1 in this case if ( rCalcConfig.mbHasStringRefSyntax || - (rCalcConfig.meStringRefAddressSyntax != formula::FormulaGrammar::CONV_XL_A1) ) + (eConv != formula::FormulaGrammar::CONV_XL_A1) ) { XclExtLstRef xExtLst( new XclExtLst( GetRoot() ) ); - xExtLst->AddRecord( XclExpExtRef( new XclExpExtCalcPr( GetRoot(), rCalcConfig.meStringRefAddressSyntax )) ); + xExtLst->AddRecord( XclExpExtRef( new XclExpExtCalcPr( GetRoot(), eConv )) ); xExtLst->SaveXml(rStrm); } diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index abcbdbc..9a9078f 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -459,22 +459,28 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr else if ( aPropertyName.compareToAscii( SC_UNO_SYNTAXSTRINGREF ) == 0 ) { ScCalcConfig aCalcConfig = pDoc->GetCalcConfig(); + formula::FormulaGrammar::AddressConvention eConv = aCalcConfig.meStringRefAddressSyntax; - // write if it has been read|imported or explicitly changed - // or if ref syntax isn't what would be native for our file format - // i.e. CalcA1 in this case - if ( aCalcConfig.mbHasStringRefSyntax || - (aCalcConfig.meStringRefAddressSyntax != formula::FormulaGrammar::CONV_OOO) ) - { - formula::FormulaGrammar::AddressConvention aConv = aCalcConfig.meStringRefAddressSyntax; + // don't save "unspecified" string ref syntax ... query formula grammar + // and save that instead + if( eConv == formula::FormulaGrammar::CONV_UNSPECIFIED) + { + eConv = pDoc->GetAddressConvention(); + } - switch (aConv) + // write if it has been read|imported or explicitly changed + // or if ref syntax isn't what would be native for our file format + // i.e. CalcA1 in this case + if ( aCalcConfig.mbHasStringRefSyntax || + (eConv != formula::FormulaGrammar::CONV_OOO) ) + { + switch (eConv) { 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 ); + aRet <<= static_cast<sal_Int16>( eConv ); break; case formula::FormulaGrammar::CONV_UNSPECIFIED: @@ -485,8 +491,8 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr aRet <<= sal_Int16(9999); break; } - } - } + } + } else { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits