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

(-)sc/source/core/tool/interpr1.cxx (+6 lines)
Lines 81-86 Link Here
81
ScErrorStack* ScInterpreter::pGlobalErrorStack = NULL;
81
ScErrorStack* ScInterpreter::pGlobalErrorStack = NULL;
82
BOOL ScInterpreter::bGlobalStackInUse = FALSE;
82
BOOL ScInterpreter::bGlobalStackInUse = FALSE;
83
83
84
SvxCellHorJustify ContentJust(const String& aStr);
84
85
85
//-----------------------------------------------------------------------------
86
//-----------------------------------------------------------------------------
86
// Funktionen
87
// Funktionen
Lines 1748-1753 Link Here
1748
					switch( pJustAttr->GetValue() )
1749
					switch( pJustAttr->GetValue() )
1749
					{
1750
					{
1750
						case SVX_HOR_JUSTIFY_STANDARD:
1751
						case SVX_HOR_JUSTIFY_STANDARD:
1752
							if (ContentJust(pCell->GetStringData()) == SVX_HOR_JUSTIFY_RIGHT)
1753
								aResult = '"';
1754
							else
1755
								aResult = '\'';	
1756
							break;
1751
						case SVX_HOR_JUSTIFY_LEFT:
1757
						case SVX_HOR_JUSTIFY_LEFT:
1752
						case SVX_HOR_JUSTIFY_BLOCK:		aResult = '\'';	break;
1758
						case SVX_HOR_JUSTIFY_BLOCK:		aResult = '\'';	break;
1753
						case SVX_HOR_JUSTIFY_CENTER:	aResult = '^';	break;
1759
						case SVX_HOR_JUSTIFY_CENTER:	aResult = '^';	break;
(-)sc/source/filter/excel/excel.cxx (-1 / +17 lines)
Lines 81-87 Link Here
81
#include "imp_op.hxx"
81
#include "imp_op.hxx"
82
#include "excimp8.hxx"
82
#include "excimp8.hxx"
83
#include "exp_op.hxx"
83
#include "exp_op.hxx"
84
84
#include <svx/frmdiritem.hxx>
85
85
86
FltError ScImportExcel( SfxMedium& r, ScDocument* p )
86
FltError ScImportExcel( SfxMedium& r, ScDocument* p )
87
{
87
{
Lines 191-198 Link Here
191
        }
191
        }
192
192
193
        eRet = xFilter.get() ? xFilter->Read() : eERR_INTERN;
193
        eRet = xFilter.get() ? xFilter->Read() : eERR_INTERN;
194
		/* For i37905: : 
195
		During import, create an array of text cells whose text dir should be modified to LTR. This is necessary if:
196
			a) there is Hebrew in the text
197
			b) the first letter of the text is not Hebrew
198
			Here we can go through the textCells, and if the text direction is "ENVIRONMENT" set it to LTR */
199
		for( ScAddress* pAddr = xFilter->CellIDList.First(); pAddr; pAddr = xFilter->CellIDList.Next() )
200
		{
201
				const SvxFrameDirectionItem* pItem = static_cast< const SvxFrameDirectionItem* >(
202
					pDocument->GetAttr( pAddr->Col(), pAddr->Row(), pAddr->Tab(), ATTR_WRITINGDIR ) );
203
				SvxFrameDirection eCellDir = (SvxFrameDirection)pItem->GetValue();
204
				if (eCellDir == FRMDIR_ENVIRONMENT)
205
					pDocument->ApplyAttr( pAddr->Col(), pAddr->Row(), pAddr->Tab(),
206
						SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, ATTR_WRITINGDIR ) );
207
		}
208
194
    }
209
    }
195
210
211
196
    return eRet;
212
    return eRet;
197
}
213
}
198
214
(-)sc/source/filter/excel/excimp8.cxx (-4 / +30 lines)
Lines 66-71 Link Here
66
#include <svx/flditem.hxx>
66
#include <svx/flditem.hxx>
67
#include <svx/xflclit.hxx>
67
#include <svx/xflclit.hxx>
68
#include <svx/svxmsbas.hxx>
68
#include <svx/svxmsbas.hxx>
69
#include <svx/algitem.hxx>
69
70
70
#include <vcl/graph.hxx>
71
#include <vcl/graph.hxx>
71
#include <vcl/bmpacc.hxx>
72
#include <vcl/bmpacc.hxx>
Lines 283-292 Link Here
283
    ScAddress aScPos( ScAddress::UNINITIALIZED );
