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/XMultiServiceFactory.hpp>
25#include <unordered_map>
26
27namespace com::sun::star {
28 namespace container {
29 class XHierarchicalNameAccess;
30 }
31 namespace util {
32 class XOfficeInstallationDirectories;
33 }
34}
35
36namespace hierarchy_ucp {
37
38
39#define HIERARCHY_URL_SCHEME \
40 "vnd.sun.star.hier"
41#define HIERARCHY_URL_SCHEME_LENGTH 17
42
43inline constexpr OUStringLiteral HIERARCHY_FOLDER_CONTENT_TYPE =
44 u"application/" HIERARCHY_URL_SCHEME "-folder";
45inline constexpr OUStringLiteral HIERARCHY_LINK_CONTENT_TYPE =
46 u"application/" HIERARCHY_URL_SCHEME "-link";
47
49{
50 css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider;
51 css::uno::Reference< css::container::XHierarchicalNameAccess > xRootReadAccess;
53
55};
56
57typedef std::unordered_map
58<
59 OUString, // service specifier
60 ConfigProviderMapEntry
61>
63
64typedef cppu::ImplInheritanceHelper< ::ucbhelper::ContentProviderImplHelper, css::lang::XInitialization> HierarchyContentProvider_Base;
66{
68 css::uno::Reference< css::util::XOfficeInstallationDirectories > m_xOfficeInstDirs;
69
70public:
72 const css::uno::Reference< css::uno::XComponentContext >& rxContext );
73 virtual ~HierarchyContentProvider() override;
74
75 // XServiceInfo
76 virtual OUString SAL_CALL getImplementationName() override;
77 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
78 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
79
80 // XContentProvider
81 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
82 queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
83
84 // XInitialization
85 virtual void SAL_CALL
86 initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
87
88 // Non-Interface methods
89 css::uno::Reference< css::lang::XMultiServiceFactory >
90 getConfigProvider( const OUString & rServiceSpecifier );
91 css::uno::Reference< css::container::XHierarchicalNameAccess >
92 getRootConfigReadNameAccess( const OUString & rServiceSpecifier );
93
94 // Note: may return an empty reference.
95 css::uno::Reference< css::util::XOfficeInstallationDirectories >
97};
98
99} // namespace hierarchy_ucp
100
101/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override
css::uno::Reference< css::lang::XMultiServiceFactory > getConfigProvider(const OUString &rServiceSpecifier)
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
css::uno::Reference< css::util::XOfficeInstallationDirectories > m_xOfficeInstDirs
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Reference< css::container::XHierarchicalNameAccess > getRootConfigReadNameAccess(const OUString &rServiceSpecifier)
HierarchyContentProvider(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::util::XOfficeInstallationDirectories > getOfficeInstallationDirectories()
float u
#define HIERARCHY_URL_SCHEME
cppu::ImplInheritanceHelper< ::ucbhelper::ContentProviderImplHelper, css::lang::XInitialization > HierarchyContentProvider_Base
constexpr OUStringLiteral HIERARCHY_LINK_CONTENT_TYPE
constexpr OUStringLiteral HIERARCHY_FOLDER_CONTENT_TYPE
std::unordered_map< OUString, ConfigProviderMapEntry > ConfigProviderMap
css::uno::Reference< css::container::XHierarchicalNameAccess > xRootReadAccess
css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider
unsigned char sal_Bool