1 /************************************************************************* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * Copyright 2000, 2010 Oracle and/or its affiliates. 5 * 6 * OpenOffice.org - a multi-platform office productivity suite 7 * 8 * This file is part of OpenOffice.org. 9 * 10 * OpenOffice.org is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU Lesser General Public License version 3 12 * only, as published by the Free Software Foundation. 13 * 14 * OpenOffice.org is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU Lesser General Public License version 3 for more details 18 * (a copy is included in the LICENSE file that accompanied this code). 19 * 20 * You should have received a copy of the GNU Lesser General Public License 21 * version 3 along with OpenOffice.org. If not, see 22 * <http://www.openoffice.org/license.html> 23 * for a copy of the LGPLv3 License. 24 * 25 ************************************************************************/ 26 27 #ifndef UCB_UCPEXT_CONTENT_HXX 28 #define UCB_UCPEXT_CONTENT_HXX 29 30 /** === begin UNO includes === **/ 31 #include <com/sun/star/sdbc/XRow.hpp> 32 #include <com/sun/star/beans/PropertyValue.hpp> 33 /** === end UNO includes === **/ 34 35 #include <rtl/ref.hxx> 36 #include <ucbhelper/contenthelper.hxx> 37 38 #include <list> 39 #include <boost/optional.hpp> 40 41 //...................................................................................................................... 42 namespace ucb { namespace ucp { namespace ext 43 { 44 //...................................................................................................................... 45 46 //================================================================================================================== 47 //= ExtensionContentType 48 //================================================================================================================== 49 enum ExtensionContentType 50 { 51 E_ROOT, 52 E_EXTENSION_ROOT, 53 E_EXTENSION_CONTENT, 54 55 E_UNKNOWN 56 }; 57 58 //================================================================================================================== 59 //= ContentProvider 60 //================================================================================================================== 61 typedef ::ucbhelper::ContentImplHelper Content_Base; 62 class Content : public Content_Base 63 { 64 public: 65 Content( 66 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, 67 ::ucbhelper::ContentProviderImplHelper* pProvider, 68 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentIdentifier >& Identifier 69 ); 70 71 static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > 72 getArtificialNodePropertyValues( 73 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr, 74 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties, 75 const ::rtl::OUString& rTitle 76 ); 77 78 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > 79 getPropertyValues( 80 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties, 81 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv 82 ); 83 84 static ::rtl::OUString 85 encodeIdentifier( const ::rtl::OUString& i_rIdentifier ); 86 static ::rtl::OUString 87 decodeIdentifier( const ::rtl::OUString& i_rIdentifier ); 88 89 virtual ::rtl::OUString getParentURL(); 90 91 ExtensionContentType getExtensionContentType() const { return m_eExtContentType; } 92 93 /** retrieves the URL of the underlying physical content. Not to be called when getExtensionContentType() 94 returns E_ROOT. 95 */ 96 ::rtl::OUString getPhysicalURL() const; 97 98 protected: 99 virtual ~Content(); 100 101 // XServiceInfo 102 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); 103 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); 104 105 // XContent 106 virtual rtl::OUString SAL_CALL getContentType() throw( com::sun::star::uno::RuntimeException ); 107 108 // XCommandProcessor 109 virtual com::sun::star::uno::Any SAL_CALL 110 execute( 111 const com::sun::star::ucb::Command& aCommand, 112 sal_Int32 CommandId, 113 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment 114 ) 115 throw ( ::com::sun::star::uno::Exception 116 , ::com::sun::star::ucb::CommandAbortedException 117 , ::com::sun::star::uno::RuntimeException 118 ); 119 120 virtual void SAL_CALL 121 abort( 122 sal_Int32 CommandId 123 ) 124 throw ( ::com::sun::star::uno::RuntimeException 125 ); 126 127 private: 128 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 ); 129 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 ); 130 131 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 132 setPropertyValues( 133 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues, 134 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv 135 ); 136 137 static bool denotesRootContent( const ::rtl::OUString& i_rContentIdentifier ); 138 139 bool impl_isFolder(); 140 void impl_determineContentType(); 141 142 private: 143 ExtensionContentType m_eExtContentType; 144 ::boost::optional< bool > m_aIsFolder; 145 ::boost::optional< ::rtl::OUString > m_aContentType; 146 ::rtl::OUString m_sExtensionId; 147 ::rtl::OUString m_sPathIntoExtension; 148 }; 149 150 //...................................................................................................................... 151 } } } // namespace ucb::ucp::ext 152 //...................................................................................................................... 153 154 #endif // UCB_UCPEXT_CONTENT_HXX 155