summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-05-20 15:36:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-05-21 10:49:40 +0200
commitd16ceda55b145cb31882bbf504924aa9103278aa (patch)
treeb75d59c682b6083660d01e33f1a9e673c6f30731 /sw
parente8578423e9390a07419066d6c350c34fa254095d (diff)
use toggle instead of click for RadioButton
Change-Id: Ic246c68749f79cc1b25fed08a66fd8a0d57495f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115884 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx26
-rw-r--r--sw/source/ui/misc/docfnote.cxx61
-rw-r--r--sw/source/ui/misc/impfnote.hxx3
-rw-r--r--sw/source/ui/misc/insfnote.cxx23
-rw-r--r--sw/source/ui/table/convert.cxx16
-rw-r--r--sw/source/uibase/inc/convert.hxx2
-rw-r--r--sw/source/uibase/inc/dbinsdlg.hxx4
-rw-r--r--sw/source/uibase/inc/insfnote.hxx3
8 files changed, 77 insertions, 61 deletions
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 1f19a0884273..b9047f92201d 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -322,8 +322,8 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
// when the cursor is inside of a table, table must NEVER be selectable
if( pView->GetWrtShell().GetTableFormat() )
{
- m_xRbAsTable->set_sensitive( false );
m_xRbAsField->set_active(true);
+ m_xRbAsTable->set_sensitive(false);
m_xRbDbFormatFromDb->set_active(true);
}
else
@@ -338,12 +338,12 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
m_xRbHeadlColnms->set_active(true);
m_xRbHeadlEmpty->set_active(false);
- m_xRbAsTable->connect_clicked( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
- m_xRbAsField->connect_clicked( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
- m_xRbAsText->connect_clicked( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
+ m_xRbAsTable->connect_toggled( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
+ m_xRbAsField->connect_toggled( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
+ m_xRbAsText->connect_toggled( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
- m_xRbDbFormatFromDb->connect_clicked( LINK(this, SwInsertDBColAutoPilot, DBFormatHdl ));
- m_xRbDbFormatFromUsr->connect_clicked( LINK(this, SwInsertDBColAutoPilot, DBFormatHdl ));
+ m_xRbDbFormatFromDb->connect_toggled( LINK(this, SwInsertDBColAutoPilot, DBFormatHdl ));
+ m_xRbDbFormatFromUsr->connect_toggled( LINK(this, SwInsertDBColAutoPilot, DBFormatHdl ));
m_xPbTableFormat->connect_clicked(LINK(this, SwInsertDBColAutoPilot, TableFormatHdl ));
m_xPbTableAutofmt->connect_clicked(LINK(this, SwInsertDBColAutoPilot, AutoFormatHdl ));
@@ -387,9 +387,12 @@ SwInsertDBColAutoPilot::~SwInsertDBColAutoPilot()
{
}
-IMPL_LINK( SwInsertDBColAutoPilot, PageHdl, weld::Button&, rButton, void )
+IMPL_LINK( SwInsertDBColAutoPilot, PageHdl, weld::ToggleButton&, rButton, void )
{
- bool bShowTable = &rButton == m_xRbAsTable.get();
+ if (!rButton.get_active())
+ return;
+
+ bool bShowTable = m_xRbAsTable->get_active();
m_xHeadFrame->set_label(MnemonicGenerator::EraseAllMnemonicChars(rButton.get_label().replace('_', '~')));
@@ -418,8 +421,11 @@ IMPL_LINK( SwInsertDBColAutoPilot, PageHdl, weld::Button&, rButton, void )
TVSelectHdl( bShowTable ? *m_xLbTableDbColumn : *m_xLbTextDbColumn );
}
-IMPL_LINK( SwInsertDBColAutoPilot, DBFormatHdl, weld::Button&, rButton, void )
+IMPL_LINK( SwInsertDBColAutoPilot, DBFormatHdl, weld::ToggleButton&, rButton, void )
{
+ if (!rButton.get_active())
+ return;
+
weld::TreeView& rBox = m_xRbAsTable->get_active()
? ( m_xLbTableCol->get_id(0).isEmpty()
? *m_xLbTableDbColumn
@@ -429,7 +435,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, DBFormatHdl, weld::Button&, rButton, void )
SwInsDBColumn aSrch(rBox.get_selected_text());
SwInsDBColumns::const_iterator it = aDBColumns.find( &aSrch );
- bool bFromDB = m_xRbDbFormatFromDb.get() == &rButton;
+ bool bFromDB = m_xRbDbFormatFromDb->get_active();
(*it)->bIsDBFormat = bFromDB;
m_xLbDbFormatFromUsr->set_sensitive( !bFromDB );
}
diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx
index c6b1eb0c40ec..af45f76e9bbe 100644
--- a/sw/source/ui/misc/docfnote.cxx
+++ b/sw/source/ui/misc/docfnote.cxx
@@ -98,8 +98,8 @@ SwEndNoteOptionPage::SwEndNoteOptionPage(weld::Container* pPage, weld::DialogCon
aNumDoc = m_xNumCountBox->get_text(FTNNUM_DOC);
aNumPage = m_xNumCountBox->get_text(FTNNUM_PAGE);
aNumChapter = m_xNumCountBox->get_text(FTNNUM_CHAPTER);
- m_xPosPageBox->connect_clicked(LINK(this, SwEndNoteOptionPage, PosPageHdl));
- m_xPosChapterBox->connect_clicked(LINK(this, SwEndNoteOptionPage, PosChapterHdl));
+ m_xPosPageBox->connect_toggled(LINK(this, SwEndNoteOptionPage, ToggleHdl));
+ m_xPosChapterBox->connect_toggled(LINK(this, SwEndNoteOptionPage, ToggleHdl));
}
m_xParaTemplBox->make_sorted();
}
@@ -257,20 +257,41 @@ void SwEndNoteOptionPage::SetShell( SwWrtShell &rShell )
pSh->GetView().GetDocShell(), true);
}
-// Handler behind the button to collect the footnote at the page. In this case
-// all kinds of numbering can be used.
-IMPL_LINK_NOARG(SwEndNoteOptionPage, PosPageHdl, weld::Button&, void)
+IMPL_LINK(SwEndNoteOptionPage, ToggleHdl, weld::ToggleButton&, rButton, void)
{
- const SwFootnoteNum eNum = GetNumbering();
- bPosDoc = false;
- if (m_xNumCountBox->find_text(aNumPage) == -1)
+ if (!rButton.get_active())
+ return;
+
+ if (m_xPosPageBox->get_active())
+ {
+ // Handler behind the button to collect the footnote at the page. In this case
+ // all kinds of numbering can be used.
+
+ const SwFootnoteNum eNum = GetNumbering();
+ bPosDoc = false;
+ if (m_xNumCountBox->find_text(aNumPage) == -1)
+ {
+ m_xNumCountBox->insert_text(FTNNUM_PAGE, aNumPage);
+ m_xNumCountBox->insert_text(FTNNUM_CHAPTER, aNumChapter);
+ SelectNumbering(eNum);
+ }
+ m_xPageTemplLbl->set_sensitive(false);
+ m_xPageTemplBox->set_sensitive(false);
+ }
+ else if (m_xPosChapterBox->get_active())
{
- m_xNumCountBox->insert_text(FTNNUM_PAGE, aNumPage);
- m_xNumCountBox->insert_text(FTNNUM_CHAPTER, aNumChapter);
- SelectNumbering(eNum);
+ // Handler behind the button to collect the footnote at the chapter or end of
+ // the document. In this case no pagewise numbering can be used.
+
+ if ( !bPosDoc )
+ SelectNumbering(FTNNUM_DOC);
+
+ bPosDoc = true;
+ m_xNumCountBox->remove_text(aNumPage);
+ m_xNumCountBox->remove_text(aNumChapter);
+ m_xPageTemplLbl->set_sensitive(true);
+ m_xPageTemplBox->set_sensitive(true);
}
- m_xPageTemplLbl->set_sensitive(false);
- m_xPageTemplBox->set_sensitive(false);
}
IMPL_LINK_NOARG(SwEndNoteOptionPage, NumCountHdl, weld::ComboBox&, void)
@@ -285,20 +306,6 @@ IMPL_LINK_NOARG(SwEndNoteOptionPage, NumCountHdl, weld::ComboBox&, void)
m_xOffsetField->set_sensitive(bEnable);
}
-// Handler behind the button to collect the footnote at the chapter or end of
-// the document. In this case no pagewise numbering can be used.
-IMPL_LINK_NOARG(SwEndNoteOptionPage, PosChapterHdl, weld::Button&, void)
-{
- if ( !bPosDoc )
- SelectNumbering(FTNNUM_DOC);
-
- bPosDoc = true;
- m_xNumCountBox->remove_text(aNumPage);
- m_xNumCountBox->remove_text(aNumChapter);
- m_xPageTemplLbl->set_sensitive(true);
- m_xPageTemplBox->set_sensitive(true);
-}
-
static SwCharFormat* lcl_GetCharFormat( SwWrtShell* pSh, const OUString& rCharFormatName )
{
SwCharFormat* pFormat = nullptr;
diff --git a/sw/source/ui/misc/impfnote.hxx b/sw/source/ui/misc/impfnote.hxx
index 8984c566fe26..7b32c6677686 100644
--- a/sw/source/ui/misc/impfnote.hxx
+++ b/sw/source/ui/misc/impfnote.hxx
@@ -56,8 +56,7 @@ class SwEndNoteOptionPage : public SfxTabPage
inline void SelectNumbering(SwFootnoteNum eNum);
SwFootnoteNum GetNumbering() const;
- DECL_LINK(PosPageHdl, weld::Button&, void);
- DECL_LINK(PosChapterHdl, weld::Button&, void);
+ DECL_LINK(ToggleHdl, weld::ToggleButton&, void);
DECL_LINK(NumCountHdl, weld::ComboBox&, void);
public:
diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx
index 8b6abea48f8a..ec3efba6bd32 100644
--- a/sw/source/ui/misc/insfnote.cxx
+++ b/sw/source/ui/misc/insfnote.cxx
@@ -68,21 +68,24 @@ void SwInsFootNoteDlg::Apply()
bFootnote = m_xFootnoteBtn->get_active();
}
-IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberCharHdl, weld::Button&, void)
-{
- m_xNumberCharEdit->grab_focus();
- m_xOkBtn->set_sensitive( !m_xNumberCharEdit->get_text().isEmpty() || m_bExtCharAvailable );
-}
-
IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberEditHdl, weld::Entry&, void)
{
m_xNumberCharBtn->set_active(true);
m_xOkBtn->set_sensitive( !m_xNumberCharEdit->get_text().isEmpty() );
}
-IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberAutoBtnHdl, weld::Button&, void)
+IMPL_LINK(SwInsFootNoteDlg, NumberToggleHdl, weld::ToggleButton&, rButton, void)
{
- m_xOkBtn->set_sensitive(true);
+ if (!rButton.get_active())
+ return;
+
+ if (m_xNumberAutoBtn->get_active())
+ m_xOkBtn->set_sensitive(true);
+ else if (m_xNumberCharBtn->get_active())
+ {
+ m_xNumberCharEdit->grab_focus();
+ m_xOkBtn->set_sensitive( !m_xNumberCharEdit->get_text().isEmpty() || m_bExtCharAvailable );
+ }
}
IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberExtCharHdl, weld::Button&, void)
@@ -154,9 +157,9 @@ SwInsFootNoteDlg::SwInsFootNoteDlg(weld::Window *pParent, SwWrtShell &rShell, bo
, m_xPrevBT(m_xBuilder->weld_button("prev"))
, m_xNextBT(m_xBuilder->weld_button("next"))
{
- m_xNumberAutoBtn->connect_clicked(LINK(this,SwInsFootNoteDlg,NumberAutoBtnHdl));
+ m_xNumberAutoBtn->connect_toggled(LINK(this,SwInsFootNoteDlg,NumberToggleHdl));
+ m_xNumberCharBtn->connect_toggled(LINK(this,SwInsFootNoteDlg,NumberToggleHdl));
m_xNumberExtChar->connect_clicked(LINK(this,SwInsFootNoteDlg,NumberExtCharHdl));
- m_xNumberCharBtn->connect_clicked(LINK(this,SwInsFootNoteDlg,NumberCharHdl));
m_xNumberCharEdit->connect_changed(LINK(this,SwInsFootNoteDlg,NumberEditHdl));
m_xPrevBT->connect_clicked(LINK(this, SwInsFootNoteDlg, NextPrevHdl));
diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx
index cd0631b6dee9..cd14678bf704 100644
--- a/sw/source/ui/table/convert.cxx
+++ b/sw/source/ui/table/convert.cxx
@@ -138,11 +138,11 @@ SwConvertTableDlg::SwConvertTableDlg(SwView& rView, bool bToTable)
}
m_xKeepColumn->save_state();
- Link<weld::Button&, void> aLk(LINK(this, SwConvertTableDlg, BtnHdl));
- m_xTabBtn->connect_clicked(aLk);
- m_xSemiBtn->connect_clicked(aLk);
- m_xParaBtn->connect_clicked(aLk);
- m_xOtherBtn->connect_clicked(aLk);
+ Link<weld::ToggleButton&, void> aLk(LINK(this, SwConvertTableDlg, BtnHdl));
+ m_xTabBtn->connect_toggled(aLk);
+ m_xSemiBtn->connect_toggled(aLk);
+ m_xParaBtn->connect_toggled(aLk);
+ m_xOtherBtn->connect_toggled(aLk);
m_xOtherEd->set_sensitive(m_xOtherBtn->get_active());
const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
@@ -172,9 +172,11 @@ IMPL_LINK_NOARG(SwConvertTableDlg, AutoFormatHdl, weld::Button&, void)
mxTAutoFormat = pDlg->FillAutoFormatOfIndex();
}
-IMPL_LINK(SwConvertTableDlg, BtnHdl, weld::Button&, rButton, void)
+IMPL_LINK(SwConvertTableDlg, BtnHdl, weld::ToggleButton&, rButton, void)
{
- if (&rButton == m_xTabBtn.get())
+ if (!rButton.get_active())
+ return;
+ if (m_xTabBtn->get_active())
m_xKeepColumn->set_state(m_xKeepColumn->get_saved_state());
else
{
diff --git a/sw/source/uibase/inc/convert.hxx b/sw/source/uibase/inc/convert.hxx
index 6b1d9da1a323..19080ac7581e 100644
--- a/sw/source/uibase/inc/convert.hxx
+++ b/sw/source/uibase/inc/convert.hxx
@@ -52,7 +52,7 @@ class SwConvertTableDlg : public SfxDialogController
SwWrtShell* pShell;
DECL_LINK(AutoFormatHdl, weld::Button&, void);
- DECL_LINK(BtnHdl, weld::Button&, void);
+ DECL_LINK(BtnHdl, weld::ToggleButton&, void);
DECL_LINK(CheckBoxHdl, weld::ToggleButton&, void);
DECL_LINK(RepeatHeaderCheckBoxHdl, weld::ToggleButton&, void);
diff --git a/sw/source/uibase/inc/dbinsdlg.hxx b/sw/source/uibase/inc/dbinsdlg.hxx
index 2d3206331e2f..49d6fd9e39ea 100644
--- a/sw/source/uibase/inc/dbinsdlg.hxx
+++ b/sw/source/uibase/inc/dbinsdlg.hxx
@@ -123,10 +123,10 @@ class SwInsertDBColAutoPilot : public SfxDialogController, public utl::ConfigIte
std::unique_ptr<weld::Button> m_xPbTableFormat;
std::unique_ptr<weld::Button> m_xPbTableAutofmt;
- DECL_LINK( PageHdl, weld::Button&, void );
+ DECL_LINK( PageHdl, weld::ToggleButton&, void );
DECL_LINK( AutoFormatHdl, weld::Button&, void );
DECL_LINK( TableFormatHdl, weld::Button&, void );
- DECL_LINK( DBFormatHdl, weld::Button&, void );
+ DECL_LINK( DBFormatHdl, weld::ToggleButton&, void );
DECL_LINK( TableToFromHdl, weld::Button&, void );
DECL_LINK( TVSelectHdl, weld::TreeView&, void );
DECL_LINK( CBSelectHdl, weld::ComboBox&, void );
diff --git a/sw/source/uibase/inc/insfnote.hxx b/sw/source/uibase/inc/insfnote.hxx
index 6ea4cc339108..ac523457e343 100644
--- a/sw/source/uibase/inc/insfnote.hxx
+++ b/sw/source/uibase/inc/insfnote.hxx
@@ -49,9 +49,8 @@ class SwInsFootNoteDlg: public weld::GenericDialogController
std::unique_ptr<weld::Button> m_xPrevBT;
std::unique_ptr<weld::Button> m_xNextBT;
- DECL_LINK(NumberCharHdl, weld::Button&, void);
+ DECL_LINK(NumberToggleHdl, weld::ToggleButton&, void);
DECL_LINK(NumberEditHdl, weld::Entry&, void);
- DECL_LINK(NumberAutoBtnHdl, weld::Button&, void);
DECL_LINK(NumberExtCharHdl, weld::Button&, void);
DECL_LINK(NextPrevHdl, weld::Button&, void);