summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-05-10 15:58:45 +0200
committerJan Holesovsky <kendy@collabora.com>2017-05-10 17:46:46 +0200
commitbb0543f6de926a2d89797162a974bb01772d890d (patch)
tree8da6174a61d175ee9301fd094fb675bebdaa9057 /svtools
parent0425ccba5b2f8819d6fade05d96a72d64db1ce0c (diff)
tdf#107677 html import: Import ISO8601 datetime in html meta tags too.
Change-Id: I51073f5c9e433fb1d9dd2c62bcfea38b299aa010
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/svhtml/parhtml.cxx34
1 files changed, 23 insertions, 11 deletions
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index c35856b9ba88..0906aab472fa 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -27,6 +27,7 @@
#include <tools/tenccvt.hxx>
#include <tools/datetime.hxx>
+#include <unotools/datetime.hxx>
#include <svl/inettype.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
@@ -1962,18 +1963,29 @@ bool HTMLParser::ParseMetaOptionsImpl(
case HtmlMeta::Created:
case HtmlMeta::Changed:
- if ( i_xDocProps.is() && !aContent.isEmpty() &&
- comphelper::string::getTokenCount(aContent, ';') == 2 )
+ if (i_xDocProps.is() && !aContent.isEmpty())
{
- Date aDate( (sal_uLong)aContent.getToken(0, ';').toInt32() );
- tools::Time aTime( (sal_uLong)aContent.getToken(1, ';').toInt32() );
- DateTime aDateTime( aDate, aTime );
- ::util::DateTime uDT = aDateTime.GetUNODateTime();
- if ( HtmlMeta::Created==nAction )
- i_xDocProps->setCreationDate( uDT );
- else
- i_xDocProps->setModificationDate( uDT );
- bChanged = true;
+ ::util::DateTime uDT;
+ bool valid = false;
+ if (comphelper::string::getTokenCount(aContent, ';') == 2)
+ {
+ Date aDate((sal_uLong)aContent.getToken(0, ';').toInt32());
+ tools::Time aTime((sal_uLong)aContent.getToken(1, ';').toInt32());
+ DateTime aDateTime(aDate, aTime);
+ uDT = aDateTime.GetUNODateTime();
+ valid = true;
+ }
+ else if (utl::ISO8601parseDateTime(aContent, uDT))
+ valid = true;
+
+ if (valid)
+ {
+ bChanged = true;
+ if (HtmlMeta::Created == nAction)
+ i_xDocProps->setCreationDate(uDT);
+ else
+ i_xDocProps->setModificationDate(uDT);
+ }
}
break;