Files
Slnkdwf/SlnkDWFCom/eplotsections.cpp
Jos Groot Lipman 6596ce32c5 TUDE#13285 AsDWF Schaal behouden
svn path=/Slnkdwf/trunk/; revision=12484
2007-12-19 09:44:56 +00:00

89 lines
2.3 KiB
C++

// EPlotSections.cpp : Implementation of CEPlotSections
#include "stdafx.h"
#include "EPlotSections.h"
// CEPlotSections
STDMETHODIMP CEPlotSections::InterfaceSupportsErrorInfo(REFIID riid)
{
static const IID* arr[] =
{
&IID_IEPlotSections
};
for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
{
if (InlineIsEqualGUID(*arr[i],riid))
return S_OK;
}
return S_FALSE;
}
// Omdat de tellingen gekoppeld zijn weten we zeker dat de refcount van
// onze eigen objecten ook 0 zal zijn en is het dus veilig ze weg te gooien (toch...?)
void CEPlotSections::FinalRelease()
{
return;
for (int i=0; i<(LONG)m_EPlotSections.GetCount(); i++)
{
CComObjectEmbed<CEPlotSection> *mySection;
mySection = &m_EPlotSections.GetAt(i);
mySection->FinalRelease();
// Gebeurt in de destructor van AtlArray! delete (&m_EPlotSections.GetAt(i));
}
}
void CEPlotSections::InitImpl(CEPlotSectionsImpl *epl)
{
m_pSectionsImpl = epl;
}
STDMETHODIMP CEPlotSections::get_Parent(IDWFFile **ppParent)
{
return m_pParent->QueryInterface(IID_IDWFFile, (void**)ppParent);
}
void CEPlotSections::SetParent(IDWFFile *pParent)
{
m_pParent = pParent;
}
// Actually process the EPlotSections and add them to our collection
BOOL CEPlotSections::ProcessManifest(DWFManifest& rManifest, CString sourceDescription)
{
ATLASSERT(false);
return TRUE;
}
STDMETHODIMP CEPlotSections::get_Count(LONG* pVal)
{
(*pVal) = (LONG)m_pSectionsImpl->get_Count();
return S_OK;
}
STDMETHODIMP CEPlotSections::get_Item(LONG i, IEPlotSection** pVal)
{
if (i<0 || i>=(LONG)m_pSectionsImpl->get_Count())
return E_INVALIDARG;
if (m_EPlotSections.GetCount() == 0)
{ // Tijd om de myEplotSectionImpl's te wrappen met onze myEplotSection's
for (int j=0; j<m_pSectionsImpl->get_Count(); j++)
{
CComObjectEmbed<CEPlotSection> *mySection = new CComObjectEmbed<CEPlotSection>; //= new tMyEplot;
mySection->SetParent(this);
CEPlotSectionImpl *ps;
ps = m_pSectionsImpl->get_Item(j);
mySection->InitImpl(ps);
mySection->SetOuterUnknown(GetControllingUnknown());
mySection->FinalConstruct();
m_EPlotSections.Add(*mySection);
}
}
ATLASSERT(i<(LONG)m_EPlotSections.GetCount());
return (m_EPlotSections.GetAt(i).QueryInterface(pVal));
}