109 lines
3.4 KiB
C++
109 lines
3.4 KiB
C++
// SLNKContour.h : Declaration of the CSLNKContour
|
|
|
|
#pragma once
|
|
#include "resource.h" // main symbols
|
|
|
|
#include "SLNKDWF.h"
|
|
#include "SLNKContourImpl.h"
|
|
#include "BoundingBox.h"
|
|
|
|
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
|
|
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
|
|
#endif
|
|
|
|
|
|
|
|
// CSLNKContour
|
|
|
|
class ATL_NO_VTABLE CSLNKContour :
|
|
public CComObjectRootEx<CComSingleThreadModel>,
|
|
public CComCoClass<CSLNKContour, &CLSID_SLNKContour>,
|
|
public IDispatchImpl<ISLNKContour, &IID_ISLNKContour, &LIBID_SLNKDWFLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
|
|
{
|
|
public:
|
|
CSLNKContour()
|
|
{
|
|
}
|
|
|
|
//REMOVED DECLARE_REGISTRY_RESOURCEID(IDR_SLNKCONTOUR)
|
|
|
|
|
|
BEGIN_COM_MAP(CSLNKContour)
|
|
COM_INTERFACE_ENTRY(ISLNKContour)
|
|
COM_INTERFACE_ENTRY(IDispatch)
|
|
END_COM_MAP()
|
|
|
|
|
|
|
|
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
|
|
|
HRESULT FinalConstruct()
|
|
{
|
|
//
|
|
// Maak object m_dwgBounding
|
|
//
|
|
CComObject<CBoundingBox> *pBoundingBox;
|
|
HRESULT hr = CComObject<CBoundingBox>::CreateInstance(&pBoundingBox);
|
|
if(FAILED(hr)) return hr;
|
|
|
|
pBoundingBox->AddRef();
|
|
hr = pBoundingBox->QueryInterface(IID_IBoundingBox, (void **)&m_dwgBounding);
|
|
pBoundingBox->Release();
|
|
if(FAILED(hr)) return hr;
|
|
|
|
//
|
|
// Maak object m_dwgCenter
|
|
//
|
|
CComObject<CDWGPoint> *pDWGPoint;
|
|
hr = CComObject<CDWGPoint>::CreateInstance(&pDWGPoint);
|
|
if(FAILED(hr)) return hr;
|
|
|
|
pDWGPoint->AddRef();
|
|
hr = pDWGPoint->QueryInterface(IID_IDWGPoint, (void **)&m_dwgCenter);
|
|
pDWGPoint->Release();
|
|
if(FAILED(hr)) return hr;
|
|
return S_OK;
|
|
}
|
|
|
|
void FinalRelease()
|
|
{
|
|
}
|
|
|
|
// Deze SLNKContour wijst naar een CSLNKContourImpl in een WhipFile object. We moeten voorkomen
|
|
// dat deze te snel uit de scope wegvalt. Dat doen we mbv SetParent
|
|
// Omgekeerd is geen probleem: de WhipFile verwijst niet(!) naar de CSLNKContour en heeft er dus
|
|
// geen last van dat die wegvalt (van zijn SLNKContourImpl objecten is hij gewoon eigenaar)
|
|
|
|
void SetParent(IWhipFile *pParent)
|
|
{
|
|
HRESULT hr = pParent->QueryInterface(IID_IWhipFile, (void **)&m_parent_iWhipFile);
|
|
};
|
|
void SetImpl(CSLNKContourImpl * pSLNKContour);
|
|
|
|
private:
|
|
CSLNKContourImpl * m_SLNKContour;
|
|
CComQIPtr<IDWGPoint> m_dwgCenter;
|
|
CComQIPtr<IBoundingBox> m_dwgBounding;
|
|
CComQIPtr<IWhipFile> m_parent_iWhipFile; // Om scope levend te houden
|
|
|
|
public:
|
|
|
|
STDMETHOD(SetColor)(ULONG rgb, BYTE Alpha);
|
|
STDMETHOD(SetoutlineColor)(ULONG rgb, BYTE Alpha);
|
|
STDMETHOD(SetUrl) (BSTR Url, BSTR FriendlyName);
|
|
STDMETHOD(MoveTop) ();
|
|
STDMETHOD(get_Area)(DOUBLE* pVal);
|
|
STDMETHOD(get_Extents)(IBoundingBox** pVal);
|
|
STDMETHOD(get_Center)(IDWGPoint** pVal);
|
|
STDMETHOD(get_Key)(BSTR* pVal);
|
|
STDMETHOD(put_Key)(BSTR newVal);
|
|
STDMETHOD(get_Label)(BSTR* pVal);
|
|
STDMETHOD(put_Label)(BSTR newVal);
|
|
STDMETHOD(get_Hatch)(BYTE* pVal);
|
|
STDMETHOD(put_Hatch)(BYTE newVal);
|
|
STDMETHOD(get_Lineweight)(DOUBLE* pVal);
|
|
STDMETHOD(put_Lineweight)(DOUBLE newVal);
|
|
};
|
|
|
|
//REMOVED OBJECT_ENTRY_AUTO(__uuidof(SLNKContour), CSLNKContour)
|