cui/uiconfig/ui/insertoleobject.ui | 15 +++ cui/uiconfig/ui/insertrowcolumn.ui | 11 ++ cui/uiconfig/ui/zoomdialog.ui | 34 ++++++- sw/uiconfig/swriter/ui/insertbreak.ui | 3 vcl/inc/vcl/button.hxx | 3 vcl/source/control/button.cxx | 58 +++++++++---- vcl/source/window/dlgctrl.cxx | 150 +++++++++++++++++++++++++++------- 7 files changed, 220 insertions(+), 54 deletions(-)
New commits: commit df0cef5bc7b15c40caa9b3224d5f033063856afb Author: Caolán McNamara <caol...@redhat.com> Date: Thu Nov 22 17:14:23 2012 +0000 make left-right traverse through radiobutton groups lets preserve the traversal order from the initial grouping order, so convert the radio group set to a vector Change-Id: If057f0c5d5f2eac2e8866a8a39efde8035c4fc4a diff --git a/cui/uiconfig/ui/insertoleobject.ui b/cui/uiconfig/ui/insertoleobject.ui index dc5debd..2d6e5b2 100644 --- a/cui/uiconfig/ui/insertoleobject.ui +++ b/cui/uiconfig/ui/insertoleobject.ui @@ -25,9 +25,11 @@ <child> <object class="GtkRadioButton" id="createnew"> <property name="label" translatable="yes">Create new</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> <property name="group">createfromfile</property> @@ -41,12 +43,15 @@ <child> <object class="GtkRadioButton" id="createfromfile"> <property name="label" translatable="yes">Create from file</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> + <property name="group">createnew</property> </object> <packing> <property name="expand">False</property> @@ -132,10 +137,12 @@ <child> <object class="GtkButton" id="urlbtn"> <property name="label" translatable="yes">Search ...</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="halign">end</property> + <property name="use_action_appearance">False</property> </object> <packing> <property name="left_attach">1</property> @@ -147,9 +154,11 @@ <child> <object class="GtkCheckButton" id="linktofile"> <property name="label" translatable="yes">Link to file</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> </object> @@ -196,11 +205,13 @@ <child> <object class="GtkButton" id="ok"> <property name="label">gtk-ok</property> + <property name="use_action_appearance">False</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_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -212,9 +223,11 @@ <child> <object class="GtkButton" id="cancel"> <property name="label">gtk-cancel</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -226,9 +239,11 @@ <child> <object class="GtkButton" id="help"> <property name="label">gtk-help</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> diff --git a/cui/uiconfig/ui/insertrowcolumn.ui b/cui/uiconfig/ui/insertrowcolumn.ui index f89ecc3..c188f60 100644 --- a/cui/uiconfig/ui/insertrowcolumn.ui +++ b/cui/uiconfig/ui/insertrowcolumn.ui @@ -25,11 +25,13 @@ <child> <object class="GtkButton" id="ok"> <property name="label">gtk-ok</property> + <property name="use_action_appearance">False</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_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -41,9 +43,11 @@ <child> <object class="GtkButton" id="cancel"> <property name="label">gtk-cancel</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -55,9 +59,11 @@ <child> <object class="GtkButton" id="help"> <property name="label">gtk-help</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -169,13 +175,16 @@ <child> <object class="GtkRadioButton" id="insert_before"> <property name="label" translatable="yes">_Before</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> + <property name="group">insert_after</property> </object> <packing> <property name="left_attach">0</property> @@ -187,9 +196,11 @@ <child> <object class="GtkRadioButton" id="insert_after"> <property name="label" translatable="yes">A_fter</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> diff --git a/cui/uiconfig/ui/zoomdialog.ui b/cui/uiconfig/ui/zoomdialog.ui index c0de1d1..ad70428 100644 --- a/cui/uiconfig/ui/zoomdialog.ui +++ b/cui/uiconfig/ui/zoomdialog.ui @@ -24,10 +24,12 @@ <child> <object class="GtkButton" id="ok"> <property name="label">gtk-ok</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_default">True</property> <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -39,9 +41,11 @@ <child> <object class="GtkButton" id="cancel"> <property name="label">gtk-cancel</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -53,9 +57,11 @@ <child> <object class="GtkButton" id="help"> <property name="label">gtk-help</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -96,12 +102,15 @@ <child> <object class="GtkRadioButton" id="optimal"> <property name="label" translatable="yes">Optimal</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> + <property name="group">fitwandh</property> </object> <packing> <property name="expand">False</property> @@ -112,13 +121,15 @@ <child> <object class="GtkRadioButton" id="fitwandh"> <property name="label" translatable="yes">Fit width and height</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">optimal</property> + <property name="group">fitw</property> </object> <packing> <property name="expand">False</property> @@ -129,13 +140,15 @@ <child> <object class="GtkRadioButton" id="fitw"> <property name="label" translatable="yes">Fit width</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">optimal</property> + <property name="group">100pc</property> </object> <packing> <property name="expand">False</property> @@ -146,13 +159,15 @@ <child> <object class="GtkRadioButton" id="100pc"> <property name="label" translatable="yes">100%</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">optimal</property> + <property name="group">variable</property> </object> <packing> <property name="expand">False</property> @@ -168,9 +183,11 @@ <child> <object class="GtkRadioButton" id="variable"> <property name="label" translatable="yes">Variable</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> @@ -241,12 +258,15 @@ <child> <object class="GtkRadioButton" id="automatic"> <property name="label" translatable="yes">Automatic</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> + <property name="group">singlepage</property> </object> <packing> <property name="expand">False</property> @@ -257,13 +277,15 @@ <child> <object class="GtkRadioButton" id="singlepage"> <property name="label" translatable="yes">Single page</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">automatic</property> + <property name="group">columns</property> </object> <packing> <property name="expand">False</property> @@ -279,9 +301,11 @@ <child> <object class="GtkRadioButton" id="columns"> <property name="label" translatable="yes">Columns</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> @@ -321,9 +345,11 @@ <child> <object class="GtkCheckButton" id="bookmode"> <property name="label" translatable="yes">Book mode</property> + <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> </object> diff --git a/sw/uiconfig/swriter/ui/insertbreak.ui b/sw/uiconfig/swriter/ui/insertbreak.ui index 48c19de..f697468 100644 --- a/sw/uiconfig/swriter/ui/insertbreak.ui +++ b/sw/uiconfig/swriter/ui/insertbreak.ui @@ -118,6 +118,7 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> + <property name="group">columnrb</property> </object> <packing> <property name="expand">False</property> @@ -136,7 +137,7 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">linerb</property> + <property name="group">pagerb</property> </object> <packing> <property name="expand">False</property> diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 3294f5a..3d6c239 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -28,7 +28,6 @@ #include <vcl/bitmap.hxx> #include <vcl/salnativewidgets.hxx> -#include <set> #include <vector> class UserDrawEvent; @@ -282,7 +281,7 @@ public: class VCL_DLLPUBLIC RadioButton : public Button { private: - boost::shared_ptr< std::set<RadioButton*> > m_xGroup; + boost::shared_ptr< std::vector<RadioButton*> > m_xGroup; Rectangle maStateRect; Rectangle maMouseRect; Image maImage; diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index b71ca99..2410ba3 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2354,23 +2354,39 @@ void RadioButton::ImplDrawRadioButton( bool bLayout ) void RadioButton::group(RadioButton &rOther) { + if (&rOther == this) + return; + if (!m_xGroup) { - m_xGroup.reset(new std::set<RadioButton*>); - m_xGroup->insert(this); + m_xGroup.reset(new std::vector<RadioButton*>); + m_xGroup->push_back(this); } - if (rOther.m_xGroup) - m_xGroup->insert(rOther.m_xGroup->begin(), rOther.m_xGroup->end()); + std::vector<RadioButton*>::iterator aFind = std::find(m_xGroup->begin(), m_xGroup->end(), &rOther); + if (aFind == m_xGroup->end()) + { + m_xGroup->push_back(&rOther); - m_xGroup->insert(&rOther); + if (rOther.m_xGroup) + { + std::vector< RadioButton* > aOthers(rOther.GetRadioButtonGroup(false)); + //make all members of the group share the same button group + for (std::vector<RadioButton*>::iterator aI = aOthers.begin(), aEnd = aOthers.end(); aI != aEnd; ++aI) + { + aFind = std::find(m_xGroup->begin(), m_xGroup->end(), *aI); + if (aFind == m_xGroup->end()) + m_xGroup->push_back(*aI); + } + } - //make all members of the group share the same button group - for (std::set<RadioButton*>::iterator aI = m_xGroup->begin(), aEnd = m_xGroup->end(); - aI != aEnd; ++aI) - { - RadioButton* pButton = *aI; - pButton->m_xGroup = m_xGroup; + //make all members of the group share the same button group + for (std::vector<RadioButton*>::iterator aI = m_xGroup->begin(), aEnd = m_xGroup->end(); + aI != aEnd; ++aI) + { + RadioButton* pButton = *aI; + pButton->m_xGroup = m_xGroup; + } } //if this one is checked, uncheck all the others @@ -2382,14 +2398,15 @@ void RadioButton::group(RadioButton &rOther) std::vector< RadioButton* > RadioButton::GetRadioButtonGroup(bool bIncludeThis) const { - std::vector< RadioButton* > aGroup; - if (m_xGroup) { - for (std::set<RadioButton*>::iterator aI = m_xGroup->begin(), aEnd = m_xGroup->end(); aI != aEnd; ++aI) + if (bIncludeThis) + return *m_xGroup; + std::vector< RadioButton* > aGroup; + for (std::vector<RadioButton*>::iterator aI = m_xGroup->begin(), aEnd = m_xGroup->end(); aI != aEnd; ++aI) { RadioButton *pRadioButton = *aI; - if (!bIncludeThis && pRadioButton == this) + if (pRadioButton == this) continue; aGroup.push_back(pRadioButton); } @@ -2409,6 +2426,7 @@ std::vector< RadioButton* > RadioButton::GetRadioButtonGroup(bool bIncludeThis) else break; } + std::vector< RadioButton* > aGroup; // insert radiobuttons up to next group do { @@ -2519,8 +2537,9 @@ void RadioButton::take_properties(Window &rOther) RadioButton &rOtherRadio = static_cast<RadioButton&>(rOther); if (rOtherRadio.m_xGroup.get()) { - rOtherRadio.m_xGroup->erase(&rOtherRadio); - rOtherRadio.m_xGroup->insert(this); + rOtherRadio.m_xGroup->erase(std::remove(rOtherRadio.m_xGroup->begin(), rOtherRadio.m_xGroup->end(), &rOtherRadio), + rOtherRadio.m_xGroup->end()); + rOtherRadio.m_xGroup->push_back(this); } std::swap(m_xGroup, rOtherRadio.m_xGroup); mbChecked = rOtherRadio.mbChecked; @@ -2546,7 +2565,10 @@ void RadioButton::ImplLoadRes( const ResId& rResId ) RadioButton::~RadioButton() { if (m_xGroup) - m_xGroup->erase(this); + { + m_xGroup->erase(std::remove(m_xGroup->begin(), m_xGroup->end(), this), + m_xGroup->end()); + } } // ----------------------------------------------------------------------- diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 26f7300..0ff589b 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -526,6 +526,89 @@ void Window::ImplControlFocus( sal_uInt16 nFlags ) // ----------------------------------------------------------------------- +namespace +{ + bool isSuitableDestination(Window *pWindow) + { + return (pWindow && isVisibleInLayout(pWindow) && isEnabledInLayout(pWindow) && pWindow->IsInputEnabled()); + } + + bool backInGroup(std::vector<RadioButton*>::reverse_iterator aRevStart, std::vector<RadioButton*> &rGroup) + { + std::vector<RadioButton*>::reverse_iterator aI(aRevStart); + while (aI != rGroup.rend()) + { + Window *pWindow = *aI; + + if (isSuitableDestination(pWindow)) + { + pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); + return true; + } + } + + aI = rGroup.rbegin(); + while (aI != aRevStart) + { + Window *pWindow = *aI; + + if (isSuitableDestination(pWindow)) + { + pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); + return true; + } + } + + return false; + } + + bool forwardInGroup(std::vector<RadioButton*>::iterator aStart, std::vector<RadioButton*> &rGroup) + { + std::vector<RadioButton*>::iterator aI(aStart); + while (++aI != rGroup.end()) + { + Window *pWindow = *aI; + + if (isSuitableDestination(pWindow)) + { + pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_FORWARD ); + return true; + } + } + + aI = rGroup.begin(); + while (aI != aStart) + { + Window *pWindow = *aI; + + if (isSuitableDestination(pWindow)) + { + pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_FORWARD ); + return true; + } + } + + return false; + } + + bool nextInGroup(RadioButton *pSourceWindow, bool bBackward) + { + std::vector<RadioButton*> aGroup(pSourceWindow->GetRadioButtonGroup(true)); + + if (aGroup.size() == 1) //only one button in group + return false; + + std::vector<RadioButton*>::iterator aStart(std::find(aGroup.begin(), aGroup.end(), pSourceWindow)); + + assert(aStart != aGroup.end()); + + if (bBackward) + return backInGroup(std::vector<RadioButton*>::reverse_iterator(aStart), aGroup); + else + return forwardInGroup(aStart, aGroup); + } +} + sal_Bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput ) { KeyCode aKeyCode = rKEvt.GetKeyCode(); @@ -796,50 +879,59 @@ sal_Bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput ) } else if ( (nKeyCode == KEY_LEFT) || (nKeyCode == KEY_UP) ) { - Window* pWindow = pSWindow; - WinBits nStyle = pSWindow->GetStyle(); - if ( !(nStyle & WB_GROUP) ) + if (pSWindow->GetType() == WINDOW_RADIOBUTTON) + return nextInGroup(static_cast<RadioButton*>(pSWindow), true); + else { - pWindow = prevLogicalChildOfParent(this, pWindow); - while ( pWindow ) + WinBits nStyle = pSWindow->GetStyle(); + if ( !(nStyle & WB_GROUP) ) { - pWindow = pWindow->ImplGetWindow(); + Window* pWindow = prevLogicalChildOfParent(this, pSWindow); + while ( pWindow ) + { + pWindow = pWindow->ImplGetWindow(); - nStyle = pWindow->GetStyle(); + nStyle = pWindow->GetStyle(); - if ( isVisibleInLayout(pWindow) && isEnabledInLayout(pWindow) && pWindow->IsInputEnabled() ) - { - if ( pWindow != pSWindow ) - pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); - return sal_True; - } + if ( isVisibleInLayout(pWindow) && isEnabledInLayout(pWindow) && pWindow->IsInputEnabled() ) + { + if ( pWindow != pSWindow ) + pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); + return sal_True; + } - if ( nStyle & WB_GROUP ) - break; + if ( nStyle & WB_GROUP ) + break; - pWindow = prevLogicalChildOfParent(this, pWindow); + pWindow = prevLogicalChildOfParent(this, pWindow); + } } } } else if ( (nKeyCode == KEY_RIGHT) || (nKeyCode == KEY_DOWN) ) { - Window* pWindow = nextLogicalChildOfParent(this, pSWindow); - while ( pWindow ) + if (pSWindow->GetType() == WINDOW_RADIOBUTTON) + return nextInGroup(static_cast<RadioButton*>(pSWindow), false); + else { - pWindow = pWindow->ImplGetWindow(); + Window* pWindow = nextLogicalChildOfParent(this, pSWindow); + while ( pWindow ) + { + pWindow = pWindow->ImplGetWindow(); - WinBits nStyle = pWindow->GetStyle(); + WinBits nStyle = pWindow->GetStyle(); - if ( nStyle & WB_GROUP ) - break; + if ( nStyle & WB_GROUP ) + break; - if ( isVisibleInLayout(pWindow) && isEnabledInLayout(pWindow) && pWindow->IsInputEnabled() ) - { - pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); - return sal_True; - } + if (isSuitableDestination(pWindow)) + { + pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); + return sal_True; + } - pWindow = nextLogicalChildOfParent(this, pWindow); + pWindow = nextLogicalChildOfParent(this, pWindow); + } } } else @@ -860,7 +952,7 @@ sal_Bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput ) } } - if ( pButtonWindow && isVisibleInLayout(pButtonWindow) && isEnabledInLayout(pButtonWindow) && pButtonWindow->IsInputEnabled() ) + if (isSuitableDestination(pButtonWindow)) { if ( bKeyInput ) {
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits