1*6df1ea1fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*6df1ea1fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*6df1ea1fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*6df1ea1fSAndrew Rist * distributed with this work for additional information 6*6df1ea1fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*6df1ea1fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*6df1ea1fSAndrew Rist * "License"); you may not use this file except in compliance 9*6df1ea1fSAndrew Rist * with the License. You may obtain a copy of the License at 10*6df1ea1fSAndrew Rist * 11*6df1ea1fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*6df1ea1fSAndrew Rist * 13*6df1ea1fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*6df1ea1fSAndrew Rist * software distributed under the License is distributed on an 15*6df1ea1fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6df1ea1fSAndrew Rist * KIND, either express or implied. See the License for the 17*6df1ea1fSAndrew Rist * specific language governing permissions and limitations 18*6df1ea1fSAndrew Rist * under the License. 19*6df1ea1fSAndrew Rist * 20*6df1ea1fSAndrew Rist *************************************************************/ 21*6df1ea1fSAndrew Rist 22*6df1ea1fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef UCB_UCPEXT_CONTENT_HXX 25cdf0e10cSrcweir #define UCB_UCPEXT_CONTENT_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir /** === begin UNO includes === **/ 28cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp> 29cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 30cdf0e10cSrcweir /** === end UNO includes === **/ 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <rtl/ref.hxx> 33cdf0e10cSrcweir #include <ucbhelper/contenthelper.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <list> 36cdf0e10cSrcweir #include <boost/optional.hpp> 37cdf0e10cSrcweir 38cdf0e10cSrcweir //...................................................................................................................... 39cdf0e10cSrcweir namespace ucb { namespace ucp { namespace ext 40cdf0e10cSrcweir { 41cdf0e10cSrcweir //...................................................................................................................... 42cdf0e10cSrcweir 43cdf0e10cSrcweir //================================================================================================================== 44cdf0e10cSrcweir //= ExtensionContentType 45cdf0e10cSrcweir //================================================================================================================== 46cdf0e10cSrcweir enum ExtensionContentType 47cdf0e10cSrcweir { 48cdf0e10cSrcweir E_ROOT, 49cdf0e10cSrcweir E_EXTENSION_ROOT, 50cdf0e10cSrcweir E_EXTENSION_CONTENT, 51cdf0e10cSrcweir 52cdf0e10cSrcweir E_UNKNOWN 53cdf0e10cSrcweir }; 54cdf0e10cSrcweir 55cdf0e10cSrcweir //================================================================================================================== 56cdf0e10cSrcweir //= ContentProvider 57cdf0e10cSrcweir //================================================================================================================== 58cdf0e10cSrcweir typedef ::ucbhelper::ContentImplHelper Content_Base; 59cdf0e10cSrcweir class Content : public Content_Base 60cdf0e10cSrcweir { 61cdf0e10cSrcweir public: 62cdf0e10cSrcweir Content( 63cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, 64cdf0e10cSrcweir ::ucbhelper::ContentProviderImplHelper* pProvider, 65cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentIdentifier >& Identifier 66cdf0e10cSrcweir ); 67cdf0e10cSrcweir 68cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > 69cdf0e10cSrcweir getArtificialNodePropertyValues( 70cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr, 71cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties, 72cdf0e10cSrcweir const ::rtl::OUString& rTitle 73cdf0e10cSrcweir ); 74cdf0e10cSrcweir 75cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > 76cdf0e10cSrcweir getPropertyValues( 77cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties, 78cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv 79cdf0e10cSrcweir ); 80cdf0e10cSrcweir 81cdf0e10cSrcweir static ::rtl::OUString 82cdf0e10cSrcweir encodeIdentifier( const ::rtl::OUString& i_rIdentifier ); 83cdf0e10cSrcweir static ::rtl::OUString 84cdf0e10cSrcweir decodeIdentifier( const ::rtl::OUString& i_rIdentifier ); 85cdf0e10cSrcweir 86cdf0e10cSrcweir virtual ::rtl::OUString getParentURL(); 87cdf0e10cSrcweir getExtensionContentType() const88cdf0e10cSrcweir ExtensionContentType getExtensionContentType() const { return m_eExtContentType; } 89cdf0e10cSrcweir 90cdf0e10cSrcweir /** retrieves the URL of the underlying physical content. Not to be called when getExtensionContentType() 91cdf0e10cSrcweir returns E_ROOT. 92cdf0e10cSrcweir */ 93cdf0e10cSrcweir ::rtl::OUString getPhysicalURL() const; 94cdf0e10cSrcweir 95cdf0e10cSrcweir protected: 96cdf0e10cSrcweir virtual ~Content(); 97cdf0e10cSrcweir 98cdf0e10cSrcweir // XServiceInfo 99cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); 100cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); 101cdf0e10cSrcweir 102cdf0e10cSrcweir // XContent 103cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getContentType() throw( com::sun::star::uno::RuntimeException ); 104cdf0e10cSrcweir 105cdf0e10cSrcweir // XCommandProcessor 106cdf0e10cSrcweir virtual com::sun::star::uno::Any SAL_CALL 107cdf0e10cSrcweir execute( 108cdf0e10cSrcweir const com::sun::star::ucb::Command& aCommand, 109cdf0e10cSrcweir sal_Int32 CommandId, 110cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment 111cdf0e10cSrcweir ) 112cdf0e10cSrcweir throw ( ::com::sun::star::uno::Exception 113cdf0e10cSrcweir , ::com::sun::star::ucb::CommandAbortedException 114cdf0e10cSrcweir , ::com::sun::star::uno::RuntimeException 115cdf0e10cSrcweir ); 116cdf0e10cSrcweir 117cdf0e10cSrcweir virtual void SAL_CALL 118cdf0e10cSrcweir abort( 119cdf0e10cSrcweir sal_Int32 CommandId 120cdf0e10cSrcweir ) 121cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException 122cdf0e10cSrcweir ); 123cdf0e10cSrcweir 124cdf0e10cSrcweir private: 125cdf0e10cSrcweir 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 ); 126cdf0e10cSrcweir 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 ); 127cdf0e10cSrcweir 128cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 129cdf0e10cSrcweir setPropertyValues( 130cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues, 131cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv 132cdf0e10cSrcweir ); 133cdf0e10cSrcweir 134cdf0e10cSrcweir static bool denotesRootContent( const ::rtl::OUString& i_rContentIdentifier ); 135cdf0e10cSrcweir 136cdf0e10cSrcweir bool impl_isFolder(); 137cdf0e10cSrcweir void impl_determineContentType(); 138cdf0e10cSrcweir 139cdf0e10cSrcweir private: 140cdf0e10cSrcweir ExtensionContentType m_eExtContentType; 141cdf0e10cSrcweir ::boost::optional< bool > m_aIsFolder; 142cdf0e10cSrcweir ::boost::optional< ::rtl::OUString > m_aContentType; 143cdf0e10cSrcweir ::rtl::OUString m_sExtensionId; 144cdf0e10cSrcweir ::rtl::OUString m_sPathIntoExtension; 145cdf0e10cSrcweir }; 146cdf0e10cSrcweir 147cdf0e10cSrcweir //...................................................................................................................... 148cdf0e10cSrcweir } } } // namespace ucb::ucp::ext 149cdf0e10cSrcweir //...................................................................................................................... 150cdf0e10cSrcweir 151cdf0e10cSrcweir #endif // UCB_UCPEXT_CONTENT_HXX 152