basctl/source/dlged/managelang.cxx | 2 cui/source/dialogs/multipat.cxx | 2 cui/source/dialogs/srchxtra.cxx | 2 cui/source/options/certpath.cxx | 2 cui/source/tabpages/autocdlg.cxx | 6 cui/uiconfig/ui/acoroptionspage.ui | 2 include/vcl/weld.hxx | 2 sc/source/ui/inc/solveroptions.hxx | 53 +++-- sc/source/ui/miscdlgs/optsolver.cxx | 9 sc/source/ui/miscdlgs/protectiondlg.cxx | 2 sc/source/ui/miscdlgs/solveroptions.cxx | 274 ++++++++++------------------ sc/uiconfig/scalc/ui/solveroptionsdialog.ui | 185 ++++++++++++------ solenv/sanitizers/ui/cui.suppr | 1 sw/source/ui/config/optload.cxx | 2 sw/source/ui/index/cnttab.cxx | 2 15 files changed, 277 insertions(+), 269 deletions(-)
New commits: commit a8f21e120b1073d7019d41e85cc9a15104ed5c93 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Feb 12 09:55:25 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Feb 12 12:48:10 2019 +0100 merge together as get_checkbox_column_width Change-Id: I183d2d94ab60c128b136674ef40eeb30057b281c Reviewed-on: https://gerrit.libreoffice.org/67714 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx index d6ab5d30e4ac..6813a96904c4 100644 --- a/basctl/source/dlged/managelang.cxx +++ b/basctl/source/dlged/managelang.cxx @@ -231,7 +231,7 @@ SetDefaultLanguageDialog::SetDefaultLanguageDialog(weld::Window* pParent, std::s m_xLanguageLB->set_size_request(-1, m_xLanguageLB->get_height_rows(10)); m_xCheckLangLB->set_size_request(-1, m_xCheckLangLB->get_height_rows(10)); std::vector<int> aWidths; - aWidths.push_back(m_xCheckLangLB->get_approximate_digit_width() * 3 + 6); + aWidths.push_back(m_xCheckLangLB->get_checkbox_column_width()); m_xCheckLangLB->set_column_fixed_widths(aWidths); if (m_xLocalizationMgr->isLibraryLocalized()) diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx index 35ea7c80d489..b6e409e5d011 100644 --- a/cui/source/dialogs/multipat.cxx +++ b/cui/source/dialogs/multipat.cxx @@ -199,7 +199,7 @@ SvxMultiPathDialog::SvxMultiPathDialog(weld::Window* pParent) m_xRadioLB->get_text_height() * 10); std::vector<int> aWidths; - aWidths.push_back(m_xRadioLB->get_approximate_digit_width() * 3 + 6); + aWidths.push_back(m_xRadioLB->get_checkbox_column_width()); m_xRadioLB->set_column_fixed_widths(aWidths); std::vector<int> aRadioColumns; diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx index 94ae52d9e0b4..39161e40765a 100644 --- a/cui/source/dialogs/srchxtra.cxx +++ b/cui/source/dialogs/srchxtra.cxx @@ -113,7 +113,7 @@ SvxSearchAttributeDialog::SvxSearchAttributeDialog(weld::Window* pParent, m_xAttrLB->get_height_rows(12)); std::vector<int> aWidths; - aWidths.push_back(m_xAttrLB->get_approximate_digit_width() * 3 + 6); + aWidths.push_back(m_xAttrLB->get_checkbox_column_width()); m_xAttrLB->set_column_fixed_widths(aWidths); m_xOKBtn->connect_clicked(LINK( this, SvxSearchAttributeDialog, OKHdl)); diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx index 4a83dad29b94..37eeadc07641 100644 --- a/cui/source/options/certpath.cxx +++ b/cui/source/options/certpath.cxx @@ -38,7 +38,7 @@ CertPathDialog::CertPathDialog(weld::Window* pParent) m_xCertPathList->get_height_rows(6)); std::vector<int> aWidths; - aWidths.push_back(m_xCertPathList->get_approximate_digit_width() * 3 + 6); + aWidths.push_back(m_xCertPathList->get_checkbox_column_width()); aWidths.push_back(m_xCertPathList->get_approximate_digit_width() * 20); m_xCertPathList->set_column_fixed_widths(aWidths); diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 03494f6d17f0..5e915f8ba31b 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -189,7 +189,7 @@ OfaAutocorrOptionsPage::OfaAutocorrOptionsPage(TabPageParent pParent, const SfxI , m_xCheckLB(m_xBuilder->weld_tree_view("checklist")) { std::vector<int> aWidths; - aWidths.push_back(m_xCheckLB->get_approximate_digit_width() * 3 + 6); + aWidths.push_back(m_xCheckLB->get_checkbox_column_width()); m_xCheckLB->set_column_fixed_widths(aWidths); m_xCheckLB->set_size_request(-1, m_xCheckLB->get_height_rows(10)); } @@ -1584,7 +1584,7 @@ OfaQuoteTabPage::OfaQuoteTabPage(TabPageParent pParent, const SfxItemSet& rSet) else { std::vector<int> aWidths; - aWidths.push_back(m_xSwCheckLB->get_approximate_digit_width() * 3 + 6); + aWidths.push_back(m_xSwCheckLB->get_checkbox_column_width()); m_xCheckLB->set_column_fixed_widths(aWidths); m_xSwCheckLB->hide(); } @@ -2131,7 +2131,7 @@ OfaSmartTagOptionsTabPage::OfaSmartTagOptionsTabPage(TabPageParent pParent, m_xSmartTagTypesLB->get_height_rows(6)); std::vector<int> aWidths; - aWidths.push_back(m_xSmartTagTypesLB->get_approximate_digit_width() * 3 + 6); + aWidths.push_back(m_xSmartTagTypesLB->get_checkbox_column_width()); m_xSmartTagTypesLB->set_column_fixed_widths(aWidths); // set the handlers: diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 311136279c37..bdd80ac3c635 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -618,6 +618,8 @@ public: virtual OUString get_column_title(int nColumn) const = 0; virtual void set_column_title(int nColumn, const OUString& rTitle) = 0; + int get_checkbox_column_width() const { return get_approximate_digit_width() * 3 + 6; } + virtual void set_selection_mode(SelectionMode eMode) = 0; virtual int count_selected_rows() const = 0; diff --git a/sc/source/ui/miscdlgs/protectiondlg.cxx b/sc/source/ui/miscdlgs/protectiondlg.cxx index 0f3e1384ae3c..f363f412a423 100644 --- a/sc/source/ui/miscdlgs/protectiondlg.cxx +++ b/sc/source/ui/miscdlgs/protectiondlg.cxx @@ -62,7 +62,7 @@ ScTableProtectionDlg::ScTableProtectionDlg(weld::Window* pParent) m_aDeleteRows = m_xDeleteRows->get_label(); std::vector<int> aWidths; - aWidths.push_back(m_xOptionsListBox->get_approximate_digit_width() * 3 + 6); + aWidths.push_back(m_xOptionsListBox->get_checkbox_column_width()); m_xOptionsListBox->set_column_fixed_widths(aWidths); Init(); diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index eaedf2ab296f..77ad31bc86e9 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -71,7 +71,7 @@ ScSolverOptionsDialog::ScSolverOptionsDialog(weld::Window* pParent, m_xLbSettings->get_height_rows(6)); std::vector<int> aWidths; - aWidths.push_back(m_xLbSettings->get_approximate_digit_width() * 3 + 6); + aWidths.push_back(m_xLbSettings->get_checkbox_column_width()); m_xLbSettings->set_column_fixed_widths(aWidths); m_xLbEngine->connect_changed( LINK( this, ScSolverOptionsDialog, EngineSelectHdl ) ); diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 1584ea6d50ec..ee185cbeac53 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -490,7 +490,7 @@ SwCaptionOptPage::SwCaptionOptPage(TabPageParent pParent, const SfxItemSet& rSet m_xCategoryBox->connect_entry_insert_text(LINK(this, SwCaptionOptPage, TextFilterHdl)); std::vector<int> aWidths; - aWidths.push_back(m_xCheckLB->get_approximate_digit_width() * 3 + 6); + aWidths.push_back(m_xCheckLB->get_checkbox_column_width()); m_xCheckLB->set_column_fixed_widths(aWidths); SwStyleNameMapper::FillUIName(RES_POOLCOLL_LABEL_ABB, m_sIllustration); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index a521961dc243..ce4ca2867a05 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -781,7 +781,7 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(TabPageParent pParent, const SfxItemSet& sAddStyleContent = m_xAddStylesCB->get_label(); std::vector<int> aWidths; - aWidths.push_back(m_xFromObjCLB->get_approximate_digit_width() * 3 + 6); + aWidths.push_back(m_xFromObjCLB->get_checkbox_column_width()); m_xFromObjCLB->set_column_fixed_widths(aWidths); for (size_t i = 0; i < SAL_N_ELEMENTS(RES_SRCTYPES); ++i) commit de0651551b13e58e4a37794e1da6649629be3fc0 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 11 21:33:49 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Feb 12 12:47:57 2019 +0100 weld ScSolverOptionsDialog Change-Id: I940fe1c5b4edf41c66a729c56fa789488fd39ba6 Reviewed-on: https://gerrit.libreoffice.org/67713 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/uiconfig/ui/acoroptionspage.ui b/cui/uiconfig/ui/acoroptionspage.ui index 9c10c2b50f58..2bdc0bf3492d 100644 --- a/cui/uiconfig/ui/acoroptionspage.ui +++ b/cui/uiconfig/ui/acoroptionspage.ui @@ -37,7 +37,7 @@ <property name="vexpand">True</property> <property name="model">liststore2</property> <property name="headers_visible">False</property> - <property name="search_column">0</property> + <property name="search_column">1</property> <property name="show_expanders">False</property> <child internal-child="selection"> <object class="GtkTreeSelection" id="Macro Library List-selection2"/> diff --git a/sc/source/ui/inc/solveroptions.hxx b/sc/source/ui/inc/solveroptions.hxx index 73e2dc1c9c40..18bc0ab3012a 100644 --- a/sc/source/ui/inc/solveroptions.hxx +++ b/sc/source/ui/inc/solveroptions.hxx @@ -20,46 +20,67 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_SOLVEROPTIONS_HXX #define INCLUDED_SC_SOURCE_UI_INC_SOLVEROPTIONS_HXX -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/lstbox.hxx> #include <vcl/weld.hxx> -#include <svx/checklbx.hxx> #include <com/sun/star/uno/Sequence.hxx> namespace com { namespace sun { namespace star { namespace beans { struct PropertyValue; } } } } -class ScSolverOptionsDialog : public ModalDialog +class ScSolverOptionsString { - VclPtr<ListBox> m_pLbEngine; - VclPtr<SvxCheckListBox> m_pLbSettings; - VclPtr<PushButton> m_pBtnEdit; + bool mbIsDouble; + double mfDoubleValue; + sal_Int32 mnIntValue; + OUString msStr; - std::unique_ptr<SvLBoxButtonData> m_xCheckButtonData; +public: + explicit ScSolverOptionsString(const OUString& rStr) + : mbIsDouble(false) + , mfDoubleValue(0.0) + , mnIntValue(0) + , msStr(rStr) + { + } + + bool IsDouble() const { return mbIsDouble; } + double GetDoubleValue() const { return mfDoubleValue; } + sal_Int32 GetIntValue() const { return mnIntValue; } + const OUString& GetText() const { return msStr; } + + void SetDoubleValue( double fNew ) { mbIsDouble = true; mfDoubleValue = fNew; } + void SetIntValue( sal_Int32 nNew ) { mbIsDouble = false; mnIntValue = nNew; } +}; + +class ScSolverOptionsDialog : public weld::GenericDialogController +{ css::uno::Sequence<OUString> maImplNames; css::uno::Sequence<OUString> maDescriptions; - OUString maEngine; + OUString maEngine; css::uno::Sequence<css::beans::PropertyValue> maProperties; - DECL_LINK( EngineSelectHdl, ListBox&, void ); - DECL_LINK( SettingsSelHdl, SvTreeListBox*, void ); - DECL_LINK( SettingsDoubleClickHdl, SvTreeListBox*, bool ); - DECL_LINK( ButtonHdl, Button*, void ); + std::vector<std::unique_ptr<ScSolverOptionsString>> m_aOptions; + + std::unique_ptr<weld::ComboBox> m_xLbEngine; + std::unique_ptr<weld::TreeView> m_xLbSettings; + std::unique_ptr<weld::Button> m_xBtnEdit; + + DECL_LINK( EngineSelectHdl, weld::ComboBox&, void ); + DECL_LINK( SettingsSelHdl, weld::TreeView&, void ); + DECL_LINK( SettingsDoubleClickHdl, weld::TreeView&, void ); + DECL_LINK( ButtonHdl, weld::Button&, void ); void ReadFromComponent(); void FillListBox(); void EditOption(); public: - ScSolverOptionsDialog( vcl::Window* pParent, + ScSolverOptionsDialog( weld::Window* pParent, const css::uno::Sequence<OUString>& rImplNames, const css::uno::Sequence<OUString>& rDescriptions, const OUString& rEngine, const css::uno::Sequence<css::beans::PropertyValue>& rProperties ); virtual ~ScSolverOptionsDialog() override; - virtual void dispose() override; // already updated in selection handler const OUString& GetEngine() const { return maEngine; } diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 8d26590cfb79..2f4232d2f4f7 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -600,12 +600,11 @@ IMPL_LINK( ScOptSolverDlg, BtnHdl, Button*, pBtn, void ) else if ( pBtn == m_pBtnOpt ) { //! move options dialog to UI lib? - ScopedVclPtr<ScSolverOptionsDialog> pOptDlg( - VclPtr<ScSolverOptionsDialog>::Create( this, maImplNames, maDescriptions, maEngine, maProperties )); - if ( pOptDlg->Execute() == RET_OK ) + ScSolverOptionsDialog aOptDlg(GetFrameWeld(), maImplNames, maDescriptions, maEngine, maProperties); + if (aOptDlg.run() == RET_OK) { - maEngine = pOptDlg->GetEngine(); - maProperties = pOptDlg->GetProperties(); + maEngine = aOptDlg.GetEngine(); + maProperties = aOptDlg.GetProperties(); } } } diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 02616a62db8d..eaedf2ab296f 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -53,85 +53,33 @@ struct ScSolverOptionsEntry } }; -class ScSolverOptionsString : public SvLBoxString -{ - bool mbIsDouble; - double mfDoubleValue; - sal_Int32 mnIntValue; - -public: - explicit ScSolverOptionsString(const OUString& rStr) - : SvLBoxString(rStr) - , mbIsDouble(false) - , mfDoubleValue(0.0) - , mnIntValue(0) - { - } - - bool IsDouble() const { return mbIsDouble; } - double GetDoubleValue() const { return mfDoubleValue; } - sal_Int32 GetIntValue() const { return mnIntValue; } - - void SetDoubleValue( double fNew ) { mbIsDouble = true; mfDoubleValue = fNew; } - void SetIntValue( sal_Int32 nNew ) { mbIsDouble = false; mnIntValue = nNew; } - - virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override; -}; - -void ScSolverOptionsString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry& /*rEntry*/) -{ - //! move position? (SvxLinguTabPage: aPos.X() += 20) - OUString aNormalStr(GetText()); - aNormalStr += ":"; - rRenderContext.DrawText(rPos, aNormalStr); - - Point aNewPos(rPos); - aNewPos.AdjustX(rRenderContext.GetTextWidth(aNormalStr) ); - vcl::Font aOldFont(rRenderContext.GetFont()); - vcl::Font aFont(aOldFont); - aFont.SetWeight(WEIGHT_BOLD); - - OUString sTxt(' '); - if (mbIsDouble) - sTxt += rtl::math::doubleToUString(mfDoubleValue, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - ScGlobal::GetpLocaleData()->getNumDecimalSep()[0], true ); - else - sTxt += OUString::number(mnIntValue); - rRenderContext.SetFont(aFont); - rRenderContext.DrawText(aNewPos, sTxt); - - rRenderContext.SetFont(aOldFont); -} - -ScSolverOptionsDialog::ScSolverOptionsDialog( vcl::Window* pParent, +ScSolverOptionsDialog::ScSolverOptionsDialog(weld::Window* pParent, const uno::Sequence<OUString>& rImplNames, const uno::Sequence<OUString>& rDescriptions, const OUString& rEngine, const uno::Sequence<beans::PropertyValue>& rProperties ) - : ModalDialog(pParent, "SolverOptionsDialog", - "modules/scalc/ui/solveroptionsdialog.ui") + : GenericDialogController(pParent, "modules/scalc/ui/solveroptionsdialog.ui", "SolverOptionsDialog") , maImplNames(rImplNames) , maDescriptions(rDescriptions) , maEngine(rEngine) , maProperties(rProperties) + , m_xLbEngine(m_xBuilder->weld_combo_box("engine")) + , m_xLbSettings(m_xBuilder->weld_tree_view("settings")) + , m_xBtnEdit(m_xBuilder->weld_button("edit")) { - get(m_pLbEngine, "engine"); - get(m_pLbSettings, "settings"); - get(m_pBtnEdit, "edit"); + m_xLbSettings->set_size_request(m_xLbSettings->get_approximate_digit_width() * 32, + m_xLbSettings->get_height_rows(6)); - m_pLbEngine->SetSelectHdl( LINK( this, ScSolverOptionsDialog, EngineSelectHdl ) ); + std::vector<int> aWidths; + aWidths.push_back(m_xLbSettings->get_approximate_digit_width() * 3 + 6); + m_xLbSettings->set_column_fixed_widths(aWidths); - m_pBtnEdit->SetClickHdl( LINK( this, ScSolverOptionsDialog, ButtonHdl ) ); + m_xLbEngine->connect_changed( LINK( this, ScSolverOptionsDialog, EngineSelectHdl ) ); - m_pLbSettings->SetStyle( m_pLbSettings->GetStyle()|WB_CLIPCHILDREN ); - m_pLbSettings->SetForceMakeVisible(true); - m_pLbSettings->SetHighlightRange(); + m_xBtnEdit->connect_clicked( LINK( this, ScSolverOptionsDialog, ButtonHdl ) ); - m_pLbSettings->SetSelectHdl( LINK( this, ScSolverOptionsDialog, SettingsSelHdl ) ); - m_pLbSettings->SetDoubleClickHdl( LINK( this, ScSolverOptionsDialog, SettingsDoubleClickHdl ) ); + m_xLbSettings->connect_changed( LINK( this, ScSolverOptionsDialog, SettingsSelHdl ) ); + m_xLbSettings->connect_row_activated( LINK( this, ScSolverOptionsDialog, SettingsDoubleClickHdl ) ); sal_Int32 nSelect = -1; sal_Int32 nImplCount = maImplNames.getLength(); @@ -139,7 +87,7 @@ ScSolverOptionsDialog::ScSolverOptionsDialog( vcl::Window* pParent, { OUString aImplName( maImplNames[nImpl] ); OUString aDescription( maDescriptions[nImpl] ); // user-visible descriptions in list box - m_pLbEngine->InsertEntry( aDescription ); + m_xLbEngine->append_text(aDescription); if ( aImplName == maEngine ) nSelect = nImpl; } @@ -155,7 +103,7 @@ ScSolverOptionsDialog::ScSolverOptionsDialog( vcl::Window* pParent, maProperties.realloc(0); // don't use options from different engine } if ( nSelect >= 0 ) // select in list box - m_pLbEngine->SelectEntryPos( static_cast<sal_uInt16>(nSelect) ); + m_xLbEngine->set_active(nSelect); if ( !maProperties.getLength() ) ReadFromComponent(); // fill maProperties from component (using maEngine) @@ -164,16 +112,6 @@ ScSolverOptionsDialog::ScSolverOptionsDialog( vcl::Window* pParent, ScSolverOptionsDialog::~ScSolverOptionsDialog() { - disposeOnce(); -} - -void ScSolverOptionsDialog::dispose() -{ - m_xCheckButtonData.reset(); - m_pLbEngine.clear(); - m_pLbSettings.clear(); - m_pBtnEdit.clear(); - ModalDialog::dispose(); } const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties() @@ -181,31 +119,20 @@ const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties( // update maProperties from list box content // order of entries in list box and maProperties is the same sal_Int32 nEntryCount = maProperties.getLength(); - SvTreeList* pModel = m_pLbSettings->GetModel(); - if ( nEntryCount == static_cast<sal_Int32>(pModel->GetEntryCount()) ) + if (nEntryCount == m_xLbSettings->n_children()) { for (sal_Int32 nEntryPos=0; nEntryPos<nEntryCount; ++nEntryPos) { uno::Any& rValue = maProperties[nEntryPos].Value; - SvTreeListEntry* pEntry = pModel->GetEntry(nEntryPos); - - bool bHasData = false; - sal_uInt16 nItemCount = pEntry->ItemCount(); - for (sal_uInt16 nItemPos=0; nItemPos<nItemCount && !bHasData; ++nItemPos) + if (ScSolverOptionsString* pStringItem = reinterpret_cast<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntryPos).toInt64())) { - SvLBoxItem& rItem = pEntry->GetItem( nItemPos ); - ScSolverOptionsString* pStringItem = dynamic_cast<ScSolverOptionsString*>(&rItem); - if ( pStringItem ) - { - if ( pStringItem->IsDouble() ) - rValue <<= pStringItem->GetDoubleValue(); - else - rValue <<= pStringItem->GetIntValue(); - bHasData = true; - } + if (pStringItem->IsDouble()) + rValue <<= pStringItem->GetDoubleValue(); + else + rValue <<= pStringItem->GetIntValue(); } - if ( !bHasData ) - rValue <<= ( m_pLbSettings->GetCheckButtonState( pEntry ) == SvButtonState::Checked ); + else + rValue <<= m_xLbSettings->get_toggle(nEntryPos, 0); } } else @@ -246,14 +173,8 @@ void ScSolverOptionsDialog::FillListBox() // fill the list box - m_pLbSettings->SetUpdateMode(false); - m_pLbSettings->Clear(); - - if (!m_xCheckButtonData) - m_xCheckButtonData.reset(new SvLBoxButtonData(m_pLbSettings)); - - SvTreeList* pModel = m_pLbSettings->GetModel(); - SvTreeListEntry* pEntry = nullptr; + m_xLbSettings->freeze(); + m_xLbSettings->clear(); for (sal_Int32 nPos=0; nPos<nCount; nPos++) { @@ -261,46 +182,52 @@ void ScSolverOptionsDialog::FillListBox() uno::Any aValue = maProperties[nPos].Value; uno::TypeClass eClass = aValue.getValueTypeClass(); + + m_xLbSettings->insert(nullptr, -1, nullptr, nullptr, + nullptr, nullptr, nullptr, false); + if ( eClass == uno::TypeClass_BOOLEAN ) { // check box entry - pEntry = new SvTreeListEntry; - std::unique_ptr<SvLBoxButton> xButton(new SvLBoxButton( - SvLBoxButtonKind::EnabledCheckbox, m_xCheckButtonData.get())); - if ( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ) - xButton->SetStateChecked(); - else - xButton->SetStateUnchecked(); - pEntry->AddItem(std::move(xButton)); - pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(Image(), Image(), false)); - pEntry->AddItem(std::make_unique<SvLBoxString>(aVisName)); + m_xLbSettings->set_toggle(nPos, ScUnoHelpFunctions::GetBoolFromAny(aValue), 0); + m_xLbSettings->set_text(nPos, aVisName, 1); } else { // value entry - pEntry = new SvTreeListEntry; - pEntry->AddItem(std::make_unique<SvLBoxString>("")); // empty column - pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(Image(), Image(), false)); - std::unique_ptr<ScSolverOptionsString> pItem( - new ScSolverOptionsString(aVisName)); - if ( eClass == uno::TypeClass_DOUBLE ) + m_xLbSettings->set_text(nPos, aVisName, 1); + m_aOptions.emplace_back(new ScSolverOptionsString(aVisName)); + if (eClass == uno::TypeClass_DOUBLE) { double fDoubleValue = 0.0; - if ( aValue >>= fDoubleValue ) - pItem->SetDoubleValue( fDoubleValue ); + if (aValue >>= fDoubleValue) + m_aOptions.back()->SetDoubleValue(fDoubleValue); + + OUString sTxt(aVisName); + sTxt += ": "; + sTxt += rtl::math::doubleToUString(fDoubleValue, + rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, + ScGlobal::GetpLocaleData()->getNumDecimalSep()[0], true ); + + m_xLbSettings->set_text(nPos, sTxt, 1); } else { sal_Int32 nIntValue = 0; - if ( aValue >>= nIntValue ) - pItem->SetIntValue( nIntValue ); + if (aValue >>= nIntValue) + m_aOptions.back()->SetIntValue(nIntValue); + + OUString sTxt(aVisName); + sTxt += ": "; + sTxt += OUString::number(nIntValue); + + m_xLbSettings->set_text(nPos, sTxt, 1); } - pEntry->AddItem(std::move(pItem)); + m_xLbSettings->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(m_aOptions.back().get()))); } - pModel->Insert( pEntry ); } - m_pLbSettings->SetUpdateMode(true); + m_xLbSettings->thaw(); } void ScSolverOptionsDialog::ReadFromComponent() @@ -310,58 +237,63 @@ void ScSolverOptionsDialog::ReadFromComponent() void ScSolverOptionsDialog::EditOption() { - SvTreeListEntry* pEntry = m_pLbSettings->GetCurEntry(); - if (pEntry) + int nEntry = m_xLbSettings->get_selected_index(); + if (nEntry == -1) + return; + ScSolverOptionsString* pStringItem = reinterpret_cast<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntry).toInt64()); + if (!pStringItem) + return; + + if (pStringItem->IsDouble()) { - sal_uInt16 nItemCount = pEntry->ItemCount(); - for (sal_uInt16 nPos=0; nPos<nItemCount; ++nPos) + ScSolverValueDialog aValDialog(m_xDialog.get()); + aValDialog.SetOptionName( pStringItem->GetText() ); + aValDialog.SetValue( pStringItem->GetDoubleValue() ); + if (aValDialog.run() == RET_OK) { - SvLBoxItem& rItem = pEntry->GetItem( nPos ); - ScSolverOptionsString* pStringItem = dynamic_cast<ScSolverOptionsString*>(&rItem); - if ( pStringItem ) - { - if ( pStringItem->IsDouble() ) - { - ScSolverValueDialog aValDialog(GetFrameWeld()); - aValDialog.SetOptionName( pStringItem->GetText() ); - aValDialog.SetValue( pStringItem->GetDoubleValue() ); - if (aValDialog.run() == RET_OK) - { - pStringItem->SetDoubleValue( aValDialog.GetValue() ); - m_pLbSettings->InvalidateEntry( pEntry ); - } - } - else - { - ScSolverIntegerDialog aIntDialog(GetFrameWeld()); - aIntDialog.SetOptionName( pStringItem->GetText() ); - aIntDialog.SetValue( pStringItem->GetIntValue() ); - if (aIntDialog.run() == RET_OK) - { - pStringItem->SetIntValue(aIntDialog.GetValue()); - m_pLbSettings->InvalidateEntry( pEntry ); - } - } - } + pStringItem->SetDoubleValue( aValDialog.GetValue() ); + + OUString sTxt(pStringItem->GetText()); + sTxt += ": "; + sTxt += rtl::math::doubleToUString(pStringItem->GetDoubleValue(), + rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, + ScGlobal::GetpLocaleData()->getNumDecimalSep()[0], true ); + + m_xLbSettings->set_text(nEntry, sTxt, 1); + } + } + else + { + ScSolverIntegerDialog aIntDialog(m_xDialog.get()); + aIntDialog.SetOptionName( pStringItem->GetText() ); + aIntDialog.SetValue( pStringItem->GetIntValue() ); + if (aIntDialog.run() == RET_OK) + { + pStringItem->SetIntValue(aIntDialog.GetValue()); + + OUString sTxt(pStringItem->GetText()); + sTxt += ": "; + sTxt += OUString::number(pStringItem->GetIntValue()); + + m_xLbSettings->set_text(nEntry, sTxt, 1); } } } -IMPL_LINK( ScSolverOptionsDialog, ButtonHdl, Button*, pBtn, void ) +IMPL_LINK( ScSolverOptionsDialog, ButtonHdl, weld::Button&, rBtn, void ) { - if (pBtn == m_pBtnEdit) + if (&rBtn == m_xBtnEdit.get()) EditOption(); } -IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsDoubleClickHdl, SvTreeListBox*, bool) +IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsDoubleClickHdl, weld::TreeView&, void) { EditOption(); - return false; } -IMPL_LINK_NOARG(ScSolverOptionsDialog, EngineSelectHdl, ListBox&, void) +IMPL_LINK_NOARG(ScSolverOptionsDialog, EngineSelectHdl, weld::ComboBox&, void) { - const sal_Int32 nSelectPos = m_pLbEngine->GetSelectedEntryPos(); + const sal_Int32 nSelectPos = m_xLbEngine->get_active(); if ( nSelectPos < maImplNames.getLength() ) { OUString aNewEngine( maImplNames[nSelectPos] ); @@ -374,19 +306,19 @@ IMPL_LINK_NOARG(ScSolverOptionsDialog, EngineSelectHdl, ListBox&, void) } } -IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsSelHdl, SvTreeListBox*, void) +IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsSelHdl, weld::TreeView&, void) { bool bCheckbox = false; - SvTreeListEntry* pEntry = m_pLbSettings->GetCurEntry(); - if (pEntry) + int nEntry = m_xLbSettings->get_selected_index(); + if (nEntry != -1) { - SvLBoxItem* pItem = pEntry->GetFirstItem(SvLBoxItemType::Button); - if (pItem && pItem->GetType() == SvLBoxItemType::Button) + ScSolverOptionsString* pStringItem = reinterpret_cast<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntry).toInt64()); + if (!pStringItem) bCheckbox = true; } - m_pBtnEdit->Enable( !bCheckbox ); + m_xBtnEdit->set_sensitive(!bCheckbox); } ScSolverIntegerDialog::ScSolverIntegerDialog(weld::Window * pParent) diff --git a/sc/uiconfig/scalc/ui/solveroptionsdialog.ui b/sc/uiconfig/scalc/ui/solveroptionsdialog.ui index 472a7224eb91..5388ef012fb6 100644 --- a/sc/uiconfig/scalc/ui/solveroptionsdialog.ui +++ b/sc/uiconfig/scalc/ui/solveroptionsdialog.ui @@ -1,18 +1,90 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> + <object class="GtkTreeStore" id="liststore1"> + <columns> + <!-- column-name check1 --> + <column type="gboolean"/> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + <!-- column-name checkvis1 --> + <column type="gboolean"/> + </columns> + </object> <object class="GtkDialog" id="SolverOptionsDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="solveroptionsdialog|SolverOptionsDialog">Options</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <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> + <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">False</property> + <property name="fill">True</property> + <property name="position">2</property> + <property name="secondary">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">2</property> + </packing> + </child> <child> <object class="GtkGrid" id="grid1"> <property name="visible">True</property> @@ -29,10 +101,10 @@ <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="solveroptionsdialog|label2">Solver engine:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">engine</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -66,10 +138,10 @@ <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="solveroptionsdialog|label1">Settings:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">settings:border</property> + <property name="mnemonic_widget">settings</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -77,13 +149,53 @@ </packing> </child> <child> - <object class="svxcorelo-SvxCheckListBox" id="settings:border"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">False</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="Check List Box-selection1"/> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="settings"> + <property name="width_request">-1</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">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="search_column">1</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Macro Library List-selection2"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn1"> + <property name="resizable">True</property> + <property name="spacing">6</property> + <property name="alignment">0.5</property> + <child> + <object class="GtkCellRendererToggle" id="cellrenderer5"/> + <attributes> + <attribute name="visible">3</attribute> + <attribute name="active">0</attribute> + </attributes> + </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn2"> + <property name="spacing">6</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">1</attribute> + </attributes> + </child> + </object> + </child> + </object> </child> </object> <packing> @@ -118,63 +230,6 @@ <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="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> - <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">False</property> - <property name="fill">True</property> - <property name="position">2</property> - <property name="secondary">True</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">2</property> - </packing> - </child> </object> </child> <action-widgets> diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr index efe88e89d490..2e83d8eed13e 100644 --- a/solenv/sanitizers/ui/cui.suppr +++ b/solenv/sanitizers/ui/cui.suppr @@ -28,7 +28,6 @@ cui/uiconfig/ui/applyautofmtpage.ui://svtlo-SvSimpleTableContainer[@id='list'] n cui/uiconfig/ui/applylocalizedpage.ui://GtkLabel[@id='m'] orphan-label cui/uiconfig/ui/applylocalizedpage.ui://GtkLabel[@id='t'] orphan-label cui/uiconfig/ui/applylocalizedpage.ui://svtlo-SvSimpleTableContainer[@id='list:border'] no-labelled-by -cui/uiconfig/ui/applylocalizedpage.ui://svxcorelo-SvxCheckListBox[@id='checklist:border'] no-labelled-by cui/uiconfig/ui/applylocalizedpage.ui://GtkLabel[@id='singlestartex'] orphan-label cui/uiconfig/ui/applylocalizedpage.ui://GtkLabel[@id='singleendex'] orphan-label cui/uiconfig/ui/applylocalizedpage.ui://GtkLabel[@id='doublestartex'] orphan-label _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits