Kaydet (Commit) 3d21bda6 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Make use of the recalc option when loading ODF documents.

Change-Id: If33dd77c1b54cdfb5a8ff75c5b6e13db09b0c19f
üst 8bba6a94
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "docsh.hxx"
#include "scitems.hxx" #include "scitems.hxx"
#include <editeng/justifyitem.hxx> #include <editeng/justifyitem.hxx>
#include <sot/clsids.hxx> #include <sot/clsids.hxx>
...@@ -92,11 +94,11 @@ ...@@ -92,11 +94,11 @@
#include "tabprotection.hxx" #include "tabprotection.hxx"
#include "docparam.hxx" #include "docparam.hxx"
#include "docsh.hxx"
#include "docshimp.hxx" #include "docshimp.hxx"
#include "sizedev.hxx" #include "sizedev.hxx"
#include <rtl/logfile.hxx> #include <rtl/logfile.hxx>
#include <officecfg/Office/Calc.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
#include "uiitems.hxx" #include "uiitems.hxx"
...@@ -428,17 +430,28 @@ sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::un ...@@ -428,17 +430,28 @@ sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::un
uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties(); uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
rtl::OUString sGenerator = xDocProps->getGenerator(); 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; 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 if (aDocument.IsUserInteractionEnabled() && xDocProps->getGenerator().indexOf("LibreOffice") == -1)
// full re-calculation. {
QueryBox aBox( // Generator is not LibreOffice. Ask if the user wants to perform
GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), // full re-calculation.
ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS)); 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) if (bHardRecalc)
DoHardRecalc(false); DoHardRecalc(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment