dev/null                                        |binary
 include/tools/datetimeutils.hxx                 |    6 +
 include/unotools/datetime.hxx                   |    3 
 svx/source/items/numfmtsh.cxx                   |    2 
 sw/qa/extras/ooxmlexport/data/date-control.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx        |   26 +++++---
 sw/source/filter/ww8/docxattributeoutput.cxx    |   52 ++++++++++++++++
 tools/source/datetime/datetimeutils.cxx         |   20 ++++++
 unotools/source/misc/datetime.cxx               |   75 +++++++++++++++++++++---
 writerfilter/source/dmapper/DomainMapper.cxx    |    3 
 writerfilter/source/dmapper/SdtHelper.cxx       |   23 ++++++-
 writerfilter/source/dmapper/SdtHelper.hxx       |    5 +
 writerfilter/source/ooxml/model.xml             |    1 
 13 files changed, 192 insertions(+), 24 deletions(-)

New commits:
commit ec1b9bfd9b444fcd3a3559ce1281b08afce19362
Author: Jacobo Aragunde Pérez <jaragu...@igalia.com>
Date:   Fri Mar 7 20:01:38 2014 +0100

    ooxml: fix export of empty date controls
    
    The text contained in the <sdtContent> tag acts both as a help message
    to the user and as the actual data; for example, Word 2010 is able to
    set the date of the control from the text in the content if the
    w:fullDate attribute in <date> tag is not set. For that reason we
    should not use the sdtContent as the "HelpText" property of the
    control in any case, only when it is empty.
    
    The name of the parameter rDefaultText was modified to reflect that
    string does not represent any default text, only the content of the
    <sdtContent> tag.
    
    Change-Id: Ic10334a949969ec8c7c3e25f73fb937a50ee0f7f
    TODO: is it worth to internationalize the help text?

diff --git a/writerfilter/source/dmapper/SdtHelper.cxx 
b/writerfilter/source/dmapper/SdtHelper.cxx
index 1e1aa4c..ababd53 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -91,11 +91,11 @@ void SdtHelper::createDropDownControl()
     m_aDropDownItems.clear();
 }
 
-void SdtHelper::createDateControl(OUString& rDefaultText)
+void SdtHelper::createDateControl(OUString& rContentText)
 {
     uno::Reference<awt::XControlModel> 
xControlModel(m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.form.component.DateField"),
 uno::UNO_QUERY);
     uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, 
uno::UNO_QUERY);
-    xPropertySet->setPropertyValue("HelpText", uno::makeAny(rDefaultText));
+
     xPropertySet->setPropertyValue("Dropdown", uno::makeAny(sal_True));
     xPropertySet->setPropertyValue("DateFormat", uno::makeAny(*m_oDateFormat));
     m_oDateFormat.reset();
@@ -106,10 +106,13 @@ void SdtHelper::createDateControl(OUString& rDefaultText)
     {
         utl::extractDate(aDateTime, aDate);
         xPropertySet->setPropertyValue("Date", uno::makeAny(aDate));
+        xPropertySet->setPropertyValue("HelpText", 
uno::makeAny(OUString("Click here to enter a date")));
     }
+    else
+        xPropertySet->setPropertyValue("HelpText", uno::makeAny(rContentText));
 
     std::vector<OUString> aItems;
-    createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), 
rDefaultText, aItems), xControlModel);
+    createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), 
rContentText, aItems), xControlModel);
 }
 
 void SdtHelper::createControlShape(awt::Size aSize, 
uno::Reference<awt::XControlModel> xControlModel)
diff --git a/writerfilter/source/dmapper/SdtHelper.hxx 
b/writerfilter/source/dmapper/SdtHelper.hxx
index f58f008..65a736b 100644
--- a/writerfilter/source/dmapper/SdtHelper.hxx
+++ b/writerfilter/source/dmapper/SdtHelper.hxx
@@ -74,7 +74,7 @@ public:
     /// Create drop-down control from w:sdt's w:dropDownList.
     void createDropDownControl();
     /// Create date control from w:sdt's w:date.
-    void createDateControl(OUString& rDefaultText);
+    void createDateControl(OUString& rContentText);
 };
 
 } // namespace dmapper
commit b2385830711ec700956869ace7670edd845a50df
Author: Jacobo Aragunde Pérez <jaragu...@igalia.com>
Date:   Fri Mar 7 18:04:09 2014 +0100

    ooxml: export date controls properly
    
    Export date controls as ooxml Standard Document Tags (SDT) instead
    of replacing them with plain text.
    
    SDT date controls contain the date in ISO format as an attribute of
    <date> tag, a custom date format that can be specified by the user
    in the <dateFormat> tag and the date formatted in that custom format
    in the <w:sdtContent> tag.
    
    The unit test testFormControl from ooxmlexport suite was removed,
    it only checked if the date control was exported as text and it
    obviously fails now. A new test that checks the values of the
    exported control was written instead.
    
    A pair of date format functions were added to datetimeutils.hxx.
    
    TODO: to avoid supporting all the posible custom formats that can be
    specified in the <dateFormat> tag, it is forced to dd/mm/yyyy on
    export.
    
    Change-Id: I9d1b6f840ee9e133831fdb04ad399fe31bcb2063

diff --git a/include/tools/datetimeutils.hxx b/include/tools/datetimeutils.hxx
index 840403b..28766ee 100644
--- a/include/tools/datetimeutils.hxx
+++ b/include/tools/datetimeutils.hxx
@@ -15,6 +15,12 @@
 // This function converts a 'DateTime' object to an 'OString' object
 TOOLS_DLLPUBLIC OString DateTimeToOString( const DateTime& rDateTime );
 
+// This function converts a 'Date' object to an 'OString' object in ISO-8601 
representation
+TOOLS_DLLPUBLIC OString DateToOString( const Date& rDate );
+
+// This function converts a 'Date' object to an 'OString' object in DD/MM/YYYY 
format
+TOOLS_DLLPUBLIC OString DateToDDMMYYYYOString( const Date& rDate );
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/data/date-control.docx 
b/sw/qa/extras/ooxmlexport/data/date-control.docx
new file mode 100644
index 0000000..0563d56
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/date-control.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/data/form-control.docx 
b/sw/qa/extras/ooxmlexport/data/form-control.docx
deleted file mode 100755
index 4f6305a..0000000
Binary files a/sw/qa/extras/ooxmlexport/data/form-control.docx and /dev/null 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index f9fda5f..b870866 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -15,6 +15,7 @@
 #include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/drawing/LineJoint.hpp>
 #include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
 #include <com/sun/star/awt/Gradient.hpp>
 #include <com/sun/star/style/TabStop.hpp>
 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
@@ -2046,14 +2047,6 @@ DECLARE_OOXMLEXPORT_TEST(testAutofit, "autofit.docx")
     CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), 
"FrameIsAutomaticHeight")));
 }
 
-DECLARE_OOXMLEXPORT_TEST(testFormControl, "form-control.docx")
-{
-    if (!m_bExported)
-        return;
-    // "[Date]" was missing.
-    getParagraph(1, "Foo [Date] bar.");
-}
-
 DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, 
