mobilemessaging/unieditor/application/inc/UniEditorAppUi.inl
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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:   Uni Editor AppUi inline functions    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // ---------------------------------------------------------
       
    21 // CUniEditorAppUi::Document
       
    22 // ---------------------------------------------------------
       
    23 //
       
    24 inline CUniEditorDocument* CUniEditorAppUi::Document() const
       
    25     {
       
    26     return static_cast<CUniEditorDocument*>( CMsgEditorAppUi::Document() );
       
    27     }
       
    28 
       
    29 // ---------------------------------------------------------
       
    30 // CUniEditorAppUi::FsSession
       
    31 // ---------------------------------------------------------
       
    32 //
       
    33 inline RFs& CUniEditorAppUi::FsSession() const
       
    34     {
       
    35     return ( iCoeEnv->FsSession() );
       
    36     }
       
    37     
       
    38 // ---------------------------------------------------------
       
    39 // CUniEditorAppUi::SmsPlugin
       
    40 // ---------------------------------------------------------
       
    41 //
       
    42 inline CUniEditorPlugin* CUniEditorAppUi::SmsPlugin()
       
    43     {
       
    44     return Document()->SmsPlugin();
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------
       
    48 // CUniEditorAppUi::MmsPlugin
       
    49 // ---------------------------------------------------------
       
    50 //
       
    51 inline CUniEditorPlugin* CUniEditorAppUi::MmsPlugin()
       
    52     {
       
    53     return Document()->MmsPlugin();
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------
       
    57 // CUniEditorAppUi::ImageCtrl
       
    58 // ---------------------------------------------------------
       
    59 //
       
    60 inline CMsgImageControl* CUniEditorAppUi::ImageCtrl() const
       
    61     {
       
    62     return ( iView
       
    63         ? static_cast<CMsgImageControl*>( iView->ControlById( EMsgComponentIdImage ) )
       
    64         : NULL );
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------
       
    68 // CUniEditorAppUi::SubjectCtrl
       
    69 // ---------------------------------------------------------
       
    70 //    
       
    71 inline CMsgExpandableControl* CUniEditorAppUi::SubjectCtrl() const
       
    72     {
       
    73     return ( iView
       
    74         ? static_cast<CMsgExpandableControl*>( iView->ControlById( EMsgComponentIdSubject ) )
       
    75         : NULL );
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------
       
    79 // CUniEditorAppUi::BodyCtrl
       
    80 // ---------------------------------------------------------
       
    81 //   
       
    82 inline CMsgBodyControl* CUniEditorAppUi::BodyCtrl() const
       
    83     {    
       
    84     return ( iView
       
    85         ? static_cast<CMsgBodyControl*>( iView->ControlById( EMsgComponentIdBody ) )
       
    86         : NULL );
       
    87     }
       
    88 
       
    89 // ---------------------------------------------------------
       
    90 // CUniEditorAppUi::ToCtrl
       
    91 // ---------------------------------------------------------
       
    92 // 
       
    93 inline CMsgAddressControl* CUniEditorAppUi::ToCtrl() const
       
    94     {
       
    95     return ( iView
       
    96         ? static_cast<CMsgAddressControl*>( iView->ControlById( EMsgComponentIdTo ) )
       
    97         : NULL );
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------
       
   101 // CUniEditorAppUi::RecipientCtrlEditor
       
   102 // ---------------------------------------------------------
       
   103 // 
       
   104 inline CEikRichTextEditor* CUniEditorAppUi::RecipientCtrlEditor( CUniBaseHeader::THeaderFields aField ) const
       
   105     {
       
   106     TMsgControlId id = EMsgComponentIdNull;
       
   107     if( !iView )
       
   108         {
       
   109         return NULL;
       
   110         }
       
   111         
       
   112     switch( aField )
       
   113         {
       
   114         case CUniBaseHeader::EHeaderAddressTo:
       
   115             {
       
   116             id = EMsgComponentIdTo;
       
   117             break;
       
   118             }
       
   119         case CUniBaseHeader::EHeaderAddressCc:
       
   120             {
       
   121             id = EMsgComponentIdCc;
       
   122             break;
       
   123             }
       
   124         case CUniBaseHeader::EHeaderAddressBcc:
       
   125             {
       
   126             id = EMsgComponentIdBcc;
       
   127             break;
       
   128             }
       
   129         default:
       
   130             {
       
   131             // It's none of the above so lets return NULL    
       
   132             return NULL;
       
   133             }
       
   134         }
       
   135         
       
   136     return iView->ControlById( id )
       
   137             ? &(static_cast<CMsgExpandableControl*>( iView->ControlById( id ) )->Editor( ) )
       
   138             : NULL;
       
   139     }
       
   140 
       
   141 // ---------------------------------------------------------
       
   142 // CUniEditorAppUi::SubjectCtrlEditor
       
   143 // ---------------------------------------------------------
       
   144 //
       
   145 inline CEikRichTextEditor* CUniEditorAppUi::SubjectCtrlEditor() const
       
   146     {
       
   147     return ( SubjectCtrl( )
       
   148         ? &( SubjectCtrl( )->Editor() )
       
   149         : NULL );
       
   150     }
       
   151 
       
   152 // ---------------------------------------------------------
       
   153 // CUniEditorAppUi::BodyCtrlEditor
       
   154 // ---------------------------------------------------------
       
   155 //
       
   156 inline CEikRichTextEditor* CUniEditorAppUi::BodyCtrlEditor() const
       
   157     {
       
   158     return ( BodyCtrl()
       
   159         ? &( BodyCtrl()->Editor() )
       
   160         : NULL );
       
   161     }
       
   162 
       
   163 // ---------------------------------------------------------
       
   164 // CUniEditorAppUi::IsHeaderEmpty
       
   165 // ---------------------------------------------------------
       
   166 //
       
   167 inline TBool CUniEditorAppUi::IsHeaderEmpty() const
       
   168     {
       
   169     return ( ( Document()->SubjectSize() + Document()->AddressSize() ) <= 0 );    
       
   170     }
       
   171 
       
   172 // ---------------------------------------------------------
       
   173 // CUniEditorAppUi::IsBodyEmpty
       
   174 // ---------------------------------------------------------
       
   175 //
       
   176 inline TBool CUniEditorAppUi::IsBodyEmpty() const
       
   177     {
       
   178     return ( Document()->DataModel( )->ObjectList().Count() <= 0 );    
       
   179     }
       
   180 
       
   181 // ---------------------------------------------------------
       
   182 // CUniEditorAppUi::IsLaunched
       
   183 // ---------------------------------------------------------
       
   184 //
       
   185 inline TBool CUniEditorAppUi::IsLaunched( ) const
       
   186 	{
       
   187 	return iEditorFlags & ELaunchSuccessful;
       
   188 	}
       
   189 	
       
   190 // End of file
       
   191