merge the formfield patch from ooo-build
[ooovba.git] / xmlhelp / source / cxxhelp / provider / provider.hxx
blobec7d08bd8269f1e556994c3a430e68b5a180c405
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: provider.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _PROVIDER_HXX
32 #define _PROVIDER_HXX
34 #include <rtl/ustring.hxx>
35 #include <osl/mutex.hxx>
36 #include <ucbhelper/providerhelper.hxx>
37 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
38 #include <com/sun/star/container/XContainerListener.hpp>
39 #include <com/sun/star/container/XContainer.hpp>
40 #include <com/sun/star/lang/XComponent.hpp>
43 namespace chelp {
45 //=========================================================================
47 // UNO service name for the provider. This name will be used by the UCB to
48 // create instances of the provider.
50 //#define MYUCP_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.CHelpContentProvider"
51 #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME1 "com.sun.star.help.XMLHelp"
52 #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME_LENGTH1 25
54 #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME2 "com.sun.star.ucb.HelpContentProvider"
55 #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME_LENGTH2 36
57 // URL scheme. This is the scheme the provider will be able to create
58 // contents for. The UCB will select the provider ( i.e. in order to create
59 // contents ) according to this scheme.
61 #define MYUCP_URL_SCHEME "vnd.sun.star.help"
62 #define MYUCP_URL_SCHEME_LENGTH 18
63 #define MYUCP_CONTENT_TYPE "application/vnd.sun.star.xmlhelp" // UCB Content Type.
65 //=========================================================================
68 class Databases;
71 class ContentProvider :
72 public ::ucbhelper::ContentProviderImplHelper,
73 public ::com::sun::star::container::XContainerListener,
74 public ::com::sun::star::lang::XComponent
76 public:
77 ContentProvider(
78 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
80 virtual ~ContentProvider();
82 // XInterface
83 XINTERFACE_DECL()
85 // XTypeProvider
86 XTYPEPROVIDER_DECL()
88 // XServiceInfo
89 XSERVICEINFO_DECL()
91 // XContentProvider
92 virtual ::com::sun::star::uno::Reference<
93 ::com::sun::star::ucb::XContent > SAL_CALL
94 queryContent( const ::com::sun::star::uno::Reference<
95 ::com::sun::star::ucb::XContentIdentifier >& Identifier )
96 throw( ::com::sun::star::ucb::IllegalIdentifierException,
97 ::com::sun::star::uno::RuntimeException );
99 //////////////////////////////////////////////////////////////////////
100 // Additional interfaces
101 //////////////////////////////////////////////////////////////////////
103 // XComponent
105 virtual void SAL_CALL
106 dispose( )
107 throw (::com::sun::star::uno::RuntimeException);
109 virtual void SAL_CALL
110 addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
111 throw (::com::sun::star::uno::RuntimeException)
113 (void)xListener;
116 virtual void SAL_CALL
117 removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
118 throw (::com::sun::star::uno::RuntimeException)
120 (void)aListener;
123 // XConainerListener ( deriver from XEventListener )
125 virtual void SAL_CALL
126 disposing( const ::com::sun::star::lang::EventObject& Source )
127 throw (::com::sun::star::uno::RuntimeException)
129 (void)Source;
130 m_xContainer = com::sun::star::uno::Reference<com::sun::star::container::XContainer>(0);
133 virtual void SAL_CALL
134 elementInserted( const ::com::sun::star::container::ContainerEvent& Event )
135 throw (::com::sun::star::uno::RuntimeException)
137 (void)Event;
140 virtual void SAL_CALL
141 elementRemoved( const ::com::sun::star::container::ContainerEvent& Event )
142 throw (::com::sun::star::uno::RuntimeException)
144 (void)Event;
147 virtual void SAL_CALL
148 elementReplaced( const ::com::sun::star::container::ContainerEvent& Event )
149 throw (::com::sun::star::uno::RuntimeException);
152 //////////////////////////////////////////////////////////////////////
153 // Non-interface methods.
154 //////////////////////////////////////////////////////////////////////
156 private:
158 osl::Mutex m_aMutex;
159 bool isInitialized;
160 rtl::OUString m_aScheme;
161 Databases* m_pDatabases;
162 com::sun::star::uno::Reference<com::sun::star::container::XContainer> m_xContainer;
164 // private methods
166 void init();
168 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
169 getConfiguration() const;
171 ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >
172 getHierAccess( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& sProvider,
173 const char* file ) const;
175 ::rtl::OUString
176 getKey( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
177 const char* key ) const;
179 sal_Bool
180 getBooleanKey(
181 const ::com::sun::star::uno::Reference<
182 ::com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
183 const char* key) const;
185 void subst( rtl::OUString& instpath ) const;
190 #endif