diff options
author | Yohei Yukawa <yukawa@google.com> | 2013-05-06 14:20:11 +0900 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-05-13 05:14:37 +0000 |
commit | 57b5ed51d46fd5673dfe35125ceffa71d39f133d (patch) | |
tree | c6dcc9991647a7869451a15ba436cb7443f1dc06 /editeng | |
parent | Typo (diff) | |
download | core-57b5ed51d46fd5673dfe35125ceffa71d39f133d.tar.gz core-57b5ed51d46fd5673dfe35125ceffa71d39f133d.zip |
Support IMR_QUERYCHARPOSITION in Writer and Calc.
IMR_QUERYCHARPOSITION is one of optional but fundamental request
message sent from IMEs to application. This message is used for
retrieving the positional information for each character in a
composition text especially when the composition text is drawn
by the application.
This information is critical for IMEs to align suggestion window
with the composition text.
Change-Id: I53a344a78688060004cc8bcbbf1127f22a468e20
Reviewed-on: https://gerrit.libreoffice.org/3849
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Tor Lillqvist <tml@iki.fi>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 8934bf8af0ae..b46b23cf72ef 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -537,6 +537,33 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) } } } + else if ( rCEvt.GetCommand() == COMMAND_QUERYCHARPOSITION ) + { + if ( mpIMEInfos && mpIMEInfos->nLen ) + { + EditPaM aPaM( pView->pImpEditView->GetEditSelection().Max() ); + if ( !IsFormatted() ) + FormatDoc(); + + ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( GetEditDoc().GetPos( aPaM.GetNode() ) ); + sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_True ); + const EditLine* pLine = pParaPortion->GetLines()[nLine]; + if ( pLine ) + { + Rectangle* aRects = new Rectangle[ mpIMEInfos->nLen ]; + for (sal_uInt16 i = 0; i < mpIMEInfos->nLen; ++i) + { + sal_uInt16 nInputPos = mpIMEInfos->aPos.GetIndex() + i; + if ( nInputPos > pLine->GetEnd() ) + nInputPos = pLine->GetEnd(); + Rectangle aR2 = GetEditCursor( pParaPortion, nInputPos ); + aRects[ i ] = pView->GetImpEditView()->GetWindowPos( aR2 ); + } + pView->GetWindow()->SetCompositionCharRect( aRects, mpIMEInfos->nLen ); + delete[] aRects; + } + } + } GetSelEngine().Command( rCEvt ); } |