os/textandloc/textrendering/word/SRC/WPOUTLNE.H
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
#if !defined(__WPOUTLNE_H__)
sl@0
    20
#define __WPOUTLNE_H__
sl@0
    21
sl@0
    22
sl@0
    23
#if !defined(__EIKHLBM_H__)
sl@0
    24
#include <techview/eikhlbm.h>
sl@0
    25
#endif
sl@0
    26
#if !defined(__EIKHLBX_H__)
sl@0
    27
#include <techview/eikhlbx.h>
sl@0
    28
#endif
sl@0
    29
#if !defined(__EIKHLBI_H__)
sl@0
    30
#include <techview/eikhlbi.h>
sl@0
    31
#endif
sl@0
    32
#if !defined(__EIKHLBV_H__)
sl@0
    33
#include <techview/eikhlbv.h>
sl@0
    34
#endif
sl@0
    35
#if !defined(__TXTRICH_H__)
sl@0
    36
#include <txtrich.h>
sl@0
    37
#endif
sl@0
    38
#if !defined(__TXTFMLYR_H__)
sl@0
    39
#include <txtfmlyr.h>
sl@0
    40
#endif
sl@0
    41
#if !defined(__BARSREAD_H__)
sl@0
    42
#include <barsread.h>
sl@0
    43
#endif
sl@0
    44
sl@0
    45
sl@0
    46
class CRichText;
sl@0
    47
class COutlineHListBox;	
sl@0
    48
class COutlineHListBoxView;
sl@0
    49
class TResourceReader;
sl@0
    50
sl@0
    51
/**
sl@0
    52
@internalComponent
sl@0
    53
*/
sl@0
    54
const TInt KErrNoOutline=-50;
sl@0
    55
sl@0
    56
sl@0
    57
class TOutlineEntry
sl@0
    58
/**
sl@0
    59
TOutlineEntry
sl@0
    60
An entry in the Outline Table - used to store info for each paragraph in the document
sl@0
    61
which has an outline level 
sl@0
    62
@internalComponent
sl@0
    63
*/
sl@0
    64
{
sl@0
    65
public:
sl@0
    66
	TOutlineEntry(TInt aParagraphNo, TInt aOutlineLevel, TInt aParaLen, TInt aParaPos, TBool aChild, TBool aLast);
sl@0
    67
	TOutlineEntry();
sl@0
    68
public:
sl@0
    69
	TInt iParagraphNo;		// The pargagraph number for this entry
sl@0
    70
	TInt iOutlineLevel;		// The outline level for this paragraph
sl@0
    71
	TInt iParagraphLength;	// No. of chars in this paragraph
sl@0
    72
	TInt iParagraphPos;		// Char position of start of paragraph
sl@0
    73
	TBool iIsChild;			// Is this a child of the previous paragraph
sl@0
    74
	TBool iLastEntry;		// Is this the last entry at this level
sl@0
    75
};
sl@0
    76
sl@0
    77
sl@0
    78
sl@0
    79
class TOutlineMap
sl@0
    80
/**
sl@0
    81
TOutlineMap
sl@0
    82
An entry in the Outline Map Table - maps an index into the Outline Table to 
sl@0
    83
an entry in the hierarchical list box
sl@0
    84
@internalComponent
sl@0
    85
*/
sl@0
    86
{
sl@0
    87
public:
sl@0
    88
	TOutlineMap(TInt aIndex, CHierListItem* aPtr);
sl@0
    89
public:
sl@0
    90
	TInt iIndex;			// Index reference
sl@0
    91
	CHierListItem*	iPtr;	// Pointer to a list item
sl@0
    92
};
sl@0
    93
sl@0
    94
/**
sl@0
    95
@internalComponent
sl@0
    96
*/
sl@0
    97
typedef CArrayFixFlat<TOutlineEntry> COutlineTable;
sl@0
    98
typedef CArrayFixFlat<TOutlineMap> COutlineMapTable;
sl@0
    99
sl@0
   100
sl@0
   101
class COutlineMap : public CBase
sl@0
   102
/**
sl@0
   103
COutlineMap
sl@0
   104
Contains an array of TOutlineMap objects, with functions to bind entries
sl@0
   105
together.
sl@0
   106
@internalComponent
sl@0
   107
*/
sl@0
   108
{
sl@0
   109
public:
sl@0
   110
static COutlineMap* NewL();
sl@0
   111
	~COutlineMap();
sl@0
   112
	void BindL(TInt aIndex, CHierListItem* aPtr);	// Bind a list item with the paragraph index
sl@0
   113
	TInt Index(CHierListItem* aPtr);				// Given a pointer, return the index
sl@0
   114
	CHierListItem* Ptr(TInt aIndex);				// Given an index, return the pointer
sl@0
   115
	TBool IndexPresent(TInt aIndex);				// Has this index been added yet?
sl@0
   116
private:
sl@0
   117
	void ConstructL();
sl@0
   118
private:
sl@0
   119
	COutlineMapTable* iOutlineMapTable;
sl@0
   120
};
sl@0
   121
