xref: /trunk/main/desktop/source/migration/services/wordbookmigration.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 
50 
51     // =============================================================================
52     // class WordbookMigration
53     // =============================================================================
54 
55     typedef ::cppu::WeakImplHelper3<
56         ::com::sun::star::lang::XServiceInfo,
57         ::com::sun::star::lang::XInitialization,
58         ::com::sun::star::task::XJob > WordbookMigration_BASE;
59 
60     class WordbookMigration : public WordbookMigration_BASE
61     {
62     private:
63         ::osl::Mutex            m_aMutex;
64         ::rtl::OUString         m_sSourceDir;
65 
66         TStringVectorPtr        getFiles( const ::rtl::OUString& rBaseURL ) const;
67         ::osl::FileBase::RC     checkAndCreateDirectory( INetURLObject& rDirURL );
68         void                    copyFiles();
69 
70     public:
71         WordbookMigration();
72         virtual ~WordbookMigration();
73 
74         // XServiceInfo
75         virtual ::rtl::OUString SAL_CALL getImplementationName();
76         virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName );
77         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
78 
79         // XInitialization
80         virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
81 
82         // XJob
83         virtual ::com::sun::star::uno::Any SAL_CALL execute(
84             const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments );
85     };
86 
87 //.........................................................................
88 }   // namespace migration
89 //.........................................................................
90 
91 #endif // _DESKTOP_AUTOCORRMIGRATION_HXX_
92