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/XSimpleFileAccess3.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 <cppuhelper/implbase.hxx>
34 
35 namespace com { namespace sun { namespace star {
36  namespace uno {
37  class XComponentContext;
38  }
39 }}}
40 
41 class INetURLObject;
42 
43 
44 namespace migration
45 {
46 
48  css::uno::Sequence< OUString > OO3ExtensionMigration_getSupportedServiceNames();
49  css::uno::Reference< css::uno::XInterface > OO3ExtensionMigration_create(
50  css::uno::Reference< css::uno::XComponentContext > const & xContext );
51 
52 
53 
54 
55  typedef ::cppu::WeakImplHelper<
56  css::lang::XServiceInfo,
57  css::lang::XInitialization,
58  css::task::XJob > ExtensionMigration_BASE;
59 
60  class OO3ExtensionMigration : public ExtensionMigration_BASE
61  {
62  private:
63  css::uno::Reference< css::uno::XComponentContext > m_ctx;
64  css::uno::Reference< css::xml::dom::XDocumentBuilder > m_xDocBuilder;
65  css::uno::Reference< css::ucb::XSimpleFileAccess3 > m_xSimpleFileAccess;
66  ::osl::Mutex m_aMutex;
67  OUString m_sSourceDir;
68  OUString m_sTargetDir;
70 
72  {
76  };
77 
78  ScanResult scanExtensionFolder( const OUString& sExtFolder );
79  void scanUserExtensions( const OUString& sSourceDir, TStringVector& aMigrateExtensions );
80  bool scanDescriptionXml( const OUString& sDescriptionXmlFilePath );
81  void migrateExtension( const OUString& sSourceDir );
82 
83  public:
84  explicit OO3ExtensionMigration(css::uno::Reference<
85  css::uno::XComponentContext > const & ctx);
86  virtual ~OO3ExtensionMigration() override;
87 
88  // XServiceInfo
89  virtual OUString SAL_CALL getImplementationName() override;
90  virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
91  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
92 
93  // XInitialization
94  virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
95 
96  // XJob
97  virtual css::uno::Any SAL_CALL execute(
98  const css::uno::Sequence< css::beans::NamedValue >& Arguments ) override;
99  };
100 
102  : public ::cppu::WeakImplHelper< css::ucb::XCommandEnvironment,
103  css::task::XInteractionHandler,
104  css::ucb::XProgressHandler >
105  {
106  public:
107  virtual ~TmpRepositoryCommandEnv() override;
109 
110  // XCommandEnvironment
111  virtual css::uno::Reference< css::task::XInteractionHandler > SAL_CALL
112  getInteractionHandler() override;
113  virtual css::uno::Reference< css::ucb::XProgressHandler >
114  SAL_CALL getProgressHandler() override;
115 
116  // XInteractionHandler
117  virtual void SAL_CALL handle(
118  css::uno::Reference< css::task::XInteractionRequest > const & xRequest ) override;
119 
120  // XProgressHandler
121  virtual void SAL_CALL push( css::uno::Any const & Status ) override;
122  virtual void SAL_CALL update( css::uno::Any const & Status ) override;
123  virtual void SAL_CALL pop() override;
124  };
125 
126 
127 } // namespace migration
128 
129 
130 #endif // INCLUDED_DESKTOP_SOURCE_MIGRATION_SERVICES_OO3EXTENSIONMIGRATION_HXX
131 
132 /* 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:2094
::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)