1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textbase/sgdi/BidiTextImp.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,125 @@
1.4 +// Copyright (c) 2002-2010 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 BIDITEXTIMP_H_
1.20 +#define BIDITEXTIMP_H_
1.21 +
1.22 +#include "BidiText.h"
1.23 +
1.24 +class TRunInfoCompact;
1.25 +
1.26 +class TBidiTextImp : public TBidiText
1.27 +/** This is the implementation for the class TBidiText. It is so designed so
1.28 +that it only occupies a single heap cell. This means that it is efficient in
1.29 +memory usage, and can be placed on the cleanup stack without being a C-class.
1.30 +@internalComponent */
1.31 + {
1.32 +public:
1.33 + static TBidiTextImp* NewL(TInt aLength, TInt aMaxLines, TInt aBdRunArraySize);
1.34 + static TBidiTextImp* Imp(TBidiText* aSelf);
1.35 + static const TBidiTextImp* Imp(const TBidiText* aSelf);
1.36 + static TInt AlignedSizeOf();
1.37 + TText* LogicalText();
1.38 + TText* VisualText();
1.39 + TInt16* LineWidthArray();
1.40 + TRunInfoCompact* BidiRunArray();
1.41 + const TText* LogicalText() const
1.42 + { return const_cast<TBidiTextImp*>(this)->LogicalText(); }
1.43 + const TText* VisualText() const
1.44 + { return const_cast<TBidiTextImp*>(this)->VisualText(); }
1.45 + const TInt16* LineWidthArray() const
1.46 + { return const_cast<TBidiTextImp*>(this)->LineWidthArray(); }
1.47 + const TRunInfoCompact* BidiRunArray() const
1.48 + { return const_cast<TBidiTextImp*>(this)->BidiRunArray(); }
1.49 + /**
1.50 + @return Current truncation character.
1.51 + @internalComponent */
1.52 + TChar TruncationChar() const
1.53 + { return static_cast<TInt>(iTruncationCharPlane << 16)
1.54 + + iTruncationChar16; }
1.55 +
1.56 + inline TInt TextLength() const;
1.57 + inline void SetTextLength(TInt aLength);
1.58 + inline TBool HasRightToLeftDirectionality() const;
1.59 + inline void SetRightToLeftDirectionality(TBool aRightToLeftDirectionality);
1.60 +
1.61 + static TInt RequiredBytes(TInt aLendth, TInt aMaxLines, TInt aBdRunArraySize);
1.62 + inline TInt AllocatedTextDataBytes() const;
1.63 +
1.64 +private:
1.65 + inline void SetAllocatedTextDataBytes(TInt aMaxBytes);
1.66 + enum TFlags
1.67 + {
1.68 + EFRightToLeft = 0x10000000,
1.69 + EFTruncateAtBeginning = 0x20000000
1.70 + };
1.71 +
1.72 + enum { ELengthMask = 0x0FFFFFFF };
1.73 + TInt iTextLengthAndFlags;
1.74 + TInt iTextDataBytes; // Number of bytes allocated off the end of the object for text data
1.75 +public:
1.76 + TInt iVisualOrderedTextLength;
1.77 + TUint16 iWrappingWidth;
1.78 + TUint16 iBidiRunArrayLength;
1.79 + TUint8 iLines;
1.80 + TUint8 iTruncationCharPlane;
1.81 + TUint16 iTruncationChar16;
1.82 + };
1.83 +
1.84 +TInt SizeLineBreak(const TText* aText);
1.85 +const TText* FindEndOfThisLine(const TText* aStart, const TText* aEnd);
1.86 +TInt NumberOfLines(const TText* aStart, const TText* aEnd);
1.87 +
1.88 +inline TBidiTextImp* TBidiTextImp::Imp(TBidiText* aSelf)
1.89 + { return static_cast<TBidiTextImp*>(aSelf); }
1.90 +
1.91 +inline const TBidiTextImp* TBidiTextImp::Imp(const TBidiText* aSelf)
1.92 + { return static_cast<const TBidiTextImp*>(aSelf); }
1.93 +
1.94 +inline TInt TBidiTextImp::AlignedSizeOf()
1.95 + { return ((sizeof(TBidiTextImp) + 1) & 0xFFFFFFFE); }
1.96 +
1.97 +inline TInt TBidiTextImp::TextLength() const
1.98 + { return iTextLengthAndFlags & TBidiTextImp::ELengthMask; }
1.99 +
1.100 +inline void TBidiTextImp::SetTextLength(TInt aLength)
1.101 + { iTextLengthAndFlags &= ~ELengthMask; // clear old size bits
1.102 + iTextLengthAndFlags |= (aLength&ELengthMask); } // set new size bits
1.103 +
1.104 +inline TBool TBidiTextImp::HasRightToLeftDirectionality() const
1.105 + { return iTextLengthAndFlags&TBidiTextImp::EFRightToLeft; }
1.106 +
1.107 +inline void TBidiTextImp::SetRightToLeftDirectionality(TBool aRightToLeftDirectionality)
1.108 + {
1.109 + if (aRightToLeftDirectionality)
1.110 + iTextLengthAndFlags |= TBidiTextImp::EFRightToLeft;
1.111 + else
1.112 + iTextLengthAndFlags &= ~TBidiTextImp::EFRightToLeft;
1.113 + }
1.114 +
1.115 +inline TInt TBidiTextImp::AllocatedTextDataBytes() const
1.116 + { return iTextDataBytes; }
1.117 +
1.118 +inline void TBidiTextImp::SetAllocatedTextDataBytes(TInt aTextDataBytes)
1.119 + { iTextDataBytes = aTextDataBytes; }
1.120 +
1.121 +
1.122 +/**
1.123 +Bidi panic.
1.124 +@internalComponent
1.125 +*/
1.126 +void TextBasePanic(TInt aError);
1.127 +
1.128 +#endif