# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284020260 -10800 # Node ID 5fd161fa28b66a917f64b75d13f66f864a8ca14b # Parent e52958d06c296fc3b746056863ad096590a164df Revision: 201019 Kit: 201035 diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/group/bld.inf Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2006 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: Includes all the Domain API specific bld.inf files, which +* export files. +* +*/ + + + +#include "../svgt_viewer_ui_api/group/bld.inf" +#include "../svg_application_observer_utility_api/group/bld.inf" +#include "../svgt_file_view_details_dialog_api/group/bld.inf" diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svg_application_observer_utility_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svg_application_observer_utility_api/group/bld.inf Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: SVG Application Observer Utility API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/SVGTAppObserverUtil.h APP_LAYER_PLATFORM_EXPORT_PATH(SVGTAppObserverUtil.h) +../inc/SVGTUISaveListener.h APP_LAYER_PLATFORM_EXPORT_PATH(SVGTUISaveListener.h) +../inc/SVGTFileManager.h APP_LAYER_PLATFORM_EXPORT_PATH(SVGTFileManager.h) diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svg_application_observer_utility_api/inc/SVGTAppObserverUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svg_application_observer_utility_api/inc/SVGTAppObserverUtil.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,581 @@ +/* +* Copyright (c) 2004,2005 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: This class provides a reference implementation for the SVGT +* UI Control Application Observer. +* +*/ + + +#ifndef SVGTAPPOBSERVERUTIL_H +#define SVGTAPPOBSERVERUTIL_H + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +// Forward Declarations +class CSVGTUIDialog; +class CEikProgressInfo; +class CDocumentHandler; + +// CLASS DECLARATION + +/** +* This class is used as a utility class for implementing observer for the +* SVGT UI Control. +* It provides helper function/reference implementation for following +* functionality: +* a. Hyperlink handling +* b. Download manager + UI Usage +* c. Save Option Implementation +* d. Misc (GetSmilFitValue) +* @lib SVGTAppObserverUtil +* @since 3.0 +*/ + +class CSVGTAppObserverUtil : public CBase, + public MSvgtAppObserver, + public MHttpDownloadMgrObserver, + public MSVGTUISaveListener, + public MProgressDialogCallback + { + + public: + + enum TDownloadNeeded + { + // The uri refers to a local image file + ELocalImageFile, + // The uri refers to a remote image file + ERemoteImageFile, + // The uri doesnt refer to an image file + ENotAnImageFile + }; + + enum TWaitNoteState + { + // WaitNote is used for file saving + ESaveFileWait = 1, + // WaitNote is used for downloading image synchronously + EDownloadImageWait + }; + + public: // Constructors and destructor + + /** + * Two-phased constructor. + * aAppDialog: Pointer to the SVGT Dialog + * RFile* aFileHdlPtr: File handle to the content. + * const TDesC& filename: Filepath. + * TBool aIsFileFullPathAvailable: Flag to indicate if content's + * fullpath is available. + * TBool aCanSaveContent, + * TBool aShouldMoveContent. + */ + IMPORT_C static CSVGTAppObserverUtil* NewL( CSVGTUIDialog* aAppDialog, + RFile* aFileHdlPtr, + const TDesC& aFilename, + TBool aIsFileFullPathAvailable, + TBool aCanSaveContent, + TBool aShouldMoveContent ); + + /** + * Two-phased constructor. + * aAppDialog: Pointer to the SVGT Dialog + * RFile* aFileHdlPtr: File handle to the content. + * const TDesC& aFilename: Filepath. + * TBool aIsFileFullPathAvailable: Flag to indicate if content's + * fullpath is available. + * TBool aCanSaveContent, + * TBool aShouldMoveContent. + */ + static CSVGTAppObserverUtil* NewLC( CSVGTUIDialog* aAppDialog, + RFile* aFileHdlPtr, + const TDesC& aFilename, + TBool aIsFileFullPathAvailable, + TBool aCanSaveContent, + TBool aShouldMoveContent); + + /** + * Two-phased constructor. + * aAppDialog: Pointer to the SVGT Dialog + * RFile* aFileHdlPtr: File handle to the content. + * @since 3.0 + */ + IMPORT_C static CSVGTAppObserverUtil* NewL( CSVGTUIDialog* aAppDialog, + RFile* aFileHdlPtr ); + + /** + * Two-phased constructor. + * aAppDialog: Pointer to the SVGT Dialog + * RFile* aFileHdlPtr: File handle to the content. + * @since 3.0 + */ + static CSVGTAppObserverUtil* NewLC( CSVGTUIDialog* aAppDialog, + RFile* aFileHdlPtr ); + /** + * Destructor. + */ + IMPORT_C virtual ~CSVGTAppObserverUtil(); + + + /** + * This method is called by the svg engine when there is an image tag + * encountered in the svg file. This function parses the uri, checks + * whether the uri is a local file or a remote file. If the file is + * a remote file, the file is downloaded. Fetched file is then opened + * and the file handle returned to the engine. + * @since 3.0 + * @see MSvgRequestObserver::FetchImage + */ + IMPORT_C virtual TInt FetchImage( const TDesC& aUri, + RFs& aSession, RFile& aFileHandle ); + + TInt FetchFont( const TDesC& /* aUri */, + RFs& /* aSession */, RFile& /* aFileHandle */ ); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::LinkActivated + */ + IMPORT_C virtual TBool LinkActivated( const TDesC& aUri ); + + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::LinkActivatedWithShow + */ + IMPORT_C virtual TBool LinkActivatedWithShow( const TDesC& aUri, + const TDesC& aShow ); + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::GetSmilFitValue + */ + IMPORT_C virtual void GetSmilFitValue( TDes& aSmilValue ); + + /** + * This function is called by the application to enable/disable the + * downloads menu in the options menu + * @since 3.0 + * @param aAddDownloadMenu enable/disable the downloads menu + */ + + IMPORT_C void SetDownloadMenu( TBool aAddDownloadMenu ); + + /** + * This function is called by the Ui Dialog to enable/disable the + * downloads menu in the options menu + * @since 3.0 + * @return iDownloadMenuEnabled enable/disable the downloads menu + */ + IMPORT_C virtual TBool CanShowDownload() const; + + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::DisplayDownloadMenuL + */ + IMPORT_C virtual void DisplayDownloadMenuL(); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::CanShowSave + */ + IMPORT_C virtual TBool CanShowSave(); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::IsSavingDone + */ + IMPORT_C virtual TBool IsSavingDone(); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::DoSaveL + */ + IMPORT_C virtual void DoSaveL( TInt aCommandId ); + + IMPORT_C TInt NewFetchImageData( const TDesC& aUri ); + IMPORT_C void AssignEmbededDataL( const TDesC& aUri ); + TBool ExitWhenOrientationChange( ); + + /** + * Helper function for DoSaveL + */ + void SaveContentL( RFile& aSrcFileHandle, const TDesC& aSrcFileName, + TDes& aDstFileName, TBool aMoveFlag ); + /** + * This function generates a unique file name in the private directory + * @param aName On return contains the full path on return. + */ + void GetUniqueFileName( TDes& aName ) const; + + /** + * Checks whether the file is a GZipped content + * @param aFileHandle File handle to the SVG content + */ + TBool IsGzipContent( const RFile& aFileHandle ) const; + + /** + * This function saves the SVG content into the private directory + */ + void SaveSvgTextContentL( const RFile& aSrcFileHandle, + TDes& aTempFileName ); + + public: // Callback from the MHttpDownloadMgrObserver + /** + * This method is a call back function used by the download manager + * to indicate the completion/failure of the download started. + * LinkActivatedWithShow function + * @since 3.0 + * @param : aDownload -- handle of the download + * @param : aEvent -- download event + */ + IMPORT_C void HandleDMgrEventL( RHttpDownload& aDownload, + THttpDownloadEvent aEvent ); + public: // Callback from the MSVGTUISaveListener + /** + * From MSVGTUISaveListener. This function is called + * when buffering or saving position is changed. + * @since 3.0 + * @param aPosition, New buffering/saving position (0-100) + */ + IMPORT_C virtual void SVGTPositionChanged( TInt aPosition ); + + /** + * From MSVGTUISaveListener. Called when saving is finished. + * @since 3.0 + * @param aError, KErrNone or one of the system wide error codes. + * @return void + */ + IMPORT_C virtual void SVGTSavingDoneL( TInt aError ); + + public: // Functions from MProgressDialogCallback + + /** @see MProgressDialogCallback::DialogDismissedL */ + IMPORT_C void DialogDismissedL( TInt aButtonId ); + + public: // Leaving variants of linkActivated and linkActivatedWithShow + + /** + * This method is called by LinkActivated. + * If this function leaves, it is trapped by the linkActivated function + * @since 3.0 + * @param : aUri -- URI string of hyperlink + */ + IMPORT_C void LinkActivatedL( const TDesC& aUri ); + + /** + * This method is called by LinkActivatedWithShow. + * If this function leaves, it is trapped by the + * LinkActivatedWithShow function + * @since 3.0 + * @param : aUri -- URI string of hyperlink + * @param : aShow -- xlink:show value + */ + IMPORT_C void LinkActivatedWithShowL( const TDesC& aUri , + const TDesC& aShow ); + public: + + /** + * This method is called by LinkActivated(WithShow), FetchImage + * This checks whether the uri passed is a local image file or + * a remote image file or not an image file. + * @since 3.0 + * @param : aUri -- URI string of hyperlink + * @return : TDownloadNeeded + * ELocalImageFile - if the uri is a local file + * ENotAnImageFile - If the uri is not an image file + * ERemoteImageFile - If the uri is remote image file. + */ + IMPORT_C static TDownloadNeeded IsDownloadNeededL( + const TDesC& aUri ); + + /** + * This method is called by LinkActivated(WithShow), FetchImage + * This gets the filename from the uri and the + * @since 3.0 + * @param : aUri -- URI string of hyperlink + * @return : ETrue if the local file name is retrieved + * EFalse if the file could not be retrieved + */ + IMPORT_C TBool GetFileNameFromUri( const TDesC& aUri, + TDes& aFileName ) const; + + /** + * This method is called by LinkActivated(WithShow), FetchImage + * This gets the filename with full path from the uri and the + * @since 3.0 + * @param : aUri -- URI string of hyperlink + * @return : ETrue if the local file name is retrieved + * EFalse if the file could not be retrieved + */ + IMPORT_C static TBool GetLocalFile( const TDesC& aUri, + TDes& aFileName, + const TDesC& aSvgFileName ); + + + protected: //helper functions for fetchImage function + + /** + * This method is called by LinkActivated(WithShow),FetchImage functions + * If this function leaves, it is trapped by the + * Called function + * @since 3.0 + * @param : aUri -- URI string of hyperlink + * @param : aSession - File server session in which the file is opened + * @param : aFileHandle - handle of the file downloaded. + * @param : aIsSynchronous - Flag to indicate synchronous/asynchronous + * download + * @param : aIsEmbedded - Flag to indicate whether the downloaded + * file needs to be opened in embedded mode or not. + * @return : KErrNone if successful + * KErrNotFound if not + */ + TInt StartDownloadingImageL( + const TDesC& aUri, + RFs& aSession, + RFile& aFileHandle, + TBool aIsSynchronous, + TBool aLinkFlag, + TBool aIsEmbedded = ETrue ); + + + /** + * This method is called by the Fetch Image + * before starting the download to get Access point id. + * @since 3.0 + * @param : aIapId -- Access point id Found + * @return : True if Iap found else returns false. + */ + IMPORT_C TBool GetDefaultInetAccessPointL + ( TUint32& aIapId ) const; + + /** + * This method is called by HandleDMgrEventL + * This makes use of Document Handler to launch the file. + * @since 3.0 + * @param : aFileName -- Name of the file to be launched. + * @param : aIsEmbedded -- Flag to indicate whether file has to + * be opened in embedded mode or independent mode + */ + IMPORT_C void LaunchDownloadedFileL( const TDesC& aFileName, + TBool aIsEmbedded, + TBool aAllowSave ) const; + + +#ifdef SVGTVIEWERAPP_DOWNLOADMGR_ENABLED + /** + * This method is called by HandleDMgrEventL + * This iterates through the linked list and return the link + * corresponding to the given http download handle + * @since 3.0 + * @param : aHttpDownload -- handle of hyperlink + * @return : CSVGTViewerAppDownloads * the link corresponding to + * the given httpDownload handle. + */ + CSVGTViewerAppDownloads* FindDownload( + const RHttpDownload* aHttpDownload ); +#endif + /** + * This method is used to get back the filename of the currently + * playing svg content in filname.ext format. + * @since 3.0 + * @param : TDes& filename: Parameter where filename needs to be + * returned. + * @return : void. + */ + IMPORT_C void GetFileNameAndExt(TDes& filename) const; + + /** + * This method is used in Save operation to decide whether + * move action should be performed. + * @since 3.0 + * @param : None. + * @return : ETrue: Content needs to be moved. EFalse: Content + * shouldn't be moved. + */ + IMPORT_C TBool IsAllowMove() const; + + /** + * This method is used to launch wait dialog while save operation + * is going on. + * @since 3.0 + * @param : aResourceId: Resource to be used for wait-note. + * aVisibilityDelayOff: Parameter to the wait note. + * aFileName FileName to be displayed in WaitNote + * @return : none. + */ + void LaunchWaitNoteL(TInt aResourceId, + TBool aVisibilityDelayOff, + const TDesC& aFileName ); + + /** + * This method is used check whether content file's full-path + * is available. + * @since 3.0 + * @return : ETrue: Fullpath available, EFalse: Fullpath + * not available. + */ + IMPORT_C TBool IsFileFullPathAvailable() const; + + protected: + + /** + * C++ default constructor. + * aAppDialog: Pointer to the SVGT Dialog + */ + IMPORT_C CSVGTAppObserverUtil( CSVGTUIDialog* aAppDialog ); + + /** + * Default Symbian 2nd phase constructor. + */ + IMPORT_C void ConstructL(); + + /** + * Default Symbian 2nd phase constructor. + * RFile* aFileHdlPtr: File handle to the content. + * const TDesC& filename: Filepath. + * TBool aIsFileFullPathAvailable: Flag to indicate if content's + * fullpath is available. + * TBool aCanSaveContent, + * TBool aShouldMoveContent. + */ + IMPORT_C void ConstructL( RFile* aFileHdlPtr, + const TDesC& aFilename, + TBool aIsFileFullPathAvailable, + TBool aCanSaveContent, + TBool aShouldMoveContent ); + + /** + * Default Symbian 2nd phase constructor. + * RFile* aFileHdlPtr: File handle to the content. + */ + IMPORT_C void ConstructL( RFile* aFileHdlPtr ); + +#ifdef SVGTVIEWERAPP_DBG_FLAG + void PrintDebugMsg( const TDesC& aMsg ); +#endif + + private: //User methods + /** + * Reads the downloaded file & assign to the svg engine. + * @since 3.1 + * @param CSVGTViewerAppDownloads aDownloadItem + * @param RHttpDownload aDownload + */ + void DoAssignImageDataL(const CSVGTViewerAppDownloads* aDownloadItem, + RHttpDownload& aDownload); + + void DoAssignLocalFileDataL( const TDesC& aOriginalUri, const TDesC& aNewUri ) const; + HBufC8* DoGetProcessedEmbededDataL( const TDesC& aXlinkHrefValue ) const; + + private: // Data + +#ifdef SVGTVIEWERAPP_DOWNLOADMGR_ENABLED + // To start a wait loop after initiating download + CActiveSchedulerWait iWait; + + // client side handle for the download manager + RHttpDownloadMgr iDownloadMgr; + + // Handle for download manager ui user interactions + CDownloadMgrUiUserInteractions* iDMgrUserInteractions; + + // Handle for download manager ui downloads list + CDownloadMgrUiDownloadsList* iDMgrDownloadsList; + + // Handle to register download manager UI + CDownloadMgrUiLibRegistry* iDMgrUiReg; + + // Head of Doubly linked list of Downloads + TDblQue iDownloads; + + // Iterator for the doubly linked list + TDblQueIter iDownloadIter; + + // Flag to check whether downloads menu is enabled or not + TBool iDownloadMenuEnabled; + + // Flag to check whether synchronous download is stopped + TBool iSynchronousDownloadStopped; +#endif + // Pointer to the SVGT Dialog + CSVGTUIDialog* iAppDialog; + + //File Manager used for file save operations. + CSVGTFileManager* iFileManager; + + TBool iIsFullFilePathValid; + TBool iCanSaveContent; + TBool iShouldMoveContent; + HBufC* iSvgFileName; + HBufC* iSvgDstFileName; + RFile* iSvgFileId; + CAknProgressDialog* iWaitNote; + + // enumeration to store the state in which the wait note is used. + TWaitNoteState iWaitNoteState; + + CEikProgressInfo* iProgressInfo; + + // Integer storing resource offset to DLL resource file + TInt iResourceOffset; + + // Boolean indicating save done + TBool iSavingDone; + + // Integer to store the command id in context while saving + TInt iCommandId; + + // DocHandler pointer to Open embedded files + CDocumentHandler* iDocHandler; + + // pointer to CEikonEnv + CEikonEnv* iEikEnv; + //TBool iIsFetchImageCall; + + // Boolean to remember whether original file is to be + // deleted after save + TBool iDeleteOrigFile; + + // Boolean to remember whether temp file was used + // to perform cleanup + TBool iTempFileUsed; + + // Used for storing the temporary file name for deletion + HBufC* iTempFileName; + // Used to indicate whether we are attempting to overwrite existing + // file + TBool iIsOverwriteCase; + TBool iDownloadDone; + + // This variable tracks whether the download manager was initialised or not + TBool iDownloadInProgress; + + }; + +#endif // SVGTAPPOBSERVERUTIL_H +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svg_application_observer_utility_api/inc/SVGTFileManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svg_application_observer_utility_api/inc/SVGTFileManager.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2004, 2005 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: File handling utility. +* +*/ + + + +#ifndef SVGTFILEMANGER_H +#define SVGTFILEMANGER_H + +// INCLUDES +#include +#include +#include + +// CONSTANTS +const TInt KSVGTOneSecond(1000000); +const TInt KSVGTOneMinute(60*KSVGTOneSecond); +const TInt KOneHourInSeconds(3600); +const TInt KSVGTPercent(100); + +// CLASS DECLARATION + +/** +* CSVGTFileManager +* File operations +* +* @lib SVGTUIControl.lib +* @since 3.0 +*/ +NONSHARABLE_CLASS(CSVGTFileManager) : public CActive, + public MFileManObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CSVGTFileManager* NewL(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CSVGTFileManager(); + + public: // New functions + + /** + * Starts async copy operation + * @since 3.0 + * @param aCallback Callback to UI side + * @param anOld source + * @param aNew target + * @return KErrDiskFull if mmc full, KErrNone if succesful. + */ + IMPORT_C TInt StartCopyOperationL( MSVGTUISaveListener* aCallback, + const TDesC& anOld,const TDesC& aNew ); + + /** + * Starts async copy operation + * @since 3.0 + * @param aCallback Callback to UI side + * @param aFileHandle source + * @param aNew target + * @return KErrDiskFull if mmc full, KErrNone if succesful. + */ + IMPORT_C TInt StartCopyOperationL( MSVGTUISaveListener* aCallback, + RFile& aFileHandle, const TDesC& aNew ); + + /** + * Cancels async copy operation + * @since 3.0 + * @return void + */ + IMPORT_C void CancelCopy(); + + /** + * Sets iMove if moving is preferred instead of copy. + * @param Document handler EGenericParamAllowMove parameter value. + * @since 2.8 + */ + IMPORT_C void SetAllowMove( TInt32 aValue ); + + public: // Functions from MFileManObserver + + /** @see MFileManObserver::NotifyFileManOperation */ + MFileManObserver::TControl NotifyFileManOperation(); + + private: // Constructors + + /** + * C++ default constructor. + */ + CSVGTFileManager(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // From CActive + + /** @see CActive::RunL() */ + void RunL(); + + /** @see CActive::DoCancel() */ + void DoCancel(); + + private: // New fuctions + + /** + * Timer callback for UI progress update + * @since 3.0 + * @param aPtr Pointer to callback class + * @return KErrNone + */ + static TInt ProgressUpdate(TAny* aPtr); + + /** + * Do progress update + * @since 3.0 + * @return void + */ + void DoProgressUpdate(); + +#ifdef SVGTVIEWERAPP_DBG_FLAG + void PrintDebugMsg( const TDesC& aMsg ); +#endif + + + private: // Data + TInt iFileSize; + TInt iPosition; + TBool iCancel; + CFileMan* iFileMan; + MSVGTUISaveListener* iCallback; // not owned + CPeriodic* iProgressUpdater; + CEikonEnv* iEikEnv; + TBool iMove; + }; + +#endif // SVGTFILEMANGER_H + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svg_application_observer_utility_api/inc/SVGTUISaveListener.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svg_application_observer_utility_api/inc/SVGTUISaveListener.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2004, 2005 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: Callback class for UI save methods +* +*/ + + +#ifndef SVGTUISAVELISTENER_H +#define SVGTUISAVELISTENER_H + +// CLASS DECLARATION + +/** +* MSVGTUISaveListener +* Callback class for UI save methods. File Manager will +* use this callback to indicate the save status to the +* SVGT Dialog. +* +* @lib SVGTUIControl.lib +* @since 3.0 +*/ +NONSHARABLE_CLASS(MSVGTUISaveListener) + { + + public: // New functions + + /** + * Called when buffering or saving position is changed + * @since 3.0 + * @param aPosition, New buffering/saving position (0-100) + * @return void + */ + virtual void SVGTPositionChanged( TInt aPosition ) = 0; + + /** + * Called when saving is finished. + * @since 3.0 + * @param aError, KErrNone or one of the system wide error codes. + * @return void + */ + virtual void SVGTSavingDoneL( TInt aError ) = 0; + + }; + +#endif // SVGTUISAVELISTENER_H + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svg_application_observer_utility_api/svg_application_observer_utility_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svg_application_observer_utility_api/svg_application_observer_utility_api.metaxml Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,18 @@ + + + SVG Application Observer Utility API + Provides utility APIs for handling the callbacks from the SVG-T UI control. The APIs are used by SVG-T viewer and MMS viewer applications. + c++ + domain + + + + + + + + + no + no + + diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_file_view_details_dialog_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_file_view_details_dialog_api/group/bld.inf Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: SVGT File View +Details Dialog API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/SVGTDrmHelper.h APP_LAYER_PLATFORM_EXPORT_PATH(SVGTDrmHelper.h) +../inc/svgtfileviewdetails.h APP_LAYER_PLATFORM_EXPORT_PATH(svgtfileviewdetails.h) + diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_file_view_details_dialog_api/inc/SVGTDrmHelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_file_view_details_dialog_api/inc/SVGTDrmHelper.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,259 @@ +/* +* Copyright (c) 2006 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: DRM helper for svg files. +* +*/ + + + +#ifndef SVGTDRMHELPER_H +#define SVGTDRMHELPER_H + +// INCLUDES +#include + +// DATA TYPES +enum TSVGTRightsStatus + { + ESVGTFull, + ESVGTMissing, + ESVGTRestricted, + ESVGTExpired, + ESVGTPreview + }; + +enum TSVGTExpireConstraint + { + ESVGTNone, + ESVGTCount, + ESVGTTime, + ESVGTCountAndTime + }; + +// CONSTANTS +const TInt KSVGTRightsAboutToExpire = -40000; + +// FORWARD DECLARATIONS +class CDRMHelper; +class CDRMHelperRightsConstraints; +class MDesCArray; +class CCoeEnv; + +// CLASS DECLARATION + +/** +* DRM helper for SVG files. +* +* @lib SVGTUIControl.dll +* @since 3.0 +*/ +class CSVGTDrmHelper : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CSVGTDrmHelper* NewL(); + + /** + * Two-phased constructor. + */ + static CSVGTDrmHelper* NewLC(); + + /** + * Destructor. + */ + virtual ~CSVGTDrmHelper(); + + public: // New functions + + + /** + * This Function checks whether the file has preview rights. + * @since 3.0 + * @param aFileHandle File handle for which usage rights info is loaded. + * @return True if the file has only preview rights + * False if not. + */ + TBool IsPreviewL( RFile& aFileHandle ); + + /** + * This Function checks the rights associated with the file. + * @since 3.0 + * @param aFileHandle File handle for which usage rights is checked. + * @return Button code + */ + TInt CheckRightsAmountL( RFile& aFileHandle ); + + + /** + * This Function gets the drm details needed for thumbnail generation. + * @since 3.0 + * @param aFileHandle File handle for which usage rights info is loaded. + * @param aRightsValid True if the rights are valid + * @param aIsSeparateDeliveryNS True if the file is a separate delivery + * drm file non-supersitributable + * @param aIsProtected True if the file is protected + */ + void GetDrmDetailsL( RFile& aFileHandle, + TBool& aRightsValid, + TBool& aIsSeparateDeliveryNS, + TBool& aIsProtected ); + + + /** + * Loads usage rights information for a svg file using + * CDRMHelper. The loaded constraint is CContentAccess::EPlay. + * @since 3.0 + * @param aFileHandle File handle for which usage rights info is loaded. + */ + void LoadUsageRigthsInfoL( RFile& aFileHandle ); + + + /** + * Gets usage rigths status. + * @since 3.0 + * @param aStatus: + * ESVGTFull: Full rights + * ESVGTMissing: Rights missing + * ESVGTRestricted: Restricted rights + * ESVGTExpired: Expired rights (could be also future rights) + * ESVGTPreview: Preview rights + */ + void GetUsageRightsStatus( TSVGTRightsStatus& aStatus ); + + /** + * Checks if the usage rigths are about to expire. If they are, returns + * info about the rights contraints that are about to expire. + * @since 3.0 + * @param aAboutToExpire Boolean telling if the rigths are about to + * expire or not. + * @param aConstraint Constraint that is about to expire: + * ESVGTCount: Usage count about to expire + * ESVGTTime: Usage time about to expire + * ESVGTCountAndTime: Usage count and time about to + * expire + * @param aCountLeft Usage counts left (only if count is about to expire) + * @param aDaysLeft Usage days left (only if time is about to expire) + */ + void GetExpireStatus( TBool& aAboutToExpire, + TSVGTExpireConstraint& aConstraint, + TInt& aCountLeft, + TInt& aDaysLeft ); + + /** + * Checks if sending of the file is allowed. + * @since 3.0 + * @return ETrue: Sending is allowed. + * EFalse: Sending is not allowed. + */ + TBool SendingAllowed() const; + + /** + * Gets usage count. + * @since 3.0 + * @param aCount Counts left. + * @return Error code: + * KErrNone: Count returned. + * KErrNotFound: Object doesn't have count based rights. + * KErrNotReady: Usage rights info not loaded. + */ + TInt GetCount( TUint32& aCount ); + + /** + * Gets start time of time based rights. + * @since 3.0 + * @param aStartTime Start time. + * @return Error code: + * KErrNone: Start time returned. + * KErrNotFound: Object doesn't have time based rights. + * KErrNotReady: Usage rights info not loaded. + */ + TInt GetStartTime( TTime& aStartTime ); + + /** + * Gets end time of time based rights. + * @since 3.0 + * @param aEndTime End time. + * @return Error code: + * KErrNone: End time returned. + * KErrNotFound: Object doesn't have time based rights. + * KErrNotReady: Usage rights info not loaded. + */ + TInt GetEndTime( TTime& aEndTime ); + + /** + * Gets interval time constraint. + * @since 3.0 + * @param aInterval Interval. + * @return Error code: + * KErrNone: Interval returned. + * KErrNotFound: Object doesn't have interval constraint. + * KErrNotReady: Usage rights info not loaded. + */ + TInt GetInterval( TTimeIntervalSeconds& aInterval ); + + /** + * Gets start time of activated interval constraint. + * @since 3.0 + * @param aStartTime Start time. + * @return Error code: + * KErrNone: Start time returned. + * KErrNotFound: Interval has not been started yet. + * KErrNotReady: Usage rights info not loaded. + */ + TInt GetIntervalStart( TTime& aStartTime ); + + /** + * Provides info about files DRM protection status. + * @since 3.0 + * @return ETrue: The file is DRM protected. + * EFalse: The file is not DRM protected. + */ + TBool IsProtected() const; + + /** + * Checks if given content can be set as an automated content. + * @since 3.0 + * @return Boolean. + */ + TBool CanSetAutomated() const; + + private: // Private contructors + + /** + * C++ default constructor. + */ + CSVGTDrmHelper(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + CDRMHelper* iDrmHelper; + CDRMHelperRightsConstraints* iRightsConstraints; + CCoeEnv* iEnv; + + TBool iProtected; + TBool iExpired; + TBool iSendingAllowed; + TBool iCanSetAutomated; + }; + +#endif // SVGTDRMHELPER_H + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_file_view_details_dialog_api/inc/svgtfileviewdetails.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_file_view_details_dialog_api/inc/svgtfileviewdetails.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,291 @@ +/* +* Copyright (c) 2006 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: Declares svg file details dialog +* +*/ + + + +#ifndef SVGTFILEVIEWDETAILSDIALOG_H +#define SVGTFILEVIEWDETAILSDIALOG_H + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS + +class CAknDoublePopupMenuStyleListBox; +class CEikonEnv; + + +// CLASS DECLARATIONS + +/** +* CSvgtFileDetails +* Container class for file details +*/ +class CSvgtFileDetails : public CBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CSvgtFileDetails(); + + /** + * Destructor. + */ + virtual ~CSvgtFileDetails(); + + public: // Data + + HBufC* iUrl; + HBufC* iFormat; + + TInt iSize; + TTime iTime; + + + // Drm stuff + TBool iDrmProtected; + TSVGTRightsStatus iDRMRightsStatus; + TSVGTExpireConstraint iDRMExpireConstraint; + TBool iDRMForwardLocked; + TUint32 iDRMCountsLeft; + + TBool iDRMFileHasInterval; + TBool iDRMIntervalActive; + TTimeIntervalSeconds iDRMInterval; + + TTime iDRMValidFrom; + TTime iDRMValidUntil; + + }; + + + +/** +* CSvgtFileViewDetailsDialog +* Used to display "View Details" option +* Makes use of SVGTdrmhelper to display the drm details +* +* @lib SVGTFileDetailsDialog.lib +* @since 2.0 +*/ +class CSvgtFileViewDetailsDialog : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CSvgtFileViewDetailsDialog* NewL(); + + /** + * Destructor. + */ + virtual ~CSvgtFileViewDetailsDialog(); + + public: // New functions + + + /** + * Shows file details to user in dialog. + * @since 3.0 + * @param aFileHandle File handle for which usage rights info is loaded. + * @leaves Leaves with KErrNotSupported if file is not valid media file. + * @return void + */ + IMPORT_C void ExecuteLD( RFile& aFileHandle ); + + private: + + /** + * C++ default constructor. + */ + CSvgtFileViewDetailsDialog(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // New functions + + /** + * Sets title for CAknPopupList. + * @since 3.0 + * @param aPopupList CAknPopupList which title is modified + * @return void + */ + void SetTitleL( CAknPopupList* aPopupList ) const; + + /** + * Fills listbox with file details information. + * @since 3.0 + * @param aFileDetails File details + * @return void + */ + void FillListBoxL( const CSvgtFileDetails* aFileDetails ); + + /** + * Adds header and value to list. + * @since 3.0 + * @param aHeading Heading + * @param aValue Value + * @param aItemArray Array where value and header are added. + * @return void + */ + void AddItemToListBoxL( const TDesC& aHeading, const TDesC& aValue, + CDesCArray* aItemArray ) const; + + + /** + * Constructs clip url item. + * @since 3.0 + * @param aItemArray Array where constructed item is put. + * @param aFileDetails File details. + * @return void + */ + void MakeUrlItemL( CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails ) const; + + /** + * Constructs media format item. + * @since 3.0 + * @param aItemArray Array where constructed item is put. + * @param aFileDetails File details. + * @return void + */ + void MakeFormatItemL( CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails ) const; + + + /** + * Constructs file size item. + * @since 3.0 + * @param aItemArray Array where constructed item is put. + * @param aFileDetails File details. + * @return void + */ + void MakeSizeItemL( CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails ) const; + + /** + * Constructs date item. + * @since 3.0 + * @param aItemArray Array where constructed item is put. + * @param aFileDetails File details. + * @return void + */ + void MakeDateItemL( CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails ) const; + + /** + * Constructs time item. + * @since 3.0 + * @param aItemArray Array where constructed item is put. + * @param aFileDetails File details. + * @return void + */ + void MakeTimeItemL( CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails ) const; + /** + * Converts between arabic-indic digits and european digits. + * @since 3.0 + * @param aText numbers to be converted. + * @return void + */ + void LanguageSpecificNumberConversion( TDes& aText) const; + + /** + * Fetches drm file details. + * @since 3.0 + * @param aFileHandle File handle for which usage rights info is loaded. + * @param aFileDetails Pointer to the details to be fetched. + * @return void + */ + void FetchDrmDataL( RFile& aFileHandle, + CSvgtFileDetails* aFileDetails ) const; + + + /** + * Constructs DRM items. + * @since 3.0 + * @param aItemArray Array where constructed item is put. + * @param aFileDetails File details. + * @return void + */ + void MakeDrmItemsL( CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails ) const; + + /** + * Constructs restricted drm items. E.g. count, interval + * @since 3.0 + * @param aRights Drm right type "Play" + * @param aItemArray Array where constructed item is put. + * @param aFileDetails File details. + * @return void + */ + void MakeRestrictedDrmItemsL( const HBufC* aRights, + CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails ) const; + + /** + * Add a single element of time to the string array + * @param aNumOfElements Number of elements of the interval + * @param aResourceIdSingle Resource id to be used in case of + * single unit + * @param aResourceIdOneFinal Resource id to be used in case of + * units ending with 1, from 21 + * (requested by Slavic languages) + * @param aResourceIdTwoFour Resource id to be used in case of + * units included from two to four, except + * 12-14 (requested by Slavic languages) + * @param aResourceIdFiveZero Resource id to be used in case of + * units ending from 5 to 9, plus range + * from 11 to 14 (requested by Slavic + * languages) + * @param aStrings Buffer where to add the element + */ + void AddSinglePartOfTimeL( TInt aNumOfElements, + TInt aResourceIdSingle, + TInt aResourceIdOneFinal, + TInt aResourceIdTwoFour, + TInt aResourceIdFiveZero, + HBufC*& aStrings ) const; + + void AddResourceFileToEnvL(); + + /** + * Shows file details to user in dialog. + * @since 3.0 + * @param aFileDetails File details which are shown to user. + * @return void + */ +// void ExecuteLD( const CSvgtFileDetails* aFileDetails ); + void DoLaunchDialogL(const CSvgtFileDetails* aFileDetails ); + + private: // Data + CAknDoublePopupMenuStyleListBox* iListBox; + CEikonEnv* iEnv; + TInt iResOffset; + }; + +#endif //SVGTFILEVIEWDETAILSDIALOG_H + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_file_view_details_dialog_api/svgt_file_view_details_dialog_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_file_view_details_dialog_api/svgt_file_view_details_dialog_api.metaxml Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,18 @@ + + + SVGT File View Details Dialog API + Provides the interface to display svgt file details. + c++ + domain + + + + + + + + + no + no + + diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/group/bld.inf Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: SVG-T Viewer UI API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/SVGTProgressBarTimer.h APP_LAYER_PLATFORM_EXPORT_PATH(SVGTProgressBarTimer.h) +../inc/SVGTPointerHideTimer.h APP_LAYER_PLATFORM_EXPORT_PATH(SVGTPointerHideTimer.h) +../inc/SVGTAppObserver.h APP_LAYER_PLATFORM_EXPORT_PATH(SVGTAppObserver.h) +../inc/SvgCodecImageConstants.hrh APP_LAYER_PLATFORM_EXPORT_PATH(SvgCodecImageConstants.hrh) +../inc/SVGTUIDialog.h APP_LAYER_PLATFORM_EXPORT_PATH(SVGTUIDialog.h) +../inc/SVGTCustControl.h APP_LAYER_PLATFORM_EXPORT_PATH(SVGTCustControl.h) +../inc/SvgtApplicationExitObserver.h APP_LAYER_PLATFORM_EXPORT_PATH(SvgtApplicationExitObserver.h) +../inc/SVGTUIControlDbgFlags.hrh APP_LAYER_PLATFORM_EXPORT_PATH(SVGTUIControlDbgFlags.hrh) +../inc/SVGTThumbnailUtil.h APP_LAYER_PLATFORM_EXPORT_PATH(SVGTThumbnailUtil.h) +../inc/SVGTViewerAppDbgFlags.hrh APP_LAYER_PLATFORM_EXPORT_PATH(SVGTViewerAppDbgFlags.hrh) +../inc/SVGTViewerAppDownloads.h APP_LAYER_PLATFORM_EXPORT_PATH(SVGTViewerAppDownloads.h) +../inc/SVGTCustControl.rh APP_LAYER_PLATFORM_EXPORT_PATH(SVGTCustControl.rh) +../inc/SVGTUIDialog.hrh APP_LAYER_PLATFORM_EXPORT_PATH(SVGTUIDialog.hrh) diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTAppObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTAppObserver.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2004,2005 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: Mixin Class that defines the call back interface used +* by application using the SVGT Control. +* +*/ + + +#ifndef SVGTAPPOBSERVER_H +#define SVGTAPPOBSERVER_H + +/** +* MSvgtAppObserver is an interface class used by SVGT control to callback to +* the application. +* @lib SVGTUIControl.lib +* @since 3.0 +*/ + +class MSvgtAppObserver +{ + public: + + + /** + * This method is called to retrieve the absolute path of an image gvien + * the uri. The SVGT control requests the absolute path to provide the + * client with control of the location of the images. + * @since 3.0 + * see MSvgRequestObserver::FetchImage + */ + virtual TInt FetchImage( const TDesC& aUri, + RFs& aSession, RFile& aFileHandle ) = 0; + + /** + * This method is called to notify the client that a link has been + * activated. + * + * @since 3.0 + * @param : aUri -- URI string of hyperlink + * @return : For future use. Value is ignored. + */ + virtual TBool LinkActivated( const TDesC& aUri ) = 0 ; + + /** + * This method is called to notify the client that a link has been + * activated. When Show is also present . + * + * @since 3.0 + * @param : aUri -- URI string of hyperlink + * @param : aShow -- xlink:show value + * @return : For future use. Value is ignored. + */ + virtual TBool LinkActivatedWithShow( const TDesC& aUri, + const TDesC& aShow ) = 0; + + /** + * This method is called to notify the client that download menu has + * been selected in the UI dialog + * @since 3.0 + */ + virtual void DisplayDownloadMenuL( void ) = 0; + + /** + * This method is called to get the SMIL fit value to be used by the + * engine. + * @since 3.0 + */ + virtual void GetSmilFitValue( TDes& aSmilValue ) = 0; + + /** + * This method is called to check from the client if Save option + * should be displayed. + * + * @since 3.0 + * @return : ETrue: Save can be shown. EFalse: Save can't be shown. + */ + virtual TBool CanShowSave() = 0; + + /** + * This method is called to check from the client if Saving + * is done already + * + * @since 3.0 + * @return : ETrue: The content is saved + * EFalse: content is not saved + */ + virtual TBool IsSavingDone() = 0; + + /** + * This method is called to check from the client if Downloads option + * should be displayed. + * + * @since 3.0 + * @return : ETrue: Downloads can be shown. + * EFalse: Downloads can't be shown. + */ + virtual TBool CanShowDownload() const = 0; + + + /** + * This method is called to perform the save operation. + * Note the Save functionality depends on the client invoking + * the dialog. E.g. Browser->SVGT-Viewer->Dialog then save + * results in Move operation to save memory. + * param aButtonId context in which save is called + * @since 3.0 + * @return : void. + */ + + virtual void DoSaveL( TInt aButtonid ) = 0; + + /** + * This method is called to retrieve the absolute path of an image given + * the uri. The SVGT control requests the absolute path to provide the + * client with control of the location of the images. This function should + * be an asynchronous, i.e. it should not block. + * On completion of fetching of the file, it should notify the control + * using AssignImageData() function + * @since 3.1 + * see MSvgRequestObserver::ImageDataReference + */ + virtual TInt NewFetchImageData( const TDesC& aUri ) = 0; + + /** + * This method is called instead of NewFetchImageData in case the image + * is defined as part of the SVG content itself i.e. inline using base-64 + * encoding for eg. + * @since 3.1 + * see MSvgRequestObserver::ImageDataReference + */ + virtual void AssignEmbededDataL( const TDesC& aUri ) = 0; + virtual TBool ExitWhenOrientationChange() = 0 ; +}; +#endif +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTCustControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTCustControl.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,1490 @@ +/* +* Copyright (c) 2004,2005 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: SVGT Custom Control Class implements the custom control used +* to display SVGT content. +* +*/ + + + +#ifndef __SVGTCUSTCONTROL_H__ +#define __SVGTCUSTCONTROL_H__ + +// INCLUDES + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#ifdef RD_SVGT_AUDIO_SUPPORT +#include //for MRemConCoreApiTargetObserver +#endif //RD_SVGT_AUDIO_SUPPORT + +// CONSTANTS +const TInt KFindTextQueryMaxLen = 50; +// MACROS + +// DATA TYPES + +// Enumeration for indicating animation Status of current SVGT Content +enum TSvgtAnimStatus { + ESvgNoAnimationsPresent, + ESvgAllAnimationsComplete, + ESvgAnimationsNotComplete }; + +// Enumeration for indicating Animation State of the viewer +enum TSvgtViewerAnimStatus + { + ESvgAnimPausedState, + ESvgAnimPlayingState, + ESvgAnimStoppedState + }; + +// Enumeration for indicating pointer types in the viewer +enum TSvgtViewerPointerTypes + { + ESvgPointerDefault, + ESvgPointerHand, + ESvgPointerText + }; + + +enum TSvgCustomControlFlag + { + ESvgDisplayWaitNote = 0x01, // need to draw initial wait note + ESvgDisplayErrorNotes = 0x02, // Display Error Notes + ESvgDisplayIcons = 0x04, // Display Icons + ESvgWindowOwning = 0x08, // Window Owning Control + ESvgDrawPointer = 0x10, // Pointer is drawn + ESvgDrawPanIndicator = 0x20, // Panning Indicator is drawn + ESvgDrawPauseIndicator = 0x40, // Pause Indicator is drawn + ESvgDrawProgressBar = 0x80, // ProgressBar drawn + ESvgUseBackLight = 0x100 // Keep Backlight on while animating + }; + +enum TSvgCustomControlSelectCause + { + ESvgInvalidSelectCause, + ESvgHyperLinkSelectCause, + ESvgTextSelectCause, + ESvgTextAreaSelectCause + }; + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class CSvgEngineInterfaceImpl; +class CSVGTHyperlinkHandler; +class CCoeControl; +class CSVGTProgressBarTimer; +class MSvgtAppObserver; +class CAknWaitDialog; +class CSVGTDrmHelper; +class CSvgtThreadController; +class CAknInformationNote; +class MSvgtApplicationExitObserver; +class CSvgtEventHandlerAO; +class CAknNavigationControlContainer; +class CAknNavigationDecorator; + +#ifdef RD_SVGT_AUDIO_SUPPORT +class CAknVolumePopup; +class CRemConCoreApiTarget; +class CRemConInterfaceSelector; +#endif //RD_SVGT_AUDIO_SUPPORT + +// CLASS DECLARATION + +/** +* Interface for the progress timer event listener. +* @lib SVGTUIControl.lib +* @since 3.0 +*/ + +class MSVGTProgressBarDrawImpl + { + public: + + /** + * This function is called in order to render the progress indicator. + * @since 3.0 + * @param aTimeElapsed - Contains the time elapsed in seconds. + * @param aTotalTime - Contains the total time in seconds + */ + virtual void DrawProgressBarL( TUint aTimeElapsed, + TUint aTotalTime ) = 0; + }; + +/** +* Interface for MSK labelling +* @lib SVGTUIControl.lib +* @since 3.2 +*/ + +class MSVGTMSKImpl +{ + public: + + /** + * This function is called to draw the MSK label by pushing the command to + * position button's stack + * @since 3.2 + * @param aResourceID - The MSK label resourceID + * @param aCommandID - The command associated with that label + */ + virtual void DrawMSKLabelL(TInt aResourceID,TInt aCommandID)=0; + + /** + * This function is called to remove MSK label from button group's stack + * @since 3.2 + */ + virtual void RemoveMSKLabel()=0; + +}; + + +class MCustControlPointerEventHandler + { +public: + virtual TBool HandleCustControlPointerEventL(const TPointerEvent& aPointerEvent) = 0; + }; + + +class MSvgCustControlListener +{ +}; + +enum TCustControlListener + { + EAudioListener = 0 + }; +#ifdef RD_SVGT_AUDIO_SUPPORT +class MSvgAudioMuteListener : public MSvgCustControlListener +{ + public: + virtual void VolumeMuted(TBool aIsVolumeMuted) = 0; +}; +#endif +/** +* CSVGTCustControl is a CCoeControl used to display SVGT content. +* It can be used independently or through dialog provided by +* CSVGTUIDialog. +* +* @lib SVGTUIControl.lib +* @since 3.0 +*/ + +class CSVGTCustControl : public CCoeControl, + public MSvgRequestObserver, + public MSvgAnimationListener, + public MSVGTProgressBarListener, + public MSVGTPointerInactivityListener, + public MSvgHyperlinkListener +#ifdef SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE + , public MSvgTextAreaListener, + public MSvgTextListener +#endif // SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE + , public MSvgLoadingListener + +#ifdef RD_SVGT_AUDIO_SUPPORT + , public MCoeControlObserver + , public MRemConCoreApiTargetObserver +#endif //RD_SVGT_AUDIO_SUPPORT + , public MSvgInteractiveElementListener + ,public MSvgViewPortListener + { + public: + enum TFileType + { + // The uri refers to a local image file + ELocalImageFile, + // The uri refers to a remote image file + ERemoteImageFile, + // The uri doesnt refer to an image file + ENotAnImageFile, + // The uri is not well formed(parsing error) + EInvalidFilePath + }; + public: // Constructors and destructor + + MCustControlPointerEventHandler* iPntrObserver; + void SetPointerObserver(MCustControlPointerEventHandler* aPntrObserver) + { + iPntrObserver = aPntrObserver; + } + + +//TOUCH SUPPORT START +#ifdef RD_SCALABLE_UI_V2 + //From CCoeControl + void HandlePointerEventL(const TPointerEvent& aPointerEvent); + void SetContainerWindowL(const CCoeControl &aContainer); + + enum TIndicatorType + { + ELeftIndicator, + ERightIndicator, + EUpIndicator, + EDownIndicator, + EPauseIndicator, //for future use + ENoIndicator + }; + + TIndicatorType ActiveIndicator(const TPoint aPosition ) const; + TRect ActiveIndicatorRect( TIndicatorType aIndicator) const; + + void PanPresentation(const CSVGTCustControl::TIndicatorType aIndicatorType ); + +#endif //RD_SCALABLE_UI_V2 + +#ifdef RD_SVGT_AUDIO_SUPPORT + //From MCoeControlObserver + virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); + + void SetPresentationVolume( TInt aVolumeLevel ); + TInt PresentationVolume() const; + + TInt GetPrevVolume() const; + void MrccatoCommand(TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ); + + void FilterAndSendCommand(TInt aCommandId); + +#endif //RD_SVGT_AUDIO_SUPPORT +//TOUCH SUPPORT END + + /** + * Two-phased constructor. + * @since 3.0 + * @param aFileHandle RFile that indicates the SVGT content filehandle + * @param aAppObs Implementation Class provided by application that + * uses this control + * @param aPBDrawImpl Implementation for rendering progress Indicator + * @param aMSKImpl Implementation for drawing MSK label + * Note: The ownership of the file handle is not transferred. + * It is the responsibility of the caller to close this file + * after deleting this control. + * @return CSVGTCustControl* + */ + + IMPORT_C static CSVGTCustControl* NewL( RFile& aFileHandle, + MSvgtAppObserver* aAppObs, + MSVGTProgressBarDrawImpl* aPBDrawImpl, + MSVGTMSKImpl* aMSKImpl, + MSvgtApplicationExitObserver* + aExitObserver = NULL, + TBool aProgressiveRendering = EFalse, + const CCoeControl* aParent = NULL, + TInt aDisplayFlag = + ESvgDisplayWaitNote| + ESvgDisplayErrorNotes| + ESvgDisplayIcons| + ESvgDrawPanIndicator| + ESvgDrawPointer| + ESvgDrawPauseIndicator| + ESvgDrawProgressBar| + ESvgUseBackLight + ); + + /** + * Two-phased constructor which pushes created object onto + * Cleanup Stack. + * @since 3.0 + * @param aFileHandle RFile that indicates the SVGT content filehandle + * @param aAppObs Implementation Class provided by application that + * uses this control + * @param aPBDrawImpl Implementation for rendering progress Indicator + * @param aMSKImpl Implementation for drawing MSK label + * Note: The ownership of the file handle is not transferred. + * It is the responsibility of the caller to close this file + * after deleting this control. + * @return CSVGTCustControl* + */ + + static CSVGTCustControl* NewLC( RFile& aFileHandle, + MSvgtAppObserver* aAppObs, + MSVGTProgressBarDrawImpl* aPBDrawImpl, + MSVGTMSKImpl* aMSKImpl, + MSvgtApplicationExitObserver* + aExitObserver = NULL, + TBool aProgressiveRendering = EFalse, + const CCoeControl* aParent = NULL, + TInt aDisplayFlag = + ESvgDisplayWaitNote| + ESvgDisplayErrorNotes| + ESvgDisplayIcons| + ESvgDrawPanIndicator| + ESvgDrawPointer| + ESvgDrawPauseIndicator| + ESvgDrawProgressBar| + ESvgUseBackLight ); + /** + * Destructor. + */ + + virtual ~CSVGTCustControl(); + + public: // New functions + + + /** + * Sets the MSK Labels under various circumstances. + * @since 3.2 + */ + void SetMSKLabelL(); + + /** + * Indicates whether the context menu is opened or not + * @since 3.2 + * @param aButtonID -EAknSoftkeyContextOptions indicates context menu icon is pressed + * -EAknSoftkeySelect animation on mousedown/mouseup event. + * @return TBool-ETrue Indicates context menu icon is pressed + * EFalse otherwise. + */ + TBool GetMSKLabelFlag(TInt aButtonId) const; + + + /** + * Sets either the iPlayMSKLabel and iContextMenuActivated flag. + * @since 3.2 + * @param aButtonID -EAknSoftkeyContextOptions indicates context menu icon is pressed + * -EAknSoftkeySelect animation on mousedown/mouseup event. + */ + void ChangeMSKLabelFlag(TInt aButtonId); + + /** + * Process commands for handling SVGT content. + * @since 3.0 + * @param aCommandId Integer indicating command that was activated. + */ + virtual void ProcessViewerCommandL( TInt aCommandId ); + + /** + * Get function for current zoom level. + * @since 3.0 + * @param aZoomLevel Integer indicating the number of times the + * user has zoomed in(Zero indicates original view or no Zoom) + */ + void GetCurrentZoomLevel( TInt& aZoomLevel ) const; + + /** + * Get function for current play status. + * @since 3.0 + * @param aIsPlaying Boolean indicating whether Content is + * Playing/Paused. + */ + void GetCurrentAnimState( TSvgtViewerAnimStatus& aAnimState ) const; + + /** + * Indicates whether the Control in Full Screen Mode. + * @since 3.0 + * @param aIsFullScreenOn Boolean indicating whether Content is + * in Full Screen Mode. + */ + void GetCurrentFullScreenStatus( TBool& aIsFullScreenOn ) const; + + /** + * Indicates whether the Loop feature is enabled for the Control + * @since 3.0 + * @param aIsLoopOn Boolean indicating whether Content is + * in Loop Mode. + */ + void GetCurrentLoopStatus( TBool& aIsLoopOn ) const; + + /** + * Gets the normal screen layout rectangle for control from LAF + * @since 3.0 + * @param aRect TRect indicating the rectangle extent of the control + */ + void GetNormalScreenLayoutRect( TRect& aRect ) const; + + /** + * Indicates whether the Loop feature is allowed for the Control + * Note: Loop Feature is allowed only for Non-Interactive content + * which has finite duration animations. + * @since 3.0 + * @return TBool - ETrue Indicates Loop is allowed + * EFalse Otherwise. + */ + TBool IsLoopAllowed() const; + + /** + * Finds whether the content contains animations + * @return TBool - ETrue indicates content contains animations, + * EFalse otherwise + * @since 3.0 + */ + TBool IsAnimationPresent() const; + + /** + * Finds whether the content contains any infinite duration animation + * @return TBool - ETrue indicates Finite duration, + * EFalse otherwise + * @since 3.0 + */ + TBool IsContentFinite() const; + + /** + * Indicates whether the SVG content is loaded + * @return TBool - ETrue indicates content loading complete, + * EFalse otherwise + * @since 3.0 + */ + TBool IsProcessDone() const; + + /** + * Sets the screen mode of the Control State Variable. + * Note: This does not change the size of the framebuffer - + * This is done in the SizeChanged(). + * @since 3.0 + * @param aIsFullScreenOn Boolean indicating whether Content is + * in Full Screen Mode. + */ + virtual void SetCurrentFullScreenStatus( TBool aIsFullScreenOn ); + + /** + * Function used by the application to handle background/foreground + * events. When the application goes to background the presentation + * needs to be paused. When application comes back to foreground, + * the user would need to start the paused presentation. + * @param aForeground: ETrue: Foreground event, + * EFalse: Background event. + * @since 3.0 + */ + void HandleApplicationForegroundEvent( TBool aForeground ); + + /** + * Indicates whether the "Select Text" menu item be displayed + * @since 3.1 + * @return TBool - ETrue Indicates menu item is displayed + * EFalse Otherwise. + */ + TBool IsTextSelectOn() const; + + /** + * Indicates whether the "Edit Text" menu item be displayed + * @since 3.1 + * @return TBool - ETrue Indicates menu item is displayed + * EFalse Otherwise. + */ + TBool IsTextEditOn() const; + + /** + * Indicates whether the text content has changed since + * last Save. + * @since 3.1 + * @return TBool - ETrue Indicates text has changed + * EFalse Otherwise. + */ + TBool IsTextContentChanged() const; + + /** + * Used to notify custom control that save is complete and + * any cleanup operation can be performed. + * @since 3.1 + */ + void SaveComplete( const TInt aError ); + TInt DoHandleLoadingThreadError(); + void DoExitFromDialogL(); + + void AssignImageData( const TDesC& aUri, HBufC8* aData ); + TFileType ImageFileType( const TDesC& aUri ) const; + void SetThreadRunning(TBool aState); + TBool IsThreadRunning() const; + void PerformEngineRedraw(); + + /** + * Used to reset the backlight time for finite content + * any cleanup operation can be performed. + * @since 3.1 + */ + void ResetBacklightTime(); + + void StopEventHandler(); + + /** + * This is a utility function is used for performing functionality + * once the engine load is complete + * @since 3.1 + */ + void DoPostLoadFuncL(); + + /** + * This is a utility function for saving the SVG content to + * a file + * @since 3.1 + */ + TInt SaveSvgDom( const TDesC& aFileName ); + + void GetViewPort(TInt getWidth, TInt getHeight, TBool isWidthInPercentage, TBool isHeightInPercentage, TInt& setWidth, TInt& setHeight); + + public: // Functions from base classes + /** + * From MSvgRequestObserver Method called by SVG Engine + * after it has rendered a frame. + * @since 3.0 + */ + void UpdateScreen(); + + /** + * From MSvgRequestObserver This method is for future extension, + * in which an external script engine could be used to evaluate + * a script description. + * @since 3.0 + * @param aScript Descriptor containing script + * @param aCallerElement SVG Element that calls the script by a + * an event of the "on" attribute. + * @return TBool. + */ + TBool ScriptCall( const TDesC& aScript, + CSvgElementImpl* aCallerElement ); + + /** + * From MSvgRequestObserver This method is called by the SVG engine + * to retrieve the absolute path of the image file. + * @since 3.0 + * @param aUri Descriptor containing the relative path of the image. + * @param aFilePath Descriptor which contains absolute path that is + * to be used by the Engine to retrieve the image. + * @return TBool - + * ETrue indicates absolute path is present in aFilePath. + * EFalse otherwise. + */ + TInt FetchImage( const TDesC& aUri, + RFs& aSession, RFile& aFileHandle ) ; + + TInt FetchFont( const TDesC& /* aUri */, + RFs& /* aSession */, RFile& /* aFileHandle */ ); + + /** + * From MSvgRequestObserver This method is called by the SVG engine + * to get the SMIL Fit attribute value. + * @since 3.0 + * @param aSmilValue Descriptor containing the SMIL Fit attribute. + */ + void GetSmilFitValue( TDes& aSmilValue ); + + /** + * From MSvgRequestObserver This method is called by the SVG engine + * to update the presentation status. + * @since 3.0 + * @param aNoOfAnimation Integer. When called for the first time + * it indicates total number of animations. + * Subsequently it contains number of animations that were completed. + */ + void UpdatePresentation( const TInt32& aNoOfAnimation ); + + /** + * From CCoeControl Key Handling Method for control. + * @since 3.0 + * @param aKeyEvent Key Event. + * @param aType Type of Key Event. + * @return TKeyResponse - EKeyWasConsumed/EKeyWasNotConsumed. + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + /** + * From CCoeControl + * @see CCoeControl::HandleResourceChange + */ + void HandleResourceChange( TInt aType ); + + + public: //From MSvgHyperlinkListener + + /** + * From MSvgHyperlinkListener + * @see MSvgHyperlinkListener::LinkEntered + */ + virtual TBool LinkEntered( const TDesC& aUri ); + + /** + * From MSvgHyperlinkListener + * @see MSvgHyperlinkListener::LinkExited + */ + virtual TBool LinkExited( const TDesC& aUri ) ; + + + + /** + * From MSvgHyperlinkListener + * @see MSvgHyperlinkListener::LinkActivated + */ + virtual TBool LinkActivated( const TDesC& aUri ) ; + + /** + * From MSvgHyperlinkListener + * @see MSvgHyperlinkListener::LinkActivatedWithShow + */ + virtual TBool LinkActivatedWithShow( const TDesC& aUri, + const TDesC& aShow ) ; + + + public: + + /** + * From MSvgLoadingListener + * @see MSvgLoadingListener::ReportAllElements + */ + virtual TBool ReportAllElements() ; + + /** + * From MSvgLoadingListener + * @see MSvgLoadingListener::WillAssignImageData + */ + virtual TBool WillAssignImageData() ; + + /** + * From MSvgLoadingListener + * @see MSvgLoadingListener::ImageDataReference + */ + virtual void ImageDataReference( const TDesC& aUri ); + + /** + * From MSvgLoadingListener + * @see MSvgLoadingListener::DocumentStart + */ + virtual TBool DocumentStart() ; + + /** + * From MSvgLoadingListener + * @see MSvgLoadingListener::DocumentEnd + */ + virtual TBool DocumentEnd() ; + + /** + * From MSvgLoadingListener + * @see MSvgLoadingListener::ElementStart + */ + virtual TBool ElementStart( const TDesC& aTagName , + MSvgAttributeList& aAttributeList ); + + /** + * From MSvgLoadingListener + * @see MSvgLoadingListener::ElementEnd + */ + virtual TBool ElementEnd( const TDesC& aTagName ) ; + + /** + * From MSvgLoadingListener + * @see MSvgLoadingListener::ExternalDataRequested + */ + virtual TBool ExternalDataRequested( const TDesC& aUri ) ; + + /** + * From MSvgLoadingListener + * @see MSvgLoadingListener::ExternalDataReceived + */ + virtual TBool ExternalDataReceived( const TDesC& aUri ) ; + + /** + * From MSvgLoadingListener + * @see MSvgLoadingListener::ExternalDataRequestFailed + */ + virtual TBool ExternalDataRequestFailed( const TDesC& aUri ) ; + + /** + * From MSvgLoadingListener + * @see MSvgLoadingListener::UnsupportedElement + */ + virtual TBool UnsupportedElement( const TDesC& aTagName , + MSvgAttributeList& aAttributeList ); + + virtual void ImagesLoaded(TInt aError); + + public: // From MSvgAudioMuteListener + /** + * This function is called to add a observer that will want a + * callback from custcontrol + * @param aListener object which needs the callback + * aType represents the type of listener + * @since 5.0 + */ + IMPORT_C void AddListener(MSvgCustControlListener *aListener, TCustControlListener aType); + + protected: // New functions - Startup Helper Functions + /** + * This function is called to create the bitmaps used by the SVG + * engine for rendering. + * @param aBitmapSize Size of Bitmap used for Framebuffer + * @since 3.0 + */ + void CreateBitmapsL( const TSize& aBitmapSize ); + + /** + * This function is called to create the icons used by the control + * for panning/pointer display etc. + * @since 3.0 + */ + void CreateIconsL(); + /** + * This function is called to initialize the SVGT-Engine interface. + * @since 3.0 + */ + void InitializeEngineL(); + + /** + * This function uses the SVG Engine to load the SVGT content. + * @since 3.0 + * @param aFileHandle file handle to the SVGT content + * SVGT content. + */ + void LoadContentL( RFile& aFileHandle ); + + /** + * This function is used for the loading of SVG content in case + * of progressive rendering + * @since 3.1 + * @param TAny* Pointer to the custom control + */ + static TInt LoadSvgContent( TAny* aAny ); + + /** + * This function is used for initialising the SVG engine in case + * of progressive rendering + * @since 3.1 + */ + void InitSvgContentL(); + + /** + * This is a utility function is used for displaying the + * information notes + * @since 3.1 + */ + void DisplayInfoNoteL( TInt aResourceId, TBool aIsWaitingDialog ); + + protected: // New functions - Pointer Helper Functions + /** + * Draws the Pointer on the screen. + * @since 3.0 + */ + void DrawPointer() const; + + /** + * This function is called when pointer needs to be redrawn. + * @since 3.0 + */ + void UpdatePointer(); + + protected: // New functions - Full/Normal Screen Helper Functions + /** + * This function is called to change the framebuffer to new size + * in the SizeChanged function + * @since 3.0 + */ + void SwitchScreenModeL(); + + protected: // New functions - Find Text Helper Functions + + /** + * This function is called to calculate the find text bounding boxes. + * @since 3.0 + * @return Bool Indicating Text was found or not + */ + TBool CalcFindTextBBox(); + + /** + * This function is called to pan the content in order that the + * current bounding box is visible. The reference point is taken as the + * center of the screen. + * @since 3.0 + */ + void PanToCurBBox(); + + /** + * This function is called to perform the necessary procesing for + * Find Text. + * @since 3.0 + */ + void ProcessFindTextCmdL(); + + /** + * Draws the Bounding box for the current match on the screen. + * @since 3.0 + * + */ + void DrawFindTextBBox( const TRect& aRect ) const; + + /** + * This function is called to perform the necessary procesing when + * text being searched using Find Text command is not found. + * @since 3.0 + */ + void ProcessNoTextFoundL(); + + + protected: // New functions - Panning Indicator Helper Functions + /** + * Draws the Pan Indicators on the screen. + * @since 3.0 + */ + void DrawPanInd() const; + + protected: // New functions - Related to Progress Bar/Loop + /** + * Counts the number of animations started in the SVGT content. + * @since 3.0 + */ + void CountAnimStarted(); + + /** + * Counts the number of animations paused in the SVGT content. + * @since 3.0 + */ + void CountAnimPaused(); + + /** + * Counts the number of animations stopped in the SVGT content. + * @since 3.0 + */ + void CountAnimStopped(); + + + /** + * Function indicates whether the animation currently in + * progress is first one. + * @return TBool - ETrue - First one + * EFalse Otherwise. + * @since 3.0 + */ + TBool IsAnimFirst() const; + + /** + * Function indicates whether the animation currently in + * progress is first one. + * @return TBool - ETrue - First one + * EFalse Otherwise. + * @since 3.0 + */ + TBool IsAnimLast() const; + + protected: // New functions for Pointer handling + /** + * Function sets the Pointer display status and redraws the whole + * control inorder to update display status + * @since 3.0 + */ + void SetPointerDisplayStatusAndRedraw( TBool aIsPointerDisplayed ); + protected: // New functions for pause icon blink support + /** + * Function sets the Pause display status and starts the periodic + * timer to draw the Pause Indicator + * @param TBool ETrue Indicates that Pause should be displayed + * @since 3.0 + */ + void ShowPauseIcon( TBool aPauseIconVisible ); + + /** + * Callback Function for periodic timer for blinking the pause indicator + * @see TCallBack + * @since 3.0 + */ + static TInt BlinkPauseIcon( TAny* aPtr ); + + /** + * Function which does the actual work of toggling pause indicator + * @since 3.0 + */ + void DoBlinkPauseIcon(); + protected: // New functions for cleanup + /** + * Function which frees the icons created by CreateIconsL(). + * @since 3.0 + */ + void FreeIcons(); + + protected: // New functions for wait-note processing + /** + * Launch wait note. + * @since 3.0 + * @param aResourceId Resource id for note text. + */ + void LaunchWaitNoteL( TInt aResourceId ); + + /** + * Dismiss wait dialog. + * @since 3.0 + */ + void DismissWaitNote(); + protected: // New functions for progress bar timer handling + + /** + * Start progress indicator timer. + * @since 3.0 + * @param aAfter Time period in microseconds after which the timer ticks. + */ + void StartProgIndTimer( TInt aAfter ); + + /** + * Stop the progress indicator timer. + * @since 3.0 + */ + void StopProgIndTimer(); + + protected: // New functions for handling animation controls + // play/pause/stop + /** + * This function is called to perform the necessary procesing for + * the Play Command. + * @since 3.0 + */ + void ProcessPlayCmd(); + + /** + * This function is called to perform the necessary procesing for + * the Pause Command. + * @since 3.0 + */ + void ProcessPauseCmd(); + + /** + * This function is called to perform the necessary procesing for + * the Stop Command. + * @since 3.0 + */ + void ProcessStopCmd(); + + private: // Functions for voice call check + /** + * This function checks whether a voice call is in progress + * and in connected state. + * @return TBool - ETrue - If voice call is in connected state + * EFalse Otherwise. + * @since 3.0 + */ + TBool IsVoiceCallActive(); + + private: // New Function for Note remover timer + /** + * Callback Function for timer for removing the note that is not + * removed in the UI. + * @see TCallBack + * @since 3.0 + */ + static TInt RemoveInfoNote( TAny* aPtr ); + + private: // New Functions for rotation + /** + * This function rotates the presentation with given angle + * about bitmap center. + * @param aAngle in Degrees + */ + void DoRotation(const TInt aAngle); + + private: // New Functions for Text Editing/Selection +#ifdef SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE + /** + * This function displays the existing text in the text/textArea + * in a read-only dialog so that the user can copy text from it to + * the system clipboard. + * @param aText Text content Descriptor + */ + void DoTextSelectionL( TDes& aText ) const; + + /** + * This function displays the existing text in the text/textArea + * element which is editable and returns the modified text in the + * same descriptor. + * @param aIsTextElement Bool indicating whether elem is text/textArea + * @param aElemHandle TInt Handle for the elem from engine + * @param aText Text content Descriptor modified on return + */ + void DoTextEditingL( TBool aIsTextElement, TInt aElemHandle, + TDes& aText ); +#endif // SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE + private: // New functions for Four Point Rects + /** + * This function calculates the center of the 4-point rect + * @param aBBoxRect the Four point Rect whose center is to be found + * @return TPoint - Center coordinates + */ + TPoint FPRCenter( const MRect* aBBoxRect ) const; + + /** + * This function checks whether the FPR intersects with the rectangle + * @param aBBoxRect the Four point Rect + * @param aRect Rectangle with which intersection is to be found + * @return TBool - Whether Intersects(ETrue) or not. + */ + TBool FPRIntersects( const MRect* aBBoxRect, const TRect& aRect ) const; + + /** + * This function converts a four point rectangle to an array of points + * @param aBBoxRect the Four point Rect + * @param aArrayPtr Array of TPoints + */ + void FPR2PointArrayL( const MRect* aBBoxRect, + CArrayFix*& aArrayPtr ) const; + + protected: // Functions from base classes + /** + * From CCoeControl Draws the SVGT frame on the screen. + * @since 3.0 + * @param aRect Rectangle which needs to be redrawn. + */ + virtual void Draw( const TRect& aRect ) const; + + /** + * From CCoeControl Constructs the control from resource. + * @since 3.0 + * @param aReader Resource Reader with which to access the + * control's resource. + */ + virtual void ConstructFromResourceL( TResourceReader& aReader ); + + /** + * From CCoeControl Handles control resizing. + * @since 3.0 + */ + virtual void SizeChanged(); + + /** + * From MSvgAnimationListener Callback called by SVG + * engine when animation starts + * @since 3.0 + */ + TBool AnimationStarted( TBool aIsAnimationIndefinite ); + + /** + * From MSvgAnimationListener Callback called by SVG + * engine when animation ends. + * @since 3.0 + */ + TBool AnimationEnded(); + + /** + * From MSvgAnimationListener Callback called by SVG + * engine when animation is paused. + * @since 3.0 + */ + TBool AnimationPaused(); + + /** + * From MSVGTProgressBarListener. This function + * updates the progress bar in the navi pane. It is called + * back by the progress bar timer. + * @since 3.0 + */ + void UpdateProgressBar(); + + /** + * From MSVGTPointerInactivityListener. This function + * updates the display status for the pointer. It is called + * back by the Pointer Hide Timer after a period of + * inactivity. + * @since 3.0 + */ + void PointerInactivityTimeout(); +#ifdef SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE + /** + * From MSvgTextAreaListener. This callback is called to notify + * when a pointer enters a textbox element. + * @since 3.1 + * @see MSvgTextAreaListener + */ + virtual TBool TextAreaEntered( TInt aTextAreaHandle ); + + /** + * From MSvgTextAreaListener. This callback is called to notify + * when a pointer exits a textbox element. + * + * @since 3.1 + * @see MSvgTextAreaListener + */ + virtual TBool TextAreaExited( TInt aTextAreaHandle ); + + /** + * From MSvgTextAreaListener. This callback is called to notify + * the client that a link has been activated. + * + * @since 3.1 + * @see MSvgTextAreaListener + */ + virtual TBool TextAreaActivated( TInt aTextAreaHandle ); + + /** + * From MSvgTextListener - Notified when a pointer enters a + * text element. + * + * @since 3.1 + * @see MSvgTextListener + */ + virtual TBool TextEntered( TInt aTextHandle ); + + /** + * From MSvgTextListener - Notified when a pointer exits a + * text element. + * + * @since 3.1 + * @see MSvgTextListener + */ + virtual TBool TextExited( TInt aTextHandle ); + + /** + * From MSvgTextListener - Notified when a pointer selects a + * text element. + * + * @since 3.1 + * @see MSvgTextListener + */ + virtual TBool TextActivated( TInt aTextHandle ); +#endif // SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE + + /** + * From MSvgInteractiveElementListener. This callback is called to notify + * the client that an interactive element has been entered. + * + * @since 3.2 + * @see MSvgInteractiveElementListener + */ + virtual TBool InteractiveElementEntered(TPtrC aElementIdPtr, TUint16 aInteractonTypeList ); + + /** + * From MSvgInteractiveElementListener - Notified when a pointer exits an + * interactive element. + * + * @since 3.2 + * @see MSvgInteractiveElementListener + */ + virtual TBool InteractiveElementExited(TPtrC aElementIdPtr); + + private: + + /** + * C++ default constructor. + * @param RFile File Handle - File handle of SVGT content + */ + CSVGTCustControl( RFile& aFileHandle , + TBool aProgressiveRendering, + TInt aDisplayFlag = + ESvgDisplayWaitNote| + ESvgDisplayErrorNotes| + ESvgDisplayIcons| + ESvgDrawPanIndicator| + ESvgDrawPointer| + ESvgDrawPauseIndicator| + ESvgDrawProgressBar| + ESvgUseBackLight ); + + /** + * Second Phase constructor. + * @param aAppObs Implementation Class provided by application that + * uses this control + * @param aPBDrawImpl Implementation for rendering progress Indicator + * @param aMSKImpl Implementation for drawing MSK label + */ + void ConstructL( MSvgtAppObserver* aAppObs, + MSVGTProgressBarDrawImpl* aPBDrawImpl, + MSVGTMSKImpl* aMSKImpl, + MSvgtApplicationExitObserver* aExitObserver, + const CCoeControl* aParent ); + private: // Data + // Stores the Application's implementation of the Callbacks. + MSvgtAppObserver* iAppObserver; + // Stores the Application's Exit callback implementation pointer + MSvgtApplicationExitObserver* iExitObserver; + // Bitmap used by SVG Engine to render content. + CFbsBitmap* iSVGTBitMap; + + // Mask for the bitmap. + CFbsBitmap* iSVGTBitMapMask; + + // Icons + // Pointer Icons - owned + CGulIcon* iPointerIcon; + CGulIcon* iHandIcon; + CGulIcon* iTextIcon; + + // Panning Indicator Icons - owned + CGulIcon* iPanIndLeftIcon; + CGulIcon* iPanIndRightIcon; + CGulIcon* iPanIndUpIcon; + CGulIcon* iPanIndDownIcon; + + // Pause Indicator Icons - owned + CGulIcon* iPauseIcon; + + // SVG Engine Interface Implementation pointer + CSvgEngineInterfaceImpl* iSvgModule; + + // Stores the total number of animation in content. + TInt32 iTotalNumerOfAnimation; + + // Stores the current animation status. + TSvgtAnimStatus iAnimationStatus; + + // Stores the viewer animation state. + TSvgtViewerAnimStatus iAnimState; + + // SVGT content filehandle + RFile& iContentFileHandle; + + // Boolean to keep track of whether the loading of content is done. + TBool iIsLoadingDone; + + // Integer variable which stores the FetchImage error + TInt iFetchImageError; + + // Zoom Level is the number of times content has been zoomed-in. + TInt iZoomLevel; + + // Boolean indicating whether Loop Mode is enabled. + TBool iIsLoopOn; + + // Boolean indicating whether Full Screen mode is enabled. + TBool iIsFullScreenOn; + + // Pointer State Variable - Delta Change in X in pixels. + TInt iPointerDx; + + // Pointer State Variable - Delta Change in Y in pixels. + TInt iPointerDy; + + // Pointer State Variable - Current X pixel coordinate. + TInt iPointerX; + + // Pointer State Variable - Current Y pixel coordinate. + TInt iPointerY; + + // Last Searched Text for use with Find Text + TBuf iLastSearchText; + + // Array to store the Bounding boxes for found text + RPointerArray iBoundBoxArray; + + // Array to store the text found + RArray iFoundTextArray; + + // Array to store the text element ids found - for use in animation case. + RArray iTextElemIdArray; + + // Bool that keeps track whether current search string(iLastSearchText) + // is valid + TBool iIsSearchStrValid; + + // Current Match Index + TInt iCurSearchMatchId; + + //Flag to check whether the svg file has only Preview rights + TBool iPreviewMode; + + // Number of animations in progress (whose repeatCount != Infinite) + TInt iNumAnimInProgress; + + // Progress Indicator Timer + CSVGTProgressBarTimer* iProgressBarTimer; + + // Duration of SVG Content + TUint iDuration; + + // Interface for Progress Bar Draw Implementation + MSVGTProgressBarDrawImpl* iProgressBarDrawImpl; + + //Interface for MSK label implementation + MSVGTMSKImpl* iMSKImpl; + + // Pointer Hide Timer + CSVGTPointerHideTimer* iInactivityTimer; + + // Bool that keeps track whether pointer should be drawn or not. + TBool iIsPointerDisplayed; + + // Timer for blinking pause icon + CPeriodic* iBlinker; + + // Bool that keeps track whether paused icon is drawn or not. + TBool iPauseIconVisible; + + + // Number of continous key presses since last key down + TInt iKeyRepeatCount; + // Main Viewer Pane Layout + TAknLayoutRect iViewerPaneRect; + // Layout Rectangles for Pan Indicators + TAknLayoutRect iPanIndLeftRect; + TAknLayoutRect iPanIndRightRect; + TAknLayoutRect iPanIndUpRect; + TAknLayoutRect iPanIndDownRect; + TAknLayoutRect iPauseRect; + + // Layout Touch Area Rectangles of Pan Indicators + TAknLayoutRect iPanIndLeftAidRect; + TAknLayoutRect iPanIndRightAidRect; + TAknLayoutRect iPanIndUpAidRect; + TAknLayoutRect iPanIndDownAidRect; + + // Layout Rectangle for Pointer + TAknLayoutRect iPointerRect; + TAknLayoutRect iHandRect; + TAknLayoutRect iTextRect; + + // Layout Rectangle for aid of placement of pointer + TAknLayoutRect iPointerAidRect; + TAknLayoutRect iHandAidRect; + TAknLayoutRect iTextAidRect; + + // Framebuffer Bitmap + CFbsBitmap* iSVGTFrameBufBitMap; + + // Bitmap Device + CFbsBitmapDevice* iSVGTFrameBufDevice; + + // Bitmap Context + CFbsBitGc* iSVGTFrameBufContext; + + // Current Layout - To check whether layout changed in SizeChanged() + TRect iCurrentLayout; + + // Find Text Highlight Colour + TRgb iFindTextHiColor; + + // Number of microseconds elapsed since content started. + TUint iProgIndTimeElap; + + // Number of milliseconds elapsed since last progress indicator update + TUint iProgIndResidueTime; + + // Last update of progress indicator tick in millisec + TUint iProgIndLastTickTime; + // Wait note dialog pointer + CAknWaitDialog* iWaitDialog; + + // DrmHelper to display save related query + CSVGTDrmHelper* iSvgDrmHelper; + + // To get the type and the state of the phone call + RProperty iSystemState; + + // Used to keep track of whether key events are ignored + // when pointer is unhidden + TBool iIgnorePointerKeyEvent; + + // Information Note for displaying the "text not found" note + CAknInformationNote* iInfoNote; + + // Timer for removing the "text not found" wait note + CPeriodic* iNoteRemoverTimer; + + // Indicates what type of pointer is to be drawn + TSvgtViewerPointerTypes iPointerType; + + // Enable/Disable Control for text operations(Editing/selection) + TBool iEnableTextOps; + + // Boolean indicating whether text edit menu is to be displayed + TBool iIsTextEditOn; + + // Boolean indicating whether text select menu is to be displayed + TBool iIsTextSelectOn; + + // Text (text/textArea) element currently under the cursor + TInt iCurrentTextElementId; + + // Boolean indicating whether current element is text(ETrue) or + // a textArea (EFalse) element + TBool iIsCurrentTextElement; + + TBool iProgressiveRendering; + TInt iDisplayFlags; + + CSvgtEventHandlerAO* iEventHandlerAO; + CSvgtThreadController* iThreadController; + RThread iMainThread; + MSvgError* iLoadingThreadError; + TFileType iImageFileType; + TTime iPreviousBackLightTimeStamp; + TBool iIsThreadRunning; + TBool iIsWaitNoteDisplayed; +//TOUCH SUPPORT START +#ifdef RD_SVGT_AUDIO_SUPPORT + CAknVolumePopup* iVolumePopup; + TInt iPrevVolume; + TInt iVolumeLevel; + + CRemConCoreApiTarget* iInterfaceSelector; + CRemConInterfaceSelector* iSelector; +#endif //RD_SVGT_AUDIO_SUPPORT +//TOUCH SUPPORT END + // The cause for select operation - Hyperlink/text/textArea activate + TSvgCustomControlSelectCause iSelectCause; + // Boolean indicating whether the cursor is inside a textArea element + TBool iTextAreaEntered; + + // Boolean indicating whether text is modified in content + // since last save + TBool iIsTextChanged; + // Booleans that are updated every time a frame is rendered + // in order to avoid overhead of calling IsPanPossibleFourWay + // API all the time. + // Pan Left Possible + TBool iPanLt; + // Pan Right Possible + TBool iPanRt; + // Pan Up Possible + TBool iPanUp; + // Pan Down Possible + TBool iPanDn; + + //Bool that checks whether the select key is pressed for options or a normal seletion + TBool iViewerCommand; + + //Flag to check whether play msk is visible + TBool iPlayMSKLabel; + + //Flag that indicates MSK is not visible + TBool iContextMenuActivated; + + // Flag to indicate whether the element is "a" element or not + TBool iAElement; + + //Flag to check whether scrolling is done when the pointer is hidden + TBool iScrollKey; + + + //Flag to indicate that pointer-down animation is possible with the element + TBool iPointerDownAnimation; + + // Count maintained to get a list of interactive elements entered + TInt iInteractiveElementEnteredCnt; +#ifdef _DEBUG + TInt iDbgNumAnimStarted; + TInt iDbgNumAnimStopped; + TInt iDbgNumAnimPaused; +#endif + + TBool iEngineInitialized; + + TBool iDownKeyOccurred; + + //indicates if volume is currently muted or not + TBool iIsVolumeMuted; + TBool iIsForeground; + + //AudioListener to indicate to UIdialog that volume is muted + MSvgAudioMuteListener* iAudioMuteListener; + }; + +#endif // __SVGTCUSTCONTROL_H__ + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTCustControl.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTCustControl.rh Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2004,2005 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: Resource Header for SVGT Custom Control Structure +* +*/ + + +#ifndef SVGTCUSTCONTROL_RH +#define SVGTCUSTCONTROL_RH +// INCLUDES + +// MACROS + +// STRUCTURE DEFINITIONS + +// ----------------------------------------------------------------------------- +// SVGT_CUST_CONTROL +// Defines the resource structure for SVGT Custom Control. +// ----------------------------------------------------------------------------- +// + +STRUCT SVGT_CUST_CONTROL + { + } +#endif // SVGTCUSTCONTROL_RH + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTPointerHideTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTPointerHideTimer.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2004, 2005 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: This header defines the CSVGTPointerHideTimer Class +* +*/ + +#ifndef SVGTPOINTERHIDETIMER_H +#define SVGTPOINTERHIDETIMER_H + +// Includes +#if !defined(__E32BASE_H__) +#include +#endif + +/** +* Interface for the pointer inactivity event listener. +* @lib SVGTUIControl.lib +* @since 3.0 +*/ + +class MSVGTPointerInactivityListener + { + public: + + /** + * This function is called when the pointer inactivity occurs. + * @since 3.0 + */ + virtual void PointerInactivityTimeout( ) = 0; + }; + +/** +* Provides the timer functionality for hiding the pointer after period of +* inactivity +* @lib SVGTUIControl.lib +* @since 3.0 +*/ + +class CSVGTPointerHideTimer : public CTimer + { + public: // Constructors and Destructor + /** + * Two-phased constructor. + */ + static CSVGTPointerHideTimer* NewLC( MSVGTPointerInactivityListener* + aListener ); + + /** + * Two-phased constructor. + */ + static CSVGTPointerHideTimer* NewL( MSVGTPointerInactivityListener* + aListener ); + + // Destructor + virtual ~CSVGTPointerHideTimer(); + + public: // New functions + + public: // Functions from base classes + + /** + * From CActive Implements cancellation of an outstanding request. + * @since 3.0 + */ + void DoCancel(); + + /** + * From CActive Handles the timer's request completion event. + * @since 3.0 + */ + void RunL(); + + protected: // New functions + protected: // Functions from base classes + + private: + /** + * C++ default constructor. + */ + CSVGTPointerHideTimer( MSVGTPointerInactivityListener* + aListener ); + + /** + * Second Phase constructor. + */ + void ConstructL(); + + private: // Data + MSVGTPointerInactivityListener *iInactivityListener; + }; +#endif // __SVGTBACKLIGHTTIMER_H__ + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTProgressBarTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTProgressBarTimer.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2004,2005 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: This header defines the CSVGTProgressBarTimer Class +* +*/ + +#ifndef __SVGTPROGRESSBARTIMER_H__ +#define __SVGTPROGRESSBARTIMER_H__ + +// Includes +#if !defined(__E32BASE_H__) +#include +#endif + + +/** +* Interface for the progress timer event listener. +* @lib SVGTUIControl.lib +* @since 3.0 +*/ + +class MSVGTProgressBarListener + { + public: + + /** + * This function is called when the progress timer event occurs. The + * user of this interface will be notified after the amount of time elapsed + * configured in KSccProgressBarTimerYieldDur. + * @since 3.0 + */ + virtual void UpdateProgressBar( ) = 0; + }; + +/** +* Provides the timer functionality for progress time display for the +* dialog. +* @lib SVGTUIControl.lib +* @since 3.0 +*/ + +class CSVGTProgressBarTimer : public CTimer + { + public: // Constructors and Destructor + /** + * Two-phased constructor. + */ + static CSVGTProgressBarTimer* NewLC( MSVGTProgressBarListener* + aListener , + TBool aResetInactivityTime ); + + /** + * Two-phased constructor. + */ + static CSVGTProgressBarTimer* NewL( MSVGTProgressBarListener* + aListener, + TBool aResetInactivityTime ); + + // Destructor + virtual ~CSVGTProgressBarTimer(); + + public: // New functions + public: // Functions from base classes + + /** + * From CActive Implements cancellation of an outstanding request. + * @since 3.0 + */ + void DoCancel(); + + /** + * From CActive Handles the timer's request completion event. + * @since 3.0 + */ + void RunL(); + + protected: // New functions + protected: // Functions from base classes + + private: + /** + * C++ default constructor. + */ + CSVGTProgressBarTimer( MSVGTProgressBarListener* + aListener , TBool aResetInactivityTime ); + + /** + * Second Phase constructor. + */ + void ConstructL(); + + private: // Data + + // Listener for progress bar timer event + MSVGTProgressBarListener* iListener; + + // Reset Inactivity time + TBool iUseInactivityTime; + }; +#endif // __SVGTPROGRESSBARTIMER_H__ + +// End of File + diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTThumbnailUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTThumbnailUtil.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 2004,2005 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: SVGT Thumbnail Utility Class implements the thumbnail +* used to display SVGT content. +* +*/ + + + +#ifndef __SVGTTHUMBNAILUTIL_H__ +#define __SVGTTHUMBNAILUTIL_H__ + +// INCLUDES + +#include + + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class CSvgEngineInterfaceImpl; +class CFbsBitmap; +// CLASS DECLARATION + +/** +* CSVGTThumbnailUtil is a utility class used to generate thumbnails. +* It is used through dialog provided by CSVGTUIDialog. +* +* @lib SVGTUIControl.lib +* @since 3.0 +*/ + +class CSVGTThumbnailUtil : public CBase, + public MSvgRequestObserver + { + public: // Constructors and destructor + /** + * Generate thumbnails for SVGT content. + * @since 3.0 + * @param aFileHandle File Handle to the SVGT file. + * @param aThumbnailBitmap Bitmap - Client provided bitmap to render + * the SVGT contents opening screen. + * @param aThumbnailBitmap Bitmap - Client provided bitmap mask. + * @return Boolean ETrue indicates thumbnail generated successfully, + * EFalse otherwise. + */ + IMPORT_C static TBool GenerateThumbnailLD( RFile& aFileHandle, + CFbsBitmap& aThumbnailBitmap, + CFbsBitmap& aThumbnailBitmapMask ); + + public: // New functions + + public: // Functions from base classes + + + /** + * This function is called to initialize the SVGT-Engine interface. + * @since 3.0 + */ + void InitializeEngineL(); + + /** + * Generates Thumbnail of initial screen of SVG content. + * @since 3.0 + * @return Boolean ETrue indicates thumbnail generated successfully, + * EFalse otherwise. + */ + + TBool GenerateThumbnail(); + + + protected: // Functions from base classes + + /** + * From MSvgRequestObserver Method called by SVG Engine + * after it has rendered a frame. + * @since 3.0 + */ + void UpdateScreen(); + + /** + * From MSvgRequestObserver This method is for future extension, + * in which an external script engine could be used to evaluate + * a script description. + * @since 3.0 + * @param aScript Descriptor containing script + * @param aCallerElement SVG Element that calls the script by a + * an event of the "on" attribute. + * @return TBool. + */ + TBool ScriptCall( const TDesC& aScript, + CSvgElementImpl* aCallerElement ); + + /** + * From MSvgRequestObserver This method is called by the SVG engine + * to retrieve the absolute path of the image file. + * @since 3.0 + * @param aUri Descriptor containing the relative path of the image. + * @param aFilePath Descriptor which contains absolute path that is + * to be used by the Engine to retrieve the image. + * @return TBool - + * ETrue indicates absolute path is present in aFilePath. + * EFalse otherwise. + */ + TInt FetchImage( const TDesC& aUri, + RFs& aSession, RFile& aFileHandle ) ; + + TInt FetchFont( const TDesC& /* aUri */, + RFs& /* aSession */, RFile& /* aFileHandle */ ); + + /** + * From MSvgRequestObserver This method is called by the SVG engine + * to get the SMIL Fit attribute value. + * @since 3.0 + * @param aSmilValue Descriptor containing the SMIL Fit attribute. + */ + void GetSmilFitValue( TDes& aSmilValue ); + + /** + * From MSvgRequestObserver This method is called by the SVG engine + * to update the presentation status. + * @since 3.0 + * @param aNoOfAnimation Integer. When called for the first time + * it indicates total number of animations. + * Subsequently it contains number of animations that were completed. + */ + void UpdatePresentation( const TInt32& aNoOfAnimation ); + private: + + /** + * C++ default constructor. + */ + CSVGTThumbnailUtil( RFile& aFileHandle ); + + /** + * Second Phase constructor. + * @param aThumbnailBitmap Client provided bitmap to render the SVGT + * contents opening screen. + * @param aThumbnailBitmapMask Bitmap - Client provided bitmap for SVGT + * bitmap mask. + */ + void ConstructL( CFbsBitmap& aThumbnailBitmap, + CFbsBitmap& aThumbnailBitmapMask ); + + /** + * Two-phased constructor for thumbnail creation. + * @since 3.0 + * @param aFileHandle file handle to the SVGT file. + * @param aThumbnailBitmap Bitmap - Client provided bitmap to render + * the SVGT contents opening screen. + * @param aThumbnailBitmapMask Bitmap - Client provided bitmap for SVGT + * bitmap mask. + * @return CSVGTThumbnailUtil* + */ + + static CSVGTThumbnailUtil* NewL( RFile& aFileHandle, + CFbsBitmap& aThumbnailBitmap, + CFbsBitmap& aThumbnailBitmapMask ); + + /** + * Two-phased constructor for thumbnail creation that pushes the + * object on the cleanup stack. + * @since 3.0 + * @param aFileHandle file handle to the SVGT file. + * @param aThumbnailBitmap Client provided bitmap to render the SVGT + * contents opening screen. + * @param aThumbnailBitmapMask Bitmap - Client provided bitmap for SVGT + * bitmap mask. + * @return CSVGTThumbnailUtil* + */ + + static CSVGTThumbnailUtil* NewLC( RFile& aFileHandle, + CFbsBitmap& aThumbnailBitmap, + CFbsBitmap& aThumbnailBitmapMask ); + /** + * Destructor. + */ + + virtual ~CSVGTThumbnailUtil(); + + private: // Data + // Dummy Bitmap used by SVG Engine to render content. + CFbsBitmap* iSVGTBitMapDummy; + + // SVG Engine Interface Implementation pointer + CSvgEngineInterfaceImpl* iSvgModule; + + // Thumbnail bitmap used by SVG Engine to render content. + CFbsBitmap* iThumbnailBitmap; + + // Thumbnail bitmap mask used by SVG Engine to render content mask. + CFbsBitmap* iThumbnailBitmapMask; + + // SVG Thumbnail Handle + TInt iThumbnailHandle; + + // SVGT content filename descriptor + RFile& iContentFileHandle; + }; + +#endif // __SVGTTHUMBNAILUTIL_H__ + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTUIControlDbgFlags.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTUIControlDbgFlags.hrh Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2004,2005 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: This header file enlists the debug flags in use by the SVGT +* UI Control. +* +*/ + +#ifndef SVGTUICONTROLDBGFLAGS_HRH +#define SVGTUICONTROLDBGFLAGS_HRH +// $Flagname +// Purpose: +// Target Value: + +// SVGTUICONTROL_DBG_LOADING_WAITNOTE_ENABLED +// Purpose: If defined, this flag enables the display of waitnote while +// loading svg content. +// Target Value: Defined +#define SVGTUICONTROL_DBG_LOADING_WAITNOTE_ENABLED + +// SVGTUICONTROL_DBG_DRM_THUMBNAIL_API_ENABLE +// Purpose: If defined, this flag enables the portion of the code where the +// DRM Thumbnail API is set. +// Target Value: defined +#define SVGTUICONTROL_DBG_DRM_THUMBNAIL_API_ENABLE + +// SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE +// Purpose: If defined, this flag enables the portion of the code where the +// DRM Thumbnail API is set. +// Target Value: defined +#define SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE + +// SVGTUICONTROL_DBG_OPENVG_TESTING_ENABLE +// Purpose: If defined, this flag enables the use of OpenVG in the SVG Engine +// Target Value: undefined +#undef SVGTUICONTROL_DBG_OPENVG_TESTING_ENABLE + +#endif // SVGTUICONTROLDBGFLAGS_HRH +// End of File + diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTUIDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTUIDialog.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,337 @@ +/* +* Copyright (c) 2004,2005 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: SVGT UI Dialog implements a custom dialog used to display +* SVGT content. +* +*/ + + +#ifndef __SVGTUIDIALOG_H__ +#define __SVGTUIDIALOG_H__ +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CSVGTCustControl; +class MSvgtAppObserver; +class MSVGTProgressBarDrawImpl; +class TCoeHelpContext; + +/** +* Provides the dialog functionality for viewing SVGT files. +* @lib SVGTUIControl.lib +* @since 3.0 +*/ + +class CSVGTUIDialog : public CAknDialog, + public MSVGTProgressBarDrawImpl, + public MSVGTMSKImpl, //Added since 3.2 interface for MSK label impl + public MSvgtApplicationExitObserver, + public MSvgAudioMuteListener, + public MCustControlPointerEventHandler + { + public: // Constructors and destructor + /** + * Two-phased constructor. + */ + IMPORT_C static CSVGTUIDialog* NewL(); + + /** + * Two-phased constructor. + */ + IMPORT_C static CSVGTUIDialog* NewLC(); + + + + // Destructor + virtual ~CSVGTUIDialog(); + public: // New functions + public: // Functions from base classes + /** + * From CAknDialog Executes the dialog and deletes the dialog on exit. + * @since 3.0 + * @param aFileHandle File handle to the SVGT content. + * @param aAppObs Implementation Class provided by application that + * uses this dialog + * Note: The ownership of the file handle is not transferred. + * It is the responsibility of the caller to close this file + * after deleting this dialog. + * @return Integer - Indicates Exit Reason. + */ + virtual TInt ExecuteLD( RFile& aFileHandle, + MSvgtAppObserver *ptr ); + + /** + * From CAknDialog - Called by framework to process commands invoked by + * the user. + */ + virtual void ProcessCommandL( TInt aCommandId ); + + public: //From MSvgtApplicationExitObserver + void HandleApplicationExitL( TInt aExitCommand ); + IMPORT_C void AssignImageData( const TDesC& aUri, HBufC8* aData ); + + public:// From MSvgAudioMuteListener + /** + * This method is to remove the muted icon + * @since 5.0 + * @param aIsVolumeMuted: indicates if volume is to be muted + * @return none. + */ + void VolumeMuted(TBool aIsVolumeMuted); + public: + + + /** + * This function is called by the application to check whether the + * loading of the svg content is done. + * @since 3.0 + * @return TBool iIsLoadingDone + */ + virtual TBool IsLoadingDone(); + /** + * Function used by the application to handle background/foreground + * events. When the application goes to background the presentation + * needs to be paused. When application comes back to foreground, + * the user would need to start the paused presentation. + * @param aForeground: ETrue: Foreground event, + * EFalse: Background event. + * @since 3.0 + */ + virtual void HandleApplicationForegroundEvent( TBool aForeground ); + + /** + * Function used by the client to indicate the filehandle is + * no longer going to be valid. e.g. In Move operation of the + * file, client could close old file and open new one after + * move is over. + * @since 3.0 + */ + virtual void StopUsingContentFileHandle(); + /** + * Function used by the client to indicate the filehandle is + * going to be valid now. e.g. In Move operation of the + * file, client could close old file and open new one after + * move is over. + * @since 3.0 + */ + virtual void StartUsingContentFileHandle(); + + /** + * Function used by the client to check if text in the content + * was modified, to check if save is needed. + * @since 3.1 + */ + virtual TBool IsTextContentChanged(); + + /** + * Function used by the client to save the modified svg content + * @since 3.1 + */ + virtual TInt SaveSvgDom( const TDesC& aFileName ); + + /** + * Function used by the client to notify dialog that save is complete + * @since 3.1 + */ + virtual void SaveComplete( TInt aError ); + + protected: // New functions + /** + * Convert a time given in milliseconds to a descriptor. + * The format depends on how big the given duration is. + * Durations of less than an hour are formatted using + * the short format (02:24). Longer durations are formatted + * using the long format (1:02:04). Maximum duration is 10 hours. + * + * @since 3.0 + * @param aDuration duration in seconds + * @param aBuf descriptor to hold the converted string + * + */ + void FormatTimeL( const TUint& aDuration, + TDes& aBuf ) const; + + /** + * This function is called when the user presses back or Exit. + * prompts a confirmation query to the user and then calls DoSaveL + * @param aButtonId + * @since 3.0 + */ + TBool SaveNeededL( TInt aButtonId ); + + /** + * This function prompts a save confirmation query to the user + * @since 3.0 + */ + TBool LaunchSaveQueryDialogL() const; + + /** + * This function changes the layout of the dialog to full screen mode + * @since 3.0 + */ + void SwitchDialogLayoutL( TBool aIsFullScreen ); + + protected: // Functions from base classes + // From CEikDialog + // From CAknDialog + + /** + * From CAknDialog - Called by framework to dynamically manipulate + * the menu for the dialog. + */ + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + /** + * From CAknDialog - Framework method to determine if it OK + * to exit the dialog. + */ + TBool OkToExitL( TInt aButtonId ); + + /** + * From CAknDialog - Called by framework to add custom control to the + * dialog when specified in resource. + */ + SEikControlInfo CreateCustomControlL( TInt aControlType ); + + /** + * From CAknDialog - Called by framework to notify resize of dialog. + */ + void SizeChanged(); + + /** + * From CCoeControl Key Handling Method for control. + * @since 3.0 + * @param aKeyEvent Key Event. + * @param aType Type of Key Event. + * @return TKeyResponse - EKeyWasConsumed/EKeyWasNotConsumed. + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + +#ifdef __SERIES60_HELP + /** + * From CCoeControl Context Sensitive Help ID retrieving function. + * @since 3.0 + * @see CCoeControl + */ + void GetHelpContext( TCoeHelpContext& aContext ) const; +#endif + /** + * From CCoeControl + * @see CCoeControl::HandleResourceChange + */ + void HandleResourceChange( TInt aType ); + + /** + * From MSVGTProgressBarDrawImpl. This function is called in + * order to render the progress indicator. + * @since 3.0 + * @param aTimeElapsed - Contains the time elapsed in seconds. + * @param aTotalTime - Contains the total time in seconds + */ + void DrawProgressBarL( TUint aTimeElapsed, TUint aTotalTime ); + + /** + * Sets the mute icon & text to the navi pane . + * @since 3.2 + * @param aIsVolumeMuted whether to show the the mute icon. + * @param aText The text show the progress info. + */ + void SetNaviPaneInfoL(TBool aIsVolumeMuted, const TDesC& aText); + + private: + + static TInt ButtonContainerTimerCallBack(TAny* aAny); + virtual TBool HandleCustControlPointerEventL(const TPointerEvent& aPointerEvent); + + /** + * From MSVGTMSKImpl. This function is called to draw the MSK label by + * pushing the command to position button's stack. + * @since 3.2 + * @param aResourceID - The MSK label resourceID + * @param aCommandID - The command associated with that label + */ + void DrawMSKLabelL(TInt aResourceID,TInt aCommandID); + + /** + * From MSVGTMSKImpl. This function is called to remove MSK label from + * button group's stack + * @since 3.2 + */ + void RemoveMSKLabel(); + + /** + * C++ default constructor. + */ + CSVGTUIDialog(); + + /** + * Second Phase constructor. + */ + void ConstructL(); + + private: // Data + CPeriodic* iBtnCntrTimer; + + TBool iIsButtonContainerVisible; + + TSize iBtnGrpSize; + TPoint iBtnGrpPos; + // Descriptor that contains the path to the SVGT file. + RFile* iFileHandlePtr; + + // Is the Content file handle valid. + TBool iIsFileHandleValid; + + // Integer storing resource offset to DLL resource file + TInt iResourceOffset; + + // Pointer to Custom CCoeControl. + CSVGTCustControl *iCustControl; + + // Pointer to application implementation of callbacks. + MSvgtAppObserver *iAppObserver; + + // Boolean Indicating whether Save functionality is required. + TBool iSaveEnable; + + // Boolean to store whether the content is preview or not + TBool iPreview; + + // Navigation Pane - for progress indicator display + CAknNavigationDecorator* iNaviDecorator; + // Application Title Text + HBufC* iAppTitleText; + + // Short Time format - initialised from resource + HBufC* iTimeFormatShort; + + // Long Time format string - initialised from resource + HBufC* iTimeFormatLong; + //Button group container - for MSK label updation + CEikButtonGroupContainer* iCbaGroup; + + HBufC* iProgressText; + + TBool iIsVolumeMuted; + + TInt iLastCommandID; + TBool iQuietExitWhenOrientationChange; + }; + +#endif // __SVGTUIDIALOG_H__ +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTUIDialog.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTUIDialog.hrh Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2004,2005 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: Resource Header for SVGT Dialog. +* +*/ + +#ifndef SVGTUIDIALOG_HRH +#define SVGTUIDIALOG_HRH + + +// DATA TYPES + +enum TSVGTNotes // UI Note type enumerations + { + ESvgtWaitNote = 1 + }; + +enum TSVGTUIDialogIds // SVGTUIDialog enumerate command codes + { + ESvgtDlgCommand1 = 0x6000, // start value must not be 0 + ESvgtDlgSaveCommand, + ESvgtDlgZoomInCommand, + ESvgtDlgZoomOutCommand, + ESvgtDlgSelectTextCommand, + ESvgtDlgEditTextCommand, + ESvgtDlgPlayCommand, + ESvgtDlgPauseCommand, + ESvgtDlgStopCommand, + ESvgtDlgLoopCascadeCommand, +//Audio commands +#ifdef RD_SVGT_AUDIO_SUPPORT + ESvgtDlgSetVolumeCommand, + ESvgtDlgMuteCommand, + ESvgtDlgUnmuteCommand, +#endif //RD_SVGT_AUDIO_SUPPORT +//end + ESvgtDlgLoopOnCommand, + ESvgtDlgLoopOffCommand, + ESvgtDlgFindTextCommand, + ESvgtDlgFullScreenCommand, + ESvgtDlgNormalScreenCommand, + ESvgtDlgViewDetailsCommand, + ESvgtDlgListDownloadCommand, + ESvgtDlgListRotateCascadeCommand, + ESvgtDlgAngle90, + ESvgtDlgAngle180, + ESvgtDlgAngle270, + ESvgtDlgAngle360, + ESvgtDlgHelpCommand, + ESvgtDlgZoomOptimalCommand + }; + +enum {ESVGTDialogCustControlIdData = 1}; +enum {ESVGTCustControl = 1000}; + +enum TSVGTStandardRotationAngles + { + ERotationAngle45 = 45, + ERotationAngle90 = 90, + ERotationAngle180 = 180, + ERotationAngle270 = 270 + }; + +enum TSVGTNumericKeys + { + ENumberKey0 = 48, + ENumberKey1, + ENumberKey2, + ENumberKey3, + ENumberKey4, + ENumberKey5, + ENumberKey6, + ENumberKey7, + ENumberKey8, + ENumberKey9 + }; + +#endif // SVGTUIDIALOG_HRH + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTViewerAppDbgFlags.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTViewerAppDbgFlags.hrh Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2004,2005 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: This header file enlists the Debug flags in use for the SVGT +* viewer +* +*/ + +#ifndef SVGTVIEWERAPPDBGFLAGS_HRH +#define SVGTVIEWERAPPDBGFLAGS_HRH +// $Flagname +// Purpose: +// Target Value: + + +// SVGTVIEWERAPP_DBG_OPEN_HARDCODE_FILE +// Purpose: If defined, this flag enables opening of a hardcoded file content +// for testing from Application Grid. +// Target Value: Undefined +#undef SVGTVIEWERAPP_DBG_OPEN_HARDCODE_FILE + +// SVGTVIEWERAPP_DOWNLOADMGR_ENABLED +// Purpose: If defined, this flag enables the download manager functionality +// for fetching remote images +// Target Value: defined +#define SVGTVIEWERAPP_DOWNLOADMGR_ENABLED + +// SVGTVIEWERAPP_SAVE_TESTING +// Purpose: If defined, this flag enables the save option to be enabled +// in filemanager and doctest +// Target Value: undefined +#undef SVGTVIEWERAPP_SAVE_TESTING + +// SVGTVIEWERAPP_DBG_FLAG +// Purpose: If defined, this flag enables the save option to be enabled +// in filemanager and doctest +// Target Value: undefined +#undef SVGTVIEWERAPP_DBG_FLAG + +#endif // SVGTVIEWERAPPDBGFLAGS_HRH + +// End of file diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTViewerAppDownloads.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SVGTViewerAppDownloads.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,198 @@ +/* +* Copyright (c) 2004,2005 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: This class defines the downloads and the required attributes. +* +*/ + + + +#ifndef SVGTVIEWERAPPDOWNLOADS_H +#define SVGTVIEWERAPPDOWNLOADS_H + +// INCLUDES +#include //RHttpDownload +#include //CBase + + +// CLASS DECLARATION + +/** +* This class declares the Downloads and the associated attributes. +* +* @since 3.0 +*/ +class CSVGTViewerAppDownloads : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aLinkFlag Image flag to distinguish the Embeded & hyperlink. + */ + static CSVGTViewerAppDownloads* NewL( TBool aIsEmbedded, + TBool aIsSynchronous, + TBool aLinkFlag ); + + /** + * Two-phased constructor. + * @param aLinkFlag Image flag to distinguish the Embeded & hyperlink. + */ + static CSVGTViewerAppDownloads* NewLC( TBool aIsEmbedded, + TBool aIsSynchronous, TBool aLinkFlag ); + + + /** + * Destructor. + */ + virtual ~CSVGTViewerAppDownloads(); + + /** + * returns link offset. + */ + static TInt LinkOffset(); + + public: // New functions + + /** + * This Function returns the filename associated with the download + * @return FileName + */ + TFileName FileName() const; + + /** + * This Function returns the flag iEmbeddedMode + * associated with the download + * @return TBool + */ + TBool EmbeddedMode() const; + + /** + * This Function returns the flag iSynchronousMode + * associated with the download + * @return TBool + */ + TBool SynchronousMode() const; + + /** + * This Function returns the flag iDownloadCompleted + * associated with the download + * @return TBool + */ + TBool DownloadCompleted() const; + + /** + * This Function returns the Link in the doubly linked list + * associated with the download + * @return TBool + */ + TDblQueLink QueLink() const; + + /** + * This Function returns the download handle + * associated with the download + * @return RHttpDownload + */ + RHttpDownload* DownloadHandle(); + + /** + * This Function returns the Image Link flag status + * associated with the download + * @return TBool + */ + TBool ImageLinkFlag() const; + + /** + * This Function Sets the filename + * associated with the download + */ + void SetFileName( const TDesC& aFileName ); + + /** + * This Function Sets the flag EmbeddedMode + * associated with the download + */ + void SetEmbeddedMode( TBool aEmbeddedMode ); + + + /** + * This Function Sets the flag SynchronousMode + * associated with the download + */ + void SetSynchronousMode( TBool aSynchronousMode ); + + /** + * This Function Sets the flag iDownloadCompleted + * associated with the download + */ + void SetDownloadCompleted( TBool aDownloadCompleted ); + + /** + * This Function Sets the Download Handle + * associated with the download + */ + void SetDownloadHandle( RHttpDownload* aDownloadHandle ); + + /** + * This function sets the image link flag. + * @param aLinkFlag Image flag to distinguish the Embeded & hyperlink. + */ + void SetImageLinkFlag(TBool aLinkFlag); + + private: + + /** + * C++ default constructor. + */ + CSVGTViewerAppDownloads( + TBool aIsEmbedded, + TBool aIsSynchronous, + TBool aLinkFlag ); + + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + // Pointer to Download handle + RHttpDownload* iHttpDownload; + + // Downloaded fileName + TFileName iFileName; + + // Boolean variable to indicate whether the downloaded file + // has to be opened in embedded mode or independent mode. + TBool iEmbeddedMode; + + // Boolean variable to indicate whether the download + // has to be performed in a synchronous mode or asynchronous mode + TBool iSynchronousMode; + + // Flag to indicate successful download completion + TBool iDownloadCompleted; + + // Doubly linked list link + TDblQueLink iLink; + + //Image flag to distinguish the Embeded & hyperlink. + //EFalse for FetchImage + //ETrue for HyperLink. + TBool iImageLinkFlag; + }; + +#endif // SVGTVIEWERAPPDOWNLOADS_H + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SvgCodecImageConstants.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SvgCodecImageConstants.hrh Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2005 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: Image type UID for the SVG presentation. +* +*/ + + +#ifndef SVGCODECIMAGECONSTANTS_HRH +#define SVGCODECIMAGECONSTANTS_HRH + +const TUid KImageTypeSVGUid = { 0x102073E7 }; + +#endif //SVGCODECIMAGECONSTANTS_HRH +//End of file \ No newline at end of file diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/inc/SvgtApplicationExitObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/inc/SvgtApplicationExitObserver.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2009 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: +* +*/ + + +#ifndef SVGTAPPLICATIONEXITOBSERVER_H +#define SVGTAPPLICATIONEXITOBSERVER_H + +class MSvgtApplicationExitObserver + { + public: + virtual void HandleApplicationExitL(TInt aExitCommand) = 0; + }; + +#endif //SVGTAPPLICATIONEXITOBSERVER_H \ No newline at end of file diff -r e52958d06c29 -r 5fd161fa28b6 graphicsuis_plat/svgt_viewer_ui_api/svgt_viewer_ui_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsuis_plat/svgt_viewer_ui_api/svgt_viewer_ui_api.metaxml Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,18 @@ + + + SVG-T Viewer UI API + Provides SVG-T UI control and Dialog APIs. + c++ + domain + + + + + + + + + no + no + + diff -r e52958d06c29 -r 5fd161fa28b6 group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2006 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: Highlevel bld.inf +* +*/ + + +#include "../graphicsuis_plat/group/bld.inf" + + +/* +* Order is important +*/ +#include "../svgtviewer/group/bld.inf" + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES diff -r e52958d06c29 -r 5fd161fa28b6 layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,14 @@ + + +]> + + + + + + + + + + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppInc/SVGTViewerApp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppInc/SVGTViewerApp.hrh Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2004,2005 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: Resource Header for SVGT Viewer. +* +*/ + +#ifndef SVGTVIEWERAPP_HRH +#define SVGTVIEWERAPP_HRH + +// DATA TYPES +enum TSVGTViewerAppIds // SVGTViewerApp enumerate command codes + { + ESVGTViewerAppCommand1 = 1 // start value must not be 0 + }; + + +#endif // SVGTVIEWERAPP_HRH diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppInc/SVGTViewerApp.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppInc/SVGTViewerApp.pan Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2004,2005 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: Panic Function and Panic codes for SVGT Viewer +* +*/ + + +#ifndef __SVGTVIEWERAPP_PAN__ +#define __SVGTVIEWERAPP_PAN__ + +/** SVGTViewerApp application panic codes */ +enum TSVGTViewerAppPanics + { + ESVGTViewerAppUi = 1 + // add further panics here + }; + + _LIT( applicationName, "SVGTViewerApp" ); + +inline void Panic( TSVGTViewerAppPanics aReason ) + { + User::Panic( applicationName, aReason ); + } + +#endif // __SVGTVIEWERAPP_PAN__ + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppInc/SVGTViewerAppAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppInc/SVGTViewerAppAppUi.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,217 @@ +/* +* Copyright (c) 2004,2005 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: AppUI class for the SVGT Viewer. +* +*/ + + +#ifndef SVGTVIEWERAPPAPPUI_H +#define SVGTVIEWERAPPAPPUI_H + +#include +#include + +// FORWARD DECLARATIONS +class CAknAppUi; +class CSVGTViewerAppAppView; +class CSVGTUIDialog; +class CDownloadMgrUiUserInteractions; +class CDownloadMgrUiDownloadsList; +class CDownloadMgrUiLibRegistry; +class CSVGTViewerAppDownloads; +class CSVGTAppObserverUtil; + + +class CSvgtViewerAppView; +// CLASS DECLARATION + +/** +* CSVGTViewerAppAppUi is the AppUI class for the SVGT Viewer +* @since 3.0 +*/ +class CSVGTViewerAppAppUi : public CAknAppUi + { + public: // Constructors and destructor + /** + * C++ default constructor. + */ + CSVGTViewerAppAppUi(); + + /** + * Second Phase constructor. + */ + void ConstructL(); + + // Destructor + virtual ~CSVGTViewerAppAppUi(); + + public: // New functions + /** + * Handle open command from document class. + * @since 3.0 + * @param aFileHandle - File Fandle to the SVGT file. + */ + virtual void OpenFileL( RFile& aFileHandle ); + + /** + * This function is used to set the move option, the + * Move allowed or not decision is done by the document + * class and it calls this function to inform the UI class + * about the decision. + * @param: aMoveAllowed, ETrue: Move allowed, EFalse: + * Move Not allowed. + * @since 3.0 + */ + void SetAllowMove(TInt32 aMoveAllowed); + + public: // Functions from base classes + /** + * From CAknAppUi + * @see CAknAppUi::HandleCommandL + */ + virtual void HandleCommandL( TInt aCommand ); + + /** + * From CAknAppUi + * @see CAknAppUi::OpenFileL + */ + virtual void OpenFileL( const TDesC& aFilename ); + + /** + * From CAknAppUi + * @see CAknAppUi::ProcessCommandParametersL + */ + virtual TBool ProcessCommandParametersL(TApaCommand aCommand, + TFileName& aDocumentName, const TDesC8& aTail ); + + /** + * From CAknAppUi + * @see CAknAppUi::HandleScreenDeviceChangedL + */ + void HandleScreenDeviceChangedL(); + + /** + * From CAknAppUi + * @see CAknAppUi::HandleResourceChangeL + */ + void HandleResourceChangeL( TInt aType ); + private: + /** + * From CEikAppUi, called when event occurs of type EEventFocusLost + * or EEventFocusGained. + * @param aForeground ETrue if the application is in the foreground, + * otherwise EFalse + */ + void HandleForegroundEventL(TBool aForeground); + + /** + * Used to find out if video call is going on. + * @since 3.0 + */ + TBool IsVideoCall() const; + /** + * Used to check if the application has started any embedded app. + * @since 3.0 + * return: ETrue: If there is an embedded app, EFalse otherwise. + */ + TBool IsEmbeddedAppRunning() const; + /** + * Used to set internal state if the application has started + * any embedded app. + * @since 3.0 + */ + void SetEmbeddedAppRunning(); + /** + * Used to set internal state if the embedded app started + * previously gets closed. + * @since 3.0 + */ + void ResetEmbeddedAppRunning(); + + /** + * Used to callback by the idle timer in order to launch the dialog + * @since 3.0 + */ + static TInt CallBackFuncL(TAny *aPtr); + + /** + * This function accesses the document and launches the content + * using the UI Dialog. + * return: ETrue When file handle is not valid + * EFalse When file handle is valid + * @since 3.0 + */ + TBool LaunchDialogL(); + + /** + * This function is used to detect how we are launched. + * Embedded or Standalone. + * return: ETrue: Embedded mode, EFalse: Standalone mode. + * @since 3.0 + */ + TBool WeAreEmbedded() const; + + /** + * This function is used to decide if the "save" option + * should be shown in the UI. "Save" is shown if we + * are launched from messaging/mms/mail/browser. + * return: ETrue: Show save, EFalse: Do not show save. + * @since 3.0 + */ + TBool CanShowSave() const; + + /** + * This function is used to decide if the Save operation + * should actually do a move. This is required if we + * are launched from browser/downloadmgr and file + * needs to be moved instead of copying to save disk + * space. + * @since 3.0 + */ + TBool ShouldMoveContent() const; + + /** + * This function checks whether the file is local or remote + * @since 3.1 + */ + TBool IsLocalFile() const; + + /** + * This function checks whether the filepath of the content + * opened is in the PHONE_MEMORY_IMAGES_PATH or + * MEMORYCARD_IMAGES_PATH + * @param aFileHandle Filehandle to check the path + * @since 3.1 + */ + TBool IsLocalFileL( RFile& aFileHandle ) const; + + private: // Data + + CSvgtViewerAppView* iContainer; + + // Pointer to the SVGT Dialog + CSVGTUIDialog* iAppDialog; + + // Pointer to Hyperlink Handler + CSVGTAppObserverUtil* iAppObserver; + + TBool iEmbeddedAppRunning; + CPeriodic* iIdleTimer; + TBool iMoveAllowed; + }; + + +#endif // __SVGTVIEWERAPPAPPUI_H__ + +//End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppInc/SVGTViewerAppApplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppInc/SVGTViewerAppApplication.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2004,2005 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: This header file enlists the application class interface of +* the SVGT Viewer App +* +*/ + + + +#ifndef __SVGTVIEWERAPPAPPLICATION_H__ +#define __SVGTVIEWERAPPAPPLICATION_H__ + +// INCLUDES +#include + +// CLASS DECLARATION + +/** +* Application Class for SVGT Viewer. +* An instance of CSVGTViewerAppApplication is the Application object +* for the SVGTViewerApp application. +* @since 3.0 +*/ + +class CSVGTViewerAppApplication : public CAknApplication + { + public: // Functions from base classes + /** + * From CAknApplication Return the application DLL UID value. + * @since 3.0 + * @return TUid The UID of this Application/Dll + */ + TUid AppDllUid() const; + + protected: // Functions from base classes + /** + * From CAknApplication Create a CApaDocument object and return a + * pointer to it. + * @since 3.0 + * @return CApaDocument* - A pointer to the created document + */ + CApaDocument* CreateDocumentL(); + private: +}; +#endif // __SVGTVIEWERAPPAPPLICATION_H__ +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppInc/SVGTViewerAppDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppInc/SVGTViewerAppDocument.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2004,2005 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: This header file enlists the Document class interface of +* the SVGT Viewer App +* +*/ + + + +#ifndef __SVGTVIEWERAPPDOCUMENT_H__ +#define __SVGTVIEWERAPPDOCUMENT_H__ + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CSVGTViewerAppAppUi; +class CEikApplication; + +// CLASS DECLARATION + +/** +* Document Class for SVGT Viewer +* An instance of class CSVGTViewerAppDocument is the Document part of the +* SVGT Viewer. +* @since 3.0 +*/ +class CSVGTViewerAppDocument : public CAiwGenericParamConsumer + { + public: // Constructors and destructor + /** + * Two-phased constructor. + * @param aApp Reference to application object + * @return CSVGTViewerAppDocument*. + */ + static CSVGTViewerAppDocument* NewL( CEikApplication& aApp ); + + /** + * Two-phased constructor. + * @param aApp Reference to application object + * @return CSVGTViewerAppDocument*. + */ + static CSVGTViewerAppDocument* NewLC( CEikApplication& aApp ); + + // Destructor + virtual ~CSVGTViewerAppDocument(); + public: // New functions + /** + * GetSvgtContentFileHandle() This function is a get function to + * get the file-handle of the file content. This is used by AppUI + * @since 3.0 + */ + RFile& GetSvgtContentFileHandle(); + + /** + * IsFileHandleValid() This function is a get function to + * get the flag whether File's handle is valid + * AppUi uses this method. + * @since 3.0 + */ + TBool IsFileHandleValid() const; + + /** + * IsFileFullPathAvailable() This function is a get function to + * get the flag whether File's fullpath is available. I.e. + * file is public. AppUi uses this method. + * @since 3.0 + */ + TBool IsFileFullPathAvailable() const; + + /** + * GetFileFullPath() This function is a get function to + * get the File's fullpath. AppUi uses this method. + * @since 3.0 + */ + void GetFileFullPath(TFileName& filename); + + /** + * GetParentAppUid() This function is a get function to + * get the Parent Application's Uid. AppUi uses this method. + * @since 3.0 + */ + TUid GetParentAppUid() const; + + + public: // Functions from base classes + /** + * From CAknDocument This function is used by the Doc Handler to open + * SVGT content. + * @since 3.0 + * @param aDoOpen Boolean indicates whether Document is to be + * opened/Created. + * @param aFilename Descriptor indicates SVGT File path + * @param aFs File Server Session handle + * @return CFileStore *. + */ + virtual CFileStore* OpenFileL( TBool aDoOpen, const TDesC& aFilename, + RFs& aFs ); + + /** + * From CAknDocument This function is used by the Doc Handler to open + * the document passed by the framework as a file-handle. + * @since 3.0 + * @see CAknDocument::OpenFileL + * */ + virtual void OpenFileL( CFileStore*& aFileStore, RFile& aFile); + + /** + * From CAknDocument This function is called by the framework to + * create the AppUI for SVGT Viewer. + * @since 3.0 + * @return A pointer to the created instance of the AppUi created + */ + CEikAppUi* CreateAppUiL(); + private: + + /** + * C++ default constructor. + */ + CSVGTViewerAppDocument( CEikApplication& aApp ); + + /** + * Second phase construction of a CSVGTViewerAppDocument object. + */ + void ConstructL(); + + private: + + // File handle to the SVGT content + RFile iSvgtContentFileHandle; + + //File Path if the file launched with full filepath. + HBufC* iFileFullPath; + + //Was file launched with full-path. + TBool iIsFileFullPathValid; + + //OpenFileL updates this flag after getting the file handle. + TBool iIsFileHandleValid; + + //Uid of the parent application + TUid iParentUid; + + }; + + +#endif // __SVGTVIEWERAPPDOCUMENT_H__ +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppInc/SvgtViewerAppView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppInc/SvgtViewerAppView.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 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: Application viewer for SVGT Viewer App. +* +*/ + + + +#ifndef __SVGTVIEWERAPPVIEW_H__ +#define __SVGTVIEWERAPPVIEW_H__ + +#include + +// +// class CSvgtViewerAppView +// + +class CSvgtViewerAppView : public CAknControl + { + public: + void ConstructL(const TRect& aRect); + ~CSvgtViewerAppView(); + + private: // from CCoeControl + void Draw(const TRect& /*aRect*/) const; + TInt CountComponentControls() const; + CCoeControl* ComponentControl(TInt aIndex) const; + void HandleResourceChange (TInt aType); + }; + + +#endif //__SVGTVIEWERAPPVIEW_H__ diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppObserverUtilSrc/SVGTAppObserverUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppObserverUtilSrc/SVGTAppObserverUtil.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,2441 @@ +/* +* Copyright (c) 2004,2005 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: This class provides helper functions and a reference +* implementation for hyperlink handling, image fetching +* and saving of the svg content. +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __SERIES60_NATIVE_BROWSER +#include // Include only if s60 native + // browser available +#endif + +#include +#include // TApaTaskList +#include // RApaLsSession +#include +#include // CApDataHandler +#include // CApAccessPointItem +#include // CApUtils +#include // CApSelect +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //TImCodecB64 +#include + +#include "SVGTViewerAppDbgFlags.hrh" +#include "SVGTViewerAppDownloads.h" +#include "SVGTAppObserver.h" // temp +#include "SVGTUIDialog.h" // AppDialog +#include "SVGTUIDialog.hrh" + +#ifdef RD_MULTIPLE_DRIVE +#include +#endif +// CONSTANTS + +_LIT( KBrowserParameter, "4" ); // magic number for browser to open the URL +_LIT( KSpace, " " ); + +_LIT(KJpg, ".jpg" ); +_LIT(KJpeg, ".jpeg" ); +_LIT(KPng, ".png" ); +_LIT(KBmp, ".bmp" ); +_LIT(KSvg, ".svg" ); +_LIT(KSvgz, ".svgz" ); + +#ifndef __SERIES60_NATIVE_BROWSER + // Below constants need to be used if s60 native browser is not used. + const TUid KCRUidBrowser = {0x10008D39}; + const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; +#endif // __S60_REMOVE_BROWSER + +// SMIL Fit Value +_LIT( KSvgtDefSmilFitValue,"meet" ); +// Resource file for App Observer Util +_LIT( KResourceFileName, "Z:SVGTAppObserverUtil.rsc" ); + +_LIT( KEmptyString, "" ); +_LIT( KWww, "www" ); +_LIT( KHttp, "http://"); +_LIT( KDotDot, ".." ); +_LIT( KBSlashStr, "/" ); +_LIT( KSlashStr, "\\" ); +_LIT( KDotSlashStr, ".\\" ); +_LIT( KColonStr, ":" ); +_LIT( KNewLineStr, "\n" ); + +#ifdef SVGTVIEWERAPP_DBG_FLAG +_LIT( KFileLoggingDir, "SVGTViewer" ); +_LIT( KFileLog, "SaveLog.txt" ); +#endif + +// Maximum length of thread Id in Characters +const TInt KSvgMaxThreadIdStr = 10; + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSVGTAppObserverUtil* CSVGTAppObserverUtil::NewL( + CSVGTUIDialog* aAppDialog, + RFile* aFileHdlPtr, + const TDesC& aFilename, + TBool aIsFileFullPathAvailable, + TBool aCanSaveContent, + TBool aShouldMoveContent) + { + CSVGTAppObserverUtil* self = + CSVGTAppObserverUtil::NewLC( aAppDialog, + aFileHdlPtr, + aFilename, + aIsFileFullPathAvailable, + aCanSaveContent, + aShouldMoveContent ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSVGTAppObserverUtil* CSVGTAppObserverUtil::NewLC( CSVGTUIDialog* aAppDialog, + RFile* aFileHdlPtr, + const TDesC& aFilename, + TBool aIsFileFullPathAvailable, + TBool aCanSaveContent, + TBool aShouldMoveContent) + { + CSVGTAppObserverUtil* self = + new( ELeave ) CSVGTAppObserverUtil( aAppDialog ); + CleanupStack::PushL( self ); + self->ConstructL( aFileHdlPtr, aFilename, aIsFileFullPathAvailable, + aCanSaveContent, aShouldMoveContent ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSVGTAppObserverUtil* CSVGTAppObserverUtil::NewL( + CSVGTUIDialog* aAppDialog, + RFile* aFileHdlPtr ) + { + CSVGTAppObserverUtil* self = + CSVGTAppObserverUtil::NewLC( aAppDialog, + aFileHdlPtr ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSVGTAppObserverUtil* CSVGTAppObserverUtil::NewLC( + CSVGTUIDialog* aAppDialog, + RFile* aFileHdlPtr ) + { + CSVGTAppObserverUtil* self = + new( ELeave ) CSVGTAppObserverUtil( aAppDialog ); + CleanupStack::PushL( self ); + + self->ConstructL( aFileHdlPtr ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +EXPORT_C CSVGTAppObserverUtil::~CSVGTAppObserverUtil() + { + +#ifdef SVGTVIEWERAPP_DOWNLOADMGR_ENABLED + + CSVGTViewerAppDownloads* downloads; + + iDownloadIter.SetToFirst(); + while ((downloads = iDownloadIter++) != NULL) + { + downloads->QueLink().Deque(); + delete downloads; + iDownloadIter.SetToFirst(); + } + + // Close the DMgr UI Library first, as it uses the same + // Download Manager session that the Viewer uses + delete iDMgrUiReg; + + // Close the Download Manager connection + iDownloadMgr.Close(); + + iDMgrDownloadsList = NULL; + iDMgrUserInteractions = NULL; +#endif + // Reset the app dialog, it is already freed in OpenFileL + iAppDialog = NULL; + + delete iFileManager; + delete iSvgFileName; + delete iSvgDstFileName; + delete iDocHandler; + + delete iWaitNote; + delete iTempFileName; + if ( iResourceOffset != 0 ) + { + iEikEnv->DeleteResourceFile( iResourceOffset ); + } + + // Reset the SVG File Handle as it is owned by the caller + iSvgFileId = NULL; + // Reset the Progress Info implementor pointer + iProgressInfo = NULL; + // Reset Environment pointer + iEikEnv = NULL; + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::FetchImage +// Called by Svg engine when there is an image tag encountered in the svg file +// parameters: +// aUri: the uri that needs to be downloaded or fetched locally +// aSession: File Session in which the file is opened. +// aFileHandle: handle of the downloaded file or locally fetched file. +// return value: +// KErrNone if the file is fetched successfully +// KErrNotFound if the file could not be fetched. +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CSVGTAppObserverUtil::FetchImage( + const TDesC& aUri , RFs& aSession , + RFile& aFileHandle ) + { + TInt ret = KErrNone; + + TDownloadNeeded downloadNeeded = ELocalImageFile; + TRAPD( error, downloadNeeded = IsDownloadNeededL( aUri ) ); + + if ( error != KErrNone ) + { + return KErrNotFound; + } + + if ( downloadNeeded == ELocalImageFile ) + { + TFileName fileName; + if ( GetLocalFile( aUri, fileName, *iSvgFileName ) ) + { + return aFileHandle.Open( aSession, fileName, EFileShareAny ); + } + else + { + return KErrNotFound; + } + } + else if ( downloadNeeded == ERemoteImageFile ) + { + TRAPD( err,ret = StartDownloadingImageL( aUri, + aSession, + aFileHandle, + EFalse, + EFalse /* Asynchronous mode */) ); + if ( err != KErrNone ) + { + return KErrNotFound; + } + else + { + return ret; + } + + } + else + { + return KErrNotFound; + } + + } + +TInt CSVGTAppObserverUtil::FetchFont( const TDesC& /* aUri */, + RFs& /* aSession */, RFile& /* aFileHandle */ ) + { + return KErrNotSupported; + } + +// --------------------------------------------------------------------------- +// CSVGTAppObserverUtil::LinkActivated +// Callback Function called by svg engine when a hyperlink is activated +// --------------------------------------------------------------------------- +// + +EXPORT_C TBool CSVGTAppObserverUtil::LinkActivated( const TDesC& aUri ) + { + if( aUri.Length() == 0 ) + { + return KErrNone; + } + TRAPD( error, LinkActivatedL( aUri ) ); + return ( error == KErrNone ); + } + + +// -------------------------------------------------------------------- +// CSVGTAppObserverUtil::LinkActivatedWithShow +// Callback Function called by the svg engine when a hyperlink with show +// attribute is activated +// -------------------------------------------------------------------- +// +EXPORT_C TBool CSVGTAppObserverUtil::LinkActivatedWithShow( + const TDesC& aUri , + const TDesC& aShow ) + { + if( aUri.Length() == 0 ) + { + return KErrNone; + } + TRAPD( error, LinkActivatedWithShowL( aUri, aShow ) ); + return ( error == KErrNone ); + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::GetSmilFitValue +// Default implementation for observer function to get SMIL fit value. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::GetSmilFitValue( TDes& aSmilValue ) + { + aSmilValue.Copy( KSvgtDefSmilFitValue ); + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::SetDownloadMenu +// Sets/Unsets the iDownloadMenuEnabled +// ----------------------------------------------------------------------------- +// + +EXPORT_C void CSVGTAppObserverUtil::SetDownloadMenu( TBool aAddDownloadMenu ) + { + iDownloadMenuEnabled = aAddDownloadMenu; + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::SetDownloadMenu +// Sets/Unsets the iDownloadMenuEnabled +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSVGTAppObserverUtil::CanShowDownload() const + { + if(iDownloadInProgress || iDownloadDone) + { + const CDownloadArray& array = iDownloadMgr.CurrentDownloads(); + return ( array.Count() ? ETrue : EFalse ); + } + + return EFalse; + } + +// -------------------------------------------------------------------- +// void CSVGTAppObserverUtil::DisplayDownloadMenuL() +// Call back called by the UI dialog when the downloads menu is +// selected. This function calls the DisplayDownloadsListL function +// provided by the download manager ui lib. +// -------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::DisplayDownloadMenuL() + { +#ifdef SVGTVIEWERAPP_DOWNLOADMGR_ENABLED + if ( iDMgrDownloadsList ) + { + TRAPD( error, iDMgrDownloadsList->DisplayDownloadsListL() ); + { + if ( error != KErrNone ) + { +#ifdef _DEBUG + TBuf<64> buffer; + _LIT(msg, "AP error : %d" ); + buffer.Format( msg, error ); + iEikEnv->InfoMsg( buffer ); +#endif + } + } + } +#endif + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::HandleDMgrEventL +// Called by Download manager when the image is being downloaded. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::HandleDMgrEventL( RHttpDownload& aDownload, + THttpDownloadEvent aEvent ) + { + +#ifdef SVGTVIEWERAPP_DOWNLOADMGR_ENABLED + +#ifdef _DEBUG + TBuf<64> buffer; + _LIT(msg, "download progressing : %d, %d" ); + buffer.Format( msg, aEvent.iDownloadState, aEvent.iProgressState ); + iEikEnv->InfoMsg( buffer ); +#endif + { + + if ( EHttpDlInprogress == aEvent.iDownloadState ) + { + iDownloadInProgress = ETrue; + iDownloadDone = EFalse; + } + + if ( EHttpDlCompleted == aEvent.iDownloadState ) + { + + iDownloadInProgress = EFalse; + iDownloadDone = ETrue; + + // Get the download item from the list + CSVGTViewerAppDownloads* downloadItem; + downloadItem = FindDownload( &aDownload ); + +#ifdef _DEBUG + + + _LIT(downloadMsg, "download found" ); + iEikEnv->InfoMsg( downloadMsg ); +#endif + + + if ( downloadItem ) + { + // Get the file Name of the downloaded file + TFileName fileName; + aDownload.GetStringAttribute( EDlAttrDestFilename, fileName ); +#ifdef _DEBUG + + _LIT(fileNameMsg, "got file name " ); + iEikEnv->InfoMsg( fileNameMsg ); +#endif + +//############################################## +// For AssignImageData + DoAssignImageDataL(downloadItem, aDownload); +//############################################## + downloadItem->SetFileName( fileName ); + + // Check whether the download happened in a synchronous way + if ( downloadItem->SynchronousMode() ) + { + downloadItem->SetDownloadCompleted( ETrue ); + + // If wait note is being displayed, delete it + if ( iWaitNote ) + { + // Delete the download wait note + TRAPD( err, iWaitNote->ProcessFinishedL() ); + if ( err != KErrNone ) + { + delete iWaitNote; + iWaitNote = NULL; + } + } + + // If synchronous stop the scheduler + iWait.AsyncStop(); + } + else + { + // Otherwise check the embedded mode and open the file + // using DocHandler + downloadItem->QueLink().Deque(); + delete downloadItem; + } + } + } + else + { + // added for if user cancels the download. + if ( EHttpDlDeleting == aEvent.iDownloadState && !iDownloadDone) + { + aDownload.Pause(); + aEvent.iDownloadState = EHttpDlFailed; + } + + if ( EHttpDlFailed == aEvent.iDownloadState ) + { +#ifdef _DEBUG + + _LIT(failMsg, " downloading failed" ); + iEikEnv->InfoMsg( failMsg ); +#endif + + TInt32 error = 0; + TInt32 globalError = 0; + aDownload.GetIntAttribute( EDlAttrErrorId, error ); + aDownload.GetIntAttribute( EDlAttrGlobalErrorId, globalError ); + +#ifdef _DEBUG + TBuf<64> errorBuffer; + _LIT(failedMsg, "downloading failed : %d, %d" ); + buffer.Format( failedMsg, error, globalError ); + iEikEnv->InfoMsg( errorBuffer ); +#endif + + // Get the download item from the list + CSVGTViewerAppDownloads* downloadItem; + downloadItem = FindDownload( &aDownload ); + // Check whether the download was started synchronously + // if( !downloadItem->ImageLinkFlag()) + { + HBufC* lUriBuf = HBufC::NewLC( KMaxUrlLength ); + TPtr lUriPtr(lUriBuf->Des()); + aDownload.GetStringAttribute( EDlAttrReqUrl, lUriPtr ); + iAppDialog->AssignImageData(lUriPtr , NULL ); + CleanupStack::PopAndDestroy( lUriBuf ); + } + + if ( downloadItem ) + { + if ( downloadItem->SynchronousMode() ) + { + + downloadItem->SetDownloadCompleted( EFalse ); + if ( iWaitNote ) + { + // Delete the download wait note + TRAPD( err, iWaitNote->ProcessFinishedL() ); + if ( err != KErrNone ) + { + delete iWaitNote; + iWaitNote = NULL; + } + } + + // If synchronous, stop the scheduler started. + iWait.AsyncStop(); + } + else + { + // Otherwise delete the download item from the list + downloadItem->QueLink().Deque(); + delete downloadItem; + } + } + } + } + } +#endif + } + +// --------------------------------------------------------------------------- +// CSVGTAppObserverUtil::LinkActivatedL +// Leave variant of LinkActivated +// Launches the browser in embedded mode and passes the uri to the browser +// if the uri is a web page, if the uri refers to a local image file, or a +// remote image file, launches the file using doc handler. +// --------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::LinkActivatedL( const TDesC& aUri ) + { + + TDownloadNeeded dnloadNeeded = IsDownloadNeededL( aUri ); + + if ( dnloadNeeded == ENotAnImageFile ) + { + + // (2 = length of the first parameter + space) + HBufC* parameters = NULL; + parameters = HBufC::NewLC( aUri.Length() + 2 ); + + TPtr parametersPtr = parameters->Des(); + parametersPtr.Copy( KBrowserParameter ); + parametersPtr.Append( KSpace ); + parametersPtr.Append( aUri ); + + // Create BrowserLauncher + CBrowserLauncher* launcher = NULL; + + launcher = CBrowserLauncher::NewLC(); + + TBrowserOverriddenSettings overriddenSettings; + launcher->LaunchBrowserSyncEmbeddedL( *parameters, NULL, &overriddenSettings ); + + //launcher, parameters + CleanupStack::PopAndDestroy( 2, parameters ); + } + else + { + if ( dnloadNeeded == ERemoteImageFile ) + { + RFile fileHandle; // param not going to be used + RFs fileSession; // param not going to be used + StartDownloadingImageL( aUri, + fileSession, + fileHandle, + EFalse, /* aSynchronous mode */ + ETrue, + ETrue /* Embedded mode */ ); + } + else if ( dnloadNeeded == ELocalImageFile ) + { + + TFileName fileName; + TInt error = KErrNone; + + if ( GetLocalFile( aUri, fileName, *iSvgFileName ) ) + { + TRAP( error, LaunchDownloadedFileL( fileName, ETrue, EFalse ) ); + } + else + { + error = KErrNotFound; + } + + if ( error != KErrNone ) + { + TInt resourceId; + resourceId = R_SVGT_FILE_NOT_FOUND; + // Show information note + HBufC* prompt = StringLoader::LoadLC( resourceId ); + CAknInformationNote* note = + new ( ELeave ) CAknInformationNote( ETrue ); + note->ExecuteLD( *prompt ); + + CleanupStack::PopAndDestroy( prompt ); + } + } + else + { + return; + } + } + } + + +// -------------------------------------------------------------------- +// CSVGTAppObserverUtil::LinkActivatedWithShowL +// Called by LinkActivatedWithShow +// Calls LinkActivatedL +// -------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::LinkActivatedWithShowL( + const TDesC& aUri , + const TDesC& /*aShow*/ ) + { + LinkActivatedL( aUri ); + } +// --------------------------------------------------------------------------- +// CSVGTAppObserverUtil::StartDownloadingImageL +// Called by FetchImage, LinkActivated, LinkActivatedWithShow to download the +// image. This function calls the download manager client Api's to start the +// download. The download completion will be indicated by the call back +// HandleDownloadMgrEventL. As FetchImage is a synchronous function +// a CActiveSchedulerWait loop is started, after starting the http download. +// the wait loop is stopped when the call back HandleDownloadMgrEventL is +// called. +// 1. CreateDownloadAndSetAttributes +// 2. check result +// If result no +// check the status of the download +// if Completed +// return the filehandle +// if in progress +// continue downloading +// if failed +// return +// else +// Start Download +// 3. If Synchronous +// Start DownloadWaitNote +// Start ActiveSchedulerWait. +// 4. Return +// +// parameters: +// aUri: the hyperlink that needs to be downloaded. +// aSession: File session in which the file handle is opened. +// aFileHandle: Handle of the downloaded file +// aIsSynchronous: flag indicating whether download is synchronous or not +// aLinkFlag: Image flag to distinguish the Embeded & hyperlink. +// aIsEmbedded: flag indicating whether downloaded file has to opened in +// stand alone mode or embedded mode. +// --------------------------------------------------------------------------- +// +TInt CSVGTAppObserverUtil::StartDownloadingImageL( + const TDesC& aUri, + RFs& aSession, + RFile& aFileHandle, + TBool aIsSynchronous, + TBool aLinkFlag, + TBool aIsEmbedded ) + { + +#ifdef SVGTVIEWERAPP_DOWNLOADMGR_ENABLED + + +#if defined(__WINS__) || defined(__WINSCW__) + //do nothing, hard code later on +#else + + + TUint32 Iapid( 0 ); + if ( !GetDefaultInetAccessPointL( Iapid ) ) + { + return KErrNotFound; + } + + + iDownloadMgr.SetIntAttribute( EDlMgrIap, (TInt32)Iapid ); +#endif // __wins__|| __winscw__ + + +#ifdef _DEBUG + _LIT( setAP, "Access point set" ); + iEikEnv->InfoMsg( setAP ); +#endif + + + TInt result = ETrue; + // Add lDownload to cleanup stack and pop it after CreateDownloadL. + CSVGTViewerAppDownloads *lDownload = CSVGTViewerAppDownloads::NewLC( + aIsEmbedded, aIsSynchronous, aLinkFlag ); + + HBufC8* url8 = NULL; + url8 = HBufC8::NewLC( aUri.Length() ); + url8->Des().Copy( aUri ); + + lDownload->SetDownloadHandle( + &iDownloadMgr.CreateDownloadL( *url8 , result ) ); + + CleanupStack::PopAndDestroy( url8 ); // url8 + +#ifdef _DEBUG + _LIT(dlCreated, "download created" ); + iEikEnv->InfoMsg( dlCreated ); +#endif + + + // Add Downloads to the Menu Option + if ( !iDownloadMenuEnabled && !aIsSynchronous ) + { + SetDownloadMenu( ETrue ); + } + + if ( !result ) + { + + // url is already being downloaded or completed + // Get the download State + TInt32 downloadState = 0; + TInt retval = KErrNone; + lDownload->DownloadHandle()->GetIntAttribute( EDlAttrState, + downloadState ); + + if ( downloadState == EHttpDlCompleted ) + { + TFileName fileName; + lDownload->DownloadHandle()->GetStringAttribute( EDlAttrDestFilename + , fileName ); + if ( aIsSynchronous ) + { + retval = aFileHandle.Open( aSession, fileName, EFileShareAny ); + } + else + { + if(aLinkFlag) + { + // Handle Launching downloaded file in asynchronous mode + LaunchDownloadedFileL( fileName, aIsEmbedded , ETrue); + } + else + { + DoAssignImageDataL(lDownload, *(lDownload->DownloadHandle())); + } + + } + + CleanupStack::PopAndDestroy( lDownload ); // lDownload + return retval; + } + else + { + if ( downloadState == EHttpDlFailed ) + { + // Retry + // Add to the linked list + iDownloads.AddFirst( *lDownload ); + CleanupStack::Pop( lDownload ); // lDownload + lDownload->DownloadHandle()->SetBoolAttribute( + EDlAttrNoContentTypeCheck, ETrue ); + // Start the download + lDownload->DownloadHandle()->Start(); + + return KErrNone; + } + else + { + + if ( !FindDownload( lDownload->DownloadHandle() ) ) + { + // Add to the linked list + iDownloads.AddFirst( *lDownload ); + CleanupStack::Pop( lDownload ); // lDownload + } + else + { + CleanupStack::PopAndDestroy( lDownload ); // lDownload + } + } + } + } + else + { + if ( aIsSynchronous ) + { + TFileName fileName( KEmptyString ); + GetFileNameFromUri( aUri, fileName ); + LaunchWaitNoteL( R_SVGT_DOWNLOAD_WAIT_NOTE, ETrue, fileName ); + } + if ( !aIsSynchronous ) + { + lDownload->DownloadHandle()->SetIntAttribute( EDlAttrAction, + lDownload->ImageLinkFlag() ? ELaunch : EDoNothing ); +// iIsFetchImageCall ? EDoNothing : ELaunch ); + } + else + { + lDownload->DownloadHandle()->SetIntAttribute( EDlAttrAction, + EDoNothing ); + lDownload->DownloadHandle()->SetBoolAttribute( EDlAttrSilent, + ETrue ); + } + + lDownload->DownloadHandle()->SetBoolAttribute( + EDlAttrNoContentTypeCheck, ETrue ); + + +#ifdef _DEBUG + _LIT(dlCreateMsg, "result true dl created" ); + iEikEnv->InfoMsg( dlCreateMsg ); +#endif + + // Add to the linked list + iDownloads.AddFirst( *lDownload ); + + CleanupStack::Pop( lDownload ); // lDownload + + // Start the download + lDownload->DownloadHandle()->Start(); + } + + if ( aIsSynchronous ) + { + // Start the Scheduler Wait + if ( !iWait.IsStarted() ) + { + iWait.Start(); + } + +#ifdef _DEBUG + _LIT(waitLoopMsg, "out of wait loop" ); + iEikEnv->InfoMsg( waitLoopMsg ); +#endif + if ( iSynchronousDownloadStopped ) + { + // Download dismissed + // Cancel the download + lDownload->DownloadHandle()->Delete(); + return KErrCancel; + } + + CSVGTViewerAppDownloads* downloadItem = NULL; + downloadItem = FindDownload( lDownload->DownloadHandle() ); + + if ( downloadItem ) + { + TInt retval = KErrNone; + TBool downloadCompleted = downloadItem->DownloadCompleted(); + + if ( downloadCompleted ) + { + retval = aFileHandle.Open( aSession, + downloadItem->FileName(), + EFileShareAny ); + } + else + { + retval = KErrNotFound; + } + + downloadItem->QueLink().Deque(); + delete downloadItem; + return retval; + } + else + { + return KErrNotFound; + } + } + else + { + return KErrNone; + } + +#else + return KErrNotFound; +#endif + + } + +// --------------------------------------------------------------------------- +// CSVGTAppObserverUtil::GetDefaultInetAccessPointL +// if the return value is true, aIapId has the default Iap id. +// --------------------------------------------------------------------------- +EXPORT_C TBool CSVGTAppObserverUtil::GetDefaultInetAccessPointL + ( TUint32& aIapId ) const + { + + // Try to find the default AP. + // The Browser may stores the default AP in the shared data. + CRepository* repository = CRepository::NewL( KCRUidBrowser ); + CleanupStack::PushL( repository ); + + TInt wapApId = 0; + TRAPD( error, repository->Get( KBrowserDefaultAccessPoint, wapApId ) ); + if ( error != KErrNone ) + { +#ifdef _DEBUG + TBuf<64> buffer; + _LIT(msg, "AP error : %d" ); + buffer.Format( msg, error ); + iEikEnv->InfoMsg( buffer ); + User::After(1000000); +#endif + return EFalse; + } + TUint32 wapApId32( wapApId ); + TUint32 iapId32( 0 ); + + CleanupStack::PopAndDestroy( repository ); + + CCommsDatabase* commsDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); + CleanupStack::PushL( commsDb ); + CApDataHandler* apDataHandler = CApDataHandler::NewLC( *commsDb ); + CApAccessPointItem* apItem = CApAccessPointItem::NewLC(); + TRAPD( err, apDataHandler->AccessPointDataL( wapApId32, *apItem ) ); + CApUtils* apUtils = CApUtils::NewLC( *commsDb ); + + TBool wapApFound( EFalse ); + TBool iapFound( EFalse ); + + if ( err == KErrNone ) + { + wapApFound = ETrue; + } + else + { + // The first valid access point has to be selected if exists + CApSelect* apSelect = CApSelect::NewLC + ( + *commsDb, + KEApIspTypeAll, + EApBearerTypeAll, + KEApSortNameAscending + ); + if ( apSelect->MoveToFirst() ) + { + wapApFound = ETrue; + wapApId32 = apSelect->Uid(); + } + CleanupStack::PopAndDestroy( apSelect ); // apSelect + } + + if ( wapApFound ) + { + // Get the IAP ID from the WAP AP ID. +#ifndef __SERIES60_WSP + iapId32 = 0; + TRAPD( errTransl, iapId32 = apUtils->IapIdFromWapIdL( wapApId32 ) ); + + if ( errTransl == KErrNone ) + { + iapFound = ETrue; + } +#else + iapId32 = wapApId32; + iapFound = ETrue; +#endif // __SERIES60_WSP + } + + CleanupStack::PopAndDestroy( 4 ); // apUtils, apItem, + // apDataHandler, commsDb + + if ( iapFound ) + { + aIapId = iapId32; + } + return iapFound; + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::LaunchDownloadedFileL +// Called by Download manager when the image is downloaded. +// This function uses the document handler to launch the downloaded file. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::LaunchDownloadedFileL( const TDesC& aFileName, + TBool /* aIsEmbedded */, + TBool aAllowSave ) const + { + + TDataType dataType = TDataType(); + RFile fileHandle; + // Creates a sharable file handle + iDocHandler->OpenTempFileL( aFileName, fileHandle ); + CleanupClosePushL( fileHandle ); + if ( aAllowSave ) + { + CAiwGenericParamList& paramList = iDocHandler->InParamListL(); + // To show/hide save confirmation dlg + TAiwVariant allowSaveVariant(aAllowSave); + TAiwGenericParam genericParamAllowSave( EGenericParamAllowSave, + allowSaveVariant ); + paramList.AppendL( genericParamAllowSave ); + + iDocHandler->OpenFileEmbeddedL( fileHandle, dataType, paramList ); + } + else + { + _LIT( KSvgFile, ".svg"); + _LIT( KSvgzFile, ".svgz"); + _LIT( KSvgbFile, ".svgb"); + if(aFileName.Right(4) == KSvgFile || aFileName.Right(5) == KSvgzFile || aFileName.Right(5) == KSvgbFile) + { + iDocHandler->OpenFileEmbeddedL( fileHandle, dataType ); + } + else + { + iDocHandler->OpenFileL( fileHandle, dataType ); + } + } + CleanupStack::PopAndDestroy( &fileHandle ); // fileHandle + } + +// --------------------------------------------------------------------------- +// CSVGTAppObserverUtil::IsDownloadNeededL +// Called by link activated(WithShow), FetchImage +// to check whether the uri needs a download +// If the filename is present in the uri and if it is a html, +// returns ENotAnImageFile +// If the host is present & filename is not present, +// returns ENotAnImageFile +// If the host is present & filename is present, +// returns ERemoteImageFile +// If the uri doesnt need a download and if it is locally available, +// returns ELocalImageFile +// --------------------------------------------------------------------------- +// +EXPORT_C CSVGTAppObserverUtil::TDownloadNeeded + CSVGTAppObserverUtil::IsDownloadNeededL( + const TDesC& aUri ) + { + + TUriParser UriParser; + + TBuf localUri; + // url starts with www so append http:// + if ( !aUri.Left( 4 ).Compare( KWww ) ) + { + localUri.Append( KHttp ); + localUri.Append( aUri ); + User::LeaveIfError( UriParser.Parse( localUri ) ); + } + else + { + User::LeaveIfError( UriParser.Parse( aUri ) ); + } + + if ( UriParser.IsPresent( EUriHost ) ) + { + // Extract the Path, filename and extension from the uri + TFileName filename = UriParser.Extract( EUriPath ); + TParsePtrC fileParser( filename ); + + if ( fileParser.NamePresent() && fileParser.ExtPresent() ) + { + if ( fileParser.Ext().Compare( KJpg ) == 0 || + fileParser.Ext().Compare( KJpeg ) == 0 || + fileParser.Ext().Compare( KBmp ) == 0 || + fileParser.Ext().Compare( KPng ) == 0 || + fileParser.Ext().Compare( KSvg ) == 0 || + fileParser.Ext().Compare( KSvgz ) == 0 ) + { + // file name and ext present and + // it is amy of the supported image types + return ERemoteImageFile; + } + else + { + //file Extension present but not a supported image ext, + //may be some html file + return ENotAnImageFile; + } + } + else + { + //Should be a domain name so return ENotAnImageFile + return ENotAnImageFile; + } + } + else + { + return ELocalImageFile; + } + } + +// --------------------------------------------------------------------------- +// CSVGTAppObserverUtil::GetFileNameFromUri +// This function gets the filename from the uri, +// Returns true if the file name is retrieved +// Returns False if the file name could not be retrieved. +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CSVGTAppObserverUtil::GetFileNameFromUri( const TDesC& aUri, + TDes& aFileName ) const + { + + const TChar KBSlash = '/'; + TUriParser UriParser; + if ( UriParser.Parse( aUri ) != KErrNone ) + { + return EFalse; + } + + if ( UriParser.IsPresent( EUriPath ) ) + { + // Extract the Path, filename and extension from the uri + TFileName filename = UriParser.Extract( EUriPath ); + + TParse fileParser; + fileParser.Set( filename, NULL, NULL ); + + TInt slashPos = filename.LocateReverse( KBSlash ); + if ( slashPos != KErrNotFound ) + { + aFileName = filename.Right( filename.Length() - (slashPos + 1)); + return ETrue; + } + else + { + return EFalse; + } + + } + else + { + return EFalse; + } + + } +// --------------------------------------------------------------------------- +// CSVGTAppObserverUtil::GetLocalFile +// This function gets the filename with full path from the uri, +// Returns true if the file name is retrieved +// Returns False if the file name could not be retrieved. +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CSVGTAppObserverUtil::GetLocalFile( + const TDesC& aUri, + TDes& aFileName , + const TDesC& aSvgFileName ) + { + + TBuf copyUri = aUri; + // Before giving the uri to the file parser, + // convert '/' to '\'. + TInt pos; + while( KErrNotFound != ( pos = copyUri.FindF( KBSlashStr ) ) ) + { + copyUri.Replace(pos,1,KSlashStr ); + } + + // if the uri starts with ".\" remove ".\" + if ( copyUri.Left( 2 ).Compare( KDotSlashStr ) == 0 ) + { + copyUri = copyUri.Right( copyUri.Length() - KDotSlashStr().Length() ); + } + + // If the second letter is not ':' + // and if it is not starting with '\', + // and if the path has '/', + // then prepend slash to it. + if ( copyUri.Length() >= 2 && + copyUri.Mid( 1, 1 ).Compare( KColonStr ) != 0 && + copyUri.Mid( 0, 1 ).Compare( KSlashStr ) != 0 && + ( copyUri.Find( KSlashStr ) != KErrNotFound ) ) + { + copyUri.Insert( 0, KSlashStr ); + } + + TParse fileParser; + if( fileParser.Set( copyUri, NULL, NULL ) != KErrNone ) + { + return EFalse; + } + + if ( fileParser.DrivePresent() ) + { + // The uri is an absolute path + aFileName.Append( fileParser.Drive() ); + // Append path, file name and extension from the uri. + if ( fileParser.PathPresent() ) + { + aFileName.Append( fileParser.Path() ); + } + if ( fileParser.NamePresent() ) + { + aFileName.Append( fileParser.Name() ); + } + if ( fileParser.ExtPresent() ) + { + aFileName.Append( fileParser.Ext() ); + } + RFs session; + TInt connectError=session.Connect(); + if(connectError==KErrNone) + { + RFile fileHandle; + TInt openError = fileHandle.Open( session, aFileName, EFileShareReadersOnly); + fileHandle.Close(); + session.Close(); + if ( openError != KErrNone ) + { + return EFalse; + } + return ETrue; + } + session.Close(); + return EFalse; + } + else + { + + TParse svgFilenameParser; + if ( svgFilenameParser.Set( aSvgFileName,NULL,NULL ) != KErrNone ) + { + return EFalse; + } + + if ( svgFilenameParser.DrivePresent() ) + { + aFileName.Append( svgFilenameParser.Drive() ); + } + + TInt dotdotPos = copyUri.Find( KDotDot ); + TInt rightPos = 0; + + if ( dotdotPos != KErrNotFound ) + { + // If ".." is present collapse it with the parent path + if ( svgFilenameParser.PathPresent() ) + { + do + { + if ( dotdotPos > 1 ) + { + svgFilenameParser.AddDir( copyUri.Left(dotdotPos - 1) ); + } + + if ( svgFilenameParser.PopDir() != KErrNone ) + { + return EFalse; + } + + rightPos = (copyUri.Length()) - (dotdotPos + 3); + + if ( rightPos > 0 ) + { + copyUri = copyUri.Right( rightPos ); + } + + }while ( (dotdotPos = copyUri.Find( KDotDot ) ) + != KErrNotFound ); + + aFileName.Append( svgFilenameParser.Path() ); + aFileName.Append( copyUri ); + } + else + { + return EFalse; + } + } + else + { + if ( svgFilenameParser.PathPresent() ) + { + aFileName.Append( svgFilenameParser.Path() ); + } + + // Append path, file name and extension from the uri. + if ( fileParser.PathPresent() ) + { + //deletes an extra slash in aFileName + TInt strlen = aFileName.Length(); + if(aFileName.Mid(strlen-1).Compare(KSlashStr) == 0) + { + aFileName.Delete(strlen-1, 1); + } + aFileName.Append( fileParser.Path() ); + } + + if ( fileParser.NamePresent() ) + { + aFileName.Append( fileParser.Name() ); + } + if ( fileParser.ExtPresent() ) + { + aFileName.Append( fileParser.Ext() ); + } + } + RFs session; + // The error is caught to avoid any code scanner error + TInt connectError=session.Connect(); + if(connectError==KErrNone) + { + RFile fileHandle; + TInt openError = fileHandle.Open(session, aFileName, EFileShareReadersOnly ); + fileHandle.Close(); + session.Close(); + if ( openError != KErrNone ) + { + return EFalse; + } + return ETrue; + } + session.Close(); + return EFalse; + } + } + + +#ifdef SVGTVIEWERAPP_DOWNLOADMGR_ENABLED +// --------------------------------------------------------------------------- +// CSVGTAppObserverUtil::FindDownload +// This iterates through the linked list and return the link +// corresponding to the given http download handle +// If a link is not found returns NULL. +// --------------------------------------------------------------------------- +// +CSVGTViewerAppDownloads* CSVGTAppObserverUtil::FindDownload( + const RHttpDownload* aHttpDownload ) + { + CSVGTViewerAppDownloads* downloadItem; + TDblQueIter Iter( iDownloads ); + if ( !iDownloads.IsEmpty() ) + { + Iter.SetToFirst(); + while ( ( downloadItem = Iter ) != NULL ) + { + if ( downloadItem->DownloadHandle() == aHttpDownload ) + { + return downloadItem; + } + Iter++; + } + } + return NULL; + } +#endif + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::CSVGTAppObserverUtil +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSVGTAppObserverUtil::CSVGTAppObserverUtil( + CSVGTUIDialog* aAppDialog ) : +#ifdef SVGTVIEWERAPP_DOWNLOADMGR_ENABLED + iDownloads( CSVGTViewerAppDownloads::LinkOffset() ) , + iDownloadIter( iDownloads ), + iDownloadMenuEnabled( EFalse ), // construct header & iterator + iSynchronousDownloadStopped( EFalse ), +#endif + iAppDialog( aAppDialog ), + iSavingDone( EFalse ), + iCommandId( 0 ), +// iIsFetchImageCall(EFalse), + iTempFileUsed( EFalse ), + iDownloadDone( EFalse ), + iDownloadInProgress( EFalse ) + + { + } +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::ConstructL() + { + + // Get the CEikonEnv pointer + iEikEnv = CEikonEnv::Static(); + + // Find which drive this DLL is installed. + TFileName fileName; + + // Get the full resource file + TParse fp; + + // Add the resource dir + fp.Set( KResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL); + + // Get the filename with full path + fileName = fp.FullName(); + + BaflUtils::NearestLanguageFile( iEikEnv->FsSession(), fileName ); //for + // localization + iResourceOffset = iEikEnv->AddResourceFileL( fileName ); + + + // File manager utility needed for saving/moving files. + iFileManager = CSVGTFileManager::NewL(); + + iDocHandler = CDocumentHandler::NewL(); + +#ifdef SVGTVIEWERAPP_DOWNLOADMGR_ENABLED + TUid hostUid = iEikEnv->EikAppUi()->Application()->AppDllUid(); + + //creates a download manager session + //parameters - uid, mhttpdownloadmgrobserver + //embedded mode on - master flag True has to be passed when the app is + //in stand alone mode, false in case of embedded mode + iDownloadMgr.ConnectL( hostUid ,*this , EFalse /* Embedded mode*/); + // When SVGT Viewer exits, all the downloads are + // cancelled by the download manager + iDownloadMgr.SetIntAttribute( EDlMgrExitAction , EExitDelete ); + + iDMgrUiReg = CDownloadMgrUiLibRegistry::NewL( iDownloadMgr ); + iDMgrDownloadsList = &iDMgrUiReg->RegisterDownloadsListL(); + iDMgrUserInteractions = &iDMgrUiReg->RegisterUserInteractionsL(); + iDMgrUserInteractions->SetBoolAttributeL( CDownloadMgrUiUserInteractions::EAttrSuppressDownloadConfirmation, + ETrue ); +#endif + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::ConstructL( + RFile* aFileHdlPtr, + const TDesC& aFilename, + TBool aIsFileFullPathAvailable, + TBool aCanSaveContent, + TBool aShouldMoveContent ) + { + iIsFullFilePathValid = aIsFileFullPathAvailable; + iCanSaveContent = aCanSaveContent; + iShouldMoveContent = aShouldMoveContent; + iSvgFileId = aFileHdlPtr; + if ( aIsFileFullPathAvailable ) + { + iSvgFileName = aFilename.AllocL(); + } + else + { + TFileName fullPathName; + iSvgFileId->FullName( fullPathName ); + iSvgFileName = fullPathName.AllocL(); + } + ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::ConstructL( + RFile* aFileHdlPtr + ) + { + TBuf<1> lDummyFileName; /* This is needed by ConstructL, + but will be ignored */ + + ConstructL( aFileHdlPtr, + lDummyFileName, + EFalse /* IsFileFullPathAvailable */, + ETrue /* CanSaveContent */, + EFalse /* aShouldMoveContent */ + ); + } +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::CanShowSave +// Tells the SVG-T dialog if the save option should be displayed. +// e.g. If the dialog is launched from SVG-T viewer and which is launched +// embedded from Browser/Messaging then Save option would be displayed. +// Also when MMS launches the dialog. +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSVGTAppObserverUtil::CanShowSave() +{ + return iCanSaveContent; +} + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::CanShowSave +// Tells the SVG-T dialog if saving of the content is done. +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSVGTAppObserverUtil::IsSavingDone() +{ + return iSavingDone; +} +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::DoSaveL +// Performs the save operation on the content opened. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::DoSaveL( TInt aCommandId ) + { + iCommandId = aCommandId; + // Get filename. + // Run Dialog. + // Need to pause content + iAppDialog->ProcessCommandL( ESvgtDlgPauseCommand ); + + // Get the currently playing svg file's name and extension. + HBufC* lFileNameBuf = HBufC::NewLC( KMaxFileName ); + TPtr lFileNamePtr = lFileNameBuf->Des(); + GetFileNameAndExt( lFileNamePtr ); + + #ifndef RD_MULTIPLE_DRIVE + // Get User's choice of name and folder for target file. + TBool retval = AknCommonDialogs::RunSaveDlgNoDirectorySelectionLD( + lFileNamePtr, + R_SVGT_SAVE_LOCATIONS ); +#else + + TBool retval = AknCommonDialogsDynMem::RunSaveDlgNoDirectorySelectionLD( + AknCommonDialogsDynMem::EMemoryTypeRemote | + AknCommonDialogsDynMem::EMemoryTypePhone | + AknCommonDialogsDynMem::EMemoryTypeMMC, + lFileNamePtr, R_SVGT_SAVE_LOCATIONS); +#endif + + if ( retval ) + { + // User chose a valid file name + TBool lMoveFlag = EFalse; + TBuf<1> lDummyFileName; + RFile lDummyFile; + TInt errSaveContent = KErrNone; + TInt errSaveText = KErrNone; + + // Assume it is not the overwrite case by default + iIsOverwriteCase = EFalse; + + // Get the currently playing svg file's full path + HBufC* lFullFilePathBuf = HBufC::NewLC( KMaxFileName ); + TPtr lFullFilePathPtr = lFullFilePathBuf->Des(); + + if ( iSvgFileId ) + { + iSvgFileId->FullName( lFullFilePathPtr ); + } + // Check if file name is same as orig file -> overwrite case + if ( !( lFileNamePtr.CompareF( lFullFilePathPtr ) ) ) + { + iIsOverwriteCase = ETrue; + } + CleanupStack::PopAndDestroy( lFullFilePathBuf ); + lFullFilePathBuf = NULL; + + // Check if text edit happened + if ( iAppDialog->IsTextContentChanged() ) + { + if ( iTempFileName ) + { + delete iTempFileName; + iTempFileName = NULL; + } + iTempFileName = HBufC::NewL( KMaxFileName ); + TPtr lTempFilePtr = iTempFileName->Des(); + + // Indicate that cleanup is to be performed in SVGTSavingDoneL + iTempFileUsed = ETrue; + + TRAP( errSaveText, SaveSvgTextContentL( *iSvgFileId, lTempFilePtr ) ); + + if ( !errSaveText ) + { + // Temp file should be moved instead of + // original file + lMoveFlag = ETrue; + + if ( IsAllowMove() || iIsOverwriteCase ) + { + // Based on Move option/self overwrite case, need to close + // the content being played. + // Need to close the currently running file-handle, + // need to inform dialog to stop using it. + iAppDialog->StopUsingContentFileHandle(); + iSvgFileId->Close(); + } + + if ( IsAllowMove() ) + { + // Remember that the original file should + // be deleted if file save is successful. + iDeleteOrigFile = ETrue; + } + + + TRAP( errSaveContent, SaveContentL( + lDummyFile, + lTempFilePtr, + lFileNamePtr, + lMoveFlag )); + } + } + else // No text editing happened + { + + if ( IsAllowMove() || iIsOverwriteCase ) + { + // Based on Move option/self overwrite case, need to close + // the content being played. + // Need to close the currently running file-handle, + // need to inform dialog to stop using it. + iAppDialog->StopUsingContentFileHandle(); + iSvgFileId->Close(); + } + + if ( IsAllowMove() ) + { + lMoveFlag = ETrue; + TRAP( errSaveContent, SaveContentL( + lDummyFile, + *iSvgFileName, + lFileNamePtr, + lMoveFlag )); + } + else + { + TRAP( errSaveContent, SaveContentL( + *iSvgFileId, + lDummyFileName, + lFileNamePtr, + lMoveFlag )); + } + } + + CleanupStack::PopAndDestroy( lFileNameBuf ); + + + if ( errSaveText || errSaveContent ) + { + // If disk full problem, display note. + if ( errSaveContent == KErrDiskFull || errSaveText == KErrDiskFull ) + { + // mmc full note + HBufC* text = StringLoader::LoadLC( R_SVGT_MMC_FULL ); + CAknGlobalNote* note = CAknGlobalNote::NewLC(); + note->SetSoftkeys( R_AVKON_SOFTKEYS_OK_EMPTY__OK ); + note->ShowNoteL( EAknGlobalErrorNote, *text ); + CleanupStack::PopAndDestroy(2);// note, text + } + + // If temporary file was used, perform cleanup + if ( iTempFileUsed ) + { + if ( iTempFileName ) + { + // Try and delete the temp file, ignore the error. + iEikEnv->FsSession().Delete( iTempFileName->Des() ); + delete iTempFileName; + iTempFileName = NULL; + } + iTempFileUsed = EFalse; + } + + // If the File Couldn't be Moved, then Open the original + // file again and Set it back to dialog. + if ( IsAllowMove() ) + { + if( iSvgFileId->Open(iEikEnv->FsSession(), + iSvgFileName->Des(), EFileShareAny) != KErrNone ) + { + // This should not happen, Couldn't reopen back the + // Original content!, No Point in showing save. + iCanSaveContent = EFalse; + return; + } + else + { + iAppDialog->StartUsingContentFileHandle(); + } + } + } + else + { + LaunchWaitNoteL( R_SVGT_SAVING_WAIT_NOTE, ETrue, lDummyFileName ); + } + } + else + { + // User pressed cancel in save dialog - cleanup + CleanupStack::PopAndDestroy( lFileNameBuf ); + } + } + +EXPORT_C TInt CSVGTAppObserverUtil::NewFetchImageData( const TDesC& aUri ) + { +// iIsFetchImageCall = ETrue + TInt ret = KErrNone; + + TDownloadNeeded downloadNeeded = ELocalImageFile; + TRAPD( error, downloadNeeded = IsDownloadNeededL( aUri ) ); + + if ( error != KErrNone ) + { + return KErrNotFound; + } + + if ( downloadNeeded == ELocalImageFile ) + { + TFileName fileName; + if ( GetLocalFile( aUri, fileName, *iSvgFileName ) ) + { + TRAPD(error, DoAssignLocalFileDataL( aUri, fileName )); + return error; + } + else + { + iAppDialog->AssignImageData(aUri , NULL ); + return KErrNotFound; + } + } + else if ( downloadNeeded == ERemoteImageFile ) + { + //creatred for Dummy purpose + RFs fs; + RFile file; + + TRAPD( err,ret = StartDownloadingImageL( aUri, fs, file, + EFalse, + EFalse /* Asynchronous mode */) ); + if ( err != KErrNone ) + { + return KErrNotFound; + } + else + { + return ret; + } + + } + else + { + return KErrNotFound; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::SaveContentL +// Performs the save operation on the content opened given +// source file handle, src/dst filename and whether to move/copy. +// ----------------------------------------------------------------------------- +// +void CSVGTAppObserverUtil::SaveContentL( RFile& aSrcFileHandle, // Used in copy + const TDesC& aSrcFileName, // Used in move + TDes& aDstFileName, // Dest File name + TBool aMoveFlag ) // ETrue = Move + { + TInt ret = KErrNone; + // Start Saving Operation. + // Create directory + TInt error = iEikEnv->FsSession().MkDirAll( aDstFileName ); + if ( error != KErrNone && error != KErrAlreadyExists ) + { + User::Leave( error ); + } + + // Check if the content should be moved. e.g. In Browser case. + iFileManager->SetAllowMove( aMoveFlag ); + + // Ask FileManager to start saving. ObserverUtil acts as + // observer for filemanager operations. Based on whether + // the Move operation is required or not, + // there are two versions of filecopy operations. + // In Move Full filepath is required + if ( aMoveFlag ) + { + if ( IsFileFullPathAvailable() ) + { + // Keep the Destination file reference. + if ( iSvgDstFileName ) + { + delete iSvgDstFileName; + iSvgDstFileName = NULL; + } + iSvgDstFileName = aDstFileName.AllocL(); + + // Start the Move Now. + ret = iFileManager->StartCopyOperationL( + this, aSrcFileName, aDstFileName ); + } + else + { + // Shouldn't happen. If Move operation is required, + // Full file path must be there. + ret = KErrPathNotFound; + } + } + else + { + ret = iFileManager->StartCopyOperationL( + this, aSrcFileHandle, aDstFileName ); + } + User::LeaveIfError( ret ); + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::GetUniqueFileName +// Generates a unique filename in the private directory +// ----------------------------------------------------------------------------- +// +void CSVGTAppObserverUtil::GetUniqueFileName( TDes& aName ) const + { + TFileName lPpath; + iEikEnv->FsSession().PrivatePath( lPpath ); + RThread lThread; + _LIT( KFNameFormatStr,"%u"); + TBuf lThreadIdStr; + lThreadIdStr.Format( KFNameFormatStr, (TUint)(lThread.Id()) ); + aName.Append( lPpath ); + aName.Append( lThreadIdStr ); + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::IsGzipContent +// Checks whether the file is a GZipped content +// ----------------------------------------------------------------------------- +// +TBool CSVGTAppObserverUtil::IsGzipContent( const RFile& aFileHandle ) const +{ + TUint8 ids[2]; + TPtr8 des( ids, 0, sizeof( TUint8 ) * 2 ); + TInt zero = 0; + + // Reset to the beginning + aFileHandle.Seek( ESeekStart, zero ); + + // Read the first two bytes + if ( aFileHandle.Read( des ) != KErrNone ) + { + return EFalse; + } + + // reset to start of file + aFileHandle.Seek( ESeekStart, zero ); + return ( ids[0] == 31 && ids[1] == 139 ); +// return ( ids[0] == EZGZipFile::ID1 && ids[1] == EZGZipFile::ID2 ); +} + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::SaveSvgContent +// Saves the SVG content to a temporary file +// ----------------------------------------------------------------------------- +// +void CSVGTAppObserverUtil::SaveSvgTextContentL( const RFile& aSrcFileHandle, + TDes& aTempFileName ) + { + TFileName lTempFileName; + + // Save the content path + HBufC* lOrigFileNameBuf = HBufC::NewLC( KMaxFileName ); + TPtr lOrigFileNamePtr = lOrigFileNameBuf->Des(); + aSrcFileHandle.FullName( lOrigFileNamePtr ); + + // Create the temp file in the same drive as the content file + TParsePtrC lOrigPath( lOrigFileNamePtr ); + + // Put the drive into the path + lTempFileName.Append( lOrigPath.Drive() ); + + // lOrigFileNameBuf no longer needed. No more references to + // lOrigFileNamePtr. +// CleanupStack::PopAndDestroy( lOrigFileNameBuf ); + + // Generate a unique file name + GetUniqueFileName( lTempFileName ); + + TInt lOrigFileSize = 0; + TInt lFileSizeErr = aSrcFileHandle.Size( lOrigFileSize ); + if ( lFileSizeErr ) + { + User::Leave( lFileSizeErr ); + } + + // Check whether freespace available + // Assume that the new file occupies same amount of space as the original + // file. Not so in the case of svgz file. +#ifndef RD_MULTIPLE_DRIVE + if( lOrigPath.Drive().CompareF( PathInfo::MemoryCardRootPath().Left(2) ) + == 0 ) + { + if (SysUtil::MMCSpaceBelowCriticalLevelL(&(iEikEnv->FsSession()), + lOrigFileSize )) + { + User::Leave( KErrDiskFull ); // MMC full, Avkon shows note + } + } + else + { + if (SysUtil::FFSSpaceBelowCriticalLevelL(&(iEikEnv->FsSession()), + lOrigFileSize )) + { + User::Leave( KErrDiskFull ); // Phone memory full, Avkon shows + // note + } + } +#else +//******************* Added to support multiple drives ************************* + TInt intDrive; + TChar ch = lOrigPath.Drive()[0]; + + User::LeaveIfError( RFs::CharToDrive(ch,intDrive) ); + + if( SysUtil::DiskSpaceBelowCriticalLevelL(&(iEikEnv->FsSession()), + lOrigFileSize, intDrive )) + { + User::Leave( KErrDiskFull ); // MMC full, Avkon shows note + } + +//********************************************************************************* +#endif + // lOrigFileNameBuf no longer needed. No more references to + // lOrigFileNamePtr. + CleanupStack::PopAndDestroy( lOrigFileNameBuf ); + + // Create the directory to the temp filename + TInt lDirCreateError = iEikEnv->FsSession().MkDirAll( lTempFileName ); + + // Ignore error if the directory already exists + if ( lDirCreateError != KErrNone && lDirCreateError != KErrAlreadyExists ) + { + User::Leave( lDirCreateError ); + } + + // Save the changed SVG content to that file name + iAppDialog->SaveSvgDom( lTempFileName ); + + // Check if content is gzipped + if ( IsGzipContent( aSrcFileHandle ) ) + { + // Zip the content + } + aTempFileName = lTempFileName; + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::GetFileNameAndExt +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::GetFileNameAndExt(TDes& filename) const +{ + + // If FileName is valid use that, else check filehandle + // and give back file-name from that. + if ( iIsFullFilePathValid ) + { + if ( iSvgFileName ) + { + TParsePtrC p(*iSvgFileName); + TPtrC ptr(p.NameAndExt()); + filename = ptr; + } + } + else + { + if ( iSvgFileId ) + { + iSvgFileId->Name( filename ); + } + } + +} + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::IsAllowMove +// ----------------------------------------------------------------------------- +EXPORT_C TBool CSVGTAppObserverUtil::IsAllowMove() const +{ + return iShouldMoveContent; +} + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::IsFileFullPathAvailable +// ----------------------------------------------------------------------------- +EXPORT_C TBool CSVGTAppObserverUtil::IsFileFullPathAvailable() const + { + return 1; + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::LauncWaitNoteL +// ----------------------------------------------------------------------------- +// +void CSVGTAppObserverUtil::LaunchWaitNoteL(TInt aResourceId, + TBool aVisibilityDelayOff, const TDesC& aFileName ) + { + + delete iWaitNote; + iWaitNote = NULL; + iProgressInfo = NULL; + + if ( aResourceId == R_SVGT_DOWNLOAD_WAIT_NOTE ) + { + iWaitNote = new (ELeave) CAknWaitDialog( (CEikDialog**)&iWaitNote, + aVisibilityDelayOff ); + iWaitNote->PrepareLC(aResourceId); + + TInt resourceId = R_SVGT_DOWNLOADING_FILE; + HBufC* downloadMsg = StringLoader::LoadLC( resourceId ); + + TBuf titleString; + titleString.Append( downloadMsg->Des() ); + + CleanupStack::PopAndDestroy( downloadMsg ); // downloadMsg + + // Add a force line feed to the note: + // qtn_svgt_waiting_downloading [ Downloading file ], + // and the note will read like this: + // Downloading file + // filename + titleString.Append( KNewLineStr ); + + // Append the filename + titleString.Append( aFileName ); + + iWaitNote->SetTextL( titleString ); + + iWaitNoteState = EDownloadImageWait; + } + else if ( aResourceId == R_SVGT_SAVING_WAIT_NOTE ) + { + iWaitNote = new (ELeave) CAknProgressDialog( (CEikDialog**)&iWaitNote, + aVisibilityDelayOff ); + iWaitNote->PrepareLC(aResourceId); + iProgressInfo = iWaitNote->GetProgressInfoL(); + iProgressInfo->SetFinalValue( KSVGTPercent ); + iWaitNoteState = ESaveFileWait; + } + else + { + return; + } + + if ( iWaitNote ) + { + iWaitNote->SetCallback(this); + iWaitNote->RunLD(); + } + else + { + return; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::DialogDismissedL +// This is for CAknWaitDialog callback +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::DialogDismissedL( TInt aButtonId ) + { + + switch (aButtonId) + { + case EAknSoftkeyQuit: + { + if ( iWaitNoteState == ESaveFileWait ) + { + // Handle Save Cancel + iFileManager->CancelCopy(); + // Resume the presentation + iAppDialog->ProcessCommandL( iCommandId ); + } + else if ( iWaitNoteState == EDownloadImageWait ) + { + if ( iWait.IsStarted() ) + { + iSynchronousDownloadStopped = ETrue; + iWait.AsyncStop(); + } + } + else + { + return; + } + break; + } + default: + break; + } + } + + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::SVGTSavingDoneL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::SVGTSavingDoneL( TInt aError ) + { +#ifdef SVGTVIEWERAPP_DBG_FLAG + TBuf<40> msg; + _LIT( errorMsg, "Save Done Err %d" ); + msg.Format(errorMsg, aError ); + PrintDebugMsg( msg ); +#endif + // If temporary file was used then, perform cleanup + if ( iTempFileUsed ) + { + if ( iTempFileName ) + { + iEikEnv->FsSession().Delete( iTempFileName->Des() ); + delete iTempFileName; + iTempFileName = NULL; + } + iTempFileUsed = EFalse; + } + + // Indicate to the dialog about the save completion + iAppDialog->SaveComplete( aError ); + + if ( !aError ) + { + iSavingDone = ETrue; + } + + if( iWaitNote ) + { + if ( !aError && iProgressInfo ) + { + iProgressInfo->SetAndDraw( KSVGTPercent ); + } + iWaitNote->ProcessFinishedL(); + delete iWaitNote; + iWaitNote = NULL; + +#ifdef SVGTVIEWERAPP_DBG_FLAG + _LIT( errorMsg, "Proc Finished called" ); + PrintDebugMsg( errorMsg() ); +#endif + + } + + if ( !aError ) + { + + // "saved" note + HBufC* text = StringLoader::LoadLC(R_SVGT_CLIP_SAVED); + CAknInformationNote* dlg = new (ELeave) CAknInformationNote( ETrue ); + dlg->ExecuteLD(*text); + CleanupStack::PopAndDestroy( text ); // text + + + } + else + { + iEikEnv->HandleError( aError ); + } + + // If move allowed or it is the overwriting self case then + if ( IsAllowMove() || iIsOverwriteCase ) + { + if ( !aError ) + { + // No error occurred + + // File has been moved and source + // deleted hence don't show save now. + iCanSaveContent = EFalse; + // If It was Move operation, then Open the new file + // and give the handle to dialog. + if ( iSvgFileId->Open(iEikEnv->FsSession(), + iSvgDstFileName->Des(), EFileShareAny) != KErrNone ) + { + // Shouldn't happen. + return; + } + else + { + iAppDialog->StartUsingContentFileHandle(); + } + } + else // Error occurred while saving, try to recover + { + // If it was Move Operation, and failed, then Open + // Original Source file again and give the handle to + // dialog. Note this could fail potentially as the + // original file could have been deleted. + if ( iSvgFileId->Open(iEikEnv->FsSession(), + iSvgFileName->Des(), EFileShareAny) != KErrNone ) + { + //Inconsistent state, can't show save also. + iCanSaveContent = EFalse; + return; + } + else + { + // Can keep showing the save option still. + iAppDialog->StartUsingContentFileHandle(); + } + } + } + + if ( !aError ) + { + if ( iDeleteOrigFile ) + { + iEikEnv->FsSession().Delete( iSvgFileName->Des() ); + iSvgFileName->Des().Zero(); + } + // Pass the command id back to UiDialog + iAppDialog->ProcessCommandL( iCommandId ); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::SVGTPositionChanged +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTAppObserverUtil::SVGTPositionChanged(TInt aPosition) + { + if (iWaitNote && iProgressInfo) + { + iProgressInfo->SetAndDraw(aPosition); + } + /* + else if (iFullScreen) + { + TRAPD(ignore, iContainer->UpdateBufferingL(aPosition) ); + } // (L961) + */ + } + +#ifdef SVGTVIEWERAPP_DBG_FLAG +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::PrintDebugMsg +// ----------------------------------------------------------------------------- +// +void CSVGTAppObserverUtil::PrintDebugMsg( const TDesC& aMsg ) + { +#ifdef _DEBUG + RFileLogger::Write( KFileLoggingDir, KFileLog, + EFileLoggingModeAppend, aMsg ); +#endif + } +#endif + +// ----------------------------------------------------------------------------- +// CSVGTAppObserverUtil::DoAssignImageDataL +// Reads the downloaded file & gives data to the svg engine. +// ----------------------------------------------------------------------------- +// +void CSVGTAppObserverUtil::DoAssignImageDataL(const CSVGTViewerAppDownloads* aDownloadItem, + RHttpDownload& aDownload) + { + if( aDownloadItem && !aDownloadItem->ImageLinkFlag() ) + { + TFileName lFileName; + // Get the file path of the downloaded file + aDownload.GetStringAttribute( EDlAttrDestFilename, lFileName ); + + TInt lFileSize = 0; + RFile lSvgFile; + // Attempt to open the file in read mode + User::LeaveIfError( lSvgFile.Open(iEikEnv->FsSession(),lFileName,EFileRead ) ); + + // Save on cleanup stack + CleanupClosePushL( lSvgFile ); + + // Get the size of the data to create read buffer + User::LeaveIfError( lSvgFile.Size(lFileSize) ); + + // Create buffer that will contain the file data + HBufC8* lFileData = HBufC8::NewLC(lFileSize); + TPtr8 lFileDataPtr(lFileData->Des()); + + // Read from the file + User::LeaveIfError( lSvgFile.Read(lFileDataPtr) ); + + // Create buffer to store the URI of the file + HBufC* lUriBuf = HBufC::NewLC( KMaxUrlLength ); + TPtr lUriPtr(lUriBuf->Des()); + + // Get the URI from data structure + aDownload.GetStringAttribute( EDlAttrReqUrl, lUriPtr ); + + // Call the AssignImageData function + // Mapping is maintained between URI <-> FileData + iAppDialog->AssignImageData(lUriPtr , lFileData ); + + CleanupStack::PopAndDestroy( lUriBuf ); + CleanupStack::Pop( lFileData ); + CleanupStack::PopAndDestroy(&lSvgFile); // lSvgFile.Close() + } + } + +void CSVGTAppObserverUtil::DoAssignLocalFileDataL( const TDesC& aOriginalUri, + const TDesC& aNewUri ) const + { + TInt lFileSize = 0; + TBuflFileName; + lFileName.Copy(aNewUri); + RFile lSvgFile; + // Attempt to open the file in read mode + User::LeaveIfError( lSvgFile.Open(iEikEnv->FsSession(),lFileName,EFileRead ) ); + + // Save on cleanup stack + CleanupClosePushL( lSvgFile ); + + // Get the size of the data to create read buffer + User::LeaveIfError( lSvgFile.Size(lFileSize) ); + // Create buffer that will contain the file data + HBufC8* lFileData = HBufC8::NewLC(lFileSize); + TPtr8 lFileDataPtr(lFileData->Des()); + // Read from the file + User::LeaveIfError( lSvgFile.Read(lFileDataPtr) ); + + // Call the AssignImageData function + // Mapping is maintained between URI <-> FileData + iAppDialog->AssignImageData(aOriginalUri , lFileData ); + + CleanupStack::Pop( lFileData ); + CleanupStack::PopAndDestroy(&lSvgFile); // lSvgFile.Close() + } + +EXPORT_C void CSVGTAppObserverUtil::AssignEmbededDataL( const TDesC& aUri ) + { + HBufC8* decoded = DoGetProcessedEmbededDataL( aUri ); + if ( decoded ) + { + iAppDialog->AssignImageData( aUri, decoded ); + } + } + +HBufC8* CSVGTAppObserverUtil::DoGetProcessedEmbededDataL( const TDesC& aXlinkHrefValue ) const + { + HBufC8* retPtr = NULL; + // find positions for ';' and ',' to determine encoding, mimetype + TInt startIndex = aXlinkHrefValue.Locate( ';' ); + TInt endIndex = aXlinkHrefValue.Locate( ',' ); + + // mimetype is after 'data:' : xlink:href="data:image/png;base64, + // ignore mimetype extraction, decode will detect mimetype from decoded data. + + if ( startIndex != KErrNotFound && + endIndex != KErrNotFound && + startIndex < endIndex ) + { + // extract encoding type + TPtrC encoding( aXlinkHrefValue.Left( endIndex ).Right( endIndex - startIndex - 1 ) ); + // handle Base64 encoding + _LIT( KEncodingBase64, "base64" ); + if ( encoding == KEncodingBase64 ) + { + // find index of first character after white-space + TInt index = endIndex + 1; + while ( index < aXlinkHrefValue.Length() && TChar( aXlinkHrefValue[index] ).IsSpace() ) + index++; + + // must be 8-bit + TInt length = aXlinkHrefValue.Length() - index; + HBufC8* encoded = HBufC8::NewLC( length ); + encoded->Des().Copy( aXlinkHrefValue.Right( length ) ); + + HBufC8* decoded = HBufC8::NewLC( length ); + TPtr8 decodedDes = decoded->Des(); + + // decode + TImCodecB64 encodingBase64; + TInt decodeError = encodingBase64.Decode( *encoded, decodedDes ); + + // Cleanup + CleanupStack::Pop( decoded ); // encoded, decoded + CleanupStack::PopAndDestroy( encoded ); + //delete encoded; + + // Check for decoding error + if ( decodeError != KErrNone ) + { + delete decoded; + } + else + { + retPtr = decoded; + } + } + } + return retPtr; + } + TBool CSVGTAppObserverUtil::ExitWhenOrientationChange() + { + return EFalse; + } + +// End of File + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppObserverUtilSrc/SVGTFileManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppObserverUtilSrc/SVGTFileManager.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,370 @@ +/* +* Copyright (c) 2004, 2005 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: File operations, used when "Save" option is selected. +* +*/ + + + +// INCLUDE FILES + +#include +#include +#include +#include + +#include "SVGTViewerAppDbgFlags.hrh" +#include "SVGTFileManager.h" +#include "SVGTUISaveListener.h" + + +#ifdef SVGTVIEWERAPP_DBG_FLAG +_LIT( KFileLoggingDir, "SVGTViewer" ); +_LIT( KFileLog, "SaveLog.txt" ); +#endif + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::CSVGTFileManager +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSVGTFileManager::CSVGTFileManager() : CActive(0) + { + } + + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSVGTFileManager::ConstructL() + { + iEikEnv = CEikonEnv::Static(); + iFileMan = CFileMan::NewL( iEikEnv->FsSession(),this ); + iProgressUpdater = CPeriodic::NewL( 0 ); + // Add this active object to the scheduler. + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSVGTFileManager* CSVGTFileManager::NewL() + { + CSVGTFileManager* self = new( ELeave ) CSVGTFileManager(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::~CSVGTFileManager +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSVGTFileManager::~CSVGTFileManager() + { + delete iFileMan; + delete iProgressUpdater; + // Reset the callback implementation pointer + iCallback = NULL; + // Reset the environment pointer + iEikEnv = NULL; + } + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::StartCopyOperationL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CSVGTFileManager::StartCopyOperationL( + MSVGTUISaveListener* aCallback, const TDesC& anOld, const TDesC& aNew ) + { + if (IsActive()) + { + return KErrInUse; + } + + iPosition = 0; + iCancel = EFalse; + RFile lFile; + TInt RetVal = KErrNone;//return value + iCallback = aCallback; + RetVal = lFile.Open(iEikEnv->FsSession(),anOld, EFileRead); + if ( RetVal != KErrNone) + { + // if there was a problem opening this file then this should return here + //itself. Or else RTIY-6JNVHS error would occur. + return RetVal ; + } + lFile.Size(iFileSize);//get the file size into iFileSize + lFile.Close();//no filehandle should be open while doing a "move" + + +#ifdef SVGTVIEWERAPP_DBG_FLAG + _LIT( errorMsg2, "Size read"); + PrintDebugMsg( errorMsg2 ); +#endif + + // Check disk space + TParsePtrC parse(aNew); + +#ifndef RD_MULTIPLE_DRIVE + if( parse.Drive().CompareF( PathInfo::MemoryCardRootPath().Left(2) ) == 0 ) + { + if (SysUtil::MMCSpaceBelowCriticalLevelL(&(iEikEnv->FsSession()),iFileSize)) + { + return KErrDiskFull; // UI shows note + } + } + else + { + if (SysUtil::FFSSpaceBelowCriticalLevelL(&(iEikEnv->FsSession()),iFileSize)) + { + User::Leave(KErrDiskFull); // Phone memory full, Avkon shows note + } + } +#else +//********************** Added the support for multiple drive ************************ + TInt intDrive; + TChar ch = parse.Drive()[0]; + + User::LeaveIfError( RFs::CharToDrive(ch,intDrive) ); + + if( SysUtil::DiskSpaceBelowCriticalLevelL(&(iEikEnv->FsSession()), + iFileSize, intDrive )) + { + User::Leave( KErrDiskFull); // Disk full, Avkon shows note + } + +//************************************************************************************ + +#endif + + // start copying + if( iMove ) + { + User::LeaveIfError( + iFileMan->Move(anOld,aNew,CFileMan::EOverWrite,iStatus)); + } + + if ( !iProgressUpdater->IsActive() ) + { + // start progress updater + iProgressUpdater->Start(KSVGTOneSecond,KSVGTOneSecond, + TCallBack(CSVGTFileManager::ProgressUpdate, this)); + + } + + + SetActive(); + + return RetVal; + } + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::StartCopyOperationL +// Overloaded version with RFile Input. +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CSVGTFileManager::StartCopyOperationL( + MSVGTUISaveListener* aCallback, RFile& aSrcHandle, const TDesC& aNew ) + { + TFileName sourceFileName; + aSrcHandle.FullName( sourceFileName ); + aSrcHandle.Size(iFileSize); + if ( iMove ) + { + aSrcHandle.Close(); + return StartCopyOperationL( aCallback, sourceFileName, aNew ); + } + else + { + + if (IsActive()) + { + return KErrInUse; + } + + iPosition = 0; + iCancel = EFalse; + + iCallback = aCallback; + + + // Check disk space + TParsePtrC parse(aNew); + +#ifndef RD_MULTIPLE_DRIVE + if( parse.Drive().CompareF( PathInfo::MemoryCardRootPath().Left(2) ) == 0 ) + { + if (SysUtil::MMCSpaceBelowCriticalLevelL(&(iEikEnv->FsSession()),iFileSize)) + { + return KErrDiskFull; // UI shows note + } + } + else + { + if (SysUtil::FFSSpaceBelowCriticalLevelL(&(iEikEnv->FsSession()),iFileSize)) + { + User::Leave(KErrDiskFull); // Phone memory full, Avkon shows note + } + } +#else +//********************** Added the support for multiple drive ************************ + TInt intDrive; + TChar ch = parse.Drive()[0]; + + User::LeaveIfError( RFs::CharToDrive(ch,intDrive) ); + + if( SysUtil::DiskSpaceBelowCriticalLevelL(&(iEikEnv->FsSession()), + iFileSize, intDrive )) + { + User::Leave( KErrDiskFull); // Disk full, Avkon shows note + } + +//************************************************************************************ + +#endif + + User::LeaveIfError( + iFileMan->Copy(aSrcHandle,aNew,CFileMan::EOverWrite,iStatus)); + + + if ( !iProgressUpdater->IsActive() ) + { + // start progress updater + iProgressUpdater->Start(KSVGTOneSecond,KSVGTOneSecond, + TCallBack(CSVGTFileManager::ProgressUpdate, this)); + + } + SetActive(); + return KErrNone; + + } + } +// ----------------------------------------------------------------------------- +// CSVGTFileManager::DoCancel +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTFileManager::CancelCopy() + { + iCancel = ETrue; + iProgressUpdater->Cancel(); + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::SetAllowMove +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSVGTFileManager::SetAllowMove( TInt32 aValue ) + { + iMove = aValue; + } + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::RunL +// ----------------------------------------------------------------------------- +// +void CSVGTFileManager::RunL() + { + iProgressUpdater->Cancel(); + + if (iCallback) + { + if (iCancel) + { + iCallback->SVGTSavingDoneL(KErrCancel); + } + else + { + iCallback->SVGTSavingDoneL(iStatus.Int()); + } + } + } + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::NotifyFileManOperation +// ----------------------------------------------------------------------------- +// +MFileManObserver::TControl CSVGTFileManager::NotifyFileManOperation() + { + if (iCancel) + { + return MFileManObserver::ECancel; + } +#ifdef SVGTVIEWERAPP_DBG_FLAG + TBuf<40> msg; + _LIT( errorMsg, "NotifyFileManOperation %d"); + msg.Format(errorMsg, iFileMan->BytesTransferredByCopyStep() ); + PrintDebugMsg( msg ); +#endif + iPosition += iFileMan->BytesTransferredByCopyStep(); + return MFileManObserver::EContinue; + } + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::DoCancel +// ----------------------------------------------------------------------------- +// +void CSVGTFileManager::DoCancel() + { + } + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::ProgressUpdate +// ----------------------------------------------------------------------------- +// +TInt CSVGTFileManager::ProgressUpdate(TAny* aPtr) + { + if ( aPtr ) + { + static_cast(aPtr)->DoProgressUpdate(); + } + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CSVGTFileManager::DoProgressUpdate +// ----------------------------------------------------------------------------- +// +void CSVGTFileManager::DoProgressUpdate() + { + if (iCallback) + { + iCallback->SVGTPositionChanged((iPosition*KSVGTPercent)/iFileSize); + } + } +#ifdef SVGTVIEWERAPP_DBG_FLAG +// ----------------------------------------------------------------------------- +// CSVGTFileManager::PrintDebugMsg +// ----------------------------------------------------------------------------- +// +void CSVGTFileManager::PrintDebugMsg( const TDesC& aMsg ) + { +#ifdef _DEBUG + RFileLogger::Write( KFileLoggingDir, KFileLog, + EFileLoggingModeAppend, aMsg ); +#endif + } +#endif + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppObserverUtilSrc/SVGTViewerAppDownloads.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppObserverUtilSrc/SVGTViewerAppDownloads.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2004,2005 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: This class defines the downloads and the required attributes. +* +*/ + + + +// INCLUDE FILES +#include // TFileName + +#include "SVGTViewerAppDownloads.h" + + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSVGTViewerAppDownloads* CSVGTViewerAppDownloads::NewL( + TBool aIsEmbedded, + TBool aIsSynchronous, + TBool aLinkFlag ) + + { + CSVGTViewerAppDownloads* self = CSVGTViewerAppDownloads::NewLC( + aIsEmbedded, aIsSynchronous, aLinkFlag); + CleanupStack::Pop( self ); + return self; + + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSVGTViewerAppDownloads* CSVGTViewerAppDownloads::NewLC( + TBool aIsEmbedded, + TBool aIsSynchronous , + TBool aLinkFlag ) + + { + CSVGTViewerAppDownloads* self = new( ELeave ) CSVGTViewerAppDownloads( + aIsEmbedded, aIsSynchronous, aLinkFlag ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CSVGTViewerAppDownloads::~CSVGTViewerAppDownloads() + { + // Reset the Http Download Handle as it is owned by caller + iHttpDownload = NULL; + } +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::LinkOffset() +// ----------------------------------------------------------------------------- +TInt CSVGTViewerAppDownloads::LinkOffset() + { + return _FOFF(CSVGTViewerAppDownloads,iLink); + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::FileName +// Returns the file name associated with the download. +// ----------------------------------------------------------------------------- +// +TFileName CSVGTViewerAppDownloads::FileName() const + { + return iFileName; + } +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::EmbeddedMode +// Returns the EmbeddedMode flag associated with the download. +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppDownloads::EmbeddedMode() const + { + return iEmbeddedMode; + } +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::SynchronousMode +// Returns the SynchronousMode flag associated with the download. +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppDownloads::SynchronousMode() const + { + return iSynchronousMode; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::DownloadCompleted +// Returns the DownloadCompleted flag associated with the download. +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppDownloads::DownloadCompleted() const + { + return iDownloadCompleted; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::QueLink +// This Function returns the download handle associated with the download +// ----------------------------------------------------------------------------- +// +TDblQueLink CSVGTViewerAppDownloads::QueLink() const + { + return iLink; + } +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::Download +// This Function returns the download handle associated with the download +// ----------------------------------------------------------------------------- +// +RHttpDownload* CSVGTViewerAppDownloads::DownloadHandle() + { + return iHttpDownload; + } + +TBool CSVGTViewerAppDownloads::ImageLinkFlag() const + { + return iImageLinkFlag; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::SetFileName +// This Function Sets the filename associated with the download +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppDownloads::SetFileName( const TDesC& aFileName ) + { + iFileName = aFileName; + } +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::SetEmbeddedMode +// This function sets the EmbeddedMode flag associated with the download. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppDownloads::SetEmbeddedMode( TBool aEmbeddedMode ) + { + iEmbeddedMode = aEmbeddedMode; + } +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::SetSynchronousMode +// This function sets the SynchronousMode flag associated with the download. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppDownloads::SetSynchronousMode( TBool aSynchronousMode ) + { + iSynchronousMode = aSynchronousMode; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::SetDownloadCompleted +// This function sets the Downloadcompleted flag associated with the download. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppDownloads::SetDownloadCompleted( TBool aDownloadCompleted ) + { + iDownloadCompleted = aDownloadCompleted; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::SetDownloadHandle +// This function sets the Download handle associated with the download. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppDownloads::SetDownloadHandle( RHttpDownload* aDownloadHandle ) + { + iHttpDownload = aDownloadHandle; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::SetImageLinkFlag +// Image flag to distinguish the Embeded & hyperlink. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppDownloads::SetImageLinkFlag(TBool aLinkFlag) + { + iImageLinkFlag = aLinkFlag; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::CSVGTViewerAppDownloads +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSVGTViewerAppDownloads::CSVGTViewerAppDownloads( TBool aIsEmbedded, + TBool aIsSynchronous , TBool aLinkFlag ) : + iEmbeddedMode( aIsEmbedded ), + iSynchronousMode( aIsSynchronous ), + iDownloadCompleted( EFalse ), + iImageLinkFlag(aLinkFlag) + { + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDownloads::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppDownloads::ConstructL() + { + } +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppSrc/SVGTViewerApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppSrc/SVGTViewerApp.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2004,2005 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: Application Entry point for SVGT Viewer App. +* +*/ + + + +// INCLUDE FILES +#include +#include "SVGTViewerAppApplication.h" + +// ----------------------------------------------------------------------------- +// NewApplication implements... +// Creates the SVGT Viewer Application. +// ----------------------------------------------------------------------------- +// +LOCAL_C CApaApplication* NewApplication() + { + return ( static_cast( new CSVGTViewerAppApplication ) ); + } + +// ----------------------------------------------------------------------------- +// E32Main implements... +// Executable entry point. +// ----------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication( NewApplication ); + } + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppSrc/SVGTViewerAppAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppSrc/SVGTViewerAppAppUi.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,686 @@ +/* +* Copyright (c) 2004,2005 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: AppUI for SVGT Viewer App. +* +*/ + + +#include +#include +#include +#include // RWsSession +#include +#include // For call handling +#include +#include +#include +#include +#include +#include "SVGTViewerAppDbgFlags.hrh" +#include "SVGTViewerAppAppUi.h" +#include "SVGTViewerAppDocument.h" +#include "SVGTViewerApp.pan" +#include "SVGTUIDialog.h" +#include "SVGTViewerApp.hrh" + + +#include "SvgtViewerAppView.h" + +#ifdef RD_MULTIPLE_DRIVE +#include +#include +#endif +// Constants + +#ifdef SVGTVIEWERAPP_DBG_OPEN_HARDCODE_FILE +_LIT(KDummyTstFileName, "c:\\data\\images\\01-guide.svg"); +#endif + +// Constant for periodic timer +const TInt KOneMicroSec = 1; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::CSVGTViewerAppAppUi +// Default Constructor for CSVGTViewerAppAppUi. +// ----------------------------------------------------------------------------- +// +CSVGTViewerAppAppUi::CSVGTViewerAppAppUi() + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::ConstructL +// Second Phase constructor for CSVGTViewerAppAppUi. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppAppUi::ConstructL() + { + BaseConstructL( EAknEnableSkin|EAknEnableMSK ); // Enable skin support and MSK label + // for this Application + + ResetEmbeddedAppRunning(); //By default, there are no embedded app started. + + iContainer = new (ELeave) CSvgtViewerAppView; + iContainer->ConstructL(ClientRect()); + // add container to stack; enables key event handling. + AddToStackL(iContainer); + +#ifndef SVGTVIEWERAPP_DBG_OPEN_HARDCODE_FILE + // Launch file only in non-hardcoded option. + // Start an idle timer to start the dialog synchronously. + iIdleTimer = CPeriodic::NewL(CActive::EPriorityIdle); + // Using the periodic timer so that active object for + // open file service gets a chance to execute + iIdleTimer->Start(KOneMicroSec, KOneMicroSec, + TCallBack(CallBackFuncL,this)); +#endif + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CSVGTViewerAppAppUi::~CSVGTViewerAppAppUi() + { + iAppDialog = NULL; + iAppObserver = NULL; + if ( iIdleTimer ) + { + delete iIdleTimer; + iIdleTimer = NULL; + } + + RemoveFromStack(iContainer); + delete iContainer; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::HandleCommandL +// Reimplements CAknAppUi::HandleCommandL inorder to handle commands. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppAppUi::HandleCommandL( TInt aCommand ) + { +#ifdef SVGTVIEWERAPP_DBG_OPEN_HARDCODE_FILE + TFileName fileName; +#endif + switch ( aCommand ) + { + case EEikCmdExit: + case EAknSoftkeyExit: + Exit(); + break; + case ESVGTViewerAppCommand1: +#ifdef _DEBUG + iEikonEnv->InfoMsg( _L( "not implemented" ) ); +#endif +#ifdef SVGTVIEWERAPP_DBG_OPEN_HARDCODE_FILE + fileName.Append( KDummyTstFileName ); + OpenFileL( fileName ); +#endif + break; + + default: + break; + } + } + + + + + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::OpenFileL +// Reimplements CAknAppUi::OpenFileL inorder to provide for opening SVG +// content through doc handler. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppAppUi::OpenFileL( + RFile& aFileHandle ) // File Handle to + // SVGT content + { + // Display an info note if a video call is in progress. + // SVG content cannot be displayed in this case. + if ( IsVideoCall() ) + { + HBufC* text = StringLoader::LoadLC( + R_SVGT_VIEWER_INFO_VIDEO_CALL_ONGOING ); + CAknInformationNote* dlg = new (ELeave) CAknInformationNote( ETrue ); + dlg->ExecuteLD( text->Des() ); + CleanupStack::PopAndDestroy( text ); // text + Exit(); + } + + TRAPD( err, iAppDialog = CSVGTUIDialog::NewL() ); + + if ( err != KErrNone ) + { + // Reset the pointer to dialog + iAppDialog = NULL; + iEikonEnv->HandleError( err ); + Exit(); + } + + // Get the File's fullpath, Handle and pass it to App Observer Util. + TFileName filename; + CSVGTViewerAppDocument *appDocument = + static_cast< CSVGTViewerAppDocument* >(iDocument); + + if ( appDocument->IsFileFullPathAvailable() ) + { + appDocument->GetFileFullPath(filename); + } + + TRAP( err, iAppObserver = CSVGTAppObserverUtil::NewL( iAppDialog, + &aFileHandle, + filename, + appDocument->IsFileFullPathAvailable(), + CanShowSave(), + ShouldMoveContent()) ); + if ( err != KErrNone ) + { + // Delete the dialog + delete iAppDialog; + // Reset the dialog pointer + iAppDialog = NULL; + // Reset the App Observer Pointer + iAppObserver = NULL; + iEikonEnv->HandleError( err ); + Exit(); + } + + if( iAppDialog ) + { + TRAP( err, iAppDialog->ExecuteLD( aFileHandle, iAppObserver ) ); + if ( err != KErrNone ) + { + if( err == KLeaveExit ) + { + delete iAppDialog; + delete iAppObserver; + + iAppObserver = NULL; + iAppDialog = NULL; + + Exit(); + } + // Reset the dialog pointer + iAppDialog = NULL; + // Delete the app observer + delete iAppObserver; + iEikonEnv->HandleError( err ); + Exit(); + } + } + // Delete the app observer + delete iAppObserver; + + // Reset the App Observer Pointer + iAppObserver = NULL; + + // Dialog has destroyed itself, Reset the pointer + iAppDialog = NULL; + + Exit(); + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::OpenFileL +// Reimplements CAknAppUi::OpenFileL inorder to provide for opening SVG +// content through doc handler. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppAppUi::OpenFileL( + const TDesC& aFileName) // File Name of SVGT content + { + // Display an info note if a video call is in progress. + // SVG content cannot be displayed in this case. + if ( IsVideoCall() ) + { + HBufC* text = StringLoader::LoadLC( + R_SVGT_VIEWER_INFO_VIDEO_CALL_ONGOING ); + CAknInformationNote* dlg = new (ELeave) CAknInformationNote( ETrue ); + dlg->ExecuteLD( text->Des() ); + CleanupStack::PopAndDestroy( text ); // text + Exit(); + } + + // Open File Handle for the file + + RFile fileHandle; + TInt err = fileHandle.Open( iEikonEnv->FsSession(), + aFileName, EFileShareAny ); + if ( err != KErrNone ) + { + iEikonEnv->HandleError( err ); + Exit(); + } + + + TRAP( err, iAppDialog = CSVGTUIDialog::NewL() ); + if ( err != KErrNone ) + { + // Reset the Dialog pointer + iAppDialog = NULL; + // Close the file handle + fileHandle.Close(); + + iEikonEnv->HandleError( err ); + Exit(); + } + + TRAP( err, + iAppObserver = CSVGTAppObserverUtil::NewL( iAppDialog, + &fileHandle, + aFileName, + ETrue, + CanShowSave(), + ShouldMoveContent() ) ); + if ( err != KErrNone ) + { + // Reset the AppObserver Pointer + iAppObserver = NULL; + // Reset the Dialog pointer + iAppDialog = NULL; + // Close the file handle + fileHandle.Close(); + + iEikonEnv->HandleError( err ); + Exit(); + } + + if( iAppDialog ) + { + TRAP( err, iAppDialog->ExecuteLD( fileHandle, iAppObserver ) ); + + if ( err != KErrNone ) + { + if( err == KLeaveExit ) + { + delete iAppDialog; + delete iAppObserver; + + iAppObserver = NULL; + iAppDialog = NULL; + + Exit(); + } + // Delete the AppObserver Pointer + delete iAppObserver; + // Reset the AppObserver Pointer + iAppObserver = NULL; + // Reset the Dialog pointer + iAppDialog = NULL; + // Close the file handle + fileHandle.Close(); + + iEikonEnv->HandleError( err ); + Exit(); + } + } + + // Delete the App Observer + delete iAppObserver; + + // Reset the App Observer pointer + iAppObserver = NULL; + + // Dialog has destroyed itself, Reset the pointer + iAppDialog = NULL; + + // Close the file handle and session + fileHandle.Close(); + + Exit(); + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::SetAllowMove +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppAppUi::SetAllowMove(TInt32 aMoveAllowed) + { + iMoveAllowed = aMoveAllowed; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::ProcessCommandParametersL +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppAppUi::ProcessCommandParametersL( + TApaCommand /* aCommand */ , + TFileName& aDocumentName, + const TDesC8& /* aTail */ ) + { + return ConeUtils::FileExists(aDocumentName); + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::HandleScreenDeviceChangedL +// Handle the screen size being changed +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppAppUi::HandleScreenDeviceChangedL() + { + CAknAppUiBase::HandleScreenDeviceChangedL(); + } +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::HandleResourceChangeL +// Handle the screen size being changed +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppAppUi::HandleResourceChangeL( TInt aType ) + { + CAknAppUi::HandleResourceChangeL( aType ); + } +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::HandleForegroundEventL +// App Framework calls this api to give background/foreground events to the +// application. Param: aForeground : ETrue: Foreground. EFalse: Background. +// ----------------------------------------------------------------------------- +// + +void CSVGTViewerAppAppUi::HandleForegroundEventL( TBool aForeground ) + { + // Pass the application foreground or goes to background, + // give the events to the underlying dialog and the custom + // control so that the animation is paused when app goes + // to background and so on. But the app might have + // opened another application embedded (Browser or another + // viewer). So need to qualify these events with these + // conditions. Whenever opening/closing another app + // embedded, need to pass background/foreground events to + // dialog, and call Set/ResetEmbeddedAppRunning. + + // Passing the event to the base class + CAknAppUi::HandleForegroundEventL( aForeground ); + + if ( !IsEmbeddedAppRunning() ) + { + if ( iAppDialog ) + { + iAppDialog->HandleApplicationForegroundEvent( + aForeground ); + } + + } + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::IsVideoCall() +// Used to find out if the videocall is going on. The +// viewer is not allowed to open if viedo call is +// going on. +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppAppUi::IsVideoCall() const + { + TBool lVideoCallConnected = EFalse; + TInt lType = 0; + TInt error = RProperty::Get( KPSUidCtsyCallInformation, + KCTsyCallType, lType ); + + // EPSTelephonyCallTypeH324Multimedia is used for 3G video calls + if ( !error && lType == EPSCTsyCallTypeH324Multimedia ) + { + // Call is of video call, check whether call is connected + TInt lState = 0; + error = RProperty::Get( KPSUidCtsyCallInformation, + KCTsyCallState, lState ); + if ( !error && + ( lState != EPSCTsyCallStateUninitialized && + lState != EPSCTsyCallStateNone && + lState != EPSCTsyCallStateDisconnecting ) ) + { + lVideoCallConnected = ETrue; + } + } + return lVideoCallConnected; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::IsEmbeddedAppRunning() +// Used to find out if viewer application has in turn +// started an embedded application. +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppAppUi::IsEmbeddedAppRunning() const + { + return iEmbeddedAppRunning; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::SetEmbeddedAppRunning() +// Used to set state in Viewer application if it has in turn +// started an embedded application. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppAppUi::SetEmbeddedAppRunning() + { + iEmbeddedAppRunning = ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::ResetEmbeddedAppRunning() +// Used to set state in viewer application if embedded +// application started by it is closed now. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppAppUi::ResetEmbeddedAppRunning() + { + iEmbeddedAppRunning = EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::CallBackFuncL() +// Used to callback by the idle timer in order to launch +// the dialog +// ----------------------------------------------------------------------------- +// +TInt CSVGTViewerAppAppUi::CallBackFuncL(TAny *aPtr) + { + CSVGTViewerAppAppUi* appUi = + static_cast< CSVGTViewerAppAppUi* >( aPtr ); + if ( appUi ) + { + return ( appUi->LaunchDialogL() ); + } + else + { + // To indicate that the timer is not + // called again, return false to the timer + // RunL + return ( EFalse ); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::LaunchDialogL() +// This function accesses the document and launches the +// content. +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppAppUi::LaunchDialogL() + { + // Check if file-handle in document is valid + if ( static_cast< CSVGTViewerAppDocument* > + (iDocument)->IsFileHandleValid() ) + { + // Obtain the file-handle + RFile& fileHandle = + (static_cast< CSVGTViewerAppDocument* > + (iDocument)->GetSvgtContentFileHandle()); + + // Cancel the periodic timer + if ( iIdleTimer->IsActive() ) + { + iIdleTimer->Cancel(); + } + + // Launch the content + OpenFileL( fileHandle ); + + // Delete and reset the idle-timer + delete iIdleTimer; + iIdleTimer = NULL; + + // Return False to indicate that + // timer need not callback further. + return EFalse; + + } + else + { + // Return True to indicate that the + // timer needs to callback this function + // again, as the file-handle is not valid + // yet. + return ETrue; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::WeAreEmbedded +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppAppUi::WeAreEmbedded() const +{ + // SVGT-Viewer will be opened in embedded mode always + return ETrue; +} + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::CanShowSave +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppAppUi::CanShowSave() const + { + // By default dont show the save option + TBool ret = EFalse; + + // Check if we are launched embedded + if (WeAreEmbedded()) + { + // If the file is not a local file then + // display the save option + if ( !IsLocalFile() ) + { + ret = ETrue; + } + } + return ret; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::ShouldMoveContent +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppAppUi::ShouldMoveContent() const + { + return iMoveAllowed; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::IsLocalFile +// This function returns ETrue if file is local, EFalse otherwise +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppAppUi::IsLocalFile() const + { + // By default file is not local + TBool isLocal = EFalse; + + // Obtain the file-handle + RFile& fileHandle = (static_cast + (iDocument)->GetSvgtContentFileHandle()); + // Check whether local/remote + TRAP_IGNORE( isLocal = IsLocalFileL( fileHandle ) ); + + return isLocal; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppAppUi::IsLocalFileL +// This function checks whether the filepath of the content opened is +// in the PHONE_MEMORY_IMAGES_PATH or MEMORYCARD_IMAGES_PATH +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppAppUi::IsLocalFileL( RFile& aFileHandle ) const + { + // By default file is not local + TBool retVal = EFalse; + +#ifdef RD_MULTIPLE_DRIVE + + HBufC* fileNameBuf = HBufC::NewLC( KMaxFileName ); + TPtr fileNamePtr = fileNameBuf->Des(); + aFileHandle.FullName( fileNamePtr ); + + RFs fsSession = iEikonEnv->FsSession(); + TName driveRootPath; + + TInt intDrive; + DriveInfo::TDriveArray driveArray; + User::LeaveIfError( DriveInfo::GetUserVisibleDrives( fsSession, driveArray ) ); + for(TInt i=0; i < driveArray.Count(); i++) + { + TChar driveLetter = driveArray.LetterAt(i); + User::LeaveIfError( RFs::CharToDrive(driveLetter, intDrive) ); + User::LeaveIfError( PathInfo::GetRootPath(driveRootPath, intDrive) ); + + // Check whether filepath consists of phone mem path or mmc path + if ( driveRootPath.FindF( fileNamePtr.Left(driveRootPath.Length() ) ) != KErrNotFound ) + { + // Path Found means file is local + retVal = ETrue; + break; + } + } + + CleanupStack::PopAndDestroy( fileNameBuf ); +#else + // Get the phone memory path + HBufC* phoneMemImgPath = iEikonEnv->AllocReadResourceLC( + R_SVGT_VIEWER_PHONE_MEMORY_IMAGES_PATH ); + + // Get the Memory Card path + HBufC* memCardImgPath = iEikonEnv->AllocReadResourceLC( + R_SVGT_VIEWER_MEMORYCARD_IMAGES_PATH ); + + // Get the content filename + HBufC* fileNameBuf = HBufC::NewLC( KMaxFileName ); + TPtr fileNamePtr = fileNameBuf->Des(); + aFileHandle.FullName( fileNamePtr ); + + // Check whether filepath consists of phone mem path or mmc path + if ( phoneMemImgPath->FindF( fileNamePtr.Left( + phoneMemImgPath->Length() ) ) != KErrNotFound + || memCardImgPath->FindF( fileNamePtr.Left( + memCardImgPath->Length() ) ) != KErrNotFound ) + { + // Path Found means file is local + retVal = ETrue; + } + + // Perform Cleanup + CleanupStack::PopAndDestroy( fileNameBuf ); + CleanupStack::PopAndDestroy( memCardImgPath ); + CleanupStack::PopAndDestroy( phoneMemImgPath ); +#endif + + return retVal; + } +//End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppSrc/SVGTViewerAppApplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppSrc/SVGTViewerAppApplication.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2004,2005 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: Application Class for SVGT Viewer +* +*/ + + + +// INCLUDE FILES +#include +#include "SVGTViewerAppApplication.h" +#include "SVGTViewerAppDocument.h" + +// Constants + +// UID for the application; this should correspond to the uid defined in the mmp file +const TUid KUidSVGTViewerAppApp = { 0x101F874A }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppApplication::AppDllUid +// Reimplements CApaApplication::AppDllUid inorder to return SVGT Viewer App's +// UID +// Returns: TUid ; SVGT Viewer App UID +// ----------------------------------------------------------------------------- +// +TUid CSVGTViewerAppApplication::AppDllUid() const + { + // Return the UID for the SVGTViewerApp application + return KUidSVGTViewerAppApp; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppApplication::CreateDocumentL +// Invokes the factory function for the Document Class. Called by the +// framework. +// Returns: CApaDocument* ; Pointer to the created Document Class +// ----------------------------------------------------------------------------- +// +CApaDocument* CSVGTViewerAppApplication::CreateDocumentL() + { + // Create an SVGTViewerApp document, and return a pointer to it + return ( static_cast< CApaDocument* >( + CSVGTViewerAppDocument::NewL( *this ) ) ); + } + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppSrc/SVGTViewerAppDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppSrc/SVGTViewerAppDocument.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,296 @@ +/* +* Copyright (c) 2004,2005 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: Document for SVGT Viewer +* +*/ + +#include +#include +#include +#include + +#include "SVGTViewerAppAppUi.h" +#include "SVGTViewerAppDocument.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::CSVGTViewerAppDocument +// Default Constructor for CSVGTViewerAppDocument. +// ----------------------------------------------------------------------------- +// +CSVGTViewerAppDocument::CSVGTViewerAppDocument( + CEikApplication& aApp ) : // Reference to application object + CAiwGenericParamConsumer( aApp ), + iIsFileHandleValid( EFalse ) + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::ConstructL +// Second Phase constructor for CSVGTViewerAppDocument. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppDocument::ConstructL() + { + iIsFileFullPathValid = EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::NewL +// Factory function for creation of CSVGTViewerAppDocument. +// Returns: CSVGTViewerAppDocument* ; Pointer to created object +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSVGTViewerAppDocument* CSVGTViewerAppDocument::NewL( + CEikApplication& aApp ) // Reference to application object + { + CSVGTViewerAppDocument* self = NewLC( aApp ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::NewL +// Factory function for creation of CSVGTViewerAppDocument. Also pushes the +// object on the cleanup stack. +// Returns: CSVGTViewerAppDocument* ; Pointer to created object +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSVGTViewerAppDocument* CSVGTViewerAppDocument::NewLC( + CEikApplication& aApp ) // Reference to application object + { + CSVGTViewerAppDocument* self = new ( ELeave ) + CSVGTViewerAppDocument( aApp ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// Destructor +CSVGTViewerAppDocument::~CSVGTViewerAppDocument() + { + // Close the file handle and session + iSvgtContentFileHandle.Close(); + delete iFileFullPath; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::GetSvgtContentFileHandle +// This function is a get function to get the file-handle of the file content. +// This is used by AppUI. +// Returns: File handle of content by reference . +// ----------------------------------------------------------------------------- +// +RFile& CSVGTViewerAppDocument::GetSvgtContentFileHandle() + { + return iSvgtContentFileHandle; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::IsFileHandleValid() +// Used by UI class to check if file's handle is valid +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppDocument::IsFileHandleValid() const + { + return iIsFileHandleValid; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::IsFileFullPathAvailable() +// Used by UI class to check if file's full-path available. +// ----------------------------------------------------------------------------- +// +TBool CSVGTViewerAppDocument::IsFileFullPathAvailable() const + { + return iIsFileFullPathValid; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::GetFileFullPath() +// Used by UI class to get file's full-path. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppDocument::GetFileFullPath(TFileName& filename) + { + if ( iFileFullPath ) + { + filename = iFileFullPath->Des(); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::GetParentAppUid() +// Used by UI class to get parent application's uid. +// ----------------------------------------------------------------------------- +// +TUid CSVGTViewerAppDocument::GetParentAppUid() const + { + return iParentUid; + } +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::OpenFileL +// Reimplements CAknDocument::OpenFileL inorder to support opening of SVGT +// files through doc-handler framework. +// Returns: NULL. +// ----------------------------------------------------------------------------- +// +CFileStore* CSVGTViewerAppDocument::OpenFileL( TBool aDoOpen, // Indicates + // Whether doc + // is to be + // created + // or opened. + const TDesC& aFilename, // SVGT + // Filename + RFs& aFs ) // File Srvr + // Session + { + // In this function we store the file-name inside the document. + // The opening of the document is performed by AppUI after + // initialisation. + if ( aDoOpen ) + { + CSVGTViewerAppAppUi* AppUi = static_cast(iAppUi); + AppUi->SetAllowMove(0); + + const CAiwGenericParamList* params = GetInputParameters(); + if ( params ) + { + TInt findIndex; + const TAiwGenericParam* param = params->FindFirst(findIndex, + EGenericParamAllowMove); + + if ( param && findIndex != KErrNotFound ) + { + TInt32 value = 0; + param->Value().Get(value); + AppUi->SetAllowMove(value); + } + } + + // Get Move parameter + if ( params && params->Count() ) + { + TInt index = 0; + const TAiwGenericParam* param = NULL; + + param = params->FindFirst(index, EGenericParamApplication, EVariantTypeTUid); + + if ( index >= 0 && param ) + { + param->Value().Get(iParentUid); + } + } + } + + // Function is called with Full-path. + iIsFileFullPathValid = ETrue; + // Store the File's fullpath. + iFileFullPath = aFilename.AllocL(); + + // Open File Handle for the file + TInt openError = iSvgtContentFileHandle.Open( aFs, aFilename, + EFileShareAny ); + if ( openError != KErrNone ) + { + User::Leave( openError ); + } + iIsFileHandleValid = ETrue; + + return NULL; + } + +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::OpenFileL +// Reimplements CAknDocument::OpenFileL inorder to support opening of SVGT +// files through doc-handler framework. +// Returns: NULL. +// ----------------------------------------------------------------------------- +// +void CSVGTViewerAppDocument::OpenFileL( + CFileStore*& aFileStore, // Pointer to reference of filestore + RFile& aFile ) // File handle of content. + { + // Set the docstore pointer to NULL so that the framework + // does not try to open the file by filename + aFileStore = NULL; + + // In this function we store the file-name inside the document. + // The opening of the document is performed by AppUI after + // initialisation. + CSVGTViewerAppAppUi* AppUi = static_cast(iAppUi); + AppUi->SetAllowMove(0); + + const CAiwGenericParamList* paramList = GetInputParameters(); + if ( paramList ) + { + TInt findIndex; + const TAiwGenericParam* param = paramList->FindFirst(findIndex, + EGenericParamAllowMove); + + if ( param && findIndex != KErrNotFound ) + { + TInt32 value = 0; + param->Value().Get(value); + AppUi->SetAllowMove(value); + } + } + + + if ( paramList && paramList->Count() ) + { + TInt index = 0; + const TAiwGenericParam* param = NULL; + param = paramList->FindFirst(index, EGenericParamApplication, EVariantTypeTUid); + + if ( index >= 0 && param ) + { + param->Value().Get(iParentUid); + } + } + // Function is not called with Full-path. + iIsFileFullPathValid = EFalse; + + // File-handle is valid + iIsFileHandleValid = ETrue; + + // Make a copy for our use later. + iSvgtContentFileHandle.Duplicate( aFile ); + + // Close the original file handle + aFile.Close(); + + return; + } +// ----------------------------------------------------------------------------- +// CSVGTViewerAppDocument::CreateAppUiL +// Called by the framework to create the AppUI. +// Returns: CEikAppUi* ; Pointer to the created object. +// Leaves if error. +// ----------------------------------------------------------------------------- +// +CEikAppUi* CSVGTViewerAppDocument::CreateAppUiL() + { + // Create the application user interface, and return a pointer to it + // the framework takes ownership of this object + return ( static_cast < CEikAppUi* > + ( new ( ELeave ) CSVGTViewerAppAppUi ) ); + } + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/AppSrc/SvgtViewerAppView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/AppSrc/SvgtViewerAppView.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 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: Application viewer for SVGT Viewer App. +* +*/ + + + +#include "SvgtViewerAppView.h" +#include + +void CSvgtViewerAppView::ConstructL(const TRect& aRect) + { + CreateWindowL(); + + SetRect(aRect); + ActivateL(); + } + +CSvgtViewerAppView::~CSvgtViewerAppView() + { + } + +TInt CSvgtViewerAppView::CountComponentControls() const + { + return 0; + } + +CCoeControl* CSvgtViewerAppView::ComponentControl(TInt /* aIndex */) const + { + return NULL; + } + +void CSvgtViewerAppView::Draw(const TRect& /* aRect */) const + { + CWindowGc& gc = SystemGc(); + gc.Clear(); + } + +void CSvgtViewerAppView::HandleResourceChange (TInt /* aType */) + { + TRect rect; + AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect ); + SetRect( rect ); + } + +//End of file + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/BWINSCW/SVGTAppObserverUtilU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/BWINSCW/SVGTAppObserverUtilU.DEF Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,41 @@ +EXPORTS + ??0CSVGTAppObserverUtil@@IAE@PAVCSVGTUIDialog@@@Z @ 1 NONAME ; CSVGTAppObserverUtil::CSVGTAppObserverUtil(class CSVGTUIDialog *) + ??1CSVGTAppObserverUtil@@UAE@XZ @ 2 NONAME ; CSVGTAppObserverUtil::~CSVGTAppObserverUtil(void) + ??1CSVGTFileManager@@UAE@XZ @ 3 NONAME ; CSVGTFileManager::~CSVGTFileManager(void) + ?AssignEmbededDataL@CSVGTAppObserverUtil@@UAEXABVTDesC16@@@Z @ 4 NONAME ; void CSVGTAppObserverUtil::AssignEmbededDataL(class TDesC16 const &) + ?CanShowDownload@CSVGTAppObserverUtil@@UBEHXZ @ 5 NONAME ; int CSVGTAppObserverUtil::CanShowDownload(void) const + ?CanShowSave@CSVGTAppObserverUtil@@UAEHXZ @ 6 NONAME ; int CSVGTAppObserverUtil::CanShowSave(void) + ?CancelCopy@CSVGTFileManager@@QAEXXZ @ 7 NONAME ; void CSVGTFileManager::CancelCopy(void) + ?ConstructL@CSVGTAppObserverUtil@@IAEXPAVRFile@@@Z @ 8 NONAME ; void CSVGTAppObserverUtil::ConstructL(class RFile *) + ?ConstructL@CSVGTAppObserverUtil@@IAEXPAVRFile@@ABVTDesC16@@HHH@Z @ 9 NONAME ; void CSVGTAppObserverUtil::ConstructL(class RFile *, class TDesC16 const &, int, int, int) + ?ConstructL@CSVGTAppObserverUtil@@IAEXXZ @ 10 NONAME ; void CSVGTAppObserverUtil::ConstructL(void) + ?DialogDismissedL@CSVGTAppObserverUtil@@UAEXH@Z @ 11 NONAME ; void CSVGTAppObserverUtil::DialogDismissedL(int) + ?DisplayDownloadMenuL@CSVGTAppObserverUtil@@UAEXXZ @ 12 NONAME ; void CSVGTAppObserverUtil::DisplayDownloadMenuL(void) + ?DoSaveL@CSVGTAppObserverUtil@@UAEXH@Z @ 13 NONAME ; void CSVGTAppObserverUtil::DoSaveL(int) + ?FetchImage@CSVGTAppObserverUtil@@UAEHABVTDesC16@@AAVRFs@@AAVRFile@@@Z @ 14 NONAME ; int CSVGTAppObserverUtil::FetchImage(class TDesC16 const &, class RFs &, class RFile &) + ?GetDefaultInetAccessPointL@CSVGTAppObserverUtil@@IBEHAAK@Z @ 15 NONAME ; int CSVGTAppObserverUtil::GetDefaultInetAccessPointL(unsigned long &) const + ?GetFileNameAndExt@CSVGTAppObserverUtil@@IBEXAAVTDes16@@@Z @ 16 NONAME ; void CSVGTAppObserverUtil::GetFileNameAndExt(class TDes16 &) const + ?GetFileNameFromUri@CSVGTAppObserverUtil@@QBEHABVTDesC16@@AAVTDes16@@@Z @ 17 NONAME ; int CSVGTAppObserverUtil::GetFileNameFromUri(class TDesC16 const &, class TDes16 &) const + ?GetLocalFile@CSVGTAppObserverUtil@@SAHABVTDesC16@@AAVTDes16@@0@Z @ 18 NONAME ; int CSVGTAppObserverUtil::GetLocalFile(class TDesC16 const &, class TDes16 &, class TDesC16 const &) + ?GetSmilFitValue@CSVGTAppObserverUtil@@UAEXAAVTDes16@@@Z @ 19 NONAME ; void CSVGTAppObserverUtil::GetSmilFitValue(class TDes16 &) + ?HandleDMgrEventL@CSVGTAppObserverUtil@@UAEXAAVRHttpDownload@@VTHttpDownloadEvent@@@Z @ 20 NONAME ; void CSVGTAppObserverUtil::HandleDMgrEventL(class RHttpDownload &, class THttpDownloadEvent) + ?IsAllowMove@CSVGTAppObserverUtil@@IBEHXZ @ 21 NONAME ; int CSVGTAppObserverUtil::IsAllowMove(void) const + ?IsDownloadNeededL@CSVGTAppObserverUtil@@SA?AW4TDownloadNeeded@1@ABVTDesC16@@@Z @ 22 NONAME ; enum CSVGTAppObserverUtil::TDownloadNeeded CSVGTAppObserverUtil::IsDownloadNeededL(class TDesC16 const &) + ?IsFileFullPathAvailable@CSVGTAppObserverUtil@@IBEHXZ @ 23 NONAME ; int CSVGTAppObserverUtil::IsFileFullPathAvailable(void) const + ?IsSavingDone@CSVGTAppObserverUtil@@UAEHXZ @ 24 NONAME ; int CSVGTAppObserverUtil::IsSavingDone(void) + ?LaunchDownloadedFileL@CSVGTAppObserverUtil@@IBEXABVTDesC16@@HH@Z @ 25 NONAME ; void CSVGTAppObserverUtil::LaunchDownloadedFileL(class TDesC16 const &, int, int) const + ?LinkActivated@CSVGTAppObserverUtil@@UAEHABVTDesC16@@@Z @ 26 NONAME ; int CSVGTAppObserverUtil::LinkActivated(class TDesC16 const &) + ?LinkActivatedL@CSVGTAppObserverUtil@@QAEXABVTDesC16@@@Z @ 27 NONAME ; void CSVGTAppObserverUtil::LinkActivatedL(class TDesC16 const &) + ?LinkActivatedWithShow@CSVGTAppObserverUtil@@UAEHABVTDesC16@@0@Z @ 28 NONAME ; int CSVGTAppObserverUtil::LinkActivatedWithShow(class TDesC16 const &, class TDesC16 const &) + ?LinkActivatedWithShowL@CSVGTAppObserverUtil@@QAEXABVTDesC16@@0@Z @ 29 NONAME ; void CSVGTAppObserverUtil::LinkActivatedWithShowL(class TDesC16 const &, class TDesC16 const &) + ?NewFetchImageData@CSVGTAppObserverUtil@@UAEHABVTDesC16@@@Z @ 30 NONAME ; int CSVGTAppObserverUtil::NewFetchImageData(class TDesC16 const &) + ?NewL@CSVGTAppObserverUtil@@SAPAV1@PAVCSVGTUIDialog@@PAVRFile@@@Z @ 31 NONAME ; class CSVGTAppObserverUtil * CSVGTAppObserverUtil::NewL(class CSVGTUIDialog *, class RFile *) + ?NewL@CSVGTAppObserverUtil@@SAPAV1@PAVCSVGTUIDialog@@PAVRFile@@ABVTDesC16@@HHH@Z @ 32 NONAME ; class CSVGTAppObserverUtil * CSVGTAppObserverUtil::NewL(class CSVGTUIDialog *, class RFile *, class TDesC16 const &, int, int, int) + ?NewL@CSVGTFileManager@@SAPAV1@XZ @ 33 NONAME ; class CSVGTFileManager * CSVGTFileManager::NewL(void) + ?SVGTPositionChanged@CSVGTAppObserverUtil@@UAEXH@Z @ 34 NONAME ; void CSVGTAppObserverUtil::SVGTPositionChanged(int) + ?SVGTSavingDoneL@CSVGTAppObserverUtil@@UAEXH@Z @ 35 NONAME ; void CSVGTAppObserverUtil::SVGTSavingDoneL(int) + ?SetAllowMove@CSVGTFileManager@@QAEXJ@Z @ 36 NONAME ; void CSVGTFileManager::SetAllowMove(long) + ?SetDownloadMenu@CSVGTAppObserverUtil@@QAEXH@Z @ 37 NONAME ; void CSVGTAppObserverUtil::SetDownloadMenu(int) + ?StartCopyOperationL@CSVGTFileManager@@QAEHPAVMSVGTUISaveListener@@AAVRFile@@ABVTDesC16@@@Z @ 38 NONAME ; int CSVGTFileManager::StartCopyOperationL(class MSVGTUISaveListener *, class RFile &, class TDesC16 const &) + ?StartCopyOperationL@CSVGTFileManager@@QAEHPAVMSVGTUISaveListener@@ABVTDesC16@@1@Z @ 39 NONAME ; int CSVGTFileManager::StartCopyOperationL(class MSVGTUISaveListener *, class TDesC16 const &, class TDesC16 const &) + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/BWINSCW/SVGTScreenSaverPluginU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/BWINSCW/SVGTScreenSaverPluginU.DEF Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,5 @@ +EXPORTS + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) + ?InitializeFuncs@@YAFPAU_NPPluginFuncs@@@Z @ 2 NONAME ; short InitializeFuncs(struct _NPPluginFuncs *) + ?NPP_Shutdown@@YAXXZ @ 3 NONAME ; void NPP_Shutdown(void) + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/BWINSCW/SVGTUICONTROLU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/BWINSCW/SVGTUICONTROLU.def Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,8 @@ +EXPORTS + ?AssignImageData@CSVGTUIDialog@@QAEXABVTDesC16@@PAVHBufC8@@@Z @ 1 NONAME ; void CSVGTUIDialog::AssignImageData(class TDesC16 const &, class HBufC8 *) + ?GenerateThumbnailLD@CSVGTThumbnailUtil@@SAHAAVRFile@@AAVCFbsBitmap@@1@Z @ 2 NONAME ; int CSVGTThumbnailUtil::GenerateThumbnailLD(class RFile &, class CFbsBitmap &, class CFbsBitmap &) + ?NewL@CSVGTCustControl@@SAPAV1@AAVRFile@@PAVMSvgtAppObserver@@PAVMSVGTProgressBarDrawImpl@@PAVMSVGTMSKImpl@@PAVMSvgtApplicationExitObserver@@HPBVCCoeControl@@H@Z @ 3 NONAME ; class CSVGTCustControl * CSVGTCustControl::NewL(class RFile &, class MSvgtAppObserver *, class MSVGTProgressBarDrawImpl *, class MSVGTMSKImpl *, class MSvgtApplicationExitObserver *, int, class CCoeControl const *, int) + ?NewL@CSVGTUIDialog@@SAPAV1@XZ @ 4 NONAME ; class CSVGTUIDialog * CSVGTUIDialog::NewL(void) + ?NewLC@CSVGTUIDialog@@SAPAV1@XZ @ 5 NONAME ; class CSVGTUIDialog * CSVGTUIDialog::NewLC(void) + ?AddListener@CSVGTCustControl@@QAEXPAVMSvgCustControlListener@@W4TCustControlListener@@@Z @ 6 NONAME ; void CSVGTCustControl::AddListener(class MSvgCustControlListener *, enum TCustControlListener) + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/BWINSCW/svgtfileviewdetails.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/BWINSCW/svgtfileviewdetails.def Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,4 @@ +EXPORTS + ?ExecuteLD@CSvgtFileViewDetailsDialog@@QAEXAAVRFile@@@Z @ 1 NONAME ; void CSvgtFileViewDetailsDialog::ExecuteLD(class RFile &) + ?NewL@CSvgtFileViewDetailsDialog@@SAPAV1@XZ @ 2 NONAME ; class CSvgtFileViewDetailsDialog * CSvgtFileViewDetailsDialog::NewL(void) + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/EABI/SVGTAppObserverUtilU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/EABI/SVGTAppObserverUtilU.DEF Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,65 @@ +EXPORTS + _ZN16CSVGTFileManager10CancelCopyEv @ 1 NONAME + _ZN16CSVGTFileManager12SetAllowMoveEl @ 2 NONAME + _ZN16CSVGTFileManager19StartCopyOperationLEP19MSVGTUISaveListenerR5RFileRK7TDesC16 @ 3 NONAME + _ZN16CSVGTFileManager19StartCopyOperationLEP19MSVGTUISaveListenerRK7TDesC16S4_ @ 4 NONAME + _ZN16CSVGTFileManager4NewLEv @ 5 NONAME + _ZN16CSVGTFileManagerD0Ev @ 6 NONAME + _ZN16CSVGTFileManagerD1Ev @ 7 NONAME + _ZN16CSVGTFileManagerD2Ev @ 8 NONAME + _ZN20CSVGTAppObserverUtil10ConstructLEP5RFile @ 9 NONAME + _ZN20CSVGTAppObserverUtil10ConstructLEP5RFileRK7TDesC16iii @ 10 NONAME + _ZN20CSVGTAppObserverUtil10ConstructLEv @ 11 NONAME + _ZN20CSVGTAppObserverUtil10FetchImageERK7TDesC16R3RFsR5RFile @ 12 NONAME + _ZN20CSVGTAppObserverUtil11CanShowSaveEv @ 13 NONAME + _ZN20CSVGTAppObserverUtil12GetLocalFileERK7TDesC16R6TDes16S2_ @ 14 NONAME + _ZN20CSVGTAppObserverUtil12IsSavingDoneEv @ 15 NONAME + _ZN20CSVGTAppObserverUtil13LinkActivatedERK7TDesC16 @ 16 NONAME + _ZN20CSVGTAppObserverUtil14LinkActivatedLERK7TDesC16 @ 17 NONAME + _ZN20CSVGTAppObserverUtil15GetSmilFitValueER6TDes16 @ 18 NONAME + _ZN20CSVGTAppObserverUtil15SVGTSavingDoneLEi @ 19 NONAME + _ZN20CSVGTAppObserverUtil15SetDownloadMenuEi @ 20 NONAME + _ZN20CSVGTAppObserverUtil16DialogDismissedLEi @ 21 NONAME + _ZN20CSVGTAppObserverUtil16HandleDMgrEventLER13RHttpDownload18THttpDownloadEvent @ 22 NONAME + _ZN20CSVGTAppObserverUtil17IsDownloadNeededLERK7TDesC16 @ 23 NONAME + _ZN20CSVGTAppObserverUtil17NewFetchImageDataERK7TDesC16 @ 24 NONAME + _ZN20CSVGTAppObserverUtil18AssignEmbededDataLERK7TDesC16 @ 25 NONAME + _ZN20CSVGTAppObserverUtil19SVGTPositionChangedEi @ 26 NONAME + _ZN20CSVGTAppObserverUtil20DisplayDownloadMenuLEv @ 27 NONAME + _ZN20CSVGTAppObserverUtil21LinkActivatedWithShowERK7TDesC16S2_ @ 28 NONAME + _ZN20CSVGTAppObserverUtil22LinkActivatedWithShowLERK7TDesC16S2_ @ 29 NONAME + _ZN20CSVGTAppObserverUtil4NewLEP13CSVGTUIDialogP5RFile @ 30 NONAME + _ZN20CSVGTAppObserverUtil4NewLEP13CSVGTUIDialogP5RFileRK7TDesC16iii @ 31 NONAME + _ZN20CSVGTAppObserverUtil7DoSaveLEi @ 32 NONAME + _ZN20CSVGTAppObserverUtilC1EP13CSVGTUIDialog @ 33 NONAME + _ZN20CSVGTAppObserverUtilC2EP13CSVGTUIDialog @ 34 NONAME + _ZN20CSVGTAppObserverUtilD0Ev @ 35 NONAME + _ZN20CSVGTAppObserverUtilD1Ev @ 36 NONAME + _ZN20CSVGTAppObserverUtilD2Ev @ 37 NONAME + _ZNK20CSVGTAppObserverUtil11IsAllowMoveEv @ 38 NONAME + _ZNK20CSVGTAppObserverUtil15CanShowDownloadEv @ 39 NONAME + _ZNK20CSVGTAppObserverUtil17GetFileNameAndExtER6TDes16 @ 40 NONAME + _ZNK20CSVGTAppObserverUtil18GetFileNameFromUriERK7TDesC16R6TDes16 @ 41 NONAME + _ZNK20CSVGTAppObserverUtil21LaunchDownloadedFileLERK7TDesC16ii @ 42 NONAME + _ZNK20CSVGTAppObserverUtil23IsFileFullPathAvailableEv @ 43 NONAME + _ZNK20CSVGTAppObserverUtil26GetDefaultInetAccessPointLERm @ 44 NONAME + _ZTI20CSVGTAppObserverUtil @ 45 NONAME DATA 56 ; ## + _ZTI23CSVGTViewerAppDownloads @ 46 NONAME DATA 12 ; ## + _ZTV20CSVGTAppObserverUtil @ 47 NONAME DATA 172 ; ## + _ZTV23CSVGTViewerAppDownloads @ 48 NONAME DATA 20 ; ## + _ZThn12_N20CSVGTAppObserverUtil15SVGTSavingDoneLEi @ 49 NONAME ; ## + _ZThn12_N20CSVGTAppObserverUtil19SVGTPositionChangedEi @ 50 NONAME ; ## + _ZThn16_N20CSVGTAppObserverUtil16DialogDismissedLEi @ 51 NONAME ; ## + _ZThn4_N20CSVGTAppObserverUtil10FetchImageERK7TDesC16R3RFsR5RFile @ 52 NONAME ; ## + _ZThn4_N20CSVGTAppObserverUtil11CanShowSaveEv @ 53 NONAME ; ## + _ZThn4_N20CSVGTAppObserverUtil12IsSavingDoneEv @ 54 NONAME ; ## + _ZThn4_N20CSVGTAppObserverUtil13LinkActivatedERK7TDesC16 @ 55 NONAME ; ## + _ZThn4_N20CSVGTAppObserverUtil15GetSmilFitValueER6TDes16 @ 56 NONAME ; ## + _ZThn4_N20CSVGTAppObserverUtil17NewFetchImageDataERK7TDesC16 @ 57 NONAME ; ## + _ZThn4_N20CSVGTAppObserverUtil18AssignEmbededDataLERK7TDesC16 @ 58 NONAME ; ## + _ZThn4_N20CSVGTAppObserverUtil20DisplayDownloadMenuLEv @ 59 NONAME ; ## + _ZThn4_N20CSVGTAppObserverUtil21LinkActivatedWithShowERK7TDesC16S2_ @ 60 NONAME ; ## + _ZThn4_N20CSVGTAppObserverUtil7DoSaveLEi @ 61 NONAME ; ## + _ZThn4_NK20CSVGTAppObserverUtil15CanShowDownloadEv @ 62 NONAME ; ## + _ZThn8_N20CSVGTAppObserverUtil16HandleDMgrEventLER13RHttpDownload18THttpDownloadEvent @ 63 NONAME ; ## + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/EABI/SVGTScreenSaverPluginU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/EABI/SVGTScreenSaverPluginU.DEF Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,15 @@ +EXPORTS + _Z24ImplementationGroupProxyRi @ 1 NONAME + _Z12NPP_Shutdownv @ 2 NONAME + _Z15InitializeFuncsP14_NPPluginFuncs @ 3 NONAME + _ZTI11CSvgtPlugin @ 4 NONAME ; ## + _ZTI15CSvgScreenSaver @ 5 NONAME ; ## + _ZTI19CSvgtPluginEcomMain @ 6 NONAME ; ## + _ZTI20CSvgRenderFrameTimer @ 7 NONAME ; ## + _ZTI22CSvgRenderFrameControl @ 8 NONAME ; ## + _ZTV11CSvgtPlugin @ 9 NONAME ; ## + _ZTV15CSvgScreenSaver @ 10 NONAME ; ## + _ZTV19CSvgtPluginEcomMain @ 11 NONAME ; ## + _ZTV20CSvgRenderFrameTimer @ 12 NONAME ; ## + _ZTV22CSvgRenderFrameControl @ 13 NONAME ; ## + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/EABI/SVGTUICONTROLU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/EABI/SVGTUICONTROLU.def Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,28 @@ +EXPORTS + _ZN13CSVGTUIDialog15AssignImageDataERK7TDesC16P6HBufC8 @ 1 NONAME + _ZN13CSVGTUIDialog4NewLEv @ 2 NONAME + _ZN13CSVGTUIDialog5NewLCEv @ 3 NONAME + _ZN16CSVGTCustControl4NewLER5RFileP16MSvgtAppObserverP24MSVGTProgressBarDrawImplP12MSVGTMSKImplP28MSvgtApplicationExitObserveriPK11CCoeControli @ 4 NONAME + _ZN18CSVGTThumbnailUtil19GenerateThumbnailLDER5RFileR10CFbsBitmapS3_ @ 5 NONAME + _ZTI10CSvgtEvent @ 6 NONAME ; ## + _ZTI13CSVGTUIDialog @ 7 NONAME ; ## + _ZTI14CSVGTDrmHelper @ 8 NONAME ; ## + _ZTI16CSVGTCustControl @ 9 NONAME ; ## + _ZTI18CSVGTThumbnailUtil @ 10 NONAME ; ## + _ZTI19CSvgtEventHandlerAO @ 11 NONAME ; ## + _ZTI21CSVGTPointerHideTimer @ 12 NONAME ; ## + _ZTI21CSVGTProgressBarTimer @ 13 NONAME ; ## + _ZTI21CSvgtDecoratorControl @ 14 NONAME ; ## + _ZTI21CSvgtThreadController @ 15 NONAME ; ## + _ZTV10CSvgtEvent @ 16 NONAME ; ## + _ZTV13CSVGTUIDialog @ 17 NONAME ; ## + _ZTV14CSVGTDrmHelper @ 18 NONAME ; ## + _ZTV16CSVGTCustControl @ 19 NONAME ; ## + _ZTV18CSVGTThumbnailUtil @ 20 NONAME ; ## + _ZTV19CSvgtEventHandlerAO @ 21 NONAME ; ## + _ZTV21CSVGTPointerHideTimer @ 22 NONAME ; ## + _ZTV21CSVGTProgressBarTimer @ 23 NONAME ; ## + _ZTV21CSvgtDecoratorControl @ 24 NONAME ; ## + _ZTV21CSvgtThreadController @ 25 NONAME ; ## + _ZN16CSVGTCustControl11AddListenerEP23MSvgCustControlListener20TCustControlListener @ 26 NONAME + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/EABI/svgtfileviewdetails.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/EABI/svgtfileviewdetails.def Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,10 @@ +EXPORTS + _ZN26CSvgtFileViewDetailsDialog4NewLEv @ 1 NONAME + _ZN26CSvgtFileViewDetailsDialog9ExecuteLDER5RFile @ 2 NONAME + _ZTI14CSVGTDrmHelper @ 3 NONAME ; ## + _ZTI16CSvgtFileDetails @ 4 NONAME ; ## + _ZTI26CSvgtFileViewDetailsDialog @ 5 NONAME ; ## + _ZTV14CSVGTDrmHelper @ 6 NONAME ; ## + _ZTV16CSvgtFileDetails @ 7 NONAME ; ## + _ZTV26CSvgtFileViewDetailsDialog @ 8 NONAME ; ## + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/Group/SVGCodec.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/Group/SVGCodec.mmp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2005, 2006 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: SVGT plugin project file +* +*/ + + +#include +/** +@file + +@SYMPurpose SVGcodec.dll SVG codec plugin +*/ + +target svgcodec.dll +CAPABILITY ALL -TCB +targettype plugin + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x102073D7 +VENDORID 0x70000001 + +USERINCLUDE ../SVGCodecInc + +// This is a SYSTEMINCLUDE macro containing the applications +// layer specific include directories +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/icl + +SOURCEPATH ../SVGCodecSrc +SOURCE SVGConvert.cpp +SOURCE SVGCodec.cpp +SOURCE SVGProxy.cpp + +SOURCEPATH ../data + +START RESOURCE 102073D7.rss +TARGET SVGCodec.rsc +HEADER +END + +START RESOURCE 102073D7_extra.rss +TARGETPATH Resource/ICL +HEADER +END + +LIBRARY euser.lib +LIBRARY ImageConversion.lib +LIBRARY fbscli.lib +LIBRARY gdi.lib +LIBRARY SvgEngine.lib +LIBRARY Cone.lib +LIBRARY efsrv.lib +LIBRARY bitgdi.lib +LIBRARY InetProtUtil.lib +LIBRARY platformenv.lib +LIBRARY imut.lib +LIBRARY charconv.lib + +START WINS +BASEADDRESS 0x4F630000 +END +// End of file + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/Group/SVGTAppObserverUtil.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/Group/SVGTAppObserverUtil.mmp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2004,2005 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: This is the .mmp for building the SVGT Viewer Application +* Observer utility for the Series60 Platform. +* +*/ + + +#include +#include + +TARGET SVGTAppObserverUtil.dll +TARGETTYPE dll +UID 0x1000008D 0x102071E5 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../AppObserverUtilSrc +SOURCE SVGTAppObserverUtil.cpp +SOURCE SVGTViewerAppDownloads.cpp +SOURCE SVGTFileManager.cpp + +// This is a SYSTEMINCLUDE macro containing the applications +// layer specific include directories +APP_LAYER_SYSTEMINCLUDE + +START RESOURCE ../data/SVGTAppObserverUtil.rss +TARGETPATH RESOURCE_FILES_DIR +HEADER +LANGUAGE_IDS +END // RESOURCE + +USERINCLUDE ../AppObserverUtilInc +USERINCLUDE ../UIControlInc +USERINCLUDE ../AppInc + + +LIBRARY euser.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY DownloadMgr.lib +LIBRARY DownloadMgrUiLib.lib +LIBRARY commdb.lib +LIBRARY apengine.lib +LIBRARY browserlauncher.lib +LIBRARY APGRFX.lib +LIBRARY WS32.lib +LIBRARY CENTRALREPOSITORY.lib +LIBRARY CommonEngine.lib +LIBRARY apmime.lib +LIBRARY CommonUi.lib +LIBRARY InetProtUtil.lib +LIBRARY SVGTUIControl.lib +LIBRARY charconv.lib +LIBRARY commondialogs.lib +LIBRARY aknnotify.lib // AknGlobalNote +LIBRARY aknmemorycardui.lib +LIBRARY eikctl.lib +LIBRARY sysutil.lib +LIBRARY platformenv.lib + +LIBRARY imut.lib +LIBRARY ServiceHandler.lib + +DEBUGLIBRARY flogger.lib + +LANGUAGE_IDS + +#if defined(ARMCC) +deffile ../EABI/ +#elif defined(WINSCW) +deffile ../BWINSCW/ +#endif + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/Group/SVGTScreenSaverPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/Group/SVGTScreenSaverPlugin.mmp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2005, 2006 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: This is the .mmp for building the Svg Screen Saver Plugin +* +*/ + + +#include +#include + +TARGET SVGTScreenSaverPlugin.dll + +TARGETTYPE PLUGIN + +/* exportunfrozen */ + +UID 0x10009D8D 0x102071E7 + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +// This is a SYSTEMINCLUDE macro containing the applications +// layer specific include directories +APP_LAYER_SYSTEMINCLUDE + +START RESOURCE ../data/102071E7.rss +HEADER +TARGET SVGTScreenSaverPlugin.rsc +END + +/* exportunfrozen */ + +SOURCEPATH ../ScreenSaverPluginSrc +SOURCE SvgRenderFrameControl.cpp +SOURCE SvgRenderFrameTimer.cpp +SOURCE SvgScreenSaver.cpp +SOURCE Svgtplugin.cpp +SOURCE Svgtplugindllapi.cpp +SOURCE Svgtpluginmain.cpp + + + +USERINCLUDE ../ScreenSaverPluginInc + + +SYSTEMINCLUDE . +SYSTEMINCLUDE /epoc32/include/libc +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY svgengine.lib +LIBRARY ecom.lib +LIBRARY euser.lib +LIBRARY gdi.lib +LIBRARY fbscli.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY avkon.lib +LIBRARY SVGTUIControl.lib +LIBRARY SVGTAppObserverUtil.lib + +DEBUGLIBRARY flogger.lib + +LANGUAGE_IDS + +#if defined(ARMCC) +deffile ../EABI/ +#elif defined(WINSCW) +deffile ../BWINSCW/ +#endif + +// End of File + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/Group/SVGTUIControl.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/Group/SVGTUIControl.mmp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2004,2005 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: This is the .mmp for building the SVGT UI Control for +* the Series60 Platform. +* +*/ + + +#include +#include + +TARGET SVGTUIControl.dll +TARGETTYPE dll +UID 0x1000008D 0x101F8749 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + + +/* exportunfrozen */ + +SOURCEPATH ../UIControlSrc +SOURCE SVGTUIDialog.cpp +SOURCE SVGTCustControl.cpp +SOURCE SVGTProgressBarTimer.cpp +SOURCE SVGTPointerHideTimer.cpp +SOURCE SVGTDrmHelper.cpp +SOURCE SVGTThumbnailUtil.cpp +SOURCE SvgtController.cpp +SOURCE SvgtEvent.cpp +SOURCE SvgtEventHandlerAO.cpp +SOURCE SvgtDecoratorControl.cpp + +// This is a SYSTEMINCLUDE macro containing the applications +// layer specific include directories +APP_LAYER_SYSTEMINCLUDE + +START RESOURCE ../data/SVGTUIControl.rss +TARGETPATH RESOURCE_FILES_DIR +HEADER +LANGUAGE_IDS +END // RESOURCE + +USERINCLUDE ../UIControlInc + + + +SYSTEMINCLUDE /epoc32/include/libc + + +LIBRARY aknskins.lib +LIBRARY egul.lib +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY eikcoctl.lib +LIBRARY eikctl.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib +LIBRARY bitgdi.lib +LIBRARY gdi.lib +LIBRARY eikdlg.lib +LIBRARY svgengine.lib +LIBRARY drmhelper.lib +LIBRARY drmcommon.lib +LIBRARY commonengine.lib +LIBRARY aknicon.lib // AknIconUtils +LIBRARY CdlEngine.lib // Scalable UI +LIBRARY AknLayout2.lib // Scalable UI +LIBRARY AknLayout2Scalable.lib // Scalable UI +LIBRARY InetProtUtil.lib +LIBRARY svgtfileviewdetails.lib +LIBRARY ws32.lib + +#ifdef RD_SVGT_AUDIO_SUPPORT +LIBRARY remconcoreapi.lib +LIBRARY remconinterfacebase.lib +#endif + +#ifdef __SERIES60_HELP +LIBRARY hlplch.lib // for "Help" options menu +#endif // __SERIES60_HELP +LIBRARY caf.lib // CAF library: for DRM +LIBRARY SVGTAppObserverUtil.lib + +LANGUAGE_IDS + +#if defined( ARMCC ) +deffile ../EABI/SVGTUICONTROL.def +#elif defined( WINSCW ) +deffile ../BWINSCW/SVGTUICONTROL.def +#elif defined( WINS ) +deffile ../bwins/SVGTUICONTROL.def +#else +deffile ../bmarm/SVGTUICONTROL.def +#endif +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/Group/SVGTViewerApp.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/Group/SVGTViewerApp.mmp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2004,2005 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: This is the .mmp for building the SVGT Viewer App for +* the Series60 Platform. +* +*/ + + +#include +#include + +TARGET SVGTViewerApp.exe +EPOCHEAPSIZE 300000 16000000 +EPOCSTACKSIZE 0x5000 +TARGETTYPE exe +UID 0x100039CE 0x101F874A + +CAPABILITY CAP_APPLICATION ProtServ MultimediaDD +VENDORID VID_DEFAULT + +SOURCEPATH ../AppSrc +SOURCE SVGTViewerApp.cpp +SOURCE SVGTViewerAppApplication.cpp +SOURCE SVGTViewerAppAppUi.cpp +SOURCE SVGTViewerAppDocument.cpp +SOURCE SvgtViewerAppView.cpp + +// This is a SYSTEMINCLUDE macro containing the applications +// layer specific include directories +APP_LAYER_SYSTEMINCLUDE + +START RESOURCE ../data/SVGTViewerApp.rss +TARGETPATH APP_RESOURCE_DIR +HEADER +LANGUAGE_IDS +END // RESOURCE + +USERINCLUDE ../AppInc +USERINCLUDE ../UIControlInc + + + +SYSTEMINCLUDE /epoc32/include/libc + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY eikcoctl.lib +LIBRARY avkon.lib +LIBRARY egul.lib +LIBRARY bitgdi.lib +LIBRARY gdi.lib +LIBRARY svgengine.lib +LIBRARY fbscli.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY WS32.lib +LIBRARY CommonEngine.lib +LIBRARY CommonUi.lib +LIBRARY SVGTUIControl.lib +LIBRARY SVGTAppObserverUtil.lib +LIBRARY ServiceHandler.lib // AIW Generic Param Handling. +LIBRARY platformenv.lib + +// Changes for Scalable UI: +// New registration resource defined. +// else +// Normal AIF will work. + +START RESOURCE ../data/SVGTViewerApp_reg.rss +DEPENDS svgtviewerapp.rsg +// Do not change the UID below. +TARGETPATH /private/10003a3f/apps +END + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/Group/SVGTViewerApp.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/Group/SVGTViewerApp.pkg Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,72 @@ +; +; Copyright (c) 2009 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: +; +; +; Installation file for SVGT Viewer App +; +;Languages +&EN +; +; UID is the app's UID +; +#{"SVG Viewer App"},(0x101F874A),1,0,0 + +; +;Supports Series 60 v 2.0 +(0x101F7960), 0, 0, 0, {"Series60ProductID"} + +; SVGT UI Control +; DLL + RSC +"\Epoc32\release\thumb\urel\SVGTUIControl.dll" -"!:\system\libs\SVGTUIControl.dll" +"\Epoc32\data\z\system\data\SVGTUIControl.rsc" -"!:\system\data\SVGTUIControl.rsc" + +; SVGT Viewer App +; App + RSC + AIF +"\Epoc32\release\thumb\urel\SVGTViewerApp.app" -"!:\system\apps\SVGTViewerApp\SVGTViewerApp.app" +"\Epoc32\data\z\system\Apps\SVGTViewerApp\SVGTViewerApp.rsc" -"!:\system\apps\SVGTViewerApp\SVGTViewerApp.rsc" +"\Epoc32\data\z\system\Apps\SVGTViewerApp\SVGTViewerApp.aif" -"!:\system\apps\SVGTViewerApp\SVGTViewerApp.aif" + +; +; +; Now the Dlls used by the application, put in the same directory +; +"\Epoc32\release\thumb\urel\gfx2d.dll" -"!:\system\libs\Gfx2d.dll" +"\Epoc32\release\thumb\urel\svgengine.dll" -"!:\system\libs\SVGEngine.dll" + +; Remove this when XMLINTERFACE.DLL is on hardware: +"\Epoc32\release\thumb\urel\XMLINTERFACE.DLL" -"!:\system\libs\XMLINTERFACE.DLL" + +; XMLParser: +"\Epoc32\release\thumb\urel\cXmlParser.dll" -"!:\system\libs\cXmlParser.dll" + +; Remove this when DRM is on hardware: +"\Epoc32\release\thumb\urel\DRMCOMMON.DLL" -"!:\system\libs\DRMCOMMON.DLL" + +; Remove this when DRM is on hardware: +"\Epoc32\release\thumb\urel\DRMAUTHENTICATED.DLL" -"!:\system\libs\DRMAUTHENTICATED.DLL" + +; SVGT Recogniser, put in system recogniser directory to recognise SVG mime type. +"\Epoc32\release\thumb\urel\SVGRECOG.MDL" -"!:\system\recogs\Svgrecog.mdl" + +; Remove this when DRM is on hardware: +"\Epoc32\release\thumb\urel\DRMHELPER.DLL" -"!:\system\libs\DRMHELPER.DLL" + +; Remove this when DRM is on hardware: +"\Epoc32\release\thumb\urel\COMMONENGINE.DLL" -"!:\system\libs\COMMONENGINE.DLL" + +; Remove this when DRM is on hardware: +"\Epoc32\release\thumb\urel\MPLAYERDRMHELPER.DLL" -"!:\system\libs\MPLAYERDRMHELPER.DLL" + +"\Epoc32\release\thumb\urel\DRMManagerEng.dll" -"!:\system\libs\DRMManagerEng.DLL" diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/Group/bld.inf Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2004-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: This is a top level bld file that drives all sub-components +* that make up the SVGT Viewer App and the UI Control +* +*/ + + +#ifdef __SVGT_VIEWER + +#include + +PRJ_PLATFORMS +DEFAULT + +// Help exports +#include "../help/group/bld.inf" + +PRJ_MMPFILES +SVGTAppObserverUtil.mmp +SVGTViewerApp.mmp +SVGTUIControl.mmp +SVGCodec.mmp +svgtfileviewdetails.mmp +#ifdef __SVGT_SCREENSAVER_PLUGIN +SVGTScreenSaverPlugin.mmp +#endif //__SVGT_SCREENSAVER_PLUGIN + +//gnumakefile icons_dc.mk +//#ifdef __SCALABLE_ICONS +//gnumakefile icons_aif_scalable_dc.mk +//#else +//gnumakefile icons_aif_bitmaps_dc.mk +//#endif // __SCALABLE_ICONS + +//S60 CODE CHANGES FOR RAPTOR +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE svgtuicontrol.mif +OPTION HEADERFILE svgtuicontrol.mbg +OPTION SOURCES -c8,8 qgn_indi_viewer_panning_down \ + -c8,8 qgn_indi_viewer_panning_left \ + -c8,8 qgn_indi_viewer_panning_right \ + -c8,8 qgn_indi_viewer_panning_up \ + -c8,8 qgn_indi_viewer_pointer \ + -c8,8 qgn_indi_viewer_pointer_hand \ + -c8,8 qgn_indi_viewer_pointer_text \ + -c8,8 qgn_indi_cams_paused + +END + +START EXTENSION s60/mifconv +OPTION TARGETFILE svgtviewerapp_aif.mif +OPTION SOURCES -c8,8 qgn_menu_mg +END + + + +PRJ_EXPORTS +// CP50 Build Improvements +../rom/SVGTAppObserverUtil.iby CORE_APP_LAYER_IBY_EXPORT_PATH(svgtappobserverutil.iby) +../rom/SVGTViewerApp.iby CORE_APP_LAYER_IBY_EXPORT_PATH(svgtviewerapp.iby) +../rom/SVGTUIControl.iby CORE_APP_LAYER_IBY_EXPORT_PATH(svgtuicontrol.iby) +../rom/SVGCodec.iby CORE_APP_LAYER_IBY_EXPORT_PATH(svgcodec.iby) +../rom/SVGTFileViewDetails.iby CORE_APP_LAYER_IBY_EXPORT_PATH(svgtfileviewdetails.iby) +../rom/SVGScreenSaverPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(svgscreensaverplugin.iby) + +// Localised Resource iby file exports +../rom/SVGTAppObserverUtilResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(svgtappobserverutilresources.iby) +../rom/SVGTFileViewDetailsResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(svgtfileviewdetailsresources.iby) +../rom/SVGTUIControlResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(svgtuicontrolresources.iby) +../rom/SVGTViewerAppResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(svgtviewerappresources.iby) + +// Loc files: Ease of localised builds +../loc/svgtfileviewdetails.loc APP_LAYER_LOC_EXPORT_PATH(svgtfileviewdetails.loc) +../loc/svgtuicontrol.loc APP_LAYER_LOC_EXPORT_PATH(svgtuicontrol.loc) + +#endif // __SVGT_VIEWER + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/Group/icons_aif_bitmaps_dc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/Group/icons_aif_bitmaps_dc.mk Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,70 @@ +# +# Copyright (c) 2004,2005 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: This is the makefile for building the AIF MBM file using +# bitmaps. The MBM file is stored in Data-Caging location. +# ============================================================================ +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# Target path and MBM file name +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\svgtviewerapp_aif.mbm + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask depth is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_mg_lst.bmp \ + /c8,8 qgn_menu_mg_cxt.bmp + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + +# End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/Group/icons_aif_scalable_dc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/Group/icons_aif_scalable_dc.mk Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,69 @@ +# +# Copyright (c) 2004,2005 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: This is the makefile for building the AIF MIF file using +# SVG icons. The MIF file is stored in Data-Caging location. +# ============================================================================ +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# Target Paths and file name +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\svgtviewerapp_aif.mif + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask depth is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_mg.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + +# End of file diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/Group/icons_dc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/Group/icons_dc.mk Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,78 @@ +# +# Copyright (c) 2004,2005 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: This is the makefile for compiling the icons for +# SVGTUIControl using data-caging paths. +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# Target Path and MIF file name +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\svgtuicontrol.mif + +HEADERDIR=\epoc32\include +HEADERFILENAME=$(HEADERDIR)\svgtuicontrol.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask depth is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c8,8 qgn_indi_viewer_panning_down \ + /c8,8 qgn_indi_viewer_panning_left \ + /c8,8 qgn_indi_viewer_panning_right \ + /c8,8 qgn_indi_viewer_panning_up \ + /c8,8 qgn_indi_viewer_pointer \ + /c8,8 qgn_indi_viewer_pointer_hand \ + /c8,8 qgn_indi_viewer_pointer_text \ + /c8,8 qgn_indi_cams_paused +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + +# End of file diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/Group/svgtfileviewdetails.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/Group/svgtfileviewdetails.mmp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2006 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: This is the .mmp for building the SVGT File Details dialog DLL. +* +*/ + + +// +// +// using relative paths for sourcepath and user includes +// exports are unfrozen +#include +#include + +TARGET svgtfileviewdetails.dll +TARGETTYPE dll +UID 0x1000008d 0x10004420 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../data + +LANGUAGE_IDS + +// This is a SYSTEMINCLUDE macro containing the applications +// layer specific include directories +APP_LAYER_SYSTEMINCLUDE + +START RESOURCE svgtfileviewdetails.rss +TARGETPATH RESOURCE_FILES_DIR +HEADER +LANGUAGE_IDS +END // RESOURCE + +SOURCEPATH ../SvgtFileViewDetailsSrc +SOURCE svgtfileviewdetails.cpp +SOURCE SVGTDrmHelper.cpp + +USERINCLUDE ../SvgtFileViewDetailsInc + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY cone.lib +LIBRARY bafl.lib +LIBRARY eikcoctl.lib +LIBRARY caf.lib +LIBRARY avkon.lib +LIBRARY drmhelper.lib +LIBRARY CommonEngine.lib +LIBRARY tzclient.lib + +#if defined(WINSCW) + deffile ../BWINSCW/svgtfileviewdetails.def +#elif defined(ARMCC) + deffile ../EABI/svgtfileviewdetails.def +#endif + +nostrictdef +//exportunfrozen + +// End of file + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/SVGCodecInc/SVGCodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/SVGCodecInc/SVGCodec.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,291 @@ +/* +* Copyright (c) 2005 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: SVGT codec for reading the file header & data. +* +*/ + + +#ifndef SVGCODEC_H +#define SVGCODEC_H + +#include +#include +#include +#include + + +class CSvgEngineInterfaceImpl; +class CFbsBitmap; +class TFrameInfo; +class TSVGFrameInfo; +class MSvgError; +class CGulIcon; + +// SVG Read codec. +class CSvgReadCodec : public CImageProcessorReadCodec + ,public MSvgRequestObserver + , public MSvgLoadingListener + + { +public: + enum TDownloadNeeded + { + // The uri refers to a local image file + ELocalImageFile, + // The uri refers to a remote image file + ERemoteImageFile, + // The uri doesnt refer to an image file + ENotAnImageFile + }; + + enum TImagesLocation + { + EPhoneMemory, + EMemoryCard + }; +public: + + /** + * Static constructor. Creates and returns a pointer to CSvgReadCodec + * @since 3.1 + * @return Pointer to the read codec instance. + */ + static CSvgReadCodec* NewL(const TSize& aSize); + + /** + * Destructor. + */ + virtual ~CSvgReadCodec(); + + /** + * Sets the SVG presentation data + * @since 3.1 + * @param aFileData SVG presentation file data + */ + void SetFileDataL( const TDesC8& aFileData ); + +public: //From MSvgRequestObserver + void UpdateScreen(); + + TBool ScriptCall( const TDesC& aScript, CSvgElementImpl* aCallerElement ); + + TInt FetchImage( const TDesC& aUri, RFs& aSession, RFile& aFileHandle ) ; + TInt CSvgReadCodec::FetchFont( const TDesC& /* aUri */, + RFs& /* aSession */, RFile& /* aFileHandle */ ); + + void GetSmilFitValue( TDes& aSmilValue ); + + void UpdatePresentation( const TInt32& aNoOfAnimation ); + +public: //User methods + void PrepareEngine(); + TSize ContentSize() const; + void GenerateThumbnailL(CFbsBitmap* aFrame, CFbsBitmap* aFrameMask); + TDownloadNeeded IsDownloadNeededL( const TDesC& aUri ) const; + TBool GetLocalFile( const TDesC& aUri, + TDes& aFileName , + const TDesC& aRefPath ) const; + + HBufC* GetImagesPath( CSvgReadCodec::TImagesLocation aImagesLocation) const; + +protected: + // From CImageProcessorReadCodec + /** + * Performs initial processing of image data and mask bitmaps. + * @param aFrameInfo + A reference to a TFrameInfo object. + * @param aFrameImageData + A reference to a CFrameImageData object. + * @param aDisableErrorDiffusion + A flag indicating whether error diffusion should be disabled. + * @param aDestination + The destination bitmap. + * @param aDestinationMask + The destination mask bitmap. + */ + virtual void InitFrameL(TFrameInfo& aFrameInfo, CFrameImageData& aFrameImageData, TBool aDisableErrorDiffusion, CFbsBitmap& aDestination, CFbsBitmap* aDestinationMask); + + /** + * Processes the frame data contained in aSrc. + * This is a pure virtual function that each derived class must implement. + * @param aSrc + * A reference to the buffer containing the frame data. + * + * @return The current frame state after processing. + */ + + virtual TFrameState ProcessFrameL(TBufPtr8& aSrc); + +private: + + /** + * Precesses the SVG presentation file data + */ + void DoProcessL(); + + /** + * Default constructor + * @param aSize specifies the thubnail size + */ + CSvgReadCodec(const TSize& aSize); + + void ConstructL(); + void InitializeEngineL(); + /** + * Deletes the structures associated with the engine + * viz. The Frame List, Mask List, Delay Interval List, + * The DOM for the content and the Engine Implementation itself + */ + void DeleteEngine(); +// From MSvgLoadingListener +public: + /** + * Query the listener if every element is to be reported or only + * the children of tag. + * + * @since 1.0 + * @return : ETrue if every element is to be reported, otherwise + * only the children of are reported. + */ + TBool ReportAllElements(); + + /** + * Query the listener if client will call 'AssignImageData' to decode images + * separately from parsing. This is used to avoid non-thread-safe calls in + * creating bitmap and decoding images, which must be executed in the main thread. + * + * @since 1.0 + * @return : ETrue to use 'ImageDataReference' instead of 'FetchImage'. + */ + TBool WillAssignImageData(); + + /** + * Callback when the href:xlink attribute is encountered for the + * element. This method is used to notify clients of image data references + * needed by element. This method is called only when 'WillAssignImageData' + * returns ETrue. + * + * @since 1.0 + * @return : none. + */ + void ImageDataReference( const TDesC& aUri ); + + /** + * Notified when the start of a svg document( tag) is encountered. + * + * @since 1.0 + * @return : For future use. Value is ignored. + */ + TBool DocumentStart() ; + + /** + * Notified when the end of a svg document( tag) is encountered. + * + * @since 1.0 + * @return : For future use. Value is ignored. + */ + TBool DocumentEnd(); + + /** + * Notified when the start of a svg element is encountered. + * + * @since 1.0 + * @param : aTagName -- name of svg tag + * @param : aAttributeList -- attribute list. + * @return : For future use. Value is ignored. + */ + TBool ElementStart( const TDesC& aTagName, + MSvgAttributeList& aAttributeList); + + /** + * Notified when the end of a svg element is encountered. + * activated. + * + * @since 1.0 + * @param : aTagName -- name of svg tag + * @return : For future use. Value is ignored. + */ + TBool ElementEnd( const TDesC& aTagName ); + + /** + * Notified when an external data is needed by the svg document, + * such as a image-file or an embedded svg-file. + * + * @since 1.0 + * @param : aUri -- URI string of external data + * @return : For future use. Value is ignored. + */ + TBool ExternalDataRequested( const TDesC& aUri ); + + /** + * Notified when an external data has been retrieved, + * such as a image-file or an embedded svg-file. + * + * @since 1.0 + * @param : aUri -- URI string of external data + * @return : For future use. Value is ignored. + */ + TBool ExternalDataReceived( const TDesC& aUri ); + + /** + * Notified when an external data request has failed. + * + * @since 1.0 + * @param : aUri -- URI string of external data + * @return : For future use. Value is ignored. + */ + TBool ExternalDataRequestFailed( const TDesC& aUri ); + + /** + * Notified when an unsupported element is encountered. + * + * @since 1.0 + * @param : aTagName -- tag name of element + * @param : aAttributeList -- attribute list. + * @return : For future use. Value is ignored. + */ + TBool UnsupportedElement( const TDesC& aTagName, + MSvgAttributeList& aAttributeList ); + + void ImagesLoaded(TInt aError); + void GetNewDataPosition(TInt &aPosition, TInt &aLength); + +private: // Data + // Dummy Bitmap used by SVG Engine to render content. + CFbsBitmap* iSVGTBitMapDummy; + + // SVG Engine Interface Implementation pointer + CSvgEngineInterfaceImpl* iSvgModule; + + //Frame Array + RPointerArray iFrameList; + RPointerArray iMaskList; + RArray iDelayList; + + // SVG Thumbnail Handle + TInt iThumbnailHandle; + + // SVGT content filename descriptor + HBufC8* iFileData; + TSize iContentSize; + MSvgError* iPrepareDomResult; + + TBool iImagesPresent; + + TBool iImagesLoaded; + + TSize iOriginalSize; + }; + +#endif //SVGCODEC_H diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/SVGCodecInc/SVGConvert.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/SVGCodecInc/SVGConvert.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2005 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: ECom plugin to create the thumbnails from svg presentation. +* +*/ + + + +#ifndef SVGCONVERT_H +#define SVGCONVERT_H + +#include + +class CSvgReadCodec; +class CFrameInfoStrings; + +/** +* The PluginAPI for SVG content decoder. +* Intended to use it for the processing the SVG content. +*/ + +class CSvgDecoder : public CImageDecoderPlugin + { +public: + + /** + * Static constructor. Creates and returns a pointer to CSvgDecoder + * @since 3.1 + * @return Pointer to the deocder instance. + */ + static CSvgDecoder* NewL(); + + /** + * Destructor. + */ + ~CSvgDecoder(); + +public: //From CImageDecoderPlugin + /** + * Returns the image type & image sub type of the frame number specified + * @since 3.1 + * @param aFrameNumber + * @param aImageType + * @param aImageSubType + * @return None. + */ + void ImageType(TInt aFrameNumber, TUid& aImageType, TUid& aImageSubType) const; + + /** + * Returns the codec specific frame information stored in resource files. + * This is a virtual funtion that each individual plugin must implement. + * @param aFs A handle to a file server session. + * @param aFrameNumber The frame number to which the codec specific frame information + * applies (optional, defaults to zero). + * @return A pointer to a newly allocated CFrameInfoStrings object. + * Ownership is transferred to the caller. + */ + CFrameInfoStrings* FrameInfoStringsL(RFs& aFs, TInt aFrameNumber); + + TSize ContentSizeInTwips(const TSize aContentSizeInPixels) const; + +private: + //Default constructor + CSvgDecoder(); + +private: //From CImageDecoderPlugin + + /** + * Invokes the ReadFrameHeadersL() method of the supplied plugin. + * The plugin's version of ReadFrameHeadersL() should read the image header \ + * information, create + * the required codec and read the frame headers. + * This is a virtual funtion that each individual plugin must implement. + */ + void ScanDataL(); + + /** + * Reads the image header & data information. It populates the image information \ + * like content size, pixel depth. + * @since 3.1 + */ + void ReadFormatL(); + +private: //Data members + TPtrC8 iFileData; + }; + + +#endif // SVGCONVERT_H +// End of File + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/SVGCodecInc/SVGImageCodecUIDs.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/SVGCodecInc/SVGImageCodecUIDs.hrh Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2005 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: Svg Decoder plugin UIDs. +* +*/ + + +#ifndef SVGIMAGECODECUIDS_HRH +#define SVGIMAGECODECUIDS_HRH + +#define KSVGCodecDllUidValue 0x102073D7 +#define KSVGDecoderImplementationUidValue 0x102071E8 + +#endif //SVGIMAGECODECUIDS_HRH + +//End of file diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/SVGCodecInc/SVGProxy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/SVGCodecInc/SVGProxy.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2005 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: SVGT proxy for resolving plugin. +* +*/ + + +#ifndef SVGDECODECONSTRUCT_H +#define SVGDECODECONSTRUCT_H + +#include + +class CSvgDecodeConstruct : public CImageDecodeConstruct + { +public: + /** + * Static constructor. Creates and returns a pointer to CSvgDecodeConstruct + * @since 3.1 + * @return Pointer to the decode construct instance. + */ + + static CSvgDecodeConstruct* NewL(); + + // From CImageDecodeConstruct + /** + * Creates a new concrete CImageDecoderPlugin object. + * This is a pure virtual function that each derived class must implement. + * @return A pointer to a fully constructed CImageDecoderPlugin. + */ + + CImageDecoderPlugin* NewPluginL() const; + }; + +#endif //SVGDECODECONSTRUCT_H \ No newline at end of file diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/SVGCodecSrc/SVGCodec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/SVGCodecSrc/SVGCodec.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,967 @@ +/* +* Copyright (c) 2005 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: This file implements the read codec for the SVG presentation +* +*/ + + +#include "SVGCodec.h" + +// INCLUDE FILES +#include +#include +#include +#include +#include +// User Includes +#include +#include +#include + +#ifdef RD_MULTIPLE_DRIVE +#include +#include +#endif + +// General Constants +const TInt KSccConstZero = 0; +const TUint KSccBackground = 0xffffffff; +// SMIL Fit Value +_LIT( KSccSmilFitValue,"meet" ); + +// +_LIT( KWww, "www" ); +_LIT( KHttp, "http://"); +_LIT( KDotDot, ".." ); +_LIT( KBSlashStr, "/" ); +_LIT( KSlashStr, "\\" ); +_LIT( KDotSlashStr, ".\\" ); +_LIT( KColonStr, ":" ); + +_LIT(KJpg, ".jpg" ); +_LIT(KJpeg, ".jpeg" ); +_LIT(KPng, ".png" ); +_LIT(KBmp, ".bmp" ); +_LIT(KSvg, ".svg" ); +_LIT(KSvgz, ".svgz" ); +// + +enum TSVGCodecPanic + { + ECouldNotGenerateThumbnail + }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSvgReadCodec::CSvgReadCodec +// Default constructor. +// ----------------------------------------------------------------------------- +// +CSvgReadCodec::CSvgReadCodec( const TSize& aSize ): iImagesPresent(EFalse), + iImagesLoaded (EFalse), + iOriginalSize(aSize) + + { + } + +// ----------------------------------------------------------------------------- +// CSvgReadCodec::NewL +// Static constructor. Returns the pointer to the CSvgReadCodec +// ----------------------------------------------------------------------------- +// +CSvgReadCodec* CSvgReadCodec::NewL( const TSize& aSize ) + { + CSvgReadCodec* self = new(ELeave) CSvgReadCodec( aSize ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CSvgReadCodec::ConstructL() + { + iSvgModule = NULL; + iSVGTBitMapDummy = NULL; + InitializeEngineL(); + } + +void CSvgReadCodec::InitializeEngineL() + { + if ( !iSvgModule ) + { + TFontSpec spec; + + if ( !iSVGTBitMapDummy ) + { + // For thumbnails, the user provided bitmap is used, + // Have to give some dummy bitmap to the engine in the constructor. + iSVGTBitMapDummy = new( ELeave ) CFbsBitmap; + User::LeaveIfError( + iSVGTBitMapDummy->Create( + TSize( KSccConstZero, KSccConstZero ), + EGray2 ) ); + } + + iSvgModule = CSvgEngineInterfaceImpl::NewL( iSVGTBitMapDummy, this, spec ); +// 0xffffffff is the default color. + iSvgModule->SetBackgroundColor( KSccBackground ); + iSvgModule->AddListener(static_cast(this), + ESvgLoadingListener); + + } + } + +// ----------------------------------------------------------------------------- +// CSvgReadCodec::~CSvgReadCodec +// Destructor +// ----------------------------------------------------------------------------- +// +CSvgReadCodec::~CSvgReadCodec() + { + DeleteEngine(); + + // Dummy bitmap + delete iSVGTBitMapDummy; + + // SVG file data + delete iFileData; + } + +// ----------------------------------------------------------------------------- +// CSvgReadCodec::SetFileDataL +// Sets the SVG presentation data +// ----------------------------------------------------------------------------- +// +void CSvgReadCodec::SetFileDataL( const TDesC8& aFileData ) + { + delete iFileData; + iFileData = NULL; + + // For files which are in UTF-16 or unicode format the first 2 bytes + // will be FF and FE. In UTF-16 and unicode format every single character + // is represented by two bytes. + + HBufC8* binaryBuffer=NULL; + binaryBuffer = HBufC8::NewL( aFileData.Length() ); + + TPtr8 binaryBufferPtr = binaryBuffer->Des(); + binaryBufferPtr = aFileData; + + TInt hichar = (CEditableText::EReversedByteOrderMark & 0xFF00)>>8; + TInt lochar = CEditableText::EReversedByteOrderMark & 0x00FF; + TInt bytesPerChar = 1; + + if(binaryBufferPtr[0] == hichar && binaryBufferPtr[1] == lochar) + { + bytesPerChar = 2; + + HBufC* dataBuffer=NULL; + TInt fileSize = aFileData.Length(); + dataBuffer = HBufC::New(aFileData.Length()/bytesPerChar); + if ( !dataBuffer) + { + //_LIT( KErrorMsg, "Failed to Load Svg Content: Out of memory"); + delete binaryBuffer; + return; + } + + TPtr dataBufferPtr = dataBuffer->Des(); + + // Skip two bytes and set the pointer to the next location + // from where the actual data starts. + dataBufferPtr.Set((TUint16*)binaryBufferPtr.Ptr()+1, + fileSize/bytesPerChar-1, + fileSize/bytesPerChar-1); + + HBufC8* outputBuffer= NULL; + outputBuffer=HBufC8::New(fileSize); + if(!outputBuffer) + { + //_LIT( KErrorMsg, "Failed to Load Svg Content: Out of memory"); + delete dataBuffer; + delete binaryBuffer; + return ; + } + TPtr8 outputBufferptr=outputBuffer->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( + outputBufferptr, // Destination + dataBufferPtr ); + + iFileData = HBufC8::NewL(fileSize); + iFileData->Des().Copy(outputBufferptr); + + delete dataBuffer; + delete outputBuffer; + + } + else + { + iFileData = HBufC8::NewL(aFileData.Length()); + iFileData->Des().Copy( aFileData ); + } + delete binaryBuffer; + } + +// ----------------------------------------------------------------------------- +// CSvgReadCodec::ProcessFrameL +// Processes the frame data contained in aSrc. +// ----------------------------------------------------------------------------- +// +TFrameState CSvgReadCodec::ProcessFrameL(TBufPtr8& aSrc ) + { + aSrc.Shift( 1 ); + TFrameState lRetVal = EFrameComplete; + DoProcessL(); + + if(iImagesPresent && !iImagesLoaded) + { + lRetVal = EFrameIncompleteRepositionRequest; + } + + return lRetVal; + } + +// ----------------------------------------------------------------------------- +// CSvgReadCodec::DoProcessL +// Processes the SVG presentation file data. Called by ProcessFrameL() +// ----------------------------------------------------------------------------- +// +void CSvgReadCodec::DoProcessL() + { + } + +// ----------------------------------------------------------------------------- +// CSvgReadCodec::InitFrameL +// Processes the SVG presentation file data. Called by ProcessFrameL() +// ----------------------------------------------------------------------------- +// +void CSvgReadCodec::InitFrameL(TFrameInfo& /* aFrameInfo*/, + CFrameImageData& /*aFrameImageData*/, + TBool /*aDisableErrorDiffusion */, + CFbsBitmap& aFrame, + CFbsBitmap* /* aDestinationMask */ ) + { + GenerateThumbnailL(&aFrame, NULL); + } + +void CSvgReadCodec::UpdateScreen() + { + } + +TBool CSvgReadCodec::ScriptCall( const TDesC& /*aScript*/, CSvgElementImpl* /*aCallerElement*/ ) + { + return EFalse; + } + +TInt CSvgReadCodec::FetchImage( const TDesC& aUri, RFs& aSession, RFile& aFileHandle ) + { + TInt errorCode = KErrNotFound; + TInt ret = 0; + TRAPD(err, ret = IsDownloadNeededL(aUri)); + if(err==KErrNone) + { + if( ret == ELocalImageFile) + { + TFileName fileName; + +#ifdef RD_MULTIPLE_DRIVE + +// RFs fsSession; + HBufC* fullImagesPathBuf = HBufC::New( KMaxPath ); + if (fullImagesPathBuf) + { + TPtr fullImagesPathPtr = fullImagesPathBuf->Des(); + TInt intDrive; + DriveInfo::TDriveArray driveArray; + +// fsSession.Connect(); + + TInt err1=DriveInfo::GetUserVisibleDrives( aSession, driveArray ); + if(err1==KErrNone) + { + for(TInt i=0; i < driveArray.Count(); i++) + { + TChar driveLetter = driveArray.LetterAt(i); + TInt err2=RFs::CharToDrive(driveLetter, intDrive); + if(err2==KErrNone) + { + TInt err3=PathInfo::GetRootPath(fullImagesPathPtr, intDrive); + if(err3==KErrNone) + { + fullImagesPathPtr.Append( PathInfo::ImagesPath() ); + if(GetLocalFile( aUri, fileName, fullImagesPathPtr)) + { + errorCode = aFileHandle.Open( aSession, fileName, EFileShareAny ); + break; + } + } + } + } + } + } + delete fullImagesPathBuf; + fullImagesPathBuf=NULL; + +// fsSession.Close(); + +#else + + HBufC* phoneMemImagesPath = GetImagesPath(EPhoneMemory); + TPtr ptrphoneMemImagesPath(phoneMemImagesPath->Des()); + HBufC* memCardImagesPath = GetImagesPath(EMemoryCard); + TPtr ptrMemCardImagesPath(memCardImagesPath->Des()); + + if(GetLocalFile( aUri, fileName, ptrphoneMemImagesPath)) + errorCode = aFileHandle.Open( aSession, fileName, EFileShareAny ); + else if(GetLocalFile( aUri, fileName, ptrMemCardImagesPath)) + errorCode = aFileHandle.Open( aSession, fileName, EFileShareAny ); + + delete memCardImagesPath; + delete phoneMemImagesPath; +#endif + } + } + return errorCode; +} + +TInt CSvgReadCodec::FetchFont( const TDesC& /* aUri */, + RFs& /* aSession */, RFile& /* aFileHandle */ ) + { + return KErrNotSupported; + } + + +void CSvgReadCodec::GetSmilFitValue( TDes& aSmilValue ) + { + aSmilValue.Copy( KSccSmilFitValue ); + } + +void CSvgReadCodec::UpdatePresentation( const TInt32& /* aNoOfAnimation */ ) + { + } + +void CSvgReadCodec::PrepareEngine() + { + iPrepareDomResult = iSvgModule->PrepareDom( *iFileData, iThumbnailHandle ); + TInt err = iPrepareDomResult->HasError(); + iSvgModule->UseDom( iThumbnailHandle, NULL); + iContentSize = iSvgModule->GetSvgBoundingBox().Size(); + if(iContentSize.iHeight < 1) + { + iContentSize.iHeight = 1; + } + if(iContentSize.iWidth < 1) + { + iContentSize.iWidth = 1; + } + } + +TSize CSvgReadCodec::ContentSize() const + { + return iContentSize; + } + +void CSvgReadCodec::GenerateThumbnailL(CFbsBitmap* aFrame, CFbsBitmap* /*aFrameMask*/) + { + if ( iSvgModule ) + { + // NULL is returned, possible out of memory when create error object. + User::LeaveIfNull( iPrepareDomResult ); + User::LeaveIfError(iPrepareDomResult->HasError()); +#ifdef SVGTUICONTROL_DBG_DRM_THUMBNAIL_API_ENABLE + iSvgModule->SetThumbNailMode( ETrue ); // Set thumbnail mode On +#endif // SVGTUICONTROL_DBG_DRM_THUMBNAIL_API_ENABLE + + // Setup the engine to use the DOM + MSvgError* pResult = iSvgModule->UseDom( iThumbnailHandle, aFrame ); + if ( pResult->HasError() && !pResult->IsWarning() ) + { + User::Leave( KErrGeneral ); + } + + // View Box define for Dom associated frame + iSvgModule->ChooseViewBoxIfNotSet(iThumbnailHandle); + + // Setup the frame size as the one obtained from + // creator of codec. + const TSize frameSize = aFrame->SizeInPixels(); + // Get the Display mode for bitmap + TDisplayMode lFrameDispMode = aFrame->DisplayMode(); + // Get the Displaymode for mask + iSvgModule->InitializeEngine(); + iSvgModule->RenderFrame( NULL, 0); + // render static content as well + if ( iFrameList.Count() ) + { + CFbsBitGc* bitmapContext=NULL; + CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( aFrame ); + CleanupStack::PushL( bitmapDevice ); + User::LeaveIfError( bitmapDevice->CreateContext( bitmapContext ) ); + CleanupStack::PushL( bitmapContext ); + bitmapContext->BitBlt( TPoint(0,0),iFrameList[ 0 ] ); + CleanupStack::PopAndDestroy(2); + } + +#ifdef SVGTUICONTROL_DBG_DRM_THUMBNAIL_API_ENABLE + iSvgModule->SetThumbNailMode( EFalse ); // Set thumbnail mode Off +#endif // SVGTUICONTROL_DBG_DRM_THUMBNAIL_API_ENABLE + } + } + +// ----------------------------------------------------------------------------- +// CSvgReadCodec::DeleteEngine +// Deletes the structures associated with the engine +// viz. The Frame List, Mask List, Delay Interval List, +// The DOM for the content and the Engine Implementation itself +// ----------------------------------------------------------------------------- +// +void CSvgReadCodec::DeleteEngine() + { + // Cleanup elements in the frame list + for ( TInt i = 0; i < iFrameList.Count(); i++ ) + { + delete iFrameList[i]; + } + + // Cleanup elements in the mask list + for ( TInt i = 0; i < iMaskList.Count(); i++ ) + { + delete iMaskList[i]; + } + + // Cleanup the memory used for storing the pointers/values + iFrameList.Reset(); + iMaskList.Reset(); + iDelayList.Reset(); + + // Close the resources + iFrameList.Close(); + iMaskList.Close(); + iDelayList.Close(); + + // Delete the DOM created for the content + //if ( iThumbnailHandle ) + // { + // iSvgModule->DeleteDom( iThumbnailHandle ); + // iThumbnailHandle = 0; + // } + + // Delete the Engine module + delete iSvgModule; + iSvgModule = NULL; + } + +CSvgReadCodec::TDownloadNeeded CSvgReadCodec::IsDownloadNeededL( const TDesC& aUri ) const + { + + TUriParser UriParser; + + TBuf localUri; + // url starts with www so append http:// + if ( !aUri.Left( 4 ).Compare( KWww ) ) + { + localUri.Append( KHttp ); + localUri.Append( aUri ); + User::LeaveIfError( UriParser.Parse( localUri ) ); + } + else + { + User::LeaveIfError( UriParser.Parse( aUri ) ); + } + + if ( UriParser.IsPresent( EUriHost ) ) + { + // Extract the Path, filename and extension from the uri + TFileName filename = UriParser.Extract( EUriPath ); + TParsePtrC fileParser( filename ); + + if ( fileParser.NamePresent() && fileParser.ExtPresent() ) + { + if ( fileParser.Ext().Compare( KJpg ) == 0 || + fileParser.Ext().Compare( KJpeg ) == 0 || + fileParser.Ext().Compare( KBmp ) == 0 || + fileParser.Ext().Compare( KPng ) == 0 || + fileParser.Ext().Compare( KSvg ) == 0 || + fileParser.Ext().Compare( KSvgz ) == 0 ) + { + // file name and ext present and + // it is amy of the supported image types + return ERemoteImageFile; + } + else + { + //file Extension present but not a supported image ext, + //may be some html file + return ENotAnImageFile; + } + } + else + { + //Should be a domain name so return ENotAnImageFile + return ENotAnImageFile; + } + } + else + { + return ELocalImageFile; + } + } + +TBool CSvgReadCodec::GetLocalFile( const TDesC& aUri, + TDes& aFileName , + const TDesC& aRefPath ) const + { + aFileName.Zero(); + TBuf copyUri = aUri; + // Before giving the uri to the file parser, + // convert '/' to '\'. + TInt pos; + while( KErrNotFound != ( pos = copyUri.FindF( KBSlashStr ) ) ) + { + copyUri.Replace(pos,1,KSlashStr ); + } + + // if the uri starts with ".\" remove ".\" + if ( copyUri.Left( 2 ).Compare( KDotSlashStr ) == 0 ) + { + copyUri = copyUri.Right( copyUri.Length() - KDotSlashStr().Length() ); + } + + // If the second letter is not ':' + // and if it is not starting with '\', + // and if the path has '/', + // then prepend slash to it. + if ( copyUri.Length() >= 2 && + copyUri.Mid( 1, 1 ).Compare( KColonStr ) != 0 && + copyUri.Mid( 0, 1 ).Compare( KSlashStr ) != 0 && + ( copyUri.Find( KSlashStr ) != KErrNotFound ) ) + { + copyUri.Insert( 0, KSlashStr ); + } + + TParse fileParser; + if( fileParser.Set( copyUri, NULL, NULL ) != KErrNone ) + { + return EFalse; + } + + if ( fileParser.DrivePresent() ) + { + // The uri is an absolute path + aFileName.Append( fileParser.Drive() ); + // Append path, file name and extension from the uri. + if ( fileParser.PathPresent() ) + { + aFileName.Append( fileParser.Path() ); + } + if ( fileParser.NamePresent() ) + { + aFileName.Append( fileParser.Name() ); + } + if ( fileParser.ExtPresent() ) + { + aFileName.Append( fileParser.Ext() ); + } + + if ( !ConeUtils::FileExists( aFileName ) ) + { + return EFalse; + } + return ETrue; + } + else + { + + TParse svgFilenameParser; + if ( svgFilenameParser.Set( aRefPath,NULL,NULL ) != KErrNone ) + { + return EFalse; + } + + if ( svgFilenameParser.DrivePresent() ) + { + aFileName.Append( svgFilenameParser.Drive() ); + } + + TInt dotdotPos = copyUri.Find( KDotDot ); + TInt rightPos = 0; + + if ( dotdotPos != KErrNotFound ) + { + // If ".." is present collapse it with the parent path + if ( svgFilenameParser.PathPresent() ) + { + do + { + if ( dotdotPos > 1 ) + { + svgFilenameParser.AddDir( copyUri.Left(dotdotPos - 1) ); + } + + if ( svgFilenameParser.PopDir() != KErrNone ) + { + return EFalse; + } + + rightPos = (copyUri.Length()) - (dotdotPos + 3); + + if ( rightPos > 0 ) + { + copyUri = copyUri.Right( rightPos ); + } + + }while ( (dotdotPos = copyUri.Find( KDotDot ) ) + != KErrNotFound ); + + aFileName.Append( svgFilenameParser.Path() ); + aFileName.Append( copyUri ); + } + else + { + return EFalse; + } + } + else + { + if ( svgFilenameParser.PathPresent() ) + { + aFileName.Append( svgFilenameParser.Path() ); + } + + // Append path, file name and extension from the uri. + if ( fileParser.PathPresent() ) + { + TFileName path(fileParser.Path() ); + path.Copy(path.Right(path.Length()-1)); + aFileName.Append( path ); + + } + + if ( fileParser.NamePresent() ) + { + aFileName.Append( fileParser.Name() ); + } + if ( fileParser.ExtPresent() ) + { + aFileName.Append( fileParser.Ext() ); + } + } + if ( !ConeUtils::FileExists( aFileName ) ) + { + return EFalse; + } + return ETrue; + } + } + +HBufC* CSvgReadCodec::GetImagesPath( + CSvgReadCodec::TImagesLocation aImagesLocation) const + { + HBufC* fullImagesPath = HBufC::New( KMaxPath ); + if(fullImagesPath) + { + TPtr ptrFullImagesPath(fullImagesPath->Des()); + + TPtrC8 ptrImagesPath((TText8*)text_images_path); + TFileName imagesPath16; + imagesPath16.Copy(ptrImagesPath); + + switch( aImagesLocation ) + { + case EPhoneMemory: + { + TPtrC8 ptrRootPhoneMemPath((TText8*)text_phone_memory_root_path); + ptrFullImagesPath.Copy(ptrRootPhoneMemPath); + } + break; + case EMemoryCard: + { + TPtrC8 ptrRootMemCardPath((TText8*)text_memory_card_root_path); + ptrFullImagesPath.Copy(ptrRootMemCardPath); + } + break; + default: + break; + } + ptrFullImagesPath.Append(imagesPath16); + } + return fullImagesPath; + } + + //------------------------------------------------------------------------ +//From MsvgLoadingListener +/** + * Query the listener if every element is to be reported or only + * the children of tag. + * + * @since 1.0 + * @return : ETrue if every element is to be reported, otherwise + * only the children of are reported. + */ + TBool CSvgReadCodec::ReportAllElements() + { + return ETrue; + } + + /** + * Query the listener if client will call 'AssignImageData' to decode images + * separately from parsing. This is used to avoid non-thread-safe calls in + * creating bitmap and decoding images, which must be executed in the main thread. + * + * @since 1.0 + * @return : ETrue to use 'ImageDataReference' instead of 'FetchImage'. + */ + TBool CSvgReadCodec::WillAssignImageData() + { + return ETrue; + } + + /** + * Callback when the href:xlink attribute is encountered for the + * element. This method is used to notify clients of image data references + * needed by element. This method is called only when 'WillAssignImageData' + * returns ETrue. + * + * @since 1.0 + * @return : none. + */ + void CSvgReadCodec::ImageDataReference( const TDesC& aUri ) + { + iImagesPresent = ETrue; + + HBufC8* lImageData = NULL; + + TInt errorCode = KErrNotFound; + TInt ret = 0; + TRAPD(err, ret = IsDownloadNeededL(aUri)); + if(err==KErrNone) + { + if( ret != ELocalImageFile) + { + lImageData = HBufC8::New(0); + if(lImageData) + { + iSvgModule->AssignImageData(aUri , lImageData ); + } + + return; + } + + _LIT(KEncodedImage,"data:image"); + + if( ! ( aUri.Left(10).Compare(KEncodedImage) )) + { + _LIT(KBase,"Base64"); + if(aUri.FindF(KBase) != KErrNotFound) + { + TInt startIndex = aUri.Locate( ';' ); + TInt endIndex = aUri.Locate( ',' ); + // find index of first character after white-space + TInt index = endIndex + 1; + while ( index < aUri.Length() && TChar( aUri[index] ).IsSpace() ) + index++; + // must be 8-bit + TInt length = aUri.Length() - index; + HBufC8* encoded = HBufC8::New( length ); + if(encoded) + { + encoded->Des().Copy( aUri.Right( length ) ); + // Assign to member variable to destroy after image is process. + lImageData = HBufC8::New( length ); + if(lImageData) + { + TPtr8 decodedDes = lImageData->Des(); + // decode + TImCodecB64 encodingBase64; + TInt decodeError = encodingBase64.Decode( *encoded, decodedDes ); + delete encoded; + encoded = NULL; + } + } + } + else + { + //lImageData = HBufC8::NewL(0); + } + } + else + { + RFile lSvgFile; + TFileName lFileName; + RFs session; + + TInt Connecterror = session.Connect(); + + HBufC* phoneMemImagesPath = GetImagesPath(EPhoneMemory); + TPtr ptrphoneMemImagesPath(phoneMemImagesPath->Des()); + HBufC* memCardImagesPath = GetImagesPath(EMemoryCard); + TPtr ptrMemCardImagesPath(memCardImagesPath->Des()); + + if(GetLocalFile( aUri, lFileName, ptrphoneMemImagesPath)) + errorCode = lSvgFile.Open( session, lFileName, EFileShareAny ); + else if(GetLocalFile( aUri, lFileName, ptrMemCardImagesPath)) + errorCode = lSvgFile.Open( session, lFileName, EFileShareAny ); + + delete memCardImagesPath; + delete phoneMemImagesPath; + + if(errorCode == KErrNone) + { + // Get the size of the data to create read buffer + TInt lFileSize = 0; + TInt sizeError = lSvgFile.Size(lFileSize) ; + // Create buffer that will contain the file data + lImageData = HBufC8::New(lFileSize); + if(lImageData) + { + TPtr8 lFileDataPtr(lImageData->Des()); + + // Read from the file + TInt ReadError = lSvgFile.Read(lFileDataPtr); + } + } + else + { + lImageData = HBufC8::New(0); + } + lSvgFile.Close(); + session.Close(); + } + if(lImageData) + { + iSvgModule->AssignImageData(aUri , lImageData ); + } + } + } + + /** + * Notified when the start of a svg document( tag) is encountered. + * + * @since 1.0 + * @return : For future use. Value is ignored. + */ + TBool CSvgReadCodec::DocumentStart() + { + return EFalse; + } + + /** + * Notified when the end of a svg document( tag) is encountered. + * + * @since 1.0 + * @return : For future use. Value is ignored. + */ + TBool CSvgReadCodec::DocumentEnd() + { + return ETrue; + } + + /** + * Notified when the start of a svg element is encountered. + * + * @since 1.0 + * @param : aTagName -- name of svg tag + * @param : aAttributeList -- attribute list. + * @return : For future use. Value is ignored. + */ + TBool CSvgReadCodec::ElementStart( const TDesC& /*aTagName*/, + MSvgAttributeList& /*aAttributeList*/) + { + return ETrue; + } + + /** + * Notified when the end of a svg element is encountered. + * activated. + * + * @since 1.0 + * @param : aTagName -- name of svg tag + * @return : For future use. Value is ignored. + */ + TBool CSvgReadCodec::ElementEnd( const TDesC& /*aTagName*/ ) + { + return ETrue; + } + + /** + * Notified when an external data is needed by the svg document, + * such as a image-file or an embedded svg-file. + * + * @since 1.0 + * @param : aUri -- URI string of external data + * @return : For future use. Value is ignored. + */ + TBool CSvgReadCodec::ExternalDataRequested( const TDesC& /*aUri*/ ) + { + return EFalse; + } + + /** + * Notified when an external data has been retrieved, + * such as a image-file or an embedded svg-file. + * + * @since 1.0 + * @param : aUri -- URI string of external data + * @return : For future use. Value is ignored. + */ + TBool CSvgReadCodec::ExternalDataReceived( const TDesC& /*aUri*/ ) + { + return EFalse; + } + + /** + * Notified when an external data request has failed. + * + * @since 1.0 + * @param : aUri -- URI string of external data + * @return : For future use. Value is ignored. + */ + TBool CSvgReadCodec::ExternalDataRequestFailed( const TDesC& /*aUri*/ ) + { + return EFalse; + } + + /** + * Notified when an unsupported element is encountered. + * + * @since 1.0 + * @param : aTagName -- tag name of element + * @param : aAttributeList -- attribute list. + * @return : For future use. Value is ignored. + */ + TBool CSvgReadCodec::UnsupportedElement( const TDesC& /*aTagName*/, + MSvgAttributeList& /*aAttributeList*/ ) + { + return EFalse; + } + + + void CSvgReadCodec::ImagesLoaded(TInt /*aError*/) + { + iImagesLoaded = ETrue; + iImagesPresent = EFalse; + } + +void CSvgReadCodec::GetNewDataPosition(TInt& aPosition, TInt& /*aLength*/) + { + // Reset position to force seek to beginning + aPosition =0; + } + + + + + +//End of file diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/SVGCodecSrc/SVGConvert.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/SVGCodecSrc/SVGConvert.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2005 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: This file implements the decoder for the SVG presentation +* +*/ + + +#include "SVGConvert.h" +#include +#include +#include +#include <102073d7_extra.rsg> +#include +#include "SVGCodec.h" + +_LIT(KSVGPanicCategory, "SVGConvertPlugin"); +const TInt KInitialFrameWidth = 1; +const TInt KInitialFrameHeight = 1; + +// Number of bits per pixel used in ReadFormatL +const TInt KSvgDecBitsPerPixel = 24; + +enum TIclPanic + { + EFrameNumberOutOfRange = 0x1 + }; + +// Global panic function +GLDEF_C void Panic(TIclPanic aError) + { + User::Panic(KSVGPanicCategory, aError); + } + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSvgDecoder::NewL +// Static constructor. Returns the pointer to the CSvgDecoder +// ----------------------------------------------------------------------------- +// +CSvgDecoder* CSvgDecoder::NewL() + { + return new (ELeave) CSvgDecoder; + } + +// ----------------------------------------------------------------------------- +// CSvgDecoder::~CSvgDecoder +// C++ destructor. +// ----------------------------------------------------------------------------- +// +CSvgDecoder::~CSvgDecoder() + { + CImageDecoderPlugin::Cleanup(); + } + +// ----------------------------------------------------------------------------- +// CSvgDecoder::ImageType +// Returns the image type and sub-type for a given frame of the image that +// has just been opened. +// ----------------------------------------------------------------------------- +// +void CSvgDecoder::ImageType(TInt aFrameNumber, TUid& aImageType, TUid& aImageSubType) const + { + __ASSERT_ALWAYS(aFrameNumber == 0, Panic( EFrameNumberOutOfRange )); + aImageType = KImageTypeSVGUid; + aImageSubType = KNullUid; + } + +// ----------------------------------------------------------------------------- +// Returns the codec specific frame information stored in resource files. +// This is a virtual funtion that each individual plugin must implement. +// ----------------------------------------------------------------------------- +// +CFrameInfoStrings* CSvgDecoder::FrameInfoStringsL( RFs& /*aFs*/, TInt /*aFrameNumber*/ ) + { + return NULL; + } + +// ----------------------------------------------------------------------------- +// CSvgDecoder::CSvgDecoder +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSvgDecoder::CSvgDecoder() + { + } + +// ----------------------------------------------------------------------------- +// Invokes the ReadFrameHeadersL() method of the supplied plugin. +// This is a virtual funtion that each individual plugin must implement. +// ----------------------------------------------------------------------------- +// +void CSvgDecoder::ScanDataL() + { + CSvgReadCodec* imageReadCodec = CSvgReadCodec::NewL( + TSize(KInitialFrameWidth, KInitialFrameHeight) + ); + SetImageReadCodec( imageReadCodec ); + + ReadFormatL(); + ReadFrameHeadersL(); + } + +// ----------------------------------------------------------------------------- +// Reads the image header & data information +// ----------------------------------------------------------------------------- +// +void CSvgDecoder::ReadFormatL() + { + ReadDataL(0, iFileData, KMaxTInt); + SetDataLength( iFileData.Length() ); + CSvgReadCodec* imageReadCodec = static_cast(ImageReadCodec()); + imageReadCodec->SetFileDataL( iFileData ); + + imageReadCodec->PrepareEngine(); + const TSize contentSize = imageReadCodec->ContentSize(); + + TFrameInfo imageInfo; + imageInfo = ImageInfo(); + imageInfo.iFrameCoordsInPixels.SetRect(TPoint(0, 0), contentSize ); + imageInfo.iOverallSizeInPixels = contentSize; + imageInfo.iBitsPerPixel = KSvgDecBitsPerPixel; + imageInfo.iDelay = 0; + imageInfo.iFlags = TFrameInfo::ECanDither | TFrameInfo::ETransparencyPossible; + imageInfo.iFrameDisplayMode = EColor64K; + imageInfo.iFrameSizeInTwips = ContentSizeInTwips(contentSize); + + SetImageInfo(imageInfo); + SetStartPosition(0); + } + +TSize CSvgDecoder::ContentSizeInTwips(const TSize aContentSizeInPixels) const + { + // Create zoom factor object + TRect boxInTwips(TPoint(0,0), TSize(0,0)); + CCoeEnv* coeEnv = CCoeEnv::Static(); + if(coeEnv) + { + TZoomFactor deviceMap(CCoeEnv::Static()->ScreenDevice()); + // Set zoom factor at 1 to 1 + deviceMap.SetZoomFactor(TZoomFactor::EZoomOneToOne); + const TRect boxInPixels(TPoint(0,0), aContentSizeInPixels); + // convert rectangle co-ordinates into pixels + boxInTwips = deviceMap.PixelsToTwips(boxInPixels); + } + return boxInTwips.Size(); + } + +// End of File + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/SVGCodecSrc/SVGProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/SVGCodecSrc/SVGProxy.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2005 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: This file implements the SVGT proxy for resolving plugins +* +*/ + + +#include "SVGProxy.h" +#include +#include +#include "SVGImageCodecUIDs.hrh" +#include "SVGConvert.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSvgDecodeConstruct::NewL +// Static constructor. Returns the pointer to the CSvgDecodeConstruct +// ----------------------------------------------------------------------------- +// +CSvgDecodeConstruct* CSvgDecodeConstruct::NewL() + { + CSvgDecodeConstruct* self = new (ELeave) CSvgDecodeConstruct; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CSvgDecodeConstruct::NewPluginL +// Creates a new concrete CImageDecoderPlugin object. +// This is a pure virtual function that each derived class must implement. +// ----------------------------------------------------------------------------- +// +CImageDecoderPlugin* CSvgDecodeConstruct::NewPluginL() const + { + return CSvgDecoder::NewL(); + } + +// Exported proxy for instantiation method resolution +// Define the Implementation UIDs for SVG decoder +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KSVGDecoderImplementationUidValue, CSvgDecodeConstruct::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginInc/SvgRenderFrameControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginInc/SvgRenderFrameControl.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,272 @@ +/* +* Copyright (c) 2005 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: SVGRenderFrameControl provides an implementation of a control +* which renders SVG using RenderFrames API provided by the +* engine. +* +*/ + + +#ifndef SVGRENDERFRAMECONTROL_H +#define SVGRENDERFRAMECONTROL_H + +#include +#include +#include +#include +#include "SvgRenderFrameTimer.h" + +const TInt KMaxTimeDuration=2500; +class CSvgEngineInterfaceImpl; +class MSvgtAppObserver; + + +/** +* CSvgRenderFrameControl is a CCoeControl used to display SVGT content. +* It makes use of RenderFrames API provided by the svg engine to get +* the set of frame buffers and render it one by using render frame timer +* +* @lib SVGTScreenSaverPlugin.lib +* @since 3.1 +*/ +class CSvgRenderFrameControl: public CCoeControl, + public MSvgRenderFrameTimerListener, + public MSvgRequestObserver + { + + public: + + /** + * Two-phased constructor. + * @since 3.1 + */ + static CSvgRenderFrameControl* NewL( + const CCoeControl* aParent, + RFile& aFileHandle, + MSvgtAppObserver* aObserver = NULL ); + + /** + * Two-phased constructor. + * @since 3.1 + */ + static CSvgRenderFrameControl* NewLC( + const CCoeControl* aParent, + RFile& aFileHandle, + MSvgtAppObserver* aObserver = NULL ); + + /** + * Destructor. + */ + virtual ~CSvgRenderFrameControl(); + + + /** + * From CCoeControl, + * @since 3.1 + */ + void Draw(const TRect& aRect) const; + + /** + * From CCoeControl, + * @since 3.1 + */ + void SizeChanged(); + + public : // From MSvgRequestObserver + + /** + * From MSvgRequestObserver, Method Called by Svg Engine, + * when the frame buffer is updated and has to be redrawn + * @since 3.1 + */ + virtual void UpdateScreen(); + + /** + * From MSvgRequestObserver, Method Called by Svg Engine, + * when there is a script support + * @since 3.1 + */ + virtual TBool ScriptCall( const TDesC& aScript, + CSvgElementImpl* aCallerElement ); + + /** + * From MSvgRequestObserver, Method Called by Svg Engine, + * when it encounters an image element + * @since 3.1 + */ + virtual TInt FetchImage( const TDesC& aUri, RFs& aSession, + RFile& aFileHandle ); + + TInt FetchFont( const TDesC& /* aUri */, + RFs& /* aSession */, RFile& /* aFileHandle */ ); + + /** + * This Method is called by the Svg engine to Get the SMIL + * Fit Attribute Value + * @since 3.1 + */ + virtual void GetSmilFitValue( TDes& aSmilValue ); + + /** + * This Method updates the presentation status + * @since 3.1 + */ + virtual void UpdatePresentation(const TInt32& aNoOfAnimation); + + public: // From MSvgRenderFrameTimerListener + + /** + * This function is a callback from animation timer, + * when there is an animation timeout. + * @since 3.1 + */ + virtual void AnimationTimeOut(); + + + public: // New Function + + /* + * Starts the timer + * @since 3.1 + */ + void SetTimer(); + + /* + * Cancels the timer + * @since 3.1 + */ + void CancelTimer(); + + /* + * Processes the command sent by the user of the control + * @param aCommandId - command to be processed + * @since 3.1 + */ + virtual void ProcessViewerCommandL( TInt aCommandId ); + + /* + * Gets the current index of the frame buffers + * @since 3.1 + */ + TInt GetCurrentIndex() const; + + /* + * Sets the index of the buffer to be used + * @param aIndex - index to be set + * @since 3.1 + */ + void SetCurrentIndex( TInt aIndex ); + + /** + * This function initializes the svg engine. + * This function is also used to check the validity of the file. + * @param aCheckFile True if used in check file mode + * False otherwise + * @since 3.1 + */ + void InitializeEngineL( TBool aCheckFile, + MSvgRequestObserver* aObserver = NULL ); + + + /** + * This function deletes the svg engine. + * @since 3.1 + */ + void DeleteEngine(); + + /** + * This function uses the svg engine to get the frames in an array + * of buffers. + * @since 3.1 + */ + TInt RenderMyFrames(); + + /** + * This function moves the index of the array + * of buffers. + * @since 3.1 + */ + void MoveIndex(); + + /** + * This function logs the debug message + * @param aMsg - message to be logged + * @since 3.1 + */ + void PrintDebugMsg( const TDesC& aMsg ) const; + + + public: + /** + * Default Constructor + * @since 3.1 + */ + CSvgRenderFrameControl( RFile& aFileHandle , + MSvgtAppObserver* aObserver = NULL ); + + + /** + * 2nd phase constructor + * @since 3.1 + */ + void ConstructL( const CCoeControl* aParent ); + + private: + + // Pointer to the Svg Engine + CSvgEngineInterfaceImpl* iSvgEngine; + + // Frame buffer to be given to svg engine during initialization + CFbsBitmap* iBmap; + + // Array of bitmaps generated by RenderFrames + RPointerArray iBitmapFrames; + + // Array of corresponding masks for the Bitmaps + RPointerArray iMaskFrames; + + // Array of TimeInterval between frames + RArray iDelayIntervals; + + // file handle of the svg file to be set as ScreenSaver. + RFile* iFileHandle; + + // Index of the bitmap in the array + TInt iCurrentFrame; + + // Start duration to be given to RenderFrames + TUint iDuration; + + // Handle to the Svg Dom + TInt iSvgDom; + + // timer + CSvgRenderFrameTimer* iRenderFrameTimer; + + // boolean to check whether it is in play or paused state + TBool iCanPlay; + + // size of the control currently + TRect iRect; + + // Parent Control + const CCoeControl* iParent; + + // App observer pointer + MSvgtAppObserver* iAppObserver; + + }; + +#endif // SVGRENDERFRAMECONTROL_H +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginInc/SvgRenderFrameTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginInc/SvgRenderFrameTimer.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2005 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: SVGRenderFrameTimer provides an implementation of timer +* for RenderFrames Control +* +*/ + + +#ifndef SVGRENDERFRAMETIMER_H +#define SVGRENDERFRAMETIMER_H + +#if !defined(__E32BASE_H__) +#include +#endif + +/** +* Interface for the render frame timer listener. +* @lib SVGTScreenSaverPlugin.lib +* @since 3.1 +*/ +class MSvgRenderFrameTimerListener + { + + public: + /* + * Function called when timeout occurs + * @since 3.1 + */ + virtual void AnimationTimeOut() = 0; + + }; + +/** +* Provides the timer functionality for RenderFrames control +* @lib SVGTScreenSaverPlugin.lib +* @since 3.1 +*/ +class CSvgRenderFrameTimer: public CTimer + { + + public: + + /** + * Two-phased constructor. + * @since 3.1 + */ + static CSvgRenderFrameTimer* NewL( MSvgRenderFrameTimerListener* + aListener ); + + /** + * Two-phased constructor. + * @since 3.1 + */ + static CSvgRenderFrameTimer* NewLC(MSvgRenderFrameTimerListener* + aListener ); + + /** + * Destructor. + */ + virtual ~CSvgRenderFrameTimer(); + + + public: // CTimer interface methods + + + /** + * From CActive Implements cancellation of an outstanding request. + * @since 3.1 + */ + void DoCancel(); + + /** + * From CActive Handles the timer's request completion event. + * @since 3.1 + */ + void RunL(); + + public: // new function(s) + + /** + * Sets the timeout to the interval specified. + * @param anInterval the timeout value + * @since 3.1 + */ + void SetTimeOut( const TTimeIntervalMicroSeconds32& anInterval ); + + + private: + + /** + * Default Constructor + * @since 3.1 + */ + CSvgRenderFrameTimer( MSvgRenderFrameTimerListener* aListener ); + + /** + * 2nd phase constructor + * @since 3.1 + */ + void ConstructL(); + + private: + + // Listener for the timeout + MSvgRenderFrameTimerListener* iListener; + + }; + +#endif // SVGRENDERFRAMETIMER_H +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginInc/SvgScreenSaver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginInc/SvgScreenSaver.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2005 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: SVGScreenSaver provides an implementation of ScreenSaverPlugin +* for Svg files. +* +*/ + + +#ifndef SVGSCREENSAVER_H +#define SVGSCREENSAVER_H + +#include +#include +#include +#include + +const TInt KMaxFileSize=10000; +class CSVGTCustControl; +class CEikonEnv; + + +/** +* CSvgScreenSaver provides an implementation of MSvgtAppObserver +* It makes use of RenderFrames Control or SVGTCustControl to render +* the SVGT content. +* @lib SVGTScreenSaverPlugin.lib +* @since 3.1 +*/ +class CSvgScreenSaver: public CBase, + public MSvgtAppObserver, + public MPluginNotifier + { + + public: + + + /** + * Default Constructor + * @since 3.1 + */ + CSvgScreenSaver(); + + /** + * Destructor. + */ + virtual ~CSvgScreenSaver(); + + /** + * 2nd phase constructor + * @since 3.1 + */ + void ConstructL( const CCoeControl* aParent ); + + + /** + * Creates an SVG Custom Control or RenderFrames Control + * for the file + * @param aFileName + * @since 3.1 + */ + TInt AsFile(const TDesC& aFileName); + + /** + * Sets the rect for SVG Custom Control or RenderFrames Control + * for the file + * @param aRect + * @since 3.1 + */ + void SetRect(const TRect& aRect); + + /** + * Sends the command to SVG Custom Control or RenderFrames Control + * @param aCommand command to be sent to the control + * @since 3.1 + */ + void SendCommandL( TInt aCommand ); + + /** + * makes the control to be (in)visible + * @param aVisible ETrue makes the control visible + * EFalse makes the control invisible + * @since 3.1 + */ + void MakeVisible( TBool aVisible ); + + /** + * gets the last error encountered by the Control + * @since 3.1 + */ + TInt GetLastError() const; + + public: // Functions From MSvgtAppObserver + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::FetchImage + */ + virtual TInt FetchImage( const TDesC& aUri, RFs& aSession, + RFile& aFileHandle ); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::GetSmilFitValue + */ + virtual void GetSmilFitValue(TDes& aSmilValue); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::LinkActivated + */ + virtual TBool LinkActivated( const TDesC& aUri ); + + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::LinkActivatedWithShow + */ + virtual TBool LinkActivatedWithShow( const TDesC& aUri, + const TDesC& aShow ); + + /** + * This function is called by the application to enable/disable the + * downloads menu in the options menu + * @since 3.0 + * @param aAddDownloadMenu enable/disable the downloads menu + */ + + void SetDownloadMenu( TBool aAddDownloadMenu ); + + /** + * This function is called by the Ui Dialog to enable/disable the + * downloads menu in the options menu + * @since 3.0 + * @return iDownloadMenuEnabled enable/disable the downloads menu + */ + virtual TBool CanShowDownload() const; + + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::DisplayDownloadMenuL + */ + virtual void DisplayDownloadMenuL(); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::CanShowSave + */ + virtual TBool CanShowSave(); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::IsSavingDone + */ + virtual TBool IsSavingDone(); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::DoSaveL + */ + virtual void DoSaveL( TInt aCommandId ); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::NewFetchImageData + */ + virtual TInt NewFetchImageData( const TDesC& aUri ); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::AssignEmbededDataL + */ + virtual void AssignEmbededDataL( const TDesC& aUri ); + + /** + * From MSvgtAppObserver + * @see MSvgtAppObserver::ExitWhenOrientationChange + */ + virtual TBool ExitWhenOrientationChange(); + + private: // In MPluginNotify in S60 + TInt NotifyL(TNotificationType aCallType, void* aParam); + + private: + + // Pointer to the Svg control + CCoeControl* iSvgControl; + + // Pointer to the Parent Control + const CCoeControl* iParent; + + // file Handle of the file displayed + RFile iFileHandle; + + // environment pointer + CEikonEnv* iEikEnv; + + // current size of the control + TRect iRect; + + // flag to indicate whether render frames control or + // Custom control is used. + TBool iIsRenderFrameControl; + + // Name of the Svg file + TFileName iFileName; + + // last error encountered by the SVG Plugin + TInt iLastError; + }; + +#endif // SVGSCREENSAVER_H +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginInc/SvgScreenSaverImplementationUid.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginInc/SvgScreenSaverImplementationUid.hrh Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2005 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: Defines the ECOM Implementation UIDs. +* +* +*/ + + +#ifndef SVGSCREENSAVERIMPLEMENTATIONUID_HRH +#define SVGSCREENSAVERIMPLEMENTATIONUID_HRH + +#define KSVGTScreenSaverImplementationUID 0x102071E6 + +#endif +// End of File + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginInc/Svgtplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginInc/Svgtplugin.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,227 @@ +/* +* Copyright (c) 2005 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: SVGT Plugin Implementation header file + * +*/ + + +#ifndef SVGTPLUGIN_H +#define SVGTPLUGIN_H + +#include +#include +#include +#include +#include + + +/** +* Note: Need to ensure that EPOC is defined before including these headers... +*/ +#if defined(__SYMBIAN32__) && !defined(EPOC) + #define EPOC +#endif + +#include +#include + +//This is to include ECom Style Plugin Specific headers +#include + +//Implementation id Svgt Ecom Plugin +const TInt KSvgtPluginImplementationValue = 0x102071E6; + +class CSvgScreenSaver; +class CSvgtPlugin; + +/** +* This function initializes the NPPluginFuncs with the +* SVG plugin Netscape interface implementation functions +*/ +IMPORT_C NPError InitializeFuncs(NPPluginFuncs* aPpf); + +/** +* This class is specific to ECom Style Plugin. +* This is used for passing plugin specific initialization information to +* and from Screensaver Animation Plugin. +*/ +class CSvgtPluginEcomMain : public CEcomBrowserPluginInterface + { + public: + /** + * Two-phased constructor. + * @param aInitParam Has Pointer to NPNImplementationFuncs and + * Pointer to PluginFuncs + * @since 3.1 + */ + static CSvgtPluginEcomMain* NewL( TAny* aInitParam ); + + /** + * Destructor. + * @since 3.1 + */ + virtual ~CSvgtPluginEcomMain(); + + /** + * Returns the iNpf. + * @since 3.1 + */ + NPNetscapeFuncs* Funcs() const {return iNpf;} + + private: + /** + * Constructor. + * @since 3.1 + */ + CSvgtPluginEcomMain( NPNetscapeFuncs* aNpf ); + + /** + * Second-phase constructor. + * @since 3.1 + */ + void ConstructL( NPPluginFuncs* aPluginFuncs ); + + private: + // NPN implementation function pointers + NPNetscapeFuncs* iNpf; + }; + +/******************************************************* +Class CSvgtPlugin +********************************************************/ + +class CSvgtPlugin : public CBase + { +public: + /** + * Two-phased constructor. + * @since 3.1 + */ + static CSvgtPlugin* NewL(NPP anInstance); + + /** + * Destructor. + * @since 3.1 + */ + ~CSvgtPlugin(); + + /** + * Second-phase constructor. + * @since 3.1 + */ + void ConstructL(); + + /** + * Called before the Plugin Exits. + * @since 3.1 + */ + void PrepareToExitL(); + + /** + * returns the Control. + * @since 3.1 + */ + CSvgScreenSaver* Control() const; + + /** + * returns the instance. + * @since 3.1 + */ + NPP Instance() const; + + /** + * Called by the SetWindow Netscape API. + * @param aWindow - structure having the parent control + * @param aRect - size of the control + * @since 3.1 + */ + void SetWindowL(const NPWindow* aWindow,const TRect& aRect); + +private: + /** + * Default constructor. + * @since 3.1 + */ + CSvgtPlugin(NPP anInstance); + +private: + // Handle to the plugin Adapter + MPluginAdapter* iPluginAdapter; + + // Pointer to the SVG control + CSvgScreenSaver* iControl; + + // Plugin instance + NPP iInstance; + + // Screensaver mode flag + TBool iScreenSaverMode; + }; + + +/****************************************************************************** +* +* Plugin API methods +* +******************************************************************************/ + +/** +* Create a plugin. +*/ +NPError SvgtPluginNewp(NPMIMEType /*pluginType*/, + NPP aInstance, + uint16 /*mode*/, + CDesCArray* /*argn*/, + CDesCArray* /*argv*/, + NPSavedData* /*saved*/); +/** +* Destroy a plugin. +*/ +NPError SvgtPluginDestroy(NPP aInstance, NPSavedData** /*save*/); + +/** +* This is the parent window of a plugin. +*/ +NPError SvgtPluginSetWindow(NPP aInstance, NPWindow* aWindow); + +/** +* A data stream has been fully saved to a file. +*/ +void SvgtPluginAsFile(NPP aInstance, + NPStream* /*stream*/, + const TDesC& aFname); + + +/** +* Generic hook to retrieve values/attributes from the plugin. +*/ +NPError SvgtPluginGetValue(NPP aInstance, + NPPVariable aVariable, + void* aRetvalue); + +/** +* Generic hook to set values/attributes within the plugin. +*/ +NPError SvgtPluginSetValue(NPP aInstance, + NPNVariable aVariable, + void* aRetvalue); + +/** +* Check File Validity +*/ +void SvgtPluginCheckFileL( void* aRetvalue ); + + +#endif // SVGTPLUGIN_H +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/SvgRenderFrameControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/SvgRenderFrameControl.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,510 @@ +/* +* Copyright (c) 2005 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: This file implements a control which displays svg files using +* renderframes engine api, used by Screen Saver application +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SvgRenderFrameControl.h" +#include "SvgRenderFrameTimer.h" + +const TUint KConvertToMicroSecond = 1000; +const TInt KMilliSecondsBetweenFrame = 50; + +// Font Ids for use with Engine-Init +const TInt KApacFontId = EApacPlain16; +const TInt KLatintFontId = ELatinBold12; + +// Duration const returned by engine when indefinite animations are present +const TUint KIndefiniteDur = 0xffffffff; + +#ifdef _DEBUG +_LIT( KFileLoggingDir, "ScreenSaver" ); +_LIT( KFileLog, "FromSvgPlugin.txt" ); +#endif + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::NewL +// ----------------------------------------------------------------------------- +// +CSvgRenderFrameControl* CSvgRenderFrameControl::NewL( + const CCoeControl* aParent, + RFile& aFileHandle , + MSvgtAppObserver* aObserver ) + { + CSvgRenderFrameControl* self = CSvgRenderFrameControl::NewLC( aParent, + aFileHandle, + aObserver ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::NewL +// ----------------------------------------------------------------------------- +// +CSvgRenderFrameControl* CSvgRenderFrameControl::NewLC( + const CCoeControl* aParent, + RFile& aFileHandle , + MSvgtAppObserver* aObserver ) + { + CSvgRenderFrameControl* self = new (ELeave) CSvgRenderFrameControl( + aFileHandle, aObserver ); + CleanupStack::PushL( self ); + self->ConstructL( aParent ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::~CSvgRenderFrameControl +// ----------------------------------------------------------------------------- +// +CSvgRenderFrameControl::~CSvgRenderFrameControl() + { + DeleteEngine(); + delete iBmap; + delete iRenderFrameTimer; + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::SizeChanged +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::SizeChanged() + { + iRect = iParent->Rect(); + + } +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::UpdateScreen +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::UpdateScreen() + { + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::ScriptCall +// ----------------------------------------------------------------------------- +// +TBool CSvgRenderFrameControl::ScriptCall( const TDesC& /*aScript*/, + CSvgElementImpl* /*aCallerElement*/ ) + { + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::FetchImage +// ----------------------------------------------------------------------------- +// +TInt CSvgRenderFrameControl::FetchImage( const TDesC& aUri, RFs& aSession, + RFile& aFileHandle ) + { + if ( iAppObserver ) + { + return iAppObserver->FetchImage( aUri, aSession, aFileHandle ); + } + else + { + return KErrNotFound; + } + + } + +TInt CSvgRenderFrameControl::FetchFont( const TDesC& /* aUri */, + RFs& /* aSession */, RFile& /* aFileHandle */ ) + { + return KErrNotSupported; + } +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::GetSmilFitValue +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::GetSmilFitValue(TDes& /*aSmilValue*/) + { + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::UpdatePresentation +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::UpdatePresentation( const TInt32& + /*aNoOfAnimation*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::Draw +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::Draw(const TRect& /*aRect*/) const + { + + // Calculate rectangle for the whole bitmap + TRect bmpPieceRect(TPoint(0,0), iRect.Size() ); + + // Get the standard graphics context + CWindowGc& gc = SystemGc(); + + gc.SetBrushColor(CGraphicsContext::ENullBrush ); + gc.SetPenColor( CGraphicsContext::ENullPen ); + + gc.BitBlt( TPoint(0,0),iBitmapFrames[iCurrentFrame], + bmpPieceRect ); + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::SetTimer +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::SetTimer() + { + if ( !iRenderFrameTimer ) + { + TRAP_IGNORE( iRenderFrameTimer = + CSvgRenderFrameTimer::NewL( this ) ); + } + if ( iCanPlay ) + { + // Since the number of delay intervals is one less than + // the number of bitmaps need to have a bound check + iRenderFrameTimer->SetTimeOut( iDelayIntervals[ + iCurrentFrame >= iDelayIntervals.Count() ? 0 : iCurrentFrame] + * KConvertToMicroSecond ); + } + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::CancelTimer +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::CancelTimer() + { + if (iRenderFrameTimer) + { + iRenderFrameTimer->Cancel(); + delete iRenderFrameTimer; + iRenderFrameTimer = NULL; + } + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::ProcessViewerCommandL +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::ProcessViewerCommandL( TInt aCommandId ) + { + if ( aCommandId == ESvgtDlgPlayCommand ) + { + _LIT(msg1, "start event " ); + PrintDebugMsg( msg1 ); + iCanPlay = ETrue; + SetTimer(); + } + if ( aCommandId == ESvgtDlgPauseCommand ) + { + _LIT(msg1, "end event " ); + PrintDebugMsg( msg1 ); + iCanPlay = EFalse; + CancelTimer(); + } + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::GetCurrentIndex +// ----------------------------------------------------------------------------- +// +TInt CSvgRenderFrameControl::GetCurrentIndex() const + { + return iCurrentFrame; + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::SetCurrentIndex +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::SetCurrentIndex( TInt aIndex ) + { + iCurrentFrame = aIndex; + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::AnimationTimeOut +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::AnimationTimeOut() + { + DrawNow(); + SetTimer(); + MoveIndex(); + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::InitializeEngineL +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::InitializeEngineL( TBool aCheckFile, + MSvgRequestObserver* aObserver ) + { + + iBmap = new ( ELeave ) CFbsBitmap(); + TSize dummyScreenSize( 10,10 ); + iBmap->Create( dummyScreenSize, EColor16MU ); + + if ( !iSvgEngine ) + { + TInt fontId = KLatintFontId; + + switch ( AknLayoutUtils::Variant() ) + { + case EApacVariant: + { + fontId = KApacFontId; + } + break; + case EEuropeanVariant: + default: + break; + } + const CFont* font = AknLayoutUtils::FontFromId( fontId ); + TFontSpec spec = font->FontSpecInTwips(); + + iSvgEngine = CSvgEngineInterfaceImpl::NewL( iBmap, + aObserver, + spec ); + + if ( iSvgEngine && !iSvgDom ) + { + if ( aCheckFile ) + { + /* Set Thumbnail Mode if check file mode + * so that the rights wont be consumed + */ + iSvgEngine->SetThumbNailMode( ETrue ); + } + + MSvgError* parseResult = iSvgEngine->PrepareDom( *iFileHandle, + iSvgDom ); + + if ( aCheckFile ) + { + /* Reset Thumbnail Mode */ + iSvgEngine->SetThumbNailMode( EFalse ); + } + + if ( parseResult && + parseResult->HasError() && + !parseResult->IsWarning() ) + { + if ( parseResult->HasError() == ESvgNoMemory ) + { + User::Leave( KErrNoMemory ); + } + else + { + User::Leave( KErrGeneral ); + } + } + if ( !aCheckFile ) + { + MSvgError* pResult = iSvgEngine->UseDom( iSvgDom, iBmap ); + if ( pResult->HasError() && !pResult->IsWarning() ) + { + User::Leave( KErrGeneral ); + } + } + } + else + { + User::Leave( KErrGeneral ); + } + } + else + { + User::Leave( KErrGeneral ); + } + return; + + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::DeleteEngine +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::DeleteEngine() + { + for ( TInt i = 0; i < iBitmapFrames.Count(); i++ ) + { + delete iBitmapFrames[i]; + } + + for ( TInt i = 0; i < iMaskFrames.Count(); i++ ) + { + delete iMaskFrames[i]; + } + + iBitmapFrames.Reset(); + iMaskFrames.Reset(); + iDelayIntervals.Reset(); + + iBitmapFrames.Close(); + iMaskFrames.Close(); + iDelayIntervals.Close(); + + iCurrentFrame = 0; + iDuration = 0; + + if ( iSvgDom ) + { + iSvgEngine->DeleteDom( iSvgDom ); + iSvgDom = 0; + } + delete iSvgEngine; + iSvgEngine = NULL; + + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::RenderMyFrames +// ----------------------------------------------------------------------------- +// +TInt CSvgRenderFrameControl::RenderMyFrames() + { + + TUint interval = iSvgEngine->Duration(); + + if ( interval == KIndefiniteDur || interval > KMaxTimeDuration ) + { + // Infinite content + // Dont try to handle using Render Frames + // return Error + return KErrGeneral; + } + + + + MSvgError* result = iSvgEngine->RenderFrames( + iSvgDom, + iRect.Size(), + 0, + interval, + KMilliSecondsBetweenFrame, + EColor64K, EGray2, + iBitmapFrames, + iMaskFrames, + iDelayIntervals, + ETrue /*Remove redundant frames*/ ); + + + if ( result->HasError() && !result->IsWarning() ) + { + return KErrGeneral; + } + else + { + return KErrNone; + } + } + + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::MoveIndex +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::MoveIndex() + { + + TBuf<64> buffer1; + _LIT(msg1, "Index is : %d" ); + buffer1.Format( msg1, iCurrentFrame ); + PrintDebugMsg( buffer1 ); + + iCurrentFrame++; + if ( iCurrentFrame == iBitmapFrames.Count() ) + { + iCurrentFrame = 0; + } + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::CSvgRenderFrameControl +// ----------------------------------------------------------------------------- +// +CSvgRenderFrameControl::CSvgRenderFrameControl( RFile& aFileHandle, + MSvgtAppObserver* aObserver ) + { + iCurrentFrame = 0; + iDuration = 0; + iSvgEngine = NULL; + iSvgDom = 0; + iFileHandle = &aFileHandle; + iCanPlay = EFalse; + iParent = NULL; + iAppObserver = aObserver; + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameControl::ConstructL +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameControl::ConstructL( const CCoeControl* aParent ) + { + + if ( aParent ) + { + CreateWindowL(aParent); + iParent = aParent; + iRect = aParent->Rect(); + } + + InitializeEngineL( EFalse /*Not checkFile mode*/ , this ); + + User::LeaveIfError(RenderMyFrames()); + + SetRect( iRect ); + + ActivateL(); + + } + +// ----------------------------------------------------------------------------- +// CScreenSaverAnimPlugin::PrintDebugMsg +// ----------------------------------------------------------------------------- +// +#ifndef _DEBUG +void CSvgRenderFrameControl::PrintDebugMsg( const TDesC& /* aMsg */ ) const +#else +void CSvgRenderFrameControl::PrintDebugMsg( const TDesC& aMsg ) const +#endif + { +#ifdef _DEBUG + RFileLogger::Write( KFileLoggingDir, KFileLog, + EFileLoggingModeAppend, aMsg ); +#endif + } + +// End Of file. + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/SvgRenderFrameTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/SvgRenderFrameTimer.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2005 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: ECOM Implementation Array. +* +*/ + + +#include "SvgRenderFrameTimer.h" +#include "SvgRenderFrameControl.h" + + +// INCLUDE FILES +// ----------------------------------------------------------------------------- +// CSvgRenderFrameTimer::CSvgRenderFrameTimer +// Default Constructor. Initialises Timer State Variables. +// ----------------------------------------------------------------------------- +// +CSvgRenderFrameTimer::CSvgRenderFrameTimer( MSvgRenderFrameTimerListener* + aListener) : // Listener for the pointer inactivity + CTimer( CActive::EPriorityStandard ), iListener( aListener ) + { + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameTimer::ConstructL +// Second Phase Constructor for CSvgRenderFrameTimer. Adds this object to the +// applications active scheduler. +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameTimer::ConstructL() + { + // Call the base class ConstructL + CTimer::ConstructL(); + // Add to active scheduler + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameTimer::NewLC +// Factory function for creating CSvgRenderFrameTimer objects. It also +// pushes the created dialog object onto the cleanup stack. +// Returns: CSvgRenderFrameTimer* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSvgRenderFrameTimer* CSvgRenderFrameTimer::NewLC( + MSvgRenderFrameTimerListener* aListener ) // Listener for inactivity event + { + CSvgRenderFrameTimer* self = new ( ELeave ) CSvgRenderFrameTimer( + aListener ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameTimer::NewL +// Factory function for creating CSvgRenderFrameTimer objects. +// Returns: CSvgRenderFrameTimer* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSvgRenderFrameTimer* CSvgRenderFrameTimer::NewL( + MSvgRenderFrameTimerListener* aListener ) // Listener for inactivity event + { + CSvgRenderFrameTimer* self = NewLC( aListener ); + CleanupStack::Pop( self ); + return self; + } + + +// Destructor +CSvgRenderFrameTimer::~CSvgRenderFrameTimer() + { + // Cancel any pending timer events + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameTimer::DoCancel +// Reimplements CActive::DoCancel. +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameTimer::DoCancel() + { + CTimer::DoCancel(); + } + +// ----------------------------------------------------------------------------- +// CSvgRenderFrameTimer::RunL +// Reimplements CActive::RunL. This function resets the inactivity timer +// so that the control is triggered to hide the pointer when no +// activity occurs for a specified time period +// ----------------------------------------------------------------------------- +// +void CSvgRenderFrameTimer::RunL() + { + // Callback + if ( iListener ) + { + iListener->AnimationTimeOut(); + } + } + +void CSvgRenderFrameTimer::SetTimeOut( + const TTimeIntervalMicroSeconds32& anInterval ) + { + if (!IsActive()) + { + After( anInterval ); + } + } + +// End of File + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/SvgScreenSaver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/SvgScreenSaver.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,361 @@ +/* +* Copyright (c) 2005 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: This file implements the SVGT Screen Saver Plugin which +* is used by Screen Saver application to display SVGT content +* +*/ + + +#include +#include + +#include +#include +#include +#include +#include +#include "SvgScreenSaver.h" +#include "SvgRenderFrameControl.h" + +_LIT( KSccSmilFitValue,"meet" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::CSvgScreenSaver +// ----------------------------------------------------------------------------- +// +CSvgScreenSaver::CSvgScreenSaver():iIsRenderFrameControl(ETrue), + iLastError(KErrNone) + { + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::~CSvgScreenSaver +// ----------------------------------------------------------------------------- +// +CSvgScreenSaver::~CSvgScreenSaver() + { + iFileHandle.Close(); + delete iSvgControl; + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::SetRect +// ----------------------------------------------------------------------------- +// +void CSvgScreenSaver::SetRect(const TRect& aRect) + { + iRect = aRect; + + if ( iIsRenderFrameControl ) + { + if ( iSvgControl ) + { + TInt index = STATIC_CAST(CSvgRenderFrameControl*, iSvgControl)-> + GetCurrentIndex(); + delete iSvgControl; + iSvgControl = NULL; + AsFile( iFileName ); + if ( iIsRenderFrameControl && iSvgControl ) + { + STATIC_CAST(CSvgRenderFrameControl*, iSvgControl)-> + SetCurrentIndex( index ); + } + } + } + else + { + if ( iSvgControl ) + { + iSvgControl->SetExtentToWholeScreen(); + } + } + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::SendCommandL +// ----------------------------------------------------------------------------- +// +void CSvgScreenSaver::SendCommandL( TInt aCommand ) + { + if ( !iSvgControl ) + { + User::Leave( KErrGeneral ); + } + if ( iIsRenderFrameControl ) + { + STATIC_CAST(CSvgRenderFrameControl*, iSvgControl)-> + ProcessViewerCommandL( aCommand ); + } + else + { + STATIC_CAST(CSVGTCustControl*, iSvgControl)-> + ProcessViewerCommandL( aCommand ); + } + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::MakeVisible +// ----------------------------------------------------------------------------- +// +void CSvgScreenSaver::MakeVisible( TBool aVisible ) + { + if ( iSvgControl ) + { + iSvgControl->MakeVisible( aVisible ); + } + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::GetLastError +// ----------------------------------------------------------------------------- +// +TInt CSvgScreenSaver::GetLastError() const + { + return iLastError; + } + + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::FetchImage +// ----------------------------------------------------------------------------- +// +TInt CSvgScreenSaver::FetchImage( const TDesC& aUri, RFs& aSession, + RFile& aFileHandle ) + { + CSVGTAppObserverUtil::TDownloadNeeded dnloadNeeded = + CSVGTAppObserverUtil::ELocalImageFile ; + TRAPD( err, + dnloadNeeded = CSVGTAppObserverUtil::IsDownloadNeededL( aUri )); + if ( err != KErrNone ) + { + return err; + } + + + if ( CSVGTAppObserverUtil::ELocalImageFile == dnloadNeeded ) + { + + TFileName fileName; + if ( CSVGTAppObserverUtil::GetLocalFile( aUri, fileName, iFileName ) ) + { + return aFileHandle.Open( aSession, fileName, EFileShareAny ); + } + else + { + return KErrNotFound; + } + } + return KErrNotFound; + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::GetSmilFitValue +// ----------------------------------------------------------------------------- +// +void CSvgScreenSaver::GetSmilFitValue(TDes& aSmilValue) + { + aSmilValue.Copy( KSccSmilFitValue ); + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::NotifyL +// ----------------------------------------------------------------------------- +// +TInt CSvgScreenSaver::NotifyL(TNotificationType /*aCallType*/, + void* /*aParam*/) + { + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::ConstructL +// ----------------------------------------------------------------------------- +// +void CSvgScreenSaver::ConstructL( const CCoeControl* aParent ) + { + iParent = aParent; + iEikEnv = CEikonEnv::Static(); + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::AsFile +// ----------------------------------------------------------------------------- +// +TInt CSvgScreenSaver::AsFile(const TDesC& aFileName) + { + iFileName = aFileName; + iLastError = iFileHandle.Open( iEikEnv->FsSession(), + aFileName, + EFileShareReadersOnly ); + + if ( iLastError != KErrNone ) + { + return iLastError; + } + TInt aSize = 0; + iFileHandle.Size(aSize); + + if ( aSize > KMaxFileSize ) + { + iLastError = KErrGeneral; + } + + else + { + TRAP( iLastError, + iSvgControl = CSvgRenderFrameControl::NewL( iParent, iFileHandle, this ) ); + } + + if ( iLastError != KErrNone ) + { + iIsRenderFrameControl = EFalse; + delete iSvgControl; + iSvgControl = NULL; + + // reset iLastError + iLastError = KErrNone; + + // Render Frames returned error + TRAP( iLastError, + iSvgControl = CSVGTCustControl::NewL( iFileHandle, + this, // App Observer + NULL, // Progress Bar Draw Impl + NULL, // MSK label Impl + NULL, // Exit Observer + EFalse, // No Progressive Render + iParent, + ESvgWindowOwning )); + + if ( iSvgControl ) + { + STATIC_CAST(CSVGTCustControl*, iSvgControl)-> + SetCurrentFullScreenStatus( ETrue ); + // trigger a size changed event + iSvgControl->SetExtentToWholeScreen(); + TRAP_IGNORE(STATIC_CAST(CSVGTCustControl*, iSvgControl)-> + ProcessViewerCommandL(ESvgtDlgStopCommand)); + } + else + { + // Control is not created. + iLastError = KErrGeneral; + } + } + + iFileHandle.Close(); + + return iLastError; + + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::LinkActivated +// ----------------------------------------------------------------------------- +// +TBool CSvgScreenSaver::LinkActivated( const TDesC& /*aUri*/ ) + { + return EFalse; + } + + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::LinkActivatedWithShow +// ----------------------------------------------------------------------------- +// +TBool CSvgScreenSaver::LinkActivatedWithShow( const TDesC& /*aUri*/, + const TDesC& /*aShow*/ ) + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::SetDownloadMenu +// ----------------------------------------------------------------------------- +// +void CSvgScreenSaver::SetDownloadMenu( TBool /*aAddDownloadMenu*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::CanShowDownload +// ----------------------------------------------------------------------------- +// +TBool CSvgScreenSaver::CanShowDownload() const + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::DisplayDownloadMenuL +// ----------------------------------------------------------------------------- +// +void CSvgScreenSaver::DisplayDownloadMenuL() + { + } +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::CanShowSave +// ----------------------------------------------------------------------------- +// +TBool CSvgScreenSaver::CanShowSave() + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::IsSavingDone +// ----------------------------------------------------------------------------- +// +TBool CSvgScreenSaver::IsSavingDone() + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::DoSaveL +// ----------------------------------------------------------------------------- +// +void CSvgScreenSaver::DoSaveL( TInt /*aCommandId*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::NewFetchImageData +// ----------------------------------------------------------------------------- +// +TInt CSvgScreenSaver::NewFetchImageData( const TDesC& /* aUri */ ) + { + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::AssignEmbededDataL +// ----------------------------------------------------------------------------- +// +void CSvgScreenSaver::AssignEmbededDataL( const TDesC& /*aUri*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CSvgScreenSaver::ExitWhenOrientationChange +// ----------------------------------------------------------------------------- +// +TBool CSvgScreenSaver::ExitWhenOrientationChange() + { + return EFalse; + } + +// End Of file. + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/SvgScreenSaverProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/SvgScreenSaverProxy.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2005 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: ECOM Implementation Array. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include "SvgScreenSaverImplementationUid.hrh" +#include "SvgScreenSaver.h" + +// CONSTANTS +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KSVGTScreenSaverImplementationUID, + CSvgScreenSaver::NewL ) + }; + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ImplementationProxy +// ECOM implementation table entry. +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + +// End of File + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/Svgtplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/Svgtplugin.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2005 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: SVGT Plugin Implementation source file + * +*/ + + + +#include +#include +#include +#include +#include +#include + +#include "Svgtplugin.h" +#include "SvgScreenSaver.h" + + +// ----------------------------------------------------------------------------- +// CSvgtPlugin::NewL +// ----------------------------------------------------------------------------- +// +CSvgtPlugin* CSvgtPlugin::NewL(NPP anInstance) + { + CSvgtPlugin *self = new (ELeave) CSvgtPlugin(anInstance); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSvgtPlugin::~CSvgtPlugin +// ----------------------------------------------------------------------------- +// +CSvgtPlugin::~CSvgtPlugin() + { + if ( iControl ) + { + delete iControl; + } + } + +// ----------------------------------------------------------------------------- +// CSvgtPlugin::PrepareToExitL +// ----------------------------------------------------------------------------- +// +void CSvgtPlugin::PrepareToExitL() + { + if ( iPluginAdapter ) + { + iPluginAdapter->PluginFinishedL(); + } + if ( iControl ) + { + delete iControl; + iControl=NULL; + } + } + +// ----------------------------------------------------------------------------- +// CSvgtPlugin::ConstructL +// ----------------------------------------------------------------------------- +// +void CSvgtPlugin::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CSvgtPlugin::SetWindowL +// Sets the parent control +// ----------------------------------------------------------------------------- +// +void CSvgtPlugin::SetWindowL(const NPWindow *aWindow,const TRect& aRect) + { + if ( !aWindow ) + { + User::Leave( KErrArgument ); + } + iPluginAdapter = static_cast(aWindow->window); + CCoeControl* lParentControl = iPluginAdapter->GetParentControl(); + + if ( !iControl ) + { + // Control is created here as Parent Control is available + // only in SetWindowL + iControl = new (ELeave) CSvgScreenSaver; + iControl->ConstructL( lParentControl ); + iPluginAdapter->SetPluginNotifier(iControl); + } + + iControl->SetRect(aRect); + } + +// ----------------------------------------------------------------------------- +// CSvgtPlugin::CSvgtPlugin +// Default constructor +// ----------------------------------------------------------------------------- +// +CSvgtPlugin::CSvgtPlugin(NPP anInstance) + { + iScreenSaverMode = EFalse; + this->iInstance=anInstance; + } + + +// ----------------------------------------------------------------------------- +// CSvgtPlugin::Control +// returns the control +// ----------------------------------------------------------------------------- +// +CSvgScreenSaver* CSvgtPlugin::Control() const + { + ASSERT( iControl ); + return iControl; + } + +// ----------------------------------------------------------------------------- +// CSvgtPlugin::Instance +// returns the instance +// ----------------------------------------------------------------------------- +// +NPP CSvgtPlugin::Instance() const + { + return iInstance; + } + + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/Svgtplugindllapi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/Svgtplugindllapi.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,282 @@ +/* +* Copyright (c) 2005 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: SVGT Plugin Implementation source file + * +*/ + + + +#include +#include + +#include "Svgtplugin.h" +#include "SvgRenderFrameControl.h" +#include "SvgScreenSaver.h" + +// ----------------------------------------------------------------------------- +// SvgtPluginNewp +// Creates the plugin. +// ----------------------------------------------------------------------------- +// +NPError SvgtPluginNewp(NPMIMEType /*pluginType*/, + NPP aInstance, + uint16 /*mode*/, + CDesCArray* /*argn*/, + CDesCArray* /*argv*/, + NPSavedData* /*saved*/) + { + CSvgtPlugin* lSvgtPlugin=NULL; + TRAPD(err,lSvgtPlugin=CSvgtPlugin::NewL(aInstance)); + + if (err == KErrNoMemory) + { + return NPERR_OUT_OF_MEMORY_ERROR; + } + if (err != KErrNone) + { + return NPERR_MODULE_LOAD_FAILED_ERROR; + } + if ( aInstance ) + { + aInstance->pdata = (void *) lSvgtPlugin; + } + else + { + return NPERR_INVALID_INSTANCE_ERROR; + } + return NPERR_NO_ERROR; + } + + +// ----------------------------------------------------------------------------- +// SvgtPluginDestroy +// Destroy a plugin. +// ----------------------------------------------------------------------------- +// +NPError SvgtPluginDestroy(NPP aInstance, NPSavedData** /*save*/) + { + if ( !aInstance ) + { + return NPERR_GENERIC_ERROR; + } + CSvgtPlugin* lSvgtPlugin = (CSvgtPlugin *)aInstance->pdata; + if ( lSvgtPlugin ) + { + TRAPD(err,lSvgtPlugin->PrepareToExitL()); + if (err != KErrNone) + { + #ifdef _DEBUG + RDebug::Print(_L("SvgtPluginDestroy Error when printing Warning")); + #endif //_DEBUG + } + /**Ignoring the error*/ + delete lSvgtPlugin; + lSvgtPlugin = NULL; + } + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// SvgtPluginSetWindow +// This sets the parent window of a plugin. +// ----------------------------------------------------------------------------- +// +NPError SvgtPluginSetWindow(NPP aInstance, NPWindow* aWindow) + { + if ( !aInstance ) + { + return NPERR_INVALID_INSTANCE_ERROR; + } + if ( !aWindow ) + { + return NPERR_GENERIC_ERROR; + } + CSvgtPlugin* lSvgtPlugin = (CSvgtPlugin *) aInstance->pdata; + TUint lWidth = aWindow->width; + TUint lHeight = aWindow->height; + + TRAPD(err,lSvgtPlugin->SetWindowL(aWindow,TRect(TSize(lWidth,lHeight)))); + if (err == KErrNoMemory) + { + return NPERR_OUT_OF_MEMORY_ERROR; + } + + if (err != KErrNone) + { + return NPERR_GENERIC_ERROR; + } + + return NPERR_NO_ERROR; + } + +// ----------------------------------------------------------------------------- +// SvgtPluginAsFile +// The name of the SVG file is set by AsFile +// ----------------------------------------------------------------------------- +// +void SvgtPluginAsFile(NPP aInstance, NPStream* /*stream*/, const TDesC& aFname) + { + CSvgtPlugin* lSvgtPlugin = (CSvgtPlugin*)aInstance->pdata; + TInt err = lSvgtPlugin->Control()->AsFile(aFname); + if ( err != KErrNone ) + { + // Destroy myself + SvgtPluginDestroy( aInstance, NULL ); + } + } + + + + +// ----------------------------------------------------------------------------- +// SvgtPluginGetValue +// Generic hook to retrieve values/attributes from the plugin. +// ----------------------------------------------------------------------------- +// +NPError SvgtPluginGetValue(NPP aInstance, + NPPVariable aVariable, + void* aRetvalue) + { + TInt ret = NPERR_NO_ERROR; + if ( !aInstance ) + { + ret = NPERR_INVALID_INSTANCE_ERROR; + } + CSvgtPlugin* lSvgtPlugin = (CSvgtPlugin *)aInstance->pdata; + if ( lSvgtPlugin && aRetvalue ) + { + if ( aVariable == NPPCheckFileIsValid ) + { + NPCheckFile* checkFile = (NPCheckFile*)aRetvalue; + checkFile->fileValidityCheckError = KErrNone; + TRAPD(err, SvgtPluginCheckFileL( aRetvalue ) ); + if ( err != KErrNone ) + { + ret= NPERR_GENERIC_ERROR; + } + ret = NPERR_NO_ERROR; + } + if ( aVariable == NPPScreenSaverGetLastError ) + { + TInt* error = (TInt*)aRetvalue; + *error = lSvgtPlugin->Control()->GetLastError(); + ret = NPERR_NO_ERROR; + } + } + else + { + ret = NPERR_GENERIC_ERROR; + } + return ret; + } + +// ----------------------------------------------------------------------------- +// SvgtPluginCheckFileL +// Helper function used to check the file's validity +// ----------------------------------------------------------------------------- +// +void SvgtPluginCheckFileL( void* aRetvalue ) + { + if ( !aRetvalue ) + { + User::Leave( KErrArgument ); + } + NPCheckFile* checkFile = (NPCheckFile*)aRetvalue; + TFileName fileName = checkFile->fileName->Des(); + RFile fileHandle; + TInt err = fileHandle.Open( CEikonEnv::Static()->FsSession(), + fileName, + EFileShareAny ); + User::LeaveIfError( err ); + + CleanupClosePushL( fileHandle ); + CSvgRenderFrameControl* control = new ( ELeave ) + CSvgRenderFrameControl( fileHandle ); + + CleanupStack::PushL( control ); + TRAP( err, control->InitializeEngineL( ETrue, control ) ); /* CheckFile Mode */ + checkFile->fileValidityCheckError = err; + CleanupStack::PopAndDestroy( control ); + CleanupStack::PopAndDestroy(&fileHandle); + } + + +// ----------------------------------------------------------------------------- +// SvgtPluginSetValue +// Generic hook to set values/attributes within the plugin. +// ----------------------------------------------------------------------------- +// +NPError SvgtPluginSetValue(NPP aInstance, + NPNVariable aVariable, + void* aRetvalue) + { + TInt ret = NPERR_NO_ERROR; + if ( !aInstance ) + { + ret = NPERR_INVALID_INSTANCE_ERROR; + } + CSvgtPlugin* lSvgtPlugin = (CSvgtPlugin *)aInstance->pdata; + + if ( lSvgtPlugin ) + { + switch( aVariable ) + { + case NPNInteractionMode: + // do nothing + break; + case NPNScreenSaverAnimationEvent: + { + NPAnimationEvent animEvent = ( NPAnimationEvent ) + (*(NPAnimationEvent*)aRetvalue); + + if ( animEvent == NPStartAnimation ) + { + // Make the control Visible + lSvgtPlugin->Control()->MakeVisible( ETrue ); + TRAPD(err, lSvgtPlugin->Control()-> + SendCommandL(ESvgtDlgLoopOnCommand)); + if ( err != KErrNone ) + { + ret = NPERR_GENERIC_ERROR; + } + // Start the animation + TRAP( err, lSvgtPlugin->Control()-> + SendCommandL( ESvgtDlgPlayCommand ) ); + if ( err != KErrNone ) + { + ret = NPERR_GENERIC_ERROR; + } + } + if ( animEvent == NPEndAnimation ) + { + // Make the control invisible + lSvgtPlugin->Control()->MakeVisible( EFalse ); + // Stop the animation + TRAPD( err, lSvgtPlugin->Control()-> + SendCommandL( ESvgtDlgPauseCommand ) ); + if ( err != KErrNone ) + { + ret= NPERR_GENERIC_ERROR; + } + } + } + break; + } + } + return ret; + } + + + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/Svgtpluginmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/Svgtpluginmain.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2005 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: SVGT Plugin Implementation source file + * +*/ + + +#include +#include + +#include "Svgtplugin.h" + +const TInt KPluginVersion = 1; + +// ----------------------------------------------------------------------------- +// CSvgtPluginEcomMain::NewL +// ----------------------------------------------------------------------------- +// +CSvgtPluginEcomMain* CSvgtPluginEcomMain::NewL(TAny* aInitParam) + { + if ( !aInitParam ) + { + User::Leave(KErrArgument); + } + + // aInitParam has both the NPNImplementation Functions implemented by + // the ScreensaverAnimPlugin and the functions implemented by the + // SVGPlugin for animation plugin. + + TFuncs* funcs = REINTERPRET_CAST( TFuncs*, aInitParam); + CSvgtPluginEcomMain* self = new(ELeave) + CSvgtPluginEcomMain(funcs->iNetscapeFuncs); + CleanupStack::PushL(self); + self->ConstructL(funcs->iPluginFuncs); + CleanupStack::Pop( self ); + Dll :: SetTls ( (void*) self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSvgtPluginEcomMain::ConstructL +// ----------------------------------------------------------------------------- +// +void CSvgtPluginEcomMain::ConstructL(NPPluginFuncs* aPluginFuncs) + { + InitializeFuncs(aPluginFuncs); + } + +// ----------------------------------------------------------------------------- +// CSvgtPluginEcomMain::CSvgtPluginEcomMain +// ----------------------------------------------------------------------------- +// +CSvgtPluginEcomMain::CSvgtPluginEcomMain(NPNetscapeFuncs* aNpf) : + CEcomBrowserPluginInterface(),iNpf(aNpf) + { + } + +// ----------------------------------------------------------------------------- +// CSvgtPluginEcomMain::~CSvgtPluginEcomMain +// ----------------------------------------------------------------------------- +// +CSvgtPluginEcomMain::~CSvgtPluginEcomMain() + { + } + +const TImplementationProxy KImplementationTable[] = + { + {{KSvgtPluginImplementationValue}, + (TProxyNewLPtr) CSvgtPluginEcomMain::NewL} + }; + +// ----------------------------------------------------------------------------- +// ImplementationGroupProxy +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy); + return KImplementationTable; + } + +// ----------------------------------------------------------------------------- +// InitializeFuncs +// ----------------------------------------------------------------------------- +// +EXPORT_C NPError InitializeFuncs(NPPluginFuncs* aPpf) + { + if ( !aPpf ) + { + return NPERR_GENERIC_ERROR; + } + aPpf->size = sizeof(NPPluginFuncs); + aPpf->version = KPluginVersion; + aPpf->newp = NewNPP_NewProc(SvgtPluginNewp); + aPpf->destroy = NewNPP_DestroyProc(SvgtPluginDestroy); + aPpf->setwindow = NewNPP_SetWindowProc(SvgtPluginSetWindow); + aPpf->newstream = NULL; + aPpf->destroystream = NULL; + aPpf->asfile = NewNPP_StreamAsFileProc(SvgtPluginAsFile); + aPpf->writeready = NULL; + aPpf->write = NULL; + aPpf->print = NULL; + aPpf->event = NULL; + aPpf->urlnotify = NULL; + aPpf->javaClass = NULL; + aPpf->getvalue = NewNPP_GetValueProc(SvgtPluginGetValue); + aPpf->setvalue = NewNPP_SetValueProc(SvgtPluginSetValue); + return NPERR_NO_ERROR; + + } + +// ----------------------------------------------------------------------------- +// NPP_Shutdown +// ----------------------------------------------------------------------------- +// +EXPORT_C void NPP_Shutdown(void) + { + CSvgtPluginEcomMain* npm = (CSvgtPluginEcomMain*) Dll :: Tls (); + delete npm; + Dll :: SetTls ( NULL ); + } + + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/SvgtFileViewDetailsSrc/SVGTDrmHelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/SvgtFileViewDetailsSrc/SVGTDrmHelper.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,542 @@ +/* +* Copyright (c) 2006 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: DRM helper for svgt files. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SVGTDrmHelper.h" + +// CONSTANTS + +const TUint32 KSVGTCountConstraint = 3; +const TInt KSVGTTimeConstraint = 7; +const TInt KSVGTSecondsInDay = 86400; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::CSVGTDrmHelper +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSVGTDrmHelper::CSVGTDrmHelper() : + iEnv(CCoeEnv::Static()) + { + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSVGTDrmHelper::ConstructL() + { + iDrmHelper = CDRMHelper::NewL( *iEnv ); + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSVGTDrmHelper* CSVGTDrmHelper::NewL() + { + CSVGTDrmHelper* self = CSVGTDrmHelper::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSVGTDrmHelper* CSVGTDrmHelper::NewLC() + { + CSVGTDrmHelper* self = new(ELeave) CSVGTDrmHelper(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::~CSVGTDrmHelper +// Destructor +// ----------------------------------------------------------------------------- +// +CSVGTDrmHelper::~CSVGTDrmHelper() + { + delete iRightsConstraints; + + // Delete the DRM Helper + delete iDrmHelper; + // Reset the environment pointer + iEnv = NULL; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::IsPreviewL +// ----------------------------------------------------------------------------- +// +TBool CSVGTDrmHelper::IsPreviewL( RFile& aFileHandle ) + { + LoadUsageRigthsInfoL( aFileHandle ); + + TSVGTRightsStatus rightsStatus; + GetUsageRightsStatus( rightsStatus ); + return ( rightsStatus == ESVGTPreview ); + + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::CheckRightsAmountL +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::CheckRightsAmountL( RFile& aFileHandle ) + { + LoadUsageRigthsInfoL( aFileHandle ); + if ( iProtected ) + { + return iDrmHelper->CheckRightsAmountL( aFileHandle ); + } + else + { + return 0; + } + } +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetDrmDetailsL +// ----------------------------------------------------------------------------- +// +void CSVGTDrmHelper::GetDrmDetailsL( RFile& aFileHandle, + TBool& aRightsValid, TBool& aIsSeparateDeliveryNS, + TBool& aIsProtected ) + { + + + LoadUsageRigthsInfoL( aFileHandle ); + + aIsProtected = IsProtected(); + + if( !aIsProtected ) + { + return; + } + + TSVGTRightsStatus rightsStatus; + GetUsageRightsStatus( rightsStatus ); + aRightsValid = ( rightsStatus == ESVGTFull ) || + ( rightsStatus == ESVGTRestricted ) || + ( rightsStatus == ESVGTPreview ); + + + // Creates a handle to content handled via CAF + CContent *content = CContent::NewLC( aFileHandle ); + content->GetAttribute( EIsForwardable, aIsSeparateDeliveryNS ); + CleanupStack::PopAndDestroy( content ); + return; + + } + + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::LoadUsageRigthsInfoL +// ----------------------------------------------------------------------------- +// +void CSVGTDrmHelper::LoadUsageRigthsInfoL( RFile& aFileHandle ) + { + + delete iRightsConstraints; + iRightsConstraints = NULL; + + // Creates a handle to content handled via CAF + CContent *content = CContent::NewLC( aFileHandle ); + content->GetAttribute( EIsProtected, iProtected ); + CleanupStack::PopAndDestroy( content ); + + if ( iProtected ) + { + + CDRMHelperRightsConstraints* ignore1 = NULL; + CDRMHelperRightsConstraints* ignore2 = NULL; + CDRMHelperRightsConstraints* ignore3 = NULL; + + + TRAPD(error, iDrmHelper->GetRightsDetailsL(aFileHandle, + ContentAccess::EView, + iExpired, + iSendingAllowed, + ignore1, + iRightsConstraints, + ignore2, + ignore3)); + + // Delete ignored constraints + delete ignore1; + ignore1 = NULL; + delete ignore2; + ignore2 = NULL; + delete ignore3; + ignore3 = NULL; + + if ( error == KErrCANoRights ) + { + delete iRightsConstraints; + iRightsConstraints = NULL; + } + else + { + User::LeaveIfError(error); + } + } + else + { + iExpired = EFalse; + iSendingAllowed = ETrue; + } + + iDrmHelper->CanSetAutomated(aFileHandle, iCanSetAutomated); + + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetUsageRightsStatus +// ----------------------------------------------------------------------------- +// +void CSVGTDrmHelper::GetUsageRightsStatus(TSVGTRightsStatus& aStatus) + { + if (!iProtected) + { + aStatus = ESVGTFull; + } + else if (iRightsConstraints) + { + if (iExpired) + { + aStatus = ESVGTExpired; + } + else if (iRightsConstraints->IsPreview()) + { + aStatus = ESVGTPreview; + } + else if (iRightsConstraints->FullRights()) + { + aStatus = ESVGTFull; + } + else + { + TTime time; + TTime startTime; + + time.HomeTime(); + TInt error = GetStartTime(startTime); + + // Check that usage time has already started + if (!error && time < startTime) + { + aStatus = ESVGTExpired; + } + else + { + aStatus = ESVGTRestricted; + } + } + } + else + { + aStatus = ESVGTMissing; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetExpireStatus +// ----------------------------------------------------------------------------- +// +void CSVGTDrmHelper::GetExpireStatus(TBool& aAboutToExpire, + TSVGTExpireConstraint& aConstraint, + TInt& aCountLeft, + TInt& aDaysLeft) + { + TSVGTRightsStatus status; + GetUsageRightsStatus(status); + + if (status == ESVGTRestricted) + { + TUint32 count = 0; + TInt countError = GetCount(count); + + TTime endTime; + TInt timeError = GetEndTime(endTime); + TTime currentTime; + currentTime.HomeTime(); + TInt diff = endTime.DaysFrom(currentTime).Int(); + + TTimeIntervalSeconds interval; + TInt intervalError = GetInterval(interval); + TInt intervalDiff = 0; + if (!intervalError) + { + TTime intervalStart; + TTimeIntervalSeconds secondsFromStart; + + if (!GetIntervalStart(intervalStart)) + { + // No error => interval has already started + currentTime.SecondsFrom(intervalStart, secondsFromStart); + intervalDiff = + (interval.Int() - secondsFromStart.Int()) / KSVGTSecondsInDay; + } + else + { + // Error occurred => interval not started yet + intervalDiff = interval.Int() / KSVGTSecondsInDay; + } + } + + if (!countError && count <= KSVGTCountConstraint && + ((!timeError && diff <= KSVGTTimeConstraint) || + (!intervalError && intervalDiff <= KSVGTTimeConstraint))) + { + // Count and time or interval contraints about to expire + aConstraint = ESVGTCountAndTime; + aCountLeft = count; + aAboutToExpire = ETrue; + + if (!timeError && !intervalError) + { + // Both constraints exist => use smaller one + aDaysLeft = Min(diff, intervalDiff); + } + else if (!timeError) + { + // Only time constraint exists => use it + aDaysLeft = diff; + } + else + { + // Only interval constraint exists => use it + aDaysLeft = intervalDiff; + } + } + else if (!countError && count <= KSVGTCountConstraint) + { + // Count constraint about to expire + aConstraint = ESVGTCount; + aCountLeft = count; + aAboutToExpire = ETrue; + } + else if ((!timeError && diff <= KSVGTTimeConstraint) || + (!intervalError && intervalDiff <= KSVGTTimeConstraint)) + { + // Time or interval constraint about to expire + aConstraint = ESVGTTime; + aAboutToExpire = ETrue; + + if (!timeError && !intervalError) + { + // Both constraints exist => use smaller one + aDaysLeft = Min(diff, intervalDiff); + } + else if (!timeError) + { + // Only time constraint exists => use it + aDaysLeft = diff; + } + else + { + // Only Interval constraint exists => use it + aDaysLeft = intervalDiff; + } + } + else + { + // No constraint about to expire + aAboutToExpire = EFalse; + aConstraint = ESVGTNone; + } + } + else + { + // Non-restricted object cannot expire + aAboutToExpire = EFalse; + } + } + + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::SendingAllowed +// ----------------------------------------------------------------------------- +// +TBool CSVGTDrmHelper::SendingAllowed() const + { + return iSendingAllowed; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetCount +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::GetCount(TUint32& aCount) + { + TInt error = KErrNone; + + if (!iProtected) + { + error = KErrNotFound; + } + else if (iRightsConstraints) + { + TUint32 ignore; + TRAP(error, iRightsConstraints->GetCountersL(aCount, ignore)); + } + else + { + error = KErrNotReady; + } + + return error; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetStartTime +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::GetStartTime(TTime& aStartTime) + { + TInt error = KErrNone; + + if (!iProtected) + { + error = KErrNotFound; + } + else if (iRightsConstraints) + { + TRAP(error, iRightsConstraints->GetStartTimeL(aStartTime)); + } + else + { + error = KErrNotReady; + } + + return error; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetEndTime +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::GetEndTime(TTime& aEndTime) + { + TInt error = KErrNone; + + if (!iProtected) + { + error = KErrNotFound; + } + else if (iRightsConstraints) + { + TRAP(error, iRightsConstraints->GetEndTimeL(aEndTime)); + } + else + { + error = KErrNotReady; + } + + return error; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetInterval +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::GetInterval(TTimeIntervalSeconds& aInterval) + { + TInt error = KErrNone; + + if (!iProtected) + { + error = KErrNotFound; + } + else if (iRightsConstraints) + { + TRAP(error, iRightsConstraints->GetIntervalL(aInterval)); + } + else + { + error = KErrNotReady; + } + + return error; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetIntervalStart +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::GetIntervalStart(TTime& aStartTime) + { + TInt error = KErrNone; + + if (!iProtected) + { + error = KErrNotFound; + } + else if (iRightsConstraints) + { + TRAP(error, iRightsConstraints->GetIntervalStartL(aStartTime)); + } + else + { + error = KErrNotReady; + } + + return error; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::IsProtected +// ----------------------------------------------------------------------------- +// +TBool CSVGTDrmHelper::IsProtected() const + { + return iProtected; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::CanSetAutomated +// ----------------------------------------------------------------------------- +// +TBool CSVGTDrmHelper::CanSetAutomated() const + { + return iCanSetAutomated; + } + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/SvgtFileViewDetailsSrc/svgtfileviewdetails.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/SvgtFileViewDetailsSrc/svgtfileviewdetails.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,904 @@ +/* +* Copyright (c) 2006 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: Implementation of the CSvgtFileViewDetailsDialog. +* +*/ + + + +// INCLUDE FILES +#include "svgtfileviewdetails.h" + +#include +#include +#include +#include +#include // KMaxDataTypeLength +#include +#include +#include +#include +#include +#include + +#include + +_LIT(KResourceFileName,"svgtfileviewdetails.rsc"); + +const TInt KSizeStringLengthSix = 6; +const TInt KSizeStringLengthFive = 5; +const TInt KSizeStringLengthFour = 4; +const TInt KSizeStringLengthThree = 3; + +const TInt KValBufferLength = 512; +const TInt KTimeCount = 2; +const TInt KArrayGranularity = 2; +const TInt KDecimalCount = 2; + +const TInt KOneDigit1 = 1; +const TInt KOneDigit5 = 5; +const TInt KOneDigit9 = 9; +const TInt KTwoDigit11 = 11; +const TInt KTwoDigit14 = 14; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSvgtFileDetails::CSvgtFileDetails +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSvgtFileDetails::CSvgtFileDetails() + : iUrl(NULL), iFormat(NULL), + iDRMExpireConstraint( ESVGTNone ) //Initialize with no constraints + { + } + +// ----------------------------------------------------------------------------- +// CSvgtFileDetails::~CSvgtFileDetails +// Destructor +// ----------------------------------------------------------------------------- +// +CSvgtFileDetails::~CSvgtFileDetails() + { + delete iUrl; + delete iFormat; + } + + +// CONSTANTS + + +_LIT(KDataTypeSvgt,"svg"); + +const TInt KFileSizeOneKilobyte = 1024; +const TInt KThousandNotKilobyte = 1000; +const TInt KMaxTimeLength = 36; + +// For meta data +_LIT( KSpace, " "); + +// Language specific time format +const TInt KOneDigit = 10; +const TInt KTwoDigits = 100; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::CSvgtFileViewDetailsDialog +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSvgtFileViewDetailsDialog::CSvgtFileViewDetailsDialog() + { + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::ConstructL() + { + iListBox = new (ELeave) CAknDoublePopupMenuStyleListBox(); + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSvgtFileViewDetailsDialog* CSvgtFileViewDetailsDialog::NewL() + { + CSvgtFileViewDetailsDialog* self = new( ELeave ) CSvgtFileViewDetailsDialog; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::~CSvgtFileViewDetailsDialog +// Destructor +// ----------------------------------------------------------------------------- +// +CSvgtFileViewDetailsDialog::~CSvgtFileViewDetailsDialog() + { + delete iListBox; + iEnv->DeleteResourceFile( iResOffset ); //removing the resource file for enviornment + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::ExecuteLD +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSvgtFileViewDetailsDialog::ExecuteLD( RFile& aFileHandle ) + { + CleanupStack::PushL( this ); + CSvgtFileDetails* fileDetails = new (ELeave) CSvgtFileDetails(); + CleanupStack::PushL( fileDetails ); + + AddResourceFileToEnvL(); + + // Creates a handle to content handled via CAF + CContent *content = CContent::NewLC( aFileHandle ); + content->GetAttribute( EIsProtected, fileDetails->iDrmProtected ); + CleanupStack::PopAndDestroy( content ); + + if ( fileDetails->iDrmProtected ) + { + // drm data + FetchDrmDataL( aFileHandle, fileDetails ); + } + + // recognize file and get format + TBuf format(KDataTypeSvgt); + fileDetails->iFormat = format.AllocL(); + + // creation time + aFileHandle.Modified(fileDetails->iTime); + + // Convert from UTC to local time + RTz lTz; + // Connect to TimeZone Server + User::LeaveIfError( lTz.Connect() ); + CleanupClosePushL( lTz ); + + // Create Util Class + CTzConverter* lTzConverterPtr = CTzConverter::NewL( lTz ); + + CleanupStack::PushL( lTzConverterPtr ); + // Perform conversion to local time + User::LeaveIfError( lTzConverterPtr->ConvertToLocalTime( fileDetails->iTime ) ); + + CleanupStack::PopAndDestroy( 2 ); // lTzConverterPtr, lTz + + // file size + aFileHandle.Size(fileDetails->iSize); + + // Show File Details Dialog + DoLaunchDialogL( fileDetails ); + + CleanupStack::PopAndDestroy( fileDetails ); + CleanupStack::PopAndDestroy( this ); + + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::DoLaunchDialog +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::DoLaunchDialogL(const CSvgtFileDetails* aFileDetails ) + { + CAknPopupList* popupList = CAknPopupList::NewL(iListBox, + R_AVKON_SOFTKEYS_OK_EMPTY__OK, + AknPopupLayouts::EMenuDoubleWindow); + CleanupStack::PushL(popupList); + + iListBox->ConstructL(popupList, EAknListBoxViewerFlags); + iListBox->CreateScrollBarFrameL(ETrue); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + + SetTitleL(popupList); + FillListBoxL(aFileDetails); + + CleanupStack::Pop( popupList ); + popupList->ExecuteLD(); + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::SetTitleL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::SetTitleL(CAknPopupList* aPopupList) const + { + HBufC* title = StringLoader::LoadLC(R_FILE_DETAILS); + if( aPopupList ) + { + aPopupList->SetTitleL(*title); + } + CleanupStack::PopAndDestroy( title ); + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::FillListBoxL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::FillListBoxL(const CSvgtFileDetails* aFileDetails) + { + CDesCArray* itemArray = + static_cast( iListBox->Model()->ItemTextArray() ); + + if( aFileDetails ) + { + if ( aFileDetails->iDrmProtected ) + { + MakeDrmItemsL(itemArray,aFileDetails); + } + + MakeUrlItemL(itemArray,aFileDetails); + MakeFormatItemL(itemArray,aFileDetails); + MakeDateItemL(itemArray,aFileDetails); + MakeTimeItemL(itemArray,aFileDetails); + MakeSizeItemL(itemArray,aFileDetails); + } + + iListBox->HandleItemAdditionL(); + iListBox->SetCurrentItemIndex(0); + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::AddItemToListBoxL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::AddItemToListBoxL(const TDesC& aHeading, + const TDesC& aValue, + CDesCArray* aItemArray) const + { + CDesCArrayFlat* items = new (ELeave) CDesCArrayFlat( KArrayGranularity ); + CleanupStack::PushL(items); + items->AppendL(aHeading); //First string (heading) + items->AppendL(aValue); //Second string (value) + HBufC* headingAndValue = + StringLoader::LoadLC( R_FILE_DETAILS_ROW_FORMAT, *items ); + if( aItemArray ) + { + aItemArray->AppendL(*headingAndValue); + } + + CleanupStack::PopAndDestroy( headingAndValue ); // headingAndValue + CleanupStack::PopAndDestroy( items ); // items + } + + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::MakeUrlItemL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::MakeUrlItemL(CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails) const + { + + if ( aFileDetails && aFileDetails->iUrl ) + { + HBufC* heading = StringLoader::LoadLC(R_FILE_URL_HEADING); + AddItemToListBoxL(*heading,*aFileDetails->iUrl,aItemArray); + CleanupStack::PopAndDestroy( heading ); + } + } + + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::MakeFormatItemL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::MakeFormatItemL(CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails) const + { + if ( aFileDetails && aFileDetails->iFormat ) + { + HBufC* heading = StringLoader::LoadLC(R_FILE_FORMAT_HEADING); + AddItemToListBoxL(*heading,*aFileDetails->iFormat,aItemArray); + CleanupStack::PopAndDestroy( heading ); + } + } + + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::MakeSizeItemL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::MakeSizeItemL(CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails) const + { + + if ( aFileDetails && aFileDetails->iSize ) + { + TRealFormat format = TRealFormat(KMaxFileName, KDecimalCount); + TBuf sizeString; + HBufC* value = NULL; + HBufC* heading = StringLoader::LoadLC(R_FILE_SIZE_HEADING); + TReal size = aFileDetails->iSize; + + // Show bytes with 3 digits. If more digits needed, + // show size in kilobytes. + if ( size < KThousandNotKilobyte ) + { + sizeString.Num(size,format); + switch (sizeString.Length()) + { + case KSizeStringLengthSix: + sizeString = sizeString.Left( KSizeStringLengthThree ); + break; + case KSizeStringLengthFive: + sizeString = sizeString.Left( KSizeStringLengthFour ); + break; + default: + break; + } + value = StringLoader::LoadLC(R_FILE_SIZE_B,sizeString); + } + else + { + size = size/KFileSizeOneKilobyte; + sizeString.Num(size,format); + switch (sizeString.Length()) + { + case KSizeStringLengthSix: + sizeString = sizeString.Left( KSizeStringLengthThree ); + break; + case KSizeStringLengthFive: + sizeString = sizeString.Left( KSizeStringLengthFour ); + break; + default: + break; + } + value = StringLoader::LoadLC(R_FILE_SIZE_KB,sizeString); + } + TPtr textPtr = value->Des(); + LanguageSpecificNumberConversion( textPtr ); + AddItemToListBoxL(*heading,*value,aItemArray); + CleanupStack::PopAndDestroy( value ); + CleanupStack::PopAndDestroy( heading ); // heading & value + } + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::MakeDateItemL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::MakeDateItemL(CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails) const + { + + if ( ( aFileDetails ) && ( aFileDetails->iTime > TTime(0) )) + { + HBufC* heading = StringLoader::LoadLC(R_FILE_DATE_HEADING); + HBufC* dateFormatString = + StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO ); + TBuf date; + aFileDetails->iTime.FormatL(date,*dateFormatString); + LanguageSpecificNumberConversion( date ); + AddItemToListBoxL(*heading,date,aItemArray); + CleanupStack::PopAndDestroy( dateFormatString ); + CleanupStack::PopAndDestroy( heading ); // heading & dateFormatString + } + + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::MakeTimeItemL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::MakeTimeItemL(CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails) const + { + if ( ( aFileDetails ) && ( aFileDetails->iTime > TTime(0))) + { + HBufC* heading = StringLoader::LoadLC( R_FILE_TIME_HEADING ); + HBufC* timeFormatString = + StringLoader::LoadLC( R_QTN_TIME_USUAL_WITH_ZERO ); + TBuf time; + aFileDetails->iTime.FormatL(time,*timeFormatString); + LanguageSpecificNumberConversion( time ); + AddItemToListBoxL(*heading,time,aItemArray); + CleanupStack::PopAndDestroy( timeFormatString ); + CleanupStack::PopAndDestroy( heading ); // heading & timeFormatString + } + } + + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::MakeDrmItemsL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::MakeDrmItemsL(CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails) const + { + + HBufC* rights = StringLoader::LoadLC(R_FILE_DRM_DISPLAY); + HBufC* heading = NULL; + HBufC* value = NULL; + + if ( aFileDetails ) + { + switch (aFileDetails->iDRMRightsStatus) + { + case ESVGTFull: + // status + heading = StringLoader::LoadLC(R_FILE_DRM_STAT); + value = StringLoader::LoadLC(R_FILE_DRM_VALID); + AddItemToListBoxL(*heading,*value,aItemArray); + CleanupStack::PopAndDestroy( value ); + CleanupStack::PopAndDestroy( heading ); // heading && value + // full rights + heading = StringLoader::LoadLC(R_FILE_DRM_FULL,*rights); + value = StringLoader::LoadLC(R_FILE_DRM_UNLIMITED); + AddItemToListBoxL(*heading,*value,aItemArray); + CleanupStack::PopAndDestroy( value ); + CleanupStack::PopAndDestroy( heading ); // heading && value + break; + case ESVGTRestricted: + case ESVGTPreview: + // status + heading = StringLoader::LoadLC(R_FILE_DRM_STAT); + value = StringLoader::LoadLC(R_FILE_DRM_VALID); + AddItemToListBoxL(*heading,*value,aItemArray); + CleanupStack::PopAndDestroy( value ); + CleanupStack::PopAndDestroy( heading ); // heading && value + // make rest of the drm items + MakeRestrictedDrmItemsL(rights,aItemArray,aFileDetails); + break; + case ESVGTMissing: + // status + heading = StringLoader::LoadLC(R_FILE_DRM_STAT); + value = StringLoader::LoadLC(R_FILE_DRM_EXP); + AddItemToListBoxL(*heading,*value,aItemArray); + CleanupStack::PopAndDestroy( value ); + CleanupStack::PopAndDestroy( heading ); // heading && value + break; + case ESVGTExpired: + // status + heading = StringLoader::LoadLC(R_FILE_DRM_STAT); + value = StringLoader::LoadLC(R_FILE_DRM_EXP); + AddItemToListBoxL(*heading,*value,aItemArray); + CleanupStack::PopAndDestroy( value ); + CleanupStack::PopAndDestroy( heading ); // heading && value + // make rest of the drm items + MakeRestrictedDrmItemsL(rights,aItemArray,aFileDetails); + break; + default: + break; + } + } + + heading = NULL; + value = NULL; + + // sending + heading = StringLoader::LoadLC(R_FILE_DRM_CS); + if ( aFileDetails && aFileDetails->iDRMForwardLocked ) + { + value = StringLoader::LoadLC(R_FILE_DRM_FORBID); + } + else + { + value = StringLoader::LoadLC(R_FILE_DRM_ALLOWED); + } + AddItemToListBoxL(*heading,*value,aItemArray); + CleanupStack::PopAndDestroy( value ); + CleanupStack::PopAndDestroy( heading ); + CleanupStack::PopAndDestroy( rights ); // heading, value, rights + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::MakeDrmItemsL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::MakeRestrictedDrmItemsL( + const HBufC* aRights, CDesCArray* aItemArray, + const CSvgtFileDetails* aFileDetails ) const + { + + HBufC* heading = NULL; + HBufC* value = NULL; + + if ( !aRights || !aItemArray ) + { + return; + } + + // count + if ( ( aFileDetails ) && ( aFileDetails->iDRMExpireConstraint == ESVGTCount + || aFileDetails->iDRMExpireConstraint == ESVGTCountAndTime )) + { + heading = StringLoader::LoadLC(R_FILE_DRM_UTL,*aRights); + + TInt counts = aFileDetails->iDRMCountsLeft; + + if (counts == 1) + { + value = StringLoader::LoadLC(R_FILE_DRM_1_COUNT); + } + else + { + value = StringLoader::LoadLC(R_FILE_DRM_N_COUNTS,counts); + } + TPtr textPtr = value->Des(); + LanguageSpecificNumberConversion( textPtr ); + AddItemToListBoxL(*heading,*value,aItemArray); + CleanupStack::PopAndDestroy( value ); + CleanupStack::PopAndDestroy( heading ); // heading && value + } + + if ( ( aFileDetails ) && ( aFileDetails->iDRMExpireConstraint == ESVGTTime || + aFileDetails->iDRMExpireConstraint == ESVGTCountAndTime || + ( aFileDetails->iDRMFileHasInterval && + aFileDetails->iDRMIntervalActive ))) + { + HBufC* dateFormatString = StringLoader::LoadLC( + R_QTN_DATE_USUAL_WITH_ZERO ); + HBufC* timeFormatString = StringLoader::LoadLC( R_QTN_TIME_USUAL ); + + TTime from = aFileDetails->iDRMValidFrom; + TTime until = aFileDetails->iDRMValidUntil; + + // from + heading = StringLoader::LoadLC(R_FILE_DRM_VALID_FROM,*aRights); + HBufC* datePointer = HBufC::NewLC( KMaxLongDateFormatSpec ); + TPtr date = datePointer->Des(); + from.FormatL( date, *dateFormatString ); + TBuf time; + from.FormatL( time, *timeFormatString ); + date.Append( KSpace ); + date.Append( time ); + LanguageSpecificNumberConversion( date ); + AddItemToListBoxL( *heading, date, aItemArray ); + CleanupStack::PopAndDestroy( datePointer ); + CleanupStack::PopAndDestroy( heading ); // datePointer, heading + + // until + heading = StringLoader::LoadLC(R_FILE_DRM_VALID_TO,*aRights); + HBufC* dateToPntr = HBufC::NewLC( KMaxLongDateFormatSpec ); + TPtr dateTo = dateToPntr->Des(); + until.FormatL( dateTo, *dateFormatString ); + TBuf timeTo; + until.FormatL( timeTo, *timeFormatString ); + dateTo.Append( KSpace ); + dateTo.Append( timeTo ); + LanguageSpecificNumberConversion( dateTo ); + AddItemToListBoxL( *heading, dateTo, aItemArray ); + + // destroying dateFormatString, timeFormatString, heading, dateToPntr + CleanupStack::PopAndDestroy( dateToPntr ); + CleanupStack::PopAndDestroy( heading ); + CleanupStack::PopAndDestroy( timeFormatString ); + CleanupStack::PopAndDestroy( dateFormatString ); + } + // interval + else + { + if ( ( aFileDetails ) && ( aFileDetails->iDRMFileHasInterval && + !aFileDetails->iDRMIntervalActive )) + { + // times not activated + heading = StringLoader::LoadLC(R_FILE_DRM_UTS,*aRights); + value = StringLoader::LoadLC(R_FILE_DRM_NOT_ACT); + AddItemToListBoxL(*heading,*value,aItemArray); + CleanupStack::PopAndDestroy( value ); // heading && value + CleanupStack::PopAndDestroy( heading ); + + // query what the current time is + TTime currentTime; + currentTime.HomeTime(); + // calculate rights end time + TTime endTime = currentTime + aFileDetails->iDRMInterval; + + HBufC* lVal = HBufC::NewLC( KValBufferLength ); + TPtr valPtr(lVal->Des()); + + TInt count = 0; + + // years + TTimeIntervalYears years = endTime.YearsFrom(currentTime); + if (years.Int()) + { + AddSinglePartOfTimeL( years.Int(), + R_FILE_DRM_NBR_OF_YEARS_ONE, + R_FILE_DRM_NBR_OF_YEARS_ONE_FINAL, + R_FILE_DRM_NBR_OF_YEARS_TWO_FOUR, + R_FILE_DRM_NBR_OF_YEARS_FIVE_ZERO, + value ); + count++; + valPtr.Append(*value); + endTime -= years; + CleanupStack::PopAndDestroy( value ); + } + + // months + TTimeIntervalMonths months = endTime.MonthsFrom(currentTime); + if (months.Int()) + { + AddSinglePartOfTimeL( months.Int(), + R_FILE_DRM_NBR_OF_MONTHS_ONE, + 0, + R_FILE_DRM_NBR_OF_MONTHS_TWO_FOUR, + R_FILE_DRM_NBR_OF_MONTHS_FIVE_ZERO, + value ); + if (count) + { + valPtr.Append( KSpace ); + } + + count++; + valPtr.Append(*value); + endTime -= months; + CleanupStack::PopAndDestroy( value ); + } + + // days + TTimeIntervalDays days = endTime.DaysFrom(currentTime); + if (days.Int() && count < KTimeCount) + { + AddSinglePartOfTimeL( days.Int(), + R_FILE_DRM_NBR_OF_DAYS_ONE, + R_FILE_DRM_NBR_OF_DAYS_ONE_FINAL, + R_FILE_DRM_NBR_OF_DAYS_TWO_FOUR, + R_FILE_DRM_NBR_OF_DAYS_FIVE_ZERO, + value ); + if (count) + { + valPtr.Append( KSpace ); + } + + valPtr.Append(*value); + endTime -= days; + CleanupStack::PopAndDestroy( value ); + count++; + } + + // hours + TTimeIntervalHours hours; + TInt ret = endTime.HoursFrom(currentTime,hours); + if (ret == KErrNone && count < KTimeCount && hours.Int()) + { + AddSinglePartOfTimeL( hours.Int(), + R_FILE_DRM_NBR_OF_HOURS_ONE, + R_FILE_DRM_NBR_OF_HOURS_ONE_FINAL, + R_FILE_DRM_NBR_OF_HOURS_TWO_FOUR, + R_FILE_DRM_NBR_OF_HOURS_FIVE_ZERO, + value ); + if (count) + { + valPtr.Append( KSpace ); + } + + valPtr.Append(*value); + endTime -= hours; + CleanupStack::PopAndDestroy( value ); + count++; + } + + // mins + TTimeIntervalMinutes minutes; + ret = endTime.MinutesFrom(currentTime,minutes); + if (ret == KErrNone && count < KTimeCount && minutes.Int()) + { + AddSinglePartOfTimeL( minutes.Int(), + R_FILE_DRM_NBR_OF_MINS_ONE, + R_FILE_DRM_NBR_OF_MINS_ONE_FINAL, + R_FILE_DRM_NBR_OF_MINS_TWO_FOUR, + R_FILE_DRM_NBR_OF_MINS_FIVE_ZERO, + value ); + if (count) + { + valPtr.Append( KSpace ); + } + + valPtr.Append(*value); + endTime -= minutes; + CleanupStack::PopAndDestroy( value ); + count++; + } + + // seconds + TTimeIntervalSeconds seconds; + ret = endTime.SecondsFrom(currentTime,seconds); + if (ret == KErrNone && count < KTimeCount && seconds.Int()) + { + AddSinglePartOfTimeL( seconds.Int(), + R_FILE_DRM_NBR_OF_SECS_ONE, + R_FILE_DRM_NBR_OF_SECS_ONE_FINAL, + R_FILE_DRM_NBR_OF_SECS_TWO_FOUR, + R_FILE_DRM_NBR_OF_SECS_FIVE_ZERO, + value ); + + if (count) + { + valPtr.Append( KSpace ); + } + + valPtr.Append(*value); + CleanupStack::PopAndDestroy( value ); + count++; + } + + heading = StringLoader::LoadLC(R_FILE_DRM_UDL,*aRights); + LanguageSpecificNumberConversion(valPtr); + AddItemToListBoxL(*heading,valPtr,aItemArray); + CleanupStack::PopAndDestroy( lVal ); + CleanupStack::PopAndDestroy( heading ); + } + + } + + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::LanguageSpecificNumberConversion +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::LanguageSpecificNumberConversion( TDes& aText ) const + { + if ( AknTextUtils::DigitModeQuery( AknTextUtils::EDigitModeShownToUser ) ) + { + AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aText ); + } + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::FetchDrmDataL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::FetchDrmDataL( RFile& aFileHandle, + CSvgtFileDetails* aFileDetails ) const + { + + CSVGTDrmHelper* myHelper = CSVGTDrmHelper::NewLC(); + + myHelper->LoadUsageRigthsInfoL(aFileHandle); + + if ( aFileDetails ) + { + myHelper->GetUsageRightsStatus(aFileDetails->iDRMRightsStatus); + + // sending + aFileDetails->iDRMForwardLocked = !myHelper->SendingAllowed(); + + if (aFileDetails->iDRMRightsStatus == ESVGTRestricted || + aFileDetails->iDRMRightsStatus == ESVGTPreview || + aFileDetails->iDRMRightsStatus == ESVGTExpired) + { + // counts + TInt retCount = myHelper->GetCount(aFileDetails->iDRMCountsLeft); + + if (retCount == KErrNone) + { + aFileDetails->iDRMExpireConstraint = ESVGTCount; + } + + // time + TInt retTime = myHelper->GetStartTime(aFileDetails->iDRMValidFrom); + retTime = myHelper->GetEndTime(aFileDetails->iDRMValidUntil); + + if (retTime == KErrNone && retCount == KErrNone) + { + aFileDetails->iDRMExpireConstraint = ESVGTCountAndTime; + } + else + { + if (retTime == KErrNone) + { + aFileDetails->iDRMExpireConstraint = ESVGTTime; + } + } + + // interval + if (myHelper->GetInterval(aFileDetails->iDRMInterval) == KErrNone) + { + aFileDetails->iDRMFileHasInterval = ETrue; + TTime from; + if (myHelper->GetIntervalStart(from) == KErrNone) + { + aFileDetails->iDRMIntervalActive = ETrue; + // active from + aFileDetails->iDRMValidFrom = from; + // calculate rights end time + aFileDetails->iDRMValidUntil = + aFileDetails->iDRMValidFrom + aFileDetails->iDRMInterval; + } + else + { + aFileDetails->iDRMIntervalActive = EFalse; + } + } + else + { + aFileDetails->iDRMFileHasInterval = EFalse; + aFileDetails->iDRMIntervalActive = EFalse; + } + } + } + + // cleanup + CleanupStack::PopAndDestroy( myHelper ); + } + +// ----------------------------------------------------------------------------- +// CSvgtFileViewDetailsDialog::AddSinglePartOfTimeL +// ----------------------------------------------------------------------------- +// +void CSvgtFileViewDetailsDialog::AddSinglePartOfTimeL( TInt aNumOfElements, + TInt aResourceIdSingle, + TInt aResourceIdOneFinal, + TInt aResourceIdTwoFour, + TInt aResourceIdFiveZero, + HBufC*& aStrings ) const + { + TInt finalOneDigit = aNumOfElements % KOneDigit; + TInt finalTwoDigits = aNumOfElements % KTwoDigits; + + if ( aNumOfElements == 1 ) + { + aStrings = StringLoader::LoadLC( aResourceIdSingle); + } + else if ( finalOneDigit == KOneDigit1 && finalTwoDigits != KTwoDigit11 ) + { + // Used for period of years ending with 1 from 21 (21, 31, 41, etc.) + aStrings = StringLoader::LoadLC( aResourceIdOneFinal, aNumOfElements ); + } + else if ( finalOneDigit == 0 || + ( finalOneDigit >= KOneDigit5 && finalOneDigit <= KOneDigit9 ) || + ( finalTwoDigits >= KTwoDigit11 && finalTwoDigits <= KTwoDigit14 ) ) + { + // Used for period of minutes ending from 5 to 0 plus range between 11 + // and 14 (5-20, 25-30, 35-40, 45-50, 53-59) + aStrings = StringLoader::LoadLC( aResourceIdFiveZero, aNumOfElements ); + } + else + { + // Used for period of minutes ending from 2 to 4, excluded 12-14 (2-4, + // 22-24, 32-34, 42-44, 52-54) + aStrings = StringLoader::LoadLC( aResourceIdTwoFour, aNumOfElements ); + } + } + +void CSvgtFileViewDetailsDialog::AddResourceFileToEnvL() + { + TFileName resFileName; + Dll::FileName( resFileName ); // get dll path + TDriveName drive( TParsePtrC( resFileName ).Drive( ) ); // solve drive + resFileName.Zero(); + resFileName.Append( drive ); + resFileName.Append( KDC_RESOURCE_FILES_DIR ); + resFileName.Append( KResourceFileName ); + + iEnv = CEikonEnv::Static(); + BaflUtils::NearestLanguageFile(iEnv->FsSession(), resFileName); //for localization + iEnv->AddResourceFileL(resFileName); + RResourceFile resFile; + CleanupClosePushL(resFile); + resFile.OpenL(iEnv->FsSession(), resFileName); + resFile.ConfirmSignatureL(); + iResOffset = resFile.Offset(); + CleanupStack::PopAndDestroy(&resFile); //resFile + } + + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlInc/SVGTDrmHelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlInc/SVGTDrmHelper.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,261 @@ +/* +* Copyright (c) 2004,2005 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: DRM helper for svg files. +* +*/ + + + +#ifndef SVGTDRMHELPER_H +#define SVGTDRMHELPER_H + +// INCLUDES +#include + +// DATA TYPES +enum TSVGTRightsStatus + { + ESVGTFull, + ESVGTMissing, + ESVGTRestricted, + ESVGTExpired, + ESVGTPreview + }; + +enum TSVGTExpireConstraint + { + ESVGTNone, + ESVGTCount, + ESVGTTime, + ESVGTCountAndTime + }; + +// CONSTANTS +const TInt KSVGTRightsAboutToExpire = -40000; + +// FORWARD DECLARATIONS +class CDRMHelper; +class CDRMHelperRightsConstraints; +class MDesCArray; +class CCoeEnv; + +// CLASS DECLARATION + +/** +* DRM helper for SVG files. +* +* @lib SVGTUIControl.dll +* @since 3.0 +*/ +class CSVGTDrmHelper : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CSVGTDrmHelper* NewL(); + + /** + * Two-phased constructor. + */ + static CSVGTDrmHelper* NewLC(); + + /** + * Destructor. + */ + virtual ~CSVGTDrmHelper(); + + public: // New functions + + + /** + * This Function checks whether the file has preview rights. + * @since 3.0 + * @param aFileHandle File handle for which usage rights info is loaded. + * @return True if the file has only preview rights + * False if not. + */ + TBool IsPreviewL( RFile& aFileHandle ); + + /** + * This Function checks the rights associated with the file. + * @since 3.0 + * @param aFileHandle File handle for which usage rights is checked. + * @return Button code + */ + TInt CheckRightsAmountL( RFile& aFileHandle ); + + + /** + * This Function gets the drm details needed for thumbnail generation. + * @since 3.0 + * @param aFileHandle File handle for which usage rights info is loaded. + * @param aRightsValid True if the rights are valid + * @param aIsSeparateDeliveryNS True if the file is a separate delivery + * drm file non-supersitributable + * @param aIsProtected True if the file is protected + */ + void GetDrmDetailsL( RFile& aFileHandle, + TBool& aRightsValid, + TBool& aIsSeparateDeliveryNS, + TBool& aIsProtected ); + + + /** + * Loads usage rights information for a svg file using + * CDRMHelper. The loaded constraint is CContentAccess::EPlay. + * @since 3.0 + * @param aFileHandle File handle for which usage rights info is loaded. + */ + void LoadUsageRigthsInfoL( RFile& aFileHandle ); + + + /** + * Gets usage rigths status. + * @since 3.0 + * @param aStatus: + * ESVGTFull: Full rights + * ESVGTMissing: Rights missing + * ESVGTRestricted: Restricted rights + * ESVGTExpired: Expired rights (could be also future rights) + * ESVGTPreview: Preview rights + */ + void GetUsageRightsStatus( TSVGTRightsStatus& aStatus ); + + /** + * Checks if the usage rigths are about to expire. If they are, returns + * info about the rights contraints that are about to expire. + * @since 3.0 + * @param aAboutToExpire Boolean telling if the rigths are about to + * expire or not. + * @param aConstraint Constraint that is about to expire: + * ESVGTCount: Usage count about to expire + * ESVGTTime: Usage time about to expire + * ESVGTCountAndTime: Usage count and time about to + * expire + * @param aCountLeft Usage counts left (only if count is about to expire) + * @param aDaysLeft Usage days left (only if time is about to expire) + */ + void GetExpireStatus( TBool& aAboutToExpire, + TSVGTExpireConstraint& aConstraint, + TInt& aCountLeft, + TInt& aDaysLeft ); + + /** + * Checks if sending of the file is allowed. + * @since 3.0 + * @return ETrue: Sending is allowed. + * EFalse: Sending is not allowed. + */ + TBool SendingAllowed() const; + + /** + * Gets usage count. + * @since 3.0 + * @param aCount Counts left. + * @return Error code: + * KErrNone: Count returned. + * KErrNotFound: Object doesn't have count based rights. + * KErrNotReady: Usage rights info not loaded. + */ + TInt GetCount( TUint32& aCount ); + + /** + * Gets start time of time based rights. + * @since 3.0 + * @param aStartTime Start time. + * @return Error code: + * KErrNone: Start time returned. + * KErrNotFound: Object doesn't have time based rights. + * KErrNotReady: Usage rights info not loaded. + */ + TInt GetStartTime( TTime& aStartTime ); + + /** + * Gets end time of time based rights. + * @since 3.0 + * @param aEndTime End time. + * @return Error code: + * KErrNone: End time returned. + * KErrNotFound: Object doesn't have time based rights. + * KErrNotReady: Usage rights info not loaded. + */ + TInt GetEndTime( TTime& aEndTime ); + + /** + * Gets interval time constraint. + * @since 3.0 + * @param aInterval Interval. + * @return Error code: + * KErrNone: Interval returned. + * KErrNotFound: Object doesn't have interval constraint. + * KErrNotReady: Usage rights info not loaded. + */ + TInt GetInterval( TTimeIntervalSeconds& aInterval ); + + /** + * Gets start time of activated interval constraint. + * @since 3.0 + * @param aStartTime Start time. + * @return Error code: + * KErrNone: Start time returned. + * KErrNotFound: Interval has not been started yet. + * KErrNotReady: Usage rights info not loaded. + */ + TInt GetIntervalStart( TTime& aStartTime ); + + /** + * Provides info about files DRM protection status. + * @since 3.0 + * @return ETrue: The file is DRM protected. + * EFalse: The file is not DRM protected. + */ + TBool IsProtected() const; + + /** + * Checks if given content can be set as an automated content. + * @since 3.0 + * @return Boolean. + */ + TBool CanSetAutomated() const; + + private: // Private contructors + + /** + * C++ default constructor. + */ + CSVGTDrmHelper(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + CDRMHelper* iDrmHelper; + CDRMHelperRightsConstraints* iRightsConstraints; + CCoeEnv* iEnv; + + TBool iProtected; + TBool iExpired; + TBool iSendingAllowed; + TBool iCanSetAutomated; + //flag to check for SD protection + TInt iIsSeparateDelivery; + }; + +#endif // SVGTDRMHELPER_H + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlInc/SvgtController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlInc/SvgtController.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2005 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: SVGT Controller implements the active objects for the +* progressive rendering feature(Redraw, Thread Exit) +* +*/ + + +//SvgtController.h + +#ifndef SVGTCONTROLLER_H +#define SVGTCONTROLLER_H + +#include +#include + +const TInt KAnimationLength = 10; +const TInt KAnimatioBufferLength = 20; +class CSVGTCustControl; +class CAknNavigationDecorator; +class CEikonEnv; + +/** +* CSvgtThreadController is a Active Object (CActive) used to +* notify thread death event to the main thread to do the post load operations +* +* @lib SVGTUIControl.lib +* @since 3.1 +*/ + +class CSvgtThreadController : public CActive + { + public: + /** + * Two phase constructor + * @since 3.1 + * @param aEngine Engine object + * @param aCustControl + * @return CSvgtThreadController* + */ + static CSvgtThreadController* NewL(CSVGTCustControl* aCustControl); + + /** + * Two phase constructor which pushes the object on cleanup stack + * @since 3.1 + * @param aEngine Engine object + * @param aCustControl + * @return CSvgtThreadController* + */ + static CSvgtThreadController* NewLC(CSVGTCustControl* aCustControl); + + /** + * Destructor + * @since 3.1 + */ + ~CSvgtThreadController(); + + /** + * Makes it active to get notify on thread death + * @since 3.1 + * @param aThread Main thread object + */ + void IssueThreadMonitorRequest(const RThread& aThread); + + /** + * Stops the thread execution + * @since 3.1 + * @param aThread Main thread object + */ + void StopThreadExecution(const RThread& aThread); + + private: + /** + * Cancels all the request + * @since 3.1 + * @see CActive + */ + void DoCancel(); + + /** + * Handles an active object's request completion event. + * @since 3.1 + * @see CActive + */ + void RunL(); + + /** + * Parameterized constructor + * @since 3.1 + * @param aEngine Engine object + * @param aCustControl + * @param aMainThread + */ + CSvgtThreadController(CSVGTCustControl* aCustControl); + /** + * Two phase constructor + * @since 3.1 + */ + void ConstructL(); + + /** + * This fuction does the loading animation + * @since 3.1 + */ + void DoLoadAnimationL(); + + /** + * Callback fuction for loading animation + * @since 3.1 + * @param aThreadController Stores the object of type CSvgtThreadController + */ + static TInt LoadAnimationCallBack(TAny* aThreadController); + + /** + * Clears the navi pane indicator when the loading animation gets over + * @since 3.1 + * @param aThreadController Stores the object of type CSvgtThreadController + */ + void ClearNaviPaneDecorator(); + + private: //data members + // Custom control object + CSVGTCustControl* iCustControl; + + // Periodic timer to do loading animation + CPeriodic* iLoadAnimator; + + // Counts the number steps in the animation + TInt iCount; + + // Stores the text to display in the context bar while loading animation + TBuf iAnimationText; + + // Stores the the navigation pane decorator + CAknNavigationDecorator* iNaviDecorator; + + // Stores the main thread id + TThreadId iMainThread; + + // Application enviornment + CEikonEnv* iEikEnv; + }; + +#endif //SVGTCONTROLLER_H + +// End of File + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlInc/SvgtDecoratorControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlInc/SvgtDecoratorControl.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2006 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: Used to decorate the control on the navi pane +* +*/ + + +////////////////////////////////////////////////////////////////////////////// +// +// -----> CSvgtDecoratorControl(definition) +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef SVGTDECORATORCONTROL_H +#define SVGTDECORATORCONTROL_H + + +#include +#include + +class CAknStylusPopUpMenu; +class CAknNavigationControlContainer; +class CEikImage; +class CEikLabel; +class CGulIcon; + +enum TSvgtDecoratorControlId + { + EMuteImageCtrlId, + ETextCtrlId, + ELastCtrl + }; + +class CSvgtDecoratorControl : public CEikBorderedControl + { +public: //class methods + + /** + * default constructor. + */ + CSvgtDecoratorControl(); + + /** + * Twon phase constructor. + */ + void ConstructL(); + + /** + * Destructor. + */ + ~CSvgtDecoratorControl(); + + /** + * Sets the visibility of the mute icon in the navi pane. + * @since 3.2 + * @param aVolumeMuted whether to show the mute icon in the navi pane (True/False); + */ + void ShowVolumeMutedIcon( TBool aVolumeMuted ); + + /** + * Sets the progress text in the navi pane. + * @since 3.2 + * @param aText Progress text; + */ + void SetTextL( const TDesC& aText); + +protected: //From CCoeControl + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + +private: //From CCoeControl + void Draw(const TRect& aRect) const; + + TInt CountComponentControls() const; + + CCoeControl* ComponentControl(TInt aIndex) const; + + void SizeChanged(); + +private: + CEikImage* iImg; + CEikLabel* iLabel; + CGulIcon* iMutedIcon; + CAknNavigationControlContainer* iNaviPane; + }; + + +#endif //SVGTDECORATORCONTROL_H \ No newline at end of file diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlInc/SvgtEvent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlInc/SvgtEvent.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2009 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: +* +*/ + + +/* +************************************************************************************ +* SvgtEvent +************************************************************************************ +*/ + + +#ifndef SVGTEVENT_H +#define SVGTEVENT_H + +#include + +class CSvgtEvent : public CBase + { + public: //Data + enum TSvgtEventType + { + ESvgtEventEmbededImage, + ESvgtEventFetchImage, + ESvgtEventLinkActivated, + ESvgtEventLinkActivatedWithShow, + ESvgtEventRedraw, + ESvgtEventInvalid + }; + + public: //class methods + CSvgtEvent(TSvgtEventType aEventType, const TDesC& aUri); + ~CSvgtEvent(); + TPtrC ImageUri() const; + TSvgtEventType EventType() const; + private: + HBufC* iUri; + TSvgtEventType iEventType; + }; + +class CSvgtEventEmbededImage : public CSvgtEvent + { + public: + CSvgtEventEmbededImage( const TDesC& aUri); + + }; + +class CSvgtEventFetchImage : public CSvgtEvent + { + public: + CSvgtEventFetchImage( const TDesC& aUri); + }; + +class CSvgtEventLinkActivated : public CSvgtEvent + { + public: + CSvgtEventLinkActivated( const TDesC& aUri); + + }; + +class CSvgtEventLinkActivatedWithShow : public CSvgtEvent + { + public: + CSvgtEventLinkActivatedWithShow( const TDesC& aUri, const TDesC& aShow); + TPtrC Show() const; + + private: + HBufC* iShow; + }; + +class CSvgtEventRedraw : public CSvgtEvent + { + public: + CSvgtEventRedraw(); + private: + using CSvgtEvent::ImageUri; + }; + +#endif //SVGTEVENT_H \ No newline at end of file diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlInc/SvgtEventHandlerAO.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlInc/SvgtEventHandlerAO.h Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2006 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: This header file defines the CSvgtEventHandlerAO class +* +*/ + + +#ifndef SVGTEVENTHANDLERAO_H +#define SVGTEVENTHANDLERAO_H + +// INCLUDES +#include +#include +#include "SVGTCustControl.h" + +class MSvgtAppObserver; +class CSVGTAppObserverUtil; +class CSvgtEvent; + +_LIT(KSvgTagName, "svg"); +_LIT(KDataTagName, "data:"); + +/** +* This class handles the event list & process the events +* while progressive rendering +*/ +class CSvgtEventHandlerAO : public CActive + { + public: + /** + * Two phase constructor + * @since 3.1 + * @param aAppObserverUtil AppOberserverUtil Object + * @param aEngine Engine object + * @param aCustControl + * @return CSvgtEventHandlerAO* + */ + static CSvgtEventHandlerAO* NewL(MSvgtAppObserver* aAppObserverUtil, + CSVGTCustControl* aCustControl, + const TThreadId aMainThreadId ); + + /** + * Destructor + */ + virtual ~CSvgtEventHandlerAO(); + + /** + * It adds the event (except redraw event) to the event queue. + * @since 3.1 + * @param aEvent Event Object + * @return TBool + */ + TBool AddEventToList(CSvgtEvent* aEvent); + + /** + * It adds the redraw event to the event queue. + * @since 3.1 + * @param aForceAdd Decides whether to add the redraw event forcefully + * @return TBool + */ + TBool AddRedrawEventToList( const TBool aForceAdd = EFalse); + + /** + * It make the request complete. + * @since 3.1 + * @param aError Error code for the service provided + * @return none + */ + void MakeRequestComplete( TInt aError ); + + /** + * It indicates that document is document loading completed. + * @since 3.1 + * @return none + */ + void SetDocumentComplete(); + + private: + /** + * Handles an active object's request completion event. + * @since 3.1 + * @see CActive + */ + void RunL(); + + /** + * Cancels all the request + * @since 3.1 + * @see CActive + */ + void DoCancel(); + + /** + * Handles a leave occurring in the request completion event handler RunL(). + * @since 3.1 + * @see CActive + */ + TInt RunError( TInt aError ); + + /** + * It determines whether the time elapsed or not. + * @since 3.1 + * @return TBool + */ + TBool IsRedrawTimeElapsed(); + + /** + * Terminates the active object + * @since 3.1 + */ + void DoTerminate(); + + private: //class methods + /** + * constructor + */ + CSvgtEventHandlerAO(MSvgtAppObserver* aAppObserverUtil, + CSVGTCustControl* aCustControl, + const TThreadId aMainThreadId ); + /** + * Two phase constructor + * @since 3.1 + */ + void ConstructL(); + + private: //Data members + + CSVGTAppObserverUtil* iAppObserverUtil; + CSvgEngineInterfaceImpl* iSvgEngine; + CSVGTCustControl* iCustControl; + RPointerArray iEventList; + + // Stores the previous time stamp + TTime iPreviousRedrawClock; + TThreadId iMainThreadId; + TBool iIsDocumentComplete; + + TInt iStepCount; + TInt iSvgTimeBetweenRedraw; + // For Synchronising RequestComplete() calls + RCriticalSection iCritSection; + }; + +#endif //SVGTEVENTHANDLERAO_H + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTCustControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTCustControl.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,4850 @@ +/* +* Copyright (c) 2004,2005 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: This file implements the SVGT Custom Control which +* is used to display SVGT content +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //CEikonEnv +#include +#include +#include // for call handling +#include +#include +#include +#include +// User Includes +#include "SVGTUIControlDbgFlags.hrh" +#include "SVGTAppObserver.h" +#include "SVGTCustControl.h" +#include "SVGTUIDialog.hrh" + +#include "SvgtController.h" +#include "SvgtApplicationExitObserver.h" +#include "SvgtEventHandlerAO.h" +#include "SvgtEvent.h" +#include +#include +#include +#include + +#ifdef RD_SVGT_AUDIO_SUPPORT +#include +#include //for CRemConInterfaceSelector +#include //for CRemConCoreApiTarget + +#endif //RD_SVGT_AUDIO_SUPPORT +// Constants + +// Panning Constants +// KSccPanNumPixelsX - Amount of Pixels to Pan in X Direction when Pan is +// performed once. +// KSccPanNumPixelsY - Amount of Pixels to Pan in Y Direction when Pan is +// performed once. +const TInt KSccPanNumPixelsX = 30; +const TInt KSccPanNumPixelsY = 30; + +// Pointer Constants +// When pointer is moved in a particular direction, the movement also +// acceleration. The below constants define the delta for the acceleration. +// KSccCursorMinDeltaX - For X Direciton +// KSccCursorMinDeltaY - For Y Direciton +const TInt KSccCursorMinDeltaX = 5; +const TInt KSccCursorMinDeltaY = 5; + +// Zoom Constants +// KSccZoomInFactor - Indicates zoom factor to use while zooming in. +// This Value should be > 1.0 +// KSccZoomOutFactor - Indicates zoom factor to use while zooming out. +// This value should be > 0 and < 1.0 +const TReal32 KSccZoomInFactor = 2.0; // 2X Zoom In +const TReal32 KSccZoomOutFactor = 0.5;// 2X Zoom Out + +// Key Constants +const TInt KSccZoomInKey = ENumberKey5;//'5'; +const TInt KSccZoomOutKey =ENumberKey0; //'0'; + +// Number of milli seconds per second +const TUint32 KSccNumMSecPerSec = 1000; + + + +// Time in microsecs after which Pointer Inactivity should be declared +const TUint KSccPointerHideTimerStartAfter = 15000000; + +// Time in microsecs per second +const TInt KSccOneSecond = 1000000; + +// General Constants +const TInt KSccConstMinusOne = -1; +const TInt KSccConstZero = 0; +const TInt KSccConstOne = 1; +const TInt KSccConstTwo = 2; + +// set the name of the multi-bitmap file containing the bitmaps +_LIT( KSccIconFile,"Z:SVGTUIControl.mif" ); + +// SMIL Fit Value +_LIT( KSccSmilFitValue,"meet" ); + +// Font Ids for use with Engine-Init +const TInt KApacFontId = EApacPlain16; +const TInt KLatintFontId = ELatinBold12; + +// Duration const returned by engine when indefinite animations are present +const TUint KSccIndefiniteDur = 0xffffffff; + + +// Interval between two consecutive timer ticks in microseconds. +const TUint32 KSccProgIndTimerYieldDur = 100000; + +//constant for converting radians to degrees +const TReal32 KDegreesToRadiansFactor = 0.01745329252; + +// Maximum length of text in a text element +const TInt KSccMaxTextLength = 250; +const TInt KBackLightTimeInterval = 9; +const TInt KMaxEditorTextLength = 5120; +const TInt KEmbededImageTagLength = 5; +const TInt KSchemaLength = 4; + +#ifdef RD_SCALABLE_UI_V2 +const TInt KInitRepeatInterval = 10000; +#endif // RD_SCALABLE_UI_V2 + +// Background colour which is used by engine before rendering as a base colour +const TUint32 KSccArgbWhite = 0xffffffff; + +//TOUCH +#ifdef RD_SVGT_AUDIO_SUPPORT +const TInt KDefaultVolumeLevel = 3; +const TInt KMinVolume = 0; +const TInt KMaxVolume = 10; +#endif // RD_SVGT_AUDIO_SUPPORT +//TOUCH +#ifdef _DEBUG +// Backlight Strings +_LIT( KSccBacklightOnStr, "Backlight On" ); +_LIT( KSccBacklightOffStr, "Backlight Off" ); +#endif + +//Loading thread name +_LIT(KSvgThread,"SvgThread"); + +_LIT(KJpg, ".jpg" ); +_LIT(KJpeg, ".jpeg" ); +_LIT(KPng, ".png" ); +_LIT(KBmp, ".bmp" ); +_LIT(KSvg, ".svg" ); +_LIT(KSvgz, ".svgz" ); + +_LIT( KWww, "www" ); +_LIT( KHttp, "http://"); +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::CSVGTCustControl +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CSVGTCustControl::CSVGTCustControl( + RFile& aFileHandle, // File Handle of SVGT content + TBool aProgressiveRendering, + TInt aFlag ) : + // Animation State + iTotalNumerOfAnimation( KSccConstMinusOne ), + iAnimationStatus( ESvgNoAnimationsPresent ), + iAnimState( ESvgAnimStoppedState ), + iContentFileHandle( aFileHandle ), + // SVG Engine + iIsLoadingDone( EFalse ), + iFetchImageError( 0 ), + // Control State Variables + iZoomLevel( 0 ), + iIsLoopOn( EFalse ), + iIsFullScreenOn( EFalse ), + // Pointer Variables + iPointerDx( 0 ), + iPointerDy( 0 ), + iPointerX( 0 ), + iPointerY( 0 ), + // Current Match is invalid + iIsSearchStrValid( EFalse ), + iCurSearchMatchId( 0 ), + iNumAnimInProgress( 0 ), + iIsPointerDisplayed( ETrue ), + iFindTextHiColor( KRgbBlack ), + iIgnorePointerKeyEvent( EFalse ), + iPointerType( ESvgPointerDefault ), + iEnableTextOps( ETrue ), + iIsTextEditOn( EFalse ), + iIsTextSelectOn(EFalse), + iProgressiveRendering(aProgressiveRendering), + iDisplayFlags( aFlag ), + iEventHandlerAO(NULL), + iThreadController(NULL), + iIsWaitNoteDisplayed(EFalse), +#ifdef RD_SVGT_AUDIO_SUPPORT + iVolumeLevel(KDefaultVolumeLevel), + iPrevVolume(KDefaultVolumeLevel), +#endif //RD_SVGT_AUDIO_SUPPORT + iIsTextChanged( EFalse ), + iViewerCommand(EFalse), + iPlayMSKLabel(EFalse), + iContextMenuActivated(EFalse), + iAElement(EFalse), + iScrollKey(EFalse), + iPointerDownAnimation(EFalse), + iInteractiveElementEnteredCnt(0), + iDownKeyOccurred(EFalse), + iIsVolumeMuted(EFalse), + iIsForeground(ETrue) + { + } + + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ConstructL +// Symbian 2nd phase constructor. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::ConstructL( + MSvgtAppObserver* aAppObs, // User Implementation of Mixin + MSVGTProgressBarDrawImpl* aPBDrawImpl , // Implementation for rendering + // progress indicator + MSVGTMSKImpl* aMSKImpl, //Interface for MSK labelling + MSvgtApplicationExitObserver* aExitObserver, + const CCoeControl* aParent ) + { + iEngineInitialized = EFalse; + // Save the user parameters for later access. + iAppObserver = aAppObs; + iProgressBarDrawImpl = aPBDrawImpl; + iMSKImpl=aMSKImpl; + iExitObserver = aExitObserver; + + TRect lRect; + GetNormalScreenLayoutRect( lRect ); + // Frame buffers creation + CreateBitmapsL( lRect.Size() ); + + // Icons(Pointer, Pan Ind) creation + CreateIconsL(); + +#ifdef RD_SVGT_AUDIO_SUPPORT + iVolumePopup = CAknVolumePopup::NewL(NULL, ETrue); + iVolumePopup->SetObserver(this); + _LIT( KVolumePopupTitle, "Presentation volume"); + iVolumePopup->SetTitleTextL(KVolumePopupTitle); + iVolumePopup->SetRange( KMinVolume, KMaxVolume); + iVolumePopup->SetValue( KDefaultVolumeLevel ); + + + // Open a connection to receive Volume Key events. + iSelector = CRemConInterfaceSelector::NewL(); + iInterfaceSelector = CRemConCoreApiTarget::NewL(*iSelector,*this); + TRAPD(err, iSelector->OpenTargetL()); + if(err != KErrNone) + { + #ifdef _DEBUG + RDebug::Printf("Leave occured in OpenTargetL. Error code returned %d",err); + #endif + } + +#endif //RD_SVGT_AUDIO_SUPPORT + + // DrmHelper to display save related query + iSvgDrmHelper = CSVGTDrmHelper::NewL(); + + // Check if it is a preview file + iPreviewMode = iSvgDrmHelper->IsPreviewL( iContentFileHandle ); + + // Initialise the SVG engine. + InitializeEngineL(); + + +//############################################################ + // Create the timer for Pointer Inactivity + if ( iDisplayFlags & ESvgDrawPointer ) + { + iInactivityTimer = CSVGTPointerHideTimer::NewL( this ); + iInactivityTimer->After( KSccPointerHideTimerStartAfter ); + } + + // Create the timer for blinking Pause + if ( iDisplayFlags & ESvgDrawPauseIndicator ) + { + + iBlinker = CPeriodic::NewL( CTimer::EPriorityStandard ); + } + + // Create the timer for removal of info note + if ( iDisplayFlags & ESvgDisplayErrorNotes) + { + // Create the timer for removal of info note + iNoteRemoverTimer = CPeriodic::NewL( CTimer::EPriorityHigh ); + } + + if ( iDisplayFlags & ESvgDisplayErrorNotes ) + { + // Create instance of DRM Helper for checking rights for content + iSvgDrmHelper->CheckRightsAmountL( iContentFileHandle ); + } + + //Initialize the backlight time to current time + iPreviousBackLightTimeStamp.HomeTime(); + if(iProgressiveRendering) + { + iEventHandlerAO = CSvgtEventHandlerAO::NewL( aAppObs, this, +RThread().Id()); + + iThreadController = CSvgtThreadController::NewL(this); + //Separate thread is created to load the content + // set up parameters to thread generate thread, leave if fails + TInt result = iMainThread.Create( KSvgThread, + ( TThreadFunction )LoadSvgContent, + KDefaultStackSize, + NULL, this, EOwnerProcess ); + User::LeaveIfError( result ); + // log on to thread & requests notification of thread completion + iThreadController->IssueThreadMonitorRequest( iMainThread ); + + // give thread low priority + iMainThread.SetPriority( EPriorityMuchLess ); + // resume thread (wake it up sometime after this function returns) + iMainThread.Resume(); + } + else + { + // Start displaying wait note + LaunchWaitNoteL( R_QTN_SVGT_WAITING_OPENING ); + + // Load the SVGT content + LoadContentL( iContentFileHandle ); + + // Dismiss the wait note + DismissWaitNote(); + + TInt lLoadErr = DoHandleLoadingThreadError(); + if ( lLoadErr != KErrNone ) + { + if ( lLoadErr != KErrNoMemory ) + { + // All errors other than memory failure related are + // ignored. + lLoadErr = KErrNone; + } + User::Leave( lLoadErr ); + } + + // Do the post load functionality + DoPostLoadFuncL(); + } + if ( aParent && (iDisplayFlags & ESvgWindowOwning )) + { + CreateWindowL( aParent ); + } +//############################################################ + // Set the windows size + SetRect( lRect ); + + // Activate the window, which makes it ready to be drawn + ActivateL(); + } + + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::NewL +// Factory function for creating CSVGTCustControl objects. +// Returns: CSVGTCustControl* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSVGTCustControl* CSVGTCustControl::NewL( + RFile& aFileHandle, // File Handle for the content + MSvgtAppObserver* aAppObs, // User Implementation of Mixin + MSVGTProgressBarDrawImpl* aPBDrawImpl , // Implementation for rendering + // progress indicator + MSVGTMSKImpl* aMSKImpl, //Interface for MSK labelling + MSvgtApplicationExitObserver* aExitObserver, + TBool aProgressiveRendering, + const CCoeControl* aParent, + TInt aDisplayFlag ) + { + CSVGTCustControl* self = CSVGTCustControl::NewLC( aFileHandle, + aAppObs, + aPBDrawImpl, + aMSKImpl, + aExitObserver, + aProgressiveRendering, + aParent, + aDisplayFlag ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::NewLC +// Factory function for creating CSVGTCustControl objects. +// Returns: CSVGTCustControl* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSVGTCustControl* CSVGTCustControl::NewLC( + RFile& aFileHandle, // File handle for the content + MSvgtAppObserver* aAppObs , // User Implementation of Mixin + MSVGTProgressBarDrawImpl* aPBDrawImpl , // Implementation for rendering + // progress indicator + MSVGTMSKImpl* aMSKImpl, //Interface for MSK labelling + MSvgtApplicationExitObserver* aExitObserver, + TBool aProgressiveRendering, + const CCoeControl* aParent, + TInt aDisplayFlag ) + { + CSVGTCustControl* self = new ( ELeave ) CSVGTCustControl( aFileHandle, + +aProgressiveRendering, + aDisplayFlag ); + CleanupStack::PushL( self ); + self->ConstructL( aAppObs, aPBDrawImpl ,aMSKImpl, aExitObserver, aParent ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::~CSVGTCustControl +// Destructor +// ----------------------------------------------------------------------------- +// +CSVGTCustControl::~CSVGTCustControl() + { + +#ifdef RD_SVGT_AUDIO_SUPPORT + // if non volume key is pressed
+ if(iVolumePopup) + { + iVolumePopup->CloseVolumePopup(); + delete iVolumePopup; + iVolumePopup=NULL; + } + if(iSelector) + { + delete iSelector; + iInterfaceSelector=NULL; + iSelector=NULL; //iSelector has been deleted by "delete iInterfaceSelector" + } + +#endif //RD_SVGT_AUDIO_SUPPORT + + if(iProgressiveRendering) + { + TInt count = 0; + if(iSvgModule) + { + if ( iSvgModule->IsLoading() ) + { + iSvgModule->CancelLoad(); + do + { + User::After( 10 * 1000 ); // milliseconds + }while ( iSvgModule->IsLoading() && count++ < 100 ); + } + } + + if(iThreadController) + { + iThreadController->StopThreadExecution(iMainThread); + } + + iMainThread.Kill(KErrNone); + iMainThread.Close(); + + delete iEventHandlerAO; + + delete iThreadController; + } + + // Hyperlink Handler + if ( iSvgModule ) + { + iSvgModule->RemoveHyperlinkListener( + static_cast< MSvgHyperlinkListener*> ( this ) ); + iSvgModule->RemoveListener( static_cast(this), + ESvgLoadingListener); + iSvgModule->RemoveListener( static_cast(this), + ESvgHyperlinkListener); + iSvgModule->RemoveListener( static_cast(this), ESvgInteractiveElementListener); + } + + // SVG Engine + delete iSvgModule; + + // Free the icons + FreeIcons(); + + // Screen Bitmaps + Masks + delete iSVGTBitMap; + delete iSVGTBitMapMask; + + // delete SVG drmHelper + delete iSvgDrmHelper; + + + // Delete the arrays + iBoundBoxArray.Close(); + iFoundTextArray.Close(); + iTextElemIdArray.Close(); + + // Reset App Observer + iAppObserver = NULL; + + // Reset Progress Bar Draw Implementation Callback + iProgressBarDrawImpl = NULL; + // Current Match is invalid + iIsSearchStrValid = EFalse; + iCurSearchMatchId = KSccConstZero; + + // Backlight Timer + + // Progress Indicator Timer + delete iProgressBarTimer; + + // Pointer Inactivity Hide Timer + delete iInactivityTimer; + + // Pause Blink Timer + delete iBlinker; + + // Framebuffer Bitmap + delete iSVGTFrameBufBitMap; + + // Framebuffer Bitmap Context + delete iSVGTFrameBufContext; + + // Framebuffer Bitmap Device + delete iSVGTFrameBufDevice; + + // Delete the wait dialog + delete iWaitDialog; + + // Delete the info note + delete iInfoNote; + + // Delete the info note remover timer + delete iNoteRemoverTimer; + + // Close the System RProperty + iSystemState.Close(); + + // Reset the loading thread error + iLoadingThreadError = NULL; + + // Reset the exit observer + iExitObserver = NULL; + + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ProcessViewerCommandL +// Process commands for handling SVGT content +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::ProcessViewerCommandL( TInt aCommandId ) // Command ID + // be processed + { + //Set the flag to indicate that the selection key is for options selection + iViewerCommand=ETrue; + switch( aCommandId ) + { + case ESvgtDlgSaveCommand: + break; + case ESvgtDlgZoomInCommand: + // Perform Zoom operation + iSvgModule->Zoom( KSccZoomInFactor ); + // Do a Redraw + iSvgModule->Redraw(); + //dummy mouse move + iSvgModule->MouseMove( iPointerX, iPointerY ); + iZoomLevel++; + UpdatePointer(); + break; + case ESvgtDlgZoomOutCommand: + if ( iZoomLevel > KSccConstZero ) + { + iZoomLevel--; + // Perform Zoom operation + iSvgModule->Zoom( KSccZoomOutFactor ); + // Do a Redraw + iSvgModule->Redraw(); + //dummy mouse move + iSvgModule->MouseMove( iPointerX, iPointerY ); + UpdatePointer(); + } + break; + case ESvgtDlgZoomOptimalCommand: + if ( iZoomLevel != KSccConstZero ) + { + //This is to nullify only the zooming effect + //Other transformations(panning, rotation) won't be restored + TReal reducedFactor = 0.0; + Math::Pow(reducedFactor, KSccZoomOutFactor, iZoomLevel); + iZoomLevel = KSccConstZero; + iSvgModule->Zoom(reducedFactor); + iSvgModule->Redraw(); + } + break; + case ESvgtDlgSelectTextCommand: + { + if ( iEnableTextOps ) + { + HBufC* lStrPtr = HBufC::NewLC( KMaxEditorTextLength ); + TPtr lPtr = lStrPtr->Des(); + + if ( iCurrentTextElementId ) + { + if ( iIsCurrentTextElement ) + { + iSvgModule->GetTextForTextElement( + iCurrentTextElementId, + iIsTextEditOn, + lPtr ); + } + else + { + iSvgModule->GetTextForTextAreaElement( + iCurrentTextElementId, + iIsTextEditOn, + lPtr ); + } + + DoTextSelectionL( lPtr ); + } + CleanupStack::PopAndDestroy( lStrPtr ); + } + } + break; + case ESvgtDlgEditTextCommand: + { + if ( iEnableTextOps ) + { + if ( iCurrentTextElementId ) + { + HBufC* lStrPtr = HBufC::NewLC( KMaxEditorTextLength ); + TPtr lPtr = lStrPtr->Des(); + + if ( iIsCurrentTextElement ) + { + iSvgModule->GetTextForTextElement( + iCurrentTextElementId, + iIsTextEditOn, + lPtr ); + } + else + { + iSvgModule->GetTextForTextAreaElement( + iCurrentTextElementId, + iIsTextEditOn, + lPtr ); + } + + + DoTextEditingL( iIsCurrentTextElement, + iCurrentTextElementId, + lPtr ); + CleanupStack::PopAndDestroy( lStrPtr ); + } + } + } + break; + case ESvgtDlgPlayCommand: + ProcessPlayCmd(); + break; + case ESvgtDlgPauseCommand: + ProcessPauseCmd(); + break; + case ESvgtDlgStopCommand: + ProcessStopCmd(); + break; +//TOUCH SUPPORT START +#ifdef RD_SVGT_AUDIO_SUPPORT + case ESvgtDlgSetVolumeCommand: + { + // The volume popup will close itself after 1s + // unless another call to ShowVolumePopupL() is made + if(iIsVolumeMuted) + { + // Set the volume of pop to zero if muted. + iVolumePopup->SetValue( 0 ); + iVolumePopup->ShowVolumePopupL(); + } + else + { + // If not muted, then show the previous volume + iVolumePopup->SetValue( iPrevVolume ); + iVolumePopup->ShowVolumePopupL(); + } + break; + } +#endif //RD_SVGT_AUDIO_SUPPORT +//TOUCH SUPPORT END + case ESvgtDlgLoopOnCommand: + if ( IsContentFinite() ) + { + iIsLoopOn = ETrue; + } + break; + case ESvgtDlgLoopOffCommand: + if ( IsContentFinite() ) + { + iIsLoopOn = EFalse; + } + break; + case ESvgtDlgFindTextCommand: + ProcessFindTextCmdL(); + break; + case ESvgtDlgFullScreenCommand: // Fall Through + case ESvgtDlgNormalScreenCommand: + // No processing here. The Command is processed by the dialog. + // Dialog sets the size of the control, because of which + // SizeChanged() of control is called. This queries the + // layout rectangles and recreates the framebuffer. + break; + case ESvgtDlgViewDetailsCommand: + { + CSvgtFileViewDetailsDialog* fileDetailsDialog = + CSvgtFileViewDetailsDialog::NewL(); + fileDetailsDialog->ExecuteLD( iContentFileHandle ); + + break; + } + case ESvgtDlgAngle90: + { + DoRotation( ERotationAngle90 ); + } + break; + case ESvgtDlgAngle180: + { + DoRotation( ERotationAngle180 ); + } + break; + case ESvgtDlgAngle270: + { + DoRotation( ERotationAngle270 ); + } + break; + case ESvgtDlgHelpCommand: + break; + default: + break; + } + if(iMSKImpl && !iPreviewMode) + { + TRAP_IGNORE(SetMSKLabelL()); + } +} +// ----------------------------------------------------------------------------- +// CSVGTCustControl::GetCurrentZoomLevel +// Get function for current zoom level. Zoom level is the number of times the +// user has zoomed in. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::GetCurrentZoomLevel( + TInt& aZoomLevel ) const // Current Zoom Level + { + aZoomLevel = iZoomLevel; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::GetCurrentAnimState +// Get function for current animation state +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::GetCurrentAnimState( + TSvgtViewerAnimStatus& aAnimState ) const // Playing/Paused/Stopped + { + aAnimState = iAnimState; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::GetCurrentFullScreenStatus +// Get function for current viewing mode. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::GetCurrentFullScreenStatus( + TBool& aIsFullScreenOn ) const // Full Screen( ETrue )/Normal( EFalse ) + { + aIsFullScreenOn = iIsFullScreenOn; + } +// ----------------------------------------------------------------------------- +// CSVGTCustControl::GetCurrentLoopStatus +// Get function for current loop mode. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::GetCurrentLoopStatus( + TBool& aIsLoopOn ) const // Loop On( ETrue )/Loop Off( EFalse ) + { + aIsLoopOn = iIsLoopOn; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::GetNormalScreenLayoutRect +// Gets the normal screen layout rectangle for control from LAF. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::GetNormalScreenLayoutRect( + TRect& aRect ) const // Rectangle specifying extent of control + { + // Get parent client rect. + TRect myRect = iEikonEnv->EikAppUi()->ClientRect(); + + if ( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) + { + TAknLayoutRect lNormalLayoutRect; + lNormalLayoutRect.LayoutRect( myRect, + AknLayoutScalable_Apps::main_viewer_pane( 0 ) ); // Normal Screen + aRect = lNormalLayoutRect.Rect(); + } + else + { + aRect = myRect; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::IsLoopAllowed +// Indicates whether the Loop feature is allowed for the Control. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::IsLoopAllowed() const + { + return ( IsContentFinite() ); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::IsAnimationPresent +// Finds whether the content has any animations +// @return TBool - ETrue indicates content contains animations, +// EFalse otherwise +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::IsAnimationPresent() const + { + return ( iAnimationStatus != ESvgNoAnimationsPresent ); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::IsContentFinite +// Finds whether the content is of finite duration. +// @return TBool - ETrue indicates Finite Duration, +// EFalse otherwise +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::IsContentFinite() const + { + // Does it not have any infinite repeat count + // animations + if ( ( iDuration != 0 ) && + ( iDuration != KSccIndefiniteDur ) ) + { + return ETrue; + } + // Content contains atlease one infinite animation + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::IsProcessDone +// Returns ETrue if loading is done. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::IsProcessDone() const + { + return iIsLoadingDone; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::SetCurrentFullScreenStatus +// Set function for current viewing mode. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::SetCurrentFullScreenStatus( + TBool aIsFullScreenOn ) // Full Screen( ETrue )/Normal( EFalse ) + { + iIsFullScreenOn = aIsFullScreenOn; + } +// ----------------------------------------------------------------------------- +// CSVGTCustControl::HandleApplicationForegroundEvent +// Does the handling of foreground event occurring. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::HandleApplicationForegroundEvent( TBool aForeground ) + { + iIsForeground = aForeground; + if ( !aForeground ) + { + // Application going into background, pause presentation. + // We need to check first if there are any + // animations at all in this presentation and pause + // makes sense or not. + if ( IsAnimationPresent() && iAnimState == ESvgAnimPlayingState ) + { + TRAPD(errProcessViewerCmd, + ProcessViewerCommandL( ESvgtDlgPauseCommand )); + + if ( errProcessViewerCmd != KErrNone ) + { + // Error occurred , Stop Processing + return; + } + + if ( iBlinker->IsActive() ) + { + iBlinker->Cancel(); + iPauseIconVisible = ETrue; + } + } + } + else + { + // Application coming into foreground. + // May need to start a flashing pause indicator so + // that user would come to know presentation is paused. + if ( IsAnimationPresent() && iAnimState == ESvgAnimPausedState ) + { + if ( iPauseIconVisible ) + { + ShowPauseIcon( ETrue ); + } + } + // Perform a redraw to avoid corrupted bitmap + iSvgModule->Redraw(); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::IsTextSelectOn +// Indicates whether the "Select Text" menu item be displayed. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::IsTextSelectOn() const + { + return ( iIsTextSelectOn ); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::IsTextEditOn +// Indicates whether the "Edit Text" menu item be displayed. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::IsTextEditOn() const + { + return ( iIsTextEditOn ); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::IsTextContentChanged +// Indicates whether the text in the content was modified. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::IsTextContentChanged() const + { + return ( iIsTextChanged ); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::SaveComplete +// Used to perform any cleanup once save is complete. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::SaveComplete( const TInt aError ) + { + if ( !aError ) + { + iIsTextChanged = EFalse; + + //Upadate the MSK label once saving is done + if(iMSKImpl && !iPreviewMode) + { + TRAP_IGNORE(SetMSKLabelL()); + } + + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::UpdateScreen +// Implements MSvgRequestObserver::UpdateScreen. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::UpdateScreen() + { + if ( IsContentFinite() ) + { + ResetBacklightTime(); + } + if ( iSVGTBitMapMask ) + { + // Generate the mask for the bitmap + iSvgModule->GenerateMask( iSVGTBitMapMask ); + } + iSvgModule->IsPanPossibleFourWay(iPanLt,iPanRt,iPanUp,iPanDn); + + // Find the new position of bounding boxes if + // Find Text was performed + if ( iIsSearchStrValid ) + { + CalcFindTextBBox(); + } + if ( iIsLoadingDone ) + { + DrawNow(); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ScriptCall +// Implements MSvgRequestObserver::ScriptCall. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::ScriptCall( const TDesC& /*aScript*/, + CSvgElementImpl* /*aCallerElement*/ ) + { + return EFalse; + } + + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::FetchImage +// Implements MSvgRequestObserver::FetchImage. It executes asynchronously. +// To fetch the image each time the KErrGeneral should be return. +// ----------------------------------------------------------------------------- +// +TInt CSVGTCustControl::FetchImage( const TDesC& aUri, + RFs& aSession, RFile& aFileHandle ) + { + + TInt ret = 0; + + iImageFileType = ImageFileType(aUri); + if ( iAppObserver ) + { + ret = iAppObserver->FetchImage( aUri, aSession, aFileHandle ) ; + } + else + { + return KErrNotFound; + } + + if ( !iFetchImageError ) + { + iFetchImageError = ret; + } + + if(iImageFileType == ELocalImageFile) + { + return ret; + } + else + { + return KErrGeneral; + } + } + +TInt CSVGTCustControl::FetchFont( const TDesC& aUri , + RFs& aSession , RFile& aFileHandle ) + { + _LIT(KPath, "C:\\data\\images\\"); + TBuf fileName; + fileName.Copy(KPath); + fileName.Append(aUri); + return aFileHandle.Open( aSession, fileName, EFileShareReadersOnly); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl:: GetSmilFitValue +// Implements the MSvgRequestObserver::GetSmilFitValue. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::GetSmilFitValue( TDes& aSmilValue ) + { + aSmilValue.Copy( KSccSmilFitValue ); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::UpdatePresentation +// Implements MSvgRequestObserver::UpdatePresentation. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::UpdatePresentation( const TInt32& aNoOfAnimation ) + { + if ( iTotalNumerOfAnimation == KSccConstMinusOne ) + { + if ( aNoOfAnimation == KSccConstZero ) + { + iAnimationStatus = ESvgNoAnimationsPresent; + return; + } + else + { + // First time Update Presentation is called + // and animations are present. + iTotalNumerOfAnimation = aNoOfAnimation; + } + } + else + { + iTotalNumerOfAnimation -= aNoOfAnimation; + } + + if ( iTotalNumerOfAnimation == KSccConstZero ) + { + iAnimationStatus = ESvgAllAnimationsComplete; + return; + } + + iAnimationStatus = ESvgAnimationsNotComplete; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::OfferKeyEventL +// Handles Key events by reimplementing CCoeControl::OfferKeyEventL. +// Returns: +// EKeyWasConsumed: If this control uses this key. +// EKeyWasNotConsumed: Otherwise. +// ----------------------------------------------------------------------------- +// +TKeyResponse CSVGTCustControl::OfferKeyEventL( + const TKeyEvent& aKeyEvent, // Key Event + TEventCode aType ) // Event Code + { + + TKeyResponse retVal = EKeyWasNotConsumed; + TInt keyScanCode = aKeyEvent.iScanCode; + TInt keyCode = aKeyEvent.iCode; + switch ( aType ) + { + case EEventKeyDown: + { + // reset the repeat count + iKeyRepeatCount = 0; + // Reset the select cause + iSelectCause = ESvgInvalidSelectCause; + // UI Spec: Pointer should be displayed when + // Select Key or Pointer is moved + if ( keyScanCode == EStdKeyEnter || + keyScanCode == EStdKeyDevice3 || + keyScanCode == EStdKeyUpArrow || + keyScanCode == EStdKeyDownArrow || + keyScanCode == EStdKeyLeftArrow || + keyScanCode == EStdKeyRightArrow ) + { + if ( !iInactivityTimer ) + { + // Ignore subsequent key events as the pointer should be + // displayed and no event is to be processed until key + // up event is received. + iIgnorePointerKeyEvent = ETrue; + } + if( keyScanCode != EStdKeyDevice3 && keyScanCode != EStdKeyEnter && !iIsPointerDisplayed ) + { + iScrollKey=ETrue; //needed to check when the pointer hidden + // and scroll key is pressed. + } + + + if( ( keyScanCode == EStdKeyDevice3 || keyScanCode == EStdKeyEnter )&&!iIsPointerDisplayed ) + { + // Key has been lifted, + // Reset the Pointer Delta Values + iPointerDx = KSccConstZero; + iPointerDy = KSccConstZero; + + // UI Spec: Pointer should be hidden after 15 sec of + // user inactivity + if ( iInactivityTimer ) + { + // Should not be the case! + delete iInactivityTimer; + iInactivityTimer = NULL; + } + iInactivityTimer = CSVGTPointerHideTimer::NewL( this ); + iInactivityTimer->After( KSccPointerHideTimerStartAfter ); + } + if(keyScanCode == EStdKeyDevice3 || keyScanCode == EStdKeyEnter ) + { + iDownKeyOccurred = ETrue; + iSvgModule->MouseDown( iPointerX, iPointerY ); + } + SetPointerDisplayStatusAndRedraw( ETrue ); + + retVal = EKeyWasConsumed; + } + } + break; + case EEventKeyUp: + { + if ( keyScanCode == EStdKeyEnter || + keyScanCode == EStdKeyDevice3 || + keyScanCode == EStdKeyUpArrow || + keyScanCode == EStdKeyDownArrow || + keyScanCode == EStdKeyLeftArrow || + keyScanCode == EStdKeyRightArrow ) + { + // Key has been lifted, + // Reset the Pointer Delta Values + iPointerDx = KSccConstZero; + iPointerDy = KSccConstZero; + + // UI Spec: Pointer should be hidden after 15 sec of + // user inactivity + if ( iInactivityTimer ) + { + // Should not be the case! + delete iInactivityTimer; + iInactivityTimer = NULL; + } + iInactivityTimer = CSVGTPointerHideTimer::NewL( this ); + iInactivityTimer->After( KSccPointerHideTimerStartAfter ); + + // Once the pointer is un-hidden, Ignore subsequent key events + // and no event is to be processed until key up event is received. + if ( iIgnorePointerKeyEvent ) + { + iIgnorePointerKeyEvent = EFalse; + retVal = EKeyWasConsumed; + TRAP_IGNORE(SetMSKLabelL()); + } + else + { + // Assume key will be consumed + retVal = EKeyWasConsumed; + + if( ( keyScanCode == EStdKeyDevice3 || keyScanCode == EStdKeyEnter )&& iDownKeyOccurred) + { + iSvgModule->MouseUp(iPointerX,iPointerY); + iDownKeyOccurred= EFalse; + } + } + + } + } + break; + case EEventKey: + { + retVal = EKeyWasConsumed; + iKeyRepeatCount++; + + // Once the pointer is un-hidden, Ignore subsequent joystick + // key events and no joystick event is to be processed until + // key up event is received. + switch ( keyCode /*keyScanCode*/ ) + { + case KSccZoomInKey: // Zoom In Key + { + if ( iKeyRepeatCount == 1 ) + { + ProcessViewerCommandL( ESvgtDlgZoomInCommand ); + } + + break; + } + case EKeyUpArrow: // Pointer Up + { + if ( iIgnorePointerKeyEvent == EFalse) + { + iPointerDx = KSccConstZero; + iPointerDy -= KSccCursorMinDeltaY; + } + break; + } + case EKeyDownArrow: // Pointer Down + if ( iIgnorePointerKeyEvent == EFalse) + { + iPointerDx = KSccConstZero; + iPointerDy += KSccCursorMinDeltaY; + } + break; + case EKeyLeftArrow: // Pointer Left + if ( iIgnorePointerKeyEvent == EFalse) + { + iPointerDx -= KSccCursorMinDeltaX; + iPointerDy = KSccConstZero; + } + break; + case EKeyRightArrow: // Pointer Right + if ( iIgnorePointerKeyEvent == EFalse) + { + iPointerDx += KSccCursorMinDeltaX; + iPointerDy = KSccConstZero; + } + break; + case ENumberKey1: //key 1 + DoRotation(ERotationAngle90); + break; + case ENumberKey3: //key 3 + DoRotation(-ERotationAngle90); + break; + case ENumberKey7: //key 7 + DoRotation(ERotationAngle45); + break; + case ENumberKey9: //key 9 + DoRotation(-ERotationAngle45); + break; + case KSccZoomOutKey: // Zoom out key + // Zoom out if "zoom-out" key was pressed once + { + if ( iKeyRepeatCount == 1 ) + { + ProcessViewerCommandL( ESvgtDlgZoomOutCommand ); + } + else if ( ( iZoomLevel > 0 ) && ( iKeyRepeatCount == 2 ) ) + { + ProcessViewerCommandL(ESvgtDlgZoomOptimalCommand ); + } + break; + } + default: + { + // Unknown Key + retVal = EKeyWasNotConsumed; + } + } + } + break; + default: + { + // Unknown Key + retVal = EKeyWasNotConsumed; + } + break; + } + if ( ( iPointerDx != KSccConstZero ) || + ( iPointerDy != KSccConstZero ) ) + { + UpdatePointer(); + } + return retVal; + } + + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::HandleResourceChange +// This function is called by the framework when there is a layout switch/skin +// change +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::HandleResourceChange( TInt aType ) + { + if ( aType == KAknsMessageSkinChange ) + { + // Recreate the icons + TRAPD( err, CreateIconsL() ); + if ( err != KErrNone ) + { + // No Error Handling done here. + } + // Find Text Highlight Colour + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + + // Color is not updated if it not found from the skin + AknsUtils::GetCachedColor(skin, iFindTextHiColor, + KAknsIIDQsnHighlightColors, + EAknsCIQsnHighlightColorsCG2); + SetSize(Rect().Size()); + } + + CCoeControl::HandleResourceChange( aType ); + } + + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::LinkEntered +// Callback Function called by the engine when the pointer enters a hyperlink +// ----------------------------------------------------------------------------- +// + +TBool CSVGTCustControl::LinkEntered( const TDesC& aUri) + { + + CXmlElementImpl* ptr=NULL; + + // Get the elementID + ptr=iSvgModule->GetElementById(iSvgModule->SvgDocument(),aUri); + + // Check for "a" element or an element which has animation on + // mousedown/mouseup + if(!ptr) + { + iAElement=ETrue; + iPointerType = ESvgPointerHand; + // Sets the MSK label + if(iMSKImpl && !iPreviewMode ) + { + TRAP_IGNORE(SetMSKLabelL()); + } + } + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::LinkExited +// Callback Function called by the engine when the pointer exits a hyperlink +// ----------------------------------------------------------------------------- +// + +TBool CSVGTCustControl::LinkExited( const TDesC& /*aUri*/ ) + { + + iPointerType = ESvgPointerDefault; + + // Reset the flag for a element + iAElement=EFalse; + + //Set the MSK label + if(iMSKImpl && !iPreviewMode) + { + TRAP_IGNORE(SetMSKLabelL()); + } + + return ETrue; + } +// --------------------------------------------------------------------------- +// CSVGTCustControl::LinkActivated +// Callback Function called by the engine when a hyperlink is activated +// --------------------------------------------------------------------------- +// + +TBool CSVGTCustControl::LinkActivated( + const TDesC& aUri ) + { + if (iSelectCause != ESvgInvalidSelectCause ) + { + // Ignore this callback as it was already processed. + return ETrue; + } + // Set the cause for select operation as Hyperlink so that + // subsequent events trigerred are ignored. + iSelectCause = ESvgHyperLinkSelectCause; + + if( iAppObserver ) + { + if( IsThreadRunning() ) + { + CSvgtEventLinkActivated* event = new + CSvgtEventLinkActivated( aUri ); + iEventHandlerAO->AddEventToList( event ); + iEventHandlerAO->MakeRequestComplete( KErrNone ); + return ETrue; + } + else + { + return iAppObserver->LinkActivated( aUri ); + } + } + else + { + return EFalse; + } + } + +// -------------------------------------------------------------------- +// CSVGTCustControl::LinkActivatedWithShow +// Callback Function called by the engine when a hyperlink with show +// attribute is activated +// -------------------------------------------------------------------- +// +TBool CSVGTCustControl::LinkActivatedWithShow( + const TDesC& aUri , + const TDesC& aShow ) + { + if (iSelectCause != ESvgInvalidSelectCause ) + { + // Ignore this callback as it was already processed. + return ETrue; + } + // Set the cause for select operation as Hyperlink so that + // subsequent events trigerred are ignored. + iSelectCause = ESvgHyperLinkSelectCause; + if( iAppObserver ) + { + if( IsThreadRunning() ) + { + CSvgtEventLinkActivatedWithShow* event = + new CSvgtEventLinkActivatedWithShow( aUri, aShow ); + iEventHandlerAO->AddEventToList( event ); + iEventHandlerAO->MakeRequestComplete( KErrNone ); + + return ETrue; + } + else + { + return iAppObserver->LinkActivatedWithShow( aUri, aShow ); + } + } + else + { + return EFalse; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::CreateBitmapsL +// This function is called to create the bitmaps used by the SVG engine +// for rendering. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::CreateBitmapsL( + const TSize& aBitmapSize ) // Bitmap Size used to render content + { + + if( iSVGTBitMap && (iSVGTBitMap->SizeInPixels() == aBitmapSize)) + { + return ; + } + + TDisplayMode dispMode = iEikonEnv->ScreenDevice()->DisplayMode(); + TInt errCode = KErrNone; + // Modes currently supported by SVG engine are: + // EGray2, EColor4K, EColor64K, EColor16M, EColor16MU. + switch ( dispMode ) + { + case EGray2: + case EColor16M: + { + break; + } + case EColor16MU: + { + break; + } + default: + { + dispMode = EColor64K; + break; + } + } + // Create the bitmaps using local variables and assign + // to member variable if successful + CFbsBitmap* lTempBitmap = new ( ELeave ) CFbsBitmap(); + + // Create the bitmap with size and display mode + errCode = lTempBitmap->Create( aBitmapSize, dispMode ); + if ( errCode != KErrNone ) + { + delete lTempBitmap; + User::Leave( errCode ); + } + + // Check and destroy existing bitmap + if ( iSVGTBitMap ) + { + delete iSVGTBitMap; + } + + // Assign newly created bitmap + iSVGTBitMap = lTempBitmap; + + // Create the bitmap mask + lTempBitmap = new ( ELeave ) CFbsBitmap(); + + // Create the bitmap with size and display mode + errCode = lTempBitmap->Create( aBitmapSize, EGray256 ); + if ( errCode != KErrNone ) + { + delete lTempBitmap; + User::Leave( errCode ); + } + + // Check and destroy existing bitmap + if ( iSVGTBitMapMask ) + { + delete iSVGTBitMapMask; + } + + // Assign newly created bitmap + iSVGTBitMapMask = lTempBitmap; + + // Create the Framebuffer Bitmap + lTempBitmap = new ( ELeave ) CFbsBitmap(); + + // Create the bitmap with size and display mode + errCode = lTempBitmap->Create( aBitmapSize, dispMode ); + if ( errCode != KErrNone ) + { + delete lTempBitmap; + User::Leave( errCode ); + } + + // Check and destroy existing bitmap + if ( iSVGTFrameBufBitMap ) + { + delete iSVGTFrameBufBitMap; + } + + // Assign newly created bitmap + iSVGTFrameBufBitMap = lTempBitmap; + + // Create the Bitmap Device and Contexts, used to reduce the number + // of interactions with the windows server + CFbsBitmapDevice* lTempBitmapDev = CFbsBitmapDevice::NewL( + iSVGTFrameBufBitMap ); + + CFbsBitGc* lTempBitmapCtx = NULL; + // Create framebuffer context + errCode = lTempBitmapDev->CreateContext( lTempBitmapCtx ); + if ( errCode != KErrNone ) + { + delete lTempBitmapDev; + User::Leave( errCode ); + } + + // Check and destroy existing bitmap device + if ( iSVGTFrameBufDevice ) + { + delete iSVGTFrameBufDevice; + } + + // Check and destroy existing bitmap context + if ( iSVGTFrameBufContext ) + { + delete iSVGTFrameBufContext; + } + + // Assign newly created bitmap device + iSVGTFrameBufDevice = lTempBitmapDev; + iSVGTFrameBufContext = lTempBitmapCtx; + } +// ----------------------------------------------------------------------------- +// CSVGTCustControl::CreateIconsL +// This function is called to create the icons used by the control. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::CreateIconsL() + { + // Skin instance + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + + // Cleanup the old icons. + FreeIcons(); + + // Construct the MBM file name + TParse parse; + parse.Set( KSccIconFile, &KDC_APP_BITMAP_DIR, NULL); + TPtrC iconFile = parse.FullName(); + + //Create icon for drawing the pointer + iPointerIcon = AknsUtils::CreateGulIconL( + skin, + KAknsIIDQgnIndiViewerPointer, + iconFile, + EMbmSvgtuicontrolQgn_indi_viewer_pointer, + EMbmSvgtuicontrolQgn_indi_viewer_pointer_mask ); + + //Create icon for drawing the hyperlink pointer + iHandIcon = AknsUtils::CreateGulIconL( + skin, + KAknsIIDQgnIndiViewerPointerHand, + iconFile, + EMbmSvgtuicontrolQgn_indi_viewer_pointer_hand, + EMbmSvgtuicontrolQgn_indi_viewer_pointer_hand_mask ); + + //Create icon for drawing the hyperlink pointer + iTextIcon = AknsUtils::CreateGulIconL( + skin, + KAknsIIDQgnIndiViewerPointerText, + iconFile, + EMbmSvgtuicontrolQgn_indi_viewer_pointer_text, + EMbmSvgtuicontrolQgn_indi_viewer_pointer_text_mask ); + + // Panning Indicators + // Create icon for drawing the Pan Left + iPanIndLeftIcon = AknsUtils::CreateGulIconL( + skin, + KAknsIIDQgnIndiViewerPanningLeft, + iconFile, + EMbmSvgtuicontrolQgn_indi_viewer_panning_left, + EMbmSvgtuicontrolQgn_indi_viewer_panning_left_mask ); + + // Create icon for drawing the Pan Right + iPanIndRightIcon = AknsUtils::CreateGulIconL( + skin, + KAknsIIDQgnIndiViewerPanningRight, + iconFile, + EMbmSvgtuicontrolQgn_indi_viewer_panning_right, + EMbmSvgtuicontrolQgn_indi_viewer_panning_right_mask ); + + // Create icon for drawing the Pan Up + iPanIndUpIcon = AknsUtils::CreateGulIconL( + skin, + KAknsIIDQgnIndiViewerPanningUp, + iconFile, + EMbmSvgtuicontrolQgn_indi_viewer_panning_up, + EMbmSvgtuicontrolQgn_indi_viewer_panning_up_mask ); + + // Create icon for drawing the Pan Down + iPanIndDownIcon = AknsUtils::CreateGulIconL( + skin, + KAknsIIDQgnIndiViewerPanningDown, + iconFile, + EMbmSvgtuicontrolQgn_indi_viewer_panning_down, + EMbmSvgtuicontrolQgn_indi_viewer_panning_down_mask ); + + // Create icon for drawing the Pause + iPauseIcon = AknsUtils::CreateGulIconL( + skin, + KAknsIIDQgnIndiCamsPaused, + iconFile, + EMbmSvgtuicontrolQgn_indi_cams_paused, + EMbmSvgtuicontrolQgn_indi_cams_paused_mask ); + } +// ----------------------------------------------------------------------------- +// CSVGTCustControl::InitializeEngineL +// Initiliazes the interface with the SVG engine. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::InitializeEngineL() + { + if ( !iSvgModule ) + { + TInt fontId = KLatintFontId; + + switch ( AknLayoutUtils::Variant() ) + { + case EApacVariant: + { + fontId = KApacFontId; + } + break; + case EEuropeanVariant: + default: + break; + } + + const CFont* font = AknLayoutUtils::FontFromId( fontId ); + TFontSpec spec = font->FontSpecInTwips(); + + iSvgModule = CSvgEngineInterfaceImpl::NewL( iSVGTBitMap, + this, spec ); + iSvgModule->SetBackgroundColor( KSccArgbWhite ); + iSvgModule->AddHyperlinkListener( static_cast < MSvgHyperlinkListener* > + (this) ); + // Register for notification of Animation Start/Stop. + iSvgModule->AddAnimationListener( static_cast < MSvgAnimationListener* > + ( this ) ); + iSvgModule->AddListener(static_cast(this), + ESvgLoadingListener); + iSvgModule->AddListener(static_cast(this), + ESvgHyperlinkListener); + iSvgModule->AddListener( static_cast < MSvgInteractiveElementListener* > + (this), ESvgInteractiveElementListener); + +#ifdef SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE + // In DRM protected contents, disable the text operations: + iEnableTextOps = !( iSvgDrmHelper->IsProtected()||iPreviewMode ); + + if ( iEnableTextOps ) + { + // Add textArea element listener + iSvgModule->AddListener( static_cast(this), + ESvgTextAreaListener ); + + // Add text element listener + iSvgModule->AddListener( static_cast(this), + ESvgTextListener ); + } +#endif // SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE + } + + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::LoadContentL +// This function uses the SVG Engine to load the SVGT content. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::LoadContentL( + RFile& aFileHandle ) // Filename of SVGT content + { + // Enable DRM mode of engine + iSvgModule->SetDRMMode( ETrue ); + + // Rewind the file + TInt pos = 0; + aFileHandle.Seek( ESeekStart, pos ); + + iLoadingThreadError = iSvgModule->Load( aFileHandle ); + +#ifdef SVGTUICONTROL_DBG_OPENVG_TESTING_ENABLE + iSvgModule->CustomOption( ETrue ); +#endif // SVGTUICONTROL_DBG_OPENVG_TESTING_ENABLE + } + +TInt CSVGTCustControl::LoadSvgContent(TAny* aAny) + { + CSVGTCustControl& loader = *( CSVGTCustControl* )aAny; + CTrapCleanup* theTrapCleanup = CTrapCleanup::New(); + loader.SetThreadRunning(ETrue); + TRAP_IGNORE( loader.InitSvgContentL() ); + delete theTrapCleanup; + return 0; + } + +void CSVGTCustControl::InitSvgContentL() + { + CActiveScheduler* threadScheduler = new (ELeave) CActiveScheduler; + CleanupStack::PushL( threadScheduler ); + CActiveScheduler::Install(threadScheduler); + + // Load the SVGT content + LoadContentL( iContentFileHandle ); + CleanupStack::PopAndDestroy( threadScheduler ); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::DisplayInfoNoteL +// This is a utility function for displaying the info notes +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::DisplayInfoNoteL( TInt aResourceId, // Resource Id of + // string + TBool aIsWaitingDialog ) // Indicate whether \ + // dialog should wait + { + if(iDisplayFlags & ESvgDisplayErrorNotes ) + { + // Show information note + HBufC* prompt = iCoeEnv->AllocReadResourceLC( aResourceId ); + CAknInformationNote* note = new ( ELeave ) CAknInformationNote( + aIsWaitingDialog ); + note->ExecuteLD( *prompt ); + CleanupStack::PopAndDestroy( prompt ); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::DoPostLoadFuncL +// This is a utility function for performing post-load functionality +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::DoPostLoadFuncL() + { + if ( iSvgModule ) + { +#ifdef RD_SVGT_AUDIO_SUPPORT + SetPresentationVolume( iVolumeLevel ); +#endif //RD_SVGT_AUDIO_SUPPORT + + // give thread normal priority + iMainThread.SetPriority( EPriorityNormal ); + // Attach to property for call state property + User::LeaveIfError( iSystemState.Attach( KPSUidCtsyCallInformation, + KCTsyCallState ) ); + // Attach to property for call type property + User::LeaveIfError( iSystemState.Attach( KPSUidCtsyCallInformation, + KCTsyCallType ) ); + // Indicate that the content loading is complete + iIsLoadingDone = ETrue; + + // Store SVG duration + iDuration = iSvgModule->Duration(); + + // Start the rendering process + iAnimState = ESvgAnimPlayingState; + iSvgModule->Start(); + + //Drawing the MSK label for the first time + if(iMSKImpl && !iPreviewMode) + { + TRAP_IGNORE(SetMSKLabelL()); + } + + // Check whether the content is finite, inorder to display the + // progress timer + if ( IsContentFinite() ) + { + // Start immediately so that the first count is displayed + StartProgIndTimer( 0 ); + } + + if ( IsVoiceCallActive() ) + { + ProcessPauseCmd(); + } + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::SaveSvgDom +// This function is a helper function to save the modified svg content +// given the file name. +// ----------------------------------------------------------------------------- +TInt CSVGTCustControl::SaveSvgDom( const TDesC& aFileName ) + { + TInt retVal = KErrNone; + MSvgError* lSvgErr = iSvgModule->SaveSvgDom( + (TInt)iSvgModule->SvgDocument(), aFileName ); + if ( ( !lSvgErr ) || ( lSvgErr->HasError() ) ) + { + if ( lSvgErr ) + { + // Attempt to find the system error code + retVal = lSvgErr->SystemErrorCode(); + } + else + { + // No free memory available + retVal = KErrNoMemory; + } + + // No error code found, indicate general error + if ( retVal == KErrNone ) + { + retVal = KErrGeneral; + } + } + return retVal; + } + // ----------------------------------------------------------------------------- + + +//----------------------------------------------------------------------------- +void CSVGTCustControl::GetViewPort( TInt getWidth , + TInt getHeight , + TBool isWidthInPercentage, + TBool isHeightInPercentage, + TInt& setWidth, TInt& setHeight ) + { + if(!iSvgModule) + { + return; + } + if(!iSVGTBitMap) + { + return; + } + TSize svgSize = iSvgModule->ContentDimensionsInPercentage(); + TInt per=100; + TSize tempSize = iSvgModule->ContentDimensions(); + TInt scrW = iSVGTBitMap->SizeInPixels().iWidth; + TInt scrH = iSVGTBitMap->SizeInPixels().iHeight; + //both not in percentage + if(!isWidthInPercentage && !isHeightInPercentage) + { + setWidth = tempSize.iWidth; + setHeight = tempSize.iHeight; + } + //if width in percentage + else if(isWidthInPercentage && !isHeightInPercentage) + { + setWidth = svgSize.iWidth * scrW / per; + //if svg had valid height take it else use default + if(tempSize.iHeight) + { + setHeight = getHeight; + } + } + //if height in percentage + else if(!isWidthInPercentage && isHeightInPercentage) + { + setHeight = svgSize.iHeight * scrH / per; + if(tempSize.iWidth) + { + setWidth = getWidth; + } + } + //if both height and width are in percentage + else + { + setHeight = svgSize.iHeight * scrH / per; + setWidth = svgSize.iWidth * scrW / per; + } + + //if height is greater than screenHeight + //or if width is greater than screenwidth + //set the width and height by preserving the aspect ratio + TReal32 sx,sy; + + if(setHeight > scrH || setWidth > scrW) + { + sx = (TReal32) (scrW) / (TReal32) (setWidth); + sy = (TReal32) (scrH) / (TReal32) (setHeight); + if ( sx > sy ) + { + sx = sy; + } + else // ( sx < sy ) + { + sy = sx; + } + setWidth = sx * setWidth; + setHeight = sy * setHeight; + } + + + } + + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::DrawPointer +// This function blits the pointer bitmap on the screen at the current mouse +// co-ordinates which are maintained as data-members of CSVGTCustControl. +// ----------------------------------------------------------------------------- +// + +void CSVGTCustControl::DrawPointer() const + { + + iSVGTFrameBufContext->SetPenStyle( CGraphicsContext::ENullPen ); + iSVGTFrameBufContext->SetBrushStyle( CGraphicsContext::ENullBrush ); + + + // Use the aid for the hotspot from the LAF. + // This value is set in the SizeChanged function. + // The hotspot information is used so that the bitmap is drawn in + // correct position with respect to the mouse position. + switch ( iPointerType ) + { + case ESvgPointerHand: + { + // Draw the hand icon at the mouse position + TPoint pointerStart( iPointerX - iHandAidRect.Rect().Width(), + iPointerY - iHandAidRect.Rect().Height() ); + iSVGTFrameBufContext->BitBltMasked( pointerStart, + iHandIcon->Bitmap(), + iHandRect.Rect(), + iHandIcon->Mask(), + EFalse ); + break; + } + case ESvgPointerText: + { + // Draw the hand icon at the mouse position + TPoint pointerStart( iPointerX - iTextAidRect.Rect().Width(), + iPointerY - iTextAidRect.Rect().Height() ); + iSVGTFrameBufContext->BitBltMasked( pointerStart, + iTextIcon->Bitmap(), + iTextRect.Rect(), + iTextIcon->Mask(), + EFalse ); + break; + } + case ESvgPointerDefault: // Fall Through + default: // Fall Through - Should never be the case + { + // Draw the pointer icon at the mouse position + TPoint pointerStart( iPointerX - iPointerAidRect.Rect().Width(), + iPointerY - iPointerAidRect.Rect().Height() ); + iSVGTFrameBufContext->BitBltMasked( pointerStart, + iPointerIcon->Bitmap(), + iPointerRect.Rect(), + iPointerIcon->Mask(), + EFalse ); + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::UpdatePointer +// Called when pointer needs to be redrawn +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::UpdatePointer() + { + // Get the size of the content + TSize svgSize = iSvgModule->Size(); + TInt rgnw = svgSize.iWidth; + TInt rgnh = svgSize.iHeight; + + // This is to store whether the framebuffer changed + TBool lFrameBufChange = EFalse; + + // iPointerDx contains the delta increment in X axis + // Add it to the pointer coordinates + iPointerX += iPointerDx; + + // If pointer coordinate becomes negative then reset it + // and perform panning. + if ( iPointerX < KSccConstZero ) + { + iPointerX = KSccConstZero; + if(iPanLt) + { + iSvgModule->Pan( KSccPanNumPixelsX, KSccConstZero ); + } + lFrameBufChange = ETrue; + } + + // If pointer coordinate becomes greater than content size + // then set it back to (content width - 1) and + // perform panning. + if ( rgnw <= iPointerX ) + { + iPointerX = rgnw - KSccConstOne; + if(iPanRt) + { + iSvgModule->Pan( -KSccPanNumPixelsX, KSccConstZero ); + } + lFrameBufChange = ETrue; + } + + // iPointerDy contains the delta increment in Y axis + // Add it to the pointer coordinates. + iPointerY += iPointerDy; + + // If pointer coordinate becomes negative then reset it + // and perform panning. + if ( iPointerY < KSccConstZero ) + { + iPointerY = KSccConstZero; + if(iPanUp) + { + iSvgModule->Pan( KSccConstZero, KSccPanNumPixelsY ); + } + lFrameBufChange = ETrue; + } + + // If pointer coordinate becomes greater than content size + // then set it back to (content height - 1) and + // perform panning. + if ( iPointerY >= rgnh ) + { + iPointerY = rgnh - KSccConstOne; + if(iPanDn) + { + iSvgModule->Pan( KSccConstZero, -KSccPanNumPixelsY ); + } + lFrameBufChange = ETrue; + } + + // If Framebuffer changed, perform an engine redraw and recalculate + // bound box coordinates + if ( lFrameBufChange ) + { + iSvgModule->Redraw(); + CalcFindTextBBox(); + } + + // Indicate new mouse position to engine + iSvgModule->MouseMove( iPointerX, iPointerY ); + + // Perform a redraw to reflect new position of pointer + DrawDeferred(); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::SetMSKLabel +// This function is called to set the MSK labels under various circumstances. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::SetMSKLabelL() +{ + TInt lResourceID=0; + TInt lCommandID=0; + if(!iIsPointerDisplayed) + { + if (IsAnimationPresent()) + { + lResourceID=R_SVGT_MSK_LABEL_CONTEXT; + lCommandID=EAknSoftkeyContextOptions; + } + else if ( !IsAnimationPresent() && + (iAppObserver->CanShowSave() || IsTextContentChanged() ) ) + { + lResourceID=R_SVGT_MSK_LABEL_SAVE; + lCommandID=EAknSoftkeySave; + } + else + { + lResourceID=R_SVGT_MSK_LABEL_CONTEXT; + lCommandID=EAknSoftkeyOptions; + } + } + else + { + switch(iPointerType) + { + case ESvgPointerHand: + { + lCommandID=EAknSoftkeySelect; + if(iAElement) + { + lResourceID=R_SVGT_MSK_LABEL_OPEN; + } + else + { + iPlayMSKLabel=ETrue; + lResourceID=R_SVGT_MSK_LABEL_PLAY; + } + } + break; + case ESvgPointerText: + { + lCommandID=EAknSoftkeySelect; + if(IsTextEditOn()) + { + lResourceID=R_SVGT_MSK_LABEL_EDIT; + } + else + { + lResourceID=R_SVGT_MSK_LABEL_SELECT; + } + } + break; + case ESvgPointerDefault: + { + if (IsAnimationPresent()) + { + lResourceID=R_SVGT_MSK_LABEL_CONTEXT; + lCommandID=EAknSoftkeyContextOptions; + } + else if( !IsAnimationPresent() && + ( iAppObserver->CanShowSave() || IsTextContentChanged() ) ) + { + lResourceID=R_SVGT_MSK_LABEL_SAVE; + lCommandID=EAknSoftkeySave; + } + else + { + lResourceID=R_SVGT_MSK_LABEL_CONTEXT; + lCommandID=EAknSoftkeyOptions; + } + } + break; + } + } + iMSKImpl->RemoveMSKLabel(); + iMSKImpl->DrawMSKLabelL(lResourceID,lCommandID); +} + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::GetMSKLabelFlag +// This function is called to get either iPlayMSKLabel or +// iContextMenuActivated flag +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::GetMSKLabelFlag(TInt aButtonId) const +{ + if (aButtonId==EAknSoftkeyContextOptions) + { + return iContextMenuActivated; + } + else //Else the case will be for EAknSoftkeySelect for which the + // iPlayMSKLabel has to be returned + { + return iPlayMSKLabel; + } +} + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::SetMSKLabelFlag +// This function is called to set/reset either iPlayMSKLabel or +// iContextMenuActivated flag +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::ChangeMSKLabelFlag(TInt aButtonId) +{ + if (aButtonId==EAknSoftkeyContextOptions) + { + iContextMenuActivated = !iContextMenuActivated; + } + else //Else the case will be for EAknSoftkeySelect + { + iPlayMSKLabel=!iPlayMSKLabel; + } +} + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::SwitchScreenModeL +// This function is called to change the viewing mode to Normal Screen/Full +// Screen. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::SwitchScreenModeL() + { + // When control mode is being switched, following + // processing needs to happen: + // a. Save the current framebuffer + // b. Create the New Framebuffer by calling CreateBitmaps() + // c. Set the framebuffer to the new framebuffer + // d. Pause the content if it was paused. + // e. Also processing in following functions is affected: + // i. UpdateScreen - This is the callback of the engine to indicate + // that it has rendered the frame on the bitmap, and is ready to be + // drawn. Here we need to generate mask with correct bitmap + // ii. Draw - This function needs to bitblt the bitmap + // along with the mask + + if ( iSvgModule ) + { + // Create new bitmaps + CreateBitmapsL( Rect().Size() ); + iSvgModule->Pause(); + // Change the rendering bitmap to the appropriate Screen Bitmap + iSvgModule->SetFrameBuffer( iSVGTBitMap ); + + // Check if content was playing + if ( iAnimState != ESvgAnimPlayingState ) + { + // Stop it, as content is paused + iSvgModule->Pause(); + // Redraw the screen, to prevent blank screen from appearing + iSvgModule->Redraw(); + } + // Find Text Update + // Get new position of Bounding Boxes + CalcFindTextBBox(); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::CalcFindTextBBox +// This function is called to recalculate the bounding boxes for the find text. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::CalcFindTextBBox() + { + + // Clear the Arrays + iBoundBoxArray.Reset(); + iFoundTextArray.Reset(); + iTextElemIdArray.Reset(); + + // If the Search String is not valid, then + // no need to do anything. + if ( !iIsSearchStrValid ) + { + return EFalse; + } + + // Invoke Engine call for searching text. + TBool retVal = iSvgModule->SearchForText( + iLastSearchText, + iBoundBoxArray, + iFoundTextArray, + iTextElemIdArray, + EFalse ); + + if ( retVal == EFalse ) + { + // Set the search string as invalid + iIsSearchStrValid = EFalse; + // Reset the string + //Himanshu iLastSearchText.Zero(); + } + + return ( retVal ); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::PanToCurBBox +// This function is called to pan the content inorder that the current +// bounding box is visible. +// ----------------------------------------------------------------------------- +// + +void CSVGTCustControl::PanToCurBBox() + { + TPoint lRefPos( Rect().Center() ); + + // We need to pan in such a way that the Top Left of the Bounding box + // coincides with the current view's Center + TPoint lPanAmount( lRefPos - FPRCenter( + iBoundBoxArray[ iCurSearchMatchId ] ) ); + iSvgModule->Pan( lPanAmount.iX, lPanAmount.iY ); + // Do a Redraw + iSvgModule->Redraw(); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ProcessFindTextCmd +// This function is called to perform the necessary processing for the find +// text command. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::ProcessFindTextCmdL() + { + // The Processing involved is + // 1. Query the text to be searched for from the User + // 2. Is the text same as the text input before? (Case Insensitive Match) + // 3. If Yes, then + // Perform "Find Next" functionality + // a. If the bounding box is not in view then + // move to the same bound box + // Else, + // Cycle through the list of bound-boxes by incrementing + // with wrap around the iCurSearchMatchId while the text + // is not visible + // else // New text entered + // Perform "Find First" Functionality + // If no Match is found then, + // Display an "Text not found" info note + // Reset the Last Searched Text + // return to caller + // Else, + // Find the List of Bound Boxes + // Set the Current Match as the Index Zero of the BBox Array + // 4. If the current bound box is not in view + // Pan to the Bound Box + // Recalculate the Bound Box Co-ordinates + // 5. Move the mouse to the center of the bound box + // 6. Return to caller. + + TBuf lText( iLastSearchText ); + // Query the text to be searched for from the User + CAknTextQueryDialog* dlg = new ( ELeave ) CAknTextQueryDialog( + iLastSearchText ); + if( dlg->ExecuteLD( R_FIND_TEXT_QUERY_DIALOG ) ) + { + // User entered text + if ( lText.CompareF( iLastSearchText ) == 0 && + iIsSearchStrValid==1 ) // Case insensitive comparison + { + // Searching for same text = Find Next + // If current bound box is not in view and is visible, then + // move to the same bound box + // else ; Bound Box is in view or is Not Visible + // find next visible box with wraparound. + TBool lIsBoxInView = FPRIntersects( + iBoundBoxArray[ iCurSearchMatchId ] , + Rect() ); + if ( lIsBoxInView || + ( !iSvgModule->IsElementVisible( + iTextElemIdArray[ iCurSearchMatchId ] ) ) ) + { + // Store the current match Index so that the end of the list + // can be identified. + TInt lastSearchMatchId = iCurSearchMatchId; + // Increment iIsCurMatchId to point to next matching text + iCurSearchMatchId = ( iCurSearchMatchId + KSccConstOne ) % + ( iBoundBoxArray.Count() ); + while ( ( iCurSearchMatchId != lastSearchMatchId ) && + ( !iSvgModule->IsElementVisible( + iTextElemIdArray[ iCurSearchMatchId ] ) ) ) + { + // Increment iIsCurMatchId to point to next matching text + iCurSearchMatchId = ( iCurSearchMatchId + KSccConstOne ) % + ( iBoundBoxArray.Count() ); + } + if( iCurSearchMatchId == lastSearchMatchId || + (iCurSearchMatchId==0 ) ) + { + ProcessNoTextFoundL(); + return; + } + } + } + else + { + // New Search String + iCurSearchMatchId = KSccConstZero; + iIsSearchStrValid = ETrue; + + if ( !CalcFindTextBBox() ) + { + ProcessNoTextFoundL(); + return; + } + else + { + // Match Found, + // Find the first box in the list that is visible + if ( !iSvgModule->IsElementVisible( + iTextElemIdArray[ iCurSearchMatchId ] ) ) + { + // Store the current match Index so that the end of the + // list can be identified. + TInt lastSearchMatchId = iCurSearchMatchId; + // Increment iIsCurMatchId to point to next matching + // text + iCurSearchMatchId = ( iCurSearchMatchId + + KSccConstOne ) % ( iBoundBoxArray.Count() ); + while ( ( iCurSearchMatchId != lastSearchMatchId ) && + ( !iSvgModule->IsElementVisible( + iTextElemIdArray[ iCurSearchMatchId ] ) ) ) + { + // Increment iIsCurMatchId to point to next + // matching text + iCurSearchMatchId = ( iCurSearchMatchId + + KSccConstOne ) % ( iBoundBoxArray.Count() ); + } + if ( iCurSearchMatchId == lastSearchMatchId ) + { + ProcessNoTextFoundL(); + return; + } + } + } + } + + // To determine if a bounding-box is in view: + // Take the intersection ( TRect::Intersects ) of the + // Cust Control's rect and the bounding-box. If Intersects() + // returns true, bounding-box is in view + TRect myRect= Rect(); + TBool lIsBoxInView = FPRIntersects( iBoundBoxArray[ iCurSearchMatchId ], + myRect ); + + if ( !lIsBoxInView ) + { + // Box is not in view + + // Pan Content to bring the text in view + PanToCurBBox(); + + // Get new position of Bounding Boxes + CalcFindTextBBox(); + } + + // Make the mouse visible + SetPointerDisplayStatusAndRedraw( ETrue ); + // Move Mouse over to the centre of the Bound Box + TPoint lMousePos = + FPRCenter( iBoundBoxArray[ iCurSearchMatchId ] ); + iPointerX = lMousePos.iX; + iPointerY = lMousePos.iY; + + UpdatePointer(); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::DrawFindTextBBox +// Draws the Bounding Box for the current match in the SVGT content. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::DrawFindTextBBox( + const TRect& aRect ) const // Rectangle which needs to be redrawn + { + // Is there any text to highlight? + if ( iIsSearchStrValid ) + { + // To determine if a bounding-box can be drawn: + // Need to check whether it is in view && It is visible + // + // Check whether it is in view: + // Take the intersection ( TRect::Intersects ) of the CoeControl-rect + // and the bounding-box.if Intersects() returns true, + // bounding-box is in view + // Check whether it is visible: + // Call Engine API to check whether the text elem is visible. + + TBool lCanDrawBox = ( FPRIntersects( + iBoundBoxArray[ iCurSearchMatchId ], aRect ) && + iSvgModule->IsElementVisible( iTextElemIdArray[ + iCurSearchMatchId ] ) ); + + if ( lCanDrawBox ) + { + // Set the Draw Mode to XOR + iSVGTFrameBufContext->SetDrawMode( CGraphicsContext::EDrawModeXOR ); + + // Set the Brush Style to No Fill + iSVGTFrameBufContext->SetBrushStyle( + CGraphicsContext::ESolidBrush ); + + // Set the Pen Style to Solid and color to one obtd from LAF + iSVGTFrameBufContext->SetPenStyle( CGraphicsContext::ESolidPen ); + iSVGTFrameBufContext->SetPenColor( iFindTextHiColor ); + + // Set the line thickness + iSVGTFrameBufContext->SetPenSize( TSize( KSccConstTwo, + KSccConstTwo ) ); + + // Set the brush to White so that when the color is XORed with it + // it is displayed in its complementary colours. + iSVGTFrameBufContext->SetBrushColor( KRgbWhite ); + // Form the clipping rectangle so that text beyound the + // framebuffer is not displayed + TRect lClipRect( TPoint( 0,0 ), iSvgModule->Size() ); + + iSVGTFrameBufContext->SetClippingRect( lClipRect); + CArrayFix* lArray = NULL; + TRAPD( err, + FPR2PointArrayL( iBoundBoxArray[ iCurSearchMatchId ], + lArray ) ); + if ( err != KErrNone ) + { + delete lArray; + return; + } + + iSVGTFrameBufContext->DrawPolygon( + lArray ); + + delete lArray; + lArray = NULL; + + // Reset the graphic context parameters so that subsequent + // Draw() functions are not affected. + iSVGTFrameBufContext->Reset(); + } + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ProcessNoTextFoundL +// This function is called to perform the necessary procesing when +// text being searched using Find Text command is not found. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::ProcessNoTextFoundL() + { + // Set the search string as invalid + iIsSearchStrValid = EFalse; + // Reset the string + //Himanshu iLastSearchText.Zero(); + + // No match found, display an information note + TInt resourceId; + + resourceId = R_SVGT_TEXT_NOT_FOUND; + // Read from Resource + HBufC* prompt = iCoeEnv->AllocReadResourceLC( + resourceId ); + + // Start a timer to delete the note after 3 seconds. + if (!iNoteRemoverTimer->IsActive()) + { + iNoteRemoverTimer->Start( KSccOneSecond * 3, KSccOneSecond * 3, + TCallBack( RemoveInfoNote, this ) ); + } + // Create and display the note + iInfoNote = new ( ELeave ) CAknInformationNote( + ETrue ); // ETrue - Waiting Dialog + iInfoNote->ExecuteLD( *prompt ); + + // Reset the pointer + iInfoNote = NULL; + + CleanupStack::PopAndDestroy( prompt ); + + // Do a deferred draw in order to refresh the highlight + DrawDeferred(); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::DrawPanInd +// Draws the Panning indicators for the SVGT content. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::DrawPanInd() const + { + // Get current Control Rectangle + TRect myRect = Rect(); + // Set the Brush Style and Pen Style to NULL type + // so that the background of bitmap is correctly blitted. + iSVGTFrameBufContext->SetPenStyle( CGraphicsContext::ENullPen ); + iSVGTFrameBufContext->SetBrushStyle( CGraphicsContext::ENullBrush ); + + if ( iSvgModule ) + { + // Pan Left? + if ( iPanLt ) + { + // Draw the indicator + iSVGTFrameBufContext->BitBltMasked( iPanIndLeftRect.Rect().iTl, + iPanIndLeftIcon->Bitmap(), + myRect, + iPanIndLeftIcon->Mask(), + EFalse ); + + } + + // Pan Right? + if ( iPanRt ) + { + // Draw the indicator + iSVGTFrameBufContext->BitBltMasked( iPanIndRightRect.Rect().iTl, + iPanIndRightIcon->Bitmap(), + myRect, + iPanIndRightIcon->Mask(), + EFalse ); + } + + // Pan Up? + if ( iPanUp ) + { + // Draw the indicator + iSVGTFrameBufContext->BitBltMasked( iPanIndUpRect.Rect().iTl, + iPanIndUpIcon->Bitmap(), + myRect, + iPanIndUpIcon->Mask(), + EFalse ); + } + + // Pan Down? + if ( iPanDn ) + { + // Draw the indicator + iSVGTFrameBufContext->BitBltMasked( iPanIndDownRect.Rect().iTl, + iPanIndDownIcon->Bitmap(), + myRect, + iPanIndDownIcon->Mask(), + EFalse ); + } + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::CountAnimStarted +// Counts the number of animations started in the SVGT content. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::CountAnimStarted() + { + iNumAnimInProgress++; +#ifdef _DEBUG + iDbgNumAnimStarted++; +#endif + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::CountAnimPaused +// Counts the number of animations paused in the SVGT content. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::CountAnimPaused() + { + // Pause is for the whole content, rather than per animation. + // Do not reset the count of animations in progress. Once the + // animation is resumed it would receive as many AnimStopped()(as in + // iNumAnimInProgress) as the animation progresses towards completion. +#ifdef _DEBUG + iDbgNumAnimPaused++; +#endif + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::CountAnimStopped +// Counts the number of animations stopped in the SVGT content. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::CountAnimStopped() + { + iNumAnimInProgress--; +#ifdef _DEBUG + iDbgNumAnimStopped++; +#endif + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::IsAnimFirst +// Function indicates whether the animation currently in progress is first one. +// @return TBool - ETrue - First one +// EFalse Otherwise. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::IsAnimFirst() const + { + return( iNumAnimInProgress == 0 ); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::IsAnimLast +// Function indicates whether the animation currently in progress is the last +// one. +// @return TBool - ETrue - Last one +// EFalse Otherwise. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::IsAnimLast() const + { + return( iNumAnimInProgress == 0 ); + } + + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::SetPointerDisplayStatusAndRedraw +// Function sets the Pointer display status and redraws the whole control +// inorder to update display status. Called when Pointer Hide Timer times out. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::SetPointerDisplayStatusAndRedraw( + TBool aIsPointerDisplayed ) + { + if ( iIsPointerDisplayed != aIsPointerDisplayed ) + { + iIsPointerDisplayed = aIsPointerDisplayed; + //Set the MSK label + if(iMSKImpl && iScrollKey && !iPreviewMode ) + { + iScrollKey=EFalse; + TRAP_IGNORE(SetMSKLabelL()); + } + DrawDeferred(); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ShowPauseIcon() +// This function updates the pause indicator display in the main pane +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::ShowPauseIcon( + TBool aPauseIconVisible ) // ETrue - Start Pause Blink + { + if ( iDisplayFlags & ESvgDrawPauseIndicator ) + { + if (aPauseIconVisible && !iBlinker->IsActive()) + { + iBlinker->Start( KSccOneSecond/2, KSccOneSecond/2, + TCallBack( BlinkPauseIcon, this ) ); + } + if (!aPauseIconVisible && iBlinker->IsActive()) + { + iBlinker->Cancel(); + } + iPauseIconVisible = aPauseIconVisible; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::BlinkPauseIcon +// Callback function of blink timer +// ----------------------------------------------------------------------------- +// +TInt CSVGTCustControl::BlinkPauseIcon( TAny* aPtr ) + { + if ( aPtr ) + { + static_cast< CSVGTCustControl* >( aPtr )->DoBlinkPauseIcon(); + } + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::DoBlinkPauseIcon +// Function which does the actual work of toggling pause indicator +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::DoBlinkPauseIcon() + { + iPauseIconVisible = !iPauseIconVisible; + DrawDeferred(); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::FreeIcons +// Function which frees the icons created by CreateIcons +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::FreeIcons() + { + // Pointer Icons - owned + delete iPointerIcon; + iPointerIcon = NULL; + + delete iHandIcon; + iHandIcon = NULL; + + delete iTextIcon; + iTextIcon = NULL; + + // Panning Indicator Icons - owned + delete iPanIndLeftIcon; + iPanIndLeftIcon = NULL; + + delete iPanIndRightIcon; + iPanIndRightIcon = NULL; + + delete iPanIndUpIcon; + iPanIndUpIcon = NULL; + + delete iPanIndDownIcon; + iPanIndDownIcon = NULL; + + // Pause Indicator Icons - owned + delete iPauseIcon; + iPauseIcon = NULL; + } + +// ---------------------------------------------------------------------------- +// CSVGTCustControl::LaunchWaitNoteL +// Helper function for launching wait note. +// ---------------------------------------------------------------------------- +// +void CSVGTCustControl::LaunchWaitNoteL( + TInt aResourceId ) // Resource ID indicating + // string to be displayed + // while waiting. + { + if ( iDisplayFlags & ESvgDisplayWaitNote ) + { + if( iWaitDialog ) + { + delete iWaitDialog; + iWaitDialog = NULL; + } + + iWaitDialog = new( ELeave ) CAknWaitDialog( + reinterpret_cast( + &iWaitDialog ), + ETrue /* No visibility delay = + Display Wait note immediately */ ); + + iWaitDialog->PrepareLC( R_SVGT_WAIT_NOTE ); + + HBufC* lNoteTextPtr = StringLoader::LoadLC( aResourceId ); + iWaitDialog->SetTextL( *lNoteTextPtr ); + CleanupStack::PopAndDestroy( lNoteTextPtr ); + + // Launch dialog + iWaitDialog->RunLD(); + } + } + +// ---------------------------------------------------------------------------- +// CSVGTCustControl::DismissWaitNote +// Helper function for dismissing wait note. +// ---------------------------------------------------------------------------- +// +void CSVGTCustControl::DismissWaitNote() + { + if ( iDisplayFlags & ESvgDisplayWaitNote ) + { + if( iWaitDialog ) + { + TRAPD( err, iWaitDialog->ProcessFinishedL() ); + if( err ) + { + delete iWaitDialog; + iWaitDialog = NULL; + } + } + } + } + +// ---------------------------------------------------------------------------- +// CSVGTCustControl::StartProgIndTimer +// Helper function for starting the progress indicator timer. +// ---------------------------------------------------------------------------- +// +void CSVGTCustControl::StartProgIndTimer( TInt aAfter ) // Time period in + // micro-seconds after + // after which timer + // expires + { + // Stop the progress indicator timer if exists + StopProgIndTimer(); + + TRAPD(err, iProgressBarTimer = + CSVGTProgressBarTimer::NewL( this, + iDisplayFlags & ESvgUseBackLight ) ); + + if ( err == KErrNone ) + { + // Expire after aAfter microseconds. + iProgressBarTimer->After( aAfter ); + } + } + +// ---------------------------------------------------------------------------- +// CSVGTCustControl::StopProgIndTimer +// Helper function for stopping the progress indicator timer. +// ---------------------------------------------------------------------------- +// +void CSVGTCustControl::StopProgIndTimer() + { + // Delete the Progress Bar timer + if ( iProgressBarTimer ) + { + delete iProgressBarTimer; + iProgressBarTimer = NULL; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ProcessPlayCmd +// This function is called to perform the necessary processing for the Play +// command. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::ProcessPlayCmd() + { + // Play Command is applicable only if animations are present + if ( IsAnimationPresent() ) + { + if ( iAnimState != ESvgAnimPlayingState ) + { + // Start the backlight timer if the content is of finite duration + if ( IsContentFinite() ) + { + if ( ( iDisplayFlags & ESvgUseBackLight ) ) + { +#ifdef _DEBUG + iEikonEnv->InfoMsg( KSccBacklightOnStr ); +#endif +/* + TRAPD( err, iBacklightTimer = CSVGTBacklightTimer::NewL() ); + if ( err == KErrNone ) + { + iBacklightTimer->After( KSccBacklightTimerStartAfter ); + } +*/ + } + } + + // Start the Progress Ind Timer if the content is of finite duration + if ( IsContentFinite() ) + { + // Start immediately so that current count is updated. + StartProgIndTimer( 0 ); + } + + if ( iAnimState == ESvgAnimStoppedState ) + { + // Rewind the content + iSvgModule->Replay(); + } + else + { + // Resume playback of the content + iSvgModule->Resume(); + } + // Set the state variable to indicate content is playing + iAnimState = ESvgAnimPlayingState; + + // Hide the display of Pause content + ShowPauseIcon( EFalse ); + } + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ProcessPauseCmd +// This function is called to perform the necessary processing for the Pause +// command. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::ProcessPauseCmd() + { + // Pause Command is applicable only if animations are present + if ( IsAnimationPresent() ) + { + if ( iAnimState == ESvgAnimPlayingState ) + { + if ( IsContentFinite() ) + { + // Stop the progress Bar timer + StopProgIndTimer(); + } + // Set the state variable. + iAnimState = ESvgAnimPausedState; + // Pause the content + iSvgModule->Pause(); + // Show the pause indicator + ShowPauseIcon( ETrue ); + } + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ProcessStopCmd +// This function is called to perform the necessary processing for the Stop +// command. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::ProcessStopCmd() + { + // Stop Command is applicable only if animations are present + if ( IsAnimationPresent() ) + { + if ( IsContentFinite() ) + { + // Stop the progress Bar timer + StopProgIndTimer(); + } + // Stop playing the content + // Do a pause so that the content is not rewound. + iSvgModule->Stop(); + + // Reset the state variables + iAnimState = ESvgAnimStoppedState; + iProgIndTimeElap = 0; + + // Reset the number of animations in progress. + iNumAnimInProgress = 0; + + // Stop the display of the Pause indicator + ShowPauseIcon( EFalse ); + + // Redraw the screen - so that pause icon is cleaned up + DrawDeferred(); + } + } +// ----------------------------------------------------------------------------- +// CSVGTCustControl::IsVoiceCallActive +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::IsVoiceCallActive() + { + TBool call; + TInt type = 0; + // Check whether a call is a voice call + TInt error = iSystemState.Get( KPSUidCtsyCallInformation, + KCTsyCallType, type ); + if ( !error && type == EPSCTsyCallTypeCSVoice ) + { + call = ETrue; + } + else + { + call = EFalse; + } + + TInt state = 0; + // Check whether the voice call is active + error = iSystemState.Get( KPSUidCtsyCallInformation, + KCTsyCallState, state ); + if ( call && !error && state == EPSCTsyCallStateConnected ) + { + return ETrue; + } + else + { + return EFalse; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::RemoveInfoNote +// This function is called by the periodic timer to remove the info note that +// is not removed because of starvation. +// ----------------------------------------------------------------------------- +// +TInt CSVGTCustControl::RemoveInfoNote( TAny* aPtr ) + { + CSVGTCustControl* thisPtr = static_cast< CSVGTCustControl* >( aPtr ); + if ( thisPtr && thisPtr->iInfoNote ) + { + delete thisPtr->iInfoNote; + thisPtr->iInfoNote = NULL; + } + if ( thisPtr ) + { + if ( thisPtr->iNoteRemoverTimer->IsActive() ) + { + thisPtr->iNoteRemoverTimer->Cancel(); + } + } + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::DoRotation() +// This function rotates the presentation in clockwise direction with given +// angle about bitmap center +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::DoRotation( const TInt aAngle ) + { + const TInt xCenter = iSVGTBitMap->SizeInPixels().iWidth / 2; + const TInt yCenter = iSVGTBitMap->SizeInPixels().iHeight / 2; + const TReal32 angleInRadians = KDegreesToRadiansFactor * TReal32( aAngle ); + iSvgModule->Rotate( angleInRadians, xCenter, yCenter ); + // Do a Redraw + iSvgModule->Redraw(); + UpdatePointer(); + } + +#ifdef SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE +// ----------------------------------------------------------------------------- +// CSVGTCustControl::DoTextSelectionL() +// This function displays the existing text in the text/textArea in a +// read-only dialog so that the user can copy text into system clipboard +// from it. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::DoTextSelectionL( + TDes& aText // Text Content descriptor + ) const + { + CAknTextQueryDialog* dlgPtr = CAknTextQueryDialog::NewL( aText ); + dlgPtr->ExecuteLD( R_SVGT_TEXT_SELECTION_DIALOG ); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::DoTextEditingL() +// This function displays the existing text in the text/textArea element which +// is editable and returns the modified text in the same descriptor. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::DoTextEditingL( + TBool aIsTextElement, // Bool indicating whether element is text/textArea + TInt aElemHandle, // Element handle from engine + TDes& aText ) // Text Content descriptor + { + const TChar KOpeningBraces ='<'; + const TChar KClosingBraces ='>'; + TBool lTextQueryDone = EFalse; + + while ( !lTextQueryDone ) + { + CAknTextQueryDialog* dlgPtr = CAknTextQueryDialog::NewL( aText ); + dlgPtr->SetPredictiveTextInputPermitted( ETrue ); + TInt retVal = dlgPtr->ExecuteLD( R_SVGT_EDIT_TEXT_QUERY_DIALOG ); + if (retVal) + { + if ( !iIsTextChanged ) + { + // Set iIsTextChanged to indicate that text content is + // changed and changes need to be saved + iIsTextChanged = ETrue; + } + + if( aText.Locate( KOpeningBraces ) != KErrNotFound || + aText.Locate( KClosingBraces ) != KErrNotFound ) + { + // display a error not with the msg that the text area + // cant contain < or > since it will fuddle up the xml parsing + DisplayInfoNoteL(R_SVGT_BRACES_FOUND_IN_TEXTAREA, ETrue ); + } + else + { + // User entered valid text, go out of loop + lTextQueryDone = ETrue; + } + } + else + { + // User pressed cancel, no need to change the text + // return back to caller + return; + } + } + + if ( aIsTextElement ) + { + // Update the text element in the engine + iSvgModule->SetTextForTextElement( aElemHandle, aText ); + } + else + { + // Update the textArea element in the engine + iSvgModule->SetTextForTextAreaElement( aElemHandle, aText ); + } + // Redraw the screen to reflect the new changes + iSvgModule->Redraw(); + + + } +#endif // SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::FPRCenter() +// This function calculates the center of the four point rectangle +// ----------------------------------------------------------------------------- +// +TPoint CSVGTCustControl::FPRCenter( + const MRect* aBBoxRect // Four point rect + ) const + { + TPoint pt1( 0, 0 ), pt2( 0, 0 ), pt3( 0, 0 ), pt4( 0, 0 ); + TPoint lCentre; + + if ( aBBoxRect ) + { + aBBoxRect->GetPoints( pt1, pt2, pt3, pt4 ); + // Center of the rectangle is the center of the diagonal as + // diagonals are congruent in a rectangle + lCentre = TPoint( ( pt1.iX + pt3.iX ) / 2, ( pt1.iY + pt3.iY )/2 ); + } + return lCentre; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::FPRIntersects() +// This function calculates whether the FPR intersects with the rectangle +// ----------------------------------------------------------------------------- +TBool CSVGTCustControl::FPRIntersects( + const MRect* aBBoxRect, // Four point rect + const TRect& aRect // Rectangle + ) const + { + TPoint pt1( 0, 0 ), pt2( 0, 0 ), pt3( 0, 0 ), pt4( 0, 0 ); + if ( aBBoxRect ) + { + aBBoxRect->GetPoints( pt1, pt2, pt3, pt4 ); + // TODO: Need to use clipping algorithm here - to check whether line is + // within rectangle. + TInt32 maxx,maxy,minx,miny; + + maxx = pt1.iX; + if(pt2.iX > maxx) + maxx = pt2.iX; + if(pt3.iX > maxx) + maxx = pt3.iX; + if(pt4.iX > maxx) + maxx = pt4.iX; + + maxy = pt1.iY; + if(pt2.iY > maxy) + maxy = pt2.iY; + if(pt3.iY > maxy) + maxy = pt3.iY; + if(pt4.iY > maxy) + maxy = pt4.iY; + + minx = pt1.iX; + if(pt2.iX < minx) + minx = pt2.iX; + if(pt3.iX < minx) + minx = pt3.iX; + if(pt4.iX < minx) + minx = pt4.iX; + + miny = pt1.iY; + if(pt2.iY < miny) + miny = pt2.iY; + if(pt3.iY < miny) + miny = pt3.iY; + if(pt4.iY < miny) + miny = pt4.iY; + + + TPoint topleft(aRect.iTl); + TPoint bottomright(aRect.iBr); + + if ( ( bottomright.iX < minx ) || ( maxx < topleft.iX ) || + ( bottomright.iY < miny) || ( maxy < topleft.iY ) ) + { + return EFalse; + } + + return ETrue; + } + return EFalse; + } +// ----------------------------------------------------------------------------- +// CSVGTCustControl::FPR2PointArrayL() +// This function converts a Four Point Rect into an array of points +// ----------------------------------------------------------------------------- +void CSVGTCustControl::FPR2PointArrayL( + const MRect* aBBoxRect, // Four Point Rect + CArrayFix*& aArrayPtr // Array of Points + ) const + { + aArrayPtr = new (ELeave) CArrayFixFlat ( 4 ); + CleanupStack::PushL( aArrayPtr ); + TPoint pt1( 0, 0 ), pt2( 0, 0 ), pt3( 0, 0 ), pt4( 0, 0 ); + + if ( aBBoxRect ) + { + aBBoxRect->GetPoints( pt1, pt2, pt3, pt4 ); + } + aArrayPtr->AppendL( pt1 ); + aArrayPtr->AppendL( pt2 ); + aArrayPtr->AppendL( pt4 ); + aArrayPtr->AppendL( pt3 ); + + CleanupStack::Pop( aArrayPtr ); // Ownership transferred to caller + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::Draw +// Reimplements CCoeControl::Draw to draw this control's view to the screen +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::Draw( + const TRect& aRect ) const + { + iSVGTFrameBufContext->Clear(); + + if ( iSVGTBitMap && iSVGTBitMapMask ) + { + iSVGTFrameBufContext->BitBltMasked( iViewerPaneRect.Rect().iTl, + iSVGTBitMap, + iViewerPaneRect.Rect(), + iSVGTBitMapMask, + ETrue ); + } + + // Draw the bounding box + DrawFindTextBBox( aRect ); + + if ( iDisplayFlags & ESvgDrawPanIndicator ) + { + // Draw Panning Indicator + DrawPanInd(); + } + + // draw paused icon + if ( iPauseIconVisible ) + { + iSVGTFrameBufContext->BitBltMasked( iPauseRect.Rect().iTl, + iPauseIcon->Bitmap(), + Rect(), + iPauseIcon->Mask(), + EFalse ); + } + + + // Draw Pointer + if ( iIsPointerDisplayed && iDisplayFlags & ESvgDrawPointer ) + { + DrawPointer(); + } + + // Get the standard graphics context + CWindowGc& gc = SystemGc(); + // Blit our framebuffer bitmap to the System GC + gc.BitBlt( iViewerPaneRect.Rect().iTl, iSVGTFrameBufBitMap ); + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ConstructFromResourceL +// Since this control is to be displayed in a dialog, this function is +// reimplented from CCoeControl::ConstructFromResourceL inorder to read +// resource values from resource file. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::ConstructFromResourceL( + TResourceReader& /*aReader*/) // Resource Reader + { + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::SizeChanged +// Handles resizing of control reimplementing CCoeControl::SizeChanged. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::SizeChanged() + { + TRect myRect = Rect(); + + // Commented this section because,Indicators were not displaying in + // case of theme change + // if ( myRect == iCurrentLayout ) + // { + // Layout has not changed, do nothing + // return; + // } + // + + if ( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) + { + TInt lVariety = 0; // Normal Screen + if ( iIsFullScreenOn ) + { + lVariety = 1; // Full Screen + } + + // Main Viewer Pane + iViewerPaneRect.LayoutRect( myRect, + AknLayoutScalable_Apps::main_viewer_pane( lVariety ) ); + + // Panning Indicators + iPanIndLeftRect.LayoutRect( myRect, + AknLayoutScalable_Apps::main_viewer_pane_g3( lVariety ) ); + iPanIndRightRect.LayoutRect( myRect, + AknLayoutScalable_Apps::main_viewer_pane_g4( lVariety ) ); + iPanIndUpRect.LayoutRect( myRect, + AknLayoutScalable_Apps::main_viewer_pane_g1( lVariety ) ); + iPanIndDownRect.LayoutRect( myRect, + AknLayoutScalable_Apps::main_viewer_pane_g2( lVariety ) ); + // Panning Indicators Rectangle for Touch Area + iPanIndLeftAidRect.LayoutRect( myRect, + AknLayoutScalable_Apps::aid_main_viewer_pane_g3( lVariety ) ); + iPanIndRightAidRect.LayoutRect( myRect, + AknLayoutScalable_Apps::aid_main_viewer_pane_g4( lVariety ) ); + iPanIndUpAidRect.LayoutRect( myRect, + AknLayoutScalable_Apps::aid_main_viewer_pane_g1( lVariety ) ); + iPanIndDownAidRect.LayoutRect( myRect, + AknLayoutScalable_Apps::aid_main_viewer_pane_g2( lVariety ) ); + + // Pointers + iPointerRect.LayoutRect( myRect, + AknLayoutScalable_Apps::main_viewer_pane_g5( lVariety ) ); + iHandRect.LayoutRect( myRect, + AknLayoutScalable_Apps::main_viewer_pane_g7( lVariety ) ); + iTextRect.LayoutRect( myRect, + AknLayoutScalable_Apps::main_viewer_pane_g7( lVariety ) ); + + // Pause Indicator + iPauseRect.LayoutRect( myRect, + AknLayoutScalable_Apps::main_viewer_pane_g8( lVariety ) ); + + // Aid for display of pointer + // In order to draw the cursor in the correct location on + // the screen, the viewer needs to know the offsetX and offSetY + // of the cursor hotspot in the icon bitmap. + // Because of Scalable UI the size of the icons can be changed + // and this would result in the change of these co-ordinates. + // he viewer needs to get this information from the LAF + // so that viewer can draw the cursor in the correct position + // on the screen. + + iPointerAidRect.LayoutRect( myRect, + AknLayoutScalable_Apps::aid_hotspot_pointer_arrow_pane() ); + iHandAidRect.LayoutRect( myRect, + AknLayoutScalable_Apps::aid_hotspot_pointer_hand_pane() ); + iTextAidRect.LayoutRect( myRect, + AknLayoutScalable_Apps::aid_hotspot_pointer_text2_pane() ); + } + else + { + // Hardcode the values for normal resolution (172x208) + + iViewerPaneRect.LayoutRect( myRect, + 0, 0, 0, 0, 0, myRect.Width(), myRect.Height() ); + + iPanIndLeftRect.LayoutRect( myRect, + 0, 0, ( myRect.Height() / KSccConstTwo ) - 8, 0, 0, 6, 15 ); + iPanIndRightRect.LayoutRect( myRect, + 0, ( myRect.Width() - 6 ), + (myRect.Height() / KSccConstTwo ) - 8, 0, 0, 6, 15 ); + iPanIndUpRect.LayoutRect( myRect, + 0, ( ( myRect.Width() / KSccConstTwo ) - 8 ), 0, 0, 0, + 15, 6 ); + iPanIndDownRect.LayoutRect( myRect, + 0, ( ( myRect.Width() / KSccConstTwo ) - 8 ), + myRect.Height() - 6, 0, 0, 15, 6 ); + + iPointerRect.LayoutRect( myRect, + 0, 0, 0, 0, 0, 18, 24 ); + iHandRect.LayoutRect( myRect, + 0, 0, 0, 0, 0, 18, 24 ); + iTextRect.LayoutRect( myRect, + 0, 0, 0, 0, 0, 18, 24 ); + + + iPauseRect.LayoutRect(myRect, + 0, 0, 0, 0, 0, 13, 13 ); + + iPointerAidRect.LayoutRect( myRect, + 0, 0, 0, 0, 0, 0, 0 ); + iHandAidRect.LayoutRect( myRect, + 0, 0, 0, 0, 0, 0, 0 ); + iTextAidRect.LayoutRect( myRect, + 0, 0, 0, 0, 0, 0, 0 ); + } + + // Set the size of the bitmaps + // No Error Handling for SetSize + // Pointers + AknIconUtils::SetSize( iPointerIcon->Bitmap(), iPointerRect.Rect().Size() ); + AknIconUtils::SetSize( iHandIcon->Bitmap(), iHandRect.Rect().Size() ); + AknIconUtils::SetSize( iTextIcon->Bitmap(), iTextRect.Rect().Size() ); + + // Panning Indicators + + // Left Ind + AknIconUtils::SetSize( iPanIndLeftIcon->Bitmap(), + iPanIndLeftRect.Rect().Size() ); + + // Right Ind + AknIconUtils::SetSize( iPanIndRightIcon->Bitmap(), + iPanIndRightRect.Rect().Size() ); + + // Up Ind + AknIconUtils::SetSize( iPanIndUpIcon->Bitmap(), + iPanIndUpRect.Rect().Size() ); + + // Down Ind + AknIconUtils::SetSize( iPanIndDownIcon->Bitmap(), + iPanIndDownRect.Rect().Size() ); + + // Pause Ind + AknIconUtils::SetSize( iPauseIcon->Bitmap(), + iPauseRect.Rect().Size() ); + + // Recreate the framebuffer. + TRAPD( errSwitchMode, SwitchScreenModeL() ); + if ( errSwitchMode != KErrNone ) + { + // Let environment handle error + iCoeEnv->HandleError( errSwitchMode ); + } + + // Dummy mouse-move to the engine + iSvgModule->MouseMove( iPointerX, iPointerY ); + + // Save current layout so that we know if the Layout changed. + iCurrentLayout = myRect; + } + + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::AnimationStarted +// Handles callback notification from SVG engine indicating Animation Started. +// Reimplements MSvgAnimationListener::AnimationStarted. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::AnimationStarted( TBool aIsAnimationIndefinite ) + { + // If the content contains any infinite animations - then the + // backlight behaves normally. + if ( !IsContentFinite() ) + { + return ETrue; + } + + if ( aIsAnimationIndefinite ) + { +#ifdef _DEBUG + iEikonEnv->InfoMsg( KSccBacklightOffStr ); +#endif + + } + else + { + if ( IsAnimFirst() ) + { +#ifdef _DEBUG + iEikonEnv->InfoMsg( KSccBacklightOnStr ); +#endif + if ( ( iDisplayFlags & ESvgUseBackLight ) ) + { + + } + } + CountAnimStarted(); + } + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::AnimationEnded +// Handles callback notification from SVG engine indicating Animation Ended. +// Reimplements MSvgAnimationListener::AnimationEnded. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::AnimationEnded() + { + // If the content contains any infinite animations - then the + // backlight behaves normally. + if ( !IsContentFinite() ) + { + return ETrue; + } + + CountAnimStopped(); + if ( IsAnimLast() ) + { +#ifdef _DEBUG + iEikonEnv->InfoMsg( KSccBacklightOffStr ); +#endif + // All animations have ended + + } + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::AnimationPaused +// Handles callback notification from SVG engine indicating Animation Paused. +// Reimplements MSvgAnimationListener::AnimationPaused. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::AnimationPaused() + { + // If the content contains any infinite animations - then the + // backlight behaves normally. + if ( !IsContentFinite() ) + { + return ETrue; + } + +#ifdef _DEBUG + iEikonEnv->InfoMsg( KSccBacklightOffStr ); +#endif + // Animation is paused, + CountAnimPaused(); + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::UpdateProgressBar +// This function updates the progress bar in the navi pane. It is called back +// by the progress bar timer. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::UpdateProgressBar() + { + + TReal lSecElapsedRounded = 0.0; + TReal lSecElapsedReal = 0.0; + TReal lTotalTimeReal = 0.0; + TReal lTotalTimeRounded = 0.0; + TUint32 lTimeElapsed = 0; + + lSecElapsedReal = (TReal)iSvgModule->MediaTime() + / KSccNumMSecPerSec; + + lTotalTimeReal = (TReal)iDuration / KSccNumMSecPerSec; + if ( iProgressBarDrawImpl ) + { + + + // Round off the Elapsed time inorder to display time accurately. + Math::Round( lSecElapsedRounded, lSecElapsedReal, 0 ); + + // Round off the Total time inorder to display time accurately. + Math::Round( lTotalTimeRounded, lTotalTimeReal, 0 ); + + lTimeElapsed = lSecElapsedRounded; + TRAPD( err, iProgressBarDrawImpl->DrawProgressBarL( lTimeElapsed, + lTotalTimeRounded ) ); + if ( err != KErrNone ) + { + // Error Case, Nothing is done now. + } + + + // Stop the Progress Bar timer + StopProgIndTimer(); + iProgIndTimeElap = lSecElapsedReal ; + + } + + // Check whether end of animation is reached. + // 01-Feb-2008 Fix for TSW Id "CGSR-7B6DFW" + // Earlier this check was happening only if iProgressBarDrawImpl is there + // for screen saver iProgressBarDrawImpl is not there but still the animation + // should work for the duration set for ScreenSaver + + if ( lSecElapsedReal >= (TReal)iDuration / KSccNumMSecPerSec ) + { + TInt err = 0; + // Reset the state variables + iProgIndTimeElap = 0; + + // Stop the animation and rewind. + TRAP(err, ProcessViewerCommandL( ESvgtDlgStopCommand ) ); + if ( err != KErrNone ) + { + // Error Case, Nothing is done now. + } + // If loop is on then replay the content. + if ( !iIsLoopOn ) + { + // Animation is done, no need to continue progress bar. + return; + } + else + { + // Loop option enabled. Replay content. + TRAP( err, ProcessViewerCommandL( ESvgtDlgPlayCommand )); + if ( err != KErrNone ) + { + // Error Case, Nothing is done now. + } + return; + } + } + + + + + // Restart the timer + StartProgIndTimer( KSccProgIndTimerYieldDur ); + } + + + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::PointerInactivityTimeout() +// This function updates the pointer display status in the navi pane. +// It is called back by the pointer hide timer. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::PointerInactivityTimeout() + { + // UI Spec: Hide Pointer as time of inactivity has passed + SetPointerDisplayStatusAndRedraw( EFalse ); + + //Set the MSK label + if(iMSKImpl && !iPreviewMode ) + { + TRAP_IGNORE(SetMSKLabelL()); + } + + // Delete the inactivity timer + delete iInactivityTimer; + iInactivityTimer = NULL; + } + +#ifdef SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE +// ----------------------------------------------------------------------------- +// CSVGTCustControl::TextAreaEntered() +// This callback is called to notify when a pointer enters a textbox element. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::TextAreaEntered( TInt aTextAreaHandle ) + { + // Save the current element handle + iCurrentTextElementId = aTextAreaHandle; + + // Indicate that it is a text area element + iIsCurrentTextElement = EFalse; + + // check if there is a 'a' element or interactive element + // within which text is present + + if(iAElement || iPointerDownAnimation) + { + iPointerType=ESvgPointerHand; + } + else + { + // Text symbol to indicate user can perform some action by clicking + iPointerType = ESvgPointerText; + } + // Remember that textArea element is entered, so that + // subsequent text element notifications are ignored + iTextAreaEntered = ETrue; + + // Enable Select Menu Option + iIsTextSelectOn = ETrue; + HBufC* lStrPtr = HBufC::New( KSccMaxTextLength ); + if ( !lStrPtr ) + { + // Error while allocation, no memory + iCoeEnv->HandleError( KErrNoMemory ); + return ETrue; + } + TPtr lPtr = lStrPtr->Des(); + + // Check whether the Text is editable + iSvgModule->GetTextForTextAreaElement( aTextAreaHandle, + iIsTextEditOn, + lPtr ); + + delete lStrPtr; + + //Display MSK label Select/Edit + if(iMSKImpl && !iPreviewMode) + { + TRAP_IGNORE(SetMSKLabelL()); + } + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::TextAreaExited() +// This callback is called to notify when a pointer exits a textbox element. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::TextAreaExited( TInt /* aTextAreaHandle */) + { + // Reset the current element handle + iCurrentTextElementId = 0; + + // Reset the element flag to text element + iIsCurrentTextElement = ETrue; + + // check if there is a 'a' element or interactive element + // within which text is present + if(iAElement || iPointerDownAnimation) + { + iPointerType=ESvgPointerHand; + } + else + { + // Reset the pointer to default pointer + iPointerType = ESvgPointerDefault; + } + // Remember that textArea element is exitted + iTextAreaEntered = EFalse; + + // Disable the Select and Edit menu option + iIsTextSelectOn = EFalse; + iIsTextEditOn = EFalse; + //Set the MSK label + if(iMSKImpl && !iPreviewMode) + { + TRAP_IGNORE(SetMSKLabelL()); + } + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::TextAreaActivated() +// This callback is called to notify that a text element has been activated. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::TextAreaActivated( TInt aTextAreaHandle ) + { + if (iSelectCause != ESvgInvalidSelectCause ) + { + // Ignore this callback as it was already processed. + return ETrue; + } + // Set the cause for select operation as text area so that + // subsequent events trigerred are ignored. + iSelectCause = ESvgTextAreaSelectCause; + + HBufC* lStrPtr = HBufC::New( KMaxEditorTextLength ); + if ( !lStrPtr ) + { + // Error while allocation, no memory + iCoeEnv->HandleError( KErrNoMemory ); + return ETrue; + } + TPtr lPtr = lStrPtr->Des(); + + // Check whether the Text is editable + iSvgModule->GetTextForTextAreaElement( aTextAreaHandle, + iIsTextEditOn, + lPtr ); + + if ( iIsTextEditOn && !iSvgModule->IsLoading() ) + { + TRAPD( err, DoTextEditingL( + EFalse, // Text Area Element + aTextAreaHandle, // Element Handle + lPtr ) ); // buffer pointer + if ( err != KErrNone ) + { + // No error handling done. + } + + } + else + { + TRAPD( err, + DoTextSelectionL( lPtr ); + ); + if ( err != KErrNone ) + { + // No error handling done. + } + } + + delete lStrPtr; + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::TextEntered() +// This callback is called to notify that a text element has been entered. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::TextEntered( TInt aTextHandle ) + { + if ( iTextAreaEntered ) + { + // Ignore all text element notifications when cursor is + // within a textArea element + return ETrue; + } + + // Save the current element handle + iCurrentTextElementId = aTextHandle; + + // Set the flag to indicate element type is text element + iIsCurrentTextElement = ETrue; + + // check if there is a 'a' element or interactive element + // within which text is present + + if(iAElement || iPointerDownAnimation) + { + iPointerType=ESvgPointerHand; + } + else + { + // Text symbol to indicate user can perform some action by clicking + iPointerType = ESvgPointerText; + } + // Enable Select Menu Option + iIsTextSelectOn = ETrue; + + HBufC* lStrPtr = HBufC::New( KSccMaxTextLength ); + + if ( !lStrPtr ) + { + // Error while allocation, no memory + iCoeEnv->HandleError( KErrNoMemory ); + return ETrue; + } + + TPtr lPtr = lStrPtr->Des(); + + // Check whether the Text is editable + iSvgModule->GetTextForTextElement( aTextHandle, + iIsTextEditOn, + lPtr ); + + delete lStrPtr; + // Display MSK label Select/Edit + if(iMSKImpl && !iPreviewMode) + { + TRAP_IGNORE(SetMSKLabelL()); + } + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::TextExited() +// This callback is called to notify that a text element has been exited. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::TextExited( TInt /* aTextHandle */ ) + { + if ( iTextAreaEntered ) + { + // Ignore all text element notifications when cursor is + // within a textArea element + return ETrue; + } + + // Reset the current element handle + iCurrentTextElementId = 0; + + // check if there is a 'a' element or interactive element + // within which text is present + if(iAElement || iPointerDownAnimation) + { + iPointerType=ESvgPointerHand; + } + else + { + // Reset the pointer to default + iPointerType = ESvgPointerDefault; + } + // Disable the Select and Edit menu option + iIsTextSelectOn = EFalse; + iIsTextEditOn = EFalse; + + //Set the MSK label + if(iMSKImpl && !iPreviewMode) + { + TRAP_IGNORE(SetMSKLabelL()); + } + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::TextActivated() +// This callback is called to notify that a text element has been activated. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::TextActivated( TInt aTextHandle ) + { + if (iSelectCause != ESvgInvalidSelectCause ) + { + // Ignore this callback as it was already processed. + return ETrue; + } + // Set the cause for select operation as text so that + // subsequent events trigerred are ignored. + iSelectCause = ESvgTextSelectCause; + HBufC* lStrPtr = HBufC::New( KMaxEditorTextLength ); + if ( !lStrPtr ) + { + // Error while allocation, no memory + iCoeEnv->HandleError( KErrNoMemory ); + return ETrue; + } + TPtr lPtr = lStrPtr->Des(); + + // Check whether the Text is editable + iSvgModule->GetTextForTextElement( aTextHandle, + iIsTextEditOn, + lPtr ); + + if ( iIsTextEditOn && !iSvgModule->IsLoading()) + { + TRAPD( err, + DoTextEditingL( ETrue, // Text Element + aTextHandle , // Element Handle + lPtr ); // Buffer Pointer + ); + if ( err != KErrNone ) + { + // No Error handling done. + } + } + else + { + TRAPD( err, + DoTextSelectionL( lPtr ); + ); + if ( err != KErrNone ) + { + // No Error handling done. + } + } + delete lStrPtr; + return ETrue; + } + +#endif // SVGTUICONTROL_DBG_TEXT_EDIT_SELECT_API_ENABLE + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::InteractiveElementEntered() +// This callback is called to notify that an interactive element has been entered. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::InteractiveElementEntered(TPtrC /*aElementIdPtr*/, TUint16 aInteractonTypeList ) + { + + if( (aInteractonTypeList & ESvgInteractiveEventClick )|| + (aInteractonTypeList & ESvgInteractiveEventMousedown ) || + (aInteractonTypeList & ESvgInteractiveEventMouseup ) ) + { + + iPointerType = ESvgPointerHand; + + // Increment the count maintained for overlapping interactive elements + // with pointer-down events so that the iPointertype is set properly + iInteractiveElementEnteredCnt++; + + // Need to set flag so that when the element is within + // textarea or text + iPointerDownAnimation=ETrue; + + // Sets the MSK label + if(iMSKImpl && !iPreviewMode) + { + TRAP_IGNORE(SetMSKLabelL()); + } + } + return ETrue; + } +// ----------------------------------------------------------------------------- +// CSVGTCustControl::InteractiveElementExited() +// This callback is called to notify that an interactive element has been exited. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::InteractiveElementExited(TPtrC /*aElementIdPtr*/) + { + + // The count of interactive elements with pointer down events registered + // is decremented + if(iPointerDownAnimation) + { + iInteractiveElementEnteredCnt--; + } + + + if(!iInteractiveElementEnteredCnt) + { + iPointerType = ESvgPointerDefault; + + iPointerDownAnimation=EFalse; + //Set the MSK label + if(iMSKImpl && !iPreviewMode) + { + TRAP_IGNORE(SetMSKLabelL()); + } + } + + return ETrue; + } +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ReportAllElements +// Implements MSvgLoadingListener::ReportAllElements. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::ReportAllElements() + { + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::WillAssignImageData +// Implements MSvgLoadingListener::WillAssignImageData. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::WillAssignImageData() + { + // Return ETrue to indicate that AssignImageData will be used to + // asynchronously load the image in the engine + if(iProgressiveRendering) + { + return ETrue; + } + else + { + return EFalse; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ImageDataReference +// Implements MSvgLoadingListener::ImageDataReference. +// ----------------------------------------------------------------------------- +// +void CSVGTCustControl::ImageDataReference( const TDesC& aUri ) + { + CSvgtEvent* event = NULL; + if ( aUri.Length() > KEmbededImageTagLength && + aUri.Left(KEmbededImageTagLength) == KDataTagName ) + { + event = new CSvgtEventEmbededImage(aUri); + } + else + { + event = new CSvgtEventFetchImage(aUri); + } + if ( iEventHandlerAO ) + { + iEventHandlerAO->AddEventToList( event ); + iEventHandlerAO->MakeRequestComplete( KErrNone ); + } + } +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ReportAllElements +// Implements MSvgLoadingListener::DocumentStart. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::DocumentStart() + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::DocumentEnd +// Implements MSvgLoadingListener::DocumentEnd. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::DocumentEnd() + { + if(iProgressiveRendering) + { + iEventHandlerAO->SetDocumentComplete(); + iEventHandlerAO->AddRedrawEventToList( ETrue ); + iEventHandlerAO->MakeRequestComplete( KErrNone ); + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ElementStart +// Implements MSvgLoadingListener::ElementStart. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::ElementStart( const TDesC& aTagName, + MSvgAttributeList& /*aAttributeList*/) + { + if ( iProgressiveRendering && aTagName == KSvgTagName && iEngineInitialized + == EFalse ) + { + iEngineInitialized = ETrue; + iSvgModule->AddListener( static_cast < MSvgViewPortListener*>(this), ESvgViewPortListener ); + iSvgModule->InitializeEngine( NULL, EFalse); + } + else if ( iProgressiveRendering ) + { +// iEventHandlerAO->RequestRedraw(); +// User::After( 10 * 1000 ); + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ElementEnd +// Implements MSvgLoadingListener::ElementEnd. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::ElementEnd( const TDesC& /* aTagName */) + { + if(iProgressiveRendering) + { + iEventHandlerAO->AddRedrawEventToList(); + iEventHandlerAO->MakeRequestComplete( KErrNone ); + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ExternalDataRequested +// Implements MSvgLoadingListener::ExternalDataRequested. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::ExternalDataRequested( const TDesC& /* aUri */) + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ExternalDataReceived +// Implements MSvgLoadingListener::ExternalDataReceived. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::ExternalDataReceived( const TDesC& /* aUri */) + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::ExternalDataRequestFailed +// Implements MSvgLoadingListener::ExternalDataRequestFailed. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::ExternalDataRequestFailed( const TDesC& /* aUri */) + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTCustControl::UnsupportedElement +// Implements MSvgLoadingListener::UnsupportedElement. +// ----------------------------------------------------------------------------- +// +TBool CSVGTCustControl::UnsupportedElement( const TDesC& /* aTagName */, + MSvgAttributeList& /* aAttributeList*/ ) + { + return EFalse; + } +void CSVGTCustControl::ImagesLoaded(TInt aError) + { + if(aError != KErrNone) + { + if(!iIsWaitNoteDisplayed) + { + iIsWaitNoteDisplayed = ETrue; + TRAP_IGNORE( DisplayInfoNoteL( R_SVGT_FILE_NOT_COMPLETE, ETrue ) ); + } + } + } + +void CSVGTCustControl::DoExitFromDialogL() + { + if ( iExitObserver ) + { + iExitObserver->HandleApplicationExitL(EEikCmdExit); + } + } + +void CSVGTCustControl::AssignImageData( const TDesC& aUri, HBufC8* aData ) + { + if(aData) + { + iSvgModule->AssignImageData(aUri, aData); + // Do a redraw to reflect the image loaded + iSvgModule->Redraw(); + } + else + { + // Show information note + if(!iIsWaitNoteDisplayed) + { + iIsWaitNoteDisplayed = ETrue; + TRAP_IGNORE( DisplayInfoNoteL( R_SVGT_FILE_NOT_COMPLETE, ETrue ) ); + } + } + } +TInt CSVGTCustControl::DoHandleLoadingThreadError() + { + TInt lErrCode = KErrNone; + // An error note "Unable to open file" for eg. should be displayed + // in the following conditions + // a. Error Object contains NULL. This means possible out of memory + // when create error object. + // b. Error Object has an error which is not a warning - This + // indicates unrecoverable error in parsing - + // invalid/corrupted content + if ( (! iLoadingThreadError ) || ( iLoadingThreadError && + iLoadingThreadError->HasError() && + !iLoadingThreadError->IsWarning() ) ) + { + TRAP_IGNORE( DisplayInfoNoteL( R_SVGT_FILE_OPEN_FAILURE, ETrue ) ); + + // Exiting from the dialog + if ( iLoadingThreadError ) + { + lErrCode = iLoadingThreadError->SystemErrorCode(); + if ( lErrCode == KErrNone ) + { + lErrCode = KErrGeneral; + } + } + else + { + lErrCode = KErrNoMemory; + } + } + + if ( lErrCode == KErrNone ) + { +// Placed into the DoPostLoadFuncL + } + + return lErrCode; + } + +CSVGTCustControl::TFileType + CSVGTCustControl::ImageFileType( const TDesC& aUri ) const + { + + TUriParser UriParser; + + TBuf localUri; + // url starts with www so append http:// + if ( !aUri.Left( KSchemaLength ).Compare( KWww ) ) + { + localUri.Append( KHttp ); + localUri.Append( aUri ); + if ( UriParser.Parse( localUri ) ) + { + return ( EInvalidFilePath ); + } + } + else + { + if ( UriParser.Parse( aUri ) ) + { + return ( EInvalidFilePath ); + } + } + + if ( UriParser.IsPresent( EUriHost ) ) + { + // Extract the Path, filename and extension from the uri + TFileName filename = UriParser.Extract( EUriPath ); + TParsePtrC fileParser( filename ); + + if ( fileParser.NamePresent() && fileParser.ExtPresent() ) + { + if ( fileParser.Ext().Compare( KJpg ) == 0 || + fileParser.Ext().Compare( KJpeg ) == 0 || + fileParser.Ext().Compare( KBmp ) == 0 || + fileParser.Ext().Compare( KPng ) == 0 || + fileParser.Ext().Compare( KSvg ) == 0 || + fileParser.Ext().Compare( KSvgz ) == 0 ) + { + // file name and ext present and + // it is amy of the supported image types + return ERemoteImageFile; + } + else + { + //file Extension present but not a supported image ext, + //may be some html file + return ENotAnImageFile; + } + } + else + { + //Should be a domain name so return ENotAnImageFile + return ENotAnImageFile; + } + } + else + { + return ELocalImageFile; + } + } + +/** +* CSVGTCustControl::ResetBacklightTime +* Resets the backlight time for finite content +*/ +void CSVGTCustControl::ResetBacklightTime() + { + TTimeIntervalSeconds secondCount; + TTime currTime; + currTime.HomeTime(); + currTime.SecondsFrom(iPreviousBackLightTimeStamp, secondCount); + + if ( iDisplayFlags & ESvgUseBackLight ) + { + if(secondCount.Int() >= KBackLightTimeInterval) + { + User::ResetInactivityTime(); + iPreviousBackLightTimeStamp = currTime; + } + } + } + +void CSVGTCustControl::StopEventHandler() + { + if ( iEventHandlerAO ) + { + iEventHandlerAO->Cancel(); + } + } + +void CSVGTCustControl::SetThreadRunning(TBool aIsRunning) + { + iIsThreadRunning = aIsRunning; + } + +TBool CSVGTCustControl::IsThreadRunning() const + { + return iIsThreadRunning; + } + +void CSVGTCustControl::PerformEngineRedraw() + { + iSvgModule->Redraw(); + } + +//TOUCH SUPPORT START +#ifdef RD_SCALABLE_UI_V2 +void CSVGTCustControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + if(aPointerEvent.iType == TPointerEvent::EButton1Down) + { + if(iPntrObserver && iPntrObserver->HandleCustControlPointerEventL(aPointerEvent)) + return; + + // Reset the select cause + iSelectCause = ESvgInvalidSelectCause; + + TIndicatorType indicatorType = + ActiveIndicator(aPointerEvent.iPosition); + if (indicatorType != ENoIndicator) + { + if(indicatorType == EPauseIndicator) + { + ProcessPlayCmd(); + } + else + { + PanPresentation( indicatorType ); + } + } + + // Get the size of the content + TSize svgSize = iSvgModule->Size(); + TInt rgnw = svgSize.iWidth; + TInt rgnh = svgSize.iHeight; + if ( aPointerEvent.iPosition.iX >= rgnw || aPointerEvent.iPosition.iY >= rgnh ) + return; + iPointerX = aPointerEvent.iPosition.iX; + iPointerY = aPointerEvent.iPosition.iY; + iSvgModule->MouseDown( iPointerX, iPointerY ); + + SetPointerDisplayStatusAndRedraw(ETrue); + UpdatePointer(); + + Window().RequestPointerRepeatEvent(KInitRepeatInterval, ActiveIndicatorRect(indicatorType)); + } + else if(aPointerEvent.iType == TPointerEvent::EButtonRepeat) + { + UpdatePointer(); + TIndicatorType indicatorType = + ActiveIndicator(aPointerEvent.iPosition); + PanPresentation( indicatorType ); + Window().RequestPointerRepeatEvent(KInitRepeatInterval, ActiveIndicatorRect(indicatorType)); + } + else if(aPointerEvent.iType == TPointerEvent::EButton1Up) + { + Window().CancelPointerRepeatEventRequest(); + // UI Spec: Pointer should be hidden after 15 sec of + // user inactivity + if ( iInactivityTimer ) + { + // Should not be the case! + delete iInactivityTimer; + iInactivityTimer = NULL; + } + iInactivityTimer = CSVGTPointerHideTimer::NewL( this ); + iInactivityTimer->After( KSccPointerHideTimerStartAfter ); + + TIndicatorType indicatorType = + ActiveIndicator(aPointerEvent.iPosition); + if (indicatorType == ENoIndicator) + { + iSvgModule->MouseUp( iPointerX, iPointerY ); + } + } + else if(aPointerEvent.iType == TPointerEvent::EDrag) + { + // Get the size of the content + TSize svgSize = iSvgModule->Size(); + TInt rgnw = svgSize.iWidth; + TInt rgnh = svgSize.iHeight; + if ( aPointerEvent.iPosition.iX >= rgnw || aPointerEvent.iPosition.iY >= rgnh ) + return; + iPointerX = aPointerEvent.iPosition.iX; + iPointerY = aPointerEvent.iPosition.iY; + + iSvgModule->MouseMove( iPointerX, iPointerY ); + SetPointerDisplayStatusAndRedraw(ETrue); + UpdatePointer(); + } + } + +void CSVGTCustControl::SetContainerWindowL(const CCoeControl &aContainer) + { + CCoeControl::SetContainerWindowL(aContainer); + EnableDragEvents(); + } + +void CSVGTCustControl::PanPresentation( + const CSVGTCustControl::TIndicatorType aIndicatorType ) + { + switch( aIndicatorType ) + { + case ELeftIndicator: + { + iSvgModule->Pan( KSccPanNumPixelsX, KSccConstZero ); + break; + } + case ERightIndicator: + { + iSvgModule->Pan( -KSccPanNumPixelsX, KSccConstZero ); + break; + } + case EUpIndicator: + { + iSvgModule->Pan( KSccConstZero, KSccPanNumPixelsY ); + break; + } + case EDownIndicator: + { + iSvgModule->Pan( KSccConstZero, -KSccPanNumPixelsY ); + break; + } + } + iSvgModule->Redraw(); + DrawDeferred(); + } + +CSVGTCustControl::TIndicatorType CSVGTCustControl::ActiveIndicator( + const TPoint aPosition ) const + { + TIndicatorType indicatorType = ENoIndicator; + + if( iPanIndLeftAidRect.Rect().Contains( aPosition ) && iPanLt) + { + indicatorType = ELeftIndicator; + } + else if( iPanIndRightAidRect.Rect().Contains( aPosition ) && iPanRt) + { + indicatorType = ERightIndicator; + } + else if( iPanIndUpAidRect.Rect().Contains( aPosition ) && iPanUp) + { + indicatorType = EUpIndicator; + } + else if( iPanIndDownAidRect.Rect().Contains( aPosition ) && iPanDn) + { + indicatorType = EDownIndicator; + } + + return indicatorType ; + } + +TRect CSVGTCustControl::ActiveIndicatorRect( TIndicatorType aIndicator) const + { + TRect indicatorRect(0,0,0,0); + + switch(aIndicator) + { + case ELeftIndicator: + { + indicatorRect = iPanIndLeftAidRect.Rect(); + } + break; + case ERightIndicator: + { + indicatorRect = iPanIndRightAidRect.Rect(); + } + break; + case EUpIndicator: + { + indicatorRect = iPanIndUpAidRect.Rect(); + } + break; + case EDownIndicator: + { + indicatorRect = iPanIndDownAidRect.Rect(); + } + break; + } + + return indicatorRect; + } + +#endif //RD_SCALABLE_UI_V2 + +#ifdef RD_SVGT_AUDIO_SUPPORT +void CSVGTCustControl::HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType) + { + if((aControl == iVolumePopup) && ( aEventType == MCoeControlObserver::EEventStateChanged)) + { +#ifdef _DEBUG + TName msg; + msg.Format(_L("Volume level: %d"), iVolumePopup->Value()); + iEikonEnv->InfoMsgWithAlignment(TGulAlignment(EHCenterVCenter), msg); +#endif + // Save the current volume as previous volume before setting + // new volume level + iPrevVolume=iVolumeLevel; + iVolumeLevel = iVolumePopup->Value(); + SetPresentationVolume( iVolumeLevel ); + } + } + +void CSVGTCustControl::SetPresentationVolume( TInt aVolumeLevel ) + { + TInt volumeInPercent = aVolumeLevel * 10; + + if(volumeInPercent) + { + + iSvgModule->SetAudioVolume(volumeInPercent); + if(iIsVolumeMuted) + { + iIsVolumeMuted = EFalse; + if(iAudioMuteListener) + { + iAudioMuteListener->VolumeMuted(EFalse); + } + + } + } + + else + { + iSvgModule->MuteAudioVolume(); + if(!iIsVolumeMuted) + { + iIsVolumeMuted = ETrue; + if(iAudioMuteListener) + { + iAudioMuteListener->VolumeMuted(ETrue); + } + + } + + } + + } + +TInt CSVGTCustControl::PresentationVolume() const + { + return iVolumeLevel; + } + +void CSVGTCustControl::MrccatoCommand(TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ) + { + switch(aOperationId) + { + case ERemConCoreApiVolumeUp: + { + switch (aButtonAct) + { + case ERemConCoreApiButtonPress: + { + break; + } + case ERemConCoreApiButtonRelease: + { + break; + } + case ERemConCoreApiButtonClick: + { + FilterAndSendCommand(EStdKeyIncVolume); + break; + } + default: + { + break; + } + } + break; + } + case ERemConCoreApiVolumeDown: + { + switch (aButtonAct) + { + case ERemConCoreApiButtonPress: + { + break; + } + case ERemConCoreApiButtonRelease: + { + break; + } + case ERemConCoreApiButtonClick: + { + FilterAndSendCommand(EStdKeyDecVolume); + break; + } + default: + { + break; + } + } + break; + } + default: + { + break; + } + } + } + +void CSVGTCustControl::FilterAndSendCommand(TInt aCommandId) + { + TInt currentVolume = iVolumeLevel; + + if(!iIsForeground) + { + return; + } + + switch(aCommandId) + { + case EStdKeyIncVolume: + currentVolume=(currentVolume< KMaxVolume)? ++currentVolume : KMaxVolume; + break; + case EStdKeyDecVolume: + currentVolume=(currentVolume> KMinVolume)? --currentVolume : KMinVolume; + break; + default: + break; + } + + iVolumePopup->SetValue( currentVolume ); + TRAP_IGNORE(iVolumePopup->ShowVolumePopupL()); + iVolumePopup->DrawNow(); + + TRAP_IGNORE(HandleControlEventL( iVolumePopup, MCoeControlObserver::EEventStateChanged )); +} + +EXPORT_C void CSVGTCustControl::AddListener(MSvgCustControlListener *aListener, TCustControlListener aType) + { + if(aType == EAudioListener) + { + iAudioMuteListener = (MSvgAudioMuteListener *)aListener; + } + + } +TInt CSVGTCustControl::GetPrevVolume() const + { + return iPrevVolume; + } +#endif //RD_SVGT_AUDIO_SUPPORT + +//TOUCH SUPPORT END + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTDrmHelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTDrmHelper.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,547 @@ +/* +* Copyright (c) 2004,2005 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: DRM helper for svgt files. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SVGTDrmHelper.h" + +// CONSTANTS + +const TUint32 KSVGTCountConstraint = 3; +const TInt KSVGTTimeConstraint = 7; +const TInt KSVGTSecondsInDay = 86400; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::CSVGTDrmHelper +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSVGTDrmHelper::CSVGTDrmHelper() : + iEnv(CCoeEnv::Static()) + { + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSVGTDrmHelper::ConstructL() + { + iDrmHelper = CDRMHelper::NewL( *iEnv ); + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSVGTDrmHelper* CSVGTDrmHelper::NewL() + { + CSVGTDrmHelper* self = CSVGTDrmHelper::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSVGTDrmHelper* CSVGTDrmHelper::NewLC() + { + CSVGTDrmHelper* self = new(ELeave) CSVGTDrmHelper(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::~CSVGTDrmHelper +// Destructor +// ----------------------------------------------------------------------------- +// +CSVGTDrmHelper::~CSVGTDrmHelper() + { + delete iRightsConstraints; + + // Delete the DRM Helper + delete iDrmHelper; + // Reset the environment pointer + iEnv = NULL; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::IsPreviewL +// ----------------------------------------------------------------------------- +// +TBool CSVGTDrmHelper::IsPreviewL( RFile& aFileHandle ) + { + LoadUsageRigthsInfoL( aFileHandle ); + + TSVGTRightsStatus rightsStatus; + GetUsageRightsStatus( rightsStatus ); + return ( rightsStatus == ESVGTPreview ); + + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::CheckRightsAmountL +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::CheckRightsAmountL( RFile& aFileHandle ) + { + LoadUsageRigthsInfoL( aFileHandle ); + if ( iProtected ) + { + return iDrmHelper->CheckRightsAmountL( aFileHandle ); + } + else + { + return 0; + } + } +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetDrmDetailsL +// ----------------------------------------------------------------------------- +// +void CSVGTDrmHelper::GetDrmDetailsL( RFile& aFileHandle, + TBool& aRightsValid, TBool& aIsSeparateDeliveryNS, + TBool& aIsProtected ) + { + + + LoadUsageRigthsInfoL( aFileHandle ); + + aIsProtected = IsProtected(); + + if( !aIsProtected ) + { + return; + } + + TSVGTRightsStatus rightsStatus; + GetUsageRightsStatus( rightsStatus ); + aRightsValid = ( rightsStatus == ESVGTFull ) || + ( rightsStatus == ESVGTRestricted ) || + ( rightsStatus == ESVGTPreview ); + + + // Creates a handle to content handled via CAF + CContent *content = CContent::NewLC( aFileHandle ); + content->GetAttribute( EIsForwardable, aIsSeparateDeliveryNS ); + CleanupStack::PopAndDestroy( content ); + return; + + } + + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::LoadUsageRigthsInfoL +// ----------------------------------------------------------------------------- +// +void CSVGTDrmHelper::LoadUsageRigthsInfoL( RFile& aFileHandle ) + { + + delete iRightsConstraints; + iRightsConstraints = NULL; + //flag to check for SD protection + iIsSeparateDelivery=0; + // Creates a handle to content handled via CAF + CContent *content = CContent::NewLC( aFileHandle ); + content->GetAttribute( EIsProtected, iProtected ); + content->GetAttribute( EDeliveryMethod, iIsSeparateDelivery ); + CleanupStack::PopAndDestroy( content ); + + if ( iProtected ) + { + + CDRMHelperRightsConstraints* ignore1 = NULL; + CDRMHelperRightsConstraints* ignore2 = NULL; + CDRMHelperRightsConstraints* ignore3 = NULL; + + + TRAPD(error, iDrmHelper->GetRightsDetailsL(aFileHandle, + ContentAccess::EView, + iExpired, + iSendingAllowed, + ignore1, + iRightsConstraints, + ignore2, + ignore3)); + + // Delete ignored constraints + delete ignore1; + ignore1 = NULL; + delete ignore2; + ignore2 = NULL; + delete ignore3; + ignore3 = NULL; + + if ( error == KErrCANoRights ) + { + delete iRightsConstraints; + iRightsConstraints = NULL; + } + else + { + User::LeaveIfError(error); + } + } + else + { + iExpired = EFalse; + iSendingAllowed = ETrue; + } + + iDrmHelper->CanSetAutomated(aFileHandle, iCanSetAutomated); + + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetUsageRightsStatus +// ----------------------------------------------------------------------------- +// +void CSVGTDrmHelper::GetUsageRightsStatus(TSVGTRightsStatus& aStatus) + { + if (!iProtected) + { + aStatus = ESVGTFull; + } + else if (iRightsConstraints) + { + if (iExpired) + { + aStatus = ESVGTExpired; + } + else if (iRightsConstraints->IsPreview()) + { + if(!(iIsSeparateDelivery==EOmaDrm2||iIsSeparateDelivery==EOmaDrm1SeparateDelivery)) + { + aStatus = ESVGTPreview; + } + } + else if (iRightsConstraints->FullRights()) + { + aStatus = ESVGTFull; + } + else + { + TTime time; + TTime startTime; + + time.HomeTime(); + TInt error = GetStartTime(startTime); + + // Check that usage time has already started + if (!error && time < startTime) + { + aStatus = ESVGTExpired; + } + else + { + aStatus = ESVGTRestricted; + } + } + } + else + { + aStatus = ESVGTMissing; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetExpireStatus +// ----------------------------------------------------------------------------- +// +void CSVGTDrmHelper::GetExpireStatus(TBool& aAboutToExpire, + TSVGTExpireConstraint& aConstraint, + TInt& aCountLeft, + TInt& aDaysLeft) + { + TSVGTRightsStatus status; + GetUsageRightsStatus(status); + + if (status == ESVGTRestricted) + { + TUint32 count = 0; + TInt countError = GetCount(count); + + TTime endTime; + TInt timeError = GetEndTime(endTime); + TTime currentTime; + currentTime.HomeTime(); + TInt diff = endTime.DaysFrom(currentTime).Int(); + + TTimeIntervalSeconds interval; + TInt intervalError = GetInterval(interval); + TInt intervalDiff = 0; + if (!intervalError) + { + TTime intervalStart; + TTimeIntervalSeconds secondsFromStart; + + if (!GetIntervalStart(intervalStart)) + { + // No error => interval has already started + currentTime.SecondsFrom(intervalStart, secondsFromStart); + intervalDiff = + (interval.Int() - secondsFromStart.Int()) / KSVGTSecondsInDay; + } + else + { + // Error occurred => interval not started yet + intervalDiff = interval.Int() / KSVGTSecondsInDay; + } + } + + if (!countError && count <= KSVGTCountConstraint && + ((!timeError && diff <= KSVGTTimeConstraint) || + (!intervalError && intervalDiff <= KSVGTTimeConstraint))) + { + // Count and time or interval contraints about to expire + aConstraint = ESVGTCountAndTime; + aCountLeft = count; + aAboutToExpire = ETrue; + + if (!timeError && !intervalError) + { + // Both constraints exist => use smaller one + aDaysLeft = Min(diff, intervalDiff); + } + else if (!timeError) + { + // Only time constraint exists => use it + aDaysLeft = diff; + } + else + { + // Only interval constraint exists => use it + aDaysLeft = intervalDiff; + } + } + else if (!countError && count <= KSVGTCountConstraint) + { + // Count constraint about to expire + aConstraint = ESVGTCount; + aCountLeft = count; + aAboutToExpire = ETrue; + } + else if ((!timeError && diff <= KSVGTTimeConstraint) || + (!intervalError && intervalDiff <= KSVGTTimeConstraint)) + { + // Time or interval constraint about to expire + aConstraint = ESVGTTime; + aAboutToExpire = ETrue; + + if (!timeError && !intervalError) + { + // Both constraints exist => use smaller one + aDaysLeft = Min(diff, intervalDiff); + } + else if (!timeError) + { + // Only time constraint exists => use it + aDaysLeft = diff; + } + else + { + // Only Interval constraint exists => use it + aDaysLeft = intervalDiff; + } + } + else + { + // No constraint about to expire + aAboutToExpire = EFalse; + aConstraint = ESVGTNone; + } + } + else + { + // Non-restricted object cannot expire + aAboutToExpire = EFalse; + } + } + + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::SendingAllowed +// ----------------------------------------------------------------------------- +// +TBool CSVGTDrmHelper::SendingAllowed() const + { + return iSendingAllowed; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetCount +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::GetCount(TUint32& aCount) + { + TInt error = KErrNone; + + if (!iProtected) + { + error = KErrNotFound; + } + else if (iRightsConstraints) + { + TUint32 ignore; + TRAP(error, iRightsConstraints->GetCountersL(aCount, ignore)); + } + else + { + error = KErrNotReady; + } + + return error; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetStartTime +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::GetStartTime(TTime& aStartTime) + { + TInt error = KErrNone; + + if (!iProtected) + { + error = KErrNotFound; + } + else if (iRightsConstraints) + { + TRAP(error, iRightsConstraints->GetStartTimeL(aStartTime)); + } + else + { + error = KErrNotReady; + } + + return error; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetEndTime +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::GetEndTime(TTime& aEndTime) + { + TInt error = KErrNone; + + if (!iProtected) + { + error = KErrNotFound; + } + else if (iRightsConstraints) + { + TRAP(error, iRightsConstraints->GetEndTimeL(aEndTime)); + } + else + { + error = KErrNotReady; + } + + return error; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetInterval +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::GetInterval(TTimeIntervalSeconds& aInterval) + { + TInt error = KErrNone; + + if (!iProtected) + { + error = KErrNotFound; + } + else if (iRightsConstraints) + { + TRAP(error, iRightsConstraints->GetIntervalL(aInterval)); + } + else + { + error = KErrNotReady; + } + + return error; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::GetIntervalStart +// ----------------------------------------------------------------------------- +// +TInt CSVGTDrmHelper::GetIntervalStart(TTime& aStartTime) + { + TInt error = KErrNone; + + if (!iProtected) + { + error = KErrNotFound; + } + else if (iRightsConstraints) + { + TRAP(error, iRightsConstraints->GetIntervalStartL(aStartTime)); + } + else + { + error = KErrNotReady; + } + + return error; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::IsProtected +// ----------------------------------------------------------------------------- +// +TBool CSVGTDrmHelper::IsProtected() const + { + return iProtected; + } + +// ----------------------------------------------------------------------------- +// CSVGTDrmHelper::CanSetAutomated +// ----------------------------------------------------------------------------- +// +TBool CSVGTDrmHelper::CanSetAutomated() const + { + return iCanSetAutomated; + } + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTPointerHideTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTPointerHideTimer.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2004, 2005 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: This file implements the timer functionality required for the +* hiding of pointer in case of inactivity. +* +*/ + + +// User Includes +#include "SVGTPointerHideTimer.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSVGTPointerHideTimer::CSVGTPointerHideTimer +// Default Constructor. Initialises Timer State Variables. +// ----------------------------------------------------------------------------- +// +CSVGTPointerHideTimer::CSVGTPointerHideTimer( MSVGTPointerInactivityListener* + aListener) : // Listener for the pointer inactivity + CTimer( CActive::EPriorityStandard ), iInactivityListener( aListener ) + { + } + +// ----------------------------------------------------------------------------- +// CSVGTPointerHideTimer::ConstructL +// Second Phase Constructor for CSVGTPointerHideTimer. Adds this object to the +// applications active scheduler. +// ----------------------------------------------------------------------------- +// +void CSVGTPointerHideTimer::ConstructL() + { + // Call the base class ConstructL + CTimer::ConstructL(); + // Add to active scheduler + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CSVGTPointerHideTimer::NewLC +// Factory function for creating CSVGTPointerHideTimer objects. It also +// pushes the created dialog object onto the cleanup stack. +// Returns: CSVGTPointerHideTimer* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSVGTPointerHideTimer* CSVGTPointerHideTimer::NewLC( + MSVGTPointerInactivityListener* aListener ) // Listener for inactivity event + { + CSVGTPointerHideTimer* self = new ( ELeave ) CSVGTPointerHideTimer( + aListener ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTPointerHideTimer::NewL +// Factory function for creating CSVGTPointerHideTimer objects. +// Returns: CSVGTPointerHideTimer* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSVGTPointerHideTimer* CSVGTPointerHideTimer::NewL( + MSVGTPointerInactivityListener* aListener ) // Listener for inactivity event + { + CSVGTPointerHideTimer* self = NewLC( aListener ); + CleanupStack::Pop( self ); + return self; + } + + +// Destructor +CSVGTPointerHideTimer::~CSVGTPointerHideTimer() + { + // Reset the listener + iInactivityListener = NULL; + // Cancel any pending timer events + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CSVGTPointerHideTimer::DoCancel +// Reimplements CActive::DoCancel. +// ----------------------------------------------------------------------------- +// +void CSVGTPointerHideTimer::DoCancel() + { + CTimer::DoCancel(); + } + +// ----------------------------------------------------------------------------- +// CSVGTPointerHideTimer::RunL +// Reimplements CActive::RunL. This function resets the inactivity timer +// so that the control is triggered to hide the pointer when no +// activity occurs for a specified time period +// ----------------------------------------------------------------------------- +// +void CSVGTPointerHideTimer::RunL() + { + // Callback + if ( iInactivityListener ) + { + iInactivityListener->PointerInactivityTimeout(); + } + } + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTProgressBarTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTProgressBarTimer.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2004,2005 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: This file implements the timer functionality required for the +* progress time functionality in the dialog. +* +*/ + + +// User Includes +#include "SVGTProgressBarTimer.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::CSVGTProgressBarTimer +// Default Constructor. Initialises Timer State Variables. +// ----------------------------------------------------------------------------- +// +CSVGTProgressBarTimer::CSVGTProgressBarTimer(MSVGTProgressBarListener* + aListener , TBool aResetInactivityTime ) : + CTimer( CActive::EPriorityHigh ), iListener( aListener ), + iUseInactivityTime( aResetInactivityTime ) + { + } + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::ConstructL +// Second Phase Constructor for CSVGTProgressBarTimer. Adds this object to the +// applications active scheduler. +// ----------------------------------------------------------------------------- +// +void CSVGTProgressBarTimer::ConstructL() + { + // Call the base class ConstructL + CTimer::ConstructL(); + // Add to active scheduler + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::NewLC +// Factory function for creating CSVGTProgressBarTimer objects.It also pushes the +// created dialog object onto the cleanup stack. +// Returns: CSVGTProgressBarTimer* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSVGTProgressBarTimer* CSVGTProgressBarTimer::NewLC( MSVGTProgressBarListener* + aListener , + TBool aResetInactivityTime ) // Listener for timer tick event + { + CSVGTProgressBarTimer* self = new ( ELeave ) CSVGTProgressBarTimer( + aListener , aResetInactivityTime ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::NewL +// Factory function for creating CSVGTProgressBarTimer objects. +// Returns: CSVGTProgressBarTimer* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSVGTProgressBarTimer* CSVGTProgressBarTimer::NewL( MSVGTProgressBarListener* + aListener , + TBool aResetInactivityTime ) // Listener for timer tick event + { + CSVGTProgressBarTimer* self = NewLC( aListener , aResetInactivityTime ); + CleanupStack::Pop( self ); + return self; + } + + +// Destructor +CSVGTProgressBarTimer::~CSVGTProgressBarTimer() + { + // Reset the listener + iListener = NULL; + // Cancel any pending timer events if any. + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::DoCancel +// Reimplements CActive::DoCancel. +// ----------------------------------------------------------------------------- +// +void CSVGTProgressBarTimer::DoCancel() + { + CTimer::DoCancel(); + } + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::RunL +// Reimplements CActive::RunL. This function updates the media time. +// ----------------------------------------------------------------------------- +// +void CSVGTProgressBarTimer::RunL() + { + if ( iUseInactivityTime ) + { + User::ResetInactivityTime(); + } + + // CallBack listener + if ( iListener ) + { + iListener->UpdateProgressBar(); + } + } + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTThumbnailUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTThumbnailUtil.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,303 @@ +/* +* Copyright (c) 2004,2005 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: This file implements the SVGT Thumbnail functionality +* to display SVGT content +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User Includes +#include "SVGTUIControlDbgFlags.hrh" +#include "SVGTThumbnailUtil.h" + +// Constants +// General Constants +const TInt KSccConstMinusOne = -1; +const TInt KSccConstZero = 0; +const TUint KSccBackground = 0xffffffff; + + +// SMIL Fit Value +_LIT( KSccSmilFitValue,"meet" ); + +// ============================ MEMBER FUNCTIONS =============================== +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::GenerateThumbnailLD +// Generate thumbnails for SVGT content. +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSVGTThumbnailUtil::GenerateThumbnailLD( + RFile& aFileHandle, // Filehandle of SVGT + CFbsBitmap& aThumbnailBitmap, // Thumbnail Bitmap + CFbsBitmap& aThumbnailBitmapMask ) // BitMap mask + { + CSVGTThumbnailUtil *tnUtilPtr = CSVGTThumbnailUtil::NewLC( aFileHandle, + aThumbnailBitmap, + aThumbnailBitmapMask ); + TBool retVal = tnUtilPtr->GenerateThumbnail(); + CleanupStack::PopAndDestroy( tnUtilPtr ); + return retVal; + } + + + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::UpdateScreen +// Implements MSvgRequestObserver::UpdateScreen. +// ----------------------------------------------------------------------------- +// +void CSVGTThumbnailUtil::UpdateScreen() + { + } + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::ScriptCall +// Implements MSvgRequestObserver::ScriptCall. +// ----------------------------------------------------------------------------- +// +TBool CSVGTThumbnailUtil::ScriptCall( const TDesC& /*aScript*/, + CSvgElementImpl* /*aCallerElement*/ ) + { + return EFalse; + } + + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::FetchImage +// Implements MSvgRequestObserver::FetchImage. Calls the application call +// back corresponding to this function if exists, else returns EFalse +// indicating to the engine that the image was not retrieved. +// ----------------------------------------------------------------------------- +// +TInt CSVGTThumbnailUtil::FetchImage( const TDesC& /*aUri*/, + RFs& /*aSession*/, RFile& /*aFileHandle*/ ) + { + return KErrNotFound; + } + +TInt CSVGTThumbnailUtil::FetchFont( const TDesC& /* aUri */, + RFs& /* aSession */, RFile& /* aFileHandle */ ) + { + return KErrNotSupported; + } + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil:: GetSmilFitValue +// Implements the MSvgRequestObserver::GetSmilFitValue. +// ----------------------------------------------------------------------------- +// +void CSVGTThumbnailUtil::GetSmilFitValue( TDes& aSmilValue ) + { + aSmilValue.Copy( KSccSmilFitValue ); + } + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::UpdatePresentation +// Implements MSvgRequestObserver::UpdatePresentation. +// ----------------------------------------------------------------------------- +// +void CSVGTThumbnailUtil::UpdatePresentation( const TInt32& + /* aNoOfAnimation */ ) + { + } + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::InitializeEngineL +// Initiliazes the interface with the SVG engine. +// ----------------------------------------------------------------------------- +// +void CSVGTThumbnailUtil::InitializeEngineL() + { + if ( !iSvgModule ) + { + TFontSpec spec; + + if ( !iSVGTBitMapDummy ) + { + // For thumbnails, the user provided bitmap is used, + // Have to give some dummy bitmap to the engine in the constructor. + iSVGTBitMapDummy = new( ELeave ) CFbsBitmap; + User::LeaveIfError( iSVGTBitMapDummy->Create( + TSize( KSccConstZero, KSccConstZero ), EGray2 ) ); + } + + iSvgModule = CSvgEngineInterfaceImpl::NewL( iSVGTBitMapDummy, + this, spec ); + iSvgModule->SetBackgroundColor( KSccBackground ); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::GenerateThumbnail +// Helper function that generates Thumbnail for the SVG content. +// ----------------------------------------------------------------------------- +// +TBool CSVGTThumbnailUtil::GenerateThumbnail() + { + if ( iSvgModule ) + { + MSvgError* result; + result = iSvgModule->PrepareDom( iContentFileHandle, iThumbnailHandle ); + + // NULL is returned, possible out of memory when create error object. + if ( ( !result ) || ( result->HasError() ) ) + { + return EFalse; + } +#ifdef SVGTUICONTROL_DBG_DRM_THUMBNAIL_API_ENABLE + // Set thumbnail mode On + iSvgModule->SetThumbNailMode( ETrue ); +#endif // SVGTUICONTROL_DBG_DRM_THUMBNAIL_API_ENABLE + + // Setup the engine to use the DOM + result = iSvgModule->UseDom( iThumbnailHandle, iThumbnailBitmap ); + if ( result->HasError() && !result->IsWarning() ) + { + return EFalse; + } + + // View Box define for Dom associated frame + iSvgModule->ChooseViewBoxIfNotSet(iThumbnailHandle); + iSvgModule->InitializeEngine(); + iSvgModule->RenderFrame( NULL, 0); + + // Render the Mask Bitmap + iSvgModule->GenerateMask( iThumbnailBitmapMask ); +#ifdef SVGTUICONTROL_DBG_DRM_THUMBNAIL_API_ENABLE + // Set thumbnail mode Off + iSvgModule->SetThumbNailMode( EFalse ); +#endif // SVGTUICONTROL_DBG_DRM_THUMBNAIL_API_ENABLE + + return ETrue; + } + else + { + return EFalse; + } + + } + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::CSVGTThumbnailUtil +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CSVGTThumbnailUtil::CSVGTThumbnailUtil( RFile& aFileHandle ) : + // Thumbnail Variables + iThumbnailHandle( KSccConstMinusOne ), + iContentFileHandle( aFileHandle ) +{ +} + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::ConstructL +// Symbian 2nd phase constructor. +// ----------------------------------------------------------------------------- +// +void CSVGTThumbnailUtil::ConstructL( + CFbsBitmap& aThumbnailBitmap, // Bitmap on which content is to be + // rendered + CFbsBitmap& aThumbnailBitmapMask )// Bitmap Mask + { + // Save the user parameters for later access. + iSvgModule = NULL; + iSVGTBitMapDummy = NULL; + iThumbnailBitmap = &aThumbnailBitmap; + iThumbnailBitmapMask = &aThumbnailBitmapMask; + InitializeEngineL(); + } + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::NewL +// Factory function for creating CSVGTThumbnailUtil objects for thumbnail +// generation. +// Returns: CSVGTThumbnailUtil* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSVGTThumbnailUtil* CSVGTThumbnailUtil::NewL( + RFile& aFileHandle, // File handle of SVGT Content + CFbsBitmap& aThumbnailBitmap, // Bitmap on which content is to be + // rendered + CFbsBitmap& aThumbnailBitmapMask )// Bitmap Mask + { + CSVGTThumbnailUtil* self = CSVGTThumbnailUtil::NewLC( aFileHandle, + aThumbnailBitmap, + aThumbnailBitmapMask ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::NewLC +// Factory function for creating CSVGTThumbnailUtil objects for thumbnail +// generation. +// Returns: CSVGTThumbnailUtil* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSVGTThumbnailUtil* CSVGTThumbnailUtil::NewLC( + RFile& aFileHandle, // File Handle of SVGT Content + CFbsBitmap& aThumbnailBitmap, // Bitmap on which content is to be + // rendered + CFbsBitmap& aThumbnailBitmapMask) // Bitmap Mask + { + CSVGTThumbnailUtil* self = new ( ELeave ) CSVGTThumbnailUtil( + aFileHandle ); + CleanupStack::PushL( self ); + self->ConstructL( aThumbnailBitmap, aThumbnailBitmapMask ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CSVGTThumbnailUtil::~CSVGTThumbnailUtil +// Destructor +// ----------------------------------------------------------------------------- +// +CSVGTThumbnailUtil::~CSVGTThumbnailUtil() + { + if ( iThumbnailHandle != KSccConstMinusOne ) + { + if ( iSvgModule ) + { + iSvgModule->DeleteDom( iThumbnailHandle ); + } + } + + // Dummy bitmap + delete iSVGTBitMapDummy; + + // SVG Engine + delete iSvgModule; + + // Reset the Thumbnail and Mask as this is owned by the caller + iThumbnailBitmap = NULL; + iThumbnailBitmapMask = NULL; + } + + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTUIDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTUIDialog.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,1310 @@ +/* +* Copyright (c) 2004,2005 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: This file implements the SVGT Dialog which +* is used to display SVGT content +* +*/ + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __SERIES60_HELP +#include +#endif // __SERIES60_HELP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//----------- + +// User Includes +#include "SVGTAppObserver.h" +#include "SVGTCustControl.h" +#include "SVGTUIDialog.h" +#include "svgtfileviewdetails.h" + +#include "SVGTUIDialog.hrh" +#include "SvgtDecoratorControl.h" + +const TInt KButtonContainerDisplayTime = 5000000; + +// Constants + +// The Middle softkey has position 3 at button group's stack +const TInt KMiddleSKId=3; +_LIT( KResourceFileName, "Z:SVGTUIControl.rsc" ); +#ifdef _DEBUG +//_LIT( KUnknownCommandStr, "Unknown Command" ); +#endif + +#ifdef __SERIES60_HELP +// Help Context UID = DLL UID3 +const TUid KSvgtHelpContextUid = { 0x101F8749 }; +#endif // __SERIES60_HELP + +// Times longer than this many seconds are shown using the long format +const TInt KShortTimeLimit = 59*60 + 59; + +// Maximum number of seconds shown in the time duration field +const TInt KMaxTotalTimeSeconds = 9*60*60 + 59*60 + 59; // 59:59 + +// Maximum length for both the time elapsed/remaining string "mm:ss/mm:ss" +// and post-recording text "Length: mm:ss" +const TInt KMaxTimeTextLength = 40; + +// This many microseconds in a second +const TInt KMicro = 1000000; + +// Key Constant for toggling between Full/Normal Screen +const TInt KSvgScreenToggleKey = '*'; +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::CSVGTUIDialog +// Default Constructor. Initialises Dialog State Variables. +// ----------------------------------------------------------------------------- +// +CSVGTUIDialog::CSVGTUIDialog() + { + // SVGT Viewer State Variables + iSaveEnable = EFalse; + iPreview = EFalse; + iCustControl = NULL; + iAppObserver = NULL; + iIsVolumeMuted = EFalse; + iLastCommandID = EAknSoftkeyOptions; + iIsButtonContainerVisible = ETrue; + iQuietExitWhenOrientationChange = EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::ConstructL +// Second Phase Constructor for CSVGTUIDialog. Opens resource file, reads the +// dialog menu resource and calls CAknDialog::ConstructL with the resource as +// param. +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::ConstructL() + { + // Find which drive this DLL is installed. + TFileName fileName; + + // Get the full resource file + TParse lParse; + + // Add the resource dir + lParse.Set( KResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL); + + // Get the filename with full path + fileName = lParse.FullName(); + + BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), fileName ); //for + // localization + iResourceOffset = iEikonEnv->AddResourceFileL( fileName ); + + // Read time format strings from AVKON resource + iTimeFormatShort = + iEikonEnv->AllocReadResourceL( R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO ); + iTimeFormatLong = + iEikonEnv->AllocReadResourceL( R_QTN_TIME_DURAT_LONG ); + + iBtnCntrTimer = CPeriodic::NewL( CActive::EPriorityStandard); + CAknDialog::ConstructL( R_SVGT_DIALOG_MENUBAR ); + + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::NewL +// Factory function for creating CSVGTUIDialog objects. +// Returns: CSVGTUIDialog* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSVGTUIDialog* CSVGTUIDialog::NewL() + { + CSVGTUIDialog* self = CSVGTUIDialog::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::NewLC +// Factory function for creating CSVGTUIDialog objects. It also pushes the +// created dialog object onto the cleanup stack. +// Returns: CSVGTUIDialog* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +EXPORT_C CSVGTUIDialog* CSVGTUIDialog::NewLC() + { + CSVGTUIDialog* self = new ( ELeave ) CSVGTUIDialog(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// Destructor +CSVGTUIDialog::~CSVGTUIDialog() + { + if ( iResourceOffset != 0 ) + { + iEikonEnv->DeleteResourceFile( iResourceOffset ); + } + // Custom Control will be automatically destroyed by dialog framework + iCustControl = NULL; + // App Observer is reset. + iAppObserver = NULL; + + // Set the text in status pane to the stored one + if (iAppTitleText) + { + // Get the Status Pane Control + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + // Get the title pane + CAknTitlePane* tp = NULL; + TRAPD( errGetControl, + tp = static_cast< CAknTitlePane* >( sp->ControlL( + TUid::Uid( EEikStatusPaneUidTitle ) ) ) ); + if ( errGetControl == KErrNone && tp ) + { + //set application name in the title pane + TRAPD( errSetText, + tp->SetTextL(*iAppTitleText) ); + if ( errSetText != KErrNone ) + { + // No error handling here + } + } + + delete iAppTitleText; + iAppTitleText = NULL; + + delete iProgressText; + iProgressText = NULL; + } + + // Clear the Navi-Pane Decorator + if ( iNaviDecorator ) + { + // Restore the old navi-pane + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + + CAknNavigationControlContainer* np = NULL; + TRAPD( errGetNaviControl, + np = static_cast< CAknNavigationControlContainer* > + ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ) ); + if ( errGetNaviControl == KErrNone && np ) + { + TRAPD( errPushDefNaviControl, + np->PushDefaultL ()); // Set default. + if ( errPushDefNaviControl != KErrNone ) + { + // No error handling here. + } + } + delete iNaviDecorator; + } + iCbaGroup=NULL; + // Callers responsibility of closing the file handle. + iFileHandlePtr = NULL; + // Delete the format strings + delete iTimeFormatShort; + delete iTimeFormatLong; + + delete iBtnCntrTimer; + } + +TInt CSVGTUIDialog::ButtonContainerTimerCallBack(TAny* aAny) + { + CSVGTUIDialog* dlg = (CSVGTUIDialog*)(aAny); + dlg->iBtnCntrTimer->Cancel(); + dlg->iIsButtonContainerVisible = EFalse; + TRAP_IGNORE(dlg->SwitchDialogLayoutL( ETrue )); + + return KErrNone; + } + +TBool CSVGTUIDialog::HandleCustControlPointerEventL(const TPointerEvent& /* aPointerEvent */) + { + TBool fullScreenStatus; + TBool isEventHandled = EFalse; + TCallBack callBack(CSVGTUIDialog::ButtonContainerTimerCallBack, this); + + iBtnCntrTimer->Cancel(); + + if(iIsButtonContainerVisible) + { + return isEventHandled; + } + + iCustControl->GetCurrentFullScreenStatus(fullScreenStatus); + if(fullScreenStatus) + { + TRect appRect = iEikonEnv->EikAppUi()->ApplicationRect(); + + if(iBtnGrpPos.iX && iBtnGrpPos.iY) + SetSize(TSize(appRect.Width() - iBtnGrpSize.iWidth, appRect.Height() - iBtnGrpSize.iHeight)); + if(iBtnGrpPos.iX) + SetSize(TSize(appRect.Width() - iBtnGrpSize.iWidth, appRect.Height())); + else if(iBtnGrpPos.iY) + SetSize(TSize(appRect.Width(), appRect.Height() - iBtnGrpSize.iHeight)); + + CEikButtonGroupContainer& bgc = ButtonGroupContainer(); + //bgc.MakeVisible(ETrue); + //bgc.SetSize(iBtnGrpSize); + //bgc.SetExtent(iBtnGrpPos, iBtnGrpSize); + //bgc.DrawDeferred(); + iIsButtonContainerVisible = ETrue; + isEventHandled = ETrue; + iBtnCntrTimer->Start(KButtonContainerDisplayTime, 0, callBack); + } + + return isEventHandled; + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::ExecuteLD +// Reimplements CAknDialog::ExecuteLD. It initialises the member variables of +// the class and calls CAknDialog::ExecuteLD() with the dialog resource. +// ----------------------------------------------------------------------------- +// +TInt CSVGTUIDialog::ExecuteLD( + RFile& aFileHandle, // Filename of SVGT Content + MSvgtAppObserver* ptr ) // Applications Implementation of callbacks + { + // Save this pointer since there are leaving functions in the flow + CleanupStack::PushL( this ); + + iFileHandlePtr = &aFileHandle; + iIsFileHandleValid = ETrue; + iAppObserver = ptr; + iQuietExitWhenOrientationChange = iAppObserver->ExitWhenOrientationChange(); + + // Get the Status Pane Control + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + + // Get the Title Pane Control + CAknTitlePane* tp = static_cast< CAknTitlePane* >( sp->ControlL( + TUid::Uid( EEikStatusPaneUidTitle ) ) ); + + // Store the Application's title text + iAppTitleText = HBufC::NewL(tp->Text()->Length()); + *iAppTitleText = *tp->Text(); + + // Display the filename in the title pane of application + + TFileName lFileName; + // Get the file name from the file handle + if ( !aFileHandle.Name( lFileName ) ) + { + TParse p; + p.Set( lFileName, NULL, NULL); + + // SetTextL also ensures that if the length exceeds the layout space + // available the text is truncated from the end. + tp->SetTextL( p.NameAndExt() ); // p.NameAndExt() gives "Filename.ext" + + } + + CSVGTDrmHelper *drmHelper = CSVGTDrmHelper::NewLC(); + // Check if the "Save" Option should be shown or not. + // The calling application of the dialog decides this. + if ( iAppObserver ) + { + iSaveEnable = iAppObserver->CanShowSave(); + } + + // Check Rights Status + iPreview = drmHelper->IsPreviewL( aFileHandle ); + + CleanupStack::PopAndDestroy( drmHelper ); + + // ExecuteLD will delete this, so we have to Pop it... + CleanupStack::Pop( this ); + + if ( iPreview ) + { + return CAknDialog::ExecuteLD( R_SVGT_VIEWER_PREVIEW_DIALOG ); + } + else + { + return CAknDialog::ExecuteLD( R_SVGT_VIEWER_DIALOG ); + } + + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::FormatTimeL +// Convert a time given in seconds to a descriptor. +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::FormatTimeL( + const TUint& aDuration, // duration in + // seconds + TDes& aBuf // Buffer holding formatted + // string + ) const + + { + TTime time( TInt64( aDuration ) * KMicro ); + + if ( time.Int64() > TInt64( KMaxTotalTimeSeconds ) * KMicro ) + { + time = TInt64( KMaxTotalTimeSeconds ) * KMicro; + } + + if ( time.Int64() < TInt64( KShortTimeLimit ) * KMicro ) + { + time.FormatL( aBuf, *iTimeFormatShort ); + } + else + { + time.FormatL( aBuf, *iTimeFormatLong ); + } + + // Arabic number conversion + AknTextUtils::LanguageSpecificNumberConversion( aBuf ); + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::SaveNeededL +// This function checks if Save is displayed and saving is already done +// and prompts a confirmation query to the user and then calls DoSaveL +// ----------------------------------------------------------------------------- +// +TBool CSVGTUIDialog::SaveNeededL( TInt aButtonId ) + { + if ( ( iAppObserver->CanShowSave() || + iCustControl->IsTextContentChanged()) && + !iAppObserver->IsSavingDone() && + !iPreview && + LaunchSaveQueryDialogL() ) + { + iAppObserver->DoSaveL( aButtonId ); + return ETrue; + } + else + { + return EFalse; + } + } +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::LaunchSaveQueryDialogL +// ----------------------------------------------------------------------------- +// +TBool CSVGTUIDialog::LaunchSaveQueryDialogL() const + { + HBufC* titleText = NULL; + + TFileName lFileName; + if ( iFileHandlePtr ) + { + iFileHandlePtr->Name( lFileName ); + } + else + { + return EFalse; + } + titleText = StringLoader::LoadLC( R_QTN_SVGT_QUERY_CONF_SAVE_DOWNLOADED, + lFileName ); + + CAknQueryDialog* query = CAknQueryDialog::NewL( ); + TBool retVal = query->ExecuteLD( R_SVGT_CONFIRMATION_QUERY_YES_NO, + *titleText ); + CleanupStack::PopAndDestroy( titleText ); + + if ( retVal == EAknSoftkeyOk || retVal == EAknSoftkeyYes ) + { + return ETrue; + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::SwitchDialogLayoutL +// This function changes the layout of the dialog +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::SwitchDialogLayoutL( TBool aIsFullScreen ) + { + if ( aIsFullScreen ) + { + // Full Screen Mode + // Expand Dialog Window to occupy full screen + SetExtentToWholeScreen(); + // Hide the Status Pane + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + sp->MakeVisible( EFalse ); + + // Hide the CBA + CEikButtonGroupContainer* cp = &( ButtonGroupContainer() ); + //cp->SetExtent( TPoint( 0, 0 ), TSize( 0, 0) ); + cp->SetSize( TSize( 0, 0) ); + + } + else + { + // Normal Screen Mode + // Show the Status Pane + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + sp->MakeVisible( ETrue ); + + // Restore the size and position of the dialog + // to normal screen size(Client Rectangle) + TRect lRect; + iCustControl->GetNormalScreenLayoutRect( lRect ); + SetSizeAndPosition( lRect.Size() ); + // Restore original layout + Layout(); + iBtnCntrTimer->Cancel(); + } + + iIsButtonContainerVisible = !aIsFullScreen; + + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::DynInitMenuPaneL +// Reimplements CAknDialog::DynInitMenuPaneL inorder to support dynamic hiding +// of menu items based on current state of the viewer. +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::DynInitMenuPaneL( + TInt aResourceId, // Resource Id for which this func is called + CEikMenuPane* aMenuPane ) // Menupane object pointer for manipulation + { + iBtnCntrTimer->Cancel(); + +if( + (aResourceId==R_SVGT_DIALOG_MENU) + &&iCustControl->GetMSKLabelFlag(EAknSoftkeyContextOptions) + &&(aMenuPane) + ) + { + iCustControl->ChangeMSKLabelFlag(EAknSoftkeyContextOptions); + if ( iAppObserver ) + { + iSaveEnable = iAppObserver->CanShowSave(); + } + aMenuPane->SetItemDimmed(ESvgtDlgSaveCommand, + !( iSaveEnable|| + iCustControl->IsTextContentChanged() ) ); + + TSvgtViewerAnimStatus lAnimState; + iCustControl->GetCurrentAnimState( lAnimState ); + TBool isLoadingDone = iCustControl->IsProcessDone(); + aMenuPane->SetItemDimmed(ESvgtDlgPlayCommand, + !isLoadingDone || + (lAnimState == ESvgAnimPlayingState )); + aMenuPane->SetItemDimmed(ESvgtDlgPauseCommand, + !isLoadingDone || + (lAnimState != ESvgAnimPlayingState )); + aMenuPane->SetItemDimmed(ESvgtDlgStopCommand, + !isLoadingDone || + (lAnimState ==ESvgAnimStoppedState)); + + + //All the other menu items are dimmed since they are not the part of + // context menu + aMenuPane->SetItemDimmed(ESvgtDlgZoomInCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgZoomOutCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgSelectTextCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgEditTextCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgLoopCascadeCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgFindTextCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgFullScreenCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgNormalScreenCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgListRotateCascadeCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgViewDetailsCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgListDownloadCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgHelpCommand,ETrue); + aMenuPane->SetItemDimmed(EAknCmdExit,ETrue); + #ifdef RD_SVGT_AUDIO_SUPPORT + aMenuPane->SetItemDimmed( ESvgtDlgMuteCommand,ETrue); + aMenuPane->SetItemDimmed( ESvgtDlgUnmuteCommand,ETrue); + aMenuPane->SetItemDimmed(ESvgtDlgSetVolumeCommand,ETrue); + #endif //RD_SVGT_AUDIO_SUPPORT + } + + else if ( ( aResourceId == R_SVGT_DIALOG_MENU ) && ( aMenuPane ) ) + { + if ( iAppObserver ) + { + iSaveEnable = iAppObserver->CanShowSave(); + } + aMenuPane->SetItemDimmed( + ESvgtDlgSaveCommand, + !( iSaveEnable || + iCustControl->IsTextContentChanged() ) ); + TInt zoomLvl = 0; + iCustControl->GetCurrentZoomLevel( zoomLvl ); + aMenuPane->SetItemDimmed( + ESvgtDlgZoomOutCommand, + ( zoomLvl == 0 ) ); + + // Select Text Option + aMenuPane->SetItemDimmed( ESvgtDlgSelectTextCommand, + !iCustControl->IsTextSelectOn() ); + + // Edit Text Option + aMenuPane->SetItemDimmed( ESvgtDlgEditTextCommand, + !iCustControl->IsTextEditOn() ); + + if ( !iCustControl->IsAnimationPresent() ) + { + // No Animations case - dim the Play/Pause/Stop buttons + aMenuPane->SetItemDimmed( + ESvgtDlgPlayCommand, + ETrue ); + + aMenuPane->SetItemDimmed( + ESvgtDlgPauseCommand, + ETrue ); + + aMenuPane->SetItemDimmed( + ESvgtDlgStopCommand, + ETrue ); + aMenuPane->SetItemDimmed( + ESvgtDlgLoopCascadeCommand, + ETrue ); + } + else + { + // Animations case - normal behaviour + // Play/Pause Options + TSvgtViewerAnimStatus lAnimState; + iCustControl->GetCurrentAnimState( lAnimState ); + TBool isLoadingDone = iCustControl->IsProcessDone(); + + aMenuPane->SetItemDimmed( + ESvgtDlgPlayCommand, + !isLoadingDone || + ( lAnimState == ESvgAnimPlayingState ) ); + + aMenuPane->SetItemDimmed( + ESvgtDlgPauseCommand, + !isLoadingDone || + ( lAnimState != ESvgAnimPlayingState ) ); + + aMenuPane->SetItemDimmed( + ESvgtDlgStopCommand, + !isLoadingDone || + ( lAnimState == ESvgAnimStoppedState ) ); + // Loop Option + aMenuPane->SetItemDimmed( + ESvgtDlgLoopCascadeCommand, + !isLoadingDone || + !iCustControl->IsLoopAllowed() ); + } +#ifdef RD_SVGT_AUDIO_SUPPORT + aMenuPane->SetItemDimmed( ESvgtDlgMuteCommand, iIsVolumeMuted ); + + aMenuPane->SetItemDimmed( ESvgtDlgUnmuteCommand, !iIsVolumeMuted ); +#endif //RD_SVGT_AUDIO_SUPPORT + TBool isFullScreenOn; + iCustControl->GetCurrentFullScreenStatus( isFullScreenOn ); + aMenuPane->SetItemDimmed( + ESvgtDlgFullScreenCommand, + isFullScreenOn ); + + aMenuPane->SetItemDimmed( + ESvgtDlgNormalScreenCommand, + !isFullScreenOn ); + + aMenuPane->SetItemDimmed( + ESvgtDlgFindTextCommand, + EFalse ); + + aMenuPane->SetItemDimmed( + ESvgtDlgViewDetailsCommand, + !iIsFileHandleValid); + aMenuPane->SetItemDimmed( + ESvgtDlgListDownloadCommand, + !iAppObserver->CanShowDownload() ); + } + else + { + if ( ( aResourceId == R_SVGT_LOOP_SUBMENU ) && ( aMenuPane ) ) + { + // Loop On/Off Submenu option + TBool isLoopOn = ETrue; + iCustControl->GetCurrentLoopStatus( isLoopOn ); + if ( isLoopOn ) + { + aMenuPane->SetItemButtonState( ESvgtDlgLoopOnCommand, + EEikMenuItemSymbolOn ); + aMenuPane->SetItemButtonState( ESvgtDlgLoopOffCommand, + EEikMenuItemSymbolIndeterminate ); + } + else + { + aMenuPane->SetItemButtonState( ESvgtDlgLoopOffCommand, + EEikMenuItemSymbolOn ); + aMenuPane->SetItemButtonState( ESvgtDlgLoopOnCommand, + EEikMenuItemSymbolIndeterminate ); + } + } + } + } +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::DrawMSKLabelL +// Reimplements MSVGTMSKImplL::DrawMSKLabelL.This function is called by the +// CSVGTCustControl whenever MSK label needs to be updated. +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::DrawMSKLabelL(TInt aResourceID,TInt aCommandID) +{ + iLastCommandID = aCommandID; + iCbaGroup= &( ButtonGroupContainer() ); + HBufC* middleSKText = StringLoader::LoadLC(aResourceID ); + iCbaGroup->AddCommandToStackL(KMiddleSKId, aCommandID,*middleSKText ); + iCbaGroup->MakeCommandVisible(aCommandID, ETrue); + CleanupStack::PopAndDestroy( middleSKText ); + iCbaGroup->DrawDeferred(); +} + +// ---------------------------------------------------------------------------- +// CSVGTUIDialog::RemoveMSKLabel +// Reimplements MSVGTMSKImplL::RemoveMSKLabel.This function is called by the +// CSVGTCustControl before adding new MSK label to button group stack. +// ---------------------------------------------------------------------------- +// +void CSVGTUIDialog::RemoveMSKLabel() +{ + iCbaGroup= &( ButtonGroupContainer() ); + MEikButtonGroup* lButtonGroup=iCbaGroup->ButtonGroup(); + TInt lCmdID=lButtonGroup->CommandId(KMiddleSKId); + iCbaGroup->RemoveCommandFromStack(KMiddleSKId,lCmdID); + iCbaGroup->DrawDeferred(); + +} + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::OkToExitL +// Reimplements CAknDialog::OkToExitL inorder to display custom menu and +// trap the back softkey to provide restore view functionality/exit. +// ----------------------------------------------------------------------------- +// +TBool CSVGTUIDialog::OkToExitL( TInt aButtonId ) // ButtonId of button pressed + { + if ( aButtonId == EAknSoftkeyOptions ) + { + DisplayMenuL(); + return EFalse; + } + else if(aButtonId==EAknSoftkeyContextOptions) + { + //Flag to differentiate context menu from normal options menu + iCustControl->ChangeMSKLabelFlag(aButtonId); + + //Display context menu + iMenuBar->SetContextMenuTitleResourceId( R_SVGT_DIALOG_MENUBAR ); + iMenuBar-> TryDisplayContextMenuBarL(); + + //No task swapper for context menu + iMenuBar->SetMenuType(CEikMenuBar::EMenuOptionsNoTaskSwapper); + + //Restore the options menu + iMenuBar->SetMenuTitleResourceId( R_SVGT_DIALOG_MENUBAR ); + iMenuBar->SetMenuType(CEikMenuBar::EMenuOptions); + + return EFalse; + } + else if(aButtonId ==EAknSoftkeySave) + { + //Save the content + ProcessCommandL(ESvgtDlgSaveCommand); + return EFalse; + } + + else + { + if ( aButtonId == EAknSoftkeyBack ) + { + // Check whether full screen is active + TBool isFullScreenActive; + iCustControl->GetCurrentFullScreenStatus( isFullScreenActive ); + + if ( isFullScreenActive ) + { + // Yes[FullScreen]: revert back to normal screen + ProcessCommandL( ESvgtDlgNormalScreenCommand ); + return EFalse; + } + + // Check whether content is zoomed in + TInt zoomLvl = 0; + iCustControl->GetCurrentZoomLevel( zoomLvl ); + + if ( zoomLvl > 0 ) + { + // Yes[ZoomedIn]: restore to original view + iCustControl->ProcessViewerCommandL( + ESvgtDlgZoomOptimalCommand ); + return EFalse; + } + return !SaveNeededL( aButtonId ); + } + else + { + // Ignore Select Key.. + if ( aButtonId == EAknSoftkeySelect || aButtonId == EEikBidOk ) + { + //If animation on mousedown/mouseup is present trigger it + if(iCustControl->GetMSKLabelFlag(aButtonId)) + { + TKeyEvent lKeyEvent; + lKeyEvent.iScanCode=EStdKeyDevice3; + iCustControl->OfferKeyEventL(lKeyEvent,EEventKey); + iCustControl->ChangeMSKLabelFlag(aButtonId); + TRAP_IGNORE(iCustControl->SetMSKLabelL()); + } + + + + // Select button pressed, ignore. + return EFalse; + } + if ( aButtonId == EEikCmdExit ) + { + return !SaveNeededL( aButtonId ); + } + } + + } + + return ETrue; + } + + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::IsLoadingDone +// This function is called by the application to check whether the +// loading of the svg content is done. +// ----------------------------------------------------------------------------- +// +TBool CSVGTUIDialog::IsLoadingDone() + { + return iCustControl->IsProcessDone(); + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::HandleApplicationForegroundEvent +// This API is used by the application to give background/foreground events +// to the Dialog. The dialog inturn passes the events to custom control. +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::HandleApplicationForegroundEvent( TBool aForeground ) + { + if ( iCustControl ) + { + iCustControl->HandleApplicationForegroundEvent( aForeground ); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::StopUsingContentFileHandle +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::StopUsingContentFileHandle() + { + // NOTE: Currently the custom control and the engine are + // not actively using the File handle. e.g. Engine uses + // the file handle only during loading of content. And custom + // control uses it when File Details are shown. + // If required, in future need to pass this event to custom control. + // Block the filedetails option now. + iIsFileHandleValid = EFalse; + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::StartUsingContentFileHandle +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::StartUsingContentFileHandle() + { + iIsFileHandleValid = ETrue; + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::IsTextContentChanged +// Function used by the client to check if text in the content was modified, +// to check if save is needed. +// ----------------------------------------------------------------------------- +// +TBool CSVGTUIDialog::IsTextContentChanged() + { + return (iCustControl->IsTextContentChanged()); + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::SaveSvgDom +// Function used by the client to save the modified svg content +// ----------------------------------------------------------------------------- +// +TInt CSVGTUIDialog::SaveSvgDom( const TDesC& aFileName ) + { + if ( iCustControl ) + { + return ( iCustControl->SaveSvgDom( aFileName ) ); + } + else + { + return KErrGeneral; + } + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::SaveComplete +// Function used by the client to indicate saving is complete +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::SaveComplete( const TInt aError ) + { + if ( !aError ) + { + // Indicate to Custom Control to perform any cleanup + // once save is complete + iCustControl->SaveComplete( aError ); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::ProcessCommandL +// Reimplements CAknDialog::ProcessCommandL inorder to handle dialog menu +// commands. +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::ProcessCommandL( TInt aCommandId ) // Command Id + { + // The Commands are handled by the custom CCoe Control and + // a boolean varialble is used inorder to keep track whether + // the control command processing needs to be invoked or not. + TBool procCmdReqd = ETrue; + CAknDialog::ProcessCommandL( aCommandId ); + switch ( aCommandId ) + { + case ESvgtDlgSaveCommand: + if ( iAppObserver ) + { + iAppObserver->DoSaveL( ESvgtDlgCommand1 ); + } + break; + case ESvgtDlgHelpCommand: +#ifdef __SERIES60_HELP + procCmdReqd = EFalse; + HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), + iEikonEnv->EikAppUi()->AppHelpContextL() ); +#endif // __SERIES60_HELP + break; + case ESvgtDlgFindTextCommand: + break; + case ESvgtDlgViewDetailsCommand: + break; + case ESvgtDlgListDownloadCommand: + { + if ( iAppObserver ) + { + iAppObserver->DisplayDownloadMenuL(); + } + break; + } + case ESvgtDlgFullScreenCommand: + { + if ( iCustControl ) + { + iCustControl->SetCurrentFullScreenStatus( ETrue ); + SwitchDialogLayoutL( ETrue ); // ETrue = Full Screen Mode + // Redraw Status Pane and CBA by doing a draw on dialog + DrawNow(); + } + break; + } + case ESvgtDlgNormalScreenCommand: + { + if ( iCustControl ) + { + iCustControl->SetCurrentFullScreenStatus( EFalse ); + SwitchDialogLayoutL( EFalse ); // EFalse = Normal Screen Mode + // Redraw Status Pane and CBA by doing a draw on dialog + DrawNow(); + } + break; + } +//@@ Touch support +#ifdef RD_SVGT_AUDIO_SUPPORT + case ESvgtDlgMuteCommand: + iIsVolumeMuted = !iIsVolumeMuted; + iCustControl->SetPresentationVolume(0); + + if(iCustControl->IsContentFinite()) + SetNaviPaneInfoL(iIsVolumeMuted, *iProgressText); + else + SetNaviPaneInfoL(iIsVolumeMuted, KNullDesC); + break; + + case ESvgtDlgUnmuteCommand: + iIsVolumeMuted = !iIsVolumeMuted; + // Set the volume level to the value it was before muting + iCustControl->SetPresentationVolume(iCustControl->GetPrevVolume()); + + if(iCustControl->IsContentFinite()) + SetNaviPaneInfoL(iIsVolumeMuted, *iProgressText); + else + SetNaviPaneInfoL(iIsVolumeMuted, KNullDesC); + break; + case ESvgtDlgSetVolumeCommand: // Fall Through +#endif //RD_SVGT_AUDIO_SUPPORT +//@@ Touch support + case ESvgtDlgLoopOnCommand: // Fall Through + case ESvgtDlgLoopOffCommand: // Fall Through + case ESvgtDlgPlayCommand: // Fall Through + case ESvgtDlgPauseCommand: // Fall Through + case ESvgtDlgStopCommand: // Fall Through + case ESvgtDlgZoomInCommand: // Fall Through + case ESvgtDlgZoomOutCommand: // Fall Through + case ESvgtDlgAngle90: // Fall Through + case ESvgtDlgAngle180: // Fall Through + case ESvgtDlgAngle270: // Fall Through + case ESvgtDlgSelectTextCommand: // Fall Through + case ESvgtDlgEditTextCommand: // Fall Through + break; + case EAknSoftkeyBack: // Fall Through + case EEikCmdExit: + // Close this dialog + procCmdReqd = EFalse; // No Further Processing required. + TryExitL( aCommandId ); + break; + case EAknCmdExit: + // Close this dialog + procCmdReqd = EFalse; // No Further Processing required. + if ( !SaveNeededL( aCommandId ) ) + { + TryExitL( aCommandId ); + iAvkonAppUi->ProcessCommandL( EAknCmdExit ); + } + break; + default: + procCmdReqd = EFalse; + break; + } + // If custom control has been created and control needs + // to process the command invoke the control's ProcessViewerCommandL() + // function + if ( procCmdReqd && iCustControl ) + { + iCustControl->ProcessViewerCommandL( aCommandId ); + } + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::CreateCustomControlL +// Reimplements CAknDialog::CreateCustomControlL inorder to add the SVGT +// custom control as part of the dialog in the UI framework. +// Returns: SEikControlInfo which contains the SVGT Cust Control, if +// aControlType == ESVGTCustControl +// else, +// the structure does not contain any control. +// ----------------------------------------------------------------------------- +// +SEikControlInfo CSVGTUIDialog::CreateCustomControlL( + TInt aControlType ) // Control Type + { + SEikControlInfo controlInfo; + controlInfo.iControl = NULL; + controlInfo.iTrailerTextId = 0; + controlInfo.iFlags = EEikControlHasEars;//EEikControlIsNonFocusing; + + switch ( aControlType ) + { + case ESVGTCustControl: + iCustControl = CSVGTCustControl::NewL( + *iFileHandlePtr, + iAppObserver, + this, + this, + this, + ETrue, // Progressive rendering enabled. + // To enable it pass ETrue + // otherwise EFalse. + NULL, + ESvgDisplayIcons| + ESvgDrawPanIndicator| + ESvgDrawPointer | + ESvgDisplayErrorNotes | + ESvgDrawPauseIndicator | + ESvgUseBackLight + ); + iCustControl->AddListener(this,EAudioListener); + controlInfo.iControl = iCustControl; + controlInfo.iControl->SetContainerWindowL(*this); + iCustControl->SetPointerObserver(this); + break; + default: + return CAknDialog::CreateCustomControlL(aControlType); + } + return controlInfo; + } + + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::SizeChanged +// Reimplements CAknDialog::SizeChanged inorder to support the resize of the +// dialog when functions such as SetRect, SetExtent are called on the dialog. +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::SizeChanged() + { + CAknDialog::SizeChanged(); + iCustControl->SetExtent( Rect().iTl, Rect().Size() ); + AknLayoutUtils::LayoutMetricsPosition(AknLayoutUtils::EControlPane, iBtnGrpPos); + AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EControlPane, iBtnGrpSize); + DrawNow(); + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::OfferKeyEventL +// Handles Key events by reimplementing CCoeControl::OfferKeyEventL. +// Returns: +// EKeyWasConsumed: If this control uses this key. +// EKeyWasNotConsumed: Otherwise. +// ----------------------------------------------------------------------------- +// +TKeyResponse CSVGTUIDialog::OfferKeyEventL( + const TKeyEvent& aKeyEvent, // Key Event + TEventCode aType) // Event Code + { + if ( iCustControl ) + { + if ( aType == EEventKey ) + { + if ( aKeyEvent.iScanCode == EStdKeyEnter ) + { + TryExitL( iLastCommandID ); + + return iCustControl->OfferKeyEventL( aKeyEvent, aType ); + } + + if ( aKeyEvent.iCode == KSvgScreenToggleKey && + aKeyEvent.iRepeats == 0 ) // Ignore Repeat Events + { + // Screen Mode Change Handling + TBool isFullScreenOn; + iCustControl->GetCurrentFullScreenStatus( isFullScreenOn ); + if ( isFullScreenOn ) + { + // Toggle to Normal Screen + ProcessCommandL( ESvgtDlgNormalScreenCommand ); + } + else + { + // Toggle to Full Screen + ProcessCommandL( ESvgtDlgFullScreenCommand ); + } + // No further processing required. + return EKeyWasConsumed; + } + } + // Pass the key to the custom control + TKeyResponse lCcRetVal = iCustControl->OfferKeyEventL( aKeyEvent, + aType ); + if ( lCcRetVal == EKeyWasConsumed ) + { + return EKeyWasConsumed; + } + } + return CAknDialog::OfferKeyEventL( aKeyEvent, aType ); + } + +#ifdef __SERIES60_HELP +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::OfferKeyEventL +// Handles Key events by reimplementing CCoeControl::OfferKeyEventL. +// Returns: +// EKeyWasConsumed: If this control uses this key. +// EKeyWasNotConsumed: Otherwise. +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::GetHelpContext( TCoeHelpContext& aContext ) const + { + aContext.iMajor = KSvgtHelpContextUid; + aContext.iContext = KSVGT_HLP_VIEWER; + } +#endif // __SERIES60_HELP + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::HandleResourceChange +// Handles change of skin/Layout +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::HandleResourceChange( TInt aType ) + { + CAknDialog::HandleResourceChange( aType ); + + + if ( aType == KAknsMessageSkinChange ) + { + // No skin related action performed. + } + else if ( aType == KEikDynamicLayoutVariantSwitch ) + { + + if( iQuietExitWhenOrientationChange ) + { + TryExitL( EAknCmdExit ); + return; + } + + if ( iCustControl ) + { + TBool isFullScreenOn; + // Check whether the custom control is using full-screen or + // normal screen + iCustControl->GetCurrentFullScreenStatus( isFullScreenOn ); + // Change the layout to reflect layout switch + TRAP_IGNORE( SwitchDialogLayoutL( isFullScreenOn ) ); + } + + // If it is a Layout switch, need to do a redraw + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + // Redraw the dialog + DrawDeferred(); + } + + } + + } +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::DrawProgressBarL +// This function updates the progress bar in the navi pane. It is called back +// by the custom control. +// ----------------------------------------------------------------------------- +// +void CSVGTUIDialog::DrawProgressBarL( TUint aTimeElapsed, // Time Elapsed in + // Seconds + TUint aTimeTotal ) // Total time in seconds + { + + TBuf timeElapsedBuf; // Time Elapsed, e.g. "00:12" + TBuf totalTimeBuf; // Total duration, e.g. "00:55" + + // Format the time to user readable format. The format is locale dependent + FormatTimeL( aTimeElapsed, timeElapsedBuf ); + FormatTimeL( aTimeTotal, totalTimeBuf ); + + // Format label text based on resource + CDesCArrayFlat* strings = new (ELeave) CDesCArrayFlat( 2 ); // Allocate 2 + // strings for + // elapsed time + // and total + // time strings + CleanupStack::PushL( strings ); + strings->AppendL( timeElapsedBuf ); + strings->AppendL( totalTimeBuf ); + + delete iProgressText; + iProgressText = NULL; + iProgressText = StringLoader::LoadL( R_QTN_SVGT_TIME_INDIC, + *strings, + iEikonEnv ); + // Destroy the array of strings + CleanupStack::PopAndDestroy( strings ); + + SetNaviPaneInfoL( iIsVolumeMuted, *iProgressText); + } + +void CSVGTUIDialog::HandleApplicationExitL( TInt aExitCommand ) + { + if((aExitCommand == EAknSoftkeyBack) || ( aExitCommand == EEikCmdExit)) + { + this->TryExitL(aExitCommand); + } + else + { + User::LeaveIfError(KErrArgument); + } + } + +EXPORT_C void CSVGTUIDialog::AssignImageData( const TDesC& aUri, HBufC8* aData ) + { + iCustControl->AssignImageData(aUri, aData); + } + +// ----------------------------------------------------------------------------- +// CSVGTUIDialog::SetNaviPaneInfoL +// Sets the mute icon & text to the navi pane. +// ----------------------------------------------------------------------------- +void CSVGTUIDialog::SetNaviPaneInfoL(TBool aIsVolumeMuted, const TDesC& aText) + { + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + CAknNavigationControlContainer* np = + static_cast + ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); + // Save the old Navi Decorator so that it can be deleted after + // creating the new navi decorator + CAknNavigationDecorator* lOldNaviDecorator = iNaviDecorator; + + iNaviDecorator = NULL; + + CSvgtDecoratorControl* decoControl = new (ELeave) CSvgtDecoratorControl; + CleanupStack::PushL(decoControl); + decoControl->ConstructL(); + decoControl->ShowVolumeMutedIcon(aIsVolumeMuted); + decoControl->SetTextL(aText); + iNaviDecorator = CAknNavigationDecorator::NewL(np, decoControl); + iNaviDecorator->SetContainerWindowL(*this); + CleanupStack::Pop(decoControl); + + // Clear the old Navi-Pane Decorator + if ( lOldNaviDecorator ) + { + delete lOldNaviDecorator ; + lOldNaviDecorator = NULL; + } + // Push the new Navi decorator in the Navigation Pane + np->PushL( *iNaviDecorator ); + } + +void CSVGTUIDialog::VolumeMuted(TBool aVolumeMuted) + { + if(iCustControl->IsContentFinite()) + { + TRAP_IGNORE( SetNaviPaneInfoL(aVolumeMuted, *iProgressText)); + } + else + { + TRAP_IGNORE(SetNaviPaneInfoL(aVolumeMuted, KNullDesC)); + } + iIsVolumeMuted = aVolumeMuted; + } +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlSrc/SvgtController.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlSrc/SvgtController.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,269 @@ +/* +* Copyright (c) 2005 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: This file implements the active objects used for progressive +* rendering +* +*/ + + +#include "SvgtController.h" +#include +#include +#include +#include +#include "SVGTCustControl.h" + +const TInt KAnimationInerval = 100000; + +_LIT(KDot, ". "); + +/* +************************************************************************************* +* ThreadController Implemetation +* +*************************************************************************************** +*/ +// ----------------------------------------------------------------------------- +// CSvgtThreadController::NewL +// Two phase constructor +// ----------------------------------------------------------------------------- +// +CSvgtThreadController* CSvgtThreadController::NewL(CSVGTCustControl* aCustControl) + { + CSvgtThreadController* self = CSvgtThreadController::NewLC(aCustControl); + CleanupStack::Pop(self); //self + return self; + } + +// ----------------------------------------------------------------------------- +// CSvgtThreadController::NewLC +// Two phase constructor +// ----------------------------------------------------------------------------- +// +CSvgtThreadController* CSvgtThreadController::NewLC(CSVGTCustControl* aCustControl) + { + CSvgtThreadController* self = new (ELeave) CSvgtThreadController(aCustControl); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CSvgtThreadController::~CSvgtThreadController +// Destructor +// ----------------------------------------------------------------------------- +// +CSvgtThreadController::~CSvgtThreadController() + { + Cancel(); + if(iLoadAnimator) + { + iLoadAnimator->Cancel(); + } + + delete iLoadAnimator; + ClearNaviPaneDecorator(); + // Reset eikon env pointer + iEikEnv = NULL; + // Reset the custom control pointer + iCustControl = NULL; + } + +// ----------------------------------------------------------------------------- +// CSvgtThreadController::DoCancel +// Cancels all the pending request +// ----------------------------------------------------------------------------- +// +void CSvgtThreadController::DoCancel() + { + } + +// ----------------------------------------------------------------------------- +// CSvgtThreadController::RunL +// Handles an active object's request completion event. +// ----------------------------------------------------------------------------- +// +void CSvgtThreadController::RunL() + { + iCustControl->SetThreadRunning(EFalse); + iLoadAnimator->Cancel(); + iCount = KAnimationLength; + DoLoadAnimationL(); + TInt lLoadError = iCustControl->DoHandleLoadingThreadError(); + TInt lPostLoadError = KErrNone; + + // Stop displaying progressive-render indicator + ClearNaviPaneDecorator(); + //iCustControl->StopEventHandler(); + if( lLoadError == KErrNone ) + { + // No Load error, Do the post load functionality + TRAP( lPostLoadError, iCustControl->DoPostLoadFuncL() ); + } + + // If there were any errors then ask parent to exit + if ( ( lLoadError!= KErrNone ) || ( lPostLoadError != KErrNone ) ) + { + // Error has occurred, commence cleanup + // Request Observer to Exit + iCustControl->DoExitFromDialogL(); + } + } + +// ----------------------------------------------------------------------------- +// CSvgtThreadController::CSvgtThreadController +// Parameterized constructor +// ----------------------------------------------------------------------------- +// +CSvgtThreadController::CSvgtThreadController(CSVGTCustControl* aCustControl): + CActive(EPriorityStandard), + iCustControl(aCustControl) + { + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// CSvgtThreadController::ConstructL +// Two phase constructor +// ----------------------------------------------------------------------------- +// +void CSvgtThreadController::ConstructL() + { + iLoadAnimator = CPeriodic::NewL(CActive::EPriorityStandard); + + // Store the environment pointer to avoid slow static access + iEikEnv = CEikonEnv::Static(); + User::LeaveIfNull( iEikEnv ); + } + +// ----------------------------------------------------------------------------- +// CSvgtThreadController::IssueThreadMonitorRequest +// Makes it active to get notify on thread death +// ----------------------------------------------------------------------------- +// +void CSvgtThreadController::IssueThreadMonitorRequest(const RThread& aThread) + { + aThread.Logon(iStatus); + iMainThread = aThread.Id(); + SetActive(); + + TCallBack callBack(LoadAnimationCallBack, this); + iCount = 0; + iLoadAnimator->Start(0, KAnimationInerval, callBack); + } + +// ----------------------------------------------------------------------------- +// CSvgtThreadController::StopThreadExecution +// Stops the thread execution +// ----------------------------------------------------------------------------- +// +void CSvgtThreadController::StopThreadExecution(const RThread& aThread) + { + aThread.LogonCancel(iStatus); + } + +// ----------------------------------------------------------------------------- +// CSvgtThreadController::DoLoadAnimationL +// This fuction does the loading animation +// ----------------------------------------------------------------------------- +// +void CSvgtThreadController::DoLoadAnimationL() + { + CEikStatusPane* sp = iEikEnv->AppUiFactory()->StatusPane(); + CAknNavigationControlContainer* np = + static_cast + ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); + + if(iCount >= KAnimationLength) + { + iCount = 0; + iAnimationText.Zero(); + } + else + { + iCount++; + iAnimationText.Append(KDot); + } + + CAknNavigationDecorator* lOldNaviDecorator = iNaviDecorator; + iNaviDecorator = NULL; + if ( lOldNaviDecorator ) + { + delete lOldNaviDecorator ; + lOldNaviDecorator = NULL; + } + + // Clear the old Navi-Pane Decorator + // Create the navi pane label + iNaviDecorator = np->CreateNavigationLabelL( iAnimationText ); + + // Save the old Navi Decorator so that it can be deleted after + // creating the new navi decorator + // Push the new Navi decorator in the Navigation Pane + np->PushL( *iNaviDecorator ); + + } + +// ----------------------------------------------------------------------------- +// CSvgtThreadController::LoadAnimationCallBack +// Callback fuction for loading animation +// ----------------------------------------------------------------------------- +// +TInt CSvgtThreadController::LoadAnimationCallBack(TAny* aThreadController) + { + CSvgtThreadController* threadController = + static_cast< CSvgtThreadController* >( aThreadController ); + if ( threadController ) + { + TRAPD( ignore, threadController->DoLoadAnimationL() ); + if ( ignore != KErrNone ) + { + // No error handling done. + } + } + return 0; + } + +// ----------------------------------------------------------------------------- +// CSvgtThreadController::ClearNaviPaneDecorator +// Clears the navi pane indicator when the loading animation gets over +// ----------------------------------------------------------------------------- +// +void CSvgtThreadController::ClearNaviPaneDecorator() + { + // Clear the Navi-Pane Decorator + if ( iNaviDecorator ) + { + // Restore the old navi-pane + CEikStatusPane* sp = iEikEnv->AppUiFactory()->StatusPane(); + + CAknNavigationControlContainer* np = NULL; + TRAPD( errGetNaviControl, + np = static_cast< CAknNavigationControlContainer* > + ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ) ); + if ( errGetNaviControl == KErrNone && np ) + { + TRAPD( errPushDefNaviControl, + np->PushDefaultL ()); // Set default. + if ( errPushDefNaviControl != KErrNone ) + { + // No error handling here. + } + } + delete iNaviDecorator; + iNaviDecorator = NULL; + } + } +// End of file + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlSrc/SvgtDecoratorControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlSrc/SvgtDecoratorControl.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2006 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: Used to decorate the control on the navi pane +* +*/ + +////////////////////////////////////////////////////////////////////////////// +// +// -----> CSvgtDecoratorControl (implementation) +// +////////////////////////////////////////////////////////////////////////////// +#include "SvgtDecoratorControl.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +_LIT(KAvkonMifFileName, "z:\\resource\\apps\\avkon2.mif"); + +// ----------------------------------------------------------------------------- +// CSvgtDecoratorControl::CSvgtDecoratorControl +// default constructor +// ----------------------------------------------------------------------------- +CSvgtDecoratorControl::CSvgtDecoratorControl() + { + } + +// ----------------------------------------------------------------------------- +// CSvgtDecoratorControl::ConstructL +// 2nd phase constructor +// ----------------------------------------------------------------------------- +void CSvgtDecoratorControl::ConstructL() + { + iNaviPane = static_cast + ( CEikStatusPaneBase::Current()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); + //Create icon for drawing the pointer + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + TRgb txtColor; + AknsUtils::GetCachedColor( skin, txtColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG2 ); + + iMutedIcon = AknsUtils::CreateGulIconL( + skin, + KAknsIIDQgnIndiMupSpeakerMuted, + KAvkonMifFileName, + EMbmAvkonQgn_indi_speaker_muted, + EMbmAvkonQgn_indi_speaker_muted_mask ); + + iImg = new (ELeave) CEikImage; + iImg->SetContainerWindowL(*this); + iImg->SetPictureOwnedExternally(ETrue); + + iLabel = new (ELeave) CEikLabel; + iLabel->SetContainerWindowL(*this); + iLabel->SetFont(iEikonEnv->DenseFont()); + iLabel->OverrideColorL( EColorLabelText, txtColor ); + iLabel->SetTextL(KNullDesC); + + ShowVolumeMutedIcon(EFalse); + TRect rt(iNaviPane->Rect().iTl, iNaviPane->Rect().Size()); + SetRect(rt); + + ActivateL(); + } + +// ----------------------------------------------------------------------------- +// CSvgtDecoratorControl::~CSvgtDecoratorControl +// Destructor +// ----------------------------------------------------------------------------- +CSvgtDecoratorControl::~CSvgtDecoratorControl() + { + delete iImg; + delete iLabel; + + delete iMutedIcon; + } + + + +// ----------------------------------------------------------------------------- +// CSvgtDecoratorControl::CountComponentControls +// From CCoeControl +// ----------------------------------------------------------------------------- +TInt CSvgtDecoratorControl::CountComponentControls() const + { + return ELastCtrl; + } + +// ----------------------------------------------------------------------------- +// CSvgtDecoratorControl::ComponentControl +// From CCoeControl +// ----------------------------------------------------------------------------- +CCoeControl* CSvgtDecoratorControl::ComponentControl(TInt aIndex) const + { + CCoeControl* control = NULL; + switch (aIndex) + { + case EMuteImageCtrlId: + control = static_cast(iImg); + break; + case ETextCtrlId: + control = static_cast(iLabel); + break; + default: + break; + } + return control; + } + +// ----------------------------------------------------------------------------- +// CSvgtDecoratorControl::SizeChanged +// From CCoeControl +// ----------------------------------------------------------------------------- +void CSvgtDecoratorControl::SizeChanged() + { + CCoeControl::SizeChanged(); + + const TInt KBitmapWidth = 40; + const TInt naviWidth = iNaviPane->Rect().Width(); + const TInt naviHeight = iNaviPane->Rect().Height() ; + + AknIconUtils::SetSize( iMutedIcon->Bitmap(), TSize(KBitmapWidth, naviHeight)); + AknIconUtils::SetSize( iMutedIcon->Mask(), TSize(KBitmapWidth, naviHeight)); + + TInt imgWidth = KBitmapWidth; + TInt lblWidth = naviWidth - imgWidth; + + TPoint imgPos; + TPoint lblPos(imgWidth, 0); + + iImg->SetExtent(imgPos, TSize(imgWidth, naviHeight)); + iLabel->SetExtent(lblPos, TSize(lblWidth, naviHeight)); + + } + + +// ----------------------------------------------------------------------------- +// CSvgtDecoratorControl::Draw +// From CCoeControl +// ----------------------------------------------------------------------------- +void CSvgtDecoratorControl::Draw(const TRect& aRect) const + { + CEikBorderedControl::Draw(aRect); + } + + +// ----------------------------------------------------------------------------- +// CSvgtDecoratorControl::OfferKeyEventL +// From CCoeControl +// ----------------------------------------------------------------------------- +TKeyResponse CSvgtDecoratorControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) + { + return CCoeControl::OfferKeyEventL(aKeyEvent, aType);//EKeyWasNotConsumed; + } + + +// ----------------------------------------------------------------------------- +// CSvgtDecoratorControl::SizeChanged +// Sets the visibility of the mute icon in the navi pane. +// ----------------------------------------------------------------------------- +void CSvgtDecoratorControl::ShowVolumeMutedIcon( TBool aVolumeMuted ) + { + if(aVolumeMuted) + { + iImg->SetPicture(iMutedIcon->Bitmap(), iMutedIcon->Mask()); + } + else + { + + iImg->SetPicture(NULL, NULL); + } +// iImg->DrawDeferred() + } + +// ----------------------------------------------------------------------------- +// CSvgtDecoratorControl::SetTextL +// Sets the progress text in the navi pane. +// ----------------------------------------------------------------------------- +void CSvgtDecoratorControl::SetTextL( const TDesC& aText) + { + iLabel->SetTextL( aText ); +// iLabel->DrawDeferred() + } diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlSrc/SvgtEvent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlSrc/SvgtEvent.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 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: +* +*/ + +#include "SvgtEvent.h" + +CSvgtEvent::CSvgtEvent(CSvgtEvent::TSvgtEventType aEventType, const TDesC& aUri): + iEventType (aEventType) + { + iUri = aUri.Alloc(); + } + +CSvgtEvent::~CSvgtEvent() + { + delete iUri; + } + +CSvgtEvent::TSvgtEventType CSvgtEvent::EventType() const + { + return iEventType; + } + +TPtrC CSvgtEvent::ImageUri() const + { + return TPtrC( iUri->Des() ); + } + +CSvgtEventEmbededImage::CSvgtEventEmbededImage( const TDesC& aUri): + CSvgtEvent(CSvgtEvent::ESvgtEventEmbededImage, aUri) + { + + } +CSvgtEventFetchImage::CSvgtEventFetchImage( const TDesC& aUri): + CSvgtEvent(CSvgtEvent::ESvgtEventFetchImage, aUri) + { + } + +CSvgtEventLinkActivated::CSvgtEventLinkActivated( const TDesC& aUri): + CSvgtEvent(CSvgtEvent::ESvgtEventLinkActivated, aUri) + { + } + +CSvgtEventLinkActivatedWithShow::CSvgtEventLinkActivatedWithShow( const TDesC& aUri, + const TDesC& aShow): + CSvgtEvent(CSvgtEvent::ESvgtEventLinkActivatedWithShow, aUri) + { + iShow = aShow.Alloc(); + } + +TPtrC CSvgtEventLinkActivatedWithShow::Show() const + { + return TPtrC(iShow->Des()); + } + +CSvgtEventRedraw::CSvgtEventRedraw() : CSvgtEvent( CSvgtEvent::ESvgtEventRedraw, KNullDesC ) + { + } + +//End of file diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlSrc/SvgtEventHandlerAO.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlSrc/SvgtEventHandlerAO.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,319 @@ +/* +* Copyright (c) 2006 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: This class handles the event list & process the events +* while progressive rendering +* +*/ + + +#include "SvgtEventHandlerAO.h" +#include +#include +#include "SvgtEvent.h" + +const TInt KTimerIntervalInMiliSeconds = 1000; + +const TInt KInitialTimeInterval = 100; +const TInt KMaxTimeInterval = 2000; +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::NewL +// Two phase construction +// ----------------------------------------------------------------------------- +// +CSvgtEventHandlerAO* CSvgtEventHandlerAO::NewL(MSvgtAppObserver* aAppObserverUtil, + CSVGTCustControl* aCustControl , + const TThreadId aMainThreadId ) + { + CSvgtEventHandlerAO* self = new ( ELeave ) CSvgtEventHandlerAO( aAppObserverUtil , + aCustControl, + aMainThreadId); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::CSvgtEventHandlerAO +// Constructor +// ----------------------------------------------------------------------------- +// +CSvgtEventHandlerAO::CSvgtEventHandlerAO(MSvgtAppObserver* aAppObserverUtil, + CSVGTCustControl* aCustControl, + const TThreadId aMainThreadId): + CActive( CActive::EPriorityStandard ), + iCustControl(aCustControl), + iMainThreadId( aMainThreadId ), + iIsDocumentComplete( EFalse ), + iStepCount( 1 ), + iSvgTimeBetweenRedraw( KInitialTimeInterval ) + { + iAppObserverUtil = static_cast(aAppObserverUtil); + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::ConstructL +// 2nd phase constructor +// ----------------------------------------------------------------------------- +// +void CSvgtEventHandlerAO::ConstructL() + { + iPreviousRedrawClock.HomeTime(); + // Add to active scheduler + CActiveScheduler::Add( this ); + // Set the status as pending + iStatus = KRequestPending; + // Set the active object as Active + SetActive(); + // Create the critical section IPC for sync. the RequestComplete Calls + iCritSection.CreateLocal(); + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::~CSvgtEventHandlerAO +// Destructor +// ----------------------------------------------------------------------------- +// +CSvgtEventHandlerAO::~CSvgtEventHandlerAO() + { + Cancel(); + iEventList.ResetAndDestroy(); + iEventList.Close(); + iCritSection.Close(); + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::AddEventToList +// It adds the event (except redraw event) to the event queue. +// ----------------------------------------------------------------------------- +// +TBool CSvgtEventHandlerAO::AddEventToList( CSvgtEvent* aEvent) + { + iEventList.Append( aEvent ); + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::AddRedrawEventToList +// It adds the redraw event to the event queue. +// ----------------------------------------------------------------------------- +// +TBool CSvgtEventHandlerAO::AddRedrawEventToList( const TBool aForceAdd ) + { + TBool isEventAdded = EFalse; + if(aForceAdd || IsRedrawTimeElapsed()) + { + CSvgtEvent* redrawEvent = new CSvgtEventRedraw; + iEventList.Append( redrawEvent ); + isEventAdded = ETrue; + } + + return isEventAdded; + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::MakeRequestComplete +// It make the request complete. +// ----------------------------------------------------------------------------- +// +void CSvgtEventHandlerAO::MakeRequestComplete( TInt aError ) + { + // The Asynchronouse service provider must only call the RequestComplete() + // once for each request. Multiple completion events on a single active + // object result in a stray signal panic. + // Hence use a critical section to synchronize access to RequestComplete() + iCritSection.Wait(); + if( ( IsActive() ) && ( iStatus == KRequestPending ) ) + { + // The asynchronous service provider is the loading thread and since + // this is called from both loading thread as well as main thread + // use the RThread object to complete the request for active + // object present in the main thread's active scheduler + TRequestStatus* status = &iStatus; + RThread mainThread; + + if( mainThread.Open( iMainThreadId) ) + { + // Problem opening thread, ignore error and return : Should not happen. + return; + } + + mainThread.RequestComplete( status, aError ); + mainThread.Close(); + } + iCritSection.Signal(); + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::AddEventToList +// It indicates that document is document loading completed. +// ----------------------------------------------------------------------------- +// +void CSvgtEventHandlerAO::SetDocumentComplete() + { + iIsDocumentComplete = ETrue; + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::RunL +// Handles an active object's request completion event. +// ----------------------------------------------------------------------------- +// +void CSvgtEventHandlerAO::RunL() + { + // Set the Active Object Active always + if( !IsActive() ) + { + iStatus = KRequestPending; + SetActive(); + } + + if(iEventList.Count()) + { + CSvgtEvent* event = iEventList[0]; + iEventList.Remove( 0 ); + switch(event->EventType()) + { + case CSvgtEvent::ESvgtEventEmbededImage: + { + CSvgtEventEmbededImage* svgEvent = + static_cast(event); + iAppObserverUtil->AssignEmbededDataL( svgEvent->ImageUri() ); + } + break; + + case CSvgtEvent::ESvgtEventFetchImage: + { + CSvgtEventFetchImage* fetchEvent = + static_cast(event); + iAppObserverUtil->NewFetchImageData(fetchEvent->ImageUri()); + } + break; + case CSvgtEvent::ESvgtEventLinkActivated: + { + CSvgtEventLinkActivated* linkEvent = + static_cast(event); + iAppObserverUtil->LinkActivated(linkEvent->ImageUri()); + } + break; + case CSvgtEvent::ESvgtEventLinkActivatedWithShow: + { + CSvgtEventLinkActivatedWithShow* linkShowEvent = + static_cast(event); + iAppObserverUtil->LinkActivatedWithShow(linkShowEvent->ImageUri(), + linkShowEvent->Show()); + } + break; + case CSvgtEvent::ESvgtEventRedraw: + { + //DO REDRAW + iCustControl->PerformEngineRedraw(); + iCustControl->DrawNow(); + } + break; + + default: + break; + } + + delete event; + } + + + if( iEventList.Count() ) + { + // Pending events in the list, reschedule active + // object + MakeRequestComplete( KErrNone ); + } + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::DoCancel +// Cancels all the pending request +// ----------------------------------------------------------------------------- +// +void CSvgtEventHandlerAO::DoCancel() + { + // The service provided for this active object is the + // loading thread. Since the loading thread is already indicated to stop + // generating requests, need to terminate the request + // pending in the main thread + DoTerminate(); + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::RunError +// Handles a leave occurring in the request completion event handler RunL(). +// ----------------------------------------------------------------------------- +// +TInt CSvgtEventHandlerAO::RunError( TInt aError ) + { + // When an error occurs, call base class error handler + // Note that active object should not be Cancel() here + // as Loading thread could still be alive and do a + // MakeRequestComplete. This would generate a stray + // signal. + return ( CActive::RunError( aError ) ); + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::IsRedrawTimeElapsed +// It determines whether the time elapsed or not. +// ----------------------------------------------------------------------------- +// +TBool CSvgtEventHandlerAO::IsRedrawTimeElapsed() + { + TBool isTimeElapsed = EFalse; + TTime currentClock; + currentClock.HomeTime(); + + TTimeIntervalMicroSeconds time64; + time64 = currentClock.MicroSecondsFrom( iPreviousRedrawClock ); + + TUint32 timeDelta = I64INT( time64.Int64() ) / KTimerIntervalInMiliSeconds; + // milliseconds + + if ( timeDelta > iSvgTimeBetweenRedraw )//KSvgTimeBetweenRedraw=500 + { + if( iSvgTimeBetweenRedraw < KMaxTimeInterval ) + { + iSvgTimeBetweenRedraw *= ++iStepCount; + } + isTimeElapsed = ETrue; + // Save the current time to calculate interframe delay + iPreviousRedrawClock.HomeTime(); + } + + return isTimeElapsed; + } + +// ----------------------------------------------------------------------------- +// CSvgtEventHandlerAO::DoTerminate +// Cancels the pending async request +// ----------------------------------------------------------------------------- +// +void CSvgtEventHandlerAO::DoTerminate() + { + // Post a pseudo complete, so that Cancel() is done + // successfully. The Loading thread which is the actual service + // provider is by now already stopped. + // The Asynchronous service provider should complete the + // request with KErrCancel as quickly as possible, because CActive::Cancel + // blocks until completion occurs. + MakeRequestComplete( KErrCancel ); + } + + +//End of file diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/data/102071E7.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/data/102071E7.rss Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2005 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: ECOM Resource file for SVGTScreenSaverPlugin.dll +* +*/ + + +// INCLUDES +#include + +#include "ScreensaverpluginIntDef.hrh" +#include "SvgScreenSaverImplementationUid.hrh" + + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// theInfo +// ECOM DLL interface & implementation description resource. +// +// ----------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x102071E7; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101F8810; // identifies plugin type (used by ECom) + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid =0x102071E6; + version_no = 1; + display_name = "SVGT-ScreenSaver"; + default_data = ""; + // suppored mime types + // mime Extensions + // and mime descriptions + opaque_data = "1"; + } + }; + } + }; + } +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/data/102073D7.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/data/102073D7.rss Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2005 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: Registry file for the SVG Decoder Implementation +* +*/ + + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif + +#include "SVGImageCodecUIDs.hrh" + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// theInfo +// Specifies the svg interface definition information +// +// ----------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KSVGCodecDllUidValue; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KDecoderInterfaceUidValue; + implementations = + { + BINARY_IMPLEMENTATION_INFO + { + implementation_uid = KSVGDecoderImplementationUidValue; + version_no = 1; + display_name = "SVG"; + default_data = {0x3C, 0x73, 0x76}; // " +#include +#include +#include +#include +#include +#include +#ifdef __SCALABLE_ICONS +#include +#endif +#include +#include +#include +#include +#include +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE + { + } + +RESOURCE TBUF + { + buf = "SVGTAppObserver"; + } + +//---------------------------------------------------- +// +// r_svgt_save_locations +// +//---------------------------------------------------- +// +RESOURCE MEMORYSELECTIONDIALOG r_svgt_save_locations + { + softkey_1 = text_softkey_ok; + softkey_2 = text_softkey_cancel; + locations = + { +#ifndef RD_MULTIPLE_DRIVE + LOCATION { root_path = text_phone_memory_root_path text_others_path; }, + LOCATION { root_path = text_memory_card_root_path text_others_path; } +#else + LOCATION + { + root_path = "C:\\Data\\"; + //default_folder="images\\"; + default_folder="Others\\"; + }, + LOCATION + { + root_path = "E:\\"; + //default_folder="images\\"; + default_folder="Others\\"; + } + +#endif + }; + } + +// --------------------------------------------------- +// +// r_svgt_mmc_full +// +// --------------------------------------------------- +// +RESOURCE TBUF r_svgt_mmc_full + { + buf = qtn_memlo_mmc_not_enough_memory; + } + +// --------------------------------------------------- +// +// r_svgt_saving_wait_note +// +// --------------------------------------------------- +// +RESOURCE DIALOG r_svgt_saving_wait_note + { + flags = EAknProgressNoteFlags; + buttons = r_svgt_waitnote_softkeys; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = 10; + control = AVKON_NOTE + { + layout = EProgressLayout; + singular_label = qtn_gen_note_saving; + imageid = EMbmAvkonQgn_note_progress; + imagemask = EMbmAvkonQgn_note_progress_mask; + }; + } + }; + } + +// --------------------------------------------------- +// +// r_svgt_download_wait_note +// +// --------------------------------------------------- +// +RESOURCE DIALOG r_svgt_download_wait_note + { + flags = EAknWaitNoteFlags; + buttons = r_svgt_waitnote_softkeys; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = 15; // EWaitNote + control = AVKON_NOTE + { + layout = EWaitLayout; + imageid = EMbmAvkonQgn_note_progress; + imagemask = EMbmAvkonQgn_note_progress_mask; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + +// --------------------------------------------------- +// +// r_svgt_saving_softkeys +// +// --------------------------------------------------- +// +RESOURCE CBA r_svgt_waitnote_softkeys + { + buttons= + { + CBA_BUTTON + { + id = EAknSoftkeyEmpty; + txt = text_softkey_empty; + }, + CBA_BUTTON + { + id = EAknSoftkeyQuit; + txt = text_softkey_cancel; + } + }; + } + +// --------------------------------------------------- +// +// r_svgt_clip_saved +// +// --------------------------------------------------- +// +RESOURCE TBUF r_svgt_clip_saved + { + + buf = qtn_fldr_others_directory ; + } + +// --------------------------------------------------- +// +// r_svgt_file_not_found +// +// --------------------------------------------------- +// +RESOURCE TBUF r_svgt_file_not_found + { + buf = qtn_svgt_file_not_found; + } + +// --------------------------------------------------- +// +// r_svgt_downloading_file +// +// --------------------------------------------------- +// +RESOURCE TBUF r_svgt_downloading_file + { + buf = qtn_svgt_waiting_downloading; + } + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/data/SVGTScreenSaverPlugin.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/data/SVGTScreenSaverPlugin.rss Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2005 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: Resource file for SVGT ScreenSaverPlugin +* +*/ + + +// RESOURCE IDENTIFIER + +NAME SVSS + +#include +#include +#include + +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE + { + } + +RESOURCE TBUF + { + buf = "SVGTScreenSaver"; + } + + +#define SVG_PHONE_MEMORY_SYSTEM_PATH "C:\\System\\" + +RESOURCE FILELISTMODEL r_svg_filelist_model + { + + directories = + { + LBUF { txt = text_rom_root_path text_images_path; }, + LBUF { txt = text_phone_memory_root_path text_images_path; }, + LBUF { txt = SVG_PHONE_MEMORY_SYSTEM_PATH text_images_path; }, + LBUF { txt = text_memory_card_root_path text_images_path; } + }; + + // Include these MIME types in the tone selection list.. + mimetypes = + { + LBUF { txt = "image/svg+xml"; } + }; + + wildcards = + { + LBUF { txt = "*.svg"; }, + LBUF { txt = "*.svgz"; } + }; + } + diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/data/SVGTUIControl.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/data/SVGTUIControl.rss Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,663 @@ +/* +* Copyright (c) 2004,2005 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: Resource file for SVGTUIControl.dll +* +*/ + + +// RESOURCE IDENTIFIER +NAME SVGU // 4 letter ID + +// INCLUDES + +#include +#include +#include +#include +#include +#include +#include + +#include "SVGTUIDialog.hrh" +#include "SVGTCustControl.rh" +#include +#include "SVGTUIControlDbgFlags.hrh" +// CONSTANTS + +// MACROS + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE + { + } + + +RESOURCE TBUF + { + buf = "SVGUIControl"; + } + +// ----------------------------------------------------------------------------- +// +// r_svgt_wait_note +// Resource for wait note displayed while opening SVGT files. +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_svgt_wait_note + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; // No Softkeys displayed + // when image is loading. + items= + { + DLG_LINE + { + type = EAknCtNote; + id = ESvgtWaitNote; + control = AVKON_NOTE + { + layout = EWaitLayout; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } +// ----------------------------------------------------------------------------- +// +// r_svgt_dialog_menubar +// Resource for SVGT Dialog "Options" Menu Bar +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_BAR r_svgt_dialog_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_svgt_dialog_menu; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_svgt_dialog_menu +// Resource for SVGT Dialog "Options" Menu Pane +// +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_svgt_dialog_menu + { + items = + { + MENU_ITEM + { + command = ESvgtDlgSaveCommand; + txt = qtn_svgt_options_save; + }, + MENU_ITEM + { + command = ESvgtDlgZoomInCommand; + txt = qtn_svgt_options_zoom_in; + }, + MENU_ITEM + { + command = ESvgtDlgZoomOutCommand; + txt = qtn_svgt_options_zoom_out; + }, + MENU_ITEM + { + command = ESvgtDlgSelectTextCommand; + txt = qtn_svgt_options_select_text; + }, + MENU_ITEM + { + command = ESvgtDlgEditTextCommand; + txt = qtn_svgt_options_edit_text; + }, + MENU_ITEM + { + command = ESvgtDlgPlayCommand; + txt = qtn_svgt_options_play; + }, + MENU_ITEM + { + command = ESvgtDlgPauseCommand; + txt = qtn_svgt_options_pause; + }, + MENU_ITEM + { + command = ESvgtDlgStopCommand; + txt = qtn_svgt_options_stop; + }, +#ifdef RD_SVGT_AUDIO_SUPPORT + MENU_ITEM + { + command = ESvgtDlgSetVolumeCommand; + txt = qtn_svgt_options_setvolume; + }, + MENU_ITEM + { + command = ESvgtDlgMuteCommand; + txt = qtn_svgt_options_mute; + }, + MENU_ITEM + { + command = ESvgtDlgUnmuteCommand; + txt = qtn_svgt_options_unmute; + }, +#endif //RD_SVGT_AUDIO_SUPPORT + MENU_ITEM + { + command = ESvgtDlgLoopCascadeCommand; + txt = qtn_svgt_options_loop; + cascade = r_svgt_loop_submenu; + }, + MENU_ITEM + { + command = ESvgtDlgFindTextCommand; + txt = qtn_svgt_options_find_text; + }, + MENU_ITEM + { + command = ESvgtDlgFullScreenCommand; + txt = qtn_svgt_options_full_screen; + }, + MENU_ITEM + { + command = ESvgtDlgNormalScreenCommand; + txt = qtn_svgt_options_normal_screen; + }, + MENU_ITEM + { + command = ESvgtDlgListRotateCascadeCommand; + txt = qtn_svgt_options_rotate; + cascade = r_svgt_rotate_submenu; + }, + MENU_ITEM + { + command = ESvgtDlgViewDetailsCommand; + txt = qtn_svgt_options_view_details; + }, + MENU_ITEM + { + command = ESvgtDlgListDownloadCommand; + txt = qtn_browser_list_downloads; + }, +#ifdef __SERIES60_HELP + MENU_ITEM + { + command = ESvgtDlgHelpCommand; + txt = qtn_options_help; + }, +#endif // __SERIES60_HELP + MENU_ITEM + { + command = EAknCmdExit; + txt = qtn_options_exit; + } + }; + } + +// --------------------------------------------------------- +// +// r_svgt_loop_submenu +// Loop Submenu +// +// --------------------------------------------------------- +// +RESOURCE MENU_PANE r_svgt_loop_submenu + { + items = + { + MENU_ITEM + { + command = ESvgtDlgLoopOnCommand; + txt = qtn_svgt_options_loop_on; + flags = EEikMenuItemRadioStart ; + }, + MENU_ITEM + { + command = ESvgtDlgLoopOffCommand; + txt = qtn_svgt_options_loop_off; + flags = EEikMenuItemSymbolOn | EEikMenuItemRadioEnd; + } + }; + } + +// +// ----------------------------------------------------------------------------- +// +// r_svgt_rotate_submenu +// Rotate submenu +// +// ----------------------------------------------------------------------------- +// + +RESOURCE MENU_PANE r_svgt_rotate_submenu + { + items = + { + MENU_ITEM + { + command = ESvgtDlgAngle90; + txt = qtn_svgt_options_rotate_90; + }, + MENU_ITEM + { + command = ESvgtDlgAngle180; + txt = qtn_svgt_options_rotate_180; + }, + MENU_ITEM + { + command = ESvgtDlgAngle270; + txt = qtn_svgt_options_rotate_270; + } + }; + } + +// --------------------------------------------------------- +// +// r_svgt_viewer_dialog +// SVG-T Dialog +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_svgt_viewer_dialog + { + flags = EEikDialogFlagNoDrag | + EEikDialogFlagFillAppClientRect | + EEikDialogFlagNoBorder | + EEikDialogFlagNoShadow | + EEikDialogFlagCbaButtons | + EEikDialogFlagWait | + EEikDialogFlagDontEatUpDownEvents; + title = "SVGT Dialog"; + buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; + items = + { + DLG_LINE + { + type = ESVGTCustControl; + id = ESVGTDialogCustControlIdData; + control = SVGT_CUST_CONTROL + { + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_svgt_viewer_preview_dialog +// SVG-T Dialog +// +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_svgt_viewer_preview_dialog + { + flags = EEikDialogFlagNoDrag | + EEikDialogFlagFillAppClientRect | + EEikDialogFlagNoBorder | + EEikDialogFlagNoShadow | + EEikDialogFlagCbaButtons | + EEikDialogFlagWait | + EEikDialogFlagDontEatUpDownEvents; + title = "SVGT Dialog"; + buttons = R_AVKON_SOFTKEYS_BACK; + items = + { + DLG_LINE + { + type = ESVGTCustControl; + id = ESVGTDialogCustControlIdData; + control = SVGT_CUST_CONTROL + { + }; + } + }; + } + + +//---------------------------------------------------- +// +// r_svgt_file_open_failure +// File open problem information note. +// +//---------------------------------------------------- +// +RESOURCE TBUF r_svgt_file_open_failure + { + buf = qtn_svgt_info_unable_to_open; + } + +//---------------------------------------------------- +// +// r_svgt_file_not_complete +// File not complete information note. +// +//---------------------------------------------------- +// +RESOURCE TBUF r_svgt_file_not_complete + { + buf = qtn_svgt_info_not_complete; + } + +//For View Details Strings + +// --------------------------------------------------- +// +// r_svgt_file_details_row_format +// +// --------------------------------------------------- +// +RESOURCE TBUF r_svgt_file_details_row_format + { + buf = "%0U\t%1U"; + } + +//For MSK Labels +//---------------------------------------------------- +// +// r_svgt_msk_label_select +// MSK Label "Select" +// +//---------------------------------------------------- +// +RESOURCE TBUF r_svgt_msk_label_select + { + buf=qtn_msk_select; + } +//---------------------------------------------------- +// +// r_svgt_msk_label_select +// MSK Label "Edit" +// +//---------------------------------------------------- +// +RESOURCE TBUF r_svgt_msk_label_edit + { + buf=qtn_msk_edit; + } +//---------------------------------------------------- +// +// r_svgt_msk_label_select +// MSK Label "Open" +// +//---------------------------------------------------- +// +RESOURCE TBUF r_svgt_msk_label_open + { + buf=qtn_msk_open; + } +//---------------------------------------------------- +// +// r_svgt_msk_label_select +// MSK context sensitive menu icon +// +//---------------------------------------------------- +// +RESOURCE TBUF r_svgt_msk_label_context + { + buf=text_softkey_option; + } +//---------------------------------------------------- +// +// r_svgt_msk_label_select +// MSK Label "Play" +// +//---------------------------------------------------- +// +RESOURCE TBUF r_svgt_msk_label_play + { + buf=qtn_msk_play; + } +//---------------------------------------------------- +// +// r_svgt_msk_label_select +// MSK Label "Save" +// +//---------------------------------------------------- +// +RESOURCE TBUF r_svgt_msk_label_save + { + buf=qtn_msk_save; + } + +// --------------------------------------------------- +// +// r_svgt_softkeys_fullscreen +// Resource for CBA in Full Screen mode +// +// --------------------------------------------------- +// + +RESOURCE CBA r_svgt_softkeys_fullscreen + { + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = text_softkey_empty; + }, + CBA_BUTTON + { + id = EAknSoftkeyBack; + txt = text_softkey_empty; + } + }; + } + + +// Find Text + +//---------------------------------------------------- +// +// r_find_text_query_dialog +// Text Query Dialog Resource +// +//---------------------------------------------------- +// +RESOURCE DIALOG r_find_text_query_dialog + { + flags = EAknDialogGenericQueryFlags | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK;//MSK label added + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = qtn_svgt_query_enter_string; + control = EDWIN + { + flags= EEikEdwinNoLineOrParaBreaks; + lines=1; + maxlength=50; + }; + }; + } + }; + } + + +//---------------------------------------------------- +// +// r_svgt_text_not_found +// "Text not Found" information note for find text. +// +//---------------------------------------------------- +// +RESOURCE TBUF r_svgt_text_not_found + { + buf = qtn_svgt_info_not_found; + } + +//---------------------------------------------------- +// +// r_svgt_braces_found_in_textarea +// Braces "<" or ">" found in text or textarea information note. +// +//---------------------------------------------------- +// +RESOURCE TBUF r_svgt_braces_found_in_textarea + { + buf = qtn_svgt_braces_found_in_textarea; + } + +//---------------------------------------------------- +// +// r_qtn_svgt_time_indic +// Progress Indicator Format String +// +//---------------------------------------------------- +// +RESOURCE TBUF r_qtn_svgt_time_indic + { + buf = qtn_svgt_time_indic; + } + +//---------------------------------------------------- +// +// r_qtn_svgt_waiting_opening +// Waiting note text for opening +// +//---------------------------------------------------- +// +RESOURCE TBUF r_qtn_svgt_waiting_opening + { + buf = qtn_svgt_waiting_opening; + } + +// ---------------------------------------------------- +// Save content (if not already saved when exiting) +// ---------------------------------------------------- +// +RESOURCE TBUF r_qtn_svgt_query_conf_save_downloaded + { + buf = qtn_iv_query_conf_save_downloaded; + } + +//---------------------------------------------------- +// +// +// Yes/No Confirmation query +// +//---------------------------------------------------- +// +RESOURCE DIALOG r_svgt_confirmation_query_yes_no + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; //MSK label added + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EAknCtQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + }; + } + }; + } + + +//---------------------------------------------------- +// +// r_svgt_text_edit_query_dialog +// Text Edit Query Dialog Resource +// +//---------------------------------------------------- +// +RESOURCE DIALOG r_svgt_edit_text_query_dialog + { + flags = EAknDialogGenericQueryFlags | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK;//MSK label added + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + itemflags=EEikDlgItemTakesEnterKey; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = qtn_svgt_edit_query_string; + control = EDWIN + { + flags= KMultiLineExpandingEditorFlags | + EEikEdwinNoAutoSelection; + width = 5; + lines = 5; + maxlength = 0; //160; + default_input_mode = EAknEditorTextInputMode; + allowed_input_modes = EAknEditorTextInputMode | + EAknEditorNumericInputMode; + default_case = EAknEditorTextCase; + allowed_case_modes = EAknEditorAllCaseModes; + avkon_flags = EAknEditorFlagUseSCTNumericCharmap | + EAknEditorFlagEnablePictographInput; + }; + }; + } + }; + } + +//---------------------------------------------------- +// +// r_svgt_text_selection_dialog +// Text selection dialog Resource +// +//---------------------------------------------------- +// +RESOURCE DIALOG r_svgt_text_selection_dialog + { + flags = EAknDialogGenericQueryFlags | + EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + itemflags=0; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = qtn_svgt_select_query_string; + control = EDWIN + { + flags = KMultiLineExpandingEditorFlags; + //width = 5; + lines = 5; + }; + }; + } + }; + } + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/data/SVGTViewerApp.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/data/SVGTViewerApp.rss Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2004,2005 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: Resource file for SVGT Viewer Applicaton +* +*/ + + +// RESOURCE IDENTIFIER + +NAME SVGT + +// INCLUDES + +#include +#include +#include +#include +#include +#include "SVGTViewerApp.hrh" +#include "SVGTViewerAppDbgFlags.hrh" +#include +#include +#include + +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE + { + } + +// --------------------------------------------------------- +// +// Default Document Name +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_default_document_name + { + buf=""; + } + +// --------------------------------------------------------- +// +// Define default menu and CBA key. +// +// --------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + menubar = r_svgtviewerapp_menubar; + cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + + +// --------------------------------------------------------- +// +// r_svgtviewerapp_localisable_app_info +// Provide Caption and Icon Info for Scalable UI +// +// --------------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_svgtviewerapp_localisable_app_info + { + short_caption = qtn_apps_sv_grid; // TODO: Replace String with + // L10n caption + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = qtn_apps_sv_grid; // TODO: Replace String with + // L10n caption +#ifdef __SCALABLE_ICONS + number_of_icons = 1; + icon_file = APP_BITMAP_DIR"\\SvgtViewerApp_aif.mif"; +#else // __SCALABLE_ICONS + number_of_icons = 2; + icon_file = APP_BITMAP_DIR"\\SvgtViewerApp_aif.mbm"; +#endif // __SCALABLE_ICONS + }; + } +// --------------------------------------------------------- +// +// r_svgtviewerapp_menubar +// Menubar for SVGTViewerApp +// +// --------------------------------------------------------- +// +RESOURCE MENU_BAR r_svgtviewerapp_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_svgtviewerapp_menu; + } + }; + } + + +// --------------------------------------------------------- +// +// r_svgtviewerapp_menu +// Menu for "Options" +// +// --------------------------------------------------------- +// +RESOURCE MENU_PANE r_svgtviewerapp_menu + { + items = + { + MENU_ITEM + { + command = EAknSoftkeyExit; + txt = qtn_options_exit; + } +#ifdef SVGTVIEWERAPP_DBG_OPEN_HARDCODE_FILE + , + MENU_ITEM + { + command = ESVGTViewerAppCommand1; + txt = "Open"; + } +#endif + }; + } + +// --------------------------------------------------- +// +// r_svgt_viewer_info_video_call_ongoing +// +// --------------------------------------------------- +// +RESOURCE TBUF r_svgt_viewer_info_video_call_ongoing + { + buf = qtn_svgt_info_video_call_ongoing; + } + +RESOURCE TBUF r_svgt_viewer_phone_memory_images_path + { + buf = text_phone_memory_root_path; + } + +RESOURCE TBUF r_svgt_viewer_memorycard_images_path + { + buf = text_memory_card_root_path; + } + + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/data/SVGTViewerApp_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/data/SVGTViewerApp_reg.rss Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2004,2005 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: Registration resource file for SVGT Viewer Applicaton +* Reqd for the new app framework. +* +*/ + + +// INCLUDES + +#include +#include +#include + +#include "SVGTViewerAppDbgFlags.hrh" + +UID2 KUidAppRegistrationResourceFile +UID3 0x101F874A // application UID + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// APP_REGISTRATION_INFO +// Registration resource for SVGT Viewer +// +// ----------------------------------------------------------------------------- +// +RESOURCE APP_REGISTRATION_INFO + { + app_file = "SVGTViewerApp"; + + localisable_resource_file = APP_RESOURCE_DIR"\\SVGTViewerApp"; + localisable_resource_id = R_SVGTVIEWERAPP_LOCALISABLE_APP_INFO; +#ifndef SVGTVIEWERAPP_DBG_OPEN_HARDCODE_FILE + hidden = KAppIsHidden; + embeddability = KAppEmbeddableUiNotStandAlone; +#else + hidden = KAppNotHidden; + embeddability = KAppEmbeddable; +#endif + + datatype_list = + { + DATATYPE + { + // SVG-T Viewer gets high priority for handling + // mime-type image/svg+xml + priority = EDataTypePriorityHigh; + type="image/svg+xml"; + }, + DATATYPE + { + // SVG-T Viewer gets high priority for handling + // mime-type image/svg + priority = EDataTypePriorityHigh; + type="image/svg"; + } + }; + } + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/data/svgtfileviewdetails.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/data/svgtfileviewdetails.rss Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,629 @@ +/* +* Copyright (c) 2006 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: Resource file for DRM view details DLL. +* +*/ + + +// RESOURCE IDENTIFIER + +NAME FVWD + +// INCLUDES + +#include +#include +#include +//#include +#include +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE + { + } + +RESOURCE TBUF + { + buf = "File View Details"; + } + +RESOURCE TBUF r_fileviewdetails_title_presentationdetails { buf = qtn_fileviewdetails_title_presentationdetails; } + +//For View Details Strings + +// --------------------------------------------------- +// +// r_file_details_row_format +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_details_row_format + { + buf = "%0U\t%1U"; + } + +// --------------------------------------------------- +// +// r_file_details +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_details + { + buf = qtn_heading_pres_details; + } + +// --------------------------------------------------- +// +// r_file_format_heading +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_format_heading + { + buf = qtn_details_format; + } + + +// --------------------------------------------------- +// +// r_file_size_heading +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_size_heading + { + buf = qtn_details_size; + } + +// --------------------------------------------------- +// +// r_file_size_kb +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_size_kb + { + buf = qtn_details_size_kb; + } + +// --------------------------------------------------- +// +// r_file_size_b +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_size_b + { + buf = qtn_details_size_b; + } + +// --------------------------------------------------- +// +// r_file_date_heading +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_date_heading + { + buf = qtn_details_date; + } + +// --------------------------------------------------- +// +// r_file_date_heading +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_time_heading + { + buf = qtn_details_time; + } + +// --------------------------------------------------- +// +// r_file_url_heading +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_url_heading + { + buf = ""; + } + + + + +// --------------------------------------------------- +// +// r_file_drm_display +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_display + { + buf = qtn_drm_mgr_det2_display; + } + +// --------------------------------------------------- +// +// r_file_drm_full +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_full + { + buf = qtn_drm_mgr_det_full_x; + } + +// --------------------------------------------------- +// +// r_file_drm_unlimited +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_unlimited + { + buf = qtn_drm_mgr_det_unlimited; + } + +// --------------------------------------------------- +// +// r_file_drm_utl +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_utl + { + buf = qtn_drm_mgr_det_utl_x; + } + +// --------------------------------------------------- +// +// r_file_drm_1_count +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_1_count + { + buf = qtn_drm_mgr_det_1_count; + } + +// --------------------------------------------------- +// +// r_file_drm_n_counts +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_n_counts + { + buf = qtn_drm_mgr_det_n_counts; + } + +// --------------------------------------------------- +// +// r_file_drm_uts +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_uts + { + buf = qtn_drm_mgr_det_uts_x; + } + +// --------------------------------------------------- +// +// r_file_drm_not_act +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_not_act + { + buf = qtn_drm_mgr_det_not_act; + } + +// --------------------------------------------------- +// +// r_file_drm_udl +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_udl + { + buf = qtn_drm_mgr_det_udl_x; + } + +// --------------------------------------------------- +// +// r_file_drm_det_inter +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_det_inter + { + buf = qtn_drm_mgr_det_inter; + } + +// --------------------------------------------------- +// +// r_file_drm_det_inter_two +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_det_inter_two + { + buf = qtn_drm_mgr_det_inter_two; + } + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_years_one +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_years_one + { + buf = qtn_drm_nbr_of_years_one; + } + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_years_one_final +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_years_one_final + { + buf = qtn_drm_nbr_of_years_one_final; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_years_two_four +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_years_two_four + { + buf = qtn_drm_nbr_of_years_two_four; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_years_five_zero +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_years_five_zero + { + buf = qtn_drm_nbr_of_years_five_zero; + } + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_months_one +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_months_one + { + buf = qtn_drm_nbr_of_months_one; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_months_two_four +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_months_two_four + { + buf = qtn_drm_nbr_of_months_two_four; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_months_five_zero +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_months_five_zero + { + buf = qtn_drm_nbr_of_months_five_zero; + } + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_days_one +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_days_one + { + buf = qtn_drm_nbr_of_days_one; + } + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_days_one_final +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_days_one_final + { + buf = qtn_drm_nbr_of_days_one_final; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_days_two_four +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_days_two_four + { + buf = qtn_drm_nbr_of_days_two_four; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_days_five_zero +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_days_five_zero + { + buf = qtn_drm_nbr_of_days_five_zero; + } + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_hours_one +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_hours_one + { + buf = qtn_drm_nbr_of_hours_one; + } + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_hours_one_final +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_hours_one_final + { + buf = qtn_drm_nbr_of_hours_one_final; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_hours_two_four +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_hours_two_four + { + buf = qtn_drm_nbr_of_hours_two_four; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_hours_five_zero +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_hours_five_zero + { + buf = qtn_drm_nbr_of_hours_five_zero; + } + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_mins_one +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_mins_one + { + buf = qtn_drm_nbr_of_mins_one; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_mins_one_final +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_mins_one_final + { + buf = qtn_drm_nbr_of_mins_one_final; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_mins_two_four +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_mins_two_four + { + buf = qtn_drm_nbr_of_mins_two_four; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_mins_five_zero +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_mins_five_zero + { + buf = qtn_drm_nbr_of_mins_five_zero; + } + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_secs_one +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_secs_one + { + buf = qtn_drm_nbr_of_secs_one; + } + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_secs_one_final +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_secs_one_final + { + buf = qtn_drm_nbr_of_secs_one_final; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_secs_two_four +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_secs_two_four + { + buf = qtn_drm_nbr_of_secs_two_four; + } + + +// --------------------------------------------------- +// +// r_file_drm_nbr_of_secs_five_zero +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_nbr_of_secs_five_zero + { + buf = qtn_drm_nbr_of_secs_five_zero; + } + +// --------------------------------------------------- +// +// r_file_drm_valid_from +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_valid_from + { + buf = qtn_drm_mgr_det_rvf_x ; + } + +// --------------------------------------------------- +// +// r_file_drm_det_valid_to +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_valid_to + { + buf = qtn_drm_mgr_det_rvt_x; + } + +// --------------------------------------------------- +// +// r_file_drm_cs +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_cs + { + buf = qtn_drm_mgr_det_cs; + } + +// --------------------------------------------------- +// +// r_file_drm_allowed +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_allowed + { + buf = qtn_drm_mgr_det_allowed; + } + +// --------------------------------------------------- +// +// r_file_drm_forbid +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_forbid + { + buf = qtn_drm_mgr_det_forbid; + } + +// --------------------------------------------------- +// +// r_file_drm_stat +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_stat + { + buf = qtn_drm_mgr_det_stat; + } + +// --------------------------------------------------- +// +// r_file_drm_valid +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_valid + { + buf = qtn_drm_mgr_det_valid; + } + +// --------------------------------------------------- +// +// r_file_drm_exp +// +// --------------------------------------------------- +// +RESOURCE TBUF r_file_drm_exp + { + buf = qtn_drm_mgr_det_exp; + } + + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/help/data/xhtml.zip Binary file svgtviewer/SvgtViewerPlugin/help/data/xhtml.zip has changed diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/help/group/bld.inf Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 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: +* Export help related files. +* +*/ + +#include +PRJ_EXPORTS +:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite +:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite + +../inc/svgt.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/svgt.hlp.hrh) +../rom/svgtviewerpluginhelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(svgtviewerpluginhelps_variant.iby) diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/help/inc/svgt.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/help/inc/svgt.hlp.hrh Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 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: +* +*/ + +// +// svgt.hlp.hrh generated by CSXHelp Utilities. +// + +#ifndef __SVGT_HLP_HRH__ +#define __SVGT_HLP_HRH__ + +_LIT(KSVGT_HLP_VIEWER, "SVGT_HLP_VIEWER"); // + +#endif \ No newline at end of file diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/help/rom/svgtviewerpluginhelps_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/help/rom/svgtviewerpluginhelps_variant.iby Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 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: IBY file for SVGTViewer Help +* +*/ + + +#ifndef __SVGTVIEWERHELPS_VARIANT_IBY__ +#define __SVGTVIEWERHELPS_VARIANT_IBY__ + +#if defined(FF_S60_HELPS_IN_USE) && defined(__SVGT_VIEWER) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F8749\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x101F8749\contents.zip) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F8749\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F8749\index.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F8749\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F8749\keywords.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F8749\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F8749\meta.xml) +#endif + +#endif diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/loc/svgtfileviewdetails.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/loc/svgtfileviewdetails.loc Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,513 @@ +/* +* Copyright (c) 2006 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: Localization strings for File view details +* +*/ + + + +//d: Heading Text for the presentation details like size, date, format etc. +//d: When the 'View Details' option is selected, the presentation details view appears. +//l: heading_pane_t1 +//w: +//r:3.0 +// +#define qtn_heading_pres_details "Presentation details" + +//d: Keyword conveying the size of the SVG-T file. +//d: When the 'View Details' option is selected, the presentation details view appears. +//d: The SVG-T files size information is displayed as "Size %N B", or "Size %N kB" +//d: where the %N is replaced by the number of bytes/kbytes of the size of file. +//l: list_double_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_details_size "Size" + +//d: Expressed in number of kbytes +//d: When the 'View Details' option is selected, the presentation details view appears. +//d: The SVG-T files size information is displayed as "Size %N kB", where the %N is replaced +//d: by the number of kbytes of the size of file. +//l: list_double_popup_menu_pane_2 +//w: +//r:3.0 +// +#define qtn_details_size_kb " %U kB" + +//d: Expressed in number of bytes +//d: When the 'View Details' option is selected, the presentation details view appears. +//d: The SVG-T files size information is displayed as "Size %N B", where the %N is replaced +//d: by the number of bytes of the size of file. +//l: list_double_popup_menu_pane_2 +//w: +//r:3.0 +// +#define qtn_details_size_b "%U B" + + +//d: Keyword conveying the Time when the SVG-T file was received in the system. +//d: When the 'View Details' option is selected, the presentation details view appears. +//l: list_double_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_details_time "Time" + + +//d: Keyword conveying the Date when the SVG-T file was received in the system. +//d: When the 'View Details' option is selected, the presentation details view appears. +//l: list_double_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_details_date "Date" + +//d: Keyword conveying the Format of the SVG-T file +//d: When the 'View Details' option is selected, the presentation details view appears. +//l: list_double_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_details_format "Format" + + +// ******************************* +// Copy from DRMRightsManager.loc +// ******************************* + +//d:Second part of the first line of the fourth entry of Details View listbox +//d:Related Media Object can be displayed (for example an image) +//l:list_single_big_heading_pane_1_2nd_part +//w: +//r:3.0 +// +#define qtn_drm_mgr_det2_display "Display" + +//d:Possible first line for fourth entry of Details View listbox +//d:%U is the type of rigths (qtn_drm_mgr_det2_play, qtn_drm_mgr_det2_display, +//d:qtn_drm_mgr_det2_execute or qtn_drm_mgr_det2_print) +//d:Second line is qtn_drm_mgr_det_unlimited, meaning that there are no +//d:constraints for this type of rights +//l:list_double_pane_1 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_full_x "Rights (%U)" + +//d:Possible second line for fourth entry of Details View listbox +//d:No constraints for this type of Right. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_unlimited "Unlimited" + +//d:Possible first line for fourth entry of Details View listbox +//d:%U is the type of rigths (qtn_drm_mgr_det2_play, qtn_drm_mgr_det2_display, +//d:qtn_drm_mgr_det2_execute or qtn_drm_mgr_det2_print) +//d:Second line is qtn_drm_mgr_det_1_count or qtn_drm_mgr_det_n_counts, +//d:meaning the number of times that this object can be used. +//l:list_double_pane_1 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_utl_x "Times left (%U)" + +//d:Possible second line for fourth entry of Details View listbox +//d:Usage times left is 1: it means that this object can be played, displayed, +//d:executed or printed (according to the examined type of right) only once +//d:more. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_1_count "1 count" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N is the number of counts +//d:Usage times left is %n: it means that this object can be played, displayed, +//d:executed or printed (according to the examined type of right) only %N times +//d:more. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_n_counts "%N counts" + +//d:Possible first line for fourth entry of Details View listbox +//d:%U is the type of rigths (qtn_drm_mgr_det2_play, qtn_drm_mgr_det2_display, +//d:qtn_drm_mgr_det2_execute or qtn_drm_mgr_det2_print) +//d:Second line is qtn_drm_mgr_det_not_act, meaning that this object has not +//d:been activated yet. +//l:list_double_pane_1 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_uts_x "Times status (%U)" + +//d:Possible second line for fourth entry of Details View listbox +//d:Rights not activated +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_not_act "Not activated" + +//d:Possible first line for fourth entry of Details View listbox +//d:%U is the type of rigths (qtn_drm_mgr_det2_play, qtn_drm_mgr_det2_display, +//d:qtn_drm_mgr_det2_execute or qtn_drm_mgr_det2_print) +//d:Second line is qtn_drm_mgr_det_inter or qtn_drm_mgr_det_inter_two, meaning +//d:a quantity of time that specifies how long this object can be used. +//l:list_double_pane_1 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_udl_x "Time left (%U)" + +//d:Possible second line for fourth entry of Details View listbox +//d:There is only one entry for an interval: e.g. "1 year" +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_inter "%U" + +//d:Possible second line for fourth entry of Details View listbox +//d:There are two entries for an interval: e.g. "1 year, 2 months" +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_inter_two "%0U, %1U" + +//d:Possible second line for fourth entry of Details View listbox +//d:It reports that the time constraint for this type of object is 1 year. +//d:Other quantities of time may follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_years_one "1 year" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of years of an interval +//d:It is used for period of years ending with 1 from 21 (21, 31, 41, etc.) +//d:It reports that the time constraint for this type of object is %N years. +//d:Other quantities of time may follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_years_one_final "%N years" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of years of an interval +//d:It is used for period of years ending from 2 to 4, excluded 12-14 (2-4, +//d:22-24, 32-34, etc.) +//d:It reports that the time constraint for this type of object is %N years. +//d:Other quantities of time may follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_years_two_four "%N years" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of years of an interval +//d:It is used for period of years ending from 5 to 0 plus range between 11 and +//d:14 (5-20, 25-30, 35-40, etc.) +//d:It reports that the time constraint for this type of object is %N years. +//d:Other quantities of time may follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_years_five_zero "%N years" + +//d:Possible second line for fourth entry of Details View listbox +//d:It reports that the time constraint for this type of object is 1 month. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_months_one "1 month" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of months of an interval +//d:It is used for period from two to four months +//d:It reports that the time constraint for this type of object is %N months. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_months_two_four "%N months" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of months of an interval +//d:It is used for period greater than four months +//d:It reports that the time constraint for this type of object is %N months. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_months_five_zero "%N months" + +//d:Possible second line for fourth entry of Details View listbox +//d:It reports that the time constraint for this type of object is 1 day. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_days_one "1 day" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of days of an interval +//d:It is used for a period of 21 days +//d:It reports that the time constraint for this type of object is %N days. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_days_one_final "%N days" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of days of an interval +//d:It is used for period of days ending from 2 to 4, excluded 12-14 (2-4, +//d:22-24) +//d:It reports that the time constraint for this type of object is %N days. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_days_two_four "%N days" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of days of an interval +//d:It is used for period of days ending from 5 to 0 plus range between 11 and +//d:14 (5-20, 25-30) +//d:It reports that the time constraint for this type of object is %N days. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_days_five_zero "%N days" + +//d:Possible second line for fourth entry of Details View listbox +//d:It reports that the time constraint for this type of object is 1 hour. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_hours_one "1 hour" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of hours of an interval +//d:It is used for a period of 21 hours +//d:It reports that the time constraint for this type of object is %N hours. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_hours_one_final "%N hours" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of hours of an interval +//d:It is used for period of hours ending from 2 to 4, excluded 12-14 (2-4, +//d:22-23) +//d:It reports that the time constraint for this type of object is %N hours. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_hours_two_four "%N hours" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of hours of an interval +//d:It is used for a period included from 5 to 20 hours +//d:It reports that the time constraint for this type of object is %N hours. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_hours_five_zero "%N hours" + +//d:Possible second line for fourth entry of Details View listbox +//d:It reports that the time constraint for this type of object is 1 minute. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_mins_one "1 minute" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of minutes of an interval +//d:It is used for period of minutes ending with 1 from 21 (21, 31, 41, 51) +//d:It reports that the time constraint for this type of object is %N minutes. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_mins_one_final "%N minutes" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of minutes of an interval +//d:It is used for period of minutes ending from 2 to 4, excluded 12-14 (2-4, +//d:22-24, 32-34, 42-44, 52-54) +//d:It reports that the time constraint for this type of object is %N minutes. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_mins_two_four "%N minutes" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of minutes of an interval +//d:It is used for period of minutes ending from 5 to 0 plus range between 11 +//d:and 14 (5-20, 25-30, 35-40, 45-50, 53-59) +//d:It reports that the time constraint for this type of object is %N minutes. +//d:Other quantities of time may precede or follow. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_mins_five_zero "%N minutes" + +//d:Possible second line for fourth entry of Details View listbox +//d:It reports that the time constraint for this type of object is 1 second. +//d:Other quantities of time may precede. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_secs_one "1 second" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of seconds of an interval +//d:It is used for period of seconds ending with 1 from 21 (21, 31, 41, 51) +//d:It reports that the time constraint for this type of object is %N seconds. +//d:Other quantities of time may precede. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_secs_one_final "%N seconds" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of seconds of an interval +//d:It is used for period of seconds ending from 2 to 4, excluded 12-14 (2-4, +//d:22-24, 32-34, 42-44, 52-54) +//d:It reports that the time constraint for this type of object is %N seconds. +//d:Other quantities of time may precede. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_secs_two_four "%N seconds" + +//d:Possible second line for fourth entry of Details View listbox +//d:%N number of seconds of an interval +//d:It is used for period of minutes ending from 5 to 0 plus range between 11 +//d:and 14 (5-20, 25-30, 35-40, 45-50, 53-59) +//d:It reports that the time constraint for this type of object is %N seconds. +//d:Other quantities of time may precede. +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_nbr_of_secs_five_zero "%N seconds" + +//d:Possible first line for fourth entry of Details View listbox +//d:%U is the type of rigths (qtn_drm_mgr_det2_play, qtn_drm_mgr_det2_display, +//d:qtn_drm_mgr_det2_execute or qtn_drm_mgr_det2_print) +//d:Second line is a date, meaning when the object started to be valid. +//l:list_double_pane_1 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_rvf_x "Valid from (%U)" + +//d:Possible first line for fourth entry of Details View listbox +//d:%U is the type of rigths (qtn_drm_mgr_det2_play, qtn_drm_mgr_det2_display, +//d:qtn_drm_mgr_det2_execute or qtn_drm_mgr_det2_print) +//d:Second line is a date, meaning until when the object is valid. +//l:list_double_pane_1 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_rvt_x "Valid until (%U)" + +//d:First line of third entry of Details View listbox +//d:It reports if it is possible to send Media Object or not. +//d:Second line is qtn_drm_mgr_det_allowed or qtn_drm_mgr_det_forbid +//l:list_double_pane_1 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_cs "Content sending" + +//d:Possible second line for third entry of Details View listbox +//d:Sending of the content is allowed +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_allowed "Allowed" + +//d:Possible second line for third entry of Details View listbox +//d:Sending of the content is forbidden +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_forbid "Not allowed" + +//d:First line of first entry of Details View listbox +//d:It indicates the current status of the selected Right Object +//d:Second line is qtn_drm_mgr_det_valid or qtn_drm_mgr_det_exp +//l:list_double_pane_1 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_stat "Status" + +//d:Possible second line for first entry of Details View listbox +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_valid "Activation key is valid" + +//d:Possible second line for first entry of Details View listbox +//l:list_double_pane_2 +//w: +//r:3.0 +// +#define qtn_drm_mgr_det_exp "Activation key expired" + + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/loc/svgtuicontrol.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/loc/svgtuicontrol.loc Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,339 @@ +/* +* Copyright (c) 2004-2006 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: Localization strings for SVGT UI Control +* +*/ + + +// APPLICATION NAME + +//d:Short name of the application, application shell grid layout +//l:cell_app_pane_1 +// +#define qtn_apps_sv_grid "SVGT Viewer" + +//d: Option in the Options menu. +//d: The option is used to rotate the presentation with selected angle. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.1 +#define qtn_svgt_options_rotate "Rotate" + +//d: Sub-menu for the "Rotate" option. +//d: The presentation is rotated with angle 90 degrees. +//l: list_single_popup_submenu_pane_1 +//w: +//r:3.1 +#define qtn_svgt_options_rotate_90 "90°" + +//d: Sub-menu for the "Rotate" option. +//d: The presentation is rotated with angle 180 degrees. +//l: list_single_popup_submenu_pane_1 +//w: +//r:3.1 +#define qtn_svgt_options_rotate_180 "180°" + +//d: Sub-menu for the "Rotate" option. +//d: The presentation is rotated with angle 270 degrees. +//l: list_single_popup_submenu_pane_1 +//w: +//r:3.1 +#define qtn_svgt_options_rotate_270 "270°" + +//d: Option in the Options menu. +//d: Available when SVG-T Viewer is launched from applications which are +//d: used for storing media files, like the Media Gallery application. +//d: Gives details of the file like size, date, format etc. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_view_details "View details" + +//d: Option in the Options menu. +//d: Available when the full screen option is selected. Used to bring back the view to +//d: normal screen mode. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_normal_screen "Normal screen" + +//d: Option in the Options menu. +//d: The option is available when the SVG-T presentation being viewed in normal screen +//d: mode. The option is used to view the presentation in full screen mode. +//d: In Full screen mode Status pane and Control pane are not visible. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_full_screen "Full screen" + +//d: Option in the Options menu. +//d: The option is used to search the text in the SVG-T presentation. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_find_text "Find text" + +//d: Option in the Options menu. +//d: The option is used to set the presentation mode to playing continuously or once. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_loop "Loop" + +//d: Sub-menu for the "Loop" option. +//d: The presentation is played only once if this sub-menu is selected. +//l: list_single_popup_submenu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_loop_off "Off" + +//d: Sub-menu for the "Loop" option. +//d: The presentation is played continuously so that when it reaches the end, it starts all over again. +//l: list_single_popup_submenu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_loop_on "On" + +//d: Option in the Options menu. +//d: Option to stop the presentation, will appear if presentation is played or paused. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_stop "Stop" + +#ifdef RD_SVGT_AUDIO_SUPPORT +//d: Option in the Options menu. +//d: Option to set the volume for the presentation. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.2 +// +#define qtn_svgt_options_setvolume "Set Volume" + +//d: Option in the Options menu. +//d: Option to mute the volume for the presentation. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.2 +// +#define qtn_svgt_options_mute "Mute" + +//d: Option in the Options menu. +//d: Option to unmute the volume for the presentation. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.2 +// +#define qtn_svgt_options_unmute "Unmute" +#endif //RD_SVGT_AUDIO_SUPPORT + +//d: Option in the Options menu. +//d: Option to pause the presentation, will appear if presentation is being played. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_pause "Pause" + +//d: Option in the Options menu. +//d: Option to play the presentation, will appear if presentation is stopped or paused. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_play "Play" + +//d: Option in the Options menu. +//d: Option to zoom out a zoomed-in presentation. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_zoom_out "Zoom out" + +//d: Option in the Options menu. +//d: Option to zoom-in a presentation. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_zoom_in "Zoom in" + +//d: Option in the Options menu. +//d: Saves the image into Media Gallery. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.0 +// +#define qtn_svgt_options_save "Save" + + + +//d: The progress note text. +//d: When the zoom-in or zoom-out option is selected, the progress note zooming is displayed +//d: until the presentation is zoomed. +//l: popup_note_wait_window_1 +//w: +//r:3.0 +// +#define qtn_svgt_waiting_zooming "Zooming" + + +//d: Wait Note. +//d: When the SVG-T file is opened, the "opening file" wait note is displayed, +//d: until the presentation is completed loaded by the engine. +//l: popup_note_wait_window_1 +//w: +//r:3.0 +// +#define qtn_svgt_waiting_opening "Opening file" + +//d: Information note for the text area editing and text editing. +//d: If "<" or ">" is found in edited content of text area and text then error has to be flashed +//l: popup_note_window +//w: +//r:3.1 +// +#define qtn_svgt_braces_found_in_textarea "< and > characters not allowed in editable area" + + + +//d: Information note for the "Find Text" option. +//d: If the Find text option does not give any results, an information note "Text not found" is displayed. +//l: popup_note_window +//w: +//r:3.0 +// +#define qtn_svgt_info_not_found "Text not found" + +//d: If some parts of the presentation (like embedded files) can not be shown, an +//d: information note "Unable to show all content" is displayed. +//l: popup_note_window +//w: +//r:3.0 +// +#define qtn_svgt_info_not_complete "Unable to show all content" + +//d: If the presentation can not be opened for any reason (for example a corrupted +//d: file or an unsupported format), an information note "Unable to open file" +//d: is displayed at the calling application and the viewer is not opened. +//l: popup_note_window +//w: +//r:3.0 +// +#define qtn_svgt_info_unable_to_open "Unable to open file" + + +//d: "Find Text" Query Prompt Text +//l: popup_query_data_window_1 +//w: +//r:3.0 +// +#define qtn_svgt_query_enter_string "Enter query string: " + + +//d: If a video call is going on the viewer is not allowed to be opened. +//l: popup_note_window +//w: +//r:3.0 +// +#define qtn_svgt_info_video_call_ongoing "SVG-T Viewer cannot be used during video call" + +//d: If a synchronous download of a remote image is going on, the +//d: "downloading file" wait note is displayed +//l: popup_note_wait_window_1 +//w: +//r:3.0 +// +#define qtn_svgt_waiting_downloading "downloading " + +//d: If a locally linked image is not found, the information note +//d: "File not found" displayed +//l: popup_note_window +//w: +//r:3.0 +// +#define qtn_svgt_file_not_found "File not found" + +//d: Progress Indicator Format String +//d: %0U is elapsed time +//d: %1U is the total duration of the presentation +//d: ( Both the Unicode texts are formatted with +//d: qtn_time_durat_min_sec_with_zero if the time is less than or +//d: equal to One hour, else qtn_time_durat_long ) +//l: navi_pane_5 +//w: +//r:3.0 +// +#define qtn_svgt_time_indic "%0U/%1U" +//d:Used as a confirmation query in situations where user wants to +//d:exit but the downloaded content is not saved. %U is replaced +//d:with the downloaded content name. +//l:popup_note_window +//w: +//r:3.0 +// +#define qtn_iv_query_conf_save_downloaded "%U has not been saved. Save now?" + +//d:Options menu item for the Client App to open Downloads List. +//l:list_single_popup_menu_pane_1 +//w: +// +#define qtn_browser_list_downloads "Downloads" + +//d:Saved information note. +//d:Shown when media clip is saved to Media Gallery. +//l:popup_note_window +// + + +//d: Text Edit Query Prompt Text +//l: popup_query_data_window_1 +//w: +//r:3.0 +// +#define qtn_svgt_edit_query_string "Edit Text" + +//d: Text Selection Query Prompt Text +//l: popup_query_data_window_1 +//w: +//r:3.0 +// +#define qtn_svgt_select_query_string "Select Text" + +//d: Option in the Options menu. +//d: The option is used to select the text which is present below the pointer. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.1 +// +#define qtn_svgt_options_select_text "Select Text" + +//d: Option in the Options menu. +//d: The option is used to edit the text which is present below the pointer. +//l: list_single_popup_menu_pane_1 +//w: +//r:3.1 +// +#define qtn_svgt_options_edit_text "Edit Text" + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/rom/SVGCodec.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/rom/SVGCodec.iby Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2004, 2005 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: IBY file for SVGCodec +* +*/ + +#ifndef __SVGCODEC_IBY +#define __SVGCODEC_IBY + +#ifdef __SVGT_VIEWER + +// SVG Codec Implementation DLL and ECOM Registration resource +ECOM_PLUGIN(SVGCodec.dll,102073D7.rsc) +data=ZRESOURCE\ICL\102073D7_extra.rsc Resource\ICL\102073D7_extra.rsc + +#endif // __SVGT_VIEWER + +#endif // __SVGCODEC_IBY +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/rom/SVGScreenSaverPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/rom/SVGScreenSaverPlugin.iby Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2005 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: IBY file for SVGScreenSaver +* +*/ + +#ifndef __SVGTSCREENSAVER_IBY +#define __SVGTSCREENSAVER_IBY + +#ifdef __SVGT_VIEWER +#ifdef __SVGT_SCREENSAVER_PLUGIN + +ECOM_PLUGIN(SVGTScreenSaverPlugin.dll,102071E7.rsc) + +#endif // __SVGT_SCREENSAVER_PLUGIN +#endif // __SVGT_VIEWER + +#endif // __SVGTSCREENSAVER_IBY +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/rom/SVGTAppObserverUtil.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/rom/SVGTAppObserverUtil.iby Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2004 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: IBY file for SVGTViewerAppObserverUtil +* +*/ + +#ifndef __SVGTVIEWERAPPOBSERVERUTIL_IBY +#define __SVGTVIEWERAPPOBSERVERUTIL_IBY + +#ifdef __SVGT_VIEWER + +file=ABI_DIR\BUILD_DIR\SVGTAppObserverUtil.dll SHARED_LIB_DIR\SVGTAppObserverUtil.dll + +#endif // __SVGT_VIEWER + +#endif // __SVGTVIEWERAPPOBSERVERUTIL_IBY +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/rom/SVGTAppObserverUtilResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/rom/SVGTAppObserverUtilResources.iby Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2004 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: IBY file for SVGTViewerAppObserverUtil localisable resources +* +*/ + +#ifndef __SVGTVIEWERAPPOBSERVERUTILRESOURCES_IBY +#define __SVGTVIEWERAPPOBSERVERUTILRESOURCES_IBY + +#ifdef __SVGT_VIEWER + +data=DATAZ_\RESOURCE_FILES_DIR\SVGTAppObserverUtil.rsc RESOURCE_FILES_DIR\SVGTAppObserverUtil.rsc + +#endif // __SVGT_VIEWER + +#endif // __SVGTVIEWERAPPOBSERVERUTILRESOURCES_IBY +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/rom/SVGTFileViewDetails.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/rom/SVGTFileViewDetails.iby Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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: IBY file for SVGTFileViewDetails +* +*/ + +#ifndef __SVGTFILEVIEWDETAILS_IBY +#define __SVGTFILEVIEWDETAILS_IBY + +#ifdef __SVGT_VIEWER + +file=ABI_DIR\BUILD_DIR\SVGTFileViewDetails.dll SHARED_LIB_DIR\SVGTFileViewDetails.dll + +#endif // __SVGT_VIEWER + +#endif // __SVGTFILEVIEWDETAILS_IBY +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/rom/SVGTFileViewDetailsResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/rom/SVGTFileViewDetailsResources.iby Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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: IBY file for SVGTFileViewDetails localisable resources +* +*/ + +#ifndef __SVGTFILEVIEWDETAILSRESOURCES_IBY +#define __SVGTFILEVIEWDETAILSRESOURCES_IBY + +#ifdef __SVGT_VIEWER + +data=DATAZ_\RESOURCE_FILES_DIR\SVGTFileViewDetails.rsc RESOURCE_FILES_DIR\SVGTFileViewDetails.rsc + +#endif // __SVGT_VIEWER + +#endif // __SVGTFILEVIEWDETAILSRESOURCES_IBY +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/rom/SVGTUIControl.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/rom/SVGTUIControl.iby Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2004 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: IBY file for SVGTUIControl +* +*/ + +#ifndef __SVGTUICONTROL_IBY +#define __SVGTUICONTROL_IBY + +#ifdef __SVGT_VIEWER + +file=ABI_DIR\BUILD_DIR\SVGTUIControl.dll SHARED_LIB_DIR\SVGTUIControl.dll +SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, SVGTUIControl ) + +#endif // __SVGT_VIEWER + +#endif // __SVGTUICONTROL_IBY +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/rom/SVGTUIControlResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/rom/SVGTUIControlResources.iby Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2004 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: IBY file for SVGTUIControl localisable resources +* +*/ + +#ifndef __SVGTUICONTROLRESOURCES_IBY +#define __SVGTUICONTROLRESOURCES_IBY + +#ifdef __SVGT_VIEWER + +data=DATAZ_\RESOURCE_FILES_DIR\SVGTUIControl.rsc RESOURCE_FILES_DIR\SVGTUIControl.rsc + +#endif // __SVGT_VIEWER + +#endif // __SVGTUICONTROLRESOURCES_IBY +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/rom/SVGTViewerApp.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/rom/SVGTViewerApp.iby Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2004 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: IBY file for SVGT Viewer App +* +*/ + +#ifndef __SVGTVIEWERAPP_IBY +#define __SVGTVIEWERAPP_IBY + +#ifdef __SVGT_VIEWER + +S60_APP_EXE( SVGTViewerApp ) +S60_APP_AIF_ICONS( SVGTViewerApp ) +S60_APP_AIF_RSC( SVGTViewerApp ) + +#endif // __SVGT_VIEWER + +#endif // __SVGTVIEWERAPP_IBY + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/rom/SVGTViewerAppResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/rom/SVGTViewerAppResources.iby Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2004 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: IBY file for SVGT Viewer App Localisable Resources +* +*/ + +#ifndef __SVGTVIEWERAPPRESOURCES_IBY +#define __SVGTVIEWERAPPRESOURCES_IBY + +#ifdef __SVGT_VIEWER + +data=DATAZ_\APP_RESOURCE_DIR\SVGTViewerApp.rsc APP_RESOURCE_DIR\SVGTViewerApp.rsc + +#endif // __SVGT_VIEWER + +#endif // __SVGTVIEWERAPPRESOURCES_IBY + +// End of File diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/group/bld.inf Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2006 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: Highlevel bld.inf +* +*/ + + + + + +/* +* Order is important +*/ +#include "../SvgtViewerPlugin/Group/bld.inf" + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES diff -r e52958d06c29 -r 5fd161fa28b6 sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r e52958d06c29 -r 5fd161fa28b6 systemDefinition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemDefinition.xml Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,33 @@ + + + + + + + + +]> + + + +&layer_file; + + +&targetDefinition_file; + + + + +&defaultbuild_file; + + + + + +&defaultclean_file; + + + + diff -r e52958d06c29 -r 5fd161fa28b6 systemDefinitionLayer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemDefinitionLayer.xml Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +