2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #ifndef MCLFSORTINGSTYLE_H
20 #define MCLFSORTINGSTYLE_H
23 #include <CLFContentListing.hrh>
24 #include <CLFContentListing.h>
27 // FORWARD DECLARATIONS
28 class MCLFSortingStyleExt;
33 * Sorting style for Content Listing Framework.
34 * This class can be used to define primary and secondary sorting styles for
35 * Content Listing Framework list model. Sorting styles are used to sort the
37 * Secondary sorting style is used to sort items that could not be sorted by
38 * the primary sorting style. In other words, items that do not have the
39 * field defined by primary or any previous secondary sorting style, the items
40 * are sorted using the next secondary sorting style. When a secondary sorting
41 * style is appended, it becomes the least significant sorting style until a
42 * new one is added after it. Items with undefined fields are placed before or
43 * after items with defined fields, depending on the undefined field position
44 * setting in MCLFSortingStyle.
48 * // Create a sorting style instance
49 * MCLFSortingStyle* sortingStyle = ContentListingFactory::NewSortingStyleLC();
51 * // Set sort ordering
52 * sortingStyle->SetOrdering( ECLFOrderingDescending );
54 * // Set undefied item position. Undefined items are items that doesn't
55 * // have field that is defined in sorting style fields
56 * sortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
58 * // All sorting style parameter fields are string type
59 * sortingStyle->SetSortingDataType( ECLFItemDataTypeDesC );
61 * // Set default sorting parameter
62 * sortingStyle->AddFieldL( ECLFFieldIdSongName );
64 * // Set secondary sorting parameter
65 * sortingStyle->AddFieldL( ECLFFieldIdFileName );
67 * // If item doesn't have ECLFFieldIdSongName field then
68 * // ECLFFieldIdFileName field is used to sort item.
71 * @lib ContentListingFramework.lib
74 class MCLFSortingStyle
81 virtual ~MCLFSortingStyle() {}
83 public: // New functions
86 * Reset settings of the sorting style to default.
89 virtual void ResetL() = 0;
92 * Set sort ordering. Ordering can be ascending or descending. See
93 * TCLFSortingStyleOrdering
95 * @param aOrdering Sort ordering to be set
97 virtual void SetOrdering( TCLFSortingStyleOrdering aOrdering ) = 0;
100 * Get current sort ordering of the sorting style.
102 * @return Current sort ordering
104 virtual TCLFSortingStyleOrdering Ordering() const = 0;
107 * Set data type of sorting parameter fields. Data type can be text,
108 * time or number. See TCLFItemDataType
110 * @param aDataType Data type to be set
112 virtual void SetSortingDataType( TCLFItemDataType aDataType ) = 0;
115 * Get current sorting data type of fields.
117 * @return Current data type sorting of sorting fields
119 virtual TCLFItemDataType SortingDataType() const = 0;
122 * Set undefined item position. Items not having information for defined
123 * sorting parameter fields are placed to top or bottom of the model. See
124 * TCLFUndefinedItemPosition
126 * @param aUndefinedItemPosition Position for undefiened items
128 virtual void SetUndefinedItemPosition(
129 TCLFUndefinedItemPosition aUndefinedItemPosition ) = 0;
132 * Get current position of undefined items.
134 * @return Current position for undefined items
136 virtual TCLFUndefinedItemPosition UndefinedItemPosition() const = 0;
139 * Add new field to the sorting style. First added field will be the
140 * default field. Remember to set type of field(s) with
141 * SetSortingDataType. Fields that are some other type will be ignored.
142 * See TCLFDefaultFieldId in CLFContentListing.hrh
144 * @param aFieldId Id of the sorting parameter field
146 virtual void AddFieldL( TCLFFieldId aFieldId ) = 0;
149 * Get IDs of fields that have been set to the sorting style.
151 * @param aArray Array of field IDs
153 virtual void GetFieldsL( RArray<TCLFFieldId>& aArray ) const = 0;
155 private: // Extension interface
157 virtual MCLFSortingStyleExt* Extension() { return NULL; }
161 #endif // MCLFSORTINGSTYLE_H