os/textandloc/textrendering/texthandling/spml/T_PMAIN2.CPP
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/textrendering/texthandling/spml/T_PMAIN2.CPP	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,73 @@
     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 +* Main
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#include <T_PARS06.H>
    1.24 +#include <T_RTP01.H>
    1.25 +#include <E32TWIN.H>
    1.26 +
    1.27 +
    1.28 +TInt E32Main()
    1.29 +	{
    1.30 +	__UHEAP_MARK;
    1.31 +	CTrapCleanup* cleanup=CTrapCleanup::New();
    1.32 + 
    1.33 + 	// set filename
    1.34 +	TFileName theFileName = _L("c:\\etext\\incp\\dunk.pml");
    1.35 +
    1.36 +	// Parse PML
    1.37 +	CParser* myParser;
    1.38 +	CRichText* richTextDoc;
    1.39 +	TRAPD(ret, myParser=CParser::NewL());
    1.40 +	TRAP(ret, richTextDoc = myParser->ParseL(theFileName));
    1.41 +
    1.42 +// *********** insert test code here ****************
    1.43 +
    1.44 +
    1.45 +/*	TInt para=richTextDoc->CountParas();
    1.46 +	TInt length=richTextDoc->DocumentLength();
    1.47 +	CParaFormat* myformat;
    1.48 +	TRAP(ret,myformat=CParaFormat::NewL());
    1.49 +	TCharFormat charFormat; CPicture* picture; TPtrC view;
    1.50 +	TRAP(ret,richTextDoc->SenseParaFormatL(length,myformat));
    1.51 +	TRAP(ret,richTextDoc->SenseChars(0,view,charFormat,picture));
    1.52 +	TRAP(ret,richTextDoc->SenseChars(10,view,charFormat,picture));
    1.53 +	richTextDoc->Delete(4,6);
    1.54 +	//TRAP(ret,richTextDoc->InsertL(richTextDoc->DocumentLength(),EParagraphDelimiter));
    1.55 +*/
    1.56 +
    1.57 +	// make rich text reader & read rich text doc & parse back to PML
    1.58 +	CRichTextReader* myRTReader;
    1.59 +	CBufSeg* returnedPmlDoc; 
    1.60 +	TRAP(ret, myRTReader = CRichTextReader::NewL());
    1.61 +	TRAP(ret, returnedPmlDoc = myRTReader->ConvertRichText(richTextDoc));
    1.62 +
    1.63 +	// save to disc
    1.64 +	CFileApp* myFileApp;
    1.65 +	TRAP(ret, myFileApp = CFileApp::NewL());
    1.66 +	TInt errorLevel = myFileApp->SaveFile(returnedPmlDoc,theFileName);
    1.67 +
    1.68 +	// finish up
    1.69 +	Adt::Destroy(myFileApp);
    1.70 +	Adt::Destroy(myRTReader);
    1.71 +	Adt::Destroy(myParser);
    1.72 +	Adt::Destroy(cleanup);
    1.73 +	__UHEAP_MARKEND;
    1.74 +	return 0;
    1.75 +	}
    1.76 +