1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 GIO_CONTENT_HXX
21 #define 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>
34 namespace com
{ namespace sun
{ namespace star
{
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
64 ContentProvider
*m_pProvider
;
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
>
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
);
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 sal_Bool bReplaceExisting
, const com::sun::star::uno::Reference
< com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
98 throw( com::sun::star::uno::Exception
);
100 void destroy( sal_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 sal_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 sal_Bool
exchangeIdentity(const com::sun::star::uno::Reference
< com::sun::star::ucb::XContentIdentifier
>& xNewId
);
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
,
130 throw ( com::sun::star::ucb::ContentCreationException
);
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
);
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
);
147 virtual OUString
getParentURL();
153 virtual OUString SAL_CALL
154 getImplementationName()
155 throw( com::sun::star::uno::RuntimeException
);
157 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
158 getSupportedServiceNames()
159 throw( com::sun::star::uno::RuntimeException
);
161 virtual OUString SAL_CALL
163 throw( com::sun::star::uno::RuntimeException
);
165 virtual com::sun::star::uno::Any SAL_CALL
166 execute( const com::sun::star::ucb::Command
& aCommand
,
168 const com::sun::star::uno::Reference
< com::sun::star::ucb::XCommandEnvironment
>& Environment
)
169 throw( com::sun::star::uno::Exception
, com::sun::star::ucb::CommandAbortedException
, com::sun::star::uno::RuntimeException
);
171 virtual void SAL_CALL
abort( sal_Int32 CommandId
)
172 throw( com::sun::star::uno::RuntimeException
);
174 virtual com::sun::star::uno::Sequence
< com::sun::star::ucb::ContentInfo
>
175 SAL_CALL
queryCreatableContentsInfo()
176 throw( com::sun::star::uno::RuntimeException
);
177 virtual com::sun::star::uno::Reference
< com::sun::star::ucb::XContent
>
178 SAL_CALL
createNewContent( const com::sun::star::ucb::ContentInfo
& Info
)
179 throw( com::sun::star::uno::RuntimeException
);
181 com::sun::star::uno::Sequence
< com::sun::star::ucb::ContentInfo
>
182 queryCreatableContentsInfo(
183 const com::sun::star::uno::Reference
< com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
184 throw( com::sun::star::uno::RuntimeException
);
193 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */