First public contribution.
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #if !defined(__WPOUTLNE_H__)
20 #define __WPOUTLNE_H__
23 #if !defined(__EIKHLBM_H__)
24 #include <techview/eikhlbm.h>
26 #if !defined(__EIKHLBX_H__)
27 #include <techview/eikhlbx.h>
29 #if !defined(__EIKHLBI_H__)
30 #include <techview/eikhlbi.h>
32 #if !defined(__EIKHLBV_H__)
33 #include <techview/eikhlbv.h>
35 #if !defined(__TXTRICH_H__)
38 #if !defined(__TXTFMLYR_H__)
41 #if !defined(__BARSREAD_H__)
47 class COutlineHListBox;
48 class COutlineHListBoxView;
49 class TResourceReader;
54 const TInt KErrNoOutline=-50;
60 An entry in the Outline Table - used to store info for each paragraph in the document
61 which has an outline level
66 TOutlineEntry(TInt aParagraphNo, TInt aOutlineLevel, TInt aParaLen, TInt aParaPos, TBool aChild, TBool aLast);
69 TInt iParagraphNo; // The pargagraph number for this entry
70 TInt iOutlineLevel; // The outline level for this paragraph
71 TInt iParagraphLength; // No. of chars in this paragraph
72 TInt iParagraphPos; // Char position of start of paragraph
73 TBool iIsChild; // Is this a child of the previous paragraph
74 TBool iLastEntry; // Is this the last entry at this level
82 An entry in the Outline Map Table - maps an index into the Outline Table to
83 an entry in the hierarchical list box
88 TOutlineMap(TInt aIndex, CHierListItem* aPtr);
90 TInt iIndex; // Index reference
91 CHierListItem* iPtr; // Pointer to a list item
97 typedef CArrayFixFlat<TOutlineEntry> COutlineTable;
98 typedef CArrayFixFlat<TOutlineMap> COutlineMapTable;
101 class COutlineMap : public CBase
104 Contains an array of TOutlineMap objects, with functions to bind entries
110 static COutlineMap* NewL();
112 void BindL(TInt aIndex, CHierListItem* aPtr); // Bind a list item with the paragraph index
113 TInt Index(CHierListItem* aPtr); // Given a pointer, return the index
114 CHierListItem* Ptr(TInt aIndex); // Given an index, return the pointer
115 TBool IndexPresent(TInt aIndex); // Has this index been added yet?
119 COutlineMapTable* iOutlineMapTable;
124 class COutlineHListBoxModel : public CHierarchicalListBoxModel
126 COutlineHListBoxModel
127 This is the list box model which defines the behaviour of an outline list box
132 static COutlineHListBoxModel* NewL(COutlineHListBox* aParent,CRichText* aText);
133 ~COutlineHListBoxModel();
134 void CreateRootListL();
135 void ExpandItemL(TInt aItemIndex);
136 TInt ExpandCurrentPositionL(TInt aCursorPos);
137 TInt CurrentCharPosition();
138 TInt GetItemByParagraph(TInt aPara);
141 void CreateEntryTableL();
142 void ScanHeading(TDes& aText);
143 TInt ExpandParagraphL(TInt aPara);
145 COutlineTable* iOutlineTable; // Table of outline levels in the document
146 COutlineMap* iOutlineMap; // Table to map between the outline table and the listbox items
150 COutlineHListBox* iParent;
155 class COutlineHListBox : public CEikHierarchicalListBox
158 Parent control - owns the model and view of the listbox
163 COutlineHListBox(CRichText* aText, TInt aCursorPos);
165 void ConstructFromResourceL(TResourceReader& aReader);
166 COutlineHListBoxModel* OutlineModel() const;
168 CListBoxView* MakeViewClassInstanceL();
169 COutlineHListBoxView* HlView() const;
170 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
171 void ExpandAllItemsL();
172 void CollapseAllItemsL();
179 class COutlineHListItemDrawer : public CHierarchicalListItemDrawer
181 COutlineHListItemDrawer
182 Contains bitmap information about each drawer in the list box
187 COutlineHListItemDrawer(COutlineHListBoxModel* aModel, const CFont* aFont, CArrayPtrFlat<CGulIcon>* aIcons);
189 protected: // from CHierarchicalListItemDrawer
190 CGulIcon* ItemIcon(TInt aItemIndex) const;
194 class COutlineHListBoxView : public CHierarchicalListBoxView
196 Overriden functions from CHierarchicalListBoxView
201 void DrawItem(TInt aItemIndex) const;
202 void DrawItemLinks(TInt aItemIndex, TInt aParagraphLevel) const;
203 TSize ItemSize(TInt aItemIndex, TInt aParagraphLevel) const;
204 TPoint ItemPos(TInt aItemIndex, TInt aParagraphLevel) const;
205 void ClearPreceedingItemRect(TInt aItemIndex, TInt aParagraphLevel) const;
207 TInt GetParagraphLevel(CHierListItem* aItem) const;
214 inline COutlineHListBoxModel* COutlineHListBox::OutlineModel() const { return (COutlineHListBoxModel*)iModel; }