sl@0: /* sl@0: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Main sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include <T_PARS06.H> sl@0: #include <T_RTP01.H> sl@0: #include <E32TWIN.H> sl@0: sl@0: sl@0: TInt E32Main() sl@0: { sl@0: __UHEAP_MARK; sl@0: CTrapCleanup* cleanup=CTrapCleanup::New(); sl@0: sl@0: // set filename sl@0: TFileName theFileName = _L("c:\\etext\\incp\\dunk.pml"); sl@0: sl@0: // Parse PML sl@0: CParser* myParser; sl@0: CRichText* richTextDoc; sl@0: TRAPD(ret, myParser=CParser::NewL()); sl@0: TRAP(ret, richTextDoc = myParser->ParseL(theFileName)); sl@0: sl@0: // *********** insert test code here **************** sl@0: sl@0: sl@0: /* TInt para=richTextDoc->CountParas(); sl@0: TInt length=richTextDoc->DocumentLength(); sl@0: CParaFormat* myformat; sl@0: TRAP(ret,myformat=CParaFormat::NewL()); sl@0: TCharFormat charFormat; CPicture* picture; TPtrC view; sl@0: TRAP(ret,richTextDoc->SenseParaFormatL(length,myformat)); sl@0: TRAP(ret,richTextDoc->SenseChars(0,view,charFormat,picture)); sl@0: TRAP(ret,richTextDoc->SenseChars(10,view,charFormat,picture)); sl@0: richTextDoc->Delete(4,6); sl@0: //TRAP(ret,richTextDoc->InsertL(richTextDoc->DocumentLength(),EParagraphDelimiter)); sl@0: */ sl@0: sl@0: // make rich text reader & read rich text doc & parse back to PML sl@0: CRichTextReader* myRTReader; sl@0: CBufSeg* returnedPmlDoc; sl@0: TRAP(ret, myRTReader = CRichTextReader::NewL()); sl@0: TRAP(ret, returnedPmlDoc = myRTReader->ConvertRichText(richTextDoc)); sl@0: sl@0: // save to disc sl@0: CFileApp* myFileApp; sl@0: TRAP(ret, myFileApp = CFileApp::NewL()); sl@0: TInt errorLevel = myFileApp->SaveFile(returnedPmlDoc,theFileName); sl@0: sl@0: // finish up sl@0: Adt::Destroy(myFileApp); sl@0: Adt::Destroy(myRTReader); sl@0: Adt::Destroy(myParser); sl@0: Adt::Destroy(cleanup); sl@0: __UHEAP_MARKEND; sl@0: return 0; sl@0: } sl@0: