mobilemessaging/unieditor/application/inc/UniEditorInsertOperation.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006,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:   CUniEditorInsertOperation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __UNIEDITORINSERTOPERATION_H
       
    21 #define __UNIEDITORINSERTOPERATION_H
       
    22 
       
    23 // INCLUDES
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <msvapi.h>
       
    27 
       
    28 #include "uniobject.h"
       
    29 #include "unislideloader.h"
       
    30 
       
    31 #include "UniEditorOperation.h"
       
    32 
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 
       
    36 class CUniEditorDocument;
       
    37 class CMsgEditorView;
       
    38 class CMsgMediaInfo; 
       
    39 class CUniSlideLoader;
       
    40 class CUniEditorHeader;
       
    41 class CUniEditorChangeSlideOperation;
       
    42 class CUniEditorProcessImageOperation;
       
    43 class CUniEditorConvertVideoOperation;
       
    44 
       
    45 // DATA TYPES
       
    46 
       
    47 enum TUniInsertState
       
    48     {
       
    49     EUniInsertIdle = 0,
       
    50     EUniInsertCheckScaling,
       
    51     EUniInsertRecheckScaling,
       
    52     EUniInsertCreateAttachment,
       
    53     EUniInsertCopyAttachment,
       
    54     EUniInsertProcessImage,
       
    55     EUniInsertConvertVideo,
       
    56     EUniInsertCheckMode,
       
    57     EUniInsertCheckSize,
       
    58     EUniInsertResolve,
       
    59     EUniInsertAddToModel,
       
    60     EUniInsertLoad,
       
    61     EUniInsertReady,
       
    62     EUniInsertError,
       
    63     EUniInsertErrorReload,
       
    64     EUniInsertErrorReport
       
    65     };
       
    66     
       
    67 // CLASS DECLARATION
       
    68 
       
    69 /**
       
    70 * CUniEditorInsertOperation
       
    71 *
       
    72 * @since 3.2
       
    73 */
       
    74 class CUniEditorInsertOperation : public CUniEditorOperation,
       
    75                                   public MUniObjectSaveObserver,
       
    76                                   public MUniSlideLoaderObserver
       
    77     {
       
    78     public: // new operations
       
    79 
       
    80         /**
       
    81         * Factory functions
       
    82         */
       
    83         static CUniEditorInsertOperation* NewL( 
       
    84             MUniEditorOperationObserver& aOperationObserver,
       
    85             CUniEditorDocument& aDocument,
       
    86             CUniEditorHeader& aHeader,
       
    87             CUniSlideLoader& aSlideLoader,
       
    88             CMsgEditorView& aView,
       
    89             RFs& aFs );
       
    90 
       
    91         /**
       
    92         * Starts insert operation
       
    93         */
       
    94         void Insert( CMsgMediaInfo* aInfo, TBool aAddSlide, TBool aAddAttachment );
       
    95 
       
    96         /**
       
    97         * Destructor
       
    98         */
       
    99         virtual ~CUniEditorInsertOperation();
       
   100 
       
   101         /**
       
   102         * Return inserted media type.
       
   103         */
       
   104         TMsgMediaType InsertedType();
       
   105         
       
   106         /**
       
   107         * Returns inserted object.
       
   108         */
       
   109         CUniObject* InsertedObject();
       
   110         
       
   111         /**
       
   112         * Return ETrue if object was inserted as attachment. EFalse otherwise.
       
   113         */
       
   114         TBool IsAddedAsAttachment() const;
       
   115 
       
   116     protected: 
       
   117 
       
   118         /**
       
   119         * From CActive
       
   120         */
       
   121         void RunL();
       
   122 
       
   123         /**
       
   124         * From MUniObjectSaveObserver
       
   125         */
       
   126         void ObjectSaveReady( TInt aError );
       
   127 
       
   128         /**
       
   129         * From MUniSlideLoaderObserver
       
   130         */
       
   131         void SlideLoadReady( TInt aError );
       
   132         
       
   133         /**
       
   134         * From CUniEditorOperation
       
   135         */
       
   136         void DoCancelCleanup();
       
   137         
       
   138         /**
       
   139         * From CUniEditorOperation
       
   140         */
       
   141         void HandleOperationEvent( TUniEditorOperationType aOperation,
       
   142                                    TUniEditorOperationEvent aEvent );
       
   143 
       
   144         
       
   145     private: // new operations
       
   146 
       
   147         /**
       
   148         * C++ constructor
       
   149         */
       
   150         CUniEditorInsertOperation( MUniEditorOperationObserver& aOperationObserver,
       
   151                                    CUniEditorDocument& aDocument,
       
   152                                    CUniEditorHeader& aHeader,
       
   153                                    CUniSlideLoader& aSlideLoader,
       
   154                                    CMsgEditorView& aView,
       
   155                                    RFs& aFs );
       
   156 
       
   157         /**
       
   158         * 2nd phase constructor.
       
   159         */
       
   160         void ConstructL();
       
   161 
       
   162         /**
       
   163         * Starts image processing
       
   164         */
       
   165         void DoStartProcessImageL();
       
   166 
       
   167         /**
       
   168         * Starts video conversion
       
   169         */
       
   170         void DoStartConvertVideoL();
       
   171 
       
   172         /**
       
   173         * Performs size check
       
   174         */
       
   175         void DoCheckSizeL();
       
   176 
       
   177         /**
       
   178         * Performs mode check
       
   179         */
       
   180         void DoCheckModeL();
       
   181 
       
   182         /**
       
   183         * Starts attachment copying
       
   184         */
       
   185         void DoStartCopyAttachmentL();
       
   186 
       
   187         /**
       
   188         * Starts loading
       
   189         */
       
   190         void DoStartLoadL();
       
   191 
       
   192         /**
       
   193         * Reloads current (old) slide after error.
       
   194         */
       
   195         void DoStartReloadL();
       
   196 
       
   197         /**
       
   198         * Performs error handling without state change.
       
   199         */
       
   200         void DoErrorWithoutStateChangeL();
       
   201 
       
   202         /**
       
   203         * Checks insert size.
       
   204         */
       
   205         TBool CheckSizeForInsertL();
       
   206 
       
   207         /**
       
   208         * Checks mode.
       
   209         *
       
   210         * @param aBeforeProcessing indicates whether the function is called
       
   211         *                          before or after image processing
       
   212         * 
       
   213         */
       
   214         TBool CheckModeForInsert( TBool aBeforeProcessing );
       
   215 
       
   216     private: // data
       
   217 
       
   218         CUniEditorHeader& iHeader;
       
   219         CUniSlideLoader& iSlideLoader;
       
   220         CMsgEditorView& iView;
       
   221 
       
   222         CUniEditorProcessImageOperation* iImageOperation;
       
   223         CUniEditorConvertVideoOperation* iVideoOperation;
       
   224         CUniEditorChangeSlideOperation* iChangeSlideOperation;
       
   225     
       
   226         CMsgMediaInfo*  iOldInfo;
       
   227         CMsgMediaInfo*  iNewInfo;
       
   228         CUniObject*     iInsertedObject;
       
   229         TBool           iAddSlide;
       
   230         TInt            iInsertedSlide;
       
   231         TBool           iAddAsAttachment;
       
   232         TBool           iPreviousSlide;
       
   233     };
       
   234 
       
   235 #endif // __UNIEDITORINSERTOPERATION_H
       
   236 
       
   237 // End of file