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