email/mail/ViewerSrc/CMailMsgBaseControlAdapter.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  BaseControl adapter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include 	"MailLog.h"
       
    22 #include    "CMailMsgBaseControlAdapter.h"
       
    23 #include    "MMailMsgBaseControl.h"
       
    24 #include    <MsgBaseControl.h>
       
    25 #include    <MsgEditorView.h>  // CMsgEditorView
       
    26 #include 	<MsgEditorCommon.h>
       
    27 
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CMailMsgBaseControlAdapter::CMailMsgBaseControlAdapter
       
    33 // C++ constructor can NOT contain any code, that
       
    34 // might leave.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CMailMsgBaseControlAdapter::CMailMsgBaseControlAdapter(
       
    38     MMailMsgBaseControl& aBaseControl)
       
    39     :iBaseControl(aBaseControl)
       
    40     {
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CMailMsgBaseControlAdapter::ConstructL
       
    45 // Symbian 2nd phase constructor can leave.
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 void CMailMsgBaseControlAdapter::ConstructL()
       
    49     {
       
    50     iControlType = EMsgBodyControl;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CMailMsgBaseControlAdapter::NewL
       
    55 // Two-phased constructor.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CMailMsgBaseControlAdapter* CMailMsgBaseControlAdapter::NewL(
       
    59     CCoeControl* /*aParent*/,
       
    60     MMailMsgBaseControl& aControl)
       
    61     {
       
    62     CMailMsgBaseControlAdapter* self = new( 
       
    63         ELeave ) CMailMsgBaseControlAdapter(aControl);
       
    64     
       
    65     CleanupStack::PushL( self );
       
    66     self->ConstructL();
       
    67 //    aControl.SetContainerWindowL(*aParent);
       
    68     CleanupStack::Pop(); // self
       
    69     return self;
       
    70     }
       
    71 
       
    72     
       
    73 // Destructor
       
    74 CMailMsgBaseControlAdapter::~CMailMsgBaseControlAdapter()
       
    75     {
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CMailMsgBaseControlAdapter::NotifyViewEvent
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 void CMailMsgBaseControlAdapter::NotifyViewEvent( 
       
    83     TMsgViewEvent LOGPARAM_ONLY( aEvent ), TInt LOGPARAM_ONLY( aParam ) )
       
    84     {
       
    85     LOG2("CMailMsgBaseControlAdapter::NotifyViewEvent aEvent:%d aParam:%d",
       
    86         aEvent, aParam);
       
    87     TPoint pos = Position();
       
    88     TSize sis = Size();    
       
    89  /*   switch( aEvent )
       
    90         {
       
    91         case EMsgViewEventPrepareFocusTransitionUp:
       
    92         case EMsgViewEventPrepareFocusTransitionDown:
       
    93         case EMsgViewEventPrepareForViewing:
       
    94         case EMsgViewEventPrepareForZooming:
       
    95         case EMsgViewEventFormHeightChanged:
       
    96         case EMsgViewEventFormScrolled:
       
    97         case EMsgViewEventSetCursorFirstPos:
       
    98         case EMsgViewEventSetCursorLastPos:
       
    99         default:
       
   100         };*/
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CMailMsgBaseControlAdapter::CurrentLineRect
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 TRect CMailMsgBaseControlAdapter::CurrentLineRect()
       
   108     {
       
   109     return iBaseControl.CurrentLineRect();
       
   110     }
       
   111     
       
   112 void CMailMsgBaseControlAdapter::SetAndGetSizeL(TSize& aSize)
       
   113     {
       
   114     iBaseControl.SetAndGetSizeL( aSize );
       
   115     SetSize( aSize );
       
   116     }
       
   117 void CMailMsgBaseControlAdapter::ClipboardL(TMsgClipboardFunc aFunc)
       
   118     {
       
   119     iBaseControl.ClipboardL( aFunc );
       
   120     }
       
   121 void CMailMsgBaseControlAdapter::EditL(TMsgEditFunc aFunc)
       
   122     {
       
   123     iBaseControl.EditL( aFunc );
       
   124     }
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CMailMsgBaseControlAdapter::IsFocusChangePossible
       
   128 // -----------------------------------------------------------------------------
       
   129 //    
       
   130 TBool CMailMsgBaseControlAdapter::IsFocusChangePossible(
       
   131     TMsgFocusDirection aDirection) const
       
   132     {
       
   133     return iBaseControl.IsFocusChangePossible( aDirection );
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CMailMsgBaseControlAdapter::IsCursorLocation
       
   138 // -----------------------------------------------------------------------------
       
   139 //    
       
   140 TBool CMailMsgBaseControlAdapter::IsCursorLocation(
       
   141     TMsgCursorLocation aLocation) const
       
   142     {
       
   143     return iBaseControl.IsCursorLocation( aLocation );
       
   144     }
       
   145 TUint32 CMailMsgBaseControlAdapter::EditPermission() const
       
   146     {
       
   147     return iBaseControl.EditPermission();
       
   148     }
       
   149 
       
   150 TInt CMailMsgBaseControlAdapter::CountComponentControls() const
       
   151     {
       
   152     return iBaseControl.CountPluginComponentControls();
       
   153     }
       
   154     
       
   155 CCoeControl* CMailMsgBaseControlAdapter::ComponentControl(TInt aIndex) const
       
   156     {
       
   157     return iBaseControl.PluginComponentControl( aIndex );
       
   158     }
       
   159     
       
   160 void CMailMsgBaseControlAdapter::SizeChanged()
       
   161     {
       
   162     LOG2("CMailMsgBaseControlAdapter::SizeChanged Position:%d iY:%d",
       
   163         Position().iX, Position().iY);
       
   164     LOG2("CMailMsgBaseControlAdapter::SizeChanged Size w:%d h:%d",
       
   165         Size().iWidth, Size().iHeight);
       
   166     TPoint editorPosition( Position() );
       
   167     TRect viewRect(0,0,0,0);
       
   168     if (iBaseControlObserver)
       
   169         {
       
   170         viewRect = iBaseControlObserver->ViewRect();
       
   171         }
       
   172     editorPosition.iY += viewRect.iTl.iY;          
       
   173     iBaseControl.SetPluginExtent( editorPosition, Size() );
       
   174     }
       
   175     
       
   176 void CMailMsgBaseControlAdapter::FocusChanged(TDrawNow aDrawNow)
       
   177     {
       
   178     iBaseControl.PluginFocusChanged(aDrawNow);
       
   179     }
       
   180 
       
   181 void CMailMsgBaseControlAdapter::SetExtent(
       
   182     const TPoint& LOGPARAM_ONLY( aPosition ),const TSize& /*aSize*/)
       
   183     {
       
   184     LOG2("CMailMsgBaseControlAdapter::SetExtent iX:%d iY:%d",
       
   185         aPosition.iX, aPosition.iY);    
       
   186     }
       
   187 
       
   188 void CMailMsgBaseControlAdapter::SetPosition(
       
   189     const TPoint& LOGPARAM_ONLY( aPosition ) )
       
   190     {
       
   191     LOG2("CMailMsgBaseControlAdapter::SetPosition iX:%d iY:%d",
       
   192         aPosition.iX, aPosition.iY);
       
   193     }
       
   194     
       
   195 TInt CMailMsgBaseControlAdapter::VirtualHeight()
       
   196     {
       
   197     return iBaseControl.VirtualHeight();
       
   198     }
       
   199     
       
   200 TInt CMailMsgBaseControlAdapter::VirtualVisibleTop()
       
   201     {
       
   202     return iBaseControl.VirtualVisibleTop();
       
   203     }
       
   204     
       
   205 void CMailMsgBaseControlAdapter::HandleResourceChange(TInt aType)
       
   206     {
       
   207     iBaseControl.PluginHandleResourceChange( aType );
       
   208     }
       
   209     
       
   210 TKeyResponse CMailMsgBaseControlAdapter::OfferKeyEventL(
       
   211     const TKeyEvent& aKeyEvent,TEventCode aType)
       
   212     {
       
   213     return iBaseControl.PluginOfferKeyEventL(aKeyEvent, aType);
       
   214     }
       
   215 
       
   216 void CMailMsgBaseControlAdapter::PrepareForReadOnly(TBool aReadOnly)
       
   217     {
       
   218     iBaseControl.PrepareForReadOnly( aReadOnly );
       
   219     }
       
   220 
       
   221 //  End of File