diff options
Diffstat (limited to 'fpicker/source/win32/folderpicker')
-rw-r--r-- | fpicker/source/win32/folderpicker/FOPServiceInfo.hxx | 54 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/FolderPicker.cxx | 219 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/FolderPicker.hxx | 129 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/FopEvtDisp.hxx | 45 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/Fopentry.cxx | 144 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/MtaFop.cxx | 839 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/MtaFop.hxx | 191 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/WinFOPImpl.cxx | 168 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/WinFOPImpl.hxx | 83 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/fop.xml | 40 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/makefile.mk | 51 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/workbench/Test_fops.cxx | 203 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/workbench/makefile.mk | 62 |
13 files changed, 2228 insertions, 0 deletions
diff --git a/fpicker/source/win32/folderpicker/FOPServiceInfo.hxx b/fpicker/source/win32/folderpicker/FOPServiceInfo.hxx new file mode 100644 index 000000000000..4dc86192a051 --- /dev/null +++ b/fpicker/source/win32/folderpicker/FOPServiceInfo.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _FOPSERVICEINFO_HXX_ +#define _FOPSERVICEINFO_HXX_ + +//------------------------------------------------------------------------ +// includes +//------------------------------------------------------------------------ + +//------------------------------------------------------------------------ +// defines +//------------------------------------------------------------------------ + +// the service name is a description of a set of +// interfaces (is the same as component categories in COM) + +// the service names +#define FOLDER_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.SystemFolderPicker" + +// the implementation names +#define FOLDER_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.Win32FolderPicker" + +// the registry key names +// a key under which this service will be registered, Format: -> "/ImplName/UNO/SERVICES/ServiceName" +// < Implementation-Name ></UNO/SERVICES/>< Service-Name > +#define FOLDER_PICKER_REGKEY_NAME "/com.sun.star.ui.dialogs.Win32FolderPicker/UNO/SERVICES/com.sun.star.ui.dialogs.SystemFolderPicker" + +#endif diff --git a/fpicker/source/win32/folderpicker/FolderPicker.cxx b/fpicker/source/win32/folderpicker/FolderPicker.cxx new file mode 100644 index 000000000000..acfe310e1cc6 --- /dev/null +++ b/fpicker/source/win32/folderpicker/FolderPicker.cxx @@ -0,0 +1,219 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_fpicker.hxx" + +//------------------------------------------------------------------------ +// includes +//------------------------------------------------------------------------ +#include <osl/diagnose.h> + +#ifndef _FOLDERPICKER_HXX_ +#include "folderpicker.hxx" +#endif +#include <com/sun/star/lang/DisposedException.hpp> +#include "WinFOPImpl.hxx" + +//------------------------------------------------------------------------ +// namespace directives +//------------------------------------------------------------------------ + +using com::sun::star::uno::Reference; +using com::sun::star::uno::RuntimeException; +using com::sun::star::uno::Sequence; +using com::sun::star::uno::XInterface; +using com::sun::star::lang::XMultiServiceFactory; +using com::sun::star::lang::XServiceInfo; +using com::sun::star::lang::DisposedException; +using com::sun::star::lang::IllegalArgumentException; +using rtl::OUString; +using osl::MutexGuard; + +using namespace cppu; +using namespace com::sun::star::ui::dialogs; + +//------------------------------------------------------------------------ +// defines +//------------------------------------------------------------------------ + +#define FOLDERPICKER_IMPL_NAME "com.sun.star.ui.dialogs.Win32FolderPicker" + +//------------------------------------------------------------------------ +// helper functions +//------------------------------------------------------------------------ + +namespace +{ + Sequence< OUString > SAL_CALL FolderPicker_getSupportedServiceNames() + { + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFolderPicker"); + return aRet; + } +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- + +CFolderPicker::CFolderPicker( const Reference< XMultiServiceFactory >& xServiceMgr ) : + m_xServiceMgr( xServiceMgr ) +{ + m_pFolderPickerImpl = std::auto_ptr< CWinFolderPickerImpl > ( new CWinFolderPickerImpl( this ) ); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- + +void SAL_CALL CFolderPicker::setTitle( const OUString& aTitle ) throw( RuntimeException ) +{ + OSL_ASSERT( m_pFolderPickerImpl.get( ) ); + MutexGuard aGuard( m_aMutex ); + m_pFolderPickerImpl->setTitle( aTitle ); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- + +void SAL_CALL CFolderPicker::setDisplayDirectory( const OUString& aDirectory ) + throw( IllegalArgumentException, RuntimeException ) +{ + OSL_ASSERT( m_pFolderPickerImpl.get( ) ); + MutexGuard aGuard( m_aMutex ); + m_pFolderPickerImpl->setDisplayDirectory( aDirectory ); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- + +OUString SAL_CALL CFolderPicker::getDisplayDirectory( ) + throw( RuntimeException ) +{ + OSL_ASSERT( m_pFolderPickerImpl.get( ) ); + MutexGuard aGuard( m_aMutex ); + return m_pFolderPickerImpl->getDisplayDirectory( ); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- + +OUString SAL_CALL CFolderPicker::getDirectory( ) throw( RuntimeException ) +{ + OSL_ASSERT( m_pFolderPickerImpl.get( ) ); + MutexGuard aGuard( m_aMutex ); + return m_pFolderPickerImpl->getDirectory( ); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- + +void SAL_CALL CFolderPicker::setDescription( const OUString& aDescription ) throw( RuntimeException ) +{ + OSL_ASSERT( m_pFolderPickerImpl.get( ) ); + MutexGuard aGuard( m_aMutex ); + m_pFolderPickerImpl->setDescription( aDescription ); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- + +sal_Int16 SAL_CALL CFolderPicker::execute( ) + throw( RuntimeException ) +{ + OSL_ASSERT( m_pFolderPickerImpl.get( ) ); + + // we should not block in this call else + // in the case of an event the client can'tgetPImplFromHandle( hWnd ) + // call another function an we run into a + // deadlock !!!!! + return m_pFolderPickerImpl->execute( ); +} + +// ------------------------------------------------- +// XServiceInfo +// ------------------------------------------------- + +OUString SAL_CALL CFolderPicker::getImplementationName( ) + throw( RuntimeException ) +{ + return OUString::createFromAscii( FOLDERPICKER_IMPL_NAME ); +} + +// ------------------------------------------------- +// XServiceInfo +// ------------------------------------------------- + +sal_Bool SAL_CALL CFolderPicker::supportsService( const OUString& ServiceName ) + throw( RuntimeException ) +{ + Sequence < OUString > SupportedServicesNames = FolderPicker_getSupportedServiceNames(); + + for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; ) + if (SupportedServicesNames[n].compareTo(ServiceName) == 0) + return sal_True; + + return sal_False; +} + +// ------------------------------------------------- +// XServiceInfo +// ------------------------------------------------- + +Sequence< OUString > SAL_CALL CFolderPicker::getSupportedServiceNames( ) + throw( RuntimeException ) +{ + return FolderPicker_getSupportedServiceNames(); +} + +// ------------------------------------------------- +// XCancellable +// ------------------------------------------------- + +void SAL_CALL CFolderPicker::cancel( ) + throw(RuntimeException) +{ + OSL_ASSERT( m_pFolderPickerImpl.get( ) ); + MutexGuard aGuard( m_aMutex ); + m_pFolderPickerImpl->cancel( ); +} + +//------------------------------------------------ +// overwrite base class method, which is called +// by base class dispose function +//------------------------------------------------ + +void SAL_CALL CFolderPicker::disposing() +{ +} + diff --git a/fpicker/source/win32/folderpicker/FolderPicker.hxx b/fpicker/source/win32/folderpicker/FolderPicker.hxx new file mode 100644 index 000000000000..0bb02c3b7682 --- /dev/null +++ b/fpicker/source/win32/folderpicker/FolderPicker.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FOLDERPICKER_HXX_ +#define _FOLDERPICKER_HXX_ + +//--------------------------------------------------------- +// includes of other projects +//--------------------------------------------------------- + +#include <cppuhelper/implbase3.hxx> +#include <osl/mutex.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> + +#ifndef _COM_SUN_STAR_UI_XFOLDERPICKER_HPP_ +#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#endif +#include <com/sun/star/util/XCancellable.hpp> + +#include <memory> + +#ifndef _FPIMPLBASE_HXX_ +#include "WinFOPImpl.hxx" +#endif + +//---------------------------------------------------------- +// class declaration +//---------------------------------------------------------- + +class CFolderPicker : + public cppu::WeakImplHelper3< + com::sun::star::ui::dialogs::XFolderPicker, + com::sun::star::lang::XServiceInfo, + com::sun::star::util::XCancellable > +{ +public: + + // ctor/dtor + CFolderPicker( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceMgr ); + + //------------------------------------------------------------------------------------ + // XExecutableDialog + //------------------------------------------------------------------------------------ + + virtual void SAL_CALL setTitle( const rtl::OUString& aTitle ) + throw( com::sun::star::uno::RuntimeException ); + + virtual sal_Int16 SAL_CALL execute( ) + throw( com::sun::star::uno::RuntimeException ); + + //------------------------------------------------------------------------------------ + // XFolderPicker functions + //------------------------------------------------------------------------------------ + + virtual void SAL_CALL setDisplayDirectory( const rtl::OUString& aDirectory ) + throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException ); + + virtual rtl::OUString SAL_CALL getDisplayDirectory( ) + throw( com::sun::star::uno::RuntimeException ); + + virtual rtl::OUString SAL_CALL getDirectory( ) + throw( com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setDescription( const rtl::OUString& aDescription ) + throw( com::sun::star::uno::RuntimeException ); + + //------------------------------------------------ + // XServiceInfo + //------------------------------------------------ + + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw(::com::sun::star::uno::RuntimeException); + + //------------------------------------------------ + // XCancellable + //------------------------------------------------ + + virtual void SAL_CALL cancel( ) + throw(::com::sun::star::uno::RuntimeException); + + //------------------------------------------------ + // overwrite base class method, which is called + // by base class dispose function + //------------------------------------------------ + + virtual void SAL_CALL disposing(); + +private: + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr; + std::auto_ptr< CWinFolderPickerImpl > m_pFolderPickerImpl; + osl::Mutex m_aMutex; + +// prevent copy and assignment +private: + CFolderPicker( const CFolderPicker& ); + CFolderPicker& operator=( const CFolderPicker& ); +}; + +#endif diff --git a/fpicker/source/win32/folderpicker/FopEvtDisp.hxx b/fpicker/source/win32/folderpicker/FopEvtDisp.hxx new file mode 100644 index 000000000000..dfaa5a9abf9b --- /dev/null +++ b/fpicker/source/win32/folderpicker/FopEvtDisp.hxx @@ -0,0 +1,45 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _FOPEVENTDISPATCHER_HXX_ +#define _FOPEVENTDISPATCHER_HXX_ + +#include <com/sun/star/lang/EventObject.hpp> + +//------------------------------------------------------------------------ +// deklarations +//------------------------------------------------------------------------ +class CFOPEventDispatcher +{ +public: + + // dispatches a FilePickerEvent to wherever + virtual void SAL_CALL helpRequested( ::com::sun::star::lang::EventObject aEvent ) const = 0; +}; + +#endif diff --git a/fpicker/source/win32/folderpicker/Fopentry.cxx b/fpicker/source/win32/folderpicker/Fopentry.cxx new file mode 100644 index 000000000000..717359ba511a --- /dev/null +++ b/fpicker/source/win32/folderpicker/Fopentry.cxx @@ -0,0 +1,144 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_fpicker.hxx" + +//----------------------------------------------------------------------- +// includes of other projects +//----------------------------------------------------------------------- +#include <cppuhelper/factory.hxx> +#include <com/sun/star/container/XSet.hpp> +#include <osl/diagnose.h> + +#ifndef _FILEPICKER_HXX_ +#include "folderpicker.hxx" +#endif + +#ifndef _FPSERVICEINFO_HXX_ +#include "FOPServiceInfo.hxx" +#endif +#include "WinFOPImpl.hxx" + +//----------------------------------------------------------------------- +// namespace directives +//----------------------------------------------------------------------- + +using namespace ::rtl ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::container ; +using namespace ::com::sun::star::lang ; +using namespace ::com::sun::star::registry ; +using namespace ::cppu ; +using com::sun::star::ui::dialogs::XFolderPicker; + + +namespace +{ + + //----------------------------------------------------------------------- + // + //----------------------------------------------------------------------- + + Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager ) + { + return Reference< XInterface >( static_cast< XFolderPicker* >( new CFolderPicker( rServiceManager ) ) ); + } +} + +//----------------------------------------------------------------------- +// the 3 important functions which will be exported +//----------------------------------------------------------------------- + +extern "C" +{ + +//---------------------------------------------------------------------- +// component_getImplementationEnvironment +//---------------------------------------------------------------------- + +void SAL_CALL component_getImplementationEnvironment( + const sal_Char ** ppEnvTypeName, uno_Environment ** ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//----------------------------------------------------------------------- +// +//----------------------------------------------------------------------- + +sal_Bool SAL_CALL component_writeInfo( void*, void* pRegistryKey ) +{ + sal_Bool bRetVal = sal_True; + + if ( pRegistryKey ) + { + try + { + Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) ); + pXNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_REGKEY_NAME ) ) ); + } + catch( InvalidRegistryException& ) + { + OSL_ENSURE(sal_False, "InvalidRegistryException caught"); + bRetVal = sal_False; + } + } + + return bRetVal; +} + +//---------------------------------------------------------------------- +// component_getFactory +// returns a factory to create XFilePicker-Services +//---------------------------------------------------------------------- + +void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* ) +{ + void* pRet = 0; + + if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FOLDER_PICKER_IMPL_NAME ) ) ) + { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ); + + Reference< XSingleServiceFactory > xFactory ( createSingleFactory( + reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), + OUString::createFromAscii( pImplName ), + createInstance, + aSNS ) ); + if ( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} + +} // extern "C" diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx new file mode 100644 index 000000000000..254887a2a0f1 --- /dev/null +++ b/fpicker/source/win32/folderpicker/MtaFop.cxx @@ -0,0 +1,839 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_fpicker.hxx" +#include <osl/diagnose.h> +#include <osl/conditn.hxx> + +#include "MtaFop.hxx" +#include <wchar.h> +#include <process.h> +#include "..\misc\resourceprovider.hxx" + +#include <systools/win32/comtools.hxx> + +using rtl::OUString; +using osl::Condition; + +const sal_uInt32 MSG_BROWSEFORFOLDER = WM_USER + 1; +const sal_uInt32 MSG_SHUTDOWN = WM_USER + 2; + +const sal_uInt32 MAX_WAITTIME = 2000; // msec + +const sal_Bool MANUAL_RESET = sal_True; +const sal_Bool AUTO_RESET = sal_False; +const sal_Bool INIT_NONSIGNALED = sal_False; + +typedef sal::systools::COMReference<IMalloc> IMallocPtr; +typedef sal::systools::COMReference<IShellFolder> IShellFolderPtr; + +namespace +{ + const char* FOLDERPICKER_SRV_DLL_NAME = "fop.dll"; + const char g_szWndClsName[] = "FopStaReqWnd###"; + const char* CURRENT_INSTANCE = "CurrInst"; + + typedef struct _RequestContext + { + HANDLE hEvent; + sal_Bool bRet; + } RequestContext; + + inline sal_Bool InitializeRequestContext( RequestContext* aRequestContext ) + { + OSL_ASSERT( aRequestContext ); + + aRequestContext->hEvent = CreateEventA( + 0, AUTO_RESET, INIT_NONSIGNALED, NULL ); + + aRequestContext->bRet = sal_False; + + return ( 0 != aRequestContext->hEvent ); + } + + inline void DeinitializeRequestContext( RequestContext* aRequestContext ) + { + OSL_ASSERT( aRequestContext && aRequestContext->hEvent ); + CloseHandle( aRequestContext->hEvent ); + } + + //------------------------------- + // Determine if current thread is + // an MTA or STA thread + //------------------------------- + bool IsMTA() + { + HRESULT hr = CoInitialize(NULL); + + if (RPC_E_CHANGED_MODE == hr) + return true; + + if(SUCCEEDED(hr)) + CoUninitialize(); + + return false; + } +} + +//---------------------------------------------------------------- +// static member initialization +//---------------------------------------------------------------- + +ATOM CMtaFolderPicker::s_ClassAtom = 0; +osl::Mutex CMtaFolderPicker::s_Mutex; +sal_Int32 CMtaFolderPicker::s_StaRequestWndRegisterCount = 0; + +//-------------------------------------------------------------------- +// ctor +//-------------------------------------------------------------------- + +CMtaFolderPicker::CMtaFolderPicker( sal_uInt32 Flags ) : + m_hStaThread( NULL ), + m_uStaThreadId( 0 ), + m_hEvtThrdReady( NULL ), + m_hwndStaRequestWnd( NULL ) +{ + m_hInstance = GetModuleHandleA( FOLDERPICKER_SRV_DLL_NAME ); + OSL_ENSURE( m_hInstance, "The name of the FolderPicker service dll must have changed" ); + + ZeroMemory( &m_bi, sizeof( m_bi ) ); + + // !!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!! + // + // Remember: This HACK prevents you from stepping + // through your code in the debugger because if you + // set a break point in the ctor here the debugger + // may become the owner of the FolderBrowse dialog + // and so it seems that the Visual Studio and the + // office are hanging + m_bi.hwndOwner = GetForegroundWindow( ); + + /* + Flag Available + -------------------------------- + BIF_EDITBOX Version 4.71 + BIF_NEWDIALOGSTYLE Version 5.0 + BIF_SHAREABLE Version 5.0 + BIF_VALIDATE Version 4.71 + + Version 4.71 - Internet Explorer 4.0 + Version 5.0 - Internet Explorer 5.0 + Windows 2000 + */ + m_bi.ulFlags = Flags; + + m_bi.lpfn = CMtaFolderPicker::FolderPickerCallback; + m_bi.lParam = reinterpret_cast< LPARAM >( this ); + + //--------------------------------------- + // read the default strings for title and + // description from a resource file + + CResourceProvider ResProvider; + + m_dialogTitle = ResProvider.getResString( 500 ); + m_Description = ResProvider.getResString( 501 ); + + // signals that the thread was successfully set up + m_hEvtThrdReady = CreateEventA( + 0, + MANUAL_RESET, + INIT_NONSIGNALED, + NULL ); + + if ( m_hEvtThrdReady ) + { + // setup the sta thread + m_hStaThread = (HANDLE)_beginthreadex( + NULL, + 0, + CMtaFolderPicker::StaThreadProc, + this, + 0, + &m_uStaThreadId ); + + OSL_ASSERT( m_hStaThread ); + } + + OSL_ASSERT( m_hEvtThrdReady ); +} + +//-------------------------------------------------------------------- +// dtor +//-------------------------------------------------------------------- + +CMtaFolderPicker::~CMtaFolderPicker( ) +{ + // only if the is a valid event handle + // there may also be a thread a hidden + // target request window and so on + // see ctor + if ( m_hEvtThrdReady ) + { + // block calling threads because we + // are about to shutdown + ResetEvent( m_hEvtThrdReady ); + + // force the destruction of the sta thread request window + // and the end of the thread + // remeber: DestroyWindow may only be called from within + // the thread that created the window + if ( IsWindow( m_hwndStaRequestWnd ) ) + { + SendMessageA( m_hwndStaRequestWnd, MSG_SHUTDOWN, 0, 0 ); + + // we place unregister class here because + // if we have a valid window we must have + // sucessfully registered a window class + // if the creation of the window itself + // failed after registering the window + // class we have unregistered it immediately + // in createStaRequestWindow below + UnregisterStaRequestWindowClass( ); + } + + if ( m_hStaThread ) + { + // wait for thread shutdown + sal_uInt32 dwResult = WaitForSingleObject( m_hStaThread, MAX_WAITTIME ); + OSL_ENSURE( dwResult == WAIT_OBJECT_0, "sta thread could not terminate" ); + + // terminate the thread if it + // doesn't shutdown itself + if ( WAIT_OBJECT_0 != dwResult ) + TerminateThread( + m_hStaThread, sal::static_int_cast< DWORD >(-1) ); + + CloseHandle( m_hStaThread ); + } + + CloseHandle( m_hEvtThrdReady ); + } +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +sal_Bool CMtaFolderPicker::browseForFolder( ) +{ + sal_Bool bRet = sal_False; + + if (IsMTA()) + { + + OSL_ASSERT( m_hEvtThrdReady ); + + if ( WaitForSingleObject( m_hEvtThrdReady, MAX_WAITTIME ) != WAIT_OBJECT_0 ) + { + OSL_ENSURE( sal_False, "sta thread not ready" ); + return sal_False; + } + + RequestContext aReqCtx; + + if ( !InitializeRequestContext( &aReqCtx ) ) + { + OSL_ASSERT( sal_False ); + return sal_False; + } + + // marshall request into the sta thread + PostMessageA( + m_hwndStaRequestWnd, + MSG_BROWSEFORFOLDER, + 0, + reinterpret_cast< LPARAM >( &aReqCtx ) ); + + // waiting for the event to be signaled or + // window messages so that we don't block + // our parent window + + sal_Bool bContinue = sal_True; + + while ( bContinue ) + { + DWORD dwResult = MsgWaitForMultipleObjects( + 1, &aReqCtx.hEvent, FALSE, INFINITE, QS_ALLEVENTS ); + + switch ( dwResult ) + { + // the request context event is signaled + case WAIT_OBJECT_0: + bContinue = sal_False; + break; + + // a window message has arrived + case WAIT_OBJECT_0 + 1: + { + // dispatching all messages but we expect to + // receive only paint or timer messages that's + // why we don't need to call TranslateMessage or + // TranslateAccelerator, because keybord or + // mouse messages are for the FolderPicker which + // is in the foreground and should not arrive here + MSG msg; + while ( PeekMessageA( &msg, NULL, 0, 0, PM_REMOVE ) ) + DispatchMessageA(&msg); + } + break; + + // should not happen + default: + OSL_ASSERT( sal_False ); + } + } + + /*sal_Bool*/ bRet = aReqCtx.bRet; + DeinitializeRequestContext( &aReqCtx ); + } + else + { + bRet = onBrowseForFolder(); + } + + return bRet; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +void SAL_CALL CMtaFolderPicker::setDisplayDirectory( const OUString& aDirectory ) +{ + m_displayDir = aDirectory; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +OUString SAL_CALL CMtaFolderPicker::getDisplayDirectory( ) +{ + return m_displayDir; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +OUString SAL_CALL CMtaFolderPicker::getDirectory( ) +{ + return m_SelectedDir; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +void SAL_CALL CMtaFolderPicker::setDescription( const rtl::OUString& aDescription ) +{ + m_Description = aDescription; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +void SAL_CALL CMtaFolderPicker::setTitle( const OUString& aTitle ) +{ + m_dialogTitle = aTitle; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +OUString SAL_CALL CMtaFolderPicker::getTitle( ) +{ + return m_dialogTitle; +} + +//----------------------------------------------------- +// XCancellable +//----------------------------------------------------- + +void SAL_CALL CMtaFolderPicker::cancel( ) +{ + if ( IsWindow( m_hwnd ) ) + { + // simulate a mouse click to the + // cancel button + PostMessageA( + m_hwnd, + WM_COMMAND, + MAKEWPARAM( IDCANCEL, BN_CLICKED ), + (LPARAM)GetDlgItem( m_hwnd, IDCANCEL ) ); + } +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +sal_Bool SAL_CALL CMtaFolderPicker::onBrowseForFolder( ) +{ + sal_Bool bRet; + LPITEMIDLIST lpiid; + + // pre SHBrowseFroFolder + + m_bi.pidlRoot = 0; + m_bi.pszDisplayName = reinterpret_cast<LPWSTR>(m_pathBuff.get()); + + if ( m_Description.getLength( ) ) + m_bi.lpszTitle = reinterpret_cast<LPCWSTR>(m_Description.getStr( )); + + lpiid = SHBrowseForFolderW( &m_bi ); + bRet = ( NULL != lpiid ); + + // post SHBrowseForFolder + + m_SelectedDir = getPathFromItemIdList( lpiid ); + releaseItemIdList( lpiid ); + + return bRet; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +void SAL_CALL CMtaFolderPicker::releaseItemIdList( LPITEMIDLIST lpItemIdList ) +{ + IMallocPtr pIMalloc; + SHGetMalloc(&pIMalloc); + if (pIMalloc.is()) + { + pIMalloc->Free(lpItemIdList); + lpItemIdList = NULL; + } +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +LPITEMIDLIST SAL_CALL CMtaFolderPicker::getItemIdListFromPath( const rtl::OUString& aDirectory ) +{ + // parameter checking + if ( !aDirectory.getLength( ) ) + return NULL; + + LPITEMIDLIST lpItemIdList(NULL); + + IShellFolderPtr pIShellFolder; + SHGetDesktopFolder(&pIShellFolder); + + if (pIShellFolder.is()) + { + pIShellFolder->ParseDisplayName( + NULL, + NULL, + reinterpret_cast<LPWSTR>(const_cast< sal_Unicode* >( aDirectory.getStr( ) )), + NULL, + &lpItemIdList, + NULL ); + } + + return lpItemIdList; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +OUString SAL_CALL CMtaFolderPicker::getPathFromItemIdList( LPCITEMIDLIST lpItemIdList ) +{ + OUString path; + + if ( lpItemIdList ) + { + bool bRet = SHGetPathFromIDListW( lpItemIdList, reinterpret_cast<LPWSTR>(m_pathBuff.get()) ); + if ( bRet ) + path = m_pathBuff.get( ); + } + + return path; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +void SAL_CALL CMtaFolderPicker::enableOk( sal_Bool bEnable ) +{ + OSL_ASSERT( IsWindow( m_hwnd ) ); + + SendMessageW( + m_hwnd, + BFFM_ENABLEOK, + static_cast< WPARAM >( 0 ), + static_cast< LPARAM >( bEnable ) ); +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +void SAL_CALL CMtaFolderPicker::setSelection( const rtl::OUString& aDirectory ) +{ + OSL_ASSERT( IsWindow( m_hwnd ) ); + +#ifdef _MSC_VER +#pragma message( "#######################################" ) +#pragma message( "SendMessageW wrapper has to be extended" ) +#pragma message( "#######################################" ) +#endif + + SendMessageW( + m_hwnd, + BFFM_SETSELECTIONW, + static_cast< WPARAM >( sal_True ), + reinterpret_cast< LPARAM >( aDirectory.getStr( ) ) ); +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +void SAL_CALL CMtaFolderPicker::setStatusText( const rtl::OUString& aStatusText ) +{ + OSL_ASSERT( IsWindow( m_hwnd ) ); + + SendMessageW( + m_hwnd, + BFFM_SETSTATUSTEXTW, + static_cast< WPARAM >( 0 ), + reinterpret_cast< LPARAM >( aStatusText.getStr( ) ) ); +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +void SAL_CALL CMtaFolderPicker::onInitialized( ) +{ + LPITEMIDLIST lpiidDisplayDir = getItemIdListFromPath( m_displayDir ); + + if ( lpiidDisplayDir ) + { + SendMessageA( + m_hwnd, + BFFM_SETSELECTION, + (WPARAM)FALSE, + (LPARAM) lpiidDisplayDir ); + + releaseItemIdList( lpiidDisplayDir ); + } +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +sal_uInt32 CMtaFolderPicker::onValidateFailed() +{ + // to be overwritten by subclasses + return 1; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +int CALLBACK CMtaFolderPicker::FolderPickerCallback( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData ) +{ + CMtaFolderPicker* pImpl = reinterpret_cast< CMtaFolderPicker* >( lpData ); + OSL_ASSERT( pImpl ); + + int nRC = 0; + + switch( uMsg ) + { + case BFFM_INITIALIZED: + pImpl->m_hwnd = hwnd; + pImpl->onInitialized( ); + SetWindowTextW( hwnd, reinterpret_cast<LPCWSTR>(pImpl->m_dialogTitle.getStr()) ); + break; + + case BFFM_SELCHANGED: + pImpl->m_hwnd = hwnd; + pImpl->onSelChanged( + pImpl->getPathFromItemIdList( + reinterpret_cast< LPITEMIDLIST >( lParam ) ) ); + break; + + case BFFM_VALIDATEFAILEDW: + nRC = pImpl->onValidateFailed(); + break; + + default: + OSL_ASSERT( sal_False ); + } + + return nRC; +} + +//-------------------------------------------------------------------- +// the window proc +//-------------------------------------------------------------------- + +LRESULT CALLBACK CMtaFolderPicker::StaWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) +{ + LRESULT lResult = 0; + CMtaFolderPicker* pImpl = NULL; + + /* + we connect to the belonging class instance of this + window using SetProp, GetProp etc. + this may fail if somehow the class instance destroyed + before the window + */ + + switch( uMsg ) + { + case WM_CREATE: + { + LPCREATESTRUCT lpcs = + reinterpret_cast< LPCREATESTRUCT >( lParam ); + + OSL_ASSERT( lpcs->lpCreateParams ); + + // connect the instance handle to the window + SetPropA( hWnd, CURRENT_INSTANCE, lpcs->lpCreateParams ); + } + break; + + case WM_NCDESTROY: + // RemoveProp returns the saved value on success + pImpl = reinterpret_cast< CMtaFolderPicker* >( + RemovePropA( hWnd, CURRENT_INSTANCE ) ); + + OSL_ASSERT( pImpl && !IsBadReadPtr( pImpl, sizeof( CMtaFolderPicker ) ) ); + break; + + case MSG_BROWSEFORFOLDER: + { + RequestContext* aReqCtx = reinterpret_cast< RequestContext* >( lParam ); + OSL_ASSERT( aReqCtx ); + + pImpl = reinterpret_cast< CMtaFolderPicker* >( + GetPropA( hWnd, CURRENT_INSTANCE ) ); + + OSL_ASSERT( pImpl && !IsBadReadPtr( pImpl, sizeof( CMtaFolderPicker ) ) ); + + aReqCtx->bRet = pImpl->onBrowseForFolder( ); + SetEvent( aReqCtx->hEvent ); + } + break; + + case MSG_SHUTDOWN: + pImpl = reinterpret_cast< CMtaFolderPicker* >( + GetPropA( hWnd, CURRENT_INSTANCE ) ); + + OSL_ASSERT( pImpl && !IsBadReadPtr( pImpl, sizeof( CMtaFolderPicker ) ) ); + + DestroyWindow( pImpl->m_hwndStaRequestWnd ); + break; + + case WM_DESTROY: + PostQuitMessage( 0 ); + break; + + default: + lResult = DefWindowProcA( hWnd, uMsg, wParam, lParam ); + break; + } + + return lResult; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +sal_Bool SAL_CALL CMtaFolderPicker::createStaRequestWindow( ) +{ + bool bIsWnd = false; + + if ( RegisterStaRequestWindowClass( ) ) + { + m_hwndStaRequestWnd = CreateWindowA( + g_szWndClsName, NULL, + 0, 0, 0, 0, 0, + NULL, NULL, m_hInstance, + (LPVOID)this // provide the instance of the class + ); + + bIsWnd = IsWindow( m_hwndStaRequestWnd ); + + // we do immediately unregister the window class + // if the creation of the window fails because we + // don't want to spoil the register class counter + if ( !bIsWnd ) + UnregisterStaRequestWindowClass( ); + + OSL_ENSURE( bIsWnd, "sta request window creation failed" ); + } + + return bIsWnd; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +unsigned int CMtaFolderPicker::run( ) +{ + OSL_ASSERT( m_hEvtThrdReady ); + + // setup an sta environment + HRESULT hr = CoInitialize( NULL ); + + // if we can't setup an sta environment + // we stop here and return + if ( FAILED( hr ) ) + { + OSL_ENSURE( sal_False, "CoInitialize failed" ); + return sal::static_int_cast< unsigned int >(-1); + } + + unsigned int nRet; + + if ( createStaRequestWindow( ) ) + { + SetEvent( m_hEvtThrdReady ); + + // pumping messages + MSG msg; + while( GetMessageA( &msg, NULL, 0, 0 ) ) + DispatchMessageA( &msg ); + + nRet = 0; + } + else + { + OSL_ENSURE( sal_False, "failed to create sta thread" ); + nRet = sal::static_int_cast< unsigned int >(-1); + } + + // shutdown sta environment + CoUninitialize( ); + + return nRet; +} + +//-------------------------------------------------------------------- +// +//-------------------------------------------------------------------- + +unsigned int WINAPI CMtaFolderPicker::StaThreadProc( LPVOID pParam ) +{ + CMtaFolderPicker* pInst = + reinterpret_cast<CMtaFolderPicker*>( pParam ); + + OSL_ASSERT( pInst ); + + HRESULT hr = OleInitialize( NULL ); + + unsigned int result = pInst->run( ); + + if ( SUCCEEDED( hr ) ) + OleUninitialize(); + + return result; +} + +//--------------------------------------------------- +// +//--------------------------------------------------- + +ATOM SAL_CALL CMtaFolderPicker::RegisterStaRequestWindowClass( ) +{ + osl::MutexGuard aGuard( s_Mutex ); + + if ( 0 == s_ClassAtom ) + { + WNDCLASSEXA wcex; + + ZeroMemory( &wcex, sizeof( WNDCLASSEXA ) ); + + wcex.cbSize = sizeof(WNDCLASSEXA); + wcex.style = 0; + wcex.lpfnWndProc = static_cast< WNDPROC >( CMtaFolderPicker::StaWndProc ); + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = m_hInstance; + wcex.hIcon = NULL; + wcex.hCursor = NULL; + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = g_szWndClsName; + wcex.hIconSm = NULL; + + s_ClassAtom = RegisterClassExA( &wcex ); + OSL_ASSERT( s_ClassAtom ); + } + + // increment the register class counter + // so that we keep track of the number + // of class registrations + if ( 0 != s_ClassAtom ) + s_StaRequestWndRegisterCount++; + + return s_ClassAtom; +} + +//--------------------------------------------------- +// +//--------------------------------------------------- + +void SAL_CALL CMtaFolderPicker::UnregisterStaRequestWindowClass( ) +{ + osl::MutexGuard aGuard( s_Mutex ); + + OSL_ASSERT( 0 != s_ClassAtom ); + + // update the register class counter + // and unregister the window class if + // counter drops to zero + if ( 0 != s_ClassAtom ) + { + s_StaRequestWndRegisterCount--; + OSL_ASSERT( s_StaRequestWndRegisterCount >= 0 ); + } + + if ( 0 == s_StaRequestWndRegisterCount ) + { + UnregisterClass( + (LPCTSTR)MAKELONG( s_ClassAtom, 0 ), m_hInstance ); + + s_ClassAtom = 0; + } +} diff --git a/fpicker/source/win32/folderpicker/MtaFop.hxx b/fpicker/source/win32/folderpicker/MtaFop.hxx new file mode 100644 index 000000000000..4735300c0ee0 --- /dev/null +++ b/fpicker/source/win32/folderpicker/MtaFop.hxx @@ -0,0 +1,191 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _MTAFOP_HXX_ +#define _MTAFOP_HXX_ + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <osl/mutex.hxx> + +#include <utility> +#ifdef __MINGW32__ +#include <windows.h> +#endif +#if defined _MSC_VER +#pragma warning(push, 1) +#pragma warning(disable: 4917) +#endif +#include <objidl.h> +#include <shlobj.h> +#if defined _MSC_VER +#pragma warning(pop) +#endif +#include "..\misc\WinImplHelper.hxx" + +//---------------------------------------------------------------- +// a simple helper class used to provide a buffer for different +// Win32 file and directory functions +//---------------------------------------------------------------- + +class CAutoPathBuff +{ +public: + CAutoPathBuff( size_t size = 0 ) + { + if (0 == size) + size = 32000; // max path length under Win2000 + + pBuff = new sal_Unicode[size]; + + OSL_POSTCOND(pBuff,"Could not allocate path buffer"); + } + + ~CAutoPathBuff( ) + { + delete [] pBuff; + } + + operator sal_Unicode*( ) + { + OSL_PRECOND( pBuff, \ + "No path buffer allocated" ); + return pBuff; + } + + sal_Unicode* get( ) + { + OSL_PRECOND( pBuff, \ + "No path buffer allocated" ); + return pBuff; + } + +private: + sal_Unicode* pBuff; +}; + +//-------------------------------------------------------- +// the Mta-Ole clipboard class is for internal use only! +// only one instance of this class should be created, the +// user has to ensure this! +// the class is not thread-safe because it will be used +// only from within the clipboard service and the methods +// of the clipboard service are already synchronized +//-------------------------------------------------------- + +class CMtaFolderPicker +{ +public: + CMtaFolderPicker( sal_uInt32 Flags ); + virtual ~CMtaFolderPicker( ); + + // shell functions + sal_Bool SAL_CALL browseForFolder( ); + + virtual void SAL_CALL setDisplayDirectory( const rtl::OUString& aDirectory ); + virtual rtl::OUString SAL_CALL getDisplayDirectory( ); + virtual rtl::OUString SAL_CALL getDirectory( ); + + virtual void SAL_CALL setDescription( const rtl::OUString& aDescription ); + + virtual void SAL_CALL setTitle( const rtl::OUString& aTitle ); + rtl::OUString SAL_CALL getTitle( ); + + //----------------------------------------------------- + // XCancellable + //----------------------------------------------------- + + virtual void SAL_CALL cancel( ); + +protected: + void SAL_CALL enableOk( sal_Bool bEnable ); + void SAL_CALL setSelection( const rtl::OUString& aDirectory ); + void SAL_CALL setStatusText( const rtl::OUString& aStatusText ); + + virtual void SAL_CALL onInitialized( ); + virtual void SAL_CALL onSelChanged( const rtl::OUString& aNewPath ) = 0; + +private: + sal_uInt32 onValidateFailed(); + + // helper functions + LPITEMIDLIST SAL_CALL getItemIdListFromPath( const rtl::OUString& aDirectory ); + rtl::OUString SAL_CALL getPathFromItemIdList( LPCITEMIDLIST lpItemIdList ); + void SAL_CALL releaseItemIdList( LPITEMIDLIST lpItemIdList ); + + unsigned int run( ); + + // create a hidden windows which serves as an request + // target; so we guarantee synchronization + sal_Bool SAL_CALL createStaRequestWindow( ); + + //--------------------------------------------------------------- + // message handler functions; remeber these functions are called + // from a different thread context! + //--------------------------------------------------------------- + + sal_Bool SAL_CALL onBrowseForFolder( ); + + static LRESULT CALLBACK StaWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); + static unsigned int WINAPI StaThreadProc( LPVOID pParam ); + + static int CALLBACK FolderPickerCallback( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData ); + +protected: + HWND m_hwnd; + +private: + ATOM SAL_CALL RegisterStaRequestWindowClass( ); + void SAL_CALL UnregisterStaRequestWindowClass( ); + +private: + HANDLE m_hStaThread; + unsigned m_uStaThreadId; + HANDLE m_hEvtThrdReady; + HWND m_hwndStaRequestWnd; + rtl::OUString m_dialogTitle; + rtl::OUString m_Description; + rtl::OUString m_displayDir; + rtl::OUString m_SelectedDir; + BROWSEINFOW m_bi; + CAutoPathBuff m_pathBuff; + HINSTANCE m_hInstance; + + // the request window class has to be registered only + // once per process, so multiple instance of this class + // share the registered window class + static ATOM s_ClassAtom; + static osl::Mutex s_Mutex; + static sal_Int32 s_StaRequestWndRegisterCount; + +// prevent copy and assignment +private: + CMtaFolderPicker( const CMtaFolderPicker& ); + CMtaFolderPicker& operator=( const CMtaFolderPicker& ); +}; + +#endif diff --git a/fpicker/source/win32/folderpicker/WinFOPImpl.cxx b/fpicker/source/win32/folderpicker/WinFOPImpl.cxx new file mode 100644 index 000000000000..1aac4f5f8c53 --- /dev/null +++ b/fpicker/source/win32/folderpicker/WinFOPImpl.cxx @@ -0,0 +1,168 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_fpicker.hxx" + +//------------------------------------------------------------------------ +// includes +//------------------------------------------------------------------------ + +#ifndef _WINDIRBROWSEIMPL_HXX_ +#include "WinFOPImpl.hxx" +#endif +#include <osl/diagnose.h> +#include <com/sun/star/lang/EventObject.hpp> + +#ifndef _COM_SUN_STAR_UI_FILEDIALOGRESULTS_HPP_ +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#endif +#include "FopEvtDisp.hxx" +#include <osl/file.hxx> +#include "FolderPicker.hxx" + +//------------------------------------------------------------------------ +// namespace directives +//------------------------------------------------------------------------ + +using com::sun::star::uno::RuntimeException; +using com::sun::star::lang::IllegalArgumentException; +using com::sun::star::lang::EventObject; +using rtl::OUString; + +using namespace com::sun::star::ui::dialogs; +using osl::FileBase; + +//------------------------------------------------------------------------ +// +//------------------------------------------------------------------------ + +const OUString BACKSLASH = OUString::createFromAscii( "\\" ); + +//------------------------------------------------------------------------ +// ctor +//------------------------------------------------------------------------ + +CWinFolderPickerImpl::CWinFolderPickerImpl( CFolderPicker* aFolderPicker ) : + CMtaFolderPicker( BIF_RETURNONLYFSDIRS | BIF_RETURNFSANCESTORS | BIF_EDITBOX | BIF_VALIDATE ), + m_pFolderPicker( aFolderPicker ), + m_nLastDlgResult( ::com::sun::star::ui::dialogs::ExecutableDialogResults::CANCEL ) +{ +} + +//------------------------------------------------------------------------ +// get directory in URL format, convert it to system format and set the +// member variable +// If the given URL for the directory is invalid the function throws an +// IllegalArgumentException +// If the specified path is well formed but invalid for the underlying +// OS the FolderPicker starts in the root of the file system hierarchie +//------------------------------------------------------------------------ + +void SAL_CALL CWinFolderPickerImpl::setDisplayDirectory( const OUString& aDirectory ) + throw( IllegalArgumentException, RuntimeException ) +{ + OUString sysDir; + + if( aDirectory.getLength( ) ) + { + // assuming that this function succeeds after successful execution + // of getAbsolutePath + ::osl::FileBase::RC rc = + ::osl::FileBase::getSystemPathFromFileURL( aDirectory, sysDir ); + + if ( ::osl::FileBase::E_None != rc ) + throw IllegalArgumentException( + OUString::createFromAscii( "directory is not a valid file url" ), + static_cast< XFolderPicker* >( m_pFolderPicker ), + 1 ); + + // we ensure that there is a trailing '/' at the end of + // he given file url, because the windows functions only + // works correctly when providing "c:\" or an environment + // variable like "=c:=c:\.." etc. is set, else the + // FolderPicker would stand in the root of the shell + // hierarchie which is the desktop folder + if ( sysDir.lastIndexOf( BACKSLASH ) != (sysDir.getLength( ) - 1) ) + sysDir += BACKSLASH; + } + + // call base class method + CMtaFolderPicker::setDisplayDirectory( sysDir ); +} + +//------------------------------------------------------------------------ +// we return the directory in URL format +//------------------------------------------------------------------------ + +OUString CWinFolderPickerImpl::getDisplayDirectory( ) + throw( RuntimeException ) +{ + // call base class method to get the directory in system format + OUString displayDirectory = CMtaFolderPicker::getDisplayDirectory( ); + + OUString displayDirectoryURL; + if ( displayDirectory.getLength( ) ) + ::osl::FileBase::getFileURLFromSystemPath( displayDirectory, displayDirectoryURL ); + + return displayDirectoryURL; +} + +//------------------------------------------------------------------------ +// +//------------------------------------------------------------------------ + +OUString SAL_CALL CWinFolderPickerImpl::getDirectory( ) throw( RuntimeException ) +{ + OUString sysDir = CMtaFolderPicker::getDirectory( ); + OUString dirURL; + + if ( sysDir.getLength( ) ) + ::osl::FileBase::getFileURLFromSystemPath( sysDir, dirURL ); + + return dirURL; +} + +//------------------------------------------------------------------------ +// +//------------------------------------------------------------------------ + +sal_Int16 SAL_CALL CWinFolderPickerImpl::execute( ) throw( RuntimeException ) +{ + return m_nLastDlgResult = CMtaFolderPicker::browseForFolder( ) ? + ::com::sun::star::ui::dialogs::ExecutableDialogResults::OK : + ::com::sun::star::ui::dialogs::ExecutableDialogResults::CANCEL; +} + +//--------------------------------------------------------------------- +// +//--------------------------------------------------------------------- + +void CWinFolderPickerImpl::onSelChanged( const OUString& aNewPath ) +{ + setStatusText( aNewPath ); +} diff --git a/fpicker/source/win32/folderpicker/WinFOPImpl.hxx b/fpicker/source/win32/folderpicker/WinFOPImpl.hxx new file mode 100644 index 000000000000..eb7889f86167 --- /dev/null +++ b/fpicker/source/win32/folderpicker/WinFOPImpl.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _WINFOPIMPL_HXX_ +#define _WINFOPIMPL_HXX_ + + +//------------------------------------------------------------------------ +// includes +//------------------------------------------------------------------------ + +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include "MtaFop.hxx" + +//------------------------------------------------------------------------ +// forward +//------------------------------------------------------------------------ + +class CFolderPicker; + +//------------------------------------------------------------------------ +// deklarations +//------------------------------------------------------------------------ + +class CWinFolderPickerImpl : public CMtaFolderPicker +{ +public: + CWinFolderPickerImpl( CFolderPicker* aFolderPicker ); + + //----------------------------------------------------------------------------------------- + // XExecutableDialog + //----------------------------------------------------------------------------------------- + + virtual sal_Int16 SAL_CALL execute( ) + throw( com::sun::star::uno::RuntimeException ); + + //----------------------------------------------------- + // XFolderPicker + //----------------------------------------------------- + + virtual void SAL_CALL setDisplayDirectory( const rtl::OUString& aDirectory ) + throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException ); + + virtual rtl::OUString SAL_CALL getDisplayDirectory( ) + throw( com::sun::star::uno::RuntimeException ); + + virtual rtl::OUString SAL_CALL getDirectory( ) + throw( com::sun::star::uno::RuntimeException ); + +protected: + virtual void SAL_CALL onSelChanged( const rtl::OUString& aNewPath ); + +private: + CFolderPicker* m_pFolderPicker; + sal_Int16 m_nLastDlgResult; +}; + +#endif diff --git a/fpicker/source/win32/folderpicker/fop.xml b/fpicker/source/win32/folderpicker/fop.xml new file mode 100644 index 000000000000..7c6835a88cb9 --- /dev/null +++ b/fpicker/source/win32/folderpicker/fop.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>fop</module-name> + <component-description> + <author> Tino Rachui </author> + <name>com.sun.star.comp.ui.dialogs.FolderPicker</name> + <description> + The win32 implementation of the FolderPicker service. +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language> c++ </language> + <status value="beta"/> + <supported-service> com.sun.star.ui.dialogs.FolderPicker </supported-service> + <service-dependency>...</service-dependency> + <type> com.sun.star.ui.dialogs.XExecutableDialog </type> + <type> com.sun.star.ui.dialogs.XFolderPicker </type> + <type> com.sun.star.ui.dialogs.ExecutableDialogException </type> + <type> com.sun.star.ui.dialogs.ExecutableDialogResults </type> + <type> com.sun.star.ui.dialogs.ExtendedFilePickerElementIds </type> + <type> com.sun.star.ui.dialogs.CommonFilePickerElementIds </type> + <type> com.sun.star.util.XCancellable </type> + <type> com.sun.star.lang.XMultiServiceFactory </type> + <type> com.sun.star.lang.XSingleServiceFactory </type> + <type> com.sun.star.lang.XServiceInfo </type> + <type> com.sun.star.lang.XTypeProvider </type> + <type> com.sun.star.lang.IllegalArgumentException </type> + <type> com.sun.star.uno.TypeClass </type> + <type> com.sun.star.uno.XWeak </type> + <type> com.sun.star.uno.XAggregation </type> + <type> com.sun.star.registry.XRegistryKey </type> + <type> com.sun.star.container.XSet </type> + </component-description> + <project-build-dependency> cppuhelper </project-build-dependency> + <project-build-dependency> cppu </project-build-dependency> + <project-build-dependency> sal </project-build-dependency> + <runtime-module-dependency> cppuhelper </runtime-module-dependency> + <runtime-module-dependency> cppu2 </runtime-module-dependency> + <runtime-module-dependency> sal2 </runtime-module-dependency> +</module-description> diff --git a/fpicker/source/win32/folderpicker/makefile.mk b/fpicker/source/win32/folderpicker/makefile.mk new file mode 100644 index 000000000000..7f0556d7cecb --- /dev/null +++ b/fpicker/source/win32/folderpicker/makefile.mk @@ -0,0 +1,51 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. +PRJNAME=fpicker +TARGET=fop +#LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE +COMP1TYPELIST=$(TARGET) + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +# enable rtti +CFLAGS+=-GR + +SLOFILES=$(SLO)$/fopentry.obj\ + $(SLO)$/folderpicker.obj\ + $(SLO)$/WinFopImpl.obj\ + $(SLO)$/MtaFop.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/fpicker/source/win32/folderpicker/workbench/Test_fops.cxx b/fpicker/source/win32/folderpicker/workbench/Test_fops.cxx new file mode 100644 index 000000000000..472562194566 --- /dev/null +++ b/fpicker/source/win32/folderpicker/workbench/Test_fops.cxx @@ -0,0 +1,203 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_fpicker.hxx" + + +//----------------------------------------------------------- +// interface includes +//----------------------------------------------------------- +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/registry/XSimpleRegistry.hpp> +#include <osl/file.hxx> + +//-------------------------------------------------------------- +// other includes +//-------------------------------------------------------------- +#include <cppuhelper/servicefactory.hxx> + +#ifndef _RTL_USTRING_ +#include <rtl/ustring.hxx> +#endif +#include <sal/types.h> +#include <osl/diagnose.h> + +#ifndef _COM_SUN_STAR_UI_XFOLDERPICKER_HPP_ +#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#endif + +#ifndef _COM_SUN_STAR_UI_FILEDIALOGRESULTS_HPP_ +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#endif +#include <cppuhelper/implbase1.hxx> + +#include <stdio.h> + +#ifndef _FPSERVICEINFO_HXX_ +#include "..\FOPServiceInfo.hxx" +#endif + +#include <osl/file.hxx> + +#define _WIN32_DCOM + +#include <windows.h> + +//-------------------------------------------------------------- +// namesapces +//-------------------------------------------------------------- + +using namespace ::rtl ; +using namespace ::cppu ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::lang ; +using namespace ::com::sun::star::ui::dialogs; +using namespace std ; + +//-------------------------------------------------------------- +// defines +//-------------------------------------------------------------- + +#define RDB_SYSPATH "D:\\Projects\\gsl\\sysui\\wntmsci7\\bin\\applicat.rdb" + +//-------------------------------------------------------------- +// global variables +//-------------------------------------------------------------- + +Reference< XMultiServiceFactory > g_xFactory; + +/* +void CreateDeepDirectory( ) +{ + // create a deep directory + + OUString aPathURL( L"file:///d|/Deep" ); + OUString normalizedPath; + + OSL_ASSERT( ::osl::FileBase::E_None == \ + ::osl::FileBase::getNormalizedPathFromFileURL( aPathURL, normalizedPath ) ); + + while( ::osl::FileBase::E_None == osl::Directory::create( normalizedPath ) ) + { + aPathURL += L"/Deep"; + OSL_ASSERT( ::osl::FileBase::E_None == \ + ::osl::FileBase::getNormalizedPathFromFileURL( aPathURL, normalizedPath ) ); + } + +} +*/ + +//-------------------------------------------------------------- +// main +//-------------------------------------------------------------- + + +int SAL_CALL main(int /*nArgc*/, char* /*Argv[]*/, char* /*Env[]*/ ) +{ + CoInitializeEx( NULL, COINIT_MULTITHREADED ); + + printf("Starting test of FolderPicker Service\n"); + + //CreateDeepDirectory( ); + + //------------------------------------------------- + // get the global service-manager + //------------------------------------------------- + + // Get global factory for uno services. + OUString rdbName = OUString( RTL_CONSTASCII_USTRINGPARAM( RDB_SYSPATH ) ); + Reference< XMultiServiceFactory > g_xFactory( createRegistryServiceFactory( rdbName ) ); + + // Print a message if an error occured. + if ( g_xFactory.is() == sal_False ) + { + OSL_ENSURE(sal_False, "Can't create RegistryServiceFactory"); + return(-1); + } + + printf("Creating RegistryServiceFactory successful\n"); + + //------------------------------------------------- + // try to get an Interface to a XFilePicker Service + //------------------------------------------------- + + Reference< XFolderPicker > xFolderPicker; + + xFolderPicker = Reference< XFolderPicker >( + g_xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM ( FOLDER_PICKER_SERVICE_NAME ) ) ), UNO_QUERY ); + + if ( xFolderPicker.is() == sal_False ) + { + OSL_ENSURE( sal_False, "Error creating FolderPicker Service" ); + return(-1); + } + + try + { + xFolderPicker->setDisplayDirectory( L"file:///C|" ); + xFolderPicker->setTitle( L"FolderBrowse Dialog" ); + xFolderPicker->execute( ); + + OUString rootDir = xFolderPicker->getDisplayDirectory( ); + OUString selectedDir = xFolderPicker->getDirectory( ); + + xFolderPicker->setDisplayDirectory( selectedDir ); + xFolderPicker->execute( ); + + rootDir = xFolderPicker->getDisplayDirectory( ); + selectedDir = xFolderPicker->getDirectory( ); + } + catch( ::com::sun::star::uno::Exception& ) + { + MessageBox( NULL, "Exception caught!", "Error", MB_OK ); + } + + //-------------------------------------------------- + // shutdown + //-------------------------------------------------- + + // Cast factory to XComponent + Reference< XComponent > xComponent( g_xFactory, UNO_QUERY ); + + // Print a message if an error occured. + if ( xComponent.is() == sal_False ) + { + OSL_ENSURE(sal_False, "Error shuting down"); + } + + // Dispose and clear factory + xComponent->dispose(); + g_xFactory.clear(); + g_xFactory = Reference< XMultiServiceFactory >(); + + printf("Test successful\n"); + + CoUninitialize( ); + + return 0; +} diff --git a/fpicker/source/win32/folderpicker/workbench/makefile.mk b/fpicker/source/win32/folderpicker/workbench/makefile.mk new file mode 100644 index 000000000000..bfdf840989f8 --- /dev/null +++ b/fpicker/source/win32/folderpicker/workbench/makefile.mk @@ -0,0 +1,62 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. + +PRJNAME= sysui +TARGET= testfops +LIBTARGET= NO +TARGETTYPE= CUI + + +# --- Settings ----------------------------------------------------- +#.INCLUDE : $(PRJ)$/util$/makefile.pmk + +.INCLUDE : settings.mk + +CFLAGS+=-GR -EHa + +# --- Files -------------------------------------------------------- + + +OBJFILES= $(OBJ)$/test_fops.obj + +APP1TARGET= test_fops + +APP1OBJS= $(OBJ)$/test_fops.obj + +APP1STDLIBS+= $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) \ + $(USER32LIB)\ + $(OLE32LIB) + +APP1DEF= $(MISC)$/$(APP1TARGET).def + +# --- Targets ------------------------------------------------------ +.INCLUDE : target.mk + |