From 9f5df4cda93eb470fb79fc4b8014d9a6dde2284b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 30 Dec 2013 16:03:09 +0000 Subject: convert solver options dialog to .ui Change-Id: I319210233dd1b71f6e717c7322b953de8f093150 --- sc/AllLangResTarget_sc.mk | 1 - sc/UIConfig_scalc.mk | 1 + sc/inc/helpids.h | 3 - sc/inc/sc.hrc | 2 - sc/source/ui/inc/solveroptions.hxx | 12 +- sc/source/ui/miscdlgs/solveroptions.cxx | 73 +++++----- sc/source/ui/src/solveroptions.src | 92 ------------- sc/uiconfig/scalc/ui/solveroptionsdialog.ui | 200 ++++++++++++++++++++++++++++ 8 files changed, 237 insertions(+), 147 deletions(-) delete mode 100644 sc/source/ui/src/solveroptions.src create mode 100644 sc/uiconfig/scalc/ui/solveroptionsdialog.ui diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk index 9bf30003658a..96be8cb07b40 100644 --- a/sc/AllLangResTarget_sc.mk +++ b/sc/AllLangResTarget_sc.mk @@ -43,7 +43,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\ sc/source/ui/src/hdrcont.src \ sc/source/ui/src/scerrors.src \ sc/source/ui/src/simpref.src \ - sc/source/ui/src/solveroptions.src \ sc/source/ui/src/miscdlgs.src \ sc/source/ui/src/scstring.src \ sc/source/ui/src/filter.src \ diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index 2473b255c1e1..e5dff59ed86d 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -137,6 +137,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/sidebarnumberformat \ sc/uiconfig/scalc/ui/sidebarcellappearance \ sc/uiconfig/scalc/ui/solverdlg \ + sc/uiconfig/scalc/ui/solveroptionsdialog \ sc/uiconfig/scalc/ui/solverprogressdialog \ sc/uiconfig/scalc/ui/solversuccessdialog \ sc/uiconfig/scalc/ui/sortcriteriapage \ diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h index e13c082b9fb6..67c6156ebd44 100644 --- a/sc/inc/helpids.h +++ b/sc/inc/helpids.h @@ -160,9 +160,6 @@ #define HID_SC_DPDATEGROUP_LB "SC_HID_SC_DPDATEGROUP_LB" #define HID_SC_DPSHOWDETAIL "SC_HID_SC_DPSHOWDETAIL" -#define HID_SC_SOLVEROPTIONS "SC_HID_SC_SOLVEROPTIONS" -#define HID_SC_SOLVEROPTIONS_LB "SC_HID_SC_SOLVEROPTIONS_LB" - #define HID_SCDLG_CONFLICTS "SC_HID_SCDLG_CONFLICTS" #define HID_SC_HF_HL_DEFINED "SC_HID_SC_HF_HL_DEFINED" diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 7230fee5dfe7..b592b518f611 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -1093,8 +1093,6 @@ #define RID_SCDLG_DPDATEGROUP (SC_DIALOGS_START + 136) #define RID_SCDLG_DPSHOWDETAIL (SC_DIALOGS_START + 137) -#define RID_SCDLG_SOLVEROPTIONS (SC_DIALOGS_START + 139) - #define RID_SCDLG_CONFLICTS (SC_DIALOGS_START + 145) #define RID_SCDLG_SHAREDOCUMENT (SC_DIALOGS_START + 146) #define RID_SCDLG_TABPROTECTION (SC_DIALOGS_START + 148) diff --git a/sc/source/ui/inc/solveroptions.hxx b/sc/source/ui/inc/solveroptions.hxx index 5ce5ec774571..74925d73e581 100644 --- a/sc/source/ui/inc/solveroptions.hxx +++ b/sc/source/ui/inc/solveroptions.hxx @@ -37,15 +37,9 @@ namespace com { namespace sun { namespace star { class ScSolverOptionsDialog : public ModalDialog { - FixedText maFtEngine; - ListBox maLbEngine; - FixedText maFtSettings; - SvxCheckListBox maLbSettings; - PushButton maBtnEdit; - FixedLine maFlButtons; - HelpButton maBtnHelp; - OKButton maBtnOk; - CancelButton maBtnCancel; + ListBox* m_pLbEngine; + SvxCheckListBox* m_pLbSettings; + PushButton* m_pBtnEdit; SvLBoxButtonData* mpCheckButtonData; com::sun::star::uno::Sequence maImplNames; diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 256f33428447..94e53b38165b 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -113,32 +113,27 @@ ScSolverOptionsDialog::ScSolverOptionsDialog( Window* pParent, const uno::Sequence& rDescriptions, const OUString& rEngine, const uno::Sequence& rProperties ) - : ModalDialog( pParent, ScResId( RID_SCDLG_SOLVEROPTIONS ) ), - maFtEngine ( this, ScResId( FT_ENGINE ) ), - maLbEngine ( this, ScResId( LB_ENGINE ) ), - maFtSettings ( this, ScResId( FT_SETTINGS ) ), - maLbSettings ( this, ScResId( LB_SETTINGS ) ), - maBtnEdit ( this, ScResId( BTN_EDIT ) ), - maFlButtons ( this, ScResId( FL_BUTTONS ) ), - maBtnHelp ( this, ScResId( BTN_HELP ) ), - maBtnOk ( this, ScResId( BTN_OK ) ), - maBtnCancel ( this, ScResId( BTN_CANCEL ) ), - mpCheckButtonData( NULL ), - maImplNames( rImplNames ), - maDescriptions( rDescriptions ), - maEngine( rEngine ), - maProperties( rProperties ) + : ModalDialog(pParent, "SolverOptionsDialog", + "modules/scalc/ui/solveroptionsdialog.ui") + , mpCheckButtonData(NULL) + , maImplNames(rImplNames) + , maDescriptions(rDescriptions) + , maEngine(rEngine) + , maProperties(rProperties) { - maLbEngine.SetSelectHdl( LINK( this, ScSolverOptionsDialog, EngineSelectHdl ) ); + get(m_pLbEngine, "engine"); + get(m_pLbSettings, "settings"); + get(m_pBtnEdit, "edit"); - maBtnEdit.SetClickHdl( LINK( this, ScSolverOptionsDialog, ButtonHdl ) ); + m_pLbEngine->SetSelectHdl( LINK( this, ScSolverOptionsDialog, EngineSelectHdl ) ); - maLbSettings.SetStyle( maLbSettings.GetStyle()|WB_CLIPCHILDREN|WB_FORCE_MAKEVISIBLE ); - maLbSettings.SetHelpId( HID_SC_SOLVEROPTIONS_LB ); - maLbSettings.SetHighlightRange(); + m_pBtnEdit->SetClickHdl( LINK( this, ScSolverOptionsDialog, ButtonHdl ) ); - maLbSettings.SetSelectHdl( LINK( this, ScSolverOptionsDialog, SettingsSelHdl ) ); - maLbSettings.SetDoubleClickHdl( LINK( this, ScSolverOptionsDialog, SettingsDoubleClickHdl ) ); + m_pLbSettings->SetStyle( m_pLbSettings->GetStyle()|WB_CLIPCHILDREN|WB_FORCE_MAKEVISIBLE ); + m_pLbSettings->SetHighlightRange(); + + m_pLbSettings->SetSelectHdl( LINK( this, ScSolverOptionsDialog, SettingsSelHdl ) ); + m_pLbSettings->SetDoubleClickHdl( LINK( this, ScSolverOptionsDialog, SettingsDoubleClickHdl ) ); sal_Int32 nSelect = -1; sal_Int32 nImplCount = maImplNames.getLength(); @@ -146,7 +141,7 @@ ScSolverOptionsDialog::ScSolverOptionsDialog( Window* pParent, { OUString aImplName( maImplNames[nImpl] ); OUString aDescription( maDescriptions[nImpl] ); // user-visible descriptions in list box - maLbEngine.InsertEntry( aDescription ); + m_pLbEngine->InsertEntry( aDescription ); if ( aImplName == maEngine ) nSelect = nImpl; } @@ -162,13 +157,11 @@ ScSolverOptionsDialog::ScSolverOptionsDialog( Window* pParent, maProperties.realloc(0); // don't use options from different engine } if ( nSelect >= 0 ) // select in list box - maLbEngine.SelectEntryPos( static_cast(nSelect) ); + m_pLbEngine->SelectEntryPos( static_cast(nSelect) ); if ( !maProperties.getLength() ) ReadFromComponent(); // fill maProperties from component (using maEngine) FillListBox(); // using maProperties - - FreeResource(); } ScSolverOptionsDialog::~ScSolverOptionsDialog() @@ -186,7 +179,7 @@ const uno::Sequence& 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 = maLbSettings.GetModel(); + SvTreeList* pModel = m_pLbSettings->GetModel(); if ( nEntryCount == (sal_Int32)pModel->GetEntryCount() ) { for (sal_Int32 nEntryPos=0; nEntryPos& ScSolverOptionsDialog::GetProperties( } if ( !bHasData ) ScUnoHelpFunctions::SetBoolInAny( rValue, - maLbSettings.GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ); + m_pLbSettings->GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ); } } else @@ -252,14 +245,14 @@ void ScSolverOptionsDialog::FillListBox() // fill the list box - maLbSettings.SetUpdateMode(false); - maLbSettings.Clear(); + m_pLbSettings->SetUpdateMode(false); + m_pLbSettings->Clear(); OUString sEmpty; if (!mpCheckButtonData) - mpCheckButtonData = new SvLBoxButtonData( &maLbSettings ); + mpCheckButtonData = new SvLBoxButtonData(m_pLbSettings); - SvTreeList* pModel = maLbSettings.GetModel(); + SvTreeList* pModel = m_pLbSettings->GetModel(); SvTreeListEntry* pEntry = NULL; for (sal_Int32 nPos=0; nPosInsert( pEntry ); } - maLbSettings.SetUpdateMode(sal_True); + m_pLbSettings->SetUpdateMode(sal_True); } void ScSolverOptionsDialog::ReadFromComponent() @@ -315,7 +308,7 @@ void ScSolverOptionsDialog::ReadFromComponent() void ScSolverOptionsDialog::EditOption() { - SvTreeListEntry* pEntry = maLbSettings.GetCurEntry(); + SvTreeListEntry* pEntry = m_pLbSettings->GetCurEntry(); if (pEntry) { sal_uInt16 nItemCount = pEntry->ItemCount(); @@ -333,7 +326,7 @@ void ScSolverOptionsDialog::EditOption() if ( aValDialog.Execute() == RET_OK ) { pStringItem->SetDoubleValue( aValDialog.GetValue() ); - maLbSettings.InvalidateEntry( pEntry ); + m_pLbSettings->InvalidateEntry( pEntry ); } } else @@ -344,7 +337,7 @@ void ScSolverOptionsDialog::EditOption() if ( aIntDialog.Execute() == RET_OK ) { pStringItem->SetIntValue( aIntDialog.GetValue() ); - maLbSettings.InvalidateEntry( pEntry ); + m_pLbSettings->InvalidateEntry( pEntry ); } } } @@ -354,7 +347,7 @@ void ScSolverOptionsDialog::EditOption() IMPL_LINK( ScSolverOptionsDialog, ButtonHdl, PushButton*, pBtn ) { - if ( pBtn == &maBtnEdit ) + if (pBtn == m_pBtnEdit) EditOption(); return 0; @@ -368,7 +361,7 @@ IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsDoubleClickHdl) IMPL_LINK_NOARG(ScSolverOptionsDialog, EngineSelectHdl) { - sal_uInt16 nSelectPos = maLbEngine.GetSelectEntryPos(); + sal_uInt16 nSelectPos = m_pLbEngine->GetSelectEntryPos(); if ( nSelectPos < maImplNames.getLength() ) { OUString aNewEngine( maImplNames[nSelectPos] ); @@ -386,7 +379,7 @@ IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsSelHdl) { sal_Bool bCheckbox = false; - SvTreeListEntry* pEntry = maLbSettings.GetCurEntry(); + SvTreeListEntry* pEntry = m_pLbSettings->GetCurEntry(); if (pEntry) { SvLBoxItem* pItem = pEntry->GetFirstItem(SV_ITEM_ID_LBOXBUTTON); @@ -394,7 +387,7 @@ IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsSelHdl) bCheckbox = true; } - maBtnEdit.Enable( !bCheckbox ); + m_pBtnEdit->Enable( !bCheckbox ); return 0; } diff --git a/sc/source/ui/src/solveroptions.src b/sc/source/ui/src/solveroptions.src deleted file mode 100644 index ae825a49fcc9..000000000000 --- a/sc/source/ui/src/solveroptions.src +++ /dev/null @@ -1,92 +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: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "solveroptions.hrc" - -ModalDialog RID_SCDLG_SOLVEROPTIONS -{ - OutputSize = TRUE ; - HelpId = HID_SC_SOLVEROPTIONS ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 218 , 156 ) ; - Moveable = TRUE ; - FixedText FT_ENGINE - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 59 , 8 ) ; - Text [ en-US ] = "Solver engine" ; - }; - ListBox LB_ENGINE - { - HelpID = "sc:ListBox:RID_SCDLG_SOLVEROPTIONS:LB_ENGINE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 67 , 6 ) ; - Size = MAP_APPFONT ( 145 , 90 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_SETTINGS - { - Pos = MAP_APPFONT ( 6 , 24 ) ; - Size = MAP_APPFONT ( 156 , 8 ) ; - Text [ en-US ] = "Settings:" ; - }; - Control LB_SETTINGS - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 35 ) ; - Size = MAP_APPFONT ( 206 , 67 ) ; - TabStop = TRUE ; - }; - PushButton BTN_EDIT - { - HelpID = "sc:PushButton:RID_SCDLG_SOLVEROPTIONS:BTN_EDIT"; - Pos = MAP_APPFONT ( 6 , 108 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Edit..." ; - }; - FixedLine FL_BUTTONS - { - Pos = MAP_APPFONT ( 0 , 125 ) ; - Size = MAP_APPFONT ( 218 , 8 ) ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 6 , 136 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 106 , 136 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 162 , 136 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - Text [ en-US ] = "Options" ; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/uiconfig/scalc/ui/solveroptionsdialog.ui b/sc/uiconfig/scalc/ui/solveroptionsdialog.ui new file mode 100644 index 000000000000..a92d4228f2f7 --- /dev/null +++ b/sc/uiconfig/scalc/ui/solveroptionsdialog.ui @@ -0,0 +1,200 @@ + + + + + + False + 6 + Options + dialog + + + False + vertical + 12 + + + True + False + True + True + 12 + + + True + False + 12 + + + True + False + 0 + Solver engine + True + engine + + + 0 + 0 + 1 + 1 + + + + + True + False + 0 + 1 + + + 1 + 0 + 1 + 1 + + + + + 0 + 0 + 1 + 1 + + + + + True + False + True + True + 6 + + + True + False + 0 + Settings: + True + settings:border + + + 0 + 0 + 1 + 1 + + + + + True + False + True + True + + + + + + 0 + 1 + 1 + 1 + + + + + Edit... + True + True + True + start + True + + + 0 + 2 + 1 + 1 + + + + + 0 + 1 + 1 + 1 + + + + + False + True + 0 + + + + + False + end + + + gtk-ok + True + True + True + True + True + True + + + False + True + 0 + + + + + gtk-cancel + True + True + True + True + + + False + True + 1 + + + + + gtk-help + True + True + True + True + + + False + True + 2 + + + + + False + True + end + 2 + + + + + + ok + cancel + help + + + -- cgit