fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / xmlhelp / source / cxxhelp / provider / provider.hxx
bloba02b6f1363eb437e6475ea196b20e5f094261ba9
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 #ifndef _PROVIDER_HXX
21 #define _PROVIDER_HXX
23 #include <rtl/ustring.hxx>
24 #include <osl/mutex.hxx>
25 #include <ucbhelper/providerhelper.hxx>
26 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
27 #include <com/sun/star/container/XContainerListener.hpp>
28 #include <com/sun/star/container/XContainer.hpp>
29 #include <com/sun/star/lang/XComponent.hpp>
32 namespace chelp {
34 //=========================================================================
36 // UNO service name for the provider. This name will be used by the UCB to
37 // create instances of the provider.
39 #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME1 "com.sun.star.help.XMLHelp"
40 #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME_LENGTH1 25
42 #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME2 "com.sun.star.ucb.HelpContentProvider"
43 #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME_LENGTH2 36
45 // URL scheme. This is the scheme the provider will be able to create
46 // contents for. The UCB will select the provider ( i.e. in order to create
47 // contents ) according to this scheme.
49 #define MYUCP_URL_SCHEME "vnd.sun.star.help"
50 #define MYUCP_URL_SCHEME_LENGTH 18
51 #define MYUCP_CONTENT_TYPE "application/vnd.sun.star.xmlhelp" // UCB Content Type.
53 //=========================================================================
56 class Databases;
59 class ContentProvider :
60 public ::ucbhelper::ContentProviderImplHelper,
61 public ::com::sun::star::container::XContainerListener,
62 public ::com::sun::star::lang::XComponent
64 public:
65 ContentProvider(
66 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
68 virtual ~ContentProvider();
70 // XInterface
71 XINTERFACE_DECL()
73 // XTypeProvider
74 XTYPEPROVIDER_DECL()
76 // XServiceInfo
77 XSERVICEINFO_DECL()
79 // XContentProvider
80 virtual ::com::sun::star::uno::Reference<
81 ::com::sun::star::ucb::XContent > SAL_CALL
82 queryContent( const ::com::sun::star::uno::Reference<
83 ::com::sun::star::ucb::XContentIdentifier >& Identifier )
84 throw( ::com::sun::star::ucb::IllegalIdentifierException,
85 ::com::sun::star::uno::RuntimeException );
87 //////////////////////////////////////////////////////////////////////
88 // Additional interfaces
89 //////////////////////////////////////////////////////////////////////
91 // XComponent
93 virtual void SAL_CALL
94 dispose( )
95 throw (::com::sun::star::uno::RuntimeException);
97 virtual void SAL_CALL
98 addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
99 throw (::com::sun::star::uno::RuntimeException)
101 (void)xListener;
104 virtual void SAL_CALL
105 removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
106 throw (::com::sun::star::uno::RuntimeException)
108 (void)aListener;
111 // XConainerListener ( deriver from XEventListener )
113 virtual void SAL_CALL
114 disposing( const ::com::sun::star::lang::EventObject& Source )
115 throw (::com::sun::star::uno::RuntimeException)
117 (void)Source;
118 m_xContainer = com::sun::star::uno::Reference<com::sun::star::container::XContainer>(0);
121 virtual void SAL_CALL
122 elementInserted( const ::com::sun::star::container::ContainerEvent& Event )
123 throw (::com::sun::star::uno::RuntimeException)
125 (void)Event;
128 virtual void SAL_CALL
129 elementRemoved( const ::com::sun::star::container::ContainerEvent& Event )
130 throw (::com::sun::star::uno::RuntimeException)
132 (void)Event;
135 virtual void SAL_CALL
136 elementReplaced( const ::com::sun::star::container::ContainerEvent& Event )
137 throw (::com::sun::star::uno::RuntimeException);
140 //////////////////////////////////////////////////////////////////////
141 // Non-interface methods.
142 //////////////////////////////////////////////////////////////////////
144 private:
146 osl::Mutex m_aMutex;
147 bool isInitialized;
148 OUString m_aScheme;
149 Databases* m_pDatabases;
150 com::sun::star::uno::Reference<com::sun::star::container::XContainer> m_xContainer;
152 // private methods
154 void init();
156 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
157 getConfiguration() const;
159 ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >
160 getHierAccess( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& sProvider,
161 const char* file ) const;
163 OUString
164 getKey( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
165 const char* key ) const;
167 sal_Bool
168 getBooleanKey(
169 const ::com::sun::star::uno::Reference<
170 ::com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
171 const char* key) const;
173 void subst( OUString& instpath ) const;
178 #endif
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */