Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / ucb / source / ucp / ext / ucpext_content.hxx
blob0bfc2a4005beae6f2583d45b17726ffe46e209f1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_UCB_SOURCE_UCP_EXT_UCPEXT_CONTENT_HXX
21 #define INCLUDED_UCB_SOURCE_UCP_EXT_UCPEXT_CONTENT_HXX
23 #include <com/sun/star/sdbc/XRow.hpp>
24 #include <com/sun/star/beans/PropertyValue.hpp>
26 #include <ucbhelper/contenthelper.hxx>
28 #include <boost/optional.hpp>
31 namespace ucb { namespace ucp { namespace ext
35 //= ExtensionContentType
37 enum ExtensionContentType
39 E_ROOT,
40 E_EXTENSION_ROOT,
41 E_EXTENSION_CONTENT,
43 E_UNKNOWN
47 //= ContentProvider
49 typedef ::ucbhelper::ContentImplHelper Content_Base;
50 class Content : public Content_Base
52 public:
53 Content(
54 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
55 ::ucbhelper::ContentProviderImplHelper* pProvider,
56 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier
59 static css::uno::Reference< css::sdbc::XRow >
60 getArtificialNodePropertyValues(
61 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
62 const css::uno::Sequence< css::beans::Property >& rProperties,
63 const OUString& rTitle
66 css::uno::Reference< css::sdbc::XRow >
67 getPropertyValues(
68 const css::uno::Sequence< css::beans::Property >& rProperties,
69 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv
72 static OUString
73 encodeIdentifier( const OUString& i_rIdentifier );
74 static OUString
75 decodeIdentifier( const OUString& i_rIdentifier );
77 virtual OUString getParentURL() override;
79 ExtensionContentType getExtensionContentType() const { return m_eExtContentType; }
81 /** retrieves the URL of the underlying physical content. Not to be called when getExtensionContentType()
82 returns E_ROOT.
84 OUString getPhysicalURL() const;
86 protected:
87 virtual ~Content() override;
89 // XServiceInfo
90 virtual OUString SAL_CALL getImplementationName( ) override;
91 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
93 // XContent
94 virtual OUString SAL_CALL getContentType() override;
96 // XCommandProcessor
97 virtual css::uno::Any SAL_CALL
98 execute(
99 const css::ucb::Command& aCommand,
100 sal_Int32 CommandId,
101 const css::uno::Reference< css::ucb::XCommandEnvironment >& Environment
102 ) override;
104 virtual void SAL_CALL
105 abort(
106 sal_Int32 CommandId
107 ) override;
109 private:
110 virtual css::uno::Sequence< css::beans::Property > getProperties( const css::uno::Reference< css::ucb::XCommandEnvironment >& i_rEnv ) override;
111 virtual css::uno::Sequence< css::ucb::CommandInfo > getCommands( const css::uno::Reference< css::ucb::XCommandEnvironment >& i_rEnv ) override;
113 css::uno::Sequence< css::uno::Any >
114 setPropertyValues(
115 const css::uno::Sequence< css::beans::PropertyValue >& rValues
118 static bool denotesRootContent( const OUString& i_rContentIdentifier );
120 bool impl_isFolder();
121 void impl_determineContentType();
123 private:
124 ExtensionContentType m_eExtContentType;
125 ::boost::optional< bool > m_aIsFolder;
126 ::boost::optional< OUString > m_aContentType;
127 OUString m_sExtensionId;
128 OUString m_sPathIntoExtension;
132 } } } // namespace ucb::ucp::ext
135 #endif // INCLUDED_UCB_SOURCE_UCP_EXT_UCPEXT_CONTENT_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */