summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2020-10-02 11:24:31 +0800
committerMark Hung <marklh9@gmail.com>2020-10-08 14:20:49 +0200
commitac76f9e8ad8b077623725d0f6dceb13adb37e43a (patch)
tree272c4966d7087334cf81c0bf1665601ef1fca11f /sw
parentd18731f71c60cbb6c02cabb042004b1aa9454de8 (diff)
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@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/portxt.cxx8
1 files changed, 4 insertions, 4 deletions
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;
}