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