csxhelp/inc/CSXHHtmlTopicContainer.h
changeset 0 1f04cf54edd8
child 1 27f5851bd5a5
equal deleted inserted replaced
-1:000000000000 0:1f04cf54edd8
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  CCSXHHtmlTopicContainer class declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef INC_CCSXHHTMLTOPICCONTAINER_H__
       
    20 #define INC_CCSXHHTMLTOPICCONTAINER_H__
       
    21 //If I use INC_CCSXHHTMLTOPICCONTAINER_H__, then CodeScanner fails 
       
    22 //but if I use INC_CCSXH_HTML_TOPIC_CONTAINER_H__ code scanner 
       
    23 //reports an error but produces results for other files
       
    24 
       
    25 #include <coecntrl.h>
       
    26 #include <BrCtlLinkResolver.h>
       
    27 #include <brctlinterface.h>
       
    28 //RUNTIME
       
    29 #include <featurecontrol.h>
       
    30 
       
    31 class CBrCtlInterface;
       
    32 class CCSXHDocument;
       
    33 class CCSXHHtmlTOC2;
       
    34 class CCSXHHtmlTopicView;
       
    35 class AppLauncherForCSXH;
       
    36 class CCSXHHelpContentBase;
       
    37 
       
    38 typedef CBrCtlInterface* (*FuncPtr_CreateBrowserControlL) (CCoeControl* aParent, TRect aRect,
       
    39     TUint aBrCtlCapabilities, TUint aCommandIdBase = TBrCtlDefs::ECommandIdBase,
       
    40     MBrCtlSoftkeysObserver* aBrCtlSoftkeysObserver = NULL,
       
    41     MBrCtlLinkResolver* aBrCtlLinkResolver = NULL,
       
    42     MBrCtlSpecialLoadObserver* aBrCtlSpecialLoadObserver = NULL,
       
    43     MBrCtlLayoutObserver* aBrCtlLayoutObserver = NULL,
       
    44     MBrCtlDialogsProvider* aBrCtlDialogsProvider = NULL,
       
    45     MBrCtlWindowObserver* aBrCtlWindowObserver = NULL,
       
    46 	MBrCtlDownloadObserver* aBrCtlDownloadObserver = NULL );
       
    47 /** 
       
    48 * @class CCSXHHtmlTopicContainer
       
    49 * This class provides Browser functionality
       
    50 */
       
    51 
       
    52 class CCSXHHtmlTopicContainer : public CCoeControl, public MBrCtlLinkResolver, 
       
    53 								public MBrCtlLinkContent, public MBrCtlLoadEventObserver,
       
    54 								public MBrCtlSoftkeysObserver,public MBrCtlLayoutObserver
       
    55     {
       
    56 public:
       
    57 
       
    58 /** 
       
    59 *  @function NewL
       
    60 *  @since S60 3.2
       
    61 *  Construct a CCSXHHtmlTopicContainer 
       
    62 *  and return a pointer to the created object
       
    63 *  @param aRect - TRect Object
       
    64 *		  aDocument - Document Object 
       
    65 *		  aView		- HtmlTopicView Pointer
       
    66 *  @return a CCSXHHtmlTopicContainer Pointer 
       
    67 */
       
    68     static CCSXHHtmlTopicContainer* NewL(const TRect& aRect,CCSXHDocument 
       
    69     &aDocument,CCSXHHtmlTopicView *aView);
       
    70 
       
    71 /** 
       
    72 *  @function NewLC
       
    73 *  @since S60 3.2
       
    74 *  Construct a CCSXHHtmlTopicContainer 
       
    75 *  and return a pointer to the created object using two phase constuction
       
    76 *  @param aRect - TRect Object
       
    77 *		  aDocument - Document Object 
       
    78 *		  aView		- HtmlTopicView Pointer
       
    79 *  @return a CCSXHHtmlTopicContainer Pointer 
       
    80 */
       
    81     static CCSXHHtmlTopicContainer* NewLC(const TRect& aRect,CCSXHDocument
       
    82      &aDocument,CCSXHHtmlTopicView *aView);
       
    83 
       
    84 /** 
       
    85 *  @function CCSXHHtmlTopicContainer
       
    86 *  @since S60 3.2
       
    87 *  Construct a CCSXHHtmlTopicContainer 
       
    88 *  and return a pointer to the created object using two phase constuction
       
    89 *  @param aRect - TRect Object
       
    90 *		  aDocument - Document Object 
       
    91 *		  aView		- HtmlTopicView Pointer
       
    92 *  @return a CCSXHHtmlTopicContainer Pointer 
       
    93 */
       
    94 	CCSXHHtmlTopicContainer(CCSXHDocument &aDocument, CCSXHHtmlTopicView *aView);
       
    95 /** 
       
    96  * @function ~CCSXHHtmlTopicContainer
       
    97  * @since S60 3.2
       
    98  * Destroy the object and release all memory objects
       
    99  */
       
   100   ~CCSXHHtmlTopicContainer();
       
   101   
       
   102 /** 
       
   103  * @function SetAndLoadInitialTopicL
       
   104  * @since S60 3.2
       
   105  * Destroy the object and release all memory objects
       
   106  * @param aTopic - Initial Topic to be displayed 
       
   107  */  
       
   108  void SetAndLoadInitialTopicL(CCSXHHtmlTOC2* aTopic);
       
   109      
       
   110 public:  
       
   111 /**
       
   112 * From MBrCtlSoftkeysObserver class
       
   113 *  Browser plug-in calls this method requests to update a softkey 
       
   114 *  @function UpdateSoftkeyL    
       
   115 *  @since S60 3.2
       
   116 *  @Param aKeySoftkey	- Update the left softkey or the right softkey  
       
   117 *		 aLabel			- The label associated with the softkey update  
       
   118 *		 aCommandId		- The command to use if the softkey is selected by the user  
       
   119 *		 aBrCtlSoftkeyChangeReason - The reason for the softkey change  
       
   120 */
       
   121 void UpdateSoftkeyL(TBrCtlKeySoftkey aKeySoftkey,
       
   122                                     const TDesC& aLabel,
       
   123                                     TUint32 aCommandId,
       
   124                                     TBrCtlSoftkeyChangeReason aBrCtlSoftkeyChangeReason);
       
   125 
       
   126 /**
       
   127 * From MBrCtlLayoutObserver Class
       
   128 *  Browser plug-in calls this method to Update the position of vertical scrollbar
       
   129 *  @function UpdateBrowserVScrollBarL
       
   130 *  @since S60 3.2    
       
   131 *  @Param  aDocumentHeight - The total height of the markup page  
       
   132 * 		   aDisplayHeight  - The height of the display  
       
   133 * 		   aDisplayPosY    - The current Y position  
       
   134 */                                    
       
   135  void UpdateBrowserVScrollBarL(TInt aDocumentHeight, 
       
   136                                               TInt aDisplayHeight,
       
   137                                               TInt aDisplayPosY ) ;
       
   138                                               
       
   139 /**
       
   140 * From MBrCtlLayoutObserver Class
       
   141 *  Browser plug-in calls this method to Update the position of horizontal scrollbar
       
   142 *  @function UpdateBrowserHScrollBarL
       
   143 *  @since S60 3.2    
       
   144 *  @Param  aDocumentWidth - The total width of the markup page  
       
   145 * 		   aDisplayWidth  - The width of the display  
       
   146 * 		   aDisplayPosX    - The current X position  
       
   147 */                                              
       
   148 void UpdateBrowserHScrollBarL(TInt aDocumentWidth, 
       
   149                                               TInt aDisplayWidth,
       
   150                                               TInt aDisplayPosX );
       
   151                                               
       
   152 /**
       
   153 * From MBrCtlLayoutObserver Class
       
   154 *  Browser plug-in calls this method to Inform the layout of the page: right to left or left to right
       
   155 *  @function NotifyLayoutChange    
       
   156 *  @since S60 3.2
       
   157 *  @Param  aNewLayout - RTL or LTR 
       
   158 */                                              
       
   159 void NotifyLayoutChange( TBrCtlLayout aNewLayout );
       
   160   
       
   161 /**
       
   162 * From MBrCtlLayoutObserver Class
       
   163 *  Browser plug-in calls this method to Inform the layout of the page: right to left or left to right
       
   164 *  @function UpdateTitleL
       
   165 *  @since S60 3.2    
       
   166 *  @Param  aTitle - Title of the page 
       
   167 */        
       
   168 void UpdateTitleL( const TDesC& aTitle );                                   
       
   169 
       
   170 public:  // from CCoeControl
       
   171 /** 
       
   172 *  From CoeControl class
       
   173 *  @function SizeChanged
       
   174 *  @since S60 3.2
       
   175 *  re-allocates and re-sizes components.
       
   176 */
       
   177 	void SizeChanged();
       
   178 /** 
       
   179 *  From CoeControl class
       
   180 *  @function CountComponentControls
       
   181 *  @since S60 3.2
       
   182 *  @return Number of child controls this has.  
       
   183 */	
       
   184 	TInt CountComponentControls() const;
       
   185 
       
   186 /** 
       
   187 *  From CoeControl class
       
   188 *  @function ComponentControl
       
   189 *  @since S60 3.2
       
   190 * @param aIndex index of child controls
       
   191 * @retrun pointer to child control
       
   192 */	
       
   193 	CCoeControl* ComponentControl(TInt aIndex) const;
       
   194 /** 
       
   195 *  From CoeControl class
       
   196 *  @function OfferKeyEventL
       
   197 *  @since S60 3.2
       
   198 *  Progress Key Event
       
   199 *  @param aKeyEvent the key event
       
   200 *  @param aType EEventKey | EEventKeyUp | EEventKeyDown
       
   201 *  @return EKeyWasConsumed if key event is processed,
       
   202 *         otherwise EKeyWasNotConsumed
       
   203 */
       
   204 	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   205 
       
   206 /** 
       
   207 *  From MBrCtlLoadEventObserver class
       
   208 *  @function HandleBrowserLoadEventL
       
   209 *  @since S60 3.2
       
   210 *  A load events notification
       
   211 *  @param aLoadEvent - The load event  
       
   212 *  		  aSize  	 - Size depends on the event  
       
   213 *  		  aTransactionId  - The transaction id of the transaction that had this event  
       
   214 */	
       
   215 	void HandleBrowserLoadEventL(TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, 
       
   216 								TUint aSize, TUint16 aTransactionId);
       
   217 
       
   218 /** 
       
   219 *  @function RefreshL
       
   220 *  @since S60 3.2
       
   221 *  Used to Refresh the Content
       
   222 *  @param aTopic - CCSXHHtmlTOC2 Object  
       
   223 */	
       
   224 	void RefreshL(CCSXHHtmlTOC2 *aTopic);
       
   225 	
       
   226 /** 
       
   227 *  @function HandleBackKeyL
       
   228 *  Handle Back Key
       
   229 *  @since S60 3.2
       
   230 *  @return ETrue, if the key is handled in the container, EFalse otherwise 
       
   231 */ 
       
   232 	TBool HandleBackKeyL();
       
   233 
       
   234 /** 
       
   235 *  @function IsPrevHtmlPageAvblL
       
   236 *  Check for Existance of the page in the Browser history stack
       
   237 *  @since S60 3.2
       
   238 *  @return ETrue, if page is available in Browser History Stack, EFalse otherwise 
       
   239 */ 
       
   240 	TBool IsPrevHtmlPageAvblL();
       
   241 
       
   242 /** 
       
   243 *  @function SetSelectedFontSizeL
       
   244 *  Sets BrowserFontsize
       
   245 *  @since S60 3.2
       
   246 *  @param aValue - Fontsize Value
       
   247 */	
       
   248 	void SetSelectedFontSizeL(TInt aValue);
       
   249 	
       
   250 /** 
       
   251 *  @function SetSelectedFontSizeL
       
   252 *  Get Current Settings Value
       
   253 *  @since S60 3.2
       
   254 *  @param aValue - Any Setting 
       
   255 *  @return Current Value used by Browser
       
   256 */	
       
   257 	TInt GetCurrentValueL(TInt aSetting);
       
   258 
       
   259 /** 
       
   260 *  @function HandleCommandBackL
       
   261 *  @since S60 3.2
       
   262 *  Handles resource changes.
       
   263 *  pass OpenLink command to the browser HandlecommandL 
       
   264 */
       
   265 	void HandleCommandOpenHyperLinkL();
       
   266 
       
   267 /** 
       
   268 *  From CoeControl class
       
   269 *  @function Draw
       
   270 *  @since S60 3.2
       
   271 *  Draw() for drawing the Background
       
   272 */
       
   273     void Draw(const TRect& aRect) const;
       
   274   
       
   275   	void ShowIndexHtmlPageL() const;
       
   276 /** 
       
   277 *  @function HandleResourceChange
       
   278 *  @since S60 3.2
       
   279 *  Handles resource changes.
       
   280 *  This function is called by framework when when e.g skin or locale is changed.
       
   281 *  @param aType resource change type
       
   282 */    	
       
   283    	void HandleResourceChange(TInt aType);
       
   284 
       
   285 /** 
       
   286 *  @function HandleResourceChangeImpl
       
   287 *  @since S60 3.2
       
   288 *  Handles resource changes.
       
   289 *  Implementation function for resource change
       
   290 *  @param aType resource change type
       
   291 */    	
       
   292     	void HandleResourceChangeImpl(TInt aType);
       
   293 
       
   294 /** 
       
   295 *  @function HandleCommandBackL
       
   296 *  @since S60 3.2
       
   297 *  Handles resource changes.
       
   298 *  pass Back command to the browser HandlecommandL 
       
   299 */   	
       
   300 	void HandleCommandBackL();
       
   301 	
       
   302 /**
       
   303 * Browser plug-in calls this method when embedded link is found. Used with ECapabilityClientResolveEmbeddedURL
       
   304 * @since 3.2
       
   305 * @param aEmbeddedUrl The url of the embedded content
       
   306 * @param aCurrentUrl The url of the current page
       
   307 * @param aLoadContentType The expected type of the embedded content
       
   308 * @param aEmbeddedLinkContent a callback interface to return the embedded content
       
   309 * @return EFalse, browser will resolve the link
       
   310 */
       
   311     TBool ResolveEmbeddedLinkL(const TDesC& aEmbeddedUrl,
       
   312     		                               const TDesC& aCurrentUrl,
       
   313         	                               TBrCtlLoadContentType aLoadContentType, 
       
   314         	                               MBrCtlLinkContent& aEmbeddedLinkContent); 
       
   315 		
       
   316 /**
       
   317 * Browser plug-in calls this method when the user requests to load content via selecting a link, or any other way. Used with ECapabilityClientNotifyURL 
       
   318 * @since 3.2
       
   319 * @param aUrl The requested url
       
   320 * @param aCurrentUrl The url of the current page
       
   321 * @param aBrCtlLinkContent a callback interface to return the embedded content
       
   322 * @return EFalse, browser will resolve the link
       
   323 */
       
   324         TBool ResolveLinkL(const TDesC& aUrl, const TDesC& aCurrentUrl,
       
   325                                    MBrCtlLinkContent& aBrCtlLinkContent);
       
   326 
       
   327 /**
       
   328 * @function CancelFetchL
       
   329 * Cancel all outstanding resolving operations
       
   330 */
       
   331         void CancelFetchL();
       
   332 /**
       
   333 * @function CancelAll
       
   334 * Cancel all outstanding resolving operations
       
   335 * @since 3.2
       
   336 */
       
   337         void CancelAll();
       
   338         
       
   339         
       
   340 /**
       
   341 * @function HandleResolveComplete
       
   342 * @since 3.2	
       
   343 * Resolver calls this method when content is resolved.
       
   344 * @param aContentType The content type of the response
       
   345 * @param aCharset The charset of the response. May be empty in case of image
       
   346 * @param aContentBuf content data. Ownership is not transfered
       
   347 * @return void
       
   348 */
       
   349         void HandleResolveComplete(const TDesC& aContentType,
       
   350                                            const TDesC& aCharset,
       
   351                                            const HBufC8* aContentBuf);
       
   352 
       
   353 /**
       
   354 * @function HandleResolveError
       
   355 * @since 3.2
       
   356 * This method is called if there is some error while resolving the content
       
   357 * @param aError system wide error code.
       
   358 */
       
   359         void HandleResolveError(TInt aError);
       
   360 /** 
       
   361 *  @function CheckForMSK
       
   362 *  @since S60 3.2
       
   363 *  Checks Msk flag is Enabled or not, If Enabled, Sets MSK Label
       
   364 */      
       
   365 		void CheckForMSK();
       
   366 /** 
       
   367 *  @function IsPrevPageAvbl
       
   368 *  Check wether focus is on Hyperlink or not
       
   369 *  @since S60 3.2
       
   370 *  @return ETrue, if Focus is on Hyperlink , EFalse otherwise 
       
   371 */		
       
   372 		TBool IsHyperLinkFocused();	
       
   373 /** 
       
   374 *  @function IsPrevPageAvbl
       
   375 *  Check for Existance of the page
       
   376 *  @since S60 3.2
       
   377 *  @return ETrue, if page is available , EFalse otherwise 
       
   378 */		
       
   379 	 	TBool IsPrevPageAvbl();
       
   380 	 	
       
   381 /** 
       
   382 *  @function ClearHistoryL
       
   383 *  Clear Browser history stack
       
   384 *  @since S60 3.2
       
   385 */	 	
       
   386  		void  ClearHistoryL(); 
       
   387  		
       
   388 /** 
       
   389 *  @function GetCurrActiveObject
       
   390 *  Get the Current Active Object 
       
   391 *  @since S60 3.2
       
   392 *  @return CCSXHHelpContentBase Pointer, 
       
   393 */ 		
       
   394  		CCSXHHelpContentBase* GetCurrActiveObject();
       
   395 
       
   396 private:
       
   397 
       
   398 /**
       
   399   @function ConstructL
       
   400   @since S60 3.2
       
   401   Perform the second phase construction of a HtmlTopicContainer object
       
   402   @param aRect the rectangle this view will be drawn to
       
   403   */
       
   404     void ConstructL(const TRect& aRect);
       
   405 
       
   406 /** 
       
   407 *  @function LoadHtmlL
       
   408 *  loads HTML page in the Browser
       
   409 *  @since S60 3.2
       
   410 */
       
   411 	void LoadHtmlL();
       
   412 
       
   413 /** 
       
   414 *  @function CheckForExternalLinkL
       
   415 *  Check for external Hyperlink, if yes launch browserNG
       
   416 *  @since S60 3.2
       
   417 *  @return ETrue, if external hyperlink available, EFalse otherwise 
       
   418 */	
       
   419 	TBool CheckForExternalLinkL(const TDesC& aUrl);
       
   420 	
       
   421 private:
       
   422 	CBrCtlInterface* iBrCtrl;    
       
   423 	CCSXHHtmlTOC2* iTopic;
       
   424 	CCSXHDocument& iDocument;
       
   425     CCSXHHelpContentBase *iNewTopic;
       
   426     
       
   427     //Check the impln comments in HandleBrowserLoadEventL function
       
   428     TBuf<KMaxFileName> iUrlNoAnchors; 
       
   429     
       
   430     CCSXHHtmlTopicView* iView;    
       
   431     AppLauncherForCSXH* iAppLauncher;
       
   432     RLibrary iBrLibrary;
       
   433     RFeatureControl iFeatureControl;
       
   434     TBool iLoadHtml;    
       
   435     TInt32 iPrevPageCount;
       
   436     TBool iBack;
       
   437     
       
   438 	};
       
   439 
       
   440 
       
   441 #endif