diff options
-rwxr-xr-x | sc/qa/unit/data/xlsx/tdf97598_scenarios.xlsx | bin | 0 -> 8400 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 15 | ||||
-rw-r--r-- | sc/source/filter/inc/scenariobuffer.hxx | 3 | ||||
-rw-r--r-- | sc/source/filter/oox/scenariobuffer.cxx | 23 |
4 files changed, 24 insertions, 17 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf97598_scenarios.xlsx b/sc/qa/unit/data/xlsx/tdf97598_scenarios.xlsx Binary files differnew file mode 100755 index 000000000000..ba3f43f8e499 --- /dev/null +++ b/sc/qa/unit/data/xlsx/tdf97598_scenarios.xlsx diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 3b5efca85439..8873513f7212 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -239,6 +239,7 @@ public: void testTdf100458(); void testTdf100709XLSX(); + void testTdf97598XLSX(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -355,6 +356,7 @@ public: CPPUNIT_TEST(testTdf100458); CPPUNIT_TEST(testTdf100709XLSX); + CPPUNIT_TEST(testTdf97598XLSX); CPPUNIT_TEST_SUITE_END(); @@ -3849,6 +3851,19 @@ void ScFiltersTest::testTdf100709XLSX() xDocSh->DoClose(); } +void ScFiltersTest::testTdf97598XLSX() +{ + ScDocShellRef xDocSh = loadDoc("tdf97598_scenarios.", FORMAT_XLSX); + CPPUNIT_ASSERT_MESSAGE("Failed to load tdf97598_secenarios.xlsx", xDocSh.Is()); + + ScDocument& rDoc = xDocSh->GetDocument(); + OUString aStr = rDoc.GetString(0, 0, 0); // A1 + CPPUNIT_ASSERT_EQUAL(OUString("Cell A1"), aStr); + + xDocSh->DoClose(); +} + + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { diff --git a/sc/source/filter/inc/scenariobuffer.hxx b/sc/source/filter/inc/scenariobuffer.hxx index cfe18f7eb94a..ddfbee5e86a8 100644 --- a/sc/source/filter/inc/scenariobuffer.hxx +++ b/sc/source/filter/inc/scenariobuffer.hxx @@ -44,6 +44,7 @@ struct ScenarioModel OUString maUser; /// Name of user created the scenario. bool mbLocked; /// True = input cell values locked. bool mbHidden; /// True = scenario is hidden. + bool mbActive; explicit ScenarioModel(); }; @@ -51,7 +52,7 @@ struct ScenarioModel class Scenario : public WorkbookHelper { public: - explicit Scenario( const WorkbookHelper& rHelper, sal_Int16 nSheet ); + explicit Scenario( const WorkbookHelper& rHelper, sal_Int16 nSheet, bool bIsActive ); /** Imports a scenario definition from a scenario element. */ void importScenario( const AttributeList& rAttribs ); diff --git a/sc/source/filter/oox/scenariobuffer.cxx b/sc/source/filter/oox/scenariobuffer.cxx index 0060adf80df7..1ae9becb6a21 100644 --- a/sc/source/filter/oox/scenariobuffer.cxx +++ b/sc/source/filter/oox/scenariobuffer.cxx @@ -50,14 +50,16 @@ ScenarioCellModel::ScenarioCellModel() : ScenarioModel::ScenarioModel() : mbLocked( false ), - mbHidden( false ) + mbHidden( false ), + mbActive( false ) { } -Scenario::Scenario( const WorkbookHelper& rHelper, sal_Int16 nSheet ) : +Scenario::Scenario( const WorkbookHelper& rHelper, sal_Int16 nSheet, bool bIsActive ) : WorkbookHelper( rHelper ), mnSheet( nSheet ) { + maModel.mbActive = bIsActive; } void Scenario::importScenario( const AttributeList& rAttribs ) @@ -138,7 +140,7 @@ void Scenario::finalizeImport() // scenario properties PropertySet aPropSet( xScenarios->getByName( aScenName ) ); - aPropSet.setProperty( PROP_IsActive, false ); + aPropSet.setProperty( PROP_IsActive, maModel.mbActive ); aPropSet.setProperty( PROP_CopyBack, false ); aPropSet.setProperty( PROP_CopyStyles, false ); aPropSet.setProperty( PROP_CopyFormulas, false ); @@ -178,7 +180,8 @@ void SheetScenarios::importScenarios( SequenceInputStream& rStrm ) Scenario& SheetScenarios::createScenario() { - ScenarioVector::value_type xScenario( new Scenario( *this, mnSheet ) ); + bool bIsActive = maScenarios.size() == (sal_uInt32) maModel.mnShown; + ScenarioVector::value_type xScenario( new Scenario( *this, mnSheet, bIsActive ) ); maScenarios.push_back( xScenario ); return *xScenario; } @@ -186,18 +189,6 @@ Scenario& SheetScenarios::createScenario() void SheetScenarios::finalizeImport() { maScenarios.forEachMem( &Scenario::finalizeImport ); - - // activate a scenario - try - { - Reference< XScenariosSupplier > xScenariosSupp( getSheetFromDoc( mnSheet ), UNO_QUERY_THROW ); - Reference< XIndexAccess > xScenariosIA( xScenariosSupp->getScenarios(), UNO_QUERY_THROW ); - Reference< XScenario > xScenario( xScenariosIA->getByIndex( maModel.mnShown ), UNO_QUERY_THROW ); - xScenario->apply(); - } - catch( Exception& ) - { - } } ScenarioBuffer::ScenarioBuffer( const WorkbookHelper& rHelper ) : |