summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/ole/axcontrol.cxx12
-rw-r--r--sc/qa/unit/data/xlsx/tdf111980_radioButtons.xlsxbin0 -> 20005 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx32
3 files changed, 43 insertions, 1 deletions
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 2eab7a0fa861..350fe0e315f9 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -1554,7 +1554,17 @@ void AxMorphDataModelBase::convertProperties( PropertyMap& rPropMap, const Contr
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
if ( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON )
- rPropMap.setProperty( PROP_GroupName, maGroupName );
+ {
+ // Form Radio Controls (non-ActiveX) have no group name, but autoGroup
+ // with their group box, or frame, or sheet, or document.
+ // So ensure that SOME name is given for a group name
+ // TODO: ActiveX controls without a Group name shouldn't autogroup
+ // with non-ActiveX option buttons.
+ // TODO: each application should test if control's area is fully inside
+ // a GroupBox, and give those a separate group name.
+ OUString sGroupName = !maGroupName.isEmpty() ? maGroupName : "autoGroup_";
+ rPropMap.setProperty( PROP_GroupName, sGroupName );
+ }
AxFontDataModel::convertProperties( rPropMap, rConv );
}
diff --git a/sc/qa/unit/data/xlsx/tdf111980_radioButtons.xlsx b/sc/qa/unit/data/xlsx/tdf111980_radioButtons.xlsx
new file mode 100644
index 000000000000..9f97d9e00a48
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf111980_radioButtons.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index b896d3e47370..ef2b5ee22aef 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -177,6 +177,7 @@ public:
//test shape import
void testControlImport();
+ void testActiveXOptionButtonGroup();
void testChartImportODS();
#if HAVE_MORE_FONTS
void testChartImportXLS();
@@ -290,6 +291,7 @@ public:
CPPUNIT_TEST(testCellValueXLSX);
CPPUNIT_TEST(testRowIndex1BasedXLSX);
CPPUNIT_TEST(testControlImport);
+ CPPUNIT_TEST(testActiveXOptionButtonGroup);
CPPUNIT_TEST(testChartImportODS);
#if HAVE_MORE_FONTS
CPPUNIT_TEST(testChartImportXLS);
@@ -1676,6 +1678,36 @@ void ScFiltersTest::testControlImport()
xDocSh->DoClose();
}
+void ScFiltersTest::testActiveXOptionButtonGroup()
+{
+ ScDocShellRef xDocSh = loadDoc("tdf111980_radioButtons.", FORMAT_XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load singlecontrol.xlsx", xDocSh.is());
+ uno::Reference< frame::XModel > xModel = xDocSh->GetModel();
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(xModel, UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), UNO_QUERY_THROW);
+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xIA->getByIndex(0), UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xIA_DrawPage(xDrawPageSupplier->getDrawPage(), UNO_QUERY_THROW);
+
+ OUString sGroupName;
+ uno::Reference< drawing::XControlShape > xControlShape(xIA_DrawPage->getByIndex(0), UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY_THROW);
+ xPropertySet->getPropertyValue("GroupName") >>= sGroupName;
+ CPPUNIT_ASSERT_EQUAL(OUString("Sheet1"), sGroupName);
+
+ // Form optionbuttons (without Group names) were not grouped.
+ // The two optionbuttons should have the same auto-generated group name.
+ 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());
+
+ 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);
+}
+
void ScFiltersTest::testChartImportODS()
{
ScDocShellRef xDocSh = loadDoc("chart-import-basic.", FORMAT_ODS);