textinput/peninputarc/src/peninputclient/peninputclient.cpp
changeset 0 eb1f2e154e89
child 10 6defe5d1bd39
child 13 3b79bedfdc20
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation for peninput client
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "peninputclient.h"
       
    20 #include "peninputclientimpl.h"
       
    21 
       
    22 
       
    23 // ---------------------------------------------------------------------------
       
    24 // RPeninputServer::RPeninputServer
       
    25 // ---------------------------------------------------------------------------
       
    26 //
       
    27 EXPORT_C RPeninputServer::RPeninputServer()
       
    28     {
       
    29     }
       
    30 
       
    31 EXPORT_C TInt RPeninputServer::ConnectAsyc(TRequestStatus& aStatus)
       
    32     { 
       
    33     TInt err;
       
    34     TRAP(err, iSingletonServer = RPeninputServerImpl::NewL(&aStatus));    
       
    35     if( !iSingletonServer )   
       
    36         {
       
    37         return KErrGeneral;
       
    38         }
       
    39     //return iSingletonServer->ConnectAsync(status);
       
    40     return err;
       
    41     }
       
    42 // ---------------------------------------------------------------------------
       
    43 // RPeninputServer::Connect
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 EXPORT_C TInt RPeninputServer::Connect()
       
    47     { 
       
    48     TInt err;
       
    49     TRAP(err, iSingletonServer = RPeninputServerImpl::NewL());    
       
    50     if( !iSingletonServer )   
       
    51         {
       
    52         return KErrGeneral;
       
    53         }
       
    54     return err;
       
    55     /************************************************************************/
       
    56     // There might be several connect coming when server is not launched.    
       
    57     /************************************************************************/
       
    58     /*TInt error = KErrNone;
       
    59     CCoeStatic * obj = CCoeEnv::Static()->FindStatic(KSingletonClientId);
       
    60     CPenInputSingletonClient* client = 
       
    61                                 static_cast<CPenInputSingletonClient*>(obj);
       
    62     if(client && client->IsValid())
       
    63         {
       
    64         RPeninputServerImpl* iSingletonServer = client->GetSingletonServer();
       
    65         if(iSingletonServer == 0 ) // second or later connecting from same client
       
    66             {
       
    67             error = KErrLaunchingServer;
       
    68             }
       
    69         }
       
    70     else
       
    71         {
       
    72         TRAP(error, iSingletonServer = RPeninputServerImpl::NewL(KSingletonClientId));
       
    73         }
       
    74     return error;    */
       
    75     }
       
    76 
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // RPeninputServer::Close
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 EXPORT_C void RPeninputServer::Close()
       
    83     {
       
    84     if(iSingletonServer)
       
    85         iSingletonServer->Close();
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // RPeninputServer::Version
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 EXPORT_C TVersion RPeninputServer::Version(void) const
       
    93     {
       
    94     return iSingletonServer->Version() ;
       
    95     }
       
    96 
       
    97 
       
    98 
       
    99 EXPORT_C void RPeninputServer::DimUiLayout(TBool aFlag)
       
   100     {
       
   101     iSingletonServer->DimUiLayout(aFlag);
       
   102     }
       
   103 // ---------------------------------------------------------------------------
       
   104 // RPeninputServer::ActivateLayout
       
   105 // Activate/Deactivate a ui layout
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 EXPORT_C void RPeninputServer::ActivateLayout(TBool aFlag)
       
   109     {
       
   110     iSingletonServer->ActivateLayout(aFlag);
       
   111     }
       
   112 
       
   113 EXPORT_C void RPeninputServer::ActivatePeninputInNotesL()
       
   114     {
       
   115     iSingletonServer->ActivatePeninputInNotesL();    
       
   116     }
       
   117 // ---------------------------------------------------------------------------
       
   118 // RPeninputServer::GetServerEventData
       
   119 // Retrieve server event data
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 EXPORT_C TInt RPeninputServer::GetServerEventData(TDes& aBuf)
       
   123     {
       
   124     return iSingletonServer->GetServerEventData(aBuf);
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // RPeninputServer::ServerEventDfataNum
       
   129 // Get the number of server event
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 EXPORT_C TInt RPeninputServer::ServerEventDataNum()
       
   133     {  
       
   134     return iSingletonServer->ServerEventDataNum();    
       
   135     }
       
   136 
       
   137 // ---------------------------------------------------------------------------
       
   138 // RPeninputServer::ResourceChanged
       
   139 // Tell server the client resource changed
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 EXPORT_C void RPeninputServer::ResourceChanged(TInt aType)
       
   143     {
       
   144     iSingletonServer->ResourceChanged(aType);
       
   145     }
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 // RPeninputServer::SetUiLayoutPos
       
   149 // Set ui layout position
       
   150 // ---------------------------------------------------------------------------
       
   151 //
       
   152 EXPORT_C TInt RPeninputServer::SetUiLayoutPos(const TPoint& aPos)
       
   153     {
       
   154     return iSingletonServer->SetUiLayoutPos(aPos); 
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------------------------
       
   158 // RPeninputServer::UiLayoutPos
       
   159 // get ui layout position
       
   160 // ---------------------------------------------------------------------------
       
   161 //
       
   162 EXPORT_C TPoint RPeninputServer::UiLayoutPos()
       
   163     {
       
   164     return iSingletonServer->UiLayoutPos();    
       
   165     }
       
   166 
       
   167 // ---------------------------------------------------------------------------
       
   168 // RPeninputServer::UiLayoutSize
       
   169 // get ui layout size
       
   170 // ---------------------------------------------------------------------------
       
   171 //
       
   172 EXPORT_C TSize RPeninputServer::UiLayoutSize()
       
   173     {
       
   174     return iSingletonServer->UiLayoutSize();    
       
   175     }
       
   176 
       
   177 // ---------------------------------------------------------------------------
       
   178 // RPeninputServer::SetUiLayoutId
       
   179 // Create a ui layout
       
   180 // ---------------------------------------------------------------------------
       
   181 //
       
   182 EXPORT_C TInt RPeninputServer::SetUiLayoutId(TUid aId)
       
   183     {
       
   184     return iSingletonServer->SetUiLayoutId(aId); 
       
   185     }
       
   186 
       
   187 // ---------------------------------------------------------------------------
       
   188 // RPeninputServer::SetUiLayoutId
       
   189 // Create a ui layout
       
   190 // ---------------------------------------------------------------------------
       
   191 //
       
   192 EXPORT_C TInt RPeninputServer::SetUiLayoutId(TUid aId,const TDesC8& aData)
       
   193     {
       
   194     return iSingletonServer->SetUiLayoutId(aId,aData);
       
   195     }
       
   196 
       
   197 // ---------------------------------------------------------------------------
       
   198 // RPeninputServer::HandleCommand
       
   199 // Ask ui layout handle command
       
   200 // ---------------------------------------------------------------------------
       
   201 //
       
   202 EXPORT_C TInt RPeninputServer::HandleCommand(TInt aCmd,const TDesC8& aBuf)
       
   203     {
       
   204     return iSingletonServer->HandleCommand(aCmd,aBuf);
       
   205     }
       
   206 
       
   207 // ---------------------------------------------------------------------------
       
   208 // RPeninputServer::HandleCommand
       
   209 // Ask ui layout handle command
       
   210 // ---------------------------------------------------------------------------
       
   211 //
       
   212 EXPORT_C TInt RPeninputServer::HandleCommand(TInt aCmd)
       
   213     {
       
   214     return iSingletonServer->HandleCommand(aCmd);       
       
   215     }
       
   216 
       
   217 // ---------------------------------------------------------------------------
       
   218 // RPeninputServer::HandleCommand
       
   219 // Ask ui layout handle command
       
   220 // ---------------------------------------------------------------------------
       
   221 //
       
   222 EXPORT_C TInt RPeninputServer::HandleCommand(TInt aCmd,const TDesC8& aBuf, TInt &aResult)
       
   223     {
       
   224     return iSingletonServer->HandleCommand(aCmd, aBuf, aResult);
       
   225     }
       
   226     
       
   227 // ---------------------------------------------------------------------------
       
   228 // RPeninputServer::IsVisible
       
   229 // ---------------------------------------------------------------------------
       
   230 //
       
   231 EXPORT_C TBool RPeninputServer::IsVisible()
       
   232     {
       
   233     return iSingletonServer->IsVisible();
       
   234     }
       
   235     
       
   236 // ---------------------------------------------------------------------------
       
   237 // RPeninputServer::IsVisible
       
   238 // ---------------------------------------------------------------------------
       
   239 //
       
   240 EXPORT_C TBool RPeninputServer::IsDimmed()
       
   241     {
       
   242     return iSingletonServer->IsDimmed();
       
   243     }
       
   244 
       
   245 // ---------------------------------------------------------------------------
       
   246 // RPeninputServer::SupportInputMode
       
   247 // ---------------------------------------------------------------------------
       
   248 //
       
   249 EXPORT_C TInt RPeninputServer::SupportInputMode()
       
   250     {
       
   251     return iSingletonServer->SupportInputMode();
       
   252     }
       
   253 
       
   254 EXPORT_C TInt RPeninputServer::SetInputLanguage( TInt aLanguage )
       
   255 	{
       
   256 	return iSingletonServer->SetInputLanguage( aLanguage );
       
   257 	}
       
   258 
       
   259 // ---------------------------------------------------------------------------
       
   260 // RPeninputServer::AddPeninputServerObserverL
       
   261 // Add observer
       
   262 // ---------------------------------------------------------------------------
       
   263 //
       
   264 EXPORT_C void RPeninputServer::AddPeninputServerObserverL(
       
   265                                        MPeninputServerEventHandler* aHandler)
       
   266     {
       
   267     iSingletonServer->AddPeninputServerObserverL(aHandler);
       
   268     }
       
   269 
       
   270 // ---------------------------------------------------------------------------
       
   271 // RPeninputServer::RemovePeninputServerObserver
       
   272 // remove all observer
       
   273 // ---------------------------------------------------------------------------
       
   274 //
       
   275 EXPORT_C void RPeninputServer::RemovePeninputServerObserver()
       
   276     {
       
   277     iSingletonServer->RemovePeninputServerObserver();
       
   278     }
       
   279 
       
   280 
       
   281 // ---------------------------------------------------------------------------
       
   282 // RPeninputServer::RemovePeninputServerObserver
       
   283 // Remove an observer
       
   284 // ---------------------------------------------------------------------------
       
   285 //
       
   286 EXPORT_C void RPeninputServer::RemovePeninputServerObserver(
       
   287                                          MPeninputServerEventHandler* aObserver)
       
   288     {
       
   289     iSingletonServer->RemovePeninputServerObserver(aObserver);
       
   290     }
       
   291 
       
   292 // ---------------------------------------------------------------------------
       
   293 // RPeninputServer::SetDisplayMode
       
   294 // Set the display mode
       
   295 // ---------------------------------------------------------------------------
       
   296 //
       
   297 EXPORT_C void RPeninputServer::SetDisplayMode(TDisplayMode aDisplayMode,
       
   298                                                 TDisplayMode aMaskDisplayMode)
       
   299     {
       
   300     iSingletonServer->SetDisplayMode( aDisplayMode, aMaskDisplayMode); 
       
   301     }
       
   302 
       
   303  
       
   304 // ---------------------------------------------------------------------------
       
   305 // RPeninputServer::ClearServerEvent
       
   306 // Set the display mode
       
   307 // ---------------------------------------------------------------------------
       
   308 //
       
   309 EXPORT_C void RPeninputServer::ClearServerEvent()
       
   310     {        
       
   311     iSingletonServer->ClearServerEvent();
       
   312     }
       
   313 
       
   314 // ---------------------------------------------------------------------------
       
   315 // RPeninputServer::SetDisplayMode
       
   316 // To disable specified layouts at a time.
       
   317 // ---------------------------------------------------------------------------
       
   318 //
       
   319 EXPORT_C void RPeninputServer::SetDisabledLayout( TInt aLayouts )
       
   320     {
       
   321     iSingletonServer->SetDisabledLayout( aLayouts);
       
   322     }
       
   323     
       
   324 // ---------------------------------------------------------------------------
       
   325 // RPeninputServer::DisabledLayout
       
   326 // To disable specified layouts at a time.
       
   327 // ---------------------------------------------------------------------------
       
   328 //
       
   329 EXPORT_C TInt RPeninputServer::DisabledLayout()
       
   330     {
       
   331     return iSingletonServer->DisabledLayout();
       
   332     }    
       
   333     
       
   334 // ---------------------------------------------------------------------------
       
   335 // RPeninputServer::GetImePluginIdListL
       
   336 // Get IME plugin list for a language
       
   337 // ---------------------------------------------------------------------------
       
   338 //
       
   339 EXPORT_C void RPeninputServer::GetImePluginIdListL(TInt aLanguage, 
       
   340                                                   TInt aPluginMode, 
       
   341                                                   RArray<TInt>& aImplmentationIds)
       
   342     {
       
   343     iSingletonServer->GetImePluginIdListL(aLanguage,aPluginMode,aImplmentationIds);
       
   344     }
       
   345   
       
   346 // ---------------------------------------------------------------------------
       
   347 // RPeninputServer::PenSupportLanguagesL
       
   348 // Get pen supported langauge
       
   349 // ---------------------------------------------------------------------------
       
   350 //                                 
       
   351 EXPORT_C void RPeninputServer::PenSupportLanguagesL(RArray<TInt>& aLanguageLists)
       
   352     {
       
   353     iSingletonServer->PenSupportLanguagesL(aLanguageLists);
       
   354     }
       
   355 
       
   356 
       
   357 // ---------------------------------------------------------------------------
       
   358 // RPeninputServer::SetForeground
       
   359 // Set current session to be foreground application session
       
   360 // ---------------------------------------------------------------------------
       
   361 //
       
   362 EXPORT_C TBool RPeninputServer::SetForeground(TBool aMustConnectFlag)
       
   363     {
       
   364     return iSingletonServer->SetForeground(aMustConnectFlag);
       
   365     }
       
   366     
       
   367 // ---------------------------------------------------------------------------
       
   368 // RPeninputServer::LoseForeground
       
   369 // Indicates current client lost foreground
       
   370 // ---------------------------------------------------------------------------
       
   371 //    
       
   372 EXPORT_C void RPeninputServer::LoseForeground()
       
   373     {
       
   374     iSingletonServer->LoseForeground();
       
   375     }
       
   376 // ---------------------------------------------------------------------------
       
   377 // RPeninputServer::IsForeground
       
   378 // Test whether this session is the forground application session
       
   379 // ---------------------------------------------------------------------------
       
   380 //
       
   381 EXPORT_C TBool RPeninputServer::IsForeground()
       
   382     {
       
   383     return iSingletonServer->IsForeground();
       
   384     }
       
   385 
       
   386 // ---------------------------------------------------------------------------
       
   387 // RPeninputServer::AddPenUiActivationHandler
       
   388 // Add an UI activate/deactivation handler
       
   389 // ---------------------------------------------------------------------------
       
   390 //
       
   391 EXPORT_C TInt RPeninputServer::AddPenUiActivationHandler(
       
   392                       MPenUiActivationHandler* aHandler,TInt aType)
       
   393     {   
       
   394     return iSingletonServer->AddPenUiActivationHandler(aHandler,aType);
       
   395     }
       
   396     
       
   397 // ---------------------------------------------------------------------------
       
   398 // RPeninputServer::RemovePenUiActivationHandler
       
   399 // Remove all UI activate/deactivation handler
       
   400 // ---------------------------------------------------------------------------
       
   401 //    
       
   402 EXPORT_C void RPeninputServer::RemovePenUiActivationHandler()
       
   403     {
       
   404     iSingletonServer->RemovePenUiActivationHandler();
       
   405     }
       
   406 
       
   407 // ---------------------------------------------------------------------------
       
   408 // RPeninputServer::RemovePenUiActivationHandler
       
   409 // Remove an UI activate/deactivation handler
       
   410 // Deprecated API
       
   411 // ---------------------------------------------------------------------------
       
   412 //    
       
   413 EXPORT_C void RPeninputServer::RemovePenUiActivationHandler(MPenUiActivationHandler 
       
   414                                                                     *aHandler)
       
   415     {
       
   416     iSingletonServer->RemovePenUiActivationHandler(aHandler);
       
   417     }
       
   418 
       
   419 // ---------------------------------------------------------------------------
       
   420 // RPeninputServer::UpdateAppInfo
       
   421 // Update current application information
       
   422 // ---------------------------------------------------------------------------
       
   423 //   
       
   424 EXPORT_C void RPeninputServer::UpdateAppInfo(const TDesC& aInfo, TPeninputAppInfo aType)
       
   425     {
       
   426     iSingletonServer->UpdateAppInfo(aInfo, aType);
       
   427     }
       
   428 
       
   429 // ---------------------------------------------------------------------------
       
   430 // RPeninputServer::SetAutoOpen
       
   431 // Enable/disable the auto-open feature
       
   432 // ---------------------------------------------------------------------------
       
   433 //   
       
   434 EXPORT_C void RPeninputServer::SetAutoOpen(TBool aFlag)
       
   435     {
       
   436 	iSingletonServer->SetAutoOpen(aFlag);
       
   437     }
       
   438 
       
   439 // ---------------------------------------------------------------------------
       
   440 // RPeninputServer::AutoOpen
       
   441 // get the the auto-open feature flag
       
   442 // ---------------------------------------------------------------------------
       
   443 //     
       
   444 EXPORT_C TBool RPeninputServer::AutoOpen()    
       
   445     {
       
   446 	return iSingletonServer->AutoOpen();	
       
   447     }
       
   448 
       
   449 EXPORT_C void RPeninputServer::BackgroudDefaultOri( TInt aOri )
       
   450     {
       
   451     iSingletonServer->BackgroudDefaultOri(aOri);
       
   452     }
       
   453     
       
   454 EXPORT_C void RPeninputServer::SetPreferredUiMode(TPluginInputMode aMode)
       
   455     {
       
   456     iSingletonServer->SetPreferredUiMode(aMode);
       
   457     }
       
   458 
       
   459 EXPORT_C TPluginInputMode RPeninputServer::PreferredUiMode()
       
   460     {
       
   461     return iSingletonServer->PreferredUiMode();
       
   462     }
       
   463 
       
   464 // ---------------------------------------------------------------------------
       
   465 // RPeninputServer::SetGlobalNotes
       
   466 // Enable/disable the auto-open feature
       
   467 // ---------------------------------------------------------------------------
       
   468 //    
       
   469 EXPORT_C void RPeninputServer::SetGlobalNotes(TBool aFlag)
       
   470     {
       
   471 	iSingletonServer->SetGlobalNotes(aFlag);
       
   472     } 
       
   473     
       
   474 // ---------------------------------------------------------------------------
       
   475 // RPeninputServer::SetAutoOpen
       
   476 // Enable/disable the auto-open feature
       
   477 // ---------------------------------------------------------------------------
       
   478 //   
       
   479 EXPORT_C void RPeninputServer::SetInternalPopUp(TBool aFlag)
       
   480     {
       
   481 	iSingletonServer->SetInternalPopUp(aFlag);
       
   482     }  
       
   483     
       
   484 // ---------------------------------------------------------------------------
       
   485 // RPeninputServer::SetAutoOpen
       
   486 // Enable/disable the auto-open feature
       
   487 // ---------------------------------------------------------------------------
       
   488 //   
       
   489 EXPORT_C void RPeninputServer::SetEditorPriority(TInt aFlag)
       
   490     {
       
   491 	iSingletonServer->SetEditorPriority(aFlag);
       
   492     }       
       
   493     
       
   494 EXPORT_C void RPeninputServer::ClearTouchUI()  
       
   495     {
       
   496     iSingletonServer->ClearTouchUI();   
       
   497     }
       
   498     
       
   499 EXPORT_C void RPeninputServer::SetResourceChange(TBool aFlag)  
       
   500     {
       
   501     iSingletonServer->SetResourceChange(aFlag);   
       
   502     }    
       
   503 
       
   504 //end of class RPeninputServer
       
   505 // End of File