|
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 field formatter. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2FIELDFORMATTER_H |
|
20 #define CPBK2FIELDFORMATTER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class MPbk2PhoneNumberFormatter; |
|
27 class MVPbkBaseContactField; |
|
28 class MVPbkFieldType; |
|
29 class MPbk2FieldPropertyArray; |
|
30 class MVPbkContactFieldDateTimeData; |
|
31 class MVPbkFieldTypeList; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Phonebook 2 field formatter. |
|
37 * |
|
38 * Responsible for formatting list box field for contact |
|
39 * field presentation needs. |
|
40 */ |
|
41 NONSHARABLE_CLASS(CPbk2FieldFormatter) : public CBase |
|
42 { |
|
43 public: // Construction and destruction |
|
44 |
|
45 /** |
|
46 * Creates a new instance of this class. |
|
47 * |
|
48 * @param aFieldProperties Field property array |
|
49 * @param aFieldTypeList Virtual Phonebook field type list. |
|
50 * @return A new instance of this class. |
|
51 */ |
|
52 IMPORT_C static CPbk2FieldFormatter* NewL( |
|
53 const MPbk2FieldPropertyArray& aFieldProperties, |
|
54 const MVPbkFieldTypeList& aFieldTypeList ); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 ~CPbk2FieldFormatter(); |
|
60 |
|
61 public: // Interface |
|
62 |
|
63 /** |
|
64 * Returns formatted contents of given field. |
|
65 * |
|
66 * @param aField The field to format. |
|
67 * @param aFieldType The field type of the field. |
|
68 * @return Formatted content of the field. |
|
69 */ |
|
70 IMPORT_C TPtrC FormatFieldContentL( |
|
71 const MVPbkBaseContactField& aField, |
|
72 const MVPbkFieldType& aFieldType ); |
|
73 |
|
74 /** |
|
75 * Sets the field's time format. |
|
76 * |
|
77 * @param aTimeFormat Time format to set. |
|
78 */ |
|
79 IMPORT_C void SetTimeFormatL( |
|
80 const TDesC& aTimeFormat ); |
|
81 |
|
82 private: // Implementation |
|
83 CPbk2FieldFormatter( |
|
84 const MPbk2FieldPropertyArray& aFieldProperties, |
|
85 const MVPbkFieldTypeList& aFieldTypeList ); |
|
86 void ConstructL(); |
|
87 TPtr ReallocBufferL( |
|
88 TInt aNewSize ); |
|
89 TBool MatchesFieldTypeL( |
|
90 const MVPbkFieldType& aFieldType, |
|
91 TInt aResourceId ) const; |
|
92 void FormatPhoneNumberContentL( |
|
93 TPtrC& aRawContent, |
|
94 TPtr& aFormattedContent ); |
|
95 void FormatDtmfContentL( |
|
96 TPtrC& aRawContent, |
|
97 TPtr& aFormattedContent ); |
|
98 void FormatSyncContentL( |
|
99 TPtrC& aRawContent, |
|
100 TPtr& aFormattedContent ); |
|
101 void FormatFileNameContentL( |
|
102 TPtrC& aRawContent, |
|
103 TPtr& aFormattedContent ); |
|
104 void FormatTextContentL( |
|
105 TPtrC& aRawContent, |
|
106 TPtr& aFormattedContent, |
|
107 const MVPbkFieldType& aFieldType ); |
|
108 void FormatAddressContentL( |
|
109 TPtrC& aRawContent, |
|
110 TPtr& aFormattedContent ); |
|
111 void FormatDateTimeContentL( |
|
112 const MVPbkContactFieldDateTimeData& aRawContent, |
|
113 TPtr& aFormattedContent ); |
|
114 |
|
115 private: // Data |
|
116 /// Own: Buffer for handling line strings |
|
117 HBufC* iBuffer; |
|
118 /// Own: Time format |
|
119 HBufC* iTimeFormat; |
|
120 /// Own: Phone number formatter |
|
121 MPbk2PhoneNumberFormatter* iNumberFormatter; |
|
122 /// Ref: Phonebook 2 field property array |
|
123 const MPbk2FieldPropertyArray& iFieldProperties; |
|
124 /// Ref: Virtual Phonebook field type list |
|
125 const MVPbkFieldTypeList& iFieldTypeList; |
|
126 }; |
|
127 |
|
128 #endif // CPBK2FIELDFORMATTER_H |
|
129 |
|
130 // End of File |