1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _PKGPROVIDER_HXX
29 #define _PKGPROVIDER_HXX
30 
31 #include <ucbhelper/providerhelper.hxx>
32 #include "pkguri.hxx"
33 
34 namespace com { namespace sun { namespace star { namespace container {
35 	class XHierarchicalNameAccess;
36 } } } }
37 
38 namespace package_ucp {
39 
40 //=========================================================================
41 
42 // UNO service name for the provider. This name will be used by the UCB to
43 // create instances of the provider.
44 #define PACKAGE_CONTENT_PROVIDER_SERVICE_NAME \
45 				"com.sun.star.ucb.PackageContentProvider"
46 #define PACKAGE_CONTENT_PROVIDER_SERVICE_NAME_LENGTH	39
47 
48 // UCB Content Type.
49 #define PACKAGE_FOLDER_CONTENT_TYPE \
50 				"application/" PACKAGE_URL_SCHEME "-folder"
51 #define PACKAGE_STREAM_CONTENT_TYPE \
52 				"application/" PACKAGE_URL_SCHEME "-stream"
53 #define PACKAGE_ZIP_FOLDER_CONTENT_TYPE \
54 				"application/" PACKAGE_ZIP_URL_SCHEME "-folder"
55 #define PACKAGE_ZIP_STREAM_CONTENT_TYPE \
56 				"application/" PACKAGE_ZIP_URL_SCHEME "-stream"
57 
58 //=========================================================================
59 
60 class Packages;
61 
62 class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
63 {
64 	Packages* m_pPackages;
65 
66 public:
67 	ContentProvider( const ::com::sun::star::uno::Reference<
68 						::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
69 	virtual ~ContentProvider();
70 
71 	// XInterface
72 	XINTERFACE_DECL()
73 
74 	// XTypeProvider
75 	XTYPEPROVIDER_DECL()
76 
77     // XServiceInfo
78 	XSERVICEINFO_DECL()
79 
80 	// XContentProvider
81 	virtual ::com::sun::star::uno::Reference<
82 				::com::sun::star::ucb::XContent > SAL_CALL
83 	queryContent( const ::com::sun::star::uno::Reference<
84 					::com::sun::star::ucb::XContentIdentifier >& Identifier )
85 		throw( ::com::sun::star::ucb::IllegalIdentifierException,
86 			   ::com::sun::star::uno::RuntimeException );
87 
88 	//////////////////////////////////////////////////////////////////////
89 	// Additional interfaces
90 	//////////////////////////////////////////////////////////////////////
91 
92 	//////////////////////////////////////////////////////////////////////
93 	// Non-interface methods.
94 	//////////////////////////////////////////////////////////////////////
95 
96 	::com::sun::star::uno::Reference<
97 		::com::sun::star::container::XHierarchicalNameAccess >
98 	createPackage( const rtl::OUString & rName, const rtl::OUString & rParam );
99 	sal_Bool
100 	removePackage( const rtl::OUString & rName );
101 };
102 
103 }
104 
105 #endif
106