|
1 /* |
|
2 * Copyright (c) 1997-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <flddef.h> |
|
20 #include <fldbltin.h> |
|
21 #include <conpics.h> |
|
22 #include "TESTFAC.H" |
|
23 |
|
24 ///////////////////////////////// |
|
25 // TTestFieldFactory |
|
26 ///////////////////////////////// |
|
27 |
|
28 CTextField* TTestFieldFactory::NewFieldL(TUid aFieldType) |
|
29 // Creates a field (in aHeader) of the type specified in aHeader |
|
30 // |
|
31 { |
|
32 CTextField* field=NULL; |
|
33 |
|
34 if (aFieldType==KDummyFieldUid) |
|
35 field = (CTextField*)new(ELeave) CDummyField(); |
|
36 |
|
37 else if (aFieldType==KDateTimeFieldUid) |
|
38 field = (CTextField*)new(ELeave) CDateTimeField(); |
|
39 |
|
40 else if (aFieldType==KPageNumberFieldUid) |
|
41 { |
|
42 field = (CTextField*)new(ELeave) CPageNumField(); |
|
43 ((CPageNumField*)field)->SetPageNumInfo(&iInfo); |
|
44 ((CPageNumField*)field)->SetNumberStyle(CPageNumField::ERomanLower); |
|
45 } |
|
46 |
|
47 else if (aFieldType==KNumPagesFieldUid) |
|
48 { |
|
49 field = (CTextField*)new(ELeave) CNumPagesField(); |
|
50 ((CNumPagesField*)field)->SetNumPagesInfo(&iInfo); |
|
51 ((CNumPagesField*)field)->SetNumberStyle(CPageNumField::EAlphabeticUpper); |
|
52 } |
|
53 |
|
54 else if (aFieldType==KFileNameFieldUid) |
|
55 { |
|
56 field = (CTextField*)new(ELeave) CFileNameField(); |
|
57 ((CFileNameField*)field)->SetFileNameInfo(&iInfo); |
|
58 } |
|
59 |
|
60 return field; |
|
61 } |
|
62 |
|
63 |
|
64 ///////////////////////////////// |
|
65 // TTestFieldInfo |
|
66 ///////////////////////////////// |
|
67 |
|
68 TInt TTestFieldInfo::UpdateFieldFileName(TPtr& aValueText)const |
|
69 { |
|
70 TBuf<12> name(_L("FileName.doc")); |
|
71 if (aValueText.MaxLength() < name.Length()) |
|
72 return name.Length(); |
|
73 else |
|
74 { |
|
75 aValueText = name; |
|
76 return 0; |
|
77 } |
|
78 } |
|
79 |
|
80 |
|
81 TInt TTestFieldInfo::UpdateFieldNumPages()const |
|
82 { |
|
83 return 2; |
|
84 } |
|
85 |
|
86 |
|
87 TInt TTestFieldInfo::UpdateFieldPageNum()const |
|
88 { |
|
89 return 1; |
|
90 } |