williamr@2: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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 williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __CNTVIEWFINDCONFIG_H__ williamr@2: #define __CNTVIEWFINDCONFIG_H__ williamr@2: williamr@2: #include williamr@2: #include "ecom/ecom.h" // For REComSession williamr@2: williamr@2: class CContactViewFindConfigInterface : public CBase williamr@2: /** An interface class that enables implementers to configure the way in which williamr@2: words are matched in CContactViewBase::ContactsMatchingCriteriaL() and CContactViewBase::ContactsMatchingPrefixL(). williamr@2: williamr@2: By default these two functions use TDesC16::MatchC() to do the matching, but williamr@2: where this is not appropriate, for instance in Chinese locales, a plug-in williamr@2: that implements this interface should be supplied. The plug-in's UID should williamr@2: be passed to CContactViewBase::SetViewFindConfigPlugin(), then the plug-in williamr@2: will be loaded when ContactsMatchingCriteriaL() or ContactsMatchingPrefixL() williamr@2: is called. Note that the plug-in is only loaded once per view, not each time williamr@2: a find is requested. Note also that the plug-in is optional. If no plug-in williamr@2: is supplied, TDesC16::MatchC() is used instead. williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: static CContactViewFindConfigInterface* NewL(TUid aImplementationUid); williamr@2: inline virtual ~CContactViewFindConfigInterface(); williamr@2: //pure virtual methods to be implemented by the plugin. williamr@2: /** May be used by the implementor of the interface to provide construction-like williamr@2: behaviour. williamr@2: williamr@2: For example, it might be used to open a connection to a predictive text input williamr@2: database, or might be used for reference counting of shared objects (using williamr@2: TLS to store the data). */ williamr@2: virtual void OpenL() = 0; williamr@2: /** May be used by the implementor of the interface to provide destruction-like williamr@2: behaviour. williamr@2: williamr@2: For example, it might be used to close a connection to a predictive text input williamr@2: database, or might be used for reference counting of shared objects (using williamr@2: TLS to store the data). */ williamr@2: virtual void Close() = 0; williamr@2: /** Searches for a string with wildcards in a single field in a contact item. williamr@2: williamr@2: @param aContactsField The contents of the contact item field to search. williamr@2: @param aWord The string to search for in aContactsField. Note that it contains williamr@2: a '*' wildcard character at the end and optionally one at the beginning, depending williamr@2: on whether ContactsMatchingCriteriaL() or ContactsMatchingPrefixL() was called. williamr@2: @return ETrue if aWord is found in aContactsField. EFalse if not. */ williamr@2: virtual TBool Match(const TDesC& aContactsField, const TDesC& aWord) = 0; williamr@2: /** Tests whether a specified word is valid to be matched by the plug-in's implementation williamr@2: of Match(). williamr@2: williamr@2: For instance, in an implementation for a Chinese locale, this function would williamr@2: return EFalse for non-Chinese words. williamr@2: williamr@2: Any words that are not valid to be matched by the plug-in will be matched williamr@2: using TDesC16::MatchC() instead. williamr@2: williamr@2: @param aWord The word to be checked. Note that it contains a '*' wildcard williamr@2: character at the end and optionally one at the beginning, depending on whether williamr@2: ContactsMatchingCriteriaL() or ContactsMatchingPrefixL() was called. williamr@2: @return ETrue if the word is valid for matching by the plug-in, EFalse if not. */ williamr@2: virtual TBool IsWordValidForMatching(const TDesC& aWord) = 0; williamr@2: /** An optimisation function that may be used to implement incremental find, i.e. williamr@2: involving only the results of a previous search, rather than the entire view. williamr@2: williamr@2: This function is not called in v7.0s, but is provided for possible future use. williamr@2: williamr@2: @param aItemString The string that is being searched. williamr@2: @param aSearchText The string to search for. williamr@2: @return ETrue if aSearchText is found in aItemString. EFalse if not. */ williamr@2: virtual TBool MatchRefineL( const TDesC& aItemString, const TDesC &aSearchText) = 0; williamr@2: private: williamr@2: //The uid is stored here,so that it can be used during destruction of the instance. williamr@2: TUid iDtor_ID_Key; williamr@2: }; williamr@2: williamr@2: #include williamr@2: williamr@2: #endif