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