summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-12-20 14:41:56 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-12-20 14:44:21 -0500
commit3d21bda6a739a5a026fdaa6aa51aee563da75ca4 (patch)
tree6f7ea6776efe5d8451e3b4eeed11badc87fb8dd3 /sc
parent8bba6a94a470224171df1abba697ca5d82d6167b (diff)
Make use of the recalc option when loading ODF documents.
Change-Id: If33dd77c1b54cdfb5a8ff75c5b6e13db09b0c19f
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/docsh.cxx29
1 files changed, 21 insertions, 8 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 1a7ec1acfdec..9377f9419f91 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "docsh.hxx"
+
#include "scitems.hxx"
#include <editeng/justifyitem.hxx>
#include <sot/clsids.hxx>
@@ -92,11 +94,11 @@
#include "tabprotection.hxx"
#include "docparam.hxx"
-#include "docsh.hxx"
#include "docshimp.hxx"
#include "sizedev.hxx"
#include <rtl/logfile.hxx>
+#include <officecfg/Office/Calc.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include "uiitems.hxx"
@@ -428,17 +430,28 @@ sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::un
uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
rtl::OUString sGenerator = xDocProps->getGenerator();
+ Reference<uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
+ ScRecalcOptions nRecalcMode =
+ static_cast<ScRecalcOptions>(officecfg::Office::Calc::Formula::Load::ODFRecalcMode::get(xContext));
+
bool bHardRecalc = false;
- if (aDocument.IsUserInteractionEnabled() && xDocProps->getGenerator().indexOf("LibreOffice") == -1)
+ if (nRecalcMode == RECALC_ASK)
{
- // Generator is not LibreOffice. Ask if the user wants to perform
- // full re-calculation.
- QueryBox aBox(
- GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
- ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS));
+ if (aDocument.IsUserInteractionEnabled() && xDocProps->getGenerator().indexOf("LibreOffice") == -1)
+ {
+ // Generator is not LibreOffice. Ask if the user wants to perform
+ // full re-calculation.
+ QueryBox aBox(
+ GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
+ ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS));
- bHardRecalc = aBox.Execute() == RET_YES;
+ bHardRecalc = aBox.Execute() == RET_YES;
+ }
}
+ else if (nRecalcMode == RECALC_ALWAYS)
+ bHardRecalc = true;
+
+ fprintf(stdout, "ScDocShell::LoadXML: hard recalc = %d\n", bHardRecalc);
if (bHardRecalc)
DoHardRecalc(false);