1*d1766043SAndrew Rist/************************************************************** 2cdf0e10cSrcweir * 3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*d1766043SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*d1766043SAndrew Rist * distributed with this work for additional information 6*d1766043SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance 9*d1766043SAndrew Rist * with the License. You may obtain a copy of the License at 10*d1766043SAndrew Rist * 11*d1766043SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*d1766043SAndrew Rist * 13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*d1766043SAndrew Rist * software distributed under the License is distributed on an 15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*d1766043SAndrew Rist * KIND, either express or implied. See the License for the 17*d1766043SAndrew Rist * specific language governing permissions and limitations 18*d1766043SAndrew Rist * under the License. 19*d1766043SAndrew Rist * 20*d1766043SAndrew Rist *************************************************************/ 21*d1766043SAndrew Rist 22*d1766043SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir#ifndef __com_sun_star_embed_StorageStream_idl__ 25cdf0e10cSrcweir#define __com_sun_star_embed_StorageStream_idl__ 26cdf0e10cSrcweir 27cdf0e10cSrcweir#ifndef __com_sun_star_embed_XEncryptionProtectedSource_idl__ 28cdf0e10cSrcweir#include <com/sun/star/embed/XEncryptionProtectedSource.idl> 29cdf0e10cSrcweir#endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir#ifndef __com_sun_star_lang_XComponent_idl__ 32cdf0e10cSrcweir#include <com/sun/star/lang/XComponent.idl> 33cdf0e10cSrcweir#endif 34cdf0e10cSrcweir 35cdf0e10cSrcweir#ifndef __com_sun_star_beans_XPropertySet_idl__ 36cdf0e10cSrcweir#include <com/sun/star/beans/XPropertySet.idl> 37cdf0e10cSrcweir#endif 38cdf0e10cSrcweir 39cdf0e10cSrcweir#ifndef __com_sun_star_io_XStream_idl__ 40cdf0e10cSrcweir#include <com/sun/star/io/XStream.idl> 41cdf0e10cSrcweir#endif 42cdf0e10cSrcweir 43cdf0e10cSrcweir#ifndef __com_sun_star_io_XSeekable_idl__ 44cdf0e10cSrcweir#include <com/sun/star/io/XSeekable.idl> 45cdf0e10cSrcweir#endif 46cdf0e10cSrcweir 47cdf0e10cSrcweir 48cdf0e10cSrcweir 49cdf0e10cSrcweir//============================================================================ 50cdf0e10cSrcweir 51cdf0e10cSrcweir module com { module sun { module star { module embed { 52cdf0e10cSrcweir 53cdf0e10cSrcweir//============================================================================ 54cdf0e10cSrcweir/** This is a service that represents a stream that can be provided by 55cdf0e10cSrcweir <type>XStorage</type>::openStreamElement() call implemented by 56cdf0e10cSrcweir <type>Storage</type> service. 57cdf0e10cSrcweir 58cdf0e10cSrcweir <p> 59cdf0e10cSrcweir In case a stream is open with readwrite access only one instance 60cdf0e10cSrcweir of the stream can exist. 61cdf0e10cSrcweir </p> 62cdf0e10cSrcweir */ 63cdf0e10cSrcweirpublished service StorageStream 64cdf0e10cSrcweir{ 65cdf0e10cSrcweir // ----------------------------------------------------------------------- 66cdf0e10cSrcweir /** allows to get access to <type scope="com::sun::star::io">XInputStream</type> 67cdf0e10cSrcweir and <type scope="com::sun::star::io">XOutputStream</type> 68cdf0e10cSrcweir implementations. 69cdf0e10cSrcweir 70cdf0e10cSrcweir <p> 71cdf0e10cSrcweir In case the storage stream is open readonly the returned reference 72cdf0e10cSrcweir to <type scope="com::sun::star::io">XOutputStream</type> will be 73cdf0e10cSrcweir empty. 74cdf0e10cSrcweir </p> 75cdf0e10cSrcweir */ 76cdf0e10cSrcweir interface ::com::sun::star::io::XStream; 77cdf0e10cSrcweir 78cdf0e10cSrcweir // ----------------------------------------------------------------------- 79cdf0e10cSrcweir /** allows to control object lifetime. 80cdf0e10cSrcweir 81cdf0e10cSrcweir <p> 82cdf0e10cSrcweir A storage stream is created by a storage and has a restrictions 83cdf0e10cSrcweir depending on the mode the stream is opened in. 84cdf0e10cSrcweir </p> 85cdf0e10cSrcweir 86cdf0e10cSrcweir <p> 87cdf0e10cSrcweir In case a stream is opened with read-write access only one instance of 88cdf0e10cSrcweir the stream can exist. It means that the stream can not be reopened 89cdf0e10cSrcweir even for readonly access until the readwrite instance is disposed. 90cdf0e10cSrcweir From the other side it is possible to open multiple streams for 91cdf0e10cSrcweir readonly access. But because of the rule mentioned above it will not 92cdf0e10cSrcweir be possible to open the stream for read-write access until all the 93cdf0e10cSrcweir readonly instances are disposed. 94cdf0e10cSrcweir </p> 95cdf0e10cSrcweir 96cdf0e10cSrcweir <p> 97cdf0e10cSrcweir The stream must be disposed by 98cdf0e10cSrcweir <member scope="com::sun::star::lang">XComponent::dispose()</member> 99cdf0e10cSrcweir call or by explicit closing of input and output ( if provided ) 100cdf0e10cSrcweir streams implementations with 101cdf0e10cSrcweir <member scope="com::sun::star::io">XInputStream::closeInput()</member> 102cdf0e10cSrcweir and 103cdf0e10cSrcweir <member scope="com::sun::star::io">XOutputStream::closeOutput()</member> 104cdf0e10cSrcweir calls. 105cdf0e10cSrcweir </p> 106cdf0e10cSrcweir 107cdf0e10cSrcweir <p> 108cdf0e10cSrcweir When a stream is disposed all the changes that were done for it are 109cdf0e10cSrcweir automatically flashed, so that they becomes visible from parent 110cdf0e10cSrcweir storage. It is also possible to flash the stream explicitly. 111cdf0e10cSrcweir </p> 112cdf0e10cSrcweir 113cdf0e10cSrcweir <p> 114cdf0e10cSrcweir In case parent storage is disposed the stream is disposed 115cdf0e10cSrcweir automatically. 116cdf0e10cSrcweir </p> 117cdf0e10cSrcweir 118cdf0e10cSrcweir <p> 119cdf0e10cSrcweir In case a stream is disposed any call to it's methods should result in 120cdf0e10cSrcweir <type scope="com::sun::star::lang">DisposedException</type>. 121cdf0e10cSrcweir </p> 122cdf0e10cSrcweir */ 123cdf0e10cSrcweir interface ::com::sun::star::lang::XComponent; 124cdf0e10cSrcweir 125cdf0e10cSrcweir // ----------------------------------------------------------------------- 126cdf0e10cSrcweir /** allows to get access to stream properties. 127cdf0e10cSrcweir */ 128cdf0e10cSrcweir interface ::com::sun::star::beans::XPropertySet; 129cdf0e10cSrcweir 130cdf0e10cSrcweir // ----------------------------------------------------------------------- 131cdf0e10cSrcweir /** allows to seek to a specified position within the stream. 132cdf0e10cSrcweir 133cdf0e10cSrcweir <p> 134cdf0e10cSrcweir This interface must be supported in case either seekable readonly 135cdf0e10cSrcweir or read-write access is requested. 136cdf0e10cSrcweir </p> 137cdf0e10cSrcweir */ 138cdf0e10cSrcweir [optional] 139cdf0e10cSrcweir interface ::com::sun::star::io::XSeekable; 140cdf0e10cSrcweir 141cdf0e10cSrcweir // ----------------------------------------------------------------------- 142cdf0e10cSrcweir /** allows to set password to the stream. 143cdf0e10cSrcweir 144cdf0e10cSrcweir <p> 145cdf0e10cSrcweir This interface must be supported by a stream with readwrite access 146cdf0e10cSrcweir to allow to set a password that should be used next time the 147cdf0e10cSrcweir stream is stored. 148cdf0e10cSrcweir </p> 149cdf0e10cSrcweir 150cdf0e10cSrcweir <p> 151cdf0e10cSrcweir If the password is set or changed by this interface and the 152cdf0e10cSrcweir stream is closed the new password should be used to get access to the 153cdf0e10cSrcweir stream next time. 154cdf0e10cSrcweir </p> 155cdf0e10cSrcweir */ 156cdf0e10cSrcweir [optional] 157cdf0e10cSrcweir interface ::com::sun::star::embed::XEncryptionProtectedSource; 158cdf0e10cSrcweir 159cdf0e10cSrcweir // ----------------------------------------------------------------------- 160cdf0e10cSrcweir /** allows to get and set media type of the stream. 161cdf0e10cSrcweir */ 162cdf0e10cSrcweir [property] string MediaType; 163cdf0e10cSrcweir 164cdf0e10cSrcweir // ----------------------------------------------------------------------- 165cdf0e10cSrcweir /** specifies if the stream should be compressed next time it is stored. 166cdf0e10cSrcweir */ 167cdf0e10cSrcweir [property] boolean IsCompressed; 168cdf0e10cSrcweir 169cdf0e10cSrcweir // ----------------------------------------------------------------------- 170cdf0e10cSrcweir /** allows to detect if the stream is encrypted. 171cdf0e10cSrcweir 172cdf0e10cSrcweir <p> 173cdf0e10cSrcweir The property value <TRUE/> means that the stream is currently encrypted. 174cdf0e10cSrcweir <FALSE/> - the stream is not encrypted. 175cdf0e10cSrcweir </p> 176cdf0e10cSrcweir 177cdf0e10cSrcweir <p> 178cdf0e10cSrcweir If somebody sets a password explicitly by using 179cdf0e10cSrcweir <type>XEncryptionProtectedSource</type> interface the value is 180cdf0e10cSrcweir automatically set to <TRUE/>. If the interface is used to remove 181cdf0e10cSrcweir the encryption - the value is automatically set to <FALSE/>. 182cdf0e10cSrcweir </p> 183cdf0e10cSrcweir 184cdf0e10cSrcweir */ 185cdf0e10cSrcweir [property, readonly] boolean IsEncrypted; 186cdf0e10cSrcweir 187cdf0e10cSrcweir // ----------------------------------------------------------------------- 188cdf0e10cSrcweir /** specifies whether the stream will become encrypted next time the 189cdf0e10cSrcweir common storage password holder is commited. 190cdf0e10cSrcweir 191cdf0e10cSrcweir <p> 192cdf0e10cSrcweir The property value <TRUE/> means that the stream will become encrypted 193cdf0e10cSrcweir after the closest storage in the parent hierarchy, that has common 194cdf0e10cSrcweir storage password, is commited. 195cdf0e10cSrcweir <FALSE/> - the stream will not react to commit of such a storage. 196cdf0e10cSrcweir </p> 197cdf0e10cSrcweir 198cdf0e10cSrcweir <p> 199cdf0e10cSrcweir In case stream is not encrypted and the property is set to <TRUE/>, 200cdf0e10cSrcweir the stream will stay nonencrypted until the closest storage 201cdf0e10cSrcweir in the parent hierarchy, that has common storage password, is commited. 202cdf0e10cSrcweir On the commit the stream will be encrypted with the common storage 203cdf0e10cSrcweir password. If there is no such storage in the hierarchy the stream 204cdf0e10cSrcweir will not be encrypted at all. 205cdf0e10cSrcweir Thus this property must be set very carefully. 206cdf0e10cSrcweir </p> 207cdf0e10cSrcweir 208cdf0e10cSrcweir <p> 209cdf0e10cSrcweir If somebody sets a password explicitly by using 210cdf0e10cSrcweir <type>XEncryptionProtectedSource</type> interface the value is 211cdf0e10cSrcweir automatically set to <FALSE/> and the stream becomes encrypted 212cdf0e10cSrcweir with specified password immediatelly. 213cdf0e10cSrcweir </p> 214cdf0e10cSrcweir 215cdf0e10cSrcweir <p> 216cdf0e10cSrcweir In case stream is encrypted one and the value is set to <TRUE/> 217cdf0e10cSrcweir the stream becomes nonencrypted until the common storage password 218cdf0e10cSrcweir holder is commited. The data about previously set password ( if any ) 219cdf0e10cSrcweir will be removed and the stream can be accessed as nonencrypted stream. 220cdf0e10cSrcweir </p> 221cdf0e10cSrcweir */ 222cdf0e10cSrcweir [property] boolean UseCommonStoragePasswordEncryption; 223cdf0e10cSrcweir 224cdf0e10cSrcweir // ----------------------------------------------------------------------- 225cdf0e10cSrcweir /** allows to detect size of the stream in bytes. 226cdf0e10cSrcweir */ 227cdf0e10cSrcweir [property, readonly] long Size; 228cdf0e10cSrcweir}; 229cdf0e10cSrcweir 230cdf0e10cSrcweir//============================================================================ 231cdf0e10cSrcweir 232cdf0e10cSrcweir}; }; }; }; 233cdf0e10cSrcweir 234cdf0e10cSrcweir#endif 235cdf0e10cSrcweir 236