|
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 for japanese region. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CPBKJAPANCONTACTNAMEFORMATTER_H__ |
|
21 #define __CPBKJAPANCONTACTNAMEFORMATTER_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include "CPbkContactNameFormatterBase.h" |
|
25 #include <cntviewbase.h> |
|
26 #include "TPbkJapanTitleFieldFilter.h" |
|
27 #include "TPbkJapanFindFieldFilter.h" |
|
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 KJapanMaxTitleFields = 2; |
|
36 /// Maximum of 4 fields (last name + first name + their reading |
|
37 /// counterparts) are used in Japanese find |
|
38 const TInt KJapanMaxFindFields = 4; |
|
39 |
|
40 |
|
41 /** |
|
42 * Phonebook contact name formatting implementation class. This class |
|
43 * encapsulates contact name formatting rules in Series60 Phonebook |
|
44 * application. |
|
45 */ |
|
46 NONSHARABLE_CLASS(CPbkJapanContactNameFormatter) : |
|
47 public CPbkContactNameFormatterBase |
|
48 { |
|
49 public: // constructor and destructor |
|
50 /** |
|
51 * Constructor. |
|
52 * |
|
53 * @param aUnnamedText text to use for unnamed contacts. |
|
54 * @param aEngine engine for formatting contacts |
|
55 */ |
|
56 static CPbkJapanContactNameFormatter* NewL |
|
57 (const TDesC& aUnnamedText, const CPbkSortOrderManager& aSortOrderManager); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 ~CPbkJapanContactNameFormatter(); |
|
63 |
|
64 public: // from MPbkContactNameFormat |
|
65 void GetContactTitle |
|
66 (const MPbkFieldDataArray& aContactData, TDes& aTitle) const; |
|
67 TInt ContactTitleLength |
|
68 (const MPbkFieldDataArray& aContactData) const; |
|
69 TBool IsTitleField |
|
70 (TPbkFieldId aFieldId) const; |
|
71 const MPbkFieldDataArray& FilterContactTitleFields |
|
72 (const MPbkFieldDataArray& aContactData) const; |
|
73 void GetContactListTitle |
|
74 (const MPbkFieldDataArray& aContactData, TDes& aTitle) const; |
|
75 TInt ContactListTitleLength |
|
76 (const MPbkFieldDataArray& aContactData) const; |
|
77 |
|
78 private: // implementation |
|
79 CPbkJapanContactNameFormatter(const CPbkSortOrderManager& aSortOrderManager); |
|
80 void ConstructL(const TDesC& aUnnamedText); |
|
81 void DoGetContactTitle |
|
82 (const MPbkFieldDataArray& aContactData, TDes& aTitle, |
|
83 TInt aTitleType) const; |
|
84 void TrimName(TInt aTitleType, const TDesC& aName, TDes& aTitle) const; |
|
85 TInt TrimNameLength(TInt aTitleType, const TDesC& aName) const; |
|
86 TInt CalculateContactTitleLength |
|
87 (const MPbkFieldDataArray& aContactData, TInt aTitleType) const; |
|
88 const MPbkFieldDataArray& FilterContactFieldsForFind |
|
89 (const MPbkFieldDataArray& aContactData) const; |
|
90 |
|
91 private: // data members |
|
92 typedef TPbkJapanTitleFieldFilter<KJapanMaxTitleFields> TTitleFieldFilter; |
|
93 typedef TPbkJapanFindFieldFilter<KJapanMaxFindFields> TFindFieldFilter; |
|
94 /// Own: title field filter |
|
95 TTitleFieldFilter* iTitleFieldFilter; |
|
96 /// Own: find field filter |
|
97 TFindFieldFilter* iFindFieldFilter; |
|
98 /// Ref: engine used when formatting contacts |
|
99 const CPbkSortOrderManager& iSortOrderManager; |
|
100 }; |
|
101 |
|
102 |
|
103 #endif // __CPBKJAPANCONTACTNAMEFORMATTER_H__ |
|
104 |
|
105 // End of File |