/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */




 module com {  module sun {  module star {  module embed {

/**  This is a service that represents a stream that can be provided by
    XStorage::openStreamElement() call implemented by
    Storage service.

    <p>
    In case a stream is open with read-write access only one instance
    of the stream can exist.
    </p>
 */
published service StorageStream
{
    /** allows to get access to com::sun::star::io::XInputStream
        and com::sun::star::io::XOutputStream
        implementations.

        <p>
        In case the storage stream is open readonly the returned reference
        to com::sun::star::io::XOutputStream will be
        empty.
        </p>
    */
    interface ::com::sun::star::io::XStream;

    /** allows to control object lifetime.

        <p>
        A storage stream is created by a storage and has a restrictions
        depending on the mode the stream is opened in.
        </p>

        <p>
        In case a stream is opened with read-write access only one instance of
        the stream can exist. It means that the stream can not be reopened
        even for readonly access until the read-write instance is disposed.
        From the other side it is possible to open multiple streams for
        readonly access. But because of the rule mentioned above it will not
        be possible to open the stream for read-write access until all the
        readonly instances are disposed.
        </p>

        <p>
        The stream must be disposed by
        com::sun::star::lang::XComponent::dispose()
        call or by explicit closing of input and output ( if provided )
        streams implementations with
        com::sun::star::io::XInputStream::closeInput()
        and
        com::sun::star::io::XOutputStream::closeOutput()
        calls.
        </p>

        <p>
        When a stream is disposed all the changes that were done for it are
        automatically flashed, so that they become visible from parent
        storage. It is also possible to flash the stream explicitly.
        </p>

        <p>
        In case parent storage is disposed the stream is disposed
        automatically.
        </p>

        <p>
        In case a stream is disposed any call to its methods should result in
        com::sun::star::lang::DisposedException.
        </p>
     */
    interface ::com::sun::star::lang::XComponent;

    /** allows to get access to stream properties.
     */
    interface ::com::sun::star::beans::XPropertySet;

    /** allows to seek to a specified position within the stream.

        <p>
        This interface must be supported in case either seekable readonly
        or read-write access is requested.
        </p>
     */
    [optional]
    interface ::com::sun::star::io::XSeekable;

    /** allows to set password to the stream.

        <p>
        This interface must be supported by a stream with read-write access
        to allow to set a password that should be used next time the
        stream is stored.
        </p>

        <p>
        If the password is set or changed by this interface and the
        stream is closed the new password should be used to get access to the
        stream next time.
        </p>
     */
    [optional]
    interface ::com::sun::star::embed::XEncryptionProtectedSource;

    /** allows to get and set media type of the stream.
     */
    [property] string MediaType;

    /** specifies if the stream should be compressed next time it is stored.
     */
    [property] boolean IsCompressed;

    /** allows to detect if the stream is encrypted.

        <p>
        The property value `TRUE` means that the stream is currently encrypted.
        `FALSE` - the stream is not encrypted.
        </p>

        <p>
        If somebody sets a password explicitly by using
        XEncryptionProtectedSource interface the value is
        automatically set to `TRUE`. If the interface is used to remove
        the encryption - the value is automatically set to `FALSE`.
        </p>

     */
    [property, readonly] boolean IsEncrypted;

    /** specifies whether the stream will become encrypted next time the
        common storage password holder is committed.

        <p>
        The property value `TRUE` means that the stream will become encrypted
        after the closest storage in the parent hierarchy, that has common
        storage password, is committed.
        `FALSE` - the stream will not react to commit of such a storage.
        </p>

        <p>
        In case stream is not encrypted and the property is set to `TRUE`,
        the stream will stay non-encrypted until the closest storage
        in the parent hierarchy, that has common storage password, is committed.
        On the commit the stream will be encrypted with the common storage
        password. If there is no such storage in the hierarchy the stream
        will not be encrypted at all.
        Thus this property must be set very carefully.
        </p>

        <p>
        If somebody sets a password explicitly by using
        XEncryptionProtectedSource interface the value is
        automatically set to `FALSE` and the stream becomes encrypted
        with specified password immediately.
        </p>

        <p>
        In case stream is encrypted one and the value is set to `TRUE`
        the stream becomes non-encrypted until the common storage password
        holder is committed. The data about previously set password ( if any )
        will be removed and the stream can be accessed as non-encrypted stream.
        </p>
     */
    [property] boolean UseCommonStoragePasswordEncryption;

    /** allows to detect size of the stream in bytes.
     */
    [property, readonly] long Size;
};


}; }; }; };

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
