diff options
-rw-r--r-- | sc/qa/unit/filters-test.cxx | 6 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.cxx | 5 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 6 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 28 |
5 files changed, 27 insertions, 22 deletions
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 44156eae1656..1d7eecafb217 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -133,8 +133,8 @@ void ScFiltersTest::testCVEs() void ScFiltersTest::testDir(osl::Directory& rDir, sal_uInt32 nType) { - OUString aFilterName(aFileFormats[nType].pFilterName, strlen(aFileFormats[nType].pFilterName), RTL_TEXTENCODING_UTF8) ; - OUString aFilterType(aFileFormats[nType].pTypeName, strlen(aFileFormats[nType].pTypeName), RTL_TEXTENCODING_UTF8); + OUString aFilterName(getFileFormats()[nType].pFilterName, strlen(getFileFormats()[nType].pFilterName), RTL_TEXTENCODING_UTF8) ; + OUString aFilterType(getFileFormats()[nType].pTypeName, strlen(getFileFormats()[nType].pTypeName), RTL_TEXTENCODING_UTF8); osl::DirectoryItem aItem; osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL|osl_FileStatus_Mask_Type); @@ -146,7 +146,7 @@ void ScFiltersTest::testDir(osl::Directory& rDir, sal_uInt32 nType) //OStringBuffer aMessage("Failed loading: "); //aMessage.append(OUStringToOString(sURL, RTL_TEXTENCODING_UTF8)); - unsigned int nFormatType = aFileFormats[nType].nFormatType; + unsigned int nFormatType = getFileFormats()[nType].nFormatType; unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; ScDocShellRef xDocSh = load(sURL, aFilterName, OUString(), aFilterType, nFormatType, nClipboardId ); diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 5692b8d11c8e..8cf45f5c71d8 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -162,6 +162,11 @@ ScDocShellRef ScBootstrapFixture::loadDoc( return load(bReadWrite, aFileName, aFilterName, OUString(), aFilterType, nFormatType, nClipboardId, nFormatType); } +const FileFormat* ScBootstrapFixture::getFileFormats() +{ + return aFileFormats; +} + void ScBootstrapFixture::createFileURL( const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath) { diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index bec76e84b175..58aa429ac68d 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -76,8 +76,6 @@ struct FileFormat { const char* pName; const char* pFilterName; const char* pTypeName; unsigned int nFormatType; }; -SC_DLLPUBLIC extern FileFormat aFileFormats[]; - // Why is this here and not in osl, and using the already existing file // handling APIs? Do we really want to add arbitrary new file handling // wrappers here and there (and then having to handle the Android (and @@ -141,6 +139,8 @@ protected: ScDocShellRef loadDoc(const OUString& rFileName, sal_Int32 nFormat, bool bReadWrite = false ); public: + static const FileFormat* getFileFormats(); + ScBootstrapFixture( const OUString& rsBaseString ) : m_aBaseString( rsBaseString ) {} void createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath); diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index d73ca8ab78f9..05b0c359df29 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -139,9 +139,9 @@ void ScExportTest::testPasswordExport() CPPUNIT_ASSERT(pDoc); sal_Int32 nFormat = ODS; - OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ; - OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); - ScDocShellRef xDocSh = saveAndReloadPassword(pShell, aFilterName, OUString(), aFilterType, aFileFormats[nFormat].nFormatType); + OUString aFilterName(getFileFormats()[nFormat].pFilterName, strlen(getFileFormats()[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ; + OUString aFilterType(getFileFormats()[nFormat].pTypeName, strlen(getFileFormats()[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); + ScDocShellRef xDocSh = saveAndReloadPassword(pShell, aFilterName, OUString(), aFilterType, getFileFormats()[nFormat].nFormatType); CPPUNIT_ASSERT(xDocSh.Is()); ScDocument* pLoadedDoc = xDocSh->GetDocument(); diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 48c519d26cae..5f2ac1ed9d8b 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1165,14 +1165,14 @@ void ScFiltersTest::testDataValidityODS() void ScFiltersTest::testBrokenQuotesCSV() { const OUString aFileNameBase("fdo48621_broken_quotes."); - OUString aFileExtension(aFileFormats[CSV].pName, strlen(aFileFormats[CSV].pName), RTL_TEXTENCODING_UTF8 ); - OUString aFilterName(aFileFormats[CSV].pFilterName, strlen(aFileFormats[CSV].pFilterName), RTL_TEXTENCODING_UTF8) ; + OUString aFileExtension(getFileFormats()[CSV].pName, strlen(getFileFormats()[CSV].pName), RTL_TEXTENCODING_UTF8 ); + OUString aFilterName(getFileFormats()[CSV].pFilterName, strlen(getFileFormats()[CSV].pFilterName), RTL_TEXTENCODING_UTF8) ; OUString aFileName; createFileURL(aFileNameBase, aFileExtension, aFileName); - OUString aFilterType(aFileFormats[CSV].pTypeName, strlen(aFileFormats[CSV].pTypeName), RTL_TEXTENCODING_UTF8); - std::cout << aFileFormats[CSV].pName << " Test" << std::endl; + OUString aFilterType(getFileFormats()[CSV].pTypeName, strlen(getFileFormats()[CSV].pTypeName), RTL_TEXTENCODING_UTF8); + std::cout << getFileFormats()[CSV].pName << " Test" << std::endl; - unsigned int nFormatType = aFileFormats[CSV].nFormatType; + unsigned int nFormatType = getFileFormats()[CSV].nFormatType; unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; ScDocShellRef xDocSh = ScBootstrapFixture::load(aFileName, aFilterName, OUString(), aFilterType, nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); @@ -1193,14 +1193,14 @@ void ScFiltersTest::testBrokenQuotesCSV() void ScFiltersTest::testCellValueXLSX() { const OUString aFileNameBase("cell-value."); - OUString aFileExtension(aFileFormats[XLSX].pName, strlen(aFileFormats[XLSX].pName), RTL_TEXTENCODING_UTF8 ); - OUString aFilterName(aFileFormats[XLSX].pFilterName, strlen(aFileFormats[XLSX].pFilterName), RTL_TEXTENCODING_UTF8) ; + OUString aFileExtension(getFileFormats()[XLSX].pName, strlen(getFileFormats()[XLSX].pName), RTL_TEXTENCODING_UTF8 ); + OUString aFilterName(getFileFormats()[XLSX].pFilterName, strlen(getFileFormats()[XLSX].pFilterName), RTL_TEXTENCODING_UTF8) ; OUString aFileName; createFileURL(aFileNameBase, aFileExtension, aFileName); - OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8); - std::cout << aFileFormats[XLSX].pName << " Test" << std::endl; + OUString aFilterType(getFileFormats()[XLSX].pTypeName, strlen(getFileFormats()[XLSX].pTypeName), RTL_TEXTENCODING_UTF8); + std::cout << getFileFormats()[XLSX].pName << " Test" << std::endl; - unsigned int nFormatType = aFileFormats[XLSX].nFormatType; + unsigned int nFormatType = getFileFormats()[XLSX].nFormatType; unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; ScDocShellRef xDocSh = ScBootstrapFixture::load( aFileName, aFilterName, OUString(), aFilterType, nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); @@ -1218,16 +1218,16 @@ void ScFiltersTest::testCellValueXLSX() void ScFiltersTest::testPassword_Impl(const OUString& aFileNameBase) { - OUString aFileExtension(aFileFormats[0].pName, strlen(aFileFormats[0].pName), RTL_TEXTENCODING_UTF8 ); - OUString aFilterName(aFileFormats[0].pFilterName, strlen(aFileFormats[0].pFilterName), RTL_TEXTENCODING_UTF8) ; + OUString aFileExtension(getFileFormats()[0].pName, strlen(getFileFormats()[0].pName), RTL_TEXTENCODING_UTF8 ); + OUString aFilterName(getFileFormats()[0].pFilterName, strlen(getFileFormats()[0].pFilterName), RTL_TEXTENCODING_UTF8) ; OUString aFileName; createFileURL(aFileNameBase, aFileExtension, aFileName); - OUString aFilterType(aFileFormats[0].pTypeName, strlen(aFileFormats[0].pTypeName), RTL_TEXTENCODING_UTF8); + OUString aFilterType(getFileFormats()[0].pTypeName, strlen(getFileFormats()[0].pTypeName), RTL_TEXTENCODING_UTF8); sal_uInt32 nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS; SfxFilter* aFilter = new SfxFilter( aFilterName, - OUString(), aFileFormats[0].nFormatType, nFormat, aFilterType, 0, OUString(), + OUString(), getFileFormats()[0].nFormatType, nFormat, aFilterType, 0, OUString(), OUString(), OUString("private:factory/scalc*") ); aFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); |