Kaydet (Commit) ed2c3a53 authored tarafından Matúš Kukan's avatar Matúš Kukan

editeng: Avoid calling expensive getLineBreak() if possible

ImpEditEngine::ImpBreakLine: if nMinBreakPos == nMaxBreakPos just set
nBreakPos to the same value directly.

Change-Id: I4544cb6c56f68071cba739260161bb24ef5a3f7f
üst cc00f501
......@@ -1769,10 +1769,20 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
break;
}
}
assert(nMinBreakPos <= nMaxBreakPos);
lang::Locale aLocale = GetLocale( EditPaM( pNode, nMaxBreakPos ) );
Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
const bool bAllowPunctuationOutsideMargin = static_cast<const SfxBoolItem&>(
pNode->GetContentAttribs().GetItem( EE_PARA_HANGINGPUNCTUATION )).GetValue();
if (nMinBreakPos == nMaxBreakPos)
{
nBreakPos = nMinBreakPos;
}
else
{
Reference< XHyphenator > xHyph;
if ( bCanHyphenate )
xHyph = GetHyphenator();
......@@ -1783,7 +1793,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
aUserOptions.forbiddenBeginCharacters = pForbidden->beginLine;
aUserOptions.forbiddenEndCharacters = pForbidden->endLine;
aUserOptions.applyForbiddenRules = static_cast<const SfxBoolItem&>(pNode->GetContentAttribs().GetItem( EE_PARA_FORBIDDENRULES )).GetValue();
aUserOptions.allowPunctuationOutsideMargin = static_cast<const SfxBoolItem&>(pNode->GetContentAttribs().GetItem( EE_PARA_HANGINGPUNCTUATION )).GetValue();
aUserOptions.allowPunctuationOutsideMargin = bAllowPunctuationOutsideMargin;
aUserOptions.allowHyphenateEnglish = sal_False;
i18n::LineBreakResults aLBR = _xBI->getLineBreak(
......@@ -1804,10 +1814,11 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
// nBreakPos can never be outside the portion, even not with hangig punctuation
if ( nBreakPos > nMaxBreakPos )
nBreakPos = nMaxBreakPos;
}
// BUG in I18N - the japanese dot is in the next line!
// !!! Test!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if ( (nBreakPos + ( aUserOptions.allowPunctuationOutsideMargin ? 0 : 1 ) ) <= nMaxBreakPos )
if ( (nBreakPos + ( bAllowPunctuationOutsideMargin ? 0 : 1 ) ) <= nMaxBreakPos )
{
sal_Unicode cFirstInNextLine = ( (nBreakPos+1) < pNode->Len() ) ? pNode->GetChar( nBreakPos ) : 0;
if ( cFirstInNextLine == 12290 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment