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: ...@@ -49,6 +49,7 @@ private:
::rtl::OUString aFormulaSepArrayCol; ::rtl::OUString aFormulaSepArrayCol;
ScRecalcOptions meOOXMLRecalc; ScRecalcOptions meOOXMLRecalc;
ScRecalcOptions meODFRecalc;
public: public:
ScFormulaOptions(); ScFormulaOptions();
...@@ -79,6 +80,9 @@ public: ...@@ -79,6 +80,9 @@ public:
void SetOOXMLRecalcOptions( ScRecalcOptions eOpt ) { meOOXMLRecalc = eOpt; } void SetOOXMLRecalcOptions( ScRecalcOptions eOpt ) { meOOXMLRecalc = eOpt; }
ScRecalcOptions GetOOXMLRecalcOptions() const { return meOOXMLRecalc; } ScRecalcOptions GetOOXMLRecalcOptions() const { return meOOXMLRecalc; }
void SetODFRecalcOptions( ScRecalcOptions eOpt ) { meODFRecalc = eOpt; }
ScRecalcOptions GetODFRecalcOptions() const { return meODFRecalc; }
void ResetFormulaSeparators(); void ResetFormulaSeparators();
static void GetDefaultFormulaSeparators(rtl::OUString& rSepArg, rtl::OUString& rSepArrayCol, rtl::OUString& rSepArrayRow); static void GetDefaultFormulaSeparators(rtl::OUString& rSepArg, rtl::OUString& rSepArrayCol, rtl::OUString& rSepArrayRow);
......
...@@ -59,7 +59,8 @@ ScFormulaOptions::ScFormulaOptions( const ScFormulaOptions& rCpy ) : ...@@ -59,7 +59,8 @@ ScFormulaOptions::ScFormulaOptions( const ScFormulaOptions& rCpy ) :
aFormulaSepArg ( rCpy.aFormulaSepArg ), aFormulaSepArg ( rCpy.aFormulaSepArg ),
aFormulaSepArrayRow ( rCpy.aFormulaSepArrayRow ), aFormulaSepArrayRow ( rCpy.aFormulaSepArrayRow ),
aFormulaSepArrayCol ( rCpy.aFormulaSepArrayCol ), aFormulaSepArrayCol ( rCpy.aFormulaSepArrayCol ),
meOOXMLRecalc ( rCpy.meOOXMLRecalc ) meOOXMLRecalc ( rCpy.meOOXMLRecalc ),
meODFRecalc ( rCpy.meODFRecalc )
{ {
} }
...@@ -72,6 +73,7 @@ void ScFormulaOptions::SetDefaults() ...@@ -72,6 +73,7 @@ void ScFormulaOptions::SetDefaults()
bUseEnglishFuncName = false; bUseEnglishFuncName = false;
eFormulaGrammar = ::formula::FormulaGrammar::GRAM_NATIVE; eFormulaGrammar = ::formula::FormulaGrammar::GRAM_NATIVE;
meOOXMLRecalc = RECALC_ASK; meOOXMLRecalc = RECALC_ASK;
meODFRecalc = RECALC_ASK;
// unspecified means use the current formula syntax. // unspecified means use the current formula syntax.
aCalcConfig.reset(); aCalcConfig.reset();
...@@ -151,6 +153,7 @@ ScFormulaOptions& ScFormulaOptions::operator=( const ScFormulaOptions& rCpy ) ...@@ -151,6 +153,7 @@ ScFormulaOptions& ScFormulaOptions::operator=( const ScFormulaOptions& rCpy )
aFormulaSepArrayRow = rCpy.aFormulaSepArrayRow; aFormulaSepArrayRow = rCpy.aFormulaSepArrayRow;
aFormulaSepArrayCol = rCpy.aFormulaSepArrayCol; aFormulaSepArrayCol = rCpy.aFormulaSepArrayCol;
meOOXMLRecalc = rCpy.meOOXMLRecalc; meOOXMLRecalc = rCpy.meOOXMLRecalc;
meODFRecalc = rCpy.meODFRecalc;
return *this; return *this;
} }
...@@ -162,7 +165,8 @@ bool ScFormulaOptions::operator==( const ScFormulaOptions& rOpt ) const ...@@ -162,7 +165,8 @@ bool ScFormulaOptions::operator==( const ScFormulaOptions& rOpt ) const
&& aFormulaSepArg == rOpt.aFormulaSepArg && aFormulaSepArg == rOpt.aFormulaSepArg
&& aFormulaSepArrayRow == rOpt.aFormulaSepArrayRow && aFormulaSepArrayRow == rOpt.aFormulaSepArrayRow
&& aFormulaSepArrayCol == rOpt.aFormulaSepArrayCol && aFormulaSepArrayCol == rOpt.aFormulaSepArrayCol
&& meOOXMLRecalc == rOpt.meOOXMLRecalc; && meOOXMLRecalc == rOpt.meOOXMLRecalc
&& meODFRecalc == rOpt.meODFRecalc;
} }
bool ScFormulaOptions::operator!=( const ScFormulaOptions& rOpt ) const bool ScFormulaOptions::operator!=( const ScFormulaOptions& rOpt ) const
...@@ -219,7 +223,8 @@ SfxPoolItem* ScTpFormulaItem::Clone( SfxItemPool * ) const ...@@ -219,7 +223,8 @@ SfxPoolItem* ScTpFormulaItem::Clone( SfxItemPool * ) const
#define SCFORMULAOPT_STRING_REF_SYNTAX 5 #define SCFORMULAOPT_STRING_REF_SYNTAX 5
#define SCFORMULAOPT_EMPTY_STRING_AS_ZERO 6 #define SCFORMULAOPT_EMPTY_STRING_AS_ZERO 6
#define SCFORMULAOPT_OOXML_RECALC 7 #define SCFORMULAOPT_OOXML_RECALC 7
#define SCFORMULAOPT_COUNT 8 #define SCFORMULAOPT_ODF_RECALC 8
#define SCFORMULAOPT_COUNT 9
Sequence<OUString> ScFormulaCfg::GetPropertyNames() Sequence<OUString> ScFormulaCfg::GetPropertyNames()
{ {
...@@ -233,6 +238,7 @@ Sequence<OUString> ScFormulaCfg::GetPropertyNames() ...@@ -233,6 +238,7 @@ Sequence<OUString> ScFormulaCfg::GetPropertyNames()
"Syntax/StringRefAddressSyntax", // SCFORMULAOPT_STRING_REF_SYNTAX "Syntax/StringRefAddressSyntax", // SCFORMULAOPT_STRING_REF_SYNTAX
"Syntax/EmptyStringAsZero", // SCFORMULAOPT_EMPTY_STRING_AS_ZERO "Syntax/EmptyStringAsZero", // SCFORMULAOPT_EMPTY_STRING_AS_ZERO
"Load/OOXMLRecalcMode", // SCFORMULAOPT_OOXML_RECALC "Load/OOXMLRecalcMode", // SCFORMULAOPT_OOXML_RECALC
"Load/ODFRecalcMode", // SCFORMULAOPT_ODF_RECALC
}; };
Sequence<OUString> aNames(SCFORMULAOPT_COUNT); Sequence<OUString> aNames(SCFORMULAOPT_COUNT);
OUString* pNames = aNames.getArray(); OUString* pNames = aNames.getArray();
...@@ -380,6 +386,30 @@ ScFormulaCfg::ScFormulaCfg() : ...@@ -380,6 +386,30 @@ ScFormulaCfg::ScFormulaCfg() :
SetOOXMLRecalcOptions(eOpt); SetOOXMLRecalcOptions(eOpt);
} }
break; 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: default:
; ;
} }
...@@ -463,6 +493,25 @@ void ScFormulaCfg::Commit() ...@@ -463,6 +493,25 @@ void ScFormulaCfg::Commit()
pValues[nProp] <<= nVal; pValues[nProp] <<= nVal;
} }
break; 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: default:
; ;
} }
......
...@@ -167,7 +167,10 @@ ...@@ -167,7 +167,10 @@
#define BTN_CUSTOM_CALC_CUSTOM 94 #define BTN_CUSTOM_CALC_CUSTOM 94
#define BTN_CUSTOM_CALC_DETAILS 95 #define BTN_CUSTOM_CALC_DETAILS 95
#define FL_RECALC_OPTIONS 96 #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 // TP_COMPATIBILITY
#define FL_KEY_BINDINGS 1 #define FL_KEY_BINDINGS 1
......
...@@ -76,7 +76,10 @@ private: ...@@ -76,7 +76,10 @@ private:
PushButton maBtnSepReset; PushButton maBtnSepReset;
FixedLine maFlRecalcOptions; FixedLine maFlRecalcOptions;
FixedText maFtOOXMLRecalc;
ListBox maLbOOXMLRecalcOptions; ListBox maLbOOXMLRecalcOptions;
FixedText maFtODFRecalc;
ListBox maLbODFRecalcOptions;
/** Stores old separator value of currently focused separator edit box. /** Stores old separator value of currently focused separator edit box.
This value is used to revert undesired value change. */ This value is used to revert undesired value change. */
......
...@@ -63,7 +63,10 @@ ScTpFormulaOptions::ScTpFormulaOptions(Window* pParent, const SfxItemSet& rCoreA ...@@ -63,7 +63,10 @@ ScTpFormulaOptions::ScTpFormulaOptions(Window* pParent, const SfxItemSet& rCoreA
maEdSepArrayRow(this, ScResId(ED_FORMULA_SEP_ARRAY_R)), maEdSepArrayRow(this, ScResId(ED_FORMULA_SEP_ARRAY_R)),
maBtnSepReset(this, ScResId(BTN_FORMULA_SEP_RESET)), maBtnSepReset(this, ScResId(BTN_FORMULA_SEP_RESET)),
maFlRecalcOptions(this, ScResId(FL_RECALC_OPTIONS)), 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) mnDecSep(0)
{ {
maLbFormulaSyntax.InsertEntry(ScResId(SCSTR_FORMULA_SYNTAX_CALC_A1).toString()); maLbFormulaSyntax.InsertEntry(ScResId(SCSTR_FORMULA_SYNTAX_CALC_A1).toString());
...@@ -248,7 +251,8 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet) ...@@ -248,7 +251,8 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet)
OUString aSep = maEdSepFuncArg.GetText(); OUString aSep = maEdSepFuncArg.GetText();
OUString aSepArrayCol = maEdSepArrayCol.GetText(); OUString aSepArrayCol = maEdSepArrayCol.GetText();
OUString aSepArrayRow = maEdSepArrayRow.GetText(); OUString aSepArrayRow = maEdSepArrayRow.GetText();
sal_Int16 aOOXMLRecalcMode = maLbOOXMLRecalcOptions.GetSelectEntryPos(); sal_Int16 nOOXMLRecalcMode = maLbOOXMLRecalcOptions.GetSelectEntryPos();
sal_Int16 nODFRecalcMode = maLbODFRecalcOptions.GetSelectEntryPos();
if (maBtnCustomCalcDefault.IsChecked()) if (maBtnCustomCalcDefault.IsChecked())
{ {
...@@ -261,7 +265,8 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet) ...@@ -261,7 +265,8 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet)
|| static_cast<OUString>(maEdSepFuncArg.GetSavedValue()) != aSep || static_cast<OUString>(maEdSepFuncArg.GetSavedValue()) != aSep
|| static_cast<OUString>(maEdSepArrayCol.GetSavedValue()) != aSepArrayCol || static_cast<OUString>(maEdSepArrayCol.GetSavedValue()) != aSepArrayCol
|| static_cast<OUString>(maEdSepArrayRow.GetSavedValue()) != aSepArrayRow || static_cast<OUString>(maEdSepArrayRow.GetSavedValue()) != aSepArrayRow
|| maLbOOXMLRecalcOptions.GetSavedValue() != aOOXMLRecalcMode || maLbOOXMLRecalcOptions.GetSavedValue() != nOOXMLRecalcMode
|| maLbODFRecalcOptions.GetSavedValue() != nODFRecalcMode
|| maSavedConfig != maCurrentConfig ) || maSavedConfig != maCurrentConfig )
{ {
::formula::FormulaGrammar::Grammar eGram = ::formula::FormulaGrammar::GRAM_DEFAULT; ::formula::FormulaGrammar::Grammar eGram = ::formula::FormulaGrammar::GRAM_DEFAULT;
...@@ -279,19 +284,8 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet) ...@@ -279,19 +284,8 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet)
break; break;
} }
ScRecalcOptions eOOXMLRecalc = RECALC_ASK; ScRecalcOptions eOOXMLRecalc = static_cast<ScRecalcOptions>(nOOXMLRecalcMode);
switch (aOOXMLRecalcMode) ScRecalcOptions eODFRecalc = static_cast<ScRecalcOptions>(nODFRecalcMode);
{
case 0:
eOOXMLRecalc = RECALC_ALWAYS;
break;
case 1:
eOOXMLRecalc = RECALC_NEVER;
break;
case 2:
eOOXMLRecalc = RECALC_ASK;
break;
};
aOpt.SetFormulaSyntax(eGram); aOpt.SetFormulaSyntax(eGram);
aOpt.SetUseEnglishFuncName(bEnglishFuncName); aOpt.SetUseEnglishFuncName(bEnglishFuncName);
...@@ -300,6 +294,7 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet) ...@@ -300,6 +294,7 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet)
aOpt.SetFormulaSepArrayRow(aSepArrayRow); aOpt.SetFormulaSepArrayRow(aSepArrayRow);
aOpt.SetCalcConfig(maCurrentConfig); aOpt.SetCalcConfig(maCurrentConfig);
aOpt.SetOOXMLRecalcOptions(eOOXMLRecalc); aOpt.SetOOXMLRecalcOptions(eOOXMLRecalc);
aOpt.SetODFRecalcOptions(eODFRecalc);
rCoreSet.Put( ScTpFormulaItem( SID_SCFORMULAOPTIONS, aOpt ) ); rCoreSet.Put( ScTpFormulaItem( SID_SCFORMULAOPTIONS, aOpt ) );
bRet = true; bRet = true;
...@@ -336,22 +331,13 @@ void ScTpFormulaOptions::Reset(const SfxItemSet& rCoreSet) ...@@ -336,22 +331,13 @@ void ScTpFormulaOptions::Reset(const SfxItemSet& rCoreSet)
maLbFormulaSyntax.SaveValue(); maLbFormulaSyntax.SaveValue();
ScRecalcOptions eOOXMLRecalc = aOpt.GetOOXMLRecalcOptions(); ScRecalcOptions eOOXMLRecalc = aOpt.GetOOXMLRecalcOptions();
maLbOOXMLRecalcOptions.SelectEntryPos(static_cast<sal_uInt16>(eOOXMLRecalc));
switch (eOOXMLRecalc)
{
case RECALC_ALWAYS:
maLbOOXMLRecalcOptions.SelectEntryPos(0);
break;
case RECALC_NEVER:
maLbOOXMLRecalcOptions.SelectEntryPos(1);
break;
case RECALC_ASK:
maLbOOXMLRecalcOptions.SelectEntryPos(2);
break;
}
maLbOOXMLRecalcOptions.SaveValue(); maLbOOXMLRecalcOptions.SaveValue();
ScRecalcOptions eODFRecalc = aOpt.GetODFRecalcOptions();
maLbODFRecalcOptions.SelectEntryPos(static_cast<sal_uInt16>(eODFRecalc));
maLbODFRecalcOptions.SaveValue();
// english function name. // english function name.
maCbEnglishFuncName.Check( aOpt.GetUseEnglishFuncName() ); maCbEnglishFuncName.Check( aOpt.GetUseEnglishFuncName() );
maCbEnglishFuncName.SaveValue(); maCbEnglishFuncName.SaveValue();
......
...@@ -291,9 +291,38 @@ TabPage RID_SCPAGE_FORMULA ...@@ -291,9 +291,38 @@ TabPage RID_SCPAGE_FORMULA
Size = MAP_APPFONT( 248, 8 ); Size = MAP_APPFONT( 248, 8 );
Text [ en-US ] = "Recalculation on file load"; 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 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 ); Size = MAP_APPFONT( 80, 50 );
Border = TRUE; Border = TRUE;
DropDown = 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