diff options
-rw-r--r-- | include/test/sheet/xspreadsheets2.hxx | 2 | ||||
-rw-r--r-- | test/source/sheet/xspreadsheets2.cxx | 29 |
2 files changed, 11 insertions, 20 deletions
diff --git a/include/test/sheet/xspreadsheets2.hxx b/include/test/sheet/xspreadsheets2.hxx index e3928d349efb..1340b80be216 100644 --- a/include/test/sheet/xspreadsheets2.hxx +++ b/include/test/sheet/xspreadsheets2.hxx @@ -46,7 +46,7 @@ protected: css::uno::Reference< css::sheet::XSpreadsheetDocument> xDocument; private: - css::uno::Reference< css::sheet::XSpreadsheetDocument> getDoc(const OUString&, css::uno::Reference< css::lang::XComponent >&); + css::uno::Reference< css::sheet::XSpreadsheetDocument> getDoc(const OUString&); static css::uno::Reference< css::sheet::XNamedRanges> getNamedRanges(css::uno::Reference< css::sheet::XSpreadsheetDocument > const &); void importSheetToCopy(); static bool isExternalReference(const OUString& aDestContent, const OUString& aSrcContent ); diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx index cea68e1cfad9..ab3ef3e75688 100644 --- a/test/source/sheet/xspreadsheets2.cxx +++ b/test/source/sheet/xspreadsheets2.cxx @@ -275,13 +275,12 @@ void XSpreadsheets2::testImportCellStyle() CPPUNIT_ASSERT_EQUAL_MESSAGE("New style: VertJustify not set", table::CellVertJustify_CENTER, static_cast<table::CellVertJustify>(aVertJustify)); } -uno::Reference< sheet::XSpreadsheetDocument> XSpreadsheets2::getDoc(const OUString& aFileBase, uno::Reference< lang::XComponent >& xComp) +uno::Reference< sheet::XSpreadsheetDocument> XSpreadsheets2::getDoc(const OUString& aFileBase) { OUString aFileURL; createFileURL(aFileBase, aFileURL); - if (!xComp.is()) - xComp = loadFromDesktop(aFileURL); + uno::Reference< lang::XComponent > xComp = loadFromDesktop(aFileURL); CPPUNIT_ASSERT(xComp.is()); @@ -301,22 +300,14 @@ void XSpreadsheets2::importSheetToCopy() uno::Reference< container::XNameAccess> xSrcNameAccess(init(),UNO_QUERY_THROW); xSrcSheet.set( xSrcNameAccess->getByName(gaSrcSheetName), UNO_QUERY_THROW); - uno::Reference< lang::XComponent > xDestComponent; - if (!xDestComponent.is()) - { - xDestDoc = getDoc(gaDestFileBase, xDestComponent); - CPPUNIT_ASSERT(xDestDoc.is()); - - // import sheet - uno::Reference< sheet::XSpreadsheets2 > xDestSheets (xDestDoc->getSheets(), UNO_QUERY_THROW); - sal_Int32 nDestPos = 0; - sal_Int32 nDestPosEffective = xDestSheets->importSheet(xDocument, gaSrcSheetName, nDestPos); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong sheet index", nDestPosEffective, nDestPos); - } - else - { - xDestDoc.set(xDestComponent,UNO_QUERY_THROW); - } + xDestDoc = getDoc(gaDestFileBase); + CPPUNIT_ASSERT(xDestDoc.is()); + + // import sheet + uno::Reference< sheet::XSpreadsheets2 > xDestSheets (xDestDoc->getSheets(), UNO_QUERY_THROW); + sal_Int32 nDestPos = 0; + sal_Int32 nDestPosEffective = xDestSheets->importSheet(xDocument, gaSrcSheetName, nDestPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong sheet index", nDestPosEffective, nDestPos); uno::Reference< container::XNameAccess > xDestSheetNameAccess (xDestDoc->getSheets(), UNO_QUERY_THROW); xDestSheet.set( xDestSheetNameAccess->getByName(gaSrcSheetName), UNO_QUERY_THROW); |