[Libreoffice-commits] core.git: 2 commits - include/vcl svtools/source sw/inc toolkit/source vcl/source
Noel Grandin
noel at peralex.com
Wed Dec 4 01:29:49 PST 2013
include/vcl/outdev.hxx | 4 ++--
svtools/source/control/ctrlbox.cxx | 4 ++--
svtools/source/control/scriptedtext.cxx | 2 +-
svtools/source/misc/sampletext.cxx | 20 ++++++++++----------
sw/inc/splargs.hxx | 2 +-
toolkit/source/awt/vclxfont.cxx | 2 +-
vcl/source/gdi/outdev3.cxx | 12 +++++++-----
vcl/source/window/window.cxx | 3 +--
8 files changed, 25 insertions(+), 24 deletions(-)
New commits:
commit a073e81c3acb0c4aa3bc4fde146b6eb9869738e1
Author: Noel Grandin <noel at peralex.com>
Date: Wed Dec 4 11:28:44 2013 +0200
fix SwInterHyphInfo commit
fix for commit eb56848029a3b26a9d4f07a55364749e9e7d8339
"convert SwInterHyphInfo from xub_StrLen->sal_Int32"
Change-Id: I197edf7d5558cd44200f8f04ba29f028fba25639
diff --git a/sw/inc/splargs.hxx b/sw/inc/splargs.hxx
index 0210ad5..9b56a21 100644
--- a/sw/inc/splargs.hxx
+++ b/sw/inc/splargs.hxx
@@ -144,7 +144,7 @@ public:
: aCrsrPos( rCrsrPos ),
bNoLang(sal_False), bCheck(sal_False),
nStart(nStartPos),
- nEnd( std::max(SAL_MAX_INT32, nStartPos + nLength) ),
+ nEnd( nLength == SAL_MAX_INT32 ? SAL_MAX_INT32 : (std::min(SAL_MAX_INT32, nStartPos + nLength)) ),
nWordStart(0), nWordLen(0),
nHyphPos(0), nMinTrail(0)
{ }
commit b273106226ab7e21f68b9e0470e8b28b27f6b726
Author: Noel Grandin <noel at peralex.com>
Date: Wed Dec 4 11:26:19 2013 +0200
convert OutputDevice::HasGlyphs from xub_StrLen->sal_Int32
Change-Id: Ic8f0ae3d263d6cb02e6faa7226db0241681fc45f
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 52b3cde..ff3278b 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 33c15d6..3249308 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 29eab5f..4975c83 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 da0c90c..d74cad4 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 929af45..a2bce61 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 dc39598..ff17d68 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 1ef62c1..2aa08ef 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;
}
More information about the Libreoffice-commits
mailing list