diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-04-22 16:18:10 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2021-01-07 16:32:51 +0100 |
commit | d6adb83a222c4536f6d3ba21918290c51e32e4aa (patch) | |
tree | 8eb50442a12b687a47fca891ae7daa3b0e70d2f3 /xmloff | |
parent | ecd472e4a5403df8e6d55aa2fec536af98042686 (diff) |
xmloff: GetEarliestODFVersionForExport(-1) is impossible
Remove defensive programming nonsense to deal with situation that has
apparently never been possible in git history.
Change-Id: I3788cdcec5e1b4afa27e294ed91825bb33e8e633
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92729
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Tested-by: Jenkins
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/xmlexppr.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/style/xmlprmap.cxx | 8 |
2 files changed, 5 insertions, 8 deletions
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index e18a0a9be6e9..f51e2c166e30 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -586,10 +586,9 @@ vector<XMLPropertyState> SvXMLExportPropertyMapper::Filter_( ( (0 != (nFlags & MID_FLAG_MUST_EXIST)) || xInfo->hasPropertyByName( rAPIName ) ) ) { - const std::optional<SvtSaveOptions::ODFSaneDefaultVersion> oEarliestODFVersionForExport( + const SvtSaveOptions::ODFSaneDefaultVersion nEarliestODFVersionForExport( mpImpl->mxPropMapper->GetEarliestODFVersionForExport(i)); - if (!oEarliestODFVersionForExport - || nCurrentVersion >= *oEarliestODFVersionForExport) + if (nEarliestODFVersionForExport <= nCurrentVersion) { pFilterInfo->AddProperty(rAPIName, i); } diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx index b71586b14a9c..16a69fc4ccbd 100644 --- a/xmloff/source/style/xmlprmap.cxx +++ b/xmloff/source/style/xmlprmap.cxx @@ -188,13 +188,11 @@ sal_Int16 XMLPropertySetMapper::GetEntryContextId( sal_Int32 nIndex ) const return nIndex == -1 ? 0 : mpImpl->maMapEntries[nIndex].nContextId; } -std::optional<SvtSaveOptions::ODFSaneDefaultVersion> +SvtSaveOptions::ODFSaneDefaultVersion XMLPropertySetMapper::GetEarliestODFVersionForExport(sal_Int32 const nIndex) const { - assert((-1 <= nIndex) && (nIndex < static_cast<sal_Int32>(mpImpl->maMapEntries.size()))); - return nIndex == -1 - ? std::optional<SvtSaveOptions::ODFSaneDefaultVersion>() - : std::optional<SvtSaveOptions::ODFSaneDefaultVersion>(mpImpl->maMapEntries[nIndex].nEarliestODFVersionForExport); + assert((0 <= nIndex) && (nIndex < static_cast<sal_Int32>(mpImpl->maMapEntries.size()))); + return mpImpl->maMapEntries[nIndex].nEarliestODFVersionForExport; } const XMLPropertyHandler* XMLPropertySetMapper::GetPropertyHandler( sal_Int32 nIndex ) const |