svgtviewer/SvgtViewerPlugin/UIControlInc/SvgtEventHandlerAO.h
changeset 0 632761c941a7
equal deleted inserted replaced
-1:000000000000 0:632761c941a7
       
     1 /*
       
     2 * Copyright (c) 2006 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:  This header file defines the  CSvgtEventHandlerAO class 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SVGTEVENTHANDLERAO_H
       
    20 #define SVGTEVENTHANDLERAO_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <e32cmn.h>
       
    25 #include "SVGTCustControl.h"
       
    26 
       
    27 class MSvgtAppObserver;
       
    28 class CSVGTAppObserverUtil;
       
    29 class CSvgtEvent;
       
    30 
       
    31 _LIT(KSvgTagName, "svg");
       
    32 _LIT(KDataTagName, "data:");
       
    33 
       
    34 /**
       
    35 *       This class handles the event list & process the events 
       
    36 *       while progressive rendering
       
    37 */
       
    38 class CSvgtEventHandlerAO : public CActive
       
    39     {
       
    40     public:
       
    41         /**
       
    42         * Two phase constructor
       
    43         * @since 3.1
       
    44         * @param aAppObserverUtil AppOberserverUtil Object
       
    45         * @param aEngine Engine object 
       
    46         * @param aCustControl
       
    47         * @return CSvgtEventHandlerAO*
       
    48         */
       
    49         static CSvgtEventHandlerAO* NewL(MSvgtAppObserver* aAppObserverUtil, 
       
    50                                             CSVGTCustControl* aCustControl,
       
    51                                             const TThreadId aMainThreadId );
       
    52 
       
    53         /**
       
    54         *  Destructor
       
    55         */
       
    56         virtual ~CSvgtEventHandlerAO();
       
    57 
       
    58         /**
       
    59         * It adds the event (except redraw event) to the event queue.
       
    60         * @since 3.1
       
    61         * @param aEvent Event Object
       
    62         * @return TBool
       
    63         */
       
    64         TBool AddEventToList(CSvgtEvent* aEvent);
       
    65 
       
    66         /**
       
    67         * It adds the redraw event to the event queue.
       
    68         * @since 3.1
       
    69         * @param aForceAdd Decides whether to add the redraw event forcefully
       
    70         * @return TBool
       
    71         */
       
    72         TBool AddRedrawEventToList( const TBool aForceAdd = EFalse);
       
    73         
       
    74         /**
       
    75         * It make the request complete.
       
    76         * @since 3.1
       
    77         * @param aError Error code for the service provided
       
    78         * @return none
       
    79         */
       
    80         void MakeRequestComplete( TInt aError );
       
    81         
       
    82         /**
       
    83         * It indicates that document is document loading completed.
       
    84         * @since 3.1
       
    85         * @return none
       
    86         */
       
    87         void SetDocumentComplete();
       
    88         
       
    89     private:
       
    90         /**
       
    91         * Handles an active object's request completion event.
       
    92         * @since 3.1
       
    93         * @see CActive
       
    94         */
       
    95         void RunL();
       
    96         
       
    97         /**
       
    98         * Cancels all the request
       
    99         * @since 3.1
       
   100         * @see CActive
       
   101         */
       
   102         void DoCancel();
       
   103 
       
   104         /**
       
   105         * Handles a leave occurring in the request completion event handler RunL().
       
   106         * @since 3.1
       
   107         * @see CActive
       
   108         */
       
   109         TInt RunError( TInt aError );
       
   110 
       
   111         /**
       
   112         * It determines whether the time elapsed or not.
       
   113         * @since 3.1
       
   114         * @return TBool
       
   115         */
       
   116         TBool IsRedrawTimeElapsed();
       
   117 
       
   118         /**
       
   119         * Terminates the active object
       
   120         * @since 3.1
       
   121         */
       
   122         void DoTerminate();
       
   123         
       
   124     private:    //class methods
       
   125         /**
       
   126         * constructor
       
   127         */
       
   128         CSvgtEventHandlerAO(MSvgtAppObserver* aAppObserverUtil, 
       
   129                                 CSVGTCustControl* aCustControl, 
       
   130                                 const TThreadId aMainThreadId );
       
   131         /**
       
   132         * Two phase constructor
       
   133         * @since 3.1
       
   134         */
       
   135         void ConstructL();
       
   136 
       
   137     private:    //Data members
       
   138 
       
   139         CSVGTAppObserverUtil* iAppObserverUtil;
       
   140         CSvgEngineInterfaceImpl* iSvgEngine;
       
   141         CSVGTCustControl* iCustControl;
       
   142         RPointerArray<CSvgtEvent>   iEventList;
       
   143 
       
   144         // Stores the previous time stamp
       
   145         TTime iPreviousRedrawClock;
       
   146         TThreadId iMainThreadId;
       
   147         TBool iIsDocumentComplete;
       
   148         
       
   149         TInt iStepCount;
       
   150         TInt iSvgTimeBetweenRedraw;
       
   151         // For Synchronising RequestComplete() calls
       
   152         RCriticalSection iCritSection;
       
   153     };
       
   154 
       
   155 #endif  //SVGTEVENTHANDLERAO_H
       
   156 
       
   157 // End of File