mobilemessaging/unieditor/application/inc/UniEditorLaunchOperation.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 11 May 2010 16:10:04 +0300
branchRCL_3
changeset 28 fbb813aef148
parent 0 72b543305e3a
child 53 696bfeff199e
permissions -rw-r--r--
Revision: 201017 Kit: 201019

/*
* Copyright (c) 2006,2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:   CUniEditorLaunchOperation, asynchronous operation for object saving
*
*/



#ifndef __UNIEDITORLAUNCHOPERATION_H
#define __UNIEDITORLAUNCHOPERATION_H

// INCLUDES

#include <e32base.h>
#include <e32std.h>

#include <unislideloader.h>

#include "UniEditorOperation.h"
#include "UniEditorDocument.h"
#include "UniEditorSendUiOperation.h"
#include "UniEditorProcessTextOperation.h"

// CONSTANTS

// MACROS

// FORWARD DECLARATIONS

class MMsgAsyncControlObserver;
class MUniDataModelObserver;
class CMsgEditorView;
class CMsgEditorAppUi;
class CUniEditorHeader;

// DATA TYPES

// FUNCTION PROTOTYPES

// CLASS DECLARATION

/**
* CUniEditorLaunchOperation
*
* @since 3.2
*/
class CUniEditorLaunchOperation : public CUniEditorOperation,
                                  public MUniSlideLoaderObserver,
                                  public MUniDataModelObserver
    {
    public:  // New methods

        /**
        * Factory method that creates this object.
        *
        * @param    aObserver
        * @return   Pointer to instance in cleanup stack
        */
        static CUniEditorLaunchOperation* NewL(
            MMsgAsyncControlObserver& aControlObserver,
            MUniEditorOperationObserver& aOperationObserver,
            CUniEditorDocument& aDocument,
            CMsgEditorView& aView,
            CMsgEditorAppUi& aAppUi,
            RFs& aFs );

        /**
        * Destructor
        */
        virtual ~CUniEditorLaunchOperation();

        /**
        * Start launch process
        */
        void Launch();

        /**
        * Detach header object
        */
        inline CUniEditorHeader* DetachHeader();

        /**
        * Detach slide loader object
        */
        inline CUniSlideLoader* DetachSlideLoader();

        /**
        * Return parse result
        */
        TInt ParseResult();

        /**
        * From MUniDataModelObserver
        */
        void RestoreReady( TInt aParseResult, TInt aError );

    protected: 

        /**
        * From CActive
        */
        void RunL();
        
        /**
        * From CActive
        */
        TInt RunError( TInt aError );

        /**
        * From MUniSlideLoaderObserver
        */
        void SlideLoadReady( TInt aError );
        
        /**
        * From CUniEditorOperation
        */
        void DoCancelCleanup();
        
        /**
        * From CUniEditorOperation
        */
        void HandleOperationEvent( TUniEditorOperationType aOperation,
                                   TUniEditorOperationEvent aEvent );
        
    private: 

        /**
        * C++ constructor.
        */
        CUniEditorLaunchOperation( MMsgAsyncControlObserver& aControlObserver,
                                   MUniEditorOperationObserver& aOperationObserver,
                                   CUniEditorDocument& aDocument,
                                   CMsgEditorView& aView,
                                   CMsgEditorAppUi& aAppUi,
                                   RFs& aFs );

        /**
        * 2nd phase constructor.
        */
        void ConstructL();

        /**
        * Performs lauch step
        */
        void DoLaunchStepL();

        /**
        * Initializes document.
        */
        void DoInitializeDocL();

        /**
        * Initializes data model
        */
        void DoInitializeModelL();

        /**
        * Processes message 
        */
        void DoHandleMessageL();

        /**
        * Prepares header
        */
        void DoPrepareHeaderL();

        /**
        * Prepares body
        */
        void DoPrepareBodyL();

        /**
        * Prepares 3GPP body
        */
        void DoPrepare3GPPBodyL();

        /**
        * Add subject prefix ("Re:" or "Fw:")
        * @param ETrue, for reply -> "Re:"
        *        EFalse, for forward -> "Fw:"
        */
        void AddSubjectPrefixL( TBool aReply );

    protected: // data

        // assigned to iOperationState in base class
        enum TUniLaunchState
            {
            EUniLaunchInitializeDoc = 0,
            EUniLaunchInitializeModel,
            EUniLaunchHandleMessage,
            EUniLaunchPrepareHeader,
            EUniLaunchPrepareBody,
            EUniLaunchEnd
            };

        MMsgAsyncControlObserver&       iControlObserver;
        CMsgEditorView&                 iView;
        CMsgEditorAppUi&                iAppUi;

        CUniEditorSendUiOperation*      iSendUiOperation;
        CUniEditorHeader*               iHeader;
        CUniSlideLoader*                iSlideLoader;
        
        CUniEditorProcessTextOperation* iTextOperation;

        TInt                            iError;
        TBool                           iSmilEditorSupported;
        // count of failed image operations
        TInt                            iParseResultTemp;

    };

#include "UniEditorLaunchOperation.inl"

#endif // __UNIEDITORLAUNCHOPERATION_H

// End of file