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