forms/source/xforms/xpathlib/xpathlib.cxx | 7 +++++-- sw/source/core/fields/docufld.cxx | 7 +++++-- sw/source/core/fields/flddat.cxx | 10 ++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-)
New commits: commit 2295c2b17cd7b4648f7d0842929be18125c0edab Author: Michael Stahl <mst...@redhat.com> AuthorDate: Wed Apr 27 15:12:00 2016 +0200 Commit: Gabor Kelemen <kelem...@ubuntu.com> CommitDate: Mon Jul 24 18:56:40 2023 +0200 sw, forms: some hacks to nerf time-fields so convwatch works better This is useful for PDF-based layout-comparison regression testing where date/time fields were updated upon PDF export and create lots of false positives. Hopefully these can be eliminated this way, at least from text documents. To test: Download https://bugs.documentfoundation.org/attachment.cgi?id=48452 from tdf#38703 and export it with: STABLE_FIELDS_HACK=1 instdir/program/swriter --convert-to pdf DeleteStackSample.odt The date and time fields are now reset to 30/12/1899 00:00:00 Change-Id: Ic89111615074adb50f16a605f920f9a89c437dfd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/24442 Tested-by: Jenkins Tested-by: Gabor Kelemen <kelem...@ubuntu.com> Reviewed-by: Gabor Kelemen <kelem...@ubuntu.com> diff --git a/forms/source/xforms/xpathlib/xpathlib.cxx b/forms/source/xforms/xpathlib/xpathlib.cxx index e2f0a10eba58..ffae5a59ca34 100644 --- a/forms/source/xforms/xpathlib/xpathlib.cxx +++ b/forms/source/xforms/xpathlib/xpathlib.cxx @@ -277,8 +277,11 @@ void xforms_nowFunction(xmlXPathParserContextPtr ctxt, int /*nargs*/) be omitted or, if present, the time zone must be Coordinated Universal tools::Time (UTC) indicated by a "Z". */ - DateTime aDateTime( DateTime::SYSTEM ); - OString aDateTimeString = makeDateTimeString(aDateTime); + OString aDateTimeString; + if (std::getenv("STABLE_FIELDS_HACK")) + aDateTimeString = makeDateTimeString(DateTime(DateTime::EMPTY)); + else + aDateTimeString = makeDateTimeString(DateTime(DateTime::SYSTEM)); xmlChar *pString = static_cast<xmlChar*>(xmlMalloc(aDateTimeString.getLength()+1)); strncpy(reinterpret_cast<char*>(pString), aDateTimeString.getStr(), aDateTimeString.getLength()); pString[aDateTimeString.getLength()] = 0; diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 97156636ef60..4c3f928ec910 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -945,8 +945,11 @@ OUString SwDocInfoFieldType::Expand( sal_uInt16 nSub, sal_uInt32 nFormat, else if( nSub == DI_PRINT ) { aName = xDocProps->getPrintedBy(); - uDT = xDocProps->getPrintDate(); - aDate = DateTime(uDT); + if ( !std::getenv("STABLE_FIELDS_HACK") ) + { + uDT = xDocProps->getPrintDate(); + aDate = DateTime(uDT); + } } else break; diff --git a/sw/source/core/fields/flddat.cxx b/sw/source/core/fields/flddat.cxx index 3dcaf848f417..264b7538f967 100644 --- a/sw/source/core/fields/flddat.cxx +++ b/sw/source/core/fields/flddat.cxx @@ -63,6 +63,11 @@ SwDateTimeField::SwDateTimeField(SwDateTimeFieldType* pInitType, sal_uInt16 nSub OUString SwDateTimeField::ExpandImpl(SwRootFrame const*const) const { + if (getenv("STABLE_FIELDS_HACK")) + { + const_cast<SwDateTimeField*>(this)->m_nSubType |= FIXEDFLD; //HACK + } + double fVal; if (!(IsFixed())) @@ -131,6 +136,11 @@ double SwDateTimeField::GetDateTime(SwDoc& rDoc, const DateTime& rDT) double SwDateTimeField::GetValue() const { + if (getenv("STABLE_FIELDS_HACK")) + { + const_cast<SwDateTimeField*>(this)->m_nSubType |= FIXEDFLD; //HACK + } + if (IsFixed()) return SwValueField::GetValue(); else