summaryrefslogtreecommitdiff
path: root/sw/source/core/text
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-19 11:20:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-19 21:45:02 +0200
commit6e531f337b27e0979cce844c013352d05ef5281e (patch)
tree0c4820c1ce0b8e9f05707a3d0ff38d49f7016cdd /sw/source/core/text
parentca8f4a66e44aed731646066241cf2225bb9f8c2a (diff)
SwBreakIt::m_xBreak is always available
this all is a hold over from the initial tentitive changeover to using it in the first place Change-Id: I70e28023798d8ea637c61f9fac252bc698e8100d Reviewed-on: https://gerrit.libreoffice.org/36683 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/core/text')
-rw-r--r--sw/source/core/text/guess.cxx2
-rw-r--r--sw/source/core/text/itratr.cxx42
-rw-r--r--sw/source/core/text/porfld.cxx27
-rw-r--r--sw/source/core/text/porlay.cxx7
-rw-r--r--sw/source/core/text/portxt.cxx4
-rw-r--r--sw/source/core/text/redlnitr.cxx58
-rw-r--r--sw/source/core/text/txtdrop.cxx2
-rw-r--r--sw/source/core/text/txthyph.cxx3
8 files changed, 59 insertions, 86 deletions
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 3a6aa4abbc59..066d45a5a2fa 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -266,7 +266,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
nBreakStart = nCutPos;
}
- else if( g_pBreakIt->GetBreakIter().is() )
+ else
{
// New: We should have a look into the last portion, if it was a
// field portion. For this, we expand the text of the field portion
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 55fbbadeb126..1c8ef5182e9b 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -361,32 +361,19 @@ static bool lcl_MinMaxString( SwMinMaxArgs& rArg, SwFont* pFnt, const OUString &
sal_Int32 nStop = nIdx;
bool bClear = false;
LanguageType eLang = pFnt->GetLanguage();
- if( g_pBreakIt->GetBreakIter().is() )
- {
- bClear = CH_BLANK == rText[ nStop ];
- Boundary aBndry( g_pBreakIt->GetBreakIter()->getWordBoundary( rText, nIdx,
- g_pBreakIt->GetLocale( eLang ),
- WordType::DICTIONARY_WORD, true ) );
- nStop = aBndry.endPos;
- if( nIdx <= aBndry.startPos && nIdx && nIdx-1 != rArg.nNoLineBreak )
- rArg.NewWord();
- if( nStop == nIdx )
- ++nStop;
- if( nStop > nEnd )
- nStop = nEnd;
- }
- else
- {
- while( nStop < nEnd && CH_BLANK != rText[ nStop ] )
- ++nStop;
- bClear = nStop == nIdx;
- if ( bClear )
- {
- rArg.NewWord();
- while( nStop < nEnd && CH_BLANK == rText[ nStop ] )
- ++nStop;
- }
- }
+ assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
+
+ bClear = CH_BLANK == rText[ nStop ];
+ Boundary aBndry( g_pBreakIt->GetBreakIter()->getWordBoundary( rText, nIdx,
+ g_pBreakIt->GetLocale( eLang ),
+ WordType::DICTIONARY_WORD, true ) );
+ nStop = aBndry.endPos;
+ if( nIdx <= aBndry.startPos && nIdx && nIdx-1 != rArg.nNoLineBreak )
+ rArg.NewWord();
+ if( nStop == nIdx )
+ ++nStop;
+ if( nStop > nEnd )
+ nStop = nEnd;
SwDrawTextInfo aDrawInf( rArg.pSh, *rArg.pOut, nullptr, rText, nIdx, nStop - nIdx );
long nAktWidth = pFnt->GetTextSize_( aDrawInf ).Width();
@@ -807,8 +794,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
if ( nStt == nEnd )
{
- if ( !g_pBreakIt->GetBreakIter().is() )
- return 100;
+ assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
SwScriptInfo aScriptInfo;
SwAttrIter aIter( *const_cast<SwTextNode*>(this), aScriptInfo );
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 1a7a3bf402b6..3821625a238e 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -194,7 +194,7 @@ SwFieldSlot::~SwFieldSlot()
void SwFieldPortion::CheckScript( const SwTextSizeInfo &rInf )
{
OUString aText;
- if( GetExpText( rInf, aText ) && !aText.isEmpty() && g_pBreakIt->GetBreakIter().is() )
+ if (GetExpText(rInf, aText) && !aText.isEmpty())
{
SwFontScript nActual = pFnt ? pFnt->GetActual() : rInf.GetFont()->GetActual();
sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType( aText, 0 );
@@ -1074,24 +1074,19 @@ SwCombinedPortion::SwCombinedPortion( const OUString &rText )
// Initialization of the scripttype array,
// the arrays of width and position are filled by the format function
- if( g_pBreakIt->GetBreakIter().is() )
+ assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
+
+ SwFontScript nScr = SW_SCRIPTS;
+ for( sal_Int32 i = 0; i < rText.getLength(); ++i )
{
- SwFontScript nScr = SW_SCRIPTS;
- for( sal_Int32 i = 0; i < rText.getLength(); ++i )
- {
- switch ( g_pBreakIt->GetBreakIter()->getScriptType( rText, i ) ) {
- case i18n::ScriptType::LATIN : nScr = SwFontScript::Latin; break;
- case i18n::ScriptType::ASIAN : nScr = SwFontScript::CJK; break;
- case i18n::ScriptType::COMPLEX : nScr = SwFontScript::CTL; break;
- }
- aScrType[i] = nScr;
+ switch ( g_pBreakIt->GetBreakIter()->getScriptType( rText, i ) ) {
+ case i18n::ScriptType::LATIN : nScr = SwFontScript::Latin; break;
+ case i18n::ScriptType::ASIAN : nScr = SwFontScript::CJK; break;
+ case i18n::ScriptType::COMPLEX : nScr = SwFontScript::CTL; break;
}
+ aScrType[i] = nScr;
}
- else
- {
- for(SwFontScript & rn : aScrType)
- rn = SwFontScript::Latin;
- }
+
memset( &aWidth, 0, sizeof(aWidth) );
}
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index b1bc88582d67..53ef42eb8992 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -698,8 +698,7 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode )
void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL )
{
- if( !g_pBreakIt->GetBreakIter().is() )
- return;
+ assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
const OUString& rText = rNode.GetText();
@@ -2215,7 +2214,7 @@ void SwScriptInfo::CalcHiddenRanges( const SwTextNode& rNode, MultiSelection& rH
sal_Int32 SwScriptInfo::CountCJKCharacters( const OUString &rText, sal_Int32 nPos, sal_Int32 nEnd, LanguageType aLang)
{
sal_Int32 nCount = 0;
- if ( nEnd > nPos && g_pBreakIt->GetBreakIter().is() )
+ if (nEnd > nPos)
{
sal_Int32 nDone = 0;
const lang::Locale &rLocale = g_pBreakIt->GetLocale( aLang );
@@ -2239,7 +2238,7 @@ void SwScriptInfo::CJKJustify( const OUString& rText, long* pKernArray,
long nSpaceAdd, bool bIsSpaceStop )
{
assert( pKernArray != nullptr && nStt >= 0 );
- if ( nLen > 0 && g_pBreakIt->GetBreakIter().is() )
+ if (nLen > 0)
{
long nSpaceSum = 0;
const lang::Locale &rLocale = g_pBreakIt->GetLocale( aLang );
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index cd508425cb94..bcdd4772cd31 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -75,7 +75,7 @@ static sal_Int32 lcl_AddSpace( const SwTextSizeInfo &rInf, const OUString* pStr,
// first we get the script type
if ( pSI )
nScript = pSI->ScriptType( nPos );
- else if ( g_pBreakIt->GetBreakIter().is() )
+ else
nScript = (sal_uInt8)g_pBreakIt->GetBreakIter()->getScriptType( *pStr, nPos );
// Note: rInf.GetIdx() can differ from nPos,
@@ -177,7 +177,7 @@ static sal_Int32 lcl_AddSpace( const SwTextSizeInfo &rInf, const OUString* pStr,
if ( pPor && pPor->IsKernPortion() )
pPor = pPor->GetPortion();
- if ( ! g_pBreakIt->GetBreakIter().is() || ! pPor || pPor->InFixMargGrp() )
+ if (!pPor || pPor->InFixMargGrp())
return nCnt;
// next character is inside a field?
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index ef9915ad4b6e..d5b5edc77e95 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -89,41 +89,35 @@ void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf,
if ( m_pScriptInfo->GetInvalidityA() != COMPLETE_STRING )
m_pScriptInfo->InitScriptInfo( rTextNode, bRTL );
- if ( g_pBreakIt->GetBreakIter().is() )
- {
- m_pFont->SetActual( SwScriptInfo::WhichFont( 0, nullptr, m_pScriptInfo ) );
+ assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
- sal_Int32 nChg = 0;
- size_t nCnt = 0;
+ m_pFont->SetActual( SwScriptInfo::WhichFont( 0, nullptr, m_pScriptInfo ) );
- do
- {
- if ( nCnt >= m_pScriptInfo->CountScriptChg() )
- break;
- nChg = m_pScriptInfo->GetScriptChg( nCnt );
- SwFontScript nTmp = SW_SCRIPTS;
- switch ( m_pScriptInfo->GetScriptType( nCnt++ ) ) {
- case i18n::ScriptType::ASIAN :
- if( !m_aMagicNo[SwFontScript::CJK] ) nTmp = SwFontScript::CJK;
- break;
- case i18n::ScriptType::COMPLEX :
- if( !m_aMagicNo[SwFontScript::CTL] ) nTmp = SwFontScript::CTL;
- break;
- default:
- if( !m_aMagicNo[SwFontScript::Latin ] ) nTmp = SwFontScript::Latin;
- }
- if( nTmp < SW_SCRIPTS )
- {
- m_pFont->ChkMagic( m_pViewShell, nTmp );
- m_pFont->GetMagic( m_aMagicNo[ nTmp ], m_aFontIdx[ nTmp ], nTmp );
- }
- } while (nChg < rTextNode.GetText().getLength());
- }
- else
+ sal_Int32 nChg = 0;
+ size_t nCnt = 0;
+
+ do
{
- m_pFont->ChkMagic( m_pViewShell, SwFontScript::Latin );
- m_pFont->GetMagic( m_aMagicNo[ SwFontScript::Latin ], m_aFontIdx[ SwFontScript::Latin ], SwFontScript::Latin );
- }
+ if ( nCnt >= m_pScriptInfo->CountScriptChg() )
+ break;
+ nChg = m_pScriptInfo->GetScriptChg( nCnt );
+ SwFontScript nTmp = SW_SCRIPTS;
+ switch ( m_pScriptInfo->GetScriptType( nCnt++ ) ) {
+ case i18n::ScriptType::ASIAN :
+ if( !m_aMagicNo[SwFontScript::CJK] ) nTmp = SwFontScript::CJK;
+ break;
+ case i18n::ScriptType::COMPLEX :
+ if( !m_aMagicNo[SwFontScript::CTL] ) nTmp = SwFontScript::CTL;
+ break;
+ default:
+ if( !m_aMagicNo[SwFontScript::Latin ] ) nTmp = SwFontScript::Latin;
+ }
+ if( nTmp < SW_SCRIPTS )
+ {
+ m_pFont->ChkMagic( m_pViewShell, nTmp );
+ m_pFont->GetMagic( m_aMagicNo[ nTmp ], m_aFontIdx[ nTmp ], nTmp );
+ }
+ } while (nChg < rTextNode.GetText().getLength());
m_nStartIndex = m_nEndIndex = m_nPosition = m_nChgCnt = 0;
m_nPropFont = 0;
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 157bfeef6719..be96cbc6bf81 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -127,7 +127,7 @@ sal_Int32 SwTextNode::GetDropLen( sal_Int32 nWishLen ) const
if( nWishLen && nWishLen < nEnd )
nEnd = nWishLen;
- if ( ! nWishLen && g_pBreakIt->GetBreakIter().is() )
+ if (! nWishLen)
{
// find first word
const SwAttrSet& rAttrSet = GetSwAttrSet();
diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx
index 6b5bd8470648..01940c21f79d 100644
--- a/sw/source/core/text/txthyph.cxx
+++ b/sw/source/core/text/txthyph.cxx
@@ -60,8 +60,7 @@ bool SwTextFrame::Hyphenate( SwInterHyphInfo &rHyphInf )
vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"swapped frame at SwTextFrame::Hyphenate" );
- if( !g_pBreakIt->GetBreakIter().is() )
- return false;
+ assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
// We lock it, to start with
OSL_ENSURE( !IsLocked(), "SwTextFrame::Hyphenate: this is locked" );