|
1 /* |
|
2 * Copyright (c) 2007-2008 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: Message header HTML |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CFREESTYLE_MESSAGE_HEADER_HTML_H__ |
|
19 #define __CFREESTYLE_MESSAGE_HEADER_HTML_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <biditext.h> |
|
23 #include <babitflags.h> |
|
24 |
|
25 #include "cfsmailmessage.h" |
|
26 #include "cfsmailaddress.h" |
|
27 #include "FreestyleMessageHeaderURLFactory.h" |
|
28 |
|
29 class RWriteStream; |
|
30 class RFs; |
|
31 class RFile; |
|
32 |
|
33 |
|
34 class CFreestyleMessageHeaderHTML : public CBase |
|
35 { |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Flags to control exporting |
|
40 */ |
|
41 enum TExportFlag |
|
42 { |
|
43 // Header is expanded |
|
44 EHeaderExpanded, |
|
45 // Attachments are expanded |
|
46 EAttachmentExpanded, |
|
47 // To field is expanded |
|
48 EToExpanded, |
|
49 // Cc field is expanded |
|
50 ECcExpanded, |
|
51 // Bcc field is expanded |
|
52 EBccExpanded, |
|
53 |
|
54 // ** For internal use only ** |
|
55 // Load images automatically |
|
56 EAutoLoadImages, |
|
57 // Mirrored layout in use |
|
58 EMirroredLayout |
|
59 }; |
|
60 |
|
61 public: |
|
62 |
|
63 IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, |
|
64 RWriteStream& aWriteStream, |
|
65 TInt aVisibleWidth, |
|
66 TInt aScrollPosition, |
|
67 const TBool aAutoLoadImages, |
|
68 const TBitFlags& aFlags ); |
|
69 IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, |
|
70 RFile& aFile, |
|
71 TInt aVisibleWidth, |
|
72 TInt aScrollPosition, |
|
73 const TBool aAutoLoadImages, |
|
74 const TBitFlags& aFlags ); |
|
75 IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, |
|
76 RFs& aFs, |
|
77 const TPath& aFilePath, |
|
78 TInt aVisibleWidth, |
|
79 TInt aScrollPosition, |
|
80 const TBool aAutoLoadImages, |
|
81 const TBitFlags& aFlags ); |
|
82 |
|
83 IMPORT_C static CFreestyleMessageHeaderHTML* NewL( CFSMailMessage& aMailMessage, |
|
84 RWriteStream& aWriteStream, |
|
85 TInt aVisibleWidth, |
|
86 TInt aScrollPosition, |
|
87 const TBool aAutoLoadImages, |
|
88 const TBitFlags& aFlags ); |
|
89 |
|
90 ~CFreestyleMessageHeaderHTML(); |
|
91 |
|
92 IMPORT_C void ExportL() const; |
|
93 |
|
94 private: |
|
95 CFreestyleMessageHeaderHTML( CFSMailMessage& aMailMessage, |
|
96 RWriteStream& aWriteStream, |
|
97 TInt aVisibleWidth, |
|
98 TInt aScrollPosition, |
|
99 const TBool aAutoLoadImages, |
|
100 const TBitFlags& aFlags ); |
|
101 void ConstructL(); |
|
102 |
|
103 void ExportHeaderTablesL() const; |
|
104 void ExportCollapsedHeaderTableL() const; |
|
105 void ExportExpandedHeaderTablesL() const; |
|
106 |
|
107 void ExportTableVisibilityParameterL( const TDesC& aTableName, const TBitFlags& aFlags ) const; |
|
108 void ExportTableVisibilityParameterL( const TDesC& aTableName, const TBool aVisible ) const; |
|
109 void ExportTableBeginL( const TDesC& aTableName, const TBitFlags& aFlags = TBitFlags() ) const; |
|
110 void ExportTableEndL() const; |
|
111 void ExportInnerTableBeginL( const TDesC& aTableName, const TInt aColSpan, const TBitFlags& aFlags = TBitFlags() ) const; |
|
112 void ExportInnerTableBeginWithRowBeginL( const TDesC& aTableName, const TInt aColSpan, const TBool aVisible, const TBitFlags& aFlags = TBitFlags() ) const; |
|
113 void ExportInnerTableEndL() const; |
|
114 void ExportInnerTableEndWithRowEndL() const; |
|
115 |
|
116 void ExportAttachmentTablesL() const; |
|
117 void ExportCollapsedAttachmentTableL( const TBool aHide ) const; |
|
118 void ExportCollapsedAttachmentsTableRowL() const; |
|
119 void ExportExpandedAttachmentTableL( const TBool aHide ) const; |
|
120 void ExportExpandedAttachmentsTableRowsL() const; |
|
121 void ExportAttachmentsL() const; |
|
122 void ExportAttachmentL( CFSMailMessagePart& aAttachment ) const; |
|
123 void ExportAttachmentIconL() const; |
|
124 |
|
125 void ExportSenderTableRowL( const TBool aCollapsed ) const; |
|
126 void ExportSenderAddressTableRowL() const; |
|
127 void ExportDateTimeTableRowL( const TInt aColSpan = 1 ) const; |
|
128 void ExportSubjectTableRowL( const TBool aShowLabel = EFalse ) const; |
|
129 void ExportMessageIconsL() const; |
|
130 void ExportFromTableRowL() const; |
|
131 void ExportToTableL() const; |
|
132 void ExportCcTableL() const; |
|
133 void ExportBccTableL() const; |
|
134 void ExportRecipientsTableL( const TDesC& aType, const TInt aLabelResourceId, |
|
135 const RPointerArray<CFSMailAddress>& aRecipients, const TBool aExpanded ) const; |
|
136 void ExportRecipientsL( const TDesC& aType, const RPointerArray<CFSMailAddress>& aRecipients ) const; |
|
137 void ExportExpandRecipientsL( const TDesC& aType, const TInt aCount ) const; |
|
138 void ExportExpandAttachmentsL( const TDesC& aType, const TInt aCount ) const; |
|
139 void ExportLabelTableRowL( const TInt aResourceId, const TInt aColSpan = 1 ) const; |
|
140 void ExportIconL( const TDesC& aIconName ) const; |
|
141 HBufC* SubjectLC() const; |
|
142 TInt CalculateTotalSpaceRequired( const TDesC& aText, CFindItemEngine& aItemEngine, |
|
143 TInt& aMaxLength ) const; |
|
144 HBufC* CreateLinksLC( const TDesC& aText, const TInt aSearchCases ) const; |
|
145 void ExportHTMLBodyStartL() const; |
|
146 void ExportHTMLBodyEndL() const; |
|
147 void ExportDisplayImagesTableL() const; |
|
148 void ExportBodyStyleL() const; |
|
149 |
|
150 private: |
|
151 |
|
152 // Table formatting flags |
|
153 enum TTableStyleFlags |
|
154 { |
|
155 // Table is hidden |
|
156 EHidden, |
|
157 // Table width is fixed |
|
158 EFixed |
|
159 }; |
|
160 |
|
161 CFSMailMessage& iMailMessage; |
|
162 RWriteStream& iWriteStream; |
|
163 TInt iVisibleWidth; |
|
164 TInt iScrollPosition; |
|
165 RPointerArray<CFSMailMessagePart> iAttachments; |
|
166 TBitFlags iExportFlags; |
|
167 }; |
|
168 |
|
169 #endif //__CFREESTYLE_MESSAGE_HEADER_HTML_H__ |