summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-12-20 14:32:04 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-12-20 14:44:21 -0500
commit8bba6a94a470224171df1abba697ca5d82d6167b (patch)
tree198e16512e059c012daac7c3313455615d055db7 /sc
parentaa5e5de62dd80a4c8be64f809d1607c4d7407fa4 (diff)
Add ODF recalc option bits to the UI and configuration.
Change-Id: I2a72956f3e91b650b7434c676722d34b2f3394e4
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/formulaopt.hxx4
-rw-r--r--sc/source/core/tool/formulaopt.cxx55
-rw-r--r--sc/source/ui/inc/optdlg.hrc5
-rw-r--r--sc/source/ui/inc/tpformula.hxx3
-rw-r--r--sc/source/ui/optdlg/tpformula.cxx46
-rw-r--r--sc/source/ui/src/optdlg.src31
6 files changed, 109 insertions, 35 deletions
diff --git a/sc/inc/formulaopt.hxx b/sc/inc/formulaopt.hxx
index fe585fe43cc0..ff560961ef4a 100644
--- a/sc/inc/formulaopt.hxx
+++ b/sc/inc/formulaopt.hxx
@@ -49,6 +49,7 @@ private:
::rtl::OUString aFormulaSepArrayCol;
ScRecalcOptions meOOXMLRecalc;
+ ScRecalcOptions meODFRecalc;
public:
ScFormulaOptions();
@@ -79,6 +80,9 @@ public:
void SetOOXMLRecalcOptions( ScRecalcOptions eOpt ) { meOOXMLRecalc = eOpt; }
ScRecalcOptions GetOOXMLRecalcOptions() const { return meOOXMLRecalc; }
+ void SetODFRecalcOptions( ScRecalcOptions eOpt ) { meODFRecalc = eOpt; }
+ ScRecalcOptions GetODFRecalcOptions() const { return meODFRecalc; }
+
void ResetFormulaSeparators();
static void GetDefaultFormulaSeparators(rtl::OUString& rSepArg, rtl::OUString& rSepArrayCol, rtl::OUString& rSepArrayRow);
diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx
index a14463b78329..3dc99384a631 100644
--- a/sc/source/core/tool/formulaopt.cxx
+++ b/sc/source/core/tool/formulaopt.cxx
@@ -59,7 +59,8 @@ ScFormulaOptions::ScFormulaOptions( const ScFormulaOptions& rCpy ) :
aFormulaSepArg ( rCpy.aFormulaSepArg ),
aFormulaSepArrayRow ( rCpy.aFormulaSepArrayRow ),
aFormulaSepArrayCol ( rCpy.aFormulaSepArrayCol ),
- meOOXMLRecalc ( rCpy.meOOXMLRecalc )
+ meOOXMLRecalc ( rCpy.meOOXMLRecalc ),
+ meODFRecalc ( rCpy.meODFRecalc )
{
}
@@ -72,6 +73,7 @@ void ScFormulaOptions::SetDefaults()
bUseEnglishFuncName = false;
eFormulaGrammar = ::formula::FormulaGrammar::GRAM_NATIVE;
meOOXMLRecalc = RECALC_ASK;
+ meODFRecalc = RECALC_ASK;
// unspecified means use the current formula syntax.
aCalcConfig.reset();
@@ -151,6 +153,7 @@ ScFormulaOptions& ScFormulaOptions::operator=( const ScFormulaOptions& rCpy )
aFormulaSepArrayRow = rCpy.aFormulaSepArrayRow;
aFormulaSepArrayCol = rCpy.aFormulaSepArrayCol;
meOOXMLRecalc = rCpy.meOOXMLRecalc;
+ meODFRecalc = rCpy.meODFRecalc;
return *this;
}
@@ -162,7 +165,8 @@ bool ScFormulaOptions::operator==( const ScFormulaOptions& rOpt ) const
&& aFormulaSepArg == rOpt.aFormulaSepArg
&& aFormulaSepArrayRow == rOpt.aFormulaSepArrayRow
&& aFormulaSepArrayCol == rOpt.aFormulaSepArrayCol
- && meOOXMLRecalc == rOpt.meOOXMLRecalc;
+ && meOOXMLRecalc == rOpt.meOOXMLRecalc
+ && meODFRecalc == rOpt.meODFRecalc;
}
bool ScFormulaOptions::operator!=( const ScFormulaOptions& rOpt ) const
@@ -219,7 +223,8 @@ SfxPoolItem* ScTpFormulaItem::Clone( SfxItemPool * ) const
#define SCFORMULAOPT_STRING_REF_SYNTAX 5
#define SCFORMULAOPT_EMPTY_STRING_AS_ZERO 6
#define SCFORMULAOPT_OOXML_RECALC 7
-#define SCFORMULAOPT_COUNT 8
+#define SCFORMULAOPT_ODF_RECALC 8
+#define SCFORMULAOPT_COUNT 9
Sequence<OUString> ScFormulaCfg::GetPropertyNames()
{
@@ -233,6 +238,7 @@ Sequence<OUString> ScFormulaCfg::GetPropertyNames()
"Syntax/StringRefAddressSyntax", // SCFORMULAOPT_STRING_REF_SYNTAX
"Syntax/EmptyStringAsZero", // SCFORMULAOPT_EMPTY_STRING_AS_ZERO
"Load/OOXMLRecalcMode", // SCFORMULAOPT_OOXML_RECALC
+ "Load/ODFRecalcMode", // SCFORMULAOPT_ODF_RECALC
};
Sequence<OUString> aNames(SCFORMULAOPT_COUNT);
OUString* pNames = aNames.getArray();
@@ -380,6 +386,30 @@ ScFormulaCfg::ScFormulaCfg() :
SetOOXMLRecalcOptions(eOpt);
}
break;
+ case SCFORMULAOPT_ODF_RECALC:
+ {
+ ScRecalcOptions eOpt = RECALC_ASK;
+ if (pValues[nProp] >>= nIntVal)
+ {
+ switch (nIntVal)
+ {
+ case 0:
+ eOpt = RECALC_ALWAYS;
+ break;
+ case 1:
+ eOpt = RECALC_NEVER;
+ break;
+ case 2:
+ eOpt = RECALC_ASK;
+ break;
+ default:
+ SAL_WARN("sc", "unknown odf recalc option!");
+ }
+ }
+
+ SetODFRecalcOptions(eOpt);
+ }
+ break;
default:
;
}
@@ -463,6 +493,25 @@ void ScFormulaCfg::Commit()
pValues[nProp] <<= nVal;
}
break;
+ case SCFORMULAOPT_ODF_RECALC:
+ {
+ sal_Int32 nVal = 2;
+ switch (GetODFRecalcOptions())
+ {
+ case RECALC_ALWAYS:
+ nVal = 0;
+ break;
+ case RECALC_NEVER:
+ nVal = 1;
+ break;
+ case RECALC_ASK:
+ nVal = 2;
+ break;
+ }
+
+ pValues[nProp] <<= nVal;
+ }
+ break;
default:
;
}
diff --git a/sc/source/ui/inc/optdlg.hrc b/sc/source/ui/inc/optdlg.hrc
index ed982c2cb130..a1c8e0a13472 100644
--- a/sc/source/ui/inc/optdlg.hrc
+++ b/sc/source/ui/inc/optdlg.hrc
@@ -167,7 +167,10 @@
#define BTN_CUSTOM_CALC_CUSTOM 94
#define BTN_CUSTOM_CALC_DETAILS 95
#define FL_RECALC_OPTIONS 96
-#define LB_OOXML_RECALC 97
+#define FT_OOXML_RECALC 97
+#define LB_OOXML_RECALC 98
+#define FT_ODF_RECALC 99
+#define LB_ODF_RECALC 100
// TP_COMPATIBILITY
#define FL_KEY_BINDINGS 1
diff --git a/sc/source/ui/inc/tpformula.hxx b/sc/source/ui/inc/tpformula.hxx
index 55ea854d9d5d..b895235c1c7b 100644
--- a/sc/source/ui/inc/tpformula.hxx
+++ b/sc/source/ui/inc/tpformula.hxx
@@ -76,7 +76,10 @@ private:
PushButton maBtnSepReset;
FixedLine maFlRecalcOptions;
+ FixedText maFtOOXMLRecalc;
ListBox maLbOOXMLRecalcOptions;
+ FixedText maFtODFRecalc;
+ ListBox maLbODFRecalcOptions;
/** Stores old separator value of currently focused separator edit box.
This value is used to revert undesired value change. */
diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx
index ba34d6fc8677..800ab6234928 100644
--- a/sc/source/ui/optdlg/tpformula.cxx
+++ b/sc/source/ui/optdlg/tpformula.cxx
@@ -63,7 +63,10 @@ ScTpFormulaOptions::ScTpFormulaOptions(Window* pParent, const SfxItemSet& rCoreA
maEdSepArrayRow(this, ScResId(ED_FORMULA_SEP_ARRAY_R)),
maBtnSepReset(this, ScResId(BTN_FORMULA_SEP_RESET)),
maFlRecalcOptions(this, ScResId(FL_RECALC_OPTIONS)),
- maLbOOXMLRecalcOptions( this, ScResId(LB_OOXML_RECALC)),
+ maFtOOXMLRecalc(this, ScResId(FT_OOXML_RECALC)),
+ maLbOOXMLRecalcOptions(this, ScResId(LB_OOXML_RECALC)),
+ maFtODFRecalc(this, ScResId(FT_ODF_RECALC)),
+ maLbODFRecalcOptions(this, ScResId(LB_ODF_RECALC)),
mnDecSep(0)
{
maLbFormulaSyntax.InsertEntry(ScResId(SCSTR_FORMULA_SYNTAX_CALC_A1).toString());
@@ -248,7 +251,8 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet)
OUString aSep = maEdSepFuncArg.GetText();
OUString aSepArrayCol = maEdSepArrayCol.GetText();
OUString aSepArrayRow = maEdSepArrayRow.GetText();
- sal_Int16 aOOXMLRecalcMode = maLbOOXMLRecalcOptions.GetSelectEntryPos();
+ sal_Int16 nOOXMLRecalcMode = maLbOOXMLRecalcOptions.GetSelectEntryPos();
+ sal_Int16 nODFRecalcMode = maLbODFRecalcOptions.GetSelectEntryPos();
if (maBtnCustomCalcDefault.IsChecked())
{
@@ -261,7 +265,8 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet)
|| static_cast<OUString>(maEdSepFuncArg.GetSavedValue()) != aSep
|| static_cast<OUString>(maEdSepArrayCol.GetSavedValue()) != aSepArrayCol
|| static_cast<OUString>(maEdSepArrayRow.GetSavedValue()) != aSepArrayRow
- || maLbOOXMLRecalcOptions.GetSavedValue() != aOOXMLRecalcMode
+ || maLbOOXMLRecalcOptions.GetSavedValue() != nOOXMLRecalcMode
+ || maLbODFRecalcOptions.GetSavedValue() != nODFRecalcMode
|| maSavedConfig != maCurrentConfig )
{
::formula::FormulaGrammar::Grammar eGram = ::formula::FormulaGrammar::GRAM_DEFAULT;
@@ -279,19 +284,8 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet)
break;
}
- ScRecalcOptions eOOXMLRecalc = RECALC_ASK;
- switch (aOOXMLRecalcMode)
- {
- case 0:
- eOOXMLRecalc = RECALC_ALWAYS;
- break;
- case 1:
- eOOXMLRecalc = RECALC_NEVER;
- break;
- case 2:
- eOOXMLRecalc = RECALC_ASK;
- break;
- };
+ ScRecalcOptions eOOXMLRecalc = static_cast<ScRecalcOptions>(nOOXMLRecalcMode);
+ ScRecalcOptions eODFRecalc = static_cast<ScRecalcOptions>(nODFRecalcMode);
aOpt.SetFormulaSyntax(eGram);
aOpt.SetUseEnglishFuncName(bEnglishFuncName);
@@ -300,6 +294,7 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet)
aOpt.SetFormulaSepArrayRow(aSepArrayRow);
aOpt.SetCalcConfig(maCurrentConfig);
aOpt.SetOOXMLRecalcOptions(eOOXMLRecalc);
+ aOpt.SetODFRecalcOptions(eODFRecalc);
rCoreSet.Put( ScTpFormulaItem( SID_SCFORMULAOPTIONS, aOpt ) );
bRet = true;
@@ -336,22 +331,13 @@ void ScTpFormulaOptions::Reset(const SfxItemSet& rCoreSet)
maLbFormulaSyntax.SaveValue();
ScRecalcOptions eOOXMLRecalc = aOpt.GetOOXMLRecalcOptions();
-
- switch (eOOXMLRecalc)
- {
- case RECALC_ALWAYS:
- maLbOOXMLRecalcOptions.SelectEntryPos(0);
- break;
- case RECALC_NEVER:
- maLbOOXMLRecalcOptions.SelectEntryPos(1);
- break;
- case RECALC_ASK:
- maLbOOXMLRecalcOptions.SelectEntryPos(2);
- break;
- }
-
+ maLbOOXMLRecalcOptions.SelectEntryPos(static_cast<sal_uInt16>(eOOXMLRecalc));
maLbOOXMLRecalcOptions.SaveValue();
+ ScRecalcOptions eODFRecalc = aOpt.GetODFRecalcOptions();
+ maLbODFRecalcOptions.SelectEntryPos(static_cast<sal_uInt16>(eODFRecalc));
+ maLbODFRecalcOptions.SaveValue();
+
// english function name.
maCbEnglishFuncName.Check( aOpt.GetUseEnglishFuncName() );
maCbEnglishFuncName.SaveValue();
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index e1c5a28aedb8..4f6f5ab0e16a 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -291,9 +291,38 @@ TabPage RID_SCPAGE_FORMULA
Size = MAP_APPFONT( 248, 8 );
Text [ en-US ] = "Recalculation on file load";
};
+
+ FixedText FT_OOXML_RECALC
+ {
+ Pos = MAP_APPFONT ( 21, 149 );
+ Size = MAP_APPFONT ( 120, 8 );
+ Text [ en-US ] = "Excel 2007 and newer";
+ };
+
ListBox LB_OOXML_RECALC
{
- Pos = MAP_APPFONT( 21, 147 );
+ Pos = MAP_APPFONT( 151, 147 );
+ Size = MAP_APPFONT( 80, 50 );
+ Border = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ "Always recalculate";
+ "Never recalculate";
+ "Prompt user";
+ };
+ };
+
+ FixedText FT_ODF_RECALC
+ {
+ Pos = MAP_APPFONT ( 21, 165 );
+ Size = MAP_APPFONT ( 120, 8 );
+ Text [ en-US ] = "ODF Spreadsheet (not saved by LibreOffice)";
+ };
+
+ ListBox LB_ODF_RECALC
+ {
+ Pos = MAP_APPFONT( 151, 163 );
Size = MAP_APPFONT( 80, 50 );
Border = TRUE;
DropDown = TRUE;