landmarksui/uicontrols/inc/clmkmapnavigationinterface.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     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:    LandmarksUi Content File -    Application's interface class to Map and Navigation use cases
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef CLMKMAPNAVIGATIONINTERFACE_H
       
    25 #define CLMKMAPNAVIGATIONINTERFACE_H
       
    26 
       
    27 // INCLUDES
       
    28 #include <AiwCommon.h>
       
    29 #include <e32std.h>
       
    30 #include <EPos_Landmarks.h>
       
    31 #include <AknProgressDialog.h>
       
    32 #include "mlmkdbsearchutilsobserver.h"
       
    33 #include "CLmkAppSelectorImplBase.h"
       
    34 #include "MLmkMapAndNavigationObServer.h"
       
    35 // FORWARD DECLARATION
       
    36 class CPosLandmark;
       
    37 class CAiwServiceHandler;
       
    38 class CLmkDbSearchUtils;
       
    39 class CAknWaitDialog;
       
    40 class CPosLandmarkDatabase;
       
    41 
       
    42 
       
    43 /**
       
    44 * The class CLmkMapNavigationInterface contains the implemenation
       
    45 * for all the uses cases of Map and Navigation. It is a singleton class
       
    46 *
       
    47 */
       
    48 class CLmkMapNavigationInterface : public CBase,
       
    49 								   public MAiwNotifyCallback,
       
    50 								   public MLmkDbSearchUtilsObserver,
       
    51 								   public MProgressDialogCallback
       
    52 	{
       
    53 	public:
       
    54 	    // Enum for view type
       
    55 		enum EViewType
       
    56 			{
       
    57 			EByLmkView, 	// For landmark view
       
    58 			EByCategoryView // For category view
       
    59 			};
       
    60 	public: // Constructors and destructor
       
    61 		/**
       
    62         * Symbian 1st phase static constructor.
       
    63         *
       
    64         * @param aViewType the view type (By Landmark or by category)
       
    65         */
       
    66         IMPORT_C static CLmkMapNavigationInterface* NewL( CPosLandmarkDatabase& aDb );
       
    67 
       
    68         /**
       
    69         * Destructor.
       
    70         */
       
    71        IMPORT_C ~CLmkMapNavigationInterface();
       
    72 
       
    73 	public: // from MAiwNotifyCallback
       
    74 		/**
       
    75 		* The callback function for the get landmark from map use case
       
    76 		* This function gets a callback once the user selects a location
       
    77 		* from map to save as a landmark.
       
    78 		*/
       
    79 		IMPORT_C TInt HandleNotifyL( TInt aCmdId,
       
    80 						            TInt aEventId,
       
    81 						            CAiwGenericParamList &aEventParamList,
       
    82 						            const CAiwGenericParamList &aInParamList );
       
    83 	public: // from MProgressDialogCallback
       
    84 		/**
       
    85 		* Callback function for Progress dialog when ok to exit
       
    86 		* the operation.
       
    87 		*/
       
    88 		void DialogDismissedL( TInt aButtonId );
       
    89 
       
    90     public: // New methods for Map & Navigation use cases
       
    91 
       
    92     	/**
       
    93     	* Shows the provided landmarks on map
       
    94     	*
       
    95     	* @param aArray pointer array of landmarks which are to be displayed on map
       
    96     	*
       
    97     	* @param aCommand command id for show on map
       
    98     	* @param aViewType
       
    99     	*/
       
   100     	IMPORT_C void ShowLandmarksOnMapL( RPointerArray<CPosLandmark> &aArray,
       
   101     									   TInt aCommand,
       
   102     									   EViewType aViewType );
       
   103 
       
   104     	/**
       
   105     	* Shows all the landmarks of a category on Map. The function searches
       
   106     	* Landmaks database through db search utils to get the landmaks in the
       
   107     	* category and then displays the map. While the search is being done a
       
   108     	* progress note is displayed.
       
   109     	*
       
   110     	* @param aCategoryId item id of the category whose landmarks need
       
   111     	*					 to be displayed on map
       
   112     	* @param aViewType
       
   113     	*
       
   114     	*/
       
   115     	IMPORT_C void ShowCategoryOnMapL( TPosLmItemId aCategoryId,
       
   116     									  TInt aCommand,
       
   117     									  EViewType aViewType  );
       
   118 
       
   119     	/**
       
   120     	* Displays map to allow navigation to the provided landmark
       
   121     	*
       
   122     	* @param aLandmark the Landmark to navigate to
       
   123     	* @param aCommand is the command id in the menu pane
       
   124     	*/
       
   125     	IMPORT_C void NavigateToLandmarkL( CPosLandmark* aLandmark, TInt aCommand );
       
   126 
       
   127     	/**
       
   128     	* This method is called for the get landmarks from map use case. The method
       
   129     	* sends the appropriate aiw command to get landmarks from map. Once user
       
   130     	* selects the opsition on map, a landmarks editor dialog will be displayed,
       
   131     	* populated with the appropriate position data of the position selected.
       
   132     	*
       
   133     	* @param aCommand menu command id for getting location from map
       
   134     	*/
       
   135     	IMPORT_C void GetLandmarkFromMapL( TInt aCommand );
       
   136 
       
   137     	/**
       
   138     	* This method is called for the get landmarks from map for saving a category.
       
   139     	* Once user selects the opsition on map, a landmarks editor dialog will be displayed,
       
   140     	* populated with the appropriate position data of the position selected.
       
   141     	*
       
   142     	* @param aCommand menu command id for getting location from map
       
   143     	* @param aCategoryId is the category in which the landmark needs to be saved
       
   144     	*/
       
   145     	IMPORT_C void GetLandmarkFromMapForCategoryL( TInt aCommand, TPosLmItemId aCategoryId );
       
   146 
       
   147     	/**
       
   148     	* Method returns the service command of the provided menu command.This
       
   149     	* function needs to be invoked in the HandleCommandL function when a
       
   150     	* menu option is selected. If the function returns anythin other than
       
   151     	* KAiwCommandNone then it is implied that some interest has been attached
       
   152     	* to the menu command and is a AIW operation.
       
   153     	*
       
   154     	* @param aCommand the command id for which the checks need to be made
       
   155     	*
       
   156     	* @return service id if valid, KAiwCmdNone otherwise
       
   157     	*/
       
   158     	IMPORT_C TInt GetServiceCmdByMenuCmd( TInt aCommand );
       
   159 
       
   160     	/**
       
   161     	* Method used to attach menu interest to AIW. If it is required to attach
       
   162     	* interest to any menu pane / command then it is require to invoke this
       
   163     	* function with the required menu pane with the required interest. The
       
   164     	* interest is an AIW interest that is defined in the resource file.
       
   165     	*
       
   166     	* @param aMenuPane is the id of the menu pane from the resource file
       
   167     	* 		 to which the interest needs to be attached
       
   168     	*
       
   169     	* @param aInterest is the id of the interest from the resource file
       
   170     	*/
       
   171     	IMPORT_C void AttachAIWInterestL( TInt aMenuPane, TInt aInterest );
       
   172 
       
   173     	/**
       
   174     	* Method used to attach menu panes which are specific to Map and Navigation.
       
   175     	* This function bascially handles the dimming of menu commands in menu panes
       
   176     	* and needs to be invoked in function "DynInitMenuPaneL" providing it with the
       
   177     	* resource id, menu pane and the base command, which is the command enum from
       
   178     	* which all Map and Navigation menu id's are declared (basically the offset).
       
   179     	*
       
   180     	* @param aResourceId resource id of the selected item
       
   181     	*
       
   182     	* @param aMenuPane is the pointer of the menu pane to which the submenu
       
   183     	*        will be attached
       
   184     	*
       
   185     	* @param aBaseCommand is the base command for map & navigation menu items
       
   186     	*
       
   187     	* @return ETrue if sub menu pane needs to be attached and will cascade the
       
   188     	*         sub menu, EFalse otherwise
       
   189     	*/
       
   190     	IMPORT_C TBool HandleMenuOperationL( TInt aResourceId, CEikMenuPane *aMenuPane, TInt aBaseCommand );
       
   191 
       
   192     	/**
       
   193     	* Method used to attach/edit menu panes. AVKON forms create
       
   194     	* its own menu panes due to which it is required to attach this to AIW's
       
   195     	* menu pane. In such cases this helper function can be used
       
   196     	*
       
   197     	* @param aResourceId resource id of the selected item
       
   198     	*
       
   199     	* @param aMenuPane is the pointer of the menu pane to which the submenu
       
   200     	*        will be attached
       
   201     	*/
       
   202     	IMPORT_C void AttachMenuPaneL( CEikMenuPane *aMenuPane, TInt aResourceId, TInt aBaseCommand );
       
   203 
       
   204     	/**
       
   205     	* Detaches a particualr interest from the service handler.
       
   206     	*
       
   207     	* @param aMenuResourceId is the menu id
       
   208     	* @param aInterestResourceId is the resource id of the interest
       
   209     	*/
       
   210     	IMPORT_C void DetachInterestL( TInt aMenuResourceId, TInt aInterestresourceId );
       
   211 
       
   212     	/**
       
   213     	* Sets the observer. It is called when map & navigation finishes
       
   214     	* any request related to landmark.
       
   215     	* @param aObserver is of type MLmkMapAndNavigationObserver
       
   216     	*/
       
   217     	IMPORT_C void SetObserver(MLmkMapAndNavigationObserver* aObserver);
       
   218 
       
   219     	/**
       
   220     	* Decreases the reference count, if it becomes zero, detroys self
       
   221     	*/
       
   222     	IMPORT_C void Release();
       
   223 
       
   224     public: // From CLmkDbSearchUtilsObserver
       
   225         /**
       
   226         * This is the callback function for the asynchronus search notification.
       
   227         * This is used for the "Show category on map" use case. This function is
       
   228         * the callaback to get all landmark id's under a particualre category.
       
   229         *
       
   230         * @param aArray is the array of the landmarks id's associated with the
       
   231         *				particular category
       
   232         */
       
   233     	void HandleCategorySearchNotifyL( RArray<TPosLmItemId> aArray );
       
   234 
       
   235     	/**
       
   236     	* This is from CLmkDbSearchUtilsObserver for landmarks search
       
   237     	* This search is not used and will have a dummy block
       
   238     	*/
       
   239     	void HandleLmkSearchNotifyL();
       
   240     private:
       
   241     	/**
       
   242         * C++ default constructor.
       
   243         */
       
   244         CLmkMapNavigationInterface( CPosLandmarkDatabase& aDb );
       
   245 
       
   246         /**
       
   247         * Symbian 2nd phase constructor.
       
   248         *
       
   249         * @param aViewType the view type (By Landmark or by category)
       
   250         */
       
   251         void ConstructL();
       
   252 
       
   253     private: // Private functions
       
   254     	/**
       
   255     	* This function is the santity check for the incomming landmarks for all
       
   256     	* use cases. The function does all the error checks and also does the
       
   257     	* error notification to the user through error notes and dialogs.
       
   258     	*
       
   259     	* @param aArray is the array of landmarks on which the checks need to made
       
   260     	*/
       
   261     	TBool CheckAndDisplayIfLandmarksEmptyL( RPointerArray<CPosLandmark> &aArray );
       
   262 
       
   263     	/**
       
   264     	* Methods saves the Landmark from the Get Landmarks from Map use case.
       
   265     	* This function opens an editor dialog to and populates it with the
       
   266     	* position information of the chosen landamark.
       
   267     	*
       
   268     	* @param aLandmark the landmark to be saved
       
   269     	*/
       
   270     	void SaveLandmarkL( CPosLandmark& aLandmark );
       
   271     	/**
       
   272     	* This method is used to check if the supplied landmark has any valid
       
   273     	* coordinates or address. If either Latitude or Longitude are Nan and if
       
   274     	* none of the address fields have any valid entyr then the method returns
       
   275     	* ETrue otherwise returns EFalse.
       
   276     	*
       
   277     	* @param aLandmark is the landmark on which the check needs to be made
       
   278     	* @return ETrue if Landmark does not have any coordinates or address,
       
   279     	*               EFalse otherwise
       
   280     	*/
       
   281     	TBool IsLandmarkDataEmptyL( CPosLandmark& aLandmark );
       
   282 
       
   283 
       
   284     private: // Data
       
   285     	// Owns : Pointer to AIW service handler to send service commands
       
   286     	CAiwServiceHandler* iAiwServiceHandler;
       
   287 
       
   288     	// Owns : Generic parameter input list
       
   289     	CAiwGenericParamList*   iInList;
       
   290 
       
   291     	// Owns : Generic parameter output list
       
   292         CAiwGenericParamList*   iOutList;
       
   293 
       
   294         // Describes if view type is by Landmark view or by Category view
       
   295         EViewType iViewType;
       
   296 
       
   297         // Owns: Pointer to landmark search util
       
   298         CLmkDbSearchUtils* iSearchUtil;
       
   299 
       
   300         // Menu command for showing category on map
       
   301         TInt iCategoryCommand;
       
   302 
       
   303         //Owns: Category name, for by category view, to display in error notes
       
   304         HBufC* iCategoryName;
       
   305 
       
   306         // Category id to which the select from Map use case needs to save to
       
   307         TPosLmItemId iCategoryId;
       
   308 
       
   309         //Owns : processing wait note
       
   310         CAknWaitDialog* iWaitNote;
       
   311 
       
   312         // Array of Landmarks required for show category on use case
       
   313         RPointerArray<CPosLandmark> iLandmarkArray;
       
   314 
       
   315         //Ref:open handle to landmark database
       
   316         CPosLandmarkDatabase& iDb;
       
   317 
       
   318         //Ref
       
   319         MLmkMapAndNavigationObserver* iObserver;
       
   320 
       
   321         // Ref
       
   322         CEikonEnv*              iEnv;
       
   323 
       
   324         TInt iRefCnt;
       
   325 	};
       
   326 
       
   327 #endif //CLMKMAPNAVIGATIONINTERFACE_H
       
   328 
       
   329 // End of file
       
   330