The migration/integration of group-name support into both forms and toolkit is now mostly complete.
On Sat, 2008-04-12 at 13:49 +0200, Frank Schönheit - Sun Microsystems Germany wrote: > > Now that the form controls are largely there, what's required to > > implement GroupName support for the Basic dialog controls? .. > As a rough plan, you would need to > - introduce a new property GroupName / BASEPROPERTY_GROUPNAME in the > toolkit module. For the details, just refer to the existing > properties, all this is pretty straight forward Done. > - add this property to the UnoControlRadioButtonModel Done. > - remove the GroupName property from the form's radio button > implementation. That is because form control( model)s inherit the > properties from the toolkit control( model)s, unless explicitly masked > out. Done. > - change the implUpdateGroupStructure method to respect the new property Done. Ish. One problem with this change is that the current logic creates a new group if the dialog step changes, which is fairly sensible and this behavior is unchanged if group names aren't present. However, if group names _are_ present, then this check isn't skipped, as I'm using a map<string, ModelGroup> to hold the named groups. This was necessary because w/o the name-keyed map, insertion order would be a problem; given a Control-Name/Group-Name arrangement: W/A X/B Y/A Z/B If we insert the radio buttons in the order W, X, Y, Z, then each radio button was considered to be a separate group, which is obviously wrong. Adding the map<string, ModelGroup> allowed me to place W/Y and X/Z together, as intended, but I'm not sure how to take the dialog step into consideration for this logic. How often would people re-use the same group name across different steps? (And what's Excel do, for that matter?) > - change the persistence code for UNO dialogs to load/save the new > property. Now that code really is beyond my competence, it's in > xmlscript, AFAIK. This has not been done yet. > - re-add the DIALOG_VISIBLE flag to > extensions/source/propctrlr/formmetadata.cxx's GroupName entry Done. Please see and review the attached patch. - Jon
Index: extensions/inc/extensio.hrc =================================================================== RCS file: /cvs/util/extensions/inc/extensio.hrc,v retrieving revision 1.34 diff -u -p -r1.34 extensio.hrc --- extensions/inc/extensio.hrc 11 Apr 2008 09:15:58 -0000 1.34 +++ extensions/inc/extensio.hrc 12 May 2008 06:43:27 -0000 @@ -157,7 +157,7 @@ //----------------------------------------------------------------------- // FREE - // FREE +#define HID_PROP_GROUP_NAME (HID_FORMS_START + 1) #define HID_PROP_GROUPBOX (HID_FORMS_START + 2) #define HID_PROP_CONTROLSOURCE (HID_FORMS_START + 3) #define HID_PROP_NAME (HID_FORMS_START + 4) Index: extensions/source/propctrlr/formmetadata.hxx =================================================================== RCS file: /cvs/util/extensions/source/propctrlr/formmetadata.hxx,v retrieving revision 1.35 diff -u -p -r1.35 formmetadata.hxx --- extensions/source/propctrlr/formmetadata.hxx 11 Apr 2008 10:58:41 -0000 1.35 +++ extensions/source/propctrlr/formmetadata.hxx 12 May 2008 06:43:27 -0000 @@ -166,6 +166,7 @@ namespace pcr #define PROPERTY_ID_ALLOWADDITIONS 20 #define PROPERTY_ID_ALLOWEDITS 21 #define PROPERTY_ID_ALLOWDELETIONS 22 + #define PROPERTY_ID_GROUP_NAME 23 #define PROPERTY_ID_NAVIGATION 24 #define PROPERTY_ID_CYCLE 25 #define PROPERTY_ID_HIDDEN_VALUE 26 Index: extensions/source/propctrlr/formmetadata.cxx =================================================================== RCS file: /cvs/util/extensions/source/propctrlr/formmetadata.cxx,v retrieving revision 1.50 diff -u -p -r1.50 formmetadata.cxx --- extensions/source/propctrlr/formmetadata.cxx 11 Apr 2008 10:58:09 -0000 1.50 +++ extensions/source/propctrlr/formmetadata.cxx 12 May 2008 06:43:27 -0000 @@ -142,6 +142,7 @@ namespace pcr DEF_INFO_2( TITLE, TITLE, TITLE, FORM_VISIBLE, DIALOG_VISIBLE ), DEF_INFO_3( LABEL, LABEL, LABEL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_2( CONTROLLABEL, LABELCONTROL, CONTROLLABEL, FORM_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( GROUP_NAME, GROUP_NAME, GROUP_NAME, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_2( TEXT, TEXT, TEXT, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( MAXTEXTLEN, MAXTEXTLEN, MAXTEXTLEN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( EDITMASK, EDITMASK, EDITMASK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), Index: extensions/source/propctrlr/formstrings.hxx =================================================================== RCS file: /cvs/util/extensions/source/propctrlr/formstrings.hxx,v retrieving revision 1.39 diff -u -p -r1.39 formstrings.hxx --- extensions/source/propctrlr/formstrings.hxx 11 Apr 2008 11:01:21 -0000 1.39 +++ extensions/source/propctrlr/formstrings.hxx 12 May 2008 06:43:27 -0000 @@ -50,6 +50,7 @@ namespace pcr PCR_CONSTASCII_STRING( PROPERTY_TABINDEX, "TabIndex"); PCR_CONSTASCII_STRING( PROPERTY_TAG, "Tag"); PCR_CONSTASCII_STRING( PROPERTY_NAME, "Name"); + PCR_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName"); PCR_CONSTASCII_STRING( PROPERTY_VALUE, "Value"); PCR_CONSTASCII_STRING( PROPERTY_TEXT, "Text"); PCR_CONSTASCII_STRING( PROPERTY_NAVIGATION, "NavigationBarMode"); Index: extensions/source/propctrlr/formresid.hrc =================================================================== RCS file: /cvs/util/extensions/source/propctrlr/formresid.hrc,v retrieving revision 1.37 diff -u -p -r1.37 formresid.hrc --- extensions/source/propctrlr/formresid.hrc 11 Apr 2008 11:00:24 -0000 1.37 +++ extensions/source/propctrlr/formresid.hrc 12 May 2008 06:43:27 -0000 @@ -147,7 +147,7 @@ #define RID_STR_TAG ( RID_FORMBROWSER_START + 116 ) #define RID_STR_HELPTEXT ( RID_FORMBROWSER_START + 117 ) #define RID_STR_HELPURL ( RID_FORMBROWSER_START + 118 ) - // FREE +#define RID_STR_GROUP_NAME ( RID_FORMBROWSER_START + 119 ) #define RID_STR_UNCHECKEDREFVALUE ( RID_FORMBROWSER_START + 120 ) #define RID_STR_CURSOR_TYPE ( RID_FORMBROWSER_START + 121 ) // FREE Index: extensions/source/propctrlr/formres.src =================================================================== RCS file: /cvs/util/extensions/source/propctrlr/formres.src,v retrieving revision 1.82 diff -u -p -r1.82 formres.src --- extensions/source/propctrlr/formres.src 11 Apr 2008 10:59:33 -0000 1.82 +++ extensions/source/propctrlr/formres.src 12 May 2008 06:43:27 -0000 @@ -230,6 +230,10 @@ String RID_STR_NAME { Text [ en-US ] = "Name" ; }; +String RID_STR_GROUP_NAME +{ + Text [ en-US ] = "Group name" ; +}; String RID_STR_TABINDEX { Text [ en-US ] = "Tab order" ; Index: extensions/util/hidother.src =================================================================== RCS file: /cvs/util/extensions/util/hidother.src,v retrieving revision 1.21 diff -u -p -r1.21 hidother.src --- extensions/util/hidother.src 11 Apr 2008 12:12:27 -0000 1.21 +++ extensions/util/hidother.src 12 May 2008 06:43:27 -0000 @@ -306,3 +306,4 @@ hidspecial HID_CHECK_FOR_UPD_STATUS hidspecial HID_CHECK_FOR_UPD_DESCRIPTION { HelpId = HID_CHECK_FOR_UPD_DESCRIPTION; } hidspecial HID_CHECK_FOR_UPD_CANCEL { HelpId = HID_CHECK_FOR_UPD_CANCEL; } hidspecial HID_PROP_NOLABEL { HelpId = HID_PROP_NOLABEL; } +hidspecial HID_PROP_GROUP_NAME { HelpId = HID_PROP_GROUP_NAME; } Index: forms/source/component/GroupManager.hxx =================================================================== RCS file: /cvs/gsl/forms/source/component/GroupManager.hxx,v retrieving revision 1.12 diff -u -p -r1.12 GroupManager.hxx --- forms/source/component/GroupManager.hxx 11 Apr 2008 08:15:27 -0000 1.12 +++ forms/source/component/GroupManager.hxx 12 May 2008 06:43:27 -0000 @@ -220,6 +220,8 @@ public: void getGroup(sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> >& _rGroup, ::rtl::OUString& Name); void getGroupByName(const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> >& _rGroup); ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> > getControlModels(); + + static ::rtl::OUString GetGroupName( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xComponent ); }; Index: forms/source/component/GroupManager.cxx =================================================================== RCS file: /cvs/gsl/forms/source/component/GroupManager.cxx,v retrieving revision 1.18 diff -u -p -r1.18 GroupManager.cxx --- forms/source/component/GroupManager.cxx 11 Apr 2008 08:15:07 -0000 1.18 +++ forms/source/component/GroupManager.cxx 12 May 2008 06:43:27 -0000 @@ -127,14 +127,13 @@ OGroupComp::OGroupComp(const Reference<X ,m_xControlModel(rxSet,UNO_QUERY) ,m_nPos( nInsertPos ) ,m_nTabIndex(0) + ,m_aName( OGroupManager::GetGroupName( rxSet ) ) { if (m_xComponent.is()) { if (hasProperty( PROPERTY_TABINDEX, m_xComponent ) ) // Indices kleiner 0 werden wie 0 behandelt m_nTabIndex = Max(getINT16(m_xComponent->getPropertyValue( PROPERTY_TABINDEX )) , sal_Int16(0)); - - m_xComponent->getPropertyValue( PROPERTY_NAME ) >>= m_aName; } } @@ -321,7 +320,8 @@ void OGroupManager::removeFromGroupMap(c aFind->second.RemoveComponent( _xSet ); // Wenn Anzahl der Gruppenelemente == 1 ist, Gruppe deaktivieren - if ( aFind->second.Count() == 1 ) + sal_Int32 nCount = aFind->second.Count(); + if ( nCount == 1 || nCount == 0 ) { OActiveGroups::iterator aActiveFind = ::std::find( m_aActiveGroupMap.begin(), @@ -332,7 +332,7 @@ void OGroupManager::removeFromGroupMap(c { // the group is active. Deactivate it if the remaining component // is *no* radio button - if ( !isRadioButton( aFind->second.GetObject( 0 ) ) ) + if ( nCount == 0 || !isRadioButton( aFind->second.GetObject( 0 ) ) ) m_aActiveGroupMap.erase( aActiveFind ); } } @@ -341,6 +341,8 @@ void OGroupManager::removeFromGroupMap(c // Bei Component als PropertyChangeListener abmelden _xSet->removePropertyChangeListener( PROPERTY_NAME, this ); + if (hasProperty(PROPERTY_GROUP_NAME, _xSet)) + _xSet->removePropertyChangeListener( PROPERTY_GROUP_NAME, this ); if (hasProperty(PROPERTY_TABINDEX, _xSet)) _xSet->removePropertyChangeListener( PROPERTY_TABINDEX, this ); } @@ -351,10 +353,23 @@ void SAL_CALL OGroupManager::propertyCha // Component aus Gruppe entfernen ::rtl::OUString sGroupName; - if (evt.PropertyName == PROPERTY_NAME) + if (hasProperty( PROPERTY_GROUP_NAME, xSet )) + xSet->getPropertyValue( PROPERTY_GROUP_NAME ) >>= sGroupName; + if (evt.PropertyName == PROPERTY_NAME) { + if (sGroupName.getLength() > 0) + return; // group hasn't changed; ignore this name change. + // no GroupName; use Name as GroupNme + evt.OldValue >>= sGroupName; + } + else if (evt.PropertyName == PROPERTY_GROUP_NAME) { evt.OldValue >>= sGroupName; + if (sGroupName.getLength() == 0) { + // No prior GroupName; fallback to Nme + xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName; + } + } else - xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName; + sGroupName = GetGroupName( xSet ); removeFromGroupMap(sGroupName,xSet); @@ -437,8 +452,7 @@ void OGroupManager::InsertElement( const m_pCompGroup->InsertComponent( xSet ); // Component in Gruppe aufnehmen - ::rtl::OUString sGroupName; - xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName; + ::rtl::OUString sGroupName( GetGroupName( xSet ) ); OGroupArr::iterator aFind = m_aGroupArr.find(sGroupName); @@ -476,6 +490,8 @@ void OGroupManager::InsertElement( const // Bei Component als PropertyChangeListener anmelden xSet->addPropertyChangeListener( PROPERTY_NAME, this ); + if (hasProperty(PROPERTY_GROUP_NAME, xSet)) + xSet->addPropertyChangeListener( PROPERTY_GROUP_NAME, this ); // Tabindex muss nicht jeder unterstuetzen if (hasProperty(PROPERTY_TABINDEX, xSet)) @@ -492,12 +508,26 @@ void OGroupManager::RemoveElement( const return; // Component aus Gruppe entfernen - ::rtl::OUString sGroupName; - xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName; + ::rtl::OUString sGroupName( GetGroupName( xSet ) ); removeFromGroupMap(sGroupName,xSet); } +::rtl::OUString OGroupManager::GetGroupName( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xComponent ) +{ + if (!xComponent.is()) + return ::rtl::OUString(); + ::rtl::OUString sGroupName; + if (hasProperty( PROPERTY_GROUP_NAME, xComponent )) { + xComponent->getPropertyValue( PROPERTY_GROUP_NAME ) >>= sGroupName; + if (sGroupName.getLength() == 0) + xComponent->getPropertyValue( PROPERTY_NAME ) >>= sGroupName; + } + else + xComponent->getPropertyValue( PROPERTY_NAME ) >>= sGroupName; + return sGroupName; +} + //......................................................................... } // namespace frm //......................................................................... Index: forms/source/component/RadioButton.cxx =================================================================== RCS file: /cvs/gsl/forms/source/component/RadioButton.cxx,v retrieving revision 1.22 diff -u -p -r1.22 RadioButton.cxx --- forms/source/component/RadioButton.cxx 11 Apr 2008 08:19:08 -0000 1.22 +++ forms/source/component/RadioButton.cxx 12 May 2008 06:43:27 -0000 @@ -31,6 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_forms.hxx" #include "RadioButton.hxx" +#include "GroupManager.hxx" #include "property.hxx" #ifndef _FRM_PROPERTY_HRC_ #include "property.hrc" @@ -169,7 +170,11 @@ StringSequence SAL_CALL ORadioButtonMode void ORadioButtonModel::SetSiblingPropsTo(const ::rtl::OUString& rPropName, const Any& rValue) { // mein Name - ::rtl::OUString sMyName(m_aName); + ::rtl::OUString sMyGroup; + if (hasProperty(PROPERTY_GROUP_NAME, this)) + this->getPropertyValue(PROPERTY_GROUP_NAME) >>= sMyGroup; + if (sMyGroup.getLength() == 0) + sMyGroup = m_aName; // meine Siblings durchiterieren Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY); @@ -177,8 +182,9 @@ void ORadioButtonModel::SetSiblingPropsT { Reference<XPropertySet> xMyProps; query_interface(static_cast<XWeak*>(this), xMyProps); - ::rtl::OUString sCurrentName; - for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i) + ::rtl::OUString sCurrentGroup; + sal_Int32 nNumSiblings = xIndexAccess->getCount(); + for (sal_Int32 i=0; i<nNumSiblings; ++i) { Reference<XPropertySet> xSiblingProperties(*(InterfaceRef*)xIndexAccess->getByIndex(i).getValue(), UNO_QUERY); if (!xSiblingProperties.is()) @@ -195,8 +201,8 @@ void ORadioButtonModel::SetSiblingPropsT continue; // das 'zur selben Gruppe gehoeren' wird am Namen festgemacht - xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sCurrentName; - if (sCurrentName == sMyName) + sCurrentGroup = OGroupManager::GetGroupName( xSiblingProperties ); + if (sCurrentGroup == sMyGroup) xSiblingProperties->setPropertyValue(rPropName, rValue); } } @@ -205,24 +211,23 @@ void ORadioButtonModel::SetSiblingPropsT //------------------------------------------------------------------------------ void ORadioButtonModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue) throw (Exception) { - OReferenceValueComponent::setFastPropertyValue_NoBroadcast( nHandle, rValue ); - - // if the label control changed ... - if (nHandle == PROPERTY_ID_CONTROLLABEL) - { // ... forward this to our siblings + if (nHandle != PROPERTY_ID_GROUP_NAME) + OReferenceValueComponent::setFastPropertyValue_NoBroadcast( nHandle, rValue ); + switch (nHandle) + { + case PROPERTY_ID_CONTROLLABEL: SetSiblingPropsTo(PROPERTY_CONTROLLABEL, rValue); - } - + break; // wenn sich die ControlSource-Eigenschaft geaendert hat ... - if (nHandle == PROPERTY_ID_CONTROLSOURCE) - { // ... muss ich allen meinen Siblings, die in der selben RadioButton-Gruppe sind wie ich, auch die + case PROPERTY_ID_CONTROLSOURCE: + // ... muss ich allen meinen Siblings, die in der selben RadioButton-Gruppe sind wie ich, auch die // neue ControlSource mitgeben SetSiblingPropsTo(PROPERTY_CONTROLSOURCE, rValue); - } - + break; // die andere Richtung : wenn sich mein Name aendert ... - if (nHandle == PROPERTY_ID_NAME) - { + case PROPERTY_ID_GROUP_NAME: + setPropertyValue( PROPERTY_GROUP_NAME, rValue ); + case PROPERTY_ID_NAME: { // ... muss ich testen, ob ich Siblings mit dem selben Namen habe, damit ich deren ControlSource uebernehmen kann Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY); if (xIndexAccess.is()) @@ -248,7 +253,7 @@ void ORadioButtonModel::setFastPropertyV // nur Radio-Buttons continue; - xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sName; + xSiblingProperties->getPropertyValue(nHandle == PROPERTY_ID_NAME ? PROPERTY_NAME : PROPERTY_GROUP_NAME) >>= sName; // Control, das zur gleichen Gruppe gehoert ? if (rValue == sName) { @@ -257,10 +262,9 @@ void ORadioButtonModel::setFastPropertyV } } } + break; } - - if (nHandle == PROPERTY_ID_DEFAULTCHECKED) - { + case PROPERTY_ID_DEFAULTCHECKED: { sal_Int16 nValue; rValue >>= nValue; if (1 == nValue) @@ -271,14 +275,20 @@ void ORadioButtonModel::setFastPropertyV aZero <<= nValue; SetSiblingPropsTo(PROPERTY_DEFAULTCHECKED, aZero); } + break; + } + default: + // OReferenceValueComponent::setFastPropertyValue_NoBroadcast( nHandle, rValue ); + break; } } //------------------------------------------------------------------------------ void ORadioButtonModel::describeFixedProperties( Sequence< Property >& _rProps ) const { - BEGIN_DESCRIBE_PROPERTIES( 1, OReferenceValueComponent ) + BEGIN_DESCRIBE_PROPERTIES( 2, OReferenceValueComponent ) DECL_PROP1(TABINDEX, sal_Int16, BOUND); + DECL_PROP1(GROUP_NAME, ::rtl::OUString, BOUND); END_DESCRIBE_PROPERTIES(); } Index: forms/source/inc/frm_strings.hxx =================================================================== RCS file: /cvs/gsl/forms/source/inc/frm_strings.hxx,v retrieving revision 1.17 diff -u -p -r1.17 frm_strings.hxx --- forms/source/inc/frm_strings.hxx 11 Apr 2008 08:34:01 -0000 1.17 +++ forms/source/inc/frm_strings.hxx 12 May 2008 06:43:28 -0000 @@ -100,6 +100,7 @@ namespace frm FORMS_CONSTASCII_STRING( PROPERTY_TABINDEX, "TabIndex" ); FORMS_CONSTASCII_STRING( PROPERTY_TAG, "Tag" ); FORMS_CONSTASCII_STRING( PROPERTY_NAME, "Name" ); + FORMS_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName" ); FORMS_CONSTASCII_STRING( PROPERTY_CLASSID, "ClassId" ); FORMS_CONSTASCII_STRING( PROPERTY_FETCHSIZE, "FetchSize" ); FORMS_CONSTASCII_STRING( PROPERTY_VALUE, "Value" ); Index: forms/source/inc/property.hrc =================================================================== RCS file: /cvs/gsl/forms/source/inc/property.hrc,v retrieving revision 1.21 diff -u -p -r1.21 property.hrc --- forms/source/inc/property.hrc 11 Apr 2008 08:35:13 -0000 1.21 +++ forms/source/inc/property.hrc 12 May 2008 06:43:28 -0000 @@ -60,7 +60,7 @@ namespace frm #define PROPERTY_ID_ALLOWEDITS (PROPERTY_ID_START + 16) #define PROPERTY_ID_ALLOWDELETIONS (PROPERTY_ID_START + 17) #define PROPERTY_ID_NATIVE_LOOK (PROPERTY_ID_START + 18) - // free +#define PROPERTY_ID_GROUP_NAME (PROPERTY_ID_START + 19) // free // free // free Index: xmloff/source/forms/formattributes.hxx =================================================================== RCS file: /cvs/xml/xmloff/source/forms/formattributes.hxx,v retrieving revision 1.14 diff -u -p -r1.14 formattributes.hxx --- xmloff/source/forms/formattributes.hxx 10 Apr 2008 22:03:59 -0000 1.14 +++ xmloff/source/forms/formattributes.hxx 12 May 2008 06:43:28 -0000 @@ -124,6 +125,7 @@ namespace xmloff #define SCA_MAX_VALUE 0x00000002 #define SCA_MIN_VALUE 0x00000004 #define SCA_VALIDATION 0x00000008 + #define SCA_GROUP_NAME 0x00000010 #define SCA_MULTI_LINE 0x00000020 #define SCA_AUTOMATIC_COMPLETION 0x00000080 #define SCA_MULTIPLE 0x00000100 Index: xmloff/source/forms/formattributes.cxx =================================================================== RCS file: /cvs/xml/xmloff/source/forms/formattributes.cxx,v retrieving revision 1.21 diff -u -p -r1.21 formattributes.cxx --- xmloff/source/forms/formattributes.cxx 10 Apr 2008 22:03:42 -0000 1.21 +++ xmloff/source/forms/formattributes.cxx 12 May 2008 06:43:28 -0000 @@ -193,6 +194,7 @@ namespace xmloff case SCA_MAX_VALUE: return "max-value"; case SCA_MIN_VALUE: return "min-value"; case SCA_VALIDATION: return "validation"; + case SCA_GROUP_NAME: return "group-name"; case SCA_MULTI_LINE: return "multi-line"; case SCA_AUTOMATIC_COMPLETION: return "auto-complete"; case SCA_MULTIPLE: return "multiple"; Index: xmloff/source/forms/strings.hxx =================================================================== RCS file: /cvs/xml/xmloff/source/forms/strings.hxx,v retrieving revision 1.18 diff -u -p -r1.18 strings.hxx --- xmloff/source/forms/strings.hxx 10 Apr 2008 22:12:05 -0000 1.18 +++ xmloff/source/forms/strings.hxx 12 May 2008 06:43:28 -0000 @@ -204,6 +205,7 @@ namespace xmloff XMLFORM_CONSTASCII_STRING( PROPERTY_VISUAL_EFFECT, "VisualEffect"); XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_POSITION, "ImagePosition"); XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_ALIGN, "ImageAlign"); + XMLFORM_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName"); XMLFORM_CONSTASCII_STRING( PROPERTY_BOUND_CELL, "BoundCell"); XMLFORM_CONSTASCII_STRING( PROPERTY_LIST_CELL_RANGE, "CellRange"); Index: xmloff/source/forms/elementexport.cxx =================================================================== RCS file: /cvs/xml/xmloff/source/forms/elementexport.cxx,v retrieving revision 1.48 diff -u -p -r1.48 elementexport.cxx --- xmloff/source/forms/elementexport.cxx 10 Apr 2008 22:00:18 -0000 1.48 +++ xmloff/source/forms/elementexport.cxx 12 May 2008 06:43:28 -0000 @@ -1110,6 +1110,39 @@ namespace xmloff } // ---------------------------------- + // the string properties + { + static sal_Int32 nStringPropertyAttributeIds[] = + { // attribute flags + SCA_GROUP_NAME + }; + static const ::rtl::OUString* pStringPropertyNames[] = + { // property names + &PROPERTY_GROUP_NAME + }; + + sal_Int32 nIdCount = sizeof( nStringPropertyAttributeIds ) / sizeof( nStringPropertyAttributeIds[0] ); + #if OSL_DEBUG_LEVEL > 0 + sal_Int32 nNameCount = sizeof( pStringPropertyNames ) / sizeof( pStringPropertyNames[0] ); + OSL_ENSURE( ( nIdCount == nNameCount ), + "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" ); + #endif + for ( i = 0; i < nIdCount; ++i ) + if ( nStringPropertyAttributeIds[i] & m_nIncludeSpecial ) + { + exportStringPropertyAttribute( + OAttributeMetaData::getSpecialAttributeNamespace( nStringPropertyAttributeIds[i] ), + OAttributeMetaData::getSpecialAttributeName( nStringPropertyAttributeIds[i] ), + *( pStringPropertyNames[i] ) + ); + #if OSL_DEBUG_LEVEL > 0 + // reset the bit for later checking + m_nIncludeSpecial = m_nIncludeSpecial & ~nStringPropertyAttributeIds[i]; + #endif + } + } + + // ---------------------------------- if ((SCA_MIN_VALUE | SCA_MAX_VALUE) & m_nIncludeSpecial) { // need to export the min value and the max value as attributes @@ -1569,6 +1602,8 @@ namespace xmloff } if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_IMAGE_POSITION ) ) m_nIncludeSpecial |= SCA_IMAGE_POSITION; + if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_GROUP_NAME ) ) + m_nIncludeSpecial |= SCA_GROUP_NAME; m_nIncludeDatabase = DA_DATA_FIELD; m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE; break; Index: svx/source/msfilter/msocximex.cxx =================================================================== RCS file: /cvs/graphics/svx/source/msfilter/msocximex.cxx,v retrieving revision 1.37 diff -u -p -r1.37 msocximex.cxx --- svx/source/msfilter/msocximex.cxx 11 Apr 2008 02:06:31 -0000 1.37 +++ svx/source/msfilter/msocximex.cxx 12 May 2008 06:43:29 -0000 @@ -1701,6 +1701,12 @@ sal_Bool OCX_OptionButton::Import(com::s aTmp <<= ::com::sun::star::style::VerticalAlignment_MIDDLE; rPropSet->setPropertyValue( WW8_ASCII2STR("VerticalAlign"), aTmp ); + if ( pGroupName ) + { + aTmp <<= lclCreateOUString( pGroupName, nGroupNameLen ); + rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp); + } + aFontData.Import(rPropSet); return sal_True; } diff --git toolkit/inc/toolkit/helper/property.hxx toolkit/inc/toolkit/helper/property.hxx index f257f5c..3577148 100644 --- toolkit/inc/toolkit/helper/property.hxx +++ toolkit/inc/toolkit/helper/property.hxx @@ -192,6 +192,7 @@ namespace rtl { #define BASEPROPERTY_NOLABEL 133 // ::rtl::OUString added for issue79712 #define BASEPROPERTY_URL 134 // ::rtl::OUString #define BASEPROPERTY_VISIBLE 135 // sal_Bool +#define BASEPROPERTY_GROUPNAME 136 // ::rtl::OUString // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. #define BASEPROPERTY_FONTDESCRIPTORPART_START 1000 Index: toolkit/source/helper/property.cxx =================================================================== RCS file: /cvs/gsl/toolkit/source/helper/property.cxx,v retrieving revision 1.42 diff -u -p -r1.42 property.cxx --- toolkit/source/helper/property.cxx 11 Apr 2008 09:36:59 -0000 1.42 +++ toolkit/source/helper/property.cxx 12 May 2008 06:43:29 -0000 @@ -179,6 +179,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( DECL_PROP_3 ( "FormatsSupplier", FORMATSSUPPLIER, Reference< ::com::sun::star::util::XNumberFormatsSupplier >, BOUND, MAYBEVOID, TRANSIENT ), DECL_PROP_2 ( "Graphic", GRAPHIC, Reference< ::com::sun::star::graphic::XGraphic >, BOUND, TRANSIENT ), + DECL_PROP_2 ( "GroupName", GROUPNAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ), Index: toolkit/source/awt/vclxwindows.cxx =================================================================== RCS file: /cvs/gsl/toolkit/source/awt/vclxwindows.cxx,v retrieving revision 1.68 diff -u -p -r1.68 vclxwindows.cxx --- toolkit/source/awt/vclxwindows.cxx 11 Apr 2008 09:22:58 -0000 1.68 +++ toolkit/source/awt/vclxwindows.cxx 12 May 2008 06:43:30 -0000 @@ -1079,6 +1079,7 @@ void VCLXRadioButton::ImplGetPropertyIds BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_ALIGN, BASEPROPERTY_VERTICALALIGN, + BASEPROPERTY_GROUPNAME, 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 15 May 2008 05:25:19 -0000 @@ -142,6 +142,18 @@ namespace return xGraphic; } + static ::rtl::OUString lcl_GetStringProperty( const ::rtl::OUString& sProperty, const Reference< XPropertySet >& xSet ) + { + ::rtl::OUString sValue; + Reference< XPropertySetInfo > xPSI; + if (xSet.is() && (xPSI = xSet->getPropertySetInfo()).is() && + xPSI->hasPropertyByName( sProperty ) ) + { + xSet->getPropertyValue( sProperty ) >>= sValue; + } + return sValue; + } + } // ---------------------------------------------------------------------------- @@ -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 +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 ) ); + Reference< XPropertySet > xCurProps( *pControlModels, UNO_QUERY ); switch ( eState ) { @@ -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 ); @@ -970,18 +1009,21 @@ void UnoControlDialogModel::implUpdateGr { if ( !bIsRadioButton ) { // no radio button -> the group is done - aCurrentGroup = maGroups.end(); + aCurrentGroup = NULL; eState = eLookingForGroup; + sCurGroup = ::rtl::OUString (); #if OSL_DEBUG_LEVEL > 1 aCurrentGroupLabels.clear(); #endif continue; } - // it is a radio button - is it on the proper page? + // it is a radio button - is it in the same group? const sal_Int32 nThisModelStep = lcl_getDialogStep( *pControlModels ); - if ( ( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page - || ( 0 == nThisModelStep ) // the current button appears on all pages + ::rtl::OUString sGroupName = lcl_GetStringProperty( GROUP_NAME, xCurProps ); + if ( (( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page + || ( 0 == nThisModelStep )) // the current button appears on all pages + && sGroupName == sCurGroup // the group name matches ) { // -> it belongs to the same group @@ -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 +++ toolkit/source/controls/unocontrolmodel.cxx @@ -341,6 +341,7 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) case BASEPROPERTY_VISIBLE: case BASEPROPERTY_DECORATION: aDefault <<= (sal_Bool) sal_True; break; + case BASEPROPERTY_GROUPNAME: case BASEPROPERTY_HELPTEXT: case BASEPROPERTY_HELPURL: case BASEPROPERTY_IMAGEURL:
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]