Kaydet (Commit) 8bba6a94 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Add ODF recalc option bits to the UI and configuration.

Change-Id: I2a72956f3e91b650b7434c676722d34b2f3394e4
üst aa5e5de6
......@@ -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);
......
......@@ -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:
;
}
......
......@@ -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
......
......@@ -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. */
......
......@@ -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();
......
......@@ -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;
......
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