diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-12 14:53:28 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-03-18 14:23:50 +0200 |
commit | fb14be5f8f74f83ba89e15f891ddf1f753dcc62f (patch) | |
tree | beaa4af08b0c3d75bf6e40b21b96c55e0ac1c60a /sc/qa | |
parent | b8ce52aab9459773544f1696cfe6b7b6f171a389 (diff) |
create new 'enum class' SotClipboardFormatId to unify types
of which there are several.
There are some issues here I am unsure of
- the SW and SC and CHART2 modules essentially ignore the enum values and assign their own ids
Perhaps I should change them to use the common values and create new enum values where necessary?
- the sc/qa/ and sq/qa/ and starmath/qa/ code was doing some dodgy stuff. I translated the code to pass down the stuff
numeric values to the underlying code, but perhaps further fixing is necessary?
Change-Id: Ic06d723e404481e3f1bca67c43b70321b764d923
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/filters-test.cxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.cxx | 20 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/opencl-test.cxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 8 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 10 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 2 |
7 files changed, 27 insertions, 25 deletions
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 4beeb54a315f..54eabf36842a 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -58,7 +58,7 @@ public: virtual bool load( const OUString &rFilter, const OUString &rURL, const OUString &rUserData, unsigned int nFilterFlags, - unsigned int nClipboardID, unsigned int nFilterVersion) SAL_OVERRIDE; + SotClipboardFormatId nClipboardID, unsigned int nFilterVersion) SAL_OVERRIDE; /** * Ensure CVEs remain unbroken */ @@ -114,7 +114,7 @@ private: bool ScFiltersTest::load(const OUString &rFilter, const OUString &rURL, const OUString &rUserData, unsigned int nFilterFlags, - unsigned int nClipboardID, unsigned int nFilterVersion) + SotClipboardFormatId nClipboardID, unsigned int nFilterVersion) { ScDocShellRef xDocShRef = ScBootstrapFixture::load(rURL, rFilter, rUserData, OUString(), nFilterFlags, nClipboardID, nFilterVersion ); diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index c64cac111b9f..11a22a8397cd 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -533,7 +533,7 @@ OUString toString( ScDocShellRef ScBootstrapFixture::load( bool bReadWrite, const OUString& rURL, const OUString& rFilter, const OUString &rUserData, - const OUString& rTypeName, unsigned int nFilterFlags, unsigned int nClipboardID, + const OUString& rTypeName, unsigned int nFilterFlags, SotClipboardFormatId nClipboardID, sal_uIntPtr nFilterVersion, const OUString* pPassword ) { SfxFilter* pFilter = new SfxFilter( @@ -566,7 +566,7 @@ ScDocShellRef ScBootstrapFixture::load( bool bReadWrite, ScDocShellRef ScBootstrapFixture::load( const OUString& rURL, const OUString& rFilter, const OUString &rUserData, - const OUString& rTypeName, unsigned int nFilterFlags, unsigned int nClipboardID, + const OUString& rTypeName, unsigned int nFilterFlags, SotClipboardFormatId nClipboardID, sal_uIntPtr nFilterVersion, const OUString* pPassword ) { return load( false, rURL, rFilter, rUserData, rTypeName, nFilterFlags, nClipboardID, nFilterVersion, pPassword ); @@ -581,7 +581,9 @@ ScDocShellRef ScBootstrapFixture::loadDoc( createFileURL( rFileName, aFileExtension, aFileName ); OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); unsigned int nFormatType = aFileFormats[nFormat].nFormatType; - unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + SotClipboardFormatId nClipboardId = SotClipboardFormatId::NONE; + if (nFormatType) + nClipboardId = SotClipboardFormatId::STARCALC_8; return load(bReadWrite, aFileName, aFilterName, OUString(), aFilterType, nFormatType, nClipboardId, nFormatType); } @@ -619,9 +621,9 @@ ScDocShellRef ScBootstrapFixture::saveAndReload( utl::TempFile aTempFile; SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE ); - sal_uInt32 nExportFormat = 0; + SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; if (nFormatType == ODS_FORMAT_TYPE) - nExportFormat = SFX_FILTER_EXPORT | SFX_FILTER_USESOPTIONS; + nExportFormat = SotClipboardFormatId::STARCHART_8; SfxFilter* pExportFilter = new SfxFilter( rFilter, OUString(), nFormatType, nExportFormat, rTypeName, 0, OUString(), @@ -633,9 +635,9 @@ ScDocShellRef ScBootstrapFixture::saveAndReload( //std::cout << "File: " << aTempFile.GetURL() << std::endl; - sal_uInt32 nFormat = 0; + SotClipboardFormatId nFormat = SotClipboardFormatId::NONE; if (nFormatType == ODS_FORMAT_TYPE) - nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS; + nFormat = SotClipboardFormatId::STARCALC_8; ScDocShellRef xDocSh = load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormatType, nFormat ); if(nFormatType == XLSX_FORMAT_TYPE) @@ -664,10 +666,10 @@ boost::shared_ptr<utl::TempFile> ScBootstrapFixture::exportTo( ScDocShell* pShel boost::shared_ptr<utl::TempFile> pTempFile(new utl::TempFile()); pTempFile->EnableKillingFile(); SfxMedium aStoreMedium( pTempFile->GetURL(), STREAM_STD_WRITE ); - sal_uInt32 nExportFormat = 0; + SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; sal_Int32 nFormatType = aFileFormats[nFormat].nFormatType; if (nFormatType == ODS_FORMAT_TYPE) - nExportFormat = SFX_FILTER_EXPORT | SFX_FILTER_USESOPTIONS; + nExportFormat = SotClipboardFormatId::STARCHART_8; SfxFilter* pExportFilter = new SfxFilter( aFilterName, OUString(), nFormatType, nExportFormat, aFilterType, 0, OUString(), diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 8fbc156c8097..20ab92c9f797 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -225,12 +225,12 @@ protected: ScDocShellRef load( bool bReadWrite, const OUString& rURL, const OUString& rFilter, const OUString &rUserData, - const OUString& rTypeName, unsigned int nFilterFlags, unsigned int nClipboardID, + const OUString& rTypeName, unsigned int nFilterFlags, SotClipboardFormatId nClipboardID, sal_uIntPtr nFilterVersion = SOFFICE_FILEFORMAT_CURRENT, const OUString* pPassword = NULL ); ScDocShellRef load( const OUString& rURL, const OUString& rFilter, const OUString &rUserData, - const OUString& rTypeName, unsigned int nFilterFlags, unsigned int nClipboardID, + const OUString& rTypeName, unsigned int nFilterFlags, SotClipboardFormatId nClipboardID, sal_uIntPtr nFilterVersion = SOFFICE_FILEFORMAT_CURRENT, const OUString* pPassword = NULL ); ScDocShellRef loadDoc(const OUString& rFileName, sal_Int32 nFormat, bool bReadWrite = false ); diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 5c72a3dcdb92..44bb074c4954 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -65,7 +65,7 @@ public: virtual bool load( const OUString &rFilter, const OUString &rURL, const OUString &rUserData, unsigned int nFilterFlags, - unsigned int nClipboardID, unsigned int nFilterVersion) SAL_OVERRIDE; + SotClipboardFormatId nClipboardID, unsigned int nFilterVersion) SAL_OVERRIDE; void testSharedFormulaXLS(); #if 0 void testSharedFormulaXLSGroundWater(); @@ -557,7 +557,7 @@ bool ScOpenCLTest::initTestEnv(const OUString& fileName, sal_Int32 nFormat, bool ScOpenCLTest::load(const OUString &rFilter, const OUString &rURL, const OUString &rUserData, unsigned int nFilterFlags, - unsigned int nClipboardID, unsigned int nFilterVersion) + SotClipboardFormatId nClipboardID, unsigned int nFilterVersion) { ScDocShellRef xDocShRef = ScBootstrapFixture::load(rURL, rFilter, rUserData, OUString(), nFilterFlags, nClipboardID, nFilterVersion ); diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 4a1b599f71ad..0084145438ae 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -224,9 +224,9 @@ ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const OUSt utl::TempFile aTempFile; aTempFile.EnableKillingFile(); SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE ); - sal_uInt32 nExportFormat = 0; + SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; if (nFormatType == ODS_FORMAT_TYPE) - nExportFormat = SFX_FILTER_EXPORT | SFX_FILTER_USESOPTIONS; + nExportFormat = SotClipboardFormatId::STARCHART_8; SfxFilter* pExportFilter = new SfxFilter( rFilter, OUString(), nFormatType, nExportFormat, rTypeName, 0, OUString(), @@ -247,9 +247,9 @@ ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const OUSt //std::cout << "File: " << aTempFile.GetURL() << std::endl; - sal_uInt32 nFormat = 0; + SotClipboardFormatId nFormat = SotClipboardFormatId::NONE; if (nFormatType == ODS_FORMAT_TYPE) - nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS; + nFormat = SotClipboardFormatId::STARCALC_8; OUString aPass("test"); return load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormatType, nFormat, SOFFICE_FILEFORMAT_CURRENT, &aPass); diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 7de72c1bb296..01dae642939f 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -84,7 +84,7 @@ public: virtual bool load( const OUString &rFilter, const OUString &rURL, const OUString &rUserData, unsigned int nFilterFlags, - unsigned int nClipboardID, unsigned int nFilterVersion) SAL_OVERRIDE; + SotClipboardFormatId nClipboardID, unsigned int nFilterVersion) SAL_OVERRIDE; virtual void setUp() SAL_OVERRIDE; virtual void tearDown() SAL_OVERRIDE; @@ -287,7 +287,7 @@ private: bool ScFiltersTest::load(const OUString &rFilter, const OUString &rURL, const OUString &rUserData, unsigned int nFilterFlags, - unsigned int nClipboardID, unsigned int nFilterVersion) + SotClipboardFormatId nClipboardID, unsigned int nFilterVersion) { ScDocShellRef xDocShRef = ScBootstrapFixture::load( rURL, rFilter, rUserData, OUString(), nFilterFlags, nClipboardID, nFilterVersion); @@ -1389,7 +1389,7 @@ void ScFiltersTest::testBrokenQuotesCSV() std::cout << getFileFormats()[CSV].pName << " Test" << std::endl; unsigned int nFormatType = getFileFormats()[CSV].nFormatType; - unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + SotClipboardFormatId nClipboardId = nFormatType ? SotClipboardFormatId::STARCALC_8 : SotClipboardFormatId::NONE; ScDocShellRef xDocSh = ScBootstrapFixture::load(aFileName, aFilterName, OUString(), aFilterType, nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); @@ -1416,7 +1416,7 @@ void ScFiltersTest::testCellValueXLSX() std::cout << getFileFormats()[XLSX].pName << " Test" << std::endl; unsigned int nFormatType = getFileFormats()[XLSX].nFormatType; - unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + SotClipboardFormatId nClipboardId = nFormatType ? SotClipboardFormatId::STARCALC_8 : SotClipboardFormatId::NONE; ScDocShellRef xDocSh = ScBootstrapFixture::load( aFileName, aFilterName, OUString(), aFilterType, nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); @@ -1471,7 +1471,7 @@ void ScFiltersTest::testPassword_Impl(const OUString& aFileNameBase) createFileURL(aFileNameBase, aFileExtension, aFileName); OUString aFilterType(getFileFormats()[0].pTypeName, strlen(getFileFormats()[0].pTypeName), RTL_TEXTENCODING_UTF8); - sal_uInt32 nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS; + SotClipboardFormatId nFormat = SotClipboardFormatId::STARCALC_8; SfxFilter* aFilter = new SfxFilter( aFilterName, OUString(), getFileFormats()[0].nFormatType, nFormat, aFilterType, 0, OUString(), diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 2f11f48ef24f..195be8f09c09 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -5894,7 +5894,7 @@ void Test::testImportStream() ScImportExport aObj(m_pDoc, ScAddress(0,0,0)); aObj.SetImportBroadcast(true); aObj.SetExtOptions(aOpt); - aObj.ImportString("1,2,3", FORMAT_STRING); + aObj.ImportString("1,2,3", SotClipboardFormatId::STRING); CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(0,0,0))); CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(1,0,0))); |