Update ooo320-m1
[ooovba.git] / ucb / source / ucp / tdoc / tdoc_provider.hxx
blob3ad5d147cda74b64c1ad8113126d61ca4703183c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tdoc_provider.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_TDOC_PROVIDER_HXX
32 #define INCLUDED_TDOC_PROVIDER_HXX
34 #include "rtl/ref.hxx"
35 #include <com/sun/star/frame/XTransientDocumentsDocumentContentFactory.hpp>
36 #include <com/sun/star/packages/WrongPasswordException.hpp>
37 #include "ucbhelper/providerhelper.hxx"
38 #include "tdoc_uri.hxx" // for TDOC_URL_SCHEME
39 #include "tdoc_docmgr.hxx"
40 #include "tdoc_storage.hxx" // for StorageAccessMode
42 namespace com { namespace sun { namespace star { namespace embed {
43 class XStorage;
44 } } } }
46 namespace com { namespace sun { namespace star { namespace frame {
47 class XModel;
48 } } } }
50 namespace tdoc_ucp {
52 //=========================================================================
54 #define TDOC_CONTENT_PROVIDER_SERVICE_NAME \
55 "com.sun.star.ucb.TransientDocumentsContentProvider"
56 #define TDOC_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 50
58 #define TDOC_ROOT_CONTENT_TYPE \
59 "application/" TDOC_URL_SCHEME "-root"
60 #define TDOC_DOCUMENT_CONTENT_TYPE \
61 "application/" TDOC_URL_SCHEME "-document"
62 #define TDOC_FOLDER_CONTENT_TYPE \
63 "application/" TDOC_URL_SCHEME "-folder"
64 #define TDOC_STREAM_CONTENT_TYPE \
65 "application/" TDOC_URL_SCHEME "-stream"
67 //=========================================================================
69 class StorageElementFactory;
71 class ContentProvider :
72 public ::ucbhelper::ContentProviderImplHelper,
73 public com::sun::star::frame::XTransientDocumentsDocumentContentFactory,
74 public OfficeDocumentsEventListener
76 public:
77 ContentProvider( const com::sun::star::uno::Reference<
78 com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
79 virtual ~ContentProvider();
81 // XInterface
82 XINTERFACE_DECL()
84 // XTypeProvider
85 XTYPEPROVIDER_DECL()
87 // XServiceInfo
88 XSERVICEINFO_DECL()
90 // XContentProvider
91 virtual com::sun::star::uno::Reference<
92 com::sun::star::ucb::XContent > SAL_CALL
93 queryContent( const com::sun::star::uno::Reference<
94 com::sun::star::ucb::XContentIdentifier >& Identifier )
95 throw( com::sun::star::ucb::IllegalIdentifierException,
96 com::sun::star::uno::RuntimeException );
98 // XTransientDocumentsDocumentContentFactory
99 virtual com::sun::star::uno::Reference<
100 com::sun::star::ucb::XContent > SAL_CALL
101 createDocumentContent( const ::com::sun::star::uno::Reference<
102 com::sun::star::frame::XModel >& Model )
103 throw ( com::sun::star::lang::IllegalArgumentException,
104 com::sun::star::uno::RuntimeException );
106 // Non-UNO interfaces
107 com::sun::star::uno::Reference< com::sun::star::embed::XStorage >
108 queryStorage( const rtl::OUString & rUri, StorageAccessMode eMode ) const;
110 com::sun::star::uno::Reference< com::sun::star::embed::XStorage >
111 queryStorageClone( const rtl::OUString & rUri ) const;
113 com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
114 queryInputStream( const rtl::OUString & rUri,
115 const rtl::OUString & rPassword ) const
116 throw ( com::sun::star::packages::WrongPasswordException );
118 com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >
119 queryOutputStream( const rtl::OUString & rUri,
120 const rtl::OUString & rPassword,
121 bool bTruncate ) const
122 throw ( com::sun::star::packages::WrongPasswordException );
124 com::sun::star::uno::Reference< com::sun::star::io::XStream >
125 queryStream( const rtl::OUString & rUri,
126 const rtl::OUString & rPassword,
127 bool bTruncate ) const
128 throw ( com::sun::star::packages::WrongPasswordException );
130 bool queryNamesOfChildren(
131 const rtl::OUString & rUri,
132 com::sun::star::uno::Sequence< rtl::OUString > & rNames ) const;
134 // storage properties
135 rtl::OUString queryStorageTitle( const rtl::OUString & rUri ) const;
137 com::sun::star::uno::Reference< com::sun::star::frame::XModel >
138 queryDocumentModel( const rtl::OUString & rUri ) const;
140 // interface OfficeDocumentsEventListener
141 virtual void notifyDocumentOpened( const rtl::OUString & rDocId );
142 virtual void notifyDocumentClosed( const rtl::OUString & rDocId );
144 private:
145 rtl::Reference< OfficeDocumentsManager > m_xDocsMgr;
146 rtl::Reference< StorageElementFactory > m_xStgElemFac;
149 } // namespace tdoc_ucp
151 #endif /* !INCLUDED_TDOC_PROVIDER_HXX */