[Libreoffice-commits] core.git: sw/source
Mark Hung (via logerrit)
logerrit at kemper.freedesktop.org
Thu Oct 8 12:21:31 UTC 2020
sw/source/core/text/portxt.cxx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit ac76f9e8ad8b077623725d0f6dceb13adb37e43a
Author: Mark Hung <marklh9 at gmail.com>
AuthorDate: Fri Oct 2 11:24:31 2020 +0800
Commit: Mark Hung <marklh9 at gmail.com>
CommitDate: Thu Oct 8 14:20:49 2020 +0200
tdf#130314 space counting for input field.
1. Input field should be counted like other fields,
with its content expanded with GetExpText().
2. Use only GetLen() instead of rInf.GetLen() in
SwTextInputFieldPortion::GetExpText() because
when justifying the text, rInf.GetLen() isn't
always updated corresponding to rInf.GetIdx().
( Check SwTextAdjuster::CalcNewBlock() for ref.)
Change-Id: I6a41275295607887c476fdd3f8e5a90c936c9d31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103782
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9 at gmail.com>
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index ace126870b54..559c3bea0ad8 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -582,7 +582,7 @@ TextFrameIndex SwTextPortion::GetSpaceCnt(const SwTextSizeInfo &rInf,
return TextFrameIndex(0);
}
- if ( InExpGrp() )
+ if ( InExpGrp() && PortionType::InputField == GetWhichPor() )
{
if( !IsBlankPortion() && !InNumberGrp() && !IsCombinedPortion() )
{
@@ -619,7 +619,7 @@ long SwTextPortion::CalcSpacing( long nSpaceAdd, const SwTextSizeInfo &rInf ) co
return 0;
}
- if ( InExpGrp() )
+ if ( InExpGrp() || PortionType::InputField == GetWhichPor() )
{
if( !IsBlankPortion() && !InNumberGrp() && !IsCombinedPortion() )
{
@@ -716,13 +716,13 @@ void SwTextInputFieldPortion::Paint( const SwTextPaintInfo &rInf ) const
bool SwTextInputFieldPortion::GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const
{
sal_Int32 nIdx(rInf.GetIdx());
- sal_Int32 nLen(rInf.GetLen());
+ sal_Int32 nLen(GetLen());
if ( rInf.GetChar( rInf.GetIdx() ) == CH_TXT_ATR_INPUTFIELDSTART )
{
++nIdx;
--nLen;
}
- if (rInf.GetChar(rInf.GetIdx() + rInf.GetLen() - TextFrameIndex(1)) == CH_TXT_ATR_INPUTFIELDEND)
+ if (rInf.GetChar(rInf.GetIdx() + GetLen() - TextFrameIndex(1)) == CH_TXT_ATR_INPUTFIELDEND)
{
--nLen;
}
More information about the Libreoffice-commits
mailing list