summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/unotools/saveopt.hxx24
-rw-r--r--unotools/source/config/saveopt.cxx24
2 files changed, 46 insertions, 2 deletions
diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index 207ad42e7c63..c9d793dfe134 100644
--- a/include/unotools/saveopt.hxx
+++ b/include/unotools/saveopt.hxx
@@ -51,7 +51,14 @@ public:
E_USERAUTOSAVE,
};
- // keep enum values sorted that a less or greater compare maps to older and newer versions!
+ /** Keep enum values sorted that a less or greater compare maps to older
+ and newer versions.
+ Do not change values, they are stored in the configuration.
+ ODFVER_LATEST designates the "current greatest and latest".
+ When adding a new value or ODFVER_LATEST designates a new real version
+ (plus extensions) adjust the mapping in
+ SvtSaveOptions::GetODFSaneDefaultVersion().
+ */
enum ODFDefaultVersion
{
ODFVER_UNKNOWN = 0, // unknown
@@ -60,11 +67,23 @@ public:
DO_NOT_USE = 3, // Do not use this, only here for compatibility with pre OOo 3.2 configuration
ODFVER_012 = 4, // ODF 1.2
ODFVER_012_EXT_COMPAT = 8, // ODF 1.2 extended, but with compatibility fallbacks
- ODFVER_013 = 9, // ODF 1.3
ODFVER_LATEST = SAL_MAX_ENUM, // ODF latest version with enhancements
};
+ /// Enums that allow a sane comparison of versions, without LATEST.
+ enum ODFSaneDefaultVersion
+ {
+ ODFSVER_EXTENDED = 1, // bit designating extensions are allowed
+ ODFSVER_010 = 2, // ODF 1.0
+ ODFSVER_011 = 4, // ODF 1.1
+ ODFSVER_012 = 6, // ODF 1.2
+ ODFSVER_012_EXT_COMPAT = 9, // ODF 1.2 extended, but with compatibility fallbacks
+ ODFSVER_012_EXTENDED = 11, // ODF 1.2 extended
+ ODFSVER_013 = 12, // ODF 1.3
+ ODFSVER_013_EXTENDED = 13 // ODF 1.3 extended
+ };
+
SvtSaveOptions();
virtual ~SvtSaveOptions();
@@ -117,6 +136,7 @@ public:
void SetODFDefaultVersion( ODFDefaultVersion eVersion );
ODFDefaultVersion GetODFDefaultVersion() const;
+ ODFSaneDefaultVersion GetODFSaneDefaultVersion() const;
bool IsUseSHA1InODF12() const;
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index 57b0aec7f8ae..18f958136998 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -1005,6 +1005,30 @@ SvtSaveOptions::ODFDefaultVersion SvtSaveOptions::GetODFDefaultVersion() const
return pImp->pSaveOpt->GetODFDefaultVersion();
}
+SvtSaveOptions::ODFSaneDefaultVersion SvtSaveOptions::GetODFSaneDefaultVersion() const
+{
+ const ODFSaneDefaultVersion NOW_CURRENT_LATEST = ODFSVER_012_EXTENDED;
+
+ switch (pImp->pSaveOpt->GetODFDefaultVersion())
+ {
+ default:
+ assert(!"map new ODFDefaultVersion to ODFSaneDefaultVersion");
+ break;
+ case ODFVER_UNKNOWN:
+ case ODFVER_LATEST:
+ return NOW_CURRENT_LATEST;
+ case ODFVER_010:
+ return ODFSVER_010;
+ case ODFVER_011:
+ return ODFSVER_011;
+ case ODFVER_012:
+ return ODFSVER_012;
+ case ODFVER_012_EXT_COMPAT:
+ return ODFSVER_012_EXT_COMPAT;
+ }
+ return NOW_CURRENT_LATEST;
+}
+
bool SvtSaveOptions::IsUseSHA1InODF12() const
{
return pImp->pSaveOpt->IsUseSHA1InODF12();