diff options
-rw-r--r-- | cui/source/options/optsave.cxx | 56 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/dbloader2.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/ConnectionHelper.cxx | 2 | ||||
-rw-r--r-- | desktop/source/app/app.cxx | 34 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 26 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 7 | ||||
-rw-r--r-- | framework/source/services/frame.cxx | 2 | ||||
-rw-r--r-- | include/o3tl/enumarray.hxx | 5 | ||||
-rw-r--r-- | include/unotools/moduleoptions.hxx | 28 | ||||
-rw-r--r-- | sfx2/source/bastyp/fltfnc.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/docfac.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 2 | ||||
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 28 | ||||
-rw-r--r-- | unotools/source/config/moduleoptions.cxx | 307 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 8 |
16 files changed, 221 insertions, 302 deletions
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index 2767ef9e0d9d..da95054e252a 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -130,8 +130,8 @@ SfxSaveTabPage::SfxSaveTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet } else { - pImpl->aDefaultArr[APP_MATH] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_MATH); - pImpl->aDefaultReadonlyArr[APP_MATH] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_MATH); + pImpl->aDefaultArr[APP_MATH] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::MATH); + pImpl->aDefaultReadonlyArr[APP_MATH] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::MATH); } if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) ) @@ -141,8 +141,8 @@ SfxSaveTabPage::SfxSaveTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet } else { - pImpl->aDefaultArr[APP_DRAW] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_DRAW); - pImpl->aDefaultReadonlyArr[APP_DRAW] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_DRAW); + pImpl->aDefaultArr[APP_DRAW] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::DRAW); + pImpl->aDefaultReadonlyArr[APP_DRAW] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::DRAW); } if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) ) @@ -152,8 +152,8 @@ SfxSaveTabPage::SfxSaveTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet } else { - pImpl->aDefaultArr[APP_IMPRESS] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS); - pImpl->aDefaultReadonlyArr[APP_IMPRESS] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_IMPRESS); + pImpl->aDefaultArr[APP_IMPRESS] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::IMPRESS); + pImpl->aDefaultReadonlyArr[APP_IMPRESS] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::IMPRESS); } if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) ) @@ -163,8 +163,8 @@ SfxSaveTabPage::SfxSaveTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet } else { - pImpl->aDefaultArr[APP_CALC] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_CALC); - pImpl->aDefaultReadonlyArr[APP_CALC] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_CALC); + pImpl->aDefaultArr[APP_CALC] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::CALC); + pImpl->aDefaultReadonlyArr[APP_CALC] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::CALC); } if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) @@ -178,12 +178,12 @@ SfxSaveTabPage::SfxSaveTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet } else { - pImpl->aDefaultArr[APP_WRITER] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITER); - pImpl->aDefaultArr[APP_WRITER_WEB] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB); - pImpl->aDefaultArr[APP_WRITER_GLOBAL] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL); - pImpl->aDefaultReadonlyArr[APP_WRITER] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITER); - pImpl->aDefaultReadonlyArr[APP_WRITER_WEB] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITERWEB); - pImpl->aDefaultReadonlyArr[APP_WRITER_GLOBAL] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITERGLOBAL); + pImpl->aDefaultArr[APP_WRITER] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITER); + pImpl->aDefaultArr[APP_WRITER_WEB] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITERWEB); + pImpl->aDefaultArr[APP_WRITER_GLOBAL] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITERGLOBAL); + pImpl->aDefaultReadonlyArr[APP_WRITER] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::WRITER); + pImpl->aDefaultReadonlyArr[APP_WRITER_WEB] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::WRITERWEB); + pImpl->aDefaultReadonlyArr[APP_WRITER_GLOBAL] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::WRITERGLOBAL); } aLink = LINK( this, SfxSaveTabPage, ODFVersionHdl_Impl ); @@ -312,32 +312,32 @@ bool SfxSaveTabPage::FillItemSet( SfxItemSet* rSet ) SvtModuleOptions aModuleOpt; if(!pImpl->aDefaultArr[APP_MATH].isEmpty() && - pImpl->aDefaultArr[APP_MATH] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_MATH)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_MATH, pImpl->aDefaultArr[APP_MATH]); + pImpl->aDefaultArr[APP_MATH] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::MATH)) + aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::EFactory::MATH, pImpl->aDefaultArr[APP_MATH]); if( !pImpl->aDefaultArr[APP_DRAW].isEmpty() && - pImpl->aDefaultArr[APP_DRAW] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_DRAW)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_DRAW, pImpl->aDefaultArr[APP_DRAW]); + pImpl->aDefaultArr[APP_DRAW] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::DRAW)) + aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::EFactory::DRAW, pImpl->aDefaultArr[APP_DRAW]); if(!pImpl->aDefaultArr[APP_IMPRESS].isEmpty() && - pImpl->aDefaultArr[APP_IMPRESS] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS, pImpl->aDefaultArr[APP_IMPRESS]); + pImpl->aDefaultArr[APP_IMPRESS] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::IMPRESS)) + aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::EFactory::IMPRESS, pImpl->aDefaultArr[APP_IMPRESS]); if(!pImpl->aDefaultArr[APP_CALC].isEmpty() && - pImpl->aDefaultArr[APP_CALC] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_CALC)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_CALC, pImpl->aDefaultArr[APP_CALC]); + pImpl->aDefaultArr[APP_CALC] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::CALC)) + aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::EFactory::CALC, pImpl->aDefaultArr[APP_CALC]); if(!pImpl->aDefaultArr[APP_WRITER].isEmpty() && - pImpl->aDefaultArr[APP_WRITER] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITER)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITER, pImpl->aDefaultArr[APP_WRITER]); + pImpl->aDefaultArr[APP_WRITER] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITER)) + aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITER, pImpl->aDefaultArr[APP_WRITER]); if(!pImpl->aDefaultArr[APP_WRITER_WEB].isEmpty() && - pImpl->aDefaultArr[APP_WRITER_WEB] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB, pImpl->aDefaultArr[APP_WRITER_WEB]); + pImpl->aDefaultArr[APP_WRITER_WEB] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITERWEB)) + aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITERWEB, pImpl->aDefaultArr[APP_WRITER_WEB]); if(!pImpl->aDefaultArr[APP_WRITER_GLOBAL].isEmpty() && - pImpl->aDefaultArr[APP_WRITER_GLOBAL] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL, pImpl->aDefaultArr[APP_WRITER_GLOBAL]); + pImpl->aDefaultArr[APP_WRITER_GLOBAL] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITERGLOBAL)) + aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITERGLOBAL, pImpl->aDefaultArr[APP_WRITER_GLOBAL]); return bModified; } diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index c457334de3e7..5714649c1bfa 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -421,7 +421,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU { Reference< XDatabaseContext > xDatabaseContext( DatabaseContext::create(m_aContext) ); - OUString sFactoryName = SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::E_DATABASE); + OUString sFactoryName = SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::EFactory::DATABASE); bCreateNew = sFactoryName.match(_rURL); Reference< XDocumentDataSource > xDocumentDataSource; diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index 5d8f1e255b35..a02b5d68b80b 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -220,7 +220,7 @@ namespace dbaui ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, 0, - aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::E_CALC) + aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::EFactory::CALC) ,SfxFilterFlags::IMPORT); askForFileName(aFileDlg); } diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index bb352e2ed204..f85026e9c35b 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2336,13 +2336,13 @@ void Desktop::OpenClients() // Support command line parameters to start a module (as preselection) if ( rArgs.IsWriter() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) - aRequest.aModule = aOpt.GetFactoryName( SvtModuleOptions::E_WRITER ); + aRequest.aModule = aOpt.GetFactoryName( SvtModuleOptions::EFactory::WRITER ); else if ( rArgs.IsCalc() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) ) - aRequest.aModule = aOpt.GetFactoryName( SvtModuleOptions::E_CALC ); + aRequest.aModule = aOpt.GetFactoryName( SvtModuleOptions::EFactory::CALC ); else if ( rArgs.IsImpress() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) ) - aRequest.aModule= aOpt.GetFactoryName( SvtModuleOptions::E_IMPRESS ); + aRequest.aModule= aOpt.GetFactoryName( SvtModuleOptions::EFactory::IMPRESS ); else if ( rArgs.IsDraw() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) ) - aRequest.aModule= aOpt.GetFactoryName( SvtModuleOptions::E_DRAW ); + aRequest.aModule= aOpt.GetFactoryName( SvtModuleOptions::EFactory::DRAW ); } // check for printing disabled @@ -2398,36 +2398,36 @@ void Desktop::OpenDefault() { // Support new command line parameters to start a module if ( rArgs.IsWriter() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_WRITER ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::WRITER ); else if ( rArgs.IsCalc() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_CALC ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::CALC ); else if ( rArgs.IsImpress() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_IMPRESS ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::IMPRESS ); else if ( rArgs.IsBase() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_DATABASE ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::DATABASE ); else if ( rArgs.IsDraw() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_DRAW ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::DRAW ); else if ( rArgs.IsMath() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_MATH ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::MATH ); else if ( rArgs.IsGlobal() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_WRITERGLOBAL ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::WRITERGLOBAL ); else if ( rArgs.IsWeb() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_WRITERWEB ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::WRITERWEB ); } if ( aName.isEmpty() ) { // Old way to create a default document if ( aOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_WRITER ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::WRITER ); else if ( aOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_CALC ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::CALC ); else if ( aOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_IMPRESS ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::IMPRESS ); else if ( aOpt.IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_DATABASE ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::DATABASE ); else if ( aOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) ) - aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::E_DRAW ); + aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::DRAW ); else return; } diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index d148b8ae60d8..083172cab2fc 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -852,23 +852,23 @@ void OfficeIPCThread::execute() if ( aCmdLineArgs->HasModuleParam() && !bDocRequestSent ) { SvtModuleOptions aOpt; - SvtModuleOptions::EFactory eFactory = SvtModuleOptions::E_WRITER; + SvtModuleOptions::EFactory eFactory = SvtModuleOptions::EFactory::WRITER; if ( aCmdLineArgs->IsWriter() ) - eFactory = SvtModuleOptions::E_WRITER; + eFactory = SvtModuleOptions::EFactory::WRITER; else if ( aCmdLineArgs->IsCalc() ) - eFactory = SvtModuleOptions::E_CALC; + eFactory = SvtModuleOptions::EFactory::CALC; else if ( aCmdLineArgs->IsDraw() ) - eFactory = SvtModuleOptions::E_DRAW; + eFactory = SvtModuleOptions::EFactory::DRAW; else if ( aCmdLineArgs->IsImpress() ) - eFactory = SvtModuleOptions::E_IMPRESS; + eFactory = SvtModuleOptions::EFactory::IMPRESS; else if ( aCmdLineArgs->IsBase() ) - eFactory = SvtModuleOptions::E_DATABASE; + eFactory = SvtModuleOptions::EFactory::DATABASE; else if ( aCmdLineArgs->IsMath() ) - eFactory = SvtModuleOptions::E_MATH; + eFactory = SvtModuleOptions::EFactory::MATH; else if ( aCmdLineArgs->IsGlobal() ) - eFactory = SvtModuleOptions::E_WRITERGLOBAL; + eFactory = SvtModuleOptions::EFactory::WRITERGLOBAL; else if ( aCmdLineArgs->IsWeb() ) - eFactory = SvtModuleOptions::E_WRITERWEB; + eFactory = SvtModuleOptions::EFactory::WRITERWEB; if ( !pRequest->aOpenList.empty() ) pRequest->aModule = aOpt.GetFactoryName( eFactory ); @@ -928,13 +928,13 @@ void OfficeIPCThread::execute() // Support command line parameters to start a module (as preselection) if ( aCmdLineArgs->IsWriter() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) - pRequest->aModule = aOpt.GetFactoryName( SvtModuleOptions::E_WRITER ); + pRequest->aModule = aOpt.GetFactoryName( SvtModuleOptions::EFactory::WRITER ); else if ( aCmdLineArgs->IsCalc() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) ) - pRequest->aModule = aOpt.GetFactoryName( SvtModuleOptions::E_CALC ); + pRequest->aModule = aOpt.GetFactoryName( SvtModuleOptions::EFactory::CALC ); else if ( aCmdLineArgs->IsImpress() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) ) - pRequest->aModule= aOpt.GetFactoryName( SvtModuleOptions::E_IMPRESS ); + pRequest->aModule= aOpt.GetFactoryName( SvtModuleOptions::EFactory::IMPRESS ); else if ( aCmdLineArgs->IsDraw() && aOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) ) - pRequest->aModule= aOpt.GetFactoryName( SvtModuleOptions::E_DRAW ); + pRequest->aModule= aOpt.GetFactoryName( SvtModuleOptions::EFactory::DRAW ); } ImplPostProcessDocumentsEvent( pRequest ); diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 57d451d1c81d..271db0b60a38 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -29,6 +29,7 @@ #include <unotools/streamwrap.hxx> #include <unotools/pathoptions.hxx> #include <osl/file.hxx> +#include <o3tl/enumrange.hxx> #include <vcl/msgbox.hxx> #include <sfx2/filedlghelper.hxx> #include "svtools/treelistentry.hxx" @@ -187,16 +188,14 @@ void XMLFilterSettingsDialog::updateStates() filter_info_impl* pInfo = static_cast<filter_info_impl*>(pSelectedEntry->GetUserData()); bIsReadonly = pInfo->mbReadonly; - sal_Int32 nFact = SvtModuleOptions::E_WRITER; - while(nFact <= SvtModuleOptions::E_BASIC) + for( auto nFact : o3tl::enumrange<SvtModuleOptions::EFactory>()) { - OUString sDefault = maModuleOpt.GetFactoryDefaultFilter((SvtModuleOptions::EFactory)nFact); + OUString sDefault = maModuleOpt.GetFactoryDefaultFilter(nFact); if( sDefault == pInfo->maFilterName ) { bIsDefault = true; break; } - ++nFact; } } m_pPBEdit->Enable( bHasSelection && !bMultiSelection && !bIsReadonly); diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index ee75278d06b2..de6fd0baddf5 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -2948,7 +2948,7 @@ void Frame::implts_setIconOnWindow() if( xModel.is() ) { SvtModuleOptions::EFactory eFactory = SvtModuleOptions::ClassifyFactoryByModel(xModel); - if (eFactory != SvtModuleOptions::E_UNKNOWN_FACTORY) + if (eFactory != SvtModuleOptions::EFactory::UNKNOWN_FACTORY) nIcon = SvtModuleOptions().GetFactoryIcon( eFactory ); } } diff --git a/include/o3tl/enumarray.hxx b/include/o3tl/enumarray.hxx index 6bc3dff7a608..76fdec12f38b 100644 --- a/include/o3tl/enumarray.hxx +++ b/include/o3tl/enumarray.hxx @@ -67,8 +67,8 @@ public: { for (size_type i=0; i<=max_index; ++i) detail_values[i] = val; } size_type size() const { return max_index + 1; } - iterator begin() { return iterator(this, 0); } - iterator end() { return iterator(this, size()); } + iterator begin() { return iterator(*this, 0); } + iterator end() { return iterator(*this, size()); } //private: V detail_values[max_index + 1]; @@ -89,6 +89,7 @@ public: value_type &operator*() { return m_buf[static_cast<key_type>(m_pos)]; } value_type *operator->() { return &(operator*()); } self_type &operator++() { ++m_pos; return *this; } + bool operator!=(const self_type& other) { return &m_buf != &other.m_buf || m_pos != other.m_pos; } }; }; // namespace o3tl diff --git a/include/unotools/moduleoptions.hxx b/include/unotools/moduleoptions.hxx index 29dff59d2d75..9bc5e09e3266 100644 --- a/include/unotools/moduleoptions.hxx +++ b/include/unotools/moduleoptions.hxx @@ -68,21 +68,21 @@ class UNOTOOLS_DLLPUBLIC SAL_WARN_UNUSED SvtModuleOptions : public utl::detail:: If you change these enum ... don't forget to change reading/writing and order of configuration values too! See "SvtModuleOptions_Impl::impl_GetSetNames()" and his ctor for further information. */ - enum EFactory + enum class EFactory { - E_UNKNOWN_FACTORY = -1, - E_WRITER = 0, - E_WRITERWEB = 1, - E_WRITERGLOBAL = 2, - E_CALC = 3, - E_DRAW = 4, - E_IMPRESS = 5, - E_MATH = 6, - E_CHART = 7, - E_STARTMODULE = 8, - E_DATABASE = 9, - E_BASIC = 10 - + UNKNOWN_FACTORY = -1, + WRITER = 0, + WRITERWEB = 1, + WRITERGLOBAL = 2, + CALC = 3, + DRAW = 4, + IMPRESS = 5, + MATH = 6, + CHART = 7, + STARTMODULE = 8, + DATABASE = 9, + BASIC = 10, + LAST = BASIC }; public: diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 4baecd5b403a..9e0f8de67342 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -204,12 +204,12 @@ const SfxFilter* SfxFilterContainer::GetDefaultFilter_Impl( const OUString& rNam // Interpret given name as Service- and ShortName! SvtModuleOptions aOpt; SvtModuleOptions::EFactory eFactory = SvtModuleOptions::ClassifyFactoryByServiceName(rName); - if (eFactory == SvtModuleOptions::E_UNKNOWN_FACTORY) + if (eFactory == SvtModuleOptions::EFactory::UNKNOWN_FACTORY) eFactory = SvtModuleOptions::ClassifyFactoryByShortName(rName); // could not classify factory by its service nor by its short name. // Must be an unknown factory! => return NULL - if (eFactory == SvtModuleOptions::E_UNKNOWN_FACTORY) + if (eFactory == SvtModuleOptions::EFactory::UNKNOWN_FACTORY) return NULL; // For the following code we need some additional information. diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 55dd58283252..ba2ff680d591 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -301,9 +301,9 @@ void SfxObjectFactory::SetSystemTemplate( const OUString& rServiceName, const OU void SfxObjectFactory::SetStandardTemplate( const OUString& rServiceName, const OUString& rTemplate ) { SvtModuleOptions::EFactory eFac = SvtModuleOptions::ClassifyFactoryByServiceName(rServiceName); - if (eFac == SvtModuleOptions::E_UNKNOWN_FACTORY) + if (eFac == SvtModuleOptions::EFactory::UNKNOWN_FACTORY) eFac = SvtModuleOptions::ClassifyFactoryByShortName(rServiceName); - if (eFac != SvtModuleOptions::E_UNKNOWN_FACTORY) + if (eFac != SvtModuleOptions::EFactory::UNKNOWN_FACTORY) { SetSystemTemplate( rServiceName, rTemplate ); SvtModuleOptions().SetFactoryStandardTemplate(eFac, rTemplate); @@ -313,11 +313,11 @@ void SfxObjectFactory::SetStandardTemplate( const OUString& rServiceName, const OUString SfxObjectFactory::GetStandardTemplate( const OUString& rServiceName ) { SvtModuleOptions::EFactory eFac = SvtModuleOptions::ClassifyFactoryByServiceName(rServiceName); - if (eFac == SvtModuleOptions::E_UNKNOWN_FACTORY) + if (eFac == SvtModuleOptions::EFactory::UNKNOWN_FACTORY) eFac = SvtModuleOptions::ClassifyFactoryByShortName(rServiceName); OUString sTemplate; - if (eFac != SvtModuleOptions::E_UNKNOWN_FACTORY) + if (eFac != SvtModuleOptions::EFactory::UNKNOWN_FACTORY) sTemplate = SvtModuleOptions().GetFactoryStandardTemplate(eFac); return sTemplate; diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index d20dfc4c9e53..fd6190da3448 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -1716,7 +1716,7 @@ static std::vector<OUString> lcl_getAllFactoryURLs () { if ( ! SfxObjectFactory::GetStandardTemplate( aServiceNames[i] ).isEmpty() ) { - SvtModuleOptions::EFactory eFac = SvtModuleOptions::E_WRITER; + SvtModuleOptions::EFactory eFac = SvtModuleOptions::EFactory::WRITER; SvtModuleOptions::ClassifyFactoryByName( aServiceNames[i], eFac ); aList.push_back(aModOpt.GetFactoryEmptyDocumentURL(eFac)); } diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 83340bf09f1f..a8b7267d0771 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -630,7 +630,7 @@ namespace { SvtModuleOptions::EFactory getModule(SfxBindings& rBindings) { - SvtModuleOptions::EFactory eFactory(SvtModuleOptions::E_UNKNOWN_FACTORY); + SvtModuleOptions::EFactory eFactory(SvtModuleOptions::EFactory::UNKNOWN_FACTORY); try { const uno::Reference< frame::XFrame > xFrame = @@ -655,12 +655,12 @@ void SvxSearchDialog::ShowOptionalControls_Impl() SvtCJKOptions aCJKOptions; SvtCTLOptions aCTLOptions; SvtModuleOptions::EFactory eFactory = getModule(rBindings); - bool bDrawApp = eFactory == SvtModuleOptions::E_DRAW; + bool bDrawApp = eFactory == SvtModuleOptions::EFactory::DRAW; bool bWriterApp = - eFactory == SvtModuleOptions::E_WRITER || - eFactory == SvtModuleOptions::E_WRITERWEB || - eFactory == SvtModuleOptions::E_WRITERGLOBAL; - bool bCalcApp = eFactory == SvtModuleOptions::E_CALC; + eFactory == SvtModuleOptions::EFactory::WRITER || + eFactory == SvtModuleOptions::EFactory::WRITERWEB || + eFactory == SvtModuleOptions::EFactory::WRITERGLOBAL; + bool bCalcApp = eFactory == SvtModuleOptions::EFactory::CALC; m_pLayoutBtn->Show(!bDrawApp); m_pNotesBtn->Show(bWriterApp); @@ -1803,10 +1803,10 @@ IMPL_LINK( SvxSearchDialog, FocusHdl_Impl, Control *, pCtrl ) { SvtModuleOptions::EFactory eFactory = getModule(rBindings); bool bWriterApp = - eFactory == SvtModuleOptions::E_WRITER || - eFactory == SvtModuleOptions::E_WRITERWEB || - eFactory == SvtModuleOptions::E_WRITERGLOBAL; - bool bCalcApp = eFactory == SvtModuleOptions::E_CALC; + eFactory == SvtModuleOptions::EFactory::WRITER || + eFactory == SvtModuleOptions::EFactory::WRITERWEB || + eFactory == SvtModuleOptions::EFactory::WRITERGLOBAL; + bool bCalcApp = eFactory == SvtModuleOptions::EFactory::CALC; if (bWriterApp) m_pLayoutBtn->SetText(aLayoutWriterStr); @@ -1931,10 +1931,10 @@ IMPL_LINK_NOARG(SvxSearchDialog, NoFormatHdl_Impl) { SvtModuleOptions::EFactory eFactory = getModule(rBindings); bool bWriterApp = - eFactory == SvtModuleOptions::E_WRITER || - eFactory == SvtModuleOptions::E_WRITERWEB || - eFactory == SvtModuleOptions::E_WRITERGLOBAL; - bool bCalcApp = eFactory == SvtModuleOptions::E_CALC; + eFactory == SvtModuleOptions::EFactory::WRITER || + eFactory == SvtModuleOptions::EFactory::WRITERWEB || + eFactory == SvtModuleOptions::EFactory::WRITERGLOBAL; + bool bCalcApp = eFactory == SvtModuleOptions::EFactory::CALC; if (bCalcApp) m_pLayoutBtn->SetText( aLayoutCalcStr ); diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index 24df404e6fc8..110231090018 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -22,9 +22,10 @@ #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> #include <osl/diagnose.h> +#include <o3tl/enumarray.hxx> #include <rtl/ustrbuf.hxx> - #include <rtl/instance.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> @@ -264,8 +265,6 @@ struct FactoryInfo css::uno::Reference< css::util::XStringSubstitution > xSubstVars; }; -typedef FactoryInfo FactoryInfoList[FACTORYCOUNT]; - /*-************************************************************************************************************ @short IMPL data container for wrapper class SvtModulOptions! @descr These class is used as a static data container of class SvtModuleOptions. The hold it by using @@ -325,7 +324,7 @@ class SvtModuleOptions_Impl : public ::utl::ConfigItem // private member private: - FactoryInfoList m_lFactories; + o3tl::enumarray<SvtModuleOptions::EFactory, FactoryInfo> m_lFactories; bool m_bReadOnlyStatesWellKnown; }; @@ -343,8 +342,8 @@ SvtModuleOptions_Impl::SvtModuleOptions_Impl() , m_bReadOnlyStatesWellKnown( false ) { // First initialize list of factory infos! Otherwise we couldnt guarantee right working of these class. - for( sal_Int32 nFactory=0; nFactory<FACTORYCOUNT; ++nFactory ) - m_lFactories[nFactory].free(); + for( auto & rFactory : m_lFactories ) + rFactory.free(); // Get name list of all existing set node names in configuration to read her properties in impl_Read(). // These list is a list of long names of our factories. @@ -400,18 +399,15 @@ void SvtModuleOptions_Impl::ImplCommit() // Step over all factories and get her really changed values only. // Build list of these ones and use it for commit. css::uno::Sequence< css::beans::PropertyValue > lCommitProperties( FACTORYCOUNT*PROPERTYCOUNT ); - FactoryInfo* pInfo = NULL; sal_Int32 nRealCount = 0; OUString sBasePath; - for( sal_Int32 nFactory=0; nFactory<FACTORYCOUNT; ++nFactory ) + for( FactoryInfo & rInfo : m_lFactories ) { - pInfo = &(m_lFactories[nFactory]); - // These path is used to build full qualified property names .... // See pInfo->getChangedProperties() for further information - sBasePath = PATHSEPARATOR + pInfo->getFactory() + PATHSEPARATOR; + sBasePath = PATHSEPARATOR + rInfo.getFactory() + PATHSEPARATOR; - const css::uno::Sequence< css::beans::PropertyValue > lChangedProperties = pInfo->getChangedProperties ( sBasePath ); + const css::uno::Sequence< css::beans::PropertyValue > lChangedProperties = rInfo.getChangedProperties ( sBasePath ); const css::beans::PropertyValue* pChangedProperties = lChangedProperties.getConstArray(); sal_Int32 nPropertyCount = lChangedProperties.getLength(); for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) @@ -451,27 +447,27 @@ bool SvtModuleOptions_Impl::IsModuleInstalled( SvtModuleOptions::EModule eModule bool bInstalled = false; switch( eModule ) { - case SvtModuleOptions::E_SWRITER : bInstalled = m_lFactories[SvtModuleOptions::E_WRITER].getInstalled(); + case SvtModuleOptions::E_SWRITER : bInstalled = m_lFactories[SvtModuleOptions::EFactory::WRITER].getInstalled(); break; - case SvtModuleOptions::E_SWEB : bInstalled = m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled(); + case SvtModuleOptions::E_SWEB : bInstalled = m_lFactories[SvtModuleOptions::EFactory::WRITERWEB].getInstalled(); break; - case SvtModuleOptions::E_SGLOBAL : bInstalled = m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled(); + case SvtModuleOptions::E_SGLOBAL : bInstalled = m_lFactories[SvtModuleOptions::EFactory::WRITERGLOBAL].getInstalled(); break; - case SvtModuleOptions::E_SCALC : bInstalled = m_lFactories[SvtModuleOptions::E_CALC].getInstalled(); + case SvtModuleOptions::E_SCALC : bInstalled = m_lFactories[SvtModuleOptions::EFactory::CALC].getInstalled(); break; - case SvtModuleOptions::E_SDRAW : bInstalled = m_lFactories[SvtModuleOptions::E_DRAW].getInstalled(); + case SvtModuleOptions::E_SDRAW : bInstalled = m_lFactories[SvtModuleOptions::EFactory::DRAW].getInstalled(); break; - case SvtModuleOptions::E_SIMPRESS : bInstalled = m_lFactories[SvtModuleOptions::E_IMPRESS].getInstalled(); + case SvtModuleOptions::E_SIMPRESS : bInstalled = m_lFactories[SvtModuleOptions::EFactory::IMPRESS].getInstalled(); break; - case SvtModuleOptions::E_SMATH : bInstalled = m_lFactories[SvtModuleOptions::E_MATH].getInstalled(); + case SvtModuleOptions::E_SMATH : bInstalled = m_lFactories[SvtModuleOptions::EFactory::MATH].getInstalled(); break; - case SvtModuleOptions::E_SCHART : bInstalled = m_lFactories[SvtModuleOptions::E_CHART].getInstalled(); + case SvtModuleOptions::E_SCHART : bInstalled = m_lFactories[SvtModuleOptions::EFactory::CHART].getInstalled(); break; - case SvtModuleOptions::E_SSTARTMODULE : bInstalled = m_lFactories[SvtModuleOptions::E_STARTMODULE].getInstalled(); + case SvtModuleOptions::E_SSTARTMODULE : bInstalled = m_lFactories[SvtModuleOptions::EFactory::STARTMODULE].getInstalled(); break; case SvtModuleOptions::E_SBASIC : bInstalled = true; // Couldn't be deselected by setup yet! break; - case SvtModuleOptions::E_SDATABASE : bInstalled = m_lFactories[SvtModuleOptions::E_DATABASE].getInstalled(); + case SvtModuleOptions::E_SDATABASE : bInstalled = m_lFactories[SvtModuleOptions::EFactory::DATABASE].getInstalled(); break; } @@ -480,64 +476,18 @@ bool SvtModuleOptions_Impl::IsModuleInstalled( SvtModuleOptions::EModule eModule ::com::sun::star::uno::Sequence < OUString > SvtModuleOptions_Impl::GetAllServiceNames() { - sal_uInt32 nCount=0; - if( m_lFactories[SvtModuleOptions::E_WRITER].getInstalled() ) - nCount++; - if ( m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled() ) - nCount++; - if ( m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SCALC].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SDRAW].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SIMPRESS].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SCHART].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SMATH].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SBASIC].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SDATABASE].getInstalled() ) - nCount++; - - css::uno::Sequence < OUString > aRet( nCount ); - sal_Int32 n=0; - if( m_lFactories[SvtModuleOptions::E_WRITER].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITER].getFactory(); - if ( m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITERWEB].getFactory(); - if ( m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SCALC].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SCALC].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SDRAW].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SDRAW].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SIMPRESS].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SIMPRESS].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SCHART].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SCHART].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SMATH].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SMATH].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SBASIC].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SBASIC].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SDATABASE].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SDATABASE].getFactory(); - - return aRet; + std::vector<OUString> aVec; + + for( auto & rFactory : m_lFactories ) + if( rFactory.getInstalled() ) + aVec.push_back( rFactory.getFactory() ); + + return comphelper::containerToSequence(aVec); } OUString SvtModuleOptions_Impl::GetFactoryName( SvtModuleOptions::EFactory eFactory ) const { - OUString sName; - - if( eFactory>=0 && eFactory<FACTORYCOUNT ) - { - sName = m_lFactories[eFactory].getFactory(); - } - - return sName; + return m_lFactories[eFactory].getFactory(); } OUString SvtModuleOptions::GetFactoryShortName(SvtModuleOptions::EFactory eFactory) @@ -550,26 +500,26 @@ OUString SvtModuleOptions::GetFactoryShortName(SvtModuleOptions::EFactory eFacto OUString sShortName; switch( eFactory ) { - case SvtModuleOptions::E_WRITER : sShortName = "swriter"; - break; - case SvtModuleOptions::E_WRITERWEB : sShortName = "swriter/web"; - break; - case SvtModuleOptions::E_WRITERGLOBAL : sShortName = "swriter/GlobalDocument"; - break; - case SvtModuleOptions::E_CALC : sShortName = "scalc"; - break; - case SvtModuleOptions::E_DRAW : sShortName = "sdraw"; - break; - case SvtModuleOptions::E_IMPRESS : sShortName = "simpress"; - break; - case SvtModuleOptions::E_MATH : sShortName = "smath"; - break; - case SvtModuleOptions::E_CHART : sShortName = "schart"; - break; - case SvtModuleOptions::E_BASIC : sShortName = "sbasic"; - break; - case SvtModuleOptions::E_DATABASE : sShortName = "sdatabase"; - break; + case SvtModuleOptions::EFactory::WRITER : sShortName = "swriter"; + break; + case SvtModuleOptions::EFactory::WRITERWEB: sShortName = "swriter/web"; + break; + case SvtModuleOptions::EFactory::WRITERGLOBAL: sShortName = "swriter/GlobalDocument"; + break; + case SvtModuleOptions::EFactory::CALC : sShortName = "scalc"; + break; + case SvtModuleOptions::EFactory::DRAW : sShortName = "sdraw"; + break; + case SvtModuleOptions::EFactory::IMPRESS : sShortName = "simpress"; + break; + case SvtModuleOptions::EFactory::MATH : sShortName = "smath"; + break; + case SvtModuleOptions::EFactory::CHART : sShortName = "schart"; + break; + case SvtModuleOptions::EFactory::BASIC : sShortName = "sbasic"; + break; + case SvtModuleOptions::EFactory::DATABASE : sShortName = "sdatabase"; + break; default: OSL_FAIL( "unknown factory" ); break; @@ -580,14 +530,7 @@ OUString SvtModuleOptions::GetFactoryShortName(SvtModuleOptions::EFactory eFacto OUString SvtModuleOptions_Impl::GetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory ) const { - OUString sFile; - - if( eFactory>=0 && eFactory<FACTORYCOUNT ) - { - sFile = m_lFactories[eFactory].getTemplateFile(); - } - - return sFile; + return m_lFactories[eFactory].getTemplateFile(); } OUString SvtModuleOptions_Impl::GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory eFactory ) @@ -600,25 +543,25 @@ OUString SvtModuleOptions_Impl::GetFactoryEmptyDocumentURL( SvtModuleOptions::EF OUString sURL; switch( eFactory ) { - case SvtModuleOptions::E_WRITER : sURL = "private:factory/swriter"; + case SvtModuleOptions::EFactory::WRITER : sURL = "private:factory/swriter"; break; - case SvtModuleOptions::E_WRITERWEB : sURL = "private:factory/swriter/web"; + case SvtModuleOptions::EFactory::WRITERWEB : sURL = "private:factory/swriter/web"; break; - case SvtModuleOptions::E_WRITERGLOBAL : sURL = "private:factory/swriter/GlobalDocument"; + case SvtModuleOptions::EFactory::WRITERGLOBAL : sURL = "private:factory/swriter/GlobalDocument"; break; - case SvtModuleOptions::E_CALC : sURL = "private:factory/scalc"; + case SvtModuleOptions::EFactory::CALC : sURL = "private:factory/scalc"; break; - case SvtModuleOptions::E_DRAW : sURL = "private:factory/sdraw"; + case SvtModuleOptions::EFactory::DRAW : sURL = "private:factory/sdraw"; break; - case SvtModuleOptions::E_IMPRESS : sURL = "private:factory/simpress?slot=6686"; + case SvtModuleOptions::EFactory::IMPRESS : sURL = "private:factory/simpress?slot=6686"; break; - case SvtModuleOptions::E_MATH : sURL = "private:factory/smath"; + case SvtModuleOptions::EFactory::MATH : sURL = "private:factory/smath"; break; - case SvtModuleOptions::E_CHART : sURL = "private:factory/schart"; + case SvtModuleOptions::EFactory::CHART : sURL = "private:factory/schart"; break; - case SvtModuleOptions::E_BASIC : sURL = "private:factory/sbasic"; + case SvtModuleOptions::EFactory::BASIC : sURL = "private:factory/sbasic"; break; - case SvtModuleOptions::E_DATABASE : sURL = "private:factory/sdatabase?Interactive"; + case SvtModuleOptions::EFactory::DATABASE : sURL = "private:factory/sdatabase?Interactive"; break; default: OSL_FAIL( "unknown factory" ); @@ -629,55 +572,31 @@ OUString SvtModuleOptions_Impl::GetFactoryEmptyDocumentURL( SvtModuleOptions::EF OUString SvtModuleOptions_Impl::GetFactoryDefaultFilter( SvtModuleOptions::EFactory eFactory ) const { - OUString sDefaultFilter; - - if( eFactory>=0 && eFactory<FACTORYCOUNT ) - { - sDefaultFilter = m_lFactories[eFactory].getDefaultFilter(); - } - return sDefaultFilter; + return m_lFactories[eFactory].getDefaultFilter(); } bool SvtModuleOptions_Impl::IsDefaultFilterReadonly( SvtModuleOptions::EFactory eFactory ) const { - bool bRet = false; - if( eFactory>=0 && eFactory<FACTORYCOUNT ) - { - bRet = m_lFactories[eFactory].isDefaultFilterReadonly(); - } - return bRet; + return m_lFactories[eFactory].isDefaultFilterReadonly(); } sal_Int32 SvtModuleOptions_Impl::GetFactoryIcon( SvtModuleOptions::EFactory eFactory ) const { - sal_Int32 nIcon = 0; - - if( eFactory>=0 && eFactory<FACTORYCOUNT ) - { - nIcon = m_lFactories[eFactory].getIcon(); - } - - return nIcon; + return m_lFactories[eFactory].getIcon(); } void SvtModuleOptions_Impl::SetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory , const OUString& sTemplate ) { - if( eFactory>=0 && eFactory<FACTORYCOUNT ) - { - m_lFactories[eFactory].setTemplateFile( sTemplate ); - SetModified(); - } + m_lFactories[eFactory].setTemplateFile( sTemplate ); + SetModified(); } void SvtModuleOptions_Impl::SetFactoryDefaultFilter( SvtModuleOptions::EFactory eFactory, const OUString& sFilter ) { - if( eFactory>=0 && eFactory<FACTORYCOUNT ) - { - m_lFactories[eFactory].setDefaultFilter( sFilter ); - SetModified(); - } + m_lFactories[eFactory].setDefaultFilter( sFilter ); + SetModified(); } /*-************************************************************************************************************ @@ -733,60 +652,60 @@ bool SvtModuleOptions_Impl::ClassifyFactoryByName( const OUString& sName, SvtMod { bool bState; - eFactory = SvtModuleOptions::E_WRITER; + eFactory = SvtModuleOptions::EFactory::WRITER; bState = ( sName == FACTORYNAME_WRITER ); if( !bState ) { - eFactory = SvtModuleOptions::E_WRITERWEB; + eFactory = SvtModuleOptions::EFactory::WRITERWEB; bState = ( sName == FACTORYNAME_WRITERWEB ); } // no else! if( !bState ) { - eFactory = SvtModuleOptions::E_WRITERGLOBAL; + eFactory = SvtModuleOptions::EFactory::WRITERGLOBAL; bState = ( sName == FACTORYNAME_WRITERGLOBAL ); } // no else! if( !bState ) { - eFactory = SvtModuleOptions::E_CALC; + eFactory = SvtModuleOptions::EFactory::CALC; bState = ( sName == FACTORYNAME_CALC ); } // no else! if( !bState ) { - eFactory = SvtModuleOptions::E_DRAW; + eFactory = SvtModuleOptions::EFactory::DRAW; bState = ( sName == FACTORYNAME_DRAW ); } // no else! if( !bState ) { - eFactory = SvtModuleOptions::E_IMPRESS; + eFactory = SvtModuleOptions::EFactory::IMPRESS; bState = ( sName == FACTORYNAME_IMPRESS ); } // no else! if( !bState ) { - eFactory = SvtModuleOptions::E_MATH; + eFactory = SvtModuleOptions::EFactory::MATH; bState = ( sName == FACTORYNAME_MATH ); } // no else! if( !bState ) { - eFactory = SvtModuleOptions::E_CHART; + eFactory = SvtModuleOptions::EFactory::CHART; bState = ( sName == FACTORYNAME_CHART ); } // no else! if( !bState ) { - eFactory = SvtModuleOptions::E_DATABASE; + eFactory = SvtModuleOptions::EFactory::DATABASE; bState = ( sName == FACTORYNAME_DATABASE ); } // no else! if( !bState ) { - eFactory = SvtModuleOptions::E_STARTMODULE; + eFactory = SvtModuleOptions::EFactory::STARTMODULE; bState = ( sName == FACTORYNAME_STARTMODULE); } // no else! @@ -1099,55 +1018,55 @@ OUString SvtModuleOptions::GetModuleName( EModule eModule ) const SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByShortName(const OUString& sName) { if ( sName == "swriter" ) - return E_WRITER; + return EFactory::WRITER; if (sName.equalsIgnoreAsciiCase("swriter/Web")) // sometimes they are registered for swriter/web :-( - return E_WRITERWEB; + return EFactory::WRITERWEB; if (sName.equalsIgnoreAsciiCase("swriter/GlobalDocument")) // sometimes they are registered for swriter/globaldocument :-( - return E_WRITERGLOBAL; + return EFactory::WRITERGLOBAL; if ( sName == "scalc" ) - return E_CALC; + return EFactory::CALC; if ( sName == "sdraw" ) - return E_DRAW; + return EFactory::DRAW; if ( sName == "simpress" ) - return E_IMPRESS; + return EFactory::IMPRESS; if ( sName == "schart" ) - return E_CHART; + return EFactory::CHART; if ( sName == "smath" ) - return E_MATH; + return EFactory::MATH; if ( sName == "sbasic" ) - return E_BASIC; + return EFactory::BASIC; if ( sName == "sdatabase" ) - return E_DATABASE; + return EFactory::DATABASE; - return E_UNKNOWN_FACTORY; + return EFactory::UNKNOWN_FACTORY; } SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByServiceName(const OUString& sName) { if (sName == FACTORYNAME_WRITERGLOBAL) - return E_WRITERGLOBAL; + return EFactory::WRITERGLOBAL; if (sName == FACTORYNAME_WRITERWEB) - return E_WRITERWEB; + return EFactory::WRITERWEB; if (sName == FACTORYNAME_WRITER) - return E_WRITER; + return EFactory::WRITER; if (sName == FACTORYNAME_CALC) - return E_CALC; + return EFactory::CALC; if (sName == FACTORYNAME_DRAW) - return E_DRAW; + return EFactory::DRAW; if (sName == FACTORYNAME_IMPRESS) - return E_IMPRESS; + return EFactory::IMPRESS; if (sName == FACTORYNAME_MATH) - return E_MATH; + return EFactory::MATH; if (sName == FACTORYNAME_CHART) - return E_CHART; + return EFactory::CHART; if (sName == FACTORYNAME_DATABASE) - return E_DATABASE; + return EFactory::DATABASE; if (sName == FACTORYNAME_STARTMODULE) - return E_STARTMODULE; + return EFactory::STARTMODULE; if (sName == FACTORYNAME_BASIC) - return E_BASIC; + return EFactory::BASIC; - return E_UNKNOWN_FACTORY; + return EFactory::UNKNOWN_FACTORY; } SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const OUString& sURL , @@ -1167,7 +1086,7 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const OUString catch(const css::uno::RuntimeException&) { throw; } catch(const css::uno::Exception&) - { return E_UNKNOWN_FACTORY; } + { return EFactory::UNKNOWN_FACTORY; } ::comphelper::SequenceAsHashMap stlDesc(lMediaDescriptor); @@ -1181,7 +1100,7 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const OUString OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault("DocumentService", OUString()); SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService); - if (eApp != E_UNKNOWN_FACTORY) + if (eApp != EFactory::UNKNOWN_FACTORY) return eApp; } catch(const css::uno::RuntimeException&) @@ -1201,7 +1120,7 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const OUString } if (sTypeName.isEmpty()) - return E_UNKNOWN_FACTORY; + return EFactory::UNKNOWN_FACTORY; // yes - there is a type info // Try to find the preferred filter. @@ -1213,7 +1132,7 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const OUString OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault("DocumentService", OUString()); SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService); - if (eApp != E_UNKNOWN_FACTORY) + if (eApp != EFactory::UNKNOWN_FACTORY) return eApp; } catch(const css::uno::RuntimeException&) @@ -1222,14 +1141,14 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const OUString { /* do nothing here ... may the following code can help!*/ } // no filter/no type/no detection result => no fun :-) - return E_UNKNOWN_FACTORY; + return EFactory::UNKNOWN_FACTORY; } SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByModel(const css::uno::Reference< css::frame::XModel >& xModel) { css::uno::Reference< css::lang::XServiceInfo > xInfo(xModel, css::uno::UNO_QUERY); if (!xInfo.is()) - return E_UNKNOWN_FACTORY; + return EFactory::UNKNOWN_FACTORY; const css::uno::Sequence< OUString > lServices = xInfo->getSupportedServiceNames(); const OUString* pServices = lServices.getConstArray(); @@ -1237,11 +1156,11 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByModel(const css::u for (sal_Int32 i=0; i<lServices.getLength(); ++i) { SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(pServices[i]); - if (eApp != E_UNKNOWN_FACTORY) + if (eApp != EFactory::UNKNOWN_FACTORY) return eApp; } - return E_UNKNOWN_FACTORY; + return EFactory::UNKNOWN_FACTORY; } ::com::sun::star::uno::Sequence < OUString > SvtModuleOptions::GetAllServiceNames() @@ -1254,21 +1173,21 @@ OUString SvtModuleOptions::GetDefaultModuleName() { OUString aModule; if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SWRITER)) - aModule = GetFactoryShortName(SvtModuleOptions::E_WRITER); + aModule = GetFactoryShortName(SvtModuleOptions::EFactory::WRITER); else if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SCALC)) - aModule = GetFactoryShortName(SvtModuleOptions::E_CALC); + aModule = GetFactoryShortName(SvtModuleOptions::EFactory::CALC); else if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SIMPRESS)) - aModule = GetFactoryShortName(SvtModuleOptions::E_IMPRESS); + aModule = GetFactoryShortName(SvtModuleOptions::EFactory::IMPRESS); else if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SDATABASE)) - aModule = GetFactoryShortName(SvtModuleOptions::E_DATABASE); + aModule = GetFactoryShortName(SvtModuleOptions::EFactory::DATABASE); else if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SDRAW)) - aModule = GetFactoryShortName(SvtModuleOptions::E_DRAW); + aModule = GetFactoryShortName(SvtModuleOptions::EFactory::DRAW); else if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SWEB)) - aModule = GetFactoryShortName(SvtModuleOptions::E_WRITERWEB); + aModule = GetFactoryShortName(SvtModuleOptions::EFactory::WRITERWEB); else if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SGLOBAL)) - aModule = GetFactoryShortName(SvtModuleOptions::E_WRITERGLOBAL); + aModule = GetFactoryShortName(SvtModuleOptions::EFactory::WRITERGLOBAL); else if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SMATH)) - aModule = GetFactoryShortName(SvtModuleOptions::E_MATH); + aModule = GetFactoryShortName(SvtModuleOptions::EFactory::MATH); return aModule; } diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 89cee1006824..fe100a0dec22 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -428,7 +428,7 @@ void SvXMLExport::_InitCtor() // Shapes in Writer cannot be named via context menu (#i51726#) void SvXMLExport::_DetermineModelType() { - meModelType = SvtModuleOptions::E_UNKNOWN_FACTORY; + meModelType = SvtModuleOptions::EFactory::UNKNOWN_FACTORY; if ( mxModel.is() ) { @@ -2397,7 +2397,7 @@ void SvXMLExport::DisposingModel() { mxModel.clear(); // Shapes in Writer cannot be named via context menu (#i51726#) - meModelType = SvtModuleOptions::E_UNKNOWN_FACTORY; + meModelType = SvtModuleOptions::EFactory::UNKNOWN_FACTORY; mxEventListener.clear(); } diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index e7ec2fbad58f..7e2b5d64d4d7 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -580,7 +580,7 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape // export hyperlinks with <a><shape/></a>. Currently only in draw since draw // does not support document events - if( xSet.is() && (GetExport().GetModelType() == SvtModuleOptions::E_DRAW) ) try + if( xSet.is() && (GetExport().GetModelType() == SvtModuleOptions::EFactory::DRAW) ) try { presentation::ClickAction eAction = presentation::ClickAction_NONE; xSet->getPropertyValue("OnClick") >>= eAction; @@ -649,9 +649,9 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape any names for shapes, except for group shapes. */ { - if ( ( GetExport().GetModelType() != SvtModuleOptions::E_WRITER && - GetExport().GetModelType() != SvtModuleOptions::E_WRITERWEB && - GetExport().GetModelType() != SvtModuleOptions::E_WRITERGLOBAL ) || + if ( ( GetExport().GetModelType() != SvtModuleOptions::EFactory::WRITER && + GetExport().GetModelType() != SvtModuleOptions::EFactory::WRITERWEB && + GetExport().GetModelType() != SvtModuleOptions::EFactory::WRITERGLOBAL ) || !( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) || aShapeInfo.meShapeType == XmlShapeTypeDrawGroupShape || ( aShapeInfo.meShapeType == XmlShapeTypeDrawCustomShape && |