Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

782 lines
21 KiB

  1. // This is implementation for CSpPropItemsServer
  2. #include "private.h"
  3. #include "globals.h"
  4. #include "propitem.h"
  5. #include "cregkey.h"
  6. extern "C" HRESULT WINAPI TF_GetGlobalCompartment(ITfCompartmentMgr **pCompMgr);
  7. // Common functions about Setting /Getting global compartment values.
  8. HRESULT _SetGlobalCompDWORD(REFGUID rguid, DWORD dw)
  9. {
  10. HRESULT hr = S_OK;
  11. CComPtr<ITfCompartmentMgr> cpGlobalCompMgr;
  12. CComPtr<ITfCompartment> cpComp;
  13. VARIANT var;
  14. hr = TF_GetGlobalCompartment(&cpGlobalCompMgr);
  15. if ( hr == S_OK )
  16. hr = cpGlobalCompMgr->GetCompartment(rguid, &cpComp);
  17. if ( hr == S_OK )
  18. {
  19. var.vt = VT_I4;
  20. var.lVal = dw;
  21. hr = cpComp->SetValue(0, &var);
  22. }
  23. return hr;
  24. }
  25. HRESULT _GetGlobalCompDWORD(REFGUID rguid, DWORD *pdw)
  26. {
  27. HRESULT hr = S_OK;
  28. CComPtr<ITfCompartmentMgr> cpGlobalCompMgr;
  29. CComPtr<ITfCompartment> cpComp;
  30. VARIANT var;
  31. hr = TF_GetGlobalCompartment(&cpGlobalCompMgr);
  32. if ( hr == S_OK )
  33. hr = cpGlobalCompMgr->GetCompartment(rguid, &cpComp);
  34. if ( hr == S_OK )
  35. hr = cpComp->GetValue(&var);
  36. if ( hr == S_OK)
  37. {
  38. Assert(var.vt == VT_I4);
  39. *pdw = var.lVal;
  40. }
  41. return hr;
  42. }
  43. //
  44. // ctor
  45. //
  46. CPropItem::CPropItem(PROP_ITEM_ID idPropItem, LPCTSTR lpszValueName, PROP_STATUS psDefault)
  47. {
  48. int iLen = lstrlen(lpszValueName);
  49. m_lpszValueName = (LPTSTR)cicMemAlloc((iLen+1) * sizeof(TCHAR));
  50. if ( m_lpszValueName )
  51. {
  52. StringCchCopy(m_lpszValueName, iLen+1, lpszValueName);
  53. }
  54. m_psDefault = psDefault;
  55. m_psStatus = PROP_UNINITIALIZED;
  56. m_fIsStatus = TRUE;
  57. m_PropItemId = idPropItem;
  58. m_pguidComp = NULL;
  59. m_dwMaskBit = 0;
  60. }
  61. CPropItem::CPropItem(PROP_ITEM_ID idPropItem, LPCTSTR lpszValueName, DWORD dwDefault)
  62. {
  63. int iLen = lstrlen(lpszValueName);
  64. m_lpszValueName = (LPTSTR)cicMemAlloc((iLen+1) * sizeof(TCHAR));
  65. if ( m_lpszValueName )
  66. {
  67. StringCchCopy(m_lpszValueName,iLen+1, lpszValueName);
  68. }
  69. m_dwDefault = dwDefault;
  70. m_dwValue = UNINIT_VALUE;
  71. m_fIsStatus = FALSE;
  72. m_PropItemId = idPropItem;
  73. m_pguidComp = NULL;
  74. m_dwMaskBit = 0;
  75. }
  76. CPropItem::CPropItem(PROP_ITEM_ID idPropItem, GUID *pguidComp, DWORD dwMaskBit, PROP_STATUS psDefault)
  77. {
  78. m_lpszValueName = NULL;
  79. m_psDefault = psDefault;
  80. m_psStatus = PROP_UNINITIALIZED;
  81. m_fIsStatus = TRUE;
  82. m_PropItemId = idPropItem;
  83. m_pguidComp = (GUID *) cicMemAlloc(sizeof(GUID));
  84. if ( m_pguidComp && pguidComp)
  85. CopyMemory(m_pguidComp, pguidComp, sizeof(GUID));
  86. m_dwMaskBit = dwMaskBit;
  87. }
  88. CPropItem::CPropItem(CPropItem *pItem)
  89. {
  90. Assert(pItem);
  91. m_PropItemId = pItem->GetPropItemId( );
  92. m_fIsStatus = pItem->IsStatusPropItem( );
  93. if ( pItem->IsGlobalCompartPropItem( ) )
  94. {
  95. // This is a Global compartment property item.
  96. m_lpszValueName = NULL;
  97. m_pguidComp = (GUID *) cicMemAlloc(sizeof(GUID));
  98. if (m_pguidComp)
  99. CopyMemory(m_pguidComp, pItem->GetCompGuid( ), sizeof(GUID));
  100. m_dwMaskBit = pItem->GetMaskBit( );
  101. }
  102. else
  103. {
  104. // This is a registry value property item.
  105. m_pguidComp = NULL;
  106. m_dwMaskBit = 0;
  107. TCHAR *pItemRegValue;
  108. pItemRegValue = pItem->GetRegValue( );
  109. Assert(pItemRegValue);
  110. int iStrLen;
  111. iStrLen = lstrlen(pItemRegValue);
  112. m_lpszValueName = (LPTSTR)cicMemAlloc((iStrLen+1) * sizeof(TCHAR));
  113. if ( m_lpszValueName )
  114. {
  115. StringCchCopy(m_lpszValueName, iStrLen+1, pItemRegValue);
  116. }
  117. }
  118. if ( m_fIsStatus )
  119. {
  120. m_psDefault = pItem->GetPropDefaultStatus( );
  121. m_psStatus = pItem->GetPropStatus( ) ? PROP_ENABLED : PROP_DISABLED;
  122. }
  123. else
  124. {
  125. m_dwDefault = pItem->GetPropDefaultValue( );
  126. m_dwValue = pItem->GetPropValue( );
  127. }
  128. }
  129. CPropItem::~CPropItem( )
  130. {
  131. if ( m_lpszValueName )
  132. cicMemFree(m_lpszValueName);
  133. if ( m_pguidComp )
  134. cicMemFree(m_pguidComp);
  135. }
  136. //
  137. // Common method functions to get and set values from /to registry
  138. //
  139. HRESULT CPropItem::_GetRegValue(HKEY hRootKey, DWORD *pdwValue)
  140. {
  141. HRESULT hr=S_FALSE;
  142. Assert(hRootKey);
  143. Assert(pdwValue);
  144. if ( IsGlobalCompartPropItem( ) ) return S_FALSE;
  145. CMyRegKey regkey;
  146. DWORD dw;
  147. hr = regkey.Open(hRootKey, c_szSapilayrKey, KEY_READ);
  148. if (S_OK == hr )
  149. {
  150. if (ERROR_SUCCESS==regkey.QueryValue(dw, m_lpszValueName))
  151. *pdwValue = dw;
  152. else
  153. hr = S_FALSE;
  154. }
  155. return hr;
  156. }
  157. void CPropItem::_SetRegValue(HKEY hRootKey, DWORD dwValue)
  158. {
  159. Assert(hRootKey);
  160. if ( IsGlobalCompartPropItem( ) )
  161. return;
  162. // Registry setting
  163. CMyRegKey regkey;
  164. if (S_OK == regkey.Create(hRootKey, c_szSapilayrKey))
  165. {
  166. regkey.SetValue(dwValue, m_lpszValueName);
  167. }
  168. }
  169. BOOL CPropItem::GetPropStatus(BOOL fForceFromReg )
  170. {
  171. // Cleanup: if we can introuce two separate derived classes for status property and value property,
  172. // there is no need to check m_fIsStatus this way.
  173. //
  174. // Compiler will detect any potential wrong code.
  175. if ( !m_fIsStatus )
  176. return FALSE;
  177. if (fForceFromReg || (m_psStatus == PROP_UNINITIALIZED) )
  178. {
  179. DWORD dw;
  180. if ( IsGlobalCompartPropItem( ) )
  181. {
  182. if ( S_OK == _GetGlobalCompDWORD(*m_pguidComp, &dw) )
  183. m_psStatus = (dw & m_dwMaskBit) ? PROP_ENABLED : PROP_DISABLED;
  184. }
  185. else
  186. {
  187. // This is Registry setting
  188. if ( (S_OK == _GetRegValue(HKEY_CURRENT_USER, &dw)) ||
  189. (S_OK == _GetRegValue(HKEY_LOCAL_MACHINE, &dw)) )
  190. {
  191. m_psStatus = (dw > 0) ? PROP_ENABLED : PROP_DISABLED;
  192. }
  193. }
  194. if (m_psStatus == PROP_UNINITIALIZED)
  195. m_psStatus = m_psDefault;
  196. }
  197. return PROP_ENABLED == m_psStatus;
  198. }
  199. DWORD CPropItem::GetPropValue(BOOL fForceFromReg )
  200. {
  201. if ( m_fIsStatus )
  202. return UNINIT_VALUE;
  203. if (fForceFromReg || (m_dwValue == UNINIT_VALUE) )
  204. {
  205. if ( (S_OK != _GetRegValue(HKEY_CURRENT_USER, &m_dwValue)) &&
  206. (S_OK != _GetRegValue(HKEY_LOCAL_MACHINE,&m_dwValue)) )
  207. {
  208. m_dwValue = m_dwDefault;
  209. }
  210. }
  211. return m_dwValue;
  212. }
  213. void CPropItem::SetPropStatus(BOOL fEnable)
  214. {
  215. if ( m_fIsStatus )
  216. m_psStatus = fEnable ? PROP_ENABLED : PROP_DISABLED;
  217. }
  218. void CPropItem::SetPropValue(DWORD dwValue )
  219. {
  220. if ( !m_fIsStatus )
  221. m_dwValue = dwValue;
  222. }
  223. void CPropItem::SaveDefaultRegValue( )
  224. {
  225. if ( IsGlobalCompartPropItem( ) )
  226. return;
  227. DWORD dw;
  228. if ( m_fIsStatus )
  229. dw = (m_psDefault == PROP_ENABLED ? 1 : 0 );
  230. else
  231. dw = m_dwDefault;
  232. _SetRegValue(HKEY_LOCAL_MACHINE, dw);
  233. }
  234. void CPropItem::SavePropData( )
  235. {
  236. DWORD dw;
  237. if ( m_fIsStatus )
  238. dw = (DWORD)GetPropStatus( );
  239. else
  240. dw = GetPropValue( );
  241. if ( IsGlobalCompartPropItem( ) )
  242. {
  243. // Global compartment setting
  244. if ( m_pguidComp && m_dwMaskBit )
  245. {
  246. DWORD dwComp;
  247. _GetGlobalCompDWORD(*m_pguidComp, &dwComp);
  248. if ( dw )
  249. dwComp |= m_dwMaskBit;
  250. else
  251. dwComp &= ~m_dwMaskBit;
  252. _SetGlobalCompDWORD(*m_pguidComp, dwComp);
  253. }
  254. }
  255. else
  256. {
  257. // Registry setting
  258. _SetRegValue(HKEY_CURRENT_USER, dw);
  259. }
  260. }
  261. //
  262. // CSpPropItemsServer
  263. //
  264. CSpPropItemsServer::CSpPropItemsServer( )
  265. {
  266. m_fInitialized = FALSE;
  267. m_PropItems = NULL;
  268. }
  269. CSpPropItemsServer::CSpPropItemsServer(CSpPropItemsServer *pItemBaseServer, PROP_ITEM_ID idPropMin, PROP_ITEM_ID idPropMax)
  270. {
  271. Assert(pItemBaseServer);
  272. m_dwNumOfItems = 0;
  273. m_fInitialized = FALSE;
  274. m_PropItems = (CPropItem **) cicMemAlloc(((DWORD)idPropMax - (DWORD)idPropMin + 1) * sizeof(CPropItem *));
  275. if ( m_PropItems )
  276. {
  277. DWORD dwPropItemId;
  278. for (dwPropItemId=(DWORD)idPropMin; dwPropItemId<= (DWORD)idPropMax; dwPropItemId ++ )
  279. {
  280. // Find the propitem from the Base Server
  281. CPropItem *pItem;
  282. pItem = pItemBaseServer->_GetPropItem((PROP_ITEM_ID)dwPropItemId);
  283. if ( pItem )
  284. {
  285. m_PropItems[m_dwNumOfItems] = (CPropItem *) new CPropItem(pItem);
  286. if ( m_PropItems[m_dwNumOfItems] )
  287. m_dwNumOfItems ++;
  288. }
  289. }
  290. if ( m_dwNumOfItems > 0 )
  291. m_fInitialized = TRUE;
  292. else
  293. cicMemFree(m_PropItems);
  294. }
  295. }
  296. CSpPropItemsServer::~CSpPropItemsServer( )
  297. {
  298. if ( m_PropItems )
  299. {
  300. Assert(m_dwNumOfItems);
  301. DWORD i;
  302. for ( i=0; i< m_dwNumOfItems; i++)
  303. {
  304. if ( m_PropItems[i] )
  305. delete m_PropItems[i];
  306. }
  307. cicMemFree(m_PropItems);
  308. }
  309. }
  310. LPCTSTR pszGetSystemMetricsKey = _T("System\\WPA\\TabletPC");
  311. LPCTSTR pszGSMRegValue = _T("Installed");
  312. HRESULT CSpPropItemsServer::_Initialize( )
  313. {
  314. HRESULT hr = S_OK;
  315. if ( m_fInitialized )
  316. return hr;
  317. m_dwNumOfItems = (DWORD) PropId_Max_Item_Id;
  318. m_PropItems = (CPropItem **) cicMemAlloc(m_dwNumOfItems * sizeof(CPropItem *));
  319. if ( m_PropItems )
  320. {
  321. // Initializing the settings for all the items
  322. // If we add new more item later, please update this array value as well.
  323. PROP_ITEM PropItems[ ] = {
  324. // Items in top property page
  325. {PropId_Cmd_Select_Correct, c_szSelectCmd, NULL, 0, TRUE, PROP_ENABLED },
  326. {PropId_Cmd_Navigation, c_szNavigateCmd, NULL, 0, TRUE, PROP_ENABLED },
  327. {PropId_Cmd_Casing, c_szCaseCmd, NULL, 0, TRUE, PROP_ENABLED },
  328. {PropId_Cmd_Editing, c_szEditCmd, NULL, 0, TRUE, PROP_ENABLED },
  329. {PropId_Cmd_Keyboard, c_szKeyboardCmd, NULL, 0, TRUE, PROP_ENABLED },
  330. {PropId_Cmd_TTS, c_szTTSCmd, NULL, 0, TRUE, PROP_ENABLED },
  331. {PropId_Cmd_Language_Bar, c_szLangBarCmd, NULL, 0, TRUE, PROP_ENABLED },
  332. {PropId_Cmd_DictMode, c_szDictCmd, NULL, 0, TRUE, PROP_ENABLED },
  333. {PropId_Mode_Button, c_szModeButton, NULL, 0, TRUE, PROP_DISABLED },
  334. // Items in Advanced Setting dialog
  335. {PropId_Hide_Balloon, NULL, (GUID *)&GUID_COMPARTMENT_SPEECH_UI_STATUS,TF_DISABLE_BALLOON,TRUE,PROP_DISABLED},
  336. {PropId_Support_LMA, c_szEnableLMA, NULL, 0, TRUE, PROP_ENABLED },
  337. {PropId_High_Confidence, c_szHighConf, NULL, 0, TRUE, PROP_ENABLED },
  338. {PropId_Save_Speech_Data, c_szSerialize, NULL, 0, TRUE, PROP_DISABLED },
  339. {PropId_Remove_Space, c_szRemoveSpace, NULL, 0, TRUE, PROP_ENABLED },
  340. {PropId_DisDict_Typing, c_szDisDictTyping, NULL, 0, TRUE, PROP_ENABLED },
  341. {PropId_PlayBack, c_szPlayBack, NULL, 0, TRUE, PROP_DISABLED },
  342. {PropId_Dict_CandOpen, c_szDictCandOpen, NULL, 0, TRUE, PROP_ENABLED },
  343. {PropId_Max_Alternates, c_szNumAlt, NULL, 0, FALSE, 9 },
  344. {PropId_MaxChar_Cand, c_szMaxCandChars, NULL, 0, FALSE, 128 },
  345. // Items in ModeButton Setting dialog
  346. {PropId_Dictation_Key, c_szDictKey, NULL, 0, FALSE, VK_F11 },
  347. {PropId_Command_Key, c_szCmdKey, NULL, 0, FALSE, VK_F12 },
  348. // Items not in any property page and dialogs
  349. {PropId_Context_Feeding, c_szCtxtFeed, NULL, 0, TRUE, PROP_ENABLED },
  350. {PropId_Dict_ModeBias, c_szDictModebias, NULL, 0, TRUE, PROP_ENABLED },
  351. {PropId_LM_Master_Cand, c_szMasterLM, NULL, 0, TRUE, PROP_DISABLED },
  352. };
  353. DWORD i;
  354. CMyRegKey regkey;
  355. DWORD dwInstalled = 0;
  356. BOOL fIsTabletPC = FALSE; // Default to false.
  357. if (S_OK == regkey.Open(HKEY_LOCAL_MACHINE, pszGetSystemMetricsKey, KEY_READ))
  358. {
  359. if (ERROR_SUCCESS == regkey.QueryValue(dwInstalled, pszGSMRegValue))
  360. {
  361. fIsTabletPC = ( dwInstalled != 0 );
  362. // Only set fIsTabletPC to TRUE when key exists and contains non-zero.
  363. }
  364. }
  365. for ( i=0; i< m_dwNumOfItems; i++ )
  366. {
  367. PROP_ITEM_ID PropId;
  368. PropId = PropItems[i].idPropItem;
  369. // Tablet PC has different default value for some of the propitems.
  370. if (fIsTabletPC)
  371. {
  372. switch (PropId)
  373. {
  374. case PropId_Cmd_DictMode :
  375. case PropId_DisDict_Typing :
  376. PropItems[i].psDefault = PROP_DISABLED;
  377. break;
  378. case PropId_Max_Alternates :
  379. PropItems[i].dwDefault = 6;
  380. break;
  381. default:
  382. // keep the same setting for other items.
  383. break;
  384. }
  385. }
  386. if ( PropItems[i].pguidComp )
  387. {
  388. // This is global compartment setting
  389. m_PropItems[i] = (CPropItem *)new CPropItem(PropId, PropItems[i].pguidComp, PropItems[i].dwMaskBit, PropItems[i].psDefault);
  390. }
  391. else
  392. {
  393. if ( PropItems[i].fIsStatus )
  394. m_PropItems[i] = (CPropItem *)new CPropItem(PropId, PropItems[i].lpszValueName, PropItems[i].psDefault);
  395. else
  396. m_PropItems[i] = (CPropItem *)new CPropItem(PropId, PropItems[i].lpszValueName, PropItems[i].dwDefault);
  397. }
  398. if ( !m_PropItems[i] )
  399. {
  400. hr = E_OUTOFMEMORY;
  401. // Release the allocated memory
  402. for ( ; i> 0; i-- )
  403. {
  404. if ( m_PropItems[i-1] )
  405. delete m_PropItems[i-1];
  406. }
  407. cicMemFree(m_PropItems);
  408. break;
  409. }
  410. }
  411. if ( hr == S_OK )
  412. m_fInitialized = TRUE;
  413. }
  414. if ( m_fInitialized )
  415. hr = S_OK;
  416. else
  417. hr = E_FAIL;
  418. return hr;
  419. }
  420. CPropItem *CSpPropItemsServer::_GetPropItem(PROP_ITEM_ID idPropItem)
  421. {
  422. CPropItem *pItem = NULL;
  423. if ( !m_fInitialized )
  424. _Initialize( );
  425. if ( m_fInitialized )
  426. {
  427. for ( DWORD i=0; i< m_dwNumOfItems; i++)
  428. {
  429. if ( m_PropItems[i] && (idPropItem == m_PropItems[i]->GetPropItemId( )) )
  430. {
  431. // Found it.
  432. pItem = m_PropItems[i];
  433. break;
  434. }
  435. }
  436. }
  437. return pItem;
  438. }
  439. DWORD CSpPropItemsServer::_GetPropData(PROP_ITEM_ID idPropItem, BOOL fForceFromReg )
  440. {
  441. DWORD dwRet = 0;
  442. CPropItem *pItem = NULL;
  443. pItem = _GetPropItem(idPropItem);
  444. if ( pItem )
  445. {
  446. if ( pItem->IsStatusPropItem( ) )
  447. dwRet = pItem->GetPropStatus(fForceFromReg);
  448. else
  449. dwRet = pItem->GetPropValue(fForceFromReg);
  450. }
  451. return dwRet;
  452. }
  453. DWORD CSpPropItemsServer::_GetPropDefaultData(PROP_ITEM_ID idPropItem )
  454. {
  455. DWORD dwRet = 0;
  456. CPropItem *pItem = NULL;
  457. pItem = _GetPropItem(idPropItem);
  458. if ( pItem )
  459. {
  460. if ( pItem->IsStatusPropItem( ) )
  461. dwRet = pItem->GetPropDefaultStatus( );
  462. else
  463. dwRet = pItem->GetPropDefaultValue( );
  464. }
  465. return dwRet;
  466. }
  467. void CSpPropItemsServer::_SetPropData(PROP_ITEM_ID idPropItem, DWORD dwData )
  468. {
  469. Assert(m_fInitialized);
  470. Assert(m_PropItems);
  471. CPropItem *pItem = NULL;
  472. pItem = _GetPropItem(idPropItem);
  473. if ( pItem )
  474. {
  475. if ( pItem->IsStatusPropItem( ) )
  476. pItem->SetPropStatus((BOOL)dwData);
  477. else
  478. pItem->SetPropValue(dwData);
  479. }
  480. }
  481. //
  482. // Save all the property data managed by this server to registry or global compartment
  483. //
  484. // when Apply or OK buttons on the property page is pressed,
  485. // this function will be called.
  486. //
  487. void CSpPropItemsServer::_SavePropData( )
  488. {
  489. Assert(m_fInitialized);
  490. Assert(m_PropItems);
  491. CPropItem *pItem = NULL;
  492. for ( DWORD i=0; i<m_dwNumOfItems; i++ )
  493. {
  494. pItem = m_PropItems[i];
  495. if ( pItem )
  496. {
  497. pItem->SavePropData( );
  498. }
  499. }
  500. }
  501. //
  502. //
  503. // Save all the default value to HKLM registry
  504. // Self-Registration will call this method to set default value for all the properties.
  505. //
  506. //
  507. void CSpPropItemsServer::_SaveDefaultData( )
  508. {
  509. if ( !m_fInitialized )
  510. _Initialize( );
  511. if ( m_fInitialized && m_PropItems )
  512. {
  513. CPropItem *pItem = NULL;
  514. for ( DWORD i=0; i<m_dwNumOfItems; i++ )
  515. {
  516. pItem = m_PropItems[i];
  517. if ( pItem )
  518. pItem->SaveDefaultRegValue( );
  519. }
  520. }
  521. }
  522. //
  523. // Merge some prop data form other items server
  524. //
  525. // When a property item data is changed in Advanced or Mode button dialog, since these dialogs have
  526. // their own property server, all these changes need to be merged back to the base property server,
  527. // so that they can be saved to the registry when user click "Apply" or "OK" in the top property page.
  528. //
  529. HRESULT CSpPropItemsServer::_MergeDataFromServer(CSpPropItemsServer *pItemBaseServer, PROP_ITEM_ID idPropMin, PROP_ITEM_ID idPropMax)
  530. {
  531. HRESULT hr = S_OK;
  532. Assert(pItemBaseServer);
  533. DWORD dwData, idPropItem;
  534. for ( idPropItem=(DWORD)idPropMin; idPropItem<= (DWORD)idPropMax; idPropItem++)
  535. {
  536. dwData = pItemBaseServer->_GetPropData((PROP_ITEM_ID)idPropItem);
  537. _SetPropData((PROP_ITEM_ID)idPropItem, dwData);
  538. }
  539. return hr;
  540. }
  541. //
  542. //
  543. // CSpPropItemsServerWrap
  544. //
  545. //
  546. // Update our internal data members from Registry.
  547. //
  548. // When sapilayr TIP gets notified of the change of the registry value,
  549. // it will call this method to renew its internal data with new registry data.
  550. //
  551. void CSpPropItemsServerWrap::_RenewAllPropDataFromReg( )
  552. {
  553. DWORD dwPropItem;
  554. for (dwPropItem=(DWORD)PropId_Min_Item_Id; dwPropItem < (DWORD)PropId_Max_Item_Id; dwPropItem ++ )
  555. {
  556. DWORD dwOldValue, dwNewValue;
  557. dwOldValue = _GetPropData((PROP_ITEM_ID)dwPropItem, FALSE);
  558. // Update the value by forcelly getting it from registry.
  559. dwNewValue = _GetPropData((PROP_ITEM_ID)dwPropItem, TRUE);
  560. m_bChanged[dwPropItem] = (dwOldValue != dwNewValue ? TRUE : FALSE);
  561. }
  562. }
  563. //
  564. //
  565. //
  566. //
  567. ULONG CSpPropItemsServerWrap::_GetMaxAlternates( )
  568. {
  569. ULONG ulMaxAlts;
  570. ulMaxAlts = _GetPropData(PropId_Max_Alternates);
  571. if ( ulMaxAlts > MAX_ALTERNATES_NUM || ulMaxAlts == 0 )
  572. ulMaxAlts = MAX_ALTERNATES_NUM;
  573. return ulMaxAlts;
  574. }
  575. //
  576. // ULONG CBestPropRange::_GetMaxCandidateChars( )
  577. //
  578. //
  579. ULONG CSpPropItemsServerWrap::_GetMaxCandidateChars( )
  580. {
  581. ULONG ulMaxCandChars;
  582. ulMaxCandChars = _GetPropData(PropId_MaxChar_Cand);
  583. if ( ulMaxCandChars > MAX_CANDIDATE_CHARS || ulMaxCandChars == 0 )
  584. ulMaxCandChars = MAX_CANDIDATE_CHARS;
  585. return ulMaxCandChars;
  586. }
  587. BOOL CSpPropItemsServerWrap::_AllCmdsEnabled( )
  588. {
  589. BOOL fEnable;
  590. fEnable = _SelectCorrectCmdEnabled( ) &&
  591. _NavigationCmdEnabled( ) &&
  592. _CasingCmdEnabled( ) &&
  593. _EditingCmdEnabled( ) &&
  594. _KeyboardCmdEnabled( ) &&
  595. _TTSCmdEnabled( ) &&
  596. _LanguageBarCmdEnabled( );
  597. return fEnable;
  598. }
  599. BOOL CSpPropItemsServerWrap::_AllCmdsDisabled( )
  600. {
  601. BOOL fDisable;
  602. fDisable = !_SelectCorrectCmdEnabled( ) &&
  603. !_NavigationCmdEnabled( ) &&
  604. !_CasingCmdEnabled( ) &&
  605. !_EditingCmdEnabled( ) &&
  606. !_KeyboardCmdEnabled( ) &&
  607. !_TTSCmdEnabled( ) &&
  608. !_LanguageBarCmdEnabled( );
  609. return fDisable;
  610. }