epoc32/include/cntviewfindconfig.h
branchSymbian2
changeset 2 2fe1408b6811
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __CNTVIEWFINDCONFIG_H__
       
    17 #define __CNTVIEWFINDCONFIG_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include "ecom/ecom.h"		// For REComSession
       
    21 
       
    22 class CContactViewFindConfigInterface : public CBase
       
    23 /** An interface class that enables implementers to configure the way in which 
       
    24 words are matched in CContactViewBase::ContactsMatchingCriteriaL() and CContactViewBase::ContactsMatchingPrefixL().
       
    25 
       
    26 By default these two functions use TDesC16::MatchC() to do the matching, but 
       
    27 where this is not appropriate, for instance in Chinese locales, a plug-in 
       
    28 that implements this interface should be supplied. The plug-in's UID should 
       
    29 be passed to CContactViewBase::SetViewFindConfigPlugin(), then the plug-in 
       
    30 will be loaded when ContactsMatchingCriteriaL() or ContactsMatchingPrefixL() 
       
    31 is called. Note that the plug-in is only loaded once per view, not each time 
       
    32 a find is requested. Note also that the plug-in is optional. If no plug-in 
       
    33 is supplied, TDesC16::MatchC() is used instead. 
       
    34 @publishedPartner
       
    35 @released
       
    36 */
       
    37 	{
       
    38 	public:
       
    39 	static CContactViewFindConfigInterface* NewL(TUid aImplementationUid);
       
    40 	inline virtual ~CContactViewFindConfigInterface();
       
    41 	//pure virtual methods to be implemented by the plugin.
       
    42 	/** May be used by the implementor of the interface to provide construction-like 
       
    43 	behaviour.
       
    44 	
       
    45 	For example, it might be used to open a connection to a predictive text input 
       
    46 	database, or might be used for reference counting of shared objects (using 
       
    47 	TLS to store the data). */
       
    48 	virtual void OpenL() = 0;
       
    49 	/** May be used by the implementor of the interface to provide destruction-like 
       
    50 	behaviour.
       
    51 	
       
    52 	For example, it might be used to close a connection to a predictive text input 
       
    53 	database, or might be used for reference counting of shared objects (using 
       
    54 	TLS to store the data). */
       
    55 	virtual void Close() = 0;
       
    56 	/** Searches for a string with wildcards in a single field in a contact item.
       
    57 	
       
    58 	@param aContactsField The contents of the contact item field to search.
       
    59 	@param aWord The string to search for in aContactsField. Note that it contains 
       
    60 	a '*' wildcard character at the end and optionally one at the beginning, depending 
       
    61 	on whether ContactsMatchingCriteriaL() or ContactsMatchingPrefixL() was called.
       
    62 	@return ETrue if aWord is found in aContactsField. EFalse if not. */
       
    63 	virtual TBool Match(const TDesC& aContactsField, const TDesC& aWord) = 0;
       
    64 	/** Tests whether a specified word is valid to be matched by the plug-in's implementation 
       
    65 	of Match().
       
    66 	
       
    67 	For instance, in an implementation for a Chinese locale, this function would 
       
    68 	return EFalse for non-Chinese words.
       
    69 	
       
    70 	Any words that are not valid to be matched by the plug-in will be matched 
       
    71 	using TDesC16::MatchC() instead.
       
    72 	
       
    73 	@param aWord The word to be checked. Note that it contains a '*' wildcard 
       
    74 	character at the end and optionally one at the beginning, depending on whether 
       
    75 	ContactsMatchingCriteriaL() or ContactsMatchingPrefixL() was called.
       
    76 	@return ETrue if the word is valid for matching by the plug-in, EFalse if not. */
       
    77 	virtual TBool IsWordValidForMatching(const TDesC& aWord) = 0;
       
    78 	/** An optimisation function that may be used to implement incremental find, i.e. 
       
    79 	involving only the results of a previous search, rather than the entire view.
       
    80 	
       
    81 	This function is not called in v7.0s, but is provided for possible future use.
       
    82 	
       
    83 	@param aItemString The string that is being searched.
       
    84 	@param aSearchText The string to search for.
       
    85 	@return ETrue if aSearchText is found in aItemString. EFalse if not. */
       
    86 	virtual TBool MatchRefineL( const TDesC& aItemString, const TDesC &aSearchText) = 0;
       
    87 	private:
       
    88 	//The uid is stored here,so that it can be used during destruction of the instance.
       
    89 	TUid iDtor_ID_Key;
       
    90 	};
       
    91 
       
    92 #include <cntviewfindconfig.inl>
       
    93 
       
    94 #endif