blob: 4527f0645a2a8845470159343ae243ca522b9da5 [file] [log] [blame]
/**************************************************************
*
* 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
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef __XSTORAGE_HXX_
#define __XSTORAGE_HXX_
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/embed/XHierarchicalStorageAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/packages/NoEncryptionException.hpp>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <ucbhelper/content.hxx>
struct FSStorage_Impl;
class FSStorage : public ::com::sun::star::lang::XTypeProvider
, public ::com::sun::star::embed::XStorage
, public ::com::sun::star::embed::XHierarchicalStorageAccess
, public ::com::sun::star::beans::XPropertySet
, public ::cppu::OWeakObject
{
::osl::Mutex m_aMutex;
FSStorage_Impl* m_pImpl;
protected:
public:
FSStorage( const ::ucbhelper::Content& aContent,
sal_Int32 nMode,
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties,
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory );
virtual ~FSStorage();
::ucbhelper::Content* GetContent();
void CopyStreamToSubStream( const ::rtl::OUString& aSourceURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest,
const ::rtl::OUString& aNewEntryName );
void CopyContentToStorage_Impl( ::ucbhelper::Content* pContent,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest );
static sal_Bool MakeFolderNoUI( const String& rFolder, sal_Bool bNewOnly );
//____________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType )
throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL acquire() throw();
virtual void SAL_CALL release() throw();
//____________________________________________________________________________________________________
// XTypeProvider
//____________________________________________________________________________________________________
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
throw( ::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
throw( ::com::sun::star::uno::RuntimeException );
//____________________________________________________________________________________________________
// XStorage
//____________________________________________________________________________________________________
virtual void SAL_CALL copyToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openStreamElement(
const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::packages::WrongPasswordException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openEncryptedStreamElement(
const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode, const ::rtl::OUString& aPass )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::packages::NoEncryptionException,
::com::sun::star::packages::WrongPasswordException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > SAL_CALL openStorageElement(
const ::rtl::OUString& aStorName, sal_Int32 nStorageMode )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneStreamElement(
const ::rtl::OUString& aStreamName )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::packages::WrongPasswordException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneEncryptedStreamElement(
const ::rtl::OUString& aStreamName, const ::rtl::OUString& aPass )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::packages::NoEncryptionException,
::com::sun::star::packages::WrongPasswordException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL copyLastCommitTo(
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTargetStorage )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL copyStorageElementLastCommitTo(
const ::rtl::OUString& aStorName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTargetStorage )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual sal_Bool SAL_CALL isStreamElement( const ::rtl::OUString& aElementName )
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::embed::InvalidStorageException,
::com::sun::star::uno::RuntimeException );
virtual sal_Bool SAL_CALL isStorageElement( const ::rtl::OUString& aElementName )
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::embed::InvalidStorageException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL removeElement( const ::rtl::OUString& aElementName )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL renameElement( const ::rtl::OUString& rEleName, const ::rtl::OUString& rNewName )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::container::ElementExistException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL copyElementTo( const ::rtl::OUString& aElementName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest,
const ::rtl::OUString& aNewName )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::container::ElementExistException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL moveElementTo( const ::rtl::OUString& aElementName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest,
const ::rtl::OUString& rNewName )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::container::ElementExistException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
//____________________________________________________________________________________________________
// XNameAccess
//____________________________________________________________________________________________________
virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
throw ( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
throw ( ::com::sun::star::uno::RuntimeException );
virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
throw ( ::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
throw ( ::com::sun::star::uno::RuntimeException );
virtual sal_Bool SAL_CALL hasElements()
throw ( ::com::sun::star::uno::RuntimeException );
//____________________________________________________________________________________________________
// XComponent
//____________________________________________________________________________________________________
virtual void SAL_CALL dispose()
throw ( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL addEventListener(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
throw ( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL removeEventListener(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
throw ( ::com::sun::star::uno::RuntimeException );
//____________________________________________________________________________________________________
// XPropertySet
//____________________________________________________________________________________________________
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
throw ( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::beans::PropertyVetoException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL addPropertyChangeListener(
const ::rtl::OUString& aPropertyName,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL removePropertyChangeListener(
const ::rtl::OUString& aPropertyName,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL addVetoableChangeListener(
const ::rtl::OUString& PropertyName,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
//____________________________________________________________________________________________________
// XHierarchicalStorageAccess
//____________________________________________________________________________________________________
virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openStreamElementByHierarchicalName( const ::rtl::OUString& sStreamPath, ::sal_Int32 nOpenMode )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::packages::WrongPasswordException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamElementByHierarchicalName( const ::rtl::OUString& sStreamName, ::sal_Int32 nOpenMode, const ::rtl::OUString& sPassword )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::packages::NoEncryptionException,
::com::sun::star::packages::WrongPasswordException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL removeStreamElementByHierarchicalName( const ::rtl::OUString& sElementPath )
throw ( ::com::sun::star::embed::InvalidStorageException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::io::IOException,
::com::sun::star::embed::StorageWrappedTargetException,
::com::sun::star::uno::RuntimeException );
};
#endif