You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ha...@apache.org on 2018/01/16 16:17:17 UTC

svn commit: r1821262 - in /openoffice/trunk/main: editeng/source/editeng/ svtools/source/edit/ sw/inc/ sw/source/core/crsr/ sw/source/ui/docvw/ vcl/source/control/ vcl/unx/gtk/window/

Author: hanya
Date: Tue Jan 16 16:17:17 2018
New Revision: 1821262

URL: http://svn.apache.org/viewvc?rev=1821262&view=rev
Log:
#i127662# send better window position to input method for suggestion window

Modified:
    openoffice/trunk/main/editeng/source/editeng/impedit2.cxx
    openoffice/trunk/main/svtools/source/edit/textview.cxx
    openoffice/trunk/main/sw/inc/crsrsh.hxx
    openoffice/trunk/main/sw/source/core/crsr/crsrsh.cxx
    openoffice/trunk/main/sw/source/ui/docvw/edtwin.cxx
    openoffice/trunk/main/vcl/source/control/edit.cxx
    openoffice/trunk/main/vcl/unx/gtk/window/gtkframe.cxx

Modified: openoffice/trunk/main/editeng/source/editeng/impedit2.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/editeng/source/editeng/impedit2.cxx?rev=1821262&r1=1821261&r2=1821262&view=diff
==============================================================================
--- openoffice/trunk/main/editeng/source/editeng/impedit2.cxx (original)
+++ openoffice/trunk/main/editeng/source/editeng/impedit2.cxx Tue Jan 16 16:17:17 2018
@@ -622,7 +622,12 @@ void ImpEditEngine::Command( const Comma
 				nInputEnd = pLine->GetEnd();
 			Rectangle aR2 = PaMtoEditCursor( EditPaM( aPaM.GetNode(), nInputEnd ), GETCRSR_ENDOFLINE );
 			Rectangle aRect = pView->GetImpEditView()->GetWindowPos( aR1 );
-			pView->GetWindow()->SetCursorRect( &aRect, aR2.Left()-aR1.Right() );
+			long nWidth = aR2.Left()-aR1.Right();
+			if ( nWidth == 0 ) {
+				Rectangle aR3 = PaMtoEditCursor( mpIMEInfos->aPos );
+				nWidth = -(aR1.Left() - aR3.Left());
+			}
+			pView->GetWindow()->SetCursorRect( &aRect, nWidth );
 		}
 		else
 		{

Modified: openoffice/trunk/main/svtools/source/edit/textview.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svtools/source/edit/textview.cxx?rev=1821262&r1=1821261&r2=1821262&view=diff
==============================================================================
--- openoffice/trunk/main/svtools/source/edit/textview.cxx (original)
+++ openoffice/trunk/main/svtools/source/edit/textview.cxx Tue Jan 16 16:17:17 2018
@@ -1048,6 +1048,10 @@ void TextView::Command( const CommandEve
 			
 			long nWidth = aR2.Left()-aR1.Right();
 			aR1.Move( -GetStartDocPos().X(), -GetStartDocPos().Y() );
+            if ( nWidth == 0 ) {
+                Rectangle aR3 = mpImpl->mpTextEngine->PaMtoEditCursor( mpImpl->mpTextEngine->mpIMEInfos->aPos );
+                nWidth = -(aR1.Left() - aR3.Left());
+            }
 			GetWindow()->SetCursorRect( &aR1, nWidth );
 		}
 		else

Modified: openoffice/trunk/main/sw/inc/crsrsh.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/crsrsh.hxx?rev=1821262&r1=1821261&r2=1821262&view=diff
==============================================================================
--- openoffice/trunk/main/sw/inc/crsrsh.hxx (original)
+++ openoffice/trunk/main/sw/inc/crsrsh.hxx Tue Jan 16 16:17:17 2018
@@ -550,6 +550,11 @@ public:
      * liefert das SRectangle, auf dem der Cursor steht.
      */
     const SwRect &GetCharRect() const { return aCharRect; }
+    
+    // Obtains character rectangle at the position.
+    sal_Bool GetCharRectAt( SwRect& rOrig, const SwPosition& rPos,
+                                  SwCrsrMoveState *pCMS = 0 ) const;
+    
     /*
      * liefert zurueck, ob der Cursor sich ganz oder teilweise im
      * sichtbaren Bereich befindet.

Modified: openoffice/trunk/main/sw/source/core/crsr/crsrsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/crsr/crsrsh.cxx?rev=1821262&r1=1821261&r2=1821262&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/crsr/crsrsh.cxx (original)
+++ openoffice/trunk/main/sw/source/core/crsr/crsrsh.cxx Tue Jan 16 16:17:17 2018
@@ -1233,6 +1233,14 @@ sal_Bool SwCrsrShell::GoPrevCrsr()
 }
 
 
+sal_Bool SwCrsrShell::GetCharRectAt( SwRect& rOrig, const SwPosition& rPos,
+                                     SwCrsrMoveState* pCMS ) const
+{
+    SwCntntFrm * pFrm = GetCurrFrm();
+    return pFrm ? pFrm->GetCharRect( rOrig, rPos, pCMS ) : sal_False;
+}
+
+
 void SwCrsrShell::Paint( const Rectangle &rRect)
 {
 	SET_CURR_SHELL( this );

Modified: openoffice/trunk/main/sw/source/ui/docvw/edtwin.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/docvw/edtwin.cxx?rev=1821262&r1=1821261&r2=1821262&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/docvw/edtwin.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/docvw/edtwin.cxx Tue Jan 16 16:17:17 2018
@@ -5059,8 +5059,40 @@ void SwEditWin::Command( const CommandEv
     }
     break;
     case COMMAND_CURSORPOS:
-        // will be handled by the base class
-        break;
+    {
+        sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
+                              rSh.IsCrsrReadonly();
+        if ( !bIsDocReadOnly )
+        {
+            if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
+            {
+                bCallBase = sal_False;
+                rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
+            }
+            else
+            {
+                const SwExtTextInput* pExtInp = rSh.GetDoc()->GetExtTextInput();
+                if ( pExtInp )
+                {
+                    // The carret placed at the end of the preedit.
+                    if ( POS_COLLIDE_START == ComparePosition( *pExtInp->End(), *pExtInp->End(),
+                                        *rSh.GetCrsr()->End(), *rSh.GetCrsr()->End() ) )
+                    {
+                        SwRect aInputRect;
+                        if ( rSh.GetCharRectAt( aInputRect, *pExtInp->Start() ) )
+                        {
+                            Rectangle aRect( aInputRect.SVRect() );
+                            SetCursorRect( &aRect, 1 );
+                            bCallBase = sal_False;
+                        }
+                    }
+                    if ( bCallBase )
+                        SetCursorRect();
+                }
+            }
+        }
+    }
+    break;
 
     case COMMAND_PASTESELECTION:
         if( !rView.GetDocShell()->IsReadOnly() )

Modified: openoffice/trunk/main/vcl/source/control/edit.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/source/control/edit.cxx?rev=1821262&r1=1821261&r2=1821262&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/source/control/edit.cxx (original)
+++ openoffice/trunk/main/vcl/source/control/edit.cxx Tue Jan 16 16:17:17 2018
@@ -2313,8 +2313,11 @@ void Edit::Command( const CommandEvent&
 		if ( mpIMEInfos )
 		{
 			xub_StrLen nCursorPos = (sal_uInt16)GetSelection().Max();
-			SetCursorRect( NULL, GetTextWidth(
-				maText, nCursorPos, mpIMEInfos->nPos+mpIMEInfos->nLen-nCursorPos ) );
+			long nWidth = GetTextWidth( maText, mpIMEInfos->nPos, mpIMEInfos->nLen );
+			if ( nCursorPos == ( mpIMEInfos->nPos + mpIMEInfos->nLen ) ) {
+				nWidth = -nWidth;
+			}
+			SetCursorRect( NULL, nWidth );
 		}
 		else
 		{

Modified: openoffice/trunk/main/vcl/unx/gtk/window/gtkframe.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/unx/gtk/window/gtkframe.cxx?rev=1821262&r1=1821261&r2=1821262&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/unx/gtk/window/gtkframe.cxx (original)
+++ openoffice/trunk/main/vcl/unx/gtk/window/gtkframe.cxx Tue Jan 16 16:17:17 2018
@@ -3344,7 +3344,9 @@ void GtkSalFrame::IMHandler::updateIMSpo
     SalExtTextInputPosEvent aPosEvent;
     m_pFrame->CallCallback( SALEVENT_EXTTEXTINPUTPOS, (void*)&aPosEvent );
     GdkRectangle aArea;
-    aArea.x = aPosEvent.mnX;
+    // Positive aPosEvent.mnExtWidth means ahead of the carret, 
+    // negative value means behind of the carret.
+    aArea.x = aPosEvent.mnX + (aPosEvent.mnExtWidth < 0 ? aPosEvent.mnExtWidth : 0);
     aArea.y = aPosEvent.mnY;
     aArea.width = aPosEvent.mnWidth;
     aArea.height = aPosEvent.mnHeight;