sl@0: /* sl@0: * Copyright (c) 1999-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: * sl@0: */ sl@0: sl@0: sl@0: #ifndef __PARSELST_H__ sl@0: #define __PARSELST_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: //++ sort out definitive hash includes sl@0: sl@0: sl@0: NONSHARABLE_CLASS(CParserList) : public CBase sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: { sl@0: enum TParserTagValues sl@0: { sl@0: EReformatOnRecogniseFlag = (TInt)0x80000000, sl@0: EReformatOnRolloverFlag = 0x40000000, sl@0: EDefaultParserFlag = 0x20000000, sl@0: EParserTagMask = 0x3FFFFFFF, sl@0: EMaxParserIndex = 0x1FFFFFFF sl@0: }; sl@0: sl@0: enum TParserListPanic sl@0: { sl@0: EParserNoneActive, sl@0: EParserNullPtr, sl@0: EParserInstanceNotActive, sl@0: EParserNoSuchTag, sl@0: EParserIgnoringAllowFlag, sl@0: EParserIndexRollover sl@0: }; sl@0: sl@0: private: sl@0: class CParserItem : public CBase sl@0: { sl@0: public: sl@0: CParserItem(MParser* aParser, const TUint aTagIndex); sl@0: ~CParserItem() {} sl@0: sl@0: inline MParser* Parser() const {return iParser;} sl@0: inline TUint TagIndex() const {return iTagIndex;} sl@0: sl@0: private: sl@0: MParser* iParser; sl@0: TUint iTagIndex; sl@0: }; sl@0: sl@0: public: sl@0: CParserList(); sl@0: ~CParserList(); sl@0: sl@0: void ActivateParserL(MParser* aParser); sl@0: void DeactivateParser(MParser* aParser); sl@0: void ActivateDefaultParserL(MParser* aParser); sl@0: void DeactivateParserDefaults(); sl@0: TBool ParseThisText(CRichText& aTextObj,TInt aStartScan,TInt aScanLength,TInt& aStartOfTags,TInt& aLength); sl@0: MParser* ParserWithThisTag(const TUint aTagIndex) const; sl@0: TUint TagForThisParser(const MParser *const aParser) const; sl@0: sl@0: static inline TBool ReformatOnRollover(const TUint aTagIndex) {return (aTagIndex & EReformatOnRolloverFlag);} sl@0: sl@0: private: sl@0: static inline TBool ReformatOnRecognise(const TUint aTagIndex) {return (aTagIndex & static_cast( EReformatOnRecogniseFlag ) );} sl@0: static inline TBool DefaultParser(const TUint aTagIndex) {return (aTagIndex & EDefaultParserFlag);} sl@0: sl@0: static inline TUint MaskedTag(const TUint32 aTagIndex) {return (aTagIndex & EParserTagMask);} sl@0: sl@0: void ActivateAParserL(MParser* aParser, const TBool aDefaultParser); sl@0: TBool LoopOneParser(MParser* aParser, const TUint aTagIndex, CRichText& aTextObj, sl@0: const TInt aStartScan, const TInt aScanLength, sl@0: TInt& aStartOfTags, TInt& aLength); sl@0: void Panic(TParserListPanic aPanic) const; sl@0: sl@0: private: sl@0: RPointerArray iParserList; // List of active parsers (specific and default) sl@0: TUint iHighestIndex; sl@0: public: sl@0: TInt iNumberInList; sl@0: TInt iRefCount; sl@0: }; sl@0: sl@0: NONSHARABLE_CLASS(CParserData) : public CBase sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: { sl@0: public: sl@0: CParserData(TInt aEndParse); sl@0: ~CParserData(); sl@0: TBool HaveRange() const { return iStartParse != -1; } sl@0: void MergeRange(TInt aStart,TInt aOldLength,TInt aNewLength); sl@0: void KillRange() { iStartParse = -1; } sl@0: TInt StartParse() const { return iStartParse; } sl@0: TInt EndParse() const { return iEndParse; } sl@0: sl@0: CParserList* iActiveParserList; // local copy because access to Dll::Tls is slow sl@0: MEditObserver* iEditObserver; sl@0: TInt iLastKnownCursor; sl@0: sl@0: private: sl@0: TInt iStartParse; // start of text to be parsed; -1 means none sl@0: TInt iEndParse; // end of text to be parsed sl@0: }; sl@0: sl@0: #endif