fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dtrans / source / win32 / dtobj / XNotifyingDataObject.cxx
blob49546050dcfb865d1147b87abc1fcd0e9cf333ba
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <osl/diagnose.h>
21 #include "XNotifyingDataObject.hxx"
22 #include "../clipb/WinClipbImpl.hxx"
23 #include "../clipb/WinClipboard.hxx"
24 #include "../../inc/DtObjFactory.hxx"
26 #ifdef __MINGW32__
27 #if defined __uuidof
28 #undef __uuidof
29 #endif
30 #define __uuidof(I) IID_##I
31 #endif
33 using namespace com::sun::star::datatransfer;
34 using namespace com::sun::star::datatransfer::clipboard;
35 using com::sun::star::uno::RuntimeException;
36 using com::sun::star::uno::Reference;
38 CXNotifyingDataObject::CXNotifyingDataObject(
39 const IDataObjectPtr& aIDataObject,
40 const Reference< XTransferable >& aXTransferable,
41 const Reference< XClipboardOwner >& aXClipOwner,
42 CWinClipbImpl* theWinClipImpl ) :
43 m_nRefCnt( 0 ),
44 m_aIDataObject( aIDataObject ),
45 m_XTransferable( aXTransferable ),
46 m_XClipboardOwner( aXClipOwner ),
47 m_pWinClipImpl( theWinClipImpl )
51 STDMETHODIMP CXNotifyingDataObject::QueryInterface( REFIID iid, LPVOID* ppvObject )
53 if ( NULL == ppvObject )
54 return E_INVALIDARG;
56 HRESULT hr = E_NOINTERFACE;
58 *ppvObject = NULL;
59 if ( ( __uuidof( IUnknown ) == iid ) ||
60 ( __uuidof( IDataObject ) == iid ) )
62 *ppvObject = static_cast< IUnknown* >( this );
63 ( (LPUNKNOWN)*ppvObject )->AddRef( );
64 hr = S_OK;
67 return hr;
70 STDMETHODIMP_(ULONG) CXNotifyingDataObject::AddRef( )
72 return static_cast< ULONG >( InterlockedIncrement( &m_nRefCnt ) );
75 STDMETHODIMP_(ULONG) CXNotifyingDataObject::Release( )
77 ULONG nRefCnt =
78 static_cast< ULONG >( InterlockedDecrement( &m_nRefCnt ) );
80 if ( 0 == nRefCnt )
82 if ( m_pWinClipImpl )
83 m_pWinClipImpl->onReleaseDataObject( this );
85 delete this;
88 return nRefCnt;
91 STDMETHODIMP CXNotifyingDataObject::GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium )
93 return m_aIDataObject->GetData(pFormatetc, pmedium);
96 STDMETHODIMP CXNotifyingDataObject::EnumFormatEtc(
97 DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc )
99 return m_aIDataObject->EnumFormatEtc(dwDirection, ppenumFormatetc);
102 STDMETHODIMP CXNotifyingDataObject::QueryGetData( LPFORMATETC pFormatetc )
104 return m_aIDataObject->QueryGetData(pFormatetc);
107 STDMETHODIMP CXNotifyingDataObject::GetDataHere( LPFORMATETC lpFetc, LPSTGMEDIUM lpStgMedium )
109 return m_aIDataObject->GetDataHere(lpFetc, lpStgMedium);
112 STDMETHODIMP CXNotifyingDataObject::GetCanonicalFormatEtc( LPFORMATETC lpFetc, LPFORMATETC lpCanonicalFetc )
114 return m_aIDataObject->GetCanonicalFormatEtc(lpFetc, lpCanonicalFetc);
117 STDMETHODIMP CXNotifyingDataObject::SetData( LPFORMATETC lpFetc, LPSTGMEDIUM lpStgMedium, BOOL bRelease )
119 return m_aIDataObject->SetData( lpFetc, lpStgMedium, bRelease );
122 STDMETHODIMP CXNotifyingDataObject::DAdvise(
123 LPFORMATETC lpFetc, DWORD advf, LPADVISESINK lpAdvSink, DWORD* pdwConnection )
125 return m_aIDataObject->DAdvise( lpFetc, advf, lpAdvSink, pdwConnection );
128 STDMETHODIMP CXNotifyingDataObject::DUnadvise( DWORD dwConnection )
130 return m_aIDataObject->DUnadvise( dwConnection );
133 STDMETHODIMP CXNotifyingDataObject::EnumDAdvise( LPENUMSTATDATA * ppenumAdvise )
135 return m_aIDataObject->EnumDAdvise( ppenumAdvise );
138 CXNotifyingDataObject::operator IDataObject*( )
140 return static_cast< IDataObject* >( this );
143 void SAL_CALL CXNotifyingDataObject::lostOwnership( )
147 if (m_XClipboardOwner.is())
148 m_XClipboardOwner->lostOwnership(
149 static_cast<XClipboardEx*>(m_pWinClipImpl->m_pWinClipboard ), m_XTransferable);
151 catch(RuntimeException&)
153 OSL_FAIL( "RuntimeException caught" );
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */