imageeditor/ImageEditorManager/inc/ImageEditorPluginManager.h
changeset 1 edfc90759b9f
child 8 897cb525da4c
equal deleted inserted replaced
0:57d4cdd99204 1:edfc90759b9f
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "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 * Ixonos Plc
       
    14 *
       
    15 * Description: 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef IMAGEEDITORPLUGINMANAGER_H
       
    22 #define IMAGEEDITORPLUGINMANAGER_H
       
    23 
       
    24 //	INCLUDES
       
    25 #include <e32base.h>
       
    26 
       
    27 #include "imageeditordebugutils.h"
       
    28 #include "commondefs.h"
       
    29 
       
    30 /// FORWARD DECLARATIONS
       
    31 class CCoeControl;
       
    32 class CFbsBitmap;
       
    33 class CPluginLoader;
       
    34 class CEditorImage;
       
    35 class CEngineWrapper;
       
    36 class CSystemParameters;
       
    37 class CArrayFixedFlat;
       
    38 
       
    39 #ifdef RD_CONTENTNOTIFICATION
       
    40 class CContentNotification;
       
    41 #endif
       
    42 
       
    43 /*	CLASS: CImageEditorPluginManager
       
    44 *
       
    45 *	CImageEditorPluginManager functions as Model of the application in 
       
    46 *	MVC design pattern sense. It includes an instance of Scalado's MIA
       
    47 *	image processing engine and manages plug-in communication with the
       
    48 *	application controller.
       
    49 */
       
    50 class CImageEditorPluginManager : public CBase
       
    51 {
       
    52 public:
       
    53 
       
    54 /** @name Methods:*/
       
    55 //@{
       
    56 
       
    57 	/** NewL factory method, pops cleanupstack
       
    58 	*
       
    59 	*	@param -
       
    60 	*	@return pointer to created CImageEditorPluginManager object
       
    61 	*/
       
    62 	IMPORT_C static CImageEditorPluginManager * NewL ();
       
    63 
       
    64 	/** Destructor
       
    65 	*
       
    66 	*	@param -
       
    67 	*	@return -
       
    68 	*/
       
    69 	IMPORT_C virtual ~CImageEditorPluginManager ();
       
    70 
       
    71 	/** OpenPluginL
       
    72 	*
       
    73 	*	Loads and opens plug-in
       
    74 	*	
       
    75 	*	@param aFileName - plug-in file name
       
    76 	*	@return -
       
    77 	*/
       
    78 	IMPORT_C void OpenPluginL (const TDesC & aFileName);
       
    79 
       
    80 	/** CreatePluginControlL
       
    81 	*
       
    82 	*	Creates UI control for the plug-in in question.
       
    83 	*	
       
    84 	*	@param aRect - control rectangle
       
    85 	*	@param aParent - parent control 
       
    86 	*	@param aPluginControl - reference to plug-in control
       
    87 	*	@return pointer to plug-in control
       
    88 	*/
       
    89 	IMPORT_C TInt CreatePluginControlL (
       
    90 		const TRect &	aRect,
       
    91 		CCoeControl *	aParent,
       
    92 		CCoeControl *&	aPluginControl
       
    93 		);
       
    94 
       
    95 	/** ClosePlugin
       
    96 	*
       
    97 	*	Deletes current plug-in and unloads it.
       
    98 	*	
       
    99 	*	@param -
       
   100 	*	@return -
       
   101 	*/
       
   102 	IMPORT_C void ClosePlugin ();
       
   103 
       
   104 	/** ShowPluginPopup
       
   105 	*
       
   106 	*	Shows plugin-related popup note.
       
   107 	*	
       
   108 	*	@param -
       
   109 	*	@return -
       
   110 	*/
       
   111 	IMPORT_C void ShowPluginPopup ();
       
   112 
       
   113 	/** UndoL
       
   114 	*
       
   115 	*	Undoes last operation performed to the image.
       
   116 	*	
       
   117 	*	@param -
       
   118 	*	@return -
       
   119 	*/
       
   120 	IMPORT_C void UndoL();
       
   121 
       
   122 	/** RedoL
       
   123 	*
       
   124 	*	Redoes the last removed operation to the image.
       
   125 	*	
       
   126 	*	@param -
       
   127 	*	@return -
       
   128 	*/
       
   129 	IMPORT_C void RedoL();
       
   130 
       
   131 	/** LoadImageL
       
   132 	*
       
   133 	*	Loads image with MIA engine.
       
   134 	*	
       
   135 	*	@param aUseIPECodec - ImageEditor's own codec should be used
       
   136 	*	@return -
       
   137 	*/
       
   138 	IMPORT_C void LoadImageL (const TBool aUseIPECodec);
       
   139 
       
   140     /** SaveImageL
       
   141 	*
       
   142 	*	Saves image with MIA engine.
       
   143 	*	
       
   144 	*	@param aQuality - JPEG quality factor
       
   145 	*	@param aSize - if not NULL includes the custom output size
       
   146 	*	@return -
       
   147 	*/
       
   148 	IMPORT_C void SaveImageL (
       
   149         const TInt      aQuality,
       
   150         const TSize *   aSize = NULL    
       
   151         );
       
   152 
       
   153 	/** PrepareAsyncSaveL
       
   154     *
       
   155 	*	Prepares to save the image by block
       
   156 	*	
       
   157 	*	@param aBlockCount - Number of blocks to save
       
   158 	*	@param aQuality - JPEG quality factor
       
   159 	*	@param aSize - if not NULL includes the custom output size
       
   160 	*	@return -
       
   161 	*/
       
   162 	IMPORT_C void PrepareAsyncSaveL (
       
   163         const TInt      aQuality,
       
   164         const TSize *   aSize = NULL
       
   165         );
       
   166 
       
   167 	/** SaveBlock
       
   168 	*
       
   169 	*	Saves a block 
       
   170 	*	
       
   171 	*	@param - 
       
   172 	*	@return - returns percentage of image data saved, 100 when ready
       
   173 	*/
       
   174 	IMPORT_C TInt SaveBlockL();
       
   175 
       
   176 	/** SaveAbortL
       
   177 	*
       
   178 	*	Must be called after aborting block saving
       
   179 	*	
       
   180 	*	@param - 
       
   181 	*/
       
   182 	EXPORT_C void SaveAbortL();
       
   183 
       
   184 	/** FinishAsyncSave
       
   185 	*
       
   186 	*	Finishes asynchronous saving with MIA engine.
       
   187 	*	
       
   188 	*	@param  - 
       
   189 	*	@return -
       
   190 	*/
       
   191 	IMPORT_C void FinishAsyncSaveL();
       
   192 
       
   193 	/** ProcessImageL
       
   194     *
       
   195 	*	Processes image with MIA engine.
       
   196 	*	
       
   197 	*	@param -
       
   198 	*	@return -
       
   199 	*/
       
   200 	IMPORT_C void ProcessImageL();
       
   201 
       
   202 	/** PrepareAsyncProcessL
       
   203     *
       
   204 	*	Prepares to process the image by block
       
   205 	*	
       
   206 	*	@param aBlockCount - Number of blocks to process
       
   207 	*	@return -
       
   208 	*/
       
   209 	IMPORT_C void PrepareAsyncProcessL(TInt& aBlockCount);
       
   210 
       
   211 	/** ProcessBlockL
       
   212 	*
       
   213 	*	Render a block 
       
   214 	*	
       
   215 	*	@param - 
       
   216 	*	@return - error code, KErrNone until whole image is saved and KErrCompletion
       
   217     *             when ready
       
   218 	*/
       
   219 	IMPORT_C TInt ProcessBlockL();
       
   220 
       
   221 	/** FinishAsyncProcessL
       
   222 	*
       
   223 	*	Finishes asynchronous processing with MIA engine.
       
   224 	*	
       
   225 	*	@param  - 
       
   226 	*	@return -
       
   227 	*/
       
   228 	IMPORT_C void FinishAsyncProcess();
       
   229 
       
   230     /** GetPreviewImage
       
   231 	*
       
   232 	*	Getter for preview bitmap.
       
   233 	*
       
   234 	*	@param -
       
   235 	*	@return pointer to CFbsBitmap
       
   236 	*/
       
   237 	IMPORT_C CFbsBitmap * GetPreviewImage();
       
   238 
       
   239     /** GetFullImage
       
   240 	*
       
   241 	*	Getter for bfull size bitmap.
       
   242 	*
       
   243 	*	@param -
       
   244 	*	@return pointer to CFbsBitmap
       
   245 	*/
       
   246 	IMPORT_C CFbsBitmap * GetFullImage();
       
   247 
       
   248     /** GetImageName
       
   249 	*
       
   250 	*	Getter for image file name
       
   251 	*
       
   252 	*	@param -
       
   253 	*	@return reference to the file name
       
   254 	*/
       
   255 	IMPORT_C const TDesC & GetImageName();
       
   256 
       
   257 	/** SetPreviewImage 
       
   258 	*
       
   259 	*	Setter for preview bitmap.
       
   260 	*
       
   261 	*	@param aBitmap - pointer to preview bitmap
       
   262 	*	@return -
       
   263 	*/
       
   264 	IMPORT_C void SetPreviewImage (CFbsBitmap * aBitmap);
       
   265 
       
   266 	/** SetFullImage 
       
   267 	*
       
   268 	*	Setter for preview bitmap.
       
   269 	*
       
   270 	*	@param aBitmap - pointer to full size bitmap
       
   271 	*	@return -
       
   272 	*/
       
   273 	IMPORT_C void SetFullImage (CFbsBitmap * aBitmap);
       
   274 
       
   275     /** SetImageName
       
   276 	*
       
   277 	*	Setter for image file name
       
   278 	*
       
   279 	*	@param aFileName - new file name
       
   280 	*	@return -
       
   281 	*/
       
   282 	IMPORT_C void SetImageName (const TDesC & aFileName);
       
   283 
       
   284 	/** SetScreenSizeL
       
   285 	*
       
   286 	*	Set current screen size to the engine
       
   287 	*
       
   288 	*	@param -
       
   289 	*	@return -
       
   290 	*/
       
   291 	IMPORT_C void SetScreenSizeL ();
       
   292 
       
   293 	/** ResetEngine
       
   294 	*
       
   295 	*	Resets MIA engine.
       
   296 	*
       
   297 	*	@param -
       
   298 	*	@return -
       
   299 	*/
       
   300 	IMPORT_C void ResetEngineL();
       
   301 
       
   302 	/** PurgeUndoRedoHistory
       
   303 	*
       
   304 	*	Purges undo / redo history.
       
   305 	*
       
   306 	*	@param -
       
   307 	*	@return -
       
   308 	*/
       
   309 	IMPORT_C void PurgeUndoRedoHistory();
       
   310 
       
   311     /** CanUndo
       
   312 	*
       
   313 	*	Checks, if undoable changes are made.
       
   314 	*
       
   315 	*	@param -
       
   316 	*	@return - ETrue if we can undo, EFalse otherwise
       
   317 	*/
       
   318 	IMPORT_C TBool CanUndo();
       
   319 
       
   320     /** IsImageChanged
       
   321 	*
       
   322 	*	Checks, if image is changed.
       
   323 	*
       
   324 	*	@param -
       
   325 	*	@return - ETrue if image changed, EFalse otherwise
       
   326 	*/
       
   327 	IMPORT_C TBool IsImageChanged();
       
   328 
       
   329     /** IsLandscapeEnabledL
       
   330 	*
       
   331 	*	Checks, if plugin is landscape enabled.
       
   332 	*
       
   333 	*	@param -
       
   334 	*	@return - ETrue if landscape enabled, EFalse otherwise
       
   335 	*/
       
   336     IMPORT_C TBool IsLandscapeEnabledL() const;
       
   337 
       
   338 
       
   339     /** ZoomL
       
   340 	*
       
   341 	*	Zooms image.
       
   342 	*
       
   343 	*	@param aZoom - zoom mode to be set
       
   344 	*	@return - 
       
   345 	*/
       
   346 	IMPORT_C void ZoomL (const TZoom aZoom);
       
   347 
       
   348     /** GetZoomMode
       
   349      * Returns current zoom mode.
       
   350      *
       
   351      * @since S60 v5.0
       
   352      * @param -
       
   353      * @return TZoomMode current zooming mode
       
   354      */
       
   355     IMPORT_C TZoomMode GetZoomMode();
       
   356     
       
   357     /** PanL
       
   358 	*
       
   359 	*   Pans image.
       
   360 	*
       
   361 	*	@param aDir - direction 
       
   362 	*	@return -
       
   363     *   @see commondefs.h
       
   364 	*/
       
   365 	IMPORT_C void PanL (const TDirection aDir);
       
   366     
       
   367     /** Pan
       
   368 	*
       
   369 	*   Pans image.
       
   370 	*
       
   371 	*	@param aXChange x-directional change on the screen
       
   372 	*	@param aYChange y-directional change on the screen
       
   373 	*	@return -
       
   374 	*/
       
   375 	IMPORT_C void PanL( TInt aXChange, TInt aYChange );
       
   376 
       
   377 
       
   378     /** RotateL
       
   379 	*
       
   380 	*	Rotates image.
       
   381 	*
       
   382 	*	@param aRot - rotate direction 
       
   383 	*	@return -
       
   384     *   @see commondefs.h
       
   385 	*/
       
   386 	IMPORT_C void RotateL (const TRotation aRot);
       
   387 
       
   388 	/** AddFilterToEngineL
       
   389 	*
       
   390 	*	Adds filter to MIA engine. Sets undo/redo point.
       
   391 	*
       
   392 	*	@param -
       
   393 	*	@return -
       
   394 	*/
       
   395 	IMPORT_C void AddFilterToEngineL();
       
   396 
       
   397 	/** GetSystemParameters
       
   398 	*
       
   399 	*	Gets system parameters.
       
   400 	*
       
   401 	*	@param -
       
   402 	*	@return const CSystemParameters &
       
   403 	*/
       
   404 	IMPORT_C const CSystemParameters & GetSystemParameters() const;
       
   405 
       
   406     /** IsPluginLoaded
       
   407 	*
       
   408 	*	Check if a plug-in is loaded
       
   409     *
       
   410     *	@param -
       
   411 	*	@return - ETrue if plug-in is loaded, EFalse otherwise
       
   412     */
       
   413 	IMPORT_C TBool IsPluginLoaded() const;
       
   414 
       
   415     /** RestoreFilterL
       
   416 	*
       
   417 	*	Restores current filter to main engine.
       
   418     *
       
   419     *	@param -
       
   420 	*	@return - 
       
   421     */
       
   422 	IMPORT_C void RestoreFilterL() const;
       
   423 
       
   424 //@}
       
   425 
       
   426 protected:
       
   427 
       
   428 /** @name Methods:*/
       
   429 //@{
       
   430 
       
   431 //@}
       
   432 
       
   433 /** @name Members:*/
       
   434 //@{
       
   435 
       
   436 //@}
       
   437 
       
   438 private:
       
   439 
       
   440 /** @name Methods:*/
       
   441 //@{
       
   442 
       
   443 	/** Default constructor
       
   444 	*
       
   445 	*	@param -
       
   446 	*	@return -
       
   447 	*/
       
   448 	CImageEditorPluginManager ();
       
   449 
       
   450 	/** Second phase constructor, may leave
       
   451 	*
       
   452 	*	@param -
       
   453 	*	@return -
       
   454 	*/
       
   455 	void ConstructL ();
       
   456 
       
   457 	/** SetParameters
       
   458 	*
       
   459 	*	Sets engine parameters depending on the filter type
       
   460 	*
       
   461 	*	@param -
       
   462 	*	@return -
       
   463 	*/
       
   464 	void SetParametersL();
       
   465 
       
   466 	/** RenderL
       
   467 	*
       
   468 	*	Renders image.
       
   469 	*
       
   470 	*	@param aMultiSessionBlockCount - Has two purposes:
       
   471 	*			1) If not null, marks a request to render 
       
   472 	*			   calling RenderBlock several times
       
   473 	*			2) On return, contains the number of blocks to save
       
   474 	*	@return -
       
   475 	*/
       
   476 	void RenderL(TInt* aMultiSessionBlockCount = NULL);
       
   477 
       
   478 	/** Cleanup
       
   479 	*
       
   480 	*	Deletes current plug-in, editor image, engine and cleans up wrapper
       
   481 	*	parameters.
       
   482 	*
       
   483 	*	@param -
       
   484 	*	@return -
       
   485 	*/
       
   486 	void Cleanup();
       
   487 
       
   488     /** Copy constructor, disabled
       
   489 	*/
       
   490 	CImageEditorPluginManager (const CImageEditorPluginManager & rhs);
       
   491 
       
   492 	/** Assignment operator, disabled 
       
   493 	*/
       
   494 	CImageEditorPluginManager & operator= (const CImageEditorPluginManager & rhs);
       
   495 
       
   496 //@}
       
   497 
       
   498 /** @name Members:*/
       
   499 //@{
       
   500 	/// Plug-in loader
       
   501 	CPluginLoader *		iPluginLoader;
       
   502 	/// Edited image as CEditorImage
       
   503 	CEditorImage *		iImage;
       
   504     /// MIA engine wrapper
       
   505     CEngineWrapper *	iEngineWrapper;
       
   506     
       
   507     #ifdef RD_CONTENTNOTIFICATION
       
   508     // Notification for Media Gallery
       
   509     CContentNotification * iEventNotifier;
       
   510     #endif
       
   511     
       
   512     /// Loaded filter type
       
   513     TInt                iFilterType;
       
   514     /// Loaded UI type
       
   515     TInt                iUiType;
       
   516     /// Is global zoom disabled
       
   517     TBool               iGlobalZoomDisabled;
       
   518     /// Closing
       
   519     TBool               iOnTheWayToDestruction;
       
   520     /// Plug-in scope
       
   521     TInt                iPluginScope;
       
   522 //@}
       
   523 
       
   524 };
       
   525 
       
   526 
       
   527 #endif