|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Concrete Phonebook contact name formatting interface |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CPBKCONTACTNAMEFORMATTER_H__ |
|
21 #define __CPBKCONTACTNAMEFORMATTER_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include "CPbkContactNameFormatterBase.h" |
|
25 #include <cntviewbase.h> |
|
26 #include "TPbkTitleFieldFilter.h" |
|
27 |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CPbkSortOrderManager; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /// Maximum of 2 fields (last name + first name) are used to format a title |
|
35 const TInt KMaxTitleFields = 2; |
|
36 |
|
37 /** |
|
38 * Phonebook contact name formatting implementation class. This class |
|
39 * encapsulates contact name formatting rules in Series60 Phonebook |
|
40 * application. |
|
41 */ |
|
42 NONSHARABLE_CLASS(CPbkContactNameFormatter) : |
|
43 public CPbkContactNameFormatterBase |
|
44 { |
|
45 public: // constructor and destructor |
|
46 /** |
|
47 * Constructor. |
|
48 * |
|
49 * @param aUnnamedText text to use for unnamed contacts. |
|
50 * @param aEngine engine for formatting contacts |
|
51 */ |
|
52 static CPbkContactNameFormatter* NewL( |
|
53 const TDesC& aUnnamedText, |
|
54 const CPbkSortOrderManager& aSortOrderManager); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 ~CPbkContactNameFormatter(); |
|
60 |
|
61 public: // from MPbkContactNameFormat |
|
62 void GetContactTitle |
|
63 (const MPbkFieldDataArray& aContactData, TDes& aTitle) const; |
|
64 const MPbkFieldDataArray& FilterContactTitleFields |
|
65 (const MPbkFieldDataArray& aContactData) const; |
|
66 void GetContactListTitle |
|
67 (const MPbkFieldDataArray& aContactData, TDes& aTitle) const; |
|
68 const MPbkFieldDataArray& FilterContactFieldsForFind |
|
69 (const MPbkFieldDataArray& aContactData) const; |
|
70 TInt ContactTitleLength |
|
71 (const MPbkFieldDataArray& aContactData) const; |
|
72 TInt ContactListTitleLength |
|
73 (const MPbkFieldDataArray& aContactData) const; |
|
74 |
|
75 private: // implementation |
|
76 CPbkContactNameFormatter(const CPbkSortOrderManager& aSortOrderManager); |
|
77 void ConstructL(const TDesC& aUnnamedText); |
|
78 void TrimName(TInt aTitleType, const TDesC& aName, TDes& aTitle) const; |
|
79 void DoGetContactTitle |
|
80 (const MPbkFieldDataArray& aContactData, TDes& aTitle, |
|
81 TInt aTitleType) const; |
|
82 |
|
83 private: // data members |
|
84 typedef TPbkTitleFieldFilter<KMaxTitleFields> TTitleFieldFilter; |
|
85 /// Own: title field filter |
|
86 TTitleFieldFilter* iTitleFieldFilter; |
|
87 /// Ref: engine used when formatting contacts |
|
88 const CPbkSortOrderManager& iSortOrderManager; |
|
89 }; |
|
90 |
|
91 |
|
92 #endif // __CPBKCONTACTNAMEFORMATTER_H__ |
|
93 |
|
94 // End of File |