From 20cbf5bd3042ed547408f324e020a3d6405705f7 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 11 Jul 2013 17:27:06 +0200 Subject: i#108348: support DateTimeWithTimezone in user defined Document Properties - fix interface of sax::Converter to allow passing time zones (rename the parsing methods while at it to reduce pointless overloading) - SfxDocumentMetaData supports DateWithTimezone and DateTimeWithTimezone in user-defined properties - add some ugly hacks to SfxCustomPropertiesPage to preserve existing time zones (which are not displayed in UI currently) Change-Id: Ice94112b9d79c285f80b5beda15f0ace91db97f3 --- xmloff/source/chart/SchXMLCalculationSettingsContext.cxx | 2 +- xmloff/source/chart/SchXMLExport.cxx | 2 +- xmloff/source/core/DocumentSettingsContext.cxx | 2 +- xmloff/source/core/SettingsExportHelper.cxx | 2 +- xmloff/source/core/xmluconv.cxx | 2 +- xmloff/source/draw/sdxmlexp.cxx | 2 +- xmloff/source/draw/ximppage.cxx | 2 +- xmloff/source/forms/handler/vcl_date_handler.cxx | 4 ++-- xmloff/source/text/XMLChangedRegionImportContext.cxx | 2 +- xmloff/source/text/XMLRedlineExport.cxx | 4 ++-- xmloff/source/text/txtflde.cxx | 4 ++-- xmloff/source/text/txtfldi.cxx | 6 +++--- xmloff/source/xforms/SchemaRestrictionContext.cxx | 2 +- xmloff/source/xforms/xformsexport.cxx | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx index 33971e260969..b875aa727151 100644 --- a/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx +++ b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx @@ -53,7 +53,7 @@ SchXMLCalculationSettingsContext::SchXMLCalculationSettingsContext( SvXMLImport& { util::DateTime aNullDate; const OUString sValue = xAttrList->getValueByIndex( i ); - ::sax::Converter::convertDateTime(aNullDate, sValue); + ::sax::Converter::parseDateTime(aNullDate, 0, sValue); m_aNullDate <<= aNullDate; } } diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 5602ea6d62a4..f66f062dfe14 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -1212,7 +1212,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& SvXMLElementExport aSet( mrExport, XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS, sal_True, sal_True ); { OUStringBuffer sBuffer; - ::sax::Converter::convertDateTime(sBuffer, aNullDate); + ::sax::Converter::convertDateTime(sBuffer, aNullDate, 0); mrExport.AddAttribute( XML_NAMESPACE_TABLE,XML_DATE_VALUE,sBuffer.makeStringAndClear()); SvXMLElementExport aNull( mrExport, XML_NAMESPACE_TABLE, XML_NULL_DATE, sal_True, sal_True ); } diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index f0a40fe87e06..b741d51e796d 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -631,7 +631,7 @@ void XMLConfigItemContext::EndElement() else if (IsXMLToken(msType, XML_DATETIME)) { util::DateTime aDateTime; - ::sax::Converter::convertDateTime(aDateTime, msValue); + ::sax::Converter::parseDateTime(aDateTime, 0, msValue); mrAny <<= aDateTime; } else if (IsXMLToken(msType, XML_BASE64BINARY)) diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx index 1f0fbf0a1045..a2ff42abfe07 100644 --- a/xmloff/source/core/SettingsExportHelper.cxx +++ b/xmloff/source/core/SettingsExportHelper.cxx @@ -267,7 +267,7 @@ void XMLSettingsExportHelper::exportDateTime(const util::DateTime& aValue, const m_rContext.AddAttribute( XML_NAME, rName ); m_rContext.AddAttribute( XML_TYPE, XML_DATETIME ); OUStringBuffer sBuffer; - ::sax::Converter::convertDateTime(sBuffer, aValue); + ::sax::Converter::convertDateTime(sBuffer, aValue, 0); m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); m_rContext.Characters( sBuffer.makeStringAndClear() ); m_rContext.EndElement( sal_False ); diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx index 0026161f3f12..efa5ba6b047e 100644 --- a/xmloff/source/core/xmluconv.cxx +++ b/xmloff/source/core/xmluconv.cxx @@ -428,7 +428,7 @@ sal_Bool SvXMLUnitConverter::convertDateTime( double& fDateTime, const OUString& rString, const com::sun::star::util::Date& aTempNullDate) { com::sun::star::util::DateTime aDateTime; - sal_Bool bSuccess = ::sax::Converter::convertDateTime(aDateTime, rString); + bool bSuccess = ::sax::Converter::parseDateTime(aDateTime, 0, rString); if (bSuccess) { diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index e2b9c29c77b8..34beb140cd4b 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -2773,7 +2773,7 @@ void SdXMLExport::exportAnnotations( const Reference& xDrawPage ) { // date time com::sun::star::util::DateTime aDate( xAnnotation->getDateTime() ); - ::sax::Converter::convertDateTime(sStringBuffer, aDate, true); + ::sax::Converter::convertDateTime(sStringBuffer, aDate, 0, true); SvXMLElementExport aDateElem( *this, XML_NAMESPACE_DC, XML_DATE, sal_True, sal_False ); Characters(sStringBuffer.makeStringAndClear()); } diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index 3c42b2d0a48a..f56af25022c0 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -192,7 +192,7 @@ void DrawAnnotationContext::EndElement() mxAnnotation->setAuthor( maAuthorBuffer.makeStringAndClear() ); util::DateTime aDateTime; - if (::sax::Converter::convertDateTime(aDateTime, + if (::sax::Converter::parseDateTime(aDateTime, 0, maDateBuffer.makeStringAndClear())) { mxAnnotation->setDateTime(aDateTime); diff --git a/xmloff/source/forms/handler/vcl_date_handler.cxx b/xmloff/source/forms/handler/vcl_date_handler.cxx index b306a65ce04b..a1ac74ec265b 100644 --- a/xmloff/source/forms/handler/vcl_date_handler.cxx +++ b/xmloff/source/forms/handler/vcl_date_handler.cxx @@ -66,7 +66,7 @@ namespace xmloff aDateTime.Year = aVCLDate.GetYear(); OUStringBuffer aBuffer; - ::sax::Converter::convertDateTime( aBuffer, aDateTime, false ); + ::sax::Converter::convertDateTime( aBuffer, aDateTime, 0, false ); return aBuffer.makeStringAndClear(); } @@ -76,7 +76,7 @@ namespace xmloff sal_Int32 nVCLDate(0); DateTime aDateTime; - if (::sax::Converter::convertDateTime( aDateTime, i_attributeValue )) + if (::sax::Converter::parseDateTime( aDateTime, 0, i_attributeValue )) { ::Date aVCLDate( aDateTime.Day, aDateTime.Month, aDateTime.Year ); nVCLDate = aVCLDate.GetDate(); diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx b/xmloff/source/text/XMLChangedRegionImportContext.cxx index bb4e45167098..541554a45a12 100644 --- a/xmloff/source/text/XMLChangedRegionImportContext.cxx +++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx @@ -162,7 +162,7 @@ void XMLChangedRegionImportContext::SetChangeInfo( const OUString& rDate) { util::DateTime aDateTime; - if (::sax::Converter::convertDateTime(aDateTime, rDate)) + if (::sax::Converter::parseDateTime(aDateTime, 0, rDate)) { GetImport().GetTextImport()->RedlineAdd( rType, sID, rAuthor, rComment, aDateTime, bMergeLastPara); diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx index 6cc8f2d74c36..7508dcc4eee2 100644 --- a/xmloff/source/text/XMLRedlineExport.cxx +++ b/xmloff/source/text/XMLRedlineExport.cxx @@ -484,7 +484,7 @@ void XMLRedlineExport::ExportChangeInfo( aAny >>= aDateTime; { OUStringBuffer sBuf; - ::sax::Converter::convertDateTime(sBuf, aDateTime); + ::sax::Converter::convertDateTime(sBuf, aDateTime, 0); SvXMLElementExport aDateElem( rExport, XML_NAMESPACE_DC, XML_DATE, sal_True, sal_False ); @@ -525,7 +525,7 @@ void XMLRedlineExport::ExportChangeInfo( util::DateTime aDateTime; rVal.Value >>= aDateTime; OUStringBuffer sBuf; - ::sax::Converter::convertDateTime(sBuf, aDateTime); + ::sax::Converter::convertDateTime(sBuf, aDateTime, 0); rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_CHG_DATE_TIME, sBuf.makeStringAndClear()); } diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index b034cba289c1..2adbfafc9953 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -1745,7 +1745,7 @@ void XMLTextFieldExport::ExportFieldHelper( util::DateTime aDate( GetDateTimeProperty(sPropertyDateTimeValue, rPropSet) ); { OUStringBuffer aBuffer; - ::sax::Converter::convertDateTime(aBuffer, aDate, true); + ::sax::Converter::convertDateTime(aBuffer, aDate, 0, true); SvXMLElementExport aDateElem( GetExport(), XML_NAMESPACE_DC, XML_DATE, sal_True, sal_False ); @@ -2652,7 +2652,7 @@ void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName, } // date/time value - ::sax::Converter::convertDateTime(aBuffer, aDateTime); + ::sax::Converter::convertDateTime(aBuffer, aDateTime, 0); // output attribute ProcessString(eName, aBuffer.makeStringAndClear(), sal_True, nPrefix); diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index c4af925d8143..d793ab66d8e7 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -1114,7 +1114,7 @@ void XMLTimeFieldImportContext::ProcessAttribute( bTimeOK = sal_True; } - if (::sax::Converter::convertDateTime(aDateTimeValue, sAttrValue)) + if (::sax::Converter::parseDateTime(aDateTimeValue, 0, sAttrValue)) { bTimeOK = sal_True; } @@ -1255,7 +1255,7 @@ void XMLDateFieldImportContext::ProcessAttribute( bTimeOK = sal_True; } - if (::sax::Converter::convertDateTime(aDateTimeValue, sAttrValue)) + if (::sax::Converter::parseDateTime(aDateTimeValue, 0, sAttrValue)) { bTimeOK = sal_True; } @@ -3820,7 +3820,7 @@ void XMLAnnotationImportContext::PrepareField( xPropertySet->setPropertyValue(sPropertyInitials, makeAny(sInitials)); util::DateTime aDateTime; - if (::sax::Converter::convertDateTime(aDateTime, + if (::sax::Converter::parseDateTime(aDateTime, 0, aDateBuffer.makeStringAndClear())) { /* diff --git a/xmloff/source/xforms/SchemaRestrictionContext.cxx b/xmloff/source/xforms/SchemaRestrictionContext.cxx index 34b64ae12fcb..ad3b9a4c228c 100644 --- a/xmloff/source/xforms/SchemaRestrictionContext.cxx +++ b/xmloff/source/xforms/SchemaRestrictionContext.cxx @@ -201,7 +201,7 @@ Any xforms_date( const OUString& rValue ) Any xforms_dateTime( const OUString& rValue ) { util::DateTime aDateTime; - bool const bSuccess = ::sax::Converter::convertDateTime(aDateTime, rValue); + bool const bSuccess = ::sax::Converter::parseDateTime(aDateTime, 0, rValue); return bSuccess ? makeAny( aDateTime ) : Any(); } diff --git a/xmloff/source/xforms/xformsexport.cxx b/xmloff/source/xforms/xformsexport.cxx index 9f8ccabe5c77..424baf490933 100644 --- a/xmloff/source/xforms/xformsexport.cxx +++ b/xmloff/source/xforms/xformsexport.cxx @@ -693,7 +693,7 @@ void xforms_formatTime( OUStringBuffer& aBuffer, const com::sun::star::util::Tim void xforms_formatDateTime( OUStringBuffer& aBuffer, const util::DateTime& aDateTime ) { - ::sax::Converter::convertDateTime( aBuffer, aDateTime ); + ::sax::Converter::convertDateTime(aBuffer, aDateTime, 0); } OUString xforms_whitespace( const Any& rAny ) -- cgit