1*6df1ea1fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*6df1ea1fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*6df1ea1fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*6df1ea1fSAndrew Rist * distributed with this work for additional information 6*6df1ea1fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*6df1ea1fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*6df1ea1fSAndrew Rist * "License"); you may not use this file except in compliance 9*6df1ea1fSAndrew Rist * with the License. You may obtain a copy of the License at 10*6df1ea1fSAndrew Rist * 11*6df1ea1fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*6df1ea1fSAndrew Rist * 13*6df1ea1fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*6df1ea1fSAndrew Rist * software distributed under the License is distributed on an 15*6df1ea1fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6df1ea1fSAndrew Rist * KIND, either express or implied. See the License for the 17*6df1ea1fSAndrew Rist * specific language governing permissions and limitations 18*6df1ea1fSAndrew Rist * under the License. 19*6df1ea1fSAndrew Rist * 20*6df1ea1fSAndrew Rist *************************************************************/ 21*6df1ea1fSAndrew Rist 22*6df1ea1fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef INCLUDED_TDOC_PROVIDER_HXX 25cdf0e10cSrcweir #define INCLUDED_TDOC_PROVIDER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "rtl/ref.hxx" 28cdf0e10cSrcweir #include <com/sun/star/frame/XTransientDocumentsDocumentContentFactory.hpp> 29cdf0e10cSrcweir #include <com/sun/star/packages/WrongPasswordException.hpp> 30cdf0e10cSrcweir #include "ucbhelper/providerhelper.hxx" 31cdf0e10cSrcweir #include "tdoc_uri.hxx" // for TDOC_URL_SCHEME 32cdf0e10cSrcweir #include "tdoc_docmgr.hxx" 33cdf0e10cSrcweir #include "tdoc_storage.hxx" // for StorageAccessMode 34cdf0e10cSrcweir 35cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace embed { 36cdf0e10cSrcweir class XStorage; 37cdf0e10cSrcweir } } } } 38cdf0e10cSrcweir 39cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace frame { 40cdf0e10cSrcweir class XModel; 41cdf0e10cSrcweir } } } } 42cdf0e10cSrcweir 43cdf0e10cSrcweir namespace tdoc_ucp { 44cdf0e10cSrcweir 45cdf0e10cSrcweir //========================================================================= 46cdf0e10cSrcweir 47cdf0e10cSrcweir #define TDOC_CONTENT_PROVIDER_SERVICE_NAME \ 48cdf0e10cSrcweir "com.sun.star.ucb.TransientDocumentsContentProvider" 49cdf0e10cSrcweir #define TDOC_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 50 50cdf0e10cSrcweir 51cdf0e10cSrcweir #define TDOC_ROOT_CONTENT_TYPE \ 52cdf0e10cSrcweir "application/" TDOC_URL_SCHEME "-root" 53cdf0e10cSrcweir #define TDOC_DOCUMENT_CONTENT_TYPE \ 54cdf0e10cSrcweir "application/" TDOC_URL_SCHEME "-document" 55cdf0e10cSrcweir #define TDOC_FOLDER_CONTENT_TYPE \ 56cdf0e10cSrcweir "application/" TDOC_URL_SCHEME "-folder" 57cdf0e10cSrcweir #define TDOC_STREAM_CONTENT_TYPE \ 58cdf0e10cSrcweir "application/" TDOC_URL_SCHEME "-stream" 59cdf0e10cSrcweir 60cdf0e10cSrcweir //========================================================================= 61cdf0e10cSrcweir 62cdf0e10cSrcweir class StorageElementFactory; 63cdf0e10cSrcweir 64cdf0e10cSrcweir class ContentProvider : 65cdf0e10cSrcweir public ::ucbhelper::ContentProviderImplHelper, 66cdf0e10cSrcweir public com::sun::star::frame::XTransientDocumentsDocumentContentFactory, 67cdf0e10cSrcweir public OfficeDocumentsEventListener 68cdf0e10cSrcweir { 69cdf0e10cSrcweir public: 70cdf0e10cSrcweir ContentProvider( const com::sun::star::uno::Reference< 71cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory >& rXSMgr ); 72cdf0e10cSrcweir virtual ~ContentProvider(); 73cdf0e10cSrcweir 74cdf0e10cSrcweir // XInterface 75cdf0e10cSrcweir XINTERFACE_DECL() 76cdf0e10cSrcweir 77cdf0e10cSrcweir // XTypeProvider 78cdf0e10cSrcweir XTYPEPROVIDER_DECL() 79cdf0e10cSrcweir 80cdf0e10cSrcweir // XServiceInfo 81cdf0e10cSrcweir XSERVICEINFO_DECL() 82cdf0e10cSrcweir 83cdf0e10cSrcweir // XContentProvider 84cdf0e10cSrcweir virtual com::sun::star::uno::Reference< 85cdf0e10cSrcweir com::sun::star::ucb::XContent > SAL_CALL 86cdf0e10cSrcweir queryContent( const com::sun::star::uno::Reference< 87cdf0e10cSrcweir com::sun::star::ucb::XContentIdentifier >& Identifier ) 88cdf0e10cSrcweir throw( com::sun::star::ucb::IllegalIdentifierException, 89cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 90cdf0e10cSrcweir 91cdf0e10cSrcweir // XTransientDocumentsDocumentContentFactory 92cdf0e10cSrcweir virtual com::sun::star::uno::Reference< 93cdf0e10cSrcweir com::sun::star::ucb::XContent > SAL_CALL 94cdf0e10cSrcweir createDocumentContent( const ::com::sun::star::uno::Reference< 95cdf0e10cSrcweir com::sun::star::frame::XModel >& Model ) 96cdf0e10cSrcweir throw ( com::sun::star::lang::IllegalArgumentException, 97cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir // Non-UNO interfaces 100cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::embed::XStorage > 101cdf0e10cSrcweir queryStorage( const rtl::OUString & rUri, StorageAccessMode eMode ) const; 102cdf0e10cSrcweir 103cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::embed::XStorage > 104cdf0e10cSrcweir queryStorageClone( const rtl::OUString & rUri ) const; 105cdf0e10cSrcweir 106cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::io::XInputStream > 107cdf0e10cSrcweir queryInputStream( const rtl::OUString & rUri, 108cdf0e10cSrcweir const rtl::OUString & rPassword ) const 109cdf0e10cSrcweir throw ( com::sun::star::packages::WrongPasswordException ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > 112cdf0e10cSrcweir queryOutputStream( const rtl::OUString & rUri, 113cdf0e10cSrcweir const rtl::OUString & rPassword, 114cdf0e10cSrcweir bool bTruncate ) const 115cdf0e10cSrcweir throw ( com::sun::star::packages::WrongPasswordException ); 116cdf0e10cSrcweir 117cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::io::XStream > 118cdf0e10cSrcweir queryStream( const rtl::OUString & rUri, 119cdf0e10cSrcweir const rtl::OUString & rPassword, 120cdf0e10cSrcweir bool bTruncate ) const 121cdf0e10cSrcweir throw ( com::sun::star::packages::WrongPasswordException ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir bool queryNamesOfChildren( 124cdf0e10cSrcweir const rtl::OUString & rUri, 125cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > & rNames ) const; 126cdf0e10cSrcweir 127cdf0e10cSrcweir // storage properties 128cdf0e10cSrcweir rtl::OUString queryStorageTitle( const rtl::OUString & rUri ) const; 129cdf0e10cSrcweir 130cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::frame::XModel > 131cdf0e10cSrcweir queryDocumentModel( const rtl::OUString & rUri ) const; 132cdf0e10cSrcweir 133cdf0e10cSrcweir // interface OfficeDocumentsEventListener 134cdf0e10cSrcweir virtual void notifyDocumentOpened( const rtl::OUString & rDocId ); 135cdf0e10cSrcweir virtual void notifyDocumentClosed( const rtl::OUString & rDocId ); 136cdf0e10cSrcweir 137cdf0e10cSrcweir private: 138cdf0e10cSrcweir rtl::Reference< OfficeDocumentsManager > m_xDocsMgr; 139cdf0e10cSrcweir rtl::Reference< StorageElementFactory > m_xStgElemFac; 140cdf0e10cSrcweir }; 141cdf0e10cSrcweir 142cdf0e10cSrcweir } // namespace tdoc_ucp 143cdf0e10cSrcweir 144cdf0e10cSrcweir #endif /* !INCLUDED_TDOC_PROVIDER_HXX */ 145