epoc32/include/app/msgbiocontrol.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:   Base class for bio controls.
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
#ifndef MSGBIOCONTROL_H
williamr@2
    21
#define MSGBIOCONTROL_H
williamr@2
    22
williamr@2
    23
williamr@2
    24
// INCLUDES
williamr@2
    25
#include <msvstd.h>
williamr@2
    26
#include <coecntrl.h>           // for CCoeControl
williamr@2
    27
#include <mmsgbiocontrol.h>     // for MMsgBioControl
williamr@2
    28
#include <badesca.h>            // for CDesCArray
williamr@2
    29
#include <aknglobalnote.h>
williamr@4
    30
#include <msgeditor.hrh>        // for TMsgCursorLocation
williamr@2
    31
williamr@2
    32
// FORWARD DECLARATIONS
williamr@2
    33
williamr@2
    34
class MMsgBioControlObserver;
williamr@2
    35
class CMsvSession;
williamr@2
    36
class MMsgBioControlExtension;  
williamr@2
    37
williamr@2
    38
williamr@2
    39
// CLASS DECLARATION
williamr@2
    40
williamr@2
    41
/**
williamr@2
    42
 * The base class for Bio controls.
williamr@2
    43
 */
williamr@2
    44
class CMsgBioControl : public CCoeControl, public MMsgBioControl
williamr@2
    45
    {
williamr@2
    46
williamr@2
    47
    public: //construction and destruction
williamr@2
    48
            
williamr@2
    49
        /**
williamr@2
    50
         * Constructor. Call this from your Bio Control constructor.
williamr@2
    51
         * @param aObserver Reference to the Bio control observer.
williamr@2
    52
         * @param aSession Message Server session. Ownership not transferred.
williamr@2
    53
         * @param aId Id of the message in the server.
williamr@2
    54
         * @param aEditorOrViewerMode Sets Bio Control into editor or viewer mode.
williamr@2
    55
         * @param aFile Data file handle. Bio controls can also be file based. Not owned.
williamr@2
    56
         */
williamr@2
    57
        IMPORT_C CMsgBioControl(
williamr@2
    58
            MMsgBioControlObserver& aObserver,
williamr@2
    59
            CMsvSession* aSession, //ownership is NOT transferred
williamr@2
    60
            TMsvId aId,
williamr@2
    61
            TMsgBioMode aEditorOrViewerMode,
williamr@2
    62
            const RFile* aFile);   //ownership is NOT transferred
williamr@2
    63
williamr@2
    64
        /**
williamr@2
    65
         * Destructor
williamr@2
    66
         */
williamr@2
    67
        IMPORT_C ~CMsgBioControl();
williamr@2
    68
williamr@2
    69
    public: // static helper functions
williamr@2
    70
williamr@2
    71
        /**
williamr@2
    72
         * Pops a confirmation query. The result is given by the return value.
williamr@2
    73
         * The standard resource must have been loaded using
williamr@2
    74
         * LoadStandardBioResourceL().
williamr@2
    75
         * @param aText The text that is to be used in the query.
williamr@2
    76
         * @return A user confirmation results in ETrue, and vice versa.
williamr@2
    77
         */
williamr@2
    78
        IMPORT_C static TBool ConfirmationQueryL(const TDesC& aText);
williamr@2
    79
williamr@2
    80
        /**
williamr@2
    81
         * Pops a confirmation query. The result is given by the return value.
williamr@2
    82
         * The standard resource must have been loaded using
williamr@2
    83
         * LoadStandardBioResourceL(). Your resource must also be loaded, for
williamr@2
    84
         * eg. with LoadResourceL().
williamr@2
    85
         * CCoeEnv must exist.
williamr@2
    86
         * @param aStringResource The string resource id.
williamr@2
    87
         * @return A user confirmation results in ETrue, and vice versa.
williamr@2
    88
         */
williamr@2
    89
        IMPORT_C static TBool ConfirmationQueryL(TInt aStringResource);
williamr@2
    90
williamr@2
    91
    public: // from MMsgBioControl
williamr@2
    92
williamr@2
    93
        /**
williamr@2
    94
         * The application can get the option menu recommendations using this
williamr@2
    95
         * function. The function comes from MMsgBioControl. This is the
williamr@2
    96
         * default implementation which returns the flags
williamr@2
    97
         * EMsgBioCallBack | EMsgBioDelete | EMsgBioMessInfo | EMsgBioMove | 
williamr@2
    98
         * EMsgBioCreateCC | EMsgBioSend | EMsgBioAddRecipient | EMsgBioSave |
williamr@2
    99
         * EMsgBioSendingOpt | EMsgBioHelp | EMsgBioExit. 
williamr@2
   100
         * Bio Controls should override this if it is not ok.
williamr@2
   101
         * @return The option menu permission flags. If the flag is off it
williamr@2
   102
         * means that the option menu command is not recommended with this
williamr@2
   103
         * Bio Control.
williamr@2
   104
         */
williamr@2
   105
        IMPORT_C TUint32 OptionMenuPermissionsL() const;
williamr@2
   106
williamr@2
   107
        /**
williamr@2
   108
         * Gives the height of the text in pixels.
williamr@2
   109
         * It is used by the scrolling framework.
williamr@2
   110
         * @return Height of the text in pixels.
williamr@2
   111
         */
williamr@2
   112
        IMPORT_C TInt VirtualHeight();
williamr@2
   113
williamr@2
   114
        /**
williamr@2
   115
         * Gives the cursor position in pixels.
williamr@2
   116
         * It is used by the scrolling framework.
williamr@2
   117
         * @return Cursor position in pixels.
williamr@2
   118
         */
williamr@2
   119
        IMPORT_C TInt VirtualVisibleTop();
williamr@2
   120
williamr@2
   121
        /**
williamr@2
   122
         * Tells whether the cursor is in the topmost or bottom position.
williamr@2
   123
         * It is used by the scrolling framework.
williamr@2
   124
         * @param aLocation Specifies either top or bottom.
williamr@2
   125
         * @return ETrue if the cursor is in the part specified by aLocation.
williamr@2
   126
         */
williamr@2
   127
        IMPORT_C TBool IsCursorLocation(TMsgCursorLocation aLocation) const;
williamr@2
   128
    
williamr@2
   129
    public: //new functions
williamr@2
   130
    
williamr@2
   131
        /**
williamr@2
   132
         * Performs the internal scrolling of control if needed.
williamr@2
   133
         * Default implementation does not perform any scrolling and returns that
williamr@2
   134
         * zero pixels were scrolled.
williamr@2
   135
         * @since 3.2
williamr@2
   136
         * @param aPixelsToScroll Amount of pixels to scroll.
williamr@2
   137
         * @param aDirection      Scrolling direction.
williamr@2
   138
         * @return Amount of pixels the where scrolled. Zero value means the component cannot
williamr@2
   139
         *         be scrolled to that direction anymore and view should be moved.
williamr@2
   140
         */
williamr@2
   141
        IMPORT_C TInt ScrollL( TInt aPixelsToScroll, TMsgScrollDirection aDirection );
williamr@2
   142
williamr@2
   143
        /**
williamr@2
   144
         * Prepares control for viewing.
williamr@2
   145
         * @since 3.2
williamr@2
   146
         * @param aEvent	The event type
williamr@2
   147
         * @param aParam Event related parameters
williamr@2
   148
         */
williamr@2
   149
        IMPORT_C void NotifyViewEvent( TMsgViewEvent aEvent, TInt aParam );
williamr@2
   150
williamr@2
   151
williamr@2
   152
    protected: //new functions
williamr@2
   153
williamr@2
   154
        /**
williamr@2
   155
         * Returns true if the control has been launched as editor,
williamr@2
   156
         * and false if it was launched as viewer.
williamr@2
   157
         * @return ETrue or EFalse
williamr@2
   158
         */
williamr@2
   159
        IMPORT_C TBool IsEditor() const;
williamr@2
   160
williamr@2
   161
        /**
williamr@2
   162
         * Is the Bio Control file based or not.
williamr@2
   163
         * @return ETrue if is file based.
williamr@2
   164
         */
williamr@2
   165
        IMPORT_C TBool IsFileBased() const;
williamr@2
   166
williamr@2
   167
        /**
williamr@2
   168
         * Accessor for MsvSession. The session exists only if the Bio Control
williamr@2
   169
         * has been created as message server based.
williamr@2
   170
         * @exception Panics if there is no session.
williamr@2
   171
         * @return CMsvSession&
williamr@2
   172
         */
williamr@2
   173
        IMPORT_C CMsvSession& MsvSession() const;
williamr@2
   174
williamr@2
   175
        /**
williamr@2
   176
         * Deprecated*
williamr@2
   177
         * 
williamr@2
   178
         * Returns name of input file.
williamr@2
   179
         * @return Name of file.
williamr@2
   180
         * @exception Panics if the control is not file based.
williamr@2
   181
         */
williamr@2
   182
        IMPORT_C const TFileName& FileName() const;
williamr@2
   183
williamr@2
   184
        /**
williamr@2
   185
         * Deprecated* Handle is valid only at contsruction phase!!
williamr@2
   186
         * To be removed.
williamr@2
   187
         * Returns input file handle.
williamr@2
   188
         * @return handle of file.
williamr@2
   189
         * @exception Panics if the control is not file based.
williamr@2
   190
         */
williamr@2
   191
        IMPORT_C const RFile& FileHandle() const;
williamr@2
   192
williamr@2
   193
        /**
williamr@2
   194
         * Loads a resource file from /system/data/ into eikon env. This
williamr@2
   195
         * function should be used for loading the Bio Control resources.
williamr@2
   196
         * The resources are unloaded in the destructor of this class. The
williamr@2
   197
         * offsets are kept in iResourceOffsets.
williamr@2
   198
         * @param aFile File name mask, for eg. "vcalbc.r??".
williamr@2
   199
         */
williamr@2
   200
        IMPORT_C void LoadResourceL(const TDesC& aFile);
williamr@2
   201
williamr@2
   202
        /**
williamr@2
   203
         * Loads a resource file into eikon env. The resources are unloaded in
williamr@2
   204
         * the destructor of this class. (the offsets are kept in
williamr@2
   205
         * iResourceOffsets).
williamr@2
   206
         * @param aFile File name mask, for eg. "vcalbc.r??".
williamr@2
   207
         * @param aSearchPath Search path, for eg. "\\System\\libs\\".
williamr@2
   208
         */
williamr@2
   209
        IMPORT_C void LoadResourceL(const TDesC& aFile,
williamr@2
   210
            const TDesC& aSearchPath);
williamr@2
   211
williamr@2
   212
        /**
williamr@2
   213
         * This loads the msgeditorutils.rsc resource, which is needed by
williamr@2
   214
         * the dialogs and notes of this class.
williamr@2
   215
         */
williamr@2
   216
        IMPORT_C void LoadStandardBioResourceL();
williamr@2
   217
williamr@2
   218
        /**
williamr@2
   219
         * Adds a menu item to the menu pane which is given as a reference.
williamr@2
   220
         * @param aMenuPane Reference to the menu pane.
williamr@2
   221
         * @param aStringRes The string resource id.
williamr@2
   222
         * @param aCommandOffset The offset of the command from the first free
williamr@2
   223
         * command.
williamr@2
   224
         * @param aPosition The inserting position. The default is at the top.
williamr@2
   225
         */
williamr@2
   226
        IMPORT_C void AddMenuItemL(CEikMenuPane& aMenuPane, TInt aStringRes,
williamr@2
   227
            TInt aCommandOffset, TInt aPosition = 0);
williamr@2
   228
williamr@2
   229
        /**
williamr@2
   230
         * Notify editor view.
williamr@2
   231
         * This is used by the Bio Control for notifying the Editor Base
williamr@2
   232
         * framework of an event, and usually for requesting something to
williamr@2
   233
         * be done.
williamr@2
   234
         */
williamr@2
   235
        IMPORT_C TBool NotifyEditorViewL( 
williamr@2
   236
            TMsgBioControlEventRequest aRequest,
williamr@2
   237
            TInt aDelta = 0);
williamr@2
   238
williamr@2
   239
        /**
williamr@2
   240
         * Call from base class if extension interface is supported.
williamr@2
   241
         * @param Interface for bio control extension. Ownership is not taken.
williamr@2
   242
         */
williamr@2
   243
        IMPORT_C void SetExtension(MMsgBioControlExtension* aExt);    
williamr@2
   244
williamr@2
   245
williamr@2
   246
    private: // new functions
williamr@2
   247
williamr@2
   248
        /**
williamr@2
   249
        * Sets the bio body control reference.
williamr@2
   250
        * Used only by CMsgBioBodyControl.
williamr@2
   251
        * @param aBioBodyControl Address of the bio body control.
williamr@2
   252
        */
williamr@2
   253
        void SetBioBodyControl( MMsgBioBodyControl* aBioBodyControl );
williamr@2
   254
williamr@2
   255
        /// deprecated
williamr@2
   256
        TBool IsNear(TInt aLafPos, TInt aPos) const;
williamr@2
   257
williamr@2
   258
    private: // not available
williamr@2
   259
williamr@2
   260
        /**
williamr@2
   261
         * Default constructor hidden away
williamr@2
   262
         */
williamr@2
   263
        CMsgBioControl();
williamr@2
   264
williamr@2
   265
        /**
williamr@2
   266
         * Copy constructor prohibited.
williamr@2
   267
         */
williamr@2
   268
        CMsgBioControl(const CMsgBioControl& aSource);
williamr@2
   269
williamr@2
   270
        /**
williamr@2
   271
         * Assignment operator prohibited.
williamr@2
   272
         */
williamr@2
   273
        const CMsgBioControl& operator=(const CMsgBioControl& aSource);
williamr@2
   274
williamr@2
   275
    protected:
williamr@2
   276
williamr@2
   277
        /// Reference to the MMsgBioControlObserver
williamr@2
   278
        MMsgBioControlObserver& iBioControlObserver;
williamr@2
   279
williamr@2
   280
        /// Id of the message in the server.
williamr@2
   281
        TMsvId          iId;
williamr@2
   282
williamr@2
   283
    private:
williamr@2
   284
williamr@2
   285
        /**
williamr@2
   286
         * Pointer to Message Server session. It is NOT owned here.
williamr@2
   287
         * The reason for using pointer type is that the session is optional.
williamr@2
   288
         * It can be NULL without implying any error.
williamr@2
   289
         * This session is accessed using the function MsvSession().
williamr@2
   290
         */
williamr@2
   291
        CMsvSession*    iMsvSession;
williamr@2
   292
williamr@2
   293
        /// Tells if the control was launched in editor or viewer mode.
williamr@2
   294
        TMsgBioMode iMode;
williamr@2
   295
williamr@2
   296
        /**
williamr@2
   297
         * * Deprecated -> To be removed* 
williamr@2
   298
         * Handle is valid only during contruction phase.
williamr@2
   299
         * A pointer to the handle of the input file, not owned.
williamr@2
   300
         * Accessed using FileHandle().
williamr@2
   301
         * See also function FileBased().
williamr@2
   302
         */
williamr@2
   303
		const RFile* iFile;
williamr@2
   304
		
williamr@2
   305
        /**
williamr@2
   306
         * A pointer to Bio control extension interface. It is not owned here.
williamr@2
   307
         */
williamr@2
   308
        MMsgBioControlExtension* iExt;
williamr@2
   309
williamr@2
   310
        // Filler needed to keep this object's size the same.
williamr@2
   311
        // Let the compiler calculate the filler size needed using sizeof.
williamr@2
   312
        TUint8 iBCFiller[sizeof(TFileName) - sizeof(TFileName*) - sizeof(MMsgBioControlExtension*)];
williamr@2
   313
        
williamr@2
   314
williamr@2
   315
        /// This is the array of resource offsets.
williamr@2
   316
        CArrayFixFlat<TInt>* iResourceOffsets;
williamr@2
   317
williamr@2
   318
        /// Pointer to the bio bodycontrol.
williamr@2
   319
        MMsgBioBodyControl* iBioBodyControl;
williamr@2
   320
        
williamr@2
   321
        /// status flags
williamr@2
   322
        TInt iBCStatusFlags;
williamr@2
   323
williamr@2
   324
    private:
williamr@2
   325
williamr@2
   326
        friend class CMsgBioBodyControl;
williamr@2
   327
williamr@2
   328
        };
williamr@2
   329
williamr@2
   330
#endif // MSGBIOCONTROL_H
williamr@2
   331
williamr@2
   332
// End of file