sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* Main
|
sl@0
|
16 |
*
|
sl@0
|
17 |
*/
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
#include <T_PARS06.H>
|
sl@0
|
21 |
#include <T_RTP01.H>
|
sl@0
|
22 |
#include <E32TWIN.H>
|
sl@0
|
23 |
|
sl@0
|
24 |
|
sl@0
|
25 |
TInt E32Main()
|
sl@0
|
26 |
{
|
sl@0
|
27 |
__UHEAP_MARK;
|
sl@0
|
28 |
CTrapCleanup* cleanup=CTrapCleanup::New();
|
sl@0
|
29 |
|
sl@0
|
30 |
// set filename
|
sl@0
|
31 |
TFileName theFileName = _L("c:\\etext\\incp\\dunk.pml");
|
sl@0
|
32 |
|
sl@0
|
33 |
// Parse PML
|
sl@0
|
34 |
CParser* myParser;
|
sl@0
|
35 |
CRichText* richTextDoc;
|
sl@0
|
36 |
TRAPD(ret, myParser=CParser::NewL());
|
sl@0
|
37 |
TRAP(ret, richTextDoc = myParser->ParseL(theFileName));
|
sl@0
|
38 |
|
sl@0
|
39 |
// *********** insert test code here ****************
|
sl@0
|
40 |
|
sl@0
|
41 |
|
sl@0
|
42 |
/* TInt para=richTextDoc->CountParas();
|
sl@0
|
43 |
TInt length=richTextDoc->DocumentLength();
|
sl@0
|
44 |
CParaFormat* myformat;
|
sl@0
|
45 |
TRAP(ret,myformat=CParaFormat::NewL());
|
sl@0
|
46 |
TCharFormat charFormat; CPicture* picture; TPtrC view;
|
sl@0
|
47 |
TRAP(ret,richTextDoc->SenseParaFormatL(length,myformat));
|
sl@0
|
48 |
TRAP(ret,richTextDoc->SenseChars(0,view,charFormat,picture));
|
sl@0
|
49 |
TRAP(ret,richTextDoc->SenseChars(10,view,charFormat,picture));
|
sl@0
|
50 |
richTextDoc->Delete(4,6);
|
sl@0
|
51 |
//TRAP(ret,richTextDoc->InsertL(richTextDoc->DocumentLength(),EParagraphDelimiter));
|
sl@0
|
52 |
*/
|
sl@0
|
53 |
|
sl@0
|
54 |
// make rich text reader & read rich text doc & parse back to PML
|
sl@0
|
55 |
CRichTextReader* myRTReader;
|
sl@0
|
56 |
CBufSeg* returnedPmlDoc;
|
sl@0
|
57 |
TRAP(ret, myRTReader = CRichTextReader::NewL());
|
sl@0
|
58 |
TRAP(ret, returnedPmlDoc = myRTReader->ConvertRichText(richTextDoc));
|
sl@0
|
59 |
|
sl@0
|
60 |
// save to disc
|
sl@0
|
61 |
CFileApp* myFileApp;
|
sl@0
|
62 |
TRAP(ret, myFileApp = CFileApp::NewL());
|
sl@0
|
63 |
TInt errorLevel = myFileApp->SaveFile(returnedPmlDoc,theFileName);
|
sl@0
|
64 |
|
sl@0
|
65 |
// finish up
|
sl@0
|
66 |
Adt::Destroy(myFileApp);
|
sl@0
|
67 |
Adt::Destroy(myRTReader);
|
sl@0
|
68 |
Adt::Destroy(myParser);
|
sl@0
|
69 |
Adt::Destroy(cleanup);
|
sl@0
|
70 |
__UHEAP_MARKEND;
|
sl@0
|
71 |
return 0;
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|