From cc407e50e8a1a74f9d1ed29d444dce9bd2e9167a Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 10 Dec 2013 15:14:00 +0100 Subject: sax, xmloff: fix ODF import/export of text:time/text:time-value The value written for an Impress time field is something like text:time-value="0000-00-00T23:28:07" (in LO 3.5+) or text:time-value="0-00-00T23:28:07" (in OOo 3.3) which contains an invalid all-zero date. Such values are actually rejected by the ODF import since commit ae3e2f170045a1525f67e9f3e9b7e03d94f2b56b. Actually there was no real support to read the RelaxNG type timeOrDateTime before. So fix that by: - adding convertTimeOrDateTime/parseTimeOrDateTime functions to sax::Converter - recognizing and ignoring the 2 invalid all-zero values written by LO 3.5 and historic OOo respectively - writing a bare "time" in text:time-value if the DateTime struct contains zero Date members (Older OOo versions and AOO cannot actually read that, but everything they _can_ read is invalid ODF...) Change-Id: I754076caee74a5163ed3f972af0f23796aa14f9f --- include/sax/tools/converter.hxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/sax/tools') diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx index 86671ce5bed2..77fc13852e3e 100644 --- a/include/sax/tools/converter.hxx +++ b/include/sax/tools/converter.hxx @@ -166,11 +166,21 @@ public: sal_Int16 const* pTimeZoneOffset, bool bAddTimeIf0AM = false ); + /** convert util::DateTime to ISO "time" or "dateTime" string */ + static void convertTimeOrDateTime(OUStringBuffer& rBuffer, + const com::sun::star::util::DateTime& rDateTime, + sal_Int16 const* pTimeZoneOffset); + /** convert ISO "date" or "dateTime" string to util::DateTime */ static bool parseDateTime( com::sun::star::util::DateTime& rDateTime, boost::optional * pTimeZoneOffset, const OUString& rString ); + /** convert ISO "time" or "dateTime" string to util::DateTime */ + static bool parseTimeOrDateTime(com::sun::star::util::DateTime& rDateTime, + boost::optional * pTimeZoneOffset, + const OUString& rString); + /** convert ISO "date" or "dateTime" string to util::DateTime or util::Date */ static bool parseDateOrDateTime( -- cgit