symhelp/helpmodel/inc/HLPDB.H
changeset 0 1f04cf54edd8
equal deleted inserted replaced
-1:000000000000 0:1f04cf54edd8
       
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __HLPDB_H__
       
    17 #define __HLPDB_H__
       
    18 
       
    19 // System includes
       
    20 #include <e32std.h>
       
    21 #include <d32dbms.h>
       
    22 #include <s32file.h>
       
    23 #include <badesca.h>
       
    24 
       
    25 // User includes
       
    26 #include "hlpconstants.h"
       
    27 #include "HLPMODEL.H"
       
    28 
       
    29 // Classes referenced
       
    30 class CFbsBitmap;
       
    31 
       
    32 
       
    33 //
       
    34 // ----> CHlpDatabase  (container class for the help database)
       
    35 //
       
    36 class CHlpDatabase : public CBase
       
    37 	{
       
    38 public:
       
    39 	static CHlpDatabase* NewLC(RFs& aFs);
       
    40 	static CHlpDatabase* NewLC(RFs& aFs, const TDesC& aFileName);
       
    41 	~CHlpDatabase();
       
    42 
       
    43 public:
       
    44 	void OpenL(const TDesC& aFileName);
       
    45 	void Close();
       
    46 
       
    47 public: // new
       
    48 	void AppendCategoryListL(CDesCArray& aList);
       
    49 	TInt TopicIdSearchL(const TUid aCategoryUid, const TUint aTopicId);
       
    50 	TInt ContextSearchL(const TDesC& aContext);
       
    51 	CFbsBitmap* ImageForIdLC(TInt aImageId, THlpZoomState aZoomState);
       
    52 	TInt ImageCountForIdL(TInt iImageId);
       
    53 
       
    54 private:
       
    55 	inline void CloseView();
       
    56 
       
    57 public:
       
    58 	TBool MatchUidL(TUid aUid);
       
    59 	inline TInt ViewHasRecordsL() const;
       
    60 	inline RDbStoreDatabase& Database() const;
       
    61 	inline RDbView& View() const;
       
    62 	inline CStreamStore& StreamStore() const;
       
    63 	inline const TDesC& FileName() const;
       
    64 	inline void SetViewReady(TBool aReady);
       
    65 	inline TBool ViewReady() const;
       
    66 	inline TUid HelpFileUid() const;
       
    67 
       
    68 private:
       
    69 	CHlpDatabase(RFs& aFs);
       
    70 	void ConstructL();
       
    71 
       
    72 private:
       
    73 	TUid iHelpFileUid;
       
    74 	TFileName iFileName;
       
    75 	TBool iViewReady;
       
    76 
       
    77 	/**
       
    78 	* Identifies whether the help file being accessed
       
    79 	* is of the old format or not.
       
    80 	*/
       
    81 	TBool iOldHelpFileFormat;
       
    82 
       
    83 	RFs& iFs;
       
    84 	RDbView* iView;
       
    85 	RDbStoreDatabase*  iDatabase;
       
    86 	CArrayFixFlat<TUid>* iUids;
       
    87 	RDbTable iImageTable;
       
    88 
       
    89 	CPermanentFileStore* iStore;
       
    90 	};
       
    91 
       
    92 
       
    93 //
       
    94 // ----> CHlpDatabase (inlines)
       
    95 //
       
    96 inline TInt CHlpDatabase::ViewHasRecordsL() const
       
    97 	{
       
    98 	return iView->CountL();
       
    99 	}
       
   100 inline RDbStoreDatabase& CHlpDatabase::Database() const
       
   101 	{
       
   102 	return *iDatabase;
       
   103 	}
       
   104 inline RDbView& CHlpDatabase::View() const
       
   105 	{
       
   106 	return *iView;
       
   107 	}
       
   108 inline CStreamStore& CHlpDatabase::StreamStore() const
       
   109 	{
       
   110 	return *iStore;
       
   111 	}
       
   112 inline const TDesC& CHlpDatabase::FileName() const
       
   113 	{
       
   114 	return iFileName;
       
   115 	}
       
   116 inline void CHlpDatabase::SetViewReady(TBool aReady)
       
   117 	{
       
   118 	iViewReady = aReady;
       
   119 	}
       
   120 inline TBool CHlpDatabase::ViewReady() const
       
   121 	{
       
   122 	return iViewReady;
       
   123 	}
       
   124 inline void CHlpDatabase::CloseView()
       
   125 	{
       
   126 	View().Close();
       
   127 	}
       
   128 inline TUid CHlpDatabase::HelpFileUid() const
       
   129 	{
       
   130 	return iHelpFileUid;
       
   131 	}
       
   132 
       
   133 #endif