Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / ucb / source / ucp / ext / ucpext_content.hxx
blobee29fd9778a044867cca8ea73da7a7f8f1bb6686
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 UCB_UCPEXT_CONTENT_HXX
21 #define UCB_UCPEXT_CONTENT_HXX
23 #include <com/sun/star/sdbc/XRow.hpp>
24 #include <com/sun/star/beans/PropertyValue.hpp>
26 #include <rtl/ref.hxx>
27 #include <ucbhelper/contenthelper.hxx>
29 #include <list>
30 #include <boost/optional.hpp>
32 //......................................................................................................................
33 namespace ucb { namespace ucp { namespace ext
35 //......................................................................................................................
37 //==================================================================================================================
38 //= ExtensionContentType
39 //==================================================================================================================
40 enum ExtensionContentType
42 E_ROOT,
43 E_EXTENSION_ROOT,
44 E_EXTENSION_CONTENT,
46 E_UNKNOWN
49 //==================================================================================================================
50 //= ContentProvider
51 //==================================================================================================================
52 typedef ::ucbhelper::ContentImplHelper Content_Base;
53 class Content : public Content_Base
55 public:
56 Content(
57 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
58 ::ucbhelper::ContentProviderImplHelper* pProvider,
59 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentIdentifier >& Identifier
62 static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
63 getArtificialNodePropertyValues(
64 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
65 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties,
66 const ::rtl::OUString& rTitle
69 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
70 getPropertyValues(
71 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties,
72 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv
75 static ::rtl::OUString
76 encodeIdentifier( const ::rtl::OUString& i_rIdentifier );
77 static ::rtl::OUString
78 decodeIdentifier( const ::rtl::OUString& i_rIdentifier );
80 virtual ::rtl::OUString getParentURL();
82 ExtensionContentType getExtensionContentType() const { return m_eExtContentType; }
84 /** retrieves the URL of the underlying physical content. Not to be called when getExtensionContentType()
85 returns E_ROOT.
87 ::rtl::OUString getPhysicalURL() const;
89 protected:
90 virtual ~Content();
92 // XServiceInfo
93 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
94 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
96 // XContent
97 virtual rtl::OUString SAL_CALL getContentType() throw( com::sun::star::uno::RuntimeException );
99 // XCommandProcessor
100 virtual com::sun::star::uno::Any SAL_CALL
101 execute(
102 const com::sun::star::ucb::Command& aCommand,
103 sal_Int32 CommandId,
104 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment
106 throw ( ::com::sun::star::uno::Exception
107 , ::com::sun::star::ucb::CommandAbortedException
108 , ::com::sun::star::uno::RuntimeException
111 virtual void SAL_CALL
112 abort(
113 sal_Int32 CommandId
115 throw ( ::com::sun::star::uno::RuntimeException
118 private:
119 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > getProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& i_rEnv );
120 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::CommandInfo > getCommands( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& i_rEnv );
122 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
123 setPropertyValues(
124 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues,
125 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv
128 static bool denotesRootContent( const ::rtl::OUString& i_rContentIdentifier );
130 bool impl_isFolder();
131 void impl_determineContentType();
133 private:
134 ExtensionContentType m_eExtContentType;
135 ::boost::optional< bool > m_aIsFolder;
136 ::boost::optional< ::rtl::OUString > m_aContentType;
137 ::rtl::OUString m_sExtensionId;
138 ::rtl::OUString m_sPathIntoExtension;
141 //......................................................................................................................
142 } } } // namespace ucb::ucp::ext
143 //......................................................................................................................
145 #endif // UCB_UCPEXT_CONTENT_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */