williamr@2
|
1 |
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __HLPMODEL_H
|
williamr@2
|
17 |
#define __HLPMODEL_H
|
williamr@2
|
18 |
|
williamr@2
|
19 |
// System includes
|
williamr@2
|
20 |
#include <e32std.h>
|
williamr@2
|
21 |
#include <badesca.h> // For MDesCArray
|
williamr@2
|
22 |
#include <txtmrtsr.h> // For MRichTextStoreResolver
|
williamr@2
|
23 |
#include <gdi.h> // For MPictureFactory
|
williamr@2
|
24 |
#include <d32dbms.h>
|
williamr@2
|
25 |
// Help model includes
|
williamr@2
|
26 |
#include "hlpconstants.h"
|
williamr@2
|
27 |
|
williamr@2
|
28 |
// Classes referenced
|
williamr@2
|
29 |
class CRichText;
|
williamr@2
|
30 |
class CHlpDatabase;
|
williamr@2
|
31 |
class CHlpFileEntry;
|
williamr@2
|
32 |
class CHlpSQLSearch;
|
williamr@2
|
33 |
class TCoeHelpContext;
|
williamr@2
|
34 |
class CParaFormatLayer;
|
williamr@2
|
35 |
class CCharFormatLayer;
|
williamr@2
|
36 |
class CHlpPicture;
|
williamr@2
|
37 |
|
williamr@2
|
38 |
// Typedefs
|
williamr@2
|
39 |
/**
|
williamr@4
|
40 |
@publishedAll
|
williamr@2
|
41 |
@released
|
williamr@2
|
42 |
*/
|
williamr@2
|
43 |
typedef CArrayPtrFlat<CHlpDatabase> CHlpDatabases;
|
williamr@2
|
44 |
|
williamr@2
|
45 |
/**
|
williamr@4
|
46 |
@publishedAll
|
williamr@4
|
47 |
@released
|
williamr@4
|
48 |
*/
|
williamr@4
|
49 |
typedef CArrayPtrFlat<CHlpFileEntry> CHlpFileList;
|
williamr@4
|
50 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
williamr@4
|
51 |
/** Maximum Title column.
|
williamr@4
|
52 |
@publishedAll
|
williamr@4
|
53 |
@released
|
williamr@4
|
54 |
*/
|
williamr@4
|
55 |
const TInt KMaxTitleColumn = 120;
|
williamr@4
|
56 |
#endif
|
williamr@4
|
57 |
|
williamr@4
|
58 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
williamr@4
|
59 |
/**
|
williamr@2
|
60 |
@internalComponent
|
williamr@2
|
61 |
@released
|
williamr@2
|
62 |
*/
|
williamr@4
|
63 |
const TInt KHlpModelDefaultNumberOfImagesForV6Point2Files = 1;
|
williamr@4
|
64 |
/**
|
williamr@4
|
65 |
@internalComponent
|
williamr@4
|
66 |
@released
|
williamr@4
|
67 |
*/
|
williamr@4
|
68 |
const TInt KHlpModelMaximumNumberOfImagesForV6Point2Files = 3;
|
williamr@4
|
69 |
//
|
williamr@4
|
70 |
/** Default zoom factor for small zoom size.
|
williamr@4
|
71 |
@internalComponent
|
williamr@4
|
72 |
@released
|
williamr@4
|
73 |
*/
|
williamr@4
|
74 |
const TInt KHlpModelZoomFactorSmall = 750;
|
williamr@4
|
75 |
/** Default zoom factor for medium zoom size.
|
williamr@4
|
76 |
@internalComponent
|
williamr@4
|
77 |
@released
|
williamr@4
|
78 |
*/
|
williamr@4
|
79 |
const TInt KHlpModelZoomFactorMedium = 1000;
|
williamr@4
|
80 |
/** Default zoom factor for large zoom size.
|
williamr@4
|
81 |
@internalComponent
|
williamr@4
|
82 |
@released
|
williamr@4
|
83 |
*/
|
williamr@4
|
84 |
const TInt KHlpModelZoomFactorLarge = 1250;
|
williamr@2
|
85 |
|
williamr@4
|
86 |
/** Default zoom factor for medium zoom size as real number.
|
williamr@4
|
87 |
@internalComponent
|
williamr@4
|
88 |
@released
|
williamr@4
|
89 |
*/
|
williamr@4
|
90 |
const TReal KHlpModelDefaultZoomFactorAsRealNumber = 1000.0;
|
williamr@4
|
91 |
|
williamr@4
|
92 |
#endif //SYMBIAN_ENABLE_SPLIT_HEADERS
|
williamr@2
|
93 |
|
williamr@2
|
94 |
class MHlpModelObserver
|
williamr@2
|
95 |
/** Client callback inteface to receive events from the help model.
|
williamr@2
|
96 |
@publishedAll
|
williamr@2
|
97 |
@released
|
williamr@2
|
98 |
*/
|
williamr@2
|
99 |
{
|
williamr@2
|
100 |
public:
|
williamr@2
|
101 |
/** Receives a help model event.
|
williamr@2
|
102 |
|
williamr@2
|
103 |
@param aEvent Help model event. Events are listed in the enums that begin
|
williamr@2
|
104 |
ECategoryListAvailable, and ENoRecordsFound. */
|
williamr@2
|
105 |
virtual void HandleModelEventL(TInt aEvent) = 0;
|
williamr@2
|
106 |
};
|
williamr@2
|
107 |
|
williamr@4
|
108 |
|
williamr@2
|
109 |
class MHlpDbObserver
|
williamr@4
|
110 |
/** Internal API to handle events reported by the search engine
|
williamr@4
|
111 |
@publishedAll
|
williamr@2
|
112 |
@released
|
williamr@2
|
113 |
*/
|
williamr@2
|
114 |
{
|
williamr@2
|
115 |
public: // TInt aEvent should be a named enum
|
williamr@2
|
116 |
virtual void HandleDbEventL(TInt aEvent) = 0;
|
williamr@2
|
117 |
};
|
williamr@2
|
118 |
|
williamr@2
|
119 |
//
|
williamr@2
|
120 |
// Search types (these should be named, but SC cannot be broken until v7.0
|
williamr@2
|
121 |
//
|
williamr@4
|
122 |
/** Defines the search types for use with CHlpModel::SearchL().
|
williamr@4
|
123 |
@publishedAll
|
williamr@4
|
124 |
@released
|
williamr@4
|
125 |
*/
|
williamr@2
|
126 |
enum
|
williamr@2
|
127 |
{
|
williamr@2
|
128 |
/** Gets a list of index entries for all help files.
|
williamr@2
|
129 |
|
williamr@2
|
130 |
Success is indicated by an EIndexListAvailable event; failure by EIndexListNoneFound.
|
williamr@2
|
131 |
The list can be retrieved using CHlpModel::LoadListL(). */
|
williamr@2
|
132 |
EIndexList,
|
williamr@2
|
133 |
/** Gets a list of categories for all help files.
|
williamr@2
|
134 |
|
williamr@2
|
135 |
Success is indicated by an ECategoryListAvailable event; failure by ECategoryListNoneFound.
|
williamr@2
|
136 |
The list can be retrieved using CHlpModel::CategoryListL(). */
|
williamr@2
|
137 |
ECategoryList,
|
williamr@2
|
138 |
/** Gets a list of topics for a specified category.
|
williamr@2
|
139 |
|
williamr@2
|
140 |
Success is indicated by an ETopicListAvailable event; failure by ETopicListNoneFound.
|
williamr@2
|
141 |
The list can be retrieved using CHlpModel::LoadListL(). */
|
williamr@2
|
142 |
ETopicListForCategory,
|
williamr@2
|
143 |
/** Gets a list of topics for a specified category UID.
|
williamr@2
|
144 |
|
williamr@2
|
145 |
Success is indicated by an ETopicListAvailable event; failure by ETopicListNoneFound.
|
williamr@2
|
146 |
The list can be retrieved using CHlpModel::LoadListL(). */
|
williamr@2
|
147 |
ETopicListForCategoryUID,
|
williamr@2
|
148 |
/** Searches for a topic with the specified help context.
|
williamr@2
|
149 |
|
williamr@2
|
150 |
A successful search generates an ETopicAvailable event. The topic can then be retrieved
|
williamr@2
|
151 |
using CHlpModel::LoadTopicL(). An unsuccessful search generates an ETopicNotFound event. */
|
williamr@2
|
152 |
EContextSearch,
|
williamr@2
|
153 |
/** Searches for index entries for the specified help item.
|
williamr@2
|
154 |
|
williamr@2
|
155 |
A successful search generates an ETopicListAvailable event. The list can then be retrieved
|
williamr@2
|
156 |
using CHlpModel::LoadListL(). An unsuccessful search generates an ETopicListNoneFound event. */
|
williamr@2
|
157 |
EIndexSearch,
|
williamr@2
|
158 |
/** Searches the topic titles for the specified text.
|
williamr@2
|
159 |
|
williamr@2
|
160 |
A successful search generates an ESearchListAvailable event. The list can then be
|
williamr@2
|
161 |
retrieved using CHlpModel::LoadListL(). An unsuccessful search generates an
|
williamr@2
|
162 |
ESearchListNoneFound event. */
|
williamr@2
|
163 |
EQuickSearch,
|
williamr@2
|
164 |
/** Searches the full text of topics for the specified text.
|
williamr@2
|
165 |
|
williamr@2
|
166 |
A successful search generates an ESearchListAvailable event. The list can then be
|
williamr@2
|
167 |
retrieved using CHlpModel::LoadListL(). An unsuccessful search generates an
|
williamr@2
|
168 |
ESearchListNoneFound event. */
|
williamr@2
|
169 |
EFullTextSearch,
|
williamr@2
|
170 |
/** Searches for a topic with the specified ID.
|
williamr@2
|
171 |
|
williamr@2
|
172 |
A successful search generates an ETopicAvailable event. The topic can then be
|
williamr@2
|
173 |
retrieved using CHlpModel::LoadTopicL(). An unsuccessful search generates an
|
williamr@2
|
174 |
ETopicNotFound event. */
|
williamr@2
|
175 |
ETopicIdSearch
|
williamr@2
|
176 |
};
|
williamr@2
|
177 |
|
williamr@2
|
178 |
//
|
williamr@2
|
179 |
// Search progress responses (this should be scoped as members of MHlpModelObserver
|
williamr@2
|
180 |
// and should also be named, but SC cannot be broken until v7.0
|
williamr@2
|
181 |
//
|
williamr@4
|
182 |
/** Search progress responses
|
williamr@4
|
183 |
@publishedAll
|
williamr@4
|
184 |
@released
|
williamr@4
|
185 |
*/
|
williamr@2
|
186 |
enum
|
williamr@2
|
187 |
{
|
williamr@2
|
188 |
ENoRecordsFound,
|
williamr@2
|
189 |
ESearchInProgress,
|
williamr@2
|
190 |
ESearchComplete
|
williamr@2
|
191 |
};
|
williamr@2
|
192 |
|
williamr@2
|
193 |
//
|
williamr@2
|
194 |
// Search progress responses (ditto for naming and scoping)
|
williamr@2
|
195 |
//
|
williamr@4
|
196 |
/** Help model search result events
|
williamr@4
|
197 |
@publishedAll
|
williamr@4
|
198 |
@released
|
williamr@4
|
199 |
*/
|
williamr@2
|
200 |
enum
|
williamr@2
|
201 |
{
|
williamr@2
|
202 |
/** The search returned a category list.
|
williamr@2
|
203 |
|
williamr@2
|
204 |
The list can be retrieved using CHlpModel::CategoryListL(). */
|
williamr@2
|
205 |
ECategoryListAvailable,
|
williamr@2
|
206 |
/** The search did not return a category list. */
|
williamr@2
|
207 |
ECategoryListNoneFound,
|
williamr@2
|
208 |
/** The search returned a results list.
|
williamr@2
|
209 |
|
williamr@2
|
210 |
The list can be retrieved using CHlpModel::LoadListL(). */
|
williamr@2
|
211 |
ESearchListAvailable,
|
williamr@2
|
212 |
/** The search did not return a results list. */
|
williamr@2
|
213 |
ESearchListNoneFound,
|
williamr@2
|
214 |
/** The search returned a topic list.
|
williamr@2
|
215 |
|
williamr@2
|
216 |
The list can be retrieved using CHlpModel::LoadListL(). */
|
williamr@2
|
217 |
ETopicListAvailable, // Category expansion
|
williamr@2
|
218 |
/** The search did not return a topic list. */
|
williamr@2
|
219 |
ETopicListNoneFound,
|
williamr@2
|
220 |
/** The search returned an index item list.
|
williamr@2
|
221 |
|
williamr@2
|
222 |
The list can be retrieved using CHlpModel::LoadListL(). */
|
williamr@2
|
223 |
EIndexListAvailable,
|
williamr@2
|
224 |
/** The search did not return an index item list. */
|
williamr@2
|
225 |
EIndexListNoneFound,
|
williamr@2
|
226 |
/** The search returned a topic list from an index phrase search.
|
williamr@2
|
227 |
|
williamr@2
|
228 |
The list can be retrieved using CHlpModel::LoadListL(). */
|
williamr@2
|
229 |
EIndexSearchListAvailable,
|
williamr@2
|
230 |
/** The search did not return a topic list from an index phrase search. */
|
williamr@2
|
231 |
EIndexSearchListNoneFound,
|
williamr@2
|
232 |
/** The search returned a topic.
|
williamr@2
|
233 |
|
williamr@2
|
234 |
The topic can be retrieved using CHlpModel::LoadTopicL(). */
|
williamr@2
|
235 |
ETopicAvailable,
|
williamr@2
|
236 |
/** The search did not return a topic. */
|
williamr@2
|
237 |
ETopicNotFound,
|
williamr@2
|
238 |
/** The search is in progress. */
|
williamr@2
|
239 |
EModelSearchInProgress,
|
williamr@2
|
240 |
/** The search has been cancelled. */
|
williamr@2
|
241 |
EHlpSearchCancelled
|
williamr@2
|
242 |
};
|
williamr@4
|
243 |
|
williamr@4
|
244 |
// Constants
|
williamr@2
|
245 |
|
williamr@4
|
246 |
/** Defines help model zoom sizes.
|
williamr@4
|
247 |
@publishedAll
|
williamr@4
|
248 |
@released
|
williamr@4
|
249 |
*/
|
williamr@2
|
250 |
enum THlpZoomState
|
williamr@2
|
251 |
{
|
williamr@2
|
252 |
/** Small zoom. */
|
williamr@2
|
253 |
EHlpZoomStateSmall = 0,
|
williamr@2
|
254 |
/** Medium zoom. */
|
williamr@2
|
255 |
EHlpZoomStateMedium = 1,
|
williamr@2
|
256 |
/** Large zoom. */
|
williamr@2
|
257 |
EHlpZoomStateLarge = 2
|
williamr@2
|
258 |
};
|
williamr@2
|
259 |
|
williamr@2
|
260 |
|
williamr@2
|
261 |
class CHlpItem : public CBase
|
williamr@2
|
262 |
/** Encapsulates an individual item in a help file.
|
williamr@2
|
263 |
|
williamr@2
|
264 |
Note that item IDs are assigned in increasing numerical order by the help
|
williamr@2
|
265 |
compiler and are not unique. Categories and help files are however specified
|
williamr@2
|
266 |
by UID, and so are unique.
|
williamr@2
|
267 |
@publishedAll
|
williamr@2
|
268 |
@released
|
williamr@2
|
269 |
*/
|
williamr@2
|
270 |
{
|
williamr@2
|
271 |
public:
|
williamr@2
|
272 |
static CHlpItem* NewL(const TDesC& aTitle, TUint32 aId, TUid aCategoryId, TUid aHelpFileUid);
|
williamr@2
|
273 |
static CHlpItem* NewLC(const TDesC& aTitle, TUint32 aId, TUid aCategoryId, TUid aHelpFileUid);
|
williamr@2
|
274 |
static CHlpItem* NewLC(const TDesC& aTitle, TUint32 aId, TUid aHelpFileUid);
|
williamr@2
|
275 |
IMPORT_C ~CHlpItem();
|
williamr@2
|
276 |
|
williamr@2
|
277 |
public: // Access
|
williamr@2
|
278 |
inline TUid CategoryUid() const
|
williamr@2
|
279 |
/** Gets the item's category ID.
|
williamr@2
|
280 |
|
williamr@2
|
281 |
@return Category ID */
|
williamr@2
|
282 |
{ return iCategoryUid; }
|
williamr@2
|
283 |
inline TUid HelpFileUid() const
|
williamr@2
|
284 |
/** Gets the item's help file UID.
|
williamr@2
|
285 |
|
williamr@2
|
286 |
@return Help file UID */
|
williamr@2
|
287 |
{ return iHelpFileUid; }
|
williamr@2
|
288 |
inline TUint32 Id() const
|
williamr@2
|
289 |
/** Gets the item's ID.
|
williamr@2
|
290 |
|
williamr@2
|
291 |
@return Item's ID */
|
williamr@2
|
292 |
{ return iId; }
|
williamr@2
|
293 |
inline const TDesC& Title() const
|
williamr@2
|
294 |
/** Gets the item's title.
|
williamr@2
|
295 |
|
williamr@2
|
296 |
@return Item's title */
|
williamr@2
|
297 |
{ return *iTitle; }
|
williamr@2
|
298 |
|
williamr@2
|
299 |
public: // These should not be public, but I can't break SC (these were inherited from
|
williamr@2
|
300 |
// the previous author.
|
williamr@2
|
301 |
/** Item's title */
|
williamr@2
|
302 |
HBufC* iTitle;
|
williamr@2
|
303 |
/** Item's ID */
|
williamr@2
|
304 |
TUint32 iId;
|
williamr@2
|
305 |
|
williamr@2
|
306 |
private:
|
williamr@2
|
307 |
friend class CHlpList; // Needed for searching
|
williamr@2
|
308 |
CHlpItem(TUint32 aId);
|
williamr@2
|
309 |
CHlpItem(TUint32 aId, TUid aHelpFileUid);
|
williamr@2
|
310 |
CHlpItem(TUint32 aId, TUid aCategoryId, TUid aHelpFileUid);
|
williamr@2
|
311 |
void ConstructL(const TDesC& aTitle);
|
williamr@2
|
312 |
|
williamr@2
|
313 |
private: // Meta data required for correct restoration of topics
|
williamr@2
|
314 |
TUid iCategoryUid;
|
williamr@2
|
315 |
TUid iHelpFileUid;
|
williamr@2
|
316 |
};
|
williamr@2
|
317 |
|
williamr@2
|
318 |
|
williamr@2
|
319 |
|
williamr@4
|
320 |
//
|
williamr@2
|
321 |
// ----> MHlpTitleArray
|
williamr@4
|
322 |
//
|
williamr@2
|
323 |
class MHlpTitleArray : public MDesCArray
|
williamr@2
|
324 |
/** Interface to get a topic ID from an array index.
|
williamr@2
|
325 |
@publishedAll
|
williamr@2
|
326 |
@released
|
williamr@2
|
327 |
*/
|
williamr@2
|
328 |
{
|
williamr@2
|
329 |
public:
|
williamr@2
|
330 |
/** Gets a topic ID for the specified index.
|
williamr@2
|
331 |
|
williamr@2
|
332 |
@param aIndex Index of item to get
|
williamr@2
|
333 |
@return Topic ID */
|
williamr@2
|
334 |
virtual TUint32 At(TInt aIndex) const = 0;
|
williamr@2
|
335 |
};
|
williamr@2
|
336 |
|
williamr@2
|
337 |
|
williamr@2
|
338 |
|
williamr@4
|
339 |
//
|
williamr@2
|
340 |
// ----> CHlpList
|
williamr@4
|
341 |
//
|
williamr@2
|
342 |
class CHlpList : public CBase, public MHlpTitleArray
|
williamr@2
|
343 |
/** A list of help items (CHlpItem objects).
|
williamr@2
|
344 |
@publishedAll
|
williamr@2
|
345 |
@released
|
williamr@2
|
346 |
*/
|
williamr@2
|
347 |
{
|
williamr@2
|
348 |
public: // Static construct / destruct
|
williamr@2
|
349 |
IMPORT_C static CHlpList* NewL();
|
williamr@2
|
350 |
IMPORT_C static CHlpList* NewLC();
|
williamr@2
|
351 |
IMPORT_C ~CHlpList();
|
williamr@2
|
352 |
|
williamr@2
|
353 |
public: // From MDesCArray
|
williamr@2
|
354 |
IMPORT_C TInt MdcaCount() const;
|
williamr@2
|
355 |
IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
|
williamr@2
|
356 |
|
williamr@2
|
357 |
public:
|
williamr@2
|
358 |
// 'At' returns topic Id, but this function is next to useless because you can't
|
williamr@2
|
359 |
// uniquely identify a help topic by topic id alone. You need to know 3 things:-
|
williamr@2
|
360 |
// a) topic id, 2) category id, 3) help file uid. This information is all
|
williamr@2
|
361 |
// encapsulated in CHlpItem so help app authors should use 'Item' instead.
|
williamr@2
|
362 |
IMPORT_C TUint32 At(TInt aIndex) const;
|
williamr@2
|
363 |
IMPORT_C CHlpItem* Item(TInt aIndex) const;
|
williamr@2
|
364 |
IMPORT_C TInt Find(TUint32 aId);
|
williamr@2
|
365 |
IMPORT_C void Reset();
|
williamr@2
|
366 |
IMPORT_C void AppendL(CHlpItem* aItem);
|
williamr@2
|
367 |
|
williamr@2
|
368 |
private: // 2nd phase constructor
|
williamr@2
|
369 |
void ConstructL();
|
williamr@2
|
370 |
|
williamr@2
|
371 |
private:
|
williamr@2
|
372 |
// This is the array of help items that were located as a result of
|
williamr@2
|
373 |
// performing a search.
|
williamr@2
|
374 |
CArrayPtr<CHlpItem>* iList;
|
williamr@2
|
375 |
};
|
williamr@2
|
376 |
|
williamr@2
|
377 |
|
williamr@2
|
378 |
|
williamr@4
|
379 |
//
|
williamr@2
|
380 |
// ----> CHlpTopic
|
williamr@4
|
381 |
//
|
williamr@2
|
382 |
class CHlpTopic : public CBase
|
williamr@2
|
383 |
/** Encapsulates a help topic.
|
williamr@2
|
384 |
|
williamr@2
|
385 |
A help topic has text, a title, a category, and paragraph and character formatting.
|
williamr@2
|
386 |
@publishedAll
|
williamr@2
|
387 |
@released
|
williamr@2
|
388 |
*/
|
williamr@2
|
389 |
{
|
williamr@2
|
390 |
public:
|
williamr@2
|
391 |
IMPORT_C static CHlpTopic* NewL();
|
williamr@2
|
392 |
IMPORT_C static CHlpTopic* NewLC();
|
williamr@2
|
393 |
IMPORT_C ~CHlpTopic();
|
williamr@2
|
394 |
|
williamr@2
|
395 |
public:
|
williamr@2
|
396 |
// This function will not behave as expected in the case where it is used to
|
williamr@2
|
397 |
// restore rich text that includes pictures. Instead, only the text and markup
|
williamr@2
|
398 |
// will be restored. Help App authors should use 'CHlpModel::LoadTopic' instead.
|
williamr@2
|
399 |
// I can't remove this as it would break S&BC.
|
williamr@2
|
400 |
IMPORT_C void RestoreL(RDbView* aView);
|
williamr@2
|
401 |
|
williamr@2
|
402 |
IMPORT_C CRichText* TopicText();
|
williamr@2
|
403 |
IMPORT_C TDesC& TopicTitle();
|
williamr@2
|
404 |
IMPORT_C TDesC& Category();
|
williamr@2
|
405 |
|
williamr@2
|
406 |
inline CParaFormatLayer* ParaFormatLayer() const
|
williamr@2
|
407 |
/** Gets the topic paragraph formatting.
|
williamr@2
|
408 |
|
williamr@2
|
409 |
@return Topic paragraph formatting */
|
williamr@2
|
410 |
{ return iGlobalParaFormatLayer; }
|
williamr@2
|
411 |
inline CCharFormatLayer* CharFormatLayer() const
|
williamr@2
|
412 |
/** Gets the topic character formatting.
|
williamr@2
|
413 |
|
williamr@2
|
414 |
@return Topic character formatting */
|
williamr@2
|
415 |
{ return iGlobalCharFormatLayer; }
|
williamr@2
|
416 |
|
williamr@2
|
417 |
private:
|
williamr@2
|
418 |
void ConstructL();
|
williamr@2
|
419 |
|
williamr@2
|
420 |
private:
|
williamr@2
|
421 |
friend class CHlpModel;
|
williamr@2
|
422 |
|
williamr@2
|
423 |
TUint32 iTopicId;
|
williamr@2
|
424 |
TBuf<KMaxTitleColumn> iTopicTitle;
|
williamr@2
|
425 |
TBuf<KMaxTitleColumn> iCategory;
|
williamr@2
|
426 |
|
williamr@2
|
427 |
CRichText* iTopicText;
|
williamr@2
|
428 |
CParaFormatLayer* iGlobalParaFormatLayer;
|
williamr@2
|
429 |
CCharFormatLayer* iGlobalCharFormatLayer;
|
williamr@2
|
430 |
};
|
williamr@2
|
431 |
|
williamr@2
|
432 |
|
williamr@2
|
433 |
|
williamr@2
|
434 |
|
williamr@4
|
435 |
//
|
williamr@2
|
436 |
// ----> CHlpModel
|
williamr@4
|
437 |
//
|
williamr@2
|
438 |
class CHlpModel : public CBase, public MHlpDbObserver, public MPictureFactory, public MRichTextStoreResolver
|
williamr@2
|
439 |
/** Help model interface.
|
williamr@2
|
440 |
|
williamr@2
|
441 |
It provides functions to search help files in various ways.
|
williamr@2
|
442 |
|
williamr@2
|
443 |
The interface implements MHlpDbObserver for help database events, and MRichTextStoreResolver
|
williamr@2
|
444 |
and MPictureFactory to obtain pictures from rich text stores.
|
williamr@2
|
445 |
@publishedAll
|
williamr@2
|
446 |
@released
|
williamr@2
|
447 |
*/
|
williamr@2
|
448 |
{
|
williamr@2
|
449 |
public: // Construct / destruct
|
williamr@2
|
450 |
IMPORT_C static CHlpModel* NewL(RFs& aFs, MHlpModelObserver* aObserver);
|
williamr@2
|
451 |
IMPORT_C static CHlpModel* NewLC(RFs& aFs, MHlpModelObserver* aObserver);
|
williamr@2
|
452 |
IMPORT_C ~CHlpModel();
|
williamr@2
|
453 |
|
williamr@2
|
454 |
public: // Opens all the help files in \System\Help
|
williamr@2
|
455 |
IMPORT_C void OpenL();
|
williamr@2
|
456 |
IMPORT_C void CloseL();
|
williamr@2
|
457 |
|
williamr@2
|
458 |
public: // Opens specific help files
|
williamr@2
|
459 |
IMPORT_C void OpenFileL(const TDesC& aFileName);
|
williamr@2
|
460 |
IMPORT_C void CloseFileL(const TDesC& aFileName);
|
williamr@2
|
461 |
|
williamr@2
|
462 |
public: // Specialized searching
|
williamr@2
|
463 |
IMPORT_C void ContextSearchL(TCoeHelpContext& aContext);
|
williamr@2
|
464 |
IMPORT_C void CategoryUIDSearchL(TUid aCategoryUID);
|
williamr@2
|
465 |
IMPORT_C void TopicSearchL(const CHlpItem& aHelpItem);
|
williamr@2
|
466 |
IMPORT_C void IndexSearchL(const CHlpItem& aHelpItem);
|
williamr@2
|
467 |
|
williamr@2
|
468 |
// Generic searching
|
williamr@2
|
469 |
IMPORT_C void SearchL(TInt aType, TUint32 aId);
|
williamr@2
|
470 |
IMPORT_C void SearchL(TInt aType, HBufC* aCriterion=NULL);
|
williamr@2
|
471 |
IMPORT_C void SearchL(TInt aType, const TDesC& aCriterion);
|
williamr@2
|
472 |
|
williamr@2
|
473 |
public: // Cancel EFullTextSearch types - will return KErrArgument if not the correct type
|
williamr@2
|
474 |
IMPORT_C TInt CancelSearch();
|
williamr@2
|
475 |
|
williamr@2
|
476 |
public: // Assumes that the search has already been performed and that the view is valid
|
williamr@2
|
477 |
IMPORT_C void LoadTopicL(CRichText& aRichText, TDes& aTitle);
|
williamr@2
|
478 |
IMPORT_C void LoadTopicL(CRichText& aRichText);
|
williamr@2
|
479 |
IMPORT_C void LoadTopicL(CHlpTopic* aTopic);
|
williamr@2
|
480 |
IMPORT_C void LoadListL(CHlpList* aList);
|
williamr@2
|
481 |
IMPORT_C void CategoryListL(CDesCArray* aList);
|
williamr@2
|
482 |
|
williamr@2
|
483 |
public:
|
williamr@2
|
484 |
IMPORT_C void SetZoomSizeL(THlpZoomState aState = EHlpZoomStateMedium);
|
williamr@2
|
485 |
IMPORT_C THlpZoomState ZoomSize() const;
|
williamr@2
|
486 |
IMPORT_C void SetZoomFactors(THlpZoomState aZoomState, TInt aFactor);
|
williamr@2
|
487 |
TInt CurrentZoomFactor() const;
|
williamr@2
|
488 |
void RemoveHelpPicture(CHlpPicture* aHelpPicture);
|
williamr@2
|
489 |
|
williamr@2
|
490 |
public: // FROM MPictureFactory
|
williamr@2
|
491 |
void NewPictureL(TPictureHeader& aHdr, const CStreamStore& aDeferredPictureStore) const;
|
williamr@2
|
492 |
|
williamr@2
|
493 |
public: // FROM MRichTextStoreResolver
|
williamr@2
|
494 |
IMPORT_C const CStreamStore& StreamStoreL(TInt aPos) const;
|
williamr@2
|
495 |
|
williamr@2
|
496 |
public:
|
williamr@2
|
497 |
// Check to see if any of the databases have matching meta data
|
williamr@2
|
498 |
IMPORT_C TInt MatchUidL(TUid aUid);
|
williamr@2
|
499 |
|
williamr@2
|
500 |
// Replace the current observer with another
|
williamr@2
|
501 |
IMPORT_C void SetObserver(MHlpModelObserver* aObserver);
|
williamr@2
|
502 |
|
williamr@2
|
503 |
public:
|
williamr@2
|
504 |
void NotifyHelpModelDestructionToPictures();
|
williamr@2
|
505 |
|
williamr@2
|
506 |
private: // Internal search API
|
williamr@2
|
507 |
void DoSearchL(TInt aType, const TDesC& aCriterion);
|
williamr@2
|
508 |
void DoNextSearchL();
|
williamr@2
|
509 |
void ResetReadyForSearch();
|
williamr@2
|
510 |
void ResetViews();
|
williamr@2
|
511 |
void SetCriterionL(const TDesC& aCriterion);
|
williamr@2
|
512 |
|
williamr@2
|
513 |
private: // Event management
|
williamr@2
|
514 |
void HandleDbEventL(TInt aEvent);
|
williamr@2
|
515 |
void ReportEventToObserverL(TInt aEvent);
|
williamr@2
|
516 |
|
williamr@2
|
517 |
private: // Misc internal functions
|
williamr@2
|
518 |
inline CHlpDatabase* CurrentDatabase() const;
|
williamr@2
|
519 |
inline TInt DatabaseCount() const;
|
williamr@2
|
520 |
inline void SetSearchType(TInt aSearchType);
|
williamr@2
|
521 |
inline TInt CurrentSearchType() const;
|
williamr@2
|
522 |
RDbView* CurrentView() const;
|
williamr@2
|
523 |
TBool DiskPresent(TInt aDrive) const;
|
williamr@2
|
524 |
CHlpFileList* BuildListForDriveLC(TDriveUnit aDrive, RFs& aFsSession) const;
|
williamr@2
|
525 |
static void ResetAndDestroyArrayOfCHlpFileEntry(TAny* aObject);
|
williamr@2
|
526 |
|
williamr@2
|
527 |
private:
|
williamr@2
|
528 |
CHlpModel(RFs& aFs, MHlpModelObserver& aObserver);
|
williamr@2
|
529 |
void ConstructL();
|
williamr@2
|
530 |
|
williamr@2
|
531 |
private: // Member data
|
williamr@2
|
532 |
RFs& iFsSession;
|
williamr@2
|
533 |
|
williamr@2
|
534 |
// This is required in order to restore rich text pictures from the database
|
williamr@2
|
535 |
CStreamStore* iCurrentRichTextStore;
|
williamr@2
|
536 |
|
williamr@2
|
537 |
// Creates our SQL string based upon the search type and criteria
|
williamr@2
|
538 |
CHlpSQLSearch* iSearch;
|
williamr@2
|
539 |
|
williamr@2
|
540 |
// An array of all the help files currently available
|
williamr@2
|
541 |
CHlpDatabases* iDatabases;
|
williamr@2
|
542 |
|
williamr@2
|
543 |
// Receives help model notifications as various actions are performed
|
williamr@2
|
544 |
MHlpModelObserver* iObserver;
|
williamr@2
|
545 |
|
williamr@2
|
546 |
// Were any matching results found for this search
|
williamr@2
|
547 |
TBool iFound;
|
williamr@2
|
548 |
|
williamr@2
|
549 |
// What was being searched for
|
williamr@2
|
550 |
HBufC* iCriterion;
|
williamr@2
|
551 |
|
williamr@2
|
552 |
// What type of search was being performed
|
williamr@2
|
553 |
TInt iSearchType;
|
williamr@2
|
554 |
|
williamr@2
|
555 |
// Which database are we currently searching
|
williamr@2
|
556 |
TInt iCurrentDb;
|
williamr@2
|
557 |
|
williamr@2
|
558 |
// Transient category Uid used when creating category lists
|
williamr@2
|
559 |
TUid iTransientCategoryUid;
|
williamr@2
|
560 |
|
williamr@2
|
561 |
// What zoom size is used
|
williamr@2
|
562 |
THlpZoomState iZoomSize;
|
williamr@2
|
563 |
|
williamr@2
|
564 |
// Array to hold the bitmaps that are currently used in the help rich text
|
williamr@2
|
565 |
CArrayPtr<CHlpPicture>* iPictures;
|
williamr@2
|
566 |
|
williamr@2
|
567 |
// Array to hold the zoom factors that correspond to each zoom size
|
williamr@2
|
568 |
CArrayFix<TInt>* iZoomFactors;
|
williamr@2
|
569 |
};
|
williamr@2
|
570 |
|
williamr@4
|
571 |
//
|
williamr@2
|
572 |
// ----> CHlpModel (inlines)
|
williamr@4
|
573 |
//
|
williamr@2
|
574 |
inline TInt CHlpModel::DatabaseCount() const
|
williamr@2
|
575 |
{
|
williamr@2
|
576 |
return iDatabases->Count();
|
williamr@2
|
577 |
}
|
williamr@2
|
578 |
inline void CHlpModel::SetSearchType(TInt aSearchType)
|
williamr@2
|
579 |
{
|
williamr@2
|
580 |
iSearchType = aSearchType;
|
williamr@2
|
581 |
}
|
williamr@2
|
582 |
inline CHlpDatabase* CHlpModel::CurrentDatabase() const
|
williamr@2
|
583 |
{
|
williamr@2
|
584 |
return iDatabases->At(iCurrentDb);
|
williamr@2
|
585 |
}
|
williamr@2
|
586 |
inline TInt CHlpModel::CurrentSearchType() const
|
williamr@2
|
587 |
{
|
williamr@2
|
588 |
return iSearchType;
|
williamr@2
|
589 |
}
|
williamr@2
|
590 |
|
williamr@2
|
591 |
|
williamr@2
|
592 |
|
williamr@2
|
593 |
#endif
|
williamr@4
|
594 |
|