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.

485 lines
18 KiB

  1. #ifndef __cmnquery_h
  2. #define __cmnquery_h
  3. #ifndef __cmnquryp_h ;internal
  4. #define __cmnquryp_h ;internal
  5. DEFINE_GUID(IID_IQueryForm, 0x8cfcee30, 0x39bd, 0x11d0, 0xb8, 0xd1, 0x0, 0xa0, 0x24, 0xab, 0x2d, 0xbb);
  6. DEFINE_GUID(IID_IPersistQuery, 0x1a3114b8, 0xa62e, 0x11d0, 0xa6, 0xc5, 0x0, 0xa0, 0xc9, 0x06, 0xaf, 0x45);
  7. DEFINE_GUID(CLSID_CommonQuery, 0x83bc5ec0, 0x6f2a, 0x11d0, 0xa1, 0xc4, 0x0, 0xaa, 0x00, 0xc1, 0x6e, 0x65);
  8. DEFINE_GUID(IID_ICommonQuery, 0xab50dec0, 0x6f1d, 0x11d0, 0xa1, 0xc4, 0x0, 0xaa, 0x00, 0xc1, 0x6e, 0x65);
  9. ;begin_internal
  10. DEFINE_GUID(IID_IQueryFrame, 0x7e8c7c20, 0x7c9d, 0x11d0, 0x91, 0x3f, 0x0, 0xaa, 0x00, 0xc1, 0x6e, 0x65);
  11. DEFINE_GUID(IID_IQueryHandler, 0xa60cc73f, 0xe0fc, 0x11d0, 0x97, 0x50, 0x0, 0xa0, 0xc9, 0x06, 0xaf, 0x45);
  12. ;end_internal
  13. #ifndef GUID_DEFS_ONLY ;both
  14. //-----------------------------------------------------------------------------
  15. // IQueryForm
  16. //-----------------------------------------------------------------------------
  17. //
  18. // A query form object is registered under the query handlers CLSID,
  19. // a list is stored in the registry:
  20. //
  21. // HKCR\CLSID\{CLSID query handler}\Forms
  22. //
  23. // For each form object there are server values which can be defined:
  24. //
  25. // Flags = flags for the form object:
  26. // QUERYFORM_CHANGESFORMLIST
  27. // QUERYFORM_CHANGESOPTFORMLIST
  28. //
  29. // CLSID = string containing the CLSID of the InProc server to invoke
  30. // to get the IQueryFormObject.
  31. //
  32. // Forms = a sub key containing the CLSIDs for the forms registered
  33. // by IQueryForm::AddForms (or modified by ::AddPages), if
  34. // the flags are 0, then we scan this list looking for a match
  35. // for the default form specified.
  36. //
  37. #define QUERYFORM_CHANGESFORMLIST 0x000000001
  38. #define QUERYFORM_CHANGESOPTFORMLIST 0x000000002
  39. //
  40. // Query Forms
  41. // ===========
  42. // Query forms are registered and have query pages added to them, a form without
  43. // pages is not displayed. Each form has a unique CLSID to allow it to be
  44. // selected by invoking the query dialog.
  45. //
  46. #define CQFF_NOGLOBALPAGES 0x0000001 // = 1 => doesn't have global pages added
  47. #define CQFF_ISOPTIONAL 0x0000002 // = 1 => form is hidden, unless optional forms requested
  48. ;begin_internal
  49. #define CQFF_ISNEVERLISTED 0x0000004 // = 1 => form not listed in the form selector
  50. ;end_internal
  51. typedef struct
  52. {
  53. DWORD cbStruct;
  54. DWORD dwFlags;
  55. CLSID clsid;
  56. HICON hIcon;
  57. LPCWSTR pszTitle;
  58. } CQFORM, * LPCQFORM;
  59. typedef HRESULT (CALLBACK *LPCQADDFORMSPROC)(LPARAM lParam, LPCQFORM pForm);
  60. //
  61. // Query Form Pages
  62. // ================
  63. // When a query form has been registered the caller can then add pages to it,
  64. // any form can have pages appended.
  65. //
  66. ;begin_internal
  67. #define CQPF_ISGLOBAL 0x00000001 // = 1 => this page is global, and added to all forms
  68. ;end_internal
  69. struct _cqpage;
  70. typedef struct _cqpage CQPAGE, * LPCQPAGE;
  71. typedef HRESULT (CALLBACK *LPCQADDPAGESPROC)(LPARAM lParam, REFCLSID clsidForm, LPCQPAGE pPage);
  72. typedef HRESULT (CALLBACK *LPCQPAGEPROC)(LPCQPAGE pPage, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  73. struct _cqpage
  74. {
  75. DWORD cbStruct;
  76. DWORD dwFlags;
  77. LPCQPAGEPROC pPageProc;
  78. HINSTANCE hInstance;
  79. INT idPageName;
  80. INT idPageTemplate;
  81. DLGPROC pDlgProc;
  82. LPARAM lParam;
  83. };
  84. //
  85. // IQueryForm interfaces
  86. //
  87. #undef INTERFACE
  88. #define INTERFACE IQueryForm
  89. DECLARE_INTERFACE_(IQueryForm, IUnknown)
  90. {
  91. // *** IUnknown methods ***
  92. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  93. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  94. STDMETHOD_(ULONG,Release)(THIS) PURE;
  95. // IQueryForm methods
  96. STDMETHOD(Initialize)(THIS_ HKEY hkForm) PURE;
  97. STDMETHOD(AddForms)(THIS_ LPCQADDFORMSPROC pAddFormsProc, LPARAM lParam) PURE;
  98. STDMETHOD(AddPages)(THIS_ LPCQADDPAGESPROC pAddPagesProc, LPARAM lParam) PURE;
  99. };
  100. //
  101. // Messages for pages
  102. //
  103. #define CQPM_INITIALIZE 0x00000001
  104. #define CQPM_RELEASE 0x00000002
  105. #define CQPM_ENABLE 0x00000003 // wParam = TRUE/FALSE (enable, disable), lParam = 0
  106. #define CQPM_GETPARAMETERS 0x00000005 // wParam = 0, lParam = -> receives the LocalAlloc
  107. #define CQPM_CLEARFORM 0x00000006 // wParam, lParam = 0
  108. #define CQPM_PERSIST 0x00000007 // wParam = fRead, lParam -> IPersistQuery
  109. #define CQPM_HELP 0x00000008 // wParam = 0, lParam -> LPHELPINFO
  110. #define CQPM_SETDEFAULTPARAMETERS 0x00000009 // wParam = 0, lParam -> OPENQUERYWINDOW
  111. #define CQPM_HANDLERSPECIFIC 0x10000000
  112. //-----------------------------------------------------------------------------
  113. // IPersistQuery
  114. //-----------------------------------------------------------------------------
  115. // IPersistQuery interface
  116. #undef INTERFACE
  117. #define INTERFACE IPersistQuery
  118. DECLARE_INTERFACE_(IPersistQuery, IPersist)
  119. {
  120. // *** IUnknown methods ***
  121. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  122. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  123. STDMETHOD_(ULONG,Release)(THIS) PURE;
  124. // IPersist
  125. STDMETHOD(GetClassID)(THIS_ CLSID* pClassID) PURE;
  126. // IPersistQuery
  127. STDMETHOD(WriteString)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPCWSTR pValue) PURE;
  128. STDMETHOD(ReadString)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPWSTR pBuffer, INT cchBuffer) PURE;
  129. STDMETHOD(WriteInt)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, INT value) PURE;
  130. STDMETHOD(ReadInt)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPINT pValue) PURE;
  131. STDMETHOD(WriteStruct)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPVOID pStruct, DWORD cbStruct) PURE;
  132. STDMETHOD(ReadStruct)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPVOID pStruct, DWORD cbStruct) PURE;
  133. STDMETHOD(Clear)(THIS) PURE;
  134. };
  135. //-----------------------------------------------------------------------------
  136. // ICommonQuery
  137. //-----------------------------------------------------------------------------
  138. #define OQWF_OKCANCEL 0x00000001 // = 1 => Provide OK/Cancel buttons
  139. #define OQWF_DEFAULTFORM 0x00000002 // = 1 => clsidDefaultQueryForm is valid
  140. #define OQWF_SINGLESELECT 0x00000004 // = 1 => view to have single selection (depends on viewer)
  141. #define OQWF_LOADQUERY 0x00000008 // = 1 => use the IPersistQuery to load the given query
  142. #define OQWF_REMOVESCOPES 0x00000010 // = 1 => remove scope picker from dialog
  143. #define OQWF_REMOVEFORMS 0x00000020 // = 1 => remove form picker from dialog
  144. #define OQWF_ISSUEONOPEN 0x00000040 // = 1 => issue query on opening the dialog
  145. #define OQWF_SHOWOPTIONAL 0x00000080 // = 1 => list optional forms by default
  146. ;begin_internal
  147. #define OQWF_HIDESEARCHPANE 0x00000100 // = 1 => hide the search pane by on opening
  148. ;end_internal
  149. #define OQWF_SAVEQUERYONOK 0x00000200 // = 1 => use the IPersistQuery to write the query on close
  150. #define OQWF_HIDEMENUS 0x00000400 // = 1 => no menu bar displayed
  151. #define OQWF_HIDESEARCHUI 0x00000800 // = 1 => dialog is filter, therefore start, stop, new search etc
  152. #define OQWF_PARAMISPROPERTYBAG 0x80000000 // = 1 => the form parameters ptr is an IPropertyBag (ppbFormParameters)
  153. typedef struct
  154. {
  155. DWORD cbStruct; // structure size
  156. DWORD dwFlags; // flags (OQFW_*)
  157. CLSID clsidHandler; // clsid of handler we are using
  158. LPVOID pHandlerParameters; // handler specific structure for initialization
  159. CLSID clsidDefaultForm; // default form to be selected (if OQF_DEFAULTFORM == 1 )
  160. IPersistQuery* pPersistQuery; // IPersistQuery used for loading queries
  161. union
  162. {
  163. void* pFormParameters;
  164. IPropertyBag* ppbFormParameters;
  165. };
  166. } OPENQUERYWINDOW, * LPOPENQUERYWINDOW;
  167. // ICommonQuery
  168. #undef INTERFACE
  169. #define INTERFACE ICommonQuery
  170. DECLARE_INTERFACE_(ICommonQuery, IUnknown)
  171. {
  172. // *** IUnknown methods ***
  173. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  174. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  175. STDMETHOD_(ULONG,Release)(THIS) PURE;
  176. // ICommonQuery methods
  177. STDMETHOD(OpenQueryWindow)(THIS_ HWND hwndParent, LPOPENQUERYWINDOW pQueryWnd, IDataObject** ppDataObject) PURE;
  178. };
  179. ;begin_internal
  180. //-----------------------------------------------------------------------------
  181. // Query handler interfaces structures etc
  182. //-----------------------------------------------------------------------------
  183. //
  184. // Query Scopes
  185. // ============
  186. // A query scope is an opaque structure passed between the query handler
  187. // and the query frame. When the handler is first invoked it is asked
  188. // to declare its scope objects, which inturn the frame holds. When the
  189. // query is issued the scope is passed back to the handler.
  190. //
  191. // When a scope is registered the cbSize field of the structure passed
  192. // is used to define how large the scope is, that entire blob is then
  193. // copied into a heap allocation. Therefore allowing the handler
  194. // to create scope blocks on the stack, knowing that the frame will
  195. // take a copy when it calls the AddProc.
  196. //
  197. struct _cqscope;
  198. typedef struct _cqscope CQSCOPE;
  199. typedef CQSCOPE* LPCQSCOPE;
  200. typedef HRESULT (CALLBACK *LPCQSCOPEPROC)(LPCQSCOPE pScope, UINT uMsg, LPVOID pVoid);
  201. struct _cqscope
  202. {
  203. DWORD cbStruct;
  204. DWORD dwFlags;
  205. LPCQSCOPEPROC pScopeProc;
  206. LPARAM lParam;
  207. };
  208. #define CQSM_INITIALIZE 0x0000000
  209. #define CQSM_RELEASE 0x0000001
  210. #define CQSM_GETDISPLAYINFO 0x0000003 // pVoid -> CQSCOPEDISPLAYINFO
  211. #define CQSM_SCOPEEQUAL 0x0000004 // pVoid -> CQSCOPE
  212. typedef struct
  213. {
  214. DWORD cbStruct;
  215. DWORD dwFlags;
  216. LPWSTR pDisplayName;
  217. INT cchDisplayName;
  218. LPWSTR pIconLocation;
  219. INT cchIconLocation;
  220. INT iIconResID;
  221. INT iIndent;
  222. } CQSCOPEDISPLAYINFO, * LPCQSCOPEDISPLAYINFO;
  223. //
  224. // Command ID's reserved for the frame to use when talking to
  225. // the handler. The handler must use only the IDs in the
  226. // range defined by CQID_MINHANDLERMENUID and CQID_MAXHANDLERMENUID
  227. //
  228. #define CQID_MINHANDLERMENUID 0x0100
  229. #define CQID_MAXHANDLERMENUID 0x4000 // all handler IDs must be below this threshold
  230. #define CQID_FILE_CLOSE (CQID_MAXHANDLERMENUID + 0x0100)
  231. #define CQID_VIEW_SEARCHPANE (CQID_MAXHANDLERMENUID + 0x0101)
  232. #define CQID_LOOKFORLABEL (CQID_MAXHANDLERMENUID + 0x0200)
  233. #define CQID_LOOKFOR (CQID_MAXHANDLERMENUID + 0x0201)
  234. #define CQID_LOOKINLABEL (CQID_MAXHANDLERMENUID + 0x0202)
  235. #define CQID_LOOKIN (CQID_MAXHANDLERMENUID + 0x0203)
  236. #define CQID_BROWSE (CQID_MAXHANDLERMENUID + 0x0204)
  237. #define CQID_FINDNOW (CQID_MAXHANDLERMENUID + 0x0205)
  238. #define CQID_STOP (CQID_MAXHANDLERMENUID + 0x0206)
  239. #define CQID_CLEARALL (CQID_MAXHANDLERMENUID + 0x0207)
  240. //
  241. // When calling IQueryHandler::ActivateView the following reason codes
  242. // are passed to indicate the type of activation being performed
  243. //
  244. #define CQRVA_ACTIVATE 0x00 // wParam = 0, lParam = 0
  245. #define CQRVA_DEACTIVATE 0x01 // wParam = 0, lParam = 0
  246. #define CQRVA_INITMENUBAR 0x02 // wParam/lParam => WM_INITMENU
  247. #define CQRVA_INITMENUBARPOPUP 0x03 // wParam/lParam => WM_INITMENUPOPUP
  248. #define CQRVA_FORMCHANGED 0x04 // wParam = title length, lParam -> title string
  249. #define CQRVA_STARTQUERY 0x05 // wParam = fStarted, lParam = 0
  250. #define CQRVA_HELP 0x06 // wParma = 0, lParam = LPHELPINFO
  251. #define CQRVA_CONTEXTMENU 0x07 // wParam/lParam from the WM_CONTEXTMENU call on the frame
  252. //
  253. // The frame creates the view and then queries the handler for display
  254. // information (title, icon, animation etc). These are all loaded as
  255. // resources from the hInstance specified, if 0 is specified for any
  256. // of the resource ID's then defaults are used.
  257. //
  258. typedef struct
  259. {
  260. DWORD dwFlags; // display attributes
  261. HINSTANCE hInstance; // resource hInstance
  262. INT idLargeIcon; // resource ID's for icons
  263. INT idSmallIcon;
  264. INT idTitle; // resource ID for title string
  265. INT idAnimation; // resource ID for animation
  266. } CQVIEWINFO, * LPCQVIEWINFO;
  267. //
  268. // IQueryHandler::GetViewObject is passed a scope indiciator to allow it
  269. // to trim the result set. All handlers must support CQRVS_SELECTION. Also,
  270. // CQRVS_HANDLERMASK defines the flags available for the handler to
  271. // use internally.
  272. //
  273. #define CQRVS_ALL 0x00000001
  274. #define CQRVS_SELECTION 0x00000002
  275. #define CQRVS_MASK 0x00ffffff
  276. #define CQRVS_HANDLERMASK 0xff000000
  277. //
  278. // When invoking the query all the parameters, the scope, the form
  279. // etc are bundled into this structure and then passed to the
  280. // IQueryHandler::IssueQuery method, it inturn populates the view
  281. // previously created with IQueryHandler::CreateResultView.
  282. //
  283. typedef struct
  284. {
  285. DWORD cbStruct;
  286. DWORD dwFlags;
  287. LPCQSCOPE pQueryScope; // handler specific scope
  288. LPVOID pQueryParameters; // handle specific argument block
  289. CLSID clsidForm; // form ID
  290. } CQPARAMS, * LPCQPARAMS;
  291. //
  292. // Query Frame Window Messages
  293. // ===========================
  294. //
  295. // CQFWM_ADDSCOPE
  296. // --------------
  297. // wParam = LPCQSCOPE, lParam = HIWORD(index), LOWORD(fSelect)
  298. //
  299. // Add a scope to the scope list of the dialog, allows async scope collection
  300. // to be performed. When the handlers AddScopes method is called then
  301. // handler can return S_OK, spin off a thread and post CQFWM_ADDSCOPE
  302. // messages to the frame, which will inturn allow the scopes to be
  303. // added to the control. When the frame receives this message it copies
  304. // the scope as it does on IQueryFrame::AddScope, if the call fails it
  305. // returns FALSE.
  306. //
  307. #define CQFWM_ADDSCOPE (WM_USER+256)
  308. //
  309. // CQFWM_GETFRAME
  310. // --------------
  311. // wParam = 0, lParam = (IQueryFrame**)
  312. //
  313. // Allows an object to query for the frame window's IQueryFrame
  314. // interface, this is used by the property well to talk to the
  315. // other forms within the system.
  316. //
  317. #define CQFWM_GETFRAME (WM_USER+257)
  318. //
  319. // CQFWM_ALLSCOPESADDED
  320. // --------------------
  321. // wParam = 0, lParam = 0
  322. //
  323. // If a handler is adding scopes async, then it should issue this message
  324. // when all the scopes have been added. That way if the caller specifies
  325. // OQWF_ISSUEONOPEN we can start the query once all the scopes have been
  326. // added.
  327. //
  328. #define CQFWM_ALLSCOPESADDED (WM_USER+258)
  329. //
  330. // CQFWM_STARTQUERY
  331. // ----------------
  332. // wParam = 0, lParam = 0
  333. //
  334. // This call can be made by the frame or the form, it allows it to
  335. // start the query running in those cases where a form really needs
  336. // this functionality.
  337. //
  338. // NB: this should be kept private!
  339. //
  340. #define CQFWM_STARTQUERY (WM_USER+259)
  341. //
  342. // CQFWM_SETDEFAULTFOCUS
  343. // ---------------------
  344. // Posted to ourselves to ensure focus is on the right control.
  345. //
  346. #define CQFWM_SETDEFAULTFOCUS (WM_USER+260)
  347. //
  348. // IQueryFrame
  349. //
  350. #undef INTERFACE
  351. #define INTERFACE IQueryFrame
  352. DECLARE_INTERFACE_(IQueryFrame, IUnknown)
  353. {
  354. // *** IUnknown methods ***
  355. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  356. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  357. STDMETHOD_(ULONG,Release)(THIS) PURE;
  358. // *** IQueryFrame methods ***
  359. STDMETHOD(AddScope)(THIS_ LPCQSCOPE pScope, INT i, BOOL fSelect) PURE;
  360. STDMETHOD(GetWindow)(THIS_ HWND* phWnd) PURE;
  361. STDMETHOD(InsertMenus)(THIS_ HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidth) PURE;
  362. STDMETHOD(RemoveMenus)(THIS_ HMENU hmenuShared) PURE;
  363. STDMETHOD(SetMenu)(THIS_ HMENU hmenuShared, HOLEMENU holereservedMenu) PURE;
  364. STDMETHOD(SetStatusText)(THIS_ LPCTSTR pszStatusText) PURE;
  365. STDMETHOD(StartQuery)(THIS_ BOOL fStarting) PURE;
  366. STDMETHOD(LoadQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  367. STDMETHOD(SaveQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  368. STDMETHOD(CallForm)(THIS_ LPCLSID pForm, UINT uMsg, WPARAM wParam, LPARAM lParam) PURE;
  369. STDMETHOD(GetScope)(THIS_ LPCQSCOPE* ppScope) PURE;
  370. STDMETHOD(GetHandler)(THIS_ REFIID riid, void **ppv) PURE;
  371. };
  372. //
  373. // IQueryHandler interface
  374. //
  375. #undef INTERFACE
  376. #define INTERFACE IQueryHandler
  377. DECLARE_INTERFACE_(IQueryHandler, IUnknown)
  378. {
  379. // *** IUnknown methods ***
  380. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  381. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  382. STDMETHOD_(ULONG,Release)(THIS) PURE;
  383. // *** IQueryHandler methods ***
  384. STDMETHOD(Initialize)(THIS_ IQueryFrame* pQueryFrame, DWORD dwOQWFlags, LPVOID pParameters) PURE;
  385. STDMETHOD(GetViewInfo)(THIS_ LPCQVIEWINFO pViewInfo) PURE;
  386. STDMETHOD(AddScopes)(THIS) PURE;
  387. STDMETHOD(BrowseForScope)(THIS_ HWND hwndParent, LPCQSCOPE pCurrentScope, LPCQSCOPE* ppScope) PURE;
  388. STDMETHOD(CreateResultView)(THIS_ HWND hwndParent, HWND* phWndView) PURE;
  389. STDMETHOD(ActivateView)(THIS_ UINT uState, WPARAM wParam, LPARAM lParam) PURE;
  390. STDMETHOD(InvokeCommand)(THIS_ HWND hwndParent, UINT idCmd) PURE;
  391. STDMETHOD(GetCommandString)(THIS_ UINT idCmd, DWORD dwFlags, LPTSTR pBuffer, INT cchBuffer) PURE;
  392. STDMETHOD(IssueQuery)(THIS_ LPCQPARAMS pQueryParams) PURE;
  393. STDMETHOD(StopQuery)(THIS) PURE;
  394. STDMETHOD(GetViewObject)(THIS_ UINT uScope, REFIID riid, LPVOID* ppvOut) PURE;
  395. STDMETHOD(LoadQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  396. STDMETHOD(SaveQuery)(THIS_ IPersistQuery* pPersistQuery, LPCQSCOPE pScope) PURE;
  397. };
  398. ;end_internal
  399. ;begin_both
  400. #endif // GUID_DEFS_ONLY
  401. #endif
  402. ;end_both