1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/textrendering/word/SRC/WPOUTLNE.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,219 @@
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 +#if !defined(__WPOUTLNE_H__)
1.23 +#define __WPOUTLNE_H__
1.24 +
1.25 +
1.26 +#if !defined(__EIKHLBM_H__)
1.27 +#include <techview/eikhlbm.h>
1.28 +#endif
1.29 +#if !defined(__EIKHLBX_H__)
1.30 +#include <techview/eikhlbx.h>
1.31 +#endif
1.32 +#if !defined(__EIKHLBI_H__)
1.33 +#include <techview/eikhlbi.h>
1.34 +#endif
1.35 +#if !defined(__EIKHLBV_H__)
1.36 +#include <techview/eikhlbv.h>
1.37 +#endif
1.38 +#if !defined(__TXTRICH_H__)
1.39 +#include <txtrich.h>
1.40 +#endif
1.41 +#if !defined(__TXTFMLYR_H__)
1.42 +#include <txtfmlyr.h>
1.43 +#endif
1.44 +#if !defined(__BARSREAD_H__)
1.45 +#include <barsread.h>
1.46 +#endif
1.47 +
1.48 +
1.49 +class CRichText;
1.50 +class COutlineHListBox;
1.51 +class COutlineHListBoxView;
1.52 +class TResourceReader;
1.53 +
1.54 +/**
1.55 +@internalComponent
1.56 +*/
1.57 +const TInt KErrNoOutline=-50;
1.58 +
1.59 +
1.60 +class TOutlineEntry
1.61 +/**
1.62 +TOutlineEntry
1.63 +An entry in the Outline Table - used to store info for each paragraph in the document
1.64 +which has an outline level
1.65 +@internalComponent
1.66 +*/
1.67 +{
1.68 +public:
1.69 + TOutlineEntry(TInt aParagraphNo, TInt aOutlineLevel, TInt aParaLen, TInt aParaPos, TBool aChild, TBool aLast);
1.70 + TOutlineEntry();
1.71 +public:
1.72 + TInt iParagraphNo; // The pargagraph number for this entry
1.73 + TInt iOutlineLevel; // The outline level for this paragraph
1.74 + TInt iParagraphLength; // No. of chars in this paragraph
1.75 + TInt iParagraphPos; // Char position of start of paragraph
1.76 + TBool iIsChild; // Is this a child of the previous paragraph
1.77 + TBool iLastEntry; // Is this the last entry at this level
1.78 +};
1.79 +
1.80 +
1.81 +
1.82 +class TOutlineMap
1.83 +/**
1.84 +TOutlineMap
1.85 +An entry in the Outline Map Table - maps an index into the Outline Table to
1.86 +an entry in the hierarchical list box
1.87 +@internalComponent
1.88 +*/
1.89 +{
1.90 +public:
1.91 + TOutlineMap(TInt aIndex, CHierListItem* aPtr);
1.92 +public:
1.93 + TInt iIndex; // Index reference
1.94 + CHierListItem* iPtr; // Pointer to a list item
1.95 +};
1.96 +
1.97 +/**
1.98 +@internalComponent
1.99 +*/
1.100 +typedef CArrayFixFlat<TOutlineEntry> COutlineTable;
1.101 +typedef CArrayFixFlat<TOutlineMap> COutlineMapTable;
1.102 +
1.103 +
1.104 +class COutlineMap : public CBase
1.105 +/**
1.106 +COutlineMap
1.107 +Contains an array of TOutlineMap objects, with functions to bind entries
1.108 +together.
1.109 +@internalComponent
1.110 +*/
1.111 +{
1.112 +public:
1.113 +static COutlineMap* NewL();
1.114 + ~COutlineMap();
1.115 + void BindL(TInt aIndex, CHierListItem* aPtr); // Bind a list item with the paragraph index
1.116 + TInt Index(CHierListItem* aPtr); // Given a pointer, return the index
1.117 + CHierListItem* Ptr(TInt aIndex); // Given an index, return the pointer
1.118 + TBool IndexPresent(TInt aIndex); // Has this index been added yet?
1.119 +private:
1.120 + void ConstructL();
1.121 +private:
1.122 + COutlineMapTable* iOutlineMapTable;
1.123 +};
1.124 +
1.125 +
1.126 +
1.127 +class COutlineHListBoxModel : public CHierarchicalListBoxModel
1.128 +/**
1.129 +COutlineHListBoxModel
1.130 +This is the list box model which defines the behaviour of an outline list box
1.131 +@internalComponent
1.132 +*/
1.133 +{
1.134 +public:
1.135 + static COutlineHListBoxModel* NewL(COutlineHListBox* aParent,CRichText* aText);
1.136 + ~COutlineHListBoxModel();
1.137 + void CreateRootListL();
1.138 + void ExpandItemL(TInt aItemIndex);
1.139 + TInt ExpandCurrentPositionL(TInt aCursorPos);
1.140 + TInt CurrentCharPosition();
1.141 + TInt GetItemByParagraph(TInt aPara);
1.142 +private:
1.143 + void ConstructL();
1.144 + void CreateEntryTableL();
1.145 + void ScanHeading(TDes& aText);
1.146 + TInt ExpandParagraphL(TInt aPara);
1.147 +public:
1.148 + COutlineTable* iOutlineTable; // Table of outline levels in the document
1.149 + COutlineMap* iOutlineMap; // Table to map between the outline table and the listbox items
1.150 +private:
1.151 + CRichText* iText;
1.152 + TInt iCursorPos;
1.153 + COutlineHListBox* iParent;
1.154 +};
1.155 +
1.156 +
1.157 +
1.158 +class COutlineHListBox : public CEikHierarchicalListBox
1.159 +/**
1.160 +COutlineHListBox
1.161 +Parent control - owns the model and view of the listbox
1.162 +@internalComponent
1.163 +*/
1.164 +{
1.165 +public:
1.166 + COutlineHListBox(CRichText* aText, TInt aCursorPos);
1.167 + void ConstructL();
1.168 + void ConstructFromResourceL(TResourceReader& aReader);
1.169 + COutlineHListBoxModel* OutlineModel() const;
1.170 + TSize MinimumSize();
1.171 + CListBoxView* MakeViewClassInstanceL();
1.172 + COutlineHListBoxView* HlView() const;
1.173 + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
1.174 + void ExpandAllItemsL();
1.175 + void CollapseAllItemsL();
1.176 +private:
1.177 + CRichText* iText;
1.178 + TInt iCursorPos;
1.179 +};
1.180 +
1.181 +
1.182 +class COutlineHListItemDrawer : public CHierarchicalListItemDrawer
1.183 +/**
1.184 +COutlineHListItemDrawer
1.185 +Contains bitmap information about each drawer in the list box
1.186 +@internalComponent
1.187 +*/
1.188 + {
1.189 +public:
1.190 + COutlineHListItemDrawer(COutlineHListBoxModel* aModel, const CFont* aFont, CArrayPtrFlat<CGulIcon>* aIcons);
1.191 +
1.192 +protected: // from CHierarchicalListItemDrawer
1.193 + CGulIcon* ItemIcon(TInt aItemIndex) const;
1.194 + };
1.195 +
1.196 +
1.197 +class COutlineHListBoxView : public CHierarchicalListBoxView
1.198 +/**
1.199 +Overriden functions from CHierarchicalListBoxView
1.200 +@internalComponent
1.201 +*/
1.202 +{
1.203 +public:
1.204 + void DrawItem(TInt aItemIndex) const;
1.205 + void DrawItemLinks(TInt aItemIndex, TInt aParagraphLevel) const;
1.206 + TSize ItemSize(TInt aItemIndex, TInt aParagraphLevel) const;
1.207 + TPoint ItemPos(TInt aItemIndex, TInt aParagraphLevel) const;
1.208 + void ClearPreceedingItemRect(TInt aItemIndex, TInt aParagraphLevel) const;
1.209 +private:
1.210 + TInt GetParagraphLevel(CHierListItem* aItem) const;
1.211 +
1.212 +};
1.213 +
1.214 +
1.215 +// Inline functions
1.216 +
1.217 +inline COutlineHListBoxModel* COutlineHListBox::OutlineModel() const { return (COutlineHListBoxModel*)iModel; }
1.218 +
1.219 +
1.220 +
1.221 +#endif
1.222 +