diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-30 00:19:30 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-30 11:37:21 -0400 |
commit | ef3fd657ba4d12062609e42f0ec19a9aa71b1c9c (patch) | |
tree | 4f249d0df0e157b1129ab38b6efba92280be5a9d /sc | |
parent | 7dd9054bdef2ac169212a74e1eff52c8f0847e8f (diff) |
Get the sub dialog functional.
Change-Id: Ib3311f64417b68cf94505aeb7f8b153cf5fcdbff
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/optdlg/calcoptionsdlg.cxx | 100 | ||||
-rw-r--r-- | sc/source/ui/optdlg/calcoptionsdlg.hxx | 7 | ||||
-rw-r--r-- | sc/source/ui/optdlg/calcoptionsdlg.src | 4 | ||||
-rw-r--r-- | sc/source/ui/optdlg/tpformula.cxx | 2 |
4 files changed, 90 insertions, 23 deletions
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index 2e22da6618b5..83e1971562bb 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -62,6 +62,41 @@ 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) + { + case 1: + return formula::FormulaGrammar::CONV_OOO; + case 2: + return formula::FormulaGrammar::CONV_XL_A1; + case 3: + return formula::FormulaGrammar::CONV_XL_R1C1; + case 0: + default: + ; + } + + return formula::FormulaGrammar::CONV_UNSPECIFIED; +} + } ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rConfig) : @@ -80,8 +115,9 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rC maLbSettings.SetStyle(maLbSettings.GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE); maLbSettings.SetHighlightRange(); - maLbSettings.SetSelectHdl(LINK(this, ScCalcOptionsDialog, SettingsSelHdl)); - maLbSettings.SetDoubleClickHdl(LINK(this, ScCalcOptionsDialog, SettingsDoubleClickHdl)); + Link aLink = LINK(this, ScCalcOptionsDialog, SettingsSelHdl); + maLbSettings.SetSelectHdl(aLink); + maLbOptionEdit.SetSelectHdl(aLink); FillOptionsList(); FreeResource(); @@ -90,18 +126,28 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rC ScCalcOptionsDialog::~ScCalcOptionsDialog() {} +const ScCalcConfig& ScCalcOptionsDialog::GetConfig() const +{ + return maConfig; +} + void ScCalcOptionsDialog::FillOptionsList() { maLbSettings.SetUpdateMode(false); + maLbSettings.Clear(); SvLBoxTreeList* pModel = maLbSettings.GetModel(); - SvLBoxEntry* pEntry = new SvLBoxEntry; - pEntry->AddItem(new SvLBoxString(pEntry, 0, rtl::OUString())); - pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, Image(), Image(), 0)); - OptionString* pItem = new OptionString(maCaptionIndirectSyntax, "Calc A1"); - pEntry->AddItem(pItem); - pModel->Insert(pEntry); + { + // Syntax for INDIRECT function. + SvLBoxEntry* pEntry = new SvLBoxEntry; + pEntry->AddItem(new SvLBoxString(pEntry, 0, rtl::OUString())); + pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, Image(), Image(), 0)); + OptionString* pItem = new OptionString( + maCaptionIndirectSyntax, toString(maConfig.meIndirectRefSyntax)); + pEntry->AddItem(pItem); + pModel->Insert(pEntry); + } maLbSettings.SetUpdateMode(true); } @@ -112,27 +158,47 @@ void ScCalcOptionsDialog::SelectionChanged() { // Formula syntax for INDIRECT function. maLbOptionEdit.Clear(); + maLbOptionEdit.InsertEntry(rtl::OUString("Use formula syntax")); maLbOptionEdit.InsertEntry(rtl::OUString("Calc A1")); maLbOptionEdit.InsertEntry(rtl::OUString("Excel A1")); maLbOptionEdit.InsertEntry(rtl::OUString("Excel R1C1")); - maLbOptionEdit.SelectEntryPos(0); + switch (maConfig.meIndirectRefSyntax) + { + case formula::FormulaGrammar::CONV_OOO: + maLbOptionEdit.SelectEntryPos(1); + break; + case formula::FormulaGrammar::CONV_XL_A1: + maLbOptionEdit.SelectEntryPos(2); + break; + case formula::FormulaGrammar::CONV_XL_R1C1: + maLbOptionEdit.SelectEntryPos(3); + break; + case formula::FormulaGrammar::CONV_UNSPECIFIED: + default: + maLbOptionEdit.SelectEntryPos(0); + } maFtAnnotation.SetText(maDescIndirectSyntax); } } -void ScCalcOptionsDialog::EditOption() +void ScCalcOptionsDialog::ListOptionValueChanged() { + if (true) + { + // Formula syntax for INDIRECT function. + sal_uInt16 nPos = maLbOptionEdit.GetSelectEntryPos(); + maConfig.meIndirectRefSyntax = toAddressConvention(nPos); + FillOptionsList(); + } } -IMPL_LINK_NOARG(ScCalcOptionsDialog, SettingsSelHdl) +IMPL_LINK(ScCalcOptionsDialog, SettingsSelHdl, Control*, pCtrl) { - SelectionChanged(); - return 0; -} + if (pCtrl == &maLbSettings) + SelectionChanged(); + else if (pCtrl == &maLbOptionEdit) + ListOptionValueChanged(); -IMPL_LINK_NOARG(ScCalcOptionsDialog, SettingsDoubleClickHdl) -{ - EditOption(); return 0; } diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx index b7263c80249b..fbd4ba5e1114 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx @@ -42,13 +42,14 @@ public: ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rConfig); virtual ~ScCalcOptionsDialog(); - DECL_LINK( SettingsSelHdl, void* ); - DECL_LINK( SettingsDoubleClickHdl, void* ); + DECL_LINK( SettingsSelHdl, Control* ); + + const ScCalcConfig& GetConfig() const; private: void FillOptionsList(); void SelectionChanged(); - void EditOption(); + void ListOptionValueChanged(); private: SvxCheckListBox maLbSettings; diff --git a/sc/source/ui/optdlg/calcoptionsdlg.src b/sc/source/ui/optdlg/calcoptionsdlg.src index cb0571b4bdc7..a420f6e6776d 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.src +++ b/sc/source/ui/optdlg/calcoptionsdlg.src @@ -54,8 +54,8 @@ ModalDialog RID_SCDLG_FORMULA_CALCOPTIONS ListBox LB_OPTION_EDIT { - Pos = MAP_APPFONT ( 50 , 82 ) ; - Size = MAP_APPFONT ( 60, 46 ) ; + Pos = MAP_APPFONT ( 50, 82 ) ; + Size = MAP_APPFONT ( 100, 46 ) ; TabStop = TRUE ; DropDown = TRUE ; }; diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx index 06327051bae2..6eb00b994a2c 100644 --- a/sc/source/ui/optdlg/tpformula.cxx +++ b/sc/source/ui/optdlg/tpformula.cxx @@ -144,7 +144,7 @@ void ScTpFormulaOptions::LaunchCustomCalcSettings() ScCalcOptionsDialog aDlg(this, maCurrentConfig); if (aDlg.Execute() == RET_OK) { - + maCurrentConfig = aDlg.GetConfig(); } } |