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