diff options
author | Noel Grandin <noel@peralex.com> | 2013-12-04 11:26:19 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-12-04 11:29:14 +0200 |
commit | b273106226ab7e21f68b9e0470e8b28b27f6b726 (patch) | |
tree | fe92cf8be49dfe25692e40442654715cf5a10349 | |
parent | 79eab004dca8413cf99ea688291083df2d146230 (diff) |
convert OutputDevice::HasGlyphs from xub_StrLen->sal_Int32
Change-Id: Ic8f0ae3d263d6cb02e6faa7226db0241681fc45f
-rw-r--r-- | include/vcl/outdev.hxx | 4 | ||||
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 4 | ||||
-rw-r--r-- | svtools/source/control/scriptedtext.cxx | 2 | ||||
-rw-r--r-- | svtools/source/misc/sampletext.cxx | 20 | ||||
-rw-r--r-- | toolkit/source/awt/vclxfont.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/outdev3.cxx | 12 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 3 |
7 files changed, 24 insertions, 23 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 52b3cde38539..ff3278b102b2 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1088,8 +1088,8 @@ public: sal_Bool GetFontCharMap( FontCharMap& rFontCharMap ) const; bool GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities ) const; - xub_StrLen HasGlyphs( const Font& rFont, const OUString& rStr, - xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN ) const; + sal_Int32 HasGlyphs( const Font& rFont, const OUString& rStr, + sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const; long GetMinKashida() const; diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 33c15d63125e..3249308b3fe7 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1347,7 +1347,7 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt ) OUString sText = makeShortRepresentativeTextForScript(aScripts[i]); if (!sText.isEmpty()) { - bool bHasSampleTextGlyphs = (STRING_LEN == rUDEvt.GetDevice()->HasGlyphs(aFont, sText)); + bool bHasSampleTextGlyphs = (-1 == rUDEvt.GetDevice()->HasGlyphs(aFont, sText)); if (bHasSampleTextGlyphs) { sSampleText = sText; @@ -1367,7 +1367,7 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt ) OUString sText = makeShortMinimalTextForScript(aMinimalScripts[i]); if (!sText.isEmpty()) { - bool bHasSampleTextGlyphs = (STRING_LEN == rUDEvt.GetDevice()->HasGlyphs(aFont, sText)); + bool bHasSampleTextGlyphs = (-1 == rUDEvt.GetDevice()->HasGlyphs(aFont, sText)); if (bHasSampleTextGlyphs) { sSampleText = sText; diff --git a/svtools/source/control/scriptedtext.cxx b/svtools/source/control/scriptedtext.cxx index 29eab5febe7e..4975c83ba656 100644 --- a/svtools/source/control/scriptedtext.cxx +++ b/svtools/source/control/scriptedtext.cxx @@ -222,7 +222,7 @@ void SvtScriptedTextHelper_Impl::CalculateBreaks( const uno::Reference< i18n::XB nScript = i18n::ScriptType::LATIN; while( (nScript != i18n::ScriptType::WEAK) && (nCharIx == nNextCharIx) ) { - nNextCharIx = mrOutDevice.HasGlyphs( GetFont( nScript ), maText, sal::static_int_cast< sal_uInt16 >(nCharIx), sal::static_int_cast< sal_uInt16 >(nNextPos - nCharIx) ); + nNextCharIx = mrOutDevice.HasGlyphs( GetFont( nScript ), maText, nCharIx, nNextPos - nCharIx ); if( nCharIx == nNextCharIx ) ++nScript; } diff --git a/svtools/source/misc/sampletext.cxx b/svtools/source/misc/sampletext.cxx index da0c90c0a86c..d74cad4b4f76 100644 --- a/svtools/source/misc/sampletext.cxx +++ b/svtools/source/misc/sampletext.cxx @@ -44,7 +44,7 @@ bool isSymbolFont(const Font &rFont) bool canRenderNameOfSelectedFont(OutputDevice &rDevice) { const Font &rFont = rDevice.GetFont(); - return !isSymbolFont(rFont) && (STRING_LEN == rDevice.HasGlyphs(rFont, rFont.GetName())); + return !isSymbolFont(rFont) && ( -1 == rDevice.HasGlyphs(rFont, rFont.GetName()) ); } OUString makeShortRepresentativeSymbolTextForSelectedFont(OutputDevice &rDevice) @@ -95,7 +95,7 @@ OUString makeShortRepresentativeSymbolTextForSelectedFont(OutputDevice &rDevice) 0x2706,0x2704,0x270D,0xE033,0x2211,0x2288,0}; const sal_Unicode* pText = bOpenSymbol ? aImplStarSymbolText : aImplSymbolFontText; OUString sSampleText(pText); - bool bHasSampleTextGlyphs = (STRING_LEN == rDevice.HasGlyphs(rDevice.GetFont(), sSampleText)); + bool bHasSampleTextGlyphs = (-1 == rDevice.HasGlyphs(rDevice.GetFont(), sSampleText)); return bHasSampleTextGlyphs ? sSampleText : OUString(); } @@ -1115,22 +1115,22 @@ namespace const sal_Unicode aKorean[] = { 0x3131 }; OUString sKorean(aKorean, SAL_N_ELEMENTS(aKorean)); - if (STRING_LEN == rDevice.HasGlyphs(rFont, sKorean)) + if (-1 == rDevice.HasGlyphs(rFont, sKorean)) bKore = true; const sal_Unicode aJapanese[] = { 0x3007, 0x9F9D }; OUString sJapanese(aJapanese, SAL_N_ELEMENTS(aJapanese)); - if (STRING_LEN == rDevice.HasGlyphs(rFont, sJapanese)) + if (-1 == rDevice.HasGlyphs(rFont, sJapanese)) bJpan = true; const sal_Unicode aTraditionalChinese[] = { 0x570B }; OUString sTraditionalChinese(aTraditionalChinese, SAL_N_ELEMENTS(aTraditionalChinese)); - if (STRING_LEN == rDevice.HasGlyphs(rFont, sTraditionalChinese)) + if (-1 == rDevice.HasGlyphs(rFont, sTraditionalChinese)) bHant = true; const sal_Unicode aSimplifiedChinese[] = { 0x56FD }; OUString sSimplifiedChinese(aSimplifiedChinese, SAL_N_ELEMENTS(aSimplifiedChinese)); - if (STRING_LEN == rDevice.HasGlyphs(rFont, sSimplifiedChinese)) + if (-1 == rDevice.HasGlyphs(rFont, sSimplifiedChinese)) bHans = true; if (bKore && !bJpan && !bHans) @@ -1172,7 +1172,7 @@ OUString makeShortRepresentativeTextForSelectedFont(OutputDevice &rDevice) eScript = attemptToDisambiguateHan(eScript, rDevice); OUString sSampleText = makeShortRepresentativeTextForScript(eScript); - bool bHasSampleTextGlyphs = (STRING_LEN == rDevice.HasGlyphs(rDevice.GetFont(), sSampleText)); + bool bHasSampleTextGlyphs = (-1 == rDevice.HasGlyphs(rDevice.GetFont(), sSampleText)); return bHasSampleTextGlyphs ? sSampleText : OUString(); } @@ -1502,7 +1502,7 @@ OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const Font &rFont) OUString sRet(makeRepresentativeTextForLanguage(rFont.GetLanguage())); VirtualDevice aDevice; - if (sRet.isEmpty() || (STRING_LEN != aDevice.HasGlyphs(rFont, sRet))) + if (sRet.isEmpty() || (-1 != aDevice.HasGlyphs(rFont, sRet))) { aDevice.SetFont(rFont); vcl::FontCapabilities aFontCapabilities; @@ -1543,10 +1543,10 @@ OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const Font &rFont) if (nScriptType == com::sun::star::i18n::ScriptType::COMPLEX) { sRet = makeRepresentativeTextForScript(USCRIPT_HEBREW); - if (STRING_LEN != aDevice.HasGlyphs(rFont, sRet)) + if (-1 != aDevice.HasGlyphs(rFont, sRet)) { sRet = makeMinimalTextForScript(USCRIPT_HEBREW); - if (STRING_LEN != aDevice.HasGlyphs(rFont, sRet)) + if (-1 != aDevice.HasGlyphs(rFont, sRet)) sRet = makeRepresentativeTextForScript(USCRIPT_ARABIC); } } diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx index 929af4513486..a2bce6193176 100644 --- a/toolkit/source/awt/vclxfont.cxx +++ b/toolkit/source/awt/vclxfont.cxx @@ -198,7 +198,7 @@ sal_Bool VCLXFont::hasGlyphs( const OUString& aText ) if ( pOutDev ) { OUString aStr( aText ); - if ( pOutDev->HasGlyphs( maFont, aStr, 0, aStr.getLength() ) == STRING_LEN ) + if ( pOutDev->HasGlyphs( maFont, aStr ) == -1 ) { return sal_True; } diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index dc39598df9a8..ff17d68a6acf 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -7710,14 +7710,16 @@ sal_Bool OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const return sal_True; } -xub_StrLen OutputDevice::HasGlyphs( const Font& rTempFont, const OUString& rStr, - xub_StrLen nIndex, xub_StrLen nLen ) const +sal_Int32 OutputDevice::HasGlyphs( const Font& rTempFont, const OUString& rStr, + sal_Int32 nIndex, sal_Int32 nLen ) const { if( nIndex >= rStr.getLength() ) return nIndex; - sal_Int32 nEnd = nIndex + nLen; - if( nIndex+nLen > rStr.getLength() ) + sal_Int32 nEnd; + if( nLen == -1 ) nEnd = rStr.getLength(); + else + nEnd = std::min( rStr.getLength(), nIndex + nLen ); DBG_ASSERT( nIndex < nEnd, "StartPos >= EndPos?" ); DBG_ASSERT( nEnd <= rStr.getLength(), "String too short" ); @@ -7737,7 +7739,7 @@ xub_StrLen OutputDevice::HasGlyphs( const Font& rTempFont, const OUString& rStr, if( ! aFontCharMap.HasChar( rStr[i] ) ) return nIndex; - return STRING_LEN; + return -1; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 1ef62c1d36cb..2aa08ef09fc8 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -441,8 +441,7 @@ bool Window::ImplCheckUIFont( const Font& rFont ) aTestText += aButtonStr; } - const int nFirstChar = HasGlyphs( rFont, aTestText ); - const bool bUIFontOk = (nFirstChar >= aTestText.getLength()); + const bool bUIFontOk = ( HasGlyphs( rFont, aTestText ) == -1 ); return bUIFontOk; } |