From 048b8e45813f6a19a4ff56e1d676fe9450325cd2 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Sat, 29 Sep 2018 14:38:31 +0300 Subject: tdf#111980 oox optionbutton autoGroup inside GroupBox The area of a GroupBox indicates which radio buttons are considered to be part of the same group. The button needs to be fully inside of the groupbox in order to participate. This patch resolves the last worry of commit 9f969799629fe6bdf8b922d8cb922846aa646ece Change-Id: Ie6057337c63bf9eb173a0615e30c8d4e4d0c7a19 Reviewed-on: https://gerrit.libreoffice.org/61131 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna --- sc/qa/unit/subsequent_filters-test.cxx | 27 +++++++++++++++++++++++++++ sc/source/filter/oox/drawingfragment.cxx | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) (limited to 'sc') diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 188a957f5440..f06aca38ecf5 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1724,6 +1724,33 @@ void ScFiltersTest::testActiveXOptionButtonGroup() CPPUNIT_ASSERT_EQUAL( sGroupName4, sGroupName5 ); CPPUNIT_ASSERT( sGroupName2 != sGroupName5 ); CPPUNIT_ASSERT( sGroupName != sGroupName5 ); + + OUString sGroupName7; //Form radiobutton autogrouped by GroupBox + xControlShape.set(xIA_DrawPage->getByIndex(7), uno::UNO_QUERY_THROW); + xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW); + xPropertySet->getPropertyValue("GroupName") >>= sGroupName7; + CPPUNIT_ASSERT_EQUAL( OUString("autoGroup_Group Box 7"), sGroupName7 ); + + OUString sGroupName8; + xControlShape.set(xIA_DrawPage->getByIndex(8), uno::UNO_QUERY_THROW); + xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW); + xPropertySet->getPropertyValue("GroupName") >>= sGroupName8; + CPPUNIT_ASSERT_EQUAL( sGroupName7, sGroupName8 ); + CPPUNIT_ASSERT( sGroupName4 != sGroupName8 ); + CPPUNIT_ASSERT( sGroupName2 != sGroupName8 ); + CPPUNIT_ASSERT( sGroupName != sGroupName8 ); + + OUString sGroupName9; //Form radiobutton not fully inside GroupBox + xControlShape.set(xIA_DrawPage->getByIndex(9), uno::UNO_QUERY_THROW); + xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW); + xPropertySet->getPropertyValue("GroupName") >>= sGroupName9; + CPPUNIT_ASSERT_EQUAL( sGroupName4, sGroupName9 ); + + OUString sGroupName10; //ActiveX unaffected by GroupBox + xControlShape.set(xIA_DrawPage->getByIndex(10), uno::UNO_QUERY_THROW); + xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW); + xPropertySet->getPropertyValue("GroupName") >>= sGroupName10; + CPPUNIT_ASSERT_EQUAL( sGroupName, sGroupName10 ); } void ScFiltersTest::testChartImportODS() diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx index 47346ca81191..b091318bed45 100644 --- a/sc/source/filter/oox/drawingfragment.cxx +++ b/sc/source/filter/oox/drawingfragment.cxx @@ -536,7 +536,8 @@ Reference< XShape > VmlDrawing::createAndInsertClientXShape( const ::oox::vml::S case XML_Radio: { AxOptionButtonModel& rAxModel = aControl.createModel< AxOptionButtonModel >(); - // unique name to prevent autoGrouping with ActiveX controls. + + // unique name to prevent autoGrouping with ActiveX controls and which a GroupBox may override - see vmldrawing.cxx. rAxModel.maGroupName = "autoGroup_formControl"; convertControlText( rAxModel.maFontData, rAxModel.mnTextColor, rAxModel.maCaption, pTextBox, pClientData->mnTextHAlign ); convertControlBackground( rAxModel, rShape ); -- cgit