Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > cd8ce32c919af60229fca1d7f792c60e > files > 20

openoffice.org-3.2.0-12.35.fc13.src.rpm

Index: source/core/text/frmcrsr.cxx
===================================================================
RCS file: /cvs/sw/sw/source/core/text/frmcrsr.cxx,v
retrieving revision 1.42
diff -u -r1.42 frmcrsr.cxx
--- openoffice.org.orig/sw/source/core/text/frmcrsr.cxx	16 Sep 2006 21:33:39 -0000	1.42
+++ openoffice.org/sw/source/core/text/frmcrsr.cxx	5 Feb 2007 13:42:51 -0000
@@ -60,6 +60,10 @@
 #include "swfntcch.hxx"		// SwFontAccess
 #include "flyfrm.hxx"
 
+#include <com/sun/star/i18n/ScriptType.hdl>
+#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
+#include "breakit.hxx"
+
 #if OSL_DEBUG_LEVEL > 1
 #include "txtpaint.hxx"
 #endif
@@ -289,7 +293,33 @@
             nMaxY = pFrm->SwitchVerticalToHorizontal( nMaxY );
 
         sal_Bool bGoOn = sal_True;
-		xub_StrLen nOffset = rPos.nContent.GetIndex();
+        xub_StrLen nOffset = rPos.nContent.GetIndex();
+
+        // #i74188 Ensure that the cursor is not drawn inside a combined char
+        const SwTxtNode* pTxtNd = ((const SwTxtFrm*)this)->GetTxtNode();
+        if( pTxtNd && ::com::sun::star::i18n::ScriptType::COMPLEX == 
+            pBreakIt->GetBreakIter()->getScriptType( pTxtNd->GetTxt(), nOffset ) )
+        {
+            sal_Int32 nCount = 1;
+            const ::com::sun::star::lang::Locale &rLocale = 
+                pBreakIt->GetLocale( pTxtNd->GetLang( nOffset ) );
+            xub_StrLen nRight = (xub_StrLen)pBreakIt->GetBreakIter()->nextCharacters( 
+                pTxtNd->GetTxt(), nOffset, rLocale,
+                ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 
+                nCount, nCount );
+
+            xub_StrLen nLeft = (xub_StrLen)pBreakIt->GetBreakIter()->previousCharacters(
+                pTxtNd->GetTxt(), nRight, rLocale, 
+                ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 
+                nCount, nCount );
+
+            if ( ( nLeft != nOffset ) && ( nRight != nOffset ) )
+            {
+                nOffset = ( Abs( nRight - nOffset ) < Abs( nLeft - nOffset ) ) ?
+                    nRight : nLeft;
+            }
+        }
+
 		xub_StrLen nNextOfst;
 
 		do