"testTrackChangesDeletedParagraphMark.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
@@ -2963,6 +2956,23 @@ DECLARE_OOXMLEXPORT_TEST(testGenericTextField, 
"Unsupportedtextfields.docx")
     CPPUNIT_ASSERT(contents.match("PRINTDATE   \\* MERGEFORMAT"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testDateControl, "date-control.docx")
+{
+    // check XML
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date", 
"fullDate", "2014-03-05T00:00:00Z");
+    assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", "05/03/2014");
+
+    // check imported control
+    uno::Reference<drawing::XControlShape> xControl(getShape(1), 
uno::UNO_QUERY);
+    util::Date aDate = getProperty<util::Date>(xControl->getControl(), "Date");
+    CPPUNIT_ASSERT_EQUAL(5,     sal_Int32(aDate.Day));
+    CPPUNIT_ASSERT_EQUAL(3,     sal_Int32(aDate.Month));
+    CPPUNIT_ASSERT_EQUAL(2014,  sal_Int32(aDate.Year));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 980f4fb..2949271 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3597,11 +3597,59 @@ void 
DocxAttributeOutput::WritePostponedFormControl(const SdrObject* pObject)
             uno::Reference<lang::XServiceInfo> xInfo(xControlModel, 
uno::UNO_QUERY);
             if 
(xInfo->supportsService("com.sun.star.form.component.DateField"))
             {
+                // gather component properties
+
                 uno::Reference<beans::XPropertySet> 
xPropertySet(xControlModel, uno::UNO_QUERY);
-                OUString aHelpText = 
xPropertySet->getPropertyValue("HelpText").get<OUString>();
+
+                OString sDate;
+                OUString aContentText;
+                bool bHasDate = false;
+                css::util::Date aUNODate;
+                if (xPropertySet->getPropertyValue("Date") >>= aUNODate)
+                {
+                    bHasDate = true;
+                    Date aDate(aUNODate.Day, aUNODate.Month, aUNODate.Year);
+                    sDate = DateToOString(aDate);
+                    aContentText = 
OUString::createFromAscii(DateToDDMMYYYYOString(aDate).getStr());
+                }
+                else
+                    aContentText = 
xPropertySet->getPropertyValue("HelpText").get<OUString>();
+
+                // output component
+
+                m_pSerializer->startElementNS(XML_w, XML_sdt, FSEND);
+                m_pSerializer->startElementNS(XML_w, XML_sdtPr, FSEND);
+
+                if (bHasDate)
+                    m_pSerializer->startElementNS(XML_w, XML_date,
+                                                  FSNS( XML_w, XML_fullDate ), 
sDate.getStr(),
+                                                  FSEND);
+                else
+                    m_pSerializer->startElementNS(XML_w, XML_date, FSEND);
+
+                m_pSerializer->singleElementNS(XML_w, XML_dateFormat,
+                                               FSNS(XML_w, XML_val), 
"dd/MM/yyyy", //TODO: hardwired
+                                               FSEND);
+                m_pSerializer->singleElementNS(XML_w, XML_lid,
+                                               FSNS(XML_w, XML_val), "en-US",  
    //TODO: hardwired
+                                               FSEND);
+                m_pSerializer->singleElementNS(XML_w, XML_storeMappedDataAs,
+                                               FSNS(XML_w, XML_val), 
"dateTime",
+                                               FSEND);
+                m_pSerializer->singleElementNS(XML_w, XML_calendar,
+                                               FSNS(XML_w, XML_val), 
"gregorian",
+                                               FSEND);
+
+                m_pSerializer->endElementNS(XML_w, XML_date);
+                m_pSerializer->endElementNS(XML_w, XML_sdtPr);
+
+                m_pSerializer->startElementNS(XML_w, XML_sdtContent, FSEND);
                 m_pSerializer->startElementNS(XML_w, XML_r, FSEND);
-                RunText(aHelpText);
+                RunText(aContentText);
                 m_pSerializer->endElementNS(XML_w, XML_r);
+                m_pSerializer->endElementNS(XML_w, XML_sdtContent);
+
+                m_pSerializer->endElementNS(XML_w, XML_sdt);
             }
         }
     }
diff --git a/tools/source/datetime/datetimeutils.cxx 
b/tools/source/datetime/datetimeutils.cxx
index 512ae82..417271c 100644
--- a/tools/source/datetime/datetimeutils.cxx
+++ b/tools/source/datetime/datetimeutils.cxx
@@ -54,3 +54,23 @@ OString DateTimeToOString( const DateTime& rDateTime )
 
     return aBuffer.makeStringAndClear();
 }
+
+OString DateToOString( const Date& rDate )
+{
+    Time aTime( Time::EMPTY );
+    return DateTimeToOString( DateTime( rDate, aTime ) );
+}
+
+OString DateToDDMMYYYYOString( const Date& rDate )
+{
+    OStringBuffer aBuffer( 25 );
+    lcl_AppendTwoDigits( aBuffer, rDate.GetDay() );
+    aBuffer.append( '/' );
+
+    lcl_AppendTwoDigits( aBuffer, rDate.GetMonth() );
+    aBuffer.append( '/' );
+
+    aBuffer.append( sal_Int32( rDate.GetYear() ) );
+
+    return aBuffer.makeStringAndClear();
+}
commit 4dcad28a5e2415c81d018bf38b4e8ed10f42da79
Author: Jacobo Aragunde Pérez <jaragu...@igalia.com>
Date:   Fri Mar 7 13:20:55 2014 +0100

    writerfilter: import date into docx date controls
    
    Date controls specified by <sdt> tags in docx documents were being
    imported but the date was being discarded.
    
    To import the date, we added an attribute to the CT_SdtDate resource
    in the ooxml model file to be able to read the date ISO definition
    contained by the fullDate attribute. We store it in the SdtHelper
    class and we transform it in a Date when the control is created.
    
    Change-Id: Iac2d4f99c31188848c109fafb54121bfcdde060d

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index f414f7c..c7e6344 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -878,6 +878,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
         case NS_ooxml::LN_CT_SdtListItem_value:
             m_pImpl->m_pSdtHelper->getDropDownItems().push_back(sStringValue);
         break;
