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.

266 lines
6.3 KiB

  1. /*++
  2. Copyright (C) 1993-1999 Microsoft Corporation
  3. Module Name:
  4. iipaobj.cpp
  5. Abstract:
  6. IOleInPlaceActiveObject interface implementation for Polyline
  7. --*/
  8. #include "polyline.h"
  9. #include "unkhlpr.h"
  10. #include "unihelpr.h"
  11. #include "utils.h"
  12. /*
  13. * CImpIOleInPlaceActiveObject::CImpIOleInPlaceActiveObject
  14. * CImpIOleInPlaceActiveObject::~CImpIOleInPlaceActiveObject
  15. *
  16. * Parameters (Constructor):
  17. * pObj PCPolyline of the object we're in.
  18. * pUnkOuter LPUNKNOWN to which we delegate.
  19. */
  20. IMPLEMENT_CONTAINED_CONSTRUCTOR(CPolyline, CImpIOleInPlaceActiveObject)
  21. IMPLEMENT_CONTAINED_DESTRUCTOR(CImpIOleInPlaceActiveObject)
  22. IMPLEMENT_CONTAINED_ADDREF(CImpIOleInPlaceActiveObject)
  23. IMPLEMENT_CONTAINED_RELEASE(CImpIOleInPlaceActiveObject)
  24. // CImpIOleInPlaceActiveObject::QueryInterface
  25. STDMETHODIMP CImpIOleInPlaceActiveObject::QueryInterface(REFIID riid
  26. , PPVOID ppv)
  27. {
  28. /*
  29. * This interface should be stand-alone on an object such that a
  30. * container cannot QueryInterface for it through any other
  31. * object interface, relying instead of calls to SetActiveObject
  32. * for it. By implementing QueryInterface here ourselves, we
  33. * prevent such abuses. Note that reference counting still uses
  34. * CFigure.
  35. */
  36. *ppv=NULL;
  37. if (IID_IUnknown==riid || IID_IOleWindow==riid
  38. || IID_IOleInPlaceActiveObject==riid)
  39. *ppv=this;
  40. //AddRef any interface we'll return.
  41. if (NULL!=*ppv)
  42. {
  43. ((LPUNKNOWN)*ppv)->AddRef();
  44. return NOERROR;
  45. }
  46. return ResultFromScode(E_NOINTERFACE);
  47. }
  48. /*
  49. * CImpIOleInPlaceActiveObject::GetWindow
  50. *
  51. * Purpose:
  52. * Retrieves the handle of the window associated with the object on
  53. * which this interface is implemented.
  54. *
  55. * Parameters:
  56. * phWnd HWND * in which to store the window handle.
  57. *
  58. * Return Value:
  59. * HRESULT NOERROR if successful, E_FAIL if there is no
  60. * window.
  61. */
  62. STDMETHODIMP CImpIOleInPlaceActiveObject::GetWindow(HWND *phWnd)
  63. {
  64. *phWnd=m_pObj->m_pHW->Window();;
  65. return NOERROR;
  66. }
  67. /*
  68. * CImpIOleInPlaceActiveObject::ContextSensitiveHelp
  69. *
  70. * Purpose:
  71. * Instructs the object on which this interface is implemented to
  72. * enter or leave a context-sensitive help mode.
  73. *
  74. * Parameters:
  75. * fEnterMode BOOL TRUE to enter the mode, FALSE otherwise.
  76. *
  77. * Return Value:
  78. * HRESULT NOERROR or an error code.
  79. */
  80. STDMETHODIMP CImpIOleInPlaceActiveObject::ContextSensitiveHelp (
  81. BOOL /* fEnterMode */ )
  82. {
  83. return ResultFromScode(E_NOTIMPL);
  84. }
  85. /*
  86. * CImpIOleInPlaceActiveObject::TranslateAccelerator
  87. *
  88. * Purpose:
  89. * Requests that the active in-place object translate the message
  90. * given in pMSG if appropriate. This is only called for DLL
  91. * servers where the container's message loop is running. EXE
  92. * servers have control of the message loop so this will not be
  93. * called in such cases.
  94. *
  95. * Parameters:
  96. * pMSG LPMSG to the message to translate.
  97. *
  98. * Return Value:
  99. * HRESULT NOERROR if translates, S_FALSE if not.
  100. */
  101. STDMETHODIMP CImpIOleInPlaceActiveObject::TranslateAccelerator
  102. (LPMSG pMSG)
  103. {
  104. // Don't handle keys unless we are UI active
  105. if (!m_pObj->m_fUIActive)
  106. return S_FALSE;
  107. // Delegate to the control class
  108. return m_pObj->m_pCtrl->TranslateAccelerators(pMSG);
  109. }
  110. /*
  111. * CImpIOleInPlaceActiveObject::OnFrameWindowActivate
  112. *
  113. * Purpose:
  114. * Informs the in-place object that the container's frame window
  115. * was either activated or deactivated. Not currently used.
  116. *
  117. * Parameters:
  118. * fActivate BOOL TRUE if the frame is active,
  119. * FALSE otherwise
  120. *
  121. * Return Value:
  122. * HRESULT NOERROR or an error code.
  123. */
  124. STDMETHODIMP CImpIOleInPlaceActiveObject::OnFrameWindowActivate (
  125. BOOL /* fActivate */)
  126. {
  127. return ResultFromScode(E_NOTIMPL);
  128. }
  129. /*
  130. * CImpIOleInPlaceActiveObject::OnDocWindowActivate
  131. *
  132. * Purpose:
  133. * Informs the in-place object that the document window in the
  134. * container is either becoming active or deactive. On this call
  135. * the object must either add or remove frame-level tools,
  136. * including the mixed menu, depending on fActivate.
  137. *
  138. * Parameters:
  139. * fActivate BOOL TRUE if the document is active,
  140. * FALSE otherwise
  141. *
  142. * Return Value:
  143. * HRESULT NOERROR or an error code.
  144. */
  145. STDMETHODIMP CImpIOleInPlaceActiveObject::OnDocWindowActivate (BOOL fActivate)
  146. {
  147. USES_CONVERSION
  148. if (NULL==m_pObj->m_pIOleIPFrame)
  149. return NOERROR;
  150. if (fActivate)
  151. {
  152. m_pObj->m_pIOleIPFrame->SetActiveObject(this, T2W(ResourceString(IDS_USERTYPE)));
  153. m_pObj->m_pIOleIPFrame->SetMenu(m_pObj->m_hMenuShared
  154. , m_pObj->m_hOLEMenu, m_pObj->m_pCtrl->Window());
  155. }
  156. else
  157. {
  158. m_pObj->m_pIOleIPFrame->SetActiveObject(NULL, NULL);
  159. }
  160. return NOERROR;
  161. }
  162. /*
  163. * CImpIOleInPlaceActiveObject::ResizeBorder
  164. *
  165. * Purpose:
  166. * Informs the object that the frame or document size changed in
  167. * which case the object may need to resize any of its frame or
  168. * document-level tools to match.
  169. *
  170. * Parameters:
  171. * pRect LPCRECT indicating the new size of the window
  172. * of interest.
  173. * pIUIWindow LPOLEINPLACEUIWINDOW pointing to an
  174. * IOleInPlaceUIWindow interface on the container
  175. * object of interest. We use this to do
  176. * border-space negotiation.
  177. *
  178. * fFrame BOOL indicating if the frame was resized (TRUE)
  179. * or the document (FALSE)
  180. *
  181. * Return Value:
  182. * HRESULT NOERROR or an error code.
  183. */
  184. STDMETHODIMP CImpIOleInPlaceActiveObject::ResizeBorder (
  185. LPCRECT, /* pRect */
  186. LPOLEINPLACEUIWINDOW, /* pIUIWindow */
  187. BOOL /* fFrame */ )
  188. {
  189. return ResultFromScode(E_NOTIMPL);
  190. }
  191. /*
  192. * CImpIOleInPlaceActiveObject::EnableModeless
  193. *
  194. * Purpose:
  195. * Instructs the object to show or hide any modeless popup windows
  196. * that it may be using when activated in-place.
  197. *
  198. * Parameters:
  199. * fEnable BOOL indicating to enable/show the windows
  200. * (TRUE) or to hide them (FALSE).
  201. *
  202. * Return Value:
  203. * HRESULT NOERROR or an error code.
  204. */
  205. STDMETHODIMP CImpIOleInPlaceActiveObject::EnableModeless (
  206. BOOL /* fActivate */ )
  207. {
  208. return ResultFromScode(E_NOTIMPL);
  209. }