1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/textrendering/texthandling/tfields/TESTFAC.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,90 @@
1.4 +/*
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 "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.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 +
1.21 +
1.22 +#include <flddef.h>
1.23 +#include <fldbltin.h>
1.24 +#include <conpics.h>
1.25 +#include "TESTFAC.H"
1.26 +
1.27 +/////////////////////////////////
1.28 +// TTestFieldFactory
1.29 +/////////////////////////////////
1.30 +
1.31 +CTextField* TTestFieldFactory::NewFieldL(TUid aFieldType)
1.32 +// Creates a field (in aHeader) of the type specified in aHeader
1.33 +//
1.34 + {
1.35 + CTextField* field=NULL;
1.36 +
1.37 + if (aFieldType==KDummyFieldUid)
1.38 + field = (CTextField*)new(ELeave) CDummyField();
1.39 +
1.40 + else if (aFieldType==KDateTimeFieldUid)
1.41 + field = (CTextField*)new(ELeave) CDateTimeField();
1.42 +
1.43 + else if (aFieldType==KPageNumberFieldUid)
1.44 + {
1.45 + field = (CTextField*)new(ELeave) CPageNumField();
1.46 + ((CPageNumField*)field)->SetPageNumInfo(&iInfo);
1.47 + ((CPageNumField*)field)->SetNumberStyle(CPageNumField::ERomanLower);
1.48 + }
1.49 +
1.50 + else if (aFieldType==KNumPagesFieldUid)
1.51 + {
1.52 + field = (CTextField*)new(ELeave) CNumPagesField();
1.53 + ((CNumPagesField*)field)->SetNumPagesInfo(&iInfo);
1.54 + ((CNumPagesField*)field)->SetNumberStyle(CPageNumField::EAlphabeticUpper);
1.55 + }
1.56 +
1.57 + else if (aFieldType==KFileNameFieldUid)
1.58 + {
1.59 + field = (CTextField*)new(ELeave) CFileNameField();
1.60 + ((CFileNameField*)field)->SetFileNameInfo(&iInfo);
1.61 + }
1.62 +
1.63 + return field;
1.64 + }
1.65 +
1.66 +
1.67 +/////////////////////////////////
1.68 +// TTestFieldInfo
1.69 +/////////////////////////////////
1.70 +
1.71 +TInt TTestFieldInfo::UpdateFieldFileName(TPtr& aValueText)const
1.72 + {
1.73 + TBuf<12> name(_L("FileName.doc"));
1.74 + if (aValueText.MaxLength() < name.Length())
1.75 + return name.Length();
1.76 + else
1.77 + {
1.78 + aValueText = name;
1.79 + return 0;
1.80 + }
1.81 + }
1.82 +
1.83 +
1.84 +TInt TTestFieldInfo::UpdateFieldNumPages()const
1.85 + {
1.86 + return 2;
1.87 + }
1.88 +
1.89 +
1.90 +TInt TTestFieldInfo::UpdateFieldPageNum()const
1.91 + {
1.92 + return 1;
1.93 + }