+        case NS_ooxml::LN_CT_SdtDate_fullDate:
+            m_pImpl->m_pSdtHelper->getDate().append(sStringValue);
+        break;
         case NS_ooxml::LN_CT_Background_color:
             m_pImpl->m_oBackgroundColor.reset(nIntValue);
         break;
diff --git a/writerfilter/source/dmapper/SdtHelper.cxx 
b/writerfilter/source/dmapper/SdtHelper.cxx
index 5f84ba8..1e1aa4c 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -14,6 +14,7 @@
 
 #include <vcl/outdev.hxx>
 #include <vcl/svapp.hxx>
+#include <unotools/datetime.hxx>
 
 #include <DomainMapper_Impl.hxx>
 #include <StyleSheetTable.hxx>
@@ -99,6 +100,14 @@ void SdtHelper::createDateControl(OUString& rDefaultText)
     xPropertySet->setPropertyValue("DateFormat", uno::makeAny(*m_oDateFormat));
     m_oDateFormat.reset();
 
+    util::Date aDate;
+    util::DateTime aDateTime;
+    if(utl::ISO8601parseDateTime(m_sDate.makeStringAndClear(), aDateTime))
+    {
+        utl::extractDate(aDateTime, aDate);
+        xPropertySet->setPropertyValue("Date", uno::makeAny(aDate));
+    }
+
     std::vector<OUString> aItems;
     createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), 
rDefaultText, aItems), xControlModel);
 }
@@ -127,6 +136,11 @@ OUStringBuffer& SdtHelper::getSdtTexts()
     return m_aSdtTexts;
 }
 
+OUStringBuffer& SdtHelper::getDate()
+{
+    return m_sDate;
+}
+
 boost::optional<sal_Int16>& SdtHelper::getDateFormat()
 {
     return m_oDateFormat;
diff --git a/writerfilter/source/dmapper/SdtHelper.hxx 
b/writerfilter/source/dmapper/SdtHelper.hxx
index 96f44bb..f58f008 100644
--- a/writerfilter/source/dmapper/SdtHelper.hxx
+++ b/writerfilter/source/dmapper/SdtHelper.hxx
@@ -51,6 +51,8 @@ class SdtHelper
     std::vector<OUString> m_aDropDownItems;
     /// Pieces of the default text -- currently used only by the dropdown 
control.
     OUStringBuffer m_aSdtTexts;
+    /// Date ISO string contained in the w:date element, used by the date 
control.
+    OUStringBuffer m_sDate;
     /// Date format, see com/sun/star/awt/UnoControlDateFieldModel.idl
     boost::optional<sal_Int16> m_oDateFormat;
 
@@ -64,6 +66,7 @@ public:
 
     std::vector<OUString>& getDropDownItems();
     OUStringBuffer& getSdtTexts();
+    OUStringBuffer& getDate();
     boost::optional<sal_Int16>& getDateFormat();
     /// If createControlShape() was ever called.
     bool hasElements();
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 2933d54..34eb59d 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -24563,6 +24563,7 @@
       <element name="listItem" tokenid="ooxml:CT_SdtDropDownList_listItem"/>
     </resource>
     <resource name="CT_SdtDate" resource="Properties" tag="field">
+      <attribute name="fullDate" tokenid="ooxml:CT_SdtDate_fullDate"/>
       <element name="dateFormat" tokenid="ooxml:CT_SdtDate_dateFormat"/>
     </resource>
     <resource name="CT_SdtListItem" resource="Properties" tag="field">
commit 09c3b8ab70b115aaea8fe68557da2cc5edde4181
Author: Jacobo Aragunde Pérez <jaragu...@igalia.com>
Date:   Fri Mar 7 13:19:22 2014 +0100

    unotools: extractDate and extractTime functions
    
    Added a pair of functions to split a UNO DateTime object into the
    corresponding Date and Time objects.
    
    Change-Id: I6bf31d83b3843a9482d6bf538a5dd7130c2c7046

diff --git a/include/unotools/datetime.hxx b/include/unotools/datetime.hxx
index 3887df2..7611299 100644
--- a/include/unotools/datetime.hxx
+++ b/include/unotools/datetime.hxx
@@ -44,6 +44,9 @@ namespace utl
     UNOTOOLS_DLLPUBLIC void typeConvert(const DateTime& _rDateTime, 
starutil::DateTime& _rOut);
     UNOTOOLS_DLLPUBLIC void typeConvert(const starutil::DateTime& _rDateTime, 
DateTime& _rOut);
 
+    UNOTOOLS_DLLPUBLIC void extractDate(const starutil::DateTime& _rDateTime, 
starutil::Date& _rOut);
+    UNOTOOLS_DLLPUBLIC void extractTime(const starutil::DateTime& _rDateTime, 
starutil::Time& _rOut);
+
     UNOTOOLS_DLLPUBLIC ::rtl::OUString toISO8601(const starutil::DateTime& 
_rDateTime);
     UNOTOOLS_DLLPUBLIC bool            ISO8601parseDateTime(const 
::rtl::OUString &i_rIn, starutil::DateTime& o_rDateTime);
     UNOTOOLS_DLLPUBLIC bool            ISO8601parseDate(const ::rtl::OUString 
&i_rIn, starutil::Date& o_rDate);
diff --git a/unotools/source/misc/datetime.cxx 
b/unotools/source/misc/datetime.cxx
index 0682094..96de510 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -215,6 +215,23 @@ void typeConvert(const starutil::DateTime& _rDateTime, 
DateTime& _rOut)
 }
 
 
