merge the formfield patch from ooo-build
[ooovba.git] / ucbhelper / workben / myucp / myucp_content.hxx
blob0c98a5a05ab96d6d29a0476857cca3086d0d12a0
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: myucp_content.hxx,v $
10 * $Revision: 1.9 $
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 // @@@ Adjust multi-include-protection-ifdef.
32 #ifndef _MYUCP_CONTENT_HXX
33 #define _MYUCP_CONTENT_HXX
35 #include <list>
37 #include "rtl/ref.hxx"
38 #include "ucbhelper/contenthelper.hxx"
40 namespace com { namespace sun { namespace star { namespace beans {
41 struct Property;
42 struct PropertyValue;
43 } } } }
45 namespace com { namespace sun { namespace star { namespace sdbc {
46 class XRow;
47 } } } }
49 namespace com { namespace sun { namespace star { namespace io {
50 class XInputStream;
51 } } } }
53 // @@@ Adjust namespace name.
54 namespace myucp
57 //=========================================================================
59 // @@@ Adjust service name.
61 // UNO service name for the content. Prefix with reversed company domain main.
62 #define MYUCP_CONTENT_SERVICE_NAME "com.sun.star.ucb.MyContent"
64 //=========================================================================
66 struct ContentProperties
68 ::rtl::OUString aTitle; // Title
69 ::rtl::OUString aContentType; // ContentType
70 sal_Bool bIsDocument; // IsDocument
71 sal_Bool bIsFolder; // IsFolder
73 // @@@ Add other properties supported by your content.
75 ContentProperties()
76 : bIsDocument( sal_True ), bIsFolder( sal_False ) {}
79 //=========================================================================
81 class Content : public ::ucbhelper::ContentImplHelper
83 ContentProperties m_aProps;
85 private:
86 virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
87 getProperties( const com::sun::star::uno::Reference<
88 com::sun::star::ucb::XCommandEnvironment > & xEnv );
89 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
90 getCommands( const com::sun::star::uno::Reference<
91 com::sun::star::ucb::XCommandEnvironment > & xEnv );
92 virtual ::rtl::OUString getParentURL();
94 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
95 getPropertyValues( const ::com::sun::star::uno::Sequence<
96 ::com::sun::star::beans::Property >& rProperties,
97 const ::com::sun::star::uno::Reference<
98 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
99 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
100 setPropertyValues( const ::com::sun::star::uno::Sequence<
101 ::com::sun::star::beans::PropertyValue >& rValues,
102 const ::com::sun::star::uno::Reference<
103 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
105 #define IMPLEMENT_COMMAND_OPEN
106 #define IMPLEMENT_COMMAND_INSERT
107 #define IMPLEMENT_COMMAND_DELETE
109 #ifdef IMPLEMENT_COMMAND_INSERT
110 typedef rtl::Reference< Content > ContentRef;
111 typedef std::list< ContentRef > ContentRefList;
112 void queryChildren( ContentRefList& rChildren );
114 // Command "insert"
115 void insert( const ::com::sun::star::uno::Reference<
116 ::com::sun::star::io::XInputStream > & xInputStream,
117 sal_Bool bReplaceExisting,
118 const com::sun::star::uno::Reference<
119 com::sun::star::ucb::XCommandEnvironment >& Environment )
120 throw( ::com::sun::star::uno::Exception );
121 #endif
123 #ifdef IMPLEMENT_COMMAND_DELETE
125 // Command "delete"
126 void destroy( sal_Bool bDeletePhysical )
127 throw( ::com::sun::star::uno::Exception );
128 #endif
130 public:
131 Content( const ::com::sun::star::uno::Reference<
132 ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
133 ::ucbhelper::ContentProviderImplHelper* pProvider,
134 const ::com::sun::star::uno::Reference<
135 ::com::sun::star::ucb::XContentIdentifier >& Identifier );
136 virtual ~Content();
138 // XInterface
139 XINTERFACE_DECL()
141 // XTypeProvider
142 XTYPEPROVIDER_DECL()
144 // XServiceInfo
145 virtual ::rtl::OUString SAL_CALL
146 getImplementationName()
147 throw( ::com::sun::star::uno::RuntimeException );
148 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
149 getSupportedServiceNames()
150 throw( ::com::sun::star::uno::RuntimeException );
152 // XContent
153 virtual rtl::OUString SAL_CALL
154 getContentType()
155 throw( com::sun::star::uno::RuntimeException );
157 // XCommandProcessor
158 virtual com::sun::star::uno::Any SAL_CALL
159 execute( const com::sun::star::ucb::Command& aCommand,
160 sal_Int32 CommandId,
161 const com::sun::star::uno::Reference<
162 com::sun::star::ucb::XCommandEnvironment >& Environment )
163 throw( com::sun::star::uno::Exception,
164 com::sun::star::ucb::CommandAbortedException,
165 com::sun::star::uno::RuntimeException );
166 virtual void SAL_CALL
167 abort( sal_Int32 CommandId )
168 throw( com::sun::star::uno::RuntimeException );
170 //////////////////////////////////////////////////////////////////////
171 // Additional interfaces
172 //////////////////////////////////////////////////////////////////////
174 // @@@ Add additional interfaces ( like com::sun::star::ucb::XContentCreator ).
176 //////////////////////////////////////////////////////////////////////
177 // Non-interface methods.
178 //////////////////////////////////////////////////////////////////////
180 // Called from resultset data supplier.
181 static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
182 getPropertyValues( const ::com::sun::star::uno::Reference<
183 ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
184 const ::com::sun::star::uno::Sequence<
185 ::com::sun::star::beans::Property >& rProperties,
186 const ContentProperties& rData,
187 const rtl::Reference<
188 ::ucbhelper::ContentProviderImplHelper >& rProvider,
189 const ::rtl::OUString& rContentId );
194 #endif