[Libreoffice-commits] core.git: 2 commits - sc/AllLangResTarget_sc.mk sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk

Caolán McNamara caolanm at redhat.com
Wed Jun 26 05:55:56 PDT 2013


 sc/AllLangResTarget_sc.mk                         |    1 
 sc/UIConfig_scalc.mk                              |    1 
 sc/inc/sc.hrc                                     |    2 
 sc/source/ui/optdlg/calcoptionsdlg.cxx            |  163 ++++++-----
 sc/source/ui/optdlg/calcoptionsdlg.hrc            |   42 --
 sc/source/ui/optdlg/calcoptionsdlg.hxx            |   15 -
 sc/source/ui/optdlg/calcoptionsdlg.src            |  137 ---------
 sc/uiconfig/scalc/ui/formulacalculationoptions.ui |  313 ++++++++++++++++++++++
 8 files changed, 413 insertions(+), 261 deletions(-)

New commits:
commit d82e1f1a1decb690926207d9fafdaebfe134ded3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 26 13:18:51 2013 +0100

    convert calculation settings dialog to .ui format
    
    Change-Id: I0031094be63f2d8efeac42d5ca560f57af5326b6

diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk
index 9f98d4c..2736ac7 100644
--- a/sc/AllLangResTarget_sc.mk
+++ b/sc/AllLangResTarget_sc.mk
@@ -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 \
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 4a1797c..5e4b9e9 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -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 \
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index a5d6973..e0bbdca 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -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)
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 69eecd9..86d718a 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -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;
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hrc b/sc/source/ui/optdlg/calcoptionsdlg.hrc
deleted file mode 100644
index be1dbbe..0000000
--- a/sc/source/ui/optdlg/calcoptionsdlg.hrc
+++ /dev/null
@@ -1,42 +0,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: */
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx
index ea93fcb..6c91e52 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.hxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx
@@ -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;
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.src b/sc/source/ui/optdlg/calcoptionsdlg.src
deleted file mode 100644
index f86a2ac..0000000
--- a/sc/source/ui/optdlg/calcoptionsdlg.src
+++ /dev/null
@@ -1,137 +0,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 "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: */
diff --git a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
new file mode 100644
index 0000000..0f00fa3
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
@@ -0,0 +1,313 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.6 -->
+  <object class="GtkDialog" id="FormulaCalculationOptions">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Detailed Calculation Settings</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="grid1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="row_spacing">12</property>
+            <child>
+              <object class="svxcorelo-SvxCheckListBox" id="settings:border">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="column_spacing">12</property>
+                <child>
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">_Value:</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkGrid" id="grid4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="column_homogeneous">True</property>
+                    <child>
+                      <object class="GtkRadioButton" id="true">
+                        <property name="label" translatable="yes">True</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">false</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="false">
+                        <property name="label" translatable="yes">False</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">true</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBoxText" id="edit">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="halign">start</property>
+                        <property name="entry_text_column">0</property>
+                        <property name="id_column">1</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="annotation">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="yalign">0</property>
+                <property name="wrap">True</property>
+                <property name="max_width_chars">56</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="ref_syntax_caption">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">Reference syntax for string reference</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="ref_syntax_desc">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">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.</property>
+                <property name="wrap">True</property>
+                <property name="max_width_chars">56</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">4</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="use_formula_syntax">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">Use formula syntax</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">5</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="empty_str_as_zero_caption">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">Treat empty string as zero</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">6</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="empty_str_as_zero_desc">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">This option determines whether or not an empty string is to be treated as having a value of zero when used in arithmetic.</property>
+                <property name="wrap">True</property>
+                <property name="max_width_chars">56</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">7</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="opencl_enabled">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">Enable OpenCL for some formula computation</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">8</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="opencl_enabled_desc">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">This option enables some sorts of simple formula expressions to be executed using OpenCL if it is available on your system.</property>
+                <property name="wrap">True</property>
+                <property name="max_width_chars">56</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">9</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkSizeGroup" id="sizegroup1">
+    <property name="mode">both</property>
+    <widgets>
+      <widget name="annotation"/>
+      <widget name="ref_syntax_desc"/>
+      <widget name="empty_str_as_zero_desc"/>
+      <widget name="opencl_enabled_desc"/>
+    </widgets>
+  </object>
+  <object class="GtkSizeGroup" id="sizegroup2">
+    <property name="mode">vertical</property>
+    <widgets>
+      <widget name="true"/>
+      <widget name="false"/>
+      <widget name="edit"/>
+    </widgets>
+  </object>
+</interface>
commit 8ece576c35094b9277a7536f0f6d23526341194e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 26 13:42:21 2013 +0100

    fix OptionString to set a correct item size
    
    Change-Id: I3406b5481991e459ac051868e441c0c04a2f7d5a

diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 88eb78e..69eecd9 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -36,8 +36,32 @@ public:
     void SetValue(const OUString &rValue) { maValue = rValue; }
 
     virtual void Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry);
+
+    virtual void InitViewData(SvTreeListBox* pView, SvTreeListEntry* pEntry, SvViewDataItem* pViewData);
 };
 
+void OptionString::InitViewData(
+    SvTreeListBox* pView, SvTreeListEntry* pEntry, SvViewDataItem* pViewData)
+{
+    if( !pViewData )
+        pViewData = pView->GetViewDataItem( pEntry, this );
+
+    OUString aDesc = maDesc + OUString(": ");
+    Size aDescSize(pView->GetTextWidth(aDesc), pView->GetTextHeight());
+
+    Font aOldFont = pView->GetFont();
+    Font aFont = aOldFont;
+    aFont.SetWeight(WEIGHT_BOLD);
+    //To not make the SvTreeListBox try and recalculate all rows, call the
+    //underlying SetFont, we just want to know what size this text will be
+    //and are going to reset the font to the original again afterwards
+    pView->Control::SetFont(aFont);
+    Size aValueSize(pView->GetTextWidth(maValue), pView->GetTextHeight());
+    pView->Control::SetFont(aOldFont);
+
+    pViewData->maSize = Size(aDescSize.Width() + aValueSize.Width(), std::max(aDescSize.Height(), aValueSize.Height()));
+}
+
 void OptionString::Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/)
 {
     Point aPos = rPos;
@@ -49,10 +73,12 @@ void OptionString::Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDat
     Font aFont = aOldFont;
     aFont.SetWeight(WEIGHT_BOLD);
 
-    rDev.SetFont(aFont);
+    //To not make the SvTreeListBox try and recalculate all rows, call the
+    //underlying SetFont, we are going to draw this string and then going to
+    //reset the font to the original again afterwards
+    rDev.Control::SetFont(aFont);
     rDev.DrawText(aPos, maValue);
-
-    rDev.SetFont(aOldFont);
+    rDev.Control::SetFont(aOldFont);
 }
 
 formula::FormulaGrammar::AddressConvention toAddressConvention(sal_uInt16 nPos)


More information about the Libreoffice-commits mailing list