DirectPrint/DirectPrintApp/inc/directprintmodel.h
branchRCL_3
changeset 12 613a5ff70823
child 15 2275db202402
equal deleted inserted replaced
8:3f1fec088555 12:613a5ff70823
       
     1 /*
       
     2 * Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Kanrikogaku Kenkyusho, Ltd. - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * This model class for DirectPrint data managemrnt
       
    16 *
       
    17 */
       
    18 
       
    19 // Protection against nested includes
       
    20 #ifndef __DIRECTPRINTMODEL_H__
       
    21 #define __DIRECTPRINTMODEL_H__
       
    22 
       
    23 // System includes
       
    24 #include <e32base.h>
       
    25 #include <f32file.h>
       
    26 #include <prninf.h>
       
    27 
       
    28 // User includes
       
    29 #include "directprintprinterdata.h"
       
    30 #include "directprintbearerdata.h"
       
    31 #include "directprintpropertydata.h"
       
    32 #include "directprintproperty.h"
       
    33 
       
    34 // Forward declarations
       
    35 class CDirectPrintPrinterInfoReader;
       
    36 
       
    37 // Class declaration
       
    38 /**
       
    39  *  Model class
       
    40  *  more_complete_description
       
    41  */
       
    42 class CDirectPrintModel : public CBase
       
    43 	{
       
    44 public:
       
    45 	/** Constructors */
       
    46 	static CDirectPrintModel* NewL();
       
    47 	static CDirectPrintModel* NewLC();
       
    48 	/** Destructor */
       
    49 	~CDirectPrintModel();
       
    50 
       
    51 	/**
       
    52 	 * Initialize data.
       
    53 	 */
       
    54 	void InitializeDataL();
       
    55 	/**
       
    56 	 * Internalize data.
       
    57 	 */
       
    58 	void InternalizeDataL();
       
    59 	/**
       
    60 	 * Externalize data.
       
    61 	 */
       
    62 	void ExternalizeDataL();
       
    63 
       
    64 	/**
       
    65 	 * Get printer data.
       
    66 	 *
       
    67 	 * @param aIndex The index of data array.
       
    68 	 * @param aData printer data
       
    69 	 */
       
    70 	void GetPrinterDataL(TInt aIndex, TDirectPrintPrinterData& aData);
       
    71 	/**
       
    72 	 * Get bearer data.
       
    73 	 *
       
    74 	 * @param aIndex The index of data array.
       
    75 	 * @param aData bearer data
       
    76 	 */
       
    77 	void GetBearerDataL(TInt aIndex, TDirectPrintBearerData& aData);
       
    78 	/**
       
    79 	 * Get current bearer data.
       
    80 	 *
       
    81 	 * @param aData bearer data
       
    82 	 */
       
    83 	void GetCurrentBearerDataL(TDirectPrintBearerData& aData);
       
    84 	/**
       
    85 	 * Get selected bearer data.
       
    86 	 *
       
    87 	 * @param aData bearer data
       
    88 	 */
       
    89 	void GetSelectedBearerDataL(TDirectPrintBearerData& aData);
       
    90 	/**
       
    91 	 * Get property data.
       
    92 	 *
       
    93 	 * @param aIndex The index of data array.
       
    94 	 * @return property data
       
    95 	 */
       
    96 	CPrinterProperty* GetPrinterPropertyL(TInt aIndex);
       
    97 	/**
       
    98 	 * Get current property data.
       
    99 	 *
       
   100 	 * @param aAppUid Application UID.
       
   101 	 * @return property data
       
   102 	 */
       
   103 	CPrinterProperty* GetCurrentPrinterPropertyL(TUid aAppUid);
       
   104 	/**
       
   105 	 * Get the id of current printer data.
       
   106 	 *
       
   107 	 * @return The id of printer data
       
   108 	 */
       
   109 	TInt GetCurrentPrinterIdL();
       
   110 	/**
       
   111 	 * Get the index of current printer data.
       
   112 	 *
       
   113 	 * @return The index of data array.
       
   114 	 */
       
   115 	TInt CurrentPrinter();
       
   116 	/**
       
   117 	 * Get the index of current bearer data.
       
   118 	 *
       
   119 	 * @return The index of data array.
       
   120 	 */
       
   121 	TInt CurrentBearer();
       
   122 	/**
       
   123 	 * Get the index of current property data.
       
   124 	 *
       
   125 	 * @return The index of data array.
       
   126 	 */
       
   127 	TInt CurrentProperty();
       
   128 	/**
       
   129 	 * Get the index of selected printer data.
       
   130 	 *
       
   131 	 * @return The index of data array.
       
   132 	 */
       
   133 	TInt SelectPrinter();
       
   134 	/**
       
   135 	 * Get the count of printer data.
       
   136 	 *
       
   137 	 * @return The count of data.
       
   138 	 */
       
   139 	TInt PrinterCount();
       
   140 	/**
       
   141 	 * Get the count of bearer data.
       
   142 	 *
       
   143 	 * @return The count of data.
       
   144 	 */
       
   145 	TInt BearerCount();
       
   146 	/**
       
   147 	 * Get the count of property data.
       
   148 	 *
       
   149 	 * @return The count of data.
       
   150 	 */
       
   151 	TInt PropertyCount();
       
   152 
       
   153 	/**
       
   154 	 * Set printer data.
       
   155 	 *
       
   156 	 * @param aIndex The index of data array.
       
   157 	 * @param aData printer data
       
   158 	 */
       
   159 	void SetPrinterDataL(TInt aIndex, const TDirectPrintPrinterData& aData);
       
   160 	/**
       
   161 	 * Set printer data.
       
   162 	 *
       
   163 	 * @param aData printer data
       
   164 	 */
       
   165 	void SetPrinterDataL(const TDirectPrintPrinterData& aData);
       
   166 	/**
       
   167 	 * Set bearer data.
       
   168 	 *
       
   169 	 * @param aIndex The index of data array.
       
   170 	 * @param aData bearer data
       
   171 	 */
       
   172 	void SetBearerDataL(TInt aIndex, const TDirectPrintBearerData& aData);
       
   173 	/**
       
   174 	 * Set bearer data.
       
   175 	 *
       
   176 	 * @param aData bearer data
       
   177 	 */
       
   178 	void SetBearerDataL(const TDirectPrintBearerData& aData);
       
   179 	/**
       
   180 	 * Set property data.
       
   181 	 *
       
   182 	 * @param aIndex The index of data array.
       
   183 	 * @param aProperty property data
       
   184 	 */
       
   185 	void SetPrinterPropertyL(TInt aIndex, CPrinterProperty* aProperty);
       
   186 	/**
       
   187 	 * Set property data.
       
   188 	 *
       
   189 	 * @param aProperty property data
       
   190 	 */
       
   191 	void SetPrinterPropertyL(CPrinterProperty* aProperty);
       
   192 	/**
       
   193 	 * Set the index of current printer data.
       
   194 	 *
       
   195 	 * @param aIndex The index of data array.
       
   196 	 */
       
   197 	void SetCurrentPrinter(TInt aIndex);
       
   198 	/**
       
   199 	 * Set the index of current bearer data.
       
   200 	 *
       
   201 	 * @param aIndex The index of data array.
       
   202 	 */
       
   203 	void SetCurrentBearer(TInt aIndex);
       
   204 	/**
       
   205 	 * Set the index of current property data.
       
   206 	 *
       
   207 	 * @param aIndex The index of data array.
       
   208 	 */
       
   209 	void SetCurrentProperty(TInt aIndex);
       
   210 	/**
       
   211 	 * Set the index of selected printer data.
       
   212 	 *
       
   213 	 * @param aIndex The index of data array.
       
   214 	 */
       
   215 	void SetSelectPrinter(TInt aIndex);
       
   216 
       
   217 	/**
       
   218 	 * Add printer data.
       
   219 	 *
       
   220 	 * @param aData printer data
       
   221 	 */
       
   222 	void AddPrinterDataL(const TDirectPrintPrinterData& aData);
       
   223 	/**
       
   224 	 * Add bearer data.
       
   225 	 *
       
   226 	 * @param aData bearer data
       
   227 	 */
       
   228 	void AddBearerDataL(const TDirectPrintBearerData& aData);
       
   229 	/**
       
   230 	 * Add property data.
       
   231 	 *
       
   232 	 * @param aProperty property data
       
   233 	 */
       
   234 	void AddPrinterPropertyL(CPrinterProperty* aProperty);
       
   235 
       
   236 	/**
       
   237 	 * Remove printer data from data array.
       
   238 	 *
       
   239 	 * @param aIndex The index of data array.
       
   240 	 */
       
   241 	void RemovePrinterDataL(TInt aIndex);
       
   242 	/**
       
   243 	 * Remove bearer data from data array.
       
   244 	 *
       
   245 	 * @param aIndex The index of data array.
       
   246 	 */
       
   247 	void RemoveBearerDataL(TInt aIndex);
       
   248 	/**
       
   249 	 * Remove property data from data array.
       
   250 	 *
       
   251 	 * @param aIndex The index of data array.
       
   252 	 */
       
   253 	void RemovePrinterPropertyL(TInt aIndex);
       
   254 
       
   255 	/**
       
   256 	 * Move printer data to top of data array.
       
   257 	 *
       
   258 	 * @param aIndex The index of data array.
       
   259 	 */
       
   260 	void MoveTopPrinterDataL(TInt aIndex);
       
   261 
       
   262 	/**
       
   263 	 * Get new data flag.
       
   264 	 *
       
   265 	 * @return new data flag.
       
   266 	 */
       
   267 	inline TBool IsNewData() {return iIsNewData;};
       
   268 	/**
       
   269 	 * Set new data flag.
       
   270 	 *
       
   271 	 * @param aFlag new data flag.
       
   272 	 */
       
   273 	inline void SetIsNewData(TBool aFlag) {iIsNewData = aFlag;};
       
   274 	/**
       
   275 	 * Generate new printer id.
       
   276 	 *
       
   277 	 * @return new data flag.
       
   278 	 */
       
   279 	inline TInt NewPrinterId() {return ++iMaxPrinterId;};
       
   280 
       
   281 	/**
       
   282 	 * Get uid of plugin.
       
   283 	 *
       
   284 	 * @return uid of plugin.
       
   285 	 */
       
   286 	TUid SettingUIPluginUidL();
       
   287 
       
   288 protected:
       
   289 	CDirectPrintModel();
       
   290 	void ConstructL();
       
   291 
       
   292 private:
       
   293 	/** File server session. */
       
   294 	RFs iFs;
       
   295 
       
   296 	/** Printer data Array. */
       
   297 	RDPPrinterDataArray iPrinters;
       
   298 	/** Bearer data Array. */
       
   299 	RDPBearerDataArray iBearers;
       
   300 	/** Property data Array. */
       
   301 	RPrinterPropertyArray iProperties;
       
   302 	/** The index of current printer data. */
       
   303 	TInt iCurrentPrinter;
       
   304 	/** The index of current bearer datay. */
       
   305 	TInt iCurrentBearer;
       
   306 	/** The index of current property data. */
       
   307 	TInt iCurrentProperty;
       
   308 	/** The index of selected printer data. */
       
   309 	TInt iSelectPrinter;
       
   310 
       
   311 	/** New data flag. */
       
   312 	TBool iIsNewData;
       
   313 	/** Printer id. */
       
   314 	TInt iMaxPrinterId;
       
   315 
       
   316 	CDirectPrintPrinterInfoReader* iPrinterInfoReader;
       
   317 	};
       
   318 
       
   319 #endif // __DIRECTPRINTMODEL_H__