Lines 142-147
namespace
Link Here
|
142 |
return xGraphic; |
142 |
return xGraphic; |
143 |
} |
143 |
} |
144 |
|
144 |
|
|
|
145 |
static ::rtl::OUString lcl_GetStringProperty( const ::rtl::OUString& sProperty, const Reference< XPropertySet >& xSet ) |
146 |
{ |
147 |
::rtl::OUString sValue; |
148 |
Reference< XPropertySetInfo > xPSI; |
149 |
if (xSet.is() && (xPSI = xSet->getPropertySetInfo()).is() && |
150 |
xPSI->hasPropertyByName( sProperty ) ) |
151 |
{ |
152 |
xSet->getPropertyValue( sProperty ) >>= sValue; |
153 |
} |
154 |
return sValue; |
155 |
} |
156 |
|
145 |
} |
157 |
} |
146 |
|
158 |
|
147 |
// ---------------------------------------------------------------------------- |
159 |
// ---------------------------------------------------------------------------- |
Lines 897-902
void UnoControlDialogModel::implNotifyTa
Link Here
|
897 |
} |
909 |
} |
898 |
} |
910 |
} |
899 |
|
911 |
|
|
|
912 |
// ---------------------------------------------------------------------------- |
913 |
void UnoControlDialogModel::AddRadioButtonGroup ( |
914 |
::std::map< ::rtl::OUString, ModelGroup >& rNamedGroups ) |
915 |
{ |
916 |
if ( rNamedGroups.size() == 0 ) |
917 |
return; |
918 |
|
919 |
size_t nGroups = maGroups.size(); |
920 |
maGroups.reserve( nGroups + rNamedGroups.size() ); |
921 |
::std::map< ::rtl::OUString, ModelGroup >::const_iterator i = rNamedGroups.begin(), e = rNamedGroups.end(); |
922 |
for( ; i != e; ++i) |
923 |
{ |
924 |
maGroups.push_back( i->second ); |
925 |
} |
926 |
|
927 |
rNamedGroups.clear(); |
928 |
} |
929 |
|
930 |
void UnoControlDialogModel::AddRadioButtonToGroup ( |
931 |
const Reference< XControlModel >& rControlModel, |
932 |
const ::rtl::OUString& rPropertyName, |
933 |
::std::map< ::rtl::OUString, ModelGroup >& rNamedGroups, |
934 |
ModelGroup*& rpCurrentGroup ) |
935 |
{ |
936 |
Reference< XPropertySet > xCurProps( rControlModel, UNO_QUERY ); |
937 |
::rtl::OUString sGroup = lcl_GetStringProperty( rPropertyName, xCurProps ); |
938 |
const sal_Int32 nControlModelStep = lcl_getDialogStep( rControlModel ); |
939 |
|
940 |
if ( sGroup.getLength() == 0 ) |
941 |
{ |
942 |
// Create a new group if: |
943 |
if ( maGroups.size() == 0 || // no groups |
944 |
rpCurrentGroup == NULL || // previous group was closed |
945 |
(nControlModelStep != 0 && // control step matches current group |
946 |
maGroups.back().size() > 0 && // (group 0 == display everywhere) |
947 |
nControlModelStep != lcl_getDialogStep( maGroups.back().back() ) ) ) |
948 |
{ |
949 |
size_t nGroups = maGroups.size(); |
950 |
maGroups.resize( nGroups + 1 ); |
951 |
} |
952 |
rpCurrentGroup = &maGroups.back(); |
953 |
} |
954 |
else |
955 |
{ |
956 |
// Different steps get different sets of named groups |
957 |
if ( rNamedGroups.size() > 0 && |
958 |
rNamedGroups.begin()->second.size() > 0 ) |
959 |
{ |
960 |
const sal_Int32 nPrevStep = lcl_getDialogStep( rNamedGroups.begin()->second.front() ); |
961 |
if ( nControlModelStep != nPrevStep ) |
962 |
AddRadioButtonGroup( rNamedGroups ); |
963 |
} |
964 |
|
965 |
rpCurrentGroup = &rNamedGroups[ sGroup ]; |
966 |
} |
967 |
rpCurrentGroup->push_back( rControlModel ); |
968 |
} |
900 |
|
969 |
|
901 |
// ---------------------------------------------------------------------------- |
970 |
// ---------------------------------------------------------------------------- |
902 |
void UnoControlDialogModel::implUpdateGroupStructure() |
971 |
void UnoControlDialogModel::implUpdateGroupStructure() |
Lines 921-930
void UnoControlDialogModel::implUpdateGr
Link Here
|
921 |
|
990 |
|
922 |
GroupingMachineState eState = eLookingForGroup; // the current state of our machine |
991 |
GroupingMachineState eState = eLookingForGroup; // the current state of our machine |
923 |
Reference< XServiceInfo > xModelSI; // for checking for a radion button |
992 |
Reference< XServiceInfo > xModelSI; // for checking for a radion button |
924 |
AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building |
993 |
ModelGroup* aCurrentGroup = NULL; // the group which we're currently building |
925 |
sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to |
|
|
926 |
sal_Bool bIsRadioButton; // is it a radio button? |
994 |
sal_Bool bIsRadioButton; // is it a radio button? |
927 |
|
995 |
|
|
|
996 |
const ::rtl::OUString GROUP_NAME( RTL_CONSTASCII_USTRINGPARAM( "GroupName" ) ); |
997 |
|
998 |
::std::map< ::rtl::OUString, ModelGroup > aNamedGroups; |
999 |
|
928 |
#if OSL_DEBUG_LEVEL > 1 |
1000 |
#if OSL_DEBUG_LEVEL > 1 |
929 |
::std::vector< ::rtl::OUString > aCurrentGroupLabels; |
1001 |
::std::vector< ::rtl::OUString > aCurrentGroupLabels; |
930 |
#endif |
1002 |
#endif |
Lines 945-958
void UnoControlDialogModel::implUpdateGr
Link Here
|
945 |
// the current model is a radio button |
1017 |
// the current model is a radio button |
946 |
// -> we found the beginning of a new group |
1018 |
// -> we found the beginning of a new group |
947 |
// create the place for this group |
1019 |
// create the place for this group |
948 |
size_t nGroups = maGroups.size(); |
1020 |
AddRadioButtonToGroup( *pControlModels, GROUP_NAME, aNamedGroups, aCurrentGroup ); |
949 |
maGroups.resize( nGroups + 1 ); |
|
|
950 |
aCurrentGroup = maGroups.begin() + nGroups; |
951 |
// and add the (only, til now) member |
952 |
aCurrentGroup->push_back( *pControlModels ); |
953 |
|
1021 |
|
954 |
// get the step which all controls of this group now have to belong to |
|
|
955 |
nCurrentGroupStep = lcl_getDialogStep( *pControlModels ); |
956 |
// new state: looking for further members |
1022 |
// new state: looking for further members |
957 |
eState = eExpandingGroup; |
1023 |
eState = eExpandingGroup; |
958 |
|
1024 |
|
Lines 970-976
void UnoControlDialogModel::implUpdateGr
Link Here
|
970 |
{ |
1036 |
{ |
971 |
if ( !bIsRadioButton ) |
1037 |
if ( !bIsRadioButton ) |
972 |
{ // no radio button -> the group is done |
1038 |
{ // no radio button -> the group is done |
973 |
aCurrentGroup = maGroups.end(); |
1039 |
aCurrentGroup = NULL; |
974 |
eState = eLookingForGroup; |
1040 |
eState = eLookingForGroup; |
975 |
#if OSL_DEBUG_LEVEL > 1 |
1041 |
#if OSL_DEBUG_LEVEL > 1 |
976 |
aCurrentGroupLabels.clear(); |
1042 |
aCurrentGroupLabels.clear(); |
Lines 978-1025
void UnoControlDialogModel::implUpdateGr
Link Here
|
978 |
continue; |
1044 |
continue; |
979 |
} |
1045 |
} |
980 |
|
1046 |
|
981 |
// it is a radio button - is it on the proper page? |
1047 |
AddRadioButtonToGroup( *pControlModels, GROUP_NAME, aNamedGroups, aCurrentGroup ); |
982 |
const sal_Int32 nThisModelStep = lcl_getDialogStep( *pControlModels ); |
|
|
983 |
if ( ( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page |
984 |
|| ( 0 == nThisModelStep ) // the current button appears on all pages |
985 |
) |
986 |
{ |
987 |
// -> it belongs to the same group |
988 |
aCurrentGroup->push_back( *pControlModels ); |
989 |
// state still is eExpandingGroup - we're looking for further elements |
990 |
eState = eExpandingGroup; |
991 |
|
1048 |
|
992 |
#if OSL_DEBUG_LEVEL > 1 |
1049 |
#if OSL_DEBUG_LEVEL > 1 |
993 |
Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY ); |
|
|
994 |
::rtl::OUString sLabel; |
995 |
if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) ) |
996 |
xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel; |
997 |
aCurrentGroupLabels.push_back( sLabel ); |
998 |
#endif |
999 |
continue; |
1000 |
} |
1001 |
|
1002 |
// it's a radio button, but on a different page |
1003 |
// -> we open a new group for it |
1004 |
|
1005 |
// close the old group |
1006 |
aCurrentGroup = maGroups.end(); |
1007 |
#if OSL_DEBUG_LEVEL > 1 |
1008 |
aCurrentGroupLabels.clear(); |
1009 |
#endif |
1010 |
|
1011 |
// open a new group |
1012 |
size_t nGroups = maGroups.size(); |
1013 |
maGroups.resize( nGroups + 1 ); |
1014 |
aCurrentGroup = maGroups.begin() + nGroups; |
1015 |
// and add the (only, til now) member |
1016 |
aCurrentGroup->push_back( *pControlModels ); |
1017 |
|
1018 |
nCurrentGroupStep = nThisModelStep; |
1019 |
|
1020 |
// state is the same: we still are looking for further elements of the current group |
1021 |
eState = eExpandingGroup; |
1022 |
#if OSL_DEBUG_LEVEL > 1 |
1023 |
Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY ); |
1050 |
Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY ); |
1024 |
::rtl::OUString sLabel; |
1051 |
::rtl::OUString sLabel; |
1025 |
if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) ) |
1052 |
if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) ) |
Lines 1031-1036
void UnoControlDialogModel::implUpdateGr
Link Here
|
1031 |
} |
1058 |
} |
1032 |
} |
1059 |
} |
1033 |
|
1060 |
|
|
|
1061 |
AddRadioButtonGroup( aNamedGroups ); |
1034 |
mbGroupsUpToDate = sal_True; |
1062 |
mbGroupsUpToDate = sal_True; |
1035 |
} |
1063 |
} |
1036 |
|
1064 |
|