Index: svx/source/svdraw/svdfppt.cxx =================================================================== RCS file: /cvs/graphics/svx/source/svdraw/svdfppt.cxx,v retrieving revision 1.141 diff -u -r1.141 svdfppt.cxx --- svx/source/svdraw/svdfppt.cxx 19 Jun 2006 16:37:24 -0000 1.141 +++ svx/source/svdraw/svdfppt.cxx 29 Oct 2006 13:19:28 -0000 @@ -298,6 +298,28 @@ using namespace drawing ; using namespace container ; +// For i37190 +// Unicode Right-to-left Mark +#define RLM 0x200F +#define IS_LATIN(x) (((x >= 'A') && (x <= 'Z')) || ((x >= 'a') && (x <= 'z'))) +#define IS_HEBREW(x) (x >= 0x590) && (x <= 0x5FF) +// European number +#define IS_EN(x) ((x >= '0') && (x <= '9')) + +// European number separator +#define IS_ES(x) ((x == '+') || (x == '-')) + +// Arabic number (to be added) +#define IS_AN FALSE + +// Common number separator + String aCs(RTL_CONSTASCII_USTRINGPARAM("`~!@#$%^&*()_-=+{}[]:;|,.?<>\\\"")); +#define IS_CS(x) (aCs.Search( x, 0 )!= STRING_NOTFOUND) + +// European number terminator +#define IS_ET(x) ((x == '$') || ((x <= 0x20A3) && (x >= 0x20AC))) +#define IS_WEAK(x) (IS_EN(x) || IS_ES(x) || IS_AN(x) || IS_CS(x) || IS_ET(x)) + //////////////////////////////////////////////////////////////////////////////////////////////////// PowerPointImportParam::PowerPointImportParam( SvStream& rDocStrm, sal_uInt32 nFlags, MSFilterTracer* pT ) : @@ -2487,7 +2509,8 @@ const PPTParagraphObj* pPreviousParagraph = NULL; for ( PPTParagraphObj* pPara = pTextObj->First(); pPara; pPara = pTextObj->Next() ) { - UINT32 nTextSize = pPara->GetTextSize(); + // UINT32 nTextSize = pPara->GetTextSize(); + UINT32 nTextSize = pPara->GetTextSizeWithRTLCheck(); if ( ! ( nTextSize & 0xffff0000 ) ) { PPTPortionObj* pPortion; @@ -2520,6 +2543,9 @@ } else memcpy( pDest, pSource, nCharacters << 1 ); + // For i37190 + if (pPortion->mbRTL_endingWeak) + pDest[ nCharacters++ ] = (sal_Unicode)RLM; // Unicode Right-to-Left mark nCurrentIndex += nCharacters; } } @@ -5485,6 +5511,7 @@ PPTCharPropSet ( 0 ), mrStyleSheet ( rStyleSheet ), mnInstance ( nInstance ), + mbRTL_endingWeak ( FALSE ), mnDepth ( ( nDepth > 4 ) ? 4 : nDepth ) { } @@ -5651,7 +5678,7 @@ if ( GetAttrib( PPT_CharAttr_Italic, nVal, nDestinationInstance ) ) rSet.Put( SvxPostureItem( nVal != 0 ? ITALIC_NORMAL : ITALIC_NONE ) ); - + if ( GetAttrib( PPT_CharAttr_Underline, nVal, nDestinationInstance ) ) rSet.Put( SvxUnderlineItem( nVal != 0 ? UNDERLINE_SINGLE : UNDERLINE_NONE ) ); @@ -6433,6 +6460,39 @@ return nRetValue; } +// For i37190 +UINT32 PPTParagraphObj::GetTextSizeWithRTLCheck() +{ + UINT32 nCount, nRetValue = 0; + BOOL b = FALSE; + for ( UINT32 i = 0; i < mnPortionCount; i++ ) + { + PPTPortionObj* pPortionObj = mpPortionList[ i ]; + pPortionObj->mbRTL_endingWeak = FALSE; + + nCount = pPortionObj->Count(); + if ( ( !nCount ) && pPortionObj->mpFieldItem ) + nCount++; + nRetValue += nCount; + // Add RLM at end if necessary + if (i == mnPortionCount - 1) + { + String pNew = pPortionObj->maString.EraseTrailingChars(); // Check the trimmed the string + int nLen = pNew.Len(); + const sal_Unicode *p = pNew.GetBuffer(); + sal_Unicode c = p[nLen -1 ]; + if (!IS_LATIN(c) && + !IS_HEBREW(c) && + (IS_EN(c) || IS_ES(c) || IS_AN(c) || IS_CS(c) || IS_ET(c))) + { + nRetValue++; + pPortionObj->mbRTL_endingWeak = TRUE; + } + } + } + return nRetValue; +} + PPTPortionObj* PPTParagraphObj::First() { mnCurrentObject = 0; Index: svx/inc/svdfppt.hxx =================================================================== RCS file: /cvs/graphics/svx/inc/svdfppt.hxx,v retrieving revision 1.55 diff -u -r1.55 svdfppt.hxx --- svx/inc/svdfppt.hxx 19 Jun 2006 14:43:22 -0000 1.55 +++ svx/inc/svdfppt.hxx 29 Oct 2006 13:19:29 -0000 @@ -1037,6 +1037,7 @@ void ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, UINT32 nInstanceInSheet, const PPTTextObj* pTextObj ); UINT32 Count() const { return ( mpFieldItem ) ? 1 : maString.Len(); }; BOOL HasTabulator(); + BOOL mbRTL_endingWeak; }; class SVX_DLLPUBLIC PPTParagraphObj : public PPTParaPropSet, public PPTNumberFormatCreator, public PPTTextRulerInterpreter @@ -1068,6 +1069,7 @@ ~PPTParagraphObj(); UINT32 GetTextSize(); + UINT32 GetTextSizeWithRTLCheck(); sal_uInt16 GetLevel( sal_uInt32 nMappedInstance ); PPTPortionObj* First(); PPTPortionObj* Next();