Type: info
Title: new css.util.Duration, and support in sax::Converter and
DocumentProperties
Posted by: [email protected]
Affected: [email protected], sax, offapi
TaskId: i97029
<http://www.openoffice.org/issues/show_bug.cgi?id=97029>
Effective from: CWS os137
CWS:
<http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=DEV300/os137>
CWS status: new
*Summary*
--------
+ struct com.sun.star.util.Duration
<sax/tools/converter.hxx>:
- sax::Converter::convertTime(...)
+ sax::Converter::convertDuration(...)
+ sax::Converter::convertDate(...)
+ sax::Converter::convertDateOrDateTime(...)
*Description*
-------------
in order to support the XMLSchema-2 "duration" type, it was necessary to
introduce a new struct com.sun.star.util.Duration:
struct Duration
{
boolean Negative;
unsigned short Years;
unsigned short Months;
unsigned short Days;
unsigned short Hours;
unsigned short Minutes;
unsigned short Seconds;
unsigned short HundredthSeconds;
};
sax::Converter:
the convertTime() functions have been replaced with convertDuration()
functions, and those using util::Duration have been re-implemented
to directly convert to/from strings, and not take the indirect
route of converting to double first, preventing rounding errors:
/** convert double to ISO "duration" string; negative durations
allowed */
static void convertDuration(::rtl::OUStringBuffer& rBuffer,
const double fTime);
/** convert util::Duration to ISO "duration" string */
static void convertDuration(::rtl::OUStringBuffer& rBuffer,
const ::com::sun::star::util::Duration&
rDuration);
/** convert ISO "duration" string to double; negative durations
allowed */
static bool convertDuration(double & rfTime,
const ::rtl::OUString& rString);
/** convert ISO "duration" string to util::Duration */
static bool convertDuration(::com::sun::star::util::Duration&
rDuration,
const ::rtl::OUString& rString);
further additions to sax::Converter:
/** convert util::Date to ISO "date" string */
static void convertDate( ::rtl::OUStringBuffer& rBuffer,
const com::sun::star::util::Date& rDate );
/** convert ISO "date" or "dateTime" string to util::DateTime or
util::Date */
static bool convertDateOrDateTime(
com::sun::star::util::Date & rDate,
com::sun::star::util::DateTime & rDateTime,
bool & rbDateTime,
const ::rtl::OUString & rString );
furthermore, the com.sun.star.document.DocumentProperties service now
supports storing user-defined properties of type util.Duration,
and will load and store such properties to/from ODF meta.xml.
Send feedback to [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]