summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-11-28 12:35:40 +0100
committerMichael Stahl <michael.stahl@cib.de>2019-11-28 15:14:01 +0100
commite7c0f65753e04d2de3dbac56fbe86ce0b6aed9b2 (patch)
tree49d1e719b836485c352bc684fc94575248175984 /sw
parent90d09fbcdf013f1d366e7881353d703e4b352639 (diff)
sw: fix asserts from SwSubFont::GetTextSize_() on ooo54042-1.doc
The function gets passed a single CH_TXT_ATR_FIELDSTART but it looks like this is a problem in SwTextNode::GetMinMaxSize(). That one should just skip over the CH_TXT_ATR_FIELD* basically, since it's only interested in the text; also CH_TXT_ATR_INPUTFIELD* while at it. Also adapt the SwTextFrame::GetScalingOfSelectedText(), as indicated by the comment. Change-Id: Idf24e84f000406d265e73441de643b022c0b3cff Reviewed-on: https://gerrit.libreoffice.org/83997 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/itratr.cxx38
1 files changed, 36 insertions, 2 deletions
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 9ec429195bf5..1aed86e50a55 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -1070,8 +1070,17 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
CH_TAB != (cChar = m_Text[sal_Int32(nStop)]) &&
CH_BREAK != cChar && CHAR_HARDBLANK != cChar &&
CHAR_HARDHYPHEN != cChar && CHAR_SOFTHYPHEN != cChar &&
+ CH_TXT_ATR_INPUTFIELDSTART != cChar &&
+ CH_TXT_ATR_INPUTFIELDEND != cChar &&
+ CH_TXT_ATR_FORMELEMENT != cChar &&
+ CH_TXT_ATR_FIELDSTART != cChar &&
+ CH_TXT_ATR_FIELDSEP != cChar &&
+ CH_TXT_ATR_FIELDEND != cChar &&
!pHint )
{
+ // this looks like some defensive programming to handle dummy char
+ // with missing hint? but it's rather silly because it may pass the
+ // dummy char to lcl_MinMaxString in that case...
if( ( CH_TXTATR_BREAKWORD != cChar && CH_TXTATR_INWORD != cChar )
|| ( nullptr == ( pHint = aIter.GetAttr( nStop ) ) ) )
++nStop;
@@ -1193,6 +1202,16 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
aIter.SeekAndChgAttrIter( ++nIdx, pOut );
}
break;
+ case CH_TXT_ATR_INPUTFIELDSTART:
+ case CH_TXT_ATR_INPUTFIELDEND:
+ case CH_TXT_ATR_FORMELEMENT:
+ case CH_TXT_ATR_FIELDSTART:
+ case CH_TXT_ATR_FIELDSEP:
+ case CH_TXT_ATR_FIELDEND:
+ { // just skip it and continue with the content...
+ aIter.SeekAndChgAttrIter( ++nIdx, pOut );
+ }
+ break;
}
}
if( static_cast<long>(rMax) < aArg.nRowWidth )
@@ -1305,6 +1324,12 @@ sal_uInt16 SwTextFrame::GetScalingOfSelectedText(
CHAR_HARDBLANK == cChar ||
CHAR_HARDHYPHEN == cChar ||
CHAR_SOFTHYPHEN == cChar ||
+ CH_TXT_ATR_INPUTFIELDSTART == cChar ||
+ CH_TXT_ATR_INPUTFIELDEND == cChar ||
+ CH_TXT_ATR_FORMELEMENT == cChar ||
+ CH_TXT_ATR_FIELDSTART == cChar ||
+ CH_TXT_ATR_FIELDSEP == cChar ||
+ CH_TXT_ATR_FIELDEND == cChar ||
(
(CH_TXTATR_BREAKWORD == cChar || CH_TXTATR_INWORD == cChar) &&
(nullptr == (pHint = aIter.GetAttr(nStop)))
@@ -1380,8 +1405,17 @@ sal_uInt16 SwTextFrame::GetScalingOfSelectedText(
}
} // end of switch
nIdx++;
- } // end of while
- }
+ }
+ else if (CH_TXT_ATR_INPUTFIELDSTART == cChar ||
+ CH_TXT_ATR_INPUTFIELDEND == cChar ||
+ CH_TXT_ATR_FORMELEMENT == cChar ||
+ CH_TXT_ATR_FIELDSTART == cChar ||
+ CH_TXT_ATR_FIELDSEP == cChar ||
+ CH_TXT_ATR_FIELDEND == cChar)
+ { // just skip it and continue with the content...
+ ++nIdx;
+ }
+ } // end of while
nWidth = std::max( nWidth, nProWidth );