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.

136 lines
4.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: histlist.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #pragma once
  11. #ifndef _HISTORY_LIST_H
  12. #define _HISTORY_LIST_H
  13. #include <exdisp.h>
  14. #include <mshtml.h>
  15. #include "amcview.h"
  16. #include "treectrl.h"
  17. #include "resultview.h"
  18. #include <windowsx.h> // for globalallocptr macro
  19. enum NavState
  20. {
  21. MMC_HISTORY_READY = 0,
  22. MMC_HISTORY_NAVIGATING = 1,
  23. MMC_HISTORY_BUSY = 2,
  24. MMC_HISTORY_PAGE_BREAK = 3
  25. };
  26. enum HistoryButton
  27. {
  28. HB_BACK = -1,
  29. HB_STOP = 0,
  30. HB_FORWARD = 1
  31. };
  32. class CHistoryEntry
  33. {
  34. public:
  35. bool operator == (const CHistoryEntry &other) const;
  36. bool operator != (const CHistoryEntry &other) const;
  37. bool IsWebEntry() {return resultViewType.HasWebBrowser();}
  38. bool IsListEntry() {return resultViewType.HasList();}
  39. bool IsOCXEntry() {return resultViewType.HasOCX();}
  40. public:
  41. int viewMode; // valid only if the result view is a list. This field is not a part of CResultViewType because the snapin does not specify this.
  42. HNODE hnode; // currently selected node in scope tree
  43. GUID guidTaskpad; // the selected taskpad
  44. CResultViewType resultViewType; // all the details about the result pane
  45. // PageBreakIDs are used to integrate with IE history. Each web entry owns a
  46. // bit of the IE history, which is bounded by 2 page break URLs. The
  47. // following properties keep track of these page break bounds.
  48. int prevPageBreakID;// used only for Web Entries
  49. int nextPageBreakID;// used only for Web Entries
  50. };
  51. /*+-------------------------------------------------------------------------*
  52. * class CHistoryList
  53. *
  54. *
  55. * PURPOSE: Maintains a list of all the states visited by the user for a view.
  56. *
  57. *+-------------------------------------------------------------------------*/
  58. class CHistoryList
  59. {
  60. typedef std::list<CHistoryEntry> HistoryEntryList;
  61. enum {MAX_HISTORY_ENTRIES = 100};
  62. public:
  63. typedef HistoryEntryList::iterator iterator;
  64. CHistoryList(CAMCView* pView);
  65. ~CHistoryList();
  66. static SC ScGeneratePageBreakURL(CStr& strResultPane);
  67. void Attach (CAMCWebViewCtrl* pWebViewCtrl) {m_pWebViewCtrl = pWebViewCtrl;}
  68. BOOL IsFirst(); // should we light up the "Back" button?
  69. BOOL IsLast(); // should we light up the "Forward" button?
  70. HRESULT Back (bool &bHandled, bool bUseBrowserHistory = true);
  71. HRESULT Forward(bool &bHandled, bool bUseBrowserHistory = true);
  72. SC ScAddEntry (CResultViewType &rvt, int viewMode, GUID &guidTaskpad); // adds new entry at current location
  73. void DeleteEntry (HNODE hnode);
  74. SC ScModifyViewTab(const GUID& guidTab);
  75. SC ScChangeViewMode(int viewMode);
  76. void MaintainWebBar();
  77. void Compact();
  78. HRESULT ExecuteCurrent();
  79. void UpdateWebBar (HistoryButton button, BOOL bOn);
  80. void Clear();
  81. void OnBrowserStateChange(bool bEnableForward, bool bEnableBack);
  82. SC ScOnPageBreak(int nPageBreakID);
  83. SC ScDoPageBreak();
  84. void OnPageBreakStateChange(bool bPageBreak);
  85. void DeleteSubsequentEntries();
  86. NavState GetNavigateState() { return m_navState; }
  87. void SetNavigateState(NavState state) { m_navState = state; }
  88. SC ScGetCurrentResultViewType (CResultViewType &rvt, int& viewMode, GUID &guidTaskpad);
  89. void SetCurrentViewMode (long nViewMode);
  90. private:
  91. CAMCWebViewCtrl* GetWebViewCtrl() {return m_pWebViewCtrl;}
  92. CHistoryEntry* GetPreviousWebPageEntry();
  93. private:
  94. iterator m_iterCurrent; // current index
  95. HistoryEntryList m_entries; // array (note: using array-size doubling scheme)
  96. CAMCView* m_pView; // to get current node
  97. NavState m_navState; // TRUE when busy
  98. CAMCWebViewCtrl *m_pWebViewCtrl; // used to navigate to a page break.
  99. bool m_bBrowserForwardEnabled;
  100. bool m_bBrowserBackEnabled;
  101. bool m_bPageBreak; // are we sitting at a page break right now?
  102. bool m_bWithin_CHistoryList_Back; // to know "Back" is on stack
  103. bool m_bWithin_CHistoryList_Forward; // to know "Forward" is on stack
  104. bool m_bNavigateAfterPageBreak; // should we navigate after a page break?
  105. wstring m_szURLToNavigate; // if m_bNavigateAfterPageBreak is true, this is the URL to navigate to.
  106. static int s_nPageBreak; // used to generate unique URLs for page breaks
  107. };
  108. #endif