summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAlbert Thuswaldner <albert.thuswaldner@gmail.com>2012-02-27 00:41:39 +0100
committerKohei Yoshida <kohei.yoshida@suse.com>2012-02-27 12:13:29 -0500
commit90284a5e7a1e5dcdd8e7473914db1ce6edc19f94 (patch)
tree695ba0adf1aa621fdb4c9b67f691da3b885f554a /sc
parentb091acc26d145f2194662df64806f09fb78ef006 (diff)
Splitting ScDocument::SetDocOptions, moved new SetFormulaOptions to ScDocShell
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/documen3.cxx32
-rw-r--r--sc/source/ui/app/scmod.cxx8
-rw-r--r--sc/source/ui/docshell/docsh3.cxx2
-rw-r--r--sc/source/ui/docshell/docsh6.cxx28
-rw-r--r--sc/source/ui/inc/docsh.hxx2
5 files changed, 33 insertions, 39 deletions
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 28eab09ade60..ddacf9246fa6 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -52,10 +52,8 @@
#include "rangelst.hxx"
#include "chartarr.hxx"
#include "chartlock.hxx"
-#include "compiler.hxx"
#include "refupdat.hxx"
#include "docoptio.hxx"
-#include "appoptio.hxx"
#include "viewopti.hxx"
#include "scextopt.hxx"
#include "brdcst.hxx"
@@ -67,7 +65,6 @@
#include "dociter.hxx"
#include "detdata.hxx"
#include "detfunc.hxx"
-#include "scmod.hxx" // SC_MOD
#include "inputopt.hxx" // GetExpandRefs
#include "chartlis.hxx"
#include "sc.hrc" // SID_LINK
@@ -1938,39 +1935,10 @@ const ScDocOptions& ScDocument::GetDocOptions() const
void ScDocument::SetDocOptions( const ScDocOptions& rOpt )
{
- ScAppOptions rAppOpt=SC_MOD()->GetAppOptions();
-
OSL_ENSURE( pDocOptions, "No DocOptions! :-(" );
- // bool bUpdateFuncNames = pDocOptions->GetUseEnglishFuncName() != rOpt.GetUseEnglishFuncName();
*pDocOptions = rOpt;
-
xPoolHelper->SetFormTableOpt(rOpt);
-
- SetGrammar( rAppOpt.GetFormulaSyntax() );
-
- //if (bUpdateFuncNames)
- {
- // This needs to be called first since it may re-initialize the entire
- // opcode map.
- if (rAppOpt.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();
- }
-
- // Update the separators.
- ScCompiler::UpdateSeparatorsNative(
- rAppOpt.GetFormulaSepArg(), rAppOpt.GetFormulaSepArrayCol(), rAppOpt.GetFormulaSepArrayRow());
}
const ScViewOptions& ScDocument::GetViewOptions() const
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 9798306af7c3..f4962112870e 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1088,13 +1088,9 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
}
// Do all the format updates on open documents in one go
- if ( bUpdateDocFormat && pDoc )
+ if ( bUpdateDocFormat && pDocSh )
{
- const ScDocOptions& rOpt = pDoc->GetDocOptions(); // Temporary fix to keep
- // SettDocOption call as is
-
- // Needs update.
- pDoc->SetDocOptions( rOpt );
+ pDocSh->SetFormulaOptions( *pAppCfg );
pDocSh->SetDocumentModified();
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index f5692efcda41..522e9d78a121 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -432,6 +432,7 @@ void ScDocShell::InitOptions(bool bForLoading) // called from InitNew and L
ScModule* pScMod = SC_MOD();
ScDocOptions aDocOpt = pScMod->GetDocOptions();
+ ScAppOptions aAppOpt = pScMod->GetAppOptions();
ScViewOptions aViewOpt = pScMod->GetViewOptions();
aDocOpt.SetAutoSpell( bAutoSpell );
@@ -448,6 +449,7 @@ void ScDocShell::InitOptions(bool bForLoading) // called from InitNew and L
aDocument.SetDocOptions( aDocOpt );
aDocument.SetViewOptions( aViewOpt );
+ SetFormulaOptions( aAppOpt );
// 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 c02956cc4236..9d054bb59988 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -47,9 +47,9 @@
#include "viewdata.hxx"
#include "tabvwsh.hxx"
#include "tablink.hxx"
-#include "appoptio.hxx"
#include "globstr.hrc"
#include "scmod.hxx"
+#include "compiler.hxx"
#include "formula/FormulaCompiler.hxx"
#include "comphelper/processfactory.hxx"
@@ -486,6 +486,31 @@ sal_Bool ScDocShell::ReloadTabLinks()
return sal_True; //! Fehler erkennen
}
+void ScDocShell::SetFormulaOptions(const ScAppOptions& rAppOpt )
+{
+ aDocument.SetGrammar( rAppOpt.GetFormulaSyntax() );
+
+ // This needs to be called first since it may re-initialize the entire
+ // opcode map.
+ if (rAppOpt.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();
+
+ // Update the separators.
+ ScCompiler::UpdateSeparatorsNative(
+ rAppOpt.GetFormulaSepArg(), rAppOpt.GetFormulaSepArrayCol(), rAppOpt.GetFormulaSepArrayRow());
+}
+
void ScDocShell::CheckConfigOptions()
{
if (IsConfigOptionsChecked())
@@ -506,6 +531,7 @@ void ScDocShell::CheckConfigOptions()
// separator. Reset them to default.
ScAppOptions aNew = rAppOpt;
aNew.ResetFormulaSeparators();
+ SetFormulaOptions(aNew);
pScMod->SetAppOptions(aNew);
// Launch a nice warning dialog to let the users know of this change.
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 74e12f45b36c..488c202de6cc 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -39,6 +39,7 @@
#include "scdllapi.h"
#include "scdll.hxx"
#include "document.hxx"
+#include "appoptio.hxx"
#include "shellids.hxx"
#include "refreshtimer.hxx"
#include "optutil.hxx"
@@ -320,6 +321,7 @@ public:
void UpdateLinks(); // Link-Eintraege aktuallisieren
sal_Bool ReloadTabLinks(); // Links ausfuehren (Inhalt aktualisieren)
+ void SetFormulaOptions(const ScAppOptions& rAppOpt );
virtual void CheckConfigOptions();
void PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddress& rCursorPos );