1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/textrendering/texthandling/inc/TXTGLOBL.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,121 @@
1.4 +/*
1.5 +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef __TXTGLOBL_H__
1.23 +#define __TXTGLOBL_H__
1.24 +
1.25 +#include <e32std.h>
1.26 +#include <e32base.h>
1.27 +#include <txtlaydc.h>
1.28 +#include <txtmfmtx.h>
1.29 +#include <txtetext.h>
1.30 +
1.31 +
1.32 +// forward declarations
1.33 +class CParaFormatLayer;
1.34 +class CCharFormatLayer;
1.35 +class TCharFormatX;
1.36 +class TCharFormatXMask;
1.37 +
1.38 +
1.39 +// Globally formatted text.
1.40 +// Uses one instance of each a paragraph format and character format class; Each presents
1.41 +// the formatting applied to the total document contents. Both of the format classes used
1.42 +// may utilise layering of formats through 'based on' links to achieve full format specification.
1.43 +// These global layers are *never* owned by global text, merely referenced.
1.44 +
1.45 +/**
1.46 +Text with globally applied formatting.
1.47 +
1.48 +Global text uses a single set of paragraph format attributes to describe the
1.49 +appearance of every paragraph and a single set of character format attributes
1.50 +to describe the appearance of every character.
1.51 +
1.52 +The paragraph formatting is stored in a CParaFormatLayer and the character
1.53 +formatting is stored in a CCharFormatLayer. A format layer is a set of character
1.54 +or paragraph format attributes, which may own a pointer to another format
1.55 +layer. This pointer is called a based-on link. The effective formatting of
1.56 +a global text object is the set of attributes specified in its two format
1.57 +layers, as well as any attributes inherited from the layers' chain of based-on
1.58 +links. To get the effective formatting, the links are read in turn, so that
1.59 +each attribute's value is taken from the first layer in the chain in which
1.60 +it has been set. Use GetCharFormat() and GetParaFormatL() to get the text
1.61 +object's effective formatting.
1.62 +
1.63 +A global text object references the two format layers; it does not own them.
1.64 +This allows more than one global text object to use the same formatting. The
1.65 +format layers may be modified (see ApplyParaFormatL() and ApplyCharFormatL())
1.66 +or replaced (see SetGlobalParaFormat() and SetGlobalCharFormat()) during the
1.67 +text object's lifetime.
1.68 +@publishedAll
1.69 +@released
1.70 +*/
1.71 +class CGlobalText : public CPlainText,public MLayDoc,public MFormatText
1.72 + {
1.73 +public:
1.74 +// Special member functions
1.75 + // Create new global text component whose sole content is an end-of-document character.
1.76 + IMPORT_C static CGlobalText* NewL(const CParaFormatLayer* aGlobalParaLayer,const CCharFormatLayer* aGlobalCharLayer,
1.77 + TDocumentStorage aStorage=ESegmentedStorage,TInt aDefaultTextGranularity=EDefaultTextGranularity);
1.78 + // Restore a new global text, that uses the specified global layers.
1.79 + IMPORT_C static CGlobalText* NewL(const CStreamStore& aStore,TStreamId aStreamId,
1.80 + const CParaFormatLayer* aGlobalParaLayer,const CCharFormatLayer* aGlobalCharLayer,
1.81 + MTextFieldFactory* aFieldFactory=NULL,
1.82 + TDocumentStorage=ESegmentedStorage);
1.83 + IMPORT_C ~CGlobalText();
1.84 +// Global Format Layers
1.85 + IMPORT_C void SetGlobalParaFormat(const CParaFormatLayer* aParaFormatLayer);
1.86 + IMPORT_C void SetGlobalCharFormat(const CCharFormatLayer* aCharFormatLayer);
1.87 + inline const CParaFormatLayer* GlobalParaFormatLayer()const;
1.88 + inline const CCharFormatLayer* GlobalCharFormatLayer()const;
1.89 +// MLayDoc implementation
1.90 + IMPORT_C virtual TInt LdDocumentLength()const;
1.91 + IMPORT_C virtual TInt LdToParagraphStart(TInt& aCurrentPos)const;
1.92 + IMPORT_C virtual void GetParagraphFormatL(CParaFormat* aFormat,TInt aPos)const;
1.93 + IMPORT_C virtual void GetChars(TPtrC& aView,TCharFormat& aFormat,TInt aStartPos)const;
1.94 + IMPORT_C virtual TInt GetPictureSizeInTwips(TSize& aSize, TInt aPos)const;
1.95 + IMPORT_C virtual CPicture* PictureHandleL(TInt aPos,MLayDoc::TForcePictureLoad aForceLoad)const;
1.96 + IMPORT_C virtual TBool EnquirePageBreak(TInt aPos,TInt aLength=0)const;
1.97 + IMPORT_C virtual TBool SelectParagraphLabel(TInt aPos);
1.98 + IMPORT_C virtual void CancelSelectLabel();
1.99 +// MFormatText implementation
1.100 + IMPORT_C virtual void GetParaFormatL(CParaFormat* aFormat,TParaFormatMask& aVaries,TInt aPos,TInt aLength,
1.101 + CParaFormat::TParaFormatGetMode aMode=CParaFormat::EAllAttributes)const;
1.102 + IMPORT_C virtual void ApplyParaFormatL(const CParaFormat* aFormat,const TParaFormatMask& aMask,TInt aPos,TInt aLength);
1.103 + IMPORT_C virtual void GetCharFormat(TCharFormat& aFormat,TCharFormatMask& aVaries,TInt aPos,TInt aLength)const;
1.104 + IMPORT_C virtual void ApplyCharFormatL(const TCharFormat& aFormat,const TCharFormatMask& aMask,TInt aPos,TInt aLength);
1.105 +protected:
1.106 + IMPORT_C CGlobalText();
1.107 + IMPORT_C CGlobalText(const CParaFormatLayer* aGlobalParaLayer,
1.108 + const CCharFormatLayer* aGlobalCharLayer);
1.109 +private:
1.110 + CGlobalText(const CGlobalText& aGlobalText);
1.111 + CGlobalText& operator=(const CGlobalText& aGlobalText);
1.112 +protected:
1.113 + const CParaFormatLayer* iGlobalParaFormatLayer; // the global paragraph format layer; not owned
1.114 + const CCharFormatLayer* iGlobalCharFormatLayer; // the global character format layer; not owned
1.115 + __DECLARE_TEST;
1.116 +private:
1.117 + void* iReserved_2;
1.118 + };
1.119 +
1.120 +
1.121 +#include <txtglobl.inl>
1.122 +
1.123 +
1.124 +#endif