sl@0: // Copyright (c) 2002-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: #ifndef BIDICOMPACT_H_ sl@0: #define BIDICOMPACT_H_ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: class TRunInfoCompact sl@0: /** sl@0: Stores information about a run and how to re-order it. sl@0: @internalTechnology sl@0: */ sl@0: { sl@0: public: sl@0: /** Describes text to be re-ordered. sl@0: @internalTechnology */ sl@0: class TReorderingContext sl@0: { sl@0: public: sl@0: /** Where the logical-order text starts. */ sl@0: const TText* iSource; sl@0: /** The start of the line. */ sl@0: TInt iStart; sl@0: /** One past the end of the line. */ sl@0: TInt iEnd; sl@0: /** sl@0: * Truncation character, if there is to be one on this line. Otherwise, sl@0: * 0xFFFF. sl@0: */ sl@0: TChar iTruncation; sl@0: /** ETrue if the line must join at its beginning. */ sl@0: TBool iJoinsAtStart; sl@0: /** ETrue if the line must join at its end. */ sl@0: TBool iJoinsAtEnd; sl@0: }; sl@0: sl@0: /** How to re-order the run. sl@0: @internalTechnology */ sl@0: enum TTypeFlags sl@0: { sl@0: /** Reverse the run, but not surrogate pairs or combining characters. */ sl@0: EFRightToLeft = 0x80000000, sl@0: /** Simply reverse the run, do not check for surrogates or combiners. */ sl@0: EFNoPairsNoCombiners = 0x40000000, sl@0: /** No mirrored characters are present. */ sl@0: EFNoMirroredCharacters = 0x20000000 sl@0: }; sl@0: sl@0: /** Sets up an empty run. sl@0: @internalTechnology */ sl@0: TRunInfoCompact() : iStart(0), iLengthAndType(0) {} sl@0: TRunInfoCompact(TInt aStart, TInt aLength, TBool aReverse, sl@0: const TText* aText); sl@0: TRunInfoCompact(TInt aStart, TInt aLength, TBool aReverse); sl@0: TBool AddRun(const TRunInfoCompact& aToBeAdded); sl@0: TText* Reorder(TText* aDestination, const TReorderingContext& aContext) const; sl@0: sl@0: /** @return The start of this run. sl@0: @internalTechnology */ sl@0: TInt Start() const { return iStart; } sl@0: sl@0: /**@return The length of this run. sl@0: @internalTechnology */ sl@0: TInt Length() const { return static_cast(iLengthAndType & 0x0FFFFFFF); } sl@0: sl@0: /** @return The flags associated with this run. sl@0: @internalTechnology */ sl@0: TInt TypeFlags() const { return iLengthAndType & 0xF0000000; } sl@0: sl@0: static TInt Convert(TRunInfoCompact* aBuffer, const TDesC& aText, sl@0: const TBidirectionalState::TRunInfo* aRunArray, TInt aArraySize); sl@0: static TBool JoinBefore(const TText* aText, TInt aIndex); sl@0: private: sl@0: TInt iStart; sl@0: TUint iLengthAndType; sl@0: }; sl@0: sl@0: #endif sl@0: