defer finding dialog parent until we need it
[LibreOffice.git] / xmlhelp / source / cxxhelp / provider / provider.hxx
blob3c1c8eec50c319a8c5565211fabf2df698909b2a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <memory>
23 #include <rtl/ustring.hxx>
24 #include <ucbhelper/providerhelper.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>
31 namespace chelp {
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.
37 #define MYUCP_URL_SCHEME "vnd.sun.star.help"
38 inline constexpr OUString MYUCP_CONTENT_TYPE = u"application/vnd.sun.star.xmlhelp"_ustr; // UCB Content Type.
40 class Databases;
42 typedef cppu::ImplInheritanceHelper< ::ucbhelper::ContentProviderImplHelper, css::container::XContainerListener, css::lang::XComponent> ContentProvider_Base;
43 class ContentProvider : public ContentProvider_Base
45 public:
46 explicit ContentProvider(
47 const css::uno::Reference< css::uno::XComponentContext >& rxContext );
49 virtual ~ContentProvider() override;
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;
56 // XContentProvider
57 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(
58 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
60 // Additional interfaces
62 // XComponent
64 virtual void SAL_CALL
65 dispose( ) override;
67 virtual void SAL_CALL
68 addEventListener( const css::uno::Reference< css::lang::XEventListener >& ) override {}
70 virtual void SAL_CALL
71 removeEventListener( const css::uno::Reference< css::lang::XEventListener >& ) override {}
73 // XContainerListener ( derive from XEventListener )
75 virtual void SAL_CALL
76 disposing( const css::lang::EventObject& /*Source*/ ) override
78 m_xContainer.clear();
81 virtual void SAL_CALL
82 elementInserted( const css::container::ContainerEvent& ) override {}
84 virtual void SAL_CALL
85 elementRemoved( const css::container::ContainerEvent& ) override {}
87 virtual void SAL_CALL
88 elementReplaced( const css::container::ContainerEvent& Event ) override;
90 // Non-interface methods.
92 private:
93 bool isInitialized;
94 std::unique_ptr<Databases> m_pDatabases;
95 css::uno::Reference<css::container::XContainer> m_xContainer;
97 // private methods
99 void init();
101 static void subst( OUString& instpath );
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */