meetingrequest/mrgui/inc/cesmrfieldstorage.h
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:28:57 +0100
branchRCL_3
changeset 25 3533d4323edc
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  ESMR field storage definition
*
*/

#ifndef CESMRFIELDSTORAGE_H
#define CESMRFIELDSTORAGE_H

#include <e32base.h>
//<cmail>
#include "esmrdef.h"
//</cmail>
#include "mesmrfieldstorage.h"
#include "cesmrfieldbuilderinterface.h"

class CESMRField;
class MESMRCalEntry;
class MESMRFieldEventObserver;
class CESMRFieldEventQueue;
class CESMRPolicy;
class CMRSystemNotifier;

/**
 * CESMRFieldStorage is a base class for different storage classes.
 * Storage class owns the fields needed to draw UI. This class also has methods
 * to add new fields into field array.
 *
 * fields for the ui are created are created in a separate ecom plugin 
 * loaded here
 */
NONSHARABLE_CLASS( CESMRFieldStorage ): public CBase, 
										public MESMRFieldStorage
    {
public:
    // Destructor
    virtual ~CESMRFieldStorage();

public:
    /**
     * Adds new field into field array.
     *
     * @param aField - field to be added
     */
    void AddFieldL( CESMRField* aField );

    /**
     * Adds new field into field array.
     *
     * @param aField - field to be added
     * @param aVisible - is this field visible by default ot not.
     */
    void AddFieldL( CESMRField* aField, TBool aVisible );

   /**
     * Creates editor field.
     *
     * @param aValidator - time validator
     * @param aField - field to be created
     */
    CESMRField* CreateEditorFieldL(
                MESMRFieldValidator* aValidator,
                TESMREntryField aField );

    /**
     * Creates viewer field.
     *
     * @param aResponseObserver - observer to be called when e.g.
     *                            answer is ready to be sent.
     * @param aField - field to be created
     * @param aResponseReady - NOT IN USE
     */
    CESMRField* CreateViewerFieldL(
                MESMRResponseObserver* aResponseObserver,
                TESMREntryField aField,
                TBool aResponseReady );

public: // From MESMRFieldStorage
    TInt Count() const;
    CESMRField* Field( TInt aInd ) const;
    CESMRField* FieldById( TESMREntryFieldId aId ) const;
    void InternalizeL( MESMRCalEntry& aEntry );
    void ExternalizeL( MESMRCalEntry& aEntry );
    TInt Validate( TESMREntryFieldId& aId, TBool aForceValidate );
    void ChangePolicyL( const CESMRPolicy& aNewPolicy,
                        MESMRCalEntry& aEntry );

protected:
    // C++ constructor
    CESMRFieldStorage(
            MESMRFieldEventObserver& aEventObserver );

    void BaseConstructL();
    
    CESMRFieldEventQueue& EventQueueL();
    
    void RemoveField( TInt aInd );
    
    void InsertFieldL( CESMRField* aField, TInt aIndex );
    
    void ReserveL( TInt aCount );
    
    void Reset();
    
private:
    /**
     * loads fieldbuilder ecom plugin
     * delayed until the first time the plugin is needed
     */
    void LoadPluginL();

    MESMRFieldBuilder* FieldBuilderL();    

private:
    /// Own: Array that owns all the fields
    RPointerArray< CESMRField > iArray;
    /// Own: ecom field builder interface
    CESMRFieldBuilderInterface* iPlugin;
    /// Ref: composite class of field builder interface
    MESMRFieldBuilder* iFieldBuilder;
    /// Ref: Event observer
    MESMRFieldEventObserver& iEventObserver;
    /// Own: Event Queue
    CESMRFieldEventQueue* iEventQueue;
    /// Own: System notifier
    CMRSystemNotifier* iSystemNotifier;
    };

#endif // CESMRFIELDSTORAGE_H

// EOF