diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-19 02:24:30 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-19 02:27:55 +0200 |
commit | 158b50763962f66515062300e265839828463efa (patch) | |
tree | a57e189f00118dfc5c832443117258df43a759a7 /sc | |
parent | c43a25a7268c1b6ab81e9ba694a1f22223a24afa (diff) |
use XL_A1 as ref string syntax for excel produced documents
Change-Id: Ieed3521674ef713d9c09313cd41d1edd6ba3dcc5
Diffstat (limited to 'sc')
-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 ) ); |