summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cppcanvas/qa/extras/emfplus/emfplus.cxx4
-rw-r--r--dbaccess/qa/extras/macros-test.cxx7
-rw-r--r--dbaccess/qa/unit/dbtest_base.cxx14
-rw-r--r--dbaccess/qa/unit/embeddeddb_performancetest.cxx3
-rw-r--r--dbaccess/qa/unit/firebird.cxx7
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx12
-rw-r--r--include/test/sheet/xspreadsheets2.hxx2
-rw-r--r--include/test/unoapi_test.hxx3
-rw-r--r--sc/qa/extras/macros-test.cxx114
-rw-r--r--sc/qa/extras/new_cond_format.cxx4
-rw-r--r--sc/qa/extras/recordchanges-test.cxx4
-rw-r--r--sc/qa/extras/scannotationobj.cxx4
-rw-r--r--sc/qa/extras/scannotationsobj.cxx4
-rw-r--r--sc/qa/extras/sccellcursorobj.cxx4
-rw-r--r--sc/qa/extras/sccellrangeobj.cxx4
-rw-r--r--sc/qa/extras/scdatabaserangeobj.cxx5
-rw-r--r--sc/qa/extras/scdatapilotfieldobj.cxx4
-rw-r--r--sc/qa/extras/scdatapilottableobj.cxx4
-rw-r--r--sc/qa/extras/scmodelobj.cxx4
-rw-r--r--sc/qa/extras/scnamedrangeobj.cxx4
-rw-r--r--sc/qa/extras/scnamedrangesobj.cxx4
-rw-r--r--sc/qa/extras/scoutlineobj.cxx4
-rw-r--r--sc/qa/extras/scpdfexport.cxx24
-rw-r--r--sc/qa/extras/scsheetlinksobj.cxx3
-rw-r--r--sc/qa/extras/scstylefamiliesobj.cxx7
-rw-r--r--sc/qa/extras/sctablesheetobj.cxx3
-rw-r--r--sc/qa/extras/sctablesheetsobj.cxx20
-rw-r--r--sc/qa/extras/vba-macro-test.cxx75
-rw-r--r--sc/qa/perf/scperfobj.cxx68
-rw-r--r--sc/qa/unit/cond_format_merge.cxx4
-rw-r--r--sc/qa/unit/scshapetest.cxx93
-rw-r--r--sc/qa/unit/uicalc/uicalc.cxx6
-rw-r--r--sccomp/qa/unit/SwarmSolverTest.cxx20
-rw-r--r--sd/qa/filter/eppt/eppt.cxx8
-rw-r--r--test/source/sheet/xspreadsheets2.cxx5
-rw-r--r--test/source/unoapi_test.cxx11
-rw-r--r--vcl/qa/cppunit/gen/gen.cxx4
37 files changed, 165 insertions, 405 deletions
diff --git a/cppcanvas/qa/extras/emfplus/emfplus.cxx b/cppcanvas/qa/extras/emfplus/emfplus.cxx
index 2d96c5957fba..15b2133552f2 100644
--- a/cppcanvas/qa/extras/emfplus/emfplus.cxx
+++ b/cppcanvas/qa/extras/emfplus/emfplus.cxx
@@ -31,9 +31,7 @@ public:
Bitmap load(const char* pName)
{
- OUString aFileURL;
- createFileURL(OUString::createFromAscii(pName), aFileURL);
- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.drawing.DrawingDocument");
+ loadFromURL(OUString::createFromAscii(pName));
SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
CPPUNIT_ASSERT(pModel);
SfxObjectShell* pShell = pModel->GetObjectShell();
diff --git a/dbaccess/qa/extras/macros-test.cxx b/dbaccess/qa/extras/macros-test.cxx
index 8adcc8a2a9bd..296c4e4b1f04 100644
--- a/dbaccess/qa/extras/macros-test.cxx
+++ b/dbaccess/qa/extras/macros-test.cxx
@@ -33,12 +33,7 @@ DBAccessTest::DBAccessTest()
{
}
-void DBAccessTest::test()
-{
- OUString aFileName;
- createFileURL(u"testdb.odb", aFileName);
- mxComponent = loadFromDesktop(aFileName);
-}
+void DBAccessTest::test() { loadFromURL(u"testdb.odb"); }
CPPUNIT_TEST_SUITE_REGISTRATION(DBAccessTest);
diff --git a/dbaccess/qa/unit/dbtest_base.cxx b/dbaccess/qa/unit/dbtest_base.cxx
index 798c5523a929..8e7d2ab433c9 100644
--- a/dbaccess/qa/unit/dbtest_base.cxx
+++ b/dbaccess/qa/unit/dbtest_base.cxx
@@ -32,9 +32,6 @@ public:
utl::TempFileNamed createTempCopy(std::u16string_view pathname);
- uno::Reference< XOfficeDatabaseDocument >
- getDocumentForFileName(std::u16string_view sFileName);
-
uno::Reference<XOfficeDatabaseDocument> getDocumentForUrl(OUString const & url);
uno::Reference< XConnection >
@@ -43,8 +40,7 @@ public:
};
utl::TempFileNamed DBTestBase::createTempCopy(std::u16string_view pathname) {
- OUString url;
- createFileURL(pathname, url);
+ OUString url = createFileURL(pathname);
utl::TempFileNamed tmp;
tmp.EnableKillingFile();
auto const e = osl::File::copy(url, tmp.GetURL());
@@ -57,14 +53,6 @@ utl::TempFileNamed DBTestBase::createTempCopy(std::u16string_view pathname) {
return tmp;
}
-uno::Reference< XOfficeDatabaseDocument >
- DBTestBase::getDocumentForFileName(std::u16string_view sFileName)
-{
- OUString sFilePath;
- createFileURL(sFileName, sFilePath);
- return getDocumentForUrl(sFilePath);
-}
-
uno::Reference<XOfficeDatabaseDocument> DBTestBase::getDocumentForUrl(OUString const & url) {
mxComponent = loadFromDesktop(url);
uno::Reference< XOfficeDatabaseDocument > xDocument(mxComponent, UNO_QUERY_THROW);
diff --git a/dbaccess/qa/unit/embeddeddb_performancetest.cxx b/dbaccess/qa/unit/embeddeddb_performancetest.cxx
index 600704ef787d..921fc9977d98 100644
--- a/dbaccess/qa/unit/embeddeddb_performancetest.cxx
+++ b/dbaccess/qa/unit/embeddeddb_performancetest.cxx
@@ -124,8 +124,7 @@ public:
SvFileStream* EmbeddedDBPerformanceTest::getWordListStream()
{
- OUString wlPath;
- createFileURL(u"wordlist", wlPath);
+ OUString wlPath = createFileURL(u"wordlist");
return new SvFileStream(wlPath, StreamMode::READ);
}
diff --git a/dbaccess/qa/unit/firebird.cxx b/dbaccess/qa/unit/firebird.cxx
index 9e1c76dd0700..076144e1b054 100644
--- a/dbaccess/qa/unit/firebird.cxx
+++ b/dbaccess/qa/unit/firebird.cxx
@@ -59,8 +59,8 @@ void FirebirdTest::testEmptyDBConnection()
*/
void FirebirdTest::testIntegerDatabase()
{
- uno::Reference< XOfficeDatabaseDocument > xDocument =
- getDocumentForFileName(u"firebird_integer_ods12.odb");
+ loadFromURL(u"firebird_integer_ods12.odb");
+ uno::Reference< XOfficeDatabaseDocument > xDocument(mxComponent, UNO_QUERY_THROW);
uno::Reference< XConnection > xConnection =
getConnectionForDocument(xDocument);
@@ -97,7 +97,8 @@ void FirebirdTest::testIntegerDatabase()
void FirebirdTest::testTdf132924()
{
- uno::Reference<XOfficeDatabaseDocument> xDocument = getDocumentForFileName(u"tdf132924.odb");
+ loadFromURL(u"tdf132924.odb");
+ uno::Reference< XOfficeDatabaseDocument > xDocument(mxComponent, UNO_QUERY_THROW);
uno::Reference<XConnection> xConnection = getConnectionForDocument(xDocument);
uno::Reference<XStatement> xStatement = xConnection->createStatement();
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 86932809328a..2ac74ba74a87 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -372,8 +372,7 @@ DesktopLOKTest::loadDocUrlImpl(const OUString& rFileURL, LibreOfficeKitDocumentT
std::unique_ptr<LibLODocument_Impl>
DesktopLOKTest::loadDocImpl(const char* pName, LibreOfficeKitDocumentType eType)
{
- OUString aFileURL;
- createFileURL(OUString::createFromAscii(pName), aFileURL);
+ OUString aFileURL = createFileURL(OUString::createFromAscii(pName));
return loadDocUrlImpl(aFileURL, eType);
}
@@ -758,8 +757,7 @@ void DesktopLOKTest::testPasteWriterJPEG()
{
LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
- OUString aFileURL;
- createFileURL(u"paste.jpg", aFileURL);
+ OUString aFileURL = createFileURL(u"paste.jpg");
std::ifstream aImageStream(aFileURL.toUtf8().copy(strlen("file://")).getStr());
std::vector<char> aImageContents((std::istreambuf_iterator<char>(aImageStream)), std::istreambuf_iterator<char>());
@@ -2675,8 +2673,7 @@ void DesktopLOKTest::testExtractParameter()
void DesktopLOKTest::readFileIntoByteVector(std::u16string_view sFilename, std::vector<unsigned char> & rByteVector)
{
rByteVector.clear();
- OUString aURL;
- createFileURL(sFilename, aURL);
+ OUString aURL = createFileURL(sFilename);
SvFileStream aStream(aURL, StreamMode::READ);
rByteVector.resize(aStream.remainingSize());
aStream.ReadBytes(rByteVector.data(), aStream.remainingSize());
@@ -3053,8 +3050,7 @@ void DesktopLOKTest::testComplexSelection()
"", nullptr, nullptr));
// Paste an image.
- OUString aFileURL;
- createFileURL(u"paste.jpg", aFileURL);
+ OUString aFileURL = createFileURL(u"paste.jpg");
std::ifstream aImageStream(aFileURL.toUtf8().copy(strlen("file://")).getStr());
std::vector<char> aImageContents((std::istreambuf_iterator<char>(aImageStream)), std::istreambuf_iterator<char>());
CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "image/jpeg", aImageContents.data(), aImageContents.size()));
diff --git a/include/test/sheet/xspreadsheets2.hxx b/include/test/sheet/xspreadsheets2.hxx
index e96367d9472f..1b8d9b8023e3 100644
--- a/include/test/sheet/xspreadsheets2.hxx
+++ b/include/test/sheet/xspreadsheets2.hxx
@@ -38,10 +38,8 @@ public:
void testImportCellStyle();
void testLastAfterInsertCopy();
- virtual css::uno::Reference< css::lang::XComponent > getComponent() = 0;
virtual css::uno::Reference< css::uno::XInterface > init() = 0;
virtual css::uno::Reference< css::lang::XComponent > loadFromDesktop(const OUString&) = 0;
- virtual void createFileURL(const OUString&, OUString&) = 0;
protected:
css::uno::Reference< css::sheet::XSpreadsheetDocument> xDocument;
diff --git a/include/test/unoapi_test.hxx b/include/test/unoapi_test.hxx
index 8dbc3acc257e..d38453432f54 100644
--- a/include/test/unoapi_test.hxx
+++ b/include/test/unoapi_test.hxx
@@ -27,7 +27,8 @@ class OOO_DLLPUBLIC_TEST UnoApiTest : public test::BootstrapFixture, public unot
public:
UnoApiTest(OUString path);
- void createFileURL(std::u16string_view aFileBase, OUString& rFilePath);
+ OUString createFileURL(std::u16string_view aFileBase);
+ OUString loadFromURL(std::u16string_view aFileBase);
virtual void setUp() override;
virtual void tearDown() override;
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 48b16ba80547..9a633d79854c 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -125,10 +125,7 @@ void ScMacrosTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
// module, we could move the test there then ) - relates to fdo#67547
void ScMacrosTest::testMSP()
{
- OUString aFileName;
- createFileURL(u"MasterScriptProviderProblem.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
-
+ loadFromURL(u"MasterScriptProviderProblem.ods");
Any aRet = executeMacro("vnd.sun.Star.script:Standard.Module1.TestMSP?language=Basic&location=document");
OUString sResult;
@@ -140,9 +137,7 @@ void ScMacrosTest::testMSP()
void ScMacrosTest::testPasswordProtectedStarBasic()
{
- OUString aFileName;
- createFileURL(u"testTypePassword.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"testTypePassword.ods");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -174,9 +169,7 @@ void ScMacrosTest::testPasswordProtectedStarBasic()
void ScMacrosTest::testStarBasic()
{
- OUString aFileName;
- createFileURL(u"StarBasic.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"StarBasic.ods");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -191,9 +184,7 @@ void ScMacrosTest::testStarBasic()
void ScMacrosTest::testRowColumn()
{
- OUString aFileName;
- createFileURL(u"StarBasic.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"StarBasic.ods");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -213,9 +204,7 @@ void ScMacrosTest::testRowColumn()
void ScMacrosTest::testTdf146742()
{
- OUString aFileName;
- createFileURL(u"tdf146742.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf146742.ods");
// Export to ODS and reload the file
saveAndReload("calc8");
@@ -238,9 +227,7 @@ void ScMacrosTest::testTdf146742()
void ScMacrosTest::testMacroButtonFormControlXlsxExport()
{
// Given a button form control with an associated macro:
- OUString aFileName;
- createFileURL(u"macro-button-form-control.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"macro-button-form-control.xlsm");
// When exporting to XLSM:
auto pTempFile = std::make_shared<utl::TempFileNamed>(save("Calc MS Excel 2007 VBA XML"));
@@ -262,9 +249,7 @@ void ScMacrosTest::testMacroButtonFormControlXlsxExport()
void ScMacrosTest::testTdf104902()
{
- OUString aFileName;
- createFileURL(u"tdf104902.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf104902.ods");
executeMacro("vnd.sun.Star.script:Standard.Module1.display_bug?language=Basic&location=document");
@@ -288,9 +273,7 @@ void ScMacrosTest::testTdf104902()
void ScMacrosTest::testTdf64639()
{
- OUString aFileName;
- createFileURL(u"tdf64639.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf64639.ods");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -319,9 +302,7 @@ void ScMacrosTest::testTdf64639()
void ScMacrosTest::testTdf142033()
{
- OUString aFileName;
- createFileURL(u"tdf142033.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf142033.ods");
executeMacro("vnd.sun.Star.script:Standard.Module1.display_bug?language=Basic&location=document");
@@ -352,9 +333,7 @@ void ScMacrosTest::testPasswordProtectedUnicodeString()
u"vnd.sun.Star.script:Protected.Module1.TestUnicodeString?language=Basic&location=document");
static const OUStringLiteral sLibName(u"Protected");
- OUString aFileName;
- createFileURL(u"tdf57113.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf57113.ods");
// Check that loading password-protected macro image correctly loads Unicode strings
{
@@ -394,9 +373,7 @@ void ScMacrosTest::testPasswordProtectedArrayInUserType()
u"vnd.sun.Star.script:Protected.Module1.TestMyType?language=Basic&location=document");
static const OUStringLiteral sLibName(u"Protected");
- OUString aFileName;
- createFileURL(u"ProtectedArrayInCustomType.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"ProtectedArrayInCustomType.ods");
// Check that loading password-protected macro image correctly loads array bounds
{
@@ -432,9 +409,7 @@ void ScMacrosTest::testPasswordProtectedArrayInUserType()
void ScMacrosTest::testTdf114427()
{
- OUString aFileName;
- createFileURL(u"tdf114427.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf114427.ods");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -465,9 +440,7 @@ void ScMacrosTest::testTdf131296_legacy()
{ "TestDoubleConst", "Double: 123" },
});
- OUString aFileName;
- createFileURL(u"tdf131296_legacy.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf131296_legacy.ods");
{
for (auto& [sTestName, sExpected] : aTests)
{
@@ -493,9 +466,7 @@ void ScMacrosTest::testTdf131296_new()
{ "TestCurrencyConst", "Currency: 123.0000" },
});
- OUString aFileName;
- createFileURL(u"tdf131296_new.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf131296_new.ods");
{
for (auto& [sTestName, sExpected] : aTests)
{
@@ -511,9 +482,7 @@ void ScMacrosTest::testTdf131296_new()
void ScMacrosTest::testTdf46119()
{
- OUString aFileName;
- createFileURL(u"tdf46119.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf46119.ods");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -541,9 +510,7 @@ void ScMacrosTest::testTdf46119()
void ScMacrosTest::testTdf128218()
{
- OUString aFileName;
- createFileURL(u"tdf128218.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf128218.ods");
Any aRet = executeMacro("vnd.sun.Star.script:Standard.Module1.TestRAND?language=Basic&location=document");
@@ -585,9 +552,7 @@ void ScMacrosTest::testTdf71271()
void ScMacrosTest::testTdf43003()
{
- OUString aFileName;
- createFileURL(u"tdf43003.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf43003.ods");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
CPPUNIT_ASSERT(pFoundShell);
@@ -606,9 +571,7 @@ void ScMacrosTest::testTdf43003()
void ScMacrosTest::testTdf75263()
{
- OUString aFileName;
- createFileURL(u"tdf75263.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf75263.xlsm");
{
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -639,9 +602,7 @@ void ScMacrosTest::testTdf75263()
void ScMacrosTest::testTdf133887()
{
- OUString aFileName;
- createFileURL(u"tdf133887.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf133887.ods");
css::uno::Any aRet;
css::uno::Sequence<sal_Int16> aOutParamIndex;
@@ -665,9 +626,7 @@ void ScMacrosTest::testTdf133887()
void ScMacrosTest::testTdf133889()
{
- OUString aFileName;
- createFileURL(u"tdf133889.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf133889.ods");
css::uno::Any aRet;
css::uno::Sequence<sal_Int16> aOutParamIndex;
@@ -691,9 +650,7 @@ void ScMacrosTest::testTdf133889()
void ScMacrosTest::testTdf143582()
{
- OUString aFileName;
- createFileURL(u"tdf143582.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf143582.ods");
Any aRet = executeMacro("vnd.sun.Star.script:Standard.Module1.TestScriptInvoke?language=Basic&location=document");
@@ -708,9 +665,7 @@ void ScMacrosTest::testTdf143582()
void ScMacrosTest::testTdf144085()
{
- OUString aFileName;
- createFileURL(u"tdf144085.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf144085.ods");
Any aRet = executeMacro("vnd.sun.Star.script:Standard.Module1.TestScriptInvoke?language=Basic&location=document");
@@ -725,9 +680,7 @@ void ScMacrosTest::testTdf144085()
void ScMacrosTest::testTdf125800()
{
- OUString aFileName;
- createFileURL(u"tdf125800.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf125800.ods");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -759,9 +712,7 @@ void ScMacrosTest::testTdf125800()
void ScMacrosTest::testTdf130307()
{
- OUString aFileName;
- createFileURL(u"tdf130307.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf130307.ods");
Any aRet = executeMacro("vnd.sun.Star.script:Standard.Module1.ForEachSheets?language=Basic&location=document");
@@ -774,9 +725,7 @@ void ScMacrosTest::testTdf130307()
void ScMacrosTest::testTdf144970()
{
- OUString aFileName;
- createFileURL(u"tdf144970.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf144970.ods");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -804,9 +753,7 @@ void ScMacrosTest::testTdf144970()
void ScMacrosTest::testTdf138646()
{
- OUString aFileName;
- createFileURL(u"tdf138646.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf138646.ods");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
@@ -840,9 +787,7 @@ void ScMacrosTest::testTdf138646()
void ScMacrosTest::testTdf105558()
{
- OUString aFileName;
- createFileURL(u"tdf105558.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf105558.ods");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
CPPUNIT_ASSERT(pFoundShell);
@@ -946,9 +891,8 @@ void ScMacrosTest::testShapeLayerId()
void ScMacrosTest::testFunctionAccessIndirect()
{
- OUString aFileName;
- createFileURL(u"tdf120161.ods", aFileName); // just some document with known values in cells
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ OUString aFileName = loadFromURL(u"tdf120161.ods"); // just some document with known values in cells
+
const OUString aReference = "'" + aFileName + "'#$Sheet1.A1";
css::uno::Reference<css::sheet::XFunctionAccess> xFunc(
diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx
index a7e7972eaa9e..dd4d2354f546 100644
--- a/sc/qa/extras/new_cond_format.cxx
+++ b/sc/qa/extras/new_cond_format.cxx
@@ -440,9 +440,7 @@ void ScConditionalFormatTest::setUp()
{
UnoApiTest::setUp();
// get the test file
- OUString aFileURL;
- createFileURL(u"new_cond_format_api.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"new_cond_format_api.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScConditionalFormatTest);
diff --git a/sc/qa/extras/recordchanges-test.cxx b/sc/qa/extras/recordchanges-test.cxx
index b0961625afb1..50774a8a0cb2 100644
--- a/sc/qa/extras/recordchanges-test.cxx
+++ b/sc/qa/extras/recordchanges-test.cxx
@@ -62,9 +62,7 @@ void ScRecordChangesTest::testSetRecordChanges()
void ScRecordChangesTest::testCheckRecordChangesProtection()
{
// test with protected changes
- OUString aFileName;
- createFileURL(u"RecordChangesProtected.ods", aFileName);
- mxComponent = loadFromDesktop(aFileName);
+ loadFromURL(u"RecordChangesProtected.ods");
uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference<beans::XPropertySet> xDocSettingsPropSet(xDoc, UNO_QUERY_THROW);
diff --git a/sc/qa/extras/scannotationobj.cxx b/sc/qa/extras/scannotationobj.cxx
index dba7cce666cc..4498ff5ad743 100644
--- a/sc/qa/extras/scannotationobj.cxx
+++ b/sc/qa/extras/scannotationobj.cxx
@@ -123,9 +123,7 @@ void ScAnnontationObj::setUp()
UnoApiTest::setUp();
// get the test file
- OUString aFileURL;
- createFileURL(u"ScAnnotationObj.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"ScAnnotationObj.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScAnnontationObj);
diff --git a/sc/qa/extras/scannotationsobj.cxx b/sc/qa/extras/scannotationsobj.cxx
index 5afcae6deceb..8e711f8e9362 100644
--- a/sc/qa/extras/scannotationsobj.cxx
+++ b/sc/qa/extras/scannotationsobj.cxx
@@ -99,9 +99,7 @@ void ScAnnontationsObj::setUp()
UnoApiTest::setUp();
// get the test file
- OUString aFileURL;
- createFileURL(u"ScAnnotationObj.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"ScAnnotationObj.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScAnnontationsObj);
diff --git a/sc/qa/extras/sccellcursorobj.cxx b/sc/qa/extras/sccellcursorobj.cxx
index b9629e25014a..de237299275b 100644
--- a/sc/qa/extras/sccellcursorobj.cxx
+++ b/sc/qa/extras/sccellcursorobj.cxx
@@ -202,9 +202,7 @@ void ScCellCursorObj::setUp()
{
UnoApiTest::setUp();
- OUString aFileURL;
- createFileURL(u"ScCellCursorObj.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"ScCellCursorObj.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScCellCursorObj);
diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx
index aa41dd9588ad..c7635cb21022 100644
--- a/sc/qa/extras/sccellrangeobj.cxx
+++ b/sc/qa/extras/sccellrangeobj.cxx
@@ -245,9 +245,7 @@ void ScCellRangeObj::setUp()
{
UnoApiTest::setUp();
- OUString aFileURL;
- createFileURL(u"xcellrangesquery.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"xcellrangesquery.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScCellRangeObj);
diff --git a/sc/qa/extras/scdatabaserangeobj.cxx b/sc/qa/extras/scdatabaserangeobj.cxx
index 91491a8fbdc4..178ce8e680b6 100644
--- a/sc/qa/extras/scdatabaserangeobj.cxx
+++ b/sc/qa/extras/scdatabaserangeobj.cxx
@@ -97,10 +97,7 @@ void ScDatabaseRangeObj::setUp()
{
UnoApiTest::setUp();
- OUString aFileURL;
- createFileURL(u"ScDatabaseRangeObj.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
-
+ loadFromURL(u"ScDatabaseRangeObj.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScDatabaseRangeObj);
diff --git a/sc/qa/extras/scdatapilotfieldobj.cxx b/sc/qa/extras/scdatapilotfieldobj.cxx
index c63dcff38c47..df10c2292761 100644
--- a/sc/qa/extras/scdatapilotfieldobj.cxx
+++ b/sc/qa/extras/scdatapilotfieldobj.cxx
@@ -110,9 +110,7 @@ void ScDataPilotFieldObj::setUp()
{
UnoApiTest::setUp();
- OUString aFileURL;
- createFileURL(u"scdatapilotfieldobj.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"scdatapilotfieldobj.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScDataPilotFieldObj);
diff --git a/sc/qa/extras/scdatapilottableobj.cxx b/sc/qa/extras/scdatapilottableobj.cxx
index 67f417f7ea33..2a6bfa08ddd2 100644
--- a/sc/qa/extras/scdatapilottableobj.cxx
+++ b/sc/qa/extras/scdatapilottableobj.cxx
@@ -131,9 +131,7 @@ void ScDataPilotTableObj::setUp()
{
UnoApiTest::setUp();
// create a calc document
- OUString aFileURL;
- createFileURL(u"ScDataPilotTableObj.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"ScDataPilotTableObj.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScDataPilotTableObj);
diff --git a/sc/qa/extras/scmodelobj.cxx b/sc/qa/extras/scmodelobj.cxx
index 1fa843c2ffdf..1c2d9c615f1c 100644
--- a/sc/qa/extras/scmodelobj.cxx
+++ b/sc/qa/extras/scmodelobj.cxx
@@ -105,9 +105,7 @@ void ScModelObj::setUp()
{
UnoApiTest::setUp();
// create a calc document
- OUString aFileURL;
- createFileURL(u"ScModelObj.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"ScModelObj.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScModelObj);
diff --git a/sc/qa/extras/scnamedrangeobj.cxx b/sc/qa/extras/scnamedrangeobj.cxx
index 9e53ac907b4b..7bbd5e510b57 100644
--- a/sc/qa/extras/scnamedrangeobj.cxx
+++ b/sc/qa/extras/scnamedrangeobj.cxx
@@ -92,9 +92,7 @@ void ScNamedRangeObj::setUp()
{
UnoApiTest::setUp();
// create a calc document
- OUString aFileURL;
- createFileURL(u"ScNamedRangeObj.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"ScNamedRangeObj.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScNamedRangeObj);
diff --git a/sc/qa/extras/scnamedrangesobj.cxx b/sc/qa/extras/scnamedrangesobj.cxx
index c02d99930b19..f5415a0b914c 100644
--- a/sc/qa/extras/scnamedrangesobj.cxx
+++ b/sc/qa/extras/scnamedrangesobj.cxx
@@ -134,9 +134,7 @@ void ScNamedRangesObj::setUp()
{
UnoApiTest::setUp();
// create a calc document
- OUString aFileURL;
- createFileURL(u"ScNamedRangeObj.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"ScNamedRangeObj.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScNamedRangesObj);
diff --git a/sc/qa/extras/scoutlineobj.cxx b/sc/qa/extras/scoutlineobj.cxx
index 90175358573b..4e20a9214760 100644
--- a/sc/qa/extras/scoutlineobj.cxx
+++ b/sc/qa/extras/scoutlineobj.cxx
@@ -62,9 +62,7 @@ void ScOutlineObj::setUp()
{
UnoApiTest::setUp();
// create a calc document
- OUString aFileURL;
- createFileURL(u"ScOutlineObj.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"ScOutlineObj.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScOutlineObj);
diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
index acbb8c876310..c3a48c8b4868 100644
--- a/sc/qa/extras/scpdfexport.cxx
+++ b/sc/qa/extras/scpdfexport.cxx
@@ -369,9 +369,7 @@ void ScPDFExportTest::testExportFitToPage_Tdf103516()
void ScPDFExportTest::testUnoCommands_Tdf120161()
{
- OUString aFileURL;
- createFileURL(u"tdf120161.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf120161.ods");
// A1:G1
{
@@ -400,9 +398,7 @@ void ScPDFExportTest::testUnoCommands_Tdf120161()
void ScPDFExportTest::testTdf64703_hiddenPageBreak()
{
- OUString aFileURL;
- createFileURL(u"tdf64703_hiddenPageBreak.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf64703_hiddenPageBreak.ods");
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
@@ -424,9 +420,7 @@ void ScPDFExportTest::testTdf143978()
return;
}
- OUString aFileURL;
- createFileURL(u"tdf143978.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf143978.ods");
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
// A1:A2
@@ -472,9 +466,7 @@ void ScPDFExportTest::testTdf84012()
return;
}
- OUString aFileURL;
- createFileURL(u"tdf84012.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf84012.ods");
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
// A1
@@ -514,9 +506,7 @@ void ScPDFExportTest::testTdf78897()
return;
}
- OUString aFileURL;
- createFileURL(u"tdf78897.xls", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf78897.xls");
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
// C3:D3
@@ -551,9 +541,7 @@ void ScPDFExportTest::testTdf78897()
// just needs to not crash on export to pdf
void ScPDFExportTest::testForcepoint97()
{
- OUString aFileURL;
- createFileURL(u"forcepoint97.xlsx", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"forcepoint97.xlsx");
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
// A1:H81
diff --git a/sc/qa/extras/scsheetlinksobj.cxx b/sc/qa/extras/scsheetlinksobj.cxx
index d30473bda5d5..7504eaaa99e4 100644
--- a/sc/qa/extras/scsheetlinksobj.cxx
+++ b/sc/qa/extras/scsheetlinksobj.cxx
@@ -88,8 +88,7 @@ uno::Reference<uno::XInterface> ScSheetLinksObj::init()
uno::Reference<sheet::XSpreadsheet> xSheet0(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
uno::Reference<sheet::XSheetLinkable> xSL(xSheet0, uno::UNO_QUERY_THROW);
- OUString aFileURL;
- createFileURL(u"ScSheetLinksObj.ods", aFileURL);
+ OUString aFileURL = createFileURL(u"ScSheetLinksObj.ods");
xSL->link(aFileURL, "Sheet1", "", "", sheet::SheetLinkMode_VALUE);
uno::Reference<beans::XPropertySet> xPropertySet(xDoc, uno::UNO_QUERY_THROW);
diff --git a/sc/qa/extras/scstylefamiliesobj.cxx b/sc/qa/extras/scstylefamiliesobj.cxx
index a23c5191e9fc..89ec9a2b46f7 100644
--- a/sc/qa/extras/scstylefamiliesobj.cxx
+++ b/sc/qa/extras/scstylefamiliesobj.cxx
@@ -112,12 +112,7 @@ uno::Reference<lang::XComponent> ScStyleFamiliesObj::getSourceComponent()
return m_xSrcComponent;
}
-OUString ScStyleFamiliesObj::getTestURL()
-{
- OUString aFileURL;
- createFileURL(u"ScStyleFamiliesObj.ods", aFileURL);
- return aFileURL;
-}
+OUString ScStyleFamiliesObj::getTestURL() { return createFileURL(u"ScStyleFamiliesObj.ods"); }
void ScStyleFamiliesObj::setUp()
{
diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx
index c6091fa5fdff..8b5b3dbaa056 100644
--- a/sc/qa/extras/sctablesheetobj.cxx
+++ b/sc/qa/extras/sctablesheetobj.cxx
@@ -354,8 +354,7 @@ OUString ScTableSheetObj::getFileURL()
void ScTableSheetObj::setUp()
{
UnoApiTest::setUp();
- createFileURL(u"ScTableSheetObj.ods", maFileURL);
- mxComponent = loadFromDesktop(maFileURL, "com.sun.star.sheet.SpreadsheetDocument");
+ maFileURL = loadFromURL(u"ScTableSheetObj.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetObj);
diff --git a/sc/qa/extras/sctablesheetsobj.cxx b/sc/qa/extras/sctablesheetsobj.cxx
index 970ecff02d64..59146a3e4b36 100644
--- a/sc/qa/extras/sctablesheetsobj.cxx
+++ b/sc/qa/extras/sctablesheetsobj.cxx
@@ -104,9 +104,7 @@ public:
CPPUNIT_TEST_SUITE_END();
- virtual uno::Reference<lang::XComponent> getComponent() override;
- virtual void createFileURL(const OUString& rFileBase, OUString& rFileURL) override;
- virtual uno::Reference<lang::XComponent> loadFromDesktop(const OUString& rString) override;
+ virtual uno::Reference<lang::XComponent> loadFromDesktop(const OUString& rFileBase) override;
};
ScTableSheetsObj::ScTableSheetsObj()
@@ -120,16 +118,10 @@ ScTableSheetsObj::ScTableSheetsObj()
{
}
-uno::Reference<lang::XComponent> ScTableSheetsObj::getComponent() { return mxComponent; }
-
-void ScTableSheetsObj::createFileURL(const OUString& rFileBase, OUString& rFileURL)
-{
- UnoApiTest::createFileURL(rFileBase, rFileURL);
-}
-
-uno::Reference<lang::XComponent> ScTableSheetsObj::loadFromDesktop(const OUString& rString)
+uno::Reference<lang::XComponent> ScTableSheetsObj::loadFromDesktop(const OUString& rFileBase)
{
- return UnoApiTest::loadFromDesktop(rString);
+ OUString aString = createFileURL(rFileBase);
+ return UnoApiTest::loadFromDesktop(aString);
}
uno::Reference<uno::XInterface> ScTableSheetsObj::init()
@@ -149,9 +141,7 @@ void ScTableSheetsObj::setUp()
{
UnoApiTest::setUp();
// create a calc document
- OUString aFileURL;
- createFileURL("rangenamessrc.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"rangenamessrc.ods");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetsObj);
diff --git a/sc/qa/extras/vba-macro-test.cxx b/sc/qa/extras/vba-macro-test.cxx
index 062a0f6633a4..ac3d7c31d2b9 100644
--- a/sc/qa/extras/vba-macro-test.cxx
+++ b/sc/qa/extras/vba-macro-test.cxx
@@ -94,10 +94,7 @@ void VBAMacroTest::testSimpleCopyAndPaste()
// Range(Cells(4, 3), Cells(6, 3)).Copy
// Cells(4, 2).Activate
// ActiveCell.PasteSpecial xlValues
-
- OUString aFileName;
- createFileURL(u"SimpleCopyPaste.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"SimpleCopyPaste.xlsm");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -142,10 +139,7 @@ void VBAMacroTest::testMultiDocumentCopyAndPaste()
// Cells(2, 2).Activate
// ActiveCell.PasteSpecial xlValues
// ...
-
- OUString aFileName;
- createFileURL(u"MultiDocumentCopyPaste.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"MultiDocumentCopyPaste.xlsm");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -166,9 +160,7 @@ void VBAMacroTest::testMultiDocumentCopyAndPaste()
void VBAMacroTest::testSheetAndColumnSelectAndHide()
{
- OUString aFileName;
- createFileURL(u"SheetAndColumnSelectAndHide.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"SheetAndColumnSelectAndHide.xlsm");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -231,10 +223,7 @@ void VBAMacroTest::testPrintArea()
{
// Sets the print area to A1:B5
// ActiveSheet.PageSetup.PrintArea = "$A$1:$B$5"
-
- OUString aFileName;
- createFileURL(u"VariousTestMacros.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"VariousTestMacros.xlsm");
uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
uno::Reference<container::XIndexAccess> xIndex(xDoc->getSheets(), uno::UNO_QUERY_THROW);
@@ -259,10 +248,7 @@ void VBAMacroTest::testSelectAllChaged()
{
// Columns("A:A").Select
// Range(Selection, Selection.End(xlToRight)).Select
-
- OUString aFileName;
- createFileURL(u"VariousTestMacros.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"VariousTestMacros.xlsm");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
@@ -284,10 +270,7 @@ void VBAMacroTest::testRangeSelect()
{
// Range("B2").Select
// Range(Selection, Selection.End(xlToRight)).Select
-
- OUString aFileName;
- createFileURL(u"VariousTestMacros.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"VariousTestMacros.xlsm");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
@@ -310,10 +293,7 @@ void VBAMacroTest::testWindowState()
// Application.WindowState = xlMinimized
// Application.WindowState = xlMaximized
// Application.WindowState = xlNormal
-
- OUString aFileName;
- createFileURL(u"VariousTestMacros.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"VariousTestMacros.xlsm");
executeMacro("vnd.sun.Star.script:VBAProject.ThisWorkbook.testWindowState?language=Basic&"
"location=document");
@@ -324,9 +304,7 @@ void VBAMacroTest::testScroll()
// ActiveWindow.ScrollColumn = 30
// ActiveWindow.ScrollRow = 100
- OUString aFileName;
- createFileURL(u"VariousTestMacros.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"VariousTestMacros.xlsm");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
@@ -352,10 +330,7 @@ void VBAMacroTest::testMacroKeyBinding()
{
// key_U() -> CTRL+U
// key_T() -> CTRL+T
-
- OUString aFileName;
- createFileURL(u"KeyShortcut.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"KeyShortcut.xlsm");
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
CPPUNIT_ASSERT(xModel.is());
@@ -491,9 +466,7 @@ void VBAMacroTest::testVba()
uno::Sequence<uno::Any> aParams;
for (const auto& rTestInfo : testInfo)
{
- OUString aFileName;
- createFileURL(Concat2View(rTestInfo.sFileBaseName + "xls"), aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ OUString aFileName = loadFromURL(Concat2View(rTestInfo.sFileBaseName + "xls"));
// process all events such as OnLoad events etc. otherwise they tend
// to arrive later at a random time - while processing other StarBasic
@@ -617,9 +590,7 @@ void VBAMacroTest::testVbaRangeSort()
void VBAMacroTest::testTdf107885()
{
- OUString aFileName;
- createFileURL(u"tdf107885.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf107885.xlsm");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -654,9 +625,7 @@ void VBAMacroTest::testTdf107885()
void VBAMacroTest::testTdf131562()
{
- OUString aFileName;
- createFileURL(u"tdf131562.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf131562.xlsm");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -677,9 +646,7 @@ void VBAMacroTest::testTdf131562()
void VBAMacroTest::testTdf52602()
{
- OUString aFileName;
- createFileURL(u"tdf52602.xls", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf52602.xls");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -706,9 +673,7 @@ void VBAMacroTest::testTdf52602()
}
void VBAMacroTest::testTdf107902()
{
- OUString aFileName;
- createFileURL(u"tdf107902.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf107902.xlsm");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -736,9 +701,7 @@ void VBAMacroTest::testTdf107902()
void VBAMacroTest::testTdf90278()
{
- OUString aFileName;
- createFileURL(u"tdf90278.xls", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf90278.xls");
// Without the fix in place, changing the border weight
// would cause a Basic exception/error in the following script.
@@ -753,9 +716,7 @@ void VBAMacroTest::testTdf90278()
void VBAMacroTest::testTdf149531()
{
- OUString aFileName;
- createFileURL(u"tdf149531.xls", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf149531.xls");
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
@@ -778,9 +739,7 @@ void VBAMacroTest::testTdf149531()
void VBAMacroTest::testTdf118247()
{
- OUString aFileName;
- createFileURL(u"tdf118247.xlsm", aFileName);
- mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+ loadFromURL(u"tdf118247.xlsm");
uno::Any aRet = executeMacro(
"vnd.sun.Star.script:VBAProject.Module1.testXlSpecialCellsValuesConstantsEmpty?"
diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx
index c7a1ef94979f..00984eded77e 100644
--- a/sc/qa/perf/scperfobj.cxx
+++ b/sc/qa/perf/scperfobj.cxx
@@ -58,8 +58,6 @@ public:
ScPerfObj();
- uno::Reference< uno::XInterface > init(std::u16string_view aFileName);
-
CPPUNIT_TEST_SUITE(ScPerfObj);
CPPUNIT_TEST(testSheetFindAll);
CPPUNIT_TEST(testFixedSum);
@@ -106,20 +104,10 @@ ScPerfObj::ScPerfObj()
{
}
-uno::Reference< uno::XInterface > ScPerfObj::init(std::u16string_view aFileName)
-{
- OUString aFileURL;
- createFileURL(aFileName, aFileURL);
-
- mxComponent = loadFromDesktop(aFileURL);
-
- return mxComponent;
-}
-
void ScPerfObj::testSheetFindAll()
{
-
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scBigFile.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scBigFile.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
// get sheet
uno::Reference< container::XIndexAccess > xSheetIndex (xDoc->getSheets(), UNO_QUERY_THROW);
@@ -172,11 +160,11 @@ void ScPerfObj::testSheetFindAll()
void ScPerfObj::testSheetNamedRanges()
{
- uno::Reference< lang::XComponent > xComponent (init(u"scBigFile.ods"), UNO_QUERY_THROW);
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComponent, UNO_QUERY_THROW);
+ loadFromURL(u"scBigFile.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
// get NamedRanges
- uno::Reference< beans::XPropertySet > xPropSet (xComponent, UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xPropSet (mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue("NamedRanges"), UNO_QUERY_THROW);
uno::Reference< container::XIndexAccess > xIndexNamedRanges(xNamedRanges, UNO_QUERY_THROW);
@@ -214,8 +202,8 @@ void ScPerfObj::testSheetNamedRanges()
void ScPerfObj::testSheets()
{
-
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scBigFile.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scBigFile.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
// get getSheets
uno::Reference< sheet::XSpreadsheets > xSheets (xDoc->getSheets(), UNO_SET_THROW);
@@ -240,7 +228,8 @@ void ScPerfObj::testSheets()
void ScPerfObj::testSum()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scMathFunctions.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scMathFunctions.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -278,7 +267,8 @@ void ScPerfObj::testSum()
void ScPerfObj::testFTest()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scMathFunctions.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scMathFunctions.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -301,7 +291,8 @@ void ScPerfObj::testFTest()
void ScPerfObj::testChiTest()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scMathFunctions.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scMathFunctions.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -324,7 +315,8 @@ void ScPerfObj::testChiTest()
void ScPerfObj::testSumX2PY2Test()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scMathFunctions2.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scMathFunctions2.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -347,7 +339,8 @@ void ScPerfObj::testSumX2PY2Test()
void ScPerfObj::testTTest()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scMathFunctions2.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scMathFunctions2.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -370,7 +363,8 @@ void ScPerfObj::testTTest()
void ScPerfObj::testLcm()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scMathFunctions2.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scMathFunctions2.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -393,7 +387,8 @@ void ScPerfObj::testLcm()
void ScPerfObj::testGcd()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scMathFunctions2.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scMathFunctions2.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -416,7 +411,8 @@ void ScPerfObj::testGcd()
void ScPerfObj::testPearson()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scMathFunctions2.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scMathFunctions2.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -439,7 +435,8 @@ void ScPerfObj::testPearson()
void ScPerfObj::testSubTotalWithFormulas()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scBigSingleSheet200.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scBigSingleSheet200.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -470,7 +467,8 @@ void ScPerfObj::testSubTotalWithFormulas()
void ScPerfObj::testSubTotalWithoutFormulas()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scBigSingleSheet200.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scBigSingleSheet200.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -502,7 +500,8 @@ void ScPerfObj::testSubTotalWithoutFormulas()
void ScPerfObj::testLoadingFileWithSingleBigSheet()
{
callgrindStart();
- uno::Reference< sheet::XSpreadsheetDocument > xDoc1(init(u"scBigSingleSheet2000.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scBigSingleSheet2000.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc1(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable1(xDoc1, UNO_QUERY_THROW);
callgrindDump("sc:loadingFileWithSingleBigSheetdoSubTotal_2000lines");
}
@@ -535,7 +534,8 @@ namespace {
void ScPerfObj::testFixedSum()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"scMathFunctions3.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"scMathFunctions3.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -558,7 +558,8 @@ void ScPerfObj::testFixedSum()
void ScPerfObj::testMatConcatSmall()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"empty.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"empty.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
@@ -585,7 +586,8 @@ void ScPerfObj::testMatConcatSmall()
void ScPerfObj::testMatConcatLarge()
{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(init(u"empty.ods"), UNO_QUERY_THROW);
+ loadFromURL(u"empty.ods");
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
diff --git a/sc/qa/unit/cond_format_merge.cxx b/sc/qa/unit/cond_format_merge.cxx
index 166529873cdc..5a33cccdbe01 100644
--- a/sc/qa/unit/cond_format_merge.cxx
+++ b/sc/qa/unit/cond_format_merge.cxx
@@ -41,9 +41,7 @@ ScCondFormatMergeTest::ScCondFormatMergeTest()
void ScCondFormatMergeTest::testCondFormatMerge()
{
- OUString aFileURL;
- createFileURL(u"cond_format_merge.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"cond_format_merge.ods");
// get the first sheet
uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index 92e334718f78..d597ac10b3fc 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -265,10 +265,7 @@ void ScShapeTest::testTdf144242_Line_noSwapWH()
void ScShapeTest::testTdf143619_validation_circle_pos()
{
// Load a document, which has validation circle around cell E6.
-
- OUString aFileURL;
- createFileURL(u"tdf143619_validationCirclePos.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf143619_validationCirclePos.ods");
// Get document
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -297,9 +294,7 @@ void ScShapeTest::testTdf140252_DragCreateFormControl()
// Error was, that drag-created form controls were initially not on layer 'controls' and thus
// other shapes could be placed in front of form controls.
// Load an empty document.
- OUString aFileURL;
- createFileURL(u"ManualColWidthRowHeight.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"ManualColWidthRowHeight.ods");
// Get ScTabViewShell
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -346,9 +341,7 @@ void ScShapeTest::testTdf134355_DragCreateCustomShape()
// layer is exclusively for form controls. Effect was, that other shapes could not be brought in
// front of custom shapes.
// Load an empty document.
- OUString aFileURL;
- createFileURL(u"ManualColWidthRowHeight.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"ManualColWidthRowHeight.ods");
// Get ScTabView
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -388,9 +381,7 @@ void ScShapeTest::testTdf140252_LayerOfControl()
// Error was, that a newly inserted control shape was put on layer
// "vorne" instead of layer "control".
// Load an empty document.
- OUString aFileURL;
- createFileURL(u"ManualColWidthRowHeight.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"ManualColWidthRowHeight.ods");
// Get ScDocShell
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -422,9 +413,7 @@ void ScShapeTest::testTdf137082_LTR_to_RTL()
// mirrored. Graphics are still not mirrored but shifted. This test makes sure a shape is mirrored
// and an image is not mirrored.
- OUString aFileURL;
- createFileURL(u"tdf137082_LTR_arrow_image.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf137082_LTR_arrow_image.ods");
// Get document
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -454,9 +443,7 @@ void ScShapeTest::testTdf137082_RTL_cell_anchored()
{
// Error was, that cell anchored custom shapes wrote wrong offsets to file and thus were wrong on
// reloading. The file contains one custom shape with "resize" and another one without.
- OUString aFileURL;
- createFileURL(u"tdf137082_RTL_cell_anchored.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf137082_RTL_cell_anchored.ods");
// Get document
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -494,9 +481,7 @@ void ScShapeTest::testTdf137081_RTL_page_anchored()
{
// Error was, that page anchored lines and custom shapes were mirrored on opening. The document
// contains measure line, polyline and transformed custom shape.
- OUString aFileURL;
- createFileURL(u"tdf137081_RTL_page_anchored.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf137081_RTL_page_anchored.ods");
// Get document
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -558,9 +543,7 @@ void ScShapeTest::testTdf137081_RTL_page_anchored()
void ScShapeTest::testTdf139583_Rotate180deg()
{
// Load an empty document.
- OUString aFileURL;
- createFileURL(u"ManualColWidthRowHeight.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"ManualColWidthRowHeight.ods");
// Get document and draw page
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -599,9 +582,7 @@ void ScShapeTest::testTdf137033_FlipHori_Resize()
{
// Load a document, which has a rotated custom shape, which is horizontal flipped. Error was, that
// if such shape was anchored "resize with cell", then after save and reload it was distorted.
- OUString aFileURL;
- createFileURL(u"tdf137033_FlipHoriRotCustomShape.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf137033_FlipHoriRotCustomShape.ods");
// Get document and shape
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -635,9 +616,7 @@ void ScShapeTest::testTdf137033_RotShear_ResizeHide()
// of the full sized shape were written to file but the changed one.
// Load a document, which has a rotated and sheared shape, anchored to cell with resize.
- OUString aFileURL;
- createFileURL(u"tdf137033_RotShearResizeAnchor.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf137033_RotShearResizeAnchor.ods");
// Get document
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -692,9 +671,7 @@ void ScShapeTest::testTdf137033_RotShear_Hide()
// makes a difference.
// Load a document, which has a rotated and sheared shape, anchored to cell, without resize.
- OUString aFileURL;
- createFileURL(u"tdf137033_RotShearCellAnchor.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf137033_RotShearCellAnchor.ods");
// Get document
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -729,9 +706,7 @@ void ScShapeTest::testTdf137576_LogicRectInDefaultMeasureline()
// resulted in zeros in NonRotatedAnchor and a wrong position when reloading.
// Load an empty document.
- OUString aFileURL;
- createFileURL(u"ManualColWidthRowHeight.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"ManualColWidthRowHeight.ods");
// Get ScDocShell
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -782,9 +757,7 @@ void ScShapeTest::testTdf137576_LogicRectInNewMeasureline()
// NonRotatedAnchor. As a result the position was wrong when reloading.
// Load an empty document
- OUString aFileURL;
- createFileURL(u"ManualColWidthRowHeight.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"ManualColWidthRowHeight.ods");
// Get document and draw page
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -818,9 +791,7 @@ void ScShapeTest::testMeasurelineHideColSave()
// The document contains a SdrMeasureObj anchored "To Cell (resize with cell)" with start in cell
// D11 and end in cell I5. Error was, that after hiding col A and saving, start and end point
// position were lost.
- OUString aFileURL;
- createFileURL(u"measurelineHideColSave.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"measurelineHideColSave.ods");
// Get document and shape
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -862,9 +833,7 @@ void ScShapeTest::testHideColsShow()
//ends in cell D5. Error was, that hiding cols C and D and then show them again extends the shape
// to column E
- OUString aFileURL;
- createFileURL(u"hideColsShow.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"hideColsShow.ods");
// Get document and shape
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -904,9 +873,7 @@ void ScShapeTest::testTdf138138_MoveCellWithRotatedShape()
{
// The document contains a 90deg rotated, cell-anchored rectangle in column D. Insert 2 columns
// after column B, save and reload. The shape was not correctly moved to column F.
- OUString aFileURL;
- createFileURL(u"tdf138138_MoveCellWithRotatedShape.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf138138_MoveCellWithRotatedShape.ods");
// Get document and shape
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -950,9 +917,7 @@ void ScShapeTest::testLoadVerticalFlip()
{
// The document has a cell anchored custom shape with vertical flip. Error was, that the
// flip was lost on loading.
- OUString aFileURL;
- createFileURL(u"loadVerticalFlip.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"loadVerticalFlip.ods");
// Get document and shape
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -968,9 +933,7 @@ void ScShapeTest::testTdf117948_CollapseBeforeShape()
// The document contains a column group left from the image. The group is expanded. Collapse the
// group, save and reload. The original error was, that the line was on wrong position after reload.
// After the fix for 'resize with cell', the custom shape had wrong position and size too.
- OUString aFileURL;
- createFileURL(u"tdf117948_CollapseBeforeShape.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf117948_CollapseBeforeShape.ods");
// Get document and objects
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -1019,9 +982,7 @@ void ScShapeTest::testTdf137355_UndoHideRows()
// The document contains a shape anchored "To Cell" with start in cell C3 and end in cell D6.
// Error was, that hiding rows 3 to 6 and undo that action "lost" the shape.
// Actually it was not lost but hidden.
- OUString aFileURL;
- createFileURL(u"tdf137355_UndoHideRows.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf137355_UndoHideRows.ods");
// Get document and shape
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -1060,9 +1021,7 @@ void ScShapeTest::testTdf115655_HideDetail()
// belongs to a group. On loading the group is expanded.
// Error was, that after collapsing the group, save and reload, and expanding the group, the image
// was "lost". Actually is was resized to zero height.
- OUString aFileURL;
- createFileURL(u"tdf115655_HideDetail.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf115655_HideDetail.ods");
// Get document and image
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -1107,9 +1066,7 @@ void ScShapeTest::testFitToCellSize()
// The document has a cell anchored custom shape. Applying
// FitToCellSize should resize and position the shape so,
// that it fits into its anchor cell. That did not happened.
- OUString aFileURL;
- createFileURL(u"tdf119191_FitToCellSize.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf119191_FitToCellSize.ods");
// Get document and shape
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -1138,9 +1095,7 @@ void ScShapeTest::testCustomShapeCellAnchoredRotatedShape()
// The example doc contains a cell anchored custom shape that is rotated
// and sheared. Error was, that the shape lost position and size on
// loading.
- OUString aFileURL;
- createFileURL(u"tdf119191_transformedShape.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"tdf119191_transformedShape.ods");
// Get document and shape
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
@@ -1169,9 +1124,7 @@ void ScShapeTest::testLargeAnchorOffset()
// The example doc contains a resize-with-cell-anchored measure line
// with a large vertical offset that shifts the start point onto the
// next cell below.
- OUString aFileURL;
- createFileURL(u"LargeAnchorOffset.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"LargeAnchorOffset.ods");
ScDocShell* pDocSh = lcl_getScDocShellWithAssert(mxComponent);
SdrObject* pObj = lcl_getSdrObjectWithAssert(pDocSh->GetDocument(), 0);
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 8e4dc6cef5d7..1131f30463f0 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -139,11 +139,7 @@ ScModelObj* ScUiCalcTest::createDoc(const char* pName)
if (!pName)
mxComponent = loadFromDesktop("private:factory/scalc");
else
- {
- OUString aFileURL;
- createFileURL(OUString::createFromAscii(pName), aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
- }
+ loadFromURL(OUString::createFromAscii(pName));
ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
CPPUNIT_ASSERT(pModelObj);
diff --git a/sccomp/qa/unit/SwarmSolverTest.cxx b/sccomp/qa/unit/SwarmSolverTest.cxx
index 2dfbda8f61d7..1f4b9ae2e177 100644
--- a/sccomp/qa/unit/SwarmSolverTest.cxx
+++ b/sccomp/qa/unit/SwarmSolverTest.cxx
@@ -45,9 +45,7 @@ public:
void SwarmSolverTest::testUnconstrained()
{
- OUString aFileURL;
- createFileURL(u"Simple.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"Simple.ods");
uno::Reference<sheet::XSpreadsheetDocument> xDocument(mxComponent, uno::UNO_QUERY_THROW);
uno::Reference<container::XIndexAccess> xIndex(xDocument->getSheets(), uno::UNO_QUERY_THROW);
@@ -90,9 +88,7 @@ void SwarmSolverTest::testUnconstrained()
void SwarmSolverTest::testVariableBounded()
{
- OUString aFileURL;
- createFileURL(u"Simple.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"Simple.ods");
uno::Reference<sheet::XSpreadsheetDocument> xDocument(mxComponent, uno::UNO_QUERY_THROW);
uno::Reference<container::XIndexAccess> xIndex(xDocument->getSheets(), uno::UNO_QUERY_THROW);
@@ -137,9 +133,7 @@ void SwarmSolverTest::testVariableBounded()
void SwarmSolverTest::testVariableConstrained()
{
- OUString aFileURL;
- createFileURL(u"Simple.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"Simple.ods");
uno::Reference<sheet::XSpreadsheetDocument> xDocument(mxComponent, uno::UNO_QUERY_THROW);
uno::Reference<container::XIndexAccess> xIndex(xDocument->getSheets(), uno::UNO_QUERY_THROW);
@@ -187,9 +181,7 @@ void SwarmSolverTest::testVariableConstrained()
void SwarmSolverTest::testTwoVariables()
{
- OUString aFileURL;
- createFileURL(u"TwoVariables.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"TwoVariables.ods");
uno::Reference<sheet::XSpreadsheetDocument> xDocument(mxComponent, uno::UNO_QUERY_THROW);
uno::Reference<container::XIndexAccess> xIndex(xDocument->getSheets(), uno::UNO_QUERY_THROW);
@@ -241,9 +233,7 @@ void SwarmSolverTest::testTwoVariables()
void SwarmSolverTest::testMultipleVariables()
{
- OUString aFileURL;
- createFileURL(u"MultiVariable.ods", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"MultiVariable.ods");
uno::Reference<sheet::XSpreadsheetDocument> xDocument(mxComponent, uno::UNO_QUERY_THROW);
uno::Reference<container::XIndexAccess> xIndex(xDocument->getSheets(), uno::UNO_QUERY_THROW);
diff --git a/sd/qa/filter/eppt/eppt.cxx b/sd/qa/filter/eppt/eppt.cxx
index b2c304fece59..38ba795dce2d 100644
--- a/sd/qa/filter/eppt/eppt.cxx
+++ b/sd/qa/filter/eppt/eppt.cxx
@@ -46,9 +46,7 @@ Test::Test()
CPPUNIT_TEST_FIXTURE(Test, testOOXMLCustomShapeBitmapFill)
{
// Save the bugdoc to PPT.
- OUString aFileURL;
- createFileURL(u"custom-shape-bitmap-fill.pptx", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"custom-shape-bitmap-fill.pptx");
saveAndReload("MS PowerPoint 97");
// Check if the bitmap shape was lost.
@@ -99,9 +97,7 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeExport)
CPPUNIT_TEST_FIXTURE(Test, testLoopingFromAnimation)
{
// Given a media shape that has an animation that specifies looping for the video:
- OUString aFileURL;
- createFileURL(u"video-loop.pptx", aFileURL);
- mxComponent = loadFromDesktop(aFileURL);
+ loadFromURL(u"video-loop.pptx");
// When exporting that to PPTX:
utl::TempFileNamed aTempFile = save("Impress Office Open XML");
diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx
index f88de2a43055..780e806b4deb 100644
--- a/test/source/sheet/xspreadsheets2.cxx
+++ b/test/source/sheet/xspreadsheets2.cxx
@@ -319,10 +319,7 @@ void XSpreadsheets2::testLastAfterInsertCopy()
uno::Reference< sheet::XSpreadsheetDocument> XSpreadsheets2::getDoc(const OUString& aFileBase)
{
- OUString aFileURL;
- createFileURL(aFileBase, aFileURL);
-
- uno::Reference< lang::XComponent > xComp = loadFromDesktop(aFileURL);
+ uno::Reference< lang::XComponent > xComp = loadFromDesktop(aFileBase);
uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComp, UNO_QUERY_THROW);
return xDoc;
}
diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx
index 2241db77599e..4d06c47a9697 100644
--- a/test/source/unoapi_test.cxx
+++ b/test/source/unoapi_test.cxx
@@ -47,9 +47,16 @@ void UnoApiTest::tearDown()
test::BootstrapFixture::tearDown();
}
-void UnoApiTest::createFileURL(std::u16string_view aFileBase, OUString& rFilePath)
+OUString UnoApiTest::createFileURL(std::u16string_view aFileBase)
{
- rFilePath = m_directories.getSrcRootURL() + m_aBaseString + "/" + aFileBase;
+ return m_directories.getSrcRootURL() + m_aBaseString + "/" + aFileBase;
+}
+
+OUString UnoApiTest::loadFromURL(std::u16string_view aFileBase)
+{
+ OUString aFileName = createFileURL(aFileBase);
+ mxComponent = loadFromDesktop(aFileName);
+ return aFileName;
}
uno::Any UnoApiTest::executeMacro(const OUString& rScriptURL,
diff --git a/vcl/qa/cppunit/gen/gen.cxx b/vcl/qa/cppunit/gen/gen.cxx
index 983a77ca29fd..cb3dda2b6ee3 100644
--- a/vcl/qa/cppunit/gen/gen.cxx
+++ b/vcl/qa/cppunit/gen/gen.cxx
@@ -31,9 +31,7 @@ public:
Bitmap load(const char* pName)
{
- OUString aFileURL;
- createFileURL(OUString::createFromAscii(pName), aFileURL);
- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.drawing.DrawingDocument");
+ loadFromURL(OUString::createFromAscii(pName));
SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
CPPUNIT_ASSERT(pModel);
SfxObjectShell* pShell = pModel->GetObjectShell();