emailuis/emailui/inc/FreestyleMessageHeaderHTML.h
branchRCL_3
changeset 22 d620048b4810
parent 16 b5fbb9b25d57
equal deleted inserted replaced
20:efd4f1afd43e 22:d620048b4810
    18 #ifndef __CFREESTYLE_MESSAGE_HEADER_HTML_H__
    18 #ifndef __CFREESTYLE_MESSAGE_HEADER_HTML_H__
    19 #define __CFREESTYLE_MESSAGE_HEADER_HTML_H__
    19 #define __CFREESTYLE_MESSAGE_HEADER_HTML_H__
    20 
    20 
    21 #include <e32base.h>
    21 #include <e32base.h>
    22 #include <biditext.h>  
    22 #include <biditext.h>  
       
    23 #include <babitflags.h>
    23 
    24 
    24 #include "cfsmailmessage.h"
    25 #include "cfsmailmessage.h"
    25 #include "cfsmailaddress.h"
    26 #include "cfsmailaddress.h"
    26 #include "FreestyleMessageHeaderURLFactory.h"
    27 #include "FreestyleMessageHeaderURLFactory.h"
    27 
    28 
    31 
    32 
    32 
    33 
    33 class CFreestyleMessageHeaderHTML : public CBase
    34 class CFreestyleMessageHeaderHTML : public CBase
    34     {
    35     {
    35 public:
    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     
    36     IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, 
    63     IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, 
    37                                   RWriteStream& aWriteStream, 
    64                                   RWriteStream& aWriteStream, 
    38                                   TInt aVisibleWidth, 
    65                                   TInt aVisibleWidth, 
    39                                   TInt aScrollPosition,
    66                                   TInt aScrollPosition,
    40                                   const TBool aAutoLoadImages,                                  
    67                                   const TBool aAutoLoadImages,                                  
    41                                   const TBool aExpanded );
    68                                   const TBitFlags& aFlags );
    42     IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, 
    69     IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, 
    43                                   RFile& aFile, 
    70                                   RFile& aFile, 
    44                                   TInt aVisibleWidth, 
    71                                   TInt aVisibleWidth, 
    45                                   TInt aScrollPosition,
    72                                   TInt aScrollPosition,
    46                                   const TBool aAutoLoadImages,
    73                                   const TBool aAutoLoadImages,
    47                                   const TBool aExpanded );
    74                                   const TBitFlags& aFlags );
    48     IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, 
    75     IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, 
    49                                   RFs& aFs, 
    76                                   RFs& aFs, 
    50                                   const TPath& aFilePath, 
    77                                   const TPath& aFilePath, 
    51                                   TInt aVisibleWidth, 
    78                                   TInt aVisibleWidth, 
    52                                   TInt aScrollPosition,
    79                                   TInt aScrollPosition,
    53                                   const TBool aAutoLoadImages,
    80                                   const TBool aAutoLoadImages,
    54                                   const TBool aExpanded );
    81                                   const TBitFlags& aFlags );
    55     
    82     
    56     IMPORT_C static CFreestyleMessageHeaderHTML* NewL( CFSMailMessage& aMailMessage,
    83     IMPORT_C static CFreestyleMessageHeaderHTML* NewL( CFSMailMessage& aMailMessage,
    57                                                        RWriteStream& aWriteStream,
    84                                                        RWriteStream& aWriteStream,
    58                                                        TInt aVisibleWidth,
    85                                                        TInt aVisibleWidth,
    59                                                        TInt aScrollPosition,
    86                                                        TInt aScrollPosition,
    60                                                        const TBool aAutoLoadImages,
    87                                                        const TBool aAutoLoadImages,
    61                                                        const TBool aExpanded );
    88                                                        const TBitFlags& aFlags );
    62     
    89     
    63     ~CFreestyleMessageHeaderHTML();
    90     ~CFreestyleMessageHeaderHTML();
    64     
    91     
    65     IMPORT_C void ExportL() const;
    92     IMPORT_C void ExportL() const;
    66     
    93     
    68     CFreestyleMessageHeaderHTML( CFSMailMessage& aMailMessage,
    95     CFreestyleMessageHeaderHTML( CFSMailMessage& aMailMessage,
    69                                  RWriteStream& aWriteStream,
    96                                  RWriteStream& aWriteStream,
    70                                  TInt aVisibleWidth,
    97                                  TInt aVisibleWidth,
    71                                  TInt aScrollPosition,
    98                                  TInt aScrollPosition,
    72                                  const TBool aAutoLoadImages,
    99                                  const TBool aAutoLoadImages,
    73                                  const TBool aExpanded );
   100                                  const TBitFlags& aFlags );
    74     void ConstructL();
   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;
    75     
   115     
    76     void HTMLStartL() const;
   116     void ExportAttachmentTablesL() const;
    77     void HTMLEndL() const;
   117     void ExportCollapsedAttachmentTableL( const TBool aHide ) const;
    78     
   118     void ExportCollapsedAttachmentsTableRowL() const;
    79     void ExportHTMLHeaderL() const;
   119     void ExportExpandedAttachmentTableL( const TBool aHide ) const;
    80     void HTMLHeaderStartL() const;
   120     void ExportExpandedAttachmentsTableRowsL() const;
    81     void HTMLMetaL() const;
   121     void ExportAttachmentsL() const;    
    82     void HTMLHeaderEndL() const;
   122     void ExportAttachmentL( CFSMailMessagePart& aAttachment ) const;    
       
   123     void ExportAttachmentIconL() const;
    83 
   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;
    84     void ExportDisplayImagesTableL() const;
   147     void ExportDisplayImagesTableL() const;
    85 
   148     void ExportBodyStyleL() const;
    86     void ExportHTMLBodyL() const;
       
    87     void HTMLBodyStartL() const;
       
    88     void HTMLBodyEndL() const;
       
    89     
       
    90     /*
       
    91      * Writes the subject to iWriteStream and also
       
    92      * takes care of the urls and marks them as hotspots
       
    93      */
       
    94     void WriteSubjectL(TDesC& aText ) const; 
       
    95 
       
    96     void ExportCollapseButtonL() const;
       
    97     void ExportTimeAndExpandButtonL() const;
       
    98     void ExportSubjectL() const;
       
    99     void ExportSubjectCollapsedL() const;
       
   100     void ExportFromL() const;
       
   101     void ExportToL() const;
       
   102     void ExportCcL() const;
       
   103     void ExportBccL() const;
       
   104     void ExportSentTimeL() const;
       
   105     void ExportAttachmentsL() const;
       
   106     
       
   107     void ExportEmailAddressesL( FreestyleMessageHeaderURLFactory::TEmailAddressType aEmailAddressType, 
       
   108                                 const RPointerArray<CFSMailAddress>& aEmailAddresses,
       
   109                                 const TDesC8& aRowId,
       
   110                                 const TDesC8& aTableId,
       
   111                                 TInt aHeaderTextResourceId ) const;
       
   112     
       
   113     void AddEmailAddressL( FreestyleMessageHeaderURLFactory::TEmailAddressType aEmailAddressType, 
       
   114                            const CFSMailAddress& aEmailAddress ) const;
       
   115     
       
   116     void AddAttachmentL( CFSMailMessagePart& aAttachment ) const;
       
   117 
       
   118     void StartHyperlinkL( const TDesC8& aUrl ) const;
       
   119     void EndHyperlinkL() const;
       
   120     
       
   121     void AddImageL( const TDesC8& aImageUrl ) const;
       
   122     void AddImageL( const TDesC8& aImageId, const TDesC8& aImageUrl, const TDesC8& aImageEvent ) const;
       
   123     
       
   124     void StartHeaderTableL( const TDesC8& aTableId, TBool aVisible ) const;
       
   125     void EndHeaderTableL() const;
       
   126 
       
   127     void StartTableL( const TDesC8& aTableId ) const;
       
   128     void EndTableL() const;
       
   129 
       
   130     HBufC8* ClickImageEventL( const TDesC8& aImageName ) const;
       
   131 
       
   132     void AddJavascriptL() const;    
       
   133     
       
   134     HBufC8* HeadingTextLC( TInt aId ) const;
       
   135     HBufC8* HeadingTextLC( TInt aId, TInt aSize ) const;
       
   136 
       
   137     void ExportCollapsedHeaderTableL() const;
       
   138     void ExportExpandedHeaderTableL() const;
       
   139 
       
   140     /**
       
   141      * Function for generating follow up icon's HTML code.
       
   142      * Returns NULL if no follow up flags are set.
       
   143      *
       
   144      * @param aShowText Whether to show icon's text after the icon or not.
       
   145      */
       
   146     HBufC8* HTMLHeaderFollowUpIconLC( TBool aShowText ) const;
       
   147     
       
   148     /**
       
   149      * Function for generating priority icon's HTML code.
       
   150      * Returns NULL if mail message's priority is normal.
       
   151      *
       
   152      * @param aShowText Whether to show icon's text after the icon or not.
       
   153      */
       
   154     HBufC8* HTMLHeaderPriorityIconLC( TBool aShowText ) const;
       
   155     void AddStyleSheetL() const;
       
   156     void StartDivL() const;
       
   157     void EndDivL() const;
       
   158     
   149     
   159 private:
   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 
   160     CFSMailMessage&             iMailMessage; 
   161     CFSMailMessage&             iMailMessage; 
   161     RWriteStream&               iWriteStream;
   162     RWriteStream&               iWriteStream;
   162     TInt                        iVisibleWidth;
   163     TInt                        iVisibleWidth;
   163     TInt                        iScrollPosition;
   164     TInt                        iScrollPosition;
   164     TBool                       iAutoLoadImages;
       
   165     TBool                       iMirrorLayout;
       
   166     TBool                       iExpanded;
       
   167     RPointerArray<CFSMailMessagePart> iAttachments;
   165     RPointerArray<CFSMailMessagePart> iAttachments;
       
   166     TBitFlags iExportFlags;
   168 };
   167 };
   169 
   168 
   170 #endif //__CFREESTYLE_MESSAGE_HEADER_HTML_H__
   169 #endif //__CFREESTYLE_MESSAGE_HEADER_HTML_H__