[Libreoffice-commits] core.git: Branch 'private/jmux/libreoffice-4-1-6+backports' - 4 commits - formula/source sc/source
Katarina Behrens
Katarina.Behrens at cib.de
Fri Oct 16 09:17:09 PDT 2015
formula/source/ui/dlg/formula.cxx | 2 -
sc/source/filter/excel/read.cxx | 9 ++++
sc/source/filter/oox/workbookfragment.cxx | 2 +
sc/source/filter/xml/xmlimprt.cxx | 17 ++++++++
sc/source/filter/xml/xmlimprt.hxx | 1
sc/source/ui/app/scmod.cxx | 6 ++-
sc/source/ui/docshell/docsh.cxx | 2 +
sc/source/ui/docshell/docsh3.cxx | 2 -
sc/source/ui/docshell/docsh6.cxx | 60 ++++++++++++++++++++----------
sc/source/ui/inc/docsh.hxx | 2 -
sc/source/ui/unoobj/confuno.cxx | 10 -----
11 files changed, 79 insertions(+), 34 deletions(-)
New commits:
commit 930ae20aa44fa362a1ae95c3f01c5a9885f9e4d5
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Fri Oct 16 16:34:28 2015 +0200
Related tdf#92256: Set legacy mode also for all xls files
Change-Id: I23854ffcd170670f70f5fc386c3b8d35295fa4c3
diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx
index d1ec8ae..17a7d28 100644
--- a/sc/source/filter/excel/read.cxx
+++ b/sc/source/filter/excel/read.cxx
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include "calcconfig.hxx"
#include "document.hxx"
#include "scerrors.hxx"
#include "fprogressbar.hxx"
@@ -752,6 +753,10 @@ FltError ImportExcel::Read( void )
pD->CalcAfterLoad();
+ ScCalcConfig aConfig = pD->GetCalcConfig();
+ aConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_A1_XL_A1 );
+ pD->SetCalcConfig( aConfig );
+
const XclImpAddressConverter& rAddrConv = GetAddressConverter();
if( rAddrConv.IsTabTruncated() )
eLastErr = SCWARN_IMPORT_SHEET_OVERFLOW;
@@ -1297,6 +1302,10 @@ FltError ImportExcel8::Read( void )
pD->CalcAfterLoad();
+ ScCalcConfig aConfig = pD->GetCalcConfig();
+ aConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_A1_XL_A1 );
+ pD->SetCalcConfig( aConfig );
+
// import change tracking data
XclImpChangeTrack aImpChTr( GetRoot(), maStrm );
aImpChTr.Apply();
commit 54760137aa52715eae043f781a0aacd0fd2aeec8
Author: Eike Rathke <erack at redhat.com>
Date: Fri Aug 22 04:29:06 2014 +0200
init formula options once, fdo#82183
Change-Id: I1db4816f4693e35024c6dc6c70585d7b72e68c32
(cherry picked from commit 10b6bda51c9da5429ca562c70ce75ee03e5f4e56)
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 6ed4b9b..a657f2f 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -480,9 +480,15 @@ void ScDocShell::SetFormulaOptions( const ScFormulaOptions& rOpt, bool bForLoadi
/** TODO: bForLoading is a workaround, rather get rid of setting any
globals from per document instances like ScDocShell. */
- if (!bForLoading)
+ /* XXX this is utter crap, we rely on the options being set here at least
+ * once, for the very first document, empty or loaded. */
+ static bool bInitOnce = true;
+
+ if (!bForLoading || bInitOnce)
{
- if (rOpt.GetUseEnglishFuncName() != SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName())
+ bool bForceInit = bInitOnce;
+ bInitOnce = false;
+ if (bForceInit || rOpt.GetUseEnglishFuncName() != SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName())
{
// This needs to be called first since it may re-initialize the entire
// opcode map.
commit ac9cc408088e1fda251504f15f9d1737d66cb8a2
Author: Eike Rathke <erack at redhat.com>
Date: Thu Aug 21 23:14:52 2014 +0200
fdo#82183 do not reset globals while loading a document
Destroying the function list while an instance of the Formula Wizard is
still open is a bad idea. Workaround not doing this when loading a
document due to a DDE function or external reference being entered in
the wizard.
(cherry picked from commit c0aba5007b6e468336b41138f099914c32f4b0cf)
Conflicts:
sc/source/filter/oox/workbookhelper.cxx
sc/source/ui/app/scmod.cxx
Change-Id: I6fa00fb4f442bf7c9410679e446ff460289e4b16
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 4891bd1..13ebb49 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -1847,7 +1847,7 @@ void FormulaDlg::StoreFormEditData(FormEditData* pData)
// -----------------------------------------------------------------------------
const IFunctionDescription* FormulaDlg::getCurrentFunctionDescription() const
{
- OSL_VERIFY(!m_pImpl->pFuncDesc || m_pImpl->pFuncDesc->getSuppressedArgumentCount() == m_pImpl->nArgs);
+ //OSL_VERIFY(!m_pImpl->pFuncDesc || m_pImpl->pFuncDesc->getSuppressedArgumentCount() == m_pImpl->nArgs);
return m_pImpl->pFuncDesc;
}
// -----------------------------------------------------------------------------
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index af6ad1d..280f814 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -360,6 +360,8 @@ void WorkbookFragment::finalizeImport()
officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::set(sal_Int32(0), batch);
ScFormulaOptions aOpt = SC_MOD()->GetFormulaOptions();
aOpt.SetOOXMLRecalcOptions(bHardRecalc ? RECALC_ALWAYS : RECALC_NEVER);
+ /* XXX is this really supposed to set the ScModule options?
+ * Not the ScDocShell options? */
SC_MOD()->SetFormulaOptions(aOpt);
batch->commit();
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 6af94af..142496a 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1071,13 +1071,15 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
bCompileErrorCells = true;
}
- SetFormulaOptions( rOpt );
-
if ( pDocSh )
{
pDocSh->SetFormulaOptions( rOpt );
pDocSh->SetDocumentModified();
}
+
+ // ScDocShell::SetFormulaOptions() may check for changed settings, so
+ // set the new options here after that has been called.
+ SetFormulaOptions( rOpt );
}
//============================================
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index f33c16c..5009ee0 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -462,6 +462,8 @@ sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::un
officecfg::Office::Calc::Formula::Load::ODFRecalcMode::set(sal_Int32(0), batch);
ScFormulaOptions aOpt = SC_MOD()->GetFormulaOptions();
aOpt.SetODFRecalcOptions(bHardRecalc ? RECALC_ALWAYS : RECALC_NEVER);
+ /** XXX is this really supposed to set the ScModule options?
+ Not the ScDocShell options? */
SC_MOD()->SetFormulaOptions(aOpt);
batch->commit();
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index c07913f..12c93af 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -431,7 +431,7 @@ void ScDocShell::InitOptions(bool bForLoading) // called from InitNew and L
aDocument.SetDocOptions( aDocOpt );
aDocument.SetViewOptions( aViewOpt );
- SetFormulaOptions( aFormulaOpt );
+ SetFormulaOptions( aFormulaOpt, bForLoading );
// Druck-Optionen werden jetzt direkt vor dem Drucken gesetzt
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 1a43856..6ed4b9b 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -466,32 +466,48 @@ sal_Bool ScDocShell::ReloadTabLinks()
return sal_True; //! Fehler erkennen
}
-void ScDocShell::SetFormulaOptions(const ScFormulaOptions& rOpt )
+void ScDocShell::SetFormulaOptions( const ScFormulaOptions& rOpt, bool bForLoading )
{
aDocument.SetGrammar( rOpt.GetFormulaSyntax() );
- // This needs to be called first since it may re-initialize the entire
- // opcode map.
- if (rOpt.GetUseEnglishFuncName())
+ // This is nasty because it resets module globals from within a docshell!
+ // For actual damage caused see fdo#82183 where an unconditional
+ // ScGlobal::ResetFunctionList() (without checking GetUseEnglishFuncName())
+ // lead to a crash becasuse the function list was still used by the Formula
+ // Wizard when loading the second document.
+ // Do the stupid stuff only when we're not called while loading a document.
+
+ /** TODO: bForLoading is a workaround, rather get rid of setting any
+ globals from per document instances like ScDocShell. */
+
+ if (!bForLoading)
{
- // switch native symbols to English.
- ScCompiler aComp(NULL, ScAddress());
- ScCompiler::OpCodeMapPtr xMap = aComp.GetOpCodeMap(::com::sun::star::sheet::FormulaLanguage::ENGLISH);
- ScCompiler::SetNativeSymbols(xMap);
- }
- else
- // re-initialize native symbols with localized function names.
- ScCompiler::ResetNativeSymbols();
+ if (rOpt.GetUseEnglishFuncName() != SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName())
+ {
+ // This needs to be called first since it may re-initialize the entire
+ // opcode map.
+ if (rOpt.GetUseEnglishFuncName())
+ {
+ // switch native symbols to English.
+ ScCompiler aComp(NULL, ScAddress());
+ ScCompiler::OpCodeMapPtr xMap = aComp.GetOpCodeMap(::com::sun::star::sheet::FormulaLanguage::ENGLISH);
+ ScCompiler::SetNativeSymbols(xMap);
+ }
+ else
+ // re-initialize native symbols with localized function names.
+ ScCompiler::ResetNativeSymbols();
- // Force re-population of function names for the function wizard, function tip etc.
- ScGlobal::ResetFunctionList();
+ // Force re-population of function names for the function wizard, function tip etc.
+ ScGlobal::ResetFunctionList();
+ }
- // Update the separators.
- ScCompiler::UpdateSeparatorsNative(
- rOpt.GetFormulaSepArg(), rOpt.GetFormulaSepArrayCol(), rOpt.GetFormulaSepArrayRow());
+ // Update the separators.
+ ScCompiler::UpdateSeparatorsNative(
+ rOpt.GetFormulaSepArg(), rOpt.GetFormulaSepArrayCol(), rOpt.GetFormulaSepArrayRow());
- // Global interpreter settings.
- ScInterpreter::SetGlobalConfig(rOpt.GetCalcConfig());
+ // Global interpreter settings.
+ ScInterpreter::SetGlobalConfig(rOpt.GetCalcConfig());
+ }
// Per document interpreter settings.
SetCalcConfig( rOpt.GetCalcConfig());
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 96a33d8..2329080 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -321,7 +321,7 @@ public:
void UpdateLinks();
sal_Bool ReloadTabLinks();
- void SetFormulaOptions(const ScFormulaOptions& rOpt );
+ void SetFormulaOptions( const ScFormulaOptions& rOpt, bool bForLoading = false );
void SetCalcConfig( const ScCalcConfig& rConfig );
virtual void CheckConfigOptions();
commit 7f88cd7db10bb7694ff6f39db416a1bdc33b3df7
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon Oct 12 15:06:20 2015 +0200
Related tdf#93688: better place this into import finalize phase
Conflicts:
sc/source/filter/xml/xmlimprt.cxx
Change-Id: I08066248973f4560f8f5d149e9f84c4c2302f12c
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index ab54d91..db2ac94 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -3206,6 +3206,22 @@ void ScXMLImport::SetSheetNamedRanges()
}
}
+void ScXMLImport::SetStringRefSyntaxIfMissing()
+{
+ if (!pDoc)
+ return;
+
+ ScCalcConfig aCalcConfig = pDoc->GetCalcConfig();
+
+ // Has any string ref syntax been imported?
+ // If not, we need to take action
+ if ( !aCalcConfig.mbHasStringRefSyntax )
+ {
+ aCalcConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_A1_XL_A1;
+ pDoc->SetCalcConfig(aCalcConfig);
+ }
+}
+
void SAL_CALL ScXMLImport::endDocument(void)
throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException )
{
@@ -3253,6 +3269,7 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE
if (mpPivotSources)
// Process pivot table sources after the named ranges have been set.
mpPivotSources->process();
+ SetStringRefSyntaxIfMissing();
}
GetProgressBarHelper()->End(); // make room for subsequent SfxProgressBars
if (pDoc)
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 832066e..18debd2 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -1191,6 +1191,7 @@ public:
void SetSheetNamedRanges();
void SetLabelRanges();
void AddDefaultNote( const com::sun::star::table::CellAddress& aCell );
+ void SetStringRefSyntaxIfMissing();
/** Extracts the formula string, the formula grammar namespace URL, and a
grammar enum value from the passed formula attribute value.
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index d1a85d8..abcbdbc 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -348,16 +348,6 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
pDocShell->SetDocumentModified();
}
-
- ScCalcConfig aCalcConfig = pDoc->GetCalcConfig();
-
- // Has any string ref syntax been imported?
- // If not, we need to take action
- if ( !aCalcConfig.mbHasStringRefSyntax )
- {
- aCalcConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_A1_XL_A1;
- pDoc->SetCalcConfig(aCalcConfig);
- }
}
else
throw uno::RuntimeException();
More information about the Libreoffice-commits
mailing list