+void extractDate(const starutil::DateTime& _rDateTime, starutil::Date& _rOut)
+{
+    _rOut.Day = _rDateTime.Day;
+    _rOut.Month = _rDateTime.Month;
+    _rOut.Year = _rDateTime.Year;
+}
+
+
+void extractTime(const starutil::DateTime& _rDateTime, starutil::Time& _rOut)
+{
+    _rOut.Hours = _rDateTime.Hours;
+    _rOut.Minutes =  _rDateTime.Minutes;
+    _rOut.Seconds = _rDateTime.Seconds;
+    _rOut.NanoSeconds = _rDateTime.NanoSeconds;
+}
+
+
 OUString toISO8601(const starutil::DateTime& rDateTime)
 {
     OUStringBuffer rBuffer;
commit 066dcba00659d2f81e4ba67edd14c44ed9ec3ea2
Author: Jacobo Aragunde Pérez <jaragu...@igalia.com>
Date:   Fri Mar 7 13:01:09 2014 +0100

    unotools: improve date parser to support timezones
    
    ISO8601 defines timezones with formats like 'Z', '+01', '-08:30' or
    '+0830' at the end of the datetime string, but our parser was failing
    when the string contained any timezone information.
    
    I have modified the parser so it doesn't fail in case of the string
    contains a timezone. Moreover, I check that the timezone definition is
    correct according to the standard [1] and I extract it to the string
    tokTz.
    
    Unfortunately UNO Time class doesn't contain any field to store the
    timezone, only the boolean field IsUTC, which I fill accordingly.
    
    TODO: add a timezone field to UNO and fill it from the parser.
    
    [1] https://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators
    
    Change-Id: I9d33b19efbc6d41a74b02ece2dfa12fa12fac5eb

diff --git a/unotools/source/misc/datetime.cxx 
b/unotools/source/misc/datetime.cxx
index bd89bde..0682094 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -108,6 +108,11 @@ namespace
             for (; nPos < i_str.getLength(); ++nPos)
             {
                 const sal_Unicode c = i_str[nPos];
+                if (c == 'Z' || c == '+' || c == '-')
+                {
+                    --nPos; // we don't want to skip the tz separator
+                    return true;
+                }
                 if (c == sep)
                     // fractional part allowed only in *last* token
                     return false;
@@ -118,6 +123,11 @@ namespace
             OSL_ENSURE(nPos == i_str.getLength(), "impl_getISO8601TimeToken 
internal error; expected to be at end of string");
             return true;
         }
+        if (i_str[nPos] == 'Z' || i_str[nPos] == '+' || i_str[nPos] == '-')
+        {
+            --nPos; // we don't want to skip the tz separator
+            return true;
+        }
         else
             return false;
     }
@@ -138,6 +148,33 @@ namespace
             return true;
         }
     }
