summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-07 19:42:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-08 10:13:52 +0200
commit59dd8fe17e970743e45edf687ab8751ab7f21b1f (patch)
treefd98e4742f907613ea40ae59b4c7538c3b6cd7a4
parentcac00eeb8ca32e931efb9b245643bff815e84bb9 (diff)
weld ScTPValidationHelp
Change-Id: I7bf8219bfef8f6e7d765b2a9f1240f364418cbc2 Reviewed-on: https://gerrit.libreoffice.org/61500 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/ui/dbgui/validate.cxx55
-rw-r--r--sc/source/ui/inc/validate.hxx13
-rw-r--r--sc/uiconfig/scalc/ui/validationhelptabpage.ui22
3 files changed, 32 insertions, 58 deletions
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index 78d2c154c319..937b081172fb 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -691,19 +691,13 @@ IMPL_LINK_NOARG(ScTPValidationValue, CheckHdl, Button*, void)
// Input Help Page
-ScTPValidationHelp::ScTPValidationHelp( vcl::Window* pParent,
- const SfxItemSet& rArgSet )
-
- : SfxTabPage ( pParent,
- "ValidationHelpTabPage" , "modules/scalc/ui/validationhelptabpage.ui" ,
- &rArgSet )
+ScTPValidationHelp::ScTPValidationHelp(TabPageParent pParent, const SfxItemSet& rArgSet)
+ : SfxTabPage(pParent, "modules/scalc/ui/validationhelptabpage.ui", "ValidationHelpTabPage", &rArgSet)
+ , m_xTsbHelp(m_xBuilder->weld_check_button("tsbhelp"))
+ , m_xEdtTitle(m_xBuilder->weld_entry("title"))
+ , m_xEdInputHelp(m_xBuilder->weld_text_view("inputhelp"))
{
- get(pTsbHelp,"tsbhelp");
- get(pEdtTitle,"title");
- get(pEdInputHelp,"inputhelp");
- pEdInputHelp->set_height_request(pEdInputHelp->GetTextHeight() * 12);
- pEdInputHelp->set_width_request(pEdInputHelp->approximate_char_width() * 50);
- Init();
+ m_xEdInputHelp->set_size_request(m_xEdInputHelp->get_approximate_digit_width() * 40, m_xEdInputHelp->get_height_rows(13));
}
ScTPValidationHelp::~ScTPValidationHelp()
@@ -711,23 +705,10 @@ ScTPValidationHelp::~ScTPValidationHelp()
disposeOnce();
}
-void ScTPValidationHelp::dispose()
-{
- pTsbHelp.clear();
- pEdtTitle.clear();
- pEdInputHelp.clear();
- SfxTabPage::dispose();
-}
-
-void ScTPValidationHelp::Init()
-{
- pTsbHelp->EnableTriState( false );
-}
-
-VclPtr<SfxTabPage> ScTPValidationHelp::Create( TabPageParent pParent,
- const SfxItemSet* rArgSet )
+VclPtr<SfxTabPage> ScTPValidationHelp::Create(TabPageParent pParent,
+ const SfxItemSet* rArgSet)
{
- return VclPtr<ScTPValidationHelp>::Create( pParent.pParent, *rArgSet );
+ return VclPtr<ScTPValidationHelp>::Create(pParent, *rArgSet);
}
void ScTPValidationHelp::Reset( const SfxItemSet* rArgSet )
@@ -735,26 +716,26 @@ void ScTPValidationHelp::Reset( const SfxItemSet* rArgSet )
const SfxPoolItem* pItem;
if ( rArgSet->GetItemState( FID_VALID_SHOWHELP, true, &pItem ) == SfxItemState::SET )
- pTsbHelp->SetState( static_cast<const SfxBoolItem*>(pItem)->GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
+ m_xTsbHelp->set_state( static_cast<const SfxBoolItem*>(pItem)->GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
else
- pTsbHelp->SetState( TRISTATE_FALSE );
+ m_xTsbHelp->set_state( TRISTATE_FALSE );
if ( rArgSet->GetItemState( FID_VALID_HELPTITLE, true, &pItem ) == SfxItemState::SET )
- pEdtTitle->SetText( static_cast<const SfxStringItem*>(pItem)->GetValue() );
+ m_xEdtTitle->set_text( static_cast<const SfxStringItem*>(pItem)->GetValue() );
else
- pEdtTitle->SetText( EMPTY_OUSTRING );
+ m_xEdtTitle->set_text( EMPTY_OUSTRING );
if ( rArgSet->GetItemState( FID_VALID_HELPTEXT, true, &pItem ) == SfxItemState::SET )
- pEdInputHelp->SetText( static_cast<const SfxStringItem*>(pItem)->GetValue() );
+ m_xEdInputHelp->set_text( static_cast<const SfxStringItem*>(pItem)->GetValue() );
else
- pEdInputHelp->SetText( EMPTY_OUSTRING );
+ m_xEdInputHelp->set_text( EMPTY_OUSTRING );
}
bool ScTPValidationHelp::FillItemSet( SfxItemSet* rArgSet )
{
- rArgSet->Put( SfxBoolItem( FID_VALID_SHOWHELP, pTsbHelp->GetState() == TRISTATE_TRUE ) );
- rArgSet->Put( SfxStringItem( FID_VALID_HELPTITLE, pEdtTitle->GetText() ) );
- rArgSet->Put( SfxStringItem( FID_VALID_HELPTEXT, pEdInputHelp->GetText() ) );
+ rArgSet->Put( SfxBoolItem( FID_VALID_SHOWHELP, m_xTsbHelp->get_state() == TRISTATE_TRUE ) );
+ rArgSet->Put( SfxStringItem( FID_VALID_HELPTITLE, m_xEdtTitle->get_text() ) );
+ rArgSet->Put( SfxStringItem( FID_VALID_HELPTEXT, m_xEdInputHelp->get_text() ) );
return true;
}
diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx
index b32aad732baf..45917c08b7ca 100644
--- a/sc/source/ui/inc/validate.hxx
+++ b/sc/source/ui/inc/validate.hxx
@@ -261,18 +261,17 @@ public:
class ScTPValidationHelp : public SfxTabPage
{
private:
- VclPtr<TriStateBox> pTsbHelp;
- VclPtr<Edit> pEdtTitle;
- VclPtr<VclMultiLineEdit> pEdInputHelp;
+ std::unique_ptr<weld::CheckButton> m_xTsbHelp;
+ std::unique_ptr<weld::Entry> m_xEdtTitle;
+ std::unique_ptr<weld::TextView> m_xEdInputHelp;
void Init();
public:
- ScTPValidationHelp( vcl::Window* pParent, const SfxItemSet& rArgSet );
- virtual ~ScTPValidationHelp() override;
- virtual void dispose() override;
+ ScTPValidationHelp(TabPageParent pParent, const SfxItemSet& rArgSet);
+ virtual ~ScTPValidationHelp() override;
- static VclPtr<SfxTabPage> Create ( TabPageParent pParent, const SfxItemSet* rArgSet );
+ static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rArgSet);
virtual bool FillItemSet ( SfxItemSet* rArgSet ) override;
virtual void Reset ( const SfxItemSet* rArgSet ) override;
};
diff --git a/sc/uiconfig/scalc/ui/validationhelptabpage.ui b/sc/uiconfig/scalc/ui/validationhelptabpage.ui
index 8a62990b116e..48c1755a8000 100644
--- a/sc/uiconfig/scalc/ui/validationhelptabpage.ui
+++ b/sc/uiconfig/scalc/ui/validationhelptabpage.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
<interface domain="sc">
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.18"/>
<object class="GtkBox" id="ValidationHelpTabPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -56,45 +57,40 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">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="GtkLabel" id="title_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="validationhelptabpage|title_label">_Title:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">title</property>
+ <property name="xalign">0</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="GtkLabel" id="inputhelp_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
<property name="label" translatable="yes" context="validationhelptabpage|inputhelp_label">_Input help:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">inputhelp:border</property>
+ <property name="mnemonic_widget">inputhelp</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
</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>
@@ -105,7 +101,7 @@
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTextView" id="inputhelp:border">
+ <object class="GtkTextView" id="inputhelp">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
@@ -116,8 +112,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>