ECMAPITable.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef ECMAPITABLE_H
  18. #define ECMAPITABLE_H
  19. #include <kopano/zcdefs.h>
  20. #include <mutex>
  21. #include <kopano/ECUnknown.h>
  22. #include "WSTransport.h"
  23. #include "ECNotifyClient.h"
  24. #include <set>
  25. /*
  26. * This is the superclass which contains common code for the Hierarchy and Contents
  27. * tables implementations
  28. */
  29. class ECMAPITable _kc_final : public ECUnknown {
  30. protected:
  31. ECMAPITable(std::string strName, ECNotifyClient *lpNotifyClient, ULONG ulFlags);
  32. virtual ~ECMAPITable();
  33. public:
  34. static HRESULT Create(std::string strName, ECNotifyClient *lpNotifyClient, ULONG ulFlags, ECMAPITable **lppECMAPITable);
  35. virtual HRESULT HrSetTableOps(WSTableView *lpTableOps, bool fLoad);
  36. virtual HRESULT QueryInterface(REFIID refiid, void **lppInterface) _kc_override;
  37. virtual BOOL IsDeferred();
  38. virtual HRESULT FlushDeferred(LPSRowSet *lppRowSet = NULL);
  39. virtual HRESULT GetLastError(HRESULT hResult, ULONG ulFlags, LPMAPIERROR *lppMAPIError);
  40. virtual HRESULT Advise(ULONG ulEventMask, LPMAPIADVISESINK lpAdviseSink, ULONG * lpulConnection);
  41. virtual HRESULT Unadvise(ULONG ulConnection);
  42. virtual HRESULT GetStatus(ULONG *lpulTableStatus, ULONG *lpulTableType);
  43. virtual HRESULT SetColumns(const SPropTagArray *lpPropTagArray, ULONG ulFlags);
  44. virtual HRESULT QueryColumns(ULONG ulFlags, LPSPropTagArray *lpPropTagArray);
  45. virtual HRESULT GetRowCount(ULONG ulFlags, ULONG *lpulCount);
  46. virtual HRESULT SeekRow(BOOKMARK bkOrigin, LONG lRowCount, LONG *lplRowsSought) ;
  47. virtual HRESULT SeekRowApprox(ULONG ulNumerator, ULONG ulDenominator);
  48. virtual HRESULT QueryPosition(ULONG *lpulRow, ULONG *lpulNumerator, ULONG *lpulDenominator);
  49. virtual HRESULT FindRow(LPSRestriction lpRestriction, BOOKMARK bkOrigin, ULONG ulFlags);
  50. virtual HRESULT Restrict(LPSRestriction lpRestriction, ULONG ulFlags);
  51. virtual HRESULT CreateBookmark(BOOKMARK* lpbkPosition);
  52. virtual HRESULT FreeBookmark(BOOKMARK bkPosition);
  53. virtual HRESULT SortTable(const SSortOrderSet *, ULONG flags);
  54. virtual HRESULT QuerySortOrder(LPSSortOrderSet *lppSortCriteria);
  55. virtual HRESULT QueryRows(LONG lRowCount, ULONG ulFlags, LPSRowSet *lppRows);
  56. virtual HRESULT Abort();
  57. virtual HRESULT ExpandRow(ULONG cbInstanceKey, LPBYTE pbInstanceKey, ULONG ulRowCount, ULONG ulFlags, LPSRowSet * lppRows, ULONG *lpulMoreRows);
  58. virtual HRESULT CollapseRow(ULONG cbInstanceKey, LPBYTE pbInstanceKey, ULONG ulFlags, ULONG *lpulRowCount);
  59. virtual HRESULT WaitForCompletion(ULONG ulFlags, ULONG ulTimeout, ULONG *lpulTableStatus);
  60. virtual HRESULT GetCollapseState(ULONG ulFlags, ULONG cbInstanceKey, LPBYTE lpbInstanceKey, ULONG *lpcbCollapseState, LPBYTE *lppbCollapseState);
  61. virtual HRESULT SetCollapseState(ULONG ulFlags, ULONG cbCollapseState, LPBYTE pbCollapseState, BOOKMARK *lpbkLocation);
  62. static HRESULT Reload(void *lpParam);
  63. class xMAPITable _kc_final : public IMAPITable {
  64. #include <kopano/xclsfrag/IUnknown.hpp>
  65. #include <kopano/xclsfrag/IMAPITable.hpp>
  66. } m_xMAPITable;
  67. private:
  68. std::recursive_mutex m_hLock;
  69. WSTableView *lpTableOps;
  70. ECNotifyClient *lpNotifyClient;
  71. LPSPropTagArray lpsPropTags;
  72. LPSSortOrderSet lpsSortOrderSet;
  73. ULONG ulFlags; // Currently unused
  74. std::set<ULONG> m_ulConnectionList;
  75. std::recursive_mutex m_hMutexConnectionList;
  76. // Deferred calls
  77. ULONG m_ulDeferredFlags;
  78. LPSPropTagArray m_lpSetColumns;
  79. LPSRestriction m_lpRestrict;
  80. LPSSortOrderSet m_lpSortTable;
  81. ULONG m_ulRowCount;
  82. ULONG m_ulFlags; // Flags from queryrows
  83. std::string m_strName;
  84. };
  85. #endif // ECMAPITABLE_H