GME
13
|
00001 //################################################################################################ 00002 // 00003 // Box Decorator COM side Implementation 00004 // BoxDecoratorImpl.cpp 00005 // 00006 //################################################################################################ 00007 00008 #include "StdAfx.h" 00009 #include "BoxDecorator.h" 00010 #include "DecoratorExceptions.h" 00011 #include "DecoratorInterface.h" 00012 #include "MgaDecoratorLib.h" 00013 #include "BoxDecoratorImpl.h" 00014 00015 00016 //################################################################################################ 00017 // 00018 // CLASS : CBoxDecoratorImpl 00019 // 00020 //################################################################################################ 00021 00022 #define VERIFY_INITIALIZATION \ 00023 if (!m_pElementDecorator) \ 00024 return E_DECORATOR_UNINITIALIZED; 00025 00026 #define VERIFY_LOCATION \ 00027 if (!m_bLocationSet) \ 00028 return E_DECORATOR_LOCISNOTSET; 00029 00030 CBoxDecoratorImpl::CBoxDecoratorImpl(): 00031 m_pElementDecorator (NULL), 00032 m_bLocationSet (false), 00033 m_bInitCallFromEx (false) 00034 { 00035 } 00036 00037 CBoxDecoratorImpl::~CBoxDecoratorImpl() 00038 { 00039 } 00040 00041 STDMETHODIMP CBoxDecoratorImpl::Initialize(IMgaProject* pProject, IMgaMetaPart* pPart, IMgaFCO* pFCO) 00042 { 00043 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00044 00045 if (pFCO && !m_bInitCallFromEx) 00046 return E_DECORATOR_USING_DEPRECATED_FUNCTION; 00047 00048 return S_OK; 00049 } 00050 00051 STDMETHODIMP CBoxDecoratorImpl::Destroy() 00052 { 00053 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00054 00055 VERIFY_INITIALIZATION 00056 00057 HRESULT retVal = S_OK; 00058 try { 00059 m_pElementDecorator->Destroy(); 00060 } 00061 catch(hresult_exception& e) { 00062 retVal = e.hr; 00063 } 00064 catch(DecoratorException& e) { 00065 retVal = e.GetHResult(); 00066 } 00067 00068 m_bLocationSet = false; 00069 delete m_pElementDecorator; 00070 m_pElementDecorator = NULL; 00071 00072 return retVal; 00073 } 00074 00075 STDMETHODIMP CBoxDecoratorImpl::GetMnemonic(BSTR* bstrMnemonic) 00076 { 00077 *bstrMnemonic = CComBSTR("BoxDecorator").Detach(); 00078 00079 return S_OK; 00080 } 00081 00082 STDMETHODIMP CBoxDecoratorImpl::GetFeatures(feature_code* pFeatureCodes) 00083 { 00084 if (m_pElementDecorator != NULL) 00085 *pFeatureCodes = m_pElementDecorator->GetFeatures(); 00086 else 00087 *pFeatureCodes = F_RESIZABLE | F_HASLABEL | F_HASPORTS; 00088 00089 return S_OK; 00090 } 00091 00092 STDMETHODIMP CBoxDecoratorImpl::SetParam(BSTR bstrName, VARIANT vValue) 00093 { 00094 VERIFY_INITIALIZATION 00095 00096 HRESULT retVal = S_OK; 00097 try { 00098 m_pElementDecorator->SetParam(bstrName, vValue); 00099 } 00100 catch(hresult_exception& e) { 00101 retVal = e.hr; 00102 } 00103 catch(DecoratorException& e) { 00104 retVal = e.GetHResult(); 00105 } 00106 return retVal; 00107 } 00108 00109 STDMETHODIMP CBoxDecoratorImpl::GetParam(BSTR bstrName, VARIANT* pvValue) 00110 { 00111 VERIFY_INITIALIZATION 00112 00113 HRESULT retVal = S_OK; 00114 try { 00115 m_pElementDecorator->GetParam(bstrName, pvValue); 00116 } 00117 catch(hresult_exception& e) { 00118 retVal = e.hr; 00119 } 00120 catch(DecoratorException& e) { 00121 retVal = e.GetHResult(); 00122 } 00123 return retVal; 00124 } 00125 00126 STDMETHODIMP CBoxDecoratorImpl::SetActive(VARIANT_BOOL vbIsActive) 00127 { 00128 VERIFY_INITIALIZATION 00129 00130 HRESULT retVal = S_OK; 00131 try { 00132 m_pElementDecorator->SetActive(vbIsActive == VARIANT_TRUE); 00133 } 00134 catch(hresult_exception& e) { 00135 retVal = e.hr; 00136 } 00137 catch(DecoratorException& e) { 00138 retVal = e.GetHResult(); 00139 } 00140 return retVal; 00141 } 00142 00143 STDMETHODIMP CBoxDecoratorImpl::GetPreferredSize(LONG* plWidth, LONG* plHeight) 00144 { 00145 VERIFY_INITIALIZATION 00146 00147 HRESULT retVal = S_OK; 00148 try { 00149 CSize cSize = m_pElementDecorator->GetPreferredSize(); 00150 *plWidth = cSize.cx; 00151 *plHeight = cSize.cy; 00152 } 00153 catch(hresult_exception& e) { 00154 retVal = e.hr; 00155 } 00156 catch(DecoratorException& e) { 00157 retVal = e.GetHResult(); 00158 } 00159 return retVal; 00160 } 00161 00162 00163 STDMETHODIMP CBoxDecoratorImpl::SetLocation(LONG sx, LONG sy, LONG ex, LONG ey) 00164 { 00165 VERIFY_INITIALIZATION 00166 00167 HRESULT retVal = S_OK; 00168 try { 00169 m_pElementDecorator->SetLocation(CRect(sx, sy, ex, ey)); 00170 m_bLocationSet = true; 00171 } 00172 catch(hresult_exception& e) { 00173 retVal = e.hr; 00174 } 00175 catch(DecoratorException& e) { 00176 retVal = e.GetHResult(); 00177 } 00178 return retVal; 00179 } 00180 00181 STDMETHODIMP CBoxDecoratorImpl::GetLocation(LONG* sx, LONG* sy, LONG* ex, LONG* ey) 00182 { 00183 VERIFY_INITIALIZATION 00184 VERIFY_LOCATION 00185 00186 HRESULT retVal = S_OK; 00187 try { 00188 CRect cRect = m_pElementDecorator->GetLocation(); 00189 *sx = cRect.left; 00190 *sy = cRect.top; 00191 *ex = cRect.right; 00192 *ey = cRect.bottom; 00193 } 00194 catch(hresult_exception& e) { 00195 retVal = e.hr; 00196 } 00197 catch(DecoratorException& e) { 00198 retVal = e.GetHResult(); 00199 } 00200 return retVal; 00201 } 00202 00203 STDMETHODIMP CBoxDecoratorImpl::GetLabelLocation(LONG* sx, LONG* sy, LONG* ex, LONG* ey) 00204 { 00205 VERIFY_INITIALIZATION 00206 VERIFY_LOCATION 00207 00208 HRESULT retVal = S_OK; 00209 try { 00210 CRect labelRect = m_pElementDecorator->GetLabelLocation(); 00211 *sx = labelRect.left; 00212 *sy = labelRect.top; 00213 *ex = labelRect.right; 00214 *ey = labelRect.bottom; 00215 } 00216 catch(hresult_exception& e) { 00217 retVal = e.hr; 00218 } 00219 catch(DecoratorException& e) { 00220 retVal = e.GetHResult(); 00221 } 00222 return retVal; 00223 } 00224 00225 STDMETHODIMP CBoxDecoratorImpl::GetPortLocation(IMgaFCO* pFCO, LONG* sx, LONG* sy, LONG* ex, LONG* ey) 00226 { 00227 VERIFY_INITIALIZATION 00228 VERIFY_LOCATION 00229 00230 HRESULT retVal = S_OK; 00231 try { 00232 CRect portLocation = m_pElementDecorator->GetPortLocation(CComPtr<IMgaFCO>(pFCO)); 00233 *sx = portLocation.left; 00234 *sy = portLocation.top; 00235 *ex = portLocation.right; 00236 *ey = portLocation.bottom; 00237 } 00238 catch(hresult_exception& e) { 00239 retVal = e.hr; 00240 } 00241 catch(DecoratorException& e) { 00242 retVal = e.GetHResult(); 00243 } 00244 return retVal; 00245 } 00246 00247 STDMETHODIMP CBoxDecoratorImpl::GetPorts(IMgaFCOs** portFCOs) 00248 { 00249 VERIFY_INITIALIZATION 00250 00251 HRESULT retVal = S_OK; 00252 try { 00253 CComPtr<IMgaFCOs> portMgaFCOs; 00254 m_pElementDecorator->GetPorts(portMgaFCOs); 00255 *portFCOs = portMgaFCOs; 00256 } 00257 catch(hresult_exception& e) { 00258 retVal = e.hr; 00259 } 00260 catch(DecoratorException& e) { 00261 retVal = e.GetHResult(); 00262 } 00263 return retVal; 00264 } 00265 00266 STDMETHODIMP CBoxDecoratorImpl::Draw(ULONG hdc) 00267 { 00268 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00269 00270 VERIFY_INITIALIZATION 00271 VERIFY_LOCATION 00272 00273 return E_DECORATOR_USING_DEPRECATED_FUNCTION; 00274 } 00275 00276 STDMETHODIMP CBoxDecoratorImpl::SaveState() 00277 { 00278 VERIFY_INITIALIZATION 00279 00280 return S_OK; 00281 } 00282 00283 // New functions 00284 STDMETHODIMP CBoxDecoratorImpl::InitializeEx(IMgaProject* pProject, IMgaMetaPart* pPart, IMgaFCO* pFCO, 00285 IMgaCommonDecoratorEvents* eventSink, ULONGLONG parentWnd) 00286 { 00287 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00288 00289 m_bInitCallFromEx = true; 00290 00291 HRESULT retVal = S_OK; 00292 try { 00293 BoxDecorator* boxDecorator = new BoxDecorator(CComPtr<IMgaCommonDecoratorEvents>(eventSink)); 00294 m_pElementDecorator = boxDecorator; 00295 00296 boxDecorator->InitializeEx(CComPtr<IMgaProject>(pProject), CComPtr<IMgaMetaPart>(pPart), 00297 CComPtr<IMgaFCO>(pFCO), (HWND)parentWnd); 00298 } 00299 catch(hresult_exception& e) { 00300 retVal = e.hr; 00301 } 00302 catch(DecoratorException& e) { 00303 retVal = e.GetHResult(); 00304 } 00305 // TODO: catch bad_alloc et al 00306 00307 return retVal; 00308 } 00309 00310 STDMETHODIMP CBoxDecoratorImpl::DrawEx(ULONG hdc, ULONGLONG gdipGraphics) 00311 { 00312 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00313 00314 VERIFY_INITIALIZATION 00315 VERIFY_LOCATION 00316 00317 HRESULT retVal = S_OK; 00318 00319 CDC dc; 00320 dc.Attach((HDC)hdc); 00321 { 00322 try { 00323 m_pElementDecorator->Draw(&dc, (Gdiplus::Graphics*)gdipGraphics); 00324 } 00325 catch(hresult_exception& e) { 00326 retVal = e.hr; 00327 } 00328 catch(DecoratorException& e) { 00329 retVal = e.GetHResult(); 00330 } 00331 } 00332 dc.Detach(); 00333 00334 return retVal; 00335 } 00336 00337 STDMETHODIMP CBoxDecoratorImpl::SetSelected(VARIANT_BOOL vbIsSelected) 00338 { 00339 VERIFY_INITIALIZATION 00340 00341 HRESULT retVal = S_OK; 00342 try { 00343 m_pElementDecorator->SetSelected(vbIsSelected == VARIANT_TRUE); 00344 } 00345 catch(hresult_exception& e) { 00346 retVal = e.hr; 00347 } 00348 catch(DecoratorException& e) { 00349 retVal = e.GetHResult(); 00350 } 00351 return retVal; 00352 } 00353 00354 STDMETHODIMP CBoxDecoratorImpl::MouseMoved(ULONG nFlags, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00355 { 00356 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00357 00358 HRESULT retVal = S_OK; 00359 try { 00360 if (m_pElementDecorator->MouseMoved(nFlags, CPoint(pointx, pointy), (HDC)transformHDC)) 00361 retVal = S_DECORATOR_EVENT_HANDLED; 00362 else 00363 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00364 } 00365 catch(hresult_exception& e) { 00366 retVal = e.hr; 00367 } 00368 catch(DecoratorException& e) { 00369 retVal = e.GetHResult(); 00370 } 00371 return retVal; 00372 } 00373 00374 STDMETHODIMP CBoxDecoratorImpl::MouseLeftButtonDown(ULONG nFlags, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00375 { 00376 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00377 00378 HRESULT retVal = S_OK; 00379 try { 00380 if (m_pElementDecorator->MouseLeftButtonDown(nFlags, CPoint(pointx, pointy), (HDC)transformHDC)) 00381 retVal = S_DECORATOR_EVENT_HANDLED; 00382 else 00383 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00384 } 00385 catch(hresult_exception& e) { 00386 retVal = e.hr; 00387 } 00388 catch(DecoratorException& e) { 00389 retVal = e.GetHResult(); 00390 } 00391 return retVal; 00392 } 00393 00394 STDMETHODIMP CBoxDecoratorImpl::MouseLeftButtonUp(ULONG nFlags, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00395 { 00396 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00397 00398 HRESULT retVal = S_OK; 00399 try { 00400 if (m_pElementDecorator->MouseLeftButtonUp(nFlags, CPoint(pointx, pointy), (HDC)transformHDC)) 00401 retVal = S_DECORATOR_EVENT_HANDLED; 00402 else 00403 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00404 } 00405 catch(hresult_exception& e) { 00406 retVal = e.hr; 00407 } 00408 catch(DecoratorException& e) { 00409 retVal = e.GetHResult(); 00410 } 00411 return retVal; 00412 } 00413 00414 STDMETHODIMP CBoxDecoratorImpl::MouseLeftButtonDoubleClick(ULONG nFlags, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00415 { 00416 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00417 00418 HRESULT retVal = S_OK; 00419 try { 00420 if (m_pElementDecorator->MouseLeftButtonDoubleClick(nFlags, CPoint(pointx, pointy), (HDC)transformHDC)) 00421 retVal = S_DECORATOR_EVENT_HANDLED; 00422 else 00423 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00424 } 00425 catch(hresult_exception& e) { 00426 retVal = e.hr; 00427 } 00428 catch(DecoratorException& e) { 00429 retVal = e.GetHResult(); 00430 } 00431 return retVal; 00432 } 00433 00434 STDMETHODIMP CBoxDecoratorImpl::MouseRightButtonDown(ULONGLONG hCtxMenu, ULONG nFlags, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00435 { 00436 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00437 00438 HRESULT retVal = S_OK; 00439 try { 00440 if (m_pElementDecorator->MouseRightButtonDown((HMENU) hCtxMenu, nFlags, CPoint(pointx, pointy), (HDC)transformHDC)) 00441 retVal = S_DECORATOR_EVENT_HANDLED; 00442 else 00443 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00444 } 00445 catch(hresult_exception& e) { 00446 retVal = e.hr; 00447 } 00448 catch(DecoratorException& e) { 00449 retVal = e.GetHResult(); 00450 } 00451 return retVal; 00452 } 00453 00454 STDMETHODIMP CBoxDecoratorImpl::MouseRightButtonUp(ULONG nFlags, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00455 { 00456 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00457 00458 HRESULT retVal = S_OK; 00459 try { 00460 if (m_pElementDecorator->MouseRightButtonUp(nFlags, CPoint(pointx, pointy), (HDC)transformHDC)) 00461 retVal = S_DECORATOR_EVENT_HANDLED; 00462 else 00463 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00464 } 00465 catch(hresult_exception& e) { 00466 retVal = e.hr; 00467 } 00468 catch(DecoratorException& e) { 00469 retVal = e.GetHResult(); 00470 } 00471 return retVal; 00472 } 00473 00474 STDMETHODIMP CBoxDecoratorImpl::MouseRightButtonDoubleClick(ULONG nFlags, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00475 { 00476 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00477 00478 HRESULT retVal = S_OK; 00479 try { 00480 if (m_pElementDecorator->MouseRightButtonDoubleClick(nFlags, CPoint(pointx, pointy), (HDC)transformHDC)) 00481 retVal = S_DECORATOR_EVENT_HANDLED; 00482 else 00483 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00484 } 00485 catch(hresult_exception& e) { 00486 retVal = e.hr; 00487 } 00488 catch(DecoratorException& e) { 00489 retVal = e.GetHResult(); 00490 } 00491 return retVal; 00492 } 00493 00494 STDMETHODIMP CBoxDecoratorImpl::MouseMiddleButtonDown(ULONG nFlags, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00495 { 00496 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00497 00498 HRESULT retVal = S_OK; 00499 try { 00500 if (m_pElementDecorator->MouseMiddleButtonDown(nFlags, CPoint(pointx, pointy), (HDC)transformHDC)) 00501 retVal = S_DECORATOR_EVENT_HANDLED; 00502 else 00503 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00504 } 00505 catch(hresult_exception& e) { 00506 retVal = e.hr; 00507 } 00508 catch(DecoratorException& e) { 00509 retVal = e.GetHResult(); 00510 } 00511 return retVal; 00512 } 00513 00514 STDMETHODIMP CBoxDecoratorImpl::MouseMiddleButtonUp(ULONG nFlags, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00515 { 00516 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00517 00518 HRESULT retVal = S_OK; 00519 try { 00520 if (m_pElementDecorator->MouseMiddleButtonUp(nFlags, CPoint(pointx, pointy), (HDC)transformHDC)) 00521 retVal = S_DECORATOR_EVENT_HANDLED; 00522 else 00523 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00524 } 00525 catch(hresult_exception& e) { 00526 retVal = e.hr; 00527 } 00528 catch(DecoratorException& e) { 00529 retVal = e.GetHResult(); 00530 } 00531 return retVal; 00532 } 00533 00534 STDMETHODIMP CBoxDecoratorImpl::MouseMiddleButtonDoubleClick(ULONG nFlags, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00535 { 00536 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00537 00538 HRESULT retVal = S_OK; 00539 try { 00540 if (m_pElementDecorator->MouseMiddleButtonDoubleClick(nFlags, CPoint(pointx, pointy), (HDC)transformHDC)) 00541 retVal = S_DECORATOR_EVENT_HANDLED; 00542 else 00543 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00544 } 00545 catch(hresult_exception& e) { 00546 retVal = e.hr; 00547 } 00548 catch(DecoratorException& e) { 00549 retVal = e.GetHResult(); 00550 } 00551 return retVal; 00552 } 00553 00554 STDMETHODIMP CBoxDecoratorImpl::MouseWheelTurned(ULONG nFlags, LONG distance, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00555 { 00556 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00557 00558 HRESULT retVal = S_OK; 00559 try { 00560 if (m_pElementDecorator->MouseWheelTurned(nFlags, (short)distance, CPoint(pointx, pointy), (HDC)transformHDC)) 00561 retVal = S_DECORATOR_EVENT_HANDLED; 00562 else 00563 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00564 } 00565 catch(hresult_exception& e) { 00566 retVal = e.hr; 00567 } 00568 catch(DecoratorException& e) { 00569 retVal = e.GetHResult(); 00570 } 00571 return retVal; 00572 } 00573 00574 STDMETHODIMP CBoxDecoratorImpl::DragEnter(ULONG* dropEffect, ULONGLONG pCOleDataObject, ULONG keyState, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00575 { 00576 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00577 00578 HRESULT retVal = S_OK; 00579 try { 00580 if (m_pElementDecorator->DragEnter((DROPEFFECT*)dropEffect, (COleDataObject*)pCOleDataObject, (DWORD)keyState, CPoint(pointx, pointy), (HDC)transformHDC)) { 00581 retVal = S_DECORATOR_EVENT_HANDLED; 00582 } else { 00583 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00584 *dropEffect = DROPEFFECT_NONE; 00585 } 00586 } 00587 catch(hresult_exception& e) { 00588 retVal = e.hr; 00589 } 00590 catch(DecoratorException& e) { 00591 retVal = e.GetHResult(); 00592 } 00593 return retVal; 00594 } 00595 00596 STDMETHODIMP CBoxDecoratorImpl::DragOver(ULONG* dropEffect, ULONGLONG pCOleDataObject, ULONG keyState, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00597 { 00598 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00599 00600 HRESULT retVal = S_OK; 00601 try { 00602 if (m_pElementDecorator->DragOver((DROPEFFECT*)dropEffect, (COleDataObject*)pCOleDataObject, (DWORD)keyState, CPoint(pointx, pointy), (HDC)transformHDC)) { 00603 retVal = S_DECORATOR_EVENT_HANDLED; 00604 } else { 00605 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00606 *dropEffect = DROPEFFECT_NONE; 00607 } 00608 } 00609 catch(hresult_exception& e) { 00610 retVal = e.hr; 00611 } 00612 catch(DecoratorException& e) { 00613 retVal = e.GetHResult(); 00614 } 00615 return retVal; 00616 } 00617 00618 STDMETHODIMP CBoxDecoratorImpl::Drop(ULONGLONG pCOleDataObject, ULONG dropEffect, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00619 { 00620 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00621 00622 HRESULT retVal = S_OK; 00623 try { 00624 if (m_pElementDecorator->Drop((COleDataObject*)pCOleDataObject, (DROPEFFECT)dropEffect, CPoint(pointx, pointy), (HDC)transformHDC)) 00625 retVal = S_DECORATOR_EVENT_HANDLED; 00626 else 00627 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00628 } 00629 catch(hresult_exception& e) { 00630 retVal = e.hr; 00631 } 00632 catch(DecoratorException& e) { 00633 retVal = e.GetHResult(); 00634 } 00635 return retVal; 00636 } 00637 00638 STDMETHODIMP CBoxDecoratorImpl::DropFile(ULONGLONG hDropInfo, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00639 { 00640 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00641 00642 HRESULT retVal = S_OK; 00643 try { 00644 if (m_pElementDecorator->DropFile((HDROP)hDropInfo, CPoint(pointx, pointy), (HDC)transformHDC)) 00645 retVal = S_DECORATOR_EVENT_HANDLED; 00646 else 00647 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00648 } 00649 catch(hresult_exception& e) { 00650 retVal = e.hr; 00651 } 00652 catch(DecoratorException& e) { 00653 retVal = e.GetHResult(); 00654 } 00655 return retVal; 00656 } 00657 00658 STDMETHODIMP CBoxDecoratorImpl::MenuItemSelected(ULONG menuItemId, ULONG nFlags, LONG pointx, LONG pointy, ULONGLONG transformHDC) 00659 { 00660 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00661 00662 HRESULT retVal = S_OK; 00663 try { 00664 if (m_pElementDecorator->MenuItemSelected(menuItemId, nFlags, CPoint(pointx, pointy), (HDC)transformHDC)) 00665 retVal = S_DECORATOR_EVENT_HANDLED; 00666 else 00667 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00668 } 00669 catch(hresult_exception& e) { 00670 retVal = e.hr; 00671 } 00672 catch(DecoratorException& e) { 00673 retVal = e.GetHResult(); 00674 } 00675 return retVal; 00676 } 00677 00678 STDMETHODIMP CBoxDecoratorImpl::OperationCanceled() 00679 { 00680 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 00681 00682 HRESULT retVal = S_OK; 00683 try { 00684 if (m_pElementDecorator->OperationCanceledByGME()) 00685 retVal = S_DECORATOR_EVENT_HANDLED; 00686 else 00687 retVal = S_DECORATOR_EVENT_NOT_HANDLED; 00688 } 00689 catch(hresult_exception& e) { 00690 retVal = e.hr; 00691 } 00692 catch(DecoratorException& e) { 00693 retVal = e.GetHResult(); 00694 } 00695 return retVal; 00696 }