sl@0
   122
sl@0
   123
sl@0
   124
class COutlineHListBoxModel : public CHierarchicalListBoxModel
sl@0
   125
/**
sl@0
   126
COutlineHListBoxModel
sl@0
   127
This is the list box model which defines the behaviour of an outline list box
sl@0
   128
@internalComponent
sl@0
   129
*/
sl@0
   130
{
sl@0
   131
public:
sl@0
   132
	static COutlineHListBoxModel* NewL(COutlineHListBox* aParent,CRichText* aText);
sl@0
   133
	~COutlineHListBoxModel();
sl@0
   134
	void CreateRootListL();
sl@0
   135
	void ExpandItemL(TInt aItemIndex);
sl@0
   136
	TInt ExpandCurrentPositionL(TInt aCursorPos);
sl@0
   137
	TInt CurrentCharPosition();
sl@0
   138
	TInt GetItemByParagraph(TInt aPara);
sl@0
   139
private:
sl@0
   140
	void ConstructL();
sl@0
   141
	void CreateEntryTableL();
sl@0
   142
	void ScanHeading(TDes& aText);
sl@0
   143
	TInt ExpandParagraphL(TInt aPara);
sl@0
   144
public:
sl@0
   145
	COutlineTable* iOutlineTable;	// Table of outline levels in the document
sl@0
   146
	COutlineMap*	iOutlineMap;	// Table to map between the outline table and the listbox items
sl@0
   147
private:
sl@0
   148
	CRichText* iText;
sl@0
   149
	TInt iCursorPos;
sl@0
   150
	COutlineHListBox* iParent;
sl@0
   151
};
sl@0
   152
sl@0
   153
sl@0
   154
sl@0
   155
class COutlineHListBox : public CEikHierarchicalListBox
sl@0
   156
/**
sl@0
   157
COutlineHListBox
sl@0
   158
Parent control - owns the model and view of the listbox
sl@0
   159
@internalComponent
sl@0
   160
*/
sl@0
   161
{
sl@0
   162
public:
sl@0
   163
	COutlineHListBox(CRichText* aText, TInt aCursorPos);
sl@0
   164
	void ConstructL();
sl@0
   165
	void ConstructFromResourceL(TResourceReader& aReader);
sl@0
   166
	COutlineHListBoxModel* OutlineModel() const;
sl@0
   167
	TSize MinimumSize();
sl@0
   168
	CListBoxView* MakeViewClassInstanceL();
sl@0
   169
	COutlineHListBoxView* HlView() const;
sl@0
   170
	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
sl@0
   171
	void ExpandAllItemsL();
sl@0
   172
	void CollapseAllItemsL();
sl@0
   173
private:
sl@0
   174
	CRichText* iText;
sl@0
   175
	TInt iCursorPos;
sl@0
   176
};
sl@0
   177
sl@0
   178
sl@0
   179
class COutlineHListItemDrawer : public CHierarchicalListItemDrawer
sl@0
   180
/**
sl@0
   181
COutlineHListItemDrawer
sl@0
   182
Contains bitmap information about each drawer in the list box
sl@0
   183
@internalComponent
sl@0
   184
*/
sl@0
   185
	{
sl@0
   186
public:
sl@0
   187
	COutlineHListItemDrawer(COutlineHListBoxModel* aModel, const CFont* aFont, CArrayPtrFlat<CGulIcon>* aIcons);
sl@0
   188
sl@0
   189
protected: // from CHierarchicalListItemDrawer
sl@0
   190
	CGulIcon* ItemIcon(TInt aItemIndex) const;
sl@0
   191
	};
sl@0
   192
sl@0
   193
sl@0
   194
class COutlineHListBoxView : public CHierarchicalListBoxView
sl@0
   195
/**
sl@0
   196
Overriden functions from CHierarchicalListBoxView
sl@0
   197
@internalComponent
sl@0
   198
*/
sl@0
   199
{
sl@0
   200
public:
sl@0
   201
	void DrawItem(TInt aItemIndex) const;
sl@0
   202
	void DrawItemLinks(TInt aItemIndex, TInt aParagraphLevel) const;
sl@0
   203
	TSize ItemSize(TInt aItemIndex, TInt aParagraphLevel) const;
sl@0
   204
	TPoint ItemPos(TInt aItemIndex, TInt aParagraphLevel) const;
sl@0
   205
	void ClearPreceedingItemRect(TInt aItemIndex, TInt aParagraphLevel) const;
sl@0
   206
private:
sl@0
   207
	TInt GetParagraphLevel(CHierListItem* aItem) const;
sl@0
   208
sl@0
   209
};
sl@0
   210
sl@0
   211
sl@0
   212
// Inline functions
sl@0
   213
sl@0
   214
inline COutlineHListBoxModel* COutlineHListBox::OutlineModel() const { return (COutlineHListBoxModel*)iModel; }
sl@0
   215
sl@0
   216
sl@0
   217
sl@0
   218
#endif
sl@0
   219