svx/source/fmcomp/gridcell.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
New commits: commit b9ad25f5f60eedd1d81a5869938be04cf63627e4 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Dec 14 14:06:28 2021 +0000 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Dec 14 18:10:40 2021 +0100 tdf#145999 -1 was the representation of unlimited cell width when using UniString -1 -> 0xFFFF i.e. old-time EDIT_NOLIMIT Change-Id: Ie40fa65a88a2b8961d70635ca5e4ec851567e089 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126815 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 5090df2372b3..16dc2a448caf 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -1175,13 +1175,12 @@ void DbTextField::updateFromModel( Reference< XPropertySet > _rxModel ) _rxModel->getPropertyValue( FM_PROP_TEXT ) >>= sText; sal_Int32 nMaxTextLen = m_pEdit->GetMaxTextLen(); - if (nMaxTextLen != 0 && sText.getLength() > nMaxTextLen) + if (nMaxTextLen > 0 && sText.getLength() > nMaxTextLen) { sal_Int32 nDiff = sText.getLength() - nMaxTextLen; sText = sText.replaceAt(sText.getLength() - nDiff,nDiff, OUString()); } - m_pEdit->SetText( sText ); m_pEdit->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) ); } @@ -1191,7 +1190,7 @@ bool DbTextField::commitControl() OUString aText( m_pEdit->GetText( getModelLineEndSetting( m_rColumn.getModel() ) ) ); // we have to check if the length before we can decide if the value was modified sal_Int32 nMaxTextLen = m_pEdit->GetMaxTextLen(); - if (nMaxTextLen != 0) + if (nMaxTextLen > 0) { OUString sOldValue; m_rColumn.getModel()->getPropertyValue( FM_PROP_TEXT ) >>= sOldValue;