| 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 |
|
| 10 |
#pragma once |
| 11 |
|
| 12 |
#include "cmis_url.hxx" |
| 13 |
#include "children_provider.hxx" |
| 14 |
|
| 15 |
#include <com/sun/star/io/XInputStream.hpp> |
| 16 |
#include <com/sun/star/io/XOutputStream.hpp> |
| 17 |
#include <com/sun/star/ucb/ContentCreationException.hpp> |
| 18 |
#include <com/sun/star/ucb/OpenCommandArgument2.hpp> |
| 19 |
#include <com/sun/star/ucb/TransferInfo.hpp> |
| 20 |
#include <com/sun/star/ucb/XContentCreator.hpp> |
| 21 |
#include <ucbhelper/contenthelper.hxx> |
| 22 |
#include <libcmis/libcmis.hxx> |
| 23 |
|
| 24 |
#include <vector> |
| 25 |
#include <list> |
| 26 |
|
| 27 |
namespace com::sun::star { |
| 28 |
namespace beans { |
| 29 |
struct Property; |
| 30 |
struct PropertyValue; |
| 31 |
} |
| 32 |
namespace sdbc { |
| 33 |
class XRow; |
| 34 |
} |
| 35 |
} |
| 36 |
namespace ucbhelper |
| 37 |
{ |
| 38 |
class Content; |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
namespace cmis |
| 43 |
{ |
| 44 |
class ContentProvider; |
| 45 |
class RepoContent : public ::ucbhelper::ContentImplHelper, |
| 46 |
public ChildrenProvider |
| 47 |
{ |
| 48 |
private: |
| 49 |
ContentProvider* m_pProvider; |
| 50 |
URL m_aURL; |
| 51 |
OUString m_sRepositoryId; |
| 52 |
|
| 53 |
std::vector< libcmis::RepositoryPtr > m_aRepositories; |
| 54 |
|
| 55 |
private: |
| 56 |
|
| 57 |
css::uno::Any getBadArgExcept(); |
| 58 |
|
| 59 |
css::uno::Reference< css::sdbc::XRow > |
| 60 |
getPropertyValues( |
| 61 |
const css::uno::Sequence< css::beans::Property >& rProperties, |
| 62 |
const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv ); |
| 63 |
|
| 64 |
/* |
| 65 |
* Call me to ensure the repositories have been fetched |
| 66 |
*/ |
| 67 |
void getRepositories( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv ); |
| 68 |
|
| 69 |
libcmis::RepositoryPtr getRepository( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv ); |
| 70 |
|
| 71 |
public: |
| 72 |
/// @throws css::ucb::ContentCreationException |
| 73 |
RepoContent( const css::uno::Reference< |
| 74 |
css::uno::XComponentContext >& rxContext, ContentProvider *pProvider, |
| 75 |
const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier, |
| 76 |
std::vector< libcmis::RepositoryPtr > && aRepos = std::vector< libcmis::RepositoryPtr > ( ) ); |
| 77 |
|
| 78 |
virtual ~RepoContent() override; |
| 79 |
|
| 80 |
virtual css::uno::Sequence< css::beans::Property > |
| 81 |
getProperties( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) override; |
| 82 |
|
| 83 |
virtual css::uno::Sequence< css::ucb::CommandInfo > |
| 84 |
getCommands( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) override; |
| 85 |
|
| 86 |
virtual OUString getParentURL() override; |
| 87 |
|
| 88 |
// XInterface |
| 89 |
|
| 90 |
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; |
| 91 |
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; |
| 92 |
|
| 93 |
virtual OUString SAL_CALL |
| 94 |
getImplementationName() override; |
| 95 |
|
| 96 |
virtual css::uno::Sequence< OUString > SAL_CALL |
| 97 |
getSupportedServiceNames() override; |
| 98 |
|
| 99 |
virtual OUString SAL_CALL |
| 100 |
getContentType() override; |
| 101 |
|
| 102 |
virtual css::uno::Any SAL_CALL |
| 103 |
execute( const css::ucb::Command& aCommand, |
| 104 |
sal_Int32 CommandId, |
| 105 |
const css::uno::Reference< css::ucb::XCommandEnvironment >& Environment ) override; |
| 106 |
|
| 107 |
virtual void SAL_CALL abort( sal_Int32 CommandId ) override; |
| 108 |
|
| 109 |
virtual std::vector< css::uno::Reference< css::ucb::XContent > > getChildren( ) override; |
| 110 |
}; |
| 111 |
|
| 112 |
} |
| 113 |
|
| 114 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |