1 txtglobl.h |
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __TXTGLOBL_H__ |
|
17 #define __TXTGLOBL_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <e32base.h> |
|
21 #include <txtlaydc.h> |
|
22 #include <txtmfmtx.h> |
|
23 #include <txtetext.h> |
|
24 |
|
25 |
|
26 // forward declarations |
|
27 class CParaFormatLayer; |
|
28 class CCharFormatLayer; |
|
29 class TCharFormatX; |
|
30 class TCharFormatXMask; |
|
31 |
|
32 |
|
33 // Globally formatted text. |
|
34 // Uses one instance of each a paragraph format and character format class; Each presents |
|
35 // the formatting applied to the total document contents. Both of the format classes used |
|
36 // may utilise layering of formats through 'based on' links to achieve full format specification. |
|
37 // These global layers are *never* owned by global text, merely referenced. |
|
38 |
|
39 /** |
|
40 Text with globally applied formatting. |
|
41 |
|
42 Global text uses a single set of paragraph format attributes to describe the |
|
43 appearance of every paragraph and a single set of character format attributes |
|
44 to describe the appearance of every character. |
|
45 |
|
46 The paragraph formatting is stored in a CParaFormatLayer and the character |
|
47 formatting is stored in a CCharFormatLayer. A format layer is a set of character |
|
48 or paragraph format attributes, which may own a pointer to another format |
|
49 layer. This pointer is called a based-on link. The effective formatting of |
|
50 a global text object is the set of attributes specified in its two format |
|
51 layers, as well as any attributes inherited from the layers' chain of based-on |
|
52 links. To get the effective formatting, the links are read in turn, so that |
|
53 each attribute's value is taken from the first layer in the chain in which |
|
54 it has been set. Use GetCharFormat() and GetParaFormatL() to get the text |
|
55 object's effective formatting. |
|
56 |
|
57 A global text object references the two format layers; it does not own them. |
|
58 This allows more than one global text object to use the same formatting. The |
|
59 format layers may be modified (see ApplyParaFormatL() and ApplyCharFormatL()) |
|
60 or replaced (see SetGlobalParaFormat() and SetGlobalCharFormat()) during the |
|
61 text object's lifetime. |
|
62 @publishedAll |
|
63 @released |
|
64 */ |
|
65 class CGlobalText : public CPlainText,public MLayDoc,public MFormatText |
|
66 { |
|
67 public: |
|
68 // Special member functions |
|
69 // Create new global text component whose sole content is an end-of-document character. |
|
70 IMPORT_C static CGlobalText* NewL(const CParaFormatLayer* aGlobalParaLayer,const CCharFormatLayer* aGlobalCharLayer, |
|
71 TDocumentStorage aStorage=ESegmentedStorage,TInt aDefaultTextGranularity=EDefaultTextGranularity); |
|
72 // Restore a new global text, that uses the specified global layers. |
|
73 IMPORT_C static CGlobalText* NewL(const CStreamStore& aStore,TStreamId aStreamId, |
|
74 const CParaFormatLayer* aGlobalParaLayer,const CCharFormatLayer* aGlobalCharLayer, |
|
75 MTextFieldFactory* aFieldFactory=NULL, |
|
76 TDocumentStorage=ESegmentedStorage); |
|
77 IMPORT_C ~CGlobalText(); |
|
78 // Global Format Layers |
|
79 IMPORT_C void SetGlobalParaFormat(const CParaFormatLayer* aParaFormatLayer); |
|
80 IMPORT_C void SetGlobalCharFormat(const CCharFormatLayer* aCharFormatLayer); |
|
81 inline const CParaFormatLayer* GlobalParaFormatLayer()const; |
|
82 inline const CCharFormatLayer* GlobalCharFormatLayer()const; |
|
83 // MLayDoc implementation |
|
84 IMPORT_C virtual TInt LdDocumentLength()const; |
|
85 IMPORT_C virtual TInt LdToParagraphStart(TInt& aCurrentPos)const; |
|
86 IMPORT_C virtual void GetParagraphFormatL(CParaFormat* aFormat,TInt aPos)const; |
|
87 IMPORT_C virtual void GetChars(TPtrC& aView,TCharFormat& aFormat,TInt aStartPos)const; |
|
88 IMPORT_C virtual TInt GetPictureSizeInTwips(TSize& aSize, TInt aPos)const; |
|
89 IMPORT_C virtual CPicture* PictureHandleL(TInt aPos,MLayDoc::TForcePictureLoad aForceLoad)const; |
|
90 IMPORT_C virtual TBool EnquirePageBreak(TInt aPos,TInt aLength=0)const; |
|
91 IMPORT_C virtual TBool SelectParagraphLabel(TInt aPos); |
|
92 IMPORT_C virtual void CancelSelectLabel(); |
|
93 // MFormatText implementation |
|
94 IMPORT_C virtual void GetParaFormatL(CParaFormat* aFormat,TParaFormatMask& aVaries,TInt aPos,TInt aLength, |
|
95 CParaFormat::TParaFormatGetMode aMode=CParaFormat::EAllAttributes)const; |
|
96 IMPORT_C virtual void ApplyParaFormatL(const CParaFormat* aFormat,const TParaFormatMask& aMask,TInt aPos,TInt aLength); |
|
97 IMPORT_C virtual void GetCharFormat(TCharFormat& aFormat,TCharFormatMask& aVaries,TInt aPos,TInt aLength)const; |
|
98 IMPORT_C virtual void ApplyCharFormatL(const TCharFormat& aFormat,const TCharFormatMask& aMask,TInt aPos,TInt aLength); |
|
99 protected: |
|
100 IMPORT_C CGlobalText(); |
|
101 IMPORT_C CGlobalText(const CParaFormatLayer* aGlobalParaLayer, |
|
102 const CCharFormatLayer* aGlobalCharLayer); |
|
103 private: |
|
104 CGlobalText(const CGlobalText& aGlobalText); |
|
105 CGlobalText& operator=(const CGlobalText& aGlobalText); |
|
106 protected: |
|
107 const CParaFormatLayer* iGlobalParaFormatLayer; // the global paragraph format layer; not owned |
|
108 const CCharFormatLayer* iGlobalCharFormatLayer; // the global character format layer; not owned |
|
109 __DECLARE_TEST; |
|
110 private: |
|
111 void* iReserved_2; |
|
112 }; |
|
113 |
|
114 |
|
115 #include <txtglobl.inl> |
|
116 |
|
117 |
|
118 #endif |