merge the formfield patch from ooo-build
[ooovba.git] / desktop / source / migration / services / extensionmigration.hxx
blob58588ceb7dd56d959b34264ab859a36b9d1a1ff0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: extensionmigration.hxx,v $
10 * $Revision: 1.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DESKTOP_EXTENSIONMIGRATION_HXX_
32 #define _DESKTOP_EXTENSIONMIGRATION_HXX_
34 #include "misc.hxx"
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/task/XJob.hpp>
37 #include <com/sun/star/lang/XInitialization.hpp>
38 #include <cppuhelper/implbase3.hxx>
39 #include <osl/mutex.hxx>
40 #include <osl/file.hxx>
41 #include "xmlscript/xmllib_imexp.hxx"
43 namespace com { namespace sun { namespace star {
44 namespace uno {
45 class XComponentContext;
47 namespace deployment {
48 class XPackage;
50 }}}
54 class INetURLObject;
57 //.........................................................................
58 namespace migration
60 //.........................................................................
62 ::rtl::OUString SAL_CALL ExtensionMigration_getImplementationName();
63 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ExtensionMigration_getSupportedServiceNames();
64 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ExtensionMigration_create(
65 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext )
66 SAL_THROW( (::com::sun::star::uno::Exception) );
69 // =============================================================================
70 // class ExtensionMigration
71 // =============================================================================
73 typedef ::cppu::WeakImplHelper3<
74 ::com::sun::star::lang::XServiceInfo,
75 ::com::sun::star::lang::XInitialization,
76 ::com::sun::star::task::XJob > ExtensionMigration_BASE;
78 class ExtensionMigration : public ExtensionMigration_BASE
80 private:
81 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_ctx;
82 ::osl::Mutex m_aMutex;
83 ::rtl::OUString m_sSourceDir;
84 ::rtl::OUString m_sTargetDir;
86 ::xmlscript::LibDescriptorArray m_scriptElements;
87 ::xmlscript::LibDescriptorArray m_dialogElements;
89 ::osl::FileBase::RC checkAndCreateDirectory( INetURLObject& rDirURL );
90 void copyConfig( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir );
91 bool isCompatibleBerkleyDb(const ::rtl::OUString& sSourceDir);
92 bool copy( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir );
93 bool processExtensions( const ::rtl::OUString& sSourceDir,
94 const ::rtl::OUString& sTargetDir );
95 /* fills m_scriptElements and m_dialogElements
97 void prepareBasicLibs();
98 void prepareBasicLibs(const ::rtl::OUString & sURL,
99 ::xmlscript::LibDescriptorArray & out_elements);
100 bool isBasicPackageEnabled( const ::com::sun::star::uno::Reference<
101 ::com::sun::star::deployment::XPackage > & xPkg);
102 void registerBasicPackage(
103 const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg);
104 void registerConfigurationPackage(
105 const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg);
107 public:
108 ExtensionMigration(::com::sun::star::uno::Reference<
109 ::com::sun::star::uno::XComponentContext > const & ctx);
110 virtual ~ExtensionMigration();
112 // XServiceInfo
113 virtual ::rtl::OUString SAL_CALL getImplementationName()
114 throw (::com::sun::star::uno::RuntimeException);
115 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName )
116 throw (::com::sun::star::uno::RuntimeException);
117 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
118 throw (::com::sun::star::uno::RuntimeException);
120 // XInitialization
121 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
122 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
124 // XJob
125 virtual ::com::sun::star::uno::Any SAL_CALL execute(
126 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments )
127 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception,
128 ::com::sun::star::uno::RuntimeException);
131 //.........................................................................
132 } // namespace migration
133 //.........................................................................
135 #endif // _DESKTOP_AUTOCORRMIGRATION_HXX_