1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsdeviceinterface/gdi/sgdi/BidiCompact.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,93 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef BIDICOMPACT_H_
1.20 +#define BIDICOMPACT_H_
1.21 +
1.22 +#include <e32std.h>
1.23 +#include <bidi.h>
1.24 +
1.25 +class TRunInfoCompact
1.26 +/**
1.27 +Stores information about a run and how to re-order it.
1.28 +@internalTechnology
1.29 +*/
1.30 + {
1.31 +public:
1.32 + /** Describes text to be re-ordered.
1.33 + @internalTechnology */
1.34 + class TReorderingContext
1.35 + {
1.36 + public:
1.37 + /** Where the logical-order text starts. */
1.38 + const TText* iSource;
1.39 + /** The start of the line. */
1.40 + TInt iStart;
1.41 + /** One past the end of the line. */
1.42 + TInt iEnd;
1.43 + /**
1.44 + * Truncation character, if there is to be one on this line. Otherwise,
1.45 + * 0xFFFF.
1.46 + */
1.47 + TChar iTruncation;
1.48 + /** ETrue if the line must join at its beginning. */
1.49 + TBool iJoinsAtStart;
1.50 + /** ETrue if the line must join at its end. */
1.51 + TBool iJoinsAtEnd;
1.52 + };
1.53 +
1.54 + /** How to re-order the run.
1.55 + @internalTechnology */
1.56 + enum TTypeFlags
1.57 + {
1.58 + /** Reverse the run, but not surrogate pairs or combining characters. */
1.59 + EFRightToLeft = 0x80000000,
1.60 + /** Simply reverse the run, do not check for surrogates or combiners. */
1.61 + EFNoPairsNoCombiners = 0x40000000,
1.62 + /** No mirrored characters are present. */
1.63 + EFNoMirroredCharacters = 0x20000000
1.64 + };
1.65 +
1.66 + /** Sets up an empty run.
1.67 + @internalTechnology */
1.68 + TRunInfoCompact() : iStart(0), iLengthAndType(0) {}
1.69 + TRunInfoCompact(TInt aStart, TInt aLength, TBool aReverse,
1.70 + const TText* aText);
1.71 + TRunInfoCompact(TInt aStart, TInt aLength, TBool aReverse);
1.72 + TBool AddRun(const TRunInfoCompact& aToBeAdded);
1.73 + TText* Reorder(TText* aDestination, const TReorderingContext& aContext) const;
1.74 +
1.75 + /** @return The start of this run.
1.76 + @internalTechnology */
1.77 + TInt Start() const { return iStart; }
1.78 +
1.79 + /**@return The length of this run.
1.80 + @internalTechnology */
1.81 + TInt Length() const { return static_cast<TInt>(iLengthAndType & 0x0FFFFFFF); }
1.82 +
1.83 + /** @return The flags associated with this run.
1.84 + @internalTechnology */
1.85 + TInt TypeFlags() const { return iLengthAndType & 0xF0000000; }
1.86 +
1.87 + static TInt Convert(TRunInfoCompact* aBuffer, const TDesC& aText,
1.88 + const TBidirectionalState::TRunInfo* aRunArray, TInt aArraySize);
1.89 + static TBool JoinBefore(const TText* aText, TInt aIndex);
1.90 +private:
1.91 + TInt iStart;
1.92 + TUint iLengthAndType;
1.93 + };
1.94 +
1.95 +#endif
1.96 +