messagingappbase/msgeditor/viewinc/MsgXhtmlBodyControl.h
branchRCL_3
changeset 60 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 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:  MsgXhtmlBodyControl  declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMSGXHTMLBODYCONTROL_H
       
    21 #define CMSGXHTMLBODYCONTROL_H
       
    22 
       
    23 // ========== INCLUDE FILES ================================
       
    24 
       
    25 #include <xhtmlparser.h>
       
    26 #include <MsgBodyControl.h>               // for CMsgBodyControl
       
    27 #include <msgasynccontrol.h>              // for MMsgAsynchControl
       
    28 
       
    29 // ========== CONSTANTS ====================================
       
    30 
       
    31 // ========== MACROS =======================================
       
    32 
       
    33 // ========== DATA TYPES ===================================
       
    34 
       
    35 // ========== FUNCTION PROTOTYPES ==========================
       
    36 
       
    37 // ========== FORWARD DECLARATIONS =========================
       
    38 
       
    39 class CMsgEditorView;
       
    40 class CXhtmlParser;
       
    41 
       
    42 // ========== CLASS DECLARATION ============================
       
    43 
       
    44 /**
       
    45 * Defines a XHTML body control for message editors/viewers.
       
    46 *
       
    47 * @since 3.2
       
    48 * @lib MsgEditorView.lib
       
    49 */
       
    50 NONSHARABLE_CLASS( CMsgXhtmlBodyControl ): public CMsgBodyControl,
       
    51                                            public MMsgAsyncControl,
       
    52                                            public MXhtmlParserObserver
       
    53     {
       
    54     public:
       
    55         
       
    56         /**
       
    57         * Factory method that creates this control.
       
    58         *
       
    59         * @param aParent Parent control
       
    60         *
       
    61         * @return Pointer to creates CMsgXhtmlBodyControl object
       
    62         */
       
    63         IMPORT_C static CMsgXhtmlBodyControl* NewL( CMsgEditorView& aParent,
       
    64                                                     MMsgAsyncControlObserver* aObserver );
       
    65         
       
    66         /**
       
    67         * Destructor.
       
    68         */
       
    69         virtual ~CMsgXhtmlBodyControl();
       
    70     
       
    71     public:
       
    72         
       
    73         /**
       
    74         * From MMsgAsyncControl
       
    75         *
       
    76         * Load content to from given file handle to control asynchronously.
       
    77         *
       
    78         * @param aFileHandle Valid file handle.
       
    79         */
       
    80         void LoadL( RFile& aFileHandle );
       
    81         
       
    82         /**
       
    83         * From MMsgAsyncControl
       
    84         *
       
    85         * Cancels the asyncronous operation if it is pending.
       
    86         */         
       
    87         void Cancel();
       
    88         
       
    89         /**
       
    90         * From MMsgAsyncControl
       
    91         *
       
    92         * Closes control. Closing means freeing file
       
    93         * specific resources that other application can use the file.
       
    94         */         
       
    95         void Close();
       
    96         
       
    97         /**
       
    98         * From MMsgAsyncControl
       
    99         *
       
   100         * Return current state.
       
   101         */
       
   102         TMsgAsyncControlState State() const;
       
   103 
       
   104         /**
       
   105         * From MMsgAsyncControl
       
   106         *
       
   107         * Return error code of the operation.
       
   108         */
       
   109         TInt Error() const;
       
   110         
       
   111         /**
       
   112         * From MMsgAsyncControl
       
   113         *
       
   114         * Adds observer.
       
   115         */
       
   116         void AddObserverL( MMsgAsyncControlObserver& aObserver );
       
   117         
       
   118         /**
       
   119         * From MMsgAsyncControl
       
   120         *
       
   121         * Removes observer.
       
   122         */
       
   123         void RemoveObserver( MMsgAsyncControlObserver& aObserver );
       
   124 
       
   125         /**
       
   126         * From MXhtmlParserObserver
       
   127         *
       
   128         * Call back function used to inform a client of the Parser
       
   129         * when a parsing operation completes.
       
   130         */
       
   131     	void ParseCompleteL();
       
   132 	    
       
   133     	/**
       
   134     	* From MXhtmlParserObserver
       
   135         *
       
   136         * Call back function used to inform a client of the Parser
       
   137         * about error.
       
   138         */
       
   139     	void ParseError( TInt aError );
       
   140     	
       
   141 	public:
       
   142 
       
   143         /**
       
   144         * From CCoeControl
       
   145         *
       
   146         * For handling dynamic layout switch.
       
   147         */
       
   148         void HandleResourceChange( TInt aType );
       
   149 	
       
   150     private:
       
   151         
       
   152         /**
       
   153         * C++ default constructor.
       
   154         */
       
   155         CMsgXhtmlBodyControl();
       
   156         
       
   157         /**
       
   158         * C++ constructor.
       
   159         */
       
   160         CMsgXhtmlBodyControl( MMsgBaseControlObserver& aBaseControlObserver );
       
   161 
       
   162         /**
       
   163         * 2nd phase constructor.
       
   164         */
       
   165         void ConstructL( MMsgAsyncControlObserver* aObserver );
       
   166         
       
   167         /**
       
   168         * Sets state and calls observer  
       
   169         */
       
   170         void SetState( TMsgAsyncControlState aState );
       
   171         
       
   172         /**
       
   173         * Reads layout data from "LAF".
       
   174         */
       
   175         void ResolveLayout();
       
   176         
       
   177         /**
       
   178         * Performs XHTML parsing from DOM
       
   179         */ 
       
   180         void ParseXhtmlL();
       
   181 
       
   182         /**
       
   183         * CleanupLinkArray() cleanup for automatic variable
       
   184         * CArrayPtrFlat<CItemFinder::CFindItemExt>*.
       
   185         * @param aAny Array
       
   186         */
       
   187         static void CleanupLinkArray( TAny* aAny );
       
   188 
       
   189     private: // Data
       
   190         
       
   191         CArrayPtrFlat<MMsgAsyncControlObserver>* iObservers;
       
   192         
       
   193         TMsgAsyncControlState iState;
       
   194         
       
   195         TInt iError;
       
   196         
       
   197         CXhtmlParser* iParser;
       
   198     };
       
   199 
       
   200 #endif // CMSGXHTMLBODYCONTROL_H
       
   201 
       
   202 // End of File