From a7756236858788b11816cbaba433768ba4ccc72a Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Fri, 28 Sep 2018 20:41:34 +0300 Subject: tdf#111980 sc optionbutton autoGroups different for form/activeX This patch only affects calc. (Perhaps .xls* is the only format that supports non-activeX radio buttons?) Commit 9f969799629fe6bdf8b922d8cb922846aa646ece worried about form and activeX buttons sharing the autoGroup_. This patch prevents that. Change-Id: Ia57a14f1cdd6363aa5d6d991469668fcc56016ca Reviewed-on: https://gerrit.libreoffice.org/61095 Tested-by: Jenkins Reviewed-by: Justin Luth --- sc/qa/unit/subsequent_filters-test.cxx | 24 ++++++++++++++++++++---- sc/source/filter/oox/drawingfragment.cxx | 2 ++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index ef2b5ee22aef..0b0406127e82 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1694,18 +1694,34 @@ void ScFiltersTest::testActiveXOptionButtonGroup() xPropertySet->getPropertyValue("GroupName") >>= sGroupName; CPPUNIT_ASSERT_EQUAL(OUString("Sheet1"), sGroupName); - // Form optionbuttons (without Group names) were not grouped. + // Optionbuttons (without Group names) were not grouped. // The two optionbuttons should have the same auto-generated group name. + OUString sGroupName2; //ActiveX controls + xControlShape.set(xIA_DrawPage->getByIndex(2), uno::UNO_QUERY_THROW); + xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW); + xPropertySet->getPropertyValue("GroupName") >>= sGroupName2; + CPPUNIT_ASSERT_EQUAL( false, sGroupName2.isEmpty() ); + + OUString sGroupName3; + xControlShape.set(xIA_DrawPage->getByIndex(3), uno::UNO_QUERY_THROW); + xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW); + xPropertySet->getPropertyValue("GroupName") >>= sGroupName3; + CPPUNIT_ASSERT_EQUAL( sGroupName2, sGroupName3 ); + CPPUNIT_ASSERT( sGroupName != sGroupName3 ); + + OUString sGroupName4; //Form controls xControlShape.set(xIA_DrawPage->getByIndex(4), uno::UNO_QUERY_THROW); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW); - xPropertySet->getPropertyValue("GroupName") >>= sGroupName; - CPPUNIT_ASSERT_EQUAL(false, sGroupName.isEmpty()); + xPropertySet->getPropertyValue("GroupName") >>= sGroupName4; + CPPUNIT_ASSERT_EQUAL( false, sGroupName4.isEmpty() ); OUString sGroupName5; xControlShape.set(xIA_DrawPage->getByIndex(5), uno::UNO_QUERY_THROW); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW); xPropertySet->getPropertyValue("GroupName") >>= sGroupName5; - CPPUNIT_ASSERT_EQUAL(sGroupName, sGroupName5); + CPPUNIT_ASSERT_EQUAL( sGroupName4, sGroupName5 ); + CPPUNIT_ASSERT( sGroupName2 != sGroupName5 ); + CPPUNIT_ASSERT( sGroupName != sGroupName5 ); } void ScFiltersTest::testChartImportODS() diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx index 5ad5f48a7b02..52c349f31fd8 100644 --- a/sc/source/filter/oox/drawingfragment.cxx +++ b/sc/source/filter/oox/drawingfragment.cxx @@ -536,6 +536,8 @@ Reference< XShape > VmlDrawing::createAndInsertClientXShape( const ::oox::vml::S case XML_Radio: { AxOptionButtonModel& rAxModel = aControl.createModel< AxOptionButtonModel >(); + // unique name to prevent autoGroping with ActiveX controls. + rAxModel.maGroupName = "autoGroup_formControl"; convertControlText( rAxModel.maFontData, rAxModel.mnTextColor, rAxModel.maCaption, pTextBox, pClientData->mnTextHAlign ); convertControlBackground( rAxModel, rShape ); rAxModel.maValue = OUString::number( pClientData->mnChecked ); -- cgit