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