View | Details | Raw Unified | Return to issue 17964
Collapse All | Expand All

(-)openoffice-3.4-1240212.orig/main/sw/source/core/txtnode/txtedt.cxx (-13 / +46 lines)
Lines 1915-1938 Link Here
1915
1915
1916
                const sal_uInt32 nExpandBegin = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nStt );
1916
                const sal_uInt32 nExpandBegin = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nStt );
1917
                const sal_uInt32 nExpandEnd   = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nEnd );
1917
                const sal_uInt32 nExpandEnd   = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nEnd );
1918
                aExpandText = aExpandText.copy( nExpandBegin, nExpandEnd - nExpandBegin );
1918
1919
1919
                const bool bCount = aExpandText.getLength() > 0;
1920
                const bool bCount = aExpandText.getLength() > 0;
1920
1921
1921
                // count words in 'regular' text:
1922
                // count words in 'regular' text:
1922
                if( bCount && pBreakIt->GetBreakIter().is() )
1923
                if( bCount && pBreakIt->GetBreakIter().is() )
1923
                {
1924
                {
1924
 -                    const String aScannerText( aExpandText );
1925
                    // split into different script languages
1925
 -                    SwScanner aScanner( *this, aScannerText, 0, pConversionMap,
1926
                    sal_Int32 nScriptBegin = 0;
1926
 -                                        i18n::WordType::WORD_COUNT,
1927
                    while ( nScriptBegin < aExpandText.getLength() )
1927
 -                                        (xub_StrLen)nExpandBegin, (xub_StrLen)nExpandEnd );
1928
 -
1929
 -                    const rtl::OUString aBreakWord( CH_TXTATR_BREAKWORD );
1930
 -
1931
 -                    while ( aScanner.NextWord() )
1932
                    {
1928
                    {
1933
 -                        if ( aScanner.GetLen() > 1 ||
1929
                        const sal_Int16 nCurrScript = pBreakIt->GetBreakIter()->getScriptType( aExpandText, nScriptBegin );
1934
 -                             CH_TXTATR_BREAKWORD != aExpandText.match(aBreakWord, aScanner.GetBegin() ) )
1930
                        const sal_Int32 nScriptEnd = pBreakIt->GetBreakIter()->endOfScript( aExpandText, nScriptBegin, nCurrScript );
1935
 -                            ++nTmpWords;
1931
                        rtl::OUString aScriptText = aExpandText.copy( nScriptBegin, nScriptEnd - nScriptBegin );
1932
                        
1933
                        // Asian languages count words as characters
1934
                        if ( nCurrScript == ::com::sun::star::i18n::ScriptType::ASIAN )
1935
                        {
1936
                            // substract white spaces
1937
                            sal_Int32 nSpaceCount = 0;
1938
                            sal_Int32 nSpacePos = 0;
1939
                            
1940
                            // substract normal white spaces
1941
                            nSpacePos = -1;
1942
                            while ( ( nSpacePos = aScriptText.indexOf( ' ', nSpacePos + 1 ) ) != -1 )
1943
                            {
1944
                                nSpaceCount++;
1945
                            }
1946
                            // substract Asian full-width white spaces
1947
                            nSpacePos = -1;
1948
                            while ( ( nSpacePos = aScriptText.indexOf( 12288, nSpacePos + 1 ) ) != -1 )
1949
                            {
1950
                                nSpaceCount++;
1951
                            }
1952
                            nTmpWords += nScriptEnd - nScriptBegin - nSpaceCount;
1953
                        }
1954
                        else
1955
                        {
1956
                            const String aScannerText( aScriptText );
1957
                            SwScanner aScanner( *this, aScannerText, 0, pConversionMap,
1958
                                                i18n::WordType::WORD_COUNT,
1959
                                                (xub_StrLen)0, (xub_StrLen)aScriptText.getLength() );
1960
1961
                            const rtl::OUString aBreakWord( CH_TXTATR_BREAKWORD );
1962
1963
                            while ( aScanner.NextWord() )
1964
                            {
1965
                                if ( aScanner.GetLen() > 1 ||
1966
                                     CH_TXTATR_BREAKWORD != aScriptText.match(aBreakWord, aScanner.GetBegin() ) )
1967
                                    ++nTmpWords;
1968
                            }
1969
                        }
1970
                        nScriptBegin = nScriptEnd;
1936
                    }
1971
                    }
1937
                }
1972
                }
1938
1973
1939
----BEGIN PGP SIGNATURE-----
1940
----END PGP SIGNATURE-----

Return to issue 17964