summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-03-02 16:41:04 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-03-03 17:18:21 +0100
commit902e23d6e95f86a6ffbc642e57e35dcd27a6e83b (patch)
tree0c3a20839949df1d748d3ebcda6afc476fcd4c6a /writerfilter
parent268bddd26cc006a7b4a1f9142245aecbff51c173 (diff)
tdf#146171 DOCX: fix loss of change tracking, if no date
was specified, or it was specified as zero date (e.g. in a LO DOCX export). DateTime attribute w:date is optional in w:ins/w:del according to the OOXML standard. Not specified w:date was imported as invalid zero date "0-00-00T00:00:00Z" resulting loss of change tracking data completely during an ODF roundtrip. Import this invalid zero date as Epoch time to avoid losing change tracking data. Change-Id: If8442db9aa5e41c470827545c36c64f598887101 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130885 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130907
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 13f1fb9056b9..8afcede51d13 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3144,7 +3144,16 @@ void DomainMapper_Impl::CreateRedline(uno::Reference<text::XTextRange> const& xR
pRedlineProperties[0].Name = getPropertyName( PROP_REDLINE_AUTHOR );
pRedlineProperties[0].Value <<= pRedline->m_sAuthor;
pRedlineProperties[1].Name = getPropertyName( PROP_REDLINE_DATE_TIME );
- pRedlineProperties[1].Value <<= ConversionHelper::ConvertDateStringToDateTime( pRedline->m_sDate );
+ util::DateTime aDateTime = ConversionHelper::ConvertDateStringToDateTime( pRedline->m_sDate );
+ // tdf#146171 import not specified w:date (or specified as zero date "0-00-00")
+ // as Epoch time to avoid of losing change tracking data during ODF roundtrip
+ if ( aDateTime.Year == 0 && aDateTime.Month == 0 && aDateTime.Day == 0 )
+ {
+ aDateTime.Year = 1970;
+ aDateTime.Month = 1;
+ aDateTime.Day = 1;
+ }
+ pRedlineProperties[1].Value <<= aDateTime;
pRedlineProperties[2].Name = getPropertyName( PROP_REDLINE_REVERT_PROPERTIES );
pRedlineProperties[2].Value <<= pRedline->m_aRevertProperties;
pRedlineProperties[3].Name = "RedlineMoved";