williamr@2: /* williamr@2: * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef MCLFSORTINGSTYLE_H williamr@2: #define MCLFSORTINGSTYLE_H williamr@2: williamr@2: // INCLUDES williamr@2: #include <CLFContentListing.hrh> williamr@2: #include <CLFContentListing.h> williamr@2: #include <e32std.h> williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class MCLFSortingStyleExt; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * Sorting style for Content Listing Framework. williamr@2: * This class can be used to define primary and secondary sorting styles for williamr@2: * Content Listing Framework list model. Sorting styles are used to sort the williamr@2: * list model.<br><br> williamr@2: * Secondary sorting style is used to sort items that could not be sorted by williamr@2: * the primary sorting style. In other words, items that do not have the williamr@2: * field defined by primary or any previous secondary sorting style, the items williamr@2: * are sorted using the next secondary sorting style. When a secondary sorting williamr@2: * style is appended, it becomes the least significant sorting style until a williamr@2: * new one is added after it. Items with undefined fields are placed before or williamr@2: * after items with defined fields, depending on the undefined field position williamr@2: * setting in MCLFSortingStyle. williamr@2: * <br><br> williamr@2: * Usage: williamr@2: * @code williamr@2: * // Create a sorting style instance williamr@2: * MCLFSortingStyle* sortingStyle = ContentListingFactory::NewSortingStyleLC(); williamr@2: * williamr@2: * // Set sort ordering williamr@2: * sortingStyle->SetOrdering( ECLFOrderingDescending ); williamr@2: * williamr@2: * // Set undefied item position. Undefined items are items that doesn't williamr@2: * // have field that is defined in sorting style fields williamr@2: * sortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd ); williamr@2: * williamr@2: * // All sorting style parameter fields are string type williamr@2: * sortingStyle->SetSortingDataType( ECLFItemDataTypeDesC ); williamr@2: * williamr@2: * // Set default sorting parameter williamr@2: * sortingStyle->AddFieldL( ECLFFieldIdSongName ); williamr@2: * williamr@2: * // Set secondary sorting parameter williamr@2: * sortingStyle->AddFieldL( ECLFFieldIdFileName ); williamr@2: * williamr@2: * // If item doesn't have ECLFFieldIdSongName field then williamr@2: * // ECLFFieldIdFileName field is used to sort item. williamr@2: * @endcode williamr@2: * williamr@2: * @lib ContentListingFramework.lib williamr@2: * @since S60 3.1 williamr@2: */ williamr@2: class MCLFSortingStyle williamr@2: { williamr@2: public: // Destructor williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: virtual ~MCLFSortingStyle() {} williamr@2: williamr@2: public: // New functions williamr@2: williamr@2: /** williamr@2: * Reset settings of the sorting style to default. williamr@2: * @since S60 3.1 williamr@2: */ williamr@2: virtual void ResetL() = 0; williamr@2: williamr@2: /** williamr@2: * Set sort ordering. Ordering can be ascending or descending. See williamr@2: * TCLFSortingStyleOrdering williamr@2: * @since S60 3.1 williamr@2: * @param aOrdering Sort ordering to be set williamr@2: */ williamr@2: virtual void SetOrdering( TCLFSortingStyleOrdering aOrdering ) = 0; williamr@2: williamr@2: /** williamr@2: * Get current sort ordering of the sorting style. williamr@2: * @since S60 3.1 williamr@2: * @return Current sort ordering williamr@2: */ williamr@2: virtual TCLFSortingStyleOrdering Ordering() const = 0; williamr@2: williamr@2: /** williamr@2: * Set data type of sorting parameter fields. Data type can be text, williamr@2: * time or number. See TCLFItemDataType williamr@2: * @since S60 3.1 williamr@2: * @param aDataType Data type to be set williamr@2: */ williamr@2: virtual void SetSortingDataType( TCLFItemDataType aDataType ) = 0; williamr@2: williamr@2: /** williamr@2: * Get current sorting data type of fields. williamr@2: * @since S60 3.1 williamr@2: * @return Current data type sorting of sorting fields williamr@2: */ williamr@2: virtual TCLFItemDataType SortingDataType() const = 0; williamr@2: williamr@2: /** williamr@2: * Set undefined item position. Items not having information for defined williamr@2: * sorting parameter fields are placed to top or bottom of the model. See williamr@2: * TCLFUndefinedItemPosition williamr@2: * @since S60 3.1 williamr@2: * @param aUndefinedItemPosition Position for undefiened items williamr@2: */ williamr@2: virtual void SetUndefinedItemPosition( williamr@2: TCLFUndefinedItemPosition aUndefinedItemPosition ) = 0; williamr@2: williamr@2: /** williamr@2: * Get current position of undefined items. williamr@2: * @since S60 3.1 williamr@2: * @return Current position for undefined items williamr@2: */ williamr@2: virtual TCLFUndefinedItemPosition UndefinedItemPosition() const = 0; williamr@2: williamr@2: /** williamr@2: * Add new field to the sorting style. First added field will be the williamr@2: * default field. Remember to set type of field(s) with williamr@2: * SetSortingDataType. Fields that are some other type will be ignored. williamr@2: * See TCLFDefaultFieldId in CLFContentListing.hrh williamr@2: * @since S60 3.1 williamr@2: * @param aFieldId Id of the sorting parameter field williamr@2: */ williamr@2: virtual void AddFieldL( TCLFFieldId aFieldId ) = 0; williamr@2: williamr@2: /** williamr@2: * Get IDs of fields that have been set to the sorting style. williamr@2: * @since S60 3.1 williamr@2: * @param aArray Array of field IDs williamr@2: */ williamr@2: virtual void GetFieldsL( RArray<TCLFFieldId>& aArray ) const = 0; williamr@2: williamr@2: private: // Extension interface williamr@2: williamr@2: virtual MCLFSortingStyleExt* Extension() { return NULL; } williamr@2: williamr@2: }; williamr@2: williamr@2: #endif // MCLFSORTINGSTYLE_H williamr@2: williamr@2: // End of File