mobilemessaging/unieditor/application/inc/UniEditorDocument.h
changeset 0 72b543305e3a
child 22 52d61119153d
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006-2009 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:   CUniDocument class definition.      
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __UNIEDITORDOCUMENT_H
       
    21 #define __UNIEDITORDOCUMENT_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <msvapi.h>                     // CMsvEntry
       
    25 #include <MsgEditorDocument.h>          // CMsgEditorDocument
       
    26 #include <mmsvattachmentmanager.h>
       
    27 #include <mmsvattachmentmanagersync.h>
       
    28 #include <gsmuelem.h>
       
    29 #include <eikenv.h>
       
    30 
       
    31 #include "UniEditorConsts.h"
       
    32 #include "UniMtmUi.h"                   //  IsUpload()
       
    33 #include "UniClientMtm.h"
       
    34 #include "unidatamodel.h"
       
    35 
       
    36 // CONSTANTS
       
    37 
       
    38 // MACROS
       
    39 
       
    40 // DATA TYPES
       
    41 
       
    42 enum TUniMessageType
       
    43     {
       
    44     EUniReadOnly = 0,
       
    45     EUniNewMessage,
       
    46     EUniOpenFromDraft,
       
    47     EUniReply,
       
    48     EUniForward,
       
    49     EUniSendUi
       
    50     };
       
    51 
       
    52 // Current state where the message is.
       
    53 enum TUniState
       
    54     {
       
    55     EUniSms = 1,
       
    56     EUniMms = 2
       
    57     };
       
    58 
       
    59 //The order of the save types is significant!
       
    60 //Don't mess!
       
    61 enum TUniSaveType
       
    62     {
       
    63     ERegularSave = 0,        // Page change
       
    64     EClosingSave,        // User save to draft
       
    65     ESendingSave         // Before send ie. text conversion is made (paragraph sep -> linefeed)
       
    66     };
       
    67 
       
    68 // FUNCTION PROTOTYPES
       
    69 
       
    70 // FORWARD DECLARATIONS
       
    71 
       
    72 class CUniClientMtm;
       
    73 class CUniMtmUi;
       
    74 class CUniEditorPlugin;
       
    75 class CUniDataModel;
       
    76 class CMsvMimeHeaders;
       
    77 class CMsvAttachment;
       
    78 class CCnvCharacterSetConverter;
       
    79 class CUniEditorObjectsModelObserver;
       
    80 
       
    81 // CLASS DECLARATION
       
    82 
       
    83 /**
       
    84 * CUniEditorDocument. The document is part of the Symbian OS application framework.
       
    85 *
       
    86 * @since 3.2
       
    87 */
       
    88 class CUniEditorDocument : public CMsgEditorDocument
       
    89     {
       
    90     public:  // Constructors and destructor
       
    91 
       
    92         /**
       
    93         * C++ constructor
       
    94         *
       
    95         * @param aApp   Reference to application instance
       
    96         */
       
    97         CUniEditorDocument( CEikApplication& aApp, CCoeEnv& aCoeEnv );
       
    98 
       
    99         /**
       
   100         * Factory function to create this object
       
   101         *
       
   102         * @param aApp   Reference to application instance
       
   103         */
       
   104         static CUniEditorDocument* NewL( CEikApplication& aApp,
       
   105                                          CCoeEnv& aCoeEnv );
       
   106 
       
   107         /**
       
   108         * Destructor.
       
   109         */
       
   110         virtual ~CUniEditorDocument();
       
   111 
       
   112     public:
       
   113 
       
   114         /**
       
   115         * MessageSize
       
   116         * Calculates message size according to TS 23.140 v5.5.0.
       
   117         * @param aSmilEstimate  if ETrue, uses estimated SMIL size (from CUniSmilModel)
       
   118         *                       if EFalse, uses SMIL file size
       
   119         * @return size in bytes
       
   120         */
       
   121         TInt MessageSize( TBool aSmilEstimate = EFalse );
       
   122 
       
   123         /**
       
   124         * Safely deletes atta from given message (from store & smilmodel)
       
   125         * This should be called only from Uni Objects view.
       
   126         *
       
   127         * @param aSlideNum
       
   128         * @param aObject
       
   129         * @param aAttachmentObject
       
   130         */
       
   131         void DeleteAttachmentL( TInt aSlideNum, 
       
   132                                 CUniObject* aObject, 
       
   133                                 TBool aAttachmentObject );
       
   134 
       
   135         /**
       
   136         * Set whether message is SendAs, Forward, Reply or Open from Draft.
       
   137         * Function determines it from launchflags & entry flags.
       
   138         */
       
   139         void SetMessageType();
       
   140 
       
   141         /**
       
   142         * Launches plugings if they are not launched yet
       
   143         */
       
   144         void LaunchPlugings();
       
   145 
       
   146         /**
       
   147         * Returns the overall state of the message
       
   148         */
       
   149         TUniState UniState() const;
       
   150         
       
   151         /**
       
   152         * Creates correct character converter.
       
   153         */
       
   154         void CreateCharConverterL( TUniMessageCharSetSupport aMode );
       
   155 
       
   156         /**
       
   157         * Count of the SD objects in the message
       
   158         */
       
   159         TInt SuperDistributableObjectCount() const;   
       
   160 
       
   161         /**
       
   162         * From CMsgEditorDocument 
       
   163         * Returns default folder for new messages.
       
   164         * @return ID of the Drafts folder.
       
   165         */
       
   166         TMsvId DefaultMsgFolder() const;
       
   167 
       
   168         /**
       
   169         * From CMsgEditorDocument
       
   170         * Returns default message service used by application
       
   171         * @return TMsvId KMsvLocalServiceIndexEntryId.
       
   172         */
       
   173         TMsvId DefaultMsgService() const;
       
   174 
       
   175         /**
       
   176         * From CMsgEditorDocument
       
   177         * Creates new message.
       
   178         * A new message of type KUniMtmType is created
       
   179         * in a destination folder.
       
   180         * Calls CreateNewL(TMsvId aServiceType, TMsvId aDestination,
       
   181         *                  TInt aTypeList).
       
   182         * @param aService service used for sending message 
       
   183         * @param aDestFolder folder in which message will be saved eg.
       
   184         *                    KMsvDraftEntryIdValue
       
   185         * @return New message operation.
       
   186         */
       
   187         TMsvId CreateNewL(TMsvId aService, TMsvId aDestFolder);
       
   188 
       
   189         /**
       
   190         * From CMsgEditorDocument
       
   191         * Called after entry is changed by BaseEditor SetEntry Function.
       
   192         * From MsgEditorDocument
       
   193         */
       
   194         void EntryChangedL();
       
   195 
       
   196         /**
       
   197         * From CMsgEditorDocument 
       
   198         * Checks the mtm type of the message.
       
   199         * If the mtm type is not UniMtm, does the specific msg type to uni mode conversion
       
   200         */
       
   201         TMsvId PrepareContextL( TMsvId aContext );
       
   202 
       
   203         /**
       
   204         * From CMsgEditorDocument 
       
   205         * In case of a reply or forward, calls DoReplyForwardL to create entry
       
   206         */
       
   207         TMsvId ChangeContextL( const TEditorParameters& aParameters );
       
   208 
       
   209         /**
       
   210         * From CMsgEditorDocument 
       
   211         * Called by ChangeContextL to create the plugin and do the conversion
       
   212         */
       
   213         TMsvId DoReplyForwardL( TBool aReply,
       
   214                                 TMsvId aSrc,
       
   215                                 TMsvId aDest,
       
   216                                 TMsvPartList aParts );
       
   217 
       
   218         /*
       
   219         * From CMsgEditorDocument 
       
   220         * Accessor (Overrides baseeditor)
       
   221         * Returns CUniClientMtm reference correctly casted from CBaseMtm
       
   222         * @param  None
       
   223         * @return Reference to documents CUniClientMtm
       
   224         */
       
   225         CUniClientMtm& Mtm();
       
   226 
       
   227         /*
       
   228         * From CMsgEditorDocument 
       
   229         * Accessor (Overrides baseeditor)
       
   230         * Returns CUniMtmUi reference correctly casted from CBaseMtmUi
       
   231         * @param  None
       
   232         * @return Reference to documents CUniMtmUi
       
   233         */
       
   234         CUniMtmUi& MtmUiL();
       
   235 
       
   236         /**
       
   237         * From MMsgAttachmentModelObserver
       
   238         */
       
   239         RFile GetAttachmentFileL( TMsvAttachmentId aId );
       
   240     
       
   241         /**
       
   242         * Returns number of non conformant attachments at this moment.
       
   243         * The result may differ compared to the load time, if images
       
   244         * are processed and inserted images conforms now.
       
   245         * @return count of non-conformant objects
       
   246         */
       
   247         TInt UpdatedNonConformantCount() const;    
       
   248 
       
   249         /**
       
   250         * @return the max size of the image
       
   251         */
       
   252         TSize MaxImageSize() const;
       
   253 
       
   254         /**
       
   255         * @return the alternate encoding type based on input language id.
       
   256         * Turkish SMS-PREQ2265 specific
       
   257         */      
       
   258         TSmsEncoding GetLanguageSpecificAltEncodingType(TInt aLangId);
       
   259         
       
   260     public: // inlines
       
   261 
       
   262         /**
       
   263         * Current slide of the model where document is indexing.
       
   264         * @return Index of the current slide.
       
   265         */
       
   266         inline TInt CurrentSlide();
       
   267 
       
   268         /**
       
   269         * Sets current slide of the message.
       
   270         * @param aSlideNum  - Index of the slide.
       
   271         */
       
   272         inline void SetCurrentSlide( TInt aSlideNum );
       
   273 
       
   274         /**
       
   275         * Saved
       
   276         * Accessor
       
   277         * Queries whether message is saved.
       
   278         * @param None
       
   279         * @return ETrue,  User has already saved message (in this or some previous session)
       
   280         *                 ie InPreparation flag is not set
       
   281         *         EFalse, Message has not been saved by user yet.
       
   282         */
       
   283         inline TBool Saved() const;
       
   284 
       
   285         /**
       
   286         * Messagetype accessor
       
   287         *
       
   288         * @return Message type
       
   289         */
       
   290         inline TUniMessageType MessageType() const;
       
   291 
       
   292         /*
       
   293         * Mutator
       
   294         * Set the body modified flag.
       
   295         *
       
   296         * @param aModified
       
   297         */
       
   298         inline void SetBodyModified( TBool aModified );
       
   299 
       
   300         /*
       
   301         * Accessor
       
   302         * Get the body modified flag.
       
   303         *
       
   304         * @return iBodyModified flag
       
   305         */
       
   306         inline TBool BodyModified() const;
       
   307 
       
   308         /*
       
   309         * Mutator
       
   310         * Set the header modified flag.
       
   311         * @param aModified
       
   312         */
       
   313         inline void SetHeaderModified( TBool aModified );
       
   314 
       
   315         /*
       
   316         * Accessor
       
   317         * Get the header modified flag.
       
   318         *
       
   319         * @return iHeaderModified flag
       
   320         */
       
   321         inline TBool HeaderModified() const;
       
   322 
       
   323         /*
       
   324         * Accessor
       
   325         *
       
   326         * @return ETrue if either iBodyModified or iHeaderModified
       
   327         *         flag is ETrue.
       
   328         */
       
   329         inline TBool Modified() const;
       
   330 
       
   331         /*
       
   332         * Accessor
       
   333         *
       
   334         * @return creation mode
       
   335         */
       
   336         inline TInt CreationMode() const;
       
   337 
       
   338         /*
       
   339         * Mutator. Use this to override the current
       
   340         * creation mode in MMS Settings.
       
   341         *
       
   342         * Notice: This does not automatically update the
       
   343         *         creation mode of "MsgMediaResolver". It
       
   344         *         should be done explicitly.
       
   345         *
       
   346         * @param creation mode
       
   347         */
       
   348         inline void SetCreationMode( TInt aCreationMode );
       
   349 
       
   350         /*
       
   351         * Accessor
       
   352         *
       
   353         * @return ETrue if creation mode is user changeable
       
   354         */
       
   355         inline TBool CreationModeUserChangeable() const;
       
   356         
       
   357         /*
       
   358         * Accessor
       
   359         *
       
   360         * @return size of "addresses"
       
   361         */
       
   362         inline TInt AddressSize() const;
       
   363 
       
   364         /*
       
   365         * Mutator. 
       
   366         *
       
   367         * @param size of "addresses"
       
   368         */
       
   369         inline void SetAddressSize( TInt aAddressSize );
       
   370 
       
   371         /*
       
   372         * Accessor
       
   373         *
       
   374         * @return size of "subject"
       
   375         */
       
   376         inline TInt SubjectSize() const;
       
   377 
       
   378         /*
       
   379         * Mutator. 
       
   380         *
       
   381         * @param size of "subject"
       
   382         */
       
   383         inline void SetSubjectSize( TInt aSubjectSize );
       
   384 
       
   385         /*
       
   386         * Accessor
       
   387         *
       
   388         * @return maximum message size in bytes
       
   389         */
       
   390         inline TUint MaxMessageSize() const;
       
   391         
       
   392         /**
       
   393         */
       
   394         inline TInt NonConformantCount() const;
       
   395         
       
   396         /**
       
   397         * Returns previous save type
       
   398         */
       
   399         inline TUniSaveType PrevSaveType() const;        
       
   400         
       
   401         /**
       
   402         * Sets previous save type
       
   403         */
       
   404         inline void SetPrevSaveType( TUniSaveType aPrevSaveType );
       
   405         
       
   406         /**
       
   407         * Returns/sets the state of the message body (body + subject)
       
   408         */
       
   409         inline TUniState UniBodyState() const;
       
   410         inline void SetBodyUniState( TUniState aState );        
       
   411 
       
   412         /**
       
   413         * Returns/sets the state of the header part (recipient fields)
       
   414         */
       
   415         inline TUniState UniHeaderState() const;
       
   416         inline void SetHeaderUniState( TUniState aState );        
       
   417 
       
   418         /**
       
   419         * Returns pointer to message plugins
       
   420         */
       
   421         inline CUniEditorPlugin* SmsPlugin();
       
   422         inline CUniEditorPlugin* MmsPlugin();
       
   423 
       
   424         /**
       
   425         * Pointer to datamodel
       
   426         */
       
   427         inline CUniDataModel* DataModel();
       
   428 
       
   429         /**
       
   430         * Max number of MMS recipients
       
   431         */
       
   432         inline TInt MaxMmsRecipients() const;
       
   433 
       
   434         /**
       
   435         * Max number of SMS recipients
       
   436         */
       
   437         inline TInt MaxSmsRecipients() const;
       
   438 
       
   439         /**
       
   440         * Max number of SMS sub messages
       
   441         * After this number the message will be changed to MMS
       
   442         */
       
   443         inline TInt MaxSmsParts() const;
       
   444 
       
   445         /**
       
   446         * Abs. max number of SMS sub messages even in hardcoded mode
       
   447         */
       
   448         inline TInt AbsoluteMaxSmsParts() const;
       
   449 
       
   450         /**
       
   451         * Is Email Over Sms feature supported
       
   452         */
       
   453         inline TBool EmailOverSmsSupported() const;
       
   454 
       
   455         /**
       
   456         * Character converter functions
       
   457         */
       
   458         inline CCnvCharacterSetConverter* CharConverter();
       
   459         
       
   460         /**
       
   461         * Character set support.
       
   462         */
       
   463         inline TUniMessageCharSetSupport CharSetSupport();
       
   464 
       
   465         /**
       
   466         * Returns the CSP bits of the SIM card
       
   467         */
       
   468         inline TInt CSPBits() const;
       
   469         
       
   470         /**
       
   471         * Returns Eikon environment pointer.
       
   472         */
       
   473         inline CEikonEnv* EikonEnv(); 
       
   474         
       
   475         /**
       
   476         * Abs. max number of characters in SMS message. 
       
   477         * If set will overdrive maximum number of SMS sub messages.
       
   478         *
       
   479         * @return -1 if not specified. Otherwise maximum character limit.
       
   480         */
       
   481         inline TInt AbsoluteMaxSmsCharacters() const;
       
   482         
       
   483         /**
       
   484         * Set unicode character mode enabled or disabled.
       
   485         *
       
   486         * @param aEnabled Enabled if ETrue. Otherwise disabled.
       
   487         */
       
   488         inline void SetUnicodeCharacterMode( TBool aEnabled );
       
   489         
       
   490         /**
       
   491         * Return whether unicode character mode is enabled or not.
       
   492         *
       
   493         * @return ETrue if enabled. Otherwise EFalse.
       
   494         */
       
   495         inline TBool UnicodeCharacterMode() const;        
       
   496         
       
   497         /**
       
   498         * Returns the currently applicable character limits for
       
   499         * single SMS part and for concatenated SMS parts.
       
   500         *
       
   501         * @param aSinglePartLength On return contains the character limit 
       
   502         *                          for single SMS part
       
   503         * @param aConcatenatedPartLength On return contains the character limit of 
       
   504         *                                single part on multiparted SMS message.
       
   505         */
       
   506         void SmsCharacterLimits( TInt& aSinglePartLength, TInt& aConcatenatedPartLength ) const;
       
   507 
       
   508         /**
       
   509          * Returns current alternate encoding type
       
   510          * Turkish SMS-PREQ2265 specific
       
   511          */
       
   512         inline TSmsEncoding AlternativeEncodingType();
       
   513 
       
   514         /**
       
   515          * Sets the current alternate encoding type to input value
       
   516          * Turkish SMS-PREQ2265 specific
       
   517          */
       
   518         inline void SetAlternativeEncodingType(TSmsEncoding aAlternateEncoding);
       
   519 
       
   520         /**
       
   521          * Returns number of bytes to show warning notification when SMS size sweeps the boundary value
       
   522          * Korean operator req : 415-5434
       
   523          */
       
   524         inline TInt SmsSizeWarningBytes();
       
   525         
       
   526     private:
       
   527 
       
   528         /**
       
   529         * ConstructL
       
   530         * 2nd phase constructor.
       
   531         */
       
   532         void ConstructL();
       
   533         
       
   534         /**
       
   535         * Creates a new UniAppUi
       
   536         *
       
   537         * @return a pointer to CUniAppUi
       
   538         */
       
   539         CEikAppUi* CreateAppUiL();
       
   540         
       
   541         /**
       
   542          * From MsgEditorDocument. See MsgEditorDocument.h
       
   543          */
       
   544         CMsgAttachmentModel* CreateNewAttachmentModelL( TBool aReadOnly );
       
   545 
       
   546     private:  // data
       
   547         
       
   548         enum TUniDocumentFlags
       
   549             {
       
   550             EUniDocumentHeaderModified = 0x1,
       
   551             EUniDocumentBodyModified = 0x2,
       
   552             EUniDocumentCreationModeUserChangeable = 0x4,
       
   553             EUniDocumentEMailOverSms = 0x8,
       
   554             EUniDocumentRestrictedReplySms = 0x10,
       
   555             EUniDocumentRestrictedReplyMms = 0x20,
       
   556             EUniDocumentCSPBitsSupported = 0x40,
       
   557             EUniDocumentUnicodeCharacterMode = 0x80
       
   558             };
       
   559         
       
   560         CEikonEnv*          iEnvironment;
       
   561         RFs&                iFs;
       
   562         TUniMessageType     iMessageType;
       
   563         
       
   564         CUniDataModel*      iDataModel;
       
   565         CCnvCharacterSetConverter* iCharConverter;
       
   566 
       
   567         TInt                iCurrentSlide;
       
   568         TUint32             iMaxMessageSize;
       
   569         TInt                iAddressSize;
       
   570         TInt                iSubjectSize;
       
   571         TInt                iMaxMmsRecipients;
       
   572         TInt                iMaxSmsRecipients;
       
   573         TInt                iMaxConcatenatedSms;
       
   574         TInt                iAbsMaxConcatenatedSms;
       
   575         TInt                iCreationMode;
       
   576         TInt                iNonConfCount;
       
   577         TInt                iMaxImageWidth;
       
   578         TInt                iMaxImageHeight;
       
   579         
       
   580         TInt                iSupportedFeatures;
       
   581         TUniSaveType        iPrevSaveType;
       
   582         TUniState           iBodyState;
       
   583         TUniState           iHeaderState;
       
   584         TInt                iFlags;
       
   585         TInt                iCSPBits;
       
   586         TUniMessageCharSetSupport    iCharSetSupport;
       
   587         
       
   588         CUniEditorObjectsModelObserver* iObjectObserver; 
       
   589         
       
   590         CUniEditorPlugin*   iSmsPlugin;
       
   591         CUniEditorPlugin*   iMmsPlugin;
       
   592         
       
   593         /** Maximum amount of unicode characters that can be send with SMS. */
       
   594         TInt                iAbsMaxSmsCharacters;
       
   595         TInt                iCharSetMode;
       
   596 
       
   597         /** Turkish SMS-PREQ2265 specific */
       
   598         TSmsEncoding        iAlternativeEncodingType;
       
   599         
       
   600         /** Sms size limit to show warning notifications: Korean req:415-5434 */
       
   601         TInt                iSmsSizeWarningBytes;
       
   602 };
       
   603 
       
   604 #include "UniEditorDocument.inl"
       
   605 
       
   606 #endif   // __UNIDOCUMENT_H
       
   607 
       
   608 // End of file