LibreOffice Module desktop (master)  1
oo3extensionmigration.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #pragma once
21 
22 #include "misc.hxx"
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/task/XJob.hpp>
25 #include <com/sun/star/lang/XInitialization.hpp>
26 #include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
27 #include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
28 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
29 #include <com/sun/star/ucb/XProgressHandler.hpp>
30 
31 #include <osl/mutex.hxx>
32 #include <cppuhelper/implbase.hxx>
33 
34 namespace com::sun::star::uno { class XComponentContext; }
35 
36 class INetURLObject;
37 
38 
39 namespace migration
40 {
41 
42  typedef ::cppu::WeakImplHelper<
43  css::lang::XServiceInfo,
44  css::lang::XInitialization,
45  css::task::XJob > ExtensionMigration_BASE;
46 
47  class OO3ExtensionMigration : public ExtensionMigration_BASE
48  {
49  private:
50  css::uno::Reference< css::uno::XComponentContext > m_ctx;
51  css::uno::Reference< css::xml::dom::XDocumentBuilder > m_xDocBuilder;
52  css::uno::Reference< css::ucb::XSimpleFileAccess3 > m_xSimpleFileAccess;
53  ::osl::Mutex m_aMutex;
54  OUString m_sSourceDir;
55  OUString m_sTargetDir;
57 
59  {
63  };
64 
65  ScanResult scanExtensionFolder( const OUString& sExtFolder );
66  void scanUserExtensions( const OUString& sSourceDir, TStringVector& aMigrateExtensions );
67  bool scanDescriptionXml( const OUString& sDescriptionXmlFilePath );
68  void migrateExtension( const OUString& sSourceDir );
69 
70  public:
71  explicit OO3ExtensionMigration(css::uno::Reference<
72  css::uno::XComponentContext > const & ctx);
73  virtual ~OO3ExtensionMigration() override;
74 
75  // XServiceInfo
76  virtual OUString SAL_CALL getImplementationName() override;
77  virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
78  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
79 
80  // XInitialization
81  virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
82 
83  // XJob
84  virtual css::uno::Any SAL_CALL execute(
85  const css::uno::Sequence< css::beans::NamedValue >& Arguments ) override;
86  };
87 
89  : public ::cppu::WeakImplHelper< css::ucb::XCommandEnvironment,
90  css::task::XInteractionHandler,
91  css::ucb::XProgressHandler >
92  {
93  public:
94  virtual ~TmpRepositoryCommandEnv() override;
96 
97  // XCommandEnvironment
98  virtual css::uno::Reference< css::task::XInteractionHandler > SAL_CALL
99  getInteractionHandler() override;
100  virtual css::uno::Reference< css::ucb::XProgressHandler >
101  SAL_CALL getProgressHandler() override;
102 
103  // XInteractionHandler
104  virtual void SAL_CALL handle(
105  css::uno::Reference< css::task::XInteractionRequest > const & xRequest ) override;
106 
107  // XProgressHandler
108  virtual void SAL_CALL push( css::uno::Any const & Status ) override;
109  virtual void SAL_CALL update( css::uno::Any const & Status ) override;
110  virtual void SAL_CALL pop() override;
111  };
112 
113 
114 } // namespace migration
115 
116 
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool scanDescriptionXml(const OUString &sDescriptionXmlFilePath)
virtual void SAL_CALL pop() override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue > &Arguments) override
ScanResult scanExtensionFolder(const OUString &sExtFolder)
css::uno::Reference< css::xml::dom::XDocumentBuilder > m_xDocBuilder
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
unsigned char sal_Bool
virtual void SAL_CALL push(css::uno::Any const &Status) override
void migrateExtension(const OUString &sSourceDir)
std::vector< OUString > TStringVector
Definition: misc.hxx:32
::cppu::WeakImplHelper< css::lang::XServiceInfo, css::lang::XInitialization, css::task::XJob > ExtensionMigration_BASE
virtual css::uno::Reference< css::ucb::XProgressHandler > SAL_CALL getProgressHandler() override
virtual void SAL_CALL handle(css::uno::Reference< css::task::XInteractionRequest > const &xRequest) override
virtual void SAL_CALL update(css::uno::Any const &Status) override
css::uno::Reference< css::ucb::XSimpleFileAccess3 > m_xSimpleFileAccess
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Reference< css::uno::XComponentContext > m_ctx
virtual css::uno::Reference< css::task::XInteractionHandler > SAL_CALL getInteractionHandler() override
void scanUserExtensions(const OUString &sSourceDir, TStringVector &aMigrateExtensions)
virtual OUString SAL_CALL getImplementationName() override
OO3ExtensionMigration(css::uno::Reference< css::uno::XComponentContext > const &ctx)