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