summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-07 19:53:09 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-08 10:14:07 +0200
commitfcd2f1c80f0523efb6941239c220bddd25d4cd7b (patch)
treee4557a8d2efa9a1d948486b8c0b4ef0cd526350e /sc/source/ui
parent59dd8fe17e970743e45edf687ab8751ab7f21b1f (diff)
weld ScTPValidationError
Change-Id: Iaea475dc1037ed070ab2ff61be647f345d39ae3c Reviewed-on: https://gerrit.libreoffice.org/61501 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/dbgui/validate.cxx89
-rw-r--r--sc/source/ui/inc/validate.hxx21
2 files changed, 48 insertions, 62 deletions
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index 937b081172fb..8f9711ef28f4 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -742,21 +742,20 @@ bool ScTPValidationHelp::FillItemSet( SfxItemSet* rArgSet )
// Error Alert Page
-ScTPValidationError::ScTPValidationError( vcl::Window* pParent,
- const SfxItemSet& rArgSet )
+ScTPValidationError::ScTPValidationError(TabPageParent pParent,
+ const SfxItemSet& rArgSet)
: SfxTabPage ( pParent,
- "ErrorAlertTabPage" , "modules/scalc/ui/erroralerttabpage.ui" ,
+ "modules/scalc/ui/erroralerttabpage.ui", "ErrorAlertTabPage",
&rArgSet )
-{
- get(m_pTsbShow,"tsbshow");
- get(m_pLbAction,"actionCB");
- get(m_pBtnSearch,"browseBtn");
- get(m_pEdtTitle,"erroralert_title");
- get(m_pFtError,"errormsg_label");
- get(m_pEdError,"errorMsg");
- m_pEdError->set_height_request(m_pEdError->GetTextHeight() * 12);
- m_pEdError->set_width_request(m_pEdError->approximate_char_width() * 50);
+ , m_xTsbShow(m_xBuilder->weld_check_button("tsbshow"))
+ , m_xLbAction(m_xBuilder->weld_combo_box("actionCB"))
+ , m_xBtnSearch(m_xBuilder->weld_button("browseBtn"))
+ , m_xEdtTitle(m_xBuilder->weld_entry("erroralert_title"))
+ , m_xFtError(m_xBuilder->weld_label("errormsg_label"))
+ , m_xEdError(m_xBuilder->weld_text_view("errorMsg"))
+{
+ m_xEdError->set_size_request(m_xEdError->get_approximate_digit_width() * 40, m_xEdError->get_height_rows(12));
Init();
}
@@ -765,32 +764,20 @@ ScTPValidationError::~ScTPValidationError()
disposeOnce();
}
-void ScTPValidationError::dispose()
-{
- m_pTsbShow.clear();
- m_pLbAction.clear();
- m_pBtnSearch.clear();
- m_pEdtTitle.clear();
- m_pFtError.clear();
- m_pEdError.clear();
- SfxTabPage::dispose();
-}
-
void ScTPValidationError::Init()
{
- m_pLbAction->SetSelectHdl( LINK( this, ScTPValidationError, SelectActionHdl ) );
- m_pBtnSearch->SetClickHdl( LINK( this, ScTPValidationError, ClickSearchHdl ) );
+ m_xLbAction->connect_changed(LINK(this, ScTPValidationError, SelectActionHdl));
+ m_xBtnSearch->connect_clicked(LINK( this, ScTPValidationError, ClickSearchHdl));
- m_pLbAction->SelectEntryPos( 0 );
- m_pTsbShow->EnableTriState( false );
+ m_xLbAction->set_active(0);
- SelectActionHdl( *m_pLbAction.get() );
+ SelectActionHdl(*m_xLbAction);
}
-VclPtr<SfxTabPage> ScTPValidationError::Create( TabPageParent pParent,
- const SfxItemSet* rArgSet )
+VclPtr<SfxTabPage> ScTPValidationError::Create(TabPageParent pParent,
+ const SfxItemSet* rArgSet)
{
- return VclPtr<ScTPValidationError>::Create( pParent.pParent, *rArgSet );
+ return VclPtr<ScTPValidationError>::Create(pParent, *rArgSet);
}
void ScTPValidationError::Reset( const SfxItemSet* rArgSet )
@@ -798,49 +785,49 @@ void ScTPValidationError::Reset( const SfxItemSet* rArgSet )
const SfxPoolItem* pItem;
if ( rArgSet->GetItemState( FID_VALID_SHOWERR, true, &pItem ) == SfxItemState::SET )
- m_pTsbShow->SetState( static_cast<const SfxBoolItem*>(pItem)->GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
+ m_xTsbShow->set_state( static_cast<const SfxBoolItem*>(pItem)->GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
else
- m_pTsbShow->SetState( TRISTATE_TRUE ); // check by default
+ m_xTsbShow->set_state( TRISTATE_TRUE ); // check by default
if ( rArgSet->GetItemState( FID_VALID_ERRSTYLE, true, &pItem ) == SfxItemState::SET )
- m_pLbAction->SelectEntryPos( static_cast<const SfxAllEnumItem*>(pItem)->GetValue() );
+ m_xLbAction->set_active( static_cast<const SfxAllEnumItem*>(pItem)->GetValue() );
else
- m_pLbAction->SelectEntryPos( 0 );
+ m_xLbAction->set_active( 0 );
if ( rArgSet->GetItemState( FID_VALID_ERRTITLE, true, &pItem ) == SfxItemState::SET )
- m_pEdtTitle->SetText( static_cast<const SfxStringItem*>(pItem)->GetValue() );
+ m_xEdtTitle->set_text( static_cast<const SfxStringItem*>(pItem)->GetValue() );
else
- m_pEdtTitle->SetText( EMPTY_OUSTRING );
+ m_xEdtTitle->set_text( EMPTY_OUSTRING );
if ( rArgSet->GetItemState( FID_VALID_ERRTEXT, true, &pItem ) == SfxItemState::SET )
- m_pEdError->SetText( static_cast<const SfxStringItem*>(pItem)->GetValue() );
+ m_xEdError->set_text( static_cast<const SfxStringItem*>(pItem)->GetValue() );
else
- m_pEdError->SetText( EMPTY_OUSTRING );
+ m_xEdError->set_text( EMPTY_OUSTRING );
- SelectActionHdl( *m_pLbAction.get() );
+ SelectActionHdl( *m_xLbAction.get() );
}
bool ScTPValidationError::FillItemSet( SfxItemSet* rArgSet )
{
- rArgSet->Put( SfxBoolItem( FID_VALID_SHOWERR, m_pTsbShow->GetState() == TRISTATE_TRUE ) );
- rArgSet->Put( SfxAllEnumItem( FID_VALID_ERRSTYLE, m_pLbAction->GetSelectedEntryPos() ) );
- rArgSet->Put( SfxStringItem( FID_VALID_ERRTITLE, m_pEdtTitle->GetText() ) );
- rArgSet->Put( SfxStringItem( FID_VALID_ERRTEXT, m_pEdError->GetText() ) );
+ rArgSet->Put( SfxBoolItem( FID_VALID_SHOWERR, m_xTsbShow->get_state() == TRISTATE_TRUE ) );
+ rArgSet->Put( SfxAllEnumItem( FID_VALID_ERRSTYLE, m_xLbAction->get_active() ) );
+ rArgSet->Put( SfxStringItem( FID_VALID_ERRTITLE, m_xEdtTitle->get_text() ) );
+ rArgSet->Put( SfxStringItem( FID_VALID_ERRTEXT, m_xEdError->get_text() ) );
return true;
}
-IMPL_LINK_NOARG(ScTPValidationError, SelectActionHdl, ListBox&, void)
+IMPL_LINK_NOARG(ScTPValidationError, SelectActionHdl, weld::ComboBox&, void)
{
- ScValidErrorStyle eStyle = static_cast<ScValidErrorStyle>(m_pLbAction->GetSelectedEntryPos());
+ ScValidErrorStyle eStyle = static_cast<ScValidErrorStyle>(m_xLbAction->get_active());
bool bMacro = ( eStyle == SC_VALERR_MACRO );
- m_pBtnSearch->Enable( bMacro );
- m_pFtError->Enable( !bMacro );
- m_pEdError->Enable( !bMacro );
+ m_xBtnSearch->set_sensitive( bMacro );
+ m_xFtError->set_sensitive( !bMacro );
+ m_xEdError->set_sensitive( !bMacro );
}
-IMPL_LINK_NOARG(ScTPValidationError, ClickSearchHdl, Button*, void)
+IMPL_LINK_NOARG(ScTPValidationError, ClickSearchHdl, weld::Button&, void)
{
// Use static SfxApplication method to bring up selector dialog for
// choosing a script
@@ -848,7 +835,7 @@ IMPL_LINK_NOARG(ScTPValidationError, ClickSearchHdl, Button*, void)
if ( !aScriptURL.isEmpty() )
{
- m_pEdtTitle->SetText( aScriptURL );
+ m_xEdtTitle->set_text( aScriptURL );
}
}
diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx
index 45917c08b7ca..bb9d262ee968 100644
--- a/sc/source/ui/inc/validate.hxx
+++ b/sc/source/ui/inc/validate.hxx
@@ -279,23 +279,22 @@ public:
class ScTPValidationError : public SfxTabPage
{
private:
- VclPtr<TriStateBox> m_pTsbShow;
- VclPtr<ListBox> m_pLbAction;
- VclPtr<PushButton> m_pBtnSearch;
- VclPtr<Edit> m_pEdtTitle;
- VclPtr<FixedText> m_pFtError;
- VclPtr<VclMultiLineEdit> m_pEdError;
+ std::unique_ptr<weld::CheckButton> m_xTsbShow;
+ std::unique_ptr<weld::ComboBox> m_xLbAction;
+ std::unique_ptr<weld::Button> m_xBtnSearch;
+ std::unique_ptr<weld::Entry> m_xEdtTitle;
+ std::unique_ptr<weld::Label> m_xFtError;
+ std::unique_ptr<weld::TextView> m_xEdError;
void Init();
// Handler ------------------------
- DECL_LINK(SelectActionHdl, ListBox&, void);
- DECL_LINK(ClickSearchHdl, Button*, void);
+ DECL_LINK(SelectActionHdl, weld::ComboBox&, void);
+ DECL_LINK(ClickSearchHdl, weld::Button&, void);
public:
- ScTPValidationError( vcl::Window* pParent, const SfxItemSet& rArgSet );
- virtual ~ScTPValidationError() override;
- virtual void dispose() override;
+ ScTPValidationError(TabPageParent pParent, const SfxItemSet& rArgSet);
+ virtual ~ScTPValidationError() override;
static VclPtr<SfxTabPage> Create ( TabPageParent pParent, const SfxItemSet* rArgSet );
virtual bool FillItemSet ( SfxItemSet* rArgSet ) override;