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 879c68263b6af5781b0ad3731d03c8b8c1467d2d Author: Michael Stahl <mst...@redhat.com> AuthorDate: Wed Apr 27 15:12:00 2016 +0200 Commit: Gabor Kelemen <kelem...@ubuntu.com> CommitDate: Tue Jul 25 10:20:32 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> (cherry picked from commit 53f4e6394eee2f4833b699071059882c28d87c33) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154860 diff --git a/forms/source/xforms/xpathlib/xpathlib.cxx b/forms/source/xforms/xpathlib/xpathlib.cxx index 6fd72e923bf0..a5f780d2326d 100644 --- a/forms/source/xforms/xpathlib/xpathlib.cxx +++ b/forms/source/xforms/xpathlib/xpathlib.cxx @@ -275,8 +275,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 53e9097279eb..cbebaeb51165 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -932,8 +932,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 f2a6a779a0ed..ecd3b8d97579 100644 --- a/sw/source/core/fields/flddat.cxx +++ b/sw/source/core/fields/flddat.cxx @@ -62,6 +62,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())) @@ -130,6 +135,11 @@ double SwDateTimeField::GetDateTime(SwDoc* pDoc, 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