ddn.odf.compat
Compatibility layer for ODF documents from common office suites.
Detects ODF version differences, identifies generator suites, handles namespace variations, and reports version-specific compatibility notes through diagnostics.
Supported suites
- LibreOffice (all versions)
- Apache OpenOffice
- Calligra
- Google Docs (Google Drive exports)
- Microsoft Office (ODF export)
- KOffice / NeoOffice
Version handling
- Detects ODF versions 1.0 through 1.4
- Reports unsupported versions as diagnostics
- Provides
OdfCompatibilityTargetfor target version selection
Compatibility notes
- Namespace prefix variations between generators
- Non-standard
meta:generatorstrings - Default attribute value differences
- Extension namespace handling
Types 4
enumOdfVersion
Known ODF specification versions.
ODF 1.2, 1.3, and 1.4 are fully supported. Legacy versions (1.0, 1.1) are detected and reported through diagnostics but content is preserved.
UNKNOWNVersion is not specified or could not be determined.
V1_0ODF 1.0 (legacy, used by early OpenOffice.org).
V1_1ODF 1.1 (used by older OpenOffice and some legacy suites).
V1_2ODF 1.2 (fully supported).
V1_3ODF 1.3 (fully supported with change tracking, RDF metadata).
V1_4ODF 1.4 (fully supported; LibreOffice 25.x default).
structOdfCompatResult
Result of a compatibility check against an ODF document.
Fields
OdfVersion detectedVersionThe detected ODF version from the document.string versionStringThe version string as found in the document (e.g. `"1.4"`).bool isFullySupportedWhether the detected version is fully supported.string generatorOptional suite identification from `meta:generator`.Known ODF generator suites.
UNKNOWN
LIBREOFFICE
OPENOFFICE
CALLIGRA
GOOGLE_DOCS
MS_OFFICE
KOFFICE
ABIWORD
OTHER
structOdfGeneratorInfo
Result of generator suite detection.
Methods
Functions 11
fn
OdfVersion parseOdfVersion(string versionString) @safe pure nothrowParses a version string (e.g. `"1.2"`) into an `OdfVersion` enum.fn
string odfVersionString(OdfVersion ver) @safe pure nothrowConverts an `OdfVersion` to its string representation.fn
bool isSupportedVersion(OdfVersion ver) @safe pure nothrowReturns `true` if the given version is supported for reading and preservation. ODF 1.0 through 1.4 are all supported for safe reading and round-tripping.fn
bool isFullyTypedVersion(OdfVersion ver) @safe pure nothrowReturns `true` if the given version has full typed support.fn
OdfGeneratorInfo detectGenerator(string generator) @safe pure nothrowDetects the generator suite from a `meta:generator` string.fn
string generatorQuirks(OdfGeneratorSuite suite) @safe pure nothrowReturns known namespace quirks for a given generator suite.fn
string recommendedWriteVersion(
OdfCompatibilityTarget target,
OdfDocumentType docType) @safe pure nothrowChecks whether a given ODF version is appropriate for writing based on the compatibility target.fn
OdfCompatResult checkVersionCompatibility(string versionString,
string generator, OdfCompatibilityTarget target,
ref OdfDiagnosticCollector collector) @safe pureChecks an ODF document version against the compatibility target and reports findings through the diagnostic collector.