Files
Slnkdwf/SlnkDWFCom/SLNKSymbol.cpp
Jos Groot Lipman 80d0142c23 SLNKDWF 2.00
svn path=/Slnkdwf/trunk/; revision=12481
2007-08-01 13:42:28 +00:00

76 lines
1.7 KiB
C++

// SLNKSymbol.cpp : Implementation of CSLNKSymbol
#include "stdafx.h"
#include "SLNKSymbol.h"
#include "SLNKContour.h"
// CSLNKSymbol
STDMETHODIMP CSLNKSymbol::InterfaceSupportsErrorInfo(REFIID riid)
{
static const IID* arr[] =
{
&IID_IWhipFile
};
for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
{
if (InlineIsEqualGUID(*arr[i],riid))
return S_OK;
}
return S_FALSE;
}
void CSLNKSymbol::SetImpl(CSLNKSymbolImpl * pSLNKSymbol)
{
m_SLNKSymbol = pSLNKSymbol;
}
STDMETHODIMP CSLNKSymbol::get_Scale(DOUBLE* pVal)
{
(*pVal) = m_SLNKSymbol->m_Scale;
return S_OK;
}
STDMETHODIMP CSLNKSymbol::put_Scale(DOUBLE newVal)
{
m_SLNKSymbol->m_Scale = newVal;
return S_OK;
}
STDMETHODIMP CSLNKSymbol::get_Rotation(LONG* pVal)
{
(*pVal) = m_SLNKSymbol->m_Rotation;
return S_OK;
}
STDMETHODIMP CSLNKSymbol::put_Rotation(LONG newVal)
{
long rotation = (newVal%360+360)%360; // Normaliseren
if (rotation%90 != 0)
return myAtlReportError (GetObjectCLSID(), "ERROR Symbol rotation must be 0/90/180/270.");
m_SLNKSymbol->m_Rotation = newVal;
return S_OK;
}
STDMETHODIMP CSLNKSymbol::get_Contour(IUnknown** pVal)
{
CSLNKContourImpl *contour= &m_SLNKSymbol->m_SLNKContour;
CComObject<CSLNKContour> *theContour;
HRESULT hr = CComObject<CSLNKContour>::CreateInstance(&theContour);
if(FAILED(hr)) return hr;
theContour->AddRef();
hr = theContour->QueryInterface(IID_ISLNKContour, (void **)pVal);
if(FAILED(hr)) return hr;
theContour->SetParent(m_parent_iWhipFile); // Zelfde parent maar
theContour->Release();
theContour->SetImpl(contour); // Heel belangrijk: zet de implementatie waar we een interface op bieden
return S_OK;
}