1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
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>
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 //=========================================================================
59 class ContentProvider
:
60 public ::ucbhelper::ContentProviderImplHelper
,
61 public ::com::sun::star::container::XContainerListener
,
62 public ::com::sun::star::lang::XComponent
66 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
68 virtual ~ContentProvider();
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 //////////////////////////////////////////////////////////////////////
95 throw (::com::sun::star::uno::RuntimeException
);
98 addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
)
99 throw (::com::sun::star::uno::RuntimeException
)
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
)
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
)
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
)
128 virtual void SAL_CALL
129 elementRemoved( const ::com::sun::star::container::ContainerEvent
& Event
)
130 throw (::com::sun::star::uno::RuntimeException
)
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 //////////////////////////////////////////////////////////////////////
149 Databases
* m_pDatabases
;
150 com::sun::star::uno::Reference
<com::sun::star::container::XContainer
> m_xContainer
;
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;
164 getKey( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XHierarchicalNameAccess
>& xHierAccess
,
165 const char* key
) const;
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;
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */