diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:55:39 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:55:39 +0100 |
commit | 371976860088a3c5c3df9840dcdfd632d9d6f1f5 (patch) | |
tree | 9e9f67205cd5b72f1031721273e1534a3a1e5b0f /desktop/source/migration/services | |
parent | 651568afad1a585c485384ab6d7b65780fb02256 (diff) |
replace obsolete "master" branch with README that points at new repoHEADmaster-deletedmaster
Diffstat (limited to 'desktop/source/migration/services')
18 files changed, 0 insertions, 2993 deletions
diff --git a/desktop/source/migration/services/autocorrmigration.cxx b/desktop/source/migration/services/autocorrmigration.cxx deleted file mode 100644 index c1e82b30c0..0000000000 --- a/desktop/source/migration/services/autocorrmigration.cxx +++ /dev/null @@ -1,288 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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_desktop.hxx" -#include "autocorrmigration.hxx" -#include <i18npool/mslangid.hxx> -#include <tools/urlobj.hxx> -#include <unotools/bootstrap.hxx> - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - - -//......................................................................... -namespace migration -{ -//......................................................................... - - - static ::rtl::OUString sSourceSubDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/autocorr" ) ); - static ::rtl::OUString sTargetSubDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/autocorr" ) ); - static ::rtl::OUString sBaseName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/acor" ) ); - static ::rtl::OUString sSuffix = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".dat" ) ); - - - // ============================================================================= - // component operations - // ============================================================================= - - ::rtl::OUString AutocorrectionMigration_getImplementationName() - { - static ::rtl::OUString* pImplName = 0; - if ( !pImplName ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pImplName ) - { - static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.desktop.migration.Autocorrection" ) ); - pImplName = &aImplName; - } - } - return *pImplName; - } - - // ----------------------------------------------------------------------------- - - Sequence< ::rtl::OUString > AutocorrectionMigration_getSupportedServiceNames() - { - static Sequence< ::rtl::OUString >* pNames = 0; - if ( !pNames ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pNames ) - { - static Sequence< ::rtl::OUString > aNames(1); - aNames.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.migration.Autocorrection" ) ); - pNames = &aNames; - } - } - return *pNames; - } - - // ============================================================================= - // AutocorrectionMigration - // ============================================================================= - - AutocorrectionMigration::AutocorrectionMigration() - { - } - - // ----------------------------------------------------------------------------- - - AutocorrectionMigration::~AutocorrectionMigration() - { - } - - // ----------------------------------------------------------------------------- - - TStringVectorPtr AutocorrectionMigration::getFiles( const ::rtl::OUString& rBaseURL ) const - { - TStringVectorPtr aResult( new TStringVector ); - ::osl::Directory aDir( rBaseURL); - - if ( aDir.open() == ::osl::FileBase::E_None ) - { - // iterate over directory content - TStringVector aSubDirs; - ::osl::DirectoryItem aItem; - while ( aDir.getNextItem( aItem ) == ::osl::FileBase::E_None ) - { - ::osl::FileStatus aFileStatus( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL ); - if ( aItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None ) - { - if ( aFileStatus.getFileType() == ::osl::FileStatus::Directory ) - aSubDirs.push_back( aFileStatus.getFileURL() ); - else - aResult->push_back( aFileStatus.getFileURL() ); - } - } - - // iterate recursive over subfolders - TStringVector::const_iterator aI = aSubDirs.begin(); - while ( aI != aSubDirs.end() ) - { - TStringVectorPtr aSubResult = getFiles( *aI ); - aResult->insert( aResult->end(), aSubResult->begin(), aSubResult->end() ); - ++aI; - } - } - - return aResult; - } - - // ----------------------------------------------------------------------------- - - ::osl::FileBase::RC AutocorrectionMigration::checkAndCreateDirectory( INetURLObject& rDirURL ) - { - ::osl::FileBase::RC aResult = ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - if ( aResult == ::osl::FileBase::E_NOENT ) - { - INetURLObject aBaseURL( rDirURL ); - aBaseURL.removeSegment(); - checkAndCreateDirectory( aBaseURL ); - return ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - } - else - { - return aResult; - } - } - - // ----------------------------------------------------------------------------- - - void AutocorrectionMigration::copyFiles() - { - ::rtl::OUString sTargetDir; - ::utl::Bootstrap::PathStatus aStatus = ::utl::Bootstrap::locateUserInstallation( sTargetDir ); - if ( aStatus == ::utl::Bootstrap::PATH_EXISTS ) - { - sTargetDir += sTargetSubDir; - TStringVectorPtr aFileList = getFiles( m_sSourceDir ); - TStringVector::const_iterator aI = aFileList->begin(); - while ( aI != aFileList->end() ) - { - ::rtl::OUString sSourceLocalName = aI->copy( m_sSourceDir.getLength() ); - sal_Int32 nStart = sBaseName.getLength(); - sal_Int32 nEnd = sSourceLocalName.lastIndexOf ( sSuffix ); - ::rtl::OUString sLanguageType = sSourceLocalName.copy( nStart, nEnd - nStart ); - ::rtl::OUString sIsoName = MsLangId::convertLanguageToIsoString( (LanguageType) sLanguageType.toInt32() ); - ::rtl::OUString sTargetLocalName = sBaseName; - sTargetLocalName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "_" )); - sTargetLocalName += sIsoName; - sTargetLocalName += sSuffix; - ::rtl::OUString sTargetName = sTargetDir + sTargetLocalName; - INetURLObject aURL( sTargetName ); - aURL.removeSegment(); - checkAndCreateDirectory( aURL ); - ::osl::FileBase::RC aResult = ::osl::File::copy( *aI, sTargetName ); - if ( aResult != ::osl::FileBase::E_None ) - { - ::rtl::OString aMsg( "AutocorrectionMigration::copyFiles: cannot copy " ); - aMsg += ::rtl::OUStringToOString( *aI, RTL_TEXTENCODING_UTF8 ) + " to " - + ::rtl::OUStringToOString( sTargetName, RTL_TEXTENCODING_UTF8 ); - OSL_FAIL( aMsg.getStr() ); - } - ++aI; - } - } - else - { - OSL_FAIL( "AutocorrectionMigration::copyFiles: no user installation!" ); - } - } - - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - - ::rtl::OUString AutocorrectionMigration::getImplementationName() throw (RuntimeException) - { - return AutocorrectionMigration_getImplementationName(); - } - - // ----------------------------------------------------------------------------- - - sal_Bool AutocorrectionMigration::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; - } - - // ----------------------------------------------------------------------------- - - Sequence< ::rtl::OUString > AutocorrectionMigration::getSupportedServiceNames() throw (RuntimeException) - { - return AutocorrectionMigration_getSupportedServiceNames(); - } - - // ----------------------------------------------------------------------------- - // XInitialization - // ----------------------------------------------------------------------------- - - void AutocorrectionMigration::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - const Any* pIter = aArguments.getConstArray(); - const Any* pEnd = pIter + aArguments.getLength(); - for ( ; pIter != pEnd ; ++pIter ) - { - beans::NamedValue aValue; - *pIter >>= aValue; - if ( aValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UserData" ) ) ) - { - if ( !(aValue.Value >>= m_sSourceDir) ) - { - OSL_FAIL( "AutocorrectionMigration::initialize: argument UserData has wrong type!" ); - } - m_sSourceDir += sSourceSubDir; - break; - } - } - } - - // ----------------------------------------------------------------------------- - // XJob - // ----------------------------------------------------------------------------- - - Any AutocorrectionMigration::execute( const Sequence< beans::NamedValue >& ) - throw (lang::IllegalArgumentException, Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - copyFiles(); - - return Any(); - } - - // ============================================================================= - // component operations - // ============================================================================= - - Reference< XInterface > SAL_CALL AutocorrectionMigration_create( - Reference< XComponentContext > const & ) - SAL_THROW( () ) - { - return static_cast< lang::XTypeProvider * >( new AutocorrectionMigration() ); - } - - // ----------------------------------------------------------------------------- - -//......................................................................... -} // namespace migration -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/autocorrmigration.hxx b/desktop/source/migration/services/autocorrmigration.hxx deleted file mode 100644 index 9a8aef32cd..0000000000 --- a/desktop/source/migration/services/autocorrmigration.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 _DESKTOP_AUTOCORRMIGRATION_HXX_ -#define _DESKTOP_AUTOCORRMIGRATION_HXX_ - -#include "misc.hxx" -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/task/XJob.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/implbase3.hxx> -#include <osl/mutex.hxx> -#include <osl/file.hxx> - - -class INetURLObject; - - -//......................................................................... -namespace migration -{ -//......................................................................... - - ::rtl::OUString SAL_CALL AutocorrectionMigration_getImplementationName(); - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL AutocorrectionMigration_getSupportedServiceNames(); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL AutocorrectionMigration_create( - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext ) - SAL_THROW( (::com::sun::star::uno::Exception) ); - - - // ============================================================================= - // class AutocorrectionMigration - // ============================================================================= - - typedef ::cppu::WeakImplHelper3< - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::lang::XInitialization, - ::com::sun::star::task::XJob > AutocorrectionMigration_BASE; - - class AutocorrectionMigration : public AutocorrectionMigration_BASE - { - private: - ::osl::Mutex m_aMutex; - ::rtl::OUString m_sSourceDir; - - TStringVectorPtr getFiles( const ::rtl::OUString& rBaseURL ) const; - ::osl::FileBase::RC checkAndCreateDirectory( INetURLObject& rDirURL ); - void copyFiles(); - - public: - AutocorrectionMigration(); - virtual ~AutocorrectionMigration(); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw (::com::sun::star::uno::RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - // XJob - virtual ::com::sun::star::uno::Any SAL_CALL execute( - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) - throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, - ::com::sun::star::uno::RuntimeException); - }; - -//......................................................................... -} // namespace migration -//......................................................................... - -#endif // _DESKTOP_AUTOCORRMIGRATION_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/basicmigration.cxx b/desktop/source/migration/services/basicmigration.cxx deleted file mode 100644 index dfadba451d..0000000000 --- a/desktop/source/migration/services/basicmigration.cxx +++ /dev/null @@ -1,257 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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_desktop.hxx" -#include "basicmigration.hxx" -#include <tools/urlobj.hxx> -#include <unotools/bootstrap.hxx> - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - - -//......................................................................... -namespace migration -{ -//......................................................................... - - - #define sSourceUserBasic ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/user/basic")) - #define sTargetUserBasic ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/user/__basic_80")) - - // ============================================================================= - // component operations - // ============================================================================= - - ::rtl::OUString BasicMigration_getImplementationName() - { - return ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.desktop.migration.Basic")); - } - - // ----------------------------------------------------------------------------- - - Sequence< ::rtl::OUString > BasicMigration_getSupportedServiceNames() - { - Sequence< ::rtl::OUString > aNames(1); - aNames.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.migration.Basic" ) ); - return aNames; - } - - // ============================================================================= - // BasicMigration - // ============================================================================= - - BasicMigration::BasicMigration() - { - } - - // ----------------------------------------------------------------------------- - - BasicMigration::~BasicMigration() - { - } - - // ----------------------------------------------------------------------------- - - TStringVectorPtr BasicMigration::getFiles( const ::rtl::OUString& rBaseURL ) const - { - TStringVectorPtr aResult( new TStringVector ); - ::osl::Directory aDir( rBaseURL); - - if ( aDir.open() == ::osl::FileBase::E_None ) - { - // iterate over directory content - TStringVector aSubDirs; - ::osl::DirectoryItem aItem; - while ( aDir.getNextItem( aItem ) == ::osl::FileBase::E_None ) - { - ::osl::FileStatus aFileStatus( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL ); - if ( aItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None ) - { - if ( aFileStatus.getFileType() == ::osl::FileStatus::Directory ) - aSubDirs.push_back( aFileStatus.getFileURL() ); - else - aResult->push_back( aFileStatus.getFileURL() ); - } - } - - // iterate recursive over subfolders - TStringVector::const_iterator aI = aSubDirs.begin(); - while ( aI != aSubDirs.end() ) - { - TStringVectorPtr aSubResult = getFiles( *aI ); - aResult->insert( aResult->end(), aSubResult->begin(), aSubResult->end() ); - ++aI; - } - } - - return aResult; - } - - // ----------------------------------------------------------------------------- - - ::osl::FileBase::RC BasicMigration::checkAndCreateDirectory( INetURLObject& rDirURL ) - { - ::osl::FileBase::RC aResult = ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - if ( aResult == ::osl::FileBase::E_NOENT ) - { - INetURLObject aBaseURL( rDirURL ); - aBaseURL.removeSegment(); - checkAndCreateDirectory( aBaseURL ); - return ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - } - else - { - return aResult; - } - } - - // ----------------------------------------------------------------------------- - - void BasicMigration::copyFiles() - { - ::rtl::OUString sTargetDir; - ::utl::Bootstrap::PathStatus aStatus = ::utl::Bootstrap::locateUserInstallation( sTargetDir ); - if ( aStatus == ::utl::Bootstrap::PATH_EXISTS ) - { - sTargetDir += sTargetUserBasic; - TStringVectorPtr aFileList = getFiles( m_sSourceDir ); - TStringVector::const_iterator aI = aFileList->begin(); - while ( aI != aFileList->end() ) - { - ::rtl::OUString sLocalName = aI->copy( m_sSourceDir.getLength() ); - ::rtl::OUString sTargetName = sTargetDir + sLocalName; - INetURLObject aURL( sTargetName ); - aURL.removeSegment(); - checkAndCreateDirectory( aURL ); - ::osl::FileBase::RC aResult = ::osl::File::copy( *aI, sTargetName ); - if ( aResult != ::osl::FileBase::E_None ) - { - ::rtl::OString aMsg( "BasicMigration::copyFiles: cannot copy " ); - aMsg += ::rtl::OUStringToOString( *aI, RTL_TEXTENCODING_UTF8 ) + " to " - + ::rtl::OUStringToOString( sTargetName, RTL_TEXTENCODING_UTF8 ); - OSL_FAIL( aMsg.getStr() ); - } - ++aI; - } - } - else - { - OSL_FAIL( "BasicMigration::copyFiles: no user installation!" ); - } - } - - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - - ::rtl::OUString BasicMigration::getImplementationName() throw (RuntimeException) - { - return BasicMigration_getImplementationName(); - } - - // ----------------------------------------------------------------------------- - - sal_Bool BasicMigration::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; - } - - // ----------------------------------------------------------------------------- - - Sequence< ::rtl::OUString > BasicMigration::getSupportedServiceNames() throw (RuntimeException) - { - return BasicMigration_getSupportedServiceNames(); - } - - // ----------------------------------------------------------------------------- - // XInitialization - // ----------------------------------------------------------------------------- - - void BasicMigration::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - const Any* pIter = aArguments.getConstArray(); - const Any* pEnd = pIter + aArguments.getLength(); - for ( ; pIter != pEnd ; ++pIter ) - { - beans::NamedValue aValue; - *pIter >>= aValue; - if ( aValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UserData" ) ) ) - { - if ( !(aValue.Value >>= m_sSourceDir) ) - { - OSL_FAIL( "BasicMigration::initialize: argument UserData has wrong type!" ); - } - m_sSourceDir += sSourceUserBasic; - break; - } - } - } - - // ----------------------------------------------------------------------------- - // XJob - // ----------------------------------------------------------------------------- - - Any BasicMigration::execute( const Sequence< beans::NamedValue >& ) - throw (lang::IllegalArgumentException, Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - copyFiles(); - - return Any(); - } - - // ============================================================================= - // component operations - // ============================================================================= - - Reference< XInterface > SAL_CALL BasicMigration_create( - Reference< XComponentContext > const & ) - SAL_THROW( () ) - { - return static_cast< lang::XTypeProvider * >( new BasicMigration() ); - } - - // ----------------------------------------------------------------------------- - -//......................................................................... -} // namespace migration -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/basicmigration.hxx b/desktop/source/migration/services/basicmigration.hxx deleted file mode 100644 index 131092748a..0000000000 --- a/desktop/source/migration/services/basicmigration.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 _DESKTOP_BASICMIGRATION_HXX_ -#define _DESKTOP_BASICMIGRATION_HXX_ - -#include "misc.hxx" -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/task/XJob.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/implbase3.hxx> -#include <osl/mutex.hxx> -#include <osl/file.hxx> - - -class INetURLObject; - - -//......................................................................... -namespace migration -{ -//......................................................................... - - ::rtl::OUString SAL_CALL BasicMigration_getImplementationName(); - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL BasicMigration_getSupportedServiceNames(); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL BasicMigration_create( - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext ) - SAL_THROW( (::com::sun::star::uno::Exception) ); - - - // ============================================================================= - // class BasicMigration - // ============================================================================= - - typedef ::cppu::WeakImplHelper3< - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::lang::XInitialization, - ::com::sun::star::task::XJob > BasicMigration_BASE; - - class BasicMigration : public BasicMigration_BASE - { - private: - ::osl::Mutex m_aMutex; - ::rtl::OUString m_sSourceDir; - - TStringVectorPtr getFiles( const ::rtl::OUString& rBaseURL ) const; - ::osl::FileBase::RC checkAndCreateDirectory( INetURLObject& rDirURL ); - void copyFiles(); - - public: - BasicMigration(); - virtual ~BasicMigration(); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw (::com::sun::star::uno::RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - // XJob - virtual ::com::sun::star::uno::Any SAL_CALL execute( - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) - throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, - ::com::sun::star::uno::RuntimeException); - }; - -//......................................................................... -} // namespace migration -//......................................................................... - -#endif // _DESKTOP_BASICMIGRATION_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/cexports.cxx b/desktop/source/migration/services/cexports.cxx deleted file mode 100644 index c772a2f9ce..0000000000 --- a/desktop/source/migration/services/cexports.cxx +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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_desktop.hxx" - -#include "cppuhelper/implementationentry.hxx" -#include "basicmigration.hxx" -#include "wordbookmigration.hxx" - - -extern "C" -{ - -::cppu::ImplementationEntry entries [] = -{ - { - migration::BasicMigration_create, migration::BasicMigration_getImplementationName, - migration::BasicMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, - 0, 0 - }, - { - migration::WordbookMigration_create, migration::WordbookMigration_getImplementationName, - migration::WordbookMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, - 0, 0 - }, - // Extension migration was disabled by Oracle / OpenOffice.org -#if 0 - { - migration::ExtensionMigration_create, migration::ExtensionMigration_getImplementationName, - migration::ExtensionMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, - 0, 0 - }, -#endif - { 0, 0, 0, 0, 0, 0 } -}; - - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, entries ); -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/cexportsoo3.cxx b/desktop/source/migration/services/cexportsoo3.cxx deleted file mode 100644 index 7aeac35452..0000000000 --- a/desktop/source/migration/services/cexportsoo3.cxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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_desktop.hxx" - -#include "cppuhelper/implementationentry.hxx" -#include "oo3extensionmigration.hxx" - -extern "C" -{ - -::cppu::ImplementationEntry entries [] = -{ - { - migration::OO3ExtensionMigration_create, migration::OO3ExtensionMigration_getImplementationName, - migration::OO3ExtensionMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, - 0, 0 - }, - { 0, 0, 0, 0, 0, 0 } -}; - - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, entries ); -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/cppumaker.mk b/desktop/source/migration/services/cppumaker.mk deleted file mode 100755 index 5ab16ed1e3..0000000000 --- a/desktop/source/migration/services/cppumaker.mk +++ /dev/null @@ -1,36 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -.IF "$(debug)" != "" - -# MSVC++: no inlining -.IF "$(COM)" == "MSC" -CFLAGS += -Ob0 -.ENDIF - -.ENDIF - diff --git a/desktop/source/migration/services/jvmfwk.cxx b/desktop/source/migration/services/jvmfwk.cxx deleted file mode 100644 index c2a3b14edc..0000000000 --- a/desktop/source/migration/services/jvmfwk.cxx +++ /dev/null @@ -1,531 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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_desktop.hxx" - -#include "cppuhelper/implbase4.hxx" -#include "cppuhelper/implementationentry.hxx" -#include "rtl/ustrbuf.hxx" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include "rtl/bootstrap.hxx" -#include "sal/types.h" -#include "sal/config.h" -#include "boost/scoped_array.hpp" -#include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/lang/XInitialization.hpp" -#include "com/sun/star/lang/WrappedTargetException.hpp" -#include "com/sun/star/task/XJob.hpp" -#include "com/sun/star/configuration/backend/XLayer.hpp" -#include "com/sun/star/configuration/backend/XLayerHandler.hpp" -#include "com/sun/star/configuration/backend/MalformedDataException.hpp" -#include "com/sun/star/configuration/backend/TemplateIdentifier.hpp" -#include "jvmfwk/framework.h" -#include "jvmfwk.hxx" -#include <stack> -#include <stdio.h> - -#include "osl/thread.hxx" -using ::rtl::OUString; - -#define OUSTR(x) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( x )) - -#define SERVICE_NAME "com.sun.star.migration.Java" -#define IMPL_NAME "com.sun.star.comp.desktop.migration.Java" - -#define ENABLE_JAVA 1 -#define USER_CLASS_PATH 2 - -namespace css = com::sun::star; -using namespace com::sun::star::uno; -using namespace com::sun::star::beans; -using namespace com::sun::star::lang; -using namespace com::sun::star::configuration::backend; - -namespace migration -{ - -class CJavaInfo -{ - CJavaInfo(const CJavaInfo&); - CJavaInfo& operator = (const CJavaInfo&); -public: - JavaInfo* pData; - CJavaInfo(); - ~CJavaInfo(); - operator JavaInfo* () const; -}; - -CJavaInfo::CJavaInfo(): pData(NULL) -{ -} - -CJavaInfo::~CJavaInfo() -{ - jfw_freeJavaInfo(pData); -} - -CJavaInfo::operator JavaInfo*() const -{ - return pData; -} - - -class JavaMigration : public ::cppu::WeakImplHelper4< - css::lang::XServiceInfo, - css::lang::XInitialization, - css::task::XJob, - css::configuration::backend::XLayerHandler> -{ -public: - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() - throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) - throw (css::uno::RuntimeException); - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() - throw (css::uno::RuntimeException); - - //XInitialization - virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) - throw(css::uno::Exception, css::uno::RuntimeException); - - //XJob - virtual css::uno::Any SAL_CALL execute( - const css::uno::Sequence<css::beans::NamedValue >& Arguments ) - throw (css::lang::IllegalArgumentException, css::uno::Exception, - css::uno::RuntimeException); - - // XLayerHandler - virtual void SAL_CALL startLayer() - throw(::com::sun::star::lang::WrappedTargetException); - - virtual void SAL_CALL endLayer() - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL overrideNode( - const rtl::OUString& aName, - sal_Int16 aAttributes, - sal_Bool bClear) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL addOrReplaceNode( - const rtl::OUString& aName, - sal_Int16 aAttributes) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL addOrReplaceNodeFromTemplate( - const rtl::OUString& aName, - const ::com::sun::star::configuration::backend::TemplateIdentifier& aTemplate, - sal_Int16 aAttributes ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL endNode() - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL dropNode( - const rtl::OUString& aName ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL overrideProperty( - const rtl::OUString& aName, - sal_Int16 aAttributes, - const css::uno::Type& aType, - sal_Bool bClear ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL setPropertyValue( - const css::uno::Any& aValue ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL setPropertyValueForLocale( - const css::uno::Any& aValue, - const rtl::OUString& aLocale ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL endProperty() - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL addProperty( - const rtl::OUString& aName, - sal_Int16 aAttributes, - const css::uno::Type& aType ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL addPropertyWithValue( - const rtl::OUString& aName, - sal_Int16 aAttributes, - const css::uno::Any& aValue ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - - - //---------------- - ~JavaMigration(); - -private: - OUString m_sUserDir; - css::uno::Reference< ::css::configuration::backend::XLayer> m_xLayer; - - void migrateJavarc(); - typedef ::std::pair< ::rtl::OUString, sal_Int16> TElementType; - typedef ::std::stack< TElementType > TElementStack; - TElementStack m_aStack; - -}; - -JavaMigration::~JavaMigration() -{ - OSL_ASSERT(m_aStack.empty()); -} - -OUString jvmfwk_getImplementationName() -{ - return OUSTR(IMPL_NAME); -} - -css::uno::Sequence< OUString > jvmfwk_getSupportedServiceNames() -{ - OUString str_name = OUSTR(SERVICE_NAME); - return css::uno::Sequence< OUString >( &str_name, 1 ); -} - -// XServiceInfo -OUString SAL_CALL JavaMigration::getImplementationName() - throw (css::uno::RuntimeException) -{ - return jvmfwk_getImplementationName(); -} - -sal_Bool SAL_CALL JavaMigration::supportsService( const OUString & rServiceName ) - throw (css::uno::RuntimeException) -{ - css::uno::Sequence< OUString > const & rSNL = getSupportedServiceNames(); - OUString const * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - { - if (rServiceName.equals( pArray[ nPos ] )) - return true; - } - return false; - -} - -css::uno::Sequence< OUString > SAL_CALL JavaMigration::getSupportedServiceNames() - throw (css::uno::RuntimeException) -{ - return jvmfwk_getSupportedServiceNames(); -} - -//XInitialization ---------------------------------------------------------------------- -void SAL_CALL JavaMigration::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) - throw(css::uno::Exception, css::uno::RuntimeException) -{ - const css::uno::Any* pIter = aArguments.getConstArray(); - const css::uno::Any* pEnd = pIter + aArguments.getLength(); - css::uno::Sequence<css::beans::NamedValue> aOldConfigValues; - css::beans::NamedValue aValue; - for(;pIter != pEnd;++pIter) - { - *pIter >>= aValue; - if (aValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OldConfiguration"))) - { - sal_Bool bSuccess = aValue.Value >>= aOldConfigValues; - OSL_ENSURE(bSuccess == sal_True, "[Service implementation " IMPL_NAME - "] XInitialization::initialize: Argument OldConfiguration has wrong type."); - if (bSuccess) - { - const css::beans::NamedValue* pIter2 = aOldConfigValues.getConstArray(); - const css::beans::NamedValue* pEnd2 = pIter2 + aOldConfigValues.getLength(); - for(;pIter2 != pEnd2;++pIter2) - { - if ( pIter2->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("org.openoffice.Office.Java")) ) - { - pIter2->Value >>= m_xLayer; - break; - } - } - } - } - else if (aValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UserData"))) - { - if ( !(aValue.Value >>= m_sUserDir) ) - { - OSL_FAIL( - "[Service implementation " IMPL_NAME - "] XInitialization::initialize: Argument UserData has wrong type."); - } - } - } - -} - -//XJob -css::uno::Any SAL_CALL JavaMigration::execute( - const css::uno::Sequence<css::beans::NamedValue >& ) - throw (css::lang::IllegalArgumentException, css::uno::Exception, - css::uno::RuntimeException) -{ - migrateJavarc(); - if (m_xLayer.is()) - m_xLayer->readData(this); - - return css::uno::Any(); -} - -void JavaMigration::migrateJavarc() -{ - if (m_sUserDir.getLength() == 0) - return; - - OUString sValue; - rtl::Bootstrap javaini(m_sUserDir + OUSTR("/user/config/"SAL_CONFIGFILE("java"))); - sal_Bool bSuccess = javaini.getFrom(OUSTR("Home"), sValue); - OSL_ENSURE(bSuccess, "[Service implementation " IMPL_NAME - "] XJob::execute: Could not get Home entry from java.ini/javarc."); - if (bSuccess == sal_True && sValue.getLength() > 0) - { - //get the directory - CJavaInfo aInfo; - javaFrameworkError err = jfw_getJavaInfoByPath(sValue.pData, &aInfo.pData); - - if (err == JFW_E_NONE) - { - if (jfw_setSelectedJRE(aInfo) != JFW_E_NONE) - { - OSL_FAIL("[Service implementation " IMPL_NAME - "] XJob::execute: jfw_setSelectedJRE failed."); - fprintf(stderr, "\nCannot migrate Java. An error occurred.\n"); - } - } - else if (err == JFW_E_FAILED_VERSION) - { - fprintf(stderr, "\nCannot migrate Java settings because the version of the Java " - "is not supported anymore.\n"); - } - } -} - - -// XLayerHandler -void SAL_CALL JavaMigration::startLayer() - throw(css::lang::WrappedTargetException) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL JavaMigration::endLayer() - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL JavaMigration::overrideNode( - const ::rtl::OUString&, - sal_Int16, - sal_Bool) - throw( - MalformedDataException, - WrappedTargetException ) - -{ - -} -// ----------------------------------------------------------------------------- - -void SAL_CALL JavaMigration::addOrReplaceNode( - const ::rtl::OUString&, - sal_Int16) - throw( - MalformedDataException, - WrappedTargetException ) -{ - -} -void SAL_CALL JavaMigration::endNode() - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL JavaMigration::dropNode( - const ::rtl::OUString& ) - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL JavaMigration::overrideProperty( - const ::rtl::OUString& aName, - sal_Int16, - const Type&, - sal_Bool ) - throw( - MalformedDataException, - WrappedTargetException ) -{ - if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Enable"))) - m_aStack.push(TElementStack::value_type(aName,ENABLE_JAVA)); - else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UserClassPath"))) - m_aStack.push(TElementStack::value_type(aName, USER_CLASS_PATH)); -} -// ----------------------------------------------------------------------------- - -void SAL_CALL JavaMigration::setPropertyValue( - const Any& aValue ) - throw( - MalformedDataException, - WrappedTargetException ) -{ - if ( !m_aStack.empty()) - { - switch (m_aStack.top().second) - { - case ENABLE_JAVA: - { - sal_Bool val = sal_Bool(); - if ((aValue >>= val) == sal_False) - throw MalformedDataException( - OUSTR("[Service implementation " IMPL_NAME - "] XLayerHandler::setPropertyValue received wrong type for Enable property"), 0, Any()); - if (jfw_setEnabled(val) != JFW_E_NONE) - throw WrappedTargetException( - OUSTR("[Service implementation " IMPL_NAME - "] XLayerHandler::setPropertyValue: jfw_setEnabled failed."), 0, Any()); - - break; - } - case USER_CLASS_PATH: - { - OUString cp; - if ((aValue >>= cp) == sal_False) - throw MalformedDataException( - OUSTR("[Service implementation " IMPL_NAME - "] XLayerHandler::setPropertyValue received wrong type for UserClassPath property"), 0, Any()); - - if (jfw_setUserClassPath(cp.pData) != JFW_E_NONE) - throw WrappedTargetException( - OUSTR("[Service implementation " IMPL_NAME - "] XLayerHandler::setPropertyValue: jfw_setUserClassPath failed."), 0, Any()); - break; - } - default: - OSL_ASSERT(0); - } - } -} -// ----------------------------------------------------------------------------- - -void SAL_CALL JavaMigration::setPropertyValueForLocale( - const Any&, - const ::rtl::OUString& ) - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL JavaMigration::endProperty() - throw( - MalformedDataException, - WrappedTargetException ) -{ - if (!m_aStack.empty()) - m_aStack.pop(); -} -// ----------------------------------------------------------------------------- - -void SAL_CALL JavaMigration::addProperty( - const rtl::OUString&, - sal_Int16, - const Type& ) - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL JavaMigration::addPropertyWithValue( - const rtl::OUString&, - sal_Int16, - const Any& ) - throw( - MalformedDataException, - WrappedTargetException ) -{ -} - -void SAL_CALL JavaMigration::addOrReplaceNodeFromTemplate( - const rtl::OUString&, - const TemplateIdentifier&, - sal_Int16 ) - throw( - MalformedDataException, - WrappedTargetException ) -{ -} - -// ----------------------------------------------------------------------------- -//ToDo enable java, user class path - -} //end namespace jfw - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/jvmfwk.hxx b/desktop/source/migration/services/jvmfwk.hxx deleted file mode 100644 index 96e459521d..0000000000 --- a/desktop/source/migration/services/jvmfwk.hxx +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include "cppuhelper/implbase3.hxx" -#include "cppuhelper/implementationentry.hxx" -#include "rtl/ustrbuf.hxx" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" -#include "boost/scoped_array.hpp" -#include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/lang/XInitialization.hpp" -#include "com/sun/star/task/XJob.hpp" - - -namespace css = com::sun::star; - -namespace migration -{ - -rtl::OUString jvmfwk_getImplementationName(); - -css::uno::Sequence< rtl::OUString > jvmfwk_getSupportedServiceNames(); - -} //end blind namespace - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/makefile.mk b/desktop/source/migration/services/makefile.mk deleted file mode 100755 index f74dec646b..0000000000 --- a/desktop/source/migration/services/makefile.mk +++ /dev/null @@ -1,131 +0,0 @@ -#************************************************************************* -# -# 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=desktop -TARGET = migrationoo2.uno -ENABLE_EXCEPTIONS=TRUE -COMP1TYPELIST = migrationoo2 -LIBTARGET=NO - -# --- Settings ----------------------------------------------------- - -.INCLUDE : ..$/..$/deployment/inc/dp_misc.mk -.INCLUDE : settings.mk -DLLPRE = - -# ------------------------------------------------------------------ - -.INCLUDE : cppumaker.mk - -CFLAGS+= $(SYSTEM_DB_CFLAGS) - -SLOFILES= \ - $(SLO)$/jvmfwk.obj \ - $(SLO)$/cexports.obj \ - $(SLO)$/basicmigration.obj \ - $(SLO)$/wordbookmigration.obj \ - $(SLO)$/autocorrmigration.obj \ - $(SLO)$/oo3extensionmigration.obj \ - $(SLO)$/cexportsoo3.obj - -SHL1OBJS= \ - $(SLO)$/jvmfwk.obj \ - $(SLO)$/cexports.obj \ - $(SLO)$/basicmigration.obj \ - $(SLO)$/wordbookmigration.obj \ - $(SLO)$/autocorrmigration.obj - -SHL1TARGET=$(TARGET) -SHL1VERSIONMAP = $(SOLARENV)/src/component.map - -SHL1STDLIBS= \ - $(DEPLOYMENTMISCLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) \ - $(UCBHELPERLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(I18NISOLANGLIB) \ - $(JVMFWKLIB) \ - $(XMLSCRIPTLIB) \ - $(BERKELEYLIB) - -SHL1DEPN= -SHL1IMPLIB=imigrationoo2 -SHL1DEF=$(MISC)$/$(SHL1TARGET).def - -DEF1NAME=$(SHL1TARGET) - -COMP2TYPELIST = migrationoo3 -SHL2TARGET=migrationoo3.uno -SHL2VERSIONMAP = $(SOLARENV)/src/component.map - -SHL2OBJS= \ - $(SLO)$/cexportsoo3.obj \ - $(SLO)$/oo3extensionmigration.obj - -SHL2STDLIBS= \ - $(DEPLOYMENTMISCLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) \ - $(UCBHELPERLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(I18NISOLANGLIB) \ - $(JVMFWKLIB) \ - $(XMLSCRIPTLIB) \ - $(BERKELEYLIB) - -SHL2DEPN= -SHL2IMPLIB=imigrationoo3 -SHL2DEF=$(MISC)$/$(SHL2TARGET).def - -DEF2NAME=$(SHL2TARGET) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/migrationoo3.component - -$(MISC)/migrationoo3.component .ERRREMOVE : \ - $(SOLARENV)/bin/createcomponent.xslt migrationoo3.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL2TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt migrationoo3.component - -ALLTAR : $(MISC)/migrationoo2.component - -$(MISC)/migrationoo2.component .ERRREMOVE : \ - $(SOLARENV)/bin/createcomponent.xslt migrationoo2.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt migrationoo2.component diff --git a/desktop/source/migration/services/migrationoo2.component b/desktop/source/migration/services/migrationoo2.component deleted file mode 100755 index 2b21ab123b..0000000000 --- a/desktop/source/migration/services/migrationoo2.component +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--********************************************************************** -* -* 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. -* -**********************************************************************--> - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.desktop.migration.Basic"> - <service name="com.sun.star.migration.Basic"/> - </implementation> - <implementation name="com.sun.star.comp.desktop.migration.Wordbooks"> - <service name="com.sun.star.migration.Wordbooks"/> - </implementation> -</component> diff --git a/desktop/source/migration/services/migrationoo2.xml b/desktop/source/migration/services/migrationoo2.xml deleted file mode 100755 index 0c77badebc..0000000000 --- a/desktop/source/migration/services/migrationoo2.xml +++ /dev/null @@ -1,78 +0,0 @@ -<?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> migrationoo2.uno </module-name> - <component-description> - <author> Joachim Lingner </author> - <name> com.sun.star.comp.jvmfwk.MigrationOO2</name> - <description> -Specifies a factory object to create proxy objects. -These proxy object represent a given target object and can be -be aggregated. The proxy objects act UNO conform and do NOT provide -original target interfaces on queryInterface() calls. -</description> - <loader-name> com.sun.star.loader.SharedLibrary </loader-name> - <language> C++ </language> - <status value="final"/> - <supported-service> com.sun.star.reflection.ProxyFactory </supported-service> - <service-dependency> ... </service-dependency> - <type> com.sun.star.lang.XTypeProvider </type> - <type> com.sun.star.lang.XServiceInfo </type> - <type> com.sun.star.lang.XSingleServiceFactory </type> - <type> com.sun.star.lang.XMultiServiceFactory </type> - <type> com.sun.star.lang.XInitialization </type> - <type> com.sun.star.lang.WrappedTargetException </type> - <type> com.sun.star.registry.XRegistryKey </type> - <type> com.sun.star.lang.XSingleComponentFactory </type> - <type> com.sun.star.task.XJob </type> - <type> com.sun.star.beans.NamedValue </type> - <type> com.sun.star.configuration.backend.XLayer </type> - <type> com.sun.star.configuration.backend.XLayerHandler </type> - <type> com.sun.star.configuration.backend.MalformedDataException </type> - <type> com.sun.star.configuration.backend.TemplateIdentifier </type> - </component-description> - <component-description> - <author>Thomas Benisch</author> - <name>com.sun.star.comp.desktop.migration.Basic</name> - <description>migration service for OpenOffice.org Basic and dialogs</description> - <loader-name>com.sun.star.loader.SharedLibrary</loader-name> - <language>c++</language> - <status value="final"/> - <supported-service>com.sun.star.migration.Basic</supported-service> - <service-dependency>...</service-dependency> - <type>com.sun.star.beans.NamedValue</type> - <type>com.sun.star.lang.IllegalArgumentException</type> - <type>com.sun.star.lang.XInitialization</type> - <type>com.sun.star.task.XJob</type> - <type>com.sun.star.lang.XServiceInfo</type> - <type>com.sun.star.lang.XTypeProvider</type> - <type>com.sun.star.uno.XComponentContext</type> - </component-description> - <component-description> - <author>Thomas Benisch</author> - <name>com.sun.star.comp.desktop.migration.Autocorrection</name> - <description>migration service for OpenOffice.org autocorrection</description> - <loader-name>com.sun.star.loader.SharedLibrary</loader-name> - <language>c++</language> - <status value="final"/> - <supported-service>com.sun.star.migration.Autocorrection</supported-service> - <service-dependency>...</service-dependency> - <type>com.sun.star.beans.NamedValue</type> - <type>com.sun.star.lang.IllegalArgumentException</type> - <type>com.sun.star.lang.XInitialization</type> - <type>com.sun.star.task.XJob</type> - <type>com.sun.star.lang.XServiceInfo</type> - <type>com.sun.star.lang.XTypeProvider</type> - <type>com.sun.star.uno.XComponentContext</type> - </component-description> - <project-build-dependency>unotools</project-build-dependency> - <project-build-dependency>tools</project-build-dependency> - <project-build-dependency>cppuhelper</project-build-dependency> - <project-build-dependency>cppu</project-build-dependency> - <project-build-dependency>sal</project-build-dependency> - <runtime-module-dependency>utl</runtime-module-dependency> - <runtime-module-dependency>tl</runtime-module-dependency> - <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency> - <runtime-module-dependency>cppu3</runtime-module-dependency> - <runtime-module-dependency>sal3</runtime-module-dependency> -</module-description> diff --git a/desktop/source/migration/services/migrationoo3.component b/desktop/source/migration/services/migrationoo3.component deleted file mode 100755 index 380c389ab7..0000000000 --- a/desktop/source/migration/services/migrationoo3.component +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--********************************************************************** -* -* 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. -* -**********************************************************************--> - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.desktop.migration.OOo3Extensions"> - <service name="com.sun.star.migration.Extensions"/> - </implementation> -</component> diff --git a/desktop/source/migration/services/misc.hxx b/desktop/source/migration/services/misc.hxx deleted file mode 100644 index a8f7babef9..0000000000 --- a/desktop/source/migration/services/misc.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 _DESKTOP_MISC_HXX_ -#define _DESKTOP_MISC_HXX_ - -#include <rtl/ustring.hxx> - -#include <vector> -#include <memory> - -//......................................................................... -namespace migration -{ -//......................................................................... - - typedef ::std::vector< ::rtl::OUString > TStringVector; - typedef ::std::auto_ptr< TStringVector > TStringVectorPtr; - -//......................................................................... -} // namespace migration -//......................................................................... - -#endif // _DESKTOP_MISC_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx deleted file mode 100644 index 1f6e836b6e..0000000000 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ /dev/null @@ -1,564 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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_desktop.hxx" - -#include "oo3extensionmigration.hxx" -#include <rtl/instance.hxx> -#include <osl/file.hxx> -#include <osl/thread.h> -#include <tools/urlobj.hxx> -#include <unotools/bootstrap.hxx> -#include <unotools/ucbstreamhelper.hxx> -#include <unotools/textsearch.hxx> -#include <comphelper/sequence.hxx> -#include <comphelper/processfactory.hxx> -#include <ucbhelper/content.hxx> - -#include <com/sun/star/task/XInteractionApprove.hpp> -#include <com/sun/star/task/XInteractionAbort.hpp> -#include <com/sun/star/ucb/XCommandInfo.hpp> -#include <com/sun/star/ucb/TransferInfo.hpp> -#include <com/sun/star/ucb/NameClash.hpp> -#include <com/sun/star/ucb/XCommandEnvironment.hpp> -#include <com/sun/star/xml/xpath/XXPathAPI.hpp> -#include <com/sun/star/beans/NamedValue.hpp> -#include <com/sun/star/deployment/ExtensionManager.hpp> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -namespace migration -{ - -static ::rtl::OUString sExtensionSubDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/uno_packages/" ) ); -static ::rtl::OUString sSubDirName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cache" ) ); -static ::rtl::OUString sConfigDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data" ) ); -static ::rtl::OUString sOrgDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org" ) ); -static ::rtl::OUString sExcludeDir1 = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org" ) ); -static ::rtl::OUString sExcludeDir2 = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org/openoffice" ) ); -static ::rtl::OUString sDescriptionXmlFile = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/description.xml" ) ); -static ::rtl::OUString sExtensionRootSubDirName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/uno_packages" ) ); - -static ::rtl::OUString sConfigurationDataType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.configuration-data")); -static ::rtl::OUString sConfigurationSchemaType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.configuration-schema")); - -// ============================================================================= -// component operations -// ============================================================================= - -::rtl::OUString OO3ExtensionMigration_getImplementationName() -{ - static ::rtl::OUString* pImplName = 0; - if ( !pImplName ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pImplName ) - { - static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.desktop.migration.OOo3Extensions" ) ); - pImplName = &aImplName; - } - } - return *pImplName; -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > OO3ExtensionMigration_getSupportedServiceNames() -{ - static Sequence< ::rtl::OUString >* pNames = 0; - if ( !pNames ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pNames ) - { - static Sequence< ::rtl::OUString > aNames(1); - aNames.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.migration.Extensions" ) ); - pNames = &aNames; - } - } - return *pNames; -} - -// ============================================================================= -// ExtensionMigration -// ============================================================================= - -OO3ExtensionMigration::OO3ExtensionMigration(Reference< XComponentContext > const & ctx) : -m_ctx(ctx) -{ -} - -// ----------------------------------------------------------------------------- - -OO3ExtensionMigration::~OO3ExtensionMigration() -{ -} - -::osl::FileBase::RC OO3ExtensionMigration::checkAndCreateDirectory( INetURLObject& rDirURL ) -{ - ::osl::FileBase::RC aResult = ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - if ( aResult == ::osl::FileBase::E_NOENT ) - { - INetURLObject aBaseURL( rDirURL ); - aBaseURL.removeSegment(); - checkAndCreateDirectory( aBaseURL ); - return ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - } - else - { - return aResult; - } -} - -void OO3ExtensionMigration::scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ) -{ - osl::Directory aScanRootDir( sSourceDir ); - osl::FileStatus fs(osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL); - osl::FileBase::RC nRetCode = aScanRootDir.open(); - if ( nRetCode == osl::Directory::E_None ) - { - sal_uInt32 nHint( 0 ); - osl::DirectoryItem aItem; - while ( aScanRootDir.getNextItem( aItem, nHint ) == osl::Directory::E_None ) - { - if (( aItem.getFileStatus(fs) == osl::FileBase::E_None ) && - ( fs.getFileType() == osl::FileStatus::Directory )) - { - //Check next folder as the "real" extension folder is below a temp folder! - ::rtl::OUString sExtensionFolderURL = fs.getFileURL(); - - osl::DirectoryItem aExtDirItem; - osl::Directory aExtensionRootDir( sExtensionFolderURL ); - - nRetCode = aExtensionRootDir.open(); - if (( nRetCode == osl::Directory::E_None ) && - ( aExtensionRootDir.getNextItem( aExtDirItem, nHint ) == osl::Directory::E_None )) - { - bool bFileStatus = aExtDirItem.getFileStatus(fs) == osl::FileBase::E_None; - bool bIsDir = fs.getFileType() == osl::FileStatus::Directory; - - if ( bFileStatus && bIsDir ) - { - sExtensionFolderURL = fs.getFileURL(); - ScanResult eResult = scanExtensionFolder( sExtensionFolderURL ); - if ( eResult == SCANRESULT_MIGRATE_EXTENSION ) - aMigrateExtensions.push_back( sExtensionFolderURL ); - } - } - } - } - } -} - -OO3ExtensionMigration::ScanResult OO3ExtensionMigration::scanExtensionFolder( const ::rtl::OUString& sExtFolder ) -{ - ScanResult aResult = SCANRESULT_NOTFOUND; - osl::Directory aDir(sExtFolder); - - // get sub dirs - if (aDir.open() == osl::FileBase::E_None) - { - // work through directory contents... - osl::DirectoryItem item; - osl::FileStatus fs(osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL); - TStringVector aDirectories; - while ((aDir.getNextItem(item) == osl::FileBase::E_None ) && - ( aResult == SCANRESULT_NOTFOUND )) - { - if (item.getFileStatus(fs) == osl::FileBase::E_None) - { - ::rtl::OUString aDirEntryURL; - if (fs.getFileType() == osl::FileStatus::Directory) - aDirectories.push_back( fs.getFileURL() ); - else - { - aDirEntryURL = fs.getFileURL(); - if ( aDirEntryURL.indexOf( sDescriptionXmlFile ) > 0 ) - aResult = scanDescriptionXml( aDirEntryURL ) ? SCANRESULT_MIGRATE_EXTENSION : SCANRESULT_DONTMIGRATE_EXTENSION; - } - } - } - - TStringVector::const_iterator pIter = aDirectories.begin(); - while ( pIter != aDirectories.end() && aResult == SCANRESULT_NOTFOUND ) - { - aResult = scanExtensionFolder( *pIter ); - ++pIter; - } - } - return aResult; -} - -bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescriptionXmlURL ) -{ - if ( !m_xDocBuilder.is() ) - { - m_xDocBuilder = uno::Reference< xml::dom::XDocumentBuilder >( - m_ctx->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.dom.DocumentBuilder")), - m_ctx ), uno::UNO_QUERY ); - } - - if ( !m_xSimpleFileAccess.is() ) - { - m_xSimpleFileAccess = uno::Reference< ucb::XSimpleFileAccess >( - m_ctx->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")), - m_ctx ), uno::UNO_QUERY ); - } - - ::rtl::OUString aExtIdentifier; - if ( m_xDocBuilder.is() && m_xSimpleFileAccess.is() ) - { - try - { - uno::Reference< io::XInputStream > xIn = - m_xSimpleFileAccess->openFileRead( sDescriptionXmlURL ); - - if ( xIn.is() ) - { - uno::Reference< xml::dom::XDocument > xDoc = m_xDocBuilder->parse( xIn ); - if ( xDoc.is() ) - { - uno::Reference< xml::dom::XElement > xRoot = xDoc->getDocumentElement(); - if ( xRoot.is() && - xRoot->getTagName().equals(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("description"))) ) - { - uno::Reference< xml::xpath::XXPathAPI > xPath( - m_ctx->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.xpath.XPathAPI")), - m_ctx), - uno::UNO_QUERY); - - xPath->registerNS( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("desc")), - xRoot->getNamespaceURI()); - xPath->registerNS( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xlink")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("http://www.w3.org/1999/xlink"))); - - try - { - uno::Reference< xml::dom::XNode > xRootNode( xRoot, uno::UNO_QUERY ); - uno::Reference< xml::dom::XNode > xNode( - xPath->selectSingleNode( - xRootNode, - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("desc:identifier/@value")) )); - if ( xNode.is() ) - aExtIdentifier = xNode->getNodeValue(); - } - catch ( xml::xpath::XPathException& ) - { - } - catch ( xml::dom::DOMException& ) - { - } - } - } - } - - if ( aExtIdentifier.getLength() > 0 ) - { - // scan extension identifier and try to match with our black list entries - for ( sal_uInt32 i = 0; i < m_aBlackList.size(); i++ ) - { - utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP); - utl::TextSearch ts(param, LANGUAGE_DONTKNOW); - - xub_StrLen start = 0; - xub_StrLen end = static_cast<sal_uInt16>(aExtIdentifier.getLength()); - if (ts.SearchFrwrd(aExtIdentifier, &start, &end)) - return false; - } - } - } - catch ( ucb::CommandAbortedException& ) - { - } - catch ( uno::RuntimeException& ) - { - } - - if ( aExtIdentifier.getLength() == 0 ) - { - // Fallback: - // Try to use the folder name to match our black list - // as some extensions don't provide an identifier in the - // description.xml! - for ( sal_uInt32 i = 0; i < m_aBlackList.size(); i++ ) - { - utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP); - utl::TextSearch ts(param, LANGUAGE_DONTKNOW); - - xub_StrLen start = 0; - xub_StrLen end = static_cast<sal_uInt16>(sDescriptionXmlURL.getLength()); - if (ts.SearchFrwrd(sDescriptionXmlURL, &start, &end)) - return false; - } - } - } - - return true; -} - -bool OO3ExtensionMigration::migrateExtension( const ::rtl::OUString& sSourceDir ) -{ - if ( !m_xExtensionManager.is() ) - { - try - { - m_xExtensionManager = deployment::ExtensionManager::get( m_ctx ); - } - catch ( ucb::CommandFailedException & ){} - catch ( uno::RuntimeException & ) {} - } - - if ( m_xExtensionManager.is() ) - { - try - { - TmpRepositoryCommandEnv* pCmdEnv = new TmpRepositoryCommandEnv(); - - uno::Reference< ucb::XCommandEnvironment > xCmdEnv( - static_cast< cppu::OWeakObject* >( pCmdEnv ), uno::UNO_QUERY ); - uno::Reference< task::XAbortChannel > xAbortChannel; - uno::Reference< deployment::XPackage > xPackage = - m_xExtensionManager->addExtension( - sSourceDir, uno::Sequence<beans::NamedValue>(), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")), xAbortChannel, xCmdEnv ); - - if ( xPackage.is() ) - return true; - } - catch ( ucb::CommandFailedException& ) - { - } - catch ( ucb::CommandAbortedException& ) - { - } - catch ( lang::IllegalArgumentException& ) - { - } - } - - return false; -} - - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString OO3ExtensionMigration::getImplementationName() throw (RuntimeException) -{ - return OO3ExtensionMigration_getImplementationName(); -} - -// ----------------------------------------------------------------------------- - -sal_Bool OO3ExtensionMigration::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > OO3ExtensionMigration::getSupportedServiceNames() throw (RuntimeException) -{ - return OO3ExtensionMigration_getSupportedServiceNames(); -} - -// ----------------------------------------------------------------------------- -// XInitialization -// ----------------------------------------------------------------------------- - -void OO3ExtensionMigration::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - const Any* pIter = aArguments.getConstArray(); - const Any* pEnd = pIter + aArguments.getLength(); - for ( ; pIter != pEnd ; ++pIter ) - { - beans::NamedValue aValue; - *pIter >>= aValue; - if ( aValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UserData" ) ) ) - { - if ( !(aValue.Value >>= m_sSourceDir) ) - { - OSL_FAIL( "ExtensionMigration::initialize: argument UserData has wrong type!" ); - } - } - else if ( aValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ExtensionBlackList" ) ) ) - { - Sequence< ::rtl::OUString > aBlackList; - if ( (aValue.Value >>= aBlackList ) && ( aBlackList.getLength() > 0 )) - { - m_aBlackList.resize( aBlackList.getLength() ); - ::comphelper::sequenceToArray< ::rtl::OUString >( &m_aBlackList[0], aBlackList ); - } - } - } -} - -Any OO3ExtensionMigration::execute( const Sequence< beans::NamedValue >& ) - throw (lang::IllegalArgumentException, Exception, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - ::utl::Bootstrap::PathStatus aStatus = ::utl::Bootstrap::locateUserInstallation( m_sTargetDir ); - if ( aStatus == ::utl::Bootstrap::PATH_EXISTS ) - { - // copy all extensions - ::rtl::OUString sSourceDir( m_sSourceDir ); - sSourceDir += sExtensionSubDir; - sSourceDir += sSubDirName; - sSourceDir += sExtensionRootSubDirName; - TStringVector aExtensionToMigrate; - scanUserExtensions( sSourceDir, aExtensionToMigrate ); - if ( aExtensionToMigrate.size() > 0 ) - { - TStringVector::iterator pIter = aExtensionToMigrate.begin(); - while ( pIter != aExtensionToMigrate.end() ) - { - migrateExtension( *pIter ); - ++pIter; - } - } - } - - return Any(); -} - -// ----------------------------------------------------------------------------- -// TmpRepositoryCommandEnv -// ----------------------------------------------------------------------------- - -TmpRepositoryCommandEnv::TmpRepositoryCommandEnv() -{ -} - -TmpRepositoryCommandEnv::~TmpRepositoryCommandEnv() -{ -} -// XCommandEnvironment -//______________________________________________________________________________ -uno::Reference< task::XInteractionHandler > TmpRepositoryCommandEnv::getInteractionHandler() -throw ( uno::RuntimeException ) -{ - return this; -} - -//______________________________________________________________________________ -uno::Reference< ucb::XProgressHandler > TmpRepositoryCommandEnv::getProgressHandler() -throw ( uno::RuntimeException ) -{ - return this; -} - -// XInteractionHandler -void TmpRepositoryCommandEnv::handle( - uno::Reference< task::XInteractionRequest> const & xRequest ) - throw ( uno::RuntimeException ) -{ - uno::Any request( xRequest->getRequest() ); - OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); - - bool approve = true; - bool abort = false; - - // select: - uno::Sequence< Reference< task::XInteractionContinuation > > conts( - xRequest->getContinuations() ); - Reference< task::XInteractionContinuation > const * pConts = - conts.getConstArray(); - sal_Int32 len = conts.getLength(); - for ( sal_Int32 pos = 0; pos < len; ++pos ) - { - if (approve) { - uno::Reference< task::XInteractionApprove > xInteractionApprove( - pConts[ pos ], uno::UNO_QUERY ); - if (xInteractionApprove.is()) { - xInteractionApprove->select(); - // don't query again for ongoing continuations: - approve = false; - } - } - else if (abort) { - uno::Reference< task::XInteractionAbort > xInteractionAbort( - pConts[ pos ], uno::UNO_QUERY ); - if (xInteractionAbort.is()) { - xInteractionAbort->select(); - // don't query again for ongoing continuations: - abort = false; - } - } - } -} - -// XProgressHandler -void TmpRepositoryCommandEnv::push( uno::Any const & /*Status*/ ) -throw (uno::RuntimeException) -{ -} - - -void TmpRepositoryCommandEnv::update( uno::Any const & /*Status */) -throw (uno::RuntimeException) -{ -} - -void TmpRepositoryCommandEnv::pop() throw (uno::RuntimeException) -{ -} - -// ============================================================================= -// component operations -// ============================================================================= - -Reference< XInterface > SAL_CALL OO3ExtensionMigration_create( - Reference< XComponentContext > const & ctx ) - SAL_THROW( () ) -{ - return static_cast< lang::XTypeProvider * >( new OO3ExtensionMigration( - ctx) ); -} - -// ----------------------------------------------------------------------------- - -} // namespace migration - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx deleted file mode 100644 index 0843707fb6..0000000000 --- a/desktop/source/migration/services/oo3extensionmigration.hxx +++ /dev/null @@ -1,163 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 _DESKTOP_OO3EXTENSIONMIGRATION_HXX_ -#define _DESKTOP_OO3EXTENSIONMIGRATION_HXX_ - -#include "misc.hxx" -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/task/XJob.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/xml/dom/XDocumentBuilder.hpp> -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> -#include <com/sun/star/deployment/XExtensionManager.hpp> - -#include <osl/mutex.hxx> -#include <osl/file.hxx> -#include <cppuhelper/implbase3.hxx> -#include <cppuhelper/compbase3.hxx> -#include <ucbhelper/content.hxx> -#include <xmlscript/xmllib_imexp.hxx> - -namespace com { namespace sun { namespace star { - namespace uno { - class XComponentContext; - } - namespace deployment { - class XPackage; - } -}}} - -class INetURLObject; - - -namespace migration -{ - - ::rtl::OUString SAL_CALL OO3ExtensionMigration_getImplementationName(); - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OO3ExtensionMigration_getSupportedServiceNames(); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OO3ExtensionMigration_create( - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext ) - SAL_THROW( (::com::sun::star::uno::Exception) ); - - - // ============================================================================= - // class ExtensionMigration - // ============================================================================= - - typedef ::cppu::WeakImplHelper3< - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::lang::XInitialization, - ::com::sun::star::task::XJob > ExtensionMigration_BASE; - - class OO3ExtensionMigration : public ExtensionMigration_BASE - { - private: - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_ctx; - ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XDocumentBuilder > m_xDocBuilder; - ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > m_xSimpleFileAccess; - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; - ::osl::Mutex m_aMutex; - ::rtl::OUString m_sSourceDir; - ::rtl::OUString m_sTargetDir; - TStringVector m_aBlackList; - - enum ScanResult - { - SCANRESULT_NOTFOUND, - SCANRESULT_MIGRATE_EXTENSION, - SCANRESULT_DONTMIGRATE_EXTENSION - }; - - ::osl::FileBase::RC checkAndCreateDirectory( INetURLObject& rDirURL ); - ScanResult scanExtensionFolder( const ::rtl::OUString& sExtFolder ); - void scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ); - bool scanDescriptionXml( const ::rtl::OUString& sDescriptionXmlFilePath ); - bool migrateExtension( const ::rtl::OUString& sSourceDir ); - - public: - OO3ExtensionMigration(::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > const & ctx); - virtual ~OO3ExtensionMigration(); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw (::com::sun::star::uno::RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - // XJob - virtual ::com::sun::star::uno::Any SAL_CALL execute( - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) - throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, - ::com::sun::star::uno::RuntimeException); - }; - - class TmpRepositoryCommandEnv - : public ::cppu::WeakImplHelper3< ::com::sun::star::ucb::XCommandEnvironment, - ::com::sun::star::task::XInteractionHandler, - ::com::sun::star::ucb::XProgressHandler > - { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler> m_forwardHandler; - public: - virtual ~TmpRepositoryCommandEnv(); - TmpRepositoryCommandEnv(); - - // XCommandEnvironment - virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > SAL_CALL - getInteractionHandler() throw ( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XProgressHandler > - SAL_CALL getProgressHandler() throw ( ::com::sun::star::uno::RuntimeException ); - - // XInteractionHandler - virtual void SAL_CALL handle( - ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & xRequest ) - throw (::com::sun::star::uno::RuntimeException); - - // XProgressHandler - virtual void SAL_CALL push( ::com::sun::star::uno::Any const & Status ) - throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL update( ::com::sun::star::uno::Any const & Status ) - throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL pop() throw (::com::sun::star::uno::RuntimeException); - }; - -//......................................................................... -} // namespace migration -//......................................................................... - -#endif // _DESKTOP_OO3EXTENSIONMIGRATION_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/wordbookmigration.cxx b/desktop/source/migration/services/wordbookmigration.cxx deleted file mode 100644 index 121a2d2890..0000000000 --- a/desktop/source/migration/services/wordbookmigration.cxx +++ /dev/null @@ -1,325 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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_desktop.hxx" -#include "wordbookmigration.hxx" -#include <tools/urlobj.hxx> -#include <unotools/bootstrap.hxx> -#include <unotools/ucbstreamhelper.hxx> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - - -//......................................................................... -namespace migration -{ -//......................................................................... - - - static ::rtl::OUString sSourceSubDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/wordbook" ) ); - static ::rtl::OUString sTargetSubDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/wordbook" ) ); - static ::rtl::OUString sBaseName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/wordbook" ) ); - static ::rtl::OUString sSuffix = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".dic" ) ); - - - // ============================================================================= - // component operations - // ============================================================================= - - ::rtl::OUString WordbookMigration_getImplementationName() - { - static ::rtl::OUString* pImplName = 0; - if ( !pImplName ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pImplName ) - { - static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.desktop.migration.Wordbooks" ) ); - pImplName = &aImplName; - } - } - return *pImplName; - } - - // ----------------------------------------------------------------------------- - - Sequence< ::rtl::OUString > WordbookMigration_getSupportedServiceNames() - { - static Sequence< ::rtl::OUString >* pNames = 0; - if ( !pNames ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pNames ) - { - static Sequence< ::rtl::OUString > aNames(1); - aNames.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.migration.Wordbooks" ) ); - pNames = &aNames; - } - } - return *pNames; - } - - // ============================================================================= - // WordbookMigration - // ============================================================================= - - WordbookMigration::WordbookMigration() - { - } - - // ----------------------------------------------------------------------------- - - WordbookMigration::~WordbookMigration() - { - } - - // ----------------------------------------------------------------------------- - - TStringVectorPtr WordbookMigration::getFiles( const ::rtl::OUString& rBaseURL ) const - { - TStringVectorPtr aResult( new TStringVector ); - ::osl::Directory aDir( rBaseURL); - - if ( aDir.open() == ::osl::FileBase::E_None ) - { - // iterate over directory content - TStringVector aSubDirs; - ::osl::DirectoryItem aItem; - while ( aDir.getNextItem( aItem ) == ::osl::FileBase::E_None ) - { - ::osl::FileStatus aFileStatus( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL ); - if ( aItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None ) - { - if ( aFileStatus.getFileType() == ::osl::FileStatus::Directory ) - aSubDirs.push_back( aFileStatus.getFileURL() ); - else - aResult->push_back( aFileStatus.getFileURL() ); - } - } - - // iterate recursive over subfolders - TStringVector::const_iterator aI = aSubDirs.begin(); - while ( aI != aSubDirs.end() ) - { - TStringVectorPtr aSubResult = getFiles( *aI ); - aResult->insert( aResult->end(), aSubResult->begin(), aSubResult->end() ); - ++aI; - } - } - - return aResult; - } - - // ----------------------------------------------------------------------------- - - ::osl::FileBase::RC WordbookMigration::checkAndCreateDirectory( INetURLObject& rDirURL ) - { - ::osl::FileBase::RC aResult = ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - if ( aResult == ::osl::FileBase::E_NOENT ) - { - INetURLObject aBaseURL( rDirURL ); - aBaseURL.removeSegment(); - checkAndCreateDirectory( aBaseURL ); - return ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - } - else - { - return aResult; - } - } - -#define MAX_HEADER_LENGTH 16 -bool IsUserWordbook( const ::rtl::OUString& rFile ) -{ - static const sal_Char* pVerStr2 = "WBSWG2"; - static const sal_Char* pVerStr5 = "WBSWG5"; - static const sal_Char* pVerStr6 = "WBSWG6"; - static const sal_Char* pVerOOo7 = "OOoUserDict1"; - - bool bRet = false; - SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( String(rFile), STREAM_STD_READ ); - if ( pStream && !pStream->GetError() ) - { - sal_Size nSniffPos = pStream->Tell(); - static sal_Size nVerOOo7Len = sal::static_int_cast< sal_Size >(strlen( pVerOOo7 )); - sal_Char pMagicHeader[MAX_HEADER_LENGTH]; - pMagicHeader[ nVerOOo7Len ] = '\0'; - if ((pStream->Read((void *) pMagicHeader, nVerOOo7Len) == nVerOOo7Len)) - { - if ( !strcmp(pMagicHeader, pVerOOo7) ) - bRet = true; - else - { - sal_uInt16 nLen; - pStream->Seek (nSniffPos); - *pStream >> nLen; - if ( nLen < MAX_HEADER_LENGTH ) - { - pStream->Read(pMagicHeader, nLen); - pMagicHeader[nLen] = '\0'; - if ( !strcmp(pMagicHeader, pVerStr2) - || !strcmp(pMagicHeader, pVerStr5) - || !strcmp(pMagicHeader, pVerStr6) ) - bRet = true; - } - } - } - } - - delete pStream; - return bRet; -} - - - // ----------------------------------------------------------------------------- - - void WordbookMigration::copyFiles() - { - ::rtl::OUString sTargetDir; - ::utl::Bootstrap::PathStatus aStatus = ::utl::Bootstrap::locateUserInstallation( sTargetDir ); - if ( aStatus == ::utl::Bootstrap::PATH_EXISTS ) - { - sTargetDir += sTargetSubDir; - TStringVectorPtr aFileList = getFiles( m_sSourceDir ); - TStringVector::const_iterator aI = aFileList->begin(); - while ( aI != aFileList->end() ) - { - if (IsUserWordbook(*aI) ) - { - ::rtl::OUString sSourceLocalName = aI->copy( m_sSourceDir.getLength() ); - ::rtl::OUString sTargetName = sTargetDir + sSourceLocalName; - INetURLObject aURL( sTargetName ); - aURL.removeSegment(); - checkAndCreateDirectory( aURL ); - ::osl::FileBase::RC aResult = ::osl::File::copy( *aI, sTargetName ); - if ( aResult != ::osl::FileBase::E_None ) - { - ::rtl::OString aMsg( "WordbookMigration::copyFiles: cannot copy " ); - aMsg += ::rtl::OUStringToOString( *aI, RTL_TEXTENCODING_UTF8 ) + " to " - + ::rtl::OUStringToOString( sTargetName, RTL_TEXTENCODING_UTF8 ); - OSL_FAIL( aMsg.getStr() ); - } - } - ++aI; - } - } - else - { - OSL_FAIL( "WordbookMigration::copyFiles: no user installation!" ); - } - } - - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - - ::rtl::OUString WordbookMigration::getImplementationName() throw (RuntimeException) - { - return WordbookMigration_getImplementationName(); - } - - // ----------------------------------------------------------------------------- - - sal_Bool WordbookMigration::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; - } - - // ----------------------------------------------------------------------------- - - Sequence< ::rtl::OUString > WordbookMigration::getSupportedServiceNames() throw (RuntimeException) - { - return WordbookMigration_getSupportedServiceNames(); - } - - // ----------------------------------------------------------------------------- - // XInitialization - // ----------------------------------------------------------------------------- - - void WordbookMigration::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - const Any* pIter = aArguments.getConstArray(); - const Any* pEnd = pIter + aArguments.getLength(); - for ( ; pIter != pEnd ; ++pIter ) - { - beans::NamedValue aValue; - *pIter >>= aValue; - if ( aValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UserData" ) ) ) - { - if ( !(aValue.Value >>= m_sSourceDir) ) - { - OSL_FAIL( "WordbookMigration::initialize: argument UserData has wrong type!" ); - } - m_sSourceDir += sSourceSubDir; - break; - } - } - } - - // ----------------------------------------------------------------------------- - // XJob - // ----------------------------------------------------------------------------- - - Any WordbookMigration::execute( const Sequence< beans::NamedValue >& ) - throw (lang::IllegalArgumentException, Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - copyFiles(); - - return Any(); - } - - // ============================================================================= - // component operations - // ============================================================================= - - Reference< XInterface > SAL_CALL WordbookMigration_create( - Reference< XComponentContext > const & ) - SAL_THROW( () ) - { - return static_cast< lang::XTypeProvider * >( new WordbookMigration() ); - } - - // ----------------------------------------------------------------------------- - -//......................................................................... -} // namespace migration -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/wordbookmigration.hxx b/desktop/source/migration/services/wordbookmigration.hxx deleted file mode 100644 index 8b04417dba..0000000000 --- a/desktop/source/migration/services/wordbookmigration.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 _DESKTOP_WORDBOOKMIGRATION_HXX_ -#define _DESKTOP_WORDBOOKMIGRATION_HXX_ - -#include "misc.hxx" -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/task/XJob.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/implbase3.hxx> -#include <osl/mutex.hxx> -#include <osl/file.hxx> - - -class INetURLObject; - - -//......................................................................... -namespace migration -{ -//......................................................................... - - ::rtl::OUString SAL_CALL WordbookMigration_getImplementationName(); - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL WordbookMigration_getSupportedServiceNames(); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL WordbookMigration_create( - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext ) - SAL_THROW( (::com::sun::star::uno::Exception) ); - - - // ============================================================================= - // class WordbookMigration - // ============================================================================= - - typedef ::cppu::WeakImplHelper3< - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::lang::XInitialization, - ::com::sun::star::task::XJob > WordbookMigration_BASE; - - class WordbookMigration : public WordbookMigration_BASE - { - private: - ::osl::Mutex m_aMutex; - ::rtl::OUString m_sSourceDir; - - TStringVectorPtr getFiles( const ::rtl::OUString& rBaseURL ) const; - ::osl::FileBase::RC checkAndCreateDirectory( INetURLObject& rDirURL ); - void copyFiles(); - - public: - WordbookMigration(); - virtual ~WordbookMigration(); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw (::com::sun::star::uno::RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - // XJob - virtual ::com::sun::star::uno::Any SAL_CALL execute( - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) - throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, - ::com::sun::star::uno::RuntimeException); - }; - -//......................................................................... -} // namespace migration -//......................................................................... - -#endif // _DESKTOP_AUTOCORRMIGRATION_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |