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 _CONTENT_HXX
29 #define _CONTENT_HXX
30 
31 #include <vos/ref.hxx>
32 #include <ucbhelper/contenthelper.hxx>
33 #include <com/sun/star/io/XInputStream.hpp>
34 
35 #include "urlparameter.hxx"
36 
37 namespace com { namespace sun { namespace star { namespace beans {
38 	struct Property;
39 	struct PropertyValue;
40 } } } }
41 
42 namespace com { namespace sun { namespace star { namespace sdbc {
43 	class XRow;
44 } } } }
45 
46 namespace chelp
47 {
48 
49 //=========================================================================
50 
51 // UNO service name for the content.
52 #define MYUCP_CONTENT_SERVICE_NAME \
53 							"com.sun.star.ucb.CHelpContent"
54 
55 //=========================================================================
56 
57 	class Databases;
58 
59 	struct ContentProperties
60 	{
61 		::rtl::OUString aTitle;    		// Title
62 		::rtl::OUString aContentType;	// ContentType
63 		sal_Bool        bIsDocument;    // IsDocument
64 		sal_Bool        bIsFolder;    	// IsFolder
65 
66 		ContentProperties()
67 			: bIsDocument( sal_True ), bIsFolder( sal_False ) {}
68 	};
69 
70 //=========================================================================
71 
72 	class Content : public ::ucbhelper::ContentImplHelper
73 	{
74 	public:
75 
76 		Content( const ::com::sun::star::uno::Reference<
77 				 ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
78 				 ::ucbhelper::ContentProviderImplHelper* pProvider,
79 				 const ::com::sun::star::uno::Reference<
80 				 ::com::sun::star::ucb::XContentIdentifier >& Identifier,
81 				 Databases* pDatabases );
82 
83 		virtual ~Content();
84 
85 		// XInterface
86 		XINTERFACE_DECL()
87 
88 		// XTypeProvider
89 		XTYPEPROVIDER_DECL()
90 
91 		// XServiceInfo
92 		virtual ::rtl::OUString SAL_CALL
93 		getImplementationName()
94 			throw( ::com::sun::star::uno::RuntimeException );
95 
96 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
97 		getSupportedServiceNames()
98 			throw( ::com::sun::star::uno::RuntimeException );
99 
100 		// XContent
101 		virtual rtl::OUString SAL_CALL
102 		getContentType()
103 			throw( com::sun::star::uno::RuntimeException );
104 
105 		// XCommandProcessor
106 		virtual com::sun::star::uno::Any SAL_CALL
107 		execute( const com::sun::star::ucb::Command& aCommand,
108 				 sal_Int32 CommandId,
109 				 const com::sun::star::uno::Reference<
110 				 com::sun::star::ucb::XCommandEnvironment >& Environment )
111 			throw( com::sun::star::uno::Exception,
112 				   com::sun::star::ucb::CommandAbortedException,
113 				   com::sun::star::uno::RuntimeException );
114 
115 		virtual void SAL_CALL
116 		abort( sal_Int32 CommandId )
117 			throw( com::sun::star::uno::RuntimeException );
118 
119 
120 	private:
121 
122 		// private members;
123 
124 		ContentProperties m_aProps;
125 		URLParameter      m_aURLParameter;
126 		Databases*        m_pDatabases;
127 
128 
129 		// private methods
130 
131 		virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
132 		getProperties( const com::sun::star::uno::Reference<
133 					   com::sun::star::ucb::XCommandEnvironment > & xEnv );
134 		virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
135 		getCommands( const com::sun::star::uno::Reference<
136 					 com::sun::star::ucb::XCommandEnvironment > & xEnv );
137 
138 		virtual ::rtl::OUString getParentURL() { return ::rtl::OUString(); }
139 
140 		::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
141 		getPropertyValues( const ::com::sun::star::uno::Sequence<
142 						   ::com::sun::star::beans::Property >& rProperties );
143 		void setPropertyValues(
144 			const ::com::sun::star::uno::Sequence<
145 			::com::sun::star::beans::PropertyValue >& rValues );
146 
147 
148 	};
149 
150 }
151 
152 #endif
153