epoc32/include/app/MPbk2ContactNameFormatter.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
/*
williamr@4
     2
* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     3
* All rights reserved.
williamr@4
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@4
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     8
*
williamr@4
     9
* Initial Contributors:
williamr@4
    10
* Nokia Corporation - initial contribution.
williamr@4
    11
*
williamr@4
    12
* Contributors:
williamr@4
    13
*
williamr@4
    14
* Description:  Phonebook 2 contact name formatter interface.
williamr@4
    15
*
williamr@4
    16
*/
williamr@4
    17
williamr@4
    18
williamr@4
    19
#ifndef MPBK2CONTACTNAMEFORMATTER_H
williamr@4
    20
#define MPBK2CONTACTNAMEFORMATTER_H
williamr@4
    21
williamr@4
    22
// INCLUDE FILES
williamr@4
    23
#include <e32std.h>
williamr@4
    24
williamr@4
    25
// FORWARD DECLARATIONS
williamr@4
    26
class MVPbkBaseContactFieldCollection;
williamr@4
    27
class MVPbkFieldType;
williamr@4
    28
class MVPbkFieldTypeList;
williamr@4
    29
class CVPbkFieldTypeRefsList;
williamr@4
    30
class MVPbkBaseContactField;
williamr@4
    31
class CVPbkBaseContactFieldTypeListIterator;
williamr@4
    32
williamr@4
    33
//Use this UID to access field property interface extension 2. Used as
williamr@4
    34
//a parameter to ContactNameFormatterExtension() method.
williamr@4
    35
const TUid MPbk2ContactNameFormatterExtension2Uid = { 2 };
williamr@4
    36
/**
williamr@4
    37
 * Abstract Phonebook 2 contact name formatter interface.
williamr@4
    38
 */
williamr@4
    39
