Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / ucb / source / ucp / gio / gio_content.hxx
blobfd40d200a234d6dae8c00aaa3a120bf0aab77228
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
52 #define GIO_CONTENT_SERVICE_NAME "com.sun.star.ucb.GIOContent"
54 #define GIO_FILE_TYPE "application/vnd.sun.staroffice.gio-file"
55 #define GIO_FOLDER_TYPE "application/vnd.sun.staroffice.gio-folder"
57 com::sun::star::uno::Any convertToException(GError *pError,
58 const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rContext, bool bThrow=true);
60 class ContentProvider;
61 class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator
63 private:
64 ContentProvider *m_pProvider;
65 GFile* mpFile;
66 GFileInfo *mpInfo;
67 bool mbTransient;
69 GFileInfo *getGFileInfo(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv,
70 GError **ppError=NULL);
71 bool isFolder(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv);
73 com::sun::star::uno::Any mapGIOError( GError *error );
74 com::sun::star::uno::Any getBadArgExcept();
76 com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
77 getPropertyValues(
78 const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties,
79 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
80 private:
81 typedef rtl::Reference< Content > ContentRef;
82 typedef std::list< ContentRef > ContentRefList;
84 void queryChildren( ContentRefList& rChildren );
86 bool doSetFileInfo ( GFileInfo *pNewInfo );
88 com::sun::star::uno::Any open(const com::sun::star::ucb::OpenCommandArgument2 & rArg,
89 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
90 throw( com::sun::star::uno::Exception );
92 void transfer( const com::sun::star::ucb::TransferInfo& rTransferInfo,
93 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
94 throw( com::sun::star::uno::Exception );
96 void insert( const com::sun::star::uno::Reference< com::sun::star::io::XInputStream > & xInputStream,
97 bool bReplaceExisting, const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
98 throw( com::sun::star::uno::Exception );
100 void destroy( bool bDeletePhysical ) throw( com::sun::star::uno::Exception );
102 void copyData( com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xIn,
103 com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > xOut );
105 com::sun::star::uno::Sequence< com::sun::star::uno::Any >
106 setPropertyValues( const com::sun::star::uno::Sequence<
107 com::sun::star::beans::PropertyValue >& rValues,
108 const com::sun::star::uno::Reference<
109 com::sun::star::ucb::XCommandEnvironment >& xEnv );
111 bool feedSink( com::sun::star::uno::Reference< com::sun::star::uno::XInterface> aSink,
112 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
114 com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
115 createInputStream(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
116 throw( com::sun::star::uno::Exception );
118 bool exchangeIdentity(const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xNewId);
120 public:
121 Content( const com::sun::star::uno::Reference<
122 com::sun::star::uno::XComponentContext >& rxContext, ContentProvider *pProvider,
123 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier)
124 throw ( com::sun::star::ucb::ContentCreationException );
126 Content( const com::sun::star::uno::Reference<
127 com::sun::star::uno::XComponentContext >& rxContext, ContentProvider *pProvider,
128 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier,
129 bool bIsFolder)
130 throw ( com::sun::star::ucb::ContentCreationException );
132 virtual ~Content();
134 com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > getPropertyValuesFromGFileInfo(
135 GFileInfo *pInfo, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
136 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv,
137 const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties);
139 virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
140 getProperties( const com::sun::star::uno::Reference<
141 com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
143 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
144 getCommands( const com::sun::star::uno::Reference<
145 com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
147 virtual OUString getParentURL() SAL_OVERRIDE;
149 // XInterface
150 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
151 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
152 virtual void SAL_CALL acquire()
153 throw() SAL_OVERRIDE;
154 virtual void SAL_CALL release()
155 throw() SAL_OVERRIDE;
157 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
158 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
159 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
160 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
162 virtual OUString SAL_CALL
163 getImplementationName()
164 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
166 virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
167 getSupportedServiceNames()
168 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
170 virtual OUString SAL_CALL
171 getContentType()
172 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
174 virtual com::sun::star::uno::Any SAL_CALL
175 execute( const com::sun::star::ucb::Command& aCommand,
176 sal_Int32 CommandId,
177 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment )
178 throw( com::sun::star::uno::Exception, com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
180 virtual void SAL_CALL abort( sal_Int32 CommandId )
181 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
183 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
184 SAL_CALL queryCreatableContentsInfo()
185 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
186 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
187 SAL_CALL createNewContent( const com::sun::star::ucb::ContentInfo& Info )
188 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
190 com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
191 queryCreatableContentsInfo(
192 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv)
193 throw( com::sun::star::uno::RuntimeException );
195 GFile* getGFile();
200 #endif
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */