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/implbase.hxx>
35 #include <ucbhelper/content.hxx>
37 namespace com
{ namespace sun
{ namespace star
{
39 class XComponentContext
;
49 OUString
OO3ExtensionMigration_getImplementationName();
50 css::uno::Sequence
< OUString
> OO3ExtensionMigration_getSupportedServiceNames();
51 css::uno::Reference
< css::uno::XInterface
> OO3ExtensionMigration_create(
52 css::uno::Reference
< css::uno::XComponentContext
> const & xContext
);
55 // class ExtensionMigration
58 typedef ::cppu::WeakImplHelper
<
59 css::lang::XServiceInfo
,
60 css::lang::XInitialization
,
61 css::task::XJob
> ExtensionMigration_BASE
;
63 class OO3ExtensionMigration
: public ExtensionMigration_BASE
66 css::uno::Reference
< css::uno::XComponentContext
> m_ctx
;
67 css::uno::Reference
< css::xml::dom::XDocumentBuilder
> m_xDocBuilder
;
68 css::uno::Reference
< css::ucb::XSimpleFileAccess3
> m_xSimpleFileAccess
;
69 ::osl::Mutex m_aMutex
;
70 OUString m_sSourceDir
;
71 OUString m_sTargetDir
;
72 TStringVector m_aBlackList
;
77 SCANRESULT_MIGRATE_EXTENSION
,
78 SCANRESULT_DONTMIGRATE_EXTENSION
81 ScanResult
scanExtensionFolder( const OUString
& sExtFolder
);
82 void scanUserExtensions( const OUString
& sSourceDir
, TStringVector
& aMigrateExtensions
);
83 bool scanDescriptionXml( const OUString
& sDescriptionXmlFilePath
);
84 void migrateExtension( const OUString
& sSourceDir
);
87 explicit OO3ExtensionMigration(css::uno::Reference
<
88 css::uno::XComponentContext
> const & ctx
);
89 virtual ~OO3ExtensionMigration() override
;
92 virtual OUString SAL_CALL
getImplementationName() override
;
93 virtual sal_Bool SAL_CALL
supportsService( const OUString
& rServiceName
) override
;
94 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
97 virtual void SAL_CALL
initialize( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
100 virtual css::uno::Any SAL_CALL
execute(
101 const css::uno::Sequence
< css::beans::NamedValue
>& Arguments
) override
;
104 class TmpRepositoryCommandEnv
105 : public ::cppu::WeakImplHelper
< css::ucb::XCommandEnvironment
,
106 css::task::XInteractionHandler
,
107 css::ucb::XProgressHandler
>
110 virtual ~TmpRepositoryCommandEnv() override
;
111 TmpRepositoryCommandEnv();
113 // XCommandEnvironment
114 virtual css::uno::Reference
< css::task::XInteractionHandler
> SAL_CALL
115 getInteractionHandler() override
;
116 virtual css::uno::Reference
< css::ucb::XProgressHandler
>
117 SAL_CALL
getProgressHandler() override
;
119 // XInteractionHandler
120 virtual void SAL_CALL
handle(
121 css::uno::Reference
< css::task::XInteractionRequest
> const & xRequest
) override
;
124 virtual void SAL_CALL
push( css::uno::Any
const & Status
) override
;
125 virtual void SAL_CALL
update( css::uno::Any
const & Status
) override
;
126 virtual void SAL_CALL
pop() override
;
130 } // namespace migration
133 #endif // INCLUDED_DESKTOP_SOURCE_MIGRATION_SERVICES_OO3EXTENSIONMIGRATION_HXX
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */