[Libreoffice-commits] core.git: 3 commits - sc/qa sc/source
Katarina Behrens
Katarina.Behrens at cib.de
Fri Aug 14 04:48:10 PDT 2015
sc/qa/unit/data/xlsx/empty-noconf.xlsx |binary
sc/qa/unit/subsequent_filters-test.cxx | 31 +++++++++++++++++++++++++++++--
sc/source/filter/excel/excdoc.cxx | 7 +++++--
sc/source/filter/oox/workbookhelper.cxx | 22 +++++++---------------
sc/source/ui/unoobj/confuno.cxx | 7 +++++--
5 files changed, 46 insertions(+), 21 deletions(-)
New commits:
commit b0a890e5bda70afa77feb3e89c3d446b00e580a3
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu Aug 13 13:45:07 2015 +0200
Some more tdf#92256 related tests
Change-Id: I052cceb229f8ab72277c51600994269e4ea52135
Reviewed-on: https://gerrit.libreoffice.org/17704
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/qa/unit/data/xlsx/empty-noconf.xlsx b/sc/qa/unit/data/xlsx/empty-noconf.xlsx
new file mode 100644
index 0000000..21f80b4
Binary files /dev/null and b/sc/qa/unit/data/xlsx/empty-noconf.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index cd909f9..3eb33b0 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -3109,8 +3109,16 @@ void ScFiltersTest::testRefStringXLSX()
double nVal = rDoc.GetValue(2, 2, 0);
ASSERT_DOUBLES_EQUAL(3.0, nVal);
- const ScCalcConfig& rCalcConfig = rDoc.GetCalcConfig();
- CPPUNIT_ASSERT_EQUAL(formula::FormulaGrammar::CONV_XL_A1, rCalcConfig.meStringRefAddressSyntax);
+ ScCalcConfig aCalcConfig = rDoc.GetCalcConfig();
+ CPPUNIT_ASSERT_EQUAL(formula::FormulaGrammar::CONV_XL_A1, aCalcConfig.meStringRefAddressSyntax);
+
+ //make sure ref syntax gets saved for MSO-produced docs
+ xDocSh = saveAndReload( &(*xDocSh), XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to reload doc", xDocSh.Is());
+
+ ScDocument& rDoc2 = xDocSh->GetDocument();
+ aCalcConfig = rDoc2.GetCalcConfig();
+ CPPUNIT_ASSERT_EQUAL(formula::FormulaGrammar::CONV_XL_A1, aCalcConfig.meStringRefAddressSyntax);
xDocSh->DoClose();
}
@@ -3128,7 +3136,26 @@ void ScFiltersTest::testRefStringConfigXLSX()
CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match", formula::FormulaGrammar::CONV_OOO,
aConfig.meStringRefAddressSyntax);
+ xDocSh = loadDoc("empty-noconf.", XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to open 2nd doc", xDocSh.Is());
+
+ //set ref syntax to something else than ExcelA1 (native to xlsx format) ...
+ ScDocument& rDoc2 = xDocSh->GetDocument();
+ aConfig = rDoc2.GetCalcConfig();
+ aConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_A1_XL_A1;
+ rDoc2.SetCalcConfig( aConfig );
+
+ ScDocShellRef xNewDocSh = saveAndReload( &(*xDocSh), XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to reload 2nd doc", xNewDocSh.Is());
+
+ // ... and make sure it got saved
+ ScDocument& rDoc3 = xNewDocSh->GetDocument();
+ aConfig = rDoc3.GetCalcConfig();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match", formula::FormulaGrammar::CONV_A1_XL_A1,
+ aConfig.meStringRefAddressSyntax);
+
xDocSh->DoClose();
+ xNewDocSh->DoClose();
}
void ScFiltersTest::testBnc762542()
commit 077c8838ace23cfe5c54ae222153dbef815b56b0
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu Aug 13 13:13:16 2015 +0200
tdf#92256: Don't force CalcA1 syntax on all !Microsoft xlsx docs
in other words, don't override user's configuration of string ref
syntax
Change-Id: I70281f6869663ccdaabacf506f6effcaf4b5a3fa
Reviewed-on: https://gerrit.libreoffice.org/17702
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 5b01085..883a58d 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -532,18 +532,6 @@ void WorkbookGlobals::useInternalChartDataTable( bool bInternal )
// private --------------------------------------------------------------------
-namespace {
-
-formula::FormulaGrammar::AddressConvention getConvention(css::uno::Reference<XDocumentProperties> xDocProps)
-{
- if (xDocProps->getGenerator().startsWithIgnoreAsciiCase("Microsoft"))
- return formula::FormulaGrammar::CONV_XL_A1;
-
- return formula::FormulaGrammar::CONV_OOO;
-}
-
-}
-
void WorkbookGlobals::initialize( bool bWorkbookFile )
{
maCellStyles = "CellStyles";
@@ -573,9 +561,13 @@ void WorkbookGlobals::initialize( bool bWorkbookFile )
Reference< XDocumentPropertiesSupplier > xPropSupplier( mxDoc, UNO_QUERY);
Reference< XDocumentProperties > xDocProps = xPropSupplier->getDocumentProperties();
- ScCalcConfig aCalcConfig = mpDoc->GetCalcConfig();
- aCalcConfig.SetStringRefSyntax( getConvention(xDocProps) );
- mpDoc->SetCalcConfig(aCalcConfig);
+
+ if (xDocProps->getGenerator().startsWithIgnoreAsciiCase("Microsoft"))
+ {
+ ScCalcConfig aCalcConfig = mpDoc->GetCalcConfig();
+ aCalcConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_XL_A1 ) ;
+ mpDoc->SetCalcConfig(aCalcConfig);
+ }
mxDocImport.reset(new ScDocumentImport(*mpDoc));
commit 2bfeabde75d1e99879465fee6fe6a97357739ae2
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu Aug 13 12:22:05 2015 +0200
tdf#92256: Save ref syntax when different from native one
that is, CalcA1 for ODF and ExcelA1 for OOXML
Change-Id: Ie4df23c5787531677c4533776d489991d413a8d6
Reviewed-on: https://gerrit.libreoffice.org/17701
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index a591402..98fc175 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -883,8 +883,11 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm )
const ScCalcConfig& rCalcConfig = GetDoc().GetCalcConfig();
- // don't write if it hasn't been read or explicitly changed
- if ( rCalcConfig.mbHasStringRefSyntax )
+ // 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) )
{
XclExtLstRef xExtLst( new XclExtLst( GetRoot() ) );
xExtLst->AddRecord( XclExpExtRef( new XclExpExtCalcPr( GetRoot(), rCalcConfig.meStringRefAddressSyntax )) );
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index c695f4f..0ddaaa1 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -462,8 +462,11 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr
{
ScCalcConfig aCalcConfig = rDoc.GetCalcConfig();
- // if it hasn't been read or explicitly changed, don't write it
- if ( aCalcConfig.mbHasStringRefSyntax )
+ // 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;
More information about the Libreoffice-commits
mailing list