diff options
author | Jan Holesovsky <kendy@suse.cz> | 2013-08-06 19:46:05 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2013-08-06 19:56:30 +0200 |
commit | 9281fc72e7c45c8080a0373449191d73c26e3a08 (patch) | |
tree | 79b65a542fcf2efc800d15e09828dece7911e8e6 | |
parent | startcenter: Move BackingComp & BackingWindow to sfx2 (diff) | |
download | core-9281fc72e7c45c8080a0373449191d73c26e3a08.tar.gz core-9281fc72e7c45c8080a0373449191d73c26e3a08.zip |
startcenter: Rename DropTargetListener to OpenFileTargetListener, ...
...move it to svtools, and kill the cut'n'pasted version.
Change-Id: Ifacf110ff08b359bd0f611dff20b3c5142e6bcc8
-rw-r--r-- | framework/Library_fwk.mk | 1 | ||||
-rw-r--r-- | framework/inc/classes/droptargetlistener.hxx | 88 | ||||
-rw-r--r-- | framework/source/classes/droptargetlistener.cxx | 233 | ||||
-rw-r--r-- | framework/source/services/frame.cxx | 4 | ||||
-rw-r--r-- | include/svtools/openfiledroptargetlistener.hxx (renamed from include/sfx2/droptargetlistener.hxx) | 16 | ||||
-rw-r--r-- | sfx2/Library_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/source/dialog/backingcomp.cxx | 4 | ||||
-rw-r--r-- | svtools/Library_svt.mk | 1 | ||||
-rw-r--r-- | svtools/source/misc/openfiledroptargetlistener.cxx (renamed from sfx2/source/control/droptargetlistener.cxx) | 35 |
9 files changed, 34 insertions, 349 deletions
diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk index 007404918c4f..7c40db8a17a2 100644 --- a/framework/Library_fwk.mk +++ b/framework/Library_fwk.mk @@ -65,7 +65,6 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\ framework/source/accelerators/moduleacceleratorconfiguration \ framework/source/accelerators/presethandler \ framework/source/accelerators/storageholder \ - framework/source/classes/droptargetlistener \ framework/source/classes/framecontainer \ framework/source/classes/fwktabwindow \ framework/source/classes/menumanager \ diff --git a/framework/inc/classes/droptargetlistener.hxx b/framework/inc/classes/droptargetlistener.hxx deleted file mode 100644 index c6fc73d6005d..000000000000 --- a/framework/inc/classes/droptargetlistener.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef __FRAMEWORK_CLASSES_DROPTARGETLISTENER_HXX_ -#define __FRAMEWORK_CLASSES_DROPTARGETLISTENER_HXX_ - -#include <threadhelp/threadhelpbase.hxx> -#include <general.h> - -#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> -#include <com/sun/star/frame/XFrame.hpp> - -#include <cppuhelper/implbase1.hxx> - -#include <sot/exchange.hxx> -#include <tools/string.hxx> - -namespace framework -{ - -class DropTargetListener : private ThreadHelpBase - , public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDropTargetListener > -{ - //___________________________________________ - // member - private: - - /// uno service manager to create necessary services - css::uno::Reference< css::uno::XComponentContext > m_xContext; - /// weakreference to target frame (Don't use a hard reference. Owner can't delete us then!) - css::uno::WeakReference< css::frame::XFrame > m_xTargetFrame; - /// drag/drop info - DataFlavorExVector* m_pFormats; - - //___________________________________________ - // c++ interface - public: - - DropTargetListener( const css::uno::Reference< css::uno::XComponentContext >& xContext , - const css::uno::Reference< css::frame::XFrame >& xFrame ); - ~DropTargetListener( ); - - //___________________________________________ - // uno interface - public: - - // XEventListener - virtual void SAL_CALL disposing ( const css::lang::EventObject& Source ) throw(css::uno::RuntimeException); - - // XDropTargetListener - virtual void SAL_CALL drop ( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) throw(css::uno::RuntimeException); - virtual void SAL_CALL dragEnter ( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw(css::uno::RuntimeException); - virtual void SAL_CALL dragExit ( const css::datatransfer::dnd::DropTargetEvent& dte ) throw(css::uno::RuntimeException); - virtual void SAL_CALL dragOver ( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(css::uno::RuntimeException); - virtual void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(css::uno::RuntimeException); - - //___________________________________________ - // internal helper - private: - - void implts_BeginDrag ( const css::uno::Sequence< css::datatransfer::DataFlavor >& rSupportedDataFlavors ); - void implts_EndDrag ( ); - sal_Bool implts_IsDropFormatSupported( SotFormatStringId nFormat ); - void implts_OpenFile ( const String& rFilePath ); - -}; // class DropTargetListener - -} // namespace framework - -#endif // __FRAMEWORK_CLASSES_DROPTARGETLISTENER_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/classes/droptargetlistener.cxx b/framework/source/classes/droptargetlistener.cxx deleted file mode 100644 index 1b00c54e7586..000000000000 --- a/framework/source/classes/droptargetlistener.cxx +++ /dev/null @@ -1,233 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <classes/droptargetlistener.hxx> -#include <threadhelp/readguard.hxx> -#include <threadhelp/writeguard.hxx> -#include <targets.h> -#include <services.h> - -#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/util/URLTransformer.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> - -#include <svtools/transfer.hxx> -#include <unotools/localfilehelper.hxx> -#include <sot/filelist.hxx> -#include <comphelper/processfactory.hxx> - -#include <osl/file.hxx> -#include <vcl/svapp.hxx> - -namespace framework -{ - -DropTargetListener::DropTargetListener( const css::uno::Reference< css::uno::XComponentContext >& xContext, - const css::uno::Reference< css::frame::XFrame >& xFrame ) - : ThreadHelpBase ( &Application::GetSolarMutex() ) - , m_xContext ( xContext ) - , m_xTargetFrame ( xFrame ) - , m_pFormats ( new DataFlavorExVector ) -{ -} - -// ----------------------------------------------------------------------------- - -DropTargetListener::~DropTargetListener() -{ - m_xTargetFrame.clear(); - m_xContext.clear(); - delete m_pFormats; - m_pFormats = NULL; -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL DropTargetListener::disposing( const css::lang::EventObject& ) throw( css::uno::RuntimeException ) -{ - m_xTargetFrame.clear(); - m_xContext.clear(); -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL DropTargetListener::drop( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) throw( css::uno::RuntimeException ) -{ - const sal_Int8 nAction = dtde.DropAction; - - try - { - if ( css::datatransfer::dnd::DNDConstants::ACTION_NONE != nAction ) - { - TransferableDataHelper aHelper( dtde.Transferable ); - sal_Bool bFormatFound = sal_False; - FileList aFileList; - - // at first check filelist format - if ( aHelper.GetFileList( SOT_FORMAT_FILE_LIST, aFileList ) ) - { - sal_uLong i, nCount = aFileList.Count(); - for ( i = 0; i < nCount; ++i ) - implts_OpenFile( aFileList.GetFile(i) ); - bFormatFound = sal_True; - } - - // then, if necessary, the file format - String aFilePath; - if ( !bFormatFound && aHelper.GetString( SOT_FORMAT_FILE, aFilePath ) ) - implts_OpenFile( aFilePath ); - } - dtde.Context->dropComplete( css::datatransfer::dnd::DNDConstants::ACTION_NONE != nAction ); - } - catch( const ::com::sun::star::uno::Exception& ) - { - } -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL DropTargetListener::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw( css::uno::RuntimeException ) -{ - try - { - implts_BeginDrag( dtdee.SupportedDataFlavors ); - } - catch( const ::com::sun::star::uno::Exception& ) - { - } - - dragOver( dtdee ); -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL DropTargetListener::dragExit( const css::datatransfer::dnd::DropTargetEvent& ) throw( css::uno::RuntimeException ) -{ - try - { - implts_EndDrag(); - } - catch( const ::com::sun::star::uno::Exception& ) - { - } -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL DropTargetListener::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) throw( css::uno::RuntimeException ) -{ - try - { - sal_Bool bAccept = ( implts_IsDropFormatSupported( SOT_FORMAT_FILE ) || - implts_IsDropFormatSupported( SOT_FORMAT_FILE_LIST ) ); - - if ( !bAccept ) - dtde.Context->rejectDrag(); - else - dtde.Context->acceptDrag( css::datatransfer::dnd::DNDConstants::ACTION_COPY ); - } - catch( const ::com::sun::star::uno::Exception& ) - { - } -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL DropTargetListener::dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& ) throw( css::uno::RuntimeException ) -{ -} - -void DropTargetListener::implts_BeginDrag( const css::uno::Sequence< css::datatransfer::DataFlavor >& rSupportedDataFlavors ) -{ - /* SAFE { */ - WriteGuard aWriteLock(m_aLock); - m_pFormats->clear(); - TransferableDataHelper::FillDataFlavorExVector(rSupportedDataFlavors,*m_pFormats); - aWriteLock.unlock(); - /* } SAFE */ -} - -void DropTargetListener::implts_EndDrag() -{ - /* SAFE { */ - WriteGuard aWriteLock(m_aLock); - m_pFormats->clear(); - aWriteLock.unlock(); - /* } SAFE */ -} - -sal_Bool DropTargetListener::implts_IsDropFormatSupported( SotFormatStringId nFormat ) -{ - /* SAFE { */ - ReadGuard aReadLock(m_aLock); - DataFlavorExVector::iterator aIter( m_pFormats->begin() ), aEnd( m_pFormats->end() ); - sal_Bool bRet = sal_False; - - while ( aIter != aEnd ) - { - if ( nFormat == (*aIter++).mnSotId ) - { - bRet = sal_True; - aIter = aEnd; - } - } - aReadLock.unlock(); - /* } SAFE */ - - return bRet; -} - -void DropTargetListener::implts_OpenFile( const String& rFilePath ) -{ - OUString aFileURL; - if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( rFilePath, aFileURL ) ) - aFileURL = rFilePath; - - ::osl::FileStatus aStatus( osl_FileStatus_Mask_FileURL ); - ::osl::DirectoryItem aItem; - if( ::osl::FileBase::E_None == ::osl::DirectoryItem::get( aFileURL, aItem ) && - ::osl::FileBase::E_None == aItem.getFileStatus( aStatus ) ) - aFileURL = aStatus.getFileURL(); - - // open file - /* SAFE { */ - ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::frame::XFrame > xTargetFrame( m_xTargetFrame.get(), css::uno::UNO_QUERY ); - css::uno::Reference< css::util::XURLTransformer > xParser ( css::util::URLTransformer::create(m_xContext) ); - aReadLock.unlock(); - /* } SAFE */ - if (xTargetFrame.is() && xParser.is()) - { - css::util::URL aURL; - aURL.Complete = aFileURL; - xParser->parseStrict(aURL); - - css::uno::Reference < css::frame::XDispatchProvider > xProvider( xTargetFrame, css::uno::UNO_QUERY ); - css::uno::Reference< css::frame::XDispatch > xDispatcher = xProvider->queryDispatch( aURL, SPECIALTARGET_DEFAULT, 0 ); - if ( xDispatcher.is() ) - xDispatcher->dispatch( aURL, css::uno::Sequence < css::beans::PropertyValue >() ); - } -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 69a01d59977b..94065be7f6ab 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -27,7 +27,7 @@ #include <helper/oframes.hxx> #include <helper/statusindicatorfactory.hxx> #include <framework/titlehelper.hxx> -#include <classes/droptargetlistener.hxx> +#include <svtools/openfiledroptargetlistener.hxx> #include <classes/taskcreator.hxx> #include <loadenv/targethelper.hxx> #include <framework/framelistanalyzer.hxx> @@ -191,7 +191,7 @@ DEFINE_INIT_SERVICE ( Frame, //------------------------------------------------------------------------------------------------------------- // Initialize a the drop target listener. // We hold member as reference ... not as pointer too! - DropTargetListener* pDropListener = new DropTargetListener( m_xContext, this ); + OpenFileDropTargetListener* pDropListener = new OpenFileDropTargetListener( m_xContext, this ); m_xDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >( static_cast< ::cppu::OWeakObject* >(pDropListener), css::uno::UNO_QUERY ); // Safe impossible cases diff --git a/include/sfx2/droptargetlistener.hxx b/include/svtools/openfiledroptargetlistener.hxx index 102a39353fbd..ef03fb079371 100644 --- a/include/sfx2/droptargetlistener.hxx +++ b/include/svtools/openfiledroptargetlistener.hxx @@ -17,8 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _SXF_DROPTARGETLISTENER_HXX -#define _SXF_DROPTARGETLISTENER_HXX +#ifndef SVTOOLS_DROPTARGETLISTENER_HXX +#define SVTOOLS_DROPTARGETLISTENER_HXX + +#include <svtools/svtdllapi.h> #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -28,7 +30,7 @@ #include <sot/exchange.hxx> #include <tools/string.hxx> -class DropTargetListener : public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDropTargetListener > +class SVT_DLLPUBLIC OpenFileDropTargetListener : public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDropTargetListener > { //___________________________________________ // member @@ -45,9 +47,9 @@ class DropTargetListener : public ::cppu::WeakImplHelper1< ::com::sun::star::dat // c++ interface public: - DropTargetListener( const css::uno::Reference< css::uno::XComponentContext >& xContext , + OpenFileDropTargetListener( const css::uno::Reference< css::uno::XComponentContext >& xContext , const css::uno::Reference< css::frame::XFrame >& xFrame ); - ~DropTargetListener( ); + ~OpenFileDropTargetListener( ); //___________________________________________ // uno interface @@ -72,8 +74,8 @@ class DropTargetListener : public ::cppu::WeakImplHelper1< ::com::sun::star::dat sal_Bool implts_IsDropFormatSupported( SotFormatStringId nFormat ); void implts_OpenFile ( const String& rFilePath ); -}; // class DropTargetListener +}; -#endif // _SXF_DROPTARGETLISTENER_HXX +#endif // SVTOOLS_DROPTARGETLISTENER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 1c5f507300b8..4b8f42437223 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -129,7 +129,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/config/evntconf \ sfx2/source/control/bindings \ sfx2/source/control/ctrlitem \ - sfx2/source/control/droptargetlistener \ sfx2/source/control/minfitem \ sfx2/source/control/msg \ sfx2/source/control/msgpool \ diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx index 6b7cd16d249b..906922c7e8d6 100644 --- a/sfx2/source/dialog/backingcomp.cxx +++ b/sfx2/source/dialog/backingcomp.cxx @@ -21,7 +21,7 @@ #include "backingwindow.hxx" -#include <sfx2/droptargetlistener.hxx> +#include <svtools/openfiledroptargetlistener.hxx> #include <helpid.hrc> @@ -454,7 +454,7 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f m_xFrame = xFrame; // establish drag&drop mode - DropTargetListener* pDropListener = new DropTargetListener( m_xContext, m_xFrame); + OpenFileDropTargetListener* pDropListener = new OpenFileDropTargetListener( m_xContext, m_xFrame); m_xDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >(static_cast< ::cppu::OWeakObject* >(pDropListener), css::uno::UNO_QUERY); css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( m_xContext ); diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 89456ecae3d0..18fea9bb68f1 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -179,6 +179,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/misc/itemdel \ svtools/source/misc/langtab \ svtools/source/misc/langhelp \ + svtools/source/misc/openfiledroptargetlistener \ svtools/source/misc/sampletext \ svtools/source/misc/stringtransfer \ svtools/source/misc/svtaccessiblefactory \ diff --git a/sfx2/source/control/droptargetlistener.cxx b/svtools/source/misc/openfiledroptargetlistener.cxx index cb40283250b7..cbdb81a99a5f 100644 --- a/sfx2/source/control/droptargetlistener.cxx +++ b/svtools/source/misc/openfiledroptargetlistener.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <sfx2/droptargetlistener.hxx> +#include <svtools/openfiledroptargetlistener.hxx> #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> #include <com/sun/star/frame/XDispatch.hpp> @@ -34,9 +34,10 @@ #include <osl/file.hxx> #include <vcl/svapp.hxx> -const OUString SPECIALTARGET_DEFAULT("_default"); +// Create a new task or recycle an existing one +const char SPECIALTARGET_DEFAULT[] = "_default"; -DropTargetListener::DropTargetListener( const css::uno::Reference< css::uno::XComponentContext >& xContext, +OpenFileDropTargetListener::OpenFileDropTargetListener( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XFrame >& xFrame ) : m_xContext ( xContext ) , m_xTargetFrame ( xFrame ) @@ -46,7 +47,7 @@ DropTargetListener::DropTargetListener( const css::uno::Reference< css::uno::XCo // ----------------------------------------------------------------------------- -DropTargetListener::~DropTargetListener() +OpenFileDropTargetListener::~OpenFileDropTargetListener() { m_xTargetFrame.clear(); m_xContext.clear(); @@ -56,7 +57,7 @@ DropTargetListener::~DropTargetListener() // ----------------------------------------------------------------------------- -void SAL_CALL DropTargetListener::disposing( const css::lang::EventObject& ) throw( css::uno::RuntimeException ) +void SAL_CALL OpenFileDropTargetListener::disposing( const css::lang::EventObject& ) throw( css::uno::RuntimeException ) { m_xTargetFrame.clear(); m_xContext.clear(); @@ -64,7 +65,7 @@ void SAL_CALL DropTargetListener::disposing( const css::lang::EventObject& ) thr // ----------------------------------------------------------------------------- -void SAL_CALL DropTargetListener::drop( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) throw( css::uno::RuntimeException ) +void SAL_CALL OpenFileDropTargetListener::drop( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) throw( css::uno::RuntimeException ) { const sal_Int8 nAction = dtde.DropAction; @@ -99,7 +100,7 @@ void SAL_CALL DropTargetListener::drop( const css::datatransfer::dnd::DropTarget // ----------------------------------------------------------------------------- -void SAL_CALL DropTargetListener::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw( css::uno::RuntimeException ) +void SAL_CALL OpenFileDropTargetListener::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw( css::uno::RuntimeException ) { try { @@ -114,7 +115,7 @@ void SAL_CALL DropTargetListener::dragEnter( const css::datatransfer::dnd::DropT // ----------------------------------------------------------------------------- -void SAL_CALL DropTargetListener::dragExit( const css::datatransfer::dnd::DropTargetEvent& ) throw( css::uno::RuntimeException ) +void SAL_CALL OpenFileDropTargetListener::dragExit( const css::datatransfer::dnd::DropTargetEvent& ) throw( css::uno::RuntimeException ) { try { @@ -127,7 +128,7 @@ void SAL_CALL DropTargetListener::dragExit( const css::datatransfer::dnd::DropTa // ----------------------------------------------------------------------------- -void SAL_CALL DropTargetListener::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) throw( css::uno::RuntimeException ) +void SAL_CALL OpenFileDropTargetListener::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) throw( css::uno::RuntimeException ) { try { @@ -146,31 +147,34 @@ void SAL_CALL DropTargetListener::dragOver( const css::datatransfer::dnd::DropTa // ----------------------------------------------------------------------------- -void SAL_CALL DropTargetListener::dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& ) throw( css::uno::RuntimeException ) +void SAL_CALL OpenFileDropTargetListener::dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& ) throw( css::uno::RuntimeException ) { } -void DropTargetListener::implts_BeginDrag( const css::uno::Sequence< css::datatransfer::DataFlavor >& rSupportedDataFlavors ) +void OpenFileDropTargetListener::implts_BeginDrag( const css::uno::Sequence< css::datatransfer::DataFlavor >& rSupportedDataFlavors ) { /* SAFE { */ SolarMutexGuard aGuard; + m_pFormats->clear(); TransferableDataHelper::FillDataFlavorExVector(rSupportedDataFlavors,*m_pFormats); /* } SAFE */ } -void DropTargetListener::implts_EndDrag() +void OpenFileDropTargetListener::implts_EndDrag() { /* SAFE { */ SolarMutexGuard aGuard; + m_pFormats->clear(); /* } SAFE */ } -sal_Bool DropTargetListener::implts_IsDropFormatSupported( SotFormatStringId nFormat ) +sal_Bool OpenFileDropTargetListener::implts_IsDropFormatSupported( SotFormatStringId nFormat ) { /* SAFE { */ SolarMutexGuard aGuard; + DataFlavorExVector::iterator aIter( m_pFormats->begin() ), aEnd( m_pFormats->end() ); sal_Bool bRet = sal_False; @@ -182,12 +186,12 @@ sal_Bool DropTargetListener::implts_IsDropFormatSupported( SotFormatStringId nFo aIter = aEnd; } } + /* } SAFE */ return bRet; - /* } SAFE */ } -void DropTargetListener::implts_OpenFile( const String& rFilePath ) +void OpenFileDropTargetListener::implts_OpenFile( const String& rFilePath ) { OUString aFileURL; if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( rFilePath, aFileURL ) ) @@ -202,6 +206,7 @@ void DropTargetListener::implts_OpenFile( const String& rFilePath ) // open file /* SAFE { */ SolarMutexGuard aGuard; + css::uno::Reference< css::frame::XFrame > xTargetFrame( m_xTargetFrame.get(), css::uno::UNO_QUERY ); css::uno::Reference< css::util::XURLTransformer > xParser ( css::util::URLTransformer::create(m_xContext) ); |