epoc32/include/fldbltin.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // 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
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __FLDBLTIN_H__
    17 #define __FLDBLTIN_H__
    18 
    19 #include <e32std.h>
    20 #include <fldbase.h>
    21 
    22 
    23 // Classes declared in this file
    24 class MFieldPageNumInfo;
    25 class MFieldNumPagesInfo;
    26 class MFieldFileNameInfo;
    27 // the built-in field types
    28 class CDateTimeField;
    29 class CPageNumField;
    30 class CNumPagesField;
    31 class CFileNameField;
    32 class TRomanNumeral;
    33 //
    34 // Classes referenced
    35 class RReadStream;
    36 class RWriteStream;
    37 
    38  
    39 
    40 /** 
    41 Specifies the mixin protocol for evaluating a current page number field.
    42 
    43 You should implement the UpdateFieldPageNum() function in a concrete derived 
    44 class, then pass an object of the class to the page number field (using CPageNumField::SetPageNumInfo()) 
    45 before the field can be evaluated. 
    46 @publishedAll
    47 @released
    48 */
    49 class MFieldPageNumInfo
    50 	{
    51 public:
    52 	
    53 	 
    54 	/** Implementations of this function should return the current page number.
    55 	
    56 	@return The page number. */
    57 	virtual TInt UpdateFieldPageNum()const=0;
    58 	};
    59 
    60 
    61 /** 
    62 Specifies the mixin protocol for evaluating a total number of pages field.
    63 
    64 You should implement the UpdateFieldNumPages() function in a concrete derived 
    65 class, then pass an object of the class to the number of pages field (using 
    66 CNumPagesField::SetNumPagesInfo()) before the field can be evaluated. 
    67 @publishedAll
    68 @released
    69 */
    70 class MFieldNumPagesInfo
    71 	{
    72 public:
    73 	
    74 	 
    75 	/** Implementations of this function should return the number of pages in the current 
    76 	document.
    77 	
    78 	@return The total number of pages. */
    79 	virtual TInt UpdateFieldNumPages()const=0;
    80 	};
    81 
    82 
    83  
    84 /** 
    85 Specifies the mixin protocol for evaluating a filename field.
    86 
    87 You should implement the UpdateFieldFileName() function in a concrete derived 
    88 class, then pass an object of the derived class to the filename field (using 
    89 CFileNameField::SetFileNameInfo()) before the field can be evaluated. 
    90 @publishedAll
    91 @released
    92 */
    93 class MFieldFileNameInfo
    94 	{
    95 public:
    96 	
    97 	 
    98 	/** Implementations of this function should set aValueText to the current document's 
    99 	filename, if the buffer is large enough. If not, the function should return 
   100 	the length which is required to hold the filename.
   101 	
   102 	@param aValueText Descriptor which on return contains the document's filename. 
   103 	
   104 	@return Zero if aValueText is long enough to hold the filename. Otherwise, 
   105 	the length of the buffer which is required to hold the filename. */
   106 	virtual TInt UpdateFieldFileName(TPtr& aValueText)const=0;
   107 	};
   108 
   109 
   110  
   111 /** 
   112 A date/time field. 
   113 
   114 This may contain any or all components of the date and time, and can be formatted 
   115 in a variety of ways. It stores a format string, which is used by the Value() 
   116 function to format the current date/time. For information on date/time formatting, 
   117 see TTime::FormatL(). 
   118 @publishedAll
   119 @released
   120 */
   121 class CDateTimeField : public CTextField
   122 	{
   123 public:
   124 	IMPORT_C CDateTimeField();
   125 	IMPORT_C void SetFormat(const TDesC& aFormat);
   126 	// from TTextField
   127 	IMPORT_C virtual TInt Value(TPtr& aValueText);
   128 	IMPORT_C virtual void InternalizeL(RReadStream& aStream);
   129 	IMPORT_C virtual void ExternalizeL(RWriteStream& aStream)const;
   130 	//
   131 	// Getters
   132 	IMPORT_C const TDesC& FormatString()const;
   133 	IMPORT_C TUid Type()const;
   134 protected:
   135 	TBuf<64> iFormatString;
   136 	};
   137 
   138 
   139  
   140 
   141 /** 
   142 Stores a style for displaying the value of numeric fields. 
   143 
   144 This style is used when converting the integer value of numeric fields into 
   145 a descriptor for display in another format, e.g. Arabic, Roman, alphabetic. 
   146 This is the base class for the numeric fields, CPageNumField and CNumPagesField. 
   147 @publishedAll
   148 @released
   149 */
   150 class CPageFieldBase : public CTextField
   151 	{
   152 public:
   153 /** Numeric style */
   154 	enum TNumberStyle {
   155 		 /** Arabic numeral, e.g. 1, 2, 3. */
   156 		EArabic,			// 1,2,3
   157 		/** Upper case Roman numeral, e.g. I, II, III. */
   158 		ERomanUpper,		// I,II,III
   159 		/** Lower case Roman numeral, e.g. i, ii, iii. */
   160 		ERomanLower,		// i,ii,iii
   161 		/** Upper case alphabetic. */
   162 		EAlphabeticUpper,	// A,B,C
   163 		/** Lower case alphabetic. */
   164 		EAlphabeticLower	// a,b,c
   165 		};
   166 public:
   167 	
   168 	/** Sets the numeric style.
   169 	
   170 	@param aStyle The numeric style. */
   171 	inline void SetNumberStyle(TNumberStyle aStyle) { iStyle = aStyle; } 
   172 	// from TTextField
   173 	IMPORT_C void InternalizeL(RReadStream& aStream);
   174 	IMPORT_C void ExternalizeL(RWriteStream& aStream)const;
   175 	//
   176 	// Getters
   177 	IMPORT_C TNumberStyle NumberStyle()const;
   178 protected:
   179 	TInt InsertValue(TPtr& aValueText,TInt aValue);
   180 protected:
   181 	TNumberStyle iStyle;
   182 	};
   183 
   184 
   185 
   186 /** 
   187 A field which evaluates to the current page number in the document. 
   188 
   189 Before the page number field can be evaluated, it must be passed a pointer 
   190 to an object which implements the UpdateFieldPageNum() function. 
   191 @publishedAll
   192 @released
   193 */
   194 class CPageNumField : public CPageFieldBase
   195 	{
   196 public:
   197 	/** Sets the object which implements UpdateFieldPageNum(), to get the current page 
   198 	number. SetPageNumInfo() must be called before the page number field can be 
   199 	evaluated.
   200 	
   201 	@param aInfo Pointer to an object which implements UpdateFieldPageNum(). */
   202 	inline void SetPageNumInfo(MFieldPageNumInfo* aInfo) { iPageNumInfo=aInfo; }
   203 	// from TTextField
   204 	IMPORT_C TInt Value(TPtr& aValueText);
   205 	IMPORT_C TUid Type()const;
   206 protected:
   207 	MFieldPageNumInfo* iPageNumInfo;
   208 	};
   209 
   210 
   211 
   212 /** 
   213 A field which evaluates to the number of pages in the document.
   214 
   215 Before the number of pages field can be evaluated, it must be passed a pointer 
   216 to an object which implements the UpdateFieldNumPages() function. 
   217 @publishedAll
   218 @released
   219 */
   220 class CNumPagesField : public CPageFieldBase
   221 	{
   222 public:
   223 	/** Sets the object which implements UpdateFieldNumPages(), to get the number of 
   224 	pages in the document. SetNumPagesInfo() must be called before the number 
   225 	of pages field can be evaluated.
   226 	
   227 	@param aInfo Pointer to an object which implements UpdateFieldNumPages(). */
   228 	inline void SetNumPagesInfo(MFieldNumPagesInfo* aInfo) { iNumPagesInfo=aInfo; }
   229 	// from TTextField
   230 	IMPORT_C TInt Value(TPtr& aValueText);
   231 	IMPORT_C TUid Type()const;
   232 protected:
   233 	MFieldNumPagesInfo* iNumPagesInfo;
   234 	};
   235 
   236 
   237 
   238 
   239 /** 
   240 A filename field. 
   241 
   242 This is a field which evaluates to the filename of the current document. Before 
   243 the filename field can be evaluated, it must be passed a pointer to an object 
   244 which implements the UpdateFieldFileName() function. 
   245 @publishedAll
   246 @released
   247 */
   248 class CFileNameField : public CTextField
   249 	{
   250 public:
   251 	/** Sets the object which implements the UpdateFieldFileName() function, to get 
   252 	the current document's filename. SetFileNameInfo() must be called before the 
   253 	filename field can be evaluated.
   254 	
   255 	@param aInfo Pointer to an object which implements the UpdateFieldFileName() 
   256 	function. */
   257 	inline void SetFileNameInfo(MFieldFileNameInfo* aInfo) { iFileNameInfo=aInfo; }
   258 	// from TTextField
   259 	IMPORT_C virtual TStreamId StoreL(CStreamStore& aStore)const;  // returns KNullStreamId
   260 	IMPORT_C virtual void RestoreL(const CStreamStore& aStore,TStreamId aId); // does nothing.
   261 	IMPORT_C virtual TInt Value(TPtr& aValueText);
   262 	
   263 
   264 	/** Overrides the base class method to do nothing, because this class has no persistent 
   265 	data. */
   266 	inline virtual void InternalizeL(RReadStream& /*aStream*/) {}; // stream the formatting
   267 	IMPORT_C TUid Type()const;
   268 protected:
   269 	MFieldFileNameInfo* iFileNameInfo;
   270 	};
   271 
   272 
   273 #endif