diff options
Diffstat (limited to 'dtrans')
-rw-r--r-- | dtrans/source/inc/DtObjFactory.hxx | 9 | ||||
-rw-r--r-- | dtrans/source/win32/clipb/WinClipbImpl.cxx | 8 | ||||
-rw-r--r-- | dtrans/source/win32/dnd/source.cxx | 2 | ||||
-rw-r--r-- | dtrans/source/win32/dnd/source.hxx | 7 | ||||
-rw-r--r-- | dtrans/source/win32/dnd/target.cxx | 4 | ||||
-rw-r--r-- | dtrans/source/win32/dnd/target.hxx | 7 | ||||
-rw-r--r-- | dtrans/source/win32/dtobj/DOTransferable.cxx | 13 | ||||
-rw-r--r-- | dtrans/source/win32/dtobj/DOTransferable.hxx | 7 | ||||
-rw-r--r-- | dtrans/source/win32/dtobj/DtObjFactory.cxx | 15 | ||||
-rw-r--r-- | dtrans/source/win32/dtobj/XNotifyingDataObject.cxx | 1 | ||||
-rw-r--r-- | dtrans/test/win32/dnd/atlwindow.cxx | 2 | ||||
-rw-r--r-- | dtrans/test/win32/dnd/atlwindow.hxx | 2 |
12 files changed, 34 insertions, 43 deletions
diff --git a/dtrans/source/inc/DtObjFactory.hxx b/dtrans/source/inc/DtObjFactory.hxx index 483286ef785e..be8bf8dbcb3e 100644 --- a/dtrans/source/inc/DtObjFactory.hxx +++ b/dtrans/source/inc/DtObjFactory.hxx @@ -25,14 +25,11 @@ #include <systools/win32/comtools.hxx> -class CDTransObjFactory +namespace CDTransObjFactory { -public: - virtual IDataObjectPtr SAL_CALL createDataObjFromTransferable( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + IDataObjectPtr createDataObjFromTransferable( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::datatransfer::XTransferable >& refXTransferable ); - virtual css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL createTransferableFromDataObj( - const css::uno::Reference< css::uno::XComponentContext >& rxContext, IDataObjectPtr pIDataObject ); -}; +} #endif diff --git a/dtrans/source/win32/clipb/WinClipbImpl.cxx b/dtrans/source/win32/clipb/WinClipbImpl.cxx index 0f517c68a4d0..ed84c02008d1 100644 --- a/dtrans/source/win32/clipb/WinClipbImpl.cxx +++ b/dtrans/source/win32/clipb/WinClipbImpl.cxx @@ -23,6 +23,7 @@ #include <systools/win32/comtools.hxx> #include "../../inc/DtObjFactory.hxx" #include "../dtobj/APNDataObject.hxx" +#include "../dtobj/DOTransferable.hxx" #include "WinClipboard.hxx" #include <com/sun/star/datatransfer/clipboard/RenderingCapabilities.hpp> #include "../dtobj/XNotifyingDataObject.hxx" @@ -103,10 +104,8 @@ Reference< XTransferable > SAL_CALL CWinClipbImpl::getContents( ) throw( Runtime // com smart pointer to the IDataObject from clipboard IDataObjectPtr pIDo( new CAPNDataObject( pIDataObject ) ); - CDTransObjFactory objFactory; - // remember pIDo destroys itself due to the smart pointer - rClipContent = objFactory.createTransferableFromDataObj( m_pWinClipboard->m_xContext, pIDo ); + rClipContent = CDOTransferable::create( m_pWinClipboard->m_xContext, pIDo ); } return rClipContent; @@ -119,7 +118,6 @@ void SAL_CALL CWinClipbImpl::setContents( const Reference< XClipboardOwner >& xClipboardOwner ) throw( RuntimeException ) { - CDTransObjFactory objFactory; IDataObjectPtr pIDataObj; if ( xTransferable.is( ) ) @@ -127,7 +125,7 @@ void SAL_CALL CWinClipbImpl::setContents( ClearableMutexGuard aGuard( m_ClipContentMutex ); m_pCurrentClipContent = new CXNotifyingDataObject( - objFactory.createDataObjFromTransferable( m_pWinClipboard->m_xContext , xTransferable ), + CDTransObjFactory::createDataObjFromTransferable( m_pWinClipboard->m_xContext , xTransferable ), xTransferable, xClipboardOwner, this ); diff --git a/dtrans/source/win32/dnd/source.cxx b/dtrans/source/win32/dnd/source.cxx index 6d29d6f3959d..fb5e6c0830fc 100644 --- a/dtrans/source/win32/dnd/source.cxx +++ b/dtrans/source/win32/dnd/source.cxx @@ -112,7 +112,7 @@ void DragSource::StartDragImpl( g_XTransferable = trans; //<-- TRA - m_spDataObject= m_aDataConverter.createDataObjFromTransferable( + m_spDataObject= CDTransObjFactory::createDataObjFromTransferable( m_xContext, trans); // Obtain the id of the thread that created the window diff --git a/dtrans/source/win32/dnd/source.hxx b/dtrans/source/win32/dnd/source.hxx index 146df441afd3..0f73d6cd60b6 100644 --- a/dtrans/source/win32/dnd/source.hxx +++ b/dtrans/source/win32/dnd/source.hxx @@ -26,12 +26,15 @@ #include <osl/mutex.hxx> #include <cppuhelper/compbase.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> -#include "../../inc/DtObjFactory.hxx" #include "globals.hxx" #include <oleidl.h> #include <systools/win32/comtools.hxx> +namespace com { namespace sun { namespace star { namespace uno { + class XComponentContext; +} } } } + using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; using namespace cppu; @@ -53,8 +56,6 @@ class DragSource: // The mouse button that set off the drag and drop operation short m_MouseButton; - // Converts XTransferable objects to IDataObject objects. - CDTransObjFactory m_aDataConverter; DragSource(); DragSource(const DragSource&); diff --git a/dtrans/source/win32/dnd/target.cxx b/dtrans/source/win32/dnd/target.cxx index d7247f9fc297..ba76771a484f 100644 --- a/dtrans/source/win32/dnd/target.cxx +++ b/dtrans/source/win32/dnd/target.cxx @@ -29,6 +29,8 @@ #include <rtl/ustring.h> #include <osl/thread.h> +#include "../dtobj/DOTransferable.hxx" + using namespace cppu; using namespace osl; using namespace com::sun::star::datatransfer; @@ -323,7 +325,7 @@ HRESULT DropTarget::DragEnter( IDataObject *pDataObj, else { // Convert the IDataObject to a XTransferable - m_currentData= m_aDataConverter.createTransferableFromDataObj( + m_currentData= CDOTransferable::create( m_xContext, IDataObjectPtr(pDataObj)); } diff --git a/dtrans/source/win32/dnd/target.hxx b/dtrans/source/win32/dnd/target.hxx index 065e6d52b48c..4e7d3b80eba2 100644 --- a/dtrans/source/win32/dnd/target.hxx +++ b/dtrans/source/win32/dnd/target.hxx @@ -36,7 +36,10 @@ #pragma warning(pop) #endif #include "globals.hxx" -#include "../../inc/DtObjFactory.hxx" + +namespace com { namespace sun { namespace star { namespace uno { + class XComponentContext; +} } } } using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; @@ -100,8 +103,6 @@ private: // sal_Int8 m_userAction; // Set by listeners when they call XDropTargetDropContext::dropComplete sal_Bool m_bDropComplete; - // converts IDataObject objects to XTransferable objects. - CDTransObjFactory m_aDataConverter; Reference<XDropTargetDragContext> m_currentDragContext; Reference<XDropTargetDropContext> m_currentDropContext; diff --git a/dtrans/source/win32/dtobj/DOTransferable.cxx b/dtrans/source/win32/dtobj/DOTransferable.cxx index e57b745e6f7d..74de0dcb0c93 100644 --- a/dtrans/source/win32/dtobj/DOTransferable.cxx +++ b/dtrans/source/win32/dtobj/DOTransferable.cxx @@ -58,7 +58,18 @@ namespace } // end namespace -// ctor +Reference< XTransferable > SAL_CALL CDOTransferable::create( const Reference< XComponentContext >& rxContext, + IDataObjectPtr pIDataObject ) +{ + CDOTransferable* pTransf = new CDOTransferable(rxContext, pIDataObject); + Reference<XTransferable> refDOTransf(pTransf); + + pTransf->acquire(); + pTransf->initFlavorList(); + pTransf->release(); + + return refDOTransf; +} CDOTransferable::CDOTransferable( const Reference< XComponentContext >& rxContext, IDataObjectPtr rDataObject ) : diff --git a/dtrans/source/win32/dtobj/DOTransferable.hxx b/dtrans/source/win32/dtobj/DOTransferable.hxx index cf3af73dc4f2..1f110089b4ea 100644 --- a/dtrans/source/win32/dtobj/DOTransferable.hxx +++ b/dtrans/source/win32/dtobj/DOTransferable.hxx @@ -31,7 +31,6 @@ #include <systools/win32/comtools.hxx> // forward -class CDTransObjFactory; class CFormatEtc; class CDOTransferable : public ::cppu::WeakImplHelper< @@ -41,6 +40,9 @@ class CDOTransferable : public ::cppu::WeakImplHelper< public: typedef css::uno::Sequence< sal_Int8 > ByteSequence_t; + static css::uno::Reference< css::datatransfer::XTransferable > create( + const css::uno::Reference< css::uno::XComponentContext >& rxContext, IDataObjectPtr pIDataObject ); + // XTransferable virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) @@ -58,7 +60,6 @@ public: (css::uno::RuntimeException); private: - // should be created only by CDTransObjFactory explicit CDOTransferable( const css::uno::Reference< css::uno::XComponentContext >& rxContext, IDataObjectPtr rDataObject ); @@ -103,8 +104,6 @@ private: private: CDOTransferable( const CDOTransferable& ); CDOTransferable& operator=( const CDOTransferable& ); - - friend class CDTransObjFactory; }; #endif diff --git a/dtrans/source/win32/dtobj/DtObjFactory.cxx b/dtrans/source/win32/dtobj/DtObjFactory.cxx index 584c695772c5..579efe21161f 100644 --- a/dtrans/source/win32/dtobj/DtObjFactory.cxx +++ b/dtrans/source/win32/dtobj/DtObjFactory.cxx @@ -21,8 +21,6 @@ #include "XTDataObject.hxx" -#include "DOTransferable.hxx" - // namespace directives using namespace com::sun::star::uno; @@ -37,17 +35,4 @@ IDataObjectPtr SAL_CALL CDTransObjFactory::createDataObjFromTransferable(const R return (IDataObjectPtr(new CXTDataObject(rxContext, refXTransferable))); } -Reference< XTransferable > SAL_CALL CDTransObjFactory::createTransferableFromDataObj( const Reference< XComponentContext >& rxContext, - IDataObjectPtr pIDataObject ) -{ - CDOTransferable* pTransf = new CDOTransferable(rxContext, pIDataObject); - Reference<XTransferable> refDOTransf(pTransf); - - pTransf->acquire(); - pTransf->initFlavorList(); - pTransf->release(); - - return refDOTransf; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx b/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx index 49546050dcfb..35b42e6801bc 100644 --- a/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx +++ b/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx @@ -21,7 +21,6 @@ #include "XNotifyingDataObject.hxx" #include "../clipb/WinClipbImpl.hxx" #include "../clipb/WinClipboard.hxx" -#include "../../inc/DtObjFactory.hxx" #ifdef __MINGW32__ #if defined __uuidof diff --git a/dtrans/test/win32/dnd/atlwindow.cxx b/dtrans/test/win32/dnd/atlwindow.cxx index 1f8f74843397..7aa0df7ce0ac 100644 --- a/dtrans/test/win32/dnd/atlwindow.cxx +++ b/dtrans/test/win32/dnd/atlwindow.cxx @@ -168,7 +168,7 @@ LRESULT AWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled pData->SetData( &format, &medium, TRUE); // releases HGLOBAL eventually - Reference<XTransferable> xTrans= m_aDataConverter.createTransferableFromDataObj( + Reference<XTransferable> xTrans= CDOTransferable::create( MultiServiceFactory, pData); // call XDragSource::executeDrag from an MTA diff --git a/dtrans/test/win32/dnd/atlwindow.hxx b/dtrans/test/win32/dnd/atlwindow.hxx index 692b8befdc7a..378407274b56 100644 --- a/dtrans/test/win32/dnd/atlwindow.hxx +++ b/dtrans/test/win32/dnd/atlwindow.hxx @@ -49,8 +49,6 @@ class AWindow: public CWindowImpl<AWindow, CWindow, HWND m_hwndEdit; - CDTransObjFactory m_aDataConverter; - public: explicit AWindow(LPCTSTR strName) { |