LibreOffice Module xmlhelp (master) 1
provider.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 <memory>
23#include <rtl/ustring.hxx>
25#include <com/sun/star/container/XContainerListener.hpp>
26#include <com/sun/star/container/XContainer.hpp>
27#include <com/sun/star/lang/XComponent.hpp>
28#include <com/sun/star/lang/XSingleServiceFactory.hpp>
29#include <com/sun/star/lang/XMultiServiceFactory.hpp>
30
31namespace chelp {
32
33// URL scheme. This is the scheme the provider will be able to create
34// contents for. The UCB will select the provider ( i.e. in order to create
35// contents ) according to this scheme.
36
37#define MYUCP_URL_SCHEME "vnd.sun.star.help"
38inline constexpr OUStringLiteral MYUCP_CONTENT_TYPE = u"application/vnd.sun.star.xmlhelp"; // UCB Content Type.
39
40 class Databases;
41
42 typedef cppu::ImplInheritanceHelper< ::ucbhelper::ContentProviderImplHelper, css::container::XContainerListener, css::lang::XComponent> ContentProvider_Base;
44 {
45 public:
47 const css::uno::Reference< css::uno::XComponentContext >& rxContext );
48
49 virtual ~ContentProvider() override;
50
51 // XServiceInfo
52 virtual OUString SAL_CALL getImplementationName() override;
53 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
54 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
55
56 // XContentProvider
57 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(
58 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
59
60 // Additional interfaces
61
62 // XComponent
63
64 virtual void SAL_CALL
65 dispose( ) override;
66
67 virtual void SAL_CALL
68 addEventListener( const css::uno::Reference< css::lang::XEventListener >& ) override {}
69
70 virtual void SAL_CALL
71 removeEventListener( const css::uno::Reference< css::lang::XEventListener >& ) override {}
72
73 // XContainerListener ( derive from XEventListener )
74
75 virtual void SAL_CALL
76 disposing( const css::lang::EventObject& /*Source*/ ) override
77 {
78 m_xContainer.clear();
79 }
80
81 virtual void SAL_CALL
82 elementInserted( const css::container::ContainerEvent& ) override {}
83
84 virtual void SAL_CALL
85 elementRemoved( const css::container::ContainerEvent& ) override {}
86
87 virtual void SAL_CALL
88 elementReplaced( const css::container::ContainerEvent& Event ) override;
89
90 // Non-interface methods.
91
92 private:
94 std::unique_ptr<Databases> m_pDatabases;
95 css::uno::Reference<css::container::XContainer> m_xContainer;
96
97 // private methods
98
99 void init();
100
101 static void subst( OUString& instpath );
102 };
103
104}
105
106/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< Databases > m_pDatabases
Definition: provider.hxx:94
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &) override
Definition: provider.hxx:68
virtual void SAL_CALL elementInserted(const css::container::ContainerEvent &) override
Definition: provider.hxx:82
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override
virtual OUString SAL_CALL getImplementationName() override
Definition: provider.cxx:58
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &) override
Definition: provider.hxx:71
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: provider.cxx:64
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: provider.cxx:70
virtual void SAL_CALL disposing(const css::lang::EventObject &) override
Definition: provider.hxx:76
virtual void SAL_CALL dispose() override
Definition: provider.cxx:117
virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent &Event) override
Definition: provider.cxx:127
virtual ~ContentProvider() override
Definition: provider.cxx:52
static void subst(OUString &instpath)
Definition: provider.cxx:185
ContentProvider(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
css::uno::Reference< css::container::XContainer > m_xContainer
Definition: provider.hxx:95
virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent &) override
Definition: provider.hxx:85
float u
cppu::ImplInheritanceHelper< ::ucbhelper::ContentProviderImplHelper, css::container::XContainerListener, css::lang::XComponent > ContentProvider_Base
Definition: provider.hxx:40
constexpr OUStringLiteral MYUCP_CONTENT_TYPE
Definition: provider.hxx:38
unsigned char sal_Bool