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 { namespace sun { namespace star { namespace embed {
34  class XStorage;
35 } } } }
36 
37 namespace com { namespace sun { namespace star { namespace 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  static OUString getImplementationName_Static();
82  static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
83 
84  static css::uno::Reference< css::lang::XSingleServiceFactory >
85  createServiceFactory( const css::uno::Reference<
86  css::lang::XMultiServiceFactory >& rxServiceMgr );
87 
88  // XContentProvider
89  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
90  queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
91 
92  // XTransientDocumentsDocumentContentIdentifierFactory
93  virtual css::uno::Reference<css::ucb::XContentIdentifier> SAL_CALL
95  css::uno::Reference<css::frame::XModel> const& xModel) override;
96 
97  // XTransientDocumentsDocumentContentFactory
98  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
99  createDocumentContent( const css::uno::Reference<
100  css::frame::XModel >& Model ) override;
101 
102  // Non-UNO interfaces
103  css::uno::Reference< css::embed::XStorage >
104  queryStorage( const OUString & rUri, StorageAccessMode eMode ) const;
105 
106  css::uno::Reference< css::embed::XStorage >
107  queryStorageClone( const OUString & rUri ) const;
108 
111  css::uno::Reference< css::io::XInputStream >
112  queryInputStream( const OUString & rUri,
113  const OUString & rPassword ) const;
114 
117  css::uno::Reference< css::io::XOutputStream >
118  queryOutputStream( const OUString & rUri,
119  const OUString & rPassword,
120  bool bTruncate ) const;
121 
124  css::uno::Reference< css::io::XStream >
125  queryStream( const OUString & rUri,
126  const OUString & rPassword,
127  bool bTruncate ) const;
128 
130  const OUString & rUri,
131  css::uno::Sequence< OUString > & rNames ) const;
132 
133  // storage properties
134  OUString queryStorageTitle( const OUString & rUri ) const;
135 
136  css::uno::Reference< css::frame::XModel >
137  queryDocumentModel( const OUString & rUri ) const;
138 
139  // interface OfficeDocumentsEventListener
140  void notifyDocumentOpened( const OUString & rDocId );
141  void notifyDocumentClosed( const OUString & rDocId );
142 
143 private:
146 };
147 
148 } // namespace tdoc_ucp
149 
150 #endif // INCLUDED_UCB_SOURCE_UCP_TDOC_TDOC_PROVIDER_HXX
151 
152 /* 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
static css::uno::Sequence< OUString > getSupportedServiceNames_Static()
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 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)
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
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
css::uno::Reference< css::embed::XStorage > queryStorage(const OUString &rUri, StorageAccessMode eMode) const
virtual ~ContentProvider() override
static OUString getImplementationName_Static()
rtl::Reference< OfficeDocumentsManager > m_xDocsMgr
void notifyDocumentClosed(const OUString &rDocId)
static css::uno::Reference< css::lang::XSingleServiceFactory > createServiceFactory(const css::uno::Reference< css::lang::XMultiServiceFactory > &rxServiceMgr)
void notifyDocumentOpened(const OUString &rDocId)
Reference< XModel > xModel
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override