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