+    inline bool getISO8601TimeZoneToken(const OUString &i_str, sal_Int32 
&io_index, OUString &o_strInt)
+    {
+        const sal_Unicode c0 = '0';
+        const sal_Unicode c9 = '9';
+        const sal_Unicode sep = ':';
+        if (i_str[io_index] == 'Z') // UTC timezone indicator
+        {
+            ++io_index;
+            o_strInt = "Z";
+            return true;
+        }
+        else if (i_str[io_index] == '+' || i_str[io_index] == '-') // other 
timezones indicator
+        {
+            ++io_index;
+            o_strInt = "";
+            for (; io_index < i_str.getLength(); ++io_index)
+            {
+                const sal_Unicode c = i_str[io_index];
+                if ((c < c0 || c > c9) && c != sep)
+                    return false;
+                o_strInt += OUString(c);
+            }
+            return true;
+        }
+        else
+            return false;
+    }
 }
 
 
@@ -313,14 +350,15 @@ bool ISO8601parseTime(const OUString &aTimeStr, 
starutil::Time& rTime)
     sal_Int32 n = 0;
     OUString tokInt;
     OUString tokFrac;
+    OUString tokTz;
     bool bFrac = false;
     // hours
     if (bSuccess && (bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, 
bFrac, tokFrac)))
     {
         if ( bFrac && n < aTimeStr.getLength())
-            // junk after ISO time
-            bSuccess = false;
-        else if ( (bSuccess = convertNumber<sal_Int32>( nHour, tokInt, 0, 23 
)) )
+            // is it junk or the timezone?
+            bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz);
+        if (bSuccess && (bSuccess = convertNumber<sal_Int32>( nHour, tokInt, 
0, 23 )) )
         {
             if (bFrac)
             {
@@ -354,9 +392,9 @@ bool ISO8601parseTime(const OUString &aTimeStr, 
starutil::Time& rTime)
     if (bSuccess && (bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, 
bFrac, tokFrac)))
     {
         if ( bFrac && n < aTimeStr.getLength())
-            // junk after ISO time
-            bSuccess = false;
-        else if ( (bSuccess = convertNumber<sal_Int32>( nMin, tokInt, 0, 59 )) 
)
+            // is it junk or the timezone?
+            bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz);
+        if (bSuccess && (bSuccess = convertNumber<sal_Int32>( nMin, tokInt, 0, 
59 )) )
         {
             if (bFrac)
             {
@@ -384,10 +422,10 @@ bool ISO8601parseTime(const OUString &aTimeStr, 
starutil::Time& rTime)
     if (bSuccess && (bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, 
bFrac, tokFrac)))
     {
         if (n < aTimeStr.getLength())
-            // junk after ISO time
-            bSuccess = false;
+            // is it junk or the timezone?
+            bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz);
         // max 60 for leap seconds
-        else if ( (bSuccess = convertNumber<sal_Int32>( nSec, tokInt, 0, 60 )) 
)
+        if (bSuccess && (bSuccess = convertNumber<sal_Int32>( nSec, tokInt, 0, 
60 )) )
         {
             if (bFrac)
             {
@@ -425,6 +463,8 @@ bool ISO8601parseTime(const OUString &aTimeStr, 
starutil::Time& rTime)
             nMin = 0;
             ++nHour;
         }
+        if(!tokTz.isEmpty())
+            rTime.IsUTC = (tokTz == "Z");
 
         rTime.Hours = (sal_uInt16)nHour;
         rTime.Minutes = (sal_uInt16)nMin;
commit 3ce5fecea7d1dc3350db15c54bce584b83038e5f
Author: Jacobo Aragunde Pérez <jaragu...@igalia.com>
Date:   Thu Mar 6 17:19:01 2014 +0100

    Translate German string
    
    Change-Id: Ib936712a8dd49a7130057aebf0ba529e65eb2c66

diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index 74e2d28..6e7e7f0 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -703,7 +703,7 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( 
std::vector<OUString>& r
 {
     sal_uInt16  nMyType;
 
-    DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
+    DBG_ASSERT( pCurFmtTable != NULL, "Unknown number format!" );
 
     const SvNumberformat*   pNumEntry   = pCurFmtTable->empty() ? 0 : 
pCurFmtTable->begin()->second;
     sal_uInt32          nNFEntry;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to