From 60ab58a17d39c84ddcad5789b0c7d60179286e1f Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 30 May 2012 00:44:24 -0400 Subject: Localize a string & more efficient list value update. Change-Id: I061ded32454d2aca1eea7ad586de815d34cf386a --- sc/source/ui/optdlg/calcoptionsdlg.cxx | 51 +++++++++++++++++++++------------- sc/source/ui/optdlg/calcoptionsdlg.hrc | 2 ++ sc/source/ui/optdlg/calcoptionsdlg.hxx | 3 ++ sc/source/ui/optdlg/calcoptionsdlg.src | 5 ++++ 4 files changed, 42 insertions(+), 19 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index 83e1971562bb..a661adc45db5 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -62,23 +62,6 @@ void OptionString::Paint(const Point& rPos, SvLBox& rDev, sal_uInt16 /*nFlags*/, rDev.SetFont(aOldFont); } -rtl::OUString toString(formula::FormulaGrammar::AddressConvention eConv) -{ - switch (eConv) - { - case formula::FormulaGrammar::CONV_OOO: - return rtl::OUString("Calc A1"); - case formula::FormulaGrammar::CONV_XL_A1: - return rtl::OUString ("Excel A1"); - case formula::FormulaGrammar::CONV_XL_R1C1: - return rtl::OUString("Excel R1C1"); - case formula::FormulaGrammar::CONV_UNSPECIFIED: - default: - ; - } - return rtl::OUString("Use formula syntax"); -} - formula::FormulaGrammar::AddressConvention toAddressConvention(sal_uInt16 nPos) { switch (nPos) @@ -110,6 +93,7 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rC maBtnCancel(this, ScResId(BTN_CANCEL)), maCaptionIndirectSyntax(ScResId(STR_INDIRECT_SYNTAX_CAPTION).toString()), maDescIndirectSyntax(ScResId(STR_INDIRECT_SYNTAX_DESC).toString()), + maUseFormulaSyntax(ScResId(STR_USE_FORMULA_SYNTAX).toString()), maConfig(rConfig) { maLbSettings.SetStyle(maLbSettings.GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE); @@ -158,7 +142,7 @@ void ScCalcOptionsDialog::SelectionChanged() { // Formula syntax for INDIRECT function. maLbOptionEdit.Clear(); - maLbOptionEdit.InsertEntry(rtl::OUString("Use formula syntax")); + maLbOptionEdit.InsertEntry(maUseFormulaSyntax); maLbOptionEdit.InsertEntry(rtl::OUString("Calc A1")); maLbOptionEdit.InsertEntry(rtl::OUString("Excel A1")); maLbOptionEdit.InsertEntry(rtl::OUString("Excel R1C1")); @@ -188,8 +172,37 @@ void ScCalcOptionsDialog::ListOptionValueChanged() // Formula syntax for INDIRECT function. sal_uInt16 nPos = maLbOptionEdit.GetSelectEntryPos(); maConfig.meIndirectRefSyntax = toAddressConvention(nPos); - FillOptionsList(); + + maLbSettings.SetUpdateMode(false); + + SvLBoxTreeList* pModel = maLbSettings.GetModel(); + SvLBoxEntry* pEntry = pModel->GetEntry(NULL, 0); + if (!pEntry) + return; + + OptionString* pItem = new OptionString( + maCaptionIndirectSyntax, toString(maConfig.meIndirectRefSyntax)); + pEntry->ReplaceItem(pItem, 2); + + maLbSettings.SetUpdateMode(true); + } +} + +rtl::OUString ScCalcOptionsDialog::toString(formula::FormulaGrammar::AddressConvention eConv) const +{ + switch (eConv) + { + case formula::FormulaGrammar::CONV_OOO: + return rtl::OUString("Calc A1"); + case formula::FormulaGrammar::CONV_XL_A1: + return rtl::OUString ("Excel A1"); + case formula::FormulaGrammar::CONV_XL_R1C1: + return rtl::OUString("Excel R1C1"); + case formula::FormulaGrammar::CONV_UNSPECIFIED: + default: + ; } + return maUseFormulaSyntax; } IMPL_LINK(ScCalcOptionsDialog, SettingsSelHdl, Control*, pCtrl) diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hrc b/sc/source/ui/optdlg/calcoptionsdlg.hrc index d0049b9911ac..9620d49aa8cc 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hrc +++ b/sc/source/ui/optdlg/calcoptionsdlg.hrc @@ -41,4 +41,6 @@ #define STR_INDIRECT_SYNTAX_CAPTION 22 #define STR_INDIRECT_SYNTAX_DESC 23 +#define STR_USE_FORMULA_SYNTAX 24 + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx index fbd4ba5e1114..51781a651cf7 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx @@ -51,6 +51,8 @@ private: void SelectionChanged(); void ListOptionValueChanged(); + rtl::OUString toString(formula::FormulaGrammar::AddressConvention eConv) const; + private: SvxCheckListBox maLbSettings; @@ -65,6 +67,7 @@ private: rtl::OUString maCaptionIndirectSyntax; rtl::OUString maDescIndirectSyntax; + rtl::OUString maUseFormulaSyntax; ScCalcConfig maConfig; }; diff --git a/sc/source/ui/optdlg/calcoptionsdlg.src b/sc/source/ui/optdlg/calcoptionsdlg.src index a420f6e6776d..7c8c1d9e3748 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.src +++ b/sc/source/ui/optdlg/calcoptionsdlg.src @@ -98,4 +98,9 @@ ModalDialog RID_SCDLG_FORMULA_CALCOPTIONS { Text [ en-US ] = "Formula syntax that built-in function INDIRECT expects."; }; + + String STR_USE_FORMULA_SYNTAX + { + Text [ en-US ] = "Use formula syntax"; + }; }; -- cgit