fep/aknfep/src/AknFepManager.cpp
branchRCL_3
changeset 18 b1ea1642412e
parent 16 857bebeecec0
child 19 ac7e4d1d9209
equal deleted inserted replaced
16:857bebeecec0 18:b1ea1642412e
   249 const TInt KWordToFocusInCandidateList = 1;
   249 const TInt KWordToFocusInCandidateList = 1;
   250 #endif
   250 #endif
   251 
   251 
   252 LOCAL_C TInt RemapVietnameseAccentedCharacter(TUint16 aChr);
   252 LOCAL_C TInt RemapVietnameseAccentedCharacter(TUint16 aChr);
   253 
   253 
   254 static _LIT_SECURITY_POLICY_PASS( KAllowAllPolicy );
       
   255 static _LIT_SECURITY_POLICY_C1( KPowerMgmtPolicy, ECapabilityPowerMgmt );
       
   256 
       
   257 //
   254 //
   258 // Class TTextDirectionalInfo
   255 // Class TTextDirectionalInfo
   259 //
   256 //
   260 /**
   257 /**
   261 * The implementation inializes with well-defined "null" state
   258 * The implementation inializes with well-defined "null" state
   446     iAknFepThaiSCTSelector = CAknFepThaiSCTSelector::NewL();
   443     iAknFepThaiSCTSelector = CAknFepThaiSCTSelector::NewL();
   447     iHybridAplphaChangedToAlphanumeric = EFalse;
   444     iHybridAplphaChangedToAlphanumeric = EFalse;
   448     iLastFocusedEditor = NULL;
   445     iLastFocusedEditor = NULL;
   449     iFepAwareDialogParentEditor = NULL;
   446     iFepAwareDialogParentEditor = NULL;
   450 	
   447 	
   451 	RProperty::Define(
   448     // Fep manager should have both read and write privilege.
   452             KPSUidAknFep, 
   449     // Known case: Auto-completion cannot be changed in setting dialog.
   453             KAknFepSettingDialogState, 
   450     RProperty::Define( KPSUidAknFep, KAknFepSettingDialogState, RProperty::EInt );
   454             RProperty::EInt, 
       
   455             KAllowAllPolicy,  // None
       
   456             KPowerMgmtPolicy ); 
       
   457     }
   451     }
   458 
   452 
   459 void CAknFepManager::ConstructFullyL()
   453 void CAknFepManager::ConstructFullyL()
   460     {
   454     {
   461     if (!iPtiEngine)
   455     if (!iPtiEngine)
 10101 	                            }
 10095 	                            }
 10102 	                        iInputCapabilities.FepAwareTextEditor()->CommitFepInlineEditL(*coeEnv);
 10096 	                        iInputCapabilities.FepAwareTextEditor()->CommitFepInlineEditL(*coeEnv);
 10103 	                        }
 10097 	                        }
 10104 	                    else
 10098 	                    else
 10105 	                        {
 10099 	                        {
 10106 	                        // Go directly via CTextView because the normal way via the FepAwareEditor can only be called
 10100                             // Line cursor is made invisible here.  There is no line cursor in S60 LAF, even though there is
 10107 	                        // during an inline edit.
 10101                             // an Edwin flag which govern this.  See CEikEdwin::SetCursorVisibilityL(TBool)
 10108 	                        // Line cursor is made invisible here.  There is no line cursor in S60 LAF, even though there is
 10102                             // Cursor is not set if this CommitInlineEditL call was prompted when losing focus.
 10109 	                        // an Edwin flag which govern this.  See CEikEdwin::SetCursorVisibilityL(TBool)
       
 10110 	                        // Cursor is not set if this CommitInlineEditL call was prompted when losing focus.
       
 10111 	                        MAknFepDocumentNavigation* docNavi = AknFepDocumentNavigation();
 10103 	                        MAknFepDocumentNavigation* docNavi = AknFepDocumentNavigation();
 10112 	                        if ( (docNavi || TextView()) && !IsCcpuFlagSet(ECcpuStateLosingFocus) )
 10104                             
 10113 	                        	{
 10105                             // Use FepAwareTextEditor to judge, not use TextView()
 10114 	                        	if (docNavi)
 10106                             if ( (docNavi || FepAwareTextEditor()) && !IsCcpuFlagSet(ECcpuStateLosingFocus) )
 10115 	                        		{
 10107                                 {
 10116 		                            docNavi->SetCursorVisibilityL( TCursor::EFCursorInvisible, 
 10108                                 if (docNavi)
 10117 	                                                             TCursor::EFCursorFlashing );
 10109                                     {
 10118 	                        		}
 10110                                     docNavi->SetCursorVisibilityL( TCursor::EFCursorInvisible, 
 10119 	                        	else 
 10111                                                                  TCursor::EFCursorFlashing );
 10120 	                        		{
 10112                                     }
 10121 		                            TextView()->SetCursorVisibilityL( TCursor::EFCursorInvisible, 
 10113                                 else 
 10122 	                                                                TCursor::EFCursorFlashing );
 10114                                     {
 10123 	                        		}
 10115                                     //Use Edwin (FepAwareTextEditor) to set cursor visibility
 10124 	                        	}
 10116                                     FepAwareTextEditor()->SetInlineEditingCursorVisibilityL( ETrue );
       
 10117                                     }
       
 10118                                 }
 10125 	                        }
 10119 	                        }
 10126 	                    }
 10120 	                    }
 10127 	                // iMatchState=EWordMatchFirst;
 10121 	                // iMatchState=EWordMatchFirst;
 10128 	
 10122 	
 10129 	                CleanupStack::PopAndDestroy(); // decoratedTextBuf
 10123 	                CleanupStack::PopAndDestroy(); // decoratedTextBuf
 10300         {
 10294         {
 10301         return ETrue;
 10295         return ETrue;
 10302         }
 10296         }
 10303     return EFalse;
 10297     return EFalse;
 10304     }
 10298     }
       
 10299     
       
 10300 // -----------------------------------------------------------------------------
       
 10301 // check whether the current editor is a Java secret editor
       
 10302 // ----------------------------------------------------------------------------- 
       
 10303 TBool CAknFepManager::IsJavaSecretEditor()
       
 10304     {
       
 10305     TBool JavaSecretEditor = EFalse;
       
 10306     
       
 10307     TUint ConstraintValue = 0;
       
 10308     MObjectProvider* mop = iInputCapabilities.ObjectProvider();
       
 10309     
       
 10310     if ( mop )
       
 10311         {
       
 10312         CAknExtendedInputCapabilities* extendedInputCapabilities = 
       
 10313         mop->MopGetObject( extendedInputCapabilities );
       
 10314         if ( extendedInputCapabilities && iInputCapabilities.FepAwareTextEditor() ) 
       
 10315             {
       
 10316             ConstraintValue = extendedInputCapabilities->MIDPConstrainst();
       
 10317             }
       
 10318         }
       
 10319     if( ConstraintValue & 0x10000 ) 
       
 10320         {
       
 10321         JavaSecretEditor = ETrue;
       
 10322         }
       
 10323     
       
 10324     return JavaSecretEditor;
       
 10325     }       
 10305 
 10326 
 10306 TBool CAknFepManager::IsEditorHasFreeSpace() const
 10327 TBool CAknFepManager::IsEditorHasFreeSpace() const
 10307     {
 10328     {
 10308     TBool unlimit = EFalse;
 10329     TBool unlimit = EFalse;
 10309     TInt freeSpace = 0;
 10330     TInt freeSpace = 0;
 16144         docNavi->GetDocPos(rawDocPos);
 16165         docNavi->GetDocPos(rawDocPos);
 16145         gotPos = ETrue;
 16166         gotPos = ETrue;
 16146     	}
 16167     	}
 16147     else
 16168     else
 16148     	{
 16169     	{
 16149 	    CTextView* textView = TextView();
 16170         // Use Edwin (FepAwareTextEditor() ) to get the position of document
 16150 	    if (textView)
 16171         if ( FepAwareTextEditor() )
 16151 	        {
 16172             {
 16152 	        TextView()->GetCursorPos(rawDocPos);
 16173             TCursorSelection cursorSel( 0, 0 );
 16153 	        gotPos = ETrue;
 16174             // Get the postion of document
 16154 	        }
 16175             FepAwareTextEditor()->GetCursorSelectionForFep( cursorSel );
       
 16176 
       
 16177             // Set the leading edge of the document.
       
 16178             rawDocPos.iPos = cursorSel.iCursorPos;
       
 16179             CAknEdwinState* state( EditorState() );
       
 16180             rawDocPos.iLeadingEdge = ( state && 
       
 16181                 state->Flags() & EAknEditorFlagCursorLedingEdge );                
       
 16182             gotPos = ETrue;
       
 16183             }
 16155     	}
 16184     	}
 16156     if (gotPos)
 16185     if (gotPos)
 16157     	{
 16186     	{
 16158         docPos.iPos = rawDocPos.iPos;
 16187         docPos.iPos = rawDocPos.iPos;
 16159         TTmDocPosSpec::TType docPosType = 
 16188         TTmDocPosSpec::TType docPosType = 
 16395     return success;
 16424     return success;
 16396     }
 16425     }
 16397 
 16426 
 16398 TBool CAknFepManager::GetVisualDocEnd( TTmDocPosSpec& aPos) const
 16427 TBool CAknFepManager::GetVisualDocEnd( TTmDocPosSpec& aPos) const
 16399     {
 16428     {
       
 16429     // Set EAknEditorFlagNeedWholeTextData to Editor State
       
 16430     // EAknEditorFlagNeedWholeTextData means needing to get whole document data to editor
       
 16431     UpdateEditorStateFlags( EAknEditorFlagNeedWholeTextData );
       
 16432 
 16400     TInt docLength = iInputCapabilities.FepAwareTextEditor()->DocumentLengthForFep();
 16433     TInt docLength = iInputCapabilities.FepAwareTextEditor()->DocumentLengthForFep();
 16401 
 16434 
 16402     // Set up the initial try as trailing after the last logical character
 16435     // Set up the initial try as trailing after the last logical character
 16403     // It is a requirement that this position is at least in the last line
 16436     // It is a requirement that this position is at least in the last line
 16404     TTmDocPosSpec pos(docLength, TTmDocPosSpec::ETrailing);
 16437     TTmDocPosSpec pos(docLength, TTmDocPosSpec::ETrailing);
 16420     else // Possible cleanup; action for when there is insufficient information
 16453     else // Possible cleanup; action for when there is insufficient information
 16421         {
 16454         {
 16422         aPos.iPos = docLength;
 16455         aPos.iPos = docLength;
 16423         aPos.iType = TTmDocPosSpec::ETrailing;
 16456         aPos.iType = TTmDocPosSpec::ETrailing;
 16424         }
 16457         }
       
 16458         
       
 16459     // Remove EAknEditorFlagNeedWholeTextData fromEditor State
       
 16460     UpdateEditorStateFlags( EAknEditorFlagNeedWholeTextData, EFalse );
 16425     return success;
 16461     return success;
 16426     }
 16462     }
 16427 
 16463 
 16428 
 16464 
 16429 TBool CAknFepManager::GetAknFepLineExtreme( const TTmDocPosSpec& aPos, TBool aToRight,
 16465 TBool CAknFepManager::GetAknFepLineExtreme( const TTmDocPosSpec& aPos, TBool aToRight,
 17010             aLanguage = ELangEnglish;               
 17046             aLanguage = ELangEnglish;               
 17011             }
 17047             }
 17012         else
 17048         else
 17013             {
 17049             {
 17014             aLanguage = EditorState()->LocalLanguage();
 17050             aLanguage = EditorState()->LocalLanguage();
       
 17051             
       
 17052             // Change local language to ELangEnglish if application, e.g. Search Widget,
       
 17053             // sets local language to ELangEnglish_Taiwan, ELangEnglish_HongKong 
       
 17054             // and ELangEnglish_Prc. 
       
 17055             if( aLanguage == ELangEnglish_Taiwan || 
       
 17056                     aLanguage == ELangEnglish_HongKong || 
       
 17057                     aLanguage == ELangEnglish_Prc )
       
 17058                 {
       
 17059                 aLanguage = ELangEnglish;
       
 17060                 }
 17015             }
 17061             }
 17016             
 17062             
 17017         if ( aLanguage != ELangTest )
 17063         if ( aLanguage != ELangTest )
 17018             {   
 17064             {   
 17019             MPtiLanguage* languageObject = NULL;
 17065             MPtiLanguage* languageObject = NULL;
 17472     if ( IsFlagSet(EFlagAtDirectionallyAmbiguousPoint)  // only perform if already at ambi-point?
 17518     if ( IsFlagSet(EFlagAtDirectionallyAmbiguousPoint)  // only perform if already at ambi-point?
 17473         && !IsFlagSet(EFlagInsideInlineEditingTransaction) ) // do not flip if inside inline edit
 17519         && !IsFlagSet(EFlagInsideInlineEditingTransaction) ) // do not flip if inside inline edit
 17474         {
 17520         {
 17475         if ( aCode == EKeyRightArrow || aCode == EKeyLeftArrow )
 17521         if ( aCode == EKeyRightArrow || aCode == EKeyLeftArrow )
 17476             {
 17522             {
       
 17523             // Never use TextView() to get editor data, 
       
 17524             // use FepAwareTextEditor() condition instead of TextView()
 17477             if ( iInputCapabilities.FepAwareTextEditor() && EditorState() 
 17525             if ( iInputCapabilities.FepAwareTextEditor() && EditorState() 
 17478             && (AknFepDocumentNavigation() || TextView()) )
 17526             && AknFepDocumentNavigation() )
 17479                 {
 17527                 {
 17480                 TTmDocPosSpec docPos = DocPos();
 17528                 TTmDocPosSpec docPos = DocPos();
 17481                 TTextDirectionalInfo status = LocalTextDirectionalStatus( docPos );
 17529                 TTextDirectionalInfo status = LocalTextDirectionalStatus( docPos );
 17482 
 17530 
 17483                 CTmTextLayout::TTmChunkDescription leftChunk;
 17531                 CTmTextLayout::TTmChunkDescription leftChunk;
 17581 		}	
 17629 		}	
 17582     }
 17630     }
 17583 
 17631 
 17584 void CAknFepManager::AdjustCursorTypeForCurrentPosition()
 17632 void CAknFepManager::AdjustCursorTypeForCurrentPosition()
 17585     {
 17633     {
       
 17634     
       
 17635     // Never use TextView() to get editor data, 
       
 17636     // use FepAwareTextEditor() condition instead of TextView()
 17586     if ( iInputCapabilities.FepAwareTextEditor() && EditorState() 
 17637     if ( iInputCapabilities.FepAwareTextEditor() && EditorState() 
 17587     && (AknFepDocumentNavigation() || TextView()) )
 17638     && AknFepDocumentNavigation())
 17588         AdjustCursorTypeForPosition( DocPos() );
 17639         AdjustCursorTypeForPosition( DocPos() );
 17589     }
 17640     }
 17590 
 17641 
 17591 void CAknFepManager::SchedulePostEventCheckL( TUint aCode )
 17642 void CAknFepManager::SchedulePostEventCheckL( TUint aCode )
 17592     {
 17643     {
 20777     }
 20828     }
 20778 
 20829 
 20779 void CAknFepManager::HideExactWordPopUp()
 20830 void CAknFepManager::HideExactWordPopUp()
 20780 	{
 20831 	{
 20781 	iExactWordPopupContent->HidePopUp();
 20832 	iExactWordPopupContent->HidePopUp();
 20782 	SendEventsToPluginManL( EPluginHideTooltip );
 20833 	TRAP_IGNORE( SendEventsToPluginManL( EPluginHideTooltip ));
 20783 	}
 20834 	}
 20784 
 20835 
 20785 TBool CAknFepManager::IsExactWordPopUpShown()
 20836 TBool CAknFepManager::IsExactWordPopUpShown()
 20786 	{
 20837 	{
 20787 #ifdef RD_SCALABLE_UI_V2 
 20838 #ifdef RD_SCALABLE_UI_V2 
 20999 	    	}
 21050 	    	}
 21000 		}
 21051 		}
 21001 	CleanupStack::PopAndDestroy();  //reader 
 21052 	CleanupStack::PopAndDestroy();  //reader 
 21002 	return isEmpty;
 21053 	return isEmpty;
 21003 	}
 21054 	}
       
 21055     
       
 21056 // ========================================
       
 21057 // Update Editor State Flag
       
 21058 // Add editor state flags or 
       
 21059 // Remove editor state flags
       
 21060 // ========================================
       
 21061 void CAknFepManager::UpdateEditorStateFlags( TInt aFlag, TBool aAdd ) const
       
 21062     {
       
 21063     CAknEdwinState* state( EditorState() );
       
 21064     if ( state )
       
 21065         {
       
 21066         TInt flags( state->Flags() );
       
 21067         if ( aAdd )
       
 21068             {
       
 21069             flags |= aFlag;  // Add flag
       
 21070             }
       
 21071         else
       
 21072             {
       
 21073             flags &= ~aFlag;  // Remove flag
       
 21074             }
       
 21075         state->SetFlags( flags );
       
 21076         }
       
 21077     }
       
 21078 
 21004 
 21079 
 21005 // ---------------------------------------------------------------------------
 21080 // ---------------------------------------------------------------------------
 21006 // LOCAL METHODS
 21081 // LOCAL METHODS
 21007 // 
 21082 // 
 21008 // ---------------------------------------------------------------------------
 21083 // ---------------------------------------------------------------------------