epoc32/include/app/cntview.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/app/cntview.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,480 @@
     1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __CNTVIEW_H__
    1.20 +#define __CNTVIEW_H__
    1.21 +
    1.22 +#include <cntviewbase.h>
    1.23 +
    1.24 +/** The maximum length of the string used by contact sub view ranges to find the 
    1.25 +item at the upper or lower limit of the range.
    1.26 +
    1.27 +In practice, only the first character in the string is used and this value 
    1.28 +is ignored. */
    1.29 +const TInt KMaxBoundaryMatchLength=8;
    1.30 +
    1.31 +class CContactGroupView: public CContactViewBase, public MContactViewObserver
    1.32 +/** Provides a view of a group of contact items.
    1.33 +
    1.34 +The view uses an underlying view. For items to appear in the group view, they 
    1.35 +must exist in the underlying view.
    1.36 +
    1.37 +The TGroupType enumeration defines whether the view displays items that belong 
    1.38 +to the group, items that do not belong to the group, or items that do not 
    1.39 +belong to any group.
    1.40 +
    1.41 +The group view observes its underlying view so that it is kept up to date 
    1.42 +if the contents of the underlying view change.
    1.43 +
    1.44 +The group can be identified by a contact item ID or by a label, e.g. "family", 
    1.45 +or "colleagues".
    1.46 +
    1.47 +@see CContactGroup 
    1.48 +@publishedAll
    1.49 +@released
    1.50 +*/
    1.51 +	{
    1.52 +friend class CGroupViewTester;
    1.53 +public:
    1.54 +	/** Defines the types of contact group view. */
    1.55 +	enum TGroupType
    1.56 +		{
    1.57 +		/** The view contains contact items in the group. */
    1.58 +		EShowContactsInGroup,
    1.59 +		/** The view contains contact items not in the group. */
    1.60 +		EShowContactsNotInGroup,
    1.61 +		/** The view contains contact items not in any group. */
    1.62 +		EShowContactsNotInAnyGroup
    1.63 +		};
    1.64 +public:
    1.65 +	IMPORT_C static CContactGroupView* NewL(const CContactDatabase& aDb,CContactViewBase& aView,MContactViewObserver& aObserver,const TContactItemId aGroupId,const TGroupType aGroupType);
    1.66 +	IMPORT_C static CContactGroupView* NewL(const CContactDatabase& aDb,CContactViewBase& aView,MContactViewObserver& aObserver, const TDesC& aGroupName,const TGroupType aGroupType);
    1.67 +
    1.68 +	// Factory constructor for version 2 behaviour
    1.69 +	IMPORT_C static CContactGroupView* NewL(CContactViewBase& aView,const CContactDatabase& aDb, MContactViewObserver& aObserver,const TContactItemId aGroupId,const TGroupType aGroupType);
    1.70 +	// Factory constructor for version 2 behaviour
    1.71 +	IMPORT_C static CContactGroupView* NewL(CContactViewBase& aView,const CContactDatabase& aDb, MContactViewObserver& aObserver, const TDesC& aGroupName,const TGroupType aGroupType);	
    1.72 +	//All CContactViewBase derived classes in public headers,
    1.73 +	//should mandatorily implement this reserved function.	
    1.74 +	TAny* CContactViewBase_Reserved_1(TFunction aFunction,TAny* aParams);
    1.75 +	~CContactGroupView();
    1.76 +public: // From CContactViewBase
    1.77 +	TContactItemId AtL(TInt aIndex) const;
    1.78 +	TInt CountL() const;
    1.79 +	TInt FindL(TContactItemId aId) const;
    1.80 +	HBufC* AllFieldsLC(TInt aIndex,const TDesC& aSeparator) const;
    1.81 +	const CViewContact& ContactAtL(TInt aIndex) const;
    1.82 +	TContactViewPreferences ContactViewPreferences();
    1.83 +	const RContactViewSortOrder& SortOrderL() const;
    1.84 +protected:
    1.85 +	IMPORT_C virtual void UpdateGroupViewL();
    1.86 +private: // From MContactViewObserver.
    1.87 +	void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent);
    1.88 +private: 
    1.89 +	void ConstructL(MContactViewObserver& aObserver,TContactItemId aGroupId);
    1.90 +	void UpdateForContactsInGroupL();
    1.91 +	void UpdateForContactsNotInThisGroupL();
    1.92 +	void UpdateForUnfiledContactsL();
    1.93 +	void UpdateForContactListL(const CContactIdArray* aArray);
    1.94 +	TContactItemId GetGroupIdbyNameL(const TDesC& aGroupName);
    1.95 +	TBool HandleRemoveEventL(TContactViewEvent& aEvent);
    1.96 +	TBool HandleAddEventL(TContactViewEvent& aEvent);
    1.97 +	TBool HandleAddEventForUnfiledContactsL(const TContactViewEvent& aEvent );
    1.98 +	static TInt CompareMappingsL(const TContactIdWithMapping& aFirst,const TContactIdWithMapping& aSecond);
    1.99 +	TInt static CompareIndexesAllowingDuplicates(const TContactIdWithMapping& aFirst, const TContactIdWithMapping& aSecond);
   1.100 +private:
   1.101 +	CContactGroupView(const CContactDatabase& aDb,CContactViewBase& aView,TGroupType aGroupType);
   1.102 +	void UpdateMappingsL();
   1.103 +	void NotifyRemovedMembersL(const CContactIdArray* aArray);
   1.104 +private:
   1.105 +	RArray<TContactIdWithMapping> iGroupContacts;
   1.106 +	TContactItemId iGroupId;
   1.107 +	CContactViewBase& iView;
   1.108 +	TGroupType iGroupType;
   1.109 +	TUint iClassVersion; //version class - used for TContactViewEvent dispatching
   1.110 +	};
   1.111 +
   1.112 +
   1.113 +class CContactFindView: public CContactViewBase, public MContactViewObserver
   1.114 +/** Provides a view of an existing CContactViewBase-derived object, populated using 
   1.115 +search criteria.
   1.116 +
   1.117 +The find view only contains contact items from the underlying view that match 
   1.118 +the search criteria.
   1.119 +
   1.120 +The find view observes its underlying view so that it is kept up to date if 
   1.121 +the contents of the underlying view change.
   1.122 +
   1.123 +The search criteria (one or more words) are held in an MDesCArray object. 
   1.124 +The fields involved in the search are those that have been used to sort the 
   1.125 +underlying view. 
   1.126 +@publishedAll
   1.127 +@released
   1.128 +*/
   1.129 +	{
   1.130 +public:
   1.131 +	IMPORT_C static CContactFindView* NewL(const CContactDatabase& aDb,CContactViewBase& aView,MContactViewObserver& aObserver,MDesCArray* aFindWords);
   1.132 +	IMPORT_C static CContactFindView* NewL(const CContactDatabase& aDb,CContactViewBase& aView,MContactViewObserver& aObserver,MDesCArray* aFindWords, TSearchType aSearchType);
   1.133 +	
   1.134 +	// Factory constructor for version 2 behaviour
   1.135 +	IMPORT_C static CContactFindView* NewL(CContactViewBase& aView,const CContactDatabase& aDb,MContactViewObserver& aObserver,MDesCArray* aFindWords);
   1.136 +	// Factory constructor for version 2 behaviour
   1.137 +	IMPORT_C static CContactFindView* NewL(CContactViewBase& aView,const CContactDatabase& aDb,MContactViewObserver& aObserver,MDesCArray* aFindWords, TSearchType aSearchType);
   1.138 +
   1.139 +	~CContactFindView();
   1.140 +public: // From CContactViewBase
   1.141 +	TContactItemId AtL(TInt aIndex) const;
   1.142 +	TInt CountL() const;
   1.143 +	TInt FindL(TContactItemId aId) const;
   1.144 +	HBufC* AllFieldsLC(TInt aIndex,const TDesC& aSeparator) const;
   1.145 +	const CViewContact& ContactAtL(TInt aIndex) const;
   1.146 +	TContactViewPreferences ContactViewPreferences();
   1.147 +	const RContactViewSortOrder& SortOrderL() const;
   1.148 +protected:
   1.149 +	IMPORT_C virtual void UpdateFindViewL();
   1.150 +public:
   1.151 +	IMPORT_C void RefineFindViewL(MDesCArray* aFindWords);
   1.152 +	//All CContactViewBase derived classes in public headers,
   1.153 +	//should mandatorily implement this reserved function.	
   1.154 +	TAny* CContactViewBase_Reserved_1(TFunction aFunction,TAny* aParams);
   1.155 +private: // From MContactViewObserver.
   1.156 +	virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent);
   1.157 +private: 
   1.158 +	void ConstructL(MContactViewObserver& aObserver,MDesCArray* aFindWords);
   1.159 +	void DeleteFindContacts();
   1.160 +	void TightenFindViewCriteriaL();
   1.161 +	void HandleRemoveEventL(TContactViewEvent& aEvent);
   1.162 +	void HandleAddEventL(TContactViewEvent& aEvent);
   1.163 +	void CopyNewFindWordsL(MDesCArray* aFindWords);
   1.164 +	void DestroyFindWordsArray();
   1.165 +	TInt InsertContact(const CViewContact* aNewContact);
   1.166 +private:
   1.167 +	CContactFindView(const CContactDatabase& aDb,CContactViewBase& aView, TSearchType aSearchType);
   1.168 +private:
   1.169 +	RPointerArray<CViewContact> iFindContacts;
   1.170 +	CPtrCArray* iFindWords;
   1.171 +	CContactViewBase& iView;
   1.172 +	const TSearchType iSearchType;
   1.173 +	TUint iClassVersion; //version class - used for TContactViewEvent dispatching
   1.174 +	};
   1.175 +
   1.176 +
   1.177 +class CContactFilteredView : public CContactViewBase, public MContactViewObserver
   1.178 +/** Provides a filtered view over an existing CContactViewBase derived object.
   1.179 +
   1.180 +For example, it might provide a view containing only contacts that have an 
   1.181 +email address. For efficiency reasons there are a limited set of filters available 
   1.182 +(defined in CContactDatabase::TContactViewFilter).
   1.183 +
   1.184 +The filtered view observes its underlying view so that it is kept up to date 
   1.185 +if the contents of the underlying view change. It will, in turn, notify its 
   1.186 +observers.
   1.187 +
   1.188 +Filters only apply to non-hidden contact fields with content. 
   1.189 +@publishedAll
   1.190 +@released
   1.191 +*/
   1.192 +	{
   1.193 +public:
   1.194 +	IMPORT_C static CContactFilteredView* NewL(MContactViewObserver& aObserver,const CContactDatabase& aDb,CContactViewBase& aView,TInt aFilter);
   1.195 +	// Factory constructor for version 2 behaviour
   1.196 +	IMPORT_C static CContactFilteredView* NewL(CContactViewBase& aView,const CContactDatabase& aDb,MContactViewObserver& aObserver,TInt aFilter);
   1.197 +
   1.198 +	//All CContactViewBase derived classes in public headers,
   1.199 +	//should mandatorily implement this reserved function.	
   1.200 +	TAny* CContactViewBase_Reserved_1(TFunction aFunction,TAny* aParams);
   1.201 +	~CContactFilteredView();
   1.202 +public: // From CContactViewBase.
   1.203 +	TContactItemId AtL(TInt aIndex) const;
   1.204 +	TInt CountL() const;
   1.205 +	TInt FindL(TContactItemId aId) const;
   1.206 +	HBufC* AllFieldsLC(TInt aIndex,const TDesC& aSeparator) const;
   1.207 +	const CViewContact& ContactAtL(TInt aIndex) const;
   1.208 +	TContactViewPreferences ContactViewPreferences();
   1.209 +	const RContactViewSortOrder& SortOrderL() const;
   1.210 +	virtual void ContactsMatchingCriteriaL(const MDesCArray& aFindWords,RPointerArray<CViewContact>& aMatchedContacts);
   1.211 +	virtual void ContactsMatchingPrefixL(const MDesCArray& aFindWords, RPointerArray<CViewContact>& aMatchedContacts);
   1.212 +private: // From MContactViewObserver.
   1.213 +	virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent);
   1.214 +private:
   1.215 +	CContactFilteredView(const CContactDatabase& aDb,TInt aFilter,CContactViewBase& aView);
   1.216 +	void ConstructL(MContactViewObserver& aObserver);
   1.217 +	void CreateFilteredIdArray();
   1.218 +	void UpdateFilteredIdArrayL(TContactViewEvent& aEvent, TBool& aViewModified);
   1.219 +	void HandleAddEventL(TContactViewEvent& aEvent, TBool& aViewModified);
   1.220 +	void HandleRemoveEventL(TContactViewEvent& aEvent, TBool& aViewModified);
   1.221 +	TInt BinaryInsertL(TContactIdWithMapping aId);
   1.222 +	static TInt FilterCallBack(TAny* aSelf);
   1.223 +	static TBool CompareMappings(const TContactIdWithMapping& aFirst,const TContactIdWithMapping& aSecond);
   1.224 +	void FilterResultsArray(RPointerArray<CViewContact>& aMatchedContacts);
   1.225 +	TInt DoFilterIncrementL();
   1.226 +	void UpdateMappingsL();
   1.227 +private:
   1.228 +	const TInt iFilter;
   1.229 +	CContactViewBase& iView;
   1.230 +	RArray<TContactIdWithMapping> iFilteredIdArray;
   1.231 +	TUint iClassVersion; //version class - used for TContactViewEvent dispatching
   1.232 +	};
   1.233 +
   1.234 +
   1.235 +class CContactViewRangeBase : public CBase
   1.236 +/** The abstract base class for all contact view range classes.
   1.237 +
   1.238 +Range classes are used by contact sub views to specify the upper and lower 
   1.239 +range boundaries and for searching their underlying view.
   1.240 +
   1.241 +@see CContactSubView 
   1.242 +@publishedAll
   1.243 +@released
   1.244 +*/
   1.245 +	{
   1.246 +public:
   1.247 +	/** Defines the range criteria. */
   1.248 +	enum TCriteria
   1.249 +		{
   1.250 +		/** Less than. */
   1.251 +		ELessThan,
   1.252 +		/** Less than or equal to. */
   1.253 +		ELessThanOrEqualTo,
   1.254 +		/** Greater than. */
   1.255 +		EGreaterThan,
   1.256 +		/** Greater than or equal to. */
   1.257 +		EGreaterThanOrEqualTo
   1.258 +		};
   1.259 +public:
   1.260 +	~CContactViewRangeBase();
   1.261 +	inline TInt LowIndex() const;
   1.262 +	inline TInt HighIndex() const;
   1.263 +	/** Sets the iLow and iHigh members. */
   1.264 +	virtual void SetL()=0;
   1.265 +	IMPORT_C TBool IndicesValid() const;
   1.266 +protected:
   1.267 +	CContactViewRangeBase(const CContactViewBase& aView);
   1.268 +	void ConstructL();
   1.269 +	TInt FindIndexL(const TDesC& aMatch,TCriteria aCriteria) const;
   1.270 +	TBool MatchesCriteriaL(TCriteria aCriteria,const TDesC& aMatch,TInt aIndex) const;
   1.271 +	void ValidateIndices();
   1.272 +protected:
   1.273 +	/** The sub view's underlying view. */
   1.274 +	const CContactViewBase& iView;
   1.275 +	/** The index into the sub view's underlying view of the item at the lower limit 
   1.276 +	of the range. */
   1.277 +	TInt iLow;
   1.278 +	/** The index into the sub view's underlying view of the item at the upper limit 
   1.279 +	of the range. */
   1.280 +	TInt iHigh;
   1.281 +	//ChrisD: contain by value not ptr
   1.282 +	/** The collation method used to sort the strings.
   1.283 +	
   1.284 +	By default, this is the standard collation method for the current locale. */
   1.285 +	TCollationMethod* iCollateMethod;
   1.286 +	};
   1.287 +
   1.288 +
   1.289 +class CContactViewRange : public CContactViewRangeBase
   1.290 +/** A sub view range with both a lower and upper limit.
   1.291 +
   1.292 +This is used by sub views when lower and upper boundary criteria are specified.
   1.293 +
   1.294 +@see CContactSubView 
   1.295 +@publishedAll
   1.296 +@released
   1.297 +*/
   1.298 +	{
   1.299 +public:
   1.300 +	~CContactViewRange();
   1.301 +	IMPORT_C static CContactViewRange* NewL(const CContactViewBase& aView,const TDesC& aLowMatch,TCriteria aLowCriteria,const TDesC& aHighMatch,TCriteria aHighCriteria);
   1.302 +private: // From CContactViewRangeBase.
   1.303 +	void SetL();
   1.304 +private:
   1.305 +	CContactViewRange(const CContactViewBase& aView,const TDesC& aLowMatch,TCriteria aLowCriteria,const TDesC& aHighMatch,TCriteria aHighCriteria);
   1.306 +	void ConstructL();
   1.307 +private:
   1.308 +	TBuf<KMaxBoundaryMatchLength> iLowMatch;
   1.309 +	TCriteria iLowCriteria;
   1.310 +	TBuf<KMaxBoundaryMatchLength> iHighMatch;
   1.311 +	TCriteria iHighCriteria;
   1.312 +	};
   1.313 +
   1.314 +
   1.315 +class CContactViewLowRange : public CContactViewRangeBase
   1.316 +/** A sub view range with an upper limit only.
   1.317 +
   1.318 +This is used by sub views when the range criteria are CContactViewRangeBase::ELessThan 
   1.319 +or CContactViewRangeBase::ELessThanOrEqualTo.
   1.320 +
   1.321 +@see CContactSubView 
   1.322 +@publishedAll
   1.323 +@released
   1.324 +*/
   1.325 +	{
   1.326 +public:
   1.327 +	IMPORT_C static CContactViewLowRange* NewL(const CContactViewBase& aView,const TDesC& aMatch,TCriteria aCriteria);
   1.328 +private: // From CContactViewRangeBase.
   1.329 +	void SetL();
   1.330 +private:
   1.331 +	CContactViewLowRange(const CContactViewBase& aView,const TDesC& aMatch,TCriteria aCriteria);
   1.332 +//ChrisD: why private d'tor
   1.333 +	~CContactViewLowRange();
   1.334 +private:
   1.335 +	TBuf<KMaxBoundaryMatchLength> iMatch;
   1.336 +	TCriteria iCriteria;
   1.337 +	};
   1.338 +
   1.339 +
   1.340 +class CContactViewHighRange : public CContactViewRangeBase
   1.341 +/** A sub view range with a lower limit only.
   1.342 +
   1.343 +This is used by sub views when the range criteria are CContactViewRangeBase::EGreaterThan 
   1.344 +or CContactViewRangeBase::EGreaterThanOrEqualTo.
   1.345 +
   1.346 +@see CContactSubView 
   1.347 +@publishedAll
   1.348 +@released
   1.349 +*/
   1.350 +	{
   1.351 +public:
   1.352 +	IMPORT_C static CContactViewHighRange* NewL(const CContactViewBase& aView,const TDesC& aMatch,TCriteria aCriteria);
   1.353 +private: // From CContactViewRangeBase.
   1.354 +	void SetL();
   1.355 +private:
   1.356 +	CContactViewHighRange(const CContactViewBase& aView,const TDesC& aMatch,TCriteria aCriteria);
   1.357 +//ChrisD: why private d'tor
   1.358 +	~CContactViewHighRange();
   1.359 +private:
   1.360 +	TBuf<KMaxBoundaryMatchLength> iMatch;
   1.361 +	TCriteria iCriteria;
   1.362 +	};
   1.363 +
   1.364 +
   1.365 +class CContactSubView : public CContactViewBase, public MContactViewObserver
   1.366 +/** Provides a view of a range of contact items from a potentially larger underlying 
   1.367 +view (another CContactViewBase-derived object).
   1.368 +
   1.369 +All contact items between a lower and upper boundary in the underlying view 
   1.370 +are included in the sub view. For example, the sub view might contain all 
   1.371 +items whose name begins with a character between 'd' and 'f'.
   1.372 +
   1.373 +The sub view observes its underlying view so that as the underlying view changes, 
   1.374 +the sub view is kept up to date. 
   1.375 +@publishedAll
   1.376 +@released
   1.377 +*/
   1.378 +	{
   1.379 +public:
   1.380 +	IMPORT_C static CContactSubView* NewL(MContactViewObserver& aObserver,const CContactDatabase& aDb,CContactViewBase& aView,const TDesC& aBoundary);//>= > is infinity <= < =0;
   1.381 +	IMPORT_C static CContactSubView* NewL(MContactViewObserver& aObserver,const CContactDatabase& aDb,CContactViewBase& aView,const TDesC& aLowBoundary,const TDesC& aHighBoundary);
   1.382 +	
   1.383 +	// Factory constructor for version 2 behaviour
   1.384 +	IMPORT_C static CContactSubView* NewL(CContactViewBase& aView,const CContactDatabase& aDb,MContactViewObserver& aObserver,const TDesC& aBoundary);//>= > is infinity <= < =0;
   1.385 +	// Factory constructor for version 2 behaviour
   1.386 +	IMPORT_C static CContactSubView* NewL(CContactViewBase& aView,const CContactDatabase& aDb,MContactViewObserver& aObserver,const TDesC& aLowBoundary,const TDesC& aHighBoundary);
   1.387 +
   1.388 +	//All CContactViewBase derived classes in public headers,
   1.389 +	//should mandatorily implement this reserved function.	
   1.390 +	TAny* CContactViewBase_Reserved_1(TFunction aFunction,TAny* aParams);
   1.391 +public: // From CContactViewBase.
   1.392 +	TContactItemId AtL(TInt aIndex) const;
   1.393 +	TInt CountL() const;
   1.394 +	TInt FindL(TContactItemId aId) const;
   1.395 +	HBufC* AllFieldsLC(TInt aIndex,const TDesC& aSeparator) const;
   1.396 +	const CViewContact& ContactAtL(TInt aIndex) const;
   1.397 +	TContactViewPreferences ContactViewPreferences();
   1.398 +	const RContactViewSortOrder& SortOrderL() const;
   1.399 +private: // From MContactViewObserver.
   1.400 +	virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent);
   1.401 +private:
   1.402 +//ChrisD: why private d'tor
   1.403 +	~CContactSubView();
   1.404 +	CContactSubView(const CContactDatabase& aDb,CContactViewBase& aView);
   1.405 +	CContactSubView(const CContactDatabase& aDb,const CContactSubView& aView);
   1.406 +	void CommonConstructL(MContactViewObserver& aObserver);
   1.407 +	void ConstructL(MContactViewObserver& aObserver,const TDesC& aBoundary);
   1.408 +	void ConstructL(MContactViewObserver& aObserver,const CContactSubView& aView);
   1.409 +	void ConstructL(MContactViewObserver& aObserver,const CContactSubView& aView,const TDesC& aBoundary);
   1.410 +	void ConstructL(MContactViewObserver& aObserver,const TDesC& aLowBoundary,const TDesC& aHighBoundary);
   1.411 +	CContactViewRangeBase::TCriteria DecodeBoundary(TDes& aBoundary) const;
   1.412 +	TInt MapToUnderlyingViewIndex(TInt aSubViewIndex) const;
   1.413 +	TInt MapToSubViewIndex(TInt aUnderlyingViewIndex) const;
   1.414 +private:
   1.415 +	CContactViewBase& iView;
   1.416 +	CContactViewRangeBase* iRange;
   1.417 +	TUint iClassVersion; //version class - used for TContactViewEvent dispatching
   1.418 +	};
   1.419 +
   1.420 +
   1.421 +class CContactConcatenatedView : public CContactViewBase, public MContactViewObserver
   1.422 +/** Concatenates multiple contact views into a single contiguous view.
   1.423 +
   1.424 +The component views are ordered according to their order in the array passed 
   1.425 +into the NewL(). 
   1.426 +@publishedAll
   1.427 +@released
   1.428 +*/
   1.429 +	{
   1.430 +public:
   1.431 +	IMPORT_C static CContactConcatenatedView* NewL(MContactViewObserver& aObserver,const CContactDatabase& aDb,RPointerArray<CContactViewBase>& aComponentViews);
   1.432 +	//All CContactViewBase derived classes in public headers,
   1.433 +	//should mandatorily implement this reserved function.	
   1.434 +	TAny* CContactViewBase_Reserved_1(TFunction aFunction,TAny* aParams);
   1.435 +public: // From CContactViewBase.
   1.436 +	TContactItemId AtL(TInt aIndex) const;
   1.437 +	TInt CountL() const;
   1.438 +	TInt FindL(TContactItemId aId) const;
   1.439 +	HBufC* AllFieldsLC(TInt aIndex,const TDesC& aSeparator) const;
   1.440 +	const CViewContact& ContactAtL(TInt aIndex) const;
   1.441 +	TContactViewPreferences ContactViewPreferences();
   1.442 +	const RContactViewSortOrder& SortOrderL() const;
   1.443 +private: // From MContactViewObserver.
   1.444 +	virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent);
   1.445 +private:
   1.446 +	struct TComponentView
   1.447 +		{
   1.448 +		TComponentView(CContactViewBase& aView,TState aState);
   1.449 +		CContactViewBase& iView;
   1.450 +		TState iState;
   1.451 +		};
   1.452 +private:
   1.453 +	~CContactConcatenatedView();
   1.454 +	CContactConcatenatedView(const CContactDatabase& aDb);
   1.455 +	void ConstructL(MContactViewObserver& aObserver,RPointerArray<CContactViewBase>& aComponentViews);
   1.456 +	void CopyComponentViewsL(RPointerArray<CContactViewBase>& aComponentViews);
   1.457 +	void OpenComponentViewsL();
   1.458 +	void CloseComponentViews();
   1.459 +	TBool ComponentViewsReady();
   1.460 +	void SetComponentViewReady(const CContactViewBase& aView);
   1.461 +	TInt OffsetL(const CContactViewBase& aView);
   1.462 +	static TBool ComponentViewsEqual(const TComponentView& aFirst,const TComponentView& aSecond);
   1.463 +	TInt FindComponentView(const CContactViewBase& aView);
   1.464 +private:
   1.465 +	RArray<TComponentView> iComponentView;
   1.466 +	};
   1.467 +
   1.468 +
   1.469 +inline TInt CContactViewRangeBase::LowIndex() const 
   1.470 +/** Gets the index into the sub view's underlying view of the item at the bottom 
   1.471 +of the range.
   1.472 +
   1.473 +@return The index of the item at the bottom of the range. */
   1.474 +	{ return iLow; }
   1.475 +
   1.476 +inline TInt CContactViewRangeBase::HighIndex() const 
   1.477 +/** Gets the index into the sub view's underlying view of the item at the top of 
   1.478 +the range.
   1.479 +	
   1.480 +@return The index of the item at the top of the range. */
   1.481 +	{ return iHigh; }
   1.482 +
   1.483 +#endif