bump product version to 5.0.4.1
[LibreOffice.git] / ucb / source / ucp / gio / gio_content.hxx
blobc5cafba661edb3ea8a21f71406863aec9e1b8f14
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_UCB_SOURCE_UCP_GIO_GIO_CONTENT_HXX
21 #define INCLUDED_UCB_SOURCE_UCP_GIO_GIO_CONTENT_HXX
23 #include <com/sun/star/io/XInputStream.hpp>
24 #include <com/sun/star/io/XOutputStream.hpp>
25 #include <com/sun/star/ucb/ContentCreationException.hpp>
26 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
27 #include <com/sun/star/ucb/TransferInfo.hpp>
28 #include <com/sun/star/ucb/XContentCreator.hpp>
29 #include <ucbhelper/contenthelper.hxx>
30 #include <gio/gio.h>
32 #include <list>
34 namespace com { namespace sun { namespace star {
35 namespace beans {
36 struct Property;
37 struct PropertyValue;
39 namespace sdbc {
40 class XRow;
42 }}}
43 namespace ucbhelper
45 class Content;
49 namespace gio
53 #define GIO_FILE_TYPE "application/vnd.sun.staroffice.gio-file"
54 #define GIO_FOLDER_TYPE "application/vnd.sun.staroffice.gio-folder"
56 com::sun::star::uno::Any convertToException(GError *pError,
57 const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rContext, bool bThrow=true);
58 void convertToIOException(GError *pError,
59 const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rContext)
60 throw (css::io::IOException, css::uno::RuntimeException, std::exception);
62 class ContentProvider;
63 class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator
65 private:
66 ContentProvider *m_pProvider;
67 GFile* mpFile;
68 GFileInfo *mpInfo;
69 bool mbTransient;
71 GFileInfo *getGFileInfo(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv,
72 GError **ppError=NULL);
73 bool isFolder(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv);
75 com::sun::star::uno::Any mapGIOError( GError *error );
76 com::sun::star::uno::Any getBadArgExcept();
78 com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
79 getPropertyValues(
80 const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties,
81 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
82 private:
83 typedef rtl::Reference< Content > ContentRef;
84 typedef std::list< ContentRef > ContentRefList;
86 void queryChildren( ContentRefList& rChildren );
88 bool doSetFileInfo ( GFileInfo *pNewInfo );
90 com::sun::star::uno::Any open(const com::sun::star::ucb::OpenCommandArgument2 & rArg,
91 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
92 throw( com::sun::star::uno::Exception );
94 void transfer( const com::sun::star::ucb::TransferInfo& rTransferInfo,
95 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
96 throw( com::sun::star::uno::Exception );
98 void insert( const com::sun::star::uno::Reference< com::sun::star::io::XInputStream > & xInputStream,
99 bool bReplaceExisting, const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
100 throw( com::sun::star::uno::Exception );
102 void destroy( bool bDeletePhysical ) throw( com::sun::star::uno::Exception );
104 static void copyData( com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xIn,
105 com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > xOut );
107 com::sun::star::uno::Sequence< com::sun::star::uno::Any >
108 setPropertyValues( const com::sun::star::uno::Sequence<
109 com::sun::star::beans::PropertyValue >& rValues,
110 const com::sun::star::uno::Reference<
111 com::sun::star::ucb::XCommandEnvironment >& xEnv );
113 bool feedSink( com::sun::star::uno::Reference< com::sun::star::uno::XInterface> aSink,
114 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
116 com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
117 createInputStream(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
118 throw( com::sun::star::uno::Exception );
120 bool exchangeIdentity(const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xNewId);
122 public:
123 Content( const com::sun::star::uno::Reference<
124 com::sun::star::uno::XComponentContext >& rxContext, ContentProvider *pProvider,
125 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier)
126 throw ( com::sun::star::ucb::ContentCreationException );
128 Content( const com::sun::star::uno::Reference<
129 com::sun::star::uno::XComponentContext >& rxContext, ContentProvider *pProvider,
130 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier,
131 bool bIsFolder)
132 throw ( com::sun::star::ucb::ContentCreationException );
134 virtual ~Content();
136 com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > getPropertyValuesFromGFileInfo(
137 GFileInfo *pInfo, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
138 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv,
139 const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties);
141 virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
142 getProperties( const com::sun::star::uno::Reference<
143 com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
145 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
146 getCommands( const com::sun::star::uno::Reference<
147 com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
149 virtual OUString getParentURL() SAL_OVERRIDE;
151 // XInterface
152 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
153 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
154 virtual void SAL_CALL acquire()
155 throw() SAL_OVERRIDE;
156 virtual void SAL_CALL release()
157 throw() SAL_OVERRIDE;
159 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
160 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
161 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
162 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
164 virtual OUString SAL_CALL
165 getImplementationName()
166 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
168 virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
169 getSupportedServiceNames()
170 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
172 virtual OUString SAL_CALL
173 getContentType()
174 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
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, std::exception ) SAL_OVERRIDE;
182 virtual void SAL_CALL abort( sal_Int32 CommandId )
183 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
185 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
186 SAL_CALL queryCreatableContentsInfo()
187 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
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, std::exception ) SAL_OVERRIDE;
192 com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
193 queryCreatableContentsInfo(
194 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv)
195 throw( com::sun::star::uno::RuntimeException );
197 GFile* getGFile();
202 #endif
204 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */