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 #pragma once
21 
22 #include <rtl/ref.hxx>
23 #include <com/sun/star/frame/XTransientDocumentsDocumentContentFactory.hpp>
24 #include <com/sun/star/frame/XTransientDocumentsDocumentContentIdentifierFactory.hpp>
25 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include "tdoc_uri.hxx"
29 #include "tdoc_docmgr.hxx"
30 #include "tdoc_storage.hxx"
31 
32 namespace com::sun::star::embed {
33  class XStorage;
34 }
35 
36 namespace com::sun::star::frame {
37  class XModel;
38 }
39 
40 namespace tdoc_ucp {
41 
42 
43 #define TDOC_ROOT_CONTENT_TYPE \
44  u"application/" TDOC_URL_SCHEME "-root"
45 #define TDOC_DOCUMENT_CONTENT_TYPE \
46  u"application/" TDOC_URL_SCHEME "-document"
47 #define TDOC_FOLDER_CONTENT_TYPE \
48  u"application/" TDOC_URL_SCHEME "-folder"
49 #define TDOC_STREAM_CONTENT_TYPE \
50  u"application/" TDOC_URL_SCHEME "-stream"
51 
52 
53 class StorageElementFactory;
54 
57  , public css::frame::XTransientDocumentsDocumentContentIdentifierFactory
58  , public css::frame::XTransientDocumentsDocumentContentFactory
59 {
60 public:
61  explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
62  virtual ~ContentProvider() override;
63 
64  // XInterface
65  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
66  virtual void SAL_CALL acquire()
67  noexcept override;
68  virtual void SAL_CALL release()
69  noexcept override;
70 
71  // XTypeProvider
72  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
73  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
74 
75  // XServiceInfo
76  virtual OUString SAL_CALL getImplementationName() override;
77  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
78  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
79 
80  // XContentProvider
81  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
82  queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
83 
84  // XTransientDocumentsDocumentContentIdentifierFactory
85  virtual css::uno::Reference<css::ucb::XContentIdentifier> SAL_CALL
87  css::uno::Reference<css::frame::XModel> const& xModel) override;
88 
89  // XTransientDocumentsDocumentContentFactory
90  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
91  createDocumentContent( const css::uno::Reference<
92  css::frame::XModel >& Model ) override;
93 
94  // Non-UNO interfaces
95  css::uno::Reference< css::embed::XStorage >
96  queryStorage( const OUString & rUri, StorageAccessMode eMode ) const;
97 
98  css::uno::Reference< css::embed::XStorage >
99  queryStorageClone( const OUString & rUri ) const;
100 
103  css::uno::Reference< css::io::XInputStream >
104  queryInputStream( const OUString & rUri,
105  const OUString & rPassword ) const;
106 
109  css::uno::Reference< css::io::XOutputStream >
110  queryOutputStream( const OUString & rUri,
111  const OUString & rPassword,
112  bool bTruncate ) const;
113 
116  css::uno::Reference< css::io::XStream >
117  queryStream( const OUString & rUri,
118  const OUString & rPassword,
119  bool bTruncate ) const;
120 
122  const OUString & rUri,
123  css::uno::Sequence< OUString > & rNames ) const;
124 
125  // storage properties
126  OUString queryStorageTitle( const OUString & rUri ) const;
127 
128  css::uno::Reference< css::frame::XModel >
129  queryDocumentModel( const OUString & rUri ) const;
130 
131  // interface OfficeDocumentsEventListener
132  void notifyDocumentOpened( const OUString & rDocId );
133  void notifyDocumentClosed( const OUString & rDocId );
134 
135 private:
138 };
139 
140 } // namespace tdoc_ucp
141 
142 /* 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
virtual void SAL_CALL acquire() noexcept override
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 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
virtual void SAL_CALL release() noexcept override
void notifyDocumentClosed(const OUString &rDocId)
void notifyDocumentOpened(const OUString &rDocId)
Reference< XModel > xModel