diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-29 09:45:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-29 18:47:18 +0200 |
commit | beaf6001c0d020f525bb99dae4a0f6cdd16b4c99 (patch) | |
tree | 82ae5fe362e073a6f6a032b9859062d78f02a7ca /unotools | |
parent | 67b157e994d9bef01f6117b53fc29e1fee538715 (diff) |
constructing SaveOptions just to read default version
can be a little expensive sometimes, since it loads a bunch of other
stuff at the same time.
So create a custom method that just loads the version
Change-Id: Ic480d95c4d64c68e57faf1b52f1d102141b7e246
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118047
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/saveopt.cxx | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index 1fad334ddbca..58040c2eafae 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -31,6 +31,7 @@ #include <osl/diagnose.h> #include <osl/mutex.hxx> #include <officecfg/Office/Recovery.hxx> +#include <officecfg/Office/Common.hxx> using namespace utl; using namespace com::sun::star::uno; @@ -937,9 +938,25 @@ SvtSaveOptions::ODFDefaultVersion SvtSaveOptions::GetODFDefaultVersion() const return (nRet == ODFVER_UNKNOWN) ? ODFVER_LATEST : nRet; } +SvtSaveOptions::ODFSaneDefaultVersion GetODFSaneDefaultVersion() +{ + sal_Int16 nTmp = officecfg::Office::Common::Save::ODF::DefaultVersion::get(); + SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion; + if( nTmp == 3 ) + eODFDefaultVersion = SvtSaveOptions::ODFVER_LATEST; + else + eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp ); + return SvtSaveOptions::GetODFSaneDefaultVersion(eODFDefaultVersion); +} + SvtSaveOptions::ODFSaneDefaultVersion SvtSaveOptions::GetODFSaneDefaultVersion() const { - switch (pImp->pSaveOpt->GetODFDefaultVersion()) + return GetODFSaneDefaultVersion(pImp->pSaveOpt->GetODFDefaultVersion()); +} + +SvtSaveOptions::ODFSaneDefaultVersion SvtSaveOptions::GetODFSaneDefaultVersion(ODFDefaultVersion eODFDefaultVersion) +{ + switch (eODFDefaultVersion) { default: assert(!"map new ODFDefaultVersion to ODFSaneDefaultVersion"); |