meetingrequest/mrgui/mrfieldbuilderplugin/inc/cmrviewerattachmentfield.h
branchRCL_3
changeset 25 3533d4323edc
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 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:  MR Attachment field for editor and viewer
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMRVIEWERATTACHMENTSFIELD_H
       
    20 #define CMRVIEWERATTACHMENTSFIELD_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <eikedwob.h>
       
    24 
       
    25 #include "esmrdef.h"
       
    26 #include "cesmrfield.h"
       
    27 #include "cesmrrichtextviewer.h"
       
    28 
       
    29 // Forward declarations
       
    30 class CMRImage;
       
    31 class CEikButtonGroupContainer;
       
    32 class CAknsBasicBackgroundControlContext;
       
    33 class CESMRRichTextViewer;
       
    34 class CCalAttachment;
       
    35 class CMRAttachmentCommandHandler;
       
    36 class CCalRemoteAttachmentApi;
       
    37 class CCalRemoteAttachmentInfo;
       
    38 class MCalRemoteAttachmentOperation;
       
    39 
       
    40 /**
       
    41  * CMRViewerAttachmentsField is entry viewer attachment field
       
    42  */
       
    43 NONSHARABLE_CLASS( CMRViewerAttachmentsField ):
       
    44         public CESMRField,
       
    45         public MEikEdwinSizeObserver,
       
    46         public MESMRRichTextObserver
       
    47     {
       
    48 public:
       
    49     /**
       
    50      * Two phase constructor.
       
    51      */
       
    52     static CMRViewerAttachmentsField* NewL();
       
    53 
       
    54     /**
       
    55      * Destructor.
       
    56      */
       
    57     ~CMRViewerAttachmentsField();
       
    58 
       
    59 protected: // From CESMRField
       
    60     TSize MinimumSize();
       
    61     void InitializeL();
       
    62     void InternalizeL( MESMRCalEntry& aEntry );
       
    63     void ExternalizeL( MESMRCalEntry& aEntry );
       
    64     TBool ExecuteGenericCommandL( TInt aCommand );
       
    65     void SetOutlineFocusL( TBool aFocus );
       
    66     void ListObserverSet();
       
    67     void HandleLongtapEventL( const TPoint& aPosition );
       
    68     TBool HandleRawPointerEventL( const TPointerEvent& aPointerEvent );
       
    69     void DynInitMenuPaneL(
       
    70                  TInt aResourceId,
       
    71                  CEikMenuPane* aMenuPane );
       
    72     void LockL();
       
    73     TBool SupportsLongTapFunctionalityL(
       
    74         		 const TPointerEvent &aPointerEvent );
       
    75 
       
    76 protected: // From CCoeControl
       
    77     TInt CountComponentControls() const;
       
    78     CCoeControl* ComponentControl( TInt aInd ) const;
       
    79     void SizeChanged();
       
    80     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
    81 
       
    82 protected: // From MEikEdwinSizeObserver
       
    83     TBool HandleEdwinSizeEventL( CEikEdwin* aEdwin, TEdwinSizeEvent aType, TSize aDesirableEdwinSize);
       
    84 
       
    85 protected: // From MESMRRichTextObserver
       
    86     TBool HandleRichTextLinkSelection( const CESMRRichTextLink* aLink );
       
    87 
       
    88 private: // Implementation
       
    89     CMRViewerAttachmentsField();
       
    90     void ConstructL();
       
    91 
       
    92     void UpdateAttachmentsListL();
       
    93     HBufC* ClipTextLC( const TDesC& aText, const CFont& aFont, TInt aWidth );
       
    94     void UpdateFieldL();
       
    95     HBufC* AttachmentNameAndSizeL( const TDesC& aDes, const CCalAttachment& aAttachment );
       
    96     TInt LineSpacing();
       
    97     TInt FocusMargin();
       
    98     void CreateRemoteAttApiL();
       
    99     void DynInitMenuPaneForCurrentAttachmentL(
       
   100                  CEikMenuPane* aMenuPane );
       
   101     TBool IsAttachmentDownloadInProgress( const CCalAttachment& aAttachment );
       
   102     TInt MaxTextLengthInPixelsL();
       
   103 
       
   104 private: //data
       
   105     // Own: Field icon
       
   106     CMRImage* iFieldIcon;
       
   107     /// Own: Lock icon
       
   108     CMRImage* iLockIcon;
       
   109     // Owned. Attachment list.
       
   110     CESMRRichTextViewer* iRichTextViewer;
       
   111     // Own. Background control context.
       
   112     CAknsBasicBackgroundControlContext* iBgCtrlContext;
       
   113     // Attachment count
       
   114     TInt iAttachmentCount;
       
   115     /// Ref: Reference to internalized entry
       
   116     MESMRCalEntry* iEntry;
       
   117     // Field rect for comparison purposes
       
   118     TRect iFieldRect;
       
   119     // Rich Text viewer size
       
   120     TSize iRichTextSize;
       
   121     /// Own: Attachment command handler
       
   122     CMRAttachmentCommandHandler* iAttachmentCommandHandler;
       
   123     /// Own: Remote attachment API
       
   124     CCalRemoteAttachmentApi* iRemoteAttApi;
       
   125     /// Own: Remote attachment URIs
       
   126     CDesCArrayFlat* iRemoteAttUris;
       
   127     /// Own: Remote attachment info
       
   128     CCalRemoteAttachmentInfo* iAttachmentInfo;
       
   129     };
       
   130 
       
   131 #endif  // CMRATTACHMENTSFIELD_H