|
1 /* |
|
2 * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "TAGMA.H" |
|
20 #include "TmTextDrawExt.h" |
|
21 |
|
22 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
23 #include "TAGMA_INTERNAL.H" |
|
24 #endif |
|
25 |
|
26 /** |
|
27 * MTmSource decorator that can draw text in the appropriate highlight colors. |
|
28 * The text must already be on the screen before this is drawn over it. |
|
29 * @since 7.0 |
|
30 * @internalComponent |
|
31 */ |
|
32 NONSHARABLE_CLASS(TTmHighlightSource) : public MTmSource |
|
33 { |
|
34 public: |
|
35 TTmHighlightSource(MTmSource& aDelegate); |
|
36 /** returns EFalse if the selection foreground and background colors are the same */ |
|
37 inline TBool HighlightVisible() {return 0xFFFFFF & (iForeground.Value() ^ iBackground.Value());} |
|
38 void DrawBackground(CGraphicsContext& aGc, |
|
39 const TPoint& aTextLayoutTopLeft, const TRect& aRect, |
|
40 const TLogicalRgb& aBackground, TRect& aRectDrawn) const; |
|
41 void DrawLineGraphics(CGraphicsContext& aGc, |
|
42 const TPoint& aTextLayoutTopLeft, const TRect& aRect, |
|
43 const TTmLineInfo& aLineInfo) const; |
|
44 void DrawText(CGraphicsContext& aGc, |
|
45 const TPoint& aTextLayoutTopLeft, const TRect& aRect, |
|
46 const TTmLineInfo& aLineInfo, const TTmCharFormat& aFormat, |
|
47 const TDesC& aText, const TInt aStart, const TInt aEnd, const TPoint& aTextOrigin, TInt aExtraPixels) const; |
|
48 void DrawPicture(CGraphicsContext& aGc, |
|
49 const TPoint& aTopLeft, const TRect& aRect, |
|
50 MGraphicsDeviceMap& aDevice, const CPicture& aPicture) const; |
|
51 // MTmSource functions: just pass through |
|
52 MGraphicsDeviceMap& FormatDevice() const; |
|
53 MGraphicsDeviceMap& InterpretDevice() const; |
|
54 TInt DocumentLength() const; |
|
55 void GetText(TInt aPos,TPtrC& aText,TTmCharFormat& aFormat) const; |
|
56 void GetParagraphFormatL(TInt aPos,RTmParFormat& aFormat) const; |
|
57 TInt ParagraphStart(TInt aPos) const; |
|
58 CPicture* PictureL(TInt aPos) const; |
|
59 TInt GetPictureSizeInTwipsL(TInt aPos,TSize& aSize) const; |
|
60 TBool PageBreakInRange(TInt aStartPos,TInt aEndPos) const; |
|
61 TAny* GetExtendedInterface(const TUid& aInterfaceId); |
|
62 |
|
63 private: |
|
64 /** |
|
65 * Colour to draw the text in |
|
66 * @internalComponent |
|
67 */ |
|
68 TRgb iForeground; |
|
69 /** |
|
70 * Colour to draw the background in |
|
71 * @internalComponent |
|
72 */ |
|
73 TRgb iBackground; |
|
74 /** |
|
75 * Colour to blend the pictures with |
|
76 * @internalComponent |
|
77 */ |
|
78 TRgb iXorPictures; |
|
79 MTmSource& iDelegate; |
|
80 MTmTextDrawExt* iTmTextDrawExt;//The implementation of MTmTextDrawExt interface will be |
|
81 //used and it will replace all CGraphicsContext::Draw<Item> calls. |
|
82 TTmTextDrawExt iTmTextDrawExtDefault;//The default implementation of MTmTextDrawExt |
|
83 }; |
|
84 |