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