Commit a7ad1f73 authored by JP Dinger's avatar JP Dinger

Lots of cosmetics, and drop an unneeded dynamic_cast<> (cast to parent is free).

parent 31f95846
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, write to the Free Software * with this program; if not, write to the Free Software Foundation, Inc.,
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#include "plugin.h" #include "plugin.h"
...@@ -27,24 +27,24 @@ ...@@ -27,24 +27,24 @@
using namespace std; using namespace std;
//////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static const FORMATETC _metaFileFormatEtc = static const FORMATETC _metaFileFormatEtc =
{ {
CF_METAFILEPICT, CF_METAFILEPICT,
NULL, NULL,
DVASPECT_CONTENT, DVASPECT_CONTENT,
-1, -1,
TYMED_MFPICT, TYMED_MFPICT,
}; };
static const FORMATETC _enhMetaFileFormatEtc = static const FORMATETC _enhMetaFileFormatEtc =
{ {
CF_ENHMETAFILE, CF_ENHMETAFILE,
NULL, NULL,
DVASPECT_CONTENT, DVASPECT_CONTENT,
-1, -1,
TYMED_ENHMF, TYMED_ENHMF,
}; };
class VLCEnumFORMATETC : public VLCEnumIterator<IID_IEnumFORMATETC, class VLCEnumFORMATETC : public VLCEnumIterator<IID_IEnumFORMATETC,
IEnumFORMATETC, IEnumFORMATETC,
...@@ -60,7 +60,7 @@ public: ...@@ -60,7 +60,7 @@ public:
{}; {};
}; };
//////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
VLCDataObject::VLCDataObject(VLCPlugin *p_instance) : _p_instance(p_instance) VLCDataObject::VLCDataObject(VLCPlugin *p_instance) : _p_instance(p_instance)
{ {
...@@ -74,9 +74,10 @@ VLCDataObject::~VLCDataObject() ...@@ -74,9 +74,10 @@ VLCDataObject::~VLCDataObject()
_p_adviseHolder->Release(); _p_adviseHolder->Release();
}; };
//////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
STDMETHODIMP VLCDataObject::DAdvise(LPFORMATETC pFormatEtc, DWORD padvf, LPADVISESINK pAdviseSink, LPDWORD pdwConnection) STDMETHODIMP VLCDataObject::DAdvise(LPFORMATETC pFormatEtc, DWORD padvf,
LPADVISESINK pAdviseSink, LPDWORD pdwConnection)
{ {
return _p_adviseHolder->Advise(this, return _p_adviseHolder->Advise(this,
pFormatEtc, padvf,pAdviseSink, pdwConnection); pFormatEtc, padvf,pAdviseSink, pdwConnection);
...@@ -92,17 +93,19 @@ STDMETHODIMP VLCDataObject::EnumDAdvise(IEnumSTATDATA **ppenumAdvise) ...@@ -92,17 +93,19 @@ STDMETHODIMP VLCDataObject::EnumDAdvise(IEnumSTATDATA **ppenumAdvise)
return _p_adviseHolder->EnumAdvise(ppenumAdvise); return _p_adviseHolder->EnumAdvise(ppenumAdvise);
}; };
STDMETHODIMP VLCDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnum) STDMETHODIMP VLCDataObject::EnumFormatEtc(DWORD dwDirection,
IEnumFORMATETC **ppEnum)
{ {
if( NULL == ppEnum ) if( NULL == ppEnum )
return E_POINTER; return E_POINTER;
*ppEnum = dynamic_cast<IEnumFORMATETC *>(new VLCEnumFORMATETC(_v_formatEtc)); *ppEnum = new VLCEnumFORMATETC(_v_formatEtc);
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY; return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
}; };
STDMETHODIMP VLCDataObject::GetCanonicalFormatEtc(LPFORMATETC pFormatEtcIn, LPFORMATETC pFormatEtcOut) STDMETHODIMP VLCDataObject::GetCanonicalFormatEtc(LPFORMATETC pFormatEtcIn,
LPFORMATETC pFormatEtcOut)
{ {
HRESULT result = QueryGetData(pFormatEtcIn); HRESULT result = QueryGetData(pFormatEtcIn);
if( FAILED(result) ) if( FAILED(result) )
...@@ -146,7 +149,8 @@ STDMETHODIMP VLCDataObject::GetData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium) ...@@ -146,7 +149,8 @@ STDMETHODIMP VLCDataObject::GetData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium)
return result; return result;
}; };
STDMETHODIMP VLCDataObject::GetDataHere(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium) STDMETHODIMP VLCDataObject::GetDataHere(LPFORMATETC pFormatEtc,
LPSTGMEDIUM pMedium)
{ {
if( NULL == pMedium ) if( NULL == pMedium )
return E_POINTER; return E_POINTER;
...@@ -154,9 +158,10 @@ STDMETHODIMP VLCDataObject::GetDataHere(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMed ...@@ -154,9 +158,10 @@ STDMETHODIMP VLCDataObject::GetDataHere(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMed
return E_NOTIMPL; return E_NOTIMPL;
} }
//////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
HRESULT VLCDataObject::getMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium) HRESULT VLCDataObject::getMetaFileData(LPFORMATETC pFormatEtc,
LPSTGMEDIUM pMedium)
{ {
HDC hicTargetDev = CreateDevDC(pFormatEtc->ptd); HDC hicTargetDev = CreateDevDC(pFormatEtc->ptd);
if( NULL == hicTargetDev ) if( NULL == hicTargetDev )
...@@ -165,7 +170,8 @@ HRESULT VLCDataObject::getMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedi ...@@ -165,7 +170,8 @@ HRESULT VLCDataObject::getMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedi
HDC hdcMeta = CreateMetaFile(NULL); HDC hdcMeta = CreateMetaFile(NULL);
if( NULL != hdcMeta ) if( NULL != hdcMeta )
{ {
LPMETAFILEPICT pMetaFilePict = (LPMETAFILEPICT)CoTaskMemAlloc(sizeof(METAFILEPICT)); LPMETAFILEPICT pMetaFilePict =
(LPMETAFILEPICT)CoTaskMemAlloc(sizeof(METAFILEPICT));
if( NULL != pMetaFilePict ) if( NULL != pMetaFilePict )
{ {
SIZEL size = _p_instance->getExtent(); SIZEL size = _p_instance->getExtent();
...@@ -182,7 +188,8 @@ HRESULT VLCDataObject::getMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedi ...@@ -182,7 +188,8 @@ HRESULT VLCDataObject::getMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedi
RECTL bounds = { 0L, 0L, size.cx, size.cy }; RECTL bounds = { 0L, 0L, size.cx, size.cy };
_p_instance->onDraw(pFormatEtc->ptd, hicTargetDev, hdcMeta, &bounds, &wBounds); _p_instance->onDraw(pFormatEtc->ptd, hicTargetDev, hdcMeta,
&bounds, &wBounds);
pMetaFilePict->hMF = CloseMetaFile(hdcMeta); pMetaFilePict->hMF = CloseMetaFile(hdcMeta);
if( NULL != pMetaFilePict->hMF ) if( NULL != pMetaFilePict->hMF )
pMedium->hMetaFilePict = pMetaFilePict; pMedium->hMetaFilePict = pMetaFilePict;
...@@ -194,7 +201,8 @@ HRESULT VLCDataObject::getMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedi ...@@ -194,7 +201,8 @@ HRESULT VLCDataObject::getMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedi
return (NULL != pMedium->hMetaFilePict) ? S_OK : E_FAIL; return (NULL != pMedium->hMetaFilePict) ? S_OK : E_FAIL;
}; };
HRESULT VLCDataObject::getEnhMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium) HRESULT VLCDataObject::getEnhMetaFileData(LPFORMATETC pFormatEtc,
LPSTGMEDIUM pMedium)
{ {
HDC hicTargetDev = CreateDevDC(pFormatEtc->ptd); HDC hicTargetDev = CreateDevDC(pFormatEtc->ptd);
if( NULL == hicTargetDev ) if( NULL == hicTargetDev )
...@@ -211,7 +219,8 @@ HRESULT VLCDataObject::getEnhMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pM ...@@ -211,7 +219,8 @@ HRESULT VLCDataObject::getEnhMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pM
RECTL bounds = { 0L, 0L, size.cx, size.cy }; RECTL bounds = { 0L, 0L, size.cx, size.cy };
_p_instance->onDraw(pFormatEtc->ptd, hicTargetDev, hdcMeta, &bounds, &wBounds); _p_instance->onDraw(pFormatEtc->ptd, hicTargetDev,
hdcMeta, &bounds, &wBounds);
pMedium->hEnhMetaFile = CloseEnhMetaFile(hdcMeta); pMedium->hEnhMetaFile = CloseEnhMetaFile(hdcMeta);
} }
DeleteDC(hicTargetDev); DeleteDC(hicTargetDev);
...@@ -250,7 +259,8 @@ STDMETHODIMP VLCDataObject::QueryGetData(LPFORMATETC pFormatEtc) ...@@ -250,7 +259,8 @@ STDMETHODIMP VLCDataObject::QueryGetData(LPFORMATETC pFormatEtc)
return S_OK; return S_OK;
}; };
STDMETHODIMP VLCDataObject::SetData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium, BOOL fRelease) STDMETHODIMP VLCDataObject::SetData(LPFORMATETC pFormatEtc,
LPSTGMEDIUM pMedium, BOOL fRelease)
{ {
return E_NOTIMPL; return E_NOTIMPL;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment