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.

201 lines
3.9 KiB

  1. /*++
  2. Copyright (C) 1993-1999 Microsoft Corporation
  3. Module Name:
  4. iipobj.cpp
  5. Abstract:
  6. IOleInPlaceObject interface implementation for Polyline
  7. --*/
  8. #include "polyline.h"
  9. #include "unkhlpr.h"
  10. /*
  11. * CImpIOleInPlaceObject interface implementation
  12. */
  13. IMPLEMENT_CONTAINED_INTERFACE(CPolyline, CImpIOleInPlaceObject)
  14. /*
  15. * CImpIOleInPlaceObject::GetWindow
  16. *
  17. * Purpose:
  18. * Retrieves the handle of the window associated with the object
  19. * on which this interface is implemented.
  20. *
  21. * Parameters:
  22. * phWnd HWND * in which to store the window handle.
  23. *
  24. * Return Value:
  25. * HRESULT NOERROR if successful, E_FAIL if there is no
  26. * window.
  27. */
  28. STDMETHODIMP
  29. CImpIOleInPlaceObject::GetWindow(
  30. OUT HWND *phWnd
  31. )
  32. {
  33. HRESULT hr = S_OK;
  34. if (phWnd == NULL) {
  35. return E_POINTER;
  36. }
  37. try {
  38. if (NULL != m_pObj->m_pHW) {
  39. *phWnd = m_pObj->m_pHW->Window();
  40. }
  41. else {
  42. *phWnd = m_pObj->m_pCtrl->Window();
  43. }
  44. } catch (...) {
  45. hr = E_POINTER;
  46. }
  47. return NOERROR;
  48. }
  49. /*
  50. * CImpIOleInPlaceObject::ContextSensitiveHelp
  51. *
  52. * Purpose:
  53. * Instructs the object on which this interface is implemented to
  54. * enter or leave a context-sensitive help mode.
  55. *
  56. * Parameters:
  57. * fEnterMode BOOL TRUE to enter the mode, FALSE otherwise.
  58. *
  59. * Return Value:
  60. * HRESULT NOERROR or an error code
  61. */
  62. STDMETHODIMP
  63. CImpIOleInPlaceObject::ContextSensitiveHelp (
  64. BOOL /* fEnterMode */
  65. )
  66. {
  67. return (E_NOTIMPL);
  68. }
  69. /*
  70. * CImpIOleInPlaceObject::InPlaceDeactivate
  71. *
  72. * Purpose:
  73. * Instructs the object to deactivate itself from an in-place state
  74. * and to discard any Undo state.
  75. *
  76. * Parameters:
  77. * None
  78. *
  79. * Return Value:
  80. * HRESULT NOERROR or an error code
  81. */
  82. STDMETHODIMP
  83. CImpIOleInPlaceObject::InPlaceDeactivate(void)
  84. {
  85. m_pObj->InPlaceDeactivate();
  86. return NOERROR;
  87. }
  88. /*
  89. * CImpIOleInPlaceObject::UIDeactivate
  90. *
  91. * Purpose:
  92. * Instructs the object to just remove any in-place user interface
  93. * but to do no other deactivation. The object should just hide
  94. * the UI components but not destroy them until InPlaceDeactivate
  95. * is called.
  96. *
  97. * Parameters:
  98. * None
  99. *
  100. * Return Value:
  101. * HRESULT NOERROR or an error code
  102. */
  103. STDMETHODIMP
  104. CImpIOleInPlaceObject::UIDeactivate(void)
  105. {
  106. m_pObj->UIDeactivate();
  107. return NOERROR;
  108. }
  109. /*
  110. * CImpIOleInPlaceObject::SetObjectRects
  111. *
  112. * Purpose:
  113. * Provides the object with rectangles describing the position of
  114. * the object in the container window as well as its visible area.
  115. *
  116. * Parameters:
  117. * prcPos LPCRECT providing the object's full rectangle
  118. * relative to the continer's document. The object
  119. * should scale to this rectangle.
  120. * prcClip LPCRECT describing the visible area of the object
  121. * which should not draw outside these areas.
  122. *
  123. * Return Value:
  124. * HRESULT NOERROR or an error code
  125. */
  126. STDMETHODIMP
  127. CImpIOleInPlaceObject::SetObjectRects(
  128. LPCRECT prcPos,
  129. LPCRECT prcClip
  130. )
  131. {
  132. HRESULT hr = S_OK;
  133. if (NULL != m_pObj->m_pHW) {
  134. try {
  135. m_pObj->m_pHW->RectsSet((LPRECT)prcPos, (LPRECT)prcClip);
  136. } catch (...) {
  137. hr = E_POINTER;
  138. }
  139. }
  140. return hr;
  141. }
  142. /*
  143. * CImpIOleInPlaceObject::ReactivateAndUndo
  144. *
  145. * Purpose:
  146. * Instructs the object to reactivate itself in-place and perform
  147. * whatever Undo means for it.
  148. *
  149. * Parameters:
  150. * None
  151. *
  152. * Return Value:
  153. * HRESULT NOERROR or an error code
  154. */
  155. STDMETHODIMP
  156. CImpIOleInPlaceObject::ReactivateAndUndo(void)
  157. {
  158. return m_pObj->InPlaceActivate(m_pObj->m_pIOleClientSite, TRUE);
  159. }