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 * Abstract utility class for phone number formatting. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CLOCPHONENUMBERFORMAT_H_ |
|
21 #define CLOCPHONENUMBERFORMAT_H_ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <AknUtils.h> |
|
26 #include <bldvariant.hrh> |
|
27 |
|
28 // DATA TYPES |
|
29 /** |
|
30 * Enumeration for numberformatting results. |
|
31 */ |
|
32 enum TFormatResult |
|
33 { |
|
34 EResultOK, // No loss of precision on formatting. |
|
35 EResultTruncated, // result descriptor truncated from the start. |
|
36 EResultClipped, // result descriptor truncated and extra dots added to start |
|
37 }; |
|
38 |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 class CFont; |
|
42 class CEikFormattedCellListBox; |
|
43 class CEikColumnListBox; |
|
44 class CAknPhoneNumberGrouping; |
|
45 |
|
46 // CLASS DECLARATION |
|
47 |
|
48 /** |
|
49 * Class for phone number formatting. It uses the AknPhoneNumberGrouping feature. |
|
50 * AknPhoneNumberGrouping takes care of grouping based on the feature flag |
|
51 * __SERIES60_PHONE_NUMBER_GROUPING. |
|
52 * Formatting & clipping is done using AknTextUtils helper methods. |
|
53 */ |
|
54 class CLocPhoneNumberFormat :public CBase |
|
55 { |
|
56 public: // Constructors and destructor |
|
57 |
|
58 /** |
|
59 * Symbian OS constructor |
|
60 * @return new object |
|
61 */ |
|
62 IMPORT_C static CLocPhoneNumberFormat* NewL(); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CLocPhoneNumberFormat(); |
|
68 |
|
69 protected: |
|
70 |
|
71 /** |
|
72 * C++ default constructor. |
|
73 */ |
|
74 CLocPhoneNumberFormat(); |
|
75 |
|
76 /** |
|
77 * Symbian 2nd Phase Contructor. |
|
78 * This is always protected |
|
79 */ |
|
80 void ConstructL(); |
|
81 |
|
82 public: // New functions |
|
83 |
|
84 /** |
|
85 * Phone number formatting for listbox texts. |
|
86 * Uses AknTextUtils for clipping long descriptors. |
|
87 * @param aNumberToFormat phone number in string to format |
|
88 * @param aFormattedString formatted number |
|
89 * @param aClipDirection tells how to clip |
|
90 * @param aListBox reference to the listbox which shows the number |
|
91 * @param aItemIndex item index |
|
92 * @param aSubCellNumber subcell number |
|
93 * @param aIcons 0->no icons, 1->ind. arrow, 2->1 icon, etc. |
|
94 * @return TFormatResult |
|
95 */ |
|
96 IMPORT_C TFormatResult PhoneNumberFormatL( const TDesC& aNumberToFormat, |
|
97 TDes& aFormattedString, AknTextUtils::TClipDirection aClipDirection, |
|
98 CEikFormattedCellListBox* aListBox, TInt aItemIndex, |
|
99 TInt aSubCellNumber, TInt aIcons ); |
|
100 |
|
101 /** |
|
102 * Groups the Phone number according to the current settings |
|
103 * The ownership of the grouped string is tranferred back to the |
|
104 * callee |
|
105 * @param aNumberToGroup Phone number to group |
|
106 * @return HBufC* Phone number after grouping. If the number |
|
107 * cannot be formatted then NULL is returned |
|
108 */ |
|
109 IMPORT_C HBufC* PhoneNumberGroupL( const TDesC& aNumberToGroup ); |
|
110 |
|
111 private: |
|
112 /** |
|
113 * Phone number formatting. |
|
114 * @param aNumberToFormat phone number in string to format |
|
115 * @param aFormattedString formatted number |
|
116 * @return TFormatResult |
|
117 */ |
|
118 TFormatResult PhoneNumberFormatL( const TDesC& aNumberToFormat, |
|
119 TDes& aFormattedString ); |
|
120 |
|
121 private: |
|
122 CAknPhoneNumberGrouping* iPNGEngine; |
|
123 }; |
|
124 |
|
125 #endif // CLOCPHONENUMBERFORMAT_H_ |
|
126 |
|
127 // End of File |
|