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