LibreOffice Module ucb (master)  1
hierarchyprovider.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 
23 #include <com/sun/star/lang/XInitialization.hpp>
24 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include <unordered_map>
27 
28 namespace com::sun::star {
29  namespace container {
30  class XHierarchicalNameAccess;
31  }
32  namespace util {
33  class XOfficeInstallationDirectories;
34  }
35 }
36 
37 namespace hierarchy_ucp {
38 
39 
40 #define HIERARCHY_URL_SCHEME \
41  "vnd.sun.star.hier"
42 #define HIERARCHY_URL_SCHEME_LENGTH 17
43 
44 #define HIERARCHY_FOLDER_CONTENT_TYPE \
45  "application/" HIERARCHY_URL_SCHEME "-folder"
46 #define HIERARCHY_LINK_CONTENT_TYPE \
47  "application/" HIERARCHY_URL_SCHEME "-link"
48 
50 {
51  css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider;
52  css::uno::Reference< css::container::XHierarchicalNameAccess > xRootReadAccess;
54 
55  ConfigProviderMapEntry() : bTriedToGetRootReadAccess( false ) {}
56 };
57 
58 typedef std::unordered_map
59 <
60  OUString, // service specifier
61  ConfigProviderMapEntry
62 >
64 
66  public css::lang::XInitialization
67 {
69  css::uno::Reference< css::util::XOfficeInstallationDirectories > m_xOfficeInstDirs;
70 
71 public:
72  explicit HierarchyContentProvider(
73  const css::uno::Reference< css::uno::XComponentContext >& rxContext );
74  virtual ~HierarchyContentProvider() override;
75 
76  // XInterface
77  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
78  virtual void SAL_CALL acquire()
79  throw() override;
80  virtual void SAL_CALL release()
81  throw() override;
82 
83  // XTypeProvider
84  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
85  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
86 
87  // XServiceInfo
88  virtual OUString SAL_CALL getImplementationName() override;
89  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
90  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
91 
92  // XContentProvider
93  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
94  queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
95 
96  // XInitialization
97  virtual void SAL_CALL
98  initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
99 
100  // Non-Interface methods
101  css::uno::Reference< css::lang::XMultiServiceFactory >
102  getConfigProvider( const OUString & rServiceSpecifier );
103  css::uno::Reference< css::container::XHierarchicalNameAccess >
104  getRootConfigReadNameAccess( const OUString & rServiceSpecifier );
105 
106  // Note: may return an empty reference.
107  css::uno::Reference< css::util::XOfficeInstallationDirectories >
109 };
110 
111 } // namespace hierarchy_ucp
112 
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
exports com.sun.star.lib. util
Type
signed char sal_Int8
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
exports com.sun.star. container
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::container::XHierarchicalNameAccess > getRootConfigReadNameAccess(const OUString &rServiceSpecifier)
virtual void SAL_CALL release() override
virtual void SAL_CALL acquire() override
css::uno::Reference< css::container::XHierarchicalNameAccess > xRootReadAccess
std::unordered_map< OUString, ConfigProviderMapEntry > ConfigProviderMap
css::uno::Reference< css::util::XOfficeInstallationDirectories > m_xOfficeInstDirs
css::uno::Reference< css::util::XOfficeInstallationDirectories > getOfficeInstallationDirectories()
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override
HierarchyContentProvider(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
unsigned char sal_Bool
css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider
css::uno::Reference< css::lang::XMultiServiceFactory > getConfigProvider(const OUString &rServiceSpecifier)
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override