mobilemessaging/unieditor/application/inc/UniEditorProcessTextOperation.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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:   CUniEditorProcessTextOperation class definition.      
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CUNIEDITORPROCESSTEXTOPERATION_H
       
    21 #define CUNIEDITORPROCESSTEXTOPERATION_H
       
    22 
       
    23 // INCLUDES
       
    24 
       
    25 #include <xhtmlparser.h>
       
    26 #include "UniEditorOperation.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 
       
    30 // DATA TYPES
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 * CUniEditorProcessTextOperation
       
    36 *
       
    37 * @since 3.2
       
    38 */
       
    39 class CUniEditorProcessTextOperation : public CUniEditorOperation,
       
    40                                        public MXhtmlParserObserver
       
    41     {
       
    42     public: // new operations
       
    43 
       
    44         /**
       
    45         * Factory method
       
    46         */
       
    47         static CUniEditorProcessTextOperation* NewL( 
       
    48             MUniEditorOperationObserver& aObserver,
       
    49             CUniEditorDocument& aDocument,
       
    50             RFs& aFs );
       
    51         
       
    52         /**
       
    53         * Destructor
       
    54         */
       
    55         virtual ~CUniEditorProcessTextOperation();
       
    56         
       
    57         /**
       
    58         * Starts text process operation
       
    59         *
       
    60         * @param aImageInfo
       
    61         * @param aAttachmentId  Attachment id, if the image is already stored as an attachment
       
    62         *                       KMsvNullIndexEntryId, otherwise.
       
    63         * @param aMessageSize
       
    64         */
       
    65         void Start();
       
    66         
       
    67     protected:
       
    68 
       
    69         /**
       
    70         * From CActive
       
    71         */
       
    72         void RunL();
       
    73 
       
    74         /**
       
    75         * From CActive
       
    76         */
       
    77         TInt RunError( TInt aError );
       
    78         
       
    79         /**
       
    80         * From CUniEditorOperation
       
    81         */
       
    82         void DoCancelCleanup();
       
    83         
       
    84         /**
       
    85         * From MXhtmlParserObserver
       
    86         *
       
    87         * Call back function used to inform a client of the Parser
       
    88         * when a parsing operation completes.
       
    89         */
       
    90     	void ParseCompleteL();
       
    91     	
       
    92     	/**
       
    93     	* From MXhtmlParserObserver
       
    94         *
       
    95         * Call back function used to inform a client of the Parser
       
    96         * about error.
       
    97         */
       
    98     	void ParseError( TInt aError );
       
    99         
       
   100     private: // new operations
       
   101 
       
   102         /**
       
   103         * C++ constructor
       
   104         */
       
   105         CUniEditorProcessTextOperation( MUniEditorOperationObserver& aObserver,
       
   106                                         CUniEditorDocument& aDocument,
       
   107                                         RFs& aFs );
       
   108 
       
   109         /**
       
   110         * 2nd phase constructor.
       
   111         */
       
   112         void ConstructL();
       
   113 
       
   114         /**
       
   115         * Checks whether some processing is needed for the text objects.
       
   116         */
       
   117         void DoStartCheck();
       
   118 
       
   119         /**
       
   120         * Start process step.
       
   121         */
       
   122         void DoStartProcessL();
       
   123         
       
   124         /**
       
   125         * Processing ready.
       
   126         */
       
   127         void DoReady();
       
   128 
       
   129         /**
       
   130         * Releases the limited resources used by the operation.
       
   131         */
       
   132         void Reset();
       
   133         
       
   134          /**
       
   135         * Creates empty text attachment.
       
   136         */
       
   137         void CreateEmptyTextAttachmentL( RFile& aFileHandle );
       
   138         
       
   139          /**
       
   140         * Replaces XHTML attachment with plain text attachment.
       
   141         */
       
   142         void ReplaceXhtmlAttachmentL( RFile& aFileHandle );
       
   143         
       
   144         /**
       
   145         * Writes text into file.
       
   146         */
       
   147         void WriteTextToFileL( CRichText& aText, RFile& aFileHandle );
       
   148         
       
   149         /**
       
   150         * Notify observer
       
   151         */ 
       
   152         void NotifyObserver( TUniEditorOperationEvent aEvent );
       
   153         
       
   154         /**
       
   155         * Performs parse error handling.
       
   156         */
       
   157         void HandleParserErrorL( TInt aError );
       
   158         
       
   159     private: // data
       
   160 
       
   161         enum TUniProcessStates
       
   162             {
       
   163             EUniProcessTxtCheck,
       
   164             EUniProcessTxtProcess,
       
   165             EUniProcessTxtNewFile,
       
   166             EUniProcessTxtReady,
       
   167             EUniProcessTxtError
       
   168             };
       
   169         
       
   170         CUniObject* iProcessedObject;
       
   171         CMsvStore* iEditStore;
       
   172 
       
   173         CXhtmlParser* iParser;
       
   174         TInt iSlideNum;
       
   175         
       
   176         TMsvAttachmentId iNewAttachmentId;
       
   177     };
       
   178 
       
   179 #endif // CUNIEDITORPROCESSTEXTOPERATION_H