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

(-)inc/scriptinfo.hxx (+1 lines)
Lines 114-119 Link Here
114
    BYTE nDefaultDir;
114
    BYTE nDefaultDir;
115
115
116
    void UpdateBidiInfo( const String& rTxt );
116
    void UpdateBidiInfo( const String& rTxt );
117
	bool HasStrongLTR ( const String& rTxt, xub_StrLen nDirIdx ); 
117
118
118
public:
119
public:
119
    enum CompType { KANA, SPECIAL_LEFT, SPECIAL_RIGHT, NONE };
120
    enum CompType { KANA, SPECIAL_LEFT, SPECIAL_RIGHT, NONE };
(-)text/porfld.cxx (+17 lines)
Lines 262-267 Link Here
262
            ubidi_close( pBidi );
262
            ubidi_close( pBidi );
263
            const xub_StrLen nNextDirChg = (xub_StrLen)nEnd;
263
            const xub_StrLen nNextDirChg = (xub_StrLen)nEnd;
264
            nNextScriptChg = Min( nNextScriptChg, nNextDirChg );
264
            nNextScriptChg = Min( nNextScriptChg, nNextDirChg );
265
			// #i89825# change the script type also to CTL 
266
			// if there is no strong LTR char in the LTR run (numbers)
267
			if ( nCurrDir != UBIDI_RTL )
268
			{
269
				nCurrDir = UBIDI_RTL;
270
				for ( xub_StrLen nCharIdx = 0; nCharIdx < nEnd; ++nCharIdx )
271
				{
272
					UCharDirection nCharDir = u_charDirection ( aTxt.GetChar ( nCharIdx ));
273
					if ( nCharDir == U_LEFT_TO_RIGHT || 
274
						nCharDir==U_LEFT_TO_RIGHT_EMBEDDING ||
275
							nCharDir == U_LEFT_TO_RIGHT_OVERRIDE )
276
					{
277
						nCurrDir = UBIDI_LTR;
278
						break;
279
					}
280
				}
281
			}
265
            if ( nCurrDir == UBIDI_RTL )
282
            if ( nCurrDir == UBIDI_RTL )
266
                nTmp = SW_CTL;
283
                nTmp = SW_CTL;
267
        }
284
        }
(-)text/porlay.cxx (-1 / +25 lines)
Lines 76-81 Link Here
76
76
77
//#ifdef BIDI
77
//#ifdef BIDI
78
#include <unicode/ubidi.h>
78
#include <unicode/ubidi.h>
79
#include <unicode/uchar.h>
80
79
81
80
sal_Bool isAlefChar ( xub_Unicode cCh )
82
sal_Bool isAlefChar ( xub_Unicode cCh )
81
{
83
{
Lines 1263-1269 Link Here
1263
        // #i16354# Change script type for RTL text to CTL.
1265
        // #i16354# Change script type for RTL text to CTL.
1264
        for ( USHORT nDirIdx = 0; nDirIdx < aDirChg.Count(); ++nDirIdx )
1266
        for ( USHORT nDirIdx = 0; nDirIdx < aDirChg.Count(); ++nDirIdx )
1265
        {
1267
        {
1266
            if ( GetDirType( nDirIdx ) == UBIDI_RTL )
1268
            if ( GetDirType( nDirIdx ) == UBIDI_RTL  ||
1269
			// #i89825# change the script type also to CTL 
1270
			// if there is no strong LTR char in the LTR run (numbers)
1271
				( !HasStrongLTR ( rTxt, nDirIdx ) && ( nDirIdx || nDefaultDir == UBIDI_RTL )))
1267
            {
1272
            {
1268
                // nStart ist start of RTL run:
1273
                // nStart ist start of RTL run:
1269
                const xub_StrLen nStart = nDirIdx > 0 ? GetDirChg( nDirIdx - 1 ) : 0;
1274
                const xub_StrLen nStart = nDirIdx > 0 ? GetDirChg( nDirIdx - 1 ) : 0;
Lines 1328-1333 Link Here
1328
    }
1333
    }
1329
}
1334
}
1330
1335
1336
bool SwScriptInfo::HasStrongLTR ( const String& rTxt, xub_StrLen nDirIdx )
1337
{
1338
	// nStart is start of run:
1339
    const xub_StrLen nStart = nDirIdx > 0 ? GetDirChg( nDirIdx - 1 ) : 0;
1340
    // nEnd is end of run:
1341
    const xub_StrLen nEnd = GetDirChg( nDirIdx );
1342
                
1343
	for ( xub_StrLen nCharIdx = nStart; nCharIdx < nEnd; ++nCharIdx )
1344
	{
1345
		UCharDirection nCharDir = u_charDirection ( rTxt.GetChar ( nCharIdx ));
1346
1347
		if ( nCharDir == U_LEFT_TO_RIGHT || 
1348
			   nCharDir==U_LEFT_TO_RIGHT_EMBEDDING ||
1349
				 nCharDir == U_LEFT_TO_RIGHT_OVERRIDE )
1350
			return true;
1351
	}
1352
	return false;
1353
}
1354
1331
void SwScriptInfo::UpdateBidiInfo( const String& rTxt )
1355
void SwScriptInfo::UpdateBidiInfo( const String& rTxt )
1332
{
1356
{
1333
    // remove invalid entries from direction information arrays
1357
    // remove invalid entries from direction information arrays

Return to issue 89825