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 com::sun::star::util {
43 struct DateTime;
44}
45
46namespace tdoc_ucp {
47
48
49inline constexpr OUStringLiteral TDOC_ROOT_CONTENT_TYPE =
50 u"application/" TDOC_URL_SCHEME "-root";
51inline constexpr OUStringLiteral TDOC_DOCUMENT_CONTENT_TYPE =
52 u"application/" TDOC_URL_SCHEME "-document";
53inline constexpr OUStringLiteral TDOC_FOLDER_CONTENT_TYPE =
54 u"application/" TDOC_URL_SCHEME "-folder";
55inline constexpr OUStringLiteral TDOC_STREAM_CONTENT_TYPE =
56 u"application/" TDOC_URL_SCHEME "-stream";
57
58
60
61typedef cppu::ImplInheritanceHelper<
63 css::frame::XTransientDocumentsDocumentContentIdentifierFactory,
64 css::frame::XTransientDocumentsDocumentContentFactory > ContentProvider_Base;
66{
67public:
68 explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
69 virtual ~ContentProvider() override;
70
71 // XServiceInfo
72 virtual OUString SAL_CALL getImplementationName() override;
73 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
74 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
75
76 // XContentProvider
77 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
78 queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
79
80 // XTransientDocumentsDocumentContentIdentifierFactory
81 virtual css::uno::Reference<css::ucb::XContentIdentifier> SAL_CALL
83 css::uno::Reference<css::frame::XModel> const& xModel) override;
84
85 // XTransientDocumentsDocumentContentFactory
86 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
87 createDocumentContent( const css::uno::Reference<
88 css::frame::XModel >& Model ) override;
89
90 // Non-UNO interfaces
91 css::uno::Reference< css::embed::XStorage >
92 queryStorage( const OUString & rUri, StorageAccessMode eMode ) const;
93
94 css::uno::Reference< css::embed::XStorage >
95 queryStorageClone( const OUString & rUri ) const;
96
99 css::uno::Reference< css::io::XInputStream >
100 queryInputStream( const OUString & rUri,
101 const OUString & rPassword ) const;
102
105 css::uno::Reference< css::io::XOutputStream >
106 queryOutputStream( const OUString & rUri,
107 const OUString & rPassword,
108 bool bTruncate ) const;
109
112 css::uno::Reference< css::io::XStream >
113 queryStream( const OUString & rUri,
114 const OUString & rPassword,
115 bool bTruncate ) const;
116
118 const OUString & rUri,
119 css::uno::Sequence< OUString > & rNames ) const;
120
121 // storage properties
122 OUString queryStorageTitle( const OUString & rUri ) const;
123
124 css::uno::Reference< css::frame::XModel >
125 queryDocumentModel( const OUString & rUri ) const;
126
127 css::util::DateTime queryStreamDateModified(OUString const & uri) const;
128
129 // interface OfficeDocumentsEventListener
130 void notifyDocumentOpened( std::u16string_view rDocId );
131 void notifyDocumentClosed( std::u16string_view rDocId );
132
133private:
136};
137
138} // namespace tdoc_ucp
139
140/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void notifyDocumentOpened(std::u16string_view rDocId)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
ContentProvider(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
css::util::DateTime queryStreamDateModified(OUString const &uri) const
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::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 ~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::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
float u
constexpr OUStringLiteral TDOC_ROOT_CONTENT_TYPE
cppu::ImplInheritanceHelper< ::ucbhelper::ContentProviderImplHelper, css::frame::XTransientDocumentsDocumentContentIdentifierFactory, css::frame::XTransientDocumentsDocumentContentFactory > ContentProvider_Base
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