Update contrib.
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
28 CTrapCleanup* cleanup=CTrapCleanup::New();
32 TSize consSize(KConsFullScreen, KConsFullScreen);
34 err = theConsole.Create();
35 err = theConsole.Control(_L("-Visibility"));
36 err = theConsole.Set(_L("The Epoc RichText Parser (c)"), consSize);
37 err = theConsole.Control(_L("Visibility Newline Max_win_size"));
41 CRichText* richTextDoc;
42 TRAPD(ret, myParser=CParser::NewL());
43 TRAP(ret, richTextDoc = myParser->ParseL(theConsole));
46 /* //enable this bit for a pause before executing test code
48 theConsole.Write(_L("\n\nPress space to execute test code & parse back to PML\n"));
49 TConsoleKey keystroke;
50 while (keystroke.Code() != EKeySpace)
51 theConsole.Read(keystroke);
54 // *********** insert test code here ****************
57 /* TInt para=richTextDoc->CountParas();
58 TInt length=richTextDoc->DocumentLength();
59 CParaFormat* myformat;
60 TRAP(ret,myformat=CParaFormat::NewL());
61 TCharFormat charFormat; CPicture* picture; TPtrC view;
62 TRAP(ret,richTextDoc->SenseParaFormatL(length,myformat));
63 TRAP(ret,richTextDoc->SenseChars(0,view,charFormat,picture));
64 TRAP(ret,richTextDoc->SenseChars(10,view,charFormat,picture));
65 richTextDoc->Delete(4,6);
66 //TRAP(ret,richTextDoc->InsertL(richTextDoc->DocumentLength(),EParagraphDelimiter));
69 // make rich text reader & read rich text doc & parse back to PML
70 CRichTextReader* myRTReader;
71 CBufSeg* returnedPmlDoc;
72 TRAP(ret, myRTReader = CRichTextReader::NewL());
73 TRAP(ret, returnedPmlDoc = myRTReader->ConvertRichText(richTextDoc,theConsole));
77 TRAP(ret, myFileApp = CFileApp::NewL());
78 TInt errorLevel = myFileApp->SaveFile(returnedPmlDoc,myParser->iFileName);
80 theConsole.Write(_L("\n\nFile Saved"));
82 theConsole.Write(_L("\n\nFile Save unsuccessful!!"));
85 theConsole.Write(_L("\n\nPress space to quit\n"));
86 TConsoleKey keystroke;
87 while (keystroke.Code() != EKeySpace)
88 theConsole.Read(keystroke);
91 Adt::Destroy(myFileApp);
92 Adt::Destroy(myRTReader);
93 Adt::Destroy(myParser);
95 Adt::Destroy(cleanup);