1.1 --- a/epoc32/include/app/msgbiocontrol.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/app/msgbiocontrol.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,332 @@
1.4 -msgbiocontrol.h
1.5 +/*
1.6 +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description: Base class for bio controls.
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +
1.24 +#ifndef MSGBIOCONTROL_H
1.25 +#define MSGBIOCONTROL_H
1.26 +
1.27 +
1.28 +// INCLUDES
1.29 +#include <msvstd.h>
1.30 +#include <coecntrl.h> // for CCoeControl
1.31 +#include <mmsgbiocontrol.h> // for MMsgBioControl
1.32 +#include <badesca.h> // for CDesCArray
1.33 +#include <aknglobalnote.h>
1.34 +#include <MsgEditor.hrh> // for TMsgCursorLocation
1.35 +
1.36 +// FORWARD DECLARATIONS
1.37 +
1.38 +class MMsgBioControlObserver;
1.39 +class CMsvSession;
1.40 +class MMsgBioControlExtension;
1.41 +
1.42 +
1.43 +// CLASS DECLARATION
1.44 +
1.45 +/**
1.46 + * The base class for Bio controls.
1.47 + */
1.48 +class CMsgBioControl : public CCoeControl, public MMsgBioControl
1.49 + {
1.50 +
1.51 + public: //construction and destruction
1.52 +
1.53 + /**
1.54 + * Constructor. Call this from your Bio Control constructor.
1.55 + * @param aObserver Reference to the Bio control observer.
1.56 + * @param aSession Message Server session. Ownership not transferred.
1.57 + * @param aId Id of the message in the server.
1.58 + * @param aEditorOrViewerMode Sets Bio Control into editor or viewer mode.
1.59 + * @param aFile Data file handle. Bio controls can also be file based. Not owned.
1.60 + */
1.61 + IMPORT_C CMsgBioControl(
1.62 + MMsgBioControlObserver& aObserver,
1.63 + CMsvSession* aSession, //ownership is NOT transferred
1.64 + TMsvId aId,
1.65 + TMsgBioMode aEditorOrViewerMode,
1.66 + const RFile* aFile); //ownership is NOT transferred
1.67 +
1.68 + /**
1.69 + * Destructor
1.70 + */
1.71 + IMPORT_C ~CMsgBioControl();
1.72 +
1.73 + public: // static helper functions
1.74 +
1.75 + /**
1.76 + * Pops a confirmation query. The result is given by the return value.
1.77 + * The standard resource must have been loaded using
1.78 + * LoadStandardBioResourceL().
1.79 + * @param aText The text that is to be used in the query.
1.80 + * @return A user confirmation results in ETrue, and vice versa.
1.81 + */
1.82 + IMPORT_C static TBool ConfirmationQueryL(const TDesC& aText);
1.83 +
1.84 + /**
1.85 + * Pops a confirmation query. The result is given by the return value.
1.86 + * The standard resource must have been loaded using
1.87 + * LoadStandardBioResourceL(). Your resource must also be loaded, for
1.88 + * eg. with LoadResourceL().
1.89 + * CCoeEnv must exist.
1.90 + * @param aStringResource The string resource id.
1.91 + * @return A user confirmation results in ETrue, and vice versa.
1.92 + */
1.93 + IMPORT_C static TBool ConfirmationQueryL(TInt aStringResource);
1.94 +
1.95 + public: // from MMsgBioControl
1.96 +
1.97 + /**
1.98 + * The application can get the option menu recommendations using this
1.99 + * function. The function comes from MMsgBioControl. This is the
1.100 + * default implementation which returns the flags
1.101 + * EMsgBioCallBack | EMsgBioDelete | EMsgBioMessInfo | EMsgBioMove |
1.102 + * EMsgBioCreateCC | EMsgBioSend | EMsgBioAddRecipient | EMsgBioSave |
1.103 + * EMsgBioSendingOpt | EMsgBioHelp | EMsgBioExit.
1.104 + * Bio Controls should override this if it is not ok.
1.105 + * @return The option menu permission flags. If the flag is off it
1.106 + * means that the option menu command is not recommended with this
1.107 + * Bio Control.
1.108 + */
1.109 + IMPORT_C TUint32 OptionMenuPermissionsL() const;
1.110 +
1.111 + /**
1.112 + * Gives the height of the text in pixels.
1.113 + * It is used by the scrolling framework.
1.114 + * @return Height of the text in pixels.
1.115 + */
1.116 + IMPORT_C TInt VirtualHeight();
1.117 +
1.118 + /**
1.119 + * Gives the cursor position in pixels.
1.120 + * It is used by the scrolling framework.
1.121 + * @return Cursor position in pixels.
1.122 + */
1.123 + IMPORT_C TInt VirtualVisibleTop();
1.124 +
1.125 + /**
1.126 + * Tells whether the cursor is in the topmost or bottom position.
1.127 + * It is used by the scrolling framework.
1.128 + * @param aLocation Specifies either top or bottom.
1.129 + * @return ETrue if the cursor is in the part specified by aLocation.
1.130 + */
1.131 + IMPORT_C TBool IsCursorLocation(TMsgCursorLocation aLocation) const;
1.132 +
1.133 + public: //new functions
1.134 +
1.135 + /**
1.136 + * Performs the internal scrolling of control if needed.
1.137 + * Default implementation does not perform any scrolling and returns that
1.138 + * zero pixels were scrolled.
1.139 + * @since 3.2
1.140 + * @param aPixelsToScroll Amount of pixels to scroll.
1.141 + * @param aDirection Scrolling direction.
1.142 + * @return Amount of pixels the where scrolled. Zero value means the component cannot
1.143 + * be scrolled to that direction anymore and view should be moved.
1.144 + */
1.145 + IMPORT_C TInt ScrollL( TInt aPixelsToScroll, TMsgScrollDirection aDirection );
1.146 +
1.147 + /**
1.148 + * Prepares control for viewing.
1.149 + * @since 3.2
1.150 + * @param aEvent The event type
1.151 + * @param aParam Event related parameters
1.152 + */
1.153 + IMPORT_C void NotifyViewEvent( TMsgViewEvent aEvent, TInt aParam );
1.154 +
1.155 +
1.156 + protected: //new functions
1.157 +
1.158 + /**
1.159 + * Returns true if the control has been launched as editor,
1.160 + * and false if it was launched as viewer.
1.161 + * @return ETrue or EFalse
1.162 + */
1.163 + IMPORT_C TBool IsEditor() const;
1.164 +
1.165 + /**
1.166 + * Is the Bio Control file based or not.
1.167 + * @return ETrue if is file based.
1.168 + */
1.169 + IMPORT_C TBool IsFileBased() const;
1.170 +
1.171 + /**
1.172 + * Accessor for MsvSession. The session exists only if the Bio Control
1.173 + * has been created as message server based.
1.174 + * @exception Panics if there is no session.
1.175 + * @return CMsvSession&
1.176 + */
1.177 + IMPORT_C CMsvSession& MsvSession() const;
1.178 +
1.179 + /**
1.180 + * Deprecated*
1.181 + *
1.182 + * Returns name of input file.
1.183 + * @return Name of file.
1.184 + * @exception Panics if the control is not file based.
1.185 + */
1.186 + IMPORT_C const TFileName& FileName() const;
1.187 +
1.188 + /**
1.189 + * Deprecated* Handle is valid only at contsruction phase!!
1.190 + * To be removed.
1.191 + * Returns input file handle.
1.192 + * @return handle of file.
1.193 + * @exception Panics if the control is not file based.
1.194 + */
1.195 + IMPORT_C const RFile& FileHandle() const;
1.196 +
1.197 + /**
1.198 + * Loads a resource file from /system/data/ into eikon env. This
1.199 + * function should be used for loading the Bio Control resources.
1.200 + * The resources are unloaded in the destructor of this class. The
1.201 + * offsets are kept in iResourceOffsets.
1.202 + * @param aFile File name mask, for eg. "vcalbc.r??".
1.203 + */
1.204 + IMPORT_C void LoadResourceL(const TDesC& aFile);
1.205 +
1.206 + /**
1.207 + * Loads a resource file into eikon env. The resources are unloaded in
1.208 + * the destructor of this class. (the offsets are kept in
1.209 + * iResourceOffsets).
1.210 + * @param aFile File name mask, for eg. "vcalbc.r??".
1.211 + * @param aSearchPath Search path, for eg. "\\System\\libs\\".
1.212 + */
1.213 + IMPORT_C void LoadResourceL(const TDesC& aFile,
1.214 + const TDesC& aSearchPath);
1.215 +
1.216 + /**
1.217 + * This loads the msgeditorutils.rsc resource, which is needed by
1.218 + * the dialogs and notes of this class.
1.219 + */
1.220 + IMPORT_C void LoadStandardBioResourceL();
1.221 +
1.222 + /**
1.223 + * Adds a menu item to the menu pane which is given as a reference.
1.224 + * @param aMenuPane Reference to the menu pane.
1.225 + * @param aStringRes The string resource id.
1.226 + * @param aCommandOffset The offset of the command from the first free
1.227 + * command.
1.228 + * @param aPosition The inserting position. The default is at the top.
1.229 + */
1.230 + IMPORT_C void AddMenuItemL(CEikMenuPane& aMenuPane, TInt aStringRes,
1.231 + TInt aCommandOffset, TInt aPosition = 0);
1.232 +
1.233 + /**
1.234 + * Notify editor view.
1.235 + * This is used by the Bio Control for notifying the Editor Base
1.236 + * framework of an event, and usually for requesting something to
1.237 + * be done.
1.238 + */
1.239 + IMPORT_C TBool NotifyEditorViewL(
1.240 + TMsgBioControlEventRequest aRequest,
1.241 + TInt aDelta = 0);
1.242 +
1.243 + /**
1.244 + * Call from base class if extension interface is supported.
1.245 + * @param Interface for bio control extension. Ownership is not taken.
1.246 + */
1.247 + IMPORT_C void SetExtension(MMsgBioControlExtension* aExt);
1.248 +
1.249 +
1.250 + private: // new functions
1.251 +
1.252 + /**
1.253 + * Sets the bio body control reference.
1.254 + * Used only by CMsgBioBodyControl.
1.255 + * @param aBioBodyControl Address of the bio body control.
1.256 + */
1.257 + void SetBioBodyControl( MMsgBioBodyControl* aBioBodyControl );
1.258 +
1.259 + /// deprecated
1.260 + TBool IsNear(TInt aLafPos, TInt aPos) const;
1.261 +
1.262 + private: // not available
1.263 +
1.264 + /**
1.265 + * Default constructor hidden away
1.266 + */
1.267 + CMsgBioControl();
1.268 +
1.269 + /**
1.270 + * Copy constructor prohibited.
1.271 + */
1.272 + CMsgBioControl(const CMsgBioControl& aSource);
1.273 +
1.274 + /**
1.275 + * Assignment operator prohibited.
1.276 + */
1.277 + const CMsgBioControl& operator=(const CMsgBioControl& aSource);
1.278 +
1.279 + protected:
1.280 +
1.281 + /// Reference to the MMsgBioControlObserver
1.282 + MMsgBioControlObserver& iBioControlObserver;
1.283 +
1.284 + /// Id of the message in the server.
1.285 + TMsvId iId;
1.286 +
1.287 + private:
1.288 +
1.289 + /**
1.290 + * Pointer to Message Server session. It is NOT owned here.
1.291 + * The reason for using pointer type is that the session is optional.
1.292 + * It can be NULL without implying any error.
1.293 + * This session is accessed using the function MsvSession().
1.294 + */
1.295 + CMsvSession* iMsvSession;
1.296 +
1.297 + /// Tells if the control was launched in editor or viewer mode.
1.298 + TMsgBioMode iMode;
1.299 +
1.300 + /**
1.301 + * * Deprecated -> To be removed*
1.302 + * Handle is valid only during contruction phase.
1.303 + * A pointer to the handle of the input file, not owned.
1.304 + * Accessed using FileHandle().
1.305 + * See also function FileBased().
1.306 + */
1.307 + const RFile* iFile;
1.308 +
1.309 + /**
1.310 + * A pointer to Bio control extension interface. It is not owned here.
1.311 + */
1.312 + MMsgBioControlExtension* iExt;
1.313 +
1.314 + // Filler needed to keep this object's size the same.
1.315 + // Let the compiler calculate the filler size needed using sizeof.
1.316 + TUint8 iBCFiller[sizeof(TFileName) - sizeof(TFileName*) - sizeof(MMsgBioControlExtension*)];
1.317 +
1.318 +
1.319 + /// This is the array of resource offsets.
1.320 + CArrayFixFlat<TInt>* iResourceOffsets;
1.321 +
1.322 + /// Pointer to the bio bodycontrol.
1.323 + MMsgBioBodyControl* iBioBodyControl;
1.324 +
1.325 + /// status flags
1.326 + TInt iBCStatusFlags;
1.327 +
1.328 + private:
1.329 +
1.330 + friend class CMsgBioBodyControl;
1.331 +
1.332 + };
1.333 +
1.334 +#endif // MSGBIOCONTROL_H
1.335 +
1.336 +// End of file