class MPbk2ContactNameFormatter
williamr@4
    40
    {
williamr@4
    41
    public: // Interface
williamr@4
    42
williamr@4
    43
        /// Flags
williamr@4
    44
        enum TPbk2ContactTitleFormattingFlags
williamr@4
    45
            {
williamr@4
    46
            /// Formatter preserves all leading spaces
williamr@4
    47
            /// in the formatted title
williamr@4
    48
            EPreserveLeadingSpaces      = 0x0001,
williamr@4
    49
            /// Formatter uses custom separator
williamr@4
    50
            /// for separating firstname and lastname
williamr@4
    51
            EUseSeparator               = 0x0002,
williamr@4
    52
            /// Formatter replaces all non-graphical
williamr@4
    53
            /// characters with space character
williamr@4
    54
            EReplaceNonGraphicChars     = 0x0004,
williamr@4
    55
            /// Formatter to retain all original space characters
williamr@4
    56
            EPreserveAllOriginalSpaces  = 0x0008
williamr@4
    57
            };
williamr@4
    58
williamr@4
    59
        /**
williamr@4
    60
         * Destructor.
williamr@4
    61
         */
williamr@4
    62
        virtual ~MPbk2ContactNameFormatter()
williamr@4
    63
                {}
williamr@4
    64
williamr@4
    65
        /**
williamr@4
    66
         * Returns the title text for a contact.
williamr@4
    67
         *
williamr@4
    68
         * @param aContactFields    Field collection representing
williamr@4
    69
         *                          the data in a contact.
williamr@4
    70
         * @param aFormattingFlags  @see TPbk2ContactTitleFormattingFlags
williamr@4
    71
         * @return  A buffer containing the formatted title,
williamr@4
    72
         *          NULL if no title can be created.
williamr@4
    73
         */
williamr@4
    74
        virtual HBufC* GetContactTitleOrNullL(
williamr@4
    75
                const MVPbkBaseContactFieldCollection& aContactFields,
williamr@4
    76
                TUint32 aFormattingFlags ) = 0;
williamr@4
    77
williamr@4
    78
        /**
williamr@4
    79
         * Returns the title text for a contact.
williamr@4
    80
         *
williamr@4
    81
         * @param aContactFields    Field collection representing
williamr@4
    82
         *                          the data in a contact.
williamr@4
    83
         * @param aFormattingFlags Formatting flags, 
williamr@4
    84
         *                         see TPbk2ContactTitleFormattingFlags.
williamr@4
    85
         * @return  A buffer containing the formatted title,
williamr@4
    86
         *          or the UnnamedText() method's result if no title 
williamr@4
    87
         *          can be created.
williamr@4
    88
         */
williamr@4
    89
        virtual HBufC* GetContactTitleL(
williamr@4
    90
                const MVPbkBaseContactFieldCollection& aContactFields,
williamr@4
    91
                TUint32 aFormattingFlags ) = 0;
williamr@4
    92
williamr@4
    93
        /**
williamr@4
    94
         * Returns the title text for a contact.
williamr@4
    95
         *
williamr@4
    96
         * @param aContactFields    Field collection representing
williamr@4
    97
         *                          the data in a contact.
williamr@4
    98
         * @param aTitle            Buffer containing the formatted title.
williamr@4
    99
         * @param aFormattingFlags  @see TPbk2ContactTitleFormattingFlags
williamr@4
   100
         */
williamr@4
   101
        virtual void GetContactTitle(
williamr@4
   102
                const MVPbkBaseContactFieldCollection& aContactFields,
williamr@4
   103
                TDes& aTitle,
williamr@4
   104
                TUint32 aFormattingFlags ) = 0;
williamr@4
   105
williamr@4
   106
        /**
williamr@4
   107
         * Returns the title text for a contact. Unlike GetContactTitle,
williamr@4
   108
         * this method will build the title using all the possible fields
williamr@4
   109
         * (not restricting the field count). Should not be used for
williamr@4
   110
         * regular name formatting needs.
williamr@4
   111
         *
williamr@4
   112
         * @param aContactFields    Field collection representing
williamr@4
   113
         *                          the data in a contact.
williamr@4
   114
         * @param aTitle            Buffer containing the formatted title.
williamr@4
   115
         * @param aFormattingFlags  @see TPbk2ContactTitleFormattingFlags
williamr@4
   116
         */
williamr@4
   117
        virtual void GetContactTitleForFind(
williamr@4
   118
                const MVPbkBaseContactFieldCollection& aContactFields,
williamr@4
   119
                TDes& aTitle,
williamr@4
   120
                TUint32 aFormattingFlags ) = 0;
williamr@4
   121
williamr@4
   122
        /**
williamr@4
   123
         * Returns the name text to be used for unnamed contacts.
williamr@4
   124
         *
williamr@4
   125
         * @return  Text used with unnamed contacts.
williamr@4
   126
         */
williamr@4
   127
        virtual const TDesC& UnnamedText() const = 0;
williamr@4
   128
williamr@4
   129
        /**
williamr@4
   130
         * Returns ETrue if the given field is part of the fields used to
williamr@4
   131
         * build the contact title.
williamr@4
   132
         *
williamr@4
   133
         * @param aContactField     The contact field to inspect.
williamr@4
   134
         * @return  ETrue if the given field is used when building
williamr@4
   135
         *          contact titles.
williamr@4
   136
         */
williamr@4
   137
        virtual TBool IsTitleField(
williamr@4
   138
                const MVPbkBaseContactField& aContactField ) const = 0;
williamr@4
   139
williamr@4
   140
        /**
williamr@4
   141
         * Returns ETrue if the given field is part of the fields used to
williamr@4
   142
         * build the contact title.
williamr@4
   143
         *
williamr@4
   144
         * @param aFieldType    Type of the field to inspect.
williamr@4
   145
         * @return  ETrue if the given field type is used when
williamr@4
   146
         *          building contact titles.
williamr@4
   147
         */
williamr@4
   148
        virtual TBool IsTitleFieldType(
williamr@4
   149
                const MVPbkFieldType& aFieldType ) const = 0;
williamr@4
   150
williamr@4
   151
        /**
williamr@4
   152
         * Return iterator that contains all fields that are used for making
williamr@4
   153
         * the formatted name.
williamr@4
   154
         *
williamr@4
   155
         * @param   aFieldTypeList  Field type list that is used to store
williamr@4
   156
         *                          field types for the iterator. The list
williamr@4
   157
         *                          will be resetted before use.
williamr@4
   158
         * @param   aContactFields  Field collection representing
williamr@4
   159
         *                          the data in a contact.
williamr@4
   160
         * @return  Iterator for fields that are used for the formated title.
williamr@4
   161
         */
williamr@4
   162
        virtual CVPbkBaseContactFieldTypeListIterator* ActualTitleFieldsLC(
williamr@4
   163
                CVPbkFieldTypeRefsList& aFieldTypeList,
williamr@4
   164
                const MVPbkBaseContactFieldCollection& aContactFields ) = 0;
williamr@4
   165
williamr@4
   166
        /**
williamr@4
   167
         * Returns the length of the formatted name.
williamr@4
   168
         *
williamr@4
   169
         * @param aContactFields    Field collection representing
williamr@4
   170
         *                          the data in a contact.
williamr@4
   171
         * @param aFormattingFlags  @see TPbk2ContactTitleFormattingFlags
williamr@4
   172
         * @return  Length of the formatted name.
williamr@4
   173
         */
williamr@4
   174
        virtual TInt MaxTitleLength(
williamr@4
   175
                const MVPbkBaseContactFieldCollection& aContactFields,
williamr@4
   176
                const TUint32 aFormattingFlags ) = 0;
williamr@4
   177
williamr@4
   178
        /**
williamr@4
   179
         * Returns the length of the formatted name. Unlike MaxTitleLength,
williamr@4
   180
         * this method will count the length using all the possible fields
williamr@4
   181
         * (not restricting the field count). Should not be used for
williamr@4
   182
         * regular name formatting needs.
williamr@4
   183
         *
williamr@4
   184
         * @param aContactFields    Field collection representing
williamr@4
   185
         *                          the data in a contact.
williamr@4
   186
         * @param aFormattingFlags  @see TPbk2ContactTitleFormattingFlags
williamr@4
   187
         * @return  Length of the formatted name.
williamr@4
   188
         */
williamr@4
   189
        virtual TInt MaxTitleLengthForFind(
williamr@4
   190
                const MVPbkBaseContactFieldCollection& aContactFields,
williamr@4
   191
                const TUint32 aFormattingFlags ) = 0;
williamr@4
   192
williamr@4
   193
        /**
williamr@4
   194
         * Checks whether the given character is a separator character.
williamr@4
   195
         *
williamr@4
   196
         * @param aChar     Character that will be checked.
williamr@4
   197
         * @return ETrue if character is a separator character.
williamr@4
   198
         */
williamr@4
   199
        virtual TBool IsFindSeparatorChar(
williamr@4
   200
                TChar aCh ) = 0;
williamr@4
   201
williamr@4
   202
        /**
williamr@4
   203
         * Returns an extension point for this interface or NULL.
williamr@4
   204
         *
williamr@4
   205
         * @param aExtensionUid     Extension UID.
williamr@4
   206
         * @return  Extension point.
williamr@4
   207
         */
williamr@4
   208
        virtual TAny* ContactNameFormatterExtension(
williamr@4
   209
                TUid /*aExtensionUid*/ )
williamr@4
   210
            {
williamr@4
   211
            return NULL;
williamr@4
   212
            }
williamr@4
   213
    };
williamr@4
   214
williamr@4
   215
#endif // MPBK2CONTACTNAMEFORMATTER_H
williamr@4
   216
williamr@4
   217
// End of File