idlehomescreen/xmluirendering/renderingplugins/xnnewstickerfactory/inc/xnnewstickersvgcontrol.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Svg scrolling functionality.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef XNNEWSTICKERSVGCONTROL_H
       
    20 #define XNNEWSTICKERSVGCONTROL_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <SVGRequestObserver.h>
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CXnNewstickerAdapter;
       
    30 class CSvgEngineInterfaceImpl;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 * @ingroup group_xnnewstickerfactory
       
    36 * 
       
    37 *  Newsticker control for XUIKON svg scrolling functionality.
       
    38 *
       
    39 *  @lib xn3newstickerfactory.dll
       
    40 *  @since Series 60 3.2
       
    41 */
       
    42 class CXnNewstickerSvgControl : public CBase, public MSvgRequestObserver
       
    43     {
       
    44     public:
       
    45         /**
       
    46          * Two-phased constructor.
       
    47          * @param aAdapter Parent control
       
    48          * @return Pointer to this.
       
    49          */
       
    50         static CXnNewstickerSvgControl* NewL(CXnNewstickerAdapter* aAdapter);
       
    51 
       
    52         /** 
       
    53         * Destructor
       
    54         */
       
    55         virtual ~CXnNewstickerSvgControl();
       
    56 
       
    57     public: //  New functions
       
    58         /**
       
    59         * Start showing the SVG until StopL is called.
       
    60         * @param aSvgData The svg byte data to show.
       
    61         */
       
    62         void StartL(const TDesC8& aSvgData);
       
    63 
       
    64         /**
       
    65         * Stop the SVG showing and started with the StartL.
       
    66         */
       
    67         void StopL();
       
    68         
       
    69         /** 
       
    70         * Sets the rect of the visible area.
       
    71         * @since S60 v3.1
       
    72         * @param aContentRect The visible rect.
       
    73         * @param aDevice The current graphics device.
       
    74         * @return void
       
    75         */        
       
    76         void SetSvgRectL(TRect& aContentRect, CGraphicsDevice& aDevice );
       
    77         
       
    78         /**
       
    79         * Draws the SVG into screen
       
    80         */
       
    81         void Draw() const;
       
    82 
       
    83     public: //From MSvgRequestObserver
       
    84     
       
    85         /**
       
    86         * This method is called by the SVG Engine when all data for a certain
       
    87         * step, such as animation frame, have been updated.  This usually means
       
    88         * the off-screen image (passed in to 'ConstructL' of CSvgEngineInterface)
       
    89         * has been updated.  The client usually redraws the image onto
       
    90         * the screen.
       
    91         */
       
    92         void UpdateScreen();
       
    93 
       
    94         /**
       
    95         * This method is for future extension, in which an external script engine
       
    96         * could be used to evaluate a script description.
       
    97         *
       
    98         * @param : aScript -- A description of script from the "on" attribute.
       
    99         * @param : aCallerElement -- The element that calls the script by a
       
   100         *                            an event of the "on" attribute.
       
   101         * @return : For future use.  Value is ignored.
       
   102         */
       
   103         TBool ScriptCall(const TDesC& aScript, CSvgElementImpl* aCallerElement);
       
   104 
       
   105         /**
       
   106         * This method is called to retrieve the file handle of an image name.
       
   107         * The session (RFs) object passed in is guaranteed to be connected, so
       
   108         * the client must NOT call aSession.Connect().
       
   109         *
       
   110         * The implementation for the client of this method is usually if not always:
       
   111         * TInt X::FetchImage(const TDesC& aFilename, RFs& aSession, RFile& aFileHandle)
       
   112         *     {
       
   113         *     // Check for "http", get data from remote site, save to disk
       
   114         *     // Get absolute path to aFilename: absolutepath
       
   115         *     return aFileHandle.Open(aSession, absolutepath, EFileRead);
       
   116         *     }
       
   117         *
       
   118         * Note: Use EFileShareReadersOnly to prevent file locking.
       
   119         *
       
   120         * The API AssignImageData() can be used to avoid block the parsing
       
   121         * thread due this method taking too long to return.  This is
       
   122         * accomplished by returning a non-KErrNone value  (i.e. KErrNotFound),
       
   123         * and storing the URI parameter.  The image data then could be
       
   124         * assigned the the URI in another thread/Active-Object.
       
   125         *
       
   126         * @param : aUri -- the relative path of an image file.
       
   127         * @param : aSession -- File session used by client to open file.
       
   128         * @param : aFileHandle -- File handle used by client to open file.
       
   129         * @return : KErrNone if Open command successful, otherwise error-code
       
   130         *           from Open command.  The SVG engine will proceed loading the file
       
   131         *           only if the return value is KErrNone.
       
   132         */
       
   133         TInt FetchImage(const TDesC& aUri, RFs& aSession, RFile& aFileHandle);
       
   134 
       
   135         /**
       
   136         * This method is called to retrieve the file handle of an svg font file.
       
   137         * This file must be SVG 1.1 .svg file.  When the engine comes acrossed
       
   138         * a font-family name that it doesnt know it will request "fontfamilyname".svg
       
   139         * file through this method.  The client can either provide the svg file
       
   140         * or the engine will default to system text.
       
   141         *
       
   142         * The usage of this method is exactly the same as the FetchImage method above
       
   143         *
       
   144         * @param : aUri -- the relative path of an image file.
       
   145         * @param : aSession -- File session used by client to open file.
       
   146         * @param : aFileHandle -- File handle used by client to open file.
       
   147         * @return : KErrNone if Open command successful, otherwise error-code
       
   148         *           from Open command.  The SVG engine will proceed loading the file
       
   149         *           only if the return value is KErrNone.
       
   150         */
       
   151         TInt FetchFont(const TDesC& aUri, RFs& aSession, RFile& aFileHandle);
       
   152 
       
   153         /**
       
   154         * This Method updates the presentation status
       
   155         * @param : TInt32&  aNoOfAnimation
       
   156         */
       
   157         void UpdatePresentation(const TInt32&  aNoOfAnimation);
       
   158 
       
   159     private: 
       
   160 
       
   161         CXnNewstickerSvgControl(CXnNewstickerAdapter* aAdapter);
       
   162 
       
   163         void ConstructL();
       
   164         
       
   165     private:    // Data
       
   166         /**
       
   167         * Parent control adapter
       
   168         * Not own.
       
   169         */	            
       
   170         CXnNewstickerAdapter*       iAdapter;
       
   171         
       
   172         /**
       
   173         * Pointer to SVG rendering engine
       
   174         * Owned.
       
   175         */
       
   176         CSvgEngineInterfaceImpl*    iSVGEngine;
       
   177         
       
   178         /**
       
   179         * Pointer to svg bitmap.
       
   180         * Own.
       
   181         */
       
   182         CFbsBitmap*                 iBitmap;
       
   183         
       
   184         /**
       
   185         * Pointer to svg mask.
       
   186         * Own.
       
   187         */
       
   188         CFbsBitmap*                 iMaskBitmap;
       
   189         
       
   190         /**
       
   191         * A rect in which the svg is shown.
       
   192         */
       
   193         TRect                       iContentRect;
       
   194         
       
   195         /**
       
   196         * Defines whether the content has been loaded
       
   197         */
       
   198         TBool                       iHasContent;
       
   199     };
       
   200 
       
   201 #endif // XNNEWSTICKERSVGCONTROL_H
       
   202 
       
   203 // End of File