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 --- include/sax/tools/converter.hxx | 22 ++++++++++++++++++---- include/sfx2/dinfdlg.hxx | 12 +++++++++--- 2 files changed, 27 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx index 615308c9e418..1e89d2cea057 100644 --- a/include/sax/tools/converter.hxx +++ b/include/sax/tools/converter.hxx @@ -22,6 +22,8 @@ #include "sax/saxdllapi.h" +#include + #include #include #include @@ -36,6 +38,8 @@ namespace com { namespace sun { namespace star { namespace util { struct Date; struct DateTime; + struct DateWithTimeZone; + struct DateTimeWithTimeZone; struct Duration; } } } } @@ -153,23 +157,33 @@ public: /** convert util::Date to ISO "date" string */ static void convertDate( OUStringBuffer& rBuffer, - const com::sun::star::util::Date& rDate ); + const com::sun::star::util::Date& rDate, + sal_Int16 const* pTimeZoneOffset); /** convert util::DateTime to ISO "date" or "dateTime" string */ static void convertDateTime( OUStringBuffer& rBuffer, const com::sun::star::util::DateTime& rDateTime, + sal_Int16 const* pTimeZoneOffset, bool bAddTimeIf0AM = false ); + static void convertDateTZ( OUStringBuffer& rBuffer, + com::sun::star::util::DateWithTimeZone const& rDate ); + + static void convertDateTimeTZ( OUStringBuffer& rBuffer, + com::sun::star::util::DateTimeWithTimeZone const& rDateTime ); + /** convert ISO "date" or "dateTime" string to util::DateTime */ - static bool convertDateTime( com::sun::star::util::DateTime& rDateTime, + static bool parseDateTime( 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 convertDateOrDateTime( - com::sun::star::util::Date & rDate, + static bool parseDateOrDateTime( + com::sun::star::util::Date * pDate, com::sun::star::util::DateTime & rDateTime, bool & rbDateTime, + boost::optional * pTimeZoneOffset, const OUString & rString ); /** gets the position of the first comma after npos in the string diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index c0758b56bc00..5752b2c4c09b 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -16,8 +16,10 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _SFX_DINFDLG_HXX -#define _SFX_DINFDLG_HXX +#ifndef SFX_DINFDLG_HXX +#define SFX_DINFDLG_HXX + +#include #include "sal/config.h" #include "sfx2/dllapi.h" @@ -285,6 +287,8 @@ private: CustomPropertyLine* m_pLine; public: + ::boost::optional m_TZ; + inline CustomPropertiesDateField( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) : DateField( pParent, rResId ), m_pLine( pLine ) {} @@ -297,9 +301,11 @@ private: CustomPropertyLine* m_pLine; public: + bool m_isUTC; + inline CustomPropertiesTimeField( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) : - TimeField( pParent, rResId ), m_pLine( pLine ) {} + TimeField( pParent, rResId ), m_pLine( pLine ), m_isUTC(false) {} inline CustomPropertyLine* GetLine() const { return m_pLine; } }; -- cgit