diff options
author | Daniel Bankston <daniel.e.bankston@gmail.com> | 2012-07-05 18:15:45 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-07-11 20:37:39 -0400 |
commit | f107e3a5f7cc19957435f1e90617105509394b4d (patch) | |
tree | eff9b1405b9b21bfad9fdc74ac04cc9fb9aeab27 /sc/source/ui/docshell/docsh.cxx | |
parent | 1cdfb19c2202b56e4de6f10104bb4841372956cb (diff) |
Use cached formula results instead of recalculating
This commit undoes some of previous commit in attempt to be less "hackish".
-When importing LibreOffice generated ODS documents, use cached formula
results instead of always recalcuating.
-For other generators, do hard-recalc.
Still need to:
-Stop matrix formula cells from being set dirty to avoid recalculating them.
-Implement special cases for functions that should always be recalculated.
Change-Id: I959872aa2f446b80f9204ee26e94de7140f1f6f9
Diffstat (limited to 'sc/source/ui/docshell/docsh.cxx')
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 528ad183aae4..d60491976826 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -116,6 +116,8 @@ #include <vector> #include <boost/shared_ptr.hpp> +#define SC_LIBO_PROD_NAME "LibreOffice" + using namespace com::sun::star; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::UNO_QUERY; @@ -363,7 +365,12 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet) if (pModificator) { + sal_uInt16 nRecalcState = aDocument.GetHardRecalcState(); + //temporarily set hard-recalc to prevent calling ScFormulaCell::Notify() + //which will set the cells dirty. + aDocument.SetHardRecalcState(2); delete pModificator; + aDocument.SetHardRecalcState(nRecalcState); pModificator = NULL; } else @@ -422,9 +429,14 @@ sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::un if ( nError ) pLoadMedium->SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); + uno::Reference<document::XDocumentPropertiesSupplier> xDPS(GetModel(), uno::UNO_QUERY_THROW); + uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties(); + rtl::OUString sGenerator(xDocProps->getGenerator()); + if(!sGenerator.match(SC_LIBO_PROD_NAME)) + DoHardRecalc(false); + aDocument.SetXMLFromWrapper( false ); AfterXMLLoading(bRet); - aDocument.SetImportingLiboGenDoc(false); //! row heights... return bRet; |