Index: svx/source/customshapes/EnhancedCustomShapeFontWork.cxx =================================================================== RCS file: /cvs/graphics/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx,v retrieving revision 1.7 diff -u -r1.7 EnhancedCustomShapeFontWork.cxx --- svx/source/customshapes/EnhancedCustomShapeFontWork.cxx 21 Feb 2005 16:17:39 -0000 1.7 +++ svx/source/customshapes/EnhancedCustomShapeFontWork.cxx 30 Aug 2005 12:17:22 -0000 @@ -2,9 +2,9 @@ * * $RCSfile: EnhancedCustomShapeFontWork.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.2 $ * - * last change: $Author: vg $ $Date: 2005/02/21 16:17:39 $ + * last change: $Author: alan $ $Date: 2005/07/31 18:24:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -153,9 +153,12 @@ #include #endif +#include + using namespace com::sun::star; using namespace com::sun::star::uno; + typedef std::vector< std::vector< double > > PolyPolygonDistances; struct FWCharacterData // representing a single character @@ -184,6 +187,44 @@ sal_Bool bSingleLineMode; }; +String bidi_reorder (const String& rTxt) +{ + VirtualDevice aVirDev( 1 ); + aVirDev.EnableRTL( sal_True ); + + BOOL bIsRTL = aVirDev.GetTextIsRTL( rTxt, 0, STRING_LEN ); + UBiDiLevel nLevel = bIsRTL ? UBIDI_RTL : UBIDI_LTR; + + // + // Bidi functions from icu 2.0 + // + UErrorCode nError = U_ZERO_ERROR; + UBiDi* pBidi = ubidi_openSized( rTxt.Len(), 0, &nError ); + nError = U_ZERO_ERROR; + + ubidi_setPara( pBidi, rTxt.GetBuffer(), rTxt.Len(), + nLevel, NULL, &nError ); + nError = U_ZERO_ERROR; + long nCount = ubidi_countRuns( pBidi, &nError ); + int32_t nStart = 0; + int32_t nEnd; + int32_t destSize = rTxt.Len() + 1; + UChar *dest = new UChar[destSize]; + memset (dest, 0, sizeof(UChar)*destSize); + uint16_t options = 0; + + for ( USHORT nIdx = 0; nIdx < nCount; ++nIdx ) + { + ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nLevel ); + ubidi_writeReordered(pBidi, dest, destSize, options, &nError); + nStart = nEnd; + } + + ubidi_close( pBidi ); + String *aRet = new String(dest); + delete dest; + return *aRet; +} sal_Bool InitializeFontWorkData( const SdrObject* pCustomShape, const sal_uInt16 nOutlinesCount2d, FWData& rFWData ) { @@ -215,7 +256,11 @@ for ( i = 0; i < nParagraphs; i++ ) { FWParagraphData aParagraphData; +#ifndef WNT + aParagraphData.aString = bidi_reorder (rTextObj.GetText( i )); +#else aParagraphData.aString = rTextObj.GetText( i ); +#endif const SfxItemSet& rParaSet = rTextObj.GetParaAttribs( i ); // retrieving some paragraph attributes aParagraphData.nFrameDirection = ((SvxFrameDirectionItem&)rParaSet.Get( EE_PARA_WRITINGDIR )).GetValue();