Kaydet (Commit) d82e1f1a authored tarafından Caolán McNamara's avatar Caolán McNamara

convert calculation settings dialog to .ui format

Change-Id: I0031094be63f2d8efeac42d5ca560f57af5326b6
üst 8ece576c
...@@ -63,7 +63,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\ ...@@ -63,7 +63,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\
sc/source/ui/cctrl/checklistmenu.src \ sc/source/ui/cctrl/checklistmenu.src \
sc/source/ui/navipi/navipi.src \ sc/source/ui/navipi/navipi.src \
sc/source/ui/docshell/tpstat.src \ sc/source/ui/docshell/tpstat.src \
sc/source/ui/optdlg/calcoptionsdlg.src \
sc/source/ui/pagedlg/pagedlg.src \ sc/source/ui/pagedlg/pagedlg.src \
sc/source/ui/styleui/scstyles.src \ sc/source/ui/styleui/scstyles.src \
sc/source/ui/styleui/styledlg.src \ sc/source/ui/styleui/styledlg.src \
......
...@@ -69,6 +69,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ ...@@ -69,6 +69,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/externaldata \ sc/uiconfig/scalc/ui/externaldata \
sc/uiconfig/scalc/ui/footerdialog \ sc/uiconfig/scalc/ui/footerdialog \
sc/uiconfig/scalc/ui/formatcellsdialog \ sc/uiconfig/scalc/ui/formatcellsdialog \
sc/uiconfig/scalc/ui/formulacalculationoptions \
sc/uiconfig/scalc/ui/goalseekdlg \ sc/uiconfig/scalc/ui/goalseekdlg \
sc/uiconfig/scalc/ui/groupdialog \ sc/uiconfig/scalc/ui/groupdialog \
sc/uiconfig/scalc/ui/headerdialog \ sc/uiconfig/scalc/ui/headerdialog \
......
...@@ -1099,7 +1099,7 @@ ...@@ -1099,7 +1099,7 @@
#define RID_SCDLG_TAB_BG_COLOR (SC_DIALOGS_START + 154) #define RID_SCDLG_TAB_BG_COLOR (SC_DIALOGS_START + 154)
#define RID_SCDLG_DATABAR (SC_DIALOGS_START + 155) #define RID_SCDLG_DATABAR (SC_DIALOGS_START + 155)
#define RID_COND_ENTRY (SC_DIALOGS_START + 156) #define RID_COND_ENTRY (SC_DIALOGS_START + 156)
#define RID_SCDLG_FORMULA_CALCOPTIONS (SC_DIALOGS_START + 157)
#define RID_ICON_SET_ENTRY (SC_DIALOGS_START + 158) #define RID_ICON_SET_ENTRY (SC_DIALOGS_START + 158)
#define RID_SCDLG_COND_FORMAT_MANAGER (SC_DIALOGS_START + 159) #define RID_SCDLG_COND_FORMAT_MANAGER (SC_DIALOGS_START + 159)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
*/ */
#include "calcoptionsdlg.hxx" #include "calcoptionsdlg.hxx"
#include "calcoptionsdlg.hrc" #include "sc.hrc"
#include "scresid.hxx" #include "scresid.hxx"
#include "svtools/svlbitm.hxx" #include "svtools/svlbitm.hxx"
...@@ -101,46 +101,43 @@ formula::FormulaGrammar::AddressConvention toAddressConvention(sal_uInt16 nPos) ...@@ -101,46 +101,43 @@ formula::FormulaGrammar::AddressConvention toAddressConvention(sal_uInt16 nPos)
} }
ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rConfig) : ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rConfig)
ModalDialog(pParent, ScResId(RID_SCDLG_FORMULA_CALCOPTIONS)), : ModalDialog(pParent, "FormulaCalculationOptions",
maLbSettings(this, ScResId(LB_SETTINGS)), "modules/scalc/ui/formulacalculationoptions.ui")
maFtOptionEditCaption(this, ScResId(FT_OPTION_EDIT_CAPTION)), , maCalcA1(ScResId(SCSTR_FORMULA_SYNTAX_CALC_A1).toString())
maLbOptionEdit(this, ScResId(LB_OPTION_EDIT)), , maExcelA1(ScResId(SCSTR_FORMULA_SYNTAX_XL_A1).toString())
maBtnTrue(this, ScResId(BTN_OPTION_TRUE)), , maExcelR1C1(ScResId(SCSTR_FORMULA_SYNTAX_XL_R1C1).toString())
maBtnFalse(this, ScResId(BTN_OPTION_FALSE)), , maConfig(rConfig)
maFlAnnotation(this, ScResId(FL_ANNOTATION)),
maFtAnnotation(this, ScResId(FT_ANNOTATION)),
maBtnOK(this, ScResId(BTN_OK)),
maBtnCancel(this, ScResId(BTN_CANCEL)),
maTrue(ScResId(STR_TRUE).toString()),
maFalse(ScResId(STR_FALSE).toString()),
maCalcA1(ScResId(SCSTR_FORMULA_SYNTAX_CALC_A1).toString()),
maExcelA1(ScResId(SCSTR_FORMULA_SYNTAX_XL_A1).toString()),
maExcelR1C1(ScResId(SCSTR_FORMULA_SYNTAX_XL_R1C1).toString()),
maCaptionStringRefSyntax(ScResId(STR_STRING_REF_SYNTAX_CAPTION).toString()),
maDescStringRefSyntax(ScResId(STR_STRING_REF_SYNTAX_DESC).toString()),
maUseFormulaSyntax(ScResId(STR_USE_FORMULA_SYNTAX).toString()),
maCaptionEmptyStringAsZero(ScResId(STR_EMPTY_STRING_AS_ZERO_CAPTION).toString()),
maDescEmptyStringAsZero(ScResId(STR_EMPTY_STRING_AS_ZERO_DESC).toString()),
maCaptionOpenCLEnabled(ScResId(STR_OPENCL_ENABLED).toString()),
maDescOpenCLEnabled(ScResId(STR_OPENCL_ENABLED_DESC).toString()),
maConfig(rConfig)
{ {
maLbSettings.SetStyle(maLbSettings.GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE); get(mpLbSettings, "settings");
maLbSettings.SetHighlightRange(); get(mpLbOptionEdit, "edit");
get(mpFtAnnotation, "annotation");
get(mpBtnTrue, "true");
get(mpBtnFalse, "false");
maCaptionStringRefSyntax = get<Window>("ref_syntax_caption")->GetText();
maDescStringRefSyntax = get<Window>("ref_syntax_desc")->GetText();
maUseFormulaSyntax = get<Window>("use_formula_syntax")->GetText();
maCaptionEmptyStringAsZero = get<Window>("empty_str_as_zero_caption")->GetText();
maDescEmptyStringAsZero = get<Window>("empty_str_as_zero_desc")->GetText();
maCaptionOpenCLEnabled = get<Window>("opencl_enabled")->GetText();
maDescOpenCLEnabled = get<Window>("opencl_enabled_desc")->GetText();
mpLbSettings->set_height_request(8 * mpLbSettings->GetTextHeight());
mpLbSettings->SetStyle(mpLbSettings->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
mpLbSettings->SetHighlightRange();
Link aLink = LINK(this, ScCalcOptionsDialog, SettingsSelHdl); Link aLink = LINK(this, ScCalcOptionsDialog, SettingsSelHdl);
maLbSettings.SetSelectHdl(aLink); mpLbSettings->SetSelectHdl(aLink);
maLbOptionEdit.SetSelectHdl(aLink); mpLbOptionEdit->SetSelectHdl(aLink);
aLink = LINK(this, ScCalcOptionsDialog, BtnToggleHdl); aLink = LINK(this, ScCalcOptionsDialog, BtnToggleHdl);
maBtnTrue.SetToggleHdl(aLink); // Set handler only to the 'True' button. mpBtnTrue->SetToggleHdl(aLink); // Set handler only to the 'True' button.
maBtnTrue.SetText(maTrue); maTrue = mpBtnTrue->GetText();
maBtnFalse.SetText(maFalse); maFalse = mpBtnFalse->GetText();
FillOptionsList(); FillOptionsList();
FreeResource();
SelectionChanged(); SelectionChanged();
} }
...@@ -163,7 +160,7 @@ SvTreeListEntry *ScCalcOptionsDialog::createBoolItem(const OUString &rCaption, b ...@@ -163,7 +160,7 @@ SvTreeListEntry *ScCalcOptionsDialog::createBoolItem(const OUString &rCaption, b
void ScCalcOptionsDialog::setValueAt(size_t nPos, const OUString &rValue) void ScCalcOptionsDialog::setValueAt(size_t nPos, const OUString &rValue)
{ {
SvTreeList *pModel = maLbSettings.GetModel(); SvTreeList *pModel = mpLbSettings->GetModel();
SvTreeListEntry* pEntry = pModel->GetEntry(NULL, nPos); SvTreeListEntry* pEntry = pModel->GetEntry(NULL, nPos);
if (!pEntry) if (!pEntry)
{ {
...@@ -183,10 +180,10 @@ void ScCalcOptionsDialog::setValueAt(size_t nPos, const OUString &rValue) ...@@ -183,10 +180,10 @@ void ScCalcOptionsDialog::setValueAt(size_t nPos, const OUString &rValue)
void ScCalcOptionsDialog::FillOptionsList() void ScCalcOptionsDialog::FillOptionsList()
{ {
maLbSettings.SetUpdateMode(false); mpLbSettings->SetUpdateMode(false);
maLbSettings.Clear(); mpLbSettings->Clear();
SvTreeList* pModel = maLbSettings.GetModel(); SvTreeList* pModel = mpLbSettings->GetModel();
{ {
// Syntax for INDIRECT function. // Syntax for INDIRECT function.
...@@ -202,42 +199,42 @@ void ScCalcOptionsDialog::FillOptionsList() ...@@ -202,42 +199,42 @@ void ScCalcOptionsDialog::FillOptionsList()
pModel->Insert(createBoolItem(maCaptionEmptyStringAsZero,maConfig.mbEmptyStringAsZero)); pModel->Insert(createBoolItem(maCaptionEmptyStringAsZero,maConfig.mbEmptyStringAsZero));
pModel->Insert(createBoolItem(maCaptionOpenCLEnabled,maConfig.mbOpenCLEnabled)); pModel->Insert(createBoolItem(maCaptionOpenCLEnabled,maConfig.mbOpenCLEnabled));
maLbSettings.SetUpdateMode(true); mpLbSettings->SetUpdateMode(true);
} }
void ScCalcOptionsDialog::SelectionChanged() void ScCalcOptionsDialog::SelectionChanged()
{ {
sal_uInt16 nSelectedPos = maLbSettings.GetSelectEntryPos(); sal_uInt16 nSelectedPos = mpLbSettings->GetSelectEntryPos();
switch ((CalcOptionOrder)nSelectedPos) switch ((CalcOptionOrder)nSelectedPos)
{ {
case CALC_OPTION_REF_SYNTAX: case CALC_OPTION_REF_SYNTAX:
{ {
// Formula syntax for INDIRECT function. // Formula syntax for INDIRECT function.
maBtnTrue.Hide(); mpBtnTrue->Hide();
maBtnFalse.Hide(); mpBtnFalse->Hide();
maLbOptionEdit.Show(); mpLbOptionEdit->Show();
maLbOptionEdit.Clear(); mpLbOptionEdit->Clear();
maLbOptionEdit.InsertEntry(maUseFormulaSyntax); mpLbOptionEdit->InsertEntry(maUseFormulaSyntax);
maLbOptionEdit.InsertEntry(maCalcA1); mpLbOptionEdit->InsertEntry(maCalcA1);
maLbOptionEdit.InsertEntry(maExcelA1); mpLbOptionEdit->InsertEntry(maExcelA1);
maLbOptionEdit.InsertEntry(maExcelR1C1); mpLbOptionEdit->InsertEntry(maExcelR1C1);
switch (maConfig.meStringRefAddressSyntax) switch (maConfig.meStringRefAddressSyntax)
{ {
case formula::FormulaGrammar::CONV_OOO: case formula::FormulaGrammar::CONV_OOO:
maLbOptionEdit.SelectEntryPos(1); mpLbOptionEdit->SelectEntryPos(1);
break; break;
case formula::FormulaGrammar::CONV_XL_A1: case formula::FormulaGrammar::CONV_XL_A1:
maLbOptionEdit.SelectEntryPos(2); mpLbOptionEdit->SelectEntryPos(2);
break; break;
case formula::FormulaGrammar::CONV_XL_R1C1: case formula::FormulaGrammar::CONV_XL_R1C1:
maLbOptionEdit.SelectEntryPos(3); mpLbOptionEdit->SelectEntryPos(3);
break; break;
case formula::FormulaGrammar::CONV_UNSPECIFIED: case formula::FormulaGrammar::CONV_UNSPECIFIED:
default: default:
maLbOptionEdit.SelectEntryPos(0); mpLbOptionEdit->SelectEntryPos(0);
} }
maFtAnnotation.SetText(maDescStringRefSyntax); mpFtAnnotation->SetText(maDescStringRefSyntax);
} }
break; break;
...@@ -246,9 +243,9 @@ void ScCalcOptionsDialog::SelectionChanged() ...@@ -246,9 +243,9 @@ void ScCalcOptionsDialog::SelectionChanged()
case CALC_OPTION_ENABLE_OPENCL: case CALC_OPTION_ENABLE_OPENCL:
{ {
// Treat empty string as zero. // Treat empty string as zero.
maLbOptionEdit.Hide(); mpLbOptionEdit->Hide();
maBtnTrue.Show(); mpBtnTrue->Show();
maBtnFalse.Show(); mpBtnFalse->Show();
bool bValue = false; bool bValue = false;
if ( nSelectedPos == CALC_OPTION_EMPTY_AS_ZERO ) if ( nSelectedPos == CALC_OPTION_EMPTY_AS_ZERO )
...@@ -258,15 +255,15 @@ void ScCalcOptionsDialog::SelectionChanged() ...@@ -258,15 +255,15 @@ void ScCalcOptionsDialog::SelectionChanged()
if ( bValue ) if ( bValue )
{ {
maBtnTrue.Check(true); mpBtnTrue->Check(true);
maBtnFalse.Check(false); mpBtnFalse->Check(false);
} }
else else
{ {
maBtnTrue.Check(false); mpBtnTrue->Check(false);
maBtnFalse.Check(true); mpBtnFalse->Check(true);
} }
maFtAnnotation.SetText(maDescEmptyStringAsZero); mpFtAnnotation->SetText(maDescEmptyStringAsZero);
} }
break; break;
default: default:
...@@ -276,13 +273,13 @@ void ScCalcOptionsDialog::SelectionChanged() ...@@ -276,13 +273,13 @@ void ScCalcOptionsDialog::SelectionChanged()
void ScCalcOptionsDialog::ListOptionValueChanged() void ScCalcOptionsDialog::ListOptionValueChanged()
{ {
sal_uInt16 nSelected = maLbSettings.GetSelectEntryPos(); sal_uInt16 nSelected = mpLbSettings->GetSelectEntryPos();
switch ((CalcOptionOrder) nSelected) switch ((CalcOptionOrder) nSelected)
{ {
case CALC_OPTION_REF_SYNTAX: case CALC_OPTION_REF_SYNTAX:
{ {
// Formula syntax for INDIRECT function. // Formula syntax for INDIRECT function.
sal_uInt16 nPos = maLbOptionEdit.GetSelectEntryPos(); sal_uInt16 nPos = mpLbOptionEdit->GetSelectEntryPos();
maConfig.meStringRefAddressSyntax = toAddressConvention(nPos); maConfig.meStringRefAddressSyntax = toAddressConvention(nPos);
setValueAt(nSelected, toString(maConfig.meStringRefAddressSyntax)); setValueAt(nSelected, toString(maConfig.meStringRefAddressSyntax));
...@@ -297,8 +294,8 @@ void ScCalcOptionsDialog::ListOptionValueChanged() ...@@ -297,8 +294,8 @@ void ScCalcOptionsDialog::ListOptionValueChanged()
void ScCalcOptionsDialog::RadioValueChanged() void ScCalcOptionsDialog::RadioValueChanged()
{ {
sal_uInt16 nSelected = maLbSettings.GetSelectEntryPos(); sal_uInt16 nSelected = mpLbSettings->GetSelectEntryPos();
bool bValue = maBtnTrue.IsChecked(); bool bValue = mpBtnTrue->IsChecked();
switch (nSelected) switch (nSelected)
{ {
case CALC_OPTION_REF_SYNTAX: case CALC_OPTION_REF_SYNTAX:
...@@ -338,9 +335,9 @@ OUString ScCalcOptionsDialog::toString(bool bVal) const ...@@ -338,9 +335,9 @@ OUString ScCalcOptionsDialog::toString(bool bVal) const
IMPL_LINK(ScCalcOptionsDialog, SettingsSelHdl, Control*, pCtrl) IMPL_LINK(ScCalcOptionsDialog, SettingsSelHdl, Control*, pCtrl)
{ {
if (pCtrl == &maLbSettings) if (pCtrl == mpLbSettings)
SelectionChanged(); SelectionChanged();
else if (pCtrl == &maLbOptionEdit) else if (pCtrl == mpLbOptionEdit)
ListOptionValueChanged(); ListOptionValueChanged();
return 0; return 0;
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
*/
#include "sc.hrc"
#define BTN_OK 1
#define BTN_CANCEL 2
#define LB_SETTINGS 3
#define FT_OPTION_EDIT_CAPTION 4
#define LB_OPTION_EDIT 5
#define BTN_OPTION_TRUE 6
#define BTN_OPTION_FALSE 7
#define FL_ANNOTATION 20
#define FT_ANNOTATION 21
#define STR_STRING_REF_SYNTAX_CAPTION 22
#define STR_STRING_REF_SYNTAX_DESC 23
#define STR_USE_FORMULA_SYNTAX 24
#define STR_TRUE 25
#define STR_FALSE 26
#define STR_EMPTY_STRING_AS_ZERO_CAPTION 27
#define STR_EMPTY_STRING_AS_ZERO_DESC 28
#define STR_OPENCL_ENABLED 29
#define STR_OPENCL_ENABLED_DESC 30
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -43,18 +43,13 @@ private: ...@@ -43,18 +43,13 @@ private:
void setValueAt(size_t nPos, const OUString &rString); void setValueAt(size_t nPos, const OUString &rString);
private: private:
SvxCheckListBox maLbSettings; SvxCheckListBox* mpLbSettings;
FixedText maFtOptionEditCaption; ListBox* mpLbOptionEdit;
ListBox maLbOptionEdit; RadioButton* mpBtnTrue;
RadioButton maBtnTrue; RadioButton* mpBtnFalse;
RadioButton maBtnFalse;
FixedLine maFlAnnotation; FixedText* mpFtAnnotation;
FixedText maFtAnnotation;
OKButton maBtnOK;
CancelButton maBtnCancel;
OUString maTrue; OUString maTrue;
OUString maFalse; OUString maFalse;
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
*/
#include "calcoptionsdlg.hrc"
ModalDialog RID_SCDLG_FORMULA_CALCOPTIONS
{
OutputSize = TRUE ;
Hide = TRUE ;
SVLook = TRUE ;
Size = MAP_APPFONT ( 230, 200 ) ;
Text [ en-US ] = "Detailed Calculation Settings" ;
Control LB_SETTINGS
{
Border = TRUE ;
Pos = MAP_APPFONT ( 6 , 10 ) ;
Size = MAP_APPFONT ( 218 , 70 ) ;
TabStop = TRUE ;
};
FixedText FT_OPTION_EDIT_CAPTION
{
Pos = MAP_APPFONT ( 8 , 84 ) ;
Size = MAP_APPFONT ( 40 , 14 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Value";
};
ListBox LB_OPTION_EDIT
{
Pos = MAP_APPFONT ( 50, 82 ) ;
Size = MAP_APPFONT ( 100, 46 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
RadioButton BTN_OPTION_TRUE
{
Pos = MAP_APPFONT ( 50, 83 ) ;
Size = MAP_APPFONT ( 50, 14 ) ;
TabStop = TRUE ;
};
RadioButton BTN_OPTION_FALSE
{
Pos = MAP_APPFONT ( 110, 83 ) ;
Size = MAP_APPFONT ( 50, 14 ) ;
TabStop = TRUE ;
};
FixedLine FL_ANNOTATION
{
Pos = MAP_APPFONT ( 6 , 98 ) ;
Size = MAP_APPFONT ( 218 , 8 ) ;
TabStop = TRUE ;
};
FixedText FT_ANNOTATION
{
Pos = MAP_APPFONT ( 8 , 108 ) ;
Size = MAP_APPFONT ( 214 , 70 ) ;
WordBreak = TRUE ;
NoLabel = TRUE ;
};
OKButton BTN_OK
{
Pos = MAP_APPFONT ( 118 , 180 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
CancelButton BTN_CANCEL
{
Pos = MAP_APPFONT ( 174 , 180 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
String STR_STRING_REF_SYNTAX_CAPTION
{
Text [ en-US ] = "Reference syntax for string reference";
};
String STR_STRING_REF_SYNTAX_DESC
{
Text [ en-US ] = "Formula syntax to use when parsing references given in string parameters. This affects built-in functions such as INDIRECT that takes a reference as a string value.";
};
String STR_USE_FORMULA_SYNTAX
{
Text [ en-US ] = "Use formula syntax";
};
String STR_EMPTY_STRING_AS_ZERO_CAPTION
{
Text [ en-US ] = "Treat empty string as zero";
};
String STR_EMPTY_STRING_AS_ZERO_DESC
{
Text [ en-US ] = "This option determines whether or not an empty string is to be treated as having a value of zero when used in arithmetic.";
};
String STR_TRUE
{
Text [ en-US ] = "True";
};
String STR_FALSE
{
Text [ en-US ] = "False";
};
String STR_OPENCL_ENABLED
{
Text [ en-US ] = "Enable OpenCL for some formula computation";
};
String STR_OPENCL_ENABLED_DESC
{
Text [ en-US ] = "This option enables some sorts of simple formula expressions to be executed using OpenCL if it is available on your system.";
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
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