1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _PKGPROVIDER_HXX
25 #define _PKGPROVIDER_HXX
26 
27 #include <ucbhelper/providerhelper.hxx>
28 #include "pkguri.hxx"
29 
30 namespace com { namespace sun { namespace star { namespace container {
31 	class XHierarchicalNameAccess;
32 } } } }
33 
34 namespace package_ucp {
35 
36 //=========================================================================
37 
38 // UNO service name for the provider. This name will be used by the UCB to
39 // create instances of the provider.
40 #define PACKAGE_CONTENT_PROVIDER_SERVICE_NAME \
41 				"com.sun.star.ucb.PackageContentProvider"
42 #define PACKAGE_CONTENT_PROVIDER_SERVICE_NAME_LENGTH	39
43 
44 // UCB Content Type.
45 #define PACKAGE_FOLDER_CONTENT_TYPE \
46 				"application/" PACKAGE_URL_SCHEME "-folder"
47 #define PACKAGE_STREAM_CONTENT_TYPE \
48 				"application/" PACKAGE_URL_SCHEME "-stream"
49 #define PACKAGE_ZIP_FOLDER_CONTENT_TYPE \
50 				"application/" PACKAGE_ZIP_URL_SCHEME "-folder"
51 #define PACKAGE_ZIP_STREAM_CONTENT_TYPE \
52 				"application/" PACKAGE_ZIP_URL_SCHEME "-stream"
53 
54 //=========================================================================
55 
56 class Packages;
57 
58 class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
59 {
60 	Packages* m_pPackages;
61 
62 public:
63 	ContentProvider( const ::com::sun::star::uno::Reference<
64 						::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
65 	virtual ~ContentProvider();
66 
67 	// XInterface
68 	XINTERFACE_DECL()
69 
70 	// XTypeProvider
71 	XTYPEPROVIDER_DECL()
72 
73     // XServiceInfo
74 	XSERVICEINFO_DECL()
75 
76 	// XContentProvider
77 	virtual ::com::sun::star::uno::Reference<
78 				::com::sun::star::ucb::XContent > SAL_CALL
79 	queryContent( const ::com::sun::star::uno::Reference<
80 					::com::sun::star::ucb::XContentIdentifier >& Identifier )
81 		throw( ::com::sun::star::ucb::IllegalIdentifierException,
82 			   ::com::sun::star::uno::RuntimeException );
83 
84 	//////////////////////////////////////////////////////////////////////
85 	// Additional interfaces
86 	//////////////////////////////////////////////////////////////////////
87 
88 	//////////////////////////////////////////////////////////////////////
89 	// Non-interface methods.
90 	//////////////////////////////////////////////////////////////////////
91 
92 	::com::sun::star::uno::Reference<
93 		::com::sun::star::container::XHierarchicalNameAccess >
94 	createPackage( const rtl::OUString & rName, const rtl::OUString & rParam );
95 	sal_Bool
96 	removePackage( const rtl::OUString & rName );
97 };
98 
99 }
100 
101 #endif
102