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 #ifndef INCLUDED_DESKTOP_SOURCE_MIGRATION_SERVICES_OO3EXTENSIONMIGRATION_HXX
21 #define INCLUDED_DESKTOP_SOURCE_MIGRATION_SERVICES_OO3EXTENSIONMIGRATION_HXX
22 
23 #include "misc.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>
31 
32 #include <osl/mutex.hxx>
33 #include <osl/file.hxx>
34 #include <cppuhelper/implbase.hxx>
35 #include <ucbhelper/content.hxx>
36 
37 namespace com { namespace sun { namespace star {
38  namespace uno {
39  class XComponentContext;
40  }
41 }}}
42 
43 class INetURLObject;
44 
45 
46 namespace migration
47 {
48 
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 );
53 
54 
55  // class ExtensionMigration
56 
57 
58  typedef ::cppu::WeakImplHelper<
59  css::lang::XServiceInfo,
60  css::lang::XInitialization,
61  css::task::XJob > ExtensionMigration_BASE;
62 
63  class OO3ExtensionMigration : public ExtensionMigration_BASE
64  {
65  private:
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;
73 
75  {
79  };
80 
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 );
85 
86  public:
87  explicit OO3ExtensionMigration(css::uno::Reference<
88  css::uno::XComponentContext > const & ctx);
89  virtual ~OO3ExtensionMigration() override;
90 
91  // XServiceInfo
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;
95 
96  // XInitialization
97  virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
98 
99  // XJob
100  virtual css::uno::Any SAL_CALL execute(
101  const css::uno::Sequence< css::beans::NamedValue >& Arguments ) override;
102  };
103 
105  : public ::cppu::WeakImplHelper< css::ucb::XCommandEnvironment,
106  css::task::XInteractionHandler,
107  css::ucb::XProgressHandler >
108  {
109  public:
110  virtual ~TmpRepositoryCommandEnv() override;
112 
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;
118 
119  // XInteractionHandler
120  virtual void SAL_CALL handle(
121  css::uno::Reference< css::task::XInteractionRequest > const & xRequest ) override;
122 
123  // XProgressHandler
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;
127  };
128 
129 
130 } // namespace migration
131 
132 
133 #endif // INCLUDED_DESKTOP_SOURCE_MIGRATION_SERVICES_OO3EXTENSIONMIGRATION_HXX
134 
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XInterface > OO3ExtensionMigration_create(Reference< XComponentContext > const &ctx)
bool scanDescriptionXml(const OUString &sDescriptionXmlFilePath)
OUString OO3ExtensionMigration_getImplementationName()
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual void SAL_CALL update(css::uno::Any const &Status) override
virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue > &Arguments) override
virtual css::uno::Reference< css::ucb::XProgressHandler > SAL_CALL getProgressHandler() override
virtual void SAL_CALL push(css::uno::Any const &Status) 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
Sequence< OUString > OO3ExtensionMigration_getSupportedServiceNames()
unsigned char sal_Bool
virtual void SAL_CALL pop() override
void migrateExtension(const OUString &sSourceDir)
std::vector< OUString > TStringVector
Definition: misc.hxx:33
static uno::Reference< css::uno::XComponentContext > xContext
Definition: init.cxx:1546
::cppu::WeakImplHelper< css::lang::XServiceInfo, css::lang::XInitialization, css::task::XJob > ExtensionMigration_BASE
virtual void SAL_CALL handle(css::uno::Reference< css::task::XInteractionRequest > const &xRequest) override
virtual css::uno::Reference< css::task::XInteractionHandler > SAL_CALL getInteractionHandler() 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
void scanUserExtensions(const OUString &sSourceDir, TStringVector &aMigrateExtensions)
virtual OUString SAL_CALL getImplementationName() override
OO3ExtensionMigration(css::uno::Reference< css::uno::XComponentContext > const &ctx)