LibreOffice Module ucb (master)  1
tdoc_provider.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_UCB_SOURCE_UCP_TDOC_TDOC_PROVIDER_HXX
21 #define INCLUDED_UCB_SOURCE_UCP_TDOC_TDOC_PROVIDER_HXX
22 
23 #include <rtl/ref.hxx>
24 #include <com/sun/star/frame/XTransientDocumentsDocumentContentFactory.hpp>
25 #include <com/sun/star/frame/XTransientDocumentsDocumentContentIdentifierFactory.hpp>
26 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include "tdoc_uri.hxx"
30 #include "tdoc_docmgr.hxx"
31 #include "tdoc_storage.hxx"
32 
33 namespace com::sun::star::embed {
34  class XStorage;
35 }
36 
37 namespace com::sun::star::frame {
38  class XModel;
39 }
40 
41 namespace tdoc_ucp {
42 
43 
44 #define TDOC_ROOT_CONTENT_TYPE \
45  "application/" TDOC_URL_SCHEME "-root"
46 #define TDOC_DOCUMENT_CONTENT_TYPE \
47  "application/" TDOC_URL_SCHEME "-document"
48 #define TDOC_FOLDER_CONTENT_TYPE \
49  "application/" TDOC_URL_SCHEME "-folder"
50 #define TDOC_STREAM_CONTENT_TYPE \
51  "application/" TDOC_URL_SCHEME "-stream"
52 
53 
54 class StorageElementFactory;
55 
58  , public css::frame::XTransientDocumentsDocumentContentIdentifierFactory
59  , public css::frame::XTransientDocumentsDocumentContentFactory
60 {
61 public:
62  explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
63  virtual ~ContentProvider() override;
64 
65  // XInterface
66  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
67  virtual void SAL_CALL acquire()
68  throw() override;
69  virtual void SAL_CALL release()
70  throw() override;
71 
72  // XTypeProvider
73  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
74  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
75 
76  // XServiceInfo
77  virtual OUString SAL_CALL getImplementationName() override;
78  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
79  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
80 
81  // XContentProvider
82  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
83  queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
84 
85  // XTransientDocumentsDocumentContentIdentifierFactory
86  virtual css::uno::Reference<css::ucb::XContentIdentifier> SAL_CALL
88  css::uno::Reference<css::frame::XModel> const& xModel) override;
89 
90  // XTransientDocumentsDocumentContentFactory
91  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
92  createDocumentContent( const css::uno::Reference<
93  css::frame::XModel >& Model ) override;
94 
95  // Non-UNO interfaces
96  css::uno::Reference< css::embed::XStorage >
97  queryStorage( const OUString & rUri, StorageAccessMode eMode ) const;
98 
99  css::uno::Reference< css::embed::XStorage >
100  queryStorageClone( const OUString & rUri ) const;
101 
104  css::uno::Reference< css::io::XInputStream >
105  queryInputStream( const OUString & rUri,
106  const OUString & rPassword ) const;
107 
110  css::uno::Reference< css::io::XOutputStream >
111  queryOutputStream( const OUString & rUri,
112  const OUString & rPassword,
113  bool bTruncate ) const;
114 
117  css::uno::Reference< css::io::XStream >
118  queryStream( const OUString & rUri,
119  const OUString & rPassword,
120  bool bTruncate ) const;
121 
123  const OUString & rUri,
124  css::uno::Sequence< OUString > & rNames ) const;
125 
126  // storage properties
127  OUString queryStorageTitle( const OUString & rUri ) const;
128 
129  css::uno::Reference< css::frame::XModel >
130  queryDocumentModel( const OUString & rUri ) const;
131 
132  // interface OfficeDocumentsEventListener
133  void notifyDocumentOpened( const OUString & rDocId );
134  void notifyDocumentClosed( const OUString & rDocId );
135 
136 private:
139 };
140 
141 } // namespace tdoc_ucp
142 
143 #endif // INCLUDED_UCB_SOURCE_UCP_TDOC_TDOC_PROVIDER_HXX
144 
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
rtl::Reference< StorageElementFactory > m_xStgElemFac
css::uno::Reference< css::frame::XModel > queryDocumentModel(const OUString &rUri) const
css::uno::Reference< css::embed::XStorage > queryStorageClone(const OUString &rUri) const
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL createDocumentContentIdentifier(css::uno::Reference< css::frame::XModel > const &xModel) override
css::uno::Reference< css::io::XInputStream > queryInputStream(const OUString &rUri, const OUString &rPassword) const
css::uno::Reference< css::io::XStream > queryStream(const OUString &rUri, const OUString &rPassword, bool bTruncate) const
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL createDocumentContent(const css::uno::Reference< css::frame::XModel > &Model) override
OUString queryStorageTitle(const OUString &rUri) const
Mode eMode
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override
ContentProvider(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
css::uno::Reference< css::io::XOutputStream > queryOutputStream(const OUString &rUri, const OUString &rPassword, bool bTruncate) const
bool queryNamesOfChildren(const OUString &rUri, css::uno::Sequence< OUString > &rNames) const
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
unsigned char sal_Bool
virtual void SAL_CALL release() override
virtual void SAL_CALL acquire() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
css::uno::Reference< css::embed::XStorage > queryStorage(const OUString &rUri, StorageAccessMode eMode) const
virtual ~ContentProvider() override
rtl::Reference< OfficeDocumentsManager > m_xDocsMgr
void notifyDocumentClosed(const OUString &rDocId)
void notifyDocumentOpened(const OUString &rDocId)
Reference< XModel > xModel