Update ooo320-m1
[ooovba.git] / ucb / source / ucp / gio / gio_content.hxx
blob9b63edf0ba32d6ec736915fc9102c3324928e0b8
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: gio_content.hxx,v $
10 * $Revision: 1.2 $
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 #ifndef GIO_CONTENT_HXX
32 #define GIO_CONTENT_HXX
34 #include <com/sun/star/io/XInputStream.hpp>
35 #include <com/sun/star/io/XOutputStream.hpp>
36 #include <com/sun/star/ucb/ContentCreationException.hpp>
37 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
38 #include <com/sun/star/ucb/TransferInfo.hpp>
39 #include <com/sun/star/ucb/XContentCreator.hpp>
40 #include <ucbhelper/contenthelper.hxx>
41 #include <gio/gio.h>
43 #include <list>
45 namespace com { namespace sun { namespace star {
46 namespace beans {
47 struct Property;
48 struct PropertyValue;
50 namespace sdbc {
51 class XRow;
53 }}}
54 namespace ucbhelper
56 class Content;
60 namespace gio
63 #define GIO_CONTENT_SERVICE_NAME "com.sun.star.ucb.GIOContent"
65 #define GIO_FILE_TYPE "application/vnd.sun.staroffice.gio-file"
66 #define GIO_FOLDER_TYPE "application/vnd.sun.staroffice.gio-folder"
68 com::sun::star::uno::Any convertToException(GError *pError,
69 const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rContext, bool bThrow=true);
71 class ContentProvider;
72 class ContentProperties;
73 class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator
75 private:
76 ContentProvider *m_pProvider;
77 GFile* mpFile;
78 GFileInfo *mpInfo;
79 bool mbTransient;
81 GFileInfo *getGFileInfo(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv,
82 GError **ppError=NULL);
83 bool isFolder(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv);
85 com::sun::star::uno::Any mapGIOError( GError *error );
86 com::sun::star::uno::Any getBadArgExcept();
88 com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
89 getPropertyValues(
90 const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties,
91 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
92 private:
93 typedef rtl::Reference< Content > ContentRef;
94 typedef std::list< ContentRef > ContentRefList;
96 void queryChildren( ContentRefList& rChildren );
98 bool doSetFileInfo ( GFileInfo *pNewInfo );
100 com::sun::star::uno::Any open(const com::sun::star::ucb::OpenCommandArgument2 & rArg,
101 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
102 throw( com::sun::star::uno::Exception );
104 void transfer( const com::sun::star::ucb::TransferInfo& rTransferInfo,
105 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
106 throw( com::sun::star::uno::Exception );
108 void insert( const com::sun::star::uno::Reference< com::sun::star::io::XInputStream > & xInputStream,
109 sal_Bool bReplaceExisting, const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
110 throw( com::sun::star::uno::Exception );
112 void destroy( sal_Bool bDeletePhysical ) throw( com::sun::star::uno::Exception );
114 void copyData( com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xIn,
115 com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > xOut );
117 com::sun::star::uno::Sequence< com::sun::star::uno::Any >
118 setPropertyValues( const com::sun::star::uno::Sequence<
119 com::sun::star::beans::PropertyValue >& rValues,
120 const com::sun::star::uno::Reference<
121 com::sun::star::ucb::XCommandEnvironment >& xEnv );
123 sal_Bool feedSink( com::sun::star::uno::Reference< com::sun::star::uno::XInterface> aSink,
124 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
126 com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
127 createInputStream(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
128 throw( com::sun::star::uno::Exception );
130 sal_Bool exchangeIdentity(const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xNewId);
132 public:
133 Content( const com::sun::star::uno::Reference<
134 com::sun::star::lang::XMultiServiceFactory >& rxSMgr, ContentProvider *pProvider,
135 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier)
136 throw ( com::sun::star::ucb::ContentCreationException );
138 Content( const com::sun::star::uno::Reference<
139 com::sun::star::lang::XMultiServiceFactory >& rxSMgr, ContentProvider *pProvider,
140 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier,
141 sal_Bool bIsFolder)
142 throw ( com::sun::star::ucb::ContentCreationException );
144 virtual ~Content();
146 static com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > getPropertyValuesFromGFileInfo(
147 GFileInfo *pInfo, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr,
148 const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties);
150 virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
151 getProperties( const com::sun::star::uno::Reference<
152 com::sun::star::ucb::XCommandEnvironment > & xEnv );
154 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
155 getCommands( const com::sun::star::uno::Reference<
156 com::sun::star::ucb::XCommandEnvironment > & xEnv );
158 virtual ::rtl::OUString getParentURL();
160 XINTERFACE_DECL()
162 XTYPEPROVIDER_DECL()
164 virtual ::rtl::OUString SAL_CALL
165 getImplementationName()
166 throw( com::sun::star::uno::RuntimeException );
168 virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
169 getSupportedServiceNames()
170 throw( com::sun::star::uno::RuntimeException );
172 virtual rtl::OUString SAL_CALL
173 getContentType()
174 throw( com::sun::star::uno::RuntimeException );
176 virtual com::sun::star::uno::Any SAL_CALL
177 execute( const com::sun::star::ucb::Command& aCommand,
178 sal_Int32 CommandId,
179 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment )
180 throw( com::sun::star::uno::Exception, com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::RuntimeException );
182 virtual void SAL_CALL abort( sal_Int32 CommandId )
183 throw( com::sun::star::uno::RuntimeException );
185 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
186 SAL_CALL queryCreatableContentsInfo()
187 throw( com::sun::star::uno::RuntimeException );
188 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
189 SAL_CALL createNewContent( const com::sun::star::ucb::ContentInfo& Info )
190 throw( com::sun::star::uno::RuntimeException );
192 GFile* getGFile();
197 #endif