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,\
sc/source/ui/cctrl/checklistmenu.src \
sc/source/ui/navipi/navipi.src \
sc/source/ui/docshell/tpstat.src \
sc/source/ui/optdlg/calcoptionsdlg.src \
sc/source/ui/pagedlg/pagedlg.src \
sc/source/ui/styleui/scstyles.src \
sc/source/ui/styleui/styledlg.src \
......
......@@ -69,6 +69,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/externaldata \
sc/uiconfig/scalc/ui/footerdialog \
sc/uiconfig/scalc/ui/formatcellsdialog \
sc/uiconfig/scalc/ui/formulacalculationoptions \
sc/uiconfig/scalc/ui/goalseekdlg \
sc/uiconfig/scalc/ui/groupdialog \
sc/uiconfig/scalc/ui/headerdialog \
......
......@@ -1099,7 +1099,7 @@
#define RID_SCDLG_TAB_BG_COLOR (SC_DIALOGS_START + 154)
#define RID_SCDLG_DATABAR (SC_DIALOGS_START + 155)
#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_SCDLG_COND_FORMAT_MANAGER (SC_DIALOGS_START + 159)
......
......@@ -11,7 +11,7 @@
*/
#include "calcoptionsdlg.hxx"
#include "calcoptionsdlg.hrc"
#include "sc.hrc"
#include "scresid.hxx"
#include "svtools/svlbitm.hxx"
......@@ -101,46 +101,43 @@ formula::FormulaGrammar::AddressConvention toAddressConvention(sal_uInt16 nPos)
}
ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rConfig) :
ModalDialog(pParent, ScResId(RID_SCDLG_FORMULA_CALCOPTIONS)),
maLbSettings(this, ScResId(LB_SETTINGS)),
maFtOptionEditCaption(this, ScResId(FT_OPTION_EDIT_CAPTION)),
maLbOptionEdit(this, ScResId(LB_OPTION_EDIT)),
maBtnTrue(this, ScResId(BTN_OPTION_TRUE)),
maBtnFalse(this, ScResId(BTN_OPTION_FALSE)),
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)
ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rConfig)
: ModalDialog(pParent, "FormulaCalculationOptions",
"modules/scalc/ui/formulacalculationoptions.ui")
, maCalcA1(ScResId(SCSTR_FORMULA_SYNTAX_CALC_A1).toString())
, maExcelA1(ScResId(SCSTR_FORMULA_SYNTAX_XL_A1).toString())
, maExcelR1C1(ScResId(SCSTR_FORMULA_SYNTAX_XL_R1C1).toString())
, maConfig(rConfig)
{
maLbSettings.SetStyle(maLbSettings.GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
maLbSettings.SetHighlightRange();
get(mpLbSettings, "settings");
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);
maLbSettings.SetSelectHdl(aLink);
maLbOptionEdit.SetSelectHdl(aLink);
mpLbSettings->SetSelectHdl(aLink);
mpLbOptionEdit->SetSelectHdl(aLink);
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);
maBtnFalse.SetText(maFalse);
maTrue = mpBtnTrue->GetText();
maFalse = mpBtnFalse->GetText();
FillOptionsList();
FreeResource();
SelectionChanged();
}
......@@ -163,7 +160,7 @@ SvTreeListEntry *ScCalcOptionsDialog::createBoolItem(const OUString &rCaption, b
void ScCalcOptionsDialog::setValueAt(size_t nPos, const OUString &rValue)
{
SvTreeList *pModel = maLbSettings.GetModel();
SvTreeList *pModel = mpLbSettings->GetModel();
SvTreeListEntry* pEntry = pModel->GetEntry(NULL, nPos);
if (!pEntry)
{
......@@ -183,10 +180,10 @@ void ScCalcOptionsDialog::setValueAt(size_t nPos, const OUString &rValue)
void ScCalcOptionsDialog::FillOptionsList()
{
maLbSettings.SetUpdateMode(false);
maLbSettings.Clear();
mpLbSettings->SetUpdateMode(false);
mpLbSettings->Clear();
SvTreeList* pModel = maLbSettings.GetModel();
SvTreeList* pModel = mpLbSettings->GetModel();
{
// Syntax for INDIRECT function.
......@@ -202,42 +199,42 @@ void ScCalcOptionsDialog::FillOptionsList()
pModel->Insert(createBoolItem(maCaptionEmptyStringAsZero,maConfig.mbEmptyStringAsZero));
pModel->Insert(createBoolItem(maCaptionOpenCLEnabled,maConfig.mbOpenCLEnabled));
maLbSettings.SetUpdateMode(true);
mpLbSettings->SetUpdateMode(true);
}
void ScCalcOptionsDialog::SelectionChanged()
{
sal_uInt16 nSelectedPos = maLbSettings.GetSelectEntryPos();
sal_uInt16 nSelectedPos = mpLbSettings->GetSelectEntryPos();
switch ((CalcOptionOrder)nSelectedPos)
{
case CALC_OPTION_REF_SYNTAX:
{
// Formula syntax for INDIRECT function.
maBtnTrue.Hide();
maBtnFalse.Hide();
maLbOptionEdit.Show();
maLbOptionEdit.Clear();
maLbOptionEdit.InsertEntry(maUseFormulaSyntax);
maLbOptionEdit.InsertEntry(maCalcA1);
maLbOptionEdit.InsertEntry(maExcelA1);
maLbOptionEdit.InsertEntry(maExcelR1C1);
mpBtnTrue->Hide();
mpBtnFalse->Hide();
mpLbOptionEdit->Show();
mpLbOptionEdit->Clear();
mpLbOptionEdit->InsertEntry(maUseFormulaSyntax);
mpLbOptionEdit->InsertEntry(maCalcA1);
mpLbOptionEdit->InsertEntry(maExcelA1);
mpLbOptionEdit->InsertEntry(maExcelR1C1);
switch (maConfig.meStringRefAddressSyntax)
{
case formula::FormulaGrammar::CONV_OOO:
maLbOptionEdit.SelectEntryPos(1);
mpLbOptionEdit->SelectEntryPos(1);
break;
case formula::FormulaGrammar::CONV_XL_A1:
maLbOptionEdit.SelectEntryPos(2);
mpLbOptionEdit->SelectEntryPos(2);
break;
case formula::FormulaGrammar::CONV_XL_R1C1:
maLbOptionEdit.SelectEntryPos(3);
mpLbOptionEdit->SelectEntryPos(3);
break;
case formula::FormulaGrammar::CONV_UNSPECIFIED:
default:
maLbOptionEdit.SelectEntryPos(0);
mpLbOptionEdit->SelectEntryPos(0);
}
maFtAnnotation.SetText(maDescStringRefSyntax);
mpFtAnnotation->SetText(maDescStringRefSyntax);
}
break;
......@@ -246,9 +243,9 @@ void ScCalcOptionsDialog::SelectionChanged()
case CALC_OPTION_ENABLE_OPENCL:
{
// Treat empty string as zero.
maLbOptionEdit.Hide();
maBtnTrue.Show();
maBtnFalse.Show();
mpLbOptionEdit->Hide();
mpBtnTrue->Show();
mpBtnFalse->Show();
bool bValue = false;
if ( nSelectedPos == CALC_OPTION_EMPTY_AS_ZERO )
......@@ -258,15 +255,15 @@ void ScCalcOptionsDialog::SelectionChanged()
if ( bValue )
{
maBtnTrue.Check(true);
maBtnFalse.Check(false);
mpBtnTrue->Check(true);
mpBtnFalse->Check(false);
}
else
{
maBtnTrue.Check(false);
maBtnFalse.Check(true);
mpBtnTrue->Check(false);
mpBtnFalse->Check(true);
}
maFtAnnotation.SetText(maDescEmptyStringAsZero);
mpFtAnnotation->SetText(maDescEmptyStringAsZero);
}
break;
default:
......@@ -276,13 +273,13 @@ void ScCalcOptionsDialog::SelectionChanged()
void ScCalcOptionsDialog::ListOptionValueChanged()
{
sal_uInt16 nSelected = maLbSettings.GetSelectEntryPos();
sal_uInt16 nSelected = mpLbSettings->GetSelectEntryPos();
switch ((CalcOptionOrder) nSelected)
{
case CALC_OPTION_REF_SYNTAX:
{
// Formula syntax for INDIRECT function.
sal_uInt16 nPos = maLbOptionEdit.GetSelectEntryPos();
sal_uInt16 nPos = mpLbOptionEdit->GetSelectEntryPos();
maConfig.meStringRefAddressSyntax = toAddressConvention(nPos);
setValueAt(nSelected, toString(maConfig.meStringRefAddressSyntax));
......@@ -297,8 +294,8 @@ void ScCalcOptionsDialog::ListOptionValueChanged()
void ScCalcOptionsDialog::RadioValueChanged()
{
sal_uInt16 nSelected = maLbSettings.GetSelectEntryPos();
bool bValue = maBtnTrue.IsChecked();
sal_uInt16 nSelected = mpLbSettings->GetSelectEntryPos();
bool bValue = mpBtnTrue->IsChecked();
switch (nSelected)
{
case CALC_OPTION_REF_SYNTAX:
......@@ -338,9 +335,9 @@ OUString ScCalcOptionsDialog::toString(bool bVal) const
IMPL_LINK(ScCalcOptionsDialog, SettingsSelHdl, Control*, pCtrl)
{
if (pCtrl == &maLbSettings)
if (pCtrl == mpLbSettings)
SelectionChanged();
else if (pCtrl == &maLbOptionEdit)
else if (pCtrl == mpLbOptionEdit)
ListOptionValueChanged();
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:
void setValueAt(size_t nPos, const OUString &rString);
private:
SvxCheckListBox maLbSettings;
SvxCheckListBox* mpLbSettings;
FixedText maFtOptionEditCaption;
ListBox maLbOptionEdit;
RadioButton maBtnTrue;
RadioButton maBtnFalse;
ListBox* mpLbOptionEdit;
RadioButton* mpBtnTrue;
RadioButton* mpBtnFalse;
FixedLine maFlAnnotation;
FixedText maFtAnnotation;
OKButton maBtnOK;
CancelButton maBtnCancel;
FixedText* mpFtAnnotation;
OUString maTrue;
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