1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _DESKTOP_WORDBOOKMIGRATION_HXX_ 25 #define _DESKTOP_WORDBOOKMIGRATION_HXX_ 26 27 #include "misc.hxx" 28 #include <com/sun/star/lang/XServiceInfo.hpp> 29 #include <com/sun/star/lang/XInitialization.hpp> 30 #include <com/sun/star/task/XJob.hpp> 31 #include <com/sun/star/uno/XComponentContext.hpp> 32 #include <cppuhelper/implbase3.hxx> 33 #include <osl/mutex.hxx> 34 #include <osl/file.hxx> 35 36 37 class INetURLObject; 38 39 40 //......................................................................... 41 namespace migration 42 { 43 //......................................................................... 44 45 ::rtl::OUString SAL_CALL WordbookMigration_getImplementationName(); 46 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL WordbookMigration_getSupportedServiceNames(); 47 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL WordbookMigration_create( 48 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext ) 49 SAL_THROW( (::com::sun::star::uno::Exception) ); 50 51 52 // ============================================================================= 53 // class WordbookMigration 54 // ============================================================================= 55 56 typedef ::cppu::WeakImplHelper3< 57 ::com::sun::star::lang::XServiceInfo, 58 ::com::sun::star::lang::XInitialization, 59 ::com::sun::star::task::XJob > WordbookMigration_BASE; 60 61 class WordbookMigration : public WordbookMigration_BASE 62 { 63 private: 64 ::osl::Mutex m_aMutex; 65 ::rtl::OUString m_sSourceDir; 66 67 TStringVectorPtr getFiles( const ::rtl::OUString& rBaseURL ) const; 68 ::osl::FileBase::RC checkAndCreateDirectory( INetURLObject& rDirURL ); 69 void copyFiles(); 70 71 public: 72 WordbookMigration(); 73 virtual ~WordbookMigration(); 74 75 // XServiceInfo 76 virtual ::rtl::OUString SAL_CALL getImplementationName() 77 throw (::com::sun::star::uno::RuntimeException); 78 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) 79 throw (::com::sun::star::uno::RuntimeException); 80 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 81 throw (::com::sun::star::uno::RuntimeException); 82 83 // XInitialization 84 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) 85 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 86 87 // XJob 88 virtual ::com::sun::star::uno::Any SAL_CALL execute( 89 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) 90 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, 91 ::com::sun::star::uno::RuntimeException); 92 }; 93 94 //......................................................................... 95 } // namespace migration 96 //......................................................................... 97 98 #endif // _DESKTOP_AUTOCORRMIGRATION_HXX_ 99