1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DESKTOP_SOURCE_MIGRATION_SERVICES_OO3EXTENSIONMIGRATION_HXX
21 #define INCLUDED_DESKTOP_SOURCE_MIGRATION_SERVICES_OO3EXTENSIONMIGRATION_HXX
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/task/XJob.hpp>
26 #include <com/sun/star/lang/XInitialization.hpp>
27 #include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
28 #include <com/sun/star/ucb/SimpleFileAccess.hpp>
29 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
30 #include <com/sun/star/ucb/XProgressHandler.hpp>
32 #include <osl/mutex.hxx>
33 #include <osl/file.hxx>
34 #include <cppuhelper/implbase3.hxx>
35 #include <cppuhelper/compbase3.hxx>
36 #include <ucbhelper/content.hxx>
38 namespace com
{ namespace sun
{ namespace star
{
40 class XComponentContext
;
50 OUString SAL_CALL
OO3ExtensionMigration_getImplementationName();
51 ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
OO3ExtensionMigration_getSupportedServiceNames();
52 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
OO3ExtensionMigration_create(
53 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> const & xContext
)
54 SAL_THROW( (::com::sun::star::uno::Exception
) );
57 // =============================================================================
58 // class ExtensionMigration
59 // =============================================================================
61 typedef ::cppu::WeakImplHelper3
<
62 ::com::sun::star::lang::XServiceInfo
,
63 ::com::sun::star::lang::XInitialization
,
64 ::com::sun::star::task::XJob
> ExtensionMigration_BASE
;
66 class OO3ExtensionMigration
: public ExtensionMigration_BASE
69 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_ctx
;
70 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::dom::XDocumentBuilder
> m_xDocBuilder
;
71 ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XSimpleFileAccess3
> m_xSimpleFileAccess
;
72 ::osl::Mutex m_aMutex
;
73 OUString m_sSourceDir
;
74 OUString m_sTargetDir
;
75 TStringVector m_aBlackList
;
80 SCANRESULT_MIGRATE_EXTENSION
,
81 SCANRESULT_DONTMIGRATE_EXTENSION
84 ::osl::FileBase::RC
checkAndCreateDirectory( INetURLObject
& rDirURL
);
85 ScanResult
scanExtensionFolder( const OUString
& sExtFolder
);
86 void scanUserExtensions( const OUString
& sSourceDir
, TStringVector
& aMigrateExtensions
);
87 bool scanDescriptionXml( const OUString
& sDescriptionXmlFilePath
);
88 void migrateExtension( const OUString
& sSourceDir
);
91 OO3ExtensionMigration(::com::sun::star::uno::Reference
<
92 ::com::sun::star::uno::XComponentContext
> const & ctx
);
93 virtual ~OO3ExtensionMigration();
96 virtual OUString SAL_CALL
getImplementationName()
97 throw (::com::sun::star::uno::RuntimeException
);
98 virtual sal_Bool SAL_CALL
supportsService( const OUString
& rServiceName
)
99 throw (::com::sun::star::uno::RuntimeException
);
100 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
101 throw (::com::sun::star::uno::RuntimeException
);
104 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
105 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
108 virtual ::com::sun::star::uno::Any SAL_CALL
execute(
109 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& Arguments
)
110 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::Exception
,
111 ::com::sun::star::uno::RuntimeException
);
114 class TmpRepositoryCommandEnv
115 : public ::cppu::WeakImplHelper3
< ::com::sun::star::ucb::XCommandEnvironment
,
116 ::com::sun::star::task::XInteractionHandler
,
117 ::com::sun::star::ucb::XProgressHandler
>
119 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
120 ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
> m_forwardHandler
;
122 virtual ~TmpRepositoryCommandEnv();
123 TmpRepositoryCommandEnv();
125 // XCommandEnvironment
126 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
> SAL_CALL
127 getInteractionHandler() throw ( ::com::sun::star::uno::RuntimeException
);
128 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XProgressHandler
>
129 SAL_CALL
getProgressHandler() throw ( ::com::sun::star::uno::RuntimeException
);
131 // XInteractionHandler
132 virtual void SAL_CALL
handle(
133 ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionRequest
> const & xRequest
)
134 throw (::com::sun::star::uno::RuntimeException
);
137 virtual void SAL_CALL
push( ::com::sun::star::uno::Any
const & Status
)
138 throw (::com::sun::star::uno::RuntimeException
);
139 virtual void SAL_CALL
update( ::com::sun::star::uno::Any
const & Status
)
140 throw (::com::sun::star::uno::RuntimeException
);
141 virtual void SAL_CALL
pop() throw (::com::sun::star::uno::RuntimeException
);
144 //.........................................................................
145 } // namespace migration
146 //.........................................................................
148 #endif // INCLUDED_DESKTOP_SOURCE_MIGRATION_SERVICES_OO3EXTENSIONMIGRATION_HXX
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */