ooo-build r12562 - in trunk: . patches/dev300
- From: jonp svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r12562 - in trunk: . patches/dev300
- Date: Fri, 16 May 2008 16:45:43 +0100 (BST)
Author: jonp
Date: Fri May 16 15:45:43 2008
New Revision: 12562
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12562&view=rev
Log:
* patches/dev300/forms-radio-button-group-names.diff: Fix group creation
within Basic dialogs so that insertion order isn't considered when
creating group-name-based groups. Thus, if you create a grid of radio
buttons with Lable/Group values:
W/A X/B
Y/A Z/B
Previously, things would work find if you created the radio buttons in the
order W, Y, X, Z. If you created in the order W, X, Y, Z, then each
readio button would be given its own group, which is wrong. Now, when
created in the order W, X, Y, Z, W&Y and X&Z are properly grouped together
based on their group name.
Modified:
trunk/ChangeLog
trunk/patches/dev300/forms-radio-button-group-names.diff
Modified: trunk/patches/dev300/forms-radio-button-group-names.diff
==============================================================================
--- trunk/patches/dev300/forms-radio-button-group-names.diff (original)
+++ trunk/patches/dev300/forms-radio-button-group-names.diff Fri May 16 15:45:43 2008
@@ -572,13 +572,41 @@
0);
VCLXImageConsumer::ImplGetPropertyIds( rIds );
}
+Index: toolkit/inc/toolkit/controls/dialogcontrol.hxx
+===================================================================
+RCS file: /cvs/gsl/toolkit/inc/toolkit/controls/dialogcontrol.hxx,v
+retrieving revision 1.9
+diff -u -p -r1.9 dialogcontrol.hxx
+--- toolkit/inc/toolkit/controls/dialogcontrol.hxx 11 Apr 2008 08:52:41 -0000 1.9
++++ toolkit/inc/toolkit/controls/dialogcontrol.hxx 15 May 2008 05:25:19 -0000
+@@ -51,6 +51,7 @@
+ #include <cppuhelper/propshlp.hxx>
+ #include <cppuhelper/basemutex.hxx>
+ #include <list>
++#include <map>
+
+ // ----------------------------------------------------
+ // class UnoControlDialogModel
+@@ -182,6 +183,12 @@ protected:
+ void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
+
+ void implUpdateGroupStructure();
++private:
++ ModelGroup* AddRadioButtonToGroup (
++ const ::com::sun::star::uno::Reference< XPropertySet >& rCurProps,
++ const ::rtl::OUString& rPropertyName,
++ ::std::map< ::rtl::OUString, ModelGroup >* pNamedGroups,
++ ::rtl::OUString* pCurGroup );
+ };
+
+ // ----------------------------------------------------
Index: toolkit/source/controls/dialogcontrol.cxx
===================================================================
RCS file: /cvs/gsl/toolkit/source/controls/dialogcontrol.cxx,v
retrieving revision 1.27
diff -u -p -r1.27 dialogcontrol.cxx
--- toolkit/source/controls/dialogcontrol.cxx 11 Apr 2008 09:24:40 -0000 1.27
-+++ toolkit/source/controls/dialogcontrol.cxx 12 May 2008 06:43:30 -0000
++++ toolkit/source/controls/dialogcontrol.cxx 15 May 2008 05:25:19 -0000
@@ -142,6 +142,18 @@ namespace
return xGraphic;
}
@@ -598,17 +626,55 @@
}
// ----------------------------------------------------------------------------
-@@ -925,6 +937,9 @@ void UnoControlDialogModel::implUpdateGr
+@@ -897,6 +909,29 @@ void UnoControlDialogModel::implNotifyTa
+ }
+ }
+
++// ----------------------------------------------------------------------------
++UnoControlDialogModel::ModelGroup* UnoControlDialogModel::AddRadioButtonToGroup (
++ const Reference< XPropertySet >& rCurProps,
++ const ::rtl::OUString& rPropertyName,
++ ::std::map< ::rtl::OUString, ModelGroup >* pNamedGroups,
++ ::rtl::OUString* pCurGroup )
++{
++ *pCurGroup = lcl_GetStringProperty( rPropertyName, rCurProps );
++
++ AllGroups* pGroups;
++ if ( pCurGroup->getLength() == 0 )
++ {
++ pGroups = &maGroups;
++ size_t nGroups = maGroups.size();
++ maGroups.resize( nGroups + 1 );
++ return &maGroups[ nGroups ];
++ }
++ else
++ {
++ ModelGroup& aCurGroup = (*pNamedGroups)[ *pCurGroup ];
++ return &aCurGroup;
++ }
++}
+
+ // ----------------------------------------------------------------------------
+ void UnoControlDialogModel::implUpdateGroupStructure()
+@@ -921,10 +956,16 @@ void UnoControlDialogModel::implUpdateGr
+
+ GroupingMachineState eState = eLookingForGroup; // the current state of our machine
+ Reference< XServiceInfo > xModelSI; // for checking for a radion button
+- AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building
++ ModelGroup* aCurrentGroup = NULL; // the group which we're currently building
sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to
sal_Bool bIsRadioButton; // is it a radio button?
+ const ::rtl::OUString GROUP_NAME (::rtl::OUString::createFromAscii( "GroupName" ) );
+ ::rtl::OUString sCurGroup;
+
++ typedef ::std::map< ::rtl::OUString, ModelGroup > NamedGroups;
++ NamedGroups aNamedGroups;
++
#if OSL_DEBUG_LEVEL > 1
::std::vector< ::rtl::OUString > aCurrentGroupLabels;
#endif
-@@ -934,6 +949,7 @@ void UnoControlDialogModel::implUpdateGr
+@@ -934,6 +975,7 @@ void UnoControlDialogModel::implUpdateGr
// we'll need this in every state
xModelSI = xModelSI.query( *pControlModels );
bIsRadioButton = xModelSI.is() && xModelSI->supportsService( ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) );
@@ -616,17 +682,26 @@
switch ( eState )
{
-@@ -950,6 +966,7 @@ void UnoControlDialogModel::implUpdateGr
- aCurrentGroup = maGroups.begin() + nGroups;
- // and add the (only, til now) member
- aCurrentGroup->push_back( *pControlModels );
-+ sCurGroup = lcl_GetStringProperty( GROUP_NAME, xCurProps );
+@@ -945,11 +987,8 @@ void UnoControlDialogModel::implUpdateGr
+ // the current model is a radio button
+ // -> we found the beginning of a new group
+ // create the place for this group
+- size_t nGroups = maGroups.size();
+- maGroups.resize( nGroups + 1 );
+- aCurrentGroup = maGroups.begin() + nGroups;
+- // and add the (only, til now) member
+- aCurrentGroup->push_back( *pControlModels );
++ aCurrentGroup = AddRadioButtonToGroup( xCurProps, GROUP_NAME, &aNamedGroups, &sCurGroup );
++ aCurrentGroup->push_back( *pControlModels );
// get the step which all controls of this group now have to belong to
nCurrentGroupStep = lcl_getDialogStep( *pControlModels );
-@@ -972,16 +989,19 @@ void UnoControlDialogModel::implUpdateGr
+@@ -970,18 +1009,21 @@ void UnoControlDialogModel::implUpdateGr
+ {
+ if ( !bIsRadioButton )
{ // no radio button -> the group is done
- aCurrentGroup = maGroups.end();
+- aCurrentGroup = maGroups.end();
++ aCurrentGroup = NULL;
eState = eLookingForGroup;
+ sCurGroup = ::rtl::OUString ();
#if OSL_DEBUG_LEVEL > 1
@@ -647,14 +722,42 @@
)
{
// -> it belongs to the same group
-@@ -1014,6 +1034,7 @@ void UnoControlDialogModel::implUpdateGr
- aCurrentGroup = maGroups.begin() + nGroups;
- // and add the (only, til now) member
- aCurrentGroup->push_back( *pControlModels );
-+ sCurGroup = lcl_GetStringProperty( GROUP_NAME, xCurProps );
+@@ -1003,17 +1045,14 @@ void UnoControlDialogModel::implUpdateGr
+ // -> we open a new group for it
+
+ // close the old group
+- aCurrentGroup = maGroups.end();
++ aCurrentGroup = NULL;
+ #if OSL_DEBUG_LEVEL > 1
+ aCurrentGroupLabels.clear();
+ #endif
+
+ // open a new group
+- size_t nGroups = maGroups.size();
+- maGroups.resize( nGroups + 1 );
+- aCurrentGroup = maGroups.begin() + nGroups;
+- // and add the (only, til now) member
+- aCurrentGroup->push_back( *pControlModels );
++ aCurrentGroup = AddRadioButtonToGroup( xCurProps, GROUP_NAME, &aNamedGroups, &sCurGroup );
++ aCurrentGroup->push_back( *pControlModels );
nCurrentGroupStep = nThisModelStep;
+@@ -1031,6 +1070,14 @@ void UnoControlDialogModel::implUpdateGr
+ }
+ }
+
++ size_t nGroups = maGroups.size();
++ maGroups.reserve( nGroups + aNamedGroups.size() );
++ NamedGroups::const_iterator i = aNamedGroups.begin(), e = aNamedGroups.end();
++ for ( ; i != e; ++i)
++ {
++ maGroups.push_back( i->second );
++ }
++
+ mbGroupsUpToDate = sal_True;
+ }
+
diff --git toolkit/source/controls/unocontrolmodel.cxx toolkit/source/controls/unocontrolmodel.cxx
index 25573a4..8768094 100644
--- toolkit/source/controls/unocontrolmodel.cxx
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]