STDMETHODIMP COlePropertiesDialog::XOleUIObjInfo::GetViewInfo( DWORD dwObject, HGLOBAL* phMetaPict, DWORD* pdvAspect, int* pnCurrentScale) { COleClientItem* pItem = (COleClientItem*)dwObject; ASSERT_VALID(pItem); if (phMetaPict != NULL) *phMetaPict = pItem->GetIconicMetafile(); if (pdvAspect != NULL) *pdvAspect = pItem->GetDrawAspect(); if (pnCurrentScale != NULL) *pnCurrentScale = 100; // 100% (arbitrary for now) return S_OK; }
STDMETHODIMP COlePropertiesDialog::XOleUIObjInfo::SetViewInfo( DWORD dwObject, HGLOBAL hMetaPict, DWORD dvAspect, int nCurrentScale, BOOL bRelativeToOrig) { METHOD_PROLOGUE_EX_(COlePropertiesDialog, OleUIObjInfo) COleClientItem* pItem = (COleClientItem*)dwObject; ASSERT_VALID(pItem); // handle aspect changes if (dvAspect != -1) { pItem->OnChange(OLE_CHANGED_ASPECT, dvAspect); pItem->SetDrawAspect((DVASPECT)dvAspect); // force scale to 100% when changing aspects if (dvAspect == DVASPECT_ICON) { nCurrentScale = 100; bRelativeToOrig = TRUE; } else if (nCurrentScale == -1) { nCurrentScale = 100; bRelativeToOrig = FALSE; } } // handle icon representation changes if (hMetaPict != NULL) { pItem->SetIconicMetafile(hMetaPict); if (pItem->GetDrawAspect() == DVASPECT_ICON) pItem->OnChange(OLE_CHANGED, (DWORD)DVASPECT_ICON); } // handle scale changes if (nCurrentScale != -1) { pThis->OnApplyScale(pItem, nCurrentScale, bRelativeToOrig); } return S_OK; }