diff options
author | Justin Luth <justin.luth@collabora.com> | 2018-11-03 18:01:42 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2018-11-05 06:53:25 +0100 |
commit | 655154e45abfe6c69b97ad5c615f231be4b3827a (patch) | |
tree | 97ccb80d699a234369a34ab026244d769b165f83 /toolkit | |
parent | 80400973e06e08f0c1ab0b9a86418c1bcc4bbd5c (diff) |
tdf#118244 pdfexport: radio buttons can group with same name
The old implementation grouped radio buttons if their
object name was the same, and didn't have a groupname property.
The old implementation still works - so that still needs to be
supported, which this patch ensures.
Change-Id: Ied6ddc52d1c4ab5bca56b14da51258460ca2120c
Reviewed-on: https://gerrit.libreoffice.org/62812
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/helper/formpdfexport.cxx | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx index dd225934a790..4277a72c83ba 100644 --- a/toolkit/source/helper/formpdfexport.cxx +++ b/toolkit/source/helper/formpdfexport.cxx @@ -132,7 +132,7 @@ namespace toolkitform // host document makes it somewhat difficult ... // Problem is that two form radio buttons belong to the same group if // - they have the same parent - // - AND they have the same group name + // - AND they have the same name or group name // This implies that we need some knowledge about (potentially) *all* radio button // groups in the document. @@ -164,6 +164,7 @@ namespace toolkitform do { std::unordered_map<OUString,sal_Int32> GroupNameMap; + std::unordered_map<OUString,sal_Int32> SharedNameMap; sal_Int32 nCount = xCurrentContainer->getCount(); sal_Int32 i; for ( i = nStartWithChild; i < nCount; ++i ) @@ -203,12 +204,25 @@ namespace toolkitform OUString sGroupName; aProps->getPropertyValue("GroupName") >>= sGroupName; - // map: unique key is the group name, so attempts to add a different ID value - // for an existing group are ignored - keeping the first ID - perfect for this scenario. - GroupNameMap.emplace( sGroupName, nGroupsEncountered + i ); + if ( !sGroupName.isEmpty() ) + { + // map: unique key is the group name, so attempts to add a different ID value + // for an existing group are ignored - keeping the first ID - perfect for this scenario. + GroupNameMap.emplace( sGroupName, nGroupsEncountered + i ); + + if ( xElement.get() == xNormalizedLookup.get() ) + return GroupNameMap[sGroupName]; + } + else + { + // Old implementation didn't have a GroupName, just identical Control names. + aProps->getPropertyValue( FM_PROP_NAME ) >>= sGroupName; + SharedNameMap.emplace( sGroupName, nGroupsEncountered + i ); + + if ( xElement.get() == xNormalizedLookup.get() ) + return SharedNameMap[sGroupName]; + } - if ( xElement.get() == xNormalizedLookup.get() ) - return GroupNameMap[sGroupName]; } } catch( uno::Exception& ) |