[Libreoffice-commits] core.git: forms/source sw/source

2023-07-24 Thread Michael Stahl (via logerrit)
 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 
AuthorDate: Wed Apr 27 15:12:00 2016 +0200
Commit: Gabor Kelemen 
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 
Reviewed-by: Gabor Kelemen 

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(xmlMalloc(aDateTimeString.getLength()+1));
 strncpy(reinterpret_cast(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(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(this)->m_nSubType |= FIXEDFLD; //HACK
+}
+
 if (IsFixed())
 return SwValueField::GetValue();
 else


[Libreoffice-commits] core.git: forms/source sw/source

2020-08-05 Thread Caolán McNamara (via logerrit)
 forms/source/component/FormComponent.cxx |2 +-
 sw/source/core/layout/frmtool.cxx|2 +-
 sw/source/filter/ww8/ww8par.hxx  |8 
 sw/source/ui/table/tabledlg.cxx  |2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit cfce4865e81db30635cf3a166d77731be41cd9a7
Author: Caolán McNamara 
AuthorDate: Wed Aug 5 14:43:08 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 5 16:52:26 2020 +0200

dito->ditto

Change-Id: I432dcc61dfb53e6b439052c495a602aab8a58f5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100172
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/forms/source/component/FormComponent.cxx 
b/forms/source/component/FormComponent.cxx
index 450ef822b632..34b5f51c538d 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -1368,7 +1368,7 @@ void OBoundControlModel::disposing()
 // disconnect from our external value binding
 if ( hasExternalValueBinding() )
 disconnectExternalValueBinding();
-// dito for the validator
+// ditto for the validator
 if ( hasValidator() )
 disconnectValidator( );
 }
diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index b9d4f37831d2..9dac5b885233 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -875,7 +875,7 @@ SwContentNotify::~SwContentNotify()
 pFESh->CalcAndSetScale( xObj ); // create client
 }
 }
-//dito animated graphics
+// ditto animated graphics
 if ( getFrameArea().HasArea() && 
static_cast(pCnt)->HasAnimation() )
 {
 static_cast(pCnt)->StopAnimation();
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 2ff459b161ca..8b0c6f51f339 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1269,10 +1269,10 @@ private:
 
 // Ini-Flags:
 sal_uInt32 m_nIniFlags;// flags from writer.ini
-sal_uInt32 m_nIniFlags1;   // dito ( additional flags )
-sal_uInt32 m_nFieldFlags;  // dito for fields
-sal_uInt32 m_nFieldTagAlways[3];   // dito for tagging of fields
-sal_uInt32 m_nFieldTagBad[3];  // dito for tagging of fields that 
can't be imported
+sal_uInt32 m_nIniFlags1;   // ditto ( additional flags )
+sal_uInt32 m_nFieldFlags;  // ditto for fields
+sal_uInt32 m_nFieldTagAlways[3];   // ditto for tagging of fields
+sal_uInt32 m_nFieldTagBad[3];  // ditto for tagging of fields that 
can't be imported
 bool m_bRegardHindiDigits;  // import digits in CTL scripts as Hindi 
numbers
 
 bool m_bDrawCpOValid;
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 082b23ee4214..c56168448f6d 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -157,7 +157,7 @@ IMPL_LINK( SwFormatTablePage, RelWidthClickHdl, 
weld::ToggleButton&, rBtn, void
 m_xLeftMF->SetRefValue(pTableData->GetSpace());
 m_xRightMF->SetRefValue(pTableData->GetSpace());
 m_xLeftMF->SetMetricFieldMin(0); //will be overwritten by the 
Percentfield
-m_xRightMF->SetMetricFieldMin(0); //dito
+m_xRightMF->SetMetricFieldMin(0); //ditto
 m_xLeftMF->SetMetricFieldMax(99);
 m_xRightMF->SetMetricFieldMax(99);
 m_xLeftMF->set_value(m_xLeftMF->NormalizePercent(nLeft ), 
FieldUnit::TWIP );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits