Branch data Line data Source code
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 UCB_UCPEXT_CONTENT_HXX
21 : : #define UCB_UCPEXT_CONTENT_HXX
22 : :
23 : : #include <com/sun/star/sdbc/XRow.hpp>
24 : : #include <com/sun/star/beans/PropertyValue.hpp>
25 : :
26 : : #include <rtl/ref.hxx>
27 : : #include <ucbhelper/contenthelper.hxx>
28 : :
29 : : #include <list>
30 : : #include <boost/optional.hpp>
31 : :
32 : : //......................................................................................................................
33 : : namespace ucb { namespace ucp { namespace ext
34 : : {
35 : : //......................................................................................................................
36 : :
37 : : //==================================================================================================================
38 : : //= ExtensionContentType
39 : : //==================================================================================================================
40 : : enum ExtensionContentType
41 : : {
42 : : E_ROOT,
43 : : E_EXTENSION_ROOT,
44 : : E_EXTENSION_CONTENT,
45 : :
46 : : E_UNKNOWN
47 : : };
48 : :
49 : : //==================================================================================================================
50 : : //= ContentProvider
51 : : //==================================================================================================================
52 : : typedef ::ucbhelper::ContentImplHelper Content_Base;
53 : : class Content : public Content_Base
54 : : {
55 : : public:
56 : : Content(
57 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
58 : : ::ucbhelper::ContentProviderImplHelper* pProvider,
59 : : const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentIdentifier >& Identifier
60 : : );
61 : :
62 : : static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
63 : : getArtificialNodePropertyValues(
64 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
65 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties,
66 : : const ::rtl::OUString& rTitle
67 : : );
68 : :
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
73 : : );
74 : :
75 : : static ::rtl::OUString
76 : : encodeIdentifier( const ::rtl::OUString& i_rIdentifier );
77 : : static ::rtl::OUString
78 : : decodeIdentifier( const ::rtl::OUString& i_rIdentifier );
79 : :
80 : : virtual ::rtl::OUString getParentURL();
81 : :
82 : 0 : ExtensionContentType getExtensionContentType() const { return m_eExtContentType; }
83 : :
84 : : /** retrieves the URL of the underlying physical content. Not to be called when getExtensionContentType()
85 : : returns E_ROOT.
86 : : */
87 : : ::rtl::OUString getPhysicalURL() const;
88 : :
89 : : protected:
90 : : virtual ~Content();
91 : :
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);
95 : :
96 : : // XContent
97 : : virtual rtl::OUString SAL_CALL getContentType() throw( com::sun::star::uno::RuntimeException );
98 : :
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
105 : : )
106 : : throw ( ::com::sun::star::uno::Exception
107 : : , ::com::sun::star::ucb::CommandAbortedException
108 : : , ::com::sun::star::uno::RuntimeException
109 : : );
110 : :
111 : : virtual void SAL_CALL
112 : : abort(
113 : : sal_Int32 CommandId
114 : : )
115 : : throw ( ::com::sun::star::uno::RuntimeException
116 : : );
117 : :
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 );
121 : :
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
126 : : );
127 : :
128 : : static bool denotesRootContent( const ::rtl::OUString& i_rContentIdentifier );
129 : :
130 : : bool impl_isFolder();
131 : : void impl_determineContentType();
132 : :
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;
139 : : };
140 : :
141 : : //......................................................................................................................
142 : : } } } // namespace ucb::ucp::ext
143 : : //......................................................................................................................
144 : :
145 : : #endif // UCB_UCPEXT_CONTENT_HXX
146 : :
147 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|