Source code of Windows XP (NT5)
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.

858 lines
17 KiB

  1. /*++
  2. Copyright (c) 1994-2001 Microsoft Corporation
  3. Module Name :
  4. docum.cpp
  5. Abstract:
  6. WWW Documents Page
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Sergei Antonov (sergeia)
  10. Project:
  11. Internet Services Manager
  12. Revision History:
  13. --*/
  14. #include "stdafx.h"
  15. #include "resource.h"
  16. #include "common.h"
  17. #include "inetmgrapp.h"
  18. #include "inetprop.h"
  19. #include "shts.h"
  20. #include "w3sht.h"
  21. #include "supdlgs.h"
  22. #include "docum.h"
  23. #include <lmcons.h>
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. //
  30. // CAddDefDocDlg dialog
  31. //
  32. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  33. CAddDefDocDlg::CAddDefDocDlg(CWnd * pParent OPTIONAL)
  34. : CDialog(CAddDefDocDlg::IDD, pParent)
  35. {
  36. //{{AFX_DATA_INIT(CAddDefDocDlg)
  37. m_strDefDocument = _T("");
  38. //}}AFX_DATA_INIT
  39. }
  40. void
  41. CAddDefDocDlg::DoDataExchange(CDataExchange * pDX)
  42. {
  43. CDialog::DoDataExchange(pDX);
  44. //{{AFX_DATA_MAP(CAddDefDocDlg)
  45. DDX_Control(pDX, IDOK, m_button_Ok);
  46. DDX_Control(pDX, IDC_EDIT_DEF_DOCUMENT, m_edit_DefDocument);
  47. DDX_Text(pDX, IDC_EDIT_DEF_DOCUMENT, m_strDefDocument);
  48. DDV_MaxChars(pDX, m_strDefDocument, MAX_PATH);
  49. //}}AFX_DATA_MAP
  50. if (pDX->m_bSaveAndValidate)
  51. {
  52. if (!PathIsFileSpec(m_strDefDocument))
  53. {
  54. ::AfxMessageBox(IDS_ERR_NO_COMPLETE_PATH);
  55. pDX->Fail();
  56. }
  57. }
  58. }
  59. //
  60. // Message Map
  61. //
  62. BEGIN_MESSAGE_MAP(CAddDefDocDlg, CDialog)
  63. //{{AFX_MSG_MAP(CAddDefDocDlg)
  64. ON_EN_CHANGE(IDC_EDIT_DEF_DOCUMENT, OnChangeEditDefDocument)
  65. //}}AFX_MSG_MAP
  66. END_MESSAGE_MAP()
  67. //
  68. // Message Handlers
  69. //
  70. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  71. void
  72. CAddDefDocDlg::OnChangeEditDefDocument()
  73. /*++
  74. Routine Description:
  75. Respond to a change in the default document edit box
  76. Arguments:
  77. None./
  78. --*/
  79. {
  80. m_button_Ok.EnableWindow(m_edit_DefDocument.GetWindowTextLength() > 0);
  81. }
  82. //
  83. // WWW Documents Property Page
  84. //
  85. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  86. IMPLEMENT_DYNCREATE(CW3DocumentsPage, CInetPropertyPage)
  87. //
  88. // Static Initialization
  89. //
  90. const LPCTSTR CW3DocumentsPage::s_lpstrSep = _T(",");
  91. const LPCTSTR CW3DocumentsPage::s_lpstrFILE = _T("FILE:");
  92. const LPCTSTR CW3DocumentsPage::s_lpstrSTRING = _T("STRING:");
  93. const LPCTSTR CW3DocumentsPage::s_lpstrURL = _T("URL:");
  94. CW3DocumentsPage::CW3DocumentsPage(CInetPropertySheet * pSheet)
  95. : CInetPropertyPage(CW3DocumentsPage::IDD, pSheet),
  96. m_dwBitRangeDirBrowsing(MD_DIRBROW_LOADDEFAULT)
  97. {
  98. #if 0 // Keep Class-wizard happy
  99. //{{AFX_DATA_INIT(CW3DocumentsPage)
  100. m_strFooter = _T("");
  101. m_fEnableDefaultDocument = FALSE;
  102. m_fEnableFooter = FALSE;
  103. //}}AFX_DATA_INIT
  104. #endif // 0
  105. }
  106. CW3DocumentsPage::~CW3DocumentsPage()
  107. /*++
  108. Routine Description:
  109. Destructor
  110. Arguments:
  111. N/A
  112. Return Value:
  113. N/A
  114. --*/
  115. {
  116. }
  117. void
  118. CW3DocumentsPage::MakeFooterCommand(CString & strFooter)
  119. /*++
  120. Routine Description:
  121. Convert the footer document to a full footer string.
  122. Arguments:
  123. CString & strFooter : On input this is the footer document,
  124. at output this will be a full footer command
  125. Return Value:
  126. None.
  127. Notes:
  128. Only support FILE: for now
  129. --*/
  130. {
  131. strFooter.TrimLeft();
  132. strFooter.TrimRight();
  133. ASSERT(!PathIsRelative(strFooter));
  134. strFooter = s_lpstrFILE + strFooter;
  135. }
  136. void
  137. CW3DocumentsPage::ParseFooterCommand(CString & strFooter)
  138. /*++
  139. Routine Description:
  140. Trim the command from the rest of this command
  141. Arguments:
  142. CString & strFooter : On input this is a footer command
  143. at output this will be just the footer document
  144. --*/
  145. {
  146. LPCTSTR lp = strFooter.GetBuffer(0);
  147. if (!_tcsnccmp(lp, s_lpstrFILE, 5))
  148. {
  149. lp += lstrlen(s_lpstrFILE);
  150. }
  151. else if (!_tcsnccmp(lp, s_lpstrSTRING, 7))
  152. {
  153. lp += lstrlen(s_lpstrSTRING);
  154. }
  155. else if (!::_tcsnccmp(lp, s_lpstrURL, 4))
  156. {
  157. lp += lstrlen(s_lpstrURL);
  158. }
  159. if (lp != strFooter.GetBuffer(0))
  160. {
  161. strFooter = lp;
  162. }
  163. strFooter.TrimLeft();
  164. }
  165. void
  166. CW3DocumentsPage::StringToListBox()
  167. /*++
  168. Routine Description:
  169. Parse the default document string, and add each doc
  170. to the listbox
  171. Arguments:
  172. None
  173. Return Value:
  174. None
  175. --*/
  176. {
  177. int start = 0, end;
  178. int skip = lstrlen(s_lpstrSep);
  179. BOOL done = FALSE;
  180. do
  181. {
  182. end = m_strDefaultDocument.Find(s_lpstrSep, start);
  183. if (end == -1)
  184. {
  185. done = TRUE;
  186. end = m_strDefaultDocument.GetLength();
  187. }
  188. CString str = m_strDefaultDocument.Mid(start, end - start);
  189. str.TrimLeft();
  190. str.TrimRight();
  191. m_list_DefDocuments.AddString(str);
  192. start = end + skip;
  193. }
  194. while (!done);
  195. }
  196. BOOL
  197. CW3DocumentsPage::StringFromListBox()
  198. /*++
  199. Routine Description:
  200. Build up list of default documents from the contents of
  201. the listbox.
  202. Arguments:
  203. None
  204. Return Value:
  205. TRUE if at least one document was added.
  206. --*/
  207. {
  208. m_strDefaultDocument.Empty();
  209. int i;
  210. for (i = 0; i < m_list_DefDocuments.GetCount(); ++i)
  211. {
  212. CString str;
  213. m_list_DefDocuments.GetText(i, str);
  214. if (i)
  215. {
  216. m_strDefaultDocument += s_lpstrSep;
  217. }
  218. m_strDefaultDocument += str;
  219. }
  220. return i > 0;
  221. }
  222. void
  223. CW3DocumentsPage::DoDataExchange(CDataExchange * pDX)
  224. {
  225. CInetPropertyPage::DoDataExchange(pDX);
  226. //{{AFX_DATA_MAP(CW3DocumentsPage)
  227. DDX_Check(pDX, IDC_CHECK_ENABLE_DEFAULT_DOCUMENT, m_fEnableDefaultDocument);
  228. DDX_Check(pDX, IDC_CHECK_ENABLE_DOCUMENT_FOOTER, m_fEnableFooter);
  229. DDX_Control(pDX, IDC_LIST_DEFAULT_DOCUMENT, m_list_DefDocuments);
  230. DDX_Control(pDX, IDC_EDIT_DOCUMENT_FOOTER, m_edit_Footer);
  231. DDX_Control(pDX, IDC_CHECK_ENABLE_DOCUMENT_FOOTER, m_check_EnableFooter);
  232. DDX_Control(pDX, IDC_BUTTON_ADD, m_button_Add);
  233. DDX_Control(pDX, IDC_BUTTON_REMOVE, m_button_Remove);
  234. DDX_Control(pDX, IDC_BUTTON_BROWSE, m_button_Browse);
  235. DDX_Control(pDX, IDC_BUTTON_UP, m_button_Up);
  236. DDX_Control(pDX, IDC_BUTTON_DOWN, m_button_Down);
  237. //}}AFX_DATA_MAP
  238. if (pDX->m_bSaveAndValidate)
  239. {
  240. if (m_fEnableDefaultDocument)
  241. {
  242. if (!StringFromListBox())
  243. {
  244. ::AfxMessageBox(IDS_ERR_DOCUMENTS);
  245. pDX->Fail();
  246. }
  247. }
  248. if (m_fEnableFooter)
  249. {
  250. BeginWaitCursor();
  251. DDX_Text(pDX, IDC_EDIT_DOCUMENT_FOOTER, m_strFooter);
  252. DDV_MinMaxChars(pDX, m_strFooter, 1, MAX_PATH);
  253. if (PathIsRelative(m_strFooter))
  254. {
  255. //
  256. // Footer doc must be a complete path
  257. //
  258. ::AfxMessageBox(IDS_ERR_COMPLETE_PATH);
  259. pDX->Fail();
  260. }
  261. else if (IsLocal() && PathIsNetworkPath(m_strFooter))
  262. {
  263. //
  264. // Footer doc must be on local machine.
  265. //
  266. ::AfxMessageBox(IDS_NOT_LOCAL_FOOTER);
  267. pDX->Fail();
  268. }
  269. else if (IsLocal() &&
  270. (::GetFileAttributes(m_strFooter) & FILE_ATTRIBUTE_DIRECTORY))
  271. {
  272. //
  273. // And lastly, but not leastly, the footer document should exist
  274. //
  275. ::AfxMessageBox(IDS_ERR_FILE_NOT_FOUND);
  276. pDX->Fail();
  277. }
  278. else
  279. {
  280. MakeFooterCommand(m_strFooter);
  281. }
  282. EndWaitCursor();
  283. }
  284. // else
  285. // {
  286. // m_strFooter.Empty();
  287. // }
  288. }
  289. else
  290. {
  291. ParseFooterCommand(m_strFooter);
  292. DDX_Text(pDX, IDC_EDIT_DOCUMENT_FOOTER, m_strFooter);
  293. DDV_MinMaxChars(pDX, m_strFooter, 1, MAX_PATH);
  294. }
  295. }
  296. //
  297. // Message Map
  298. //
  299. BEGIN_MESSAGE_MAP(CW3DocumentsPage, CInetPropertyPage)
  300. //{{AFX_MSG_MAP(CW3DocumentsPage)
  301. ON_BN_CLICKED(IDC_CHECK_ENABLE_DEFAULT_DOCUMENT, OnCheckEnableDefaultDocument)
  302. ON_BN_CLICKED(IDC_CHECK_ENABLE_DOCUMENT_FOOTER, OnCheckEnableDocumentFooter)
  303. ON_BN_CLICKED(IDC_BUTTON_ADD, OnButtonAdd)
  304. ON_BN_CLICKED(IDC_BUTTON_REMOVE, OnButtonRemove)
  305. ON_BN_CLICKED(IDC_BUTTON_BROWSE, OnButtonBrowse)
  306. ON_BN_CLICKED(IDC_BUTTON_UP, OnButtonUp)
  307. ON_BN_CLICKED(IDC_BUTTON_DOWN, OnButtonDown)
  308. ON_LBN_SELCHANGE(IDC_LIST_DEFAULT_DOCUMENT, OnSelchangeListDefaultDocument)
  309. //}}AFX_MSG_MAP
  310. ON_EN_CHANGE(IDC_EDIT_DEFAULT_DOCUMENT, OnItemChanged)
  311. ON_EN_CHANGE(IDC_EDIT_DOCUMENT_FOOTER, OnItemChanged)
  312. END_MESSAGE_MAP()
  313. void
  314. CW3DocumentsPage::SetUpDownStates()
  315. {
  316. int nLast = m_list_DefDocuments.GetCount() - 1;
  317. int nSel = m_list_DefDocuments.GetCurSel();
  318. m_button_Up.EnableWindow(nSel > 0);
  319. m_button_Down.EnableWindow(nSel >= 0 && nSel < nLast);
  320. }
  321. BOOL
  322. CW3DocumentsPage::SetRemoveState()
  323. {
  324. BOOL fEnabled = m_fEnableDefaultDocument
  325. && (m_list_DefDocuments.GetCurSel() != LB_ERR);
  326. m_button_Remove.EnableWindow(fEnabled);
  327. return fEnabled;
  328. }
  329. BOOL
  330. CW3DocumentsPage::SetDefDocumentState(BOOL fEnabled)
  331. /*++
  332. Routine Description:
  333. Set the enabled states of the Default Documents state
  334. Arguments:
  335. BOOL fEnabled : TRUE if default document is on
  336. Return Value:
  337. TRUE if default document is on
  338. --*/
  339. {
  340. m_button_Add.EnableWindow(fEnabled);
  341. m_button_Up.EnableWindow(fEnabled);
  342. m_button_Down.EnableWindow(fEnabled);
  343. m_list_DefDocuments.EnableWindow(fEnabled);
  344. SetRemoveState();
  345. return fEnabled;
  346. }
  347. BOOL
  348. CW3DocumentsPage::SetDocFooterState(BOOL fEnabled)
  349. /*++
  350. Routine Description:
  351. Set the enabled state of the footer documents
  352. Arguments:
  353. BOOL fEnabled : TRUE if footers are on
  354. Return Value:
  355. TRUE if footers are on
  356. --*/
  357. {
  358. m_edit_Footer.EnableWindow(fEnabled);
  359. m_button_Browse.EnableWindow(IsLocal() && fEnabled);
  360. return fEnabled;
  361. }
  362. //
  363. // Message Handlers
  364. //
  365. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  366. void
  367. CW3DocumentsPage::OnItemChanged()
  368. {
  369. SetModified(TRUE);
  370. }
  371. void
  372. CW3DocumentsPage::OnCheckEnableDefaultDocument()
  373. {
  374. m_fEnableDefaultDocument = !m_fEnableDefaultDocument;
  375. SetDefDocumentState(m_fEnableDefaultDocument);
  376. OnItemChanged();
  377. }
  378. void
  379. CW3DocumentsPage::OnCheckEnableDocumentFooter()
  380. {
  381. m_fEnableFooter = !m_fEnableFooter;
  382. if (SetDocFooterState(m_fEnableFooter))
  383. {
  384. m_edit_Footer.SetSel(0,-1);
  385. m_edit_Footer.SetFocus();
  386. }
  387. OnItemChanged();
  388. }
  389. BOOL
  390. CW3DocumentsPage::OnInitDialog()
  391. {
  392. CInetPropertyPage::OnInitDialog();
  393. //
  394. // Make sure the up/down buttons show up correctly
  395. //
  396. CRect rc;
  397. GetDlgItem(IDC_BUTTONUP)->GetWindowRect(&rc);
  398. GetDlgItem(IDC_BUTTONUP)->DestroyWindow();
  399. ScreenToClient(&rc);
  400. m_button_Up.Create(NULL,
  401. WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_OWNERDRAW, rc, this, IDC_BUTTON_UP);
  402. m_button_Up.LoadBitmaps(IDB_BUTTONUPU, IDB_BUTTONUPD, IDB_BUTTONUPF, IDB_BUTTONUPX);
  403. m_button_Up.SizeToContent();
  404. GetDlgItem(IDC_BUTTONDN)->GetWindowRect(&rc);
  405. GetDlgItem(IDC_BUTTONDN)->DestroyWindow();
  406. ScreenToClient(&rc);
  407. m_button_Down.Create(NULL,
  408. WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_OWNERDRAW, rc, this, IDC_BUTTON_DOWN);
  409. m_button_Down.LoadBitmaps(IDB_BUTTONDNU, IDB_BUTTONDND, IDB_BUTTONDNF, IDB_BUTTONDNX);
  410. m_button_Down.SizeToContent();
  411. StringToListBox();
  412. SetDefDocumentState(m_fEnableDefaultDocument);
  413. SetDocFooterState(m_fEnableFooter);
  414. SetUpDownStates();
  415. SetRemoveState();
  416. return TRUE;
  417. }
  418. /* virtual */
  419. HRESULT
  420. CW3DocumentsPage::FetchLoadedValues()
  421. {
  422. CError err;
  423. BEGIN_META_DIR_READ(CW3Sheet)
  424. FETCH_DIR_DATA_FROM_SHEET(m_dwDirBrowsing);
  425. FETCH_DIR_DATA_FROM_SHEET(m_strDefaultDocument);
  426. FETCH_DIR_DATA_FROM_SHEET(m_fEnableFooter);
  427. FETCH_DIR_DATA_FROM_SHEET(m_strFooter);
  428. m_fEnableDefaultDocument = IS_FLAG_SET(
  429. m_dwDirBrowsing,
  430. MD_DIRBROW_LOADDEFAULT
  431. );
  432. END_META_DIR_READ(err)
  433. return err;
  434. }
  435. HRESULT
  436. CW3DocumentsPage::SaveInfo()
  437. {
  438. ASSERT(IsDirty());
  439. TRACEEOLID("Saving W3 documents page now...");
  440. CError err;
  441. SET_FLAG_IF(m_fEnableDefaultDocument, m_dwDirBrowsing, MD_DIRBROW_LOADDEFAULT);
  442. BeginWaitCursor();
  443. BEGIN_META_DIR_WRITE(CW3Sheet)
  444. INIT_DIR_DATA_MASK(m_dwDirBrowsing, m_dwBitRangeDirBrowsing)
  445. STORE_DIR_DATA_ON_SHEET(m_strDefaultDocument)
  446. //STORE_DIR_DATA_ON_SHEET_MASK(m_dwDirBrowsing, m_dwBitRangeDirBrowsing)
  447. STORE_DIR_DATA_ON_SHEET(m_dwDirBrowsing)
  448. STORE_DIR_DATA_ON_SHEET(m_fEnableFooter)
  449. CString buf = m_strFooter;
  450. if (!m_fEnableFooter)
  451. {
  452. m_strFooter.Empty();
  453. }
  454. STORE_DIR_DATA_ON_SHEET(m_strFooter)
  455. m_strFooter = buf;
  456. END_META_DIR_WRITE(err)
  457. if (err.Succeeded())
  458. {
  459. err = ((CW3Sheet *)GetSheet())->SetKeyType();
  460. }
  461. EndWaitCursor();
  462. return err;
  463. }
  464. int
  465. CW3DocumentsPage::DocExistsInList(LPCTSTR lpDoc)
  466. /*++
  467. Routine Description:
  468. Check to see if the given document exists in the list
  469. Arguments:
  470. LPCTSTR lpDoc : Document to check
  471. Return Value:
  472. The index where the item exists or LB_ERR if it doesn't exist.
  473. --*/
  474. {
  475. CString str;
  476. for (int n = 0; n < m_list_DefDocuments.GetCount(); ++n)
  477. {
  478. m_list_DefDocuments.GetText(n, str);
  479. if (!str.CompareNoCase(lpDoc))
  480. {
  481. return n;
  482. }
  483. }
  484. return LB_ERR;
  485. }
  486. void
  487. CW3DocumentsPage::OnButtonAdd()
  488. {
  489. CAddDefDocDlg dlg;
  490. if (dlg.DoModal() == IDOK)
  491. {
  492. //
  493. // Check to see if it existed already
  494. //
  495. try
  496. {
  497. int nSel;
  498. CString strNewDoc(dlg.GetDefDocument());
  499. if ((nSel = DocExistsInList(strNewDoc)) != LB_ERR)
  500. {
  501. m_list_DefDocuments.SetCurSel(nSel);
  502. ::AfxMessageBox(IDS_DUPLICATE_DOC);
  503. return;
  504. }
  505. nSel = m_list_DefDocuments.AddString(strNewDoc);
  506. if (nSel >= 0)
  507. {
  508. m_list_DefDocuments.SetCurSel(nSel);
  509. SetUpDownStates();
  510. SetRemoveState();
  511. OnItemChanged();
  512. }
  513. }
  514. catch(CMemoryException * e)
  515. {
  516. e->ReportError();
  517. e->Delete();
  518. }
  519. }
  520. }
  521. void
  522. CW3DocumentsPage::OnButtonRemove()
  523. {
  524. int nSel = m_list_DefDocuments.GetCurSel();
  525. if (nSel >= 0)
  526. {
  527. m_list_DefDocuments.DeleteString(nSel);
  528. if (nSel >= m_list_DefDocuments.GetCount())
  529. {
  530. --nSel;
  531. }
  532. m_list_DefDocuments.SetCurSel(nSel);
  533. SetUpDownStates();
  534. OnItemChanged();
  535. if (!SetRemoveState())
  536. {
  537. //
  538. // Make sure we don't focus on a disabled button
  539. //
  540. m_button_Add.SetFocus();
  541. }
  542. }
  543. }
  544. void
  545. CW3DocumentsPage::OnButtonBrowse()
  546. {
  547. ASSERT(IsLocal());
  548. //
  549. // Pop up the file dialog and let the user select the footer htm file.
  550. //
  551. CString str;
  552. str.LoadString(IDS_HTML_MASK);
  553. CFileDialog dlgBrowse(TRUE, NULL, NULL, OFN_HIDEREADONLY, str, this);
  554. //
  555. // If the new style of file-open dialog is requested, comment
  556. // out the DoModal, and remove the other two comments.
  557. //
  558. dlgBrowse.m_ofn.Flags &= ~(OFN_ENABLEHOOK);
  559. dlgBrowse.m_ofn.Flags |= OFN_DONTADDTORECENT|OFN_FILEMUSTEXIST;
  560. if (dlgBrowse.DoModal() == IDOK)
  561. //if (GetOpenFileName(&dlgBrowse.m_ofn))
  562. {
  563. m_edit_Footer.SetWindowText(dlgBrowse.GetPathName());
  564. }
  565. }
  566. void
  567. CW3DocumentsPage::ExchangeDocuments(
  568. IN int nLow,
  569. IN int nHigh
  570. )
  571. /*++
  572. Routine Description:
  573. Exchange two documents in the listbox
  574. Arguments:
  575. int nLow : Low item
  576. int nHigh : High item
  577. Return Value:
  578. None.
  579. --*/
  580. {
  581. ASSERT(nLow < nHigh);
  582. CString str;
  583. m_list_DefDocuments.GetText(nLow, str);
  584. m_list_DefDocuments.DeleteString(nLow);
  585. m_list_DefDocuments.InsertString(nHigh, str);
  586. OnItemChanged();
  587. }
  588. void
  589. CW3DocumentsPage::OnButtonUp()
  590. /*++
  591. Routine Description:
  592. Move the currently selected doc up
  593. Arguments:
  594. None.
  595. Return Value:
  596. None.
  597. --*/
  598. {
  599. int nCurSel = m_list_DefDocuments.GetCurSel();
  600. ExchangeDocuments(nCurSel - 1, nCurSel);
  601. m_list_DefDocuments.SetCurSel(nCurSel - 1);
  602. m_list_DefDocuments.SetFocus();
  603. SetUpDownStates();
  604. }
  605. void
  606. CW3DocumentsPage::OnButtonDown()
  607. /*++
  608. Routine Description:
  609. Move the currently selected doc down
  610. Arguments:
  611. None.
  612. Return Value:
  613. None.
  614. --*/
  615. {
  616. int nCurSel = m_list_DefDocuments.GetCurSel();
  617. ExchangeDocuments(nCurSel, nCurSel + 1);
  618. m_list_DefDocuments.SetCurSel(nCurSel + 1);
  619. m_list_DefDocuments.SetFocus();
  620. SetUpDownStates();
  621. }
  622. void
  623. CW3DocumentsPage::OnSelchangeListDefaultDocument()
  624. {
  625. SetUpDownStates();
  626. SetRemoveState();
  627. }