284
    ScAddress aScPos( ScAddress::UNINITIALIZED );
284
    if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
285
    if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
285
	{
286
	{
286
        GetXFRangeBuffer().SetXF( aScPos, nXF );
287
		GetXFRangeBuffer().SetXF( aScPos, nXF );
287
        pColRowBuff->Used( aScPos );
288
		pColRowBuff->Used( aScPos );
288
        if( ScBaseCell* pCell = GetSst().CreateCell( nSst, nXF ) )
289
		if( ScBaseCell* pCell = GetSst().CreateCell( nSst, nXF ) )
289
            GetDoc().PutCell( aScPos.Col(), aScPos.Row(), aScPos.Tab(), pCell );
290
		{
291
		    GetDoc().PutCell( aScPos.Col(), aScPos.Row(), aScPos.Tab(), pCell );
292
293
		// For i37905 : 
294
		// If a) text contains Hebrew b) first letter is not Hebrew,
295
		// add the cell position to a list. 
296
		// Check after import if text dir is "ENVIRONMENT". If so, change its direction to LTR.
297
298
			#define IS_HEBREW(x) (x >= 0x590) && (x <= 0x5FF)
299
300
			const sal_Unicode *p = pCell->GetStringData().GetBuffer();
301
			BOOL bFirstCharHebrew = IS_HEBREW(*p);
302
			BOOL bHasHebrew = bFirstCharHebrew;
303
			for (int i = 1; (i < pCell->GetStringData().Len()) && (!bHasHebrew); i++)
304
			{
305
				p++;
306
				if (IS_HEBREW(*p))
307
						bHasHebrew = TRUE;
308
			}
309
			BOOL bAddToList = bHasHebrew && !bFirstCharHebrew;
310
			if (bAddToList)
311
			{
312
				ScAddress* aScPosCopy = new ScAddress(aScPos);
313
				CellIDList.Append( aScPosCopy );
314
			}
315
		}
290
	}
316
	}
