63
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2007 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: Phonebook 2 contact name formatter interface.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef MPBK2CONTACTNAMEFORMATTER_H
|
|
20 |
#define MPBK2CONTACTNAMEFORMATTER_H
|
|
21 |
|
|
22 |
// INCLUDE FILES
|
|
23 |
#include <e32std.h>
|
|
24 |
|
|
25 |
// FORWARD DECLARATIONS
|
|
26 |
class MVPbkBaseContactFieldCollection;
|
|
27 |
class MVPbkFieldType;
|
|
28 |
class MVPbkFieldTypeList;
|
|
29 |
class CVPbkFieldTypeRefsList;
|
|
30 |
class MVPbkBaseContactField;
|
|
31 |
class CVPbkBaseContactFieldTypeListIterator;
|
|
32 |
|
|
33 |
//Use this UID to access field property interface extension 2. Used as
|
|
34 |
//a parameter to ContactNameFormatterExtension() method.
|
|
35 |
const TUid MPbk2ContactNameFormatterExtension2Uid = { 2 };
|
|
36 |
/**
|
|
37 |
* Abstract Phonebook 2 contact name formatter interface.
|
|
38 |
*/
|
|
39 |
class MPbk2ContactNameFormatter
|
|
40 |
{
|
|
41 |
public: // Interface
|
|
42 |
|
|
43 |
/// Flags
|
|
44 |
enum TPbk2ContactTitleFormattingFlags
|
|
45 |
{
|
|
46 |
/// Formatter preserves all leading spaces
|
|
47 |
/// in the formatted title
|
|
48 |
EPreserveLeadingSpaces = 0x0001,
|
|
49 |
/// Formatter uses custom separator
|
|
50 |
/// for separating firstname and lastname
|
|
51 |
EUseSeparator = 0x0002,
|
|
52 |
/// Formatter replaces all non-graphical
|
|
53 |
/// characters with space character
|
|
54 |
EReplaceNonGraphicChars = 0x0004,
|
|
55 |
/// Formatter to retain all original space characters
|
|
56 |
EPreserveAllOriginalSpaces = 0x0008,
|
|
57 |
/// Formatter by default uses coma separator
|
|
58 |
/// for separating company name
|
|
59 |
EDisableCompanyNameSeparator = 0x0010
|
|
60 |
};
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Destructor.
|
|
64 |
*/
|
|
65 |
virtual ~MPbk2ContactNameFormatter()
|
|
66 |
{}
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Returns the title text for a contact.
|
|
70 |
*
|
|
71 |
* @param aContactFields Field collection representing
|
|
72 |
* the data in a contact.
|
|
73 |
* @param aFormattingFlags @see TPbk2ContactTitleFormattingFlags
|
|
74 |
* @return A buffer containing the formatted title,
|
|
75 |
* NULL if no title can be created.
|
|
76 |
*/
|
|
77 |
virtual HBufC* GetContactTitleOrNullL(
|
|
78 |
const MVPbkBaseContactFieldCollection& aContactFields,
|
|
79 |
TUint32 aFormattingFlags ) = 0;
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Returns the title text for a contact.
|
|
83 |
*
|
|
84 |
* @param aContactFields Field collection representing
|
|
85 |
* the data in a contact.
|
|
86 |
* @param aFormattingFlags Formatting flags,
|
|
87 |
* see TPbk2ContactTitleFormattingFlags.
|
|
88 |
* @return A buffer containing the formatted title,
|
|
89 |
* or the UnnamedText() method's result if no title
|
|
90 |
* can be created.
|
|
91 |
*/
|
|
92 |
virtual HBufC* GetContactTitleL(
|
|
93 |
const MVPbkBaseContactFieldCollection& aContactFields,
|
|
94 |
TUint32 aFormattingFlags ) = 0;
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Returns the title text for a contact.
|
|
98 |
*
|
|
99 |
* @param aContactFields Field collection representing
|
|
100 |
* the data in a contact.
|
|
101 |
* @param aTitle Buffer containing the formatted title.
|
|
102 |
* @param aFormattingFlags @see TPbk2ContactTitleFormattingFlags
|
|
103 |
*/
|
|
104 |
virtual void GetContactTitle(
|
|
105 |
const MVPbkBaseContactFieldCollection& aContactFields,
|
|
106 |
TDes& aTitle,
|
|
107 |
TUint32 aFormattingFlags ) = 0;
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Returns the title text for a contact. Unlike GetContactTitle,
|
|
111 |
* this method will build the title using all the possible fields
|
|
112 |
* (not restricting the field count). Should not be used for
|
|
113 |
* regular name formatting needs.
|
|
114 |
*
|
|
115 |
* @param aContactFields Field collection representing
|
|
116 |
* the data in a contact.
|
|
117 |
* @param aTitle Buffer containing the formatted title.
|
|
118 |
* @param aFormattingFlags @see TPbk2ContactTitleFormattingFlags
|
|
119 |
*/
|
|
120 |
virtual void GetContactTitleForFind(
|
|
121 |
const MVPbkBaseContactFieldCollection& aContactFields,
|
|
122 |
TDes& aTitle,
|
|
123 |
TUint32 aFormattingFlags ) = 0;
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Returns the name text to be used for unnamed contacts.
|
|
127 |
*
|
|
128 |
* @return Text used with unnamed contacts.
|
|
129 |
*/
|
|
130 |
virtual const TDesC& UnnamedText() const = 0;
|
|
131 |
|
|
132 |
/**
|
|
133 |
* Returns ETrue if the given field is part of the fields used to
|
|
134 |
* build the contact title.
|
|
135 |
*
|
|
136 |
* @param aContactField The contact field to inspect.
|
|
137 |
* @return ETrue if the given field is used when building
|
|
138 |
* contact titles.
|
|
139 |
*/
|
|
140 |
virtual TBool IsTitleField(
|
|
141 |
const MVPbkBaseContactField& aContactField ) const = 0;
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Returns ETrue if the given field is part of the fields used to
|
|
145 |
* build the contact title.
|
|
146 |
*
|
|
147 |
* @param aFieldType Type of the field to inspect.
|
|
148 |
* @return ETrue if the given field type is used when
|
|
149 |
* building contact titles.
|
|
150 |
*/
|
|
151 |
virtual TBool IsTitleFieldType(
|
|
152 |
const MVPbkFieldType& aFieldType ) const = 0;
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Return iterator that contains all fields that are used for making
|
|
156 |
* the formatted name.
|
|
157 |
*
|
|
158 |
* @param aFieldTypeList Field type list that is used to store
|
|
159 |
* field types for the iterator. The list
|
|
160 |
* will be resetted before use.
|
|
161 |
* @param aContactFields Field collection representing
|
|
162 |
* the data in a contact.
|
|
163 |
* @return Iterator for fields that are used for the formated title.
|
|
164 |
*/
|
|
165 |
virtual CVPbkBaseContactFieldTypeListIterator* ActualTitleFieldsLC(
|
|
166 |
CVPbkFieldTypeRefsList& aFieldTypeList,
|
|
167 |
const MVPbkBaseContactFieldCollection& aContactFields ) = 0;
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Returns the length of the formatted name.
|
|
171 |
*
|
|
172 |
* @param aContactFields Field collection representing
|
|
173 |
* the data in a contact.
|
|
174 |
* @param aFormattingFlags @see TPbk2ContactTitleFormattingFlags
|
|
175 |
* @return Length of the formatted name.
|
|
176 |
*/
|
|
177 |
virtual TInt MaxTitleLength(
|
|
178 |
const MVPbkBaseContactFieldCollection& aContactFields,
|
|
179 |
const TUint32 aFormattingFlags ) = 0;
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Returns the length of the formatted name. Unlike MaxTitleLength,
|
|
183 |
* this method will count the length using all the possible fields
|
|
184 |
* (not restricting the field count). Should not be used for
|
|
185 |
* regular name formatting needs.
|
|
186 |
*
|
|
187 |
* @param aContactFields Field collection representing
|
|
188 |
* the data in a contact.
|
|
189 |
* @param aFormattingFlags @see TPbk2ContactTitleFormattingFlags
|
|
190 |
* @return Length of the formatted name.
|
|
191 |
*/
|
|
192 |
virtual TInt MaxTitleLengthForFind(
|
|
193 |
const MVPbkBaseContactFieldCollection& aContactFields,
|
|
194 |
const TUint32 aFormattingFlags ) = 0;
|
|
195 |
|
|
196 |
/**
|
|
197 |
* Checks whether the given character is a separator character.
|
|
198 |
*
|
|
199 |
* @param aChar Character that will be checked.
|
|
200 |
* @return ETrue if character is a separator character.
|
|
201 |
*/
|
|
202 |
virtual TBool IsFindSeparatorChar(
|
|
203 |
TChar aCh ) = 0;
|
|
204 |
|
|
205 |
/**
|
|
206 |
* Returns an extension point for this interface or NULL.
|
|
207 |
*
|
|
208 |
* @param aExtensionUid Extension UID.
|
|
209 |
* @return Extension point.
|
|
210 |
*/
|
|
211 |
virtual TAny* ContactNameFormatterExtension(
|
|
212 |
TUid /*aExtensionUid*/ )
|
|
213 |
{
|
|
214 |
return NULL;
|
|
215 |
}
|
|
216 |
};
|
|
217 |
|
|
218 |
#endif // MPBK2CONTACTNAMEFORMATTER_H
|
|
219 |
|
|
220 |
// End of File
|