Kaydet (Commit) fd4fe853 authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: fdo#49208 don't copy string if we can reuse the original

Change-Id: I95d82ce168fd1790107316460f6ddbd9f6b32e18
üst 268ec2e6
......@@ -96,7 +96,12 @@ public:
sal_uInt16 GetRealScriptOfText( const rtl::OUString& rTxt, sal_Int32 nPos ) const;
sal_uInt16 GetAllScriptsOfText( const rtl::OUString& rTxt ) const;
sal_Int32 getGraphemeCount(const rtl::OUString& rStr) const;
sal_Int32 getGraphemeCount(const rtl::OUString& rStr,
sal_Int32 nStart, sal_Int32 nEnd) const;
sal_Int32 getGraphemeCount(const rtl::OUString& rStr) const
{
return getGraphemeCount(rStr, 0, rStr.getLength());
}
};
#define SW_BREAKITER() SwBreakIt::Get()
......
......@@ -165,12 +165,12 @@ sal_uInt16 SwBreakIt::GetAllScriptsOfText( const rtl::OUString& rTxt ) const
return nRet;
}
sal_Int32 SwBreakIt::getGraphemeCount(const rtl::OUString& rText) const
sal_Int32 SwBreakIt::getGraphemeCount(const rtl::OUString& rText, sal_Int32 nStart, sal_Int32 nEnd) const
{
sal_Int32 nGraphemeCount = 0;
sal_Int32 nCurPos = 0;
while (nCurPos < rText.getLength())
sal_Int32 nCurPos = nStart;
while (nCurPos < nEnd)
{
sal_Int32 nCount2 = 1;
nCurPos = xBreak->nextCharacters(rText, nCurPos, lang::Locale(),
......
......@@ -1913,7 +1913,7 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
}
}
nTmpChars = pBreakIt->getGraphemeCount(aExpandText.copy(nExpandBegin, nExpandEnd - nExpandBegin));
nTmpChars = pBreakIt->getGraphemeCount(aExpandText, nExpandBegin, nExpandEnd);
nTmpChars -= nNumOfMaskedChars;
// no nTmpCharsExcludingSpaces adjust needed neither for blanked out MaskedChars
......
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