epoc32/include/fldbase.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/fldbase.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/fldbase.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,115 @@
     1.4 -fldbase.h
     1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __FLDBASE_H__
    1.21 +#define __FLDBASE_H__
    1.22 +
    1.23 +#include <e32std.h>
    1.24 +#include <e32base.h>
    1.25 +#include <s32stor.h>
    1.26 +
    1.27 +// Classes defined:
    1.28 +class CTextField;
    1.29 +class MTextFieldFactory;
    1.30 +
    1.31 +
    1.32 +
    1.33 +
    1.34 +class CTextField : public CBase
    1.35 +/** 
    1.36 +Abstract class: derive from this to instantiate a particular type of field (eg date etc)
    1.37 +Abstract base class for all field types.
    1.38 +
    1.39 +A field contains information which relates to a text object and can be automatically 
    1.40 +updated, e.g. page number or current date and time. Fields must implement 
    1.41 +the pure virtual functions defined in this class, including Value() which 
    1.42 +should calculate and return the field's new value, and Type() which returns 
    1.43 +the field's type UID. The type UID identifies the field type to the field 
    1.44 +factory (see class MTextFieldFactory). 
    1.45 +@publishedAll
    1.46 +@released
    1.47 +*/
    1.48 +	{
    1.49 +public:
    1.50 +	IMPORT_C virtual TStreamId StoreL(CStreamStore& aStore)const; // calls ExternalizeL()
    1.51 +	IMPORT_C virtual void RestoreL(const CStreamStore& aStore,TStreamId aId); // calls InternalizeL()
    1.52 +	//
    1.53 +	// Should be replaced by concrete derived classes.
    1.54 +	IMPORT_C virtual void ExternalizeL(RWriteStream& aStream)const; // Externalize state info for the field
    1.55 +    /** Internalises the field data. Called by RestoreL().
    1.56 +	
    1.57 +	@param aStream Stream from which the field data should be internalised. */
    1.58 +	virtual void InternalizeL(RReadStream& aStream)=0;
    1.59 +	//
    1.60 +	/** Sets aValueText to the current field value if the buffer is large enough. If 
    1.61 +	not, aValueText is not changed, and the function returns the length which 
    1.62 +	is required to hold the field's value.
    1.63 +	
    1.64 +	@param aValueText Descriptor which on return contains the field's updated 
    1.65 +	value. 
    1.66 +	@return Zero on success, otherwise, the length of the buffer which is required 
    1.67 +	to hold the field's updated value. */
    1.68 +	virtual TInt Value(TPtr& aValueText)=0; 
    1.69 +	//	
    1.70 +	/** Returns the field's type UID.
    1.71 +	
    1.72 +	@return The field's type UID. */
    1.73 +	virtual TUid Type()const=0;
    1.74 +	};
    1.75 +
    1.76 +
    1.77 + 
    1.78 +
    1.79 +class MTextFieldFactory
    1.80 +/** 
    1.81 +Abstract class that should be derived from by any application that wishes to support fields
    1.82 +Abstract base class for field factories.
    1.83 +
    1.84 +To use fields in editable text,
    1.85 +
    1.86 +1) Define a field factory class (derived from MTextFieldFactory) that implements 
    1.87 +NewFieldL().
    1.88 +
    1.89 +2) Create an instance of the field factory and set this to be the editable 
    1.90 +text object's field factory (see CPlainText::SetFieldFactory(), or you can 
    1.91 +specify a field factory in the text object 's NewL()).
    1.92 +
    1.93 +3) Create a new field (CPlainText::NewTextFieldL()), specifying the field 
    1.94 +type UID (the built in field type UID values are defined in flddef.h). This 
    1.95 +calls the factory's NewFieldL() function.
    1.96 +
    1.97 +4) Insert the field into the text object (CPlainText::InsertFieldL()).
    1.98 +
    1.99 +5) Evaluate the field (CPlainText::UpdateFieldL()) and then re-evaluate when 
   1.100 +required. 
   1.101 +@publishedAll
   1.102 +@released
   1.103 +*/
   1.104 +	{
   1.105 +public:
   1.106 +	
   1.107 +	/** Implementations of this function should create a field of the type specified, 
   1.108 +	returning NULL if the field type is not recognised or supported.
   1.109 +	
   1.110 +	@param aFieldType The field's type UID. 
   1.111 +	@return Pointer to the new text field, or NULL if the factory does not recognise 
   1.112 +	or support the field type. */
   1.113 +	virtual CTextField* NewFieldL(TUid aFieldType)=0; 
   1.114 +	// Creates a field of the type specified
   1.115 +	// Returns NULL if it does not recognise/support the field type
   1.116 +	};
   1.117 +
   1.118 +
   1.119 +#endif