phonebookui/Phonebook2/Presentation/inc/CPbk2PresentationContactFieldTextData.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  Presentation text data of the contact field.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2PRESENTATIONCONTACTFIELDTEXTDATA_H
       
    20 #define CPBK2PRESENTATIONCONTACTFIELDTEXTDATA_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <MVPbkContactFieldTextData.h>
       
    26 
       
    27 class MVPbkStoreContactField;
       
    28 class MPbk2FieldProperty;
       
    29 
       
    30 // CLASS DECLARATIONS
       
    31 
       
    32 /**
       
    33  * Presentation text data of the contact field
       
    34  */
       
    35 NONSHARABLE_CLASS( CPbk2PresentationContactFieldTextData ) : 
       
    36         public MVPbkContactFieldTextData
       
    37     {
       
    38     public:  // Constructor & Destructor
       
    39         /**
       
    40          * Creates a new instance of this class.
       
    41          *
       
    42          * @param aTextData         The field text data
       
    43          * @param aFieldProperty    Phonebook 2 field property.
       
    44          * @param aMaxDataLength    Data's max length
       
    45          * @return  A new instance of this class.
       
    46          */
       
    47         static CPbk2PresentationContactFieldTextData* NewL(
       
    48             MVPbkContactFieldTextData& aTextData,
       
    49             const MPbk2FieldProperty& aFieldProperty,
       
    50             const TInt aMaxDataLength );
       
    51         
       
    52         /**
       
    53          * Destructor.
       
    54          */
       
    55         ~CPbk2PresentationContactFieldTextData();
       
    56 
       
    57     public:  // Interface
       
    58         /**
       
    59          * Casts MVPbkContactFieldData to this interface.
       
    60          *
       
    61          * @precond aFieldData.DataType() == EVPbkFieldStorageTypeText
       
    62          *          VPbkError::Panic(VPbkError::EFieldDataTypeMismatch)
       
    63          *          is raised if the precondition does not hold.
       
    64          * @param aFieldData    Data of the field.
       
    65          * @return Casted inteface for the text field data.
       
    66          */
       
    67         static CPbk2PresentationContactFieldTextData& Cast(
       
    68                 MVPbkContactFieldData& aFieldData);
       
    69 
       
    70         /**
       
    71          * Casts const MVPbkContactFieldData to this interface.
       
    72          *
       
    73          * @precond aFieldData.DataType() == EVPbkFieldStorageTypeText
       
    74          *          VPbkError::Panic(VPbkError::EFieldDataTypeMismatch)
       
    75          *          is raised if the precondition does not hold.
       
    76          * @param aFieldData    Data of the field.
       
    77          * @return Casted inteface for the text field data.
       
    78          */
       
    79         static const CPbk2PresentationContactFieldTextData& Cast(
       
    80                 const MVPbkContactFieldData& aFieldData);
       
    81 
       
    82         
       
    83         TPtrC Text() const;
       
    84         void SetTextL( const TDesC& aText );
       
    85         TInt MaxLength() const;
       
    86         TVPbkFieldStorageType DataType() const;
       
    87         TBool IsEmpty() const;
       
    88         void CopyL(const MVPbkContactFieldData& aFieldData);
       
    89         
       
    90     private: 
       
    91         CPbk2PresentationContactFieldTextData( 
       
    92             MVPbkContactFieldTextData& aTextData,
       
    93             const MPbk2FieldProperty& aFieldProperty,
       
    94             const TInt aMaxDataLength );        
       
    95         
       
    96     private: // Data
       
    97         /// Ref: The contact field text data
       
    98         MVPbkContactFieldTextData& iTextData;
       
    99         /// Ref: Phonebook 2 field property
       
   100         const MPbk2FieldProperty& iFieldProperty;
       
   101         /// Own: Field data max length
       
   102         const TInt iMaxDataLength;
       
   103 
       
   104     };
       
   105 
       
   106 #endif  // CPBK2PRESENTATIONCONTACTFIELDTEXTDATA_H
       
   107 
       
   108 // End of File