uifw/AvKon/src/AknMultilineQueryControl.cpp
changeset 0 2f259fa3e83a
child 14 3320e4e6e8bb
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <aknmultilinequerycontrol.h>   //This class
       
    22 #include <barsread.h>                   //For TResourceReader
       
    23 #include <eikenv.h>                     //For CEikEnv
       
    24 #include <AknLayoutDef.h>               //For layout definitions
       
    25 #include <AknLayout.lag>                //For layout macros
       
    26 #include <avkon.mbg>
       
    27 
       
    28 #include <AknsDrawUtils.h>
       
    29 #include <AknsFrameBackgroundControlContext.h>
       
    30 
       
    31 #include "akntextcontrol.h"
       
    32 #include "aknqueryeditorindicator.h"
       
    33 #include "AknQueryExtension.h"
       
    34 #include <skinlayout.cdl.h>
       
    35 #include "aknappui.h"
       
    36 #include "AknQueryExtension.h"
       
    37 
       
    38 #include <layoutmetadata.cdl.h>
       
    39 #include <AknLayout2ScalableDef.h>
       
    40 #include <aknlayoutscalable_avkon.cdl.h>
       
    41 
       
    42 #if defined( RD_SCALABLE_UI_V2)
       
    43 //class CAknButton is available from week 20 version 5.0 onwards
       
    44 #include <aknbutton.h>
       
    45 // For MAknMfneCommandObserver
       
    46 #include <aknmfnecommandobserver.h>
       
    47 #endif //if defined( RD_SCALABLE_UI_V2)
       
    48 
       
    49 #include <aknlocationed.h>
       
    50 #include <aknconsts.h>
       
    51 
       
    52 #include <touchfeedback.h>
       
    53 
       
    54 #include <AknTasHook.h> // for testability hooks
       
    55 
       
    56 
       
    57 EXPORT_C CAknMultilineQueryControl::CAknMultilineQueryControl() 
       
    58     : CAknQueryControl(), iLinePos(EFirstLine)
       
    59     {
       
    60     AKNTASHOOK_ADD( this, "CAknMultilineQueryControl" );
       
    61     }
       
    62 
       
    63 //
       
    64 //Destructor
       
    65 //
       
    66 EXPORT_C CAknMultilineQueryControl::~CAknMultilineQueryControl()
       
    67 
       
    68     {
       
    69     AKNTASHOOK_REMOVE();
       
    70     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
    71     if ( feedback )
       
    72         {
       
    73         feedback->RemoveFeedbackForControl( this );
       
    74         }
       
    75     }
       
    76 
       
    77 /**
       
    78  *Initializes the member data from resource
       
    79  */
       
    80 void CAknMultilineQueryControl::ConstructQueryL(TResourceReader& aRes)
       
    81     {
       
    82     SetLinePosition();
       
    83 
       
    84     switch(iQueryType)
       
    85         {
       
    86         case EMultiDataFirstEdwin:
       
    87         case EMultiDataSecondEdwin:
       
    88             {
       
    89             iEdwin = new(ELeave)CEikEdwin;
       
    90             iEdwin->SetContainerWindowL(*this);
       
    91             iEdwin->ConstructFromResourceL(aRes);
       
    92             iEdwin->SetObserver(this);
       
    93             iEdwin->AddFlagToUserFlags(EEikEdwinNoWrap);
       
    94             }
       
    95             break;
       
    96         case EMultiDataFirstEdwinAllowEmpty:
       
    97             {
       
    98             iEdwin = new(ELeave)CEikEdwin;
       
    99             iEdwin->SetContainerWindowL(*this);
       
   100             iEdwin->ConstructFromResourceL(aRes);
       
   101             iEdwin->SetObserver(this);
       
   102             iEdwin->AddFlagToUserFlags(EEikEdwinNoWrap);
       
   103                 
       
   104             CAknQueryExtension* extension = QueryExtension();
       
   105             if( extension )
       
   106                 {
       
   107                 extension->iAllowEmptyInput = ETrue;
       
   108                 }
       
   109             iQueryType = EMultiDataFirstEdwin;
       
   110             }
       
   111             break;
       
   112         case EMultiDataSecondEdwinAllowEmpty:
       
   113             {
       
   114             iEdwin = new(ELeave)CEikEdwin;
       
   115             iEdwin->SetContainerWindowL(*this);
       
   116             iEdwin->ConstructFromResourceL(aRes);
       
   117             iEdwin->SetObserver(this);
       
   118             iEdwin->AddFlagToUserFlags(EEikEdwinNoWrap);
       
   119                 
       
   120             CAknQueryExtension* extension = QueryExtension();
       
   121             if( extension )
       
   122                 {
       
   123                 extension->iAllowEmptyInput = ETrue;
       
   124                 }
       
   125             iQueryType = EMultiDataSecondEdwin;
       
   126             }
       
   127             break;
       
   128         case EMultiDataFirstSecEd:
       
   129         case EMultiDataSecondSecEd:
       
   130             {
       
   131             iSecretEd = new(ELeave)CEikSecretEditor;
       
   132             iSecretEd->SetContainerWindowL(*this);
       
   133             iSecretEd->ConstructFromResourceL(aRes);
       
   134             iSecretEd->SetObserver(this);
       
   135             iSecretEd->SetSkinTextColorL(EAknsCIQsnTextColorsCG27);
       
   136             }
       
   137             break;
       
   138         case EMultiDataFirstTimeEd:
       
   139         case EMultiDataSecondTimeEd:
       
   140             {
       
   141             iTimeEdwin = new(ELeave)CEikTimeEditor;
       
   142             iTimeEdwin->SetContainerWindowL(*this);
       
   143             iTimeEdwin->ConstructFromResourceL(aRes);
       
   144             iTimeEdwin->SetSkinTextColorL(EAknsCIQsnTextColorsCG27);
       
   145 #if defined( RD_SCALABLE_UI_V2)
       
   146 
       
   147             if ( AknLayoutUtils::PenEnabled() )
       
   148                 {
       
   149                 iTimeEdwin->SetFeature( CEikMfne::EFingerSupport, CEikMfne::EnableWithAllHighlight );
       
   150                 }
       
   151                             
       
   152 #endif //if defined( RD_SCALABLE_UI_V2)
       
   153             }
       
   154             break;
       
   155         case EMultiDataFirstDateEd:
       
   156         case EMultiDataSecondDateEd:
       
   157             {
       
   158             iDateEdwin = new(ELeave)CEikDateEditor;
       
   159             iDateEdwin->SetContainerWindowL(*this);
       
   160             iDateEdwin->ConstructFromResourceL(aRes);
       
   161             iDateEdwin->SetSkinTextColorL(EAknsCIQsnTextColorsCG27);
       
   162 #if defined( RD_SCALABLE_UI_V2)
       
   163 
       
   164             if ( AknLayoutUtils::PenEnabled() )
       
   165                 {
       
   166                 iDateEdwin->SetFeature( CEikMfne::EFingerSupport, CEikMfne::EnableWithAllHighlight );
       
   167                 //SizeChanged();
       
   168                 }
       
   169     
       
   170 #endif //if defined( RD_SCALABLE_UI_V2)
       
   171             }
       
   172             break;
       
   173         case EMultiDataFirstDurEd:
       
   174         case EMultiDataSecondDurEd:
       
   175             {
       
   176             iDurationEdwin = new(ELeave)CEikDurationEditor;
       
   177             iDurationEdwin->SetContainerWindowL(*this);
       
   178             iDurationEdwin->ConstructFromResourceL(aRes);
       
   179             iDurationEdwin->SetSkinTextColorL(EAknsCIQsnTextColorsCG27);
       
   180             if ( AknLayoutUtils::PenEnabled() )
       
   181                 {
       
   182                 iDurationEdwin->SetFeature( CEikMfne::EFingerSupport, CEikMfne::EnableWithAllHighlight );
       
   183                 }
       
   184             }
       
   185             break;
       
   186         case EMultiDataFirstPhoneEd:
       
   187         case EMultiDataSecondPhoneEd:
       
   188             {
       
   189             iEdwin = new(ELeave)CEikEdwin;
       
   190             iEdwin->AddFlagToUserFlags(EEikEdwinAlternativeWrapping | EEikEdwinNoWrap);
       
   191             iEdwin->SetContainerWindowL(*this);
       
   192             iEdwin->SetEdwinObserver(this);
       
   193             iEdwin->ConstructFromResourceL(aRes);
       
   194             iEdwin->SetObserver(this);
       
   195             iEdwin->SetAknEditorInputMode(EAknEditorNumericInputMode);
       
   196             iEdwin->SetAknEditorAllowedInputModes(EAknEditorNumericInputMode);
       
   197             }
       
   198             break;
       
   199         case EMultiDataFirstNumEd:
       
   200         case EMultiDataSecondNumEd:
       
   201             {
       
   202             iNumberEdwin = new(ELeave)CAknIntegerEdwin;
       
   203             iNumberEdwin->SetContainerWindowL(*this);
       
   204             iNumberEdwin->ConstructFromResourceL(aRes);
       
   205             iNumberEdwin->SetObserver(this);
       
   206             iNumberEdwin->AddFlagToUserFlags(EEikEdwinNoWrap);
       
   207             }
       
   208             break;
       
   209         case EMultiDataFirstPinEd:
       
   210         case EMultiDataSecondPinEd:
       
   211             {
       
   212             iPinEdwin = new(ELeave)CAknNumericSecretEditor;
       
   213             iPinEdwin->SetContainerWindowL(*this);
       
   214             iPinEdwin->ConstructFromResourceL(aRes);
       
   215             iPinEdwin->SetObserver(this);
       
   216             iPinEdwin->SetSkinTextColorL(EAknsCIQsnTextColorsCG27);
       
   217             }
       
   218             break;
       
   219         case EMultiDataFirstLocationEd:
       
   220         case EMultiDataSecondLocationEd:
       
   221             {
       
   222             LocationEd() = new(ELeave)CAknLocationEditor;
       
   223             LocationEd()->SetContainerWindowL(*this);
       
   224             LocationEd()->ConstructFromResourceL(aRes);
       
   225             LocationEd()->SetObserver(this);
       
   226             LocationEd()->SetSkinTextColorL(EAknsCIQsnTextColorsCG27);
       
   227             if ( AknLayoutUtils::PenEnabled() )
       
   228                 {
       
   229                 LocationEd()->SetFeature( CEikMfne::EFingerSupport, CEikMfne::EnableWithAllHighlight );
       
   230                 }
       
   231             }
       
   232         default:
       
   233             break;
       
   234         }
       
   235 
       
   236     // Construct editor context
       
   237     CAknQueryExtension* extension = QueryExtension();
       
   238     if( extension )
       
   239         {
       
   240         extension->CreateEditorContextL();
       
   241         }
       
   242         
       
   243     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
   244     CFeedbackSpec* spec = CFeedbackSpec::New();
       
   245     if ( feedback && spec )
       
   246         {
       
   247         spec->AddFeedback( ETouchEventStylusDown,
       
   248                            ETouchFeedbackSensitiveList );
       
   249         feedback->SetFeedbackArea( this, 0, Rect(), spec );
       
   250         delete spec;
       
   251         }
       
   252     }
       
   253 
       
   254 /** 
       
   255  * Layout rectangle (shift up and left by margins)
       
   256  */
       
   257 TRect CAknMultilineQueryControl::LayoutRect()
       
   258     {
       
   259     TPoint topLeft(0,0);
       
   260     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
   261 
       
   262     TAknLayoutRect layout;
       
   263     layout.LayoutRect(DialogRect(), AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_graphics_Line_5(DialogRect(), LAFIndex.CDCPQWindowGraphicsLine5()));
       
   264 
       
   265     TRect rect(layout.Rect());
       
   266     topLeft.iX -= rect.iTl.iX;
       
   267     topLeft.iY -= rect.iTl.iY;
       
   268 
       
   269     TPoint bottomRight (topLeft);
       
   270     TSize  size (MinimumSize());
       
   271     bottomRight.iY += size.iHeight; 
       
   272     bottomRight.iX += size.iWidth;
       
   273 
       
   274     return TRect(topLeft,bottomRight);
       
   275     }
       
   276 
       
   277 
       
   278 /**
       
   279  * Depending on layout type determine control position in the dialog
       
   280  */
       
   281 void CAknMultilineQueryControl::SetLinePosition()
       
   282     {
       
   283     if ( iQueryType == EMultiDataSecondEdwin || iQueryType == EMultiDataSecondSecEd
       
   284         || iQueryType == EMultiDataSecondTimeEd || iQueryType == EMultiDataSecondDateEd
       
   285         || iQueryType == EMultiDataSecondDurEd  || iQueryType == EMultiDataSecondPhoneEd
       
   286         || iQueryType == EMultiDataSecondNumEd  || iQueryType == EMultiDataSecondPinEd 
       
   287         || iQueryType == EMultiDataSecondLocationEd
       
   288         )
       
   289         {   
       
   290         iLinePos = ESecondLine;
       
   291         }
       
   292     }
       
   293 
       
   294 /**
       
   295  * Set the line width for the prompt lines
       
   296  *
       
   297  * This is a virtual method called by CAknQueryControl::DoSetPromptL()
       
   298  *
       
   299  * Depending on LAF information and on weather we are the first or the second 
       
   300  * query line, we can work out the line widths by indexing the LAF tables.
       
   301  *
       
   302  */
       
   303 void CAknMultilineQueryControl::SetLineWidthsL()
       
   304     {
       
   305     if (!iLineWidths)
       
   306         return;
       
   307     
       
   308     iLineWidths->Reset();
       
   309 
       
   310     TAknLayoutRect parentLayoutRect;
       
   311     if (Layout_Meta_Data::IsLandscapeOrientation())
       
   312         parentLayoutRect.LayoutRect(iAvkonAppUi->ClientRect(), AKN_LAYOUT_WINDOW_popup_query_data_window(0));
       
   313     else
       
   314         parentLayoutRect.LayoutRect(iAvkonAppUi->ClientRect(), AKN_LAYOUT_WINDOW_popup_query_data_code_window(0));
       
   315     
       
   316     //parentLayoutRect.LayoutRect(iAvkonAppUi->ClientRect(), AKN_LAYOUT_WINDOW_popup_query_data_code_window(0));
       
   317     TAknLayoutText textRect;
       
   318 
       
   319     for (TInt i = 0; i < 2; i++)
       
   320         {
       
   321         if (iLinePos == EFirstLine || Layout_Meta_Data::IsLandscapeOrientation())
       
   322             {
       
   323             textRect.LayoutText(parentLayoutRect.Rect(), AKN_LAYOUT_TEXT_Combined_data_and_code_query_pop_up_window_texts_Line_1(0));
       
   324             iLineWidths->AppendL(textRect.TextRect().Width());
       
   325             }
       
   326         else if (iLinePos == ESecondLine)
       
   327             {
       
   328             textRect.LayoutText(parentLayoutRect.Rect(), AKN_LAYOUT_TEXT_Combined_data_and_code_query_pop_up_window_texts_Line_3(0));
       
   329             iLineWidths->AppendL(textRect.TextRect().Width());
       
   330             }
       
   331         }
       
   332     }
       
   333 
       
   334 /**
       
   335  * Set the number of prompt lines.
       
   336  *
       
   337  * The query dialog calls this method in order to communicate the number of prompt lines
       
   338  * in the other query line. Indexing into LAF tables depends on this.
       
   339  *
       
   340  */
       
   341 EXPORT_C void CAknMultilineQueryControl::SetNbrOfPromptLines( 
       
   342                                             TInt aNbrOfPromptLinesFirstLine, 
       
   343                                             TInt aNbrOfPromptLinesSecondLine)
       
   344     {
       
   345     iFirstQueryPromptLines  = aNbrOfPromptLinesFirstLine;
       
   346     iSecondQueryPromptLines = aNbrOfPromptLinesSecondLine;
       
   347     }       
       
   348 
       
   349 
       
   350 EXPORT_C CCoeControl* CAknMultilineQueryControl::ControlByLayoutOrNull(TInt aLayout)
       
   351     {
       
   352     CCoeControl* ctrl=NULL;
       
   353     switch ( aLayout )
       
   354         {
       
   355         case EMultiDataFirstEdwin:
       
   356         case EMultiDataSecondEdwin:
       
   357         case EMultiDataFirstPhoneEd:
       
   358         case EMultiDataSecondPhoneEd:
       
   359             ctrl=iEdwin;
       
   360             break;
       
   361         case EMultiDataFirstSecEd:
       
   362         case EMultiDataSecondSecEd:
       
   363             ctrl=iSecretEd;
       
   364             break;
       
   365         case EMultiDataFirstDateEd:
       
   366         case EMultiDataSecondDateEd:
       
   367             ctrl=iDateEdwin;
       
   368             break;
       
   369         case EMultiDataFirstTimeEd:
       
   370         case EMultiDataSecondTimeEd:
       
   371             ctrl=iTimeEdwin;
       
   372             break;
       
   373         case EMultiDataFirstDurEd:
       
   374         case EMultiDataSecondDurEd:
       
   375             ctrl=iDurationEdwin;
       
   376             break;
       
   377         case EMultiDataFirstNumEd:
       
   378         case EMultiDataSecondNumEd:
       
   379             ctrl=iNumberEdwin;
       
   380             break;
       
   381         case EMultiDataFirstPinEd:
       
   382         case EMultiDataSecondPinEd:
       
   383             ctrl=iPinEdwin;
       
   384             break;
       
   385         case EMultiDataFirstLocationEd:
       
   386         case EMultiDataSecondLocationEd:
       
   387             ctrl=LocationEd();
       
   388             break;
       
   389         default:
       
   390             break;
       
   391         }
       
   392     return ctrl;
       
   393     }
       
   394 
       
   395 EXPORT_C TBool CAknMultilineQueryControl::IsFirst() const
       
   396     {
       
   397     return iLinePos == EFirstLine;
       
   398     }
       
   399 
       
   400 EXPORT_C TBool CAknMultilineQueryControl::IsSecond() const
       
   401     {
       
   402     return !IsFirst();
       
   403     }
       
   404 
       
   405 /**
       
   406  * Return control minimum size
       
   407  *
       
   408  * Size is calculated by using LAF tables. Index in this table depends on the 
       
   409  * total number of prompt lines in both queries
       
   410  */
       
   411 EXPORT_C TSize CAknMultilineQueryControl::MinimumSize()
       
   412     {
       
   413     TAknLayoutRect layout;  
       
   414     TAknWindowLineLayout window;
       
   415     WindowLayout( window );    
       
   416     
       
   417     TRect mainPane;
       
   418     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent, mainPane );
       
   419     layout.LayoutRect( mainPane, window );
       
   420     TRect rect2(layout.Rect()); 
       
   421     TSize size = rect2.Size();
       
   422 
       
   423     if (IsFirst())
       
   424         {
       
   425         size.iHeight = FirstLineHeight(); 
       
   426         }
       
   427     else if (Layout_Meta_Data::IsLandscapeOrientation() && IsSecond())
       
   428         {
       
   429         size.iHeight = SecondLineHeight();
       
   430         }
       
   431     else if (IsSecond())
       
   432         {
       
   433         TAknWindowLineLayout layoutLine = AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_graphics_Line_5(rect2/*DialogRect()*/,0);
       
   434         TAknLayoutRect layoutRect;
       
   435         layoutRect.LayoutRect(rect2/*DialogRect()*/, layoutLine);
       
   436         TRect rect(layoutRect.Rect());
       
   437         size.iHeight = rect.Height() - FirstLineHeight();
       
   438         }
       
   439       
       
   440     else
       
   441         __ASSERT_DEBUG(0,Panic(EAknPanicNotSupported));
       
   442     
       
   443     return size;
       
   444   }
       
   445 
       
   446 /**
       
   447  * Return height of first line control, use separator to determine this.
       
   448  */
       
   449 TInt16 CAknMultilineQueryControl::FirstLineHeight() const
       
   450     {
       
   451     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
   452     TAknWindowLineLayout separator;
       
   453     if(!AknLayoutUtils::PenEnabled())
       
   454     {
       
   455         separator = 
       
   456         AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_3
       
   457             (LAFIndex.CDCQPWindowLine3());
       
   458     }   
       
   459     else
       
   460     {
       
   461         separator = AknLayoutScalable_Avkon::popup_query_data_code_window_g1(5);    
       
   462     }
       
   463 
       
   464     TAknLayoutRect layout;
       
   465     layout.LayoutRect(TRect(), separator);
       
   466     TRect rect(layout.Rect());
       
   467     return (TInt16)(rect.iTl.iY + rect.Height());
       
   468     }
       
   469 
       
   470 TInt16 CAknMultilineQueryControl::SecondLineHeight() const
       
   471     {
       
   472     TIndex LAFIndex(iLinePos,iSecondQueryPromptLines,iFirstQueryPromptLines);
       
   473     
       
   474     TAknWindowLineLayout separator;
       
   475     if(!AknLayoutUtils::PenEnabled())
       
   476     {
       
   477         separator = 
       
   478         AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_3
       
   479             (LAFIndex.CDCQPWindowLine3());
       
   480     }
       
   481     else
       
   482     {
       
   483         separator = AknLayoutScalable_Avkon::popup_query_data_code_window_g1(5);    
       
   484     }
       
   485     TAknLayoutRect layout;
       
   486     layout.LayoutRect(TRect(), separator);
       
   487     TRect rect(layout.Rect());
       
   488     return (TInt16)(rect.iTl.iY + rect.Height());
       
   489     }
       
   490 
       
   491 
       
   492 /**
       
   493  * Draw method.
       
   494  *
       
   495  * Draw line between query lines only if we are the first line.
       
   496  */
       
   497 void CAknMultilineQueryControl::Draw(const TRect& aRect) const
       
   498     {
       
   499     if (Layout_Meta_Data::IsLandscapeOrientation())
       
   500         {
       
   501         CAknQueryControl::Draw(aRect);
       
   502         return;
       
   503         }
       
   504         
       
   505     CWindowGc& gc=SystemGc(); 
       
   506     TRect rect(Rect());    
       
   507     
       
   508     if (IsSecond())
       
   509         {                
       
   510         TAknWindowLineLayout dimension;
       
   511         WindowLayout( dimension );
       
   512 
       
   513         TAknLayoutRect layout;
       
   514         layout.LayoutRect(iAvkonAppUi->ClientRect(), dimension);
       
   515         TRect rect2(layout.Rect());
       
   516         TAknWindowLineLayout layoutLine = AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_graphics_Line_5(rect2,0);
       
   517         TAknLayoutRect layoutRect;
       
   518         layoutRect.LayoutRect(rect2, layoutLine);
       
   519         TRect rect3(layoutRect.Rect());
       
   520         rect.iBr.iY += rect3.Height() - rect.Height();
       
   521         }           
       
   522 
       
   523     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   524     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
   525 
       
   526     if( CAknEnv::Static()->TransparencyEnabled() )
       
   527         {
       
   528         RRegion clipReg;
       
   529         clipReg.AddRect( rect );
       
   530     
       
   531         if ( iHasEditor )
       
   532             {
       
   533             clipReg.SubRect( iEditorFrame.Rect() );
       
   534             }
       
   535     
       
   536         if ( iEditIndicator )
       
   537             {
       
   538             clipReg.SubRect( 
       
   539                 TRect( iEditIndicator->Position(),
       
   540                 iEditIndicator->Size() ) );
       
   541             }
       
   542 
       
   543         gc.SetClippingRegion( clipReg );
       
   544         clipReg.Close();
       
   545         
       
   546         AknsDrawUtils::Background( skin, cc, this, gc, rect, KAknsDrawParamNoClearUnderImage );
       
   547     
       
   548         clipReg.AddRect( rect );
       
   549 
       
   550         CCoeControl* ctrl = const_cast<CAknMultilineQueryControl*>(this)->ControlByLayoutOrNull( iQueryType );
       
   551         if ( ctrl )
       
   552             {
       
   553             clipReg.SubRect( ctrl->Rect() );
       
   554             }
       
   555 
       
   556         gc.CancelClippingRegion();        
       
   557         gc.SetClippingRegion( clipReg );
       
   558         clipReg.Close();
       
   559         }
       
   560     else
       
   561         {
       
   562         AknsDrawUtils::Background( skin, cc, this, gc, rect );
       
   563         }
       
   564 
       
   565     DrawEditorFrame(gc,rect);
       
   566  
       
   567     if( CAknEnv::Static()->TransparencyEnabled() )
       
   568         {
       
   569         gc.CancelClippingRegion();
       
   570         }
       
   571 
       
   572     //if (iLinePos == EFirstLine || !Layout_Meta_Data::IsLandscapeOrientation())
       
   573     //   iLayoutLineBetweenEntryFields.DrawRect(SystemGc());
       
   574     }
       
   575 
       
   576 void CAknMultilineQueryControl::WindowLayout( TAknWindowLineLayout& aLayout ) const
       
   577     {
       
   578     if (Layout_Meta_Data::IsLandscapeOrientation())
       
   579         {   
       
   580         TInt variety = 0;   
       
   581         TInt promptLines = ( iLinePos == EFirstLine ? iFirstQueryPromptLines-1 : iSecondQueryPromptLines-1 );       
       
   582         
       
   583         if (promptLines < 0)
       
   584             {
       
   585             promptLines = 0;
       
   586             }
       
   587             
       
   588         AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation();
       
   589        
       
   590         if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight)
       
   591             {
       
   592             static const TInt KPopupQueryDataWindowIndex[7] = 
       
   593                 {13, 12, 11, 10, 9, 8, 7}; // variety numbers for right CBA are 7-13 
       
   594             
       
   595             variety = KPopupQueryDataWindowIndex[promptLines];
       
   596             }
       
   597         else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft)
       
   598             {
       
   599             static const TInt KPopupQueryDataWindowIndex[7] = 
       
   600                 {20, 19, 18, 17, 16, 15, 14}; // variety numbers for left CBA are 14-20 
       
   601             variety = KPopupQueryDataWindowIndex[promptLines];
       
   602             }
       
   603         else // bottom
       
   604             {
       
   605             static const TInt KPopupQueryDataWindowIndex[7] = 
       
   606                 {0, 1, 2, 3, 4, 5, 6}; // variety numbers for bottom CBA are 0-6
       
   607             variety = KPopupQueryDataWindowIndex[promptLines];
       
   608             }
       
   609             
       
   610         if(!AknLayoutUtils::PenEnabled())
       
   611             {
       
   612                 aLayout = AknLayoutScalable_Avkon::popup_query_data_window(variety);
       
   613             }
       
   614         else
       
   615             {
       
   616             TBool button=EFalse;
       
   617             
       
   618             if(button || promptLines)
       
   619                 {
       
   620                 aLayout = AknLayoutScalable_Avkon::popup_query_code_window(4);      
       
   621                 }
       
   622             else
       
   623                 {
       
   624                 aLayout = AknLayoutScalable_Avkon::popup_query_code_window(3);      
       
   625                 }
       
   626             }
       
   627         }
       
   628     else
       
   629         {
       
   630         if(!AknLayoutUtils::PenEnabled())
       
   631             {
       
   632             TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
   633             aLayout = AKN_LAYOUT_WINDOW_popup_query_data_code_window(LAFIndex.MainPanePQDCWindow());        
       
   634             }                  
       
   635         else
       
   636             {
       
   637             aLayout = AknLayoutScalable_Avkon::popup_query_data_code_window(2); 
       
   638             }
       
   639         }
       
   640     }
       
   641 
       
   642 void CAknMultilineQueryControl::SizeChanged()
       
   643     {
       
   644     DialogSizeChanged();
       
   645 
       
   646     LayoutPrompt(ECombinedCodeDataQueryLayoutM);
       
   647     LayoutSeparator(ECombinedCodeDataQueryLayoutM);
       
   648     LayoutEditor(ECombinedCodeDataQueryLayoutM);
       
   649 
       
   650     CAknQueryExtension* extension = QueryExtension();
       
   651     if( iHasEditor && extension && extension->EditorContext() )
       
   652         {
       
   653         // Layout editor context
       
   654         TAknLayoutRect topLeft;
       
   655         TAknLayoutRect bottomRight;
       
   656         
       
   657         topLeft.LayoutRect(iEditorFrame.Rect(), SkinLayout::Input_field_skin_placing__general__Line_2());                
       
   658         bottomRight.LayoutRect(TRect(iEditorFrame.Rect().iBr, iEditorFrame.Rect().iBr), SkinLayout::Input_field_skin_placing__general__Line_5());
       
   659 
       
   660         TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
       
   661         TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl);
       
   662 
       
   663         extension->EditorContext()->SetFrameRects( outerRect, innerRect );
       
   664         // Chain with the background (since the frame doesn't occupy the entire
       
   665         // layout and it may even be transparent)
       
   666         extension->EditorContext()->SetParentContext( AknsDrawUtils::ControlContextOfParent( this ) );
       
   667          
       
   668         }
       
   669     
       
   670     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
   671     if ( feedback )
       
   672         {
       
   673         feedback->ChangeFeedbackArea( this, 0, Rect() );
       
   674         feedback->EnableFeedbackForControl( this, !(IsFocused() || Layout_Meta_Data::IsLandscapeOrientation()) );
       
   675         }
       
   676     }
       
   677     
       
   678 EXPORT_C void CAknMultilineQueryControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
   679     { 
       
   680     CAknQueryControl::HandlePointerEventL(aPointerEvent); 
       
   681     }    
       
   682 
       
   683 EXPORT_C void* CAknMultilineQueryControl::ExtensionInterface( TUid /*aInterface*/ ) 
       
   684     { 
       
   685     return NULL;
       
   686     }
       
   687 
       
   688 /**
       
   689  * Layout the query prompt
       
   690  */
       
   691 void CAknMultilineQueryControl::LayoutPrompt(const TLayoutMethod& /*aLayoutM*/)
       
   692     {
       
   693     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
   694 
       
   695     iPrompt->SetRect(DialogRect());
       
   696     TRect rect = LayoutRect();
       
   697     
       
   698     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   699     TRgb color;
       
   700     TInt error = AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19 );
       
   701 
       
   702     for (TInt i = 0; i < NbrOfPromptLines(); i++)
       
   703         {
       
   704         if (iLinePos == EFirstLine || Layout_Meta_Data::IsLandscapeOrientation())
       
   705             AknLayoutUtils::LayoutLabel(iPrompt->Line(i), rect, 
       
   706                 AKN_LAYOUT_TEXT_Combined_data_and_code_query_pop_up_window_texts_Line_1
       
   707                     (LAFIndex.CDCQPWindowTextsLine1(i)));
       
   708         
       
   709         else if (iLinePos == ESecondLine)
       
   710         {
       
   711           if(!AknLayoutUtils::PenEnabled())
       
   712           {
       
   713             AknLayoutUtils::LayoutLabel(iPrompt->Line(i),rect,
       
   714                 AKN_LAYOUT_TEXT_Combined_data_and_code_query_pop_up_window_texts_Line_3
       
   715                     (LAFIndex.CDCQPWindowTextsLine3(i)));
       
   716           }
       
   717           else
       
   718           {
       
   719             TAknTextComponentLayout promtLineVariant;
       
   720             if(i == 0)
       
   721             {
       
   722                 promtLineVariant = AknLayoutScalable_Avkon::popup_query_data_code_window_t3(0);
       
   723             }           
       
   724             else 
       
   725             {   
       
   726                 promtLineVariant = AknLayoutScalable_Avkon::popup_query_data_code_window_t4(0);
       
   727             }
       
   728             AknLayoutUtils::LayoutLabel(iPrompt->Line(i),rect,promtLineVariant);    
       
   729           }
       
   730         }
       
   731         
       
   732         else
       
   733             __ASSERT_DEBUG(0,Panic(EAknPanicNotSupported));
       
   734         
       
   735         if (!error)      
       
   736             {
       
   737             TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *iPrompt->Line(i), EColorLabelText, color ) );        
       
   738             }
       
   739 
       
   740         }
       
   741     }
       
   742 /**
       
   743  * Layout the separation line between the two queries
       
   744  */
       
   745 void CAknMultilineQueryControl::LayoutSeparator(const TLayoutMethod& /*aLayoutM*/)
       
   746     {
       
   747     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
   748 
       
   749     iLayoutLineBetweenEntryFields.LayoutRect(LayoutRect(), 
       
   750         AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_3
       
   751             (LAFIndex.CDCQPWindowLine3()));
       
   752     }
       
   753 
       
   754 /**
       
   755  * Following four function classes allow passing the AknLayoutUtils fcn as as
       
   756  * parameter to DoLayoutEditor()
       
   757  */
       
   758 
       
   759 /**
       
   760  * Layout text editors 
       
   761  */
       
   762 class FLayoutEdwin
       
   763     {
       
   764 public:
       
   765     FLayoutEdwin() { }
       
   766     void operator() (CEikEdwin* aEd, const TRect& aRect, const TAknWindowComponentLayout& aLay, 
       
   767         const CFont* aFont, TBool aMinimizedView) const
       
   768         {
       
   769         TAknTextLineLayout lay = TAknWindowComponentLayout::ComposeText(aLay, AknLayoutScalable_Avkon::query_popup_data_pane_t1(0)).LayoutLine();
       
   770         AknLayoutUtils::LayoutEdwin(aEd,aRect,lay,EAknsCIQsnTextColorsCG27,aFont,aMinimizedView);
       
   771         AknsUtils::RegisterControlPosition(aEd);
       
   772         }
       
   773     };
       
   774 
       
   775 /**
       
   776  * Layout editors containing secret codes
       
   777  */
       
   778 class FLayoutSecretEditor
       
   779     {
       
   780 public:
       
   781     FLayoutSecretEditor() { }
       
   782     void operator() (CEikSecretEditor* aEd, const TRect& aRect, const TAknWindowComponentLayout& aLay,
       
   783         const CFont* /*aFont*/, TBool /*aMinimizedView*/) const
       
   784         { 
       
   785         TAknTextLineLayout lay = TAknWindowComponentLayout::ComposeText(aLay, AknLayoutScalable_Avkon::query_popup_pane_t1()).LayoutLine();
       
   786         AknLayoutUtils::LayoutSecretEditor(aEd,aRect,lay);
       
   787         AknsUtils::RegisterControlPosition(aEd);
       
   788         }
       
   789     };
       
   790 
       
   791 /**
       
   792  * Layout numeric editors 
       
   793  */
       
   794 class FLayoutNumericEdwin
       
   795     {
       
   796 public:
       
   797     FLayoutNumericEdwin() { }
       
   798     void operator() (CAknNumericEdwin* aEd, const TRect& aRect, const TAknWindowComponentLayout& aLay, 
       
   799         const CFont* aFont, TBool aMinimizedView) const
       
   800         {
       
   801         TAknTextLineLayout lay = TAknWindowComponentLayout::ComposeText(aLay, AknLayoutScalable_Avkon::query_popup_data_pane_t1(0)).LayoutLine();
       
   802         AknLayoutUtils::LayoutEdwin(aEd,aRect,lay,EAknsCIQsnTextColorsCG27,aFont,aMinimizedView);
       
   803         AknsUtils::RegisterControlPosition(aEd);
       
   804         }
       
   805     };
       
   806 
       
   807 /**
       
   808  * Layout multifield numeric editors (MFNEs) 
       
   809  */
       
   810 class FLayoutMfne
       
   811     {
       
   812 public:
       
   813     FLayoutMfne(){ }
       
   814     void operator() (CEikMfne* aEd, const TRect& aRect, const TAknWindowComponentLayout& aLay,
       
   815         const CFont* /*aFont*/, TBool /*aMinimizedView*/) const
       
   816         {
       
   817         TAknTextLineLayout lay = TAknWindowComponentLayout::ComposeText(aLay, AknLayoutScalable_Avkon::query_popup_pane_t1()).LayoutLine();
       
   818         AknLayoutUtils::LayoutMfne(aEd,aRect,lay);
       
   819         AknsUtils::RegisterControlPosition(aEd);
       
   820         }
       
   821     };
       
   822 
       
   823 /**
       
   824  * Layout a single editor
       
   825  */
       
   826 template<class Edt, class Fct> 
       
   827 void DoLayoutEditor(const TRect& aRect, Edt* aEd, Fct aFcn, const CAknMultilineQueryControl::TIndex& aLAFIndex,TBool aButton,TInt aNbrPromptLines,
       
   828     const CFont* aCustomFont=0, TBool aMinimizeEdwinView=EFalse)
       
   829     {
       
   830     if (aEd)
       
   831         {
       
   832         if (aLAFIndex.LinePos() == EFirstLine || Layout_Meta_Data::IsLandscapeOrientation())
       
   833             {
       
   834                 if(!AknLayoutUtils::PenEnabled() || !aButton)
       
   835                 {
       
   836             aFcn(aEd, aRect,
       
   837                 AknLayoutScalable_Avkon::query_popup_data_pane_cp2(aLAFIndex.CDCQPWindowTextsLine2()),aCustomFont,aMinimizeEdwinView);
       
   838                 }
       
   839                 else
       
   840                 {
       
   841                 TAknLayoutRect editRect;
       
   842                 editRect.LayoutRect(aRect,AknLayoutScalable_Avkon::cont_query_data_pane());
       
   843                 aFcn(aEd, editRect.Rect(),
       
   844                     AknLayoutScalable_Avkon::query_popup_pane_cp3(),aCustomFont,aMinimizeEdwinView);    
       
   845                 }
       
   846             }
       
   847     
       
   848         else if (aLAFIndex.LinePos() == ESecondLine)
       
   849             {
       
   850                 if(!AknLayoutUtils::PenEnabled())
       
   851                 {
       
   852             aFcn(aEd, aRect,
       
   853                 AknLayoutScalable_Avkon::query_popup_pane_cp2(aLAFIndex.CDCQPWindowTextsLine4()),aCustomFont,aMinimizeEdwinView);
       
   854                 }
       
   855                 else
       
   856                 {
       
   857                  if(!aButton)
       
   858                  {
       
   859                     if(aNbrPromptLines == 1)
       
   860                     {
       
   861                         aFcn(aEd, aRect,AknLayoutScalable_Avkon::query_popup_pane_cp2(5),aCustomFont,aMinimizeEdwinView);          
       
   862                     }
       
   863                     else //aNbrPromptLines = 2
       
   864                     {
       
   865                         aFcn(aEd, aRect,AknLayoutScalable_Avkon::query_popup_pane_cp2(0),aCustomFont,aMinimizeEdwinView);                               
       
   866                     }
       
   867                  }
       
   868                  else
       
   869                  {
       
   870                     TAknLayoutRect editRect;
       
   871                     editRect.LayoutRect(aRect,AknLayoutScalable_Avkon::cont_query_data_pane_cp1());
       
   872                     aFcn(aEd, editRect.Rect(),
       
   873                     AknLayoutScalable_Avkon::query_popup_pane_cp3(),aCustomFont,aMinimizeEdwinView);            
       
   874                  }    
       
   875                 }                                               
       
   876             }
       
   877         
       
   878         else
       
   879         #ifdef _DEBUG
       
   880             __ASSERT_DEBUG(0,Panic(EAknPanicNotSupported));
       
   881         #endif
       
   882         
       
   883         aEd->SetBorder(TGulBorder::ENone); 
       
   884         }
       
   885     }
       
   886 
       
   887 /**
       
   888  * Layout every editor
       
   889  *
       
   890  */
       
   891 void CAknMultilineQueryControl::LayoutEditor(const TLayoutMethod& aLayoutM)
       
   892     {
       
   893     TRect rect = LayoutRect();
       
   894     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
   895     TIndex LAFIndex2(iLinePos,iSecondQueryPromptLines,iSecondQueryPromptLines);
       
   896 
       
   897     const TIndex *index = &LAFIndex;
       
   898     if (Layout_Meta_Data::IsLandscapeOrientation() && iLinePos == ESecondLine)
       
   899         {
       
   900         index = &LAFIndex2;
       
   901         }
       
   902 
       
   903     iHasEditor = ETrue;
       
   904     LayoutEditorFrame(aLayoutM);
       
   905     LayoutEditorIndicator(aLayoutM);
       
   906 
       
   907     TBool button=EFalse;
       
   908     
       
   909     TInt nbrPromptLines = CAknQueryControl::NbrOfPromptLines();
       
   910     DoLayoutEditor(rect,iEdwin,FLayoutEdwin(),*index,button,nbrPromptLines,0,ETrue);
       
   911     DoLayoutEditor(rect,iSecretEd,FLayoutSecretEditor(),*index,button,nbrPromptLines);
       
   912     
       
   913     DoLayoutEditor(rect,iTimeEdwin,FLayoutMfne(),*index,button,nbrPromptLines);
       
   914     DoLayoutEditor(rect,iDateEdwin,FLayoutMfne(),*index,button,nbrPromptLines);
       
   915     
       
   916     DoLayoutEditor(rect,iDurationEdwin,FLayoutMfne(),*index,button,nbrPromptLines);
       
   917     DoLayoutEditor(rect,iNumberEdwin,FLayoutNumericEdwin(),*index,button,nbrPromptLines);
       
   918     
       
   919     DoLayoutEditor(rect,iPinEdwin,FLayoutSecretEditor(),*index,button,nbrPromptLines);
       
   920     DoLayoutEditor(rect,LocationEd(),FLayoutMfne(),*index,button,nbrPromptLines);
       
   921     }
       
   922 
       
   923 /**
       
   924  * Layout the editor frame
       
   925  */
       
   926 void CAknMultilineQueryControl::LayoutEditorFrame(const TLayoutMethod& /*aLayoutM*/)
       
   927     {
       
   928     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
   929     TIndex LAFIndex2(EFirstLine,iSecondQueryPromptLines,iSecondQueryPromptLines);
       
   930     TRect rect = LayoutRect();
       
   931 
       
   932     const TIndex *index = &LAFIndex;
       
   933     if (Layout_Meta_Data::IsLandscapeOrientation() && iLinePos == ESecondLine)
       
   934         {
       
   935         index = &LAFIndex2;
       
   936         }
       
   937     iEditorVerShadow.LayoutRect(rect, 
       
   938         AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_1(!IsFocused(),index->CDCQPWindowLine1()));
       
   939     
       
   940     iEditorHorShadow.LayoutRect(rect, 
       
   941         AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_2(!IsFocused(),index->CDCQPWindowLine2()));
       
   942 
       
   943     TBool button=EFalse;
       
   944     
       
   945     if(!AknLayoutUtils::PenEnabled())
       
   946         {
       
   947     iEditorFrame.LayoutRect    (rect, 
       
   948         AknLayout::Combined_data_and_code_query_pop_up_window_elements_Line_4(index->CDCQPWindowRectangles()));
       
   949         }
       
   950     else
       
   951         {
       
   952             if(!button)                       
       
   953             {
       
   954                if(iLinePos == EFirstLine || Layout_Meta_Data::IsLandscapeOrientation())
       
   955                {
       
   956                     if(NbrOfPromptLines() == 1)
       
   957                     {
       
   958                 iEditorFrame.LayoutRect(rect,AknLayoutScalable_Avkon::query_popup_pane_cp2(4));      
       
   959                     }                     
       
   960                     else //2 lines
       
   961                     {
       
   962                         iEditorFrame.LayoutRect(rect,AknLayoutScalable_Avkon::query_popup_data_pane_cp2(0));            
       
   963                     }
       
   964                }
       
   965                else
       
   966                {
       
   967                     if(NbrOfPromptLines() == 1)
       
   968                     {
       
   969                 iEditorFrame.LayoutRect(rect,AknLayoutScalable_Avkon::query_popup_pane_cp2(5));      
       
   970                     }
       
   971                     else
       
   972                     {
       
   973                        iEditorFrame.LayoutRect(rect,AknLayoutScalable_Avkon::query_popup_pane_cp2(0));                                               
       
   974                     }
       
   975                }
       
   976             }    
       
   977             else
       
   978             {
       
   979                 TAknLayoutRect rectEditorFrame;                
       
   980                 TAknLayoutRect popupRect;                                
       
   981                 if(iLinePos == EFirstLine || Layout_Meta_Data::IsLandscapeOrientation())
       
   982                 {
       
   983                     popupRect.LayoutRect(rect,AknLayoutScalable_Avkon::cont_query_data_pane());         
       
   984                 }
       
   985                 else
       
   986                 {
       
   987                     popupRect.LayoutRect(rect,AknLayoutScalable_Avkon::cont_query_data_pane_cp1());
       
   988                 }
       
   989             iEditorFrame.LayoutRect(popupRect.Rect(),AknLayoutScalable_Avkon::query_popup_pane_cp3());                          
       
   990             }
       
   991         }                                               
       
   992     }
       
   993 
       
   994 /**
       
   995  * Layout the editor indicator icons
       
   996  */
       
   997 void CAknMultilineQueryControl::LayoutEditorIndicator(const TLayoutMethod& /*aLayoutM*/)
       
   998     {
       
   999     CCoeControl* editor = ControlByLayoutOrNull(iQueryType);
       
  1000     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
  1001 
       
  1002     if (!iEditIndicator || !editor || iFlags.IsSet(EEditorIndicatorOff))
       
  1003         return;
       
  1004         
       
  1005     if (editor->IsFocused())
       
  1006         {
       
  1007         TAknWindowLineLayout indicatorLine;
       
  1008         
       
  1009         if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1010             {
       
  1011             TInt promptLines = ( iLinePos == EFirstLine ?
       
  1012                 iFirstQueryPromptLines : iSecondQueryPromptLines );
       
  1013             
       
  1014             static const TInt lineTable[4] = { 2, 2, 1, 3 };
       
  1015                 
       
  1016             indicatorLine = AknLayoutScalable_Avkon::indicator_popup_pane_cp4( lineTable[promptLines] ).LayoutLine();
       
  1017             }
       
  1018         else
       
  1019             {
       
  1020                 if(iLinePos == ESecondLine && AknLayoutUtils::PenEnabled())
       
  1021                 {
       
  1022                     if(NbrOfPromptLines() == 1)
       
  1023                     {
       
  1024                     indicatorLine = AknLayoutScalable_Avkon::indicator_popup_pane_cp2(5);                       
       
  1025                     }
       
  1026                     else
       
  1027                     {
       
  1028                         indicatorLine = AknLayoutScalable_Avkon::indicator_popup_pane_cp2(0);
       
  1029                     }
       
  1030                 }
       
  1031                 else
       
  1032                 {
       
  1033             indicatorLine = AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_5(LAFIndex.CDCQPWindowLine5());
       
  1034                 }
       
  1035             }
       
  1036             
       
  1037         AknLayoutUtils::LayoutControl( iEditIndicator, LayoutRect(), indicatorLine );
       
  1038         }
       
  1039     else
       
  1040         iEditIndicator->SetRect(TRect(TPoint(0,0),TPoint(0,0)));
       
  1041     }
       
  1042     
       
  1043 
       
  1044 EXPORT_C void CAknMultilineQueryControl::HandleResourceChange( TInt aType ) 
       
  1045     {
       
  1046     CCoeControl::HandleResourceChange( aType );
       
  1047         
       
  1048     if ( aType == KAknsMessageSkinChange )
       
  1049         {
       
  1050         CAknQueryExtension* extension = QueryExtension();
       
  1051         if( iHasEditor && extension && extension->EditorContext() )
       
  1052             {
       
  1053             extension->EditorContext()->SetParentContext( AknsDrawUtils::ControlContextOfParent( this ) );
       
  1054             }
       
  1055         }
       
  1056     else if( aType == KEikDynamicLayoutVariantSwitch ) // JLa 22.09.2006 
       
  1057         {
       
  1058         SizeChanged();
       
  1059         }
       
  1060     }    
       
  1061 
       
  1062 
       
  1063 /*****************************************************************
       
  1064  * CAknMultilineQueryControl::TIndex
       
  1065  *
       
  1066  * Manage indexes into LAF tables
       
  1067  *
       
  1068  * PQDC stands for 'Popup Query Data Code'
       
  1069  *
       
  1070  * CDCQP stands for 'Combined Data Code Query Popup'
       
  1071  ******************************************************************/
       
  1072 
       
  1073 /**
       
  1074  * Construction, iLinePos is the position of the current line, either first or
       
  1075  * second. iFirstLine is the numeber of prompt lines for the first query, either 1
       
  1076  * or 2. iSecondline is the number of prompt lines for the second query, either 1 or 2
       
  1077  */ 
       
  1078 CAknMultilineQueryControl::TIndex::TIndex(const TLinePosition& aLinePos, 
       
  1079                                                  TInt aFirstQueryPromptLines, TInt aSecondQueryPromptLines) :
       
  1080     iLinePos(aLinePos), iFirstQueryPromptLines(aFirstQueryPromptLines), iSecondQueryPromptLines(aSecondQueryPromptLines)
       
  1081         {
       
  1082         }
       
  1083 
       
  1084 /**
       
  1085  * Check that we are in a consistent state for retrieving correct indexes
       
  1086  *
       
  1087  */
       
  1088 void CAknMultilineQueryControl::TIndex::SelfTest() const
       
  1089     {
       
  1090     __ASSERT_DEBUG(iLinePos == EFirstLine || iLinePos == ESecondLine,
       
  1091         Panic(EAknPanicInvalidValue));
       
  1092     __ASSERT_DEBUG(iFirstQueryPromptLines >= 0  && iFirstQueryPromptLines <= 2, 
       
  1093         Panic(EAknPanicInvalidValue));
       
  1094     __ASSERT_DEBUG(iSecondQueryPromptLines >= 0 && iSecondQueryPromptLines <= 2, 
       
  1095         Panic(EAknPanicInvalidValue));
       
  1096     }
       
  1097 
       
  1098 /**
       
  1099  * We tolerate a null number of prompt lines. If this is the case we set
       
  1100  * the number of lines to 1 (empty query will use layout of a query with a
       
  1101  * line of text).
       
  1102  */
       
  1103 TInt CAknMultilineQueryControl::TIndex::FirstQueryPromptLines() const
       
  1104     {
       
  1105     SelfTest();
       
  1106     return iFirstQueryPromptLines > 0 ? iFirstQueryPromptLines - 1 : 1;
       
  1107     }
       
  1108 
       
  1109 /**
       
  1110  * We tolerate a null number of prompt lines. If this is the case we set
       
  1111  * the number of lines to 1 (empty query will use layout of a query with a
       
  1112  * line of text).
       
  1113  */
       
  1114 TInt CAknMultilineQueryControl::TIndex::SecondQueryPromptLines() const
       
  1115     {
       
  1116     SelfTest();
       
  1117     return iSecondQueryPromptLines > 0 ? iSecondQueryPromptLines - 1: 1;
       
  1118     }
       
  1119 
       
  1120 
       
  1121 /**
       
  1122  * Return index into Main Pane PQDC Window, which
       
  1123  * depends on total number of prompt lines minus 2, e.g.
       
  1124  * index 0 for 2 prompt lines total.
       
  1125  *
       
  1126  */
       
  1127 TInt CAknMultilineQueryControl::TIndex::MainPanePQDCWindow() const
       
  1128     {
       
  1129     SelfTest();
       
  1130     static const TInt KMainPanePQDCWindow[3] = {0,1,2}; 
       
  1131     return KMainPanePQDCWindow[FirstQueryPromptLines() + SecondQueryPromptLines()];
       
  1132     }
       
  1133 
       
  1134 /**
       
  1135  * Return index into PQDC Window Rectangles, which
       
  1136  * depends on line position and number or prompt lines in
       
  1137  * both queries.
       
  1138  */
       
  1139 TInt CAknMultilineQueryControl::TIndex::CDCQPWindowLine1() const
       
  1140     {
       
  1141     SelfTest();
       
  1142     static const TInt KPQDCWindowRectanglesIndex[2][2][2] = 
       
  1143         {    
       
  1144             {{0,4},{2,6}},   //First  line
       
  1145             {{1,5},{3,7}}    //Second line
       
  1146         };
       
  1147     return KPQDCWindowRectanglesIndex[(TInt)iLinePos][FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  1148     }
       
  1149 
       
  1150 TInt CAknMultilineQueryControl::TIndex::CDCQPWindowLine2() const
       
  1151     {
       
  1152     return CDCQPWindowLine1();
       
  1153     }
       
  1154 
       
  1155 /**
       
  1156  * Return index into PQDC Window Line 3, which depends on number of prompt
       
  1157  * lines in both queries
       
  1158  */
       
  1159 TInt CAknMultilineQueryControl::TIndex::CDCQPWindowLine3() const
       
  1160     {
       
  1161     SelfTest();
       
  1162     static const TInt KCDCQPWindowLine3Index[2][2] = 
       
  1163         {    
       
  1164             {0,2},
       
  1165             {1,3}    
       
  1166         };  
       
  1167     return KCDCQPWindowLine3Index[FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  1168     }
       
  1169 
       
  1170 TInt CAknMultilineQueryControl::TIndex::CDCQPWindowRectangles() const
       
  1171     {
       
  1172     return CDCQPWindowLine1();
       
  1173     }
       
  1174 
       
  1175 TInt CAknMultilineQueryControl::TIndex::CDCQPWindowLine5() const
       
  1176     {
       
  1177     return CDCQPWindowLine1();
       
  1178     }
       
  1179 
       
  1180 
       
  1181 /**
       
  1182  * Return index into 'CDCQP Window texts Line 1', which 
       
  1183  * depends on total number of promt lines and current 
       
  1184  * prompt line number (received as parameter)
       
  1185  */
       
  1186 TInt CAknMultilineQueryControl::TIndex::CDCQPWindowTextsLine1(TInt aLineNum) const
       
  1187     {
       
  1188     SelfTest();
       
  1189     __ASSERT_DEBUG(aLineNum >= 0 && aLineNum < 2,Panic(EAknPanicInvalidValue));
       
  1190 
       
  1191     static const TInt KPQDCWindowTextsLine1Index[2][3] = {
       
  1192         {0,0,2}, //First prompt line
       
  1193         {1,1,3}  //Second prompt line
       
  1194         };
       
  1195     return KPQDCWindowTextsLine1Index[aLineNum][FirstQueryPromptLines() + SecondQueryPromptLines()];
       
  1196     }
       
  1197 
       
  1198 /**
       
  1199  * Return index into 'CDCQP Window texts Line 2', which 
       
  1200  * depends on number of prompt lines in both queries
       
  1201  */
       
  1202 TInt CAknMultilineQueryControl::TIndex::CDCQPWindowTextsLine2() const
       
  1203     {
       
  1204     static const TInt KPQDCWindowTextsLine2Index[2][2] = {
       
  1205         {3,2},
       
  1206         {1,0}
       
  1207         };
       
  1208     return KPQDCWindowTextsLine2Index[FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  1209 
       
  1210     }
       
  1211 
       
  1212 /**
       
  1213  * Return index into 'CDCQP Window texts Line 3', which 
       
  1214  * depends on number of promt lines and current 
       
  1215  * prompt line number (received as parameter)
       
  1216  */
       
  1217 TInt CAknMultilineQueryControl::TIndex::CDCQPWindowTextsLine3(TInt aLineNum) const
       
  1218     {
       
  1219     SelfTest();
       
  1220     __ASSERT_DEBUG(aLineNum >= 0 && aLineNum < 2,Panic(EAknPanicInvalidValue));
       
  1221 
       
  1222     static const TInt KPQDCWindowTextsLine3Index[2][2][2] = {
       
  1223         {{0,0}, {2,3}},  //First prompt line
       
  1224         {{1,1}, {2,4}}   //Second Prompt Line
       
  1225         };
       
  1226     return KPQDCWindowTextsLine3Index[aLineNum][FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  1227     }
       
  1228 
       
  1229 /**
       
  1230  * Return index into 'CDCQP Window texts Line 4', which 
       
  1231  * depends on number of prompt lines in both queries
       
  1232  */
       
  1233 TInt CAknMultilineQueryControl::TIndex::CDCQPWindowTextsLine4() const
       
  1234     {
       
  1235     static const TInt KPQDCWindowTextsLine4Index[2][2] = {
       
  1236         {3,2},
       
  1237         {1,0}
       
  1238         };
       
  1239     return KPQDCWindowTextsLine4Index[FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  1240     }
       
  1241 
       
  1242 /**
       
  1243  * Return index into 'CDCQP Window graphics Line 5', which 
       
  1244  * depends on number of prompt lines in both queries
       
  1245  */
       
  1246 TInt CAknMultilineQueryControl::TIndex::CDCPQWindowGraphicsLine5() const
       
  1247     {
       
  1248     static const TInt KCDCPQWindowGraphicsLine5Index[2][2] = {
       
  1249         {0,0}, 
       
  1250         {0,1}  
       
  1251         };
       
  1252     return KCDCPQWindowGraphicsLine5Index[FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  1253     }
       
  1254 
       
  1255 
       
  1256 
       
  1257 
       
  1258 /*****************************
       
  1259  * CAknExtMultilineQueryControl
       
  1260  *****************************/
       
  1261 
       
  1262 
       
  1263 
       
  1264 EXPORT_C CAknExtMultilineQueryControl::CAknExtMultilineQueryControl() 
       
  1265     : CAknExtQueryControl(), iLinePos(EFirstLine)
       
  1266     {
       
  1267     AKNTASHOOK_ADD( this, "CAknExtMultilineQueryControl" );
       
  1268     }
       
  1269 
       
  1270 //
       
  1271 //Destructor
       
  1272 //
       
  1273 EXPORT_C CAknExtMultilineQueryControl::~CAknExtMultilineQueryControl()
       
  1274 
       
  1275     {
       
  1276     AKNTASHOOK_REMOVE();
       
  1277     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1278     if ( feedback )
       
  1279         {
       
  1280         feedback->RemoveFeedbackForControl( this );
       
  1281         }
       
  1282     }
       
  1283 
       
  1284 /**
       
  1285  *Initializes the member data from resource
       
  1286  */
       
  1287 void CAknExtMultilineQueryControl::ConstructQueryL(TResourceReader& aRes)
       
  1288     {
       
  1289     SetLinePosition();
       
  1290 
       
  1291     if ( iQueryType == EMultiDataFirstIpEd || iQueryType == EMultiDataSecondIpEd )
       
  1292         {           
       
  1293         iIpEditor = new(ELeave)CAknIpFieldEditor;
       
  1294         iIpEditor->SetContainerWindowL(*this);
       
  1295         iIpEditor->ConstructFromResourceL(aRes);
       
  1296         iIpEditor->SetObserver(this);
       
  1297         iIpEditor->SetSkinTextColorL(EAknsCIQsnTextColorsCG27);
       
  1298         if ( AknLayoutUtils::PenEnabled() )
       
  1299             {
       
  1300             iIpEditor->SetFeature( CEikMfne::EFingerSupport, CEikMfne::EnableWithAllHighlight );
       
  1301             }
       
  1302         }  
       
  1303 
       
  1304     // Construct editor context
       
  1305     CAknQueryExtension* extension = QueryExtension();
       
  1306     if( extension )
       
  1307         {
       
  1308         extension->CreateEditorContextL();
       
  1309         }
       
  1310         
       
  1311     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1312     CFeedbackSpec* spec = CFeedbackSpec::New();
       
  1313     if ( feedback && spec )
       
  1314         {
       
  1315         spec->AddFeedback( ETouchEventStylusDown,
       
  1316                            ETouchFeedbackSensitiveList );
       
  1317         feedback->SetFeedbackArea( this, 0, Rect(), spec );
       
  1318         delete spec;
       
  1319         }
       
  1320     }
       
  1321 
       
  1322 
       
  1323 /** 
       
  1324  * Layout rectangle (shift up and left by margins)
       
  1325  */
       
  1326 TRect CAknExtMultilineQueryControl::LayoutRect()
       
  1327     {
       
  1328     TPoint topLeft(0,0);
       
  1329     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
  1330 
       
  1331     TAknLayoutRect layout;
       
  1332     layout.LayoutRect(DialogRect(), AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_graphics_Line_5(DialogRect(), LAFIndex.CDCPQWindowGraphicsLine5()));
       
  1333 
       
  1334     TRect rect(layout.Rect());
       
  1335     topLeft.iX -= rect.iTl.iX;
       
  1336     topLeft.iY -= rect.iTl.iY;
       
  1337 
       
  1338     TPoint bottomRight (topLeft);
       
  1339     TSize  size (MinimumSize());
       
  1340     bottomRight.iY += size.iHeight; 
       
  1341     bottomRight.iX += size.iWidth;
       
  1342 
       
  1343     return TRect(topLeft,bottomRight);
       
  1344     }
       
  1345 
       
  1346 
       
  1347 /**
       
  1348  * Depending on layout type determine control position in the dialog
       
  1349  */
       
  1350 void CAknExtMultilineQueryControl::SetLinePosition()
       
  1351     {
       
  1352     if ( iQueryType == EMultiDataSecondIpEd )
       
  1353         {   
       
  1354         iLinePos = ESecondLine;
       
  1355         }
       
  1356     }
       
  1357 
       
  1358 
       
  1359 /**
       
  1360  * Set the line width for the prompt lines
       
  1361  *
       
  1362  * This is a virtual method called by CAknQueryControl::DoSetPromptL()
       
  1363  *
       
  1364  * Depending on LAF information and on weather we are the first or the second 
       
  1365  * query line, we can work out the line widths by indexing the LAF tables.
       
  1366  *
       
  1367  */
       
  1368 void CAknExtMultilineQueryControl::SetLineWidthsL()
       
  1369     {
       
  1370     if (!iLineWidths)
       
  1371         return;
       
  1372     
       
  1373     iLineWidths->Reset();
       
  1374 
       
  1375     TAknLayoutRect parentLayoutRect;
       
  1376     
       
  1377     if (Layout_Meta_Data::IsLandscapeOrientation())
       
  1378         parentLayoutRect.LayoutRect(iAvkonAppUi->ClientRect(), AKN_LAYOUT_WINDOW_popup_query_data_window(0));
       
  1379     else
       
  1380         parentLayoutRect.LayoutRect(iAvkonAppUi->ClientRect(), AKN_LAYOUT_WINDOW_popup_query_data_code_window(0));
       
  1381     
       
  1382     //parentLayoutRect.LayoutRect(iAvkonAppUi->ClientRect(), AKN_LAYOUT_WINDOW_popup_query_data_code_window(0));
       
  1383     TAknLayoutText textRect;
       
  1384 
       
  1385     for (TInt i = 0; i < 2; i++)
       
  1386         {
       
  1387         if (iLinePos == EFirstLine || Layout_Meta_Data::IsLandscapeOrientation())
       
  1388             {
       
  1389             textRect.LayoutText(parentLayoutRect.Rect(), AKN_LAYOUT_TEXT_Combined_data_and_code_query_pop_up_window_texts_Line_1(0));
       
  1390             iLineWidths->AppendL(textRect.TextRect().Width());
       
  1391             }
       
  1392         else if (iLinePos == ESecondLine)
       
  1393             {
       
  1394             textRect.LayoutText(parentLayoutRect.Rect(), AKN_LAYOUT_TEXT_Combined_data_and_code_query_pop_up_window_texts_Line_3(0));
       
  1395             iLineWidths->AppendL(textRect.TextRect().Width());
       
  1396             }
       
  1397         }
       
  1398     }
       
  1399 
       
  1400 
       
  1401 EXPORT_C TBool CAknExtMultilineQueryControl::IsFirst() const
       
  1402     {
       
  1403     return iLinePos == EFirstLine;
       
  1404     }
       
  1405 
       
  1406 EXPORT_C TBool CAknExtMultilineQueryControl::IsSecond() const
       
  1407     {
       
  1408     return !IsFirst();
       
  1409     }
       
  1410 
       
  1411 /**
       
  1412  * Set the number of prompt lines.
       
  1413  *
       
  1414  * The query dialog calls this method in order to communicate the number of prompt lines
       
  1415  * in the other query line. Indexing into LAF tables depends on this.
       
  1416  *
       
  1417  */
       
  1418 EXPORT_C void CAknExtMultilineQueryControl::SetNbrOfPromptLines( 
       
  1419                                             TInt aNbrOfPromptLinesFirstLine, 
       
  1420                                             TInt aNbrOfPromptLinesSecondLine)
       
  1421     {
       
  1422     iFirstQueryPromptLines  = aNbrOfPromptLinesFirstLine;
       
  1423     iSecondQueryPromptLines = aNbrOfPromptLinesSecondLine;
       
  1424     }
       
  1425 
       
  1426 
       
  1427 EXPORT_C CCoeControl* CAknExtMultilineQueryControl::ControlByLayoutOrNull(TInt aLayout)
       
  1428     {
       
  1429     CCoeControl* ctrl=NULL;
       
  1430     if ( aLayout == EMultiDataFirstIpEd || aLayout == EMultiDataSecondIpEd )
       
  1431         {
       
  1432         ctrl = iIpEditor;
       
  1433         }   
       
  1434     return ctrl;
       
  1435     }
       
  1436 
       
  1437 
       
  1438 /**
       
  1439  * Return control minimum size
       
  1440  *
       
  1441  * Size is calculated by using LAF tables. Index in this table depends on the 
       
  1442  * total number of prompt lines in both queries
       
  1443  */
       
  1444 EXPORT_C TSize CAknExtMultilineQueryControl::MinimumSize()
       
  1445     {
       
  1446     TAknLayoutRect layout;  
       
  1447     TAknWindowLineLayout window;
       
  1448     WindowLayout( window );    
       
  1449     
       
  1450     TRect mainPane;
       
  1451     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent, mainPane );
       
  1452     layout.LayoutRect( mainPane, window );
       
  1453     TRect rect2(layout.Rect()); 
       
  1454     TSize size = rect2.Size();
       
  1455 
       
  1456     if (IsFirst())
       
  1457         {
       
  1458         size.iHeight = FirstLineHeight(); 
       
  1459         }        
       
  1460     else if (Layout_Meta_Data::IsLandscapeOrientation() && IsSecond())
       
  1461         {
       
  1462         size.iHeight = SecondLineHeight();
       
  1463         }    
       
  1464     else if (IsSecond())
       
  1465         {
       
  1466         TAknWindowLineLayout layoutLine = AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_graphics_Line_5(DialogRect(),0);
       
  1467         TAknLayoutRect layoutRect;
       
  1468         layoutRect.LayoutRect(rect2, layoutLine);
       
  1469         TRect rect(layoutRect.Rect());
       
  1470         size.iHeight = rect.Height() - FirstLineHeight();
       
  1471         }
       
  1472       
       
  1473     else
       
  1474         __ASSERT_DEBUG(0,Panic(EAknPanicNotSupported));
       
  1475     
       
  1476     return size;
       
  1477   }
       
  1478 
       
  1479 
       
  1480 /**
       
  1481  * Return height of first line control, use separator to determine this.
       
  1482  */
       
  1483 TInt16 CAknExtMultilineQueryControl::FirstLineHeight() const
       
  1484     {
       
  1485     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
  1486 
       
  1487     TAknWindowLineLayout separator = 
       
  1488         AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_3
       
  1489             (LAFIndex.CDCQPWindowLine3());
       
  1490 
       
  1491     TAknLayoutRect layout;
       
  1492     layout.LayoutRect(TRect(), separator);
       
  1493     TRect rect(layout.Rect());
       
  1494     return (TInt16)(rect.iTl.iY + rect.Height());
       
  1495     }
       
  1496     
       
  1497 TInt16 CAknExtMultilineQueryControl::SecondLineHeight() const
       
  1498     {
       
  1499     TIndex LAFIndex(iLinePos,iSecondQueryPromptLines,iFirstQueryPromptLines);
       
  1500 
       
  1501     TAknWindowLineLayout separator = 
       
  1502         AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_3
       
  1503             (LAFIndex.CDCQPWindowLine3());
       
  1504 
       
  1505     TAknLayoutRect layout;
       
  1506     layout.LayoutRect(TRect(), separator);
       
  1507     TRect rect(layout.Rect());
       
  1508     return (TInt16)(rect.iTl.iY + rect.Height());
       
  1509     }
       
  1510 
       
  1511 
       
  1512 /**
       
  1513  * Draw method.
       
  1514  *
       
  1515  * Draw line between query lines only if we are the first line.
       
  1516  */
       
  1517 
       
  1518 void CAknExtMultilineQueryControl::Draw(const TRect& aRect) const
       
  1519     {
       
  1520     if (Layout_Meta_Data::IsLandscapeOrientation())
       
  1521         {
       
  1522         if( CAknEnv::Static()->TransparencyEnabled() )
       
  1523             {
       
  1524             if ( IsFocused() )
       
  1525                 {
       
  1526                 CAknExtQueryControl::Draw(aRect);
       
  1527                 }
       
  1528             }
       
  1529         else
       
  1530             {
       
  1531             CAknExtQueryControl::Draw(aRect);
       
  1532             }
       
  1533         return;
       
  1534         }
       
  1535         
       
  1536     CWindowGc& gc=SystemGc(); 
       
  1537     TRect rect(Rect());    
       
  1538     
       
  1539     if (IsSecond())
       
  1540         {                
       
  1541         TAknWindowLineLayout dimension;
       
  1542         WindowLayout( dimension );
       
  1543 
       
  1544         TAknLayoutRect layout;
       
  1545         layout.LayoutRect(iAvkonAppUi->ClientRect(), dimension);
       
  1546         TRect rect2(layout.Rect());
       
  1547         TAknWindowLineLayout layoutLine = AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_graphics_Line_5(rect2,0);
       
  1548         TAknLayoutRect layoutRect;
       
  1549         layoutRect.LayoutRect(rect2, layoutLine);
       
  1550         TRect rect3(layoutRect.Rect());
       
  1551         rect.iBr.iY += rect3.Height() - rect.Height();
       
  1552         }           
       
  1553 
       
  1554     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  1555     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
  1556     
       
  1557     if( CAknEnv::Static()->TransparencyEnabled() )
       
  1558         {
       
  1559         RRegion clipReg;
       
  1560         clipReg.AddRect( rect );
       
  1561 
       
  1562         if ( iHasEditor )
       
  1563             {
       
  1564             clipReg.SubRect( iEditorFrame.Rect() );
       
  1565             }
       
  1566 
       
  1567         if ( iEditIndicator )
       
  1568             {
       
  1569             clipReg.SubRect(
       
  1570                 TRect( iEditIndicator->Position(),
       
  1571                 iEditIndicator->Size() ) );
       
  1572             }
       
  1573 
       
  1574         gc.SetClippingRegion( clipReg );
       
  1575         clipReg.Close();
       
  1576         
       
  1577         AknsDrawUtils::Background( skin, cc, this, gc, rect, KAknsDrawParamNoClearUnderImage );
       
  1578     
       
  1579         clipReg.AddRect( rect );
       
  1580 
       
  1581         CCoeControl* ctrl = const_cast<CAknExtMultilineQueryControl*>(this)->ControlByLayoutOrNull( iQueryType );
       
  1582         if ( ctrl )
       
  1583             {
       
  1584             clipReg.SubRect( ctrl->Rect() );
       
  1585             }
       
  1586 
       
  1587         gc.CancelClippingRegion();        
       
  1588         gc.SetClippingRegion( clipReg );
       
  1589         clipReg.Close();
       
  1590         }
       
  1591     else
       
  1592         {
       
  1593         AknsDrawUtils::Background( skin, cc, this, gc, rect );
       
  1594         }
       
  1595 
       
  1596     DrawEditorFrame(gc,rect);
       
  1597  
       
  1598     if( CAknEnv::Static()->TransparencyEnabled() )
       
  1599         {
       
  1600         gc.CancelClippingRegion();
       
  1601         }
       
  1602     }
       
  1603   
       
  1604     
       
  1605 EXPORT_C void CAknExtMultilineQueryControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
  1606     { 
       
  1607     CAknExtQueryControl::HandlePointerEventL(aPointerEvent); 
       
  1608     }    
       
  1609 
       
  1610 EXPORT_C void* CAknExtMultilineQueryControl::ExtensionInterface( TUid /*aInterface*/ ) 
       
  1611     { 
       
  1612     return NULL;
       
  1613     }
       
  1614 
       
  1615 void CAknExtMultilineQueryControl::WindowLayout( TAknWindowLineLayout& aLayout ) const
       
  1616     {
       
  1617     if (Layout_Meta_Data::IsLandscapeOrientation())
       
  1618         {
       
  1619         TInt variety = 0;   
       
  1620         TInt promptLines = ( iLinePos == EFirstLine ? iFirstQueryPromptLines-1 : iSecondQueryPromptLines-1 );       
       
  1621         
       
  1622         if (promptLines < 0)
       
  1623             {
       
  1624             promptLines = 0;
       
  1625             }
       
  1626             
       
  1627         AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation();
       
  1628        
       
  1629         if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight)
       
  1630             {
       
  1631             static const TInt KPopupQueryDataWindowIndex[7] = 
       
  1632                 {13, 12, 11, 10, 9, 8, 7}; // variety numbers for right CBA are 7-13 
       
  1633             
       
  1634             variety = KPopupQueryDataWindowIndex[promptLines];
       
  1635             }
       
  1636         else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft)
       
  1637             {
       
  1638             static const TInt KPopupQueryDataWindowIndex[7] = 
       
  1639                 {20, 19, 18, 17, 16, 15, 14}; // variety numbers for left CBA are 14-20 
       
  1640             variety = KPopupQueryDataWindowIndex[promptLines];
       
  1641             }
       
  1642         else // bottom
       
  1643             {
       
  1644             static const TInt KPopupQueryDataWindowIndex[7] = 
       
  1645                 {0, 1, 2, 3, 4, 5, 6}; // variety numbers for bottom CBA are 0-6
       
  1646             variety = KPopupQueryDataWindowIndex[promptLines];
       
  1647             }
       
  1648             
       
  1649         aLayout = AknLayoutScalable_Avkon::popup_query_data_window(variety);    
       
  1650         }
       
  1651     else
       
  1652         {
       
  1653         TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
  1654         aLayout = AKN_LAYOUT_WINDOW_popup_query_data_code_window(LAFIndex.MainPanePQDCWindow());        
       
  1655         }
       
  1656     }
       
  1657 
       
  1658 
       
  1659 
       
  1660 void CAknExtMultilineQueryControl::SizeChanged()
       
  1661     {
       
  1662     DialogSizeChanged();
       
  1663     
       
  1664     LayoutPrompt(ECombinedCodeDataQueryLayoutM);
       
  1665     LayoutSeparator(ECombinedCodeDataQueryLayoutM);
       
  1666     LayoutEditor(ECombinedCodeDataQueryLayoutM);
       
  1667 
       
  1668     CAknQueryExtension* extension = QueryExtension();
       
  1669     if( iHasEditor && extension && extension->EditorContext() )
       
  1670         {
       
  1671         // Layout editor context
       
  1672         TAknLayoutRect topLeft;
       
  1673         TAknLayoutRect bottomRight;
       
  1674         
       
  1675         topLeft.LayoutRect(iEditorFrame.Rect(), SkinLayout::Input_field_skin_placing__general__Line_2());                
       
  1676         bottomRight.LayoutRect(TRect(iEditorFrame.Rect().iBr, iEditorFrame.Rect().iBr), SkinLayout::Input_field_skin_placing__general__Line_5());
       
  1677 
       
  1678         TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
       
  1679         TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl);
       
  1680 
       
  1681         extension->EditorContext()->SetFrameRects( outerRect, innerRect );
       
  1682         // Chain with the background (since the frame doesn't occupy the entire
       
  1683         // layout and it may even be transparent)
       
  1684         extension->EditorContext()->SetParentContext( AknsDrawUtils::ControlContextOfParent( this ) );
       
  1685         }
       
  1686         
       
  1687     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1688     if ( feedback )
       
  1689         {
       
  1690         feedback->ChangeFeedbackArea( this, 0, Rect() );
       
  1691         feedback->EnableFeedbackForControl( this, !(IsFocused() || Layout_Meta_Data::IsLandscapeOrientation()) );
       
  1692         } 
       
  1693     }
       
  1694 
       
  1695 /**
       
  1696  * Layout the query prompt
       
  1697  */
       
  1698 void CAknExtMultilineQueryControl::LayoutPrompt(const TLayoutMethod& /*aLayoutM*/)
       
  1699     {
       
  1700     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
  1701 
       
  1702     iPrompt->SetRect(DialogRect());
       
  1703     TRect rect = LayoutRect();
       
  1704 
       
  1705     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  1706     TRgb color;
       
  1707     TInt error = AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19 );
       
  1708 
       
  1709     for (TInt i = 0; i < NbrOfPromptLines(); i++)
       
  1710         {
       
  1711         if (iLinePos == EFirstLine || Layout_Meta_Data::IsLandscapeOrientation())
       
  1712             AknLayoutUtils::LayoutLabel(iPrompt->Line(i), rect, 
       
  1713                 AKN_LAYOUT_TEXT_Combined_data_and_code_query_pop_up_window_texts_Line_1
       
  1714                     (LAFIndex.CDCQPWindowTextsLine1(i)));
       
  1715         
       
  1716         else if (iLinePos == ESecondLine)
       
  1717             AknLayoutUtils::LayoutLabel(iPrompt->Line(i),rect,
       
  1718                 AKN_LAYOUT_TEXT_Combined_data_and_code_query_pop_up_window_texts_Line_3
       
  1719                     (LAFIndex.CDCQPWindowTextsLine3(i)));
       
  1720         
       
  1721         else
       
  1722             __ASSERT_DEBUG(0,Panic(EAknPanicNotSupported));
       
  1723 
       
  1724         if (!error)      
       
  1725             {
       
  1726             TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *iPrompt->Line(i), EColorLabelText, color ) );        
       
  1727             }
       
  1728         }
       
  1729     }
       
  1730 /**
       
  1731  * Layout the separation line between the two queries
       
  1732  */
       
  1733 void CAknExtMultilineQueryControl::LayoutSeparator(const TLayoutMethod& /*aLayoutM*/)
       
  1734     {
       
  1735     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
  1736 
       
  1737     iLayoutLineBetweenEntryFields.LayoutRect(LayoutRect(), 
       
  1738         AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_3
       
  1739             (LAFIndex.CDCQPWindowLine3()));
       
  1740     }
       
  1741 
       
  1742 
       
  1743 /**
       
  1744  * Layout multifield numeric editors (MFNEs) 
       
  1745  */
       
  1746 class FLayoutMfne2
       
  1747     {
       
  1748 public:
       
  1749     FLayoutMfne2(){ }
       
  1750     void operator() (CEikMfne* aEd, const TRect& aRect, const TAknWindowComponentLayout& aLay,
       
  1751         const CFont* /*aFont*/, TBool /*aMinimizedView*/) const
       
  1752         {
       
  1753         TAknTextLineLayout lay = TAknWindowComponentLayout::ComposeText(aLay, AknLayoutScalable_Avkon::query_popup_pane_t1()).LayoutLine();
       
  1754         AknLayoutUtils::LayoutMfne(aEd,aRect,lay);
       
  1755         AknsUtils::RegisterControlPosition(aEd);
       
  1756         }
       
  1757     };
       
  1758 
       
  1759 /**
       
  1760  * Layout a single editor
       
  1761  */
       
  1762 template<class Edt, class Fct> 
       
  1763 void DoLayoutEditor(const TRect& aRect, Edt* aEd, Fct aFcn, const CAknExtMultilineQueryControl::TIndex& aLAFIndex,
       
  1764     const CFont* aCustomFont=0, TBool aMinimizeEdwinView=EFalse)
       
  1765     {
       
  1766     if (aEd)
       
  1767         {
       
  1768         if (aLAFIndex.LinePos() == EFirstLine || Layout_Meta_Data::IsLandscapeOrientation())
       
  1769             {
       
  1770             aFcn(aEd, aRect,
       
  1771                 AknLayoutScalable_Avkon::query_popup_data_pane_cp2(aLAFIndex.CDCQPWindowTextsLine2()),aCustomFont,aMinimizeEdwinView);
       
  1772             }                
       
  1773         else if (aLAFIndex.LinePos() == ESecondLine)
       
  1774             {
       
  1775             aFcn(aEd, aRect,
       
  1776                 AknLayoutScalable_Avkon::query_popup_pane_cp2(aLAFIndex.CDCQPWindowTextsLine4()),aCustomFont,aMinimizeEdwinView);
       
  1777             }                    
       
  1778         else
       
  1779         #ifdef _DEBUG
       
  1780             __ASSERT_DEBUG(0,Panic(EAknPanicNotSupported));
       
  1781         #endif
       
  1782         
       
  1783         aEd->SetBorder(TGulBorder::ENone); 
       
  1784         }
       
  1785     }
       
  1786 
       
  1787 
       
  1788 /**
       
  1789  * Layout every editor
       
  1790  *
       
  1791  */
       
  1792 void CAknExtMultilineQueryControl::LayoutEditor(const TLayoutMethod& aLayoutM)
       
  1793     {
       
  1794     TRect rect = LayoutRect();
       
  1795     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
  1796     TIndex LAFIndex2(iLinePos,iSecondQueryPromptLines,iSecondQueryPromptLines);
       
  1797 
       
  1798     const TIndex *index = &LAFIndex;
       
  1799     if (Layout_Meta_Data::IsLandscapeOrientation() && iLinePos == ESecondLine)
       
  1800         {
       
  1801         index = &LAFIndex2;
       
  1802         }
       
  1803 
       
  1804     iHasEditor = ETrue;
       
  1805     LayoutEditorFrame(aLayoutM);
       
  1806     LayoutEditorIndicator(aLayoutM);
       
  1807     
       
  1808     DoLayoutEditor(rect,iIpEditor,FLayoutMfne2(), *index);
       
  1809     }
       
  1810 
       
  1811 /**
       
  1812  * Layout the editor frame
       
  1813  */
       
  1814 void CAknExtMultilineQueryControl::LayoutEditorFrame(const TLayoutMethod& /*aLayoutM*/)
       
  1815     {
       
  1816     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
  1817     TIndex LAFIndex2(EFirstLine,iSecondQueryPromptLines,iSecondQueryPromptLines);
       
  1818     TRect rect = LayoutRect();
       
  1819     
       
  1820     const TIndex *index = &LAFIndex;
       
  1821     if (Layout_Meta_Data::IsLandscapeOrientation() && iLinePos == ESecondLine)
       
  1822         {
       
  1823         index = &LAFIndex2;
       
  1824         }
       
  1825 
       
  1826     iEditorVerShadow.LayoutRect(rect, 
       
  1827         AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_1(!IsFocused(), index->CDCQPWindowLine1()));
       
  1828     
       
  1829     iEditorHorShadow.LayoutRect(rect, 
       
  1830         AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_2(!IsFocused(), index->CDCQPWindowLine2()));
       
  1831 
       
  1832     iEditorFrame.LayoutRect    (rect, 
       
  1833         AknLayout::Combined_data_and_code_query_pop_up_window_elements_Line_4(index->CDCQPWindowRectangles()));
       
  1834     }
       
  1835 
       
  1836 /**
       
  1837  * Layout the editor indicator icons
       
  1838  */
       
  1839 void CAknExtMultilineQueryControl::LayoutEditorIndicator(const TLayoutMethod& /*aLayoutM*/)
       
  1840     {
       
  1841     CCoeControl* editor = ControlByLayoutOrNull(iQueryType);
       
  1842     TIndex LAFIndex(iLinePos,iFirstQueryPromptLines,iSecondQueryPromptLines);
       
  1843 
       
  1844     if (!iEditIndicator || !editor || iFlags.IsSet(EEditorIndicatorOff))
       
  1845         return;
       
  1846         
       
  1847     if (editor->IsFocused())
       
  1848         {
       
  1849         TAknWindowLineLayout indicatorLine;
       
  1850         
       
  1851         if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1852             {
       
  1853             TInt promptLines = ( iLinePos == EFirstLine ? iFirstQueryPromptLines : iSecondQueryPromptLines );            
       
  1854             static const TInt lineTable[4] = { 2, 2, 1, 3 };                
       
  1855             indicatorLine = AknLayoutScalable_Avkon::indicator_popup_pane_cp4( lineTable[promptLines] ).LayoutLine();
       
  1856             }
       
  1857         else
       
  1858             {
       
  1859             indicatorLine = AKN_LAYOUT_WINDOW_Combined_data_and_code_query_pop_up_window_elements_Line_5(LAFIndex.CDCQPWindowLine5());
       
  1860             }
       
  1861             
       
  1862         AknLayoutUtils::LayoutControl( iEditIndicator, LayoutRect(), indicatorLine );
       
  1863         }
       
  1864     else
       
  1865         iEditIndicator->SetRect(TRect(TPoint(0,0),TPoint(0,0)));
       
  1866     }
       
  1867     
       
  1868     
       
  1869 EXPORT_C void CAknExtMultilineQueryControl::HandleResourceChange( TInt aType ) 
       
  1870     {
       
  1871     CCoeControl::HandleResourceChange( aType );
       
  1872         
       
  1873     if ( aType == KAknsMessageSkinChange )
       
  1874         {
       
  1875         CAknQueryExtension* extension = QueryExtension();
       
  1876         if( iHasEditor && extension && extension->EditorContext() )
       
  1877             {
       
  1878             extension->EditorContext()->SetParentContext( AknsDrawUtils::ControlContextOfParent( this ) );
       
  1879             }
       
  1880         }
       
  1881     else if( aType == KEikDynamicLayoutVariantSwitch ) 
       
  1882         {
       
  1883         SizeChanged(); 
       
  1884         }
       
  1885     }    
       
  1886 
       
  1887 
       
  1888 /*****************************************************************
       
  1889  * CAknExtMultilineQueryControl::TIndex
       
  1890  *
       
  1891  * Manage indexes into LAF tables
       
  1892  *
       
  1893  * PQDC stands for 'Popup Query Data Code'
       
  1894  *
       
  1895  * CDCQP stands for 'Combined Data Code Query Popup'
       
  1896  ******************************************************************/
       
  1897 
       
  1898 /**
       
  1899  * Construction, iLinePos is the position of the current line, either first or
       
  1900  * second. iFirstLine is the numeber of prompt lines for the first query, either 1
       
  1901  * or 2. iSecondline is the number of prompt lines for the second query, either 1 or 2
       
  1902  */ 
       
  1903 CAknExtMultilineQueryControl::TIndex::TIndex(const TLinePosition& aLinePos, 
       
  1904                                                  TInt aFirstQueryPromptLines, TInt aSecondQueryPromptLines) :
       
  1905     iLinePos(aLinePos), iFirstQueryPromptLines(aFirstQueryPromptLines), iSecondQueryPromptLines(aSecondQueryPromptLines)
       
  1906         {
       
  1907         }
       
  1908 
       
  1909 /**
       
  1910  * Check that we are in a consistent state for retrieving correct indexes
       
  1911  *
       
  1912  */
       
  1913 void CAknExtMultilineQueryControl::TIndex::SelfTest() const
       
  1914     {
       
  1915     __ASSERT_DEBUG(iLinePos == EFirstLine || iLinePos == ESecondLine,
       
  1916         Panic(EAknPanicInvalidValue));
       
  1917     __ASSERT_DEBUG(iFirstQueryPromptLines >= 0  && iFirstQueryPromptLines <= 2, 
       
  1918         Panic(EAknPanicInvalidValue));
       
  1919     __ASSERT_DEBUG(iSecondQueryPromptLines >= 0 && iSecondQueryPromptLines <= 2, 
       
  1920         Panic(EAknPanicInvalidValue));
       
  1921     }
       
  1922 
       
  1923 /**
       
  1924  * We tolerate a null number of prompt lines. If this is the case we set
       
  1925  * the number of lines to 1 (empty query will use layout of a query with a
       
  1926  * line of text).
       
  1927  */
       
  1928 TInt CAknExtMultilineQueryControl::TIndex::FirstQueryPromptLines() const
       
  1929     {
       
  1930     SelfTest();
       
  1931     return iFirstQueryPromptLines > 0 ? iFirstQueryPromptLines - 1 : 1;
       
  1932     }
       
  1933 
       
  1934 /**
       
  1935  * We tolerate a null number of prompt lines. If this is the case we set
       
  1936  * the number of lines to 1 (empty query will use layout of a query with a
       
  1937  * line of text).
       
  1938  */
       
  1939 TInt CAknExtMultilineQueryControl::TIndex::SecondQueryPromptLines() const
       
  1940     {
       
  1941     SelfTest();
       
  1942     return iSecondQueryPromptLines > 0 ? iSecondQueryPromptLines - 1: 1;
       
  1943     }
       
  1944 
       
  1945 
       
  1946 /**
       
  1947  * Return index into Main Pane PQDC Window, which
       
  1948  * depends on total number of prompt lines minus 2, e.g.
       
  1949  * index 0 for 2 prompt lines total.
       
  1950  *
       
  1951  */
       
  1952 TInt CAknExtMultilineQueryControl::TIndex::MainPanePQDCWindow() const
       
  1953     {
       
  1954     SelfTest();
       
  1955     static const TInt KMainPanePQDCWindow[3] = {0,1,2}; 
       
  1956     return KMainPanePQDCWindow[FirstQueryPromptLines() + SecondQueryPromptLines()];
       
  1957     }
       
  1958 
       
  1959 /**
       
  1960  * Return index into PQDC Window Rectangles, which
       
  1961  * depends on line position and number or prompt lines in
       
  1962  * both queries.
       
  1963  */
       
  1964 TInt CAknExtMultilineQueryControl::TIndex::CDCQPWindowLine1() const
       
  1965     {
       
  1966     SelfTest();
       
  1967     static const TInt KPQDCWindowRectanglesIndex[2][2][2] = 
       
  1968         {    
       
  1969             {{0,4},{2,6}},   //First  line
       
  1970             {{1,5},{3,7}}    //Second line
       
  1971         };
       
  1972     return KPQDCWindowRectanglesIndex[(TInt)iLinePos][FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  1973     }
       
  1974 
       
  1975 TInt CAknExtMultilineQueryControl::TIndex::CDCQPWindowLine2() const
       
  1976     {
       
  1977     return CDCQPWindowLine1();
       
  1978     }
       
  1979 
       
  1980 /**
       
  1981  * Return index into PQDC Window Line 3, which depends on number of prompt
       
  1982  * lines in both queries
       
  1983  */
       
  1984 TInt CAknExtMultilineQueryControl::TIndex::CDCQPWindowLine3() const
       
  1985     {
       
  1986     SelfTest();
       
  1987     static const TInt KCDCQPWindowLine3Index[2][2] = 
       
  1988         {    
       
  1989             {0,2},
       
  1990             {1,3}    
       
  1991         };  
       
  1992     return KCDCQPWindowLine3Index[FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  1993     }
       
  1994 
       
  1995 TInt CAknExtMultilineQueryControl::TIndex::CDCQPWindowRectangles() const
       
  1996     {
       
  1997     return CDCQPWindowLine1();
       
  1998     }
       
  1999 
       
  2000 TInt CAknExtMultilineQueryControl::TIndex::CDCQPWindowLine5() const
       
  2001     {
       
  2002     return CDCQPWindowLine1();
       
  2003     }
       
  2004 
       
  2005 
       
  2006 /**
       
  2007  * Return index into 'CDCQP Window texts Line 1', which 
       
  2008  * depends on total number of promt lines and current 
       
  2009  * prompt line number (received as parameter)
       
  2010  */
       
  2011 TInt CAknExtMultilineQueryControl::TIndex::CDCQPWindowTextsLine1(TInt aLineNum) const
       
  2012     {
       
  2013     SelfTest();
       
  2014     __ASSERT_DEBUG(aLineNum >= 0 && aLineNum < 2,Panic(EAknPanicInvalidValue));
       
  2015 
       
  2016     static const TInt KPQDCWindowTextsLine1Index[2][3] = {
       
  2017         {0,0,2}, //First prompt line
       
  2018         {1,1,3}  //Second prompt line
       
  2019         };
       
  2020     return KPQDCWindowTextsLine1Index[aLineNum][FirstQueryPromptLines() + SecondQueryPromptLines()];
       
  2021     }
       
  2022 
       
  2023 /**
       
  2024  * Return index into 'CDCQP Window texts Line 2', which 
       
  2025  * depends on number of prompt lines in both queries
       
  2026  */
       
  2027 TInt CAknExtMultilineQueryControl::TIndex::CDCQPWindowTextsLine2() const
       
  2028     {
       
  2029     static const TInt KPQDCWindowTextsLine2Index[2][2] = {
       
  2030         {3,2},
       
  2031         {1,0}  
       
  2032         };
       
  2033     return KPQDCWindowTextsLine2Index[FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  2034 
       
  2035     }
       
  2036 
       
  2037 /**
       
  2038  * Return index into 'CDCQP Window texts Line 3', which 
       
  2039  * depends on number of promt lines and current 
       
  2040  * prompt line number (received as parameter)
       
  2041  */
       
  2042 TInt CAknExtMultilineQueryControl::TIndex::CDCQPWindowTextsLine3(TInt aLineNum) const
       
  2043     {
       
  2044     SelfTest();
       
  2045     __ASSERT_DEBUG(aLineNum >= 0 && aLineNum < 2,Panic(EAknPanicInvalidValue));
       
  2046 
       
  2047     static const TInt KPQDCWindowTextsLine3Index[2][2][2] = {
       
  2048         {{0,0}, {2,3}},  //First prompt line
       
  2049         {{1,1}, {2,4}}   //Second Prompt Line
       
  2050         };
       
  2051     return KPQDCWindowTextsLine3Index[aLineNum][FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  2052     }
       
  2053 
       
  2054 /**
       
  2055  * Return index into 'CDCQP Window texts Line 4', which 
       
  2056  * depends on number of prompt lines in both queries
       
  2057  */
       
  2058 TInt CAknExtMultilineQueryControl::TIndex::CDCQPWindowTextsLine4() const
       
  2059     {
       
  2060     static const TInt KPQDCWindowTextsLine4Index[2][2] = {
       
  2061         {3,2},
       
  2062         {1,0}
       
  2063         };
       
  2064     return KPQDCWindowTextsLine4Index[FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  2065     }
       
  2066 
       
  2067 /**
       
  2068  * Return index into 'CDCQP Window graphics Line 5', which 
       
  2069  * depends on number of prompt lines in both queries
       
  2070  */
       
  2071 TInt CAknExtMultilineQueryControl::TIndex::CDCPQWindowGraphicsLine5() const
       
  2072     {
       
  2073     static const TInt KCDCPQWindowGraphicsLine5Index[2][2] = {
       
  2074         {0,0}, 
       
  2075         {0,1}  
       
  2076         };
       
  2077     return KCDCPQWindowGraphicsLine5Index[FirstQueryPromptLines()][SecondQueryPromptLines()];
       
  2078     }
       
  2079 
       
  2080 // End of File