meetingrequest/mrgui/mrfieldbuilderplugin/inc/cmrviewerattachmentfield.h
branchRCL_3
changeset 12 4ce476e64c59
child 16 b5fbb9b25d57
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
       
     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     
       
    74 protected: // From CCoeControl
       
    75     TInt CountComponentControls() const;
       
    76     CCoeControl* ComponentControl( TInt aInd ) const;
       
    77     void SizeChanged();
       
    78     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
    79     void SetContainerWindowL( const CCoeControl& aControl );
       
    80     
       
    81 protected: // From MEikEdwinSizeObserver
       
    82     TBool HandleEdwinSizeEventL( CEikEdwin* aEdwin, TEdwinSizeEvent aType, TSize aDesirableEdwinSize);
       
    83     
       
    84 public: // From MESMRRichTextObserver
       
    85     TBool HandleRichTextLinkSelection( const CESMRRichTextLink* aLink );
       
    86     
       
    87 private: // Implementation
       
    88     CMRViewerAttachmentsField();
       
    89     void ConstructL();
       
    90 
       
    91     void UpdateAttachmentsListL();
       
    92     HBufC* ClipTextLC( const TDesC& aText, const CFont& aFont, TInt aWidth );
       
    93     void UpdateFieldL();
       
    94     HBufC* AttachmentNameAndSizeL( const TDesC& aDes, const CCalAttachment& aAttachment );
       
    95     TInt LineSpacing();
       
    96     TInt FocusMargin();
       
    97     void CreateRemoteAttApiL();
       
    98     void DynInitMenuPaneForCurrentAttachmentL(
       
    99                  CEikMenuPane* aMenuPane );
       
   100     TBool IsAttachmentDownloadInProgress( const CCalAttachment& aAttachment );
       
   101     
       
   102 private: //data
       
   103     // Own: Field icon
       
   104     CMRImage* iFieldIcon;
       
   105     /// Own: Lock icon
       
   106     CMRImage* iLockIcon;
       
   107     // Owned. Attachment list.
       
   108     CESMRRichTextViewer* iRichTextViewer;
       
   109     // Not owned. CBA.
       
   110     CEikButtonGroupContainer* iButtonGroupContainer;
       
   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