phonebookui/Phonebook2/Presentation/inc/CPbk2JapaneseContactNameFormatter.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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 *     Japanese contact name formatter.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CPBK2JAPANESECONTACTNAMEFORMATTER_H
       
    21 #define CPBK2JAPANESECONTACTNAMEFORMATTER_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include "CPbk2ContactNameFormatterBase.h"
       
    25 
       
    26 /**
       
    27  * Japanese contact name formatter.
       
    28  *
       
    29  * Name creation logic:
       
    30  *  1)  Try to create name using last and first name.
       
    31  *  2)  If the contact didn't have neither of the two fields
       
    32  *      then use last/first name reading to build title.
       
    33  *      Sort order defines the order of last/first name
       
    34  *  3)  If the title is still empty then create name
       
    35  *      accoriding to the third -> last type in the sort order.
       
    36  *  3)  If the field type is defined in the sort order but not defined
       
    37  *      as a title field type then the field data is not used.
       
    38  *
       
    39  */
       
    40 NONSHARABLE_CLASS(CPbk2JapaneseContactNameFormatter)
       
    41     :   public CPbk2ContactNameFormatterBase
       
    42     {
       
    43     public: // Construction
       
    44 
       
    45         /**        
       
    46         * @param aMasterFieldTypeList  Master field type list of
       
    47         *                              Virtual Phonebook.
       
    48         * @param aSortOrderManager     Sort order manager for fetching
       
    49         *                              current sort order.
       
    50         * @param aTitleFieldSelector   Title fields, ownership changes
       
    51         * @param aUnnamedText          Text to use for unnamed contacts.
       
    52         * @return a new instance of this class
       
    53         */
       
    54         static CPbk2JapaneseContactNameFormatter* NewL(
       
    55                 const MVPbkFieldTypeList& aMasterFieldTypeList,
       
    56                 const CPbk2SortOrderManager& aSortOrderManager,
       
    57                 CVPbkFieldTypeSelector* aTitleFieldSelector,
       
    58                 const TDesC& aUnnamedText );
       
    59 
       
    60         ~CPbk2JapaneseContactNameFormatter();
       
    61 
       
    62     private: // From MPbk2ContactNameFormatter
       
    63         void GetContactTitle(
       
    64             const MVPbkBaseContactFieldCollection& aContactFields,
       
    65             TDes& aTitle,
       
    66             TUint32 aFormattingFlags);
       
    67         void GetContactTitleForFind(
       
    68             const MVPbkBaseContactFieldCollection& aContactFields,
       
    69             TDes& aTitle,
       
    70             TUint32 aFormattingFlags);
       
    71         CVPbkBaseContactFieldTypeListIterator* ActualTitleFieldsLC(
       
    72             CVPbkFieldTypeRefsList& aFieldTypeList,
       
    73             const MVPbkBaseContactFieldCollection& aContactFields );
       
    74         TInt MaxTitleLength(
       
    75             const MVPbkBaseContactFieldCollection& aContactFields,
       
    76             const TUint32 aFormattingFlags);
       
    77         TInt MaxTitleLengthForFind(
       
    78             const MVPbkBaseContactFieldCollection& aContactFields,
       
    79             const TUint32 aFormattingFlags);
       
    80         TBool IsFindSeparatorChar( TChar aCh );
       
    81         
       
    82     public: // From MPbk2ContactNameFormatter2
       
    83         
       
    84          HBufC* GetContactTitleWithCompanyNameL(
       
    85              const MVPbkBaseContactFieldCollection& /*aContactFields*/,
       
    86              TUint32 /*aFormattingFlags*/ )
       
    87              {
       
    88              return NULL;
       
    89              }
       
    90          
       
    91     public: // From MPbk2ContactNameFormatter3
       
    92         
       
    93         CVPbkBaseContactFieldTypeListIterator* TitleWithCompanyNameFieldsLC(
       
    94                 CVPbkFieldTypeRefsList& /*aFieldTypeList*/,
       
    95                 const MVPbkBaseContactFieldCollection& /*aContactFields */)
       
    96              {
       
    97              return NULL;
       
    98              }
       
    99          
       
   100     private: // Implementation
       
   101         CPbk2JapaneseContactNameFormatter(
       
   102             const MVPbkFieldTypeList& aMasterFieldTypeList,
       
   103             const CPbk2SortOrderManager& aSortOrderManager);
       
   104         void ConstructL(
       
   105             const TDesC& aUnnamedText,
       
   106             CVPbkFieldTypeSelector* aTitleFieldSelector );
       
   107     };
       
   108 
       
   109 #endif // CPBK2JAPANESECONTACTNAMEFORMATTER_H
       
   110 
       
   111 // End of File