mds_pub/content_listing_framework_api/inc/MCLFSortingStyle.h
changeset 0 c53acadfccc6
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MCLFSORTINGSTYLE_H
       
    20 #define MCLFSORTINGSTYLE_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <CLFContentListing.hrh>
       
    24 #include <CLFContentListing.h>
       
    25 #include <e32std.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class MCLFSortingStyleExt;
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    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
       
    36 *  list model.<br><br>
       
    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.
       
    45 *  <br><br>
       
    46 *  Usage:
       
    47 *  @code
       
    48 *  // Create a sorting style instance
       
    49 *  MCLFSortingStyle* sortingStyle = ContentListingFactory::NewSortingStyleLC();
       
    50 *
       
    51 *  // Set sort ordering
       
    52 *  sortingStyle->SetOrdering( ECLFOrderingDescending );
       
    53 *
       
    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 );
       
    57 *
       
    58 *  // All sorting style parameter fields are string type
       
    59 *  sortingStyle->SetSortingDataType( ECLFItemDataTypeDesC );
       
    60 *
       
    61 *  // Set default sorting parameter
       
    62 *  sortingStyle->AddFieldL( ECLFFieldIdSongName );
       
    63 *
       
    64 *  // Set secondary sorting parameter
       
    65 *  sortingStyle->AddFieldL( ECLFFieldIdFileName );
       
    66 *
       
    67 *  // If item doesn't have ECLFFieldIdSongName field then
       
    68 *  // ECLFFieldIdFileName field is used to sort item.
       
    69 *  @endcode
       
    70 *
       
    71 *  @lib ContentListingFramework.lib
       
    72 *  @since S60 3.1
       
    73 */
       
    74 class MCLFSortingStyle
       
    75     {
       
    76     public:  // Destructor
       
    77 
       
    78         /**
       
    79         * Destructor.
       
    80         */
       
    81         virtual ~MCLFSortingStyle() {}
       
    82 
       
    83     public: // New functions
       
    84 
       
    85         /**
       
    86         * Reset settings of the sorting style to default.
       
    87         * @since S60 3.1
       
    88         */
       
    89         virtual void ResetL() = 0;
       
    90 
       
    91         /**
       
    92         * Set sort ordering. Ordering can be ascending or descending. See
       
    93         * TCLFSortingStyleOrdering
       
    94         * @since S60 3.1
       
    95         * @param aOrdering Sort ordering to be set
       
    96         */
       
    97         virtual void SetOrdering( TCLFSortingStyleOrdering aOrdering ) = 0;
       
    98 
       
    99         /**
       
   100         * Get current sort ordering of the sorting style.
       
   101         * @since S60 3.1
       
   102         * @return Current sort ordering
       
   103         */
       
   104         virtual TCLFSortingStyleOrdering Ordering() const = 0;
       
   105 
       
   106         /**
       
   107         * Set data type of sorting parameter fields. Data type can be text,
       
   108         * time or number. See TCLFItemDataType
       
   109         * @since S60 3.1
       
   110         * @param aDataType Data type to be set
       
   111         */
       
   112         virtual void SetSortingDataType( TCLFItemDataType aDataType ) = 0;
       
   113 
       
   114         /**
       
   115         * Get current sorting data type of fields.
       
   116         * @since S60 3.1
       
   117         * @return Current data type sorting of sorting fields
       
   118         */
       
   119         virtual TCLFItemDataType SortingDataType() const = 0;
       
   120 
       
   121         /**
       
   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
       
   125         * @since S60 3.1
       
   126         * @param aUndefinedItemPosition Position for undefiened items
       
   127         */
       
   128         virtual void SetUndefinedItemPosition(
       
   129                     TCLFUndefinedItemPosition aUndefinedItemPosition ) = 0;
       
   130 
       
   131         /**
       
   132         * Get current position of undefined items.
       
   133         * @since S60 3.1
       
   134         * @return Current position for undefined items
       
   135         */
       
   136         virtual TCLFUndefinedItemPosition UndefinedItemPosition() const = 0;
       
   137 
       
   138         /**
       
   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
       
   143         * @since S60 3.1
       
   144         * @param aFieldId Id of the sorting parameter field
       
   145         */
       
   146         virtual void AddFieldL( TCLFFieldId aFieldId ) = 0;
       
   147 
       
   148         /**
       
   149         * Get IDs of fields that have been set to the sorting style.
       
   150         * @since S60 3.1
       
   151         * @param aArray Array of field IDs
       
   152         */
       
   153         virtual void GetFieldsL( RArray<TCLFFieldId>& aArray ) const = 0;
       
   154 
       
   155     private: // Extension interface
       
   156 
       
   157         virtual MCLFSortingStyleExt* Extension() { return NULL; }
       
   158 
       
   159     };
       
   160 
       
   161 #endif      // MCLFSORTINGSTYLE_H
       
   162 
       
   163 // End of File