Hi,

I need to determine the word at the current (mouse) cursor position. The
code below computes the index of the letter at the current cursor
position:

uno::Reference< XSpellAlternatives >
    SwEditShell::GetCorrection( const Point* pPt, SwRect& rSelectRect )
{
        uno::Reference< XSpellAlternatives >  xSpellAlt;

        if( IsTableMode() )
                return NULL;
        SwPaM* pCrsr = GetCrsr();
        SwPosition aPos( *pCrsr->GetPoint() );
        Point aPt( *pPt );
        SwCrsrMoveState eTmpState( MV_SETONLYTEXT );
        SwTxtNode *pNode;
        SwWrongList *pWrong;
        if( GetLayout()->GetCrsrOfst( &aPos, aPt, &eTmpState ) &&
                0 != (pNode = aPos.nNode.GetNode().GetTxtNode()) &&
                0 != (pWrong = pNode->GetWrong()) &&
                !pNode->IsInProtectSect() )
        {
                xub_StrLen nBegin = aPos.nContent.GetIndex();

But if a text field is underneath the cursor the returned index is
always the position of the whole field. How can I compute the index of
the letter of the text inside the field?

E.g. 
                
test [field text] test      
       /|\
        |
        cursor pos

The cursor is over the letter "e" of the word "field". So I want to know
that the cursor is over the field at position 6 and over the letter "e"
at position 3.


Thanks!

Best regards
-- 
Jakob Lechner
Research & Development
Fabalabs Software GmbH
Honauerstraße 4
A-4020 Linz
Tel.: [+43] (70) 60 61 62
Fax: [+43] (70) 60 61 62-609
E-Mail: [EMAIL PROTECTED]
Web: http://www.fabalabs.org

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  • [sw-discussion... Jakob Lechner
    • Re: [sw-d... Frank Meies - Sun Germany - Development - Software Engineer
      • Re: [... Jakob Lechner
        • R... Frank Meies - Sun Germany - Development - Software Engineer

Reply via email to