textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutmultilineicfeditor.cpp
branchRCL_3
changeset 12 5e18d8c489d6
parent 11 c8fb4cf7b3ae
child 13 1bbdde98cc2d
equal deleted inserted replaced
11:c8fb4cf7b3ae 12:5e18d8c489d6
   343         }
   343         }
   344     }
   344     }
   345 
   345 
   346 void CFepLayoutMultiLineIcfEditor::RecalculatePosByNewPromptTextL(const TDesC& aNewPromptText)
   346 void CFepLayoutMultiLineIcfEditor::RecalculatePosByNewPromptTextL(const TDesC& aNewPromptText)
   347     {
   347     {
   348     // recalculate cursor pos
       
   349     AdjustSelectionL(TCursorSelection(iTextView->Selection().iCursorPos + aNewPromptText.Length() - iPromptTextLen,
   348     AdjustSelectionL(TCursorSelection(iTextView->Selection().iCursorPos + aNewPromptText.Length() - iPromptTextLen,
   350                      iTextView->Selection().iAnchorPos + aNewPromptText.Length() - iPromptTextLen));
   349                      iTextView->Selection().iAnchorPos + aNewPromptText.Length() - iPromptTextLen));
   351 
   350 
   352     // set new cursor position    
   351     // set new cursor position    
   353 
   352 
   355     iPreInlineEndPos += (aNewPromptText.Length() - iPromptTextLen);
   354     iPreInlineEndPos += (aNewPromptText.Length() - iPromptTextLen);
   356     iPreAutoStartPos += (aNewPromptText.Length() - iPromptTextLen);
   355     iPreAutoStartPos += (aNewPromptText.Length() - iPromptTextLen);
   357     iPreAutoEndPos += (aNewPromptText.Length() - iPromptTextLen);
   356     iPreAutoEndPos += (aNewPromptText.Length() - iPromptTextLen);
   358     iPreTextSelStartPos += (aNewPromptText.Length() - iPromptTextLen);
   357     iPreTextSelStartPos += (aNewPromptText.Length() - iPromptTextLen);
   359     iPreTextSelEndPos += (aNewPromptText.Length() - iPromptTextLen);
   358     iPreTextSelEndPos += (aNewPromptText.Length() - iPromptTextLen);
   360 
       
   361     }
   359     }
   362 
   360 
   363 const HBufC* CFepLayoutMultiLineIcfEditor::PromptText()
   361 const HBufC* CFepLayoutMultiLineIcfEditor::PromptText()
   364 	{
   362 	{
   365 	return iPromptText;	
   363 	return iPromptText;	
   366 	}
   364 	}
   367 	
   365 	
   368 void CFepLayoutMultiLineIcfEditor::SetPromptTextL(const TDesC& aPromptText, TBool aCleanContent)
   366 void CFepLayoutMultiLineIcfEditor::SetPromptTextL(const TDesC& aPromptText, TBool aCleanContent)
   369     {
   367     {
   370     
       
   371     if ( aCleanContent )
   368     if ( aCleanContent )
   372     	{
   369     	{
   373     	//clean all the content (include prompt text) on the ICF
   370     	//clean all the content (include prompt text) on the ICF
   374         TInt length = iRichText->DocumentLength();
   371         TInt length = iRichText->DocumentLength();
   375         iRichText->DeleteL( 0,  length);
   372         iRichText->DeleteL( 0,  length);
   377     	iTextView->SetSelectionL( TCursorSelection(0, 0) );
   374     	iTextView->SetSelectionL( TCursorSelection(0, 0) );
   378     	iCursorSel = TCursorSelection(0, 0);
   375     	iCursorSel = TCursorSelection(0, 0);
   379         iNoMatchState = EFalse;
   376         iNoMatchState = EFalse;
   380     	}
   377     	}
   381     else 
   378     else 
   382         {
   379         {   
   383         /*if ( ( ( !iInitPromptText && aPromptText.Length() == 0 ) )|| 
   380         if ( ( ( !iInitPromptText && aPromptText.Length() == 0 ) )|| 
   384             ( iInitPromptText && *iInitPromptText == aPromptText && 
   381             ( iInitPromptText && *iInitPromptText == aPromptText && 
   385             iPromptText && TextWidth(*iPromptText) <= iViewRect.Width()) )
   382             iPromptText && TextWidth(*iPromptText) <= iViewRect.Width()) )
   386     	    {
   383     	    {
   387     	    //prompt text has not been change then need not to be reset
   384     	    //prompt text has not been change then need not to be reset
   388     	    //but iLineSeparator may be changed, need reset prompt text
   385     	    //but iLineSeparator may be changed, need reset prompt text
   389     	    return;
   386             TBool newLineSeparator = iLineSeparator;
   390             }*/
   387             if ( !iLineSeparator )
       
   388                 {
       
   389                 newLineSeparator = ( TBidiText::TextDirectionality( aPromptText )
       
   390                                                      == TBidiText:: ERightToLeft );
       
   391                 }
       
   392             if ( newLineSeparator == iLineSeparator )
       
   393                 {
       
   394                 return;
       
   395                 }
       
   396             }
   391         //prompt text need to be reset and not clean the content
   397         //prompt text need to be reset and not clean the content
   392         iRichText->DeleteL( 0,  iPromptTextLen );
   398         iRichText->DeleteL( 0,  iPromptTextLen );
   393         iTextView->HandleInsertDeleteL(TCursorSelection(0, 0), iPromptTextLen );
   399         iTextView->HandleInsertDeleteL(TCursorSelection(0, 0), iPromptTextLen );
   394         }
   400         }
   395     
   401     
   547                 {
   553                 {
   548                 TInt delLen = iRichText->DocumentLength() - iPromptTextLen;
   554                 TInt delLen = iRichText->DocumentLength() - iPromptTextLen;
   549                 iRichText->DeleteL(iPromptTextLen, delLen );
   555                 iRichText->DeleteL(iPromptTextLen, delLen );
   550                 iTextView->HandleInsertDeleteL(TCursorSelection(iPromptTextLen, iPromptTextLen), 
   556                 iTextView->HandleInsertDeleteL(TCursorSelection(iPromptTextLen, iPromptTextLen), 
   551                                                delLen);
   557                                                delLen);
       
   558                 iTextView->SetSelectionL(TCursorSelection(iPromptTextLen, iPromptTextLen));
   552                 }
   559                 }
   553             ptr.Copy(icfdata.iText);
   560             ptr.Copy(icfdata.iText);
   554             }
   561             }
   555             break;
   562             break;
   556         case EPeninputICFReplace:
   563         case EPeninputICFReplace:
  1633     TPoint leftTop = TPoint(Rect().iBr.iX-iInfoBubble->Rect().Width(),Rect().iTl.iY);
  1640     TPoint leftTop = TPoint(Rect().iBr.iX-iInfoBubble->Rect().Width(),Rect().iTl.iY);
  1634     iInfoBubble->SetRect( TRect(leftTop,aSize) ) ;        
  1641     iInfoBubble->SetRect( TRect(leftTop,aSize) ) ;        
  1635     }
  1642     }
  1636 
  1643 
  1637 void CFepLayoutMultiLineIcfEditor::ShowTooltipL( const TDesC& aText, 
  1644 void CFepLayoutMultiLineIcfEditor::ShowTooltipL( const TDesC& aText, 
  1638 		                                         const TRect& aRect )
  1645 		                                         const TRect& aRect,
       
  1646 		                                         TInt aLangCode )
  1639 	{
  1647 	{
  1640 	if ( !iTooltip )
  1648 	if ( !iTooltip )
  1641 	    {
  1649 	    {
  1642 	    return;
  1650 	    return;
  1643 	    }
  1651 	    }
  1644 
  1652 
  1645     iTooltip->SetTextL( aText );
  1653     iTooltip->SetTextL( aText );
       
  1654     iTooltip->SetLangCode( aLangCode );
  1646     TPoint tl( 0, 0 ), br( 0, 0 );
  1655     TPoint tl( 0, 0 ), br( 0, 0 );
  1647     InlineTextPos( tl, br );    
  1656     InlineTextPos( tl, br );    
  1648     
  1657     
  1649     if ( iLineMaxCount > 1 )
  1658     if ( iLineMaxCount > 1 )
  1650 	    {
  1659 	    {
  1683 	    	{
  1692 	    	{
  1684 	    	tooltipRect.iBr.iX += moveX;
  1693 	    	tooltipRect.iBr.iX += moveX;
  1685 	    	tooltipRect.iTl.iX += moveX;
  1694 	    	tooltipRect.iTl.iX += moveX;
  1686 	    	}
  1695 	    	}
  1687 	    }		
  1696 	    }		
       
  1697 
       
  1698 	if (( iTooltip->Rect().iTl != tooltipRect.iTl ) && ( iTooltip->Rect().iBr != tooltipRect.iBr ))
       
  1699 	    {
       
  1700         iTooltip->Close();
       
  1701 	    }
       
  1702 
  1688     iTooltip->Popup( tooltipRect );
  1703     iTooltip->Popup( tooltipRect );
  1689 	}
  1704 	}
  1690 
  1705 
  1691 void CFepLayoutMultiLineIcfEditor::HideTooltip()
  1706 void CFepLayoutMultiLineIcfEditor::HideTooltip()
  1692 	{
  1707 	{