diff options
author | Noel Grandin <noel@peralex.com> | 2016-09-23 13:47:13 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-09-26 08:29:38 +0200 |
commit | 58a24575eb96a045cd8cacd2c96ab64aee992c0e (patch) | |
tree | f2daf9ad0fa05bcbf667fef43c5b90ecfd903cc1 | |
parent | 7f97b5e72c61066ea1ddd0f782e50070ce5f6363 (diff) |
convert ScXMLImportWrapper import flags to typed_flags_set
Change-Id: Id3aef9e6c43886d3c3fb9691a5d8f75499ed387c
-rw-r--r-- | sc/inc/xmlwrap.hxx | 21 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlwrap.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 4 |
3 files changed, 22 insertions, 15 deletions
diff --git a/sc/inc/xmlwrap.hxx b/sc/inc/xmlwrap.hxx index 7179bd843870..8193f757dc23 100644 --- a/sc/inc/xmlwrap.hxx +++ b/sc/inc/xmlwrap.hxx @@ -44,6 +44,19 @@ class SfxMedium; class ScMySharedData; class ScDocShell; +enum class ImportFlags { + Styles = 0x01, + Content = 0x02, + Metadata = 0x04, + Settings = 0x08, + All = Styles | Content | Metadata | Settings +}; +namespace o3tl +{ + template<> struct typed_flags<ImportFlags> : is_typed_flags<ImportFlags, 0x0f> {}; +} + + class ScXMLImportWrapper { sc::ImportPostProcessData maPostProcessData; @@ -73,16 +86,10 @@ class ScXMLImportWrapper public: - static const sal_uInt8 STYLES = 0x01; - static const sal_uInt8 CONTENT = 0x02; - static const sal_uInt8 METADATA = 0x04; - static const sal_uInt8 SETTINGS = 0x08; - static const sal_uInt8 ALL = STYLES | CONTENT | METADATA | SETTINGS; - ScXMLImportWrapper( ScDocShell& rDocSh, SfxMedium* pM, const css::uno::Reference<css::embed::XStorage>& xStor ); - bool Import( sal_uInt8 nMode, ErrCode& rError ); + bool Import( ImportFlags nMode, ErrCode& rError ); bool Export(bool bStylesOnly); const sc::ImportPostProcessData& GetImportPostProcessData() const { return maPostProcessData;} diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 7bf97823bf59..7aa54c029138 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -279,7 +279,7 @@ sal_uInt32 ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XCo return nReturn; } -bool ScXMLImportWrapper::Import( sal_uInt8 nMode, ErrCode& rError ) +bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError ) { uno::Reference<uno::XComponentContext> xContext = comphelper::getProcessComponentContext(); @@ -382,7 +382,7 @@ bool ScXMLImportWrapper::Import( sal_uInt8 nMode, ErrCode& rError ) bool bOasis = ( SotStorage::GetVersion( xStorage ) > SOFFICE_FILEFORMAT_60 ); - if ((nMode & METADATA) == METADATA && bOasis) + if ((nMode & ImportFlags::Metadata) && bOasis) { // RDF metadata: ODF >= 1.2 try @@ -415,7 +415,7 @@ bool ScXMLImportWrapper::Import( sal_uInt8 nMode, ErrCode& rError ) // #i103539#: always read meta.xml for generator sal_uInt32 nMetaRetval(0); - if ((nMode & METADATA) == METADATA) + if (nMode & ImportFlags::Metadata) { uno::Sequence<uno::Any> aMetaArgs(1); uno::Any* pMetaArgs = aMetaArgs.getArray(); @@ -454,7 +454,7 @@ bool ScXMLImportWrapper::Import( sal_uInt8 nMode, ErrCode& rError ) pStylesArgs[3] <<= xObjectResolver; sal_uInt32 nSettingsRetval(0); - if ((nMode & SETTINGS) == SETTINGS) + if (nMode & ImportFlags::Settings) { // Settings must be loaded first because of the printer setting, // which is needed in the page styles (paper tray). @@ -475,7 +475,7 @@ bool ScXMLImportWrapper::Import( sal_uInt8 nMode, ErrCode& rError ) } sal_uInt32 nStylesRetval(0); - if ((nMode & STYLES) == STYLES) + if (nMode & ImportFlags::Styles) { SAL_INFO( "sc.filter", "styles import start" ); @@ -489,7 +489,7 @@ bool ScXMLImportWrapper::Import( sal_uInt8 nMode, ErrCode& rError ) } sal_uInt32 nDocRetval(0); - if ((nMode & CONTENT) == CONTENT) + if (nMode & ImportFlags::Content) { if (mrDocShell.GetCreateMode() == SfxObjectCreateMode::INTERNAL) // We only need to import content for external link cache document. diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 20d21be97639..a1b32f0f3c06 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -451,9 +451,9 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css ErrCode nError = ERRCODE_NONE; aDocument.EnableAdjustHeight(false); if (GetCreateMode() == SfxObjectCreateMode::ORGANIZER) - bRet = aImport.Import(ScXMLImportWrapper::STYLES, nError); + bRet = aImport.Import(ImportFlags::Styles, nError); else - bRet = aImport.Import(ScXMLImportWrapper::ALL, nError); + bRet = aImport.Import(ImportFlags::All, nError); if ( nError ) pLoadMedium->SetError( nError, OSL_LOG_PREFIX ); |