diff options
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookhelper.cxx | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 0a30c7b4f949..7ea90f19015f 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2160,7 +2160,7 @@ public: SC_DLLPUBLIC void DumpAreaBroadcasters() const; #endif - void SetCalcConfig( const ScCalcConfig& rConfig ); + SC_DLLPUBLIC void SetCalcConfig( const ScCalcConfig& rConfig ); const ScCalcConfig& GetCalcConfig() const { return maCalcConfig; } void ConvertFormulaToValue( const ScRange& rRange, sc::TableValues* pUndo ); diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 96db289d4e7f..f34332aee286 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -34,6 +34,8 @@ #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/table/CellAddress.hpp> #include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <osl/thread.h> #include <oox/helper/progressbar.hxx> #include <oox/helper/propertyset.hxx> @@ -521,6 +523,18 @@ 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"; @@ -548,6 +562,12 @@ void WorkbookGlobals::initialize( bool bWorkbookFile ) if (!mpDoc) throw RuntimeException("Workbookhelper::getScDocument(): Failed to access ScDocument from model"); + Reference< XDocumentPropertiesSupplier > xPropSupplier( mxDoc, UNO_QUERY); + Reference< XDocumentProperties > xDocProps = xPropSupplier->getDocumentProperties(); + ScCalcConfig aCalcConfig = mpDoc->GetCalcConfig(); + aCalcConfig.meStringRefAddressSyntax = getConvention(xDocProps); + mpDoc->SetCalcConfig(aCalcConfig); + mxDocImport.reset(new ScDocumentImport(*mpDoc)); mxFormulaBuffer.reset( new FormulaBuffer( *this ) ); |