291
}
317
}
292
318
(-)sc/source/filter/inc/imp_op.hxx (-1 / +4 lines)
Lines 70-76 Link Here
70
#include "excdefs.hxx"
70
#include "excdefs.hxx"
71
#endif
71
#endif
72
72
73
74
class SfxItemSet;
73
class SfxItemSet;
75
class SvStream;
74
class SvStream;
76
75
Lines 85-90 Link Here
85
class ValueFormBuffer;
84
class ValueFormBuffer;
86
class ExcelToSc;
85
class ExcelToSc;
87
86
87
typedef ScfDelList< ScAddress >     XclBaseScAddressList;
88
88
89
89
class ImportTyp
90
class ImportTyp
90
{
91
{
Lines 271-276 Link Here
271
	virtual					~ImportExcel( void );
272
	virtual					~ImportExcel( void );
272
273
273
	virtual FltError		Read( void );
274
	virtual FltError		Read( void );
275
276
	XclBaseScAddressList	CellIDList;
274
};
277
};
275
278
276
#endif
279
#endif
(-)sc/source/ui/view/output2.cxx (-4 / +15 lines)
Lines 1217-1222 Link Here
1217
#endif
1217
#endif
1218
}
1218
}
1219
1219
1220
SvxCellHorJustify ContentJust(const String& aStr)
1221
{
1222
	const sal_Unicode *p = aStr.GetBuffer();
1223
	BOOL bHebrew = ((*p >= 0x590) && (*p <= 0x5FF)) ;
1224
	return bHebrew ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT;
1225
}
1226
1227
1220
void ScOutputData::DrawStrings( BOOL bPixelToLogic )
1228
void ScOutputData::DrawStrings( BOOL bPixelToLogic )
1221
{
1229
{
1222
	DBG_ASSERT( pDev == pRefDevice ||
1230
	DBG_ASSERT( pDev == pRefDevice ||
Lines 1437-1443 Link Here
1437
1445
1438
					eOutHorJust = ( aVars.GetHorJust() != SVX_HOR_JUSTIFY_STANDARD ) ?
1446
					eOutHorJust = ( aVars.GetHorJust() != SVX_HOR_JUSTIFY_STANDARD ) ?
1439
								  aVars.GetHorJust() :
1447
								  aVars.GetHorJust() :
1440
								  ( bCellIsValue ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT );
1448
								  ( bCellIsValue ? SVX_HOR_JUSTIFY_RIGHT : ContentJust(pCell->GetStringData()));
1441
1449
1442
					if ( eOutHorJust == SVX_HOR_JUSTIFY_BLOCK || eOutHorJust == SVX_HOR_JUSTIFY_REPEAT )
1450
					if ( eOutHorJust == SVX_HOR_JUSTIFY_BLOCK || eOutHorJust == SVX_HOR_JUSTIFY_REPEAT )
1443
						eOutHorJust = SVX_HOR_JUSTIFY_LEFT;		// repeat is not yet implemented
1451
						eOutHorJust = SVX_HOR_JUSTIFY_LEFT;		// repeat is not yet implemented
Lines 2162-2168 Link Here
2162
2170
2163
						SvxCellHorJustify eOutHorJust =
2171
						SvxCellHorJustify eOutHorJust =
2164
							( eHorJust != SVX_HOR_JUSTIFY_STANDARD ) ? eHorJust :
2172
							( eHorJust != SVX_HOR_JUSTIFY_STANDARD ) ? eHorJust :
2165
							( bCellIsValue ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT );
2173
							( bCellIsValue ? SVX_HOR_JUSTIFY_RIGHT : ContentJust(pCell->GetStringData()));
2166
2174
2167
						if ( eOutHorJust == SVX_HOR_JUSTIFY_BLOCK || eOutHorJust == SVX_HOR_JUSTIFY_REPEAT )
2175
						if ( eOutHorJust == SVX_HOR_JUSTIFY_BLOCK || eOutHorJust == SVX_HOR_JUSTIFY_REPEAT )
2168
							eOutHorJust = SVX_HOR_JUSTIFY_LEFT;		// repeat is not yet implemented
2176
							eOutHorJust = SVX_HOR_JUSTIFY_LEFT;		// repeat is not yet implemented
Lines 2308-2314 Link Here
2308
									switch (eHorJust)
2316
									switch (eHorJust)
2309
									{
2317
									{
2310
										case SVX_HOR_JUSTIFY_STANDARD:
2318
										case SVX_HOR_JUSTIFY_STANDARD:
2311
											eSvxAdjust = bCellIsValue ? SVX_ADJUST_RIGHT : SVX_ADJUST_LEFT;
2319
											eSvxAdjust = (bCellIsValue || (ContentJust(pCell->GetStringData()) == SVX_HOR_JUSTIFY_RIGHT)) 
2320
													? SVX_ADJUST_RIGHT : SVX_ADJUST_LEFT;
2312
											break;
2321
											break;
2313
										case SVX_HOR_JUSTIFY_LEFT:
2322
										case SVX_HOR_JUSTIFY_LEFT:
2314
										case SVX_HOR_JUSTIFY_REPEAT:			// nicht implementiert
2323
										case SVX_HOR_JUSTIFY_REPEAT:			// nicht implementiert
Lines 3494-3500 Link Here
3494
									else
3503
									else
3495
									{
3504
									{
3496
										//	bei gedrehtem Text ist Standard zentriert
3505
										//	bei gedrehtem Text ist Standard zentriert
3497
										if (eHorJust==SVX_HOR_JUSTIFY_RIGHT)
3506
										if ((eHorJust==SVX_HOR_JUSTIFY_RIGHT) ||
3507
											((eHorJust==SVX_HOR_JUSTIFY_STANDARD) && 
3508
												(ContentJust(pCell->GetStringData()) == SVX_HOR_JUSTIFY_RIGHT)))
3498
											aLogicStart.X() += nAvailWidth - nEngineWidth;
3509
											aLogicStart.X() += nAvailWidth - nEngineWidth;
3499
										else if (eHorJust==SVX_HOR_JUSTIFY_CENTER ||
3510
										else if (eHorJust==SVX_HOR_JUSTIFY_CENTER ||
3500
												 eHorJust==SVX_HOR_JUSTIFY_STANDARD)
3511
												 eHorJust==SVX_HOR_JUSTIFY_STANDARD)

Return to issue 37905