[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sc/uiconfig
Caolán McNamara
caolanm at redhat.com
Sun May 20 19:14:40 UTC 2018
sc/inc/scabstdlg.hxx | 2
sc/source/ui/attrdlg/scdlgfact.cxx | 13 +-
sc/source/ui/attrdlg/scdlgfact.hxx | 13 +-
sc/source/ui/dbgui/pvfundlg.cxx | 37 ++----
sc/source/ui/inc/pvfundlg.hxx | 20 +--
sc/source/ui/optdlg/calcoptionsdlg.cxx | 67 ++++-------
sc/source/ui/optdlg/calcoptionsdlg.hxx | 38 ++----
sc/source/ui/optdlg/tpformula.cxx | 9 -
sc/source/ui/view/cellsh1.cxx | 7 -
sc/uiconfig/scalc/ui/formulacalculationoptions.ui | 130 +++++++++++-----------
sc/uiconfig/scalc/ui/showdetaildialog.ui | 51 +++++++-
11 files changed, 200 insertions(+), 187 deletions(-)
New commits:
commit 56c9746f294639583ce5422bf909ad9e4a746f70
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat May 19 20:44:59 2018 +0100
weld ScCalcOptionsDialog
Change-Id: I391e26bd95cb3dc6cfa983502aa960a5c54cc800
Reviewed-on: https://gerrit.libreoffice.org/54580
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 74e7904249d7..e931a180e8bc 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -72,43 +72,32 @@ sal_Int32 toSelectedItem( formula::FormulaGrammar::AddressConvention eConv )
}
-ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfig& rConfig, bool bWriteConfig)
- : ModalDialog(pParent, "FormulaCalculationOptions",
- "modules/scalc/ui/formulacalculationoptions.ui")
+ScCalcOptionsDialog::ScCalcOptionsDialog(weld::Window* pParent, const ScCalcConfig& rConfig, bool bWriteConfig)
+ : GenericDialogController(pParent, "modules/scalc/ui/formulacalculationoptions.ui", "FormulaCalculationOptions")
, maConfig(rConfig)
, mbSelectedEmptyStringAsZero(rConfig.mbEmptyStringAsZero)
, mbWriteConfig(bWriteConfig)
+ , mxEmptyAsZero(m_xBuilder->weld_check_button("checkEmptyAsZero"))
+ , mxConversion(m_xBuilder->weld_combo_box_text("comboConversion"))
+ , mxCurrentDocOnly(m_xBuilder->weld_check_button("current_doc"))
+ , mxSyntax(m_xBuilder->weld_combo_box_text("comboSyntaxRef"))
{
- get(mpConversion,"comboConversion");
- mpConversion->SelectEntryPos(static_cast<sal_Int32>(rConfig.meStringConversion));
- mpConversion->SetSelectHdl(LINK(this, ScCalcOptionsDialog, ConversionModifiedHdl));
+ mxConversion->set_active(static_cast<int>(rConfig.meStringConversion));
+ mxConversion->connect_changed(LINK(this, ScCalcOptionsDialog, ConversionModifiedHdl));
- get(mpEmptyAsZero,"checkEmptyAsZero");
- mpEmptyAsZero->Check(rConfig.mbEmptyStringAsZero);
- mpEmptyAsZero->SetClickHdl(LINK(this, ScCalcOptionsDialog, AsZeroModifiedHdl));
+ mxEmptyAsZero->set_active(rConfig.mbEmptyStringAsZero);
+ mxEmptyAsZero->connect_toggled(LINK(this, ScCalcOptionsDialog, AsZeroModifiedHdl));
CoupleEmptyAsZeroToStringConversion();
- get(mpSyntax,"comboSyntaxRef");
- mpSyntax->SelectEntryPos( toSelectedItem(rConfig.meStringRefAddressSyntax) );
- mpSyntax->SetSelectHdl(LINK(this, ScCalcOptionsDialog, SyntaxModifiedHdl));
+ mxSyntax->set_active(toSelectedItem(rConfig.meStringRefAddressSyntax));
+ mxSyntax->connect_changed(LINK(this, ScCalcOptionsDialog, SyntaxModifiedHdl));
- get(mpCurrentDocOnly,"current_doc");
- mpCurrentDocOnly->Check(!mbWriteConfig);
- mpCurrentDocOnly->SetClickHdl(LINK(this, ScCalcOptionsDialog, CurrentDocOnlyHdl));
+ mxCurrentDocOnly->set_active(!mbWriteConfig);
+ mxCurrentDocOnly->connect_toggled(LINK(this, ScCalcOptionsDialog, CurrentDocOnlyHdl));
}
ScCalcOptionsDialog::~ScCalcOptionsDialog()
{
- disposeOnce();
-}
-
-void ScCalcOptionsDialog::dispose()
-{
- mpEmptyAsZero.clear();
- mpConversion.clear();
- mpSyntax.clear();
- mpCurrentDocOnly.clear();
- ModalDialog::dispose();
}
void ScCalcOptionsDialog::CoupleEmptyAsZeroToStringConversion()
@@ -117,43 +106,43 @@ void ScCalcOptionsDialog::CoupleEmptyAsZeroToStringConversion()
{
case ScCalcConfig::StringConversion::ILLEGAL:
maConfig.mbEmptyStringAsZero = false;
- mpEmptyAsZero->Check(false);
- mpEmptyAsZero->Enable(false);
+ mxEmptyAsZero->set_active(false);
+ mxEmptyAsZero->set_sensitive(false);
break;
case ScCalcConfig::StringConversion::ZERO:
maConfig.mbEmptyStringAsZero = true;
- mpEmptyAsZero->Check();
- mpEmptyAsZero->Enable(false);
+ mxEmptyAsZero->set_active(true);
+ mxEmptyAsZero->set_sensitive(false);
break;
case ScCalcConfig::StringConversion::UNAMBIGUOUS:
case ScCalcConfig::StringConversion::LOCALE:
// Reset to the value the user selected before.
maConfig.mbEmptyStringAsZero = mbSelectedEmptyStringAsZero;
- mpEmptyAsZero->Enable();
- mpEmptyAsZero->Check( mbSelectedEmptyStringAsZero);
+ mxEmptyAsZero->set_sensitive(true);
+ mxEmptyAsZero->set_active(mbSelectedEmptyStringAsZero);
break;
}
}
-IMPL_LINK(ScCalcOptionsDialog, AsZeroModifiedHdl, Button*, pCheckBox, void )
+IMPL_LINK(ScCalcOptionsDialog, AsZeroModifiedHdl, weld::ToggleButton&, rCheckBox, void )
{
- maConfig.mbEmptyStringAsZero = mbSelectedEmptyStringAsZero = static_cast<CheckBox*>(pCheckBox)->IsChecked();
+ maConfig.mbEmptyStringAsZero = mbSelectedEmptyStringAsZero = rCheckBox.get_active();
}
-IMPL_LINK(ScCalcOptionsDialog, ConversionModifiedHdl, ListBox&, rConv, void )
+IMPL_LINK(ScCalcOptionsDialog, ConversionModifiedHdl, weld::ComboBoxText&, rConv, void)
{
- maConfig.meStringConversion = static_cast<ScCalcConfig::StringConversion>(rConv.GetSelectedEntryPos());
+ maConfig.meStringConversion = static_cast<ScCalcConfig::StringConversion>(rConv.get_active());
CoupleEmptyAsZeroToStringConversion();
}
-IMPL_LINK(ScCalcOptionsDialog, SyntaxModifiedHdl, ListBox&, rSyntax, void)
+IMPL_LINK(ScCalcOptionsDialog, SyntaxModifiedHdl, weld::ComboBoxText&, rSyntax, void)
{
- maConfig.SetStringRefSyntax(toAddressConvention(rSyntax.GetSelectedEntryPos()));
+ maConfig.SetStringRefSyntax(toAddressConvention(rSyntax.get_active()));
}
-IMPL_LINK(ScCalcOptionsDialog, CurrentDocOnlyHdl, Button*, pCheckBox, void)
+IMPL_LINK(ScCalcOptionsDialog, CurrentDocOnlyHdl, weld::ToggleButton&, rCheckBox, void)
{
- mbWriteConfig = !(static_cast<CheckBox*>(pCheckBox)->IsChecked());
+ mbWriteConfig = !rCheckBox.get_active();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx
index 5d62570678cb..899f04305c9c 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.hxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx
@@ -11,19 +11,7 @@
#define INCLUDED_SC_SOURCE_UI_OPTDLG_CALCOPTIONSDLG_HXX
#include <config_features.h>
-
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/field.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/layout.hxx>
-#include <vcl/lstbox.hxx>
-
-#include <svx/checklbx.hxx>
-
-#include <svtools/treelistbox.hxx>
-
+#include <vcl/weld.hxx>
#include <calcconfig.hxx>
#if HAVE_FEATURE_OPENCL
@@ -31,17 +19,16 @@
#include <opencl/platforminfo.hxx>
#endif
-class ScCalcOptionsDialog : public ModalDialog
+class ScCalcOptionsDialog : public weld::GenericDialogController
{
public:
- ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfig& rConfig, bool bWriteConfig);
+ ScCalcOptionsDialog(weld::Window* pParent, const ScCalcConfig& rConfig, bool bWriteConfig);
virtual ~ScCalcOptionsDialog() override;
- virtual void dispose() override;
- DECL_LINK( AsZeroModifiedHdl, Button*, void);
- DECL_LINK( ConversionModifiedHdl, ListBox&, void);
- DECL_LINK( SyntaxModifiedHdl, ListBox&, void);
- DECL_LINK( CurrentDocOnlyHdl, Button*, void);
+ DECL_LINK(AsZeroModifiedHdl, weld::ToggleButton&, void);
+ DECL_LINK(ConversionModifiedHdl, weld::ComboBoxText&, void);
+ DECL_LINK(SyntaxModifiedHdl, weld::ComboBoxText&, void);
+ DECL_LINK(CurrentDocOnlyHdl, weld::ToggleButton&, void);
const ScCalcConfig& GetConfig() const { return maConfig;}
bool GetWriteCalcConfig() const { return mbWriteConfig;}
@@ -50,15 +37,14 @@ private:
void CoupleEmptyAsZeroToStringConversion();
private:
- VclPtr<CheckBox> mpEmptyAsZero;
- VclPtr<ListBox> mpConversion;
- VclPtr<ListBox> mpSyntax;
- VclPtr<CheckBox> mpCurrentDocOnly;
-
ScCalcConfig maConfig;
-
bool mbSelectedEmptyStringAsZero;
bool mbWriteConfig;
+
+ std::unique_ptr<weld::CheckButton> mxEmptyAsZero;
+ std::unique_ptr<weld::ComboBoxText> mxConversion;
+ std::unique_ptr<weld::CheckButton> mxCurrentDocOnly;
+ std::unique_ptr<weld::ComboBoxText> mxSyntax;
};
#endif
diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx
index 75b3482fefde..09797b051071 100644
--- a/sc/source/ui/optdlg/tpformula.cxx
+++ b/sc/source/ui/optdlg/tpformula.cxx
@@ -138,12 +138,11 @@ void ScTpFormulaOptions::UpdateCustomCalcRadioButtons(bool bDefault)
void ScTpFormulaOptions::LaunchCustomCalcSettings()
{
- ScopedVclPtrInstance< ScCalcOptionsDialog > aDlg(this, maCurrentConfig,
- maCurrentDocOptions.IsWriteCalcConfig());
- if (aDlg->Execute() == RET_OK)
+ ScCalcOptionsDialog aDlg(GetFrameWeld(), maCurrentConfig, maCurrentDocOptions.IsWriteCalcConfig());
+ if (aDlg.run() == RET_OK)
{
- maCurrentConfig = aDlg->GetConfig();
- maCurrentDocOptions.SetWriteCalcConfig( aDlg->GetWriteCalcConfig());
+ maCurrentConfig = aDlg.GetConfig();
+ maCurrentDocOptions.SetWriteCalcConfig(aDlg.GetWriteCalcConfig());
}
}
diff --git a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
index fe751a985bfc..e637ca6af42e 100644
--- a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
+++ b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
@@ -1,25 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.4 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
- <object class="GtkAdjustment" id="adjustment1">
- <property name="lower">2</property>
- <property name="value">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">100</property>
- </object>
<object class="GtkDialog" id="FormulaCalculationOptions">
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="formulacalculationoptions|FormulaCalculationOptions">Detailed Calculation Settings</property>
+ <property name="modal">True</property>
+ <property name="default_width">0</property>
+ <property name="default_height">0</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="help">
+ <property name="label">gtk-help</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">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ <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">1</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">2</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="GtkFrame" id="frame1">
<property name="visible">True</property>
@@ -42,8 +96,8 @@
<object class="GtkLabel" id="labelConvT2N">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="formulacalculationoptions|labelConvT2N">Conversion from text to number:</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -147,69 +201,15 @@
<property name="position">0</property>
</packing>
</child>
- <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="help">
- <property name="label">gtk-help</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">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- <property name="secondary">True</property>
- </packing>
- </child>
- <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">1</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">2</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>
</object>
</child>
<action-widgets>
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
<object class="GtkSizeGroup" id="sizegroup1">
<widgets>
commit 215d1ceaa086e72bb0c7251e97b199a77ef917e1
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat May 19 20:15:17 2018 +0100
weld ScDPShowDetailDlg
Change-Id: Ifbb93a71ac891f4a5621edcd1c3f004a278a088d
Reviewed-on: https://gerrit.libreoffice.org/54577
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 392e4d60fa2d..7032ab97c8c7 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -492,7 +492,7 @@ public:
sal_Int32 nDatePart,
const Date& rNullDate ) = 0;
- virtual VclPtr<AbstractScDPShowDetailDlg> CreateScDPShowDetailDlg( vcl::Window* pParent,
+ virtual VclPtr<AbstractScDPShowDetailDlg> CreateScDPShowDetailDlg(weld::Window* pParent,
ScDPObject& rDPObj,
css::sheet::DataPilotFieldOrientation nOrient ) = 0;
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index a84d7dc9b5dd..dfedd10a54a2 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -160,7 +160,12 @@ IMPL_ABSTDLG_BASE(AbstractScDPFunctionDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScDPSubtotalDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScDPNumGroupDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScDPDateGroupDlg_Impl);
-IMPL_ABSTDLG_BASE(AbstractScDPShowDetailDlg_Impl);
+
+short AbstractScDPShowDetailDlg_Impl::Execute()
+{
+ return m_xDlg->execute();
+}
+
IMPL_ABSTDLG_BASE(AbstractScNewScenarioDlg_Impl);
short AbstractScShowTabDlg_Impl::Execute()
@@ -602,7 +607,7 @@ sal_Int32 AbstractScDPDateGroupDlg_Impl::GetDatePart() const
OUString AbstractScDPShowDetailDlg_Impl::GetDimensionName() const
{
- return pDlg->GetDimensionName();
+ return m_xDlg->GetDimensionName();
}
void AbstractScNewScenarioDlg_Impl::SetScenarioData(
@@ -867,9 +872,9 @@ VclPtr<AbstractScDPDateGroupDlg> ScAbstractDialogFactory_Impl::CreateScDPDateGro
}
VclPtr<AbstractScDPShowDetailDlg> ScAbstractDialogFactory_Impl::CreateScDPShowDetailDlg (
- vcl::Window* pParent, ScDPObject& rDPObj, css::sheet::DataPilotFieldOrientation nOrient )
+ weld::Window* pParent, ScDPObject& rDPObj, css::sheet::DataPilotFieldOrientation nOrient )
{
- return VclPtr<AbstractScDPShowDetailDlg_Impl>::Create( VclPtr<ScDPShowDetailDlg>::Create( pParent, rDPObj, nOrient ) );
+ return VclPtr<AbstractScDPShowDetailDlg_Impl>::Create(new ScDPShowDetailDlg(pParent, rDPObj, nOrient));
}
VclPtr<AbstractScNewScenarioDlg> ScAbstractDialogFactory_Impl::CreateScNewScenarioDlg(vcl::Window* pParent, const OUString& rName,
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 27e6513b2904..a27a52ab26d7 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -407,7 +407,14 @@ class AbstractScDPDateGroupDlg_Impl : public AbstractScDPDateGroupDlg
class AbstractScDPShowDetailDlg_Impl : public AbstractScDPShowDetailDlg
{
- DECL_ABSTDLG_BASE( AbstractScDPShowDetailDlg_Impl, ScDPShowDetailDlg)
+protected:
+ std::shared_ptr<ScDPShowDetailDlg> m_xDlg;
+public:
+ explicit AbstractScDPShowDetailDlg_Impl(ScDPShowDetailDlg* p)
+ : m_xDlg(p)
+ {
+ }
+ virtual short Execute() override;
virtual OUString GetDimensionName() const override;
};
@@ -597,9 +604,9 @@ public:
sal_Int32 nDatePart,
const Date& rNullDate ) override;
- virtual VclPtr<AbstractScDPShowDetailDlg> CreateScDPShowDetailDlg( vcl::Window* pParent,
+ virtual VclPtr<AbstractScDPShowDetailDlg> CreateScDPShowDetailDlg(weld::Window* pParent,
ScDPObject& rDPObj,
- css::sheet::DataPilotFieldOrientation nOrient ) override;
+ css::sheet::DataPilotFieldOrientation nOrient) override;
virtual VclPtr<AbstractScNewScenarioDlg> CreateScNewScenarioDlg ( vcl::Window* pParent, const OUString& rName,
bool bEdit, bool bSheetProtected ) override;
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index c03571c7caf8..42117af9ff63 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -812,13 +812,11 @@ IMPL_LINK( ScDPSubtotalOptDlg, SelectHdl, ListBox&, rLBox, void )
}
}
-ScDPShowDetailDlg::ScDPShowDetailDlg( vcl::Window* pParent, ScDPObject& rDPObj, css::sheet::DataPilotFieldOrientation nOrient ) :
- ModalDialog ( pParent, "ShowDetail", "modules/scalc/ui/showdetaildialog.ui" ),
- mrDPObj(rDPObj)
+ScDPShowDetailDlg::ScDPShowDetailDlg(weld::Window* pParent, ScDPObject& rDPObj, css::sheet::DataPilotFieldOrientation nOrient)
+ : GenericDialogController(pParent, "modules/scalc/ui/showdetaildialog.ui", "ShowDetail")
+ , mrDPObj(rDPObj)
+ , mxLbDims(m_xBuilder->weld_tree_view("dimsTreeview"))
{
- get(mpLbDims, "dimsTreeview");
- get(mpBtnOk, "ok");
-
ScDPSaveData* pSaveData = rDPObj.GetSaveData();
long nDimCount = rDPObj.GetDimCount();
for (long nDim=0; nDim<nDimCount; nDim++)
@@ -837,39 +835,31 @@ ScDPShowDetailDlg::ScDPShowDetailDlg( vcl::Window* pParent, ScDPObject& rDPObj,
if (pLayoutName)
aName = *pLayoutName;
}
- mpLbDims->InsertEntry( aName );
+ mxLbDims->append_text(aName);
maNameIndexMap.emplace(aName, nDim);
}
}
}
- if( mpLbDims->GetEntryCount() )
- mpLbDims->SelectEntryPos( 0 );
+ if (mxLbDims->n_children())
+ mxLbDims->select(0);
- mpLbDims->SetDoubleClickHdl( LINK( this, ScDPShowDetailDlg, DblClickHdl ) );
+ mxLbDims->connect_row_activated(LINK(this, ScDPShowDetailDlg, DblClickHdl));
}
ScDPShowDetailDlg::~ScDPShowDetailDlg()
{
- disposeOnce();
-}
-
-void ScDPShowDetailDlg::dispose()
-{
- mpLbDims.clear();
- mpBtnOk.clear();
- ModalDialog::dispose();
}
-short ScDPShowDetailDlg::Execute()
+short ScDPShowDetailDlg::execute()
{
- return mpLbDims->GetEntryCount() ? ModalDialog::Execute() : static_cast<short>(RET_CANCEL);
+ return mxLbDims->n_children() ? m_xDialog->run() : static_cast<short>(RET_CANCEL);
}
OUString ScDPShowDetailDlg::GetDimensionName() const
{
// Look up the internal dimension name which may be different from the
// displayed field name.
- OUString aSelectedName = mpLbDims->GetSelectedEntry();
+ OUString aSelectedName = mxLbDims->get_selected_text();
DimNameIndexMap::const_iterator itr = maNameIndexMap.find(aSelectedName);
if (itr == maNameIndexMap.end())
// This should never happen!
@@ -880,10 +870,9 @@ OUString ScDPShowDetailDlg::GetDimensionName() const
return mrDPObj.GetDimName(nDim, bIsDataLayout);
}
-IMPL_LINK( ScDPShowDetailDlg, DblClickHdl, ListBox&, rLBox, void )
+IMPL_LINK_NOARG(ScDPShowDetailDlg, DblClickHdl, weld::TreeView&, void)
{
- if( &rLBox == mpLbDims )
- mpBtnOk->Click();
+ m_xDialog->response(RET_OK);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx
index 4ae7ffd4330d..89f732bfcf9c 100644
--- a/sc/source/ui/inc/pvfundlg.hxx
+++ b/sc/source/ui/inc/pvfundlg.hxx
@@ -31,6 +31,7 @@
#include <vcl/button.hxx>
#include <vcl/morebtn.hxx>
#include <vcl/field.hxx>
+#include <vcl/weld.hxx>
#include <svx/checklbx.hxx>
#include <sfx2/itemconnect.hxx>
#include <pivot.hxx>
@@ -186,14 +187,14 @@ private:
NameMapType maDataFieldNameMap; /// Cache for displayed name to field name mapping.
};
-class ScDPShowDetailDlg : public ModalDialog
+class ScDPShowDetailDlg : public weld::GenericDialogController
{
public:
- explicit ScDPShowDetailDlg( vcl::Window* pParent, ScDPObject& rDPObj,
- css::sheet::DataPilotFieldOrientation nOrient );
- virtual ~ScDPShowDetailDlg() override;
- virtual void dispose() override;
- virtual short Execute() override;
+ explicit ScDPShowDetailDlg(weld::Window* pParent, ScDPObject& rDPObj,
+ css::sheet::DataPilotFieldOrientation nOrient);
+ virtual ~ScDPShowDetailDlg() override;
+
+ short execute();
/**
* @return String internal name of the selected field. Note that this may
@@ -203,15 +204,14 @@ public:
OUString GetDimensionName() const;
private:
- DECL_LINK( DblClickHdl, ListBox&, void );
+ DECL_LINK(DblClickHdl, weld::TreeView&, void);
private:
- VclPtr<ListBox> mpLbDims;
- VclPtr<OKButton> mpBtnOk;
-
typedef std::unordered_map<OUString, long> DimNameIndexMap;
DimNameIndexMap maNameIndexMap;
ScDPObject& mrDPObj;
+
+ std::unique_ptr<weld::TreeView> mxLbDims;
};
#endif
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 697d52cd8a0f..55fa9e421210 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1083,11 +1083,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
if ( pTabViewShell->HasSelectionForDrillDown( nOrientation ) )
{
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
-
+ assert(pFact && "ScAbstractFactory create fail!");
ScopedVclPtr<AbstractScDPShowDetailDlg> pDlg( pFact->CreateScDPShowDetailDlg(
- pTabViewShell->GetDialogParent(), *pDPObj, nOrientation ) );
- OSL_ENSURE(pDlg, "Dialog create fail!");
+ pTabViewShell->GetFrameWeld(), *pDPObj, nOrientation ) );
+ assert(pDlg && "Dialog create fail!");
if ( pDlg->Execute() == RET_OK )
{
OUString aNewDimName( pDlg->GetDimensionName() );
diff --git a/sc/uiconfig/scalc/ui/showdetaildialog.ui b/sc/uiconfig/scalc/ui/showdetaildialog.ui
index 74d5079851db..d7f3f0a9231d 100644
--- a/sc/uiconfig/scalc/ui/showdetaildialog.ui
+++ b/sc/uiconfig/scalc/ui/showdetaildialog.ui
@@ -1,7 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.19.0 -->
+<!-- Generated with glade 3.20.4 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkListStore" id="liststore1">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="ShowDetail">
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -9,17 +17,20 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="showdetaildialog|ShowDetail">Show Detail</property>
<property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="default_width">0</property>
+ <property name="default_height">0</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="hexpand">True</property>
<property name="vexpand">True</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="orientation">vertical</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="ok">
@@ -66,6 +77,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
+ <property name="secondary">True</property>
</packing>
</child>
</object>
@@ -88,12 +100,12 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="showdetaildialog|label1">_Choose the field containing the detail you want to show</property>
<property name="use_underline">True</property>
<property name="wrap">True</property>
<property name="mnemonic_widget">dimsTreeview</property>
<property name="max_width_chars">50</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -102,13 +114,37 @@
</packing>
</child>
<child>
- <object class="GtkTreeView" id="dimsTreeview">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection1"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="dimsTreeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
@@ -131,5 +167,8 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>
More information about the Libreoffice-commits
mailing list