diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-10-14 16:57:04 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-10-16 14:19:20 +0000 |
commit | 1f9b6013e507ee4acb9374cee909f59139d52978 (patch) | |
tree | 014cc1248815b7722cea3e20af0c09d58fe37f46 /dtrans | |
parent | 5eab3e5eec67ad97f39f792852e88003fea89d1c (diff) |
clang-cl loplugin: dtrans
Change-Id: I1d55f3e7ecbde486f318d5175b1570f0caa33255
Reviewed-on: https://gerrit.libreoffice.org/29870
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'dtrans')
47 files changed, 966 insertions, 1002 deletions
diff --git a/dtrans/Library_dnd.mk b/dtrans/Library_dnd.mk index 01fd32cc094c..9ce6c4439e05 100644 --- a/dtrans/Library_dnd.mk +++ b/dtrans/Library_dnd.mk @@ -21,6 +21,10 @@ $(eval $(call gb_Library_Library,dnd)) $(eval $(call gb_Library_set_componentfile,dnd,dtrans/util/dnd)) +$(eval $(call gb_Library_use_externals,dnd, \ + boost_headers \ +)) + $(eval $(call gb_Library_use_sdk_api,dnd)) $(eval $(call gb_Library_use_libraries,dnd,\ diff --git a/dtrans/source/generic/clipboardmanager.cxx b/dtrans/source/generic/clipboardmanager.cxx index 9c1fa0bf0b56..727724e347aa 100644 --- a/dtrans/source/generic/clipboardmanager.cxx +++ b/dtrans/source/generic/clipboardmanager.cxx @@ -147,7 +147,7 @@ void SAL_CALL ClipboardManager::dispose() ClearableMutexGuard aGuard( rBHelper.rMutex ); if (!rBHelper.bDisposed && !rBHelper.bInDispose) { - rBHelper.bInDispose = sal_True; + rBHelper.bInDispose = true; aGuard.clear(); // give everyone a chance to save his clipboard instance @@ -182,8 +182,8 @@ void SAL_CALL ClipboardManager::dispose() } } - rBHelper.bDisposed = sal_True; - rBHelper.bInDispose = sal_False; + rBHelper.bDisposed = true; + rBHelper.bInDispose = false; } } @@ -199,7 +199,7 @@ void SAL_CALL ClipboardManager::disposing( const EventObject& event ) Reference< XInterface > SAL_CALL ClipboardManager_createInstance( const Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/) { - return Reference < XInterface >( ( OWeakObject * ) new ClipboardManager()); + return Reference < XInterface >(static_cast<OWeakObject *>(new ClipboardManager())); } Sequence< OUString > SAL_CALL ClipboardManager_getSupportedServiceNames() diff --git a/dtrans/source/generic/clipboardmanager.hxx b/dtrans/source/generic/clipboardmanager.hxx index b52dae2b545a..80b179712eda 100644 --- a/dtrans/source/generic/clipboardmanager.hxx +++ b/dtrans/source/generic/clipboardmanager.hxx @@ -45,7 +45,7 @@ namespace dtrans const OUString m_aDefaultName; - virtual ~ClipboardManager(); + virtual ~ClipboardManager() override; protected: using WeakComponentImplHelperBase::disposing; public: @@ -57,27 +57,27 @@ namespace dtrans */ virtual OUString SAL_CALL getImplementationName( ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; /* * XComponent */ virtual void SAL_CALL dispose() - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; /* * XEventListener */ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; /* * XClipboardManager @@ -85,18 +85,18 @@ namespace dtrans virtual css::uno::Reference< css::datatransfer::clipboard::XClipboard > SAL_CALL getClipboard( const OUString& aName ) throw(css::container::NoSuchElementException, - css::uno::RuntimeException); + css::uno::RuntimeException) override; virtual void SAL_CALL addClipboard( const css::uno::Reference< css::datatransfer::clipboard::XClipboard >& xClipboard ) throw(css::lang::IllegalArgumentException, css::container::ElementExistException, - css::uno::RuntimeException); + css::uno::RuntimeException) override; virtual void SAL_CALL removeClipboard( const OUString& aName ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual css::uno::Sequence< OUString > SAL_CALL listClipboardNames( ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; }; diff --git a/dtrans/source/generic/dtrans.cxx b/dtrans/source/generic/dtrans.cxx index fd7c0a3ae0ed..22be8aca3c22 100644 --- a/dtrans/source/generic/dtrans.cxx +++ b/dtrans/source/generic/dtrans.cxx @@ -35,7 +35,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL dtrans_component_getFactory( void * /*pRegistryKey*/ ) { - void * pRet = 0; + void * pRet = nullptr; if (pServiceManager) { @@ -44,7 +44,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL dtrans_component_getFactory( if (rtl_str_compare( pImplName, CLIPBOARDMANAGER_IMPLEMENTATION_NAME ) == 0) { xFactory = createOneInstanceFactory( - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + static_cast< XMultiServiceFactory * >( pServiceManager ), OUString::createFromAscii( pImplName ), ClipboardManager_createInstance, ClipboardManager_getSupportedServiceNames() ); @@ -52,7 +52,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL dtrans_component_getFactory( else if (rtl_str_compare( pImplName, GENERIC_CLIPBOARD_IMPLEMENTATION_NAME ) == 0) { xFactory = createSingleFactory( - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + static_cast< XMultiServiceFactory * >( pServiceManager ), OUString::createFromAscii( pImplName ), GenericClipboard_createInstance, GenericClipboard_getSupportedServiceNames() ); diff --git a/dtrans/source/generic/generic_clipboard.cxx b/dtrans/source/generic/generic_clipboard.cxx index 13061dc3cf09..de175f24617d 100644 --- a/dtrans/source/generic/generic_clipboard.cxx +++ b/dtrans/source/generic/generic_clipboard.cxx @@ -33,7 +33,7 @@ using ::dtrans::GenericClipboard; GenericClipboard::GenericClipboard() : WeakComponentImplHelper< XClipboardEx, XClipboardNotifier, XServiceInfo, XInitialization > (m_aMutex), - m_bInitialized(sal_False) + m_bInitialized(false) { } @@ -156,7 +156,7 @@ Sequence< OUString > SAL_CALL GenericClipboard_getSupportedServiceNames() Reference< XInterface > SAL_CALL GenericClipboard_createInstance( const Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/) { - return Reference < XInterface >( ( OWeakObject * ) new GenericClipboard()); + return Reference < XInterface >(static_cast<OWeakObject *>(new GenericClipboard())); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/generic/generic_clipboard.hxx b/dtrans/source/generic/generic_clipboard.hxx index 41d7cdc6f640..c336cabef1e7 100644 --- a/dtrans/source/generic/generic_clipboard.hxx +++ b/dtrans/source/generic/generic_clipboard.hxx @@ -46,8 +46,8 @@ namespace dtrans css::uno::Reference< css::datatransfer::XTransferable > m_aContents; css::uno::Reference< css::datatransfer::clipboard::XClipboardOwner > m_aOwner; - sal_Bool m_bInitialized; - virtual ~GenericClipboard(); + bool m_bInitialized; + virtual ~GenericClipboard() override; public: @@ -58,42 +58,42 @@ namespace dtrans */ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) - throw(css::uno::Exception, css::uno::RuntimeException); + throw(css::uno::Exception, css::uno::RuntimeException) override; /* * XServiceInfo */ virtual OUString SAL_CALL getImplementationName( ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; /* * XClipboard */ virtual css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL getContents() - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual void SAL_CALL setContents( const css::uno::Reference< css::datatransfer::XTransferable >& xTrans, const css::uno::Reference< css::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual OUString SAL_CALL getName() - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; /* * XClipboardEx */ virtual sal_Int8 SAL_CALL getRenderingCapabilities() - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; /* * XClipboardNotifier @@ -101,11 +101,11 @@ namespace dtrans virtual void SAL_CALL addClipboardListener( const css::uno::Reference< css::datatransfer::clipboard::XClipboardListener >& listener ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual void SAL_CALL removeClipboardListener( const css::uno::Reference< css::datatransfer::clipboard::XClipboardListener >& listener ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; }; diff --git a/dtrans/source/win32/clipb/MtaOleClipb.cxx b/dtrans/source/win32/clipb/MtaOleClipb.cxx index 843a73d51d13..11f9c16ec0e9 100644 --- a/dtrans/source/win32/clipb/MtaOleClipb.cxx +++ b/dtrans/source/win32/clipb/MtaOleClipb.cxx @@ -75,8 +75,8 @@ namespace /* private */ const sal_uInt32 MAX_WAIT_SHUTDOWN = 10000; // msec const sal_uInt32 MAX_CLIPEVENT_PROCESSING_TIME = 5000; // msec - const sal_Bool MANUAL_RESET = sal_True; - const sal_Bool INIT_NONSIGNALED = sal_False; + const bool MANUAL_RESET = true; + const bool INIT_NONSIGNALED = false; /* Cannot use osl conditions because they are blocking without waking up on messages sent by another thread @@ -93,10 +93,10 @@ namespace /* private */ Win32Condition() { m_hEvent = CreateEvent( - 0, /* no security */ + nullptr, /* no security */ true, /* manual reset */ false, /* initial state not signaled */ - 0); /* automatic name */ + nullptr); /* automatic name */ } // dtor @@ -109,7 +109,7 @@ namespace /* private */ // leave messages sent through void wait() { - while(1) + while(true) { DWORD dwResult = MsgWaitForMultipleObjects(1, &m_hEvent, FALSE, INFINITE, QS_SENDMESSAGE); @@ -125,7 +125,7 @@ namespace /* private */ queue that's what we want, messages from the PostMessage queue stay untouched */ MSG msg; - PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE); + PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE); break; } @@ -144,8 +144,8 @@ namespace /* private */ // prevent copy/assignment private: - Win32Condition(const Win32Condition&); - Win32Condition& operator=(const Win32Condition&); + Win32Condition(const Win32Condition&) = delete; + Win32Condition& operator=(const Win32Condition&) = delete; }; // we use one condition for every request @@ -160,17 +160,17 @@ namespace /* private */ // static member initialization -CMtaOleClipboard* CMtaOleClipboard::s_theMtaOleClipboardInst = NULL; +CMtaOleClipboard* CMtaOleClipboard::s_theMtaOleClipboardInst = nullptr; // marshal an IDataObject //inline HRESULT MarshalIDataObjectInStream( IDataObject* pIDataObject, LPSTREAM* ppStream ) { - OSL_ASSERT( NULL != pIDataObject ); - OSL_ASSERT( NULL != ppStream ); + OSL_ASSERT( nullptr != pIDataObject ); + OSL_ASSERT( nullptr != ppStream ); - *ppStream = NULL; + *ppStream = nullptr; return CoMarshalInterThreadInterfaceInStream( __uuidof(IDataObject), //The IID of interface to be marshaled pIDataObject, //The interface pointer @@ -183,10 +183,10 @@ HRESULT MarshalIDataObjectInStream( IDataObject* pIDataObject, LPSTREAM* ppStrea //inline HRESULT UnmarshalIDataObjectAndReleaseStream( LPSTREAM lpStream, IDataObject** ppIDataObject ) { - OSL_ASSERT( NULL != lpStream ); - OSL_ASSERT( NULL != ppIDataObject ); + OSL_ASSERT( nullptr != lpStream ); + OSL_ASSERT( nullptr != ppIDataObject ); - *ppIDataObject = NULL; + *ppIDataObject = nullptr; return CoGetInterfaceAndReleaseStream( lpStream, __uuidof(IDataObject), @@ -208,7 +208,7 @@ public: this function calls CoInitialize for every thread it creates */ - m_hResult = CoInitialize( NULL ); + m_hResult = CoInitialize( nullptr ); if ( S_OK == m_hResult ) OSL_FAIL( \ @@ -241,42 +241,42 @@ private: // ctor CMtaOleClipboard::CMtaOleClipboard( ) : - m_hOleThread( NULL ), + m_hOleThread( nullptr ), m_uOleThreadId( 0 ), - m_hEvtThrdReady( NULL ), - m_hwndMtaOleReqWnd( NULL ), + m_hEvtThrdReady( nullptr ), + m_hwndMtaOleReqWnd( nullptr ), m_MtaOleReqWndClassAtom( 0 ), - m_hwndNextClipViewer( NULL ), - m_pfncClipViewerCallback( NULL ), + m_hwndNextClipViewer( nullptr ), + m_pfncClipViewerCallback( nullptr ), m_bRunClipboardNotifierThread( true ), m_hClipboardChangedEvent( m_hClipboardChangedNotifierEvents[0] ), m_hTerminateClipboardChangedNotifierEvent( m_hClipboardChangedNotifierEvents[1] ), m_ClipboardChangedEventCount( 0 ) { // signals that the thread was successfully setup - m_hEvtThrdReady = CreateEventA( 0, MANUAL_RESET, INIT_NONSIGNALED, NULL ); + m_hEvtThrdReady = CreateEventA( nullptr, MANUAL_RESET, INIT_NONSIGNALED, nullptr ); - OSL_ASSERT( NULL != m_hEvtThrdReady ); + OSL_ASSERT( nullptr != m_hEvtThrdReady ); s_theMtaOleClipboardInst = this; - m_hOleThread = (HANDLE)_beginthreadex( - NULL, 0, CMtaOleClipboard::oleThreadProc, this, 0, &m_uOleThreadId ); - OSL_ASSERT( NULL != m_hOleThread ); + m_hOleThread = reinterpret_cast<HANDLE>(_beginthreadex( + nullptr, 0, CMtaOleClipboard::oleThreadProc, this, 0, &m_uOleThreadId )); + OSL_ASSERT( nullptr != m_hOleThread ); // setup the clipboard changed notifier thread - m_hClipboardChangedNotifierEvents[0] = CreateEventA( 0, MANUAL_RESET, INIT_NONSIGNALED, NULL ); - OSL_ASSERT( NULL != m_hClipboardChangedNotifierEvents[0] ); + m_hClipboardChangedNotifierEvents[0] = CreateEventA( nullptr, MANUAL_RESET, INIT_NONSIGNALED, nullptr ); + OSL_ASSERT( nullptr != m_hClipboardChangedNotifierEvents[0] ); - m_hClipboardChangedNotifierEvents[1] = CreateEventA( 0, MANUAL_RESET, INIT_NONSIGNALED, NULL ); - OSL_ASSERT( NULL != m_hClipboardChangedNotifierEvents[1] ); + m_hClipboardChangedNotifierEvents[1] = CreateEventA( nullptr, MANUAL_RESET, INIT_NONSIGNALED, nullptr ); + OSL_ASSERT( nullptr != m_hClipboardChangedNotifierEvents[1] ); unsigned uThreadId; - m_hClipboardChangedNotifierThread = (HANDLE)_beginthreadex( - NULL, 0, CMtaOleClipboard::clipboardChangedNotifierThreadProc, this, 0, &uThreadId ); + m_hClipboardChangedNotifierThread = reinterpret_cast<HANDLE>(_beginthreadex( + nullptr, 0, CMtaOleClipboard::clipboardChangedNotifierThreadProc, this, 0, &uThreadId )); - OSL_ASSERT( NULL != m_hClipboardChangedNotifierThread ); + OSL_ASSERT( nullptr != m_hClipboardChangedNotifierThread ); } // dtor @@ -284,7 +284,7 @@ CMtaOleClipboard::CMtaOleClipboard( ) : CMtaOleClipboard::~CMtaOleClipboard( ) { // block calling threads out - if ( NULL != m_hEvtThrdReady ) + if ( nullptr != m_hEvtThrdReady ) ResetEvent( m_hEvtThrdReady ); // terminate the clipboard changed notifier thread @@ -297,36 +297,34 @@ CMtaOleClipboard::~CMtaOleClipboard( ) (void) dwResult; OSL_ENSURE( dwResult == WAIT_OBJECT_0, "clipboard notifier thread could not terminate" ); - if ( NULL != m_hClipboardChangedNotifierThread ) + if ( nullptr != m_hClipboardChangedNotifierThread ) CloseHandle( m_hClipboardChangedNotifierThread ); - if ( NULL != m_hClipboardChangedNotifierEvents[0] ) + if ( nullptr != m_hClipboardChangedNotifierEvents[0] ) CloseHandle( m_hClipboardChangedNotifierEvents[0] ); - if ( NULL != m_hClipboardChangedNotifierEvents[1] ) + if ( nullptr != m_hClipboardChangedNotifierEvents[1] ) CloseHandle( m_hClipboardChangedNotifierEvents[1] ); // end the thread // because DestroyWindow can only be called // from within the thread that created the window - sendMessage( MSG_SHUTDOWN, - static_cast< WPARAM >( 0 ), - static_cast< LPARAM >( 0 ) ); + sendMessage( MSG_SHUTDOWN ); // wait for thread shutdown dwResult = WaitForSingleObject( m_hOleThread, MAX_WAIT_SHUTDOWN ); OSL_ENSURE( dwResult == WAIT_OBJECT_0, "OleThread could not terminate" ); - if ( NULL != m_hOleThread ) + if ( nullptr != m_hOleThread ) CloseHandle( m_hOleThread ); - if ( NULL != m_hEvtThrdReady ) + if ( nullptr != m_hEvtThrdReady ) CloseHandle( m_hEvtThrdReady ); if ( m_MtaOleReqWndClassAtom ) - UnregisterClassA( g_szWndClsName, NULL ); + UnregisterClassA( g_szWndClsName, nullptr ); - OSL_ENSURE( ( NULL == m_pfncClipViewerCallback ) && + OSL_ENSURE( ( nullptr == m_pfncClipViewerCallback ) && !IsWindow( m_hwndNextClipViewer ), \ "Clipboard viewer not properly unregistered" ); } @@ -355,7 +353,7 @@ HRESULT CMtaOleClipboard::flushClipboard( ) HRESULT CMtaOleClipboard::getClipboard( IDataObject** ppIDataObject ) { - OSL_PRECOND( NULL != ppIDataObject, "invalid parameter" ); + OSL_PRECOND( nullptr != ppIDataObject, "invalid parameter" ); OSL_PRECOND( GetCurrentThreadId( ) != m_uOleThreadId, "getClipboard from within clipboard sta thread called" ); if ( !WaitForThreadReady( ) ) @@ -368,7 +366,7 @@ HRESULT CMtaOleClipboard::getClipboard( IDataObject** ppIDataObject ) LPSTREAM lpStream; - *ppIDataObject = NULL; + *ppIDataObject = nullptr; MsgCtx aMsgCtx; @@ -418,8 +416,7 @@ HRESULT CMtaOleClipboard::setClipboard( IDataObject* pIDataObject ) postMessage( MSG_SETCLIPBOARD, - reinterpret_cast< WPARAM >( pIDataObject ), - 0 ); + reinterpret_cast< WPARAM >( pIDataObject ) ); // because this is an asynchronous function // the return value is useless @@ -462,7 +459,7 @@ bool CMtaOleClipboard::onRegisterClipViewer( LPFNC_CLIPVIEWER_CALLBACK_t pfncCli MutexGuard aGuard( m_pfncClipViewerCallbackMutex ); // register if not yet done - if ( ( NULL != pfncClipViewerCallback ) && ( NULL == m_pfncClipViewerCallback ) ) + if ( ( nullptr != pfncClipViewerCallback ) && ( nullptr == m_pfncClipViewerCallback ) ) { // SetClipboardViewer sends a WM_DRAWCLIPBOARD message we ignore // this message if we register ourself as clip viewer @@ -472,19 +469,19 @@ bool CMtaOleClipboard::onRegisterClipViewer( LPFNC_CLIPVIEWER_CALLBACK_t pfncCli // if there is no other cb-viewer the // return value is NULL!!! - bRet = IsWindow( m_hwndNextClipViewer ) ? true : false; + bRet = IsWindow( m_hwndNextClipViewer ); // save the new callback function m_pfncClipViewerCallback = pfncClipViewerCallback; } - else if ( ( NULL == pfncClipViewerCallback ) && ( NULL != m_pfncClipViewerCallback ) ) + else if ( ( nullptr == pfncClipViewerCallback ) && ( nullptr != m_pfncClipViewerCallback ) ) { - m_pfncClipViewerCallback = NULL; + m_pfncClipViewerCallback = nullptr; // unregister if input parameter is NULL and we previously registered // as clipboard viewer ChangeClipboardChain( m_hwndMtaOleReqWnd, m_hwndNextClipViewer ); - m_hwndNextClipViewer = NULL; + m_hwndNextClipViewer = nullptr; } return bRet; @@ -497,7 +494,7 @@ LRESULT CMtaOleClipboard::onSetClipboard( IDataObject* pIDataObject ) LRESULT CMtaOleClipboard::onGetClipboard( LPSTREAM* ppStream ) { - OSL_ASSERT(NULL != ppStream); + OSL_ASSERT(nullptr != ppStream); IDataObjectPtr pIDataObject; @@ -589,7 +586,7 @@ bool CMtaOleClipboard::postMessage( UINT msg, WPARAM wParam, LPARAM lParam ) { BOOL const ret = PostMessageA(m_hwndMtaOleReqWnd, msg, wParam, lParam); SAL_WARN_IF(0 == ret, "dtrans", "ERROR: PostMessage() failed!"); - return ret ? true : false; + return ret; } // the window proc @@ -600,14 +597,14 @@ LRESULT CALLBACK CMtaOleClipboard::mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARA // get a connection to the class-instance via the static member CMtaOleClipboard* pImpl = CMtaOleClipboard::s_theMtaOleClipboardInst; - OSL_ASSERT( NULL != pImpl ); + OSL_ASSERT( nullptr != pImpl ); switch( uMsg ) { case MSG_SETCLIPBOARD: { IDataObject* pIDataObject = reinterpret_cast< IDataObject* >( wParam ); - pImpl->onSetClipboard( pIDataObject ); + CMtaOleClipboard::onSetClipboard( pIDataObject ); // in setClipboard we did acquire the // interface pointer in order to prevent @@ -626,7 +623,7 @@ LRESULT CALLBACK CMtaOleClipboard::mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARA MsgCtx* aMsgCtx = reinterpret_cast< MsgCtx* >( lParam ); OSL_ASSERT( aMsgCtx ); - aMsgCtx->hr = pImpl->onGetClipboard( reinterpret_cast< LPSTREAM* >(wParam) ); + aMsgCtx->hr = CMtaOleClipboard::onGetClipboard( reinterpret_cast< LPSTREAM* >(wParam) ); aMsgCtx->aCondition.set( ); } break; @@ -636,7 +633,7 @@ LRESULT CALLBACK CMtaOleClipboard::mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARA MsgCtx* aMsgCtx = reinterpret_cast< MsgCtx* >( lParam ); OSL_ASSERT( aMsgCtx ); - aMsgCtx->hr = pImpl->onFlushClipboard( ); + aMsgCtx->hr = CMtaOleClipboard::onFlushClipboard( ); aMsgCtx->aCondition.set( ); } break; @@ -682,7 +679,7 @@ void CMtaOleClipboard::createMtaOleReqWnd( ) WNDCLASSEXA wcex; HINSTANCE hInst = GetModuleHandleA( CLIPSRV_DLL_NAME ); - OSL_ENSURE( NULL != hInst, "The name of the clipboard service dll must have changed" ); + OSL_ENSURE( nullptr != hInst, "The name of the clipboard service dll must have changed" ); ZeroMemory( &wcex, sizeof( WNDCLASSEXA ) ); @@ -692,23 +689,23 @@ void CMtaOleClipboard::createMtaOleReqWnd( ) wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInst; - wcex.hIcon = NULL; - wcex.hCursor = NULL; - wcex.hbrBackground = NULL; - wcex.lpszMenuName = NULL; + wcex.hIcon = nullptr; + wcex.hCursor = nullptr; + wcex.hbrBackground = nullptr; + wcex.lpszMenuName = nullptr; wcex.lpszClassName = g_szWndClsName; - wcex.hIconSm = NULL; + wcex.hIconSm = nullptr; m_MtaOleReqWndClassAtom = RegisterClassExA( &wcex ); if ( 0 != m_MtaOleReqWndClassAtom ) m_hwndMtaOleReqWnd = CreateWindowA( - g_szWndClsName, NULL, 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL ); + g_szWndClsName, nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, hInst, nullptr ); } unsigned int CMtaOleClipboard::run( ) { - HRESULT hr = OleInitialize( NULL ); + HRESULT hr = OleInitialize( nullptr ); OSL_ASSERT( SUCCEEDED( hr ) ); createMtaOleReqWnd( ); @@ -717,12 +714,12 @@ unsigned int CMtaOleClipboard::run( ) if ( IsWindow( m_hwndMtaOleReqWnd ) ) { - if ( NULL != m_hEvtThrdReady ) + if ( nullptr != m_hEvtThrdReady ) SetEvent( m_hEvtThrdReady ); // pumping messages MSG msg; - while( GetMessageA( &msg, NULL, 0, 0 ) ) + while( GetMessageA( &msg, nullptr, 0, 0 ) ) DispatchMessageA( &msg ); nRet = 0; @@ -740,8 +737,8 @@ unsigned int WINAPI CMtaOleClipboard::oleThreadProc( LPVOID pParam ) osl_setThreadName("CMtaOleClipboard::run()"); CMtaOleClipboard* pInst = - reinterpret_cast<CMtaOleClipboard*>( pParam ); - OSL_ASSERT( NULL != pInst ); + static_cast<CMtaOleClipboard*>( pParam ); + OSL_ASSERT( nullptr != pInst ); return pInst->run( ); } @@ -749,10 +746,10 @@ unsigned int WINAPI CMtaOleClipboard::oleThreadProc( LPVOID pParam ) unsigned int WINAPI CMtaOleClipboard::clipboardChangedNotifierThreadProc( LPVOID pParam ) { osl_setThreadName("CMtaOleClipboard::clipboardChangedNotifierThreadProc()"); - CMtaOleClipboard* pInst = reinterpret_cast< CMtaOleClipboard* >( pParam ); - OSL_ASSERT( NULL != pInst ); + CMtaOleClipboard* pInst = static_cast< CMtaOleClipboard* >( pParam ); + OSL_ASSERT( nullptr != pInst ); - CoInitialize( NULL ); + CoInitialize( nullptr ); // assuming we don't need a lock for // a boolean variable like m_bRun... @@ -791,7 +788,7 @@ bool CMtaOleClipboard::WaitForThreadReady( ) const { bool bRet = false; - if ( NULL != m_hEvtThrdReady ) + if ( nullptr != m_hEvtThrdReady ) { DWORD dwResult = WaitForSingleObject( m_hEvtThrdReady, MAX_WAITTIME ); diff --git a/dtrans/source/win32/clipb/MtaOleClipb.hxx b/dtrans/source/win32/clipb/MtaOleClipb.hxx index a8458a1c3fec..5c7dbfa5c6f5 100644 --- a/dtrans/source/win32/clipb/MtaOleClipb.hxx +++ b/dtrans/source/win32/clipb/MtaOleClipb.hxx @@ -73,9 +73,9 @@ private: // message handler functions; remember these functions are called // from a different thread context! - LRESULT onSetClipboard( IDataObject* pIDataObject ); - LRESULT onGetClipboard( LPSTREAM* ppStream ); - LRESULT onFlushClipboard( ); + static LRESULT onSetClipboard( IDataObject* pIDataObject ); + static LRESULT onGetClipboard( LPSTREAM* ppStream ); + static LRESULT onFlushClipboard( ); bool onRegisterClipViewer( LPFNC_CLIPVIEWER_CALLBACK_t pfncClipViewerCallback ); // win32 clipboard-viewer support diff --git a/dtrans/source/win32/clipb/WinClipbImpl.cxx b/dtrans/source/win32/clipb/WinClipbImpl.cxx index f3daae02a5db..d38c30855435 100644 --- a/dtrans/source/win32/clipb/WinClipbImpl.cxx +++ b/dtrans/source/win32/clipb/WinClipbImpl.cxx @@ -48,15 +48,15 @@ using namespace com::sun::star::datatransfer::clipboard; using namespace com::sun::star::datatransfer::clipboard::RenderingCapabilities; // definition of static members -CWinClipbImpl* CWinClipbImpl::s_pCWinClipbImpl = NULL; +CWinClipbImpl* CWinClipbImpl::s_pCWinClipbImpl = nullptr; osl::Mutex CWinClipbImpl::s_aMutex; CWinClipbImpl::CWinClipbImpl( const OUString& aClipboardName, CWinClipboard* theWinClipboard ) : m_itsName( aClipboardName ), m_pWinClipboard( theWinClipboard ), - m_pCurrentClipContent( NULL ) + m_pCurrentClipContent( nullptr ) { - OSL_ASSERT( NULL != m_pWinClipboard ); + OSL_ASSERT( nullptr != m_pWinClipboard ); // necessary to reassociate from // the static callback function @@ -67,7 +67,7 @@ CWinClipbImpl::CWinClipbImpl( const OUString& aClipboardName, CWinClipboard* the CWinClipbImpl::~CWinClipbImpl( ) { ClearableMutexGuard aGuard( s_aMutex ); - s_pCWinClipbImpl = NULL; + s_pCWinClipbImpl = nullptr; aGuard.clear( ); unregisterClipboardViewer( ); @@ -79,7 +79,7 @@ Reference< XTransferable > SAL_CALL CWinClipbImpl::getContents( ) throw( Runtime // system clipboard ClearableMutexGuard aGuard( m_ClipContentMutex ); - if ( NULL != m_pCurrentClipContent ) + if ( nullptr != m_pCurrentClipContent ) { return m_pCurrentClipContent->m_XTransferable; } @@ -154,7 +154,7 @@ void SAL_CALL CWinClipbImpl::flushClipboard( ) throw( RuntimeException ) // It may be possible to move the request to the clipboard STA thread by saving the // DataObject and call OleIsCurrentClipboard bevore flushing. - if ( NULL != m_pCurrentClipContent ) + if ( nullptr != m_pCurrentClipContent ) m_MtaOleClipboard.flushClipboard( ); } @@ -165,7 +165,7 @@ void SAL_CALL CWinClipbImpl::registerClipboardViewer( ) void SAL_CALL CWinClipbImpl::unregisterClipboardViewer( ) { - m_MtaOleClipboard.registerClipViewer( NULL ); + m_MtaOleClipboard.registerClipViewer( nullptr ); } void SAL_CALL CWinClipbImpl::dispose() throw( RuntimeException ) @@ -178,13 +178,13 @@ void WINAPI CWinClipbImpl::onClipboardContentChanged() MutexGuard aGuard( s_aMutex ); // reassocition to instance through static member - if ( NULL != s_pCWinClipbImpl ) + if ( nullptr != s_pCWinClipbImpl ) s_pCWinClipbImpl->m_pWinClipboard->notifyAllClipboardListener( ); } void SAL_CALL CWinClipbImpl::onReleaseDataObject( CXNotifyingDataObject* theCaller ) { - OSL_ASSERT( NULL != theCaller ); + OSL_ASSERT( nullptr != theCaller ); if ( theCaller ) theCaller->lostOwnership( ); @@ -195,7 +195,7 @@ void SAL_CALL CWinClipbImpl::onReleaseDataObject( CXNotifyingDataObject* theCall MutexGuard aGuard( m_ClipContentMutex ); if ( m_pCurrentClipContent == theCaller ) - m_pCurrentClipContent = NULL; + m_pCurrentClipContent = nullptr; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/clipb/WinClipbImpl.hxx b/dtrans/source/win32/clipb/WinClipbImpl.hxx index 8123bf7e2862..64024db385ac 100644 --- a/dtrans/source/win32/clipb/WinClipbImpl.hxx +++ b/dtrans/source/win32/clipb/WinClipbImpl.hxx @@ -61,7 +61,7 @@ protected: // XClipboardEx - sal_Int8 SAL_CALL getRenderingCapabilities( ) throw( css::uno::RuntimeException ); + static sal_Int8 SAL_CALL getRenderingCapabilities( ) throw( css::uno::RuntimeException ); // XFlushableClipboard diff --git a/dtrans/source/win32/clipb/WinClipboard.cxx b/dtrans/source/win32/clipb/WinClipboard.cxx index ef383e3fe42f..1e960d4783fc 100644 --- a/dtrans/source/win32/clipb/WinClipboard.cxx +++ b/dtrans/source/win32/clipb/WinClipboard.cxx @@ -69,7 +69,7 @@ Reference< XTransferable > SAL_CALL CWinClipboard::getContents( ) throw( Runtime throw DisposedException("object is already disposed", static_cast< XClipboardEx* >( this ) ); - if ( NULL != m_pImpl.get( ) ) + if ( nullptr != m_pImpl.get( ) ) return m_pImpl->getContents( ); return Reference< XTransferable >( ); @@ -85,7 +85,7 @@ void SAL_CALL CWinClipboard::setContents( const Reference< XTransferable >& xTra throw DisposedException("object is already disposed", static_cast< XClipboardEx* >( this ) ); - if ( NULL != m_pImpl.get( ) ) + if ( nullptr != m_pImpl.get( ) ) m_pImpl->setContents( xTransferable, xClipboardOwner ); } @@ -95,7 +95,7 @@ OUString SAL_CALL CWinClipboard::getName( ) throw( RuntimeException ) throw DisposedException("object is already disposed", static_cast< XClipboardEx* >( this ) ); - if ( NULL != m_pImpl.get( ) ) + if ( nullptr != m_pImpl.get( ) ) return m_pImpl->getName( ); return OUString(""); @@ -111,7 +111,7 @@ void SAL_CALL CWinClipboard::flushClipboard( ) throw( RuntimeException ) throw DisposedException("object is already disposed", static_cast< XClipboardEx* >( this ) ); - if ( NULL != m_pImpl.get( ) ) + if ( nullptr != m_pImpl.get( ) ) m_pImpl->flushClipboard( ); } @@ -123,8 +123,8 @@ sal_Int8 SAL_CALL CWinClipboard::getRenderingCapabilities( ) throw( RuntimeExce throw DisposedException("object is already disposed", static_cast< XClipboardEx* >( this ) ); - if ( NULL != m_pImpl.get( ) ) - return m_pImpl->getRenderingCapabilities( ); + if ( nullptr != m_pImpl.get( ) ) + return CWinClipbImpl::getRenderingCapabilities( ); return 0; } diff --git a/dtrans/source/win32/clipb/WinClipboard.hxx b/dtrans/source/win32/clipb/WinClipboard.hxx index f5ba95f89fa1..b85a03e008b8 100644 --- a/dtrans/source/win32/clipb/WinClipboard.hxx +++ b/dtrans/source/win32/clipb/WinClipboard.hxx @@ -72,49 +72,49 @@ public: // XClipboard virtual css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL getContents( ) - throw( css::uno::RuntimeException ); + throw( css::uno::RuntimeException ) override; virtual void SAL_CALL setContents( const css::uno::Reference< css::datatransfer::XTransferable >& xTransferable, const css::uno::Reference< css::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) - throw( css::uno::RuntimeException ); + throw( css::uno::RuntimeException ) override; virtual OUString SAL_CALL getName( ) - throw( css::uno::RuntimeException ); + throw( css::uno::RuntimeException ) override; // XFlushableClipboard - virtual void SAL_CALL flushClipboard( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL flushClipboard( ) throw( css::uno::RuntimeException ) override; // XClipboardEx - virtual sal_Int8 SAL_CALL getRenderingCapabilities( ) throw( css::uno::RuntimeException ); + virtual sal_Int8 SAL_CALL getRenderingCapabilities( ) throw( css::uno::RuntimeException ) override; // XClipboardNotifier virtual void SAL_CALL addClipboardListener( const css::uno::Reference< css::datatransfer::clipboard::XClipboardListener >& listener ) - throw( css::uno::RuntimeException ); + throw( css::uno::RuntimeException ) override; virtual void SAL_CALL removeClipboardListener( const css::uno::Reference< css::datatransfer::clipboard::XClipboardListener >& listener ) - throw( css::uno::RuntimeException ); + throw( css::uno::RuntimeException ) override; // overwrite base class method, which is called // by base class dispose function - virtual void SAL_CALL disposing(); + virtual void SAL_CALL disposing() override; // XServiceInfo virtual OUString SAL_CALL getImplementationName( ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; private: void SAL_CALL notifyAllClipboardListener( ); diff --git a/dtrans/source/win32/clipb/wcbentry.cxx b/dtrans/source/win32/clipb/wcbentry.cxx index c5c00ef99cf4..60e506111485 100644 --- a/dtrans/source/win32/clipb/wcbentry.cxx +++ b/dtrans/source/win32/clipb/wcbentry.cxx @@ -54,7 +54,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL sysdtrans_component_getFactory( const sal_Char* pImplName, void* pSrvManager, void* /*pRegistryKey*/ ) { - void* pRet = 0; + void* pRet = nullptr; if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, WINCLIPBOARD_IMPL_NAME ) ) ) { @@ -62,7 +62,7 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL sysdtrans_component_getFactory( const sal_Ch //OUString( FPS_IMPL_NAME ) Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory( - reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), + static_cast< XMultiServiceFactory* > ( pSrvManager ), OUString::createFromAscii( pImplName ), createInstance, aSNS ) ); diff --git a/dtrans/source/win32/dnd/dndentry.cxx b/dtrans/source/win32/dnd/dndentry.cxx index 79aa8cc08324..170fe5388375 100644 --- a/dtrans/source/win32/dnd/dndentry.cxx +++ b/dtrans/source/win32/dnd/dndentry.cxx @@ -48,7 +48,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL dnd_component_getFactory( const sal_Char* pImplName, void* pSrvManager, void* /*pRegistryKey*/ ) { - void* pRet = 0; + void* pRet = nullptr; Reference< XSingleServiceFactory > xFactory; if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, DNDSOURCE_IMPL_NAME ) ) ) @@ -56,7 +56,7 @@ dnd_component_getFactory( const sal_Char* pImplName, void* pSrvManager, void* /* Sequence< OUString > aSNS { DNDSOURCE_SERVICE_NAME }; xFactory= createSingleFactory( - reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), + static_cast< XMultiServiceFactory* > ( pSrvManager ), OUString::createFromAscii( pImplName ), createDragSource, aSNS); @@ -67,7 +67,7 @@ dnd_component_getFactory( const sal_Char* pImplName, void* pSrvManager, void* /* Sequence< OUString > aSNS { DNDTARGET_SERVICE_NAME }; xFactory= createSingleFactory( - reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), + static_cast< XMultiServiceFactory* > ( pSrvManager ), OUString::createFromAscii( pImplName ), createDropTarget, aSNS); diff --git a/dtrans/source/win32/dnd/idroptarget.cxx b/dtrans/source/win32/dnd/idroptarget.cxx index 0edc50ab4b04..1686baf0d718 100644 --- a/dtrans/source/win32/dnd/idroptarget.cxx +++ b/dtrans/source/win32/dnd/idroptarget.cxx @@ -40,7 +40,7 @@ HRESULT STDMETHODCALLTYPE IDropTargetImpl::QueryInterface( REFIID riid, void ** { if( !ppvObject) return E_POINTER; - *ppvObject= NULL; + *ppvObject= nullptr; if( riid == __uuidof( IUnknown)) *ppvObject= static_cast<IUnknown*>( this); diff --git a/dtrans/source/win32/dnd/idroptarget.hxx b/dtrans/source/win32/dnd/idroptarget.hxx index c7843a3de951..a86739f87cdd 100644 --- a/dtrans/source/win32/dnd/idroptarget.hxx +++ b/dtrans/source/win32/dnd/idroptarget.hxx @@ -36,30 +36,30 @@ public: // IDropTarget virtual HRESULT STDMETHODCALLTYPE QueryInterface( /* [in] */ REFIID riid, - /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) override; - virtual ULONG STDMETHODCALLTYPE AddRef( ); + virtual ULONG STDMETHODCALLTYPE AddRef( ) override; - virtual ULONG STDMETHODCALLTYPE Release( ); + virtual ULONG STDMETHODCALLTYPE Release( ) override; virtual HRESULT STDMETHODCALLTYPE DragEnter( /* [unique][in] */ IDataObject __RPC_FAR *pDataObj, /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, - /* [out][in] */ DWORD __RPC_FAR *pdwEffect); + /* [out][in] */ DWORD __RPC_FAR *pdwEffect) override; virtual HRESULT STDMETHODCALLTYPE DragOver( /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, - /* [out][in] */ DWORD __RPC_FAR *pdwEffect); + /* [out][in] */ DWORD __RPC_FAR *pdwEffect) override; - virtual HRESULT STDMETHODCALLTYPE DragLeave( ) ; + virtual HRESULT STDMETHODCALLTYPE DragLeave( ) override; virtual HRESULT STDMETHODCALLTYPE Drop( /* [unique][in] */ IDataObject __RPC_FAR *pDataObj, /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, - /* [out][in] */ DWORD __RPC_FAR *pdwEffect); + /* [out][in] */ DWORD __RPC_FAR *pdwEffect) override; }; #endif diff --git a/dtrans/source/win32/dnd/source.cxx b/dtrans/source/win32/dnd/source.cxx index fb5e6c0830fc..7bf94f8b8000 100644 --- a/dtrans/source/win32/dnd/source.cxx +++ b/dtrans/source/win32/dnd/source.cxx @@ -22,6 +22,8 @@ #include <com/sun/star/awt/MouseButton.hpp> #include <com/sun/star/awt/MouseEvent.hpp> #include <cppuhelper/supportsservice.hxx> +#include <o3tl/any.hxx> + #include <process.h> #include <memory> @@ -59,7 +61,7 @@ DragSource::DragSource( const Reference<XComponentContext>& rxContext): WeakComponentImplHelper< XDragSource, XInitialization, XServiceInfo >(m_mutex), m_xContext( rxContext ), // m_pcurrentContext_impl(0), - m_hAppWindow(0), + m_hAppWindow(nullptr), m_MouseButton(0), m_RunningDndOperationCount(0) { @@ -104,7 +106,7 @@ void DragSource::StartDragImpl( // while this function executes). The source context is also used // in DragSource::QueryContinueDrag. m_currentContext= static_cast<XDragSourceContext*>( new SourceContext( - static_cast<DragSource*>(this), listener ) ); + this, listener ) ); // Convert the XTransferable data object into an IDataObject object; @@ -128,7 +130,7 @@ void DragSource::StartDragImpl( // Hopefully this instance is not destroyed before the thread has terminated. unsigned threadId; HANDLE hThread= reinterpret_cast<HANDLE>(_beginthreadex( - 0, 0, DndOleSTAFunc, reinterpret_cast<void*>(this), 0, &threadId)); + nullptr, 0, DndOleSTAFunc, this, 0, &threadId)); // detach from thread CloseHandle(hThread); @@ -140,7 +142,7 @@ void SAL_CALL DragSource::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException) { if( aArguments.getLength() >=2) - m_hAppWindow= *(HWND*)aArguments[1].getValue(); + m_hAppWindow= reinterpret_cast<HWND>(static_cast<sal_uIntPtr>(*o3tl::doAccess<sal_uInt64>(aArguments[1]))); OSL_ASSERT( IsWindow( m_hAppWindow) ); } @@ -148,7 +150,7 @@ void SAL_CALL DragSource::initialize( const Sequence< Any >& aArguments ) sal_Bool SAL_CALL DragSource::isDragImageSupported( ) throw(RuntimeException) { - return 0; + return false; } sal_Int32 SAL_CALL DragSource::getDefaultCursor( sal_Int8 /*dragAction*/ ) @@ -201,7 +203,7 @@ HRESULT STDMETHODCALLTYPE DragSource::QueryInterface( REFIID riid, void **ppvOb { if( !ppvObject) return E_POINTER; - *ppvObject= NULL; + *ppvObject= nullptr; if( riid == __uuidof( IUnknown) ) *ppvObject= static_cast<IUnknown*>( this); @@ -314,17 +316,17 @@ unsigned __stdcall DndOleSTAFunc(LPVOID pParams) osl_setThreadName("DragSource DndOleSTAFunc"); // The structure contains all arguments for DoDragDrop and other - DragSource *pSource= (DragSource*)pParams; + DragSource *pSource= static_cast<DragSource*>(pParams); // Drag and drop only works in a thread in which OleInitialize is called. - HRESULT hr= OleInitialize( NULL); + HRESULT hr= OleInitialize( nullptr); if(SUCCEEDED(hr)) { // We force the creation of a thread message queue. This is necessary // for a later call to AttachThreadInput MSG msgtemp; - PeekMessage( &msgtemp, NULL, WM_USER, WM_USER, PM_NOREMOVE); + PeekMessage( &msgtemp, nullptr, WM_USER, WM_USER, PM_NOREMOVE); DWORD threadId= GetCurrentThreadId(); @@ -356,12 +358,12 @@ unsigned __stdcall DndOleSTAFunc(LPVOID pParams) sal_Int8 action= hr == DRAGDROP_S_DROP ? dndOleDropEffectsToActions( dwEffect) : ACTION_NONE; static_cast<SourceContext*>(pSource->m_currentContext.get())->fire_dragDropEnd( - hr == DRAGDROP_S_DROP ? sal_True : sal_False, action); + hr == DRAGDROP_S_DROP, action); // Destroy SourceContextslkfgj - pSource->m_currentContext= 0; + pSource->m_currentContext= nullptr; // Destroy the XTransferable wrapper - pSource->m_spDataObject=0; + pSource->m_spDataObject=nullptr; OleUninitialize(); } diff --git a/dtrans/source/win32/dnd/source.hxx b/dtrans/source/win32/dnd/source.hxx index 61f21ebdcfde..15a06f9f62ea 100644 --- a/dtrans/source/win32/dnd/source.hxx +++ b/dtrans/source/win32/dnd/source.hxx @@ -84,46 +84,46 @@ public: public: explicit DragSource(const Reference<XComponentContext>& rxContext); - virtual ~DragSource(); + virtual ~DragSource() override; DragSource(const DragSource&) = delete; DragSource &operator= ( const DragSource&) = delete; // XInitialization virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) - throw(Exception, RuntimeException); + throw(Exception, RuntimeException) override; // XDragSource - virtual sal_Bool SAL_CALL isDragImageSupported( ) throw(RuntimeException); + virtual sal_Bool SAL_CALL isDragImageSupported( ) throw(RuntimeException) override; virtual sal_Int32 SAL_CALL getDefaultCursor( sal_Int8 dragAction ) - throw( IllegalArgumentException, RuntimeException); + throw( IllegalArgumentException, RuntimeException) override; virtual void SAL_CALL startDrag( const DragGestureEvent& trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, const Reference<XTransferable >& trans, const Reference<XDragSourceListener >& listener ) - throw( RuntimeException); + throw( RuntimeException) override; // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException); - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); + virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException) override; + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException) override; virtual HRESULT STDMETHODCALLTYPE QueryInterface( /* [in] */ REFIID riid, - /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) override; - virtual ULONG STDMETHODCALLTYPE AddRef( ); + virtual ULONG STDMETHODCALLTYPE AddRef( ) override; - virtual ULONG STDMETHODCALLTYPE Release( ); + virtual ULONG STDMETHODCALLTYPE Release( ) override; // IDropSource virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag( /* [in] */ BOOL fEscapePressed, - /* [in] */ DWORD grfKeyState); + /* [in] */ DWORD grfKeyState) override; virtual HRESULT STDMETHODCALLTYPE GiveFeedback( - /* [in] */ DWORD dwEffect); + /* [in] */ DWORD dwEffect) override; }; diff --git a/dtrans/source/win32/dnd/sourcecontext.cxx b/dtrans/source/win32/dnd/sourcecontext.cxx index 84e54da21cfc..3408c2913359 100644 --- a/dtrans/source/win32/dnd/sourcecontext.cxx +++ b/dtrans/source/win32/dnd/sourcecontext.cxx @@ -75,20 +75,20 @@ void SAL_CALL SourceContext::transferablesFlavorsChanged( ) // non -interface functions // Fires XDragSourceListener::dragDropEnd events. -void SourceContext::fire_dragDropEnd( sal_Bool success, sal_Int8 effect) +void SourceContext::fire_dragDropEnd( bool success, sal_Int8 effect) { DragSourceDropEvent e; - if( success == sal_True) + if( success ) { e.DropAction= effect; - e.DropSuccess= sal_True; + e.DropSuccess= true; } else { e.DropAction= ACTION_NONE; - e.DropSuccess= sal_False; + e.DropSuccess= false; } e.DragSource= m_dragSource; e.DragSourceContext= static_cast<XDragSourceContext*>( this); diff --git a/dtrans/source/win32/dnd/sourcecontext.hxx b/dtrans/source/win32/dnd/sourcecontext.hxx index 9f1788b22e56..b70a0cec8ead 100644 --- a/dtrans/source/win32/dnd/sourcecontext.hxx +++ b/dtrans/source/win32/dnd/sourcecontext.hxx @@ -46,7 +46,7 @@ class SourceContext: public MutexDummy, public: SourceContext( DragSource* pSource, const Reference<XDragSourceListener>& listener); - ~SourceContext(); + ~SourceContext() override; SourceContext(const SourceContext&) = delete; SourceContext &operator= (const SourceContext&) = delete; @@ -55,16 +55,16 @@ public: virtual void SAL_CALL removeDragSourceListener( const Reference<XDragSourceListener >& dsl ) throw( RuntimeException); virtual sal_Int32 SAL_CALL getCurrentCursor( ) - throw( RuntimeException); + throw( RuntimeException) override; virtual void SAL_CALL setCursor( sal_Int32 cursorId ) - throw( RuntimeException); + throw( RuntimeException) override; virtual void SAL_CALL setImage( sal_Int32 imageId ) - throw( RuntimeException); + throw( RuntimeException) override; virtual void SAL_CALL transferablesFlavorsChanged( ) - throw( RuntimeException); + throw( RuntimeException) override; // non - interface functions - void fire_dragDropEnd( sal_Bool success, sal_Int8 byte); + void fire_dragDropEnd( bool success, sal_Int8 byte); void fire_dropActionChanged( sal_Int8 dropAction, sal_Int8 userAction); }; diff --git a/dtrans/source/win32/dnd/target.cxx b/dtrans/source/win32/dnd/target.cxx index ba76771a484f..5f2dea68d5a1 100644 --- a/dtrans/source/win32/dnd/target.cxx +++ b/dtrans/source/win32/dnd/target.cxx @@ -20,6 +20,8 @@ #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> #include <com/sun/star/datatransfer/XTransferable.hpp> #include <cppuhelper/supportsservice.hxx> +#include <o3tl/any.hxx> + #include <stdio.h> #include "target.hxx" #include "idroptarget.hxx" @@ -45,14 +47,14 @@ DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams); DropTarget::DropTarget( const Reference<XComponentContext>& rxContext): WeakComponentImplHelper<XInitialization,XDropTarget, XServiceInfo>(m_mutex), - m_hWnd( NULL), + m_hWnd( nullptr), m_threadIdWindow(0), m_threadIdTarget(0), - m_hOleThread(0), + m_hOleThread(nullptr), m_oleThreadId( 0), - m_pDropTarget( NULL), + m_pDropTarget( nullptr), m_xContext( rxContext ), - m_bActive(sal_True), + m_bActive(true), m_nDefaultActions(ACTION_COPY|ACTION_MOVE|ACTION_LINK|ACTION_DEFAULT), m_nCurrentDropAction( ACTION_NONE), m_nLastDropAction(0), @@ -75,7 +77,7 @@ void SAL_CALL DropTarget::disposing() if( m_threadIdTarget) { // Call RevokeDragDrop and wait for the OLE thread to die; - PostThreadMessage( m_threadIdTarget, WM_REVOKEDRAGDROP, (WPARAM)this, 0); + PostThreadMessage( m_threadIdTarget, WM_REVOKEDRAGDROP, reinterpret_cast<WPARAM>(this), 0); WaitForSingleObject( m_hOleThread, INFINITE); CloseHandle( m_hOleThread); //OSL_ENSURE( SUCCEEDED( hr), "HWND not valid!" ); @@ -83,7 +85,7 @@ void SAL_CALL DropTarget::disposing() else { RevokeDragDrop( m_hWnd); - m_hWnd= 0; + m_hWnd= nullptr; } if( m_pDropTarget) { @@ -122,33 +124,33 @@ void SAL_CALL DropTarget::initialize( const Sequence< Any >& aArguments ) if( aArguments.getLength() > 0) { // Get the window handle from aArgument. It is needed for RegisterDragDrop. - m_hWnd= *(HWND*)aArguments[0].getValue(); + m_hWnd= reinterpret_cast<HWND>(static_cast<sal_uIntPtr>(*o3tl::doAccess<sal_uInt64>(aArguments[0]))); OSL_ASSERT( IsWindow( m_hWnd) ); // Obtain the id of the thread that created the window - m_threadIdWindow= GetWindowThreadProcessId( m_hWnd, NULL); + m_threadIdWindow= GetWindowThreadProcessId( m_hWnd, nullptr); - HRESULT hr= OleInitialize( NULL); + HRESULT hr= OleInitialize( nullptr); // Current thread is MTA or Current thread and Window thread are not identical if( hr == RPC_E_CHANGED_MODE || GetCurrentThreadId() != m_threadIdWindow ) { OSL_ENSURE( ! m_threadIdTarget,"initialize was called twice"); // create the IDropTargetImplementation - m_pDropTarget= new IDropTargetImpl( *static_cast<DropTarget*>( this) ); + m_pDropTarget= new IDropTargetImpl( *this ); m_pDropTarget->AddRef(); // Obtain the id of the thread that created the window - m_threadIdWindow= GetWindowThreadProcessId( m_hWnd, NULL); + m_threadIdWindow= GetWindowThreadProcessId( m_hWnd, nullptr); // The event is set by the thread that we will create momentarily. // It indicates that the thread is ready to receive messages. - HANDLE m_evtThreadReady= CreateEvent( NULL, FALSE, FALSE, NULL); + HANDLE m_evtThreadReady= CreateEvent( nullptr, FALSE, FALSE, nullptr); - m_hOleThread= CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)DndTargetOleSTAFunc, + m_hOleThread= CreateThread( nullptr, 0, DndTargetOleSTAFunc, &m_evtThreadReady, 0, &m_threadIdTarget); WaitForSingleObject( m_evtThreadReady, INFINITE); CloseHandle( m_evtThreadReady); - PostThreadMessage( m_threadIdTarget, WM_REGISTERDRAGDROP, (WPARAM)static_cast<DropTarget*>(this), 0); + PostThreadMessage( m_threadIdTarget, WM_REGISTERDRAGDROP, reinterpret_cast<WPARAM>(this), 0); } else if( hr == S_OK || hr == S_FALSE) { @@ -164,7 +166,7 @@ void SAL_CALL DropTarget::initialize( const Sequence< Any >& aArguments ) // Get the window handle from aArgument. It is needed for RegisterDragDrop. // create the IDropTargetImplementation - m_pDropTarget= new IDropTargetImpl( *static_cast<DropTarget*>( this) ); + m_pDropTarget= new IDropTargetImpl( *this ); m_pDropTarget->AddRef(); // CoLockObjectExternal is prescribed by the protocol. It bumps up the ref count if( SUCCEEDED( CoLockObjectExternal( m_pDropTarget, TRUE, FALSE))) @@ -175,7 +177,7 @@ void SAL_CALL DropTarget::initialize( const Sequence< Any >& aArguments ) CoLockObjectExternal( m_pDropTarget, FALSE, FALSE); m_pDropTarget->Release(); m_pDropTarget = nullptr; - m_hWnd= NULL; + m_hWnd= nullptr; } } } @@ -192,25 +194,25 @@ DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams) { osl_setThreadName("DropTarget DndTargetOleSTAFunc"); - HRESULT hr= OleInitialize( NULL); + HRESULT hr= OleInitialize( nullptr); if( SUCCEEDED( hr) ) { MSG msg; // force the creation of a message queue - PeekMessage( &msg, (HWND)NULL, 0, 0, PM_NOREMOVE); + PeekMessage( &msg, nullptr, 0, 0, PM_NOREMOVE); // Signal the creator ( DropTarget::initialize) that the thread is // ready to receive messages. - SetEvent( *(HANDLE*) pParams); + SetEvent( *static_cast<HANDLE*>(pParams)); // Thread id is needed for attaching this message queue to the one of the // thread where the window was created. DWORD threadId= GetCurrentThreadId(); // We force the creation of a thread message queue. This is necessary // for a later call to AttachThreadInput - while( GetMessage(&msg, (HWND)NULL, 0, 0) ) + while( GetMessage(&msg, nullptr, 0, 0) ) { if( msg.message == WM_REGISTERDRAGDROP) { - DropTarget *pTarget= (DropTarget*)msg.wParam; + DropTarget *pTarget= reinterpret_cast<DropTarget*>(msg.wParam); // This thread is attached to the thread that created the window. Hence // this thread also receives all mouse and keyboard messages which are // needed @@ -224,17 +226,17 @@ DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams) CoLockObjectExternal( pTarget->m_pDropTarget, FALSE, FALSE); pTarget->m_pDropTarget->Release(); pTarget->m_pDropTarget = nullptr; - pTarget->m_hWnd= NULL; + pTarget->m_hWnd= nullptr; } } } else if( msg.message == WM_REVOKEDRAGDROP) { - DropTarget *pTarget= (DropTarget*)msg.wParam; + DropTarget *pTarget= reinterpret_cast<DropTarget*>(msg.wParam); RevokeDragDrop( pTarget-> m_hWnd); // Detach this thread from the window thread AttachThreadInput( threadId, pTarget->m_threadIdWindow, FALSE); - pTarget->m_hWnd= 0; + pTarget->m_hWnd= nullptr; break; } TranslateMessage( &msg); @@ -315,7 +317,7 @@ HRESULT DropTarget::DragEnter( IDataObject *pDataObj, m_nLastDropAction= ACTION_DEFAULT | ACTION_MOVE; m_currentDragContext= static_cast<XDropTargetDragContext*>( new TargetDragContext( - static_cast<DropTarget*>(this) ) ); + this ) ); //--> TRA @@ -423,9 +425,9 @@ HRESULT DropTarget::DragLeave() if( m_bActive) { - m_currentData=0; - m_currentDragContext= 0; - m_currentDropContext= 0; + m_currentData=nullptr; + m_currentDragContext= nullptr; + m_currentDropContext= nullptr; m_nLastDropAction= 0; if( m_nDefaultActions != ACTION_NONE) @@ -450,10 +452,10 @@ HRESULT DropTarget::Drop( IDataObject * /*pDataObj*/, if( m_bActive) { - m_bDropComplete= sal_False; + m_bDropComplete= false; m_nCurrentDropAction= getFilteredActions( grfKeyState, *pdwEffect); - m_currentDropContext= static_cast<XDropTargetDropContext*>( new TargetDropContext( static_cast<DropTarget*>(this )) ); + m_currentDropContext= static_cast<XDropTargetDropContext*>( new TargetDropContext( this ) ); if( m_nCurrentDropAction) { DropTargetDropEvent e; @@ -469,7 +471,7 @@ HRESULT DropTarget::Drop( IDataObject * /*pDataObj*/, fire_drop( e); //if fire_drop returns than a listener might have modified m_nCurrentDropAction - if( m_bDropComplete == sal_True) + if( m_bDropComplete ) { sal_Int8 allowedActions= dndOleDropEffectsToActions( *pdwEffect); *pdwEffect= dndActionsToSingleDropEffect( m_nCurrentDropAction & allowedActions); @@ -480,9 +482,9 @@ HRESULT DropTarget::Drop( IDataObject * /*pDataObj*/, else *pdwEffect= DROPEFFECT_NONE; - m_currentData= 0; - m_currentDragContext= 0; - m_currentDropContext= 0; + m_currentData= nullptr; + m_currentDragContext= nullptr; + m_currentDropContext= nullptr; m_nLastDropAction= 0; } return S_OK; @@ -586,7 +588,7 @@ void DropTarget::_rejectDrop( const Reference<XDropTargetDropContext>& context) } } -void DropTarget::_dropComplete(sal_Bool success, const Reference<XDropTargetDropContext>& context) +void DropTarget::_dropComplete(bool success, const Reference<XDropTargetDropContext>& context) { if(context == m_currentDropContext) { diff --git a/dtrans/source/win32/dnd/target.hxx b/dtrans/source/win32/dnd/target.hxx index 47ff87ce6fb9..ada9301a04f1 100644 --- a/dtrans/source/win32/dnd/target.hxx +++ b/dtrans/source/win32/dnd/target.hxx @@ -87,7 +87,7 @@ private: Reference<XComponentContext> m_xContext; // If m_bActive == sal_True then events are fired to XDropTargetListener s, // none otherwise. The default value is sal_True. - sal_Bool m_bActive; + bool m_bActive; sal_Int8 m_nDefaultActions; // This value is set when a XDropTargetListener calls accept or reject on @@ -102,39 +102,39 @@ private: // action has changed (dropActionChanged) // sal_Int8 m_userAction; // Set by listeners when they call XDropTargetDropContext::dropComplete - sal_Bool m_bDropComplete; + bool m_bDropComplete; Reference<XDropTargetDragContext> m_currentDragContext; Reference<XDropTargetDropContext> m_currentDropContext; public: explicit DropTarget(const Reference<XComponentContext>& rxContext); - virtual ~DropTarget(); + virtual ~DropTarget() override; DropTarget(DropTarget&) = delete; DropTarget &operator= (DropTarget&) = delete; // Overrides WeakComponentImplHelper::disposing which is called by // WeakComponentImplHelper::dispose // Must be called. - virtual void SAL_CALL disposing(); + virtual void SAL_CALL disposing() override; // XInitialization virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) - throw(Exception, RuntimeException); + throw(Exception, RuntimeException) override; // XDropTarget virtual void SAL_CALL addDropTargetListener( const Reference< XDropTargetListener >& dtl ) - throw(RuntimeException); + throw(RuntimeException) override; virtual void SAL_CALL removeDropTargetListener( const Reference< XDropTargetListener >& dtl ) - throw(RuntimeException); + throw(RuntimeException) override; // Default is not active - virtual sal_Bool SAL_CALL isActive( ) throw(RuntimeException); - virtual void SAL_CALL setActive( sal_Bool isActive ) throw(RuntimeException); - virtual sal_Int8 SAL_CALL getDefaultActions( ) throw(RuntimeException); - virtual void SAL_CALL setDefaultActions( sal_Int8 actions ) throw(RuntimeException); + virtual sal_Bool SAL_CALL isActive( ) throw(RuntimeException) override; + virtual void SAL_CALL setActive( sal_Bool isActive ) throw(RuntimeException) override; + virtual sal_Int8 SAL_CALL getDefaultActions( ) throw(RuntimeException) override; + virtual void SAL_CALL setDefaultActions( sal_Int8 actions ) throw(RuntimeException) override; // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException); - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); + virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException) override; + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException) override; // Functions called from the IDropTarget implementation ( m_pDropTarget) virtual HRESULT DragEnter( @@ -161,7 +161,7 @@ public: void _acceptDrop( sal_Int8 dropOperation, const Reference<XDropTargetDropContext>& context); void _rejectDrop( const Reference<XDropTargetDropContext>& context); - void _dropComplete( sal_Bool success, const Reference<XDropTargetDropContext>& context); + void _dropComplete( bool success, const Reference<XDropTargetDropContext>& context); // XDropTargetDragContext delegated from DragContext void _acceptDrag( sal_Int8 dragOperation, const Reference<XDropTargetDragContext>& context); diff --git a/dtrans/source/win32/dnd/targetdragcontext.hxx b/dtrans/source/win32/dnd/targetdragcontext.hxx index 3d061b4e866a..00c3d40d2382 100644 --- a/dtrans/source/win32/dnd/targetdragcontext.hxx +++ b/dtrans/source/win32/dnd/targetdragcontext.hxx @@ -39,14 +39,14 @@ class TargetDragContext: public WeakImplHelper<XDropTargetDragContext> public: explicit TargetDragContext(DropTarget* pTarget); - ~TargetDragContext(); + ~TargetDragContext() override; TargetDragContext( const TargetDragContext&) = delete; TargetDragContext &operator= ( const TargetDragContext&) = delete; virtual void SAL_CALL acceptDrag( sal_Int8 dragOperation ) - throw( RuntimeException); + throw( RuntimeException) override; virtual void SAL_CALL rejectDrag( ) - throw( RuntimeException); + throw( RuntimeException) override; }; #endif diff --git a/dtrans/source/win32/dnd/targetdropcontext.hxx b/dtrans/source/win32/dnd/targetdropcontext.hxx index ec2e5b20e1d6..f240e6897fbb 100644 --- a/dtrans/source/win32/dnd/targetdropcontext.hxx +++ b/dtrans/source/win32/dnd/targetdropcontext.hxx @@ -38,19 +38,19 @@ class TargetDropContext: public WeakImplHelper<XDropTargetDropContext> public: explicit TargetDropContext(DropTarget* pTarget); - ~TargetDropContext(); + ~TargetDropContext() override; TargetDropContext( const TargetDropContext&) = delete; TargetDropContext &operator= ( const TargetDropContext&) = delete; // XDropTargetDragContext virtual void SAL_CALL acceptDrop( sal_Int8 dropOperation ) - throw( RuntimeException); + throw( RuntimeException) override; virtual void SAL_CALL rejectDrop( ) - throw( RuntimeException); + throw( RuntimeException) override; // XDropTargetDropContext (inherits XDropTargetDragContext) virtual void SAL_CALL dropComplete( sal_Bool success ) - throw( RuntimeException); + throw( RuntimeException) override; }; #endif diff --git a/dtrans/source/win32/dtobj/APNDataObject.cxx b/dtrans/source/win32/dtobj/APNDataObject.cxx index d0ecbefde3a8..62d59007afea 100644 --- a/dtrans/source/win32/dtobj/APNDataObject.cxx +++ b/dtrans/source/win32/dtobj/APNDataObject.cxx @@ -35,7 +35,7 @@ CAPNDataObject::CAPNDataObject( IDataObjectPtr rIDataObject ) : m_rIDataObjectOrg( rIDataObject ), - m_hGlobal( NULL ), + m_hGlobal( nullptr ), m_nRefCnt( 0 ) { @@ -45,7 +45,7 @@ CAPNDataObject::CAPNDataObject( IDataObjectPtr rIDataObject ) : // that it can be unmarshaled multiple times when this // class will be used from another apartment IStreamPtr pStm; - HRESULT hr = CreateStreamOnHGlobal( 0, KEEP_HGLOB_ON_RELEASE, &pStm ); + HRESULT hr = CreateStreamOnHGlobal( nullptr, KEEP_HGLOB_ON_RELEASE, &pStm ); OSL_ENSURE( E_INVALIDARG != hr, "invalid args passed to CreateStreamOnHGlobal" ); @@ -56,7 +56,7 @@ CAPNDataObject::CAPNDataObject( IDataObjectPtr rIDataObject ) : __uuidof(IDataObject), static_cast<LPUNKNOWN>(m_rIDataObjectOrg.get()), MSHCTX_LOCAL, - NULL, + nullptr, MSHLFLAGS_TABLEWEAK ); OSL_ENSURE( CO_E_NOTINITIALIZED != hr_marshal, "COM is not initialized" ); @@ -79,8 +79,8 @@ CAPNDataObject::CAPNDataObject( IDataObjectPtr rIDataObject ) : HGLOBAL hGlobal = GlobalFree(m_hGlobal); - OSL_ENSURE(NULL == hGlobal, "GlobalFree failed"); - m_hGlobal = NULL; + OSL_ENSURE(nullptr == hGlobal, "GlobalFree failed"); + m_hGlobal = nullptr; } } } @@ -106,18 +106,18 @@ CAPNDataObject::~CAPNDataObject( ) STDMETHODIMP CAPNDataObject::QueryInterface( REFIID iid, LPVOID* ppvObject ) { - OSL_ASSERT( NULL != ppvObject ); + OSL_ASSERT( nullptr != ppvObject ); - if ( NULL == ppvObject ) + if ( nullptr == ppvObject ) return E_INVALIDARG; HRESULT hr = E_NOINTERFACE; - *ppvObject = NULL; + *ppvObject = nullptr; if ( ( __uuidof( IUnknown ) == iid ) || ( __uuidof( IDataObject ) == iid ) ) { *ppvObject = static_cast< IUnknown* >( this ); - ( (LPUNKNOWN)*ppvObject )->AddRef( ); + static_cast<LPUNKNOWN>(*ppvObject)->AddRef( ); hr = S_OK; } @@ -309,9 +309,9 @@ CAPNDataObject::operator IDataObject*( ) HRESULT CAPNDataObject::MarshalIDataObjectIntoCurrentApartment( IDataObject** ppIDataObj ) { - OSL_ASSERT(NULL != ppIDataObj); + OSL_ASSERT(nullptr != ppIDataObj); - *ppIDataObj = NULL; + *ppIDataObj = nullptr; HRESULT hr = E_FAIL; if (m_hGlobal) @@ -323,7 +323,7 @@ HRESULT CAPNDataObject::MarshalIDataObjectIntoCurrentApartment( IDataObject** pp if (SUCCEEDED(hr)) { - hr = CoUnmarshalInterface(pStm.get(), __uuidof(IDataObject), (void**)ppIDataObj); + hr = CoUnmarshalInterface(pStm.get(), __uuidof(IDataObject), reinterpret_cast<void**>(ppIDataObj)); OSL_ENSURE(CO_E_NOTINITIALIZED != hr, "COM is not initialized"); } } diff --git a/dtrans/source/win32/dtobj/APNDataObject.hxx b/dtrans/source/win32/dtobj/APNDataObject.hxx index 86dd355bfb7e..534bead593b3 100644 --- a/dtrans/source/win32/dtobj/APNDataObject.hxx +++ b/dtrans/source/win32/dtobj/APNDataObject.hxx @@ -37,21 +37,21 @@ public: //IUnknown interface methods - STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject); - STDMETHODIMP_( ULONG ) AddRef( ); - STDMETHODIMP_( ULONG ) Release( ); + STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject) override; + STDMETHODIMP_( ULONG ) AddRef( ) override; + STDMETHODIMP_( ULONG ) Release( ) override; // IDataObject interface methods - STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); - STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); - STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ); - STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ); - STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ); - STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ); - STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ); - STDMETHODIMP DUnadvise( DWORD dwConnection ); - STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ); + STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ) override; + STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ) override; + STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ) override; + STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ) override; + STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ) override; + STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ) override; + STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ) override; + STDMETHODIMP DUnadvise( DWORD dwConnection ) override; + STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ) override; operator IDataObject*( ); diff --git a/dtrans/source/win32/dtobj/DOTransferable.cxx b/dtrans/source/win32/dtobj/DOTransferable.cxx index 0252ac74b4bf..c6dd59fdb800 100644 --- a/dtrans/source/win32/dtobj/DOTransferable.cxx +++ b/dtrans/source/win32/dtobj/DOTransferable.cxx @@ -47,13 +47,124 @@ namespace const Type CPPUTYPE_OUSTRING = cppu::UnoType<OUString>::get(); inline - sal_Bool isValidFlavor( const DataFlavor& aFlavor ) + bool isValidFlavor( const DataFlavor& aFlavor ) { return ( aFlavor.MimeType.getLength( ) && ( ( aFlavor.DataType == CPPUTYPE_SEQINT8 ) || ( aFlavor.DataType == CPPUTYPE_OUSTRING ) ) ); } +void clipDataToByteStream( CLIPFORMAT cf, STGMEDIUM stgmedium, CDOTransferable::ByteSequence_t& aByteSequence ) +{ + CStgTransferHelper memTransferHelper; + + switch( stgmedium.tymed ) + { + case TYMED_HGLOBAL: + memTransferHelper.init( stgmedium.hGlobal ); + break; + + case TYMED_MFPICT: + memTransferHelper.init( stgmedium.hMetaFilePict ); + break; + + case TYMED_ENHMF: + memTransferHelper.init( stgmedium.hEnhMetaFile ); + break; + + case TYMED_ISTREAM: + //TODO: Has to be implemented + break; + + default: + throw UnsupportedFlavorException( ); + break; + } + + int nMemSize = memTransferHelper.memSize( cf ); + aByteSequence.realloc( nMemSize ); + memTransferHelper.read( aByteSequence.getArray( ), nMemSize ); +} + +inline +OUString byteStreamToOUString( CDOTransferable::ByteSequence_t& aByteStream ) +{ + sal_Int32 nWChars; + sal_Int32 nMemSize = aByteStream.getLength( ); + + // if there is a trailing L"\0" subtract 1 from length + if ( 0 == aByteStream[ aByteStream.getLength( ) - 2 ] && + 0 == aByteStream[ aByteStream.getLength( ) - 1 ] ) + nWChars = static_cast< sal_Int32 >( nMemSize / sizeof( sal_Unicode ) ) - 1; + else + nWChars = static_cast< sal_Int32 >( nMemSize / sizeof( sal_Unicode ) ); + + return OUString( reinterpret_cast< sal_Unicode* >( aByteStream.getArray( ) ), nWChars ); +} + +inline +Any byteStreamToAny( CDOTransferable::ByteSequence_t& aByteStream, const Type& aRequestedDataType ) +{ + Any aAny; + + if ( aRequestedDataType == CPPUTYPE_OUSTRING ) + { + OUString str = byteStreamToOUString( aByteStream ); + aAny = makeAny( str ); + } + else + aAny = makeAny( aByteStream ); + + return aAny; +} + +bool SAL_CALL cmpFullMediaType( + const Reference< XMimeContentType >& xLhs, const Reference< XMimeContentType >& xRhs ) +{ + return xLhs->getFullMediaType().equalsIgnoreAsciiCase( xRhs->getFullMediaType( ) ); +} + +bool SAL_CALL cmpAllContentTypeParameter( + const Reference< XMimeContentType >& xLhs, const Reference< XMimeContentType >& xRhs ) +{ + Sequence< OUString > xLhsFlavors = xLhs->getParameters( ); + Sequence< OUString > xRhsFlavors = xRhs->getParameters( ); + bool bRet = true; + + try + { + if ( xLhsFlavors.getLength( ) == xRhsFlavors.getLength( ) ) + { + OUString pLhs; + OUString pRhs; + + for ( sal_Int32 i = 0; i < xLhsFlavors.getLength( ); i++ ) + { + pLhs = xLhs->getParameterValue( xLhsFlavors[i] ); + pRhs = xRhs->getParameterValue( xLhsFlavors[i] ); + + if ( !pLhs.equalsIgnoreAsciiCase( pRhs ) ) + { + bRet = false; + break; + } + } + } + else + bRet = false; + } + catch( NoSuchElementException& ) + { + bRet = false; + } + catch( IllegalArgumentException& ) + { + bRet = false; + } + + return bRet; +} + } // end namespace Reference< XTransferable > SAL_CALL CDOTransferable::create( const Reference< XComponentContext >& rxContext, @@ -74,7 +185,7 @@ CDOTransferable::CDOTransferable( m_rDataObject( rDataObject ), m_xContext( rxContext ), m_DataFormatTranslator( rxContext ), - m_bUnicodeRegistered( sal_False ), + m_bUnicodeRegistered( false ), m_TxtFormatOnClipboard( CF_INVALID ) { } @@ -101,7 +212,7 @@ Any SAL_CALL CDOTransferable::getTransferData( const DataFlavor& aFlavor ) } catch( UnsupportedFlavorException& ) { - if ( m_DataFormatTranslator.isUnicodeTextFormat( fetc.getClipformat( ) ) && + if ( CDataFormatTranslator::isUnicodeTextFormat( fetc.getClipformat( ) ) && m_bUnicodeRegistered ) { OUString aUnicodeText = synthesizeUnicodeText( ); @@ -153,9 +264,9 @@ sal_Bool SAL_CALL CDOTransferable::isDataFlavorSupported( const DataFlavor& aFla for ( sal_Int32 i = 0; i < m_FlavorList.getLength( ); i++ ) if ( compareDataFlavors( aFlavor, m_FlavorList[i] ) ) - return sal_True; + return true; - return sal_False; + return false; } // the list of dataflavors currently on the clipboard will be initialized @@ -176,7 +287,7 @@ void SAL_CALL CDOTransferable::initFlavorList( ) pEnumFormatEtc->Reset( ); FORMATETC fetc; - while ( S_FALSE != pEnumFormatEtc->Next( 1, &fetc, NULL ) ) + while ( S_FALSE != pEnumFormatEtc->Next( 1, &fetc, nullptr ) ) { // we use locales only to determine the // charset if there is text on the cliboard @@ -187,23 +298,23 @@ void SAL_CALL CDOTransferable::initFlavorList( ) DataFlavor aFlavor = formatEtcToDataFlavor( fetc ); // if text or oemtext is offered we also pretend to have unicode text - if ( m_DataFormatTranslator.isOemOrAnsiTextFormat( fetc.cfFormat ) && + if ( CDataFormatTranslator::isOemOrAnsiTextFormat( fetc.cfFormat ) && !m_bUnicodeRegistered ) { addSupportedFlavor( aFlavor ); m_TxtFormatOnClipboard = fetc.cfFormat; - m_bUnicodeRegistered = sal_True; + m_bUnicodeRegistered = true; // register unicode text as accompany format aFlavor = formatEtcToDataFlavor( - m_DataFormatTranslator.getFormatEtcForClipformat( CF_UNICODETEXT ) ); + CDataFormatTranslator::getFormatEtcForClipformat( CF_UNICODETEXT ) ); addSupportedFlavor( aFlavor ); } else if ( (CF_UNICODETEXT == fetc.cfFormat) && !m_bUnicodeRegistered ) { addSupportedFlavor( aFlavor ); - m_bUnicodeRegistered = sal_True; + m_bUnicodeRegistered = true; } else addSupportedFlavor( aFlavor ); @@ -250,7 +361,7 @@ LCID SAL_CALL CDOTransferable::getLocaleFromClipboard( ) try { - CFormatEtc fetc = m_DataFormatTranslator.getFormatEtcForClipformat( CF_LOCALE ); + CFormatEtc fetc = CDataFormatTranslator::getFormatEtcForClipformat( CF_LOCALE ); ByteSequence_t aLCIDSeq = getClipboardData( fetc ); lcid = *(reinterpret_cast<LCID*>( aLCIDSeq.getArray( ) ) ); @@ -355,7 +466,7 @@ OUString SAL_CALL CDOTransferable::synthesizeUnicodeText( ) if ( CF_TEXT == m_TxtFormatOnClipboard ) { - fetc = m_DataFormatTranslator.getFormatEtcForClipformat( CF_TEXT ); + fetc = CDataFormatTranslator::getFormatEtcForClipformat( CF_TEXT ); aTextSequence = getClipboardData( fetc ); // determine the codepage used for text conversion @@ -363,14 +474,14 @@ OUString SAL_CALL CDOTransferable::synthesizeUnicodeText( ) } else if ( CF_OEMTEXT == m_TxtFormatOnClipboard ) { - fetc = m_DataFormatTranslator.getFormatEtcForClipformat( CF_OEMTEXT ); + fetc = CDataFormatTranslator::getFormatEtcForClipformat( CF_OEMTEXT ); aTextSequence = getClipboardData( fetc ); // determine the codepage used for text conversion cpForTxtCnvt = getWinCPFromLocaleId( lcid, LOCALE_IDEFAULTCODEPAGE ).toInt32( ); } else - OSL_ASSERT( sal_False ); + OSL_ASSERT( false ); CStgTransferHelper stgTransferHelper; @@ -379,79 +490,15 @@ OUString SAL_CALL CDOTransferable::synthesizeUnicodeText( ) reinterpret_cast<char*>( aTextSequence.getArray( ) ), sal::static_int_cast<sal_uInt32>(-1), // Huh ? stgTransferHelper, - sal_False); + false); CRawHGlobalPtr ptrHGlob(stgTransferHelper); - sal_Unicode* pWChar = reinterpret_cast<sal_Unicode*>(ptrHGlob.GetMemPtr()); + sal_Unicode* pWChar = static_cast<sal_Unicode*>(ptrHGlob.GetMemPtr()); return OUString(pWChar); } -void CDOTransferable::clipDataToByteStream( CLIPFORMAT cf, STGMEDIUM stgmedium, ByteSequence_t& aByteSequence ) -{ - CStgTransferHelper memTransferHelper; - - switch( stgmedium.tymed ) - { - case TYMED_HGLOBAL: - memTransferHelper.init( stgmedium.hGlobal ); - break; - - case TYMED_MFPICT: - memTransferHelper.init( stgmedium.hMetaFilePict ); - break; - - case TYMED_ENHMF: - memTransferHelper.init( stgmedium.hEnhMetaFile ); - break; - - case TYMED_ISTREAM: - //TODO: Has to be implemented - break; - - default: - throw UnsupportedFlavorException( ); - break; - } - - int nMemSize = memTransferHelper.memSize( cf ); - aByteSequence.realloc( nMemSize ); - memTransferHelper.read( aByteSequence.getArray( ), nMemSize ); -} - -inline -Any CDOTransferable::byteStreamToAny( ByteSequence_t& aByteStream, const Type& aRequestedDataType ) -{ - Any aAny; - - if ( aRequestedDataType == CPPUTYPE_OUSTRING ) - { - OUString str = byteStreamToOUString( aByteStream ); - aAny = makeAny( str ); - } - else - aAny = makeAny( aByteStream ); - - return aAny; -} - -inline -OUString CDOTransferable::byteStreamToOUString( ByteSequence_t& aByteStream ) -{ - sal_Int32 nWChars; - sal_Int32 nMemSize = aByteStream.getLength( ); - - // if there is a trailing L"\0" subtract 1 from length - if ( 0 == aByteStream[ aByteStream.getLength( ) - 2 ] && - 0 == aByteStream[ aByteStream.getLength( ) - 1 ] ) - nWChars = static_cast< sal_Int32 >( nMemSize / sizeof( sal_Unicode ) ) - 1; - else - nWChars = static_cast< sal_Int32 >( nMemSize / sizeof( sal_Unicode ) ); - - return OUString( reinterpret_cast< sal_Unicode* >( aByteStream.getArray( ) ), nWChars ); -} - -sal_Bool SAL_CALL CDOTransferable::compareDataFlavors( +bool SAL_CALL CDOTransferable::compareDataFlavors( const DataFlavor& lhs, const DataFlavor& rhs ) { if ( !m_rXMimeCntFactory.is( ) ) @@ -459,7 +506,7 @@ sal_Bool SAL_CALL CDOTransferable::compareDataFlavors( m_rXMimeCntFactory = MimeContentTypeFactory::create( m_xContext ); } - sal_Bool bRet = sal_False; + bool bRet = false; try { @@ -474,54 +521,7 @@ sal_Bool SAL_CALL CDOTransferable::compareDataFlavors( catch( IllegalArgumentException& ) { OSL_FAIL( "Invalid content type detected" ); - bRet = sal_False; - } - - return bRet; -} - -sal_Bool SAL_CALL CDOTransferable::cmpFullMediaType( - const Reference< XMimeContentType >& xLhs, const Reference< XMimeContentType >& xRhs ) const -{ - return xLhs->getFullMediaType().equalsIgnoreAsciiCase( xRhs->getFullMediaType( ) ); -} - -sal_Bool SAL_CALL CDOTransferable::cmpAllContentTypeParameter( - const Reference< XMimeContentType >& xLhs, const Reference< XMimeContentType >& xRhs ) const -{ - Sequence< OUString > xLhsFlavors = xLhs->getParameters( ); - Sequence< OUString > xRhsFlavors = xRhs->getParameters( ); - sal_Bool bRet = sal_True; - - try - { - if ( xLhsFlavors.getLength( ) == xRhsFlavors.getLength( ) ) - { - OUString pLhs; - OUString pRhs; - - for ( sal_Int32 i = 0; i < xLhsFlavors.getLength( ); i++ ) - { - pLhs = xLhs->getParameterValue( xLhsFlavors[i] ); - pRhs = xRhs->getParameterValue( xLhsFlavors[i] ); - - if ( !pLhs.equalsIgnoreAsciiCase( pRhs ) ) - { - bRet = sal_False; - break; - } - } - } - else - bRet = sal_False; - } - catch( NoSuchElementException& ) - { - bRet = sal_False; - } - catch( IllegalArgumentException& ) - { - bRet = sal_False; + bRet = false; } return bRet; @@ -532,7 +532,7 @@ css::uno::Any SAL_CALL CDOTransferable::getData( const Sequence< sal_Int8>& aPro { Any retVal; - sal_uInt8 * arProcCaller= (sal_uInt8*)(sal_Int8*) aProcessId.getConstArray(); + sal_Int8 const * arProcCaller= aProcessId.getConstArray(); sal_uInt8 arId[16]; rtl_getGlobalProcessId(arId); if( ! memcmp( arId, arProcCaller,16)) diff --git a/dtrans/source/win32/dtobj/DOTransferable.hxx b/dtrans/source/win32/dtobj/DOTransferable.hxx index 1f110089b4ea..ab08e22e286a 100644 --- a/dtrans/source/win32/dtobj/DOTransferable.hxx +++ b/dtrans/source/win32/dtobj/DOTransferable.hxx @@ -46,18 +46,18 @@ public: // XTransferable virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) - throw( css::datatransfer::UnsupportedFlavorException, css::io::IOException, css::uno::RuntimeException ); + throw( css::datatransfer::UnsupportedFlavorException, css::io::IOException, css::uno::RuntimeException ) override; virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) - throw( css::uno::RuntimeException ); + throw( css::uno::RuntimeException ) override; virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor ) - throw( css::uno::RuntimeException ); + throw( css::uno::RuntimeException ) override; // XSystemTransferable virtual css::uno::Any SAL_CALL getData( const css::uno::Sequence<sal_Int8>& aProcessId ) throw - (css::uno::RuntimeException); + (css::uno::RuntimeException) override; private: explicit CDOTransferable( @@ -74,22 +74,11 @@ private: ByteSequence_t SAL_CALL getClipboardData( CFormatEtc& aFormatEtc ); OUString SAL_CALL synthesizeUnicodeText( ); - void SAL_CALL clipDataToByteStream( CLIPFORMAT cf, STGMEDIUM stgmedium, ByteSequence_t& aByteSequence ); - - css::uno::Any SAL_CALL byteStreamToAny( ByteSequence_t& aByteStream, const css::uno::Type& aRequestedDataType ); - OUString SAL_CALL byteStreamToOUString( ByteSequence_t& aByteStream ); - LCID SAL_CALL getLocaleFromClipboard( ); - sal_Bool SAL_CALL compareDataFlavors( const css::datatransfer::DataFlavor& lhs, + bool SAL_CALL compareDataFlavors( const css::datatransfer::DataFlavor& lhs, const css::datatransfer::DataFlavor& rhs ); - sal_Bool SAL_CALL cmpFullMediaType( const css::uno::Reference< css::datatransfer::XMimeContentType >& xLhs, - const css::uno::Reference< css::datatransfer::XMimeContentType >& xRhs ) const; - - sal_Bool SAL_CALL cmpAllContentTypeParameter( const css::uno::Reference< css::datatransfer::XMimeContentType >& xLhs, - const css::uno::Reference< css::datatransfer::XMimeContentType >& xRhs ) const; - private: IDataObjectPtr m_rDataObject; css::uno::Sequence< css::datatransfer::DataFlavor > m_FlavorList; @@ -97,7 +86,7 @@ private: CDataFormatTranslator m_DataFormatTranslator; css::uno::Reference< css::datatransfer::XMimeContentTypeFactory > m_rXMimeCntFactory; ::osl::Mutex m_aMutex; - sal_Bool m_bUnicodeRegistered; + bool m_bUnicodeRegistered; CLIPFORMAT m_TxtFormatOnClipboard; // non supported operations diff --git a/dtrans/source/win32/dtobj/DTransHelper.cxx b/dtrans/source/win32/dtobj/DTransHelper.cxx index 46b1086fe18d..49151f4d4fd1 100644 --- a/dtrans/source/win32/dtobj/DTransHelper.cxx +++ b/dtrans/source/win32/dtobj/DTransHelper.cxx @@ -23,10 +23,10 @@ // implementation -CStgTransferHelper::CStgTransferHelper( sal_Bool bAutoInit, +CStgTransferHelper::CStgTransferHelper( bool bAutoInit, HGLOBAL hGlob, - sal_Bool bDelStgOnRelease ) : - m_lpStream( NULL ), + bool bDelStgOnRelease ) : + m_lpStream( nullptr ), m_bDelStgOnRelease( bDelStgOnRelease ) { if ( bAutoInit ) @@ -83,13 +83,13 @@ HGLOBAL SAL_CALL CStgTransferHelper::getHGlobal( ) const { OSL_ASSERT( m_lpStream ); - HGLOBAL hGlob = NULL; + HGLOBAL hGlob = nullptr; if ( m_lpStream ) { HRESULT hr = GetHGlobalFromStream( m_lpStream, &hGlob ); if ( FAILED( hr ) ) - hGlob = NULL; + hGlob = nullptr; } return hGlob; @@ -109,21 +109,21 @@ void SAL_CALL CStgTransferHelper::getIStream( LPSTREAM* ppStream ) void SAL_CALL CStgTransferHelper::init( SIZE_T newSize, sal_uInt32 uiFlags, - sal_Bool bDelStgOnRelease ) + bool bDelStgOnRelease ) { cleanup( ); m_bDelStgOnRelease = bDelStgOnRelease; HGLOBAL hGlob = GlobalAlloc( uiFlags, newSize ); - if ( NULL == hGlob ) + if ( nullptr == hGlob ) throw CStgTransferException( STG_E_MEDIUMFULL ); HRESULT hr = CreateStreamOnHGlobal( hGlob, m_bDelStgOnRelease, &m_lpStream ); if ( FAILED( hr ) ) { GlobalFree( hGlob ); - m_lpStream = NULL; + m_lpStream = nullptr; throw CStgTransferException( hr ); } @@ -137,7 +137,7 @@ void SAL_CALL CStgTransferHelper::init( SIZE_T newSize, // Init void SAL_CALL CStgTransferHelper::init( HGLOBAL hGlob, - sal_Bool bDelStgOnRelease ) + bool bDelStgOnRelease ) { cleanup( ); @@ -162,7 +162,7 @@ void SAL_CALL CStgTransferHelper::cleanup( ) if ( m_lpStream ) { m_lpStream->Release( ); - m_lpStream = NULL; + m_lpStream = nullptr; } } @@ -172,7 +172,7 @@ sal_uInt32 SAL_CALL CStgTransferHelper::memSize( CLIPFORMAT cf ) const { DWORD dwSize = 0; - if ( NULL != m_lpStream ) + if ( nullptr != m_lpStream ) { HGLOBAL hGlob; GetHGlobalFromStream( m_lpStream, &hGlob ); diff --git a/dtrans/source/win32/dtobj/DTransHelper.hxx b/dtrans/source/win32/dtobj/DTransHelper.hxx index 5760ca31a0d8..2143c571f047 100644 --- a/dtrans/source/win32/dtobj/DTransHelper.hxx +++ b/dtrans/source/win32/dtobj/DTransHelper.hxx @@ -48,14 +48,14 @@ public: public: CStgTransferHelper( - sal_Bool bAutoInit = sal_False, - HGLOBAL hGlob = NULL, - sal_Bool bDelStgOnRelease = sal_False ); + bool bAutoInit = false, + HGLOBAL hGlob = nullptr, + bool bDelStgOnRelease = false ); ~CStgTransferHelper( ); - void SAL_CALL write( const void* lpData, ULONG cb, ULONG* cbWritten = NULL ); - void SAL_CALL read( LPVOID pv, ULONG cb, ULONG* pcbRead = NULL ); + void SAL_CALL write( const void* lpData, ULONG cb, ULONG* cbWritten = nullptr ); + void SAL_CALL read( LPVOID pv, ULONG cb, ULONG* pcbRead = nullptr ); HGLOBAL SAL_CALL getHGlobal( ) const; void SAL_CALL getIStream( LPSTREAM* ppStream ); @@ -63,11 +63,11 @@ public: void SAL_CALL init( SIZE_T newSize, sal_uInt32 uiFlags = GHND, - sal_Bool bDelStgOnRelease = sal_False ); + bool bDelStgOnRelease = false ); void SAL_CALL init( HGLOBAL hGlob, - sal_Bool bDelStgOnRelease = sal_False ); + bool bDelStgOnRelease = false ); // returns the size of the managed memory sal_uInt32 SAL_CALL memSize( CLIPFORMAT cf = CF_INVALID ) const; @@ -78,7 +78,7 @@ public: private: LPSTREAM m_lpStream; - sal_Bool m_bDelStgOnRelease; + bool m_bDelStgOnRelease; private: CStgTransferHelper( const CStgTransferHelper& ); @@ -98,7 +98,7 @@ public: explicit CRawHGlobalPtr( HGLOBAL hGlob ) : m_hGlob( hGlob ), m_bIsLocked( FALSE ), - m_pGlobMem( NULL ) + m_pGlobMem( nullptr ) { } @@ -107,7 +107,7 @@ public: explicit CRawHGlobalPtr( const CStgTransferHelper& theHGlobalHelper ) : m_hGlob( theHGlobalHelper.getHGlobal( ) ), m_bIsLocked( FALSE ), - m_pGlobMem( NULL ) + m_pGlobMem( nullptr ) { } @@ -124,10 +124,10 @@ public: BOOL Lock( ) { - if ( !m_bIsLocked && ( NULL != m_hGlob ) ) + if ( !m_bIsLocked && ( nullptr != m_hGlob ) ) { m_pGlobMem = GlobalLock( m_hGlob ); - m_bIsLocked = ( NULL != m_pGlobMem ); + m_bIsLocked = ( nullptr != m_pGlobMem ); } return m_bIsLocked; @@ -140,7 +140,7 @@ public: { GlobalUnlock( m_hGlob ); m_bIsLocked = FALSE; - m_pGlobMem = NULL; + m_pGlobMem = nullptr; return ( NO_ERROR == GetLastError( ) ); } diff --git a/dtrans/source/win32/dtobj/DataFmtTransl.cxx b/dtrans/source/win32/dtobj/DataFmtTransl.cxx index b0e4c5816f21..a498e9d4471e 100644 --- a/dtrans/source/win32/dtobj/DataFmtTransl.cxx +++ b/dtrans/source/win32/dtobj/DataFmtTransl.cxx @@ -154,7 +154,7 @@ DataFlavor CDataFormatTranslator::getDataFlavorFromFormatEtc( const FORMATETC& a return aFlavor; } -CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformatName( const OUString& aClipFmtName ) const +CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformatName( const OUString& aClipFmtName ) { // check parameter if ( !aClipFmtName.getLength( ) ) @@ -164,7 +164,7 @@ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformatName( const return getFormatEtcForClipformat( cf ); } -OUString CDataFormatTranslator::getClipboardFormatName( CLIPFORMAT aClipformat ) const +OUString CDataFormatTranslator::getClipboardFormatName( CLIPFORMAT aClipformat ) { OSL_PRECOND( CF_INVALID != aClipformat, "Invalid clipboard format" ); @@ -174,9 +174,9 @@ OUString CDataFormatTranslator::getClipboardFormatName( CLIPFORMAT aClipformat ) return OUString( wBuff, nLen ); } -CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformat( CLIPFORMAT cf ) const +CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformat( CLIPFORMAT cf ) { - CFormatEtc fetc( cf, TYMED_NULL, NULL, DVASPECT_CONTENT ); + CFormatEtc fetc( cf, TYMED_NULL, nullptr, DVASPECT_CONTENT ); switch( cf ) { @@ -207,34 +207,34 @@ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformat( CLIPFORMAT return fetc; } -sal_Bool SAL_CALL CDataFormatTranslator::isOemOrAnsiTextFormat( CLIPFORMAT cf ) const +bool SAL_CALL CDataFormatTranslator::isOemOrAnsiTextFormat( CLIPFORMAT cf ) { return ( (cf == CF_TEXT) || (cf == CF_OEMTEXT) ); } -sal_Bool SAL_CALL CDataFormatTranslator::isUnicodeTextFormat( CLIPFORMAT cf ) const +bool SAL_CALL CDataFormatTranslator::isUnicodeTextFormat( CLIPFORMAT cf ) { return ( cf == CF_UNICODETEXT ); } -sal_Bool SAL_CALL CDataFormatTranslator::isTextFormat( CLIPFORMAT cf ) const +bool SAL_CALL CDataFormatTranslator::isTextFormat( CLIPFORMAT cf ) { return ( isOemOrAnsiTextFormat( cf ) || isUnicodeTextFormat( cf ) ); } -sal_Bool SAL_CALL CDataFormatTranslator::isHTMLFormat( CLIPFORMAT cf ) const +bool SAL_CALL CDataFormatTranslator::isHTMLFormat( CLIPFORMAT cf ) { OUString clipFormatName = getClipboardFormatName( cf ); return ( clipFormatName == HTML_FORMAT_NAME_WINDOWS ); } -sal_Bool SAL_CALL CDataFormatTranslator::isTextHtmlFormat( CLIPFORMAT cf ) const +bool SAL_CALL CDataFormatTranslator::isTextHtmlFormat( CLIPFORMAT cf ) { OUString clipFormatName = getClipboardFormatName( cf ); return ( clipFormatName.equalsIgnoreAsciiCase( HTML_FORMAT_NAME_SOFFICE ) ); } -OUString SAL_CALL CDataFormatTranslator::getTextCharsetFromLCID( LCID lcid, CLIPFORMAT aClipformat ) const +OUString SAL_CALL CDataFormatTranslator::getTextCharsetFromLCID( LCID lcid, CLIPFORMAT aClipformat ) { OSL_ASSERT( isOemOrAnsiTextFormat( aClipformat ) ); @@ -254,7 +254,7 @@ OUString SAL_CALL CDataFormatTranslator::getTextCharsetFromLCID( LCID lcid, CLIP PRE_OEM_CODEPAGE ); } else // CF_UNICODE - OSL_ASSERT( sal_False ); + OSL_ASSERT( false ); return charset; } diff --git a/dtrans/source/win32/dtobj/DataFmtTransl.hxx b/dtrans/source/win32/dtobj/DataFmtTransl.hxx index 716d96e7268d..5412d7bdd901 100644 --- a/dtrans/source/win32/dtobj/DataFmtTransl.hxx +++ b/dtrans/source/win32/dtobj/DataFmtTransl.hxx @@ -47,18 +47,18 @@ public: css::datatransfer::DataFlavor getDataFlavorFromFormatEtc( const FORMATETC& aFormatEtc, LCID lcid = GetThreadLocale( ) ) const; - CFormatEtc SAL_CALL getFormatEtcForClipformat( CLIPFORMAT cf ) const; - CFormatEtc SAL_CALL getFormatEtcForClipformatName( const OUString& aClipFmtName ) const; - OUString SAL_CALL getClipboardFormatName( CLIPFORMAT aClipformat ) const; + static CFormatEtc SAL_CALL getFormatEtcForClipformat( CLIPFORMAT cf ); + static CFormatEtc SAL_CALL getFormatEtcForClipformatName( const OUString& aClipFmtName ); + static OUString SAL_CALL getClipboardFormatName( CLIPFORMAT aClipformat ); - sal_Bool SAL_CALL isHTMLFormat( CLIPFORMAT cf ) const; - sal_Bool SAL_CALL isTextHtmlFormat( CLIPFORMAT cf ) const; - sal_Bool SAL_CALL isOemOrAnsiTextFormat( CLIPFORMAT cf ) const; - sal_Bool SAL_CALL isUnicodeTextFormat( CLIPFORMAT cf ) const; - sal_Bool SAL_CALL isTextFormat( CLIPFORMAT cf ) const; + static bool SAL_CALL isHTMLFormat( CLIPFORMAT cf ); + static bool SAL_CALL isTextHtmlFormat( CLIPFORMAT cf ); + static bool SAL_CALL isOemOrAnsiTextFormat( CLIPFORMAT cf ); + static bool SAL_CALL isUnicodeTextFormat( CLIPFORMAT cf ); + static bool SAL_CALL isTextFormat( CLIPFORMAT cf ); private: - OUString SAL_CALL getTextCharsetFromLCID( LCID lcid, CLIPFORMAT aClipformat ) const; + static OUString SAL_CALL getTextCharsetFromLCID( LCID lcid, CLIPFORMAT aClipformat ); private: css::uno::Reference< css::datatransfer::XDataFormatTranslator > m_XDataFormatTranslator; diff --git a/dtrans/source/win32/dtobj/Fetc.cxx b/dtrans/source/win32/dtobj/Fetc.cxx index 9f60a0e5d68e..048b9228de5d 100644 --- a/dtrans/source/win32/dtobj/Fetc.cxx +++ b/dtrans/source/win32/dtobj/Fetc.cxx @@ -24,7 +24,7 @@ CFormatEtc::CFormatEtc( ) { m_FormatEtc.cfFormat = 0; - m_FormatEtc.ptd = NULL; + m_FormatEtc.ptd = nullptr; m_FormatEtc.dwAspect = 0; m_FormatEtc.lindex = -1; m_FormatEtc.tymed = TYMED_NULL; @@ -109,7 +109,7 @@ void CFormatEtc::getTargetDevice( DVTARGETDEVICE** lpDvTargetDevice ) const OSL_ASSERT( lpDvTargetDevice ); OSL_ASSERT( !IsBadWritePtr( lpDvTargetDevice, sizeof( DVTARGETDEVICE ) ) ); - *lpDvTargetDevice = NULL; + *lpDvTargetDevice = nullptr; if ( m_FormatEtc.ptd ) *lpDvTargetDevice = CopyTargetDevice( m_FormatEtc.ptd ); @@ -153,14 +153,14 @@ void CFormatEtc::setLindex( LONG lindex ) m_FormatEtc.lindex = lindex; } -sal_Int32 operator==( const CFormatEtc& lhs, const CFormatEtc& rhs ) +bool operator==( const CFormatEtc& lhs, const CFormatEtc& rhs ) { return CompareFormatEtc( &lhs.m_FormatEtc, &rhs.m_FormatEtc ); } -sal_Int32 operator!=( const CFormatEtc& lhs, const CFormatEtc& rhs ) +bool operator!=( const CFormatEtc& lhs, const CFormatEtc& rhs ) { - return ( ( lhs == rhs ) != 1 ); + return !( lhs == rhs ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/dtobj/Fetc.hxx b/dtrans/source/win32/dtobj/Fetc.hxx index 6b070907a6e3..7513ebd62aec 100644 --- a/dtrans/source/win32/dtobj/Fetc.hxx +++ b/dtrans/source/win32/dtobj/Fetc.hxx @@ -43,7 +43,7 @@ class CFormatEtc public: CFormatEtc( ); explicit CFormatEtc( const FORMATETC& aFormatEtc ); - CFormatEtc( CLIPFORMAT cf, DWORD tymed = TYMED_HGLOBAL, DVTARGETDEVICE* ptd = NULL, DWORD dwAspect = DVASPECT_CONTENT, LONG lindex = -1 ); + CFormatEtc( CLIPFORMAT cf, DWORD tymed = TYMED_HGLOBAL, DVTARGETDEVICE* ptd = nullptr, DWORD dwAspect = DVASPECT_CONTENT, LONG lindex = -1 ); CFormatEtc( const CFormatEtc& theOther ); ~CFormatEtc( ); @@ -69,12 +69,12 @@ public: private: FORMATETC m_FormatEtc; - friend sal_Int32 operator==( const CFormatEtc& lhs, const CFormatEtc& rhs ); - friend sal_Int32 operator!=( const CFormatEtc& lhs, const CFormatEtc& rhs ); + friend bool operator==( const CFormatEtc& lhs, const CFormatEtc& rhs ); + friend bool operator!=( const CFormatEtc& lhs, const CFormatEtc& rhs ); }; -sal_Int32 operator==( const CFormatEtc& lhs, const CFormatEtc& rhs ); -sal_Int32 operator!=( const CFormatEtc& lhs, const CFormatEtc& rhs ); +bool operator==( const CFormatEtc& lhs, const CFormatEtc& rhs ); +bool operator!=( const CFormatEtc& lhs, const CFormatEtc& rhs ); #endif diff --git a/dtrans/source/win32/dtobj/FetcList.cxx b/dtrans/source/win32/dtobj/FetcList.cxx index c3a3c056822c..a320d34dc2ec 100644 --- a/dtrans/source/win32/dtobj/FetcList.cxx +++ b/dtrans/source/win32/dtobj/FetcList.cxx @@ -64,7 +64,7 @@ void SAL_CALL CFormatEtcContainer::removeAllFormatEtc( ) m_FormatMap.clear( ); } -sal_Bool CFormatEtcContainer::hasFormatEtc( const CFormatEtc& fetc ) const +bool CFormatEtcContainer::hasFormatEtc( const CFormatEtc& fetc ) const { FormatEtcMap_t::const_iterator iter = find( m_FormatMap.begin(), m_FormatMap.end(), fetc ); @@ -72,7 +72,7 @@ sal_Bool CFormatEtcContainer::hasFormatEtc( const CFormatEtc& fetc ) const return ( iter != m_FormatMap.end( ) ); } -sal_Bool CFormatEtcContainer::hasElements( ) const +bool CFormatEtcContainer::hasElements( ) const { return !m_FormatMap.empty(); } @@ -100,7 +100,7 @@ sal_uInt32 SAL_CALL CFormatEtcContainer::nextFormatEtc( LPFORMATETC lpFetc, return nFetched; } -sal_Bool SAL_CALL CFormatEtcContainer::skipFormatEtc( sal_uInt32 aNum ) +bool SAL_CALL CFormatEtcContainer::skipFormatEtc( sal_uInt32 aNum ) { FormatEtcMap_t::const_iterator iter_end = m_FormatMap.end( ); for ( sal_uInt32 i = 0; @@ -114,7 +114,7 @@ sal_Bool SAL_CALL CFormatEtcContainer::skipFormatEtc( sal_uInt32 aNum ) CFormatRegistrar::CFormatRegistrar( const Reference< XComponentContext >& rxContext, const CDataFormatTranslator& aDataFormatTranslator ) : m_DataFormatTranslator( aDataFormatTranslator ), - m_bHasSynthesizedLocale( sal_False ), + m_bHasSynthesizedLocale( false ), m_xContext( rxContext ) { } @@ -144,7 +144,7 @@ void SAL_CALL CFormatRegistrar::RegisterFormats( { Sequence< DataFlavor > aFlavorList = aXTransferable->getTransferDataFlavors( ); sal_Int32 nFlavors = aFlavorList.getLength( ); - sal_Bool bUnicodeRegistered = sal_False; + bool bUnicodeRegistered = false; DataFlavor aFlavor; for( sal_Int32 i = 0; i < nFlavors; i++ ) @@ -161,18 +161,18 @@ void SAL_CALL CFormatRegistrar::RegisterFormats( else { // if we haven't registered any text format up to now - if ( m_DataFormatTranslator.isTextFormat( fetc.getClipformat() ) && !bUnicodeRegistered ) + if ( CDataFormatTranslator::isTextFormat( fetc.getClipformat() ) && !bUnicodeRegistered ) { // if the transferable supports unicode text we ignore // any further text format the transferable offers // because we can create it from Unicode text in addition // we register CF_TEXT for non unicode clients - if ( m_DataFormatTranslator.isUnicodeTextFormat( fetc.getClipformat() ) ) + if ( CDataFormatTranslator::isUnicodeTextFormat( fetc.getClipformat() ) ) { aFormatEtcContainer.addFormatEtc( fetc ); // add CF_UNICODE aFormatEtcContainer.addFormatEtc( - m_DataFormatTranslator.getFormatEtcForClipformat( CF_TEXT ) ); // add CF_TEXT - bUnicodeRegistered = sal_True; + CDataFormatTranslator::getFormatEtcForClipformat( CF_TEXT ) ); // add CF_TEXT + bUnicodeRegistered = true; } else if ( !hasUnicodeFlavor( aXTransferable ) ) { @@ -188,26 +188,26 @@ void SAL_CALL CFormatRegistrar::RegisterFormats( m_TxtCodePage = txtCP; aFormatEtcContainer.addFormatEtc( - m_DataFormatTranslator.getFormatEtcForClipformat( CF_UNICODETEXT ) ); + CDataFormatTranslator::getFormatEtcForClipformat( CF_UNICODETEXT ) ); if ( !IsOEMCP( m_TxtCodePage ) ) aFormatEtcContainer.addFormatEtc( - m_DataFormatTranslator.getFormatEtcForClipformat( CF_TEXT ) ); + CDataFormatTranslator::getFormatEtcForClipformat( CF_TEXT ) ); else aFormatEtcContainer.addFormatEtc( - m_DataFormatTranslator.getFormatEtcForClipformat( CF_OEMTEXT ) ); + CDataFormatTranslator::getFormatEtcForClipformat( CF_OEMTEXT ) ); aFormatEtcContainer.addFormatEtc( - m_DataFormatTranslator.getFormatEtcForClipformat( CF_LOCALE ) ); + CDataFormatTranslator::getFormatEtcForClipformat( CF_LOCALE ) ); // we save the flavor so it's easier when // queried for it in XTDataObject::GetData(...) m_RegisteredTextFlavor = aFlavor; - m_bHasSynthesizedLocale = sal_True; + m_bHasSynthesizedLocale = true; } } } - else if ( m_DataFormatTranslator.isTextHtmlFormat( fetc.getClipformat( ) ) ) // Html (Hyper Text...) + else if ( CDataFormatTranslator::isTextHtmlFormat( fetc.getClipformat( ) ) ) // Html (Hyper Text...) { // we add text/html ( HTML (HyperText Markup Language) ) aFormatEtcContainer.addFormatEtc( fetc ); @@ -215,23 +215,23 @@ void SAL_CALL CFormatRegistrar::RegisterFormats( // and HTML Format OUString htmlFormat( "HTML Format" ); aFormatEtcContainer.addFormatEtc( - m_DataFormatTranslator.getFormatEtcForClipformatName( htmlFormat ) ); + CDataFormatTranslator::getFormatEtcForClipformatName( htmlFormat ) ); } } } } -sal_Bool SAL_CALL CFormatRegistrar::hasSynthesizedLocale( ) const +bool SAL_CALL CFormatRegistrar::hasSynthesizedLocale( ) const { return m_bHasSynthesizedLocale; } -LCID SAL_CALL CFormatRegistrar::getSynthesizedLocale( ) const +LCID SAL_CALL CFormatRegistrar::getSynthesizedLocale( ) { return m_TxtLocale; } -sal_uInt32 SAL_CALL CFormatRegistrar::getRegisteredTextCodePage( ) const +sal_uInt32 SAL_CALL CFormatRegistrar::getRegisteredTextCodePage( ) { return m_TxtCodePage; } @@ -241,19 +241,19 @@ DataFlavor SAL_CALL CFormatRegistrar::getRegisteredTextFlavor( ) const return m_RegisteredTextFlavor; } -sal_Bool SAL_CALL CFormatRegistrar::isSynthesizeableFormat( const CFormatEtc& aFormatEtc ) const +bool SAL_CALL CFormatRegistrar::isSynthesizeableFormat( const CFormatEtc& aFormatEtc ) { - return ( m_DataFormatTranslator.isOemOrAnsiTextFormat( aFormatEtc.getClipformat() ) || - m_DataFormatTranslator.isUnicodeTextFormat( aFormatEtc.getClipformat() ) || - m_DataFormatTranslator.isHTMLFormat( aFormatEtc.getClipformat() ) ); + return ( CDataFormatTranslator::isOemOrAnsiTextFormat( aFormatEtc.getClipformat() ) || + CDataFormatTranslator::isUnicodeTextFormat( aFormatEtc.getClipformat() ) || + CDataFormatTranslator::isHTMLFormat( aFormatEtc.getClipformat() ) ); } inline -sal_Bool SAL_CALL CFormatRegistrar::needsToSynthesizeAccompanyFormats( const CFormatEtc& aFormatEtc ) const +bool SAL_CALL CFormatRegistrar::needsToSynthesizeAccompanyFormats( const CFormatEtc& aFormatEtc ) { - return ( m_DataFormatTranslator.isOemOrAnsiTextFormat( aFormatEtc.getClipformat() ) || - m_DataFormatTranslator.isUnicodeTextFormat( aFormatEtc.getClipformat() ) || - m_DataFormatTranslator.isTextHtmlFormat( aFormatEtc.getClipformat( ) ) ); + return ( CDataFormatTranslator::isOemOrAnsiTextFormat( aFormatEtc.getClipformat() ) || + CDataFormatTranslator::isUnicodeTextFormat( aFormatEtc.getClipformat() ) || + CDataFormatTranslator::isTextHtmlFormat( aFormatEtc.getClipformat( ) ) ); } OUString SAL_CALL CFormatRegistrar::getCharsetFromDataFlavor( const DataFlavor& aFlavor ) @@ -283,7 +283,7 @@ OUString SAL_CALL CFormatRegistrar::getCharsetFromDataFlavor( const DataFlavor& return charset; } -sal_Bool SAL_CALL CFormatRegistrar::hasUnicodeFlavor( const Reference< XTransferable >& aXTransferable ) const +bool SAL_CALL CFormatRegistrar::hasUnicodeFlavor( const Reference< XTransferable >& aXTransferable ) const { CFormatEtc fetc( CF_UNICODETEXT ); @@ -293,20 +293,14 @@ sal_Bool SAL_CALL CFormatRegistrar::hasUnicodeFlavor( const Reference< XTransfer return aXTransferable->isDataFlavorSupported( aFlavor ); } -inline -sal_Bool CFormatRegistrar::isEqualCurrentSystemCodePage( sal_uInt32 aCodePage ) const -{ - return ( (aCodePage == GetOEMCP()) || (aCodePage == GetACP()) ); -} - -sal_Bool SAL_CALL CFormatRegistrar::findLocaleForTextCodePage( ) +bool SAL_CALL CFormatRegistrar::findLocaleForTextCodePage( ) { m_TxtLocale = 0; EnumSystemLocalesA( CFormatRegistrar::EnumLocalesProc, LCID_INSTALLED ); - return ( IsValidLocale( m_TxtLocale, LCID_INSTALLED ) ) ? sal_True : sal_False; + return IsValidLocale( m_TxtLocale, LCID_INSTALLED ); } -sal_Bool SAL_CALL CFormatRegistrar::isLocaleCodePage( LCID lcid, LCTYPE lctype, sal_uInt32 codepage ) +bool SAL_CALL CFormatRegistrar::isLocaleCodePage( LCID lcid, LCTYPE lctype, sal_uInt32 codepage ) { char buff[6]; sal_uInt32 localeCodePage; @@ -321,13 +315,13 @@ sal_Bool SAL_CALL CFormatRegistrar::isLocaleCodePage( LCID lcid, LCTYPE lctype, } inline -sal_Bool SAL_CALL CFormatRegistrar::isLocaleOemCodePage( LCID lcid, sal_uInt32 codepage ) +bool SAL_CALL CFormatRegistrar::isLocaleOemCodePage( LCID lcid, sal_uInt32 codepage ) { return isLocaleCodePage( lcid, LOCALE_IDEFAULTCODEPAGE, codepage ); } inline -sal_Bool SAL_CALL CFormatRegistrar::isLocaleAnsiCodePage( LCID lcid, sal_uInt32 codepage ) +bool SAL_CALL CFormatRegistrar::isLocaleAnsiCodePage( LCID lcid, sal_uInt32 codepage ) { return isLocaleCodePage( lcid, LOCALE_IDEFAULTANSICODEPAGE, codepage ); } @@ -335,16 +329,16 @@ sal_Bool SAL_CALL CFormatRegistrar::isLocaleAnsiCodePage( LCID lcid, sal_uInt32 BOOL CALLBACK CFormatRegistrar::EnumLocalesProc( LPSTR lpLocaleStr ) { // the lpLocaleStr parameter is hexadecimal - LCID lcid = strtol( lpLocaleStr, NULL, 16 ); + LCID lcid = strtol( lpLocaleStr, nullptr, 16 ); if ( isLocaleAnsiCodePage( lcid, CFormatRegistrar::m_TxtCodePage ) || isLocaleOemCodePage( lcid, CFormatRegistrar::m_TxtCodePage ) ) { CFormatRegistrar::m_TxtLocale = lcid; - return sal_False; // stop enumerating + return false; // stop enumerating } - return sal_True; + return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/dtobj/FetcList.hxx b/dtrans/source/win32/dtobj/FetcList.hxx index 21823211d76a..9f70d0976ab2 100644 --- a/dtrans/source/win32/dtobj/FetcList.hxx +++ b/dtrans/source/win32/dtobj/FetcList.hxx @@ -53,9 +53,9 @@ public: // removes the formatetc at pos void SAL_CALL removeAllFormatEtc( ); - sal_Bool SAL_CALL hasFormatEtc( const CFormatEtc& fetc ) const; + bool SAL_CALL hasFormatEtc( const CFormatEtc& fetc ) const; - sal_Bool SAL_CALL hasElements( ) const; + bool SAL_CALL hasElements( ) const; // begin enumeration void SAL_CALL beginEnumFormatEtc( ); @@ -67,7 +67,7 @@ public: sal_uInt32 SAL_CALL nextFormatEtc( LPFORMATETC lpFetc, sal_uInt32 aNum = 1 ); // skips the specified number of elements in the container - sal_Bool SAL_CALL skipFormatEtc( sal_uInt32 aNum ); + bool SAL_CALL skipFormatEtc( sal_uInt32 aNum ); protected: typedef std::vector< CFormatEtc > FormatEtcMap_t; @@ -102,32 +102,31 @@ public: void SAL_CALL RegisterFormats( const css::uno::Reference< css::datatransfer::XTransferable >& aXTransferable, CFormatEtcContainer& aFormatEtcContainer ); - sal_Bool SAL_CALL hasSynthesizedLocale( ) const; - LCID SAL_CALL getSynthesizedLocale( ) const; - sal_uInt32 SAL_CALL getRegisteredTextCodePage( ) const; + bool SAL_CALL hasSynthesizedLocale( ) const; + static LCID SAL_CALL getSynthesizedLocale( ); + static sal_uInt32 SAL_CALL getRegisteredTextCodePage( ); css::datatransfer::DataFlavor SAL_CALL getRegisteredTextFlavor( ) const; - sal_Bool SAL_CALL isSynthesizeableFormat( const CFormatEtc& aFormatEtc ) const; - sal_Bool SAL_CALL needsToSynthesizeAccompanyFormats( const CFormatEtc& aFormatEtc ) const; + static bool SAL_CALL isSynthesizeableFormat( const CFormatEtc& aFormatEtc ); + static bool SAL_CALL needsToSynthesizeAccompanyFormats( const CFormatEtc& aFormatEtc ); private: - sal_Bool SAL_CALL isEqualCurrentSystemCodePage( sal_uInt32 aCodePage ) const; OUString SAL_CALL getCharsetFromDataFlavor( const css::datatransfer::DataFlavor& aFlavor ); - sal_Bool SAL_CALL hasUnicodeFlavor( + bool SAL_CALL hasUnicodeFlavor( const css::uno::Reference< css::datatransfer::XTransferable >& aXTransferable ) const; - sal_Bool SAL_CALL findLocaleForTextCodePage( ); + static bool SAL_CALL findLocaleForTextCodePage( ); - static sal_Bool SAL_CALL isLocaleOemCodePage( LCID lcid, sal_uInt32 codepage ); - static sal_Bool SAL_CALL isLocaleAnsiCodePage( LCID lcid, sal_uInt32 codepage ); - static sal_Bool SAL_CALL isLocaleCodePage( LCID lcid, LCTYPE lctype, sal_uInt32 codepage ); + static bool SAL_CALL isLocaleOemCodePage( LCID lcid, sal_uInt32 codepage ); + static bool SAL_CALL isLocaleAnsiCodePage( LCID lcid, sal_uInt32 codepage ); + static bool SAL_CALL isLocaleCodePage( LCID lcid, LCTYPE lctype, sal_uInt32 codepage ); static BOOL CALLBACK EnumLocalesProc( LPSTR lpLocaleStr ); private: const CDataFormatTranslator& m_DataFormatTranslator; - sal_Bool m_bHasSynthesizedLocale; + bool m_bHasSynthesizedLocale; css::datatransfer::DataFlavor m_RegisteredTextFlavor; const css::uno::Reference< css::uno::XComponentContext > m_xContext; diff --git a/dtrans/source/win32/dtobj/FmtFilter.cxx b/dtrans/source/win32/dtobj/FmtFilter.cxx index ea66d37a17c0..fc9681f28448 100644 --- a/dtrans/source/win32/dtobj/FmtFilter.cxx +++ b/dtrans/source/win32/dtobj/FmtFilter.cxx @@ -65,7 +65,7 @@ Sequence< sal_Int8 > SAL_CALL WinMFPictToOOMFPict( Sequence< sal_Int8 >& aMetaFi Sequence< sal_Int8 > mfpictStream; METAFILEPICT* pMFPict = reinterpret_cast< METAFILEPICT* >( aMetaFilePict.getArray( ) ); HMETAFILE hMf = pMFPict->hMF; - sal_uInt32 nCount = GetMetaFileBitsEx( hMf, 0, NULL ); + sal_uInt32 nCount = GetMetaFileBitsEx( hMf, 0, nullptr ); if ( nCount > 0 ) { @@ -134,11 +134,11 @@ Sequence< sal_Int8 > SAL_CALL WinENHMFPictToOOMFPict( HENHMETAFILE hEnhMetaFile UINT nSize = 0; if( hEnhMetaFile && - ( ( nSize = GetEnhMetaFileBits( hEnhMetaFile, 0, NULL ) ) != 0 ) ) + ( ( nSize = GetEnhMetaFileBits( hEnhMetaFile, 0, nullptr ) ) != 0 ) ) { aRet.realloc( nSize ); - if( GetEnhMetaFileBits( hEnhMetaFile, nSize, (unsigned char*) aRet.getArray() ) != nSize ) + if( GetEnhMetaFileBits( hEnhMetaFile, nSize, reinterpret_cast<unsigned char*>(aRet.getArray()) ) != nSize ) aRet.realloc( 0 ); } @@ -149,12 +149,12 @@ Sequence< sal_Int8 > SAL_CALL WinENHMFPictToOOMFPict( HENHMETAFILE hEnhMetaFile HMETAFILEPICT SAL_CALL OOMFPictToWinMFPict( Sequence< sal_Int8 >& aOOMetaFilePict ) { - HMETAFILEPICT hPict = NULL; - HMETAFILE hMtf = SetMetaFileBitsEx( aOOMetaFilePict.getLength(), (unsigned char*) aOOMetaFilePict.getConstArray() ); + HMETAFILEPICT hPict = nullptr; + HMETAFILE hMtf = SetMetaFileBitsEx( aOOMetaFilePict.getLength(), reinterpret_cast<unsigned char const *>(aOOMetaFilePict.getConstArray()) ); if( hMtf ) { - METAFILEPICT* pPict = (METAFILEPICT*) GlobalLock( hPict = GlobalAlloc( GHND, sizeof( METAFILEPICT ) ) ); + METAFILEPICT* pPict = static_cast<METAFILEPICT*>(GlobalLock( hPict = GlobalAlloc( GHND, sizeof( METAFILEPICT ) ) )); pPict->mm = 8; pPict->xExt = 0; @@ -171,7 +171,7 @@ HMETAFILEPICT SAL_CALL OOMFPictToWinMFPict( Sequence< sal_Int8 >& aOOMetaFilePic HENHMETAFILE SAL_CALL OOMFPictToWinENHMFPict( Sequence< sal_Int8 >& aOOMetaFilePict ) { - HENHMETAFILE hEnhMtf = SetEnhMetaFileBits( aOOMetaFilePict.getLength(), (unsigned char*) aOOMetaFilePict.getConstArray() ); + HENHMETAFILE hEnhMtf = SetEnhMetaFileBits( aOOMetaFilePict.getLength(), reinterpret_cast<unsigned char const *>(aOOMetaFilePict.getConstArray()) ); return hEnhMtf; } @@ -311,7 +311,7 @@ std::wstring getShellLinkTarget(const std::wstring& aLnkFile) { sal::systools::COMReference<IShellLinkA> pIShellLink; HRESULT hr = CoCreateInstance( - CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, reinterpret_cast<LPVOID*>(&pIShellLink)); + CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, reinterpret_cast<LPVOID*>(&pIShellLink)); if (FAILED(hr)) return target; @@ -322,7 +322,7 @@ std::wstring getShellLinkTarget(const std::wstring& aLnkFile) if (FAILED(hr)) return target; - hr = pIShellLink->Resolve(NULL, SLR_UPDATE | SLR_NO_UI); + hr = pIShellLink->Resolve(nullptr, SLR_UPDATE | SLR_NO_UI); if (FAILED(hr)) return target; @@ -387,13 +387,13 @@ ByteSequence_t FileListToByteSequence(const FileList_t& fileList) ByteSequence_t CF_HDROPToFileList(HGLOBAL hGlobal) { - UINT nFiles = DragQueryFileW((HDROP)hGlobal, 0xFFFFFFFF, NULL, 0); + UINT nFiles = DragQueryFileW(static_cast<HDROP>(hGlobal), 0xFFFFFFFF, nullptr, 0); FileList_t files; for (UINT i = 0; i < nFiles; i++) { wchar_t buff[MAX_PATH]; - /*UINT size =*/ DragQueryFileW((HDROP)hGlobal, i, buff, MAX_PATH); + /*UINT size =*/ DragQueryFileW(static_cast<HDROP>(hGlobal), i, buff, MAX_PATH); std::wstring filename = buff; if (isShellLink(filename)) filename = getShellLinkTarget(filename); @@ -417,7 +417,7 @@ Sequence< sal_Int8 > SAL_CALL WinBITMAPToOOBMP( HBITMAP aHBMP ) sizeof(BITMAPINFO) + nDataBytes ); - PBITMAPINFOHEADER pBmp = (PBITMAPINFOHEADER)aBitmapStream.getArray(); + PBITMAPINFOHEADER pBmp = reinterpret_cast<PBITMAPINFOHEADER>(aBitmapStream.getArray()); pBmp->biSize = sizeof( BITMAPINFOHEADER ); pBmp->biWidth = aBmpSize.cx; pBmp->biHeight = aBmpSize.cy; @@ -429,11 +429,11 @@ Sequence< sal_Int8 > SAL_CALL WinBITMAPToOOBMP( HBITMAP aHBMP ) pBmp->biYPelsPerMeter = 1000; pBmp->biClrUsed = 0; pBmp->biClrImportant = 0; - if( GetDIBits( 0, // DC, 0 is a default GC, basically that of the desktop + if( GetDIBits( nullptr, // DC, 0 is a default GC, basically that of the desktop aHBMP, 0, aBmpSize.cy, aBitmapStream.getArray() + sizeof(BITMAPINFO), - (LPBITMAPINFO)pBmp, + reinterpret_cast<LPBITMAPINFO>(pBmp), DIB_RGB_COLORS ) ) { ooBmpStream = WinDIBToOOBMP( aBitmapStream ); diff --git a/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx b/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx index f3560204fad5..529a0b49969f 100644 --- a/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx +++ b/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx @@ -33,7 +33,7 @@ int CalcBuffSizeForTextConversion( UINT code_page, LPCSTR lpMultiByteString, int 0, lpMultiByteString, nLen, - NULL, + nullptr, 0 ) * sizeof( sal_Unicode ) ); } @@ -45,10 +45,10 @@ int CalcBuffSizeForTextConversion( UINT code_page, LPCWSTR lpWideCharString, int 0, lpWideCharString, nLen, - NULL, + nullptr, 0, - NULL, - NULL ); + nullptr, + nullptr ); } // converts text in one code page into unicode text @@ -62,7 +62,7 @@ int MultiByteToWideCharEx( UINT cp_src, BOOL bEnsureTrailingZero ) { OSL_ASSERT( IsValidCodePage( cp_src ) ); - OSL_ASSERT( NULL != lpMultiByteString ); + OSL_ASSERT( nullptr != lpMultiByteString ); // calculate the required buff size int reqSize = CalcBuffSizeForTextConversion( cp_src, lpMultiByteString, lenStr ); @@ -96,7 +96,7 @@ int WideCharToMultiByteEx( UINT cp_dest, BOOL bEnsureTrailingZero ) { OSL_ASSERT( IsValidCodePage( cp_dest ) ); - OSL_ASSERT( NULL != lpWideCharString ); + OSL_ASSERT( nullptr != lpWideCharString ); // calculate the required buff size int reqSize = CalcBuffSizeForTextConversion( cp_dest, lpWideCharString, lenStr ); @@ -117,8 +117,8 @@ int WideCharToMultiByteEx( UINT cp_dest, lenStr, static_cast< LPSTR >( ptrHGlob.GetMemPtr( ) ), ptrHGlob.MemSize( ), - NULL, - NULL ); + nullptr, + nullptr ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx b/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx index 35b42e6801bc..c18e32912111 100644 --- a/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx +++ b/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx @@ -49,17 +49,17 @@ CXNotifyingDataObject::CXNotifyingDataObject( STDMETHODIMP CXNotifyingDataObject::QueryInterface( REFIID iid, LPVOID* ppvObject ) { - if ( NULL == ppvObject ) + if ( nullptr == ppvObject ) return E_INVALIDARG; HRESULT hr = E_NOINTERFACE; - *ppvObject = NULL; + *ppvObject = nullptr; if ( ( __uuidof( IUnknown ) == iid ) || ( __uuidof( IDataObject ) == iid ) ) { *ppvObject = static_cast< IUnknown* >( this ); - ( (LPUNKNOWN)*ppvObject )->AddRef( ); + static_cast<LPUNKNOWN>(*ppvObject)->AddRef( ); hr = S_OK; } diff --git a/dtrans/source/win32/dtobj/XNotifyingDataObject.hxx b/dtrans/source/win32/dtobj/XNotifyingDataObject.hxx index 53cdaecea0c4..4e916ce28682 100644 --- a/dtrans/source/win32/dtobj/XNotifyingDataObject.hxx +++ b/dtrans/source/win32/dtobj/XNotifyingDataObject.hxx @@ -56,20 +56,20 @@ public: // ole interface implementation //IUnknown interface methods - STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject); - STDMETHODIMP_( ULONG ) AddRef( ); - STDMETHODIMP_( ULONG ) Release( ); + STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject) override; + STDMETHODIMP_( ULONG ) AddRef( ) override; + STDMETHODIMP_( ULONG ) Release( ) override; // IDataObject interface methods - STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); - STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); - STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ); - STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ); - STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ); - STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ); - STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ); - STDMETHODIMP DUnadvise( DWORD dwConnection ); - STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ); + STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ) override; + STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ) override; + STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ) override; + STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ) override; + STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ) override; + STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ) override; + STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ) override; + STDMETHODIMP DUnadvise( DWORD dwConnection ) override; + STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ) override; operator IDataObject*( ); diff --git a/dtrans/source/win32/dtobj/XTDataObject.cxx b/dtrans/source/win32/dtobj/XTDataObject.cxx index 105c42339226..2ddaf315ab2b 100644 --- a/dtrans/source/win32/dtobj/XTDataObject.cxx +++ b/dtrans/source/win32/dtobj/XTDataObject.cxx @@ -50,6 +50,38 @@ using namespace com::sun::star::datatransfer::clipboard; using namespace com::sun::star::uno; using namespace com::sun::star::lang; +namespace { + +void SAL_CALL setupStgMedium( const FORMATETC& fetc, + CStgTransferHelper& stgTransHlp, + STGMEDIUM& stgmedium ) +{ + stgmedium.pUnkForRelease = nullptr; + + if ( fetc.cfFormat == CF_METAFILEPICT ) + { + stgmedium.tymed = TYMED_MFPICT; + stgmedium.hMetaFilePict = static_cast< HMETAFILEPICT >( stgTransHlp.getHGlobal( ) ); + } + else if ( fetc.cfFormat == CF_ENHMETAFILE ) + { + stgmedium.tymed = TYMED_ENHMF; + stgmedium.hEnhMetaFile = static_cast< HENHMETAFILE >( stgTransHlp.getHGlobal( ) ); + } + else if ( fetc.tymed & TYMED_HGLOBAL ) + { + stgmedium.tymed = TYMED_HGLOBAL; + stgmedium.hGlobal = stgTransHlp.getHGlobal( ); + } + else if ( fetc.tymed & TYMED_ISTREAM ) + { + stgmedium.tymed = TYMED_ISTREAM; + stgTransHlp.getIStream( &stgmedium.pstm ); + } + else + OSL_ASSERT( false ); +} + // a helper class that will be thrown by the function validateFormatEtc class CInvalidFormatEtcException @@ -59,11 +91,90 @@ public: explicit CInvalidFormatEtcException( HRESULT hr ) : m_hr( hr ) {}; }; +inline +void validateFormatEtc( LPFORMATETC lpFormatEtc ) +{ + OSL_ASSERT( lpFormatEtc ); + + if ( lpFormatEtc->lindex != -1 ) + throw CInvalidFormatEtcException( DV_E_LINDEX ); + + if ( !(lpFormatEtc->dwAspect & DVASPECT_CONTENT) && + !(lpFormatEtc->dwAspect & DVASPECT_SHORTNAME) ) + throw CInvalidFormatEtcException( DV_E_DVASPECT ); + + if ( !(lpFormatEtc->tymed & TYMED_HGLOBAL) && + !(lpFormatEtc->tymed & TYMED_ISTREAM) && + !(lpFormatEtc->tymed & TYMED_MFPICT) && + !(lpFormatEtc->tymed & TYMED_ENHMF) ) + throw CInvalidFormatEtcException( DV_E_TYMED ); + + if ( lpFormatEtc->cfFormat == CF_METAFILEPICT && + !(lpFormatEtc->tymed & TYMED_MFPICT) ) + throw CInvalidFormatEtcException( DV_E_TYMED ); + + if ( lpFormatEtc->cfFormat == CF_ENHMETAFILE && + !(lpFormatEtc->tymed & TYMED_ENHMF) ) + throw CInvalidFormatEtcException( DV_E_TYMED ); +} + +inline +void SAL_CALL invalidateStgMedium( STGMEDIUM& stgmedium ) +{ + stgmedium.tymed = TYMED_NULL; +} + +inline +HRESULT SAL_CALL translateStgExceptionCode( HRESULT hr ) +{ + HRESULT hrTransl; + + switch( hr ) + { + case STG_E_MEDIUMFULL: + hrTransl = hr; + break; + + default: + hrTransl = E_UNEXPECTED; + break; + } + + return hrTransl; +} + +// inline +void SAL_CALL renderDataAndSetupStgMedium( + const sal_Int8* lpStorage, const FORMATETC& fetc, sal_uInt32 nInitStgSize, + sal_uInt32 nBytesToTransfer, STGMEDIUM& stgmedium ) +{ + OSL_PRECOND( !nInitStgSize || nInitStgSize && (nInitStgSize >= nBytesToTransfer), + "Memory size less than number of bytes to transfer" ); + + CStgTransferHelper stgTransfHelper( AUTO_INIT ); + + // setup storage size + if ( nInitStgSize > 0 ) + stgTransfHelper.init( nInitStgSize ); + +#if OSL_DEBUG_LEVEL > 0 + sal_uInt32 nBytesWritten = 0; + stgTransfHelper.write( lpStorage, nBytesToTransfer, &nBytesWritten ); + OSL_ASSERT( nBytesWritten == nBytesToTransfer ); +#else + stgTransfHelper.write( lpStorage, nBytesToTransfer ); +#endif + + setupStgMedium( fetc, stgTransfHelper, stgmedium ); +} + +} + CXTDataObject::CXTDataObject( const Reference< XComponentContext >& rxContext, const Reference< XTransferable >& aXTransferable ) : m_nRefCnt( 0 ) , m_XTransferable( aXTransferable ) - , m_bFormatEtcContainerInitialized( sal_False ) + , m_bFormatEtcContainerInitialized( false ) , m_DataFormatTranslator( rxContext ) , m_FormatRegistrar( rxContext, m_DataFormatTranslator ) { @@ -73,17 +184,17 @@ CXTDataObject::CXTDataObject( const Reference< XComponentContext >& rxContext, STDMETHODIMP CXTDataObject::QueryInterface( REFIID iid, LPVOID* ppvObject ) { - if ( NULL == ppvObject ) + if ( nullptr == ppvObject ) return E_INVALIDARG; HRESULT hr = E_NOINTERFACE; - *ppvObject = NULL; + *ppvObject = nullptr; if ( ( __uuidof( IUnknown ) == iid ) || ( __uuidof( IDataObject ) == iid ) ) { *ppvObject = static_cast< IUnknown* >( this ); - ( (LPUNKNOWN)*ppvObject )->AddRef( ); + static_cast<LPUNKNOWN>(*ppvObject)->AddRef( ); hr = S_OK; } @@ -134,7 +245,7 @@ STDMETHODIMP CXTDataObject::GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium HRESULT hr = DV_E_FORMATETC; CFormatEtc aFormatetc(*pFormatetc); - if (m_FormatRegistrar.isSynthesizeableFormat(aFormatetc)) + if (CFormatRegistrar::isSynthesizeableFormat(aFormatetc)) hr = renderSynthesizedFormatAndSetupStgMedium( *pFormatetc, *pmedium ); return hr; @@ -155,38 +266,13 @@ STDMETHODIMP CXTDataObject::GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium return S_OK; } -// inline -void SAL_CALL CXTDataObject::renderDataAndSetupStgMedium( - const sal_Int8* lpStorage, const FORMATETC& fetc, sal_uInt32 nInitStgSize, - sal_uInt32 nBytesToTransfer, STGMEDIUM& stgmedium ) -{ - OSL_PRECOND( !nInitStgSize || nInitStgSize && (nInitStgSize >= nBytesToTransfer), - "Memory size less than number of bytes to transfer" ); - - CStgTransferHelper stgTransfHelper( AUTO_INIT ); - - // setup storage size - if ( nInitStgSize > 0 ) - stgTransfHelper.init( nInitStgSize, GHND ); - -#if OSL_DEBUG_LEVEL > 0 - sal_uInt32 nBytesWritten = 0; - stgTransfHelper.write( lpStorage, nBytesToTransfer, &nBytesWritten ); - OSL_ASSERT( nBytesWritten == nBytesToTransfer ); -#else - stgTransfHelper.write( lpStorage, nBytesToTransfer ); -#endif - - setupStgMedium( fetc, stgTransfHelper, stgmedium ); -} - //inline void SAL_CALL CXTDataObject::renderLocaleAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ) { if ( m_FormatRegistrar.hasSynthesizedLocale( ) ) { - LCID lcid = m_FormatRegistrar.getSynthesizedLocale( ); + LCID lcid = CFormatRegistrar::getSynthesizedLocale( ); renderDataAndSetupStgMedium( reinterpret_cast< sal_Int8* >( &lcid ), fetc, @@ -256,7 +342,7 @@ void SAL_CALL CXTDataObject::renderAnyDataAndSetupStgMedium( aAny >>= clipDataStream; sal_uInt32 nRequiredMemSize = 0; - if ( m_DataFormatTranslator.isOemOrAnsiTextFormat( fetc.cfFormat ) ) + if ( CDataFormatTranslator::isOemOrAnsiTextFormat( fetc.cfFormat ) ) nRequiredMemSize = sizeof( sal_Int8 ) * clipDataStream.getLength( ) + 1; // prepare data for transmision @@ -282,13 +368,13 @@ void SAL_CALL CXTDataObject::renderAnyDataAndSetupStgMedium( { stgmedium.tymed = TYMED_MFPICT; stgmedium.hMetaFilePict = OOMFPictToWinMFPict( clipDataStream ); - stgmedium.pUnkForRelease = NULL; + stgmedium.pUnkForRelease = nullptr; } else if( CF_ENHMETAFILE == fetc.cfFormat ) { stgmedium.tymed = TYMED_ENHMF; stgmedium.hMetaFilePict = OOMFPictToWinENHMFPict( clipDataStream ); - stgmedium.pUnkForRelease = NULL; + stgmedium.pUnkForRelease = nullptr; } else renderDataAndSetupStgMedium( @@ -308,7 +394,7 @@ HRESULT SAL_CALL CXTDataObject::renderSynthesizedFormatAndSetupStgMedium( FORMAT if ( CF_UNICODETEXT == fetc.cfFormat ) // the transferable seems to have only text renderSynthesizedUnicodeAndSetupStgMedium( fetc, stgmedium ); - else if ( m_DataFormatTranslator.isOemOrAnsiTextFormat( fetc.cfFormat ) ) + else if ( CDataFormatTranslator::isOemOrAnsiTextFormat( fetc.cfFormat ) ) // the transferable seems to have only unicode text renderSynthesizedTextAndSetupStgMedium( fetc, stgmedium ); else @@ -358,7 +444,7 @@ void SAL_CALL CXTDataObject::renderSynthesizedUnicodeAndSetupStgMedium( FORMATET CStgTransferHelper stgTransfHelper; MultiByteToWideCharEx( - m_FormatRegistrar.getRegisteredTextCodePage( ), + CFormatRegistrar::getRegisteredTextCodePage( ), reinterpret_cast< char* >( aText.getArray( ) ), aText.getLength( ), stgTransfHelper ); @@ -370,10 +456,10 @@ void SAL_CALL CXTDataObject::renderSynthesizedUnicodeAndSetupStgMedium( FORMATET void SAL_CALL CXTDataObject::renderSynthesizedTextAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ) { - OSL_ASSERT( m_DataFormatTranslator.isOemOrAnsiTextFormat( fetc.cfFormat ) ); + OSL_ASSERT( CDataFormatTranslator::isOemOrAnsiTextFormat( fetc.cfFormat ) ); DataFlavor aFlavor = formatEtcToDataFlavor( - m_DataFormatTranslator.getFormatEtcForClipformat( CF_UNICODETEXT ) ); + CDataFormatTranslator::getFormatEtcForClipformat( CF_UNICODETEXT ) ); Any aAny = m_XTransferable->getTransferData( aFlavor ); @@ -402,7 +488,7 @@ void SAL_CALL CXTDataObject::renderSynthesizedTextAndSetupStgMedium( FORMATETC& void SAL_CALL CXTDataObject::renderSynthesizedHtmlAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ) { - OSL_ASSERT( m_DataFormatTranslator.isHTMLFormat( fetc.cfFormat ) ); + OSL_ASSERT( CDataFormatTranslator::isHTMLFormat( fetc.cfFormat ) ); DataFlavor aFlavor; @@ -441,13 +527,13 @@ void SAL_CALL CXTDataObject::renderSynthesizedHtmlAndSetupStgMedium( FORMATETC& STDMETHODIMP CXTDataObject::EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ) { - if ( NULL == ppenumFormatetc ) + if ( nullptr == ppenumFormatetc ) return E_INVALIDARG; if ( DATADIR_SET == dwDirection ) return E_NOTIMPL; - *ppenumFormatetc = NULL; + *ppenumFormatetc = nullptr; InitializeFormatEtcContainer( ); @@ -469,7 +555,7 @@ STDMETHODIMP CXTDataObject::EnumFormatEtc( STDMETHODIMP CXTDataObject::QueryGetData( LPFORMATETC pFormatetc ) { - if ( (NULL == pFormatetc) || IsBadReadPtr( pFormatetc, sizeof( FORMATETC ) ) ) + if ( (nullptr == pFormatetc) || IsBadReadPtr( pFormatetc, sizeof( FORMATETC ) ) ) return E_INVALIDARG; InitializeFormatEtcContainer( ); @@ -534,7 +620,7 @@ DataFlavor SAL_CALL CXTDataObject::formatEtcToDataFlavor( const FORMATETC& aForm if ( m_FormatRegistrar.hasSynthesizedLocale( ) ) aFlavor = - m_DataFormatTranslator.getDataFlavorFromFormatEtc( aFormatEtc, m_FormatRegistrar.getSynthesizedLocale( ) ); + m_DataFormatTranslator.getDataFlavorFromFormatEtc( aFormatEtc, CFormatRegistrar::getSynthesizedLocale( ) ); else aFlavor = m_DataFormatTranslator.getDataFlavorFromFormatEtc( aFormatEtc ); @@ -544,94 +630,12 @@ DataFlavor SAL_CALL CXTDataObject::formatEtcToDataFlavor( const FORMATETC& aForm return aFlavor; } -inline -void CXTDataObject::validateFormatEtc( LPFORMATETC lpFormatEtc ) const -{ - OSL_ASSERT( lpFormatEtc ); - - if ( lpFormatEtc->lindex != -1 ) - throw CInvalidFormatEtcException( DV_E_LINDEX ); - - if ( !(lpFormatEtc->dwAspect & DVASPECT_CONTENT) && - !(lpFormatEtc->dwAspect & DVASPECT_SHORTNAME) ) - throw CInvalidFormatEtcException( DV_E_DVASPECT ); - - if ( !(lpFormatEtc->tymed & TYMED_HGLOBAL) && - !(lpFormatEtc->tymed & TYMED_ISTREAM) && - !(lpFormatEtc->tymed & TYMED_MFPICT) && - !(lpFormatEtc->tymed & TYMED_ENHMF) ) - throw CInvalidFormatEtcException( DV_E_TYMED ); - - if ( lpFormatEtc->cfFormat == CF_METAFILEPICT && - !(lpFormatEtc->tymed & TYMED_MFPICT) ) - throw CInvalidFormatEtcException( DV_E_TYMED ); - - if ( lpFormatEtc->cfFormat == CF_ENHMETAFILE && - !(lpFormatEtc->tymed & TYMED_ENHMF) ) - throw CInvalidFormatEtcException( DV_E_TYMED ); -} - -void SAL_CALL CXTDataObject::setupStgMedium( const FORMATETC& fetc, - CStgTransferHelper& stgTransHlp, - STGMEDIUM& stgmedium ) -{ - stgmedium.pUnkForRelease = NULL; - - if ( fetc.cfFormat == CF_METAFILEPICT ) - { - stgmedium.tymed = TYMED_MFPICT; - stgmedium.hMetaFilePict = static_cast< HMETAFILEPICT >( stgTransHlp.getHGlobal( ) ); - } - else if ( fetc.cfFormat == CF_ENHMETAFILE ) - { - stgmedium.tymed = TYMED_ENHMF; - stgmedium.hEnhMetaFile = static_cast< HENHMETAFILE >( stgTransHlp.getHGlobal( ) ); - } - else if ( fetc.tymed & TYMED_HGLOBAL ) - { - stgmedium.tymed = TYMED_HGLOBAL; - stgmedium.hGlobal = stgTransHlp.getHGlobal( ); - } - else if ( fetc.tymed & TYMED_ISTREAM ) - { - stgmedium.tymed = TYMED_ISTREAM; - stgTransHlp.getIStream( &stgmedium.pstm ); - } - else - OSL_ASSERT( sal_False ); -} - -inline -void SAL_CALL CXTDataObject::invalidateStgMedium( STGMEDIUM& stgmedium ) const -{ - stgmedium.tymed = TYMED_NULL; -} - -inline -HRESULT SAL_CALL CXTDataObject::translateStgExceptionCode( HRESULT hr ) const -{ - HRESULT hrTransl; - - switch( hr ) - { - case STG_E_MEDIUMFULL: - hrTransl = hr; - break; - - default: - hrTransl = E_UNEXPECTED; - break; - } - - return hrTransl; -} - inline void SAL_CALL CXTDataObject::InitializeFormatEtcContainer( ) { if ( !m_bFormatEtcContainerInitialized ) { m_FormatRegistrar.RegisterFormats( m_XTransferable, m_FormatEtcContainer ); - m_bFormatEtcContainerInitialized = sal_True; + m_bFormatEtcContainerInitialized = true; } } @@ -647,12 +651,12 @@ CEnumFormatEtc::CEnumFormatEtc( LPUNKNOWN lpUnkOuter, const CFormatEtcContainer& STDMETHODIMP CEnumFormatEtc::QueryInterface( REFIID iid, LPVOID* ppvObject ) { - if ( NULL == ppvObject ) + if ( nullptr == ppvObject ) return E_INVALIDARG; HRESULT hr = E_NOINTERFACE; - *ppvObject = NULL; + *ppvObject = nullptr; if ( ( __uuidof( IUnknown ) == iid ) || ( __uuidof( IEnumFORMATETC ) == iid ) ) @@ -693,13 +697,13 @@ STDMETHODIMP_(ULONG) CEnumFormatEtc::Release( ) STDMETHODIMP CEnumFormatEtc::Next( ULONG nRequested, LPFORMATETC lpDest, ULONG* lpFetched ) { if ( ( nRequested < 1 ) || - (( nRequested > 1 ) && ( NULL == lpFetched )) || + (( nRequested > 1 ) && ( nullptr == lpFetched )) || IsBadWritePtr( lpDest, sizeof( FORMATETC ) * nRequested ) ) return E_INVALIDARG; sal_uInt32 nFetched = m_FormatEtcContainer.nextFormatEtc( lpDest, nRequested ); - if ( NULL != lpFetched ) + if ( nullptr != lpFetched ) *lpFetched = nFetched; return (nFetched == nRequested) ? S_OK : S_FALSE; @@ -724,7 +728,7 @@ STDMETHODIMP CEnumFormatEtc::Reset( ) STDMETHODIMP CEnumFormatEtc::Clone( IEnumFORMATETC** ppenum ) { - if ( NULL == ppenum ) + if ( nullptr == ppenum ) return E_INVALIDARG; *ppenum = new CEnumFormatEtc( m_lpUnkOuter, m_FormatEtcContainer ); diff --git a/dtrans/source/win32/dtobj/XTDataObject.hxx b/dtrans/source/win32/dtobj/XTDataObject.hxx index 3d8d71c2c24a..8bf3c10ed8c4 100644 --- a/dtrans/source/win32/dtobj/XTDataObject.hxx +++ b/dtrans/source/win32/dtobj/XTDataObject.hxx @@ -69,32 +69,26 @@ public: // ole interface implementation //IUnknown interface methods - STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject); - STDMETHODIMP_( ULONG ) AddRef( ); - STDMETHODIMP_( ULONG ) Release( ); + STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject) override; + STDMETHODIMP_( ULONG ) AddRef( ) override; + STDMETHODIMP_( ULONG ) Release( ) override; // IDataObject interface methods - STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); - STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); - STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ); - STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ); - STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ); - STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ); - STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ); - STDMETHODIMP DUnadvise( DWORD dwConnection ); - STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ); + STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ) override; + STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ) override; + STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ) override; + STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ) override; + STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ) override; + STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ) override; + STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ) override; + STDMETHODIMP DUnadvise( DWORD dwConnection ) override; + STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ) override; operator IDataObject*( ); private: css::datatransfer::DataFlavor SAL_CALL formatEtcToDataFlavor( const FORMATETC& aFormatEtc ) const; - void SAL_CALL renderDataAndSetupStgMedium( const sal_Int8* lpStorage, - const FORMATETC& fetc, - sal_uInt32 nInitStgSize, - sal_uInt32 nBytesToTransfer, - STGMEDIUM& stgmedium ); - void SAL_CALL renderLocaleAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ); void SAL_CALL renderUnicodeAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ); void SAL_CALL renderAnyDataAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ); @@ -104,22 +98,13 @@ private: void SAL_CALL renderSynthesizedTextAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ); void SAL_CALL renderSynthesizedHtmlAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ); - void SAL_CALL setupStgMedium( const FORMATETC& fetc, - CStgTransferHelper& stgTransHlp, - STGMEDIUM& stgmedium ); - - void validateFormatEtc( LPFORMATETC lpFormatEtc ) const; - void SAL_CALL invalidateStgMedium( STGMEDIUM& stgmedium ) const; - - HRESULT SAL_CALL translateStgExceptionCode( HRESULT hr ) const; - inline void SAL_CALL InitializeFormatEtcContainer( ); private: LONG m_nRefCnt; css::uno::Reference< css::datatransfer::XTransferable > m_XTransferable; CFormatEtcContainer m_FormatEtcContainer; - sal_Bool m_bFormatEtcContainerInitialized; + bool m_bFormatEtcContainerInitialized; CDataFormatTranslator m_DataFormatTranslator; CFormatRegistrar m_FormatRegistrar; }; @@ -131,15 +116,15 @@ public: virtual ~CEnumFormatEtc() {} // IUnknown - STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject ); - STDMETHODIMP_( ULONG ) AddRef( ); - STDMETHODIMP_( ULONG ) Release( ); + STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject ) override; + STDMETHODIMP_( ULONG ) AddRef( ) override; + STDMETHODIMP_( ULONG ) Release( ) override; //IEnumFORMATETC - STDMETHODIMP Next( ULONG nRequested, LPFORMATETC lpDest, ULONG* lpFetched ); - STDMETHODIMP Skip( ULONG celt ); - STDMETHODIMP Reset( ); - STDMETHODIMP Clone( IEnumFORMATETC** ppenum ); + STDMETHODIMP Next( ULONG nRequested, LPFORMATETC lpDest, ULONG* lpFetched ) override; + STDMETHODIMP Skip( ULONG celt ) override; + STDMETHODIMP Reset( ) override; + STDMETHODIMP Clone( IEnumFORMATETC** ppenum ) override; private: LONG m_nRefCnt; diff --git a/dtrans/source/win32/ftransl/ftransl.cxx b/dtrans/source/win32/ftransl/ftransl.cxx index 55fce69266a8..cb62bdd24be4 100644 --- a/dtrans/source/win32/ftransl/ftransl.cxx +++ b/dtrans/source/win32/ftransl/ftransl.cxx @@ -66,9 +66,7 @@ namespace struct FormatEntry { - FormatEntry() {} - - FormatEntry( + FormatEntry( const char *mime_content_type, const char *human_presentable_name, const char *native_format_name, @@ -97,113 +95,6 @@ FormatEntry::FormatEntry( aStandardFormatId = std_clipboard_format_id; } -CDataFormatTranslatorUNO::CDataFormatTranslatorUNO( const Reference< XComponentContext >& rxContext ) : - m_xContext( rxContext ) -{ -} - -Any SAL_CALL CDataFormatTranslatorUNO::getSystemDataTypeFromDataFlavor( const DataFlavor& aDataFlavor ) - throw( RuntimeException ) -{ - Any aAny; - - try - { - Reference< XMimeContentTypeFactory > refXMimeCntFactory = MimeContentTypeFactory::create( m_xContext ); - - Reference< XMimeContentType > - refXMimeCntType( refXMimeCntFactory->createMimeContentType( aDataFlavor.MimeType ) ); - - OUString fullMediaType = refXMimeCntType->getFullMediaType( ); - if ( isTextPlainMediaType( fullMediaType ) ) - { - // default is CF_TEXT - aAny <<= static_cast< sal_Int32 >( CF_TEXT ); - - if ( refXMimeCntType->hasParameter( "charset" ) ) - { - // but maybe it is unicode text or oem text - OUString charset = refXMimeCntType->getParameterValue( "charset" ); - findStandardFormatIdForCharset( charset, aAny ); - } - } - else - { - if (refXMimeCntType->hasParameter(Windows_FormatName)) - { - OUString winfmtname = refXMimeCntType->getParameterValue(Windows_FormatName); - aAny <<= winfmtname; - - setStandardFormatIdForNativeFormatName( winfmtname, aAny ); - } - else - findStdFormatIdOrNativeFormatNameForFullMediaType( refXMimeCntFactory, fullMediaType, aAny ); - } - } - catch( IllegalArgumentException& ) - { - OSL_FAIL( "Invalid content-type detected!" ); - } - catch( NoSuchElementException& ) - { - OSL_FAIL( "Illegal content-type parameter" ); - } - catch( ... ) - { - OSL_FAIL( "Unexpected error" ); - throw; - } - - return aAny; -} - -DataFlavor SAL_CALL CDataFormatTranslatorUNO::getDataFlavorFromSystemDataType( const Any& aSysDataType ) - throw( RuntimeException ) -{ - OSL_PRECOND( aSysDataType.hasValue( ), "Empty system data type delivered" ); - - DataFlavor aFlavor = mkDataFlv( EMPTY_OUSTR, EMPTY_OUSTR, CPPUTYPE_SEQSALINT8 ); - - if ( aSysDataType.getValueType( ) == CPPUTYPE_SALINT32 ) - { - sal_Int32 clipformat = CF_INVALID; - aSysDataType >>= clipformat; - if ( CF_INVALID != clipformat ) - findDataFlavorForStandardFormatId( clipformat, aFlavor ); - } - else if ( aSysDataType.getValueType( ) == CPPUTYPE_OUSTR ) - { - OUString nativeFormatName; - aSysDataType >>= nativeFormatName; - - findDataFlavorForNativeFormatName( nativeFormatName, aFlavor ); - } - else - OSL_FAIL( "Invalid data type received" ); - - return aFlavor; -} - -// XServiceInfo - -OUString SAL_CALL CDataFormatTranslatorUNO::getImplementationName( ) - throw( RuntimeException ) -{ - return OUString( IMPL_NAME ); -} - -sal_Bool SAL_CALL CDataFormatTranslatorUNO::supportsService( const OUString& ServiceName ) - throw( RuntimeException ) -{ - return cppu::supportsService(this, ServiceName); -} - -Sequence< OUString > SAL_CALL CDataFormatTranslatorUNO::getSupportedServiceNames( ) - throw( RuntimeException ) -{ - return DataFormatTranslator_getSupportedServiceNames( ); -} - // to optimize searching we add all entries with a // standard clipboard format number first, in the // table before the entries with CF_INVALID @@ -237,233 +128,235 @@ static const std::vector< FormatEntry > g_TranslTable { //SotClipboardFormatId::SYLK FormatEntry("application/x-openoffice-sylk;windows_formatname=\"Sylk\"", "Sylk", "Sylk", CF_SYLK, CPPUTYPE_DEFAULT ), // SotClipboardFormatId::GDIMETAFILE - FormatEntry("application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"", "GDIMetaFile", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"", "GDIMetaFile", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::PRIVATE - FormatEntry("application/x-openoffice-private;windows_formatname=\"Private\"", "Private", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-private;windows_formatname=\"Private\"", "Private", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::SIMPLE_FILE - FormatEntry("application/x-openoffice-file;windows_formatname=\"FileName\"", "FileName", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-file;windows_formatname=\"FileName\"", "FileName", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::RTF - FormatEntry("text/richtext", "Rich Text Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("text/richtext", "Rich Text Format", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::DRAWING - FormatEntry("application/x-openoffice-drawing;windows_formatname=\"Drawing Format\"", "Drawing Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-drawing;windows_formatname=\"Drawing Format\"", "Drawing Format", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::SVXB - FormatEntry("application/x-openoffice-svbx;windows_formatname=\"SVXB (StarView Bitmap/Animation)\"", "SVXB (StarView Bitmap/Animation)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-svbx;windows_formatname=\"SVXB (StarView Bitmap/Animation)\"", "SVXB (StarView Bitmap/Animation)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::SVIM - FormatEntry("application/x-openoffice-svim;windows_formatname=\"SVIM (StarView ImageMap)\"", "SVIM (StarView ImageMap)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-svim;windows_formatname=\"SVIM (StarView ImageMap)\"", "SVIM (StarView ImageMap)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::XFA - FormatEntry("application/x-openoffice-xfa;windows_formatname=\"XFA (XOutDev FillAttr)\"", "XFA (XOutDev FillAttr)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-xfa;windows_formatname=\"XFA (XOutDev FillAttr)\"", "XFA (XOutDev FillAttr)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::EDITENGINE - FormatEntry("application/x-openoffice-editengine;windows_formatname=\"EditEngineFormat\"", "EditEngineFormat", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-editengine;windows_formatname=\"EditEngineFormat\"", "EditEngineFormat", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::INTERNALLINK_STATE - FormatEntry("application/x-openoffice-internallink-state;windows_formatname=\"StatusInfo vom SvxInternalLink\"", "StatusInfo vom SvxInternalLink", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-internallink-state;windows_formatname=\"StatusInfo vom SvxInternalLink\"", "StatusInfo vom SvxInternalLink", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::SOLK - FormatEntry("application/x-openoffice-solk;windows_formatname=\"SOLK (StarOffice Link)\"", "SOLK (StarOffice Link)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-solk;windows_formatname=\"SOLK (StarOffice Link)\"", "SOLK (StarOffice Link)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::NETSCAPE_BOOKMARK - FormatEntry("application/x-openoffice-netscape-bookmark;windows_formatname=\"Netscape Bookmark\"", "Netscape Bookmark", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-netscape-bookmark;windows_formatname=\"Netscape Bookmark\"", "Netscape Bookmark", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::TREELISTBOX - FormatEntry("application/x-openoffice-treelistbox;windows_formatname=\"SV_LBOX_DD_FORMAT\"", "SV_LBOX_DD_FORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-treelistbox;windows_formatname=\"SV_LBOX_DD_FORMAT\"", "SV_LBOX_DD_FORMAT", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::NATIVE - FormatEntry("application/x-openoffice-native;windows_formatname=\"Native\"", "Native", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-native;windows_formatname=\"Native\"", "Native", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::OWNERLINK - FormatEntry("application/x-openoffice-ownerlink;windows_formatname=\"OwnerLink\"", "OwnerLink", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-ownerlink;windows_formatname=\"OwnerLink\"", "OwnerLink", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::STARSERVER - FormatEntry("application/x-openoffice-starserver;windows_formatname=\"StarServerFormat\"", "StarServerFormat", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starserver;windows_formatname=\"StarServerFormat\"", "StarServerFormat", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::STAROBJECT - FormatEntry("application/x-openoffice-starobject;windows_formatname=\"StarObjectFormat\"", "StarObjectFormat", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starobject;windows_formatname=\"StarObjectFormat\"", "StarObjectFormat", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::APPLETOBJECT - FormatEntry("application/x-openoffice-appletobject;windows_formatname=\"Applet Object\"", "Applet Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-appletobject;windows_formatname=\"Applet Object\"", "Applet Object", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::PLUGIN_OBJECT - FormatEntry("application/x-openoffice-plugin-object;windows_formatname=\"PlugIn Object\"", "PlugIn Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-plugin-object;windows_formatname=\"PlugIn Object\"", "PlugIn Object", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::STARWRITER_30 - FormatEntry("application/x-openoffice-starwriter-30;windows_formatname=\"StarWriter 3.0\"", "StarWriter 3.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starwriter-30;windows_formatname=\"StarWriter 3.0\"", "StarWriter 3.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARWRITER_40 - FormatEntry("application/x-openoffice-starwriter-40;windows_formatname=\"StarWriter 4.0\"", "StarWriter 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starwriter-40;windows_formatname=\"StarWriter 4.0\"", "StarWriter 4.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARWRITER_50 - FormatEntry("application/x-openoffice-starwriter-50;windows_formatname=\"StarWriter 5.0\"", "StarWriter 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starwriter-50;windows_formatname=\"StarWriter 5.0\"", "StarWriter 5.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARWRITERWEB_40 - FormatEntry("application/x-openoffice-starwriterweb-40;windows_formatname=\"StarWriter/Web 4.0\"", "StarWriter/Web 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starwriterweb-40;windows_formatname=\"StarWriter/Web 4.0\"", "StarWriter/Web 4.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARWRITERWEB_50 - FormatEntry("application/x-openoffice-starwriterweb-50;windows_formatname=\"StarWriter/Web 5.0\"", "StarWriter/Web 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starwriterweb-50;windows_formatname=\"StarWriter/Web 5.0\"", "StarWriter/Web 5.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARWRITERGLOB_40 - FormatEntry("application/x-openoffice-starwriterglob-40;windows_formatname=\"StarWriter/Global 4.0\"", "StarWriter/Global 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starwriterglob-40;windows_formatname=\"StarWriter/Global 4.0\"", "StarWriter/Global 4.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::STARWRITERGLOB_50 - FormatEntry("application/x-openoffice-starwriterglob-50;windows_formatname=\"StarWriter/Global 5.0\"", "StarWriter/Global 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starwriterglob-50;windows_formatname=\"StarWriter/Global 5.0\"", "StarWriter/Global 5.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARDRAW - FormatEntry("application/x-openoffice-stardraw;windows_formatname=\"StarDrawDocument\"", "StarDrawDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-stardraw;windows_formatname=\"StarDrawDocument\"", "StarDrawDocument", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARDRAW_40 - FormatEntry("application/x-openoffice-stardraw-40;windows_formatname=\"StarDrawDocument 4.0\"", "StarDrawDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-stardraw-40;windows_formatname=\"StarDrawDocument 4.0\"", "StarDrawDocument 4.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARIMPRESS_50 - FormatEntry("application/x-openoffice-starimpress-50;windows_formatname=\"StarImpress 5.0\"", "StarImpress 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starimpress-50;windows_formatname=\"StarImpress 5.0\"", "StarImpress 5.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::STARDRAW_50 - FormatEntry("application/x-openoffice-stardraw-50;windows_formatname=\"StarDraw 5.0\"", "StarDraw 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-stardraw-50;windows_formatname=\"StarDraw 5.0\"", "StarDraw 5.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARCALC - FormatEntry("application/x-openoffice-starcalc;windows_formatname=\"StarCalcDocument\"", "StarCalcDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starcalc;windows_formatname=\"StarCalcDocument\"", "StarCalcDocument", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARCALC_40 - FormatEntry("application/x-openoffice-starcalc-40;windows_formatname=\"StarCalc 4.0\"", "StarCalc 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starcalc-40;windows_formatname=\"StarCalc 4.0\"", "StarCalc 4.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::STARCALC_50 - FormatEntry("application/x-openoffice-starcalc-50;windows_formatname=\"StarCalc 5.0\"", "StarCalc 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starcalc-50;windows_formatname=\"StarCalc 5.0\"", "StarCalc 5.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::STARCHART - FormatEntry("application/x-openoffice-starchart;windows_formatname=\"StarChartDocument\"", "StarChartDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starchart;windows_formatname=\"StarChartDocument\"", "StarChartDocument", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::STARCHART_40 - FormatEntry("application/x-openoffice-starchart-40;windows_formatname=\"StarChartDocument 4.0\"", "StarChartDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starchart-40;windows_formatname=\"StarChartDocument 4.0\"", "StarChartDocument 4.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::STARCHART_50 - FormatEntry("application/x-openoffice-starchart-50;windows_formatname=\"StarChart 5.0\"", "StarChart 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starchart-50;windows_formatname=\"StarChart 5.0\"", "StarChart 5.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARIMAGE - FormatEntry("application/x-openoffice-starimage;windows_formatname=\"StarImageDocument\"", "StarImageDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starimage;windows_formatname=\"StarImageDocument\"", "StarImageDocument", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARIMAGE_40 - FormatEntry("application/x-openoffice-starimage-40;windows_formatname=\"StarImageDocument 4.0\"", "StarImageDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starimage-40;windows_formatname=\"StarImageDocument 4.0\"", "StarImageDocument 4.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARIMAGE_50 - FormatEntry("application/x-openoffice-starimage-50;windows_formatname=\"StarImage 5.0\"", "StarImage 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starimage-50;windows_formatname=\"StarImage 5.0\"", "StarImage 5.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARMATH - FormatEntry("application/x-openoffice-starmath;windows_formatname=\"StarMath\"", "StarMath", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starmath;windows_formatname=\"StarMath\"", "StarMath", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARMATH_40 - FormatEntry("application/x-openoffice-starmath-40;windows_formatname=\"StarMathDocument 4.0\"", "StarMathDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starmath-40;windows_formatname=\"StarMathDocument 4.0\"", "StarMathDocument 4.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARMATH_50 - FormatEntry("application/x-openoffice-starmath-50;windows_formatname=\"StarMath 5.0\"", "StarMath 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starmath-50;windows_formatname=\"StarMath 5.0\"", "StarMath 5.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STAROBJECT_PAINTDOC - FormatEntry("application/x-openoffice-starobject-paintdoc;windows_formatname=\"StarObjectPaintDocument\"", "StarObjectPaintDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starobject-paintdoc;windows_formatname=\"StarObjectPaintDocument\"", "StarObjectPaintDocument", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::FILLED_AREA - FormatEntry("application/x-openoffice-filled-area;windows_formatname=\"FilledArea\"", "FilledArea", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-filled-area;windows_formatname=\"FilledArea\"", "FilledArea", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::HTML - FormatEntry("text/html", "HTML (HyperText Markup Language)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("text/html", "HTML (HyperText Markup Language)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::HTML_SIMPLE - FormatEntry("application/x-openoffice-html-simple;windows_formatname=\"HTML Format\"", "HTML Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-html-simple;windows_formatname=\"HTML Format\"", "HTML Format", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::CHAOS - FormatEntry("application/x-openoffice-chaos;windows_formatname=\"FORMAT_CHAOS\"", "FORMAT_CHAOS", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-chaos;windows_formatname=\"FORMAT_CHAOS\"", "FORMAT_CHAOS", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::CNT_MSGATTACHFILE - FormatEntry("application/x-openoffice-msgattachfile;windows_formatname=\"CNT_MSGATTACHFILE_FORMAT\"", "CNT_MSGATTACHFILE_FORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-msgattachfile;windows_formatname=\"CNT_MSGATTACHFILE_FORMAT\"", "CNT_MSGATTACHFILE_FORMAT", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::BIFF_5 - FormatEntry("application/x-openoffice-biff5;windows_formatname=\"Biff5\"", "Biff5", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-biff5;windows_formatname=\"Biff5\"", "Biff5", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::BIFF__5 - FormatEntry("application/x-openoffice-biff-5;windows_formatname=\"Biff 5\"", "Biff 5", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-biff-5;windows_formatname=\"Biff 5\"", "Biff 5", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::BIFF_8 - FormatEntry("application/x-openoffice-biff-8;windows_formatname=\"Biff8\"", "Biff8", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-biff-8;windows_formatname=\"Biff8\"", "Biff8", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SYLK_BIGCAPS - FormatEntry("application/x-openoffice-sylk-bigcaps;windows_formatname=\"SYLK\"", "SYLK", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sylk-bigcaps;windows_formatname=\"SYLK\"", "SYLK", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::LINK - FormatEntry("application/x-openoffice-link;windows_formatname=\"Link\"", "Link", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-link;windows_formatname=\"Link\"", "Link", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARDRAW_TABBAR - FormatEntry("application/x-openoffice-stardraw-tabbar;windows_formatname=\"StarDraw TabBar\"", "StarDraw TabBar", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-stardraw-tabbar;windows_formatname=\"StarDraw TabBar\"", "StarDraw TabBar", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SONLK - FormatEntry("application/x-openoffice-sonlk;windows_formatname=\"SONLK (StarOffice Navi Link)\"", "SONLK (StarOffice Navi Link)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sonlk;windows_formatname=\"SONLK (StarOffice Navi Link)\"", "SONLK (StarOffice Navi Link)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::MSWORD_DOC - FormatEntry("application/msword", "MSWordDoc", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/msword", "MSWordDoc", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STAR_FRAMESET_DOC - FormatEntry("application/x-openoffice-star-frameset-doc;windows_formatname=\"StarFrameSetDocument\"", "StarFrameSetDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-star-frameset-doc;windows_formatname=\"StarFrameSetDocument\"", "StarFrameSetDocument", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::OFFICE_DOC - FormatEntry("application/x-openoffice-office-doc;windows_formatname=\"OfficeDocument\"", "OfficeDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-office-doc;windows_formatname=\"OfficeDocument\"", "OfficeDocument", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::NOTES_DOCINFO - FormatEntry("application/x-openoffice-notes-docinfo;windows_formatname=\"NotesDocInfo\"", "NotesDocInfo", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-notes-docinfo;windows_formatname=\"NotesDocInfo\"", "NotesDocInfo", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::NOTES_HNOTE - FormatEntry("application/x-openoffice-notes-hnote;windows_formatname=\"NoteshNote\"", "NoteshNote", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-notes-hnote;windows_formatname=\"NoteshNote\"", "NoteshNote", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::NOTES_NATIVE - FormatEntry("application/x-openoffice-notes-native;windows_formatname=\"Native\"", "Native", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-notes-native;windows_formatname=\"Native\"", "Native", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SFX_DOC - FormatEntry("application/x-openoffice-sfx-doc;windows_formatname=\"SfxDocument\"", "SfxDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sfx-doc;windows_formatname=\"SfxDocument\"", "SfxDocument", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::EVDF - FormatEntry("application/x-openoffice-evdf;windows_formatname=\"EVDF (Explorer View Dummy Format)\"", "EVDF (Explorer View Dummy Format)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-evdf;windows_formatname=\"EVDF (Explorer View Dummy Format)\"", "EVDF (Explorer View Dummy Format)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::ESDF - FormatEntry("application/x-openoffice-esdf;windows_formatname=\"ESDF (Explorer Search Dummy Format)\"", "ESDF (Explorer Search Dummy Format)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-esdf;windows_formatname=\"ESDF (Explorer Search Dummy Format)\"", "ESDF (Explorer Search Dummy Format)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::IDF - FormatEntry("application/x-openoffice-idf;windows_formatname=\"IDF (Iconview Dummy Format)\"", "IDF (Iconview Dummy Format)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-idf;windows_formatname=\"IDF (Iconview Dummy Format)\"", "IDF (Iconview Dummy Format)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::EFTP - FormatEntry("application/x-openoffice-eftp;windows_formatname=\"EFTP (Explorer Ftp File)\"", "EFTP (Explorer Ftp File)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-eftp;windows_formatname=\"EFTP (Explorer Ftp File)\"", "EFTP (Explorer Ftp File)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::EFD - FormatEntry("application/x-openoffice-efd;windows_formatname=\"EFD (Explorer Ftp Dir)\"", "EFD (Explorer Ftp Dir)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-efd;windows_formatname=\"EFD (Explorer Ftp Dir)\"", "EFD (Explorer Ftp Dir)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SVX_FORMFIELDEXCH - FormatEntry("application/x-openoffice-svx-formfieldexch;windows_formatname=\"SvxFormFieldExch\"", "SvxFormFieldExch", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-svx-formfieldexch;windows_formatname=\"SvxFormFieldExch\"", "SvxFormFieldExch", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::EXTENDED_TABBAR - FormatEntry("application/x-openoffice-extended-tabbar;windows_formatname=\"ExtendedTabBar\"", "ExtendedTabBar", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-extended-tabbar;windows_formatname=\"ExtendedTabBar\"", "ExtendedTabBar", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SBA_DATAEXCHANGE - FormatEntry("application/x-openoffice-sba-dataexchange;windows_formatname=\"SBA-DATAFORMAT\"", "SBA-DATAFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sba-dataexchange;windows_formatname=\"SBA-DATAFORMAT\"", "SBA-DATAFORMAT", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SBA_FIELDDATAEXCHANGE - FormatEntry("application/x-openoffice-sba-fielddataexchange;windows_formatname=\"SBA-FIELDFORMAT\"", "SBA-FIELDFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sba-fielddataexchange;windows_formatname=\"SBA-FIELDFORMAT\"", "SBA-FIELDFORMAT", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SBA_PRIVATE_URL - FormatEntry("application/x-openoffice-sba-private-url;windows_formatname=\"SBA-PRIVATEURLFORMAT\"", "SBA-PRIVATEURLFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sba-private-url;windows_formatname=\"SBA-PRIVATEURLFORMAT\"", "SBA-PRIVATEURLFORMAT", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SBA_TABED - FormatEntry("application/x-openoffice-sba-tabed;windows_formatname=\"Tabed\"", "Tabed", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sba-tabed;windows_formatname=\"Tabed\"", "Tabed", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SBA_TABID - FormatEntry("application/x-openoffice-sba-tabid;windows_formatname=\"Tabid\"", "Tabid", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sba-tabid;windows_formatname=\"Tabid\"", "Tabid", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SBA_JOIN - FormatEntry("application/x-openoffice-sba-join;windows_formatname=\"SBA-JOINFORMAT\"", "SBA-JOINFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sba-join;windows_formatname=\"SBA-JOINFORMAT\"", "SBA-JOINFORMAT", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::OBJECTDESCRIPTOR - FormatEntry("application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"", "Star Object Descriptor (XML)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"", "Star Object Descriptor (XML)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::LINKSRCDESCRIPTOR - FormatEntry("application/x-openoffice-linksrcdescriptor-xml;windows_formatname=\"Star Link Source Descriptor (XML)\"", "Star Link Source Descriptor (XML)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-linksrcdescriptor-xml;windows_formatname=\"Star Link Source Descriptor (XML)\"", "Star Link Source Descriptor (XML)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::EMBED_SOURCE - FormatEntry("application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"", "Star Embed Source (XML)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"", "Star Embed Source (XML)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::LINK_SOURCE - FormatEntry("application/x-openoffice-link-source-xml;windows_formatname=\"Star Link Source (XML)\"", "Star Link Source (XML)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-link-source-xml;windows_formatname=\"Star Link Source (XML)\"", "Star Link Source (XML)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::EMBEDDED_OBJ - FormatEntry("application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star Embedded Object (XML)\"", "Star Embedded Object (XML)", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star Embedded Object (XML)\"", "Star Embedded Object (XML)", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::FILECONTENT - FormatEntry("application/x-openoffice-filecontent;windows_formatname=\"" CFSTR_FILECONTENTS "\"", CFSTR_FILECONTENTS, NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-filecontent;windows_formatname=\"" CFSTR_FILECONTENTS "\"", CFSTR_FILECONTENTS, nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::FILEGRPDESCRIPTOR - FormatEntry("application/x-openoffice-filegrpdescriptor;windows_formatname=\"" CFSTR_FILEDESCRIPTOR "\"", CFSTR_FILEDESCRIPTOR, NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-filegrpdescriptor;windows_formatname=\"" CFSTR_FILEDESCRIPTOR "\"", CFSTR_FILEDESCRIPTOR, nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::FILENAME - FormatEntry("application/x-openoffice-filename;windows_formatname=\"" CFSTR_FILENAME "\"", CFSTR_FILENAME, NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-filename;windows_formatname=\"" CFSTR_FILENAME "\"", CFSTR_FILENAME, nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SD_OLE - FormatEntry("application/x-openoffice-sd-ole;windows_formatname=\"SD-OLE\"", "SD-OLE", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sd-ole;windows_formatname=\"SD-OLE\"", "SD-OLE", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::EMBEDDED_OBJ_OLE - FormatEntry("application/x-openoffice-embedded-obj-ole;windows_formatname=\"Embedded Object\"", "Embedded Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-embedded-obj-ole;windows_formatname=\"Embedded Object\"", "Embedded Object", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::EMBED_SOURCE_OLE - FormatEntry("application/x-openoffice-embed-source-ole;windows_formatname=\"Embed Source\"", "Embed Source", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-embed-source-ole;windows_formatname=\"Embed Source\"", "Embed Source", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::OBJECTDESCRIPTOR_OLE - FormatEntry("application/x-openoffice-objectdescriptor-ole;windows_formatname=\"Object Descriptor\"", "Object Descriptor", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-objectdescriptor-ole;windows_formatname=\"Object Descriptor\"", "Object Descriptor", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::LINKSRCDESCRIPTOR_OLE - FormatEntry("application/x-openoffice-linkdescriptor-ole;windows_formatname=\"Link Source Descriptor\"", "Link Source Descriptor", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-linkdescriptor-ole;windows_formatname=\"Link Source Descriptor\"", "Link Source Descriptor", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::LINK_SOURCE_OLE - FormatEntry("application/x-openoffice-link-source-ole;windows_formatname=\"Link Source\"", "Link Source", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-link-source-ole;windows_formatname=\"Link Source\"", "Link Source", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SBA_CTRLDATAEXCHANGE - FormatEntry("application/x-openoffice-sba-ctrldataexchange;windows_formatname=\"SBA-CTRLFORMAT\"", "SBA-CTRLFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sba-ctrldataexchange;windows_formatname=\"SBA-CTRLFORMAT\"", "SBA-CTRLFORMAT", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::OUTPLACE_OBJ - FormatEntry("application/x-openoffice-outplace-obj;windows_formatname=\"OutPlace Object\"", "OutPlace Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-outplace-obj;windows_formatname=\"OutPlace Object\"", "OutPlace Object", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::CNT_OWN_CLIP - FormatEntry("application/x-openoffice-cnt-own-clip;windows_formatname=\"CntOwnClipboard\"", "CntOwnClipboard", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-cnt-own-clip;windows_formatname=\"CntOwnClipboard\"", "CntOwnClipboard", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::INET_IMAGE - FormatEntry("application/x-openoffice-inet-image;windows_formatname=\"SO-INet-Image\"", "SO-INet-Image", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-inet-image;windows_formatname=\"SO-INet-Image\"", "SO-INet-Image", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::NETSCAPE_IMAGE - FormatEntry("application/x-openoffice-netscape-image;windows_formatname=\"Netscape Image Format\"", "Netscape Image Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-netscape-image;windows_formatname=\"Netscape Image Format\"", "Netscape Image Format", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SBA_FORMEXCHANGE - FormatEntry("application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\"", "SBA_FORMEXCHANGE", NULL, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SBA_REPORTEXCHANGE - FormatEntry("application/x-openoffice-sba-reportexchange;windows_formatname=\"SBA_REPORTEXCHANGE\"", "SBA_REPORTEXCHANGE", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\"", "SBA_FORMEXCHANGE", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::SBA_REPORTEXCHANGE + FormatEntry("application/x-openoffice-sba-reportexchange;windows_formatname=\"SBA_REPORTEXCHANGE\"", "SBA_REPORTEXCHANGE", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::UNIFORMRESOURCELOCATOR - FormatEntry("application/x-openoffice-uniformresourcelocator;windows_formatname=\"UniformResourceLocator\"", "UniformResourceLocator", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-uniformresourcelocator;windows_formatname=\"UniformResourceLocator\"", "UniformResourceLocator", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARCHARTDOCUMENT_50 - FormatEntry("application/x-openoffice-starchartdocument-50;windows_formatname=\"StarChartDocument 5.0\"", "StarChartDocument 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-starchartdocument-50;windows_formatname=\"StarChartDocument 5.0\"", "StarChartDocument 5.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::GRAPHOBJ - FormatEntry("application/x-openoffice-graphobj;windows_formatname=\"Graphic Object\"", "Graphic Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-graphobj;windows_formatname=\"Graphic Object\"", "Graphic Object", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARWRITER_60 - FormatEntry("application/vnd.sun.xml.writer", "Writer 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/vnd.sun.xml.writer", "Writer 6.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARWRITERWEB_60 - FormatEntry("application/vnd.sun.xml.writer.web", "Writer/Web 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/vnd.sun.xml.writer.web", "Writer/Web 6.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARWRITERGLOB_60 - FormatEntry("application/vnd.sun.xml.writer.global", "Writer/Global 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/vnd.sun.xml.writer.global", "Writer/Global 6.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARWDRAW_60 - FormatEntry("application/vnd.sun.xml.draw", "Draw 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/vnd.sun.xml.draw", "Draw 6.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARIMPRESS_60 - FormatEntry("application/vnd.sun.xml.impress", "Impress 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/vnd.sun.xml.impress", "Impress 6.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARCALC_60 - FormatEntry("application/vnd.sun.xml.calc", "Calc 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/vnd.sun.xml.calc", "Calc 6.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARCHART_60 - FormatEntry("application/vnd.sun.xml.chart", "Chart 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/vnd.sun.xml.chart", "Chart 6.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::STARMATH_60 - FormatEntry("application/vnd.sun.xml.math", "Math 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/vnd.sun.xml.math", "Math 6.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::DIALOG_60 - FormatEntry("application/vnd.sun.xml.dialog", "Dialog 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/vnd.sun.xml.dialog", "Dialog 6.0", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::BMP - FormatEntry("image/bmp", "Windows Bitmap", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("image/bmp", "Windows Bitmap", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::PNG - FormatEntry("image/png", "PNG", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("image/png", "PNG", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::MATHML - FormatEntry("application/mathml+xml", "MathML", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/mathml+xml", "MathML", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::DUMMY3 - FormatEntry("application/x-openoffice-dummy3;windows_formatname=\"SO_DUMMYFORMAT_3\"", "SO_DUMMYFORMAT_3", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-dummy3;windows_formatname=\"SO_DUMMYFORMAT_3\"", "SO_DUMMYFORMAT_3", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::DUMMY4 - FormatEntry("application/x-openoffice-dummy4;windows_formatname=\"SO_DUMMYFORMAT_4\"", "SO_DUMMYFORMAT_4", NULL, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("application/x-openoffice-dummy4;windows_formatname=\"SO_DUMMYFORMAT_4\"", "SO_DUMMYFORMAT_4", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), }; -void SAL_CALL CDataFormatTranslatorUNO::findDataFlavorForStandardFormatId( sal_Int32 aStandardFormatId, DataFlavor& aDataFlavor ) const +namespace { + +void SAL_CALL findDataFlavorForStandardFormatId( sal_Int32 aStandardFormatId, DataFlavor& aDataFlavor ) { /* we break the for loop if we find the first CF_INVALID @@ -485,7 +378,7 @@ void SAL_CALL CDataFormatTranslatorUNO::findDataFlavorForStandardFormatId( sal_I } } -void SAL_CALL CDataFormatTranslatorUNO::findDataFlavorForNativeFormatName( const OUString& aNativeFormatName, DataFlavor& aDataFlavor ) const +void SAL_CALL findDataFlavorForNativeFormatName( const OUString& aNativeFormatName, DataFlavor& aDataFlavor ) { vector< FormatEntry >::const_iterator citer_end = g_TranslTable.end( ); for ( vector< FormatEntry >::const_iterator citer = g_TranslTable.begin( ); @@ -500,7 +393,7 @@ void SAL_CALL CDataFormatTranslatorUNO::findDataFlavorForNativeFormatName( const } } -void SAL_CALL CDataFormatTranslatorUNO::findStandardFormatIdForCharset( const OUString& aCharset, Any& aAny ) const +void SAL_CALL findStandardFormatIdForCharset( const OUString& aCharset, Any& aAny ) { if ( aCharset.equalsIgnoreAsciiCase( "utf-16" ) ) aAny <<= static_cast< sal_Int32 >( CF_UNICODETEXT ); @@ -512,7 +405,7 @@ void SAL_CALL CDataFormatTranslatorUNO::findStandardFormatIdForCharset( const OU } } -void SAL_CALL CDataFormatTranslatorUNO::setStandardFormatIdForNativeFormatName( const OUString& aNativeFormatName, Any& aAny ) const +void SAL_CALL setStandardFormatIdForNativeFormatName( const OUString& aNativeFormatName, Any& aAny ) { vector< FormatEntry >::const_iterator citer_end = g_TranslTable.end( ); for ( vector< FormatEntry >::const_iterator citer = g_TranslTable.begin( ); citer != citer_end; ++citer ) @@ -526,10 +419,10 @@ void SAL_CALL CDataFormatTranslatorUNO::setStandardFormatIdForNativeFormatName( } } -void SAL_CALL CDataFormatTranslatorUNO::findStdFormatIdOrNativeFormatNameForFullMediaType( +void SAL_CALL findStdFormatIdOrNativeFormatNameForFullMediaType( const Reference< XMimeContentTypeFactory >& aRefXMimeFactory, const OUString& aFullMediaType, - Any& aAny ) const + Any& aAny ) { vector< FormatEntry >::const_iterator citer_end = g_TranslTable.end( ); for ( vector< FormatEntry >::const_iterator citer = g_TranslTable.begin( ); citer != citer_end; ++citer ) @@ -552,12 +445,12 @@ void SAL_CALL CDataFormatTranslatorUNO::findStdFormatIdOrNativeFormatNameForFull } } -inline sal_Bool CDataFormatTranslatorUNO::isTextPlainMediaType( const OUString& fullMediaType ) const +inline bool isTextPlainMediaType( const OUString& fullMediaType ) { return fullMediaType.equalsIgnoreAsciiCase("text/plain"); } -DataFlavor SAL_CALL CDataFormatTranslatorUNO::mkDataFlv(const OUString& cnttype, const OUString& hpname, Type dtype) +DataFlavor SAL_CALL mkDataFlv(const OUString& cnttype, const OUString& hpname, Type dtype) { DataFlavor dflv; dflv.MimeType = cnttype; @@ -566,4 +459,113 @@ DataFlavor SAL_CALL CDataFormatTranslatorUNO::mkDataFlv(const OUString& cnttype, return dflv; } +} + +CDataFormatTranslatorUNO::CDataFormatTranslatorUNO( const Reference< XComponentContext >& rxContext ) : + m_xContext( rxContext ) +{ +} + +Any SAL_CALL CDataFormatTranslatorUNO::getSystemDataTypeFromDataFlavor( const DataFlavor& aDataFlavor ) + throw( RuntimeException ) +{ + Any aAny; + + try + { + Reference< XMimeContentTypeFactory > refXMimeCntFactory = MimeContentTypeFactory::create( m_xContext ); + + Reference< XMimeContentType > + refXMimeCntType( refXMimeCntFactory->createMimeContentType( aDataFlavor.MimeType ) ); + + OUString fullMediaType = refXMimeCntType->getFullMediaType( ); + if ( isTextPlainMediaType( fullMediaType ) ) + { + // default is CF_TEXT + aAny <<= static_cast< sal_Int32 >( CF_TEXT ); + + if ( refXMimeCntType->hasParameter( "charset" ) ) + { + // but maybe it is unicode text or oem text + OUString charset = refXMimeCntType->getParameterValue( "charset" ); + findStandardFormatIdForCharset( charset, aAny ); + } + } + else + { + if (refXMimeCntType->hasParameter(Windows_FormatName)) + { + OUString winfmtname = refXMimeCntType->getParameterValue(Windows_FormatName); + aAny <<= winfmtname; + + setStandardFormatIdForNativeFormatName( winfmtname, aAny ); + } + else + findStdFormatIdOrNativeFormatNameForFullMediaType( refXMimeCntFactory, fullMediaType, aAny ); + } + } + catch( IllegalArgumentException& ) + { + OSL_FAIL( "Invalid content-type detected!" ); + } + catch( NoSuchElementException& ) + { + OSL_FAIL( "Illegal content-type parameter" ); + } + catch( ... ) + { + OSL_FAIL( "Unexpected error" ); + throw; + } + + return aAny; +} + +DataFlavor SAL_CALL CDataFormatTranslatorUNO::getDataFlavorFromSystemDataType( const Any& aSysDataType ) + throw( RuntimeException ) +{ + OSL_PRECOND( aSysDataType.hasValue( ), "Empty system data type delivered" ); + + DataFlavor aFlavor = mkDataFlv( EMPTY_OUSTR, EMPTY_OUSTR, CPPUTYPE_SEQSALINT8 ); + + if ( aSysDataType.getValueType( ) == CPPUTYPE_SALINT32 ) + { + sal_Int32 clipformat = CF_INVALID; + aSysDataType >>= clipformat; + if ( CF_INVALID != clipformat ) + findDataFlavorForStandardFormatId( clipformat, aFlavor ); + } + else if ( aSysDataType.getValueType( ) == CPPUTYPE_OUSTR ) + { + OUString nativeFormatName; + aSysDataType >>= nativeFormatName; + + findDataFlavorForNativeFormatName( nativeFormatName, aFlavor ); + } + else + OSL_FAIL( "Invalid data type received" ); + + return aFlavor; +} + +// XServiceInfo + +OUString SAL_CALL CDataFormatTranslatorUNO::getImplementationName( ) + throw( RuntimeException ) +{ + return OUString( IMPL_NAME ); +} + +sal_Bool SAL_CALL CDataFormatTranslatorUNO::supportsService( const OUString& ServiceName ) + throw( RuntimeException ) +{ + return cppu::supportsService(this, ServiceName); +} + +Sequence< OUString > SAL_CALL CDataFormatTranslatorUNO::getSupportedServiceNames( ) + throw( RuntimeException ) +{ + return DataFormatTranslator_getSupportedServiceNames( ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/ftransl/ftransl.hxx b/dtrans/source/win32/ftransl/ftransl.hxx index abf486f526d8..82d148f025ea 100644 --- a/dtrans/source/win32/ftransl/ftransl.hxx +++ b/dtrans/source/win32/ftransl/ftransl.hxx @@ -50,34 +50,21 @@ public: // XDataFormatTranslator virtual css::uno::Any SAL_CALL getSystemDataTypeFromDataFlavor( const css::datatransfer::DataFlavor& aDataFlavor ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual css::datatransfer::DataFlavor SAL_CALL getDataFlavorFromSystemDataType( const css::uno::Any& aSysDataType ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; // XServiceInfo virtual OUString SAL_CALL getImplementationName( ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) - throw(css::uno::RuntimeException); + throw(css::uno::RuntimeException) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) - throw(css::uno::RuntimeException); - -private: - void SAL_CALL findDataFlavorForStandardFormatId( sal_Int32 aStandardFormatId, css::datatransfer::DataFlavor& aDataFlavor ) const; - void SAL_CALL findDataFlavorForNativeFormatName( const OUString& aNativeFormatName, css::datatransfer::DataFlavor& aDataFlavor ) const; - void SAL_CALL findStandardFormatIdForCharset( const OUString& aCharset, css::uno::Any& aAny ) const; - void SAL_CALL setStandardFormatIdForNativeFormatName( const OUString& aNativeFormatName, css::uno::Any& aAny ) const; - void SAL_CALL findStdFormatIdOrNativeFormatNameForFullMediaType( - const css::uno::Reference< css::datatransfer::XMimeContentTypeFactory >& aRefXMimeFactory, - const OUString& aFullMediaType, css::uno::Any& aAny ) const; - - sal_Bool isTextPlainMediaType( const OUString& fullMediaType ) const; - - css::datatransfer::DataFlavor SAL_CALL mkDataFlv( const OUString& cnttype, const OUString& hpname, css::uno::Type dtype ); + throw(css::uno::RuntimeException) override; private: const css::uno::Reference< css::uno::XComponentContext > m_xContext; diff --git a/dtrans/source/win32/ftransl/ftranslentry.cxx b/dtrans/source/win32/ftransl/ftranslentry.cxx index 99521ab6c2ec..19f5cd0773ad 100644 --- a/dtrans/source/win32/ftransl/ftranslentry.cxx +++ b/dtrans/source/win32/ftransl/ftranslentry.cxx @@ -53,14 +53,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL ftransl_component_getFactory( const sal_Char* pImplName, void* pSrvManager, void* /*pRegistryKey*/ ) { - void* pRet = 0; + void* pRet = nullptr; if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, IMPL_NAME ) ) ) { Sequence< OUString > aSNS { SERVICE_NAME }; Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory( - reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), + static_cast< XMultiServiceFactory* > ( pSrvManager ), OUString::createFromAscii( pImplName ), createInstance, aSNS ) ); diff --git a/dtrans/source/win32/misc/ImplHelper.cxx b/dtrans/source/win32/misc/ImplHelper.cxx index 29299e0b1fe5..5a3cdb10c71d 100644 --- a/dtrans/source/win32/misc/ImplHelper.cxx +++ b/dtrans/source/win32/misc/ImplHelper.cxx @@ -59,8 +59,7 @@ sal_uInt32 SAL_CALL getWinCPFromMimeCharset( const OUString& charset ) sal_uIntPtr winChrs = rtl_getBestWindowsCharsetFromTextEncoding( txtEnc ); CHARSETINFO chrsInf; - sal_Bool bRet = TranslateCharsetInfo( (DWORD*)winChrs, &chrsInf, TCI_SRCCHARSET ) ? - sal_True : sal_False; + bool bRet = TranslateCharsetInfo( reinterpret_cast<DWORD*>(winChrs), &chrsInf, TCI_SRCCHARSET ); // if one of the above functions fails // we will return the current ANSI codepage @@ -92,7 +91,7 @@ OUString SAL_CALL getWinCPFromLocaleId( LCID lcid, LCTYPE lctype ) winCP = OUString::number( static_cast<sal_Int32>(GetACP( )) ); } else - OSL_ASSERT( sal_False ); + OSL_ASSERT( false ); // we use the GetLocaleInfoA because don't want to provide // a unicode wrapper function for Win9x in sal/systools @@ -105,7 +104,7 @@ OUString SAL_CALL getWinCPFromLocaleId( LCID lcid, LCTYPE lctype ) if ( nResult ) { sal_Int32 len = MultiByteToWideChar( - CP_ACP, 0, buff, -1, NULL, 0 ); + CP_ACP, 0, buff, -1, nullptr, 0 ); OSL_ASSERT( len > 0 ); @@ -141,7 +140,7 @@ OUString SAL_CALL getMimeCharsetFromLocaleId( LCID lcid, LCTYPE lctype, const OU // IsOEMCP -sal_Bool SAL_CALL IsOEMCP( sal_uInt32 codepage ) +bool SAL_CALL IsOEMCP( sal_uInt32 codepage ) { OSL_ASSERT( IsValidCodePage( codepage ) ); @@ -152,9 +151,9 @@ sal_Bool SAL_CALL IsOEMCP( sal_uInt32 codepage ) for ( size_t i = 0; i < SAL_N_ELEMENTS( arrOEMCP ); ++i ) if ( arrOEMCP[i] == codepage ) - return sal_True; + return true; - return sal_False; + return false; } // converts a codepage into its string representation @@ -218,7 +217,7 @@ void SAL_CALL DeleteTargetDevice( DVTARGETDEVICE* ptd ) // if ptdSrc!=NULL and memory allocation fails, then NULL is returned DVTARGETDEVICE* SAL_CALL CopyTargetDevice( DVTARGETDEVICE* ptdSrc ) { - DVTARGETDEVICE* ptdDest = NULL; + DVTARGETDEVICE* ptdDest = nullptr; #if defined ( __MINGW32__ ) && !defined ( _WIN64 ) jmp_buf jmpbuf; @@ -230,7 +229,7 @@ DVTARGETDEVICE* SAL_CALL CopyTargetDevice( DVTARGETDEVICE* ptdSrc ) __try { #endif - if ( NULL != ptdSrc ) + if ( nullptr != ptdSrc ) { ptdDest = static_cast< DVTARGETDEVICE* >( CoTaskMemAlloc( ptdSrc->tdSize ) ); memcpy( ptdDest, ptdSrc, static_cast< size_t >( ptdSrc->tdSize ) ); @@ -270,9 +269,9 @@ DVTARGETDEVICE* SAL_CALL CopyTargetDevice( DVTARGETDEVICE* ptdSrc ) // returns TRUE if copy was successful; // returns FALSE if not successful, e.g. one or both of the pointers // were invalid or the pointers were equal -sal_Bool SAL_CALL CopyFormatEtc( LPFORMATETC petcDest, LPFORMATETC petcSrc ) +bool SAL_CALL CopyFormatEtc( LPFORMATETC petcDest, LPFORMATETC petcSrc ) { - sal_Bool bRet = sal_False; + bool bRet = false; #if defined ( __MINGW32__ ) && !defined ( _WIN64 ) jmp_buf jmpbuf; @@ -289,15 +288,15 @@ sal_Bool SAL_CALL CopyFormatEtc( LPFORMATETC petcDest, LPFORMATETC petcSrc ) petcDest->cfFormat = petcSrc->cfFormat; - petcDest->ptd = NULL; - if ( NULL != petcSrc->ptd ) + petcDest->ptd = nullptr; + if ( nullptr != petcSrc->ptd ) petcDest->ptd = CopyTargetDevice(petcSrc->ptd); petcDest->dwAspect = petcSrc->dwAspect; petcDest->lindex = petcSrc->lindex; petcDest->tymed = petcSrc->tymed; - bRet = sal_True; + bRet = true; } } #if defined ( __MINGW32__ ) && !defined ( _WIN64 ) @@ -388,9 +387,9 @@ sal_Int32 SAL_CALL CompareFormatEtc( const FORMATETC* pFetcLhs, const FORMATETC* return nMatch; } -sal_Bool SAL_CALL CompareTargetDevice( DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE* ptdRight ) +bool SAL_CALL CompareTargetDevice( DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE* ptdRight ) { - sal_Bool bRet = sal_False; + bool bRet = false; #if defined ( __MINGW32__ ) && !defined ( _WIN64 ) jmp_buf jmpbuf; @@ -405,16 +404,16 @@ sal_Bool SAL_CALL CompareTargetDevice( DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE* if ( ptdLeft == ptdRight ) { // same address of td; must be same (handles NULL case) - bRet = sal_True; + bRet = true; } // one ot the two is NULL - else if ( ( NULL != ptdRight ) && ( NULL != ptdLeft ) ) + else if ( ( nullptr != ptdRight ) && ( nullptr != ptdLeft ) ) if ( ptdLeft->tdSize == ptdRight->tdSize ) if ( memcmp( ptdLeft, ptdRight, ptdLeft->tdSize ) == 0 ) - bRet = sal_True; + bRet = true; } #if defined ( __MINGW32__ ) && !defined ( _WIN64 ) else @@ -423,7 +422,7 @@ sal_Bool SAL_CALL CompareTargetDevice( DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE* #endif { OSL_FAIL( "Error CompareTargetDevice" ); - bRet = sal_False; + bRet = false; } #if defined ( __MINGW32__ ) && !defined ( _WIN64 ) han.Reset(); diff --git a/dtrans/source/win32/misc/ImplHelper.hxx b/dtrans/source/win32/misc/ImplHelper.hxx index e612744e8763..a0c32b0ad712 100644 --- a/dtrans/source/win32/misc/ImplHelper.hxx +++ b/dtrans/source/win32/misc/ImplHelper.hxx @@ -33,9 +33,9 @@ // target device and formatetc helper void SAL_CALL DeleteTargetDevice(DVTARGETDEVICE* ptd); -sal_Bool SAL_CALL CopyFormatEtc(LPFORMATETC petcDest, LPFORMATETC petcSrc); +bool SAL_CALL CopyFormatEtc(LPFORMATETC petcDest, LPFORMATETC petcSrc); sal_Int32 SAL_CALL CompareFormatEtc( const FORMATETC* pFetcLeft, const FORMATETC* pFetcRight); -sal_Bool SAL_CALL CompareTargetDevice(DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE* ptdRight); +bool SAL_CALL CompareTargetDevice(DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE* ptdRight); DVTARGETDEVICE* SAL_CALL CopyTargetDevice(DVTARGETDEVICE* ptdSrc); // some codepage helper functions @@ -68,7 +68,7 @@ OUString SAL_CALL getMimeCharsetFromLocaleId( // returns true, if a given codepage is an oem codepage -sal_Bool SAL_CALL IsOEMCP( sal_uInt32 codepage ); +bool SAL_CALL IsOEMCP( sal_uInt32 codepage ); // converts a codepage into a string representation |