LibreOffice Module comphelper (master)  1
officeinstallationdirectories.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 <osl/mutex.hxx>
23 #include <cppuhelper/implbase.hxx>
24 
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/util/XOfficeInstallationDirectories.hpp>
27 
28 #include <optional>
29 
30 namespace com::sun::star::uno { class XComponentContext; }
31 
32 namespace comphelper {
33 
34 
35 
36 typedef cppu::WeakImplHelper<
37  css::util::XOfficeInstallationDirectories,
38  css::lang::XServiceInfo > UnoImplBase;
39 
41 {
42  osl::Mutex m_aMutex;
43 };
44 
45 class OfficeInstallationDirectories : public mutex_holder, public UnoImplBase
46 {
47 public:
49  const css::uno::Reference< css::uno::XComponentContext > & xCtx );
50  virtual ~OfficeInstallationDirectories() override;
51 
52  // XOfficeInstallationDirectories
53  virtual OUString SAL_CALL
55  virtual OUString SAL_CALL
57  virtual OUString SAL_CALL
58  makeRelocatableURL( const OUString& URL ) override;
59  virtual OUString SAL_CALL
60  makeAbsoluteURL( const OUString& URL ) override;
61 
62  // XServiceInfo
63  virtual OUString SAL_CALL
64  getImplementationName() override;
65  virtual sal_Bool SAL_CALL
66  supportsService( const OUString& ServiceName ) override;
67  virtual css::uno::Sequence< OUString > SAL_CALL
68  getSupportedServiceNames() override;
69 
70 private:
71  void initDirs();
72 
73  css::uno::Reference< css::uno::XComponentContext > m_xCtx;
74  std::optional<OUString> m_xOfficeBrandDir;
75  std::optional<OUString> m_xUserDir;
76 };
77 
78 } // namespace comphelper
79 
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString SAL_CALL getOfficeInstallationDirectoryURL() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
css::uno::Reference< css::uno::XComponentContext > m_xCtx
virtual OUString SAL_CALL makeAbsoluteURL(const OUString &URL) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getOfficeUserDataDirectoryURL() override
OfficeInstallationDirectories(const css::uno::Reference< css::uno::XComponentContext > &xCtx)
unsigned char sal_Bool
cppu::WeakImplHelper< css::util::XOfficeInstallationDirectories, css::lang::XServiceInfo > UnoImplBase
virtual OUString SAL_CALL makeRelocatableURL(const OUString &URL) override