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 _BC_HXX_ 25cdf0e10cSrcweir #define _BC_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "osl/mutex.hxx" 28cdf0e10cSrcweir #include "rtl/ustring.hxx" 29cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 30cdf0e10cSrcweir #include <ucbhelper/macros.hxx> 31cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 32cdf0e10cSrcweir #include <com/sun/star/uno/XInterface.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 34cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 35cdf0e10cSrcweir #include <com/sun/star/ucb/XCommandProcessor.hpp> 36cdf0e10cSrcweir #include <com/sun/star/beans/XPropertiesChangeNotifier.hpp> 37cdf0e10cSrcweir #include <com/sun/star/ucb/XContent.hpp> 38cdf0e10cSrcweir #include <com/sun/star/ucb/XContentProvider.hpp> 39cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UCB_XRESULTSET_HPP_ 40cdf0e10cSrcweir #include <com/sun/star/ucb/XDynamicResultSet.hpp> 41cdf0e10cSrcweir #endif 42cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 43cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp> 44cdf0e10cSrcweir #include <com/sun/star/beans/PropertyChangeEvent.hpp> 45cdf0e10cSrcweir #include <com/sun/star/beans/Property.hpp> 46cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 47cdf0e10cSrcweir #include <com/sun/star/ucb/XCommandInfo.hpp> 48cdf0e10cSrcweir #include <com/sun/star/ucb/InsertCommandArgument.hpp> 49cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp> 50cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyContainer.hpp> 51cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp> 52cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfoChangeListener.hpp> 53cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 54cdf0e10cSrcweir #include <com/sun/star/ucb/XContentCreator.hpp> 55cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 56cdf0e10cSrcweir #include <com/sun/star/ucb/OpenCommandArgument2.hpp> 57cdf0e10cSrcweir #include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp> 58cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UCB_SHELL_HXX_ 59cdf0e10cSrcweir #include "shell.hxx" 60cdf0e10cSrcweir #endif 61cdf0e10cSrcweir 62cdf0e10cSrcweir 63cdf0e10cSrcweir namespace fileaccess { 64cdf0e10cSrcweir 65cdf0e10cSrcweir class PropertyListeners; 66cdf0e10cSrcweir class shell; 67cdf0e10cSrcweir class FileProvider; 68cdf0e10cSrcweir 69cdf0e10cSrcweir class BaseContent: 70cdf0e10cSrcweir public cppu::OWeakObject, 71cdf0e10cSrcweir public com::sun::star::lang::XComponent, 72cdf0e10cSrcweir public com::sun::star::lang::XServiceInfo, 73cdf0e10cSrcweir public com::sun::star::lang::XTypeProvider, 74cdf0e10cSrcweir public com::sun::star::ucb::XCommandProcessor, 75cdf0e10cSrcweir public com::sun::star::beans::XPropertiesChangeNotifier, 76cdf0e10cSrcweir public com::sun::star::beans::XPropertyContainer, 77cdf0e10cSrcweir public com::sun::star::beans::XPropertySetInfoChangeNotifier, 78cdf0e10cSrcweir public com::sun::star::ucb::XContentCreator, 79cdf0e10cSrcweir public com::sun::star::container::XChild, 80cdf0e10cSrcweir public com::sun::star::ucb::XContent, 81cdf0e10cSrcweir public fileaccess::Notifier // implementation class 82cdf0e10cSrcweir { 83cdf0e10cSrcweir private: 84cdf0e10cSrcweir 85cdf0e10cSrcweir // A special creator for inserted contents; Creates an ugly object 86cdf0e10cSrcweir BaseContent( shell* pMyShell, 87cdf0e10cSrcweir const rtl::OUString& parentName, 88cdf0e10cSrcweir sal_Bool bFolder ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir public: 91cdf0e10cSrcweir BaseContent( 92cdf0e10cSrcweir shell* pMyShell, 93cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xContentIdentifier, 94cdf0e10cSrcweir const rtl::OUString& aUnqPath ); 95cdf0e10cSrcweir 96cdf0e10cSrcweir virtual ~BaseContent(); 97cdf0e10cSrcweir 98cdf0e10cSrcweir // XInterface 99cdf0e10cSrcweir virtual com::sun::star::uno::Any SAL_CALL 100cdf0e10cSrcweir queryInterface( 101cdf0e10cSrcweir const com::sun::star::uno::Type& aType ) 102cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException); 103cdf0e10cSrcweir 104cdf0e10cSrcweir virtual void SAL_CALL 105cdf0e10cSrcweir acquire( 106cdf0e10cSrcweir void ) 107cdf0e10cSrcweir throw(); 108cdf0e10cSrcweir 109cdf0e10cSrcweir virtual void SAL_CALL 110cdf0e10cSrcweir release( 111cdf0e10cSrcweir void ) 112cdf0e10cSrcweir throw(); 113cdf0e10cSrcweir 114cdf0e10cSrcweir 115cdf0e10cSrcweir // XComponent 116cdf0e10cSrcweir virtual void SAL_CALL 117cdf0e10cSrcweir dispose( 118cdf0e10cSrcweir void ) 119cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 120cdf0e10cSrcweir 121cdf0e10cSrcweir virtual void SAL_CALL 122cdf0e10cSrcweir addEventListener( 123cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener ) 124cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 125cdf0e10cSrcweir 126cdf0e10cSrcweir virtual void SAL_CALL 127cdf0e10cSrcweir removeEventListener( const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener ) 128cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 129cdf0e10cSrcweir 130cdf0e10cSrcweir 131cdf0e10cSrcweir // XTypeProvider 132cdf0e10cSrcweir 133cdf0e10cSrcweir XTYPEPROVIDER_DECL() 134cdf0e10cSrcweir 135cdf0e10cSrcweir 136cdf0e10cSrcweir // XServiceInfo 137cdf0e10cSrcweir virtual rtl::OUString SAL_CALL 138cdf0e10cSrcweir getImplementationName() 139cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException); 140cdf0e10cSrcweir 141cdf0e10cSrcweir virtual sal_Bool SAL_CALL 142cdf0e10cSrcweir supportsService( const rtl::OUString& ServiceName ) 143cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException); 144cdf0e10cSrcweir 145cdf0e10cSrcweir virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL 146cdf0e10cSrcweir getSupportedServiceNames() 147cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 148cdf0e10cSrcweir 149cdf0e10cSrcweir 150cdf0e10cSrcweir // XCommandProcessor 151cdf0e10cSrcweir virtual sal_Int32 SAL_CALL 152cdf0e10cSrcweir createCommandIdentifier( 153cdf0e10cSrcweir void ) 154cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir virtual com::sun::star::uno::Any SAL_CALL 157cdf0e10cSrcweir execute( 158cdf0e10cSrcweir const com::sun::star::ucb::Command& aCommand, 159cdf0e10cSrcweir sal_Int32 CommandId, 160cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment ) 161cdf0e10cSrcweir throw( com::sun::star::uno::Exception, 162cdf0e10cSrcweir com::sun::star::ucb::CommandAbortedException, 163cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 164cdf0e10cSrcweir 165cdf0e10cSrcweir virtual void SAL_CALL 166cdf0e10cSrcweir abort( 167cdf0e10cSrcweir sal_Int32 CommandId ) 168cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 169cdf0e10cSrcweir 170cdf0e10cSrcweir 171cdf0e10cSrcweir // XContent 172cdf0e10cSrcweir virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL 173cdf0e10cSrcweir getIdentifier( 174cdf0e10cSrcweir void ) 175cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 176cdf0e10cSrcweir 177cdf0e10cSrcweir virtual rtl::OUString SAL_CALL 178cdf0e10cSrcweir getContentType( 179cdf0e10cSrcweir void ) 180cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 181cdf0e10cSrcweir 182cdf0e10cSrcweir virtual void SAL_CALL 183cdf0e10cSrcweir addContentEventListener( 184cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::ucb::XContentEventListener >& Listener ) 185cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 186cdf0e10cSrcweir 187cdf0e10cSrcweir virtual void SAL_CALL 188cdf0e10cSrcweir removeContentEventListener( 189cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::ucb::XContentEventListener >& Listener ) 190cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 191cdf0e10cSrcweir 192cdf0e10cSrcweir // XPropertiesChangeNotifier 193cdf0e10cSrcweir 194cdf0e10cSrcweir virtual void SAL_CALL 195cdf0e10cSrcweir addPropertiesChangeListener( 196cdf0e10cSrcweir const com::sun::star::uno::Sequence< rtl::OUString >& PropertyNames, 197cdf0e10cSrcweir const com::sun::star::uno::Reference< 198cdf0e10cSrcweir com::sun::star::beans::XPropertiesChangeListener >& Listener ) 199cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 200cdf0e10cSrcweir 201cdf0e10cSrcweir virtual void SAL_CALL 202cdf0e10cSrcweir removePropertiesChangeListener( const com::sun::star::uno::Sequence< rtl::OUString >& PropertyNames, 203cdf0e10cSrcweir const com::sun::star::uno::Reference< 204cdf0e10cSrcweir com::sun::star::beans::XPropertiesChangeListener >& Listener ) 205cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 206cdf0e10cSrcweir 207cdf0e10cSrcweir // XPropertyContainer 208cdf0e10cSrcweir 209cdf0e10cSrcweir virtual void SAL_CALL 210cdf0e10cSrcweir addProperty( 211cdf0e10cSrcweir const rtl::OUString& Name, 212cdf0e10cSrcweir sal_Int16 Attributes, 213cdf0e10cSrcweir const com::sun::star::uno::Any& DefaultValue ) 214cdf0e10cSrcweir throw( com::sun::star::beans::PropertyExistException, 215cdf0e10cSrcweir com::sun::star::beans::IllegalTypeException, 216cdf0e10cSrcweir com::sun::star::lang::IllegalArgumentException, 217cdf0e10cSrcweir com::sun::star::uno::RuntimeException); 218cdf0e10cSrcweir 219cdf0e10cSrcweir virtual void SAL_CALL 220cdf0e10cSrcweir removeProperty( 221cdf0e10cSrcweir const rtl::OUString& Name ) 222cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 223cdf0e10cSrcweir com::sun::star::beans::NotRemoveableException, 224cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 225cdf0e10cSrcweir 226cdf0e10cSrcweir // XPropertySetInfoChangeNotifier 227cdf0e10cSrcweir 228cdf0e10cSrcweir virtual void SAL_CALL 229cdf0e10cSrcweir addPropertySetInfoChangeListener( 230cdf0e10cSrcweir const com::sun::star::uno::Reference< 231cdf0e10cSrcweir com::sun::star::beans::XPropertySetInfoChangeListener >& Listener ) 232cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 233cdf0e10cSrcweir 234cdf0e10cSrcweir virtual void SAL_CALL 235cdf0e10cSrcweir removePropertySetInfoChangeListener( 236cdf0e10cSrcweir const com::sun::star::uno::Reference< 237cdf0e10cSrcweir com::sun::star::beans::XPropertySetInfoChangeListener >& Listener ) 238cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 239cdf0e10cSrcweir 240cdf0e10cSrcweir 241cdf0e10cSrcweir // XContentCreator 242cdf0e10cSrcweir 243cdf0e10cSrcweir virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > SAL_CALL 244cdf0e10cSrcweir queryCreatableContentsInfo( 245cdf0e10cSrcweir void ) 246cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 247cdf0e10cSrcweir 248cdf0e10cSrcweir virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL 249cdf0e10cSrcweir createNewContent( 250cdf0e10cSrcweir const com::sun::star::ucb::ContentInfo& Info ) 251cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 252cdf0e10cSrcweir 253cdf0e10cSrcweir 254cdf0e10cSrcweir // XChild 255cdf0e10cSrcweir virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL 256cdf0e10cSrcweir getParent( 257cdf0e10cSrcweir void ) throw( com::sun::star::uno::RuntimeException ); 258cdf0e10cSrcweir 259cdf0e10cSrcweir // Not supported 260cdf0e10cSrcweir virtual void SAL_CALL 261cdf0e10cSrcweir setParent( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& Parent ) 262cdf0e10cSrcweir throw( com::sun::star::lang::NoSupportException, 263cdf0e10cSrcweir com::sun::star::uno::RuntimeException); 264cdf0e10cSrcweir 265cdf0e10cSrcweir 266cdf0e10cSrcweir // Notifier 267cdf0e10cSrcweir 268cdf0e10cSrcweir ContentEventNotifier* cDEL( void ); 269cdf0e10cSrcweir ContentEventNotifier* cEXC( const rtl::OUString aNewName ); 270cdf0e10cSrcweir ContentEventNotifier* cCEL( void ); 271cdf0e10cSrcweir PropertySetInfoChangeNotifier* cPSL( void ); 272cdf0e10cSrcweir PropertyChangeNotifier* cPCL( void ); 273cdf0e10cSrcweir rtl::OUString getKey( void ); 274cdf0e10cSrcweir 275cdf0e10cSrcweir private: 276cdf0e10cSrcweir // Data members 277cdf0e10cSrcweir shell* m_pMyShell; 278cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xContentIdentifier; 279cdf0e10cSrcweir rtl::OUString m_aUncPath; 280cdf0e10cSrcweir 281cdf0e10cSrcweir enum state { NameForInsertionSet = 1, 282cdf0e10cSrcweir JustInserted = 2, 283cdf0e10cSrcweir Deleted = 4, 284cdf0e10cSrcweir FullFeatured = 8, 285cdf0e10cSrcweir Connected = 16 }; 286cdf0e10cSrcweir sal_Bool m_bFolder; 287cdf0e10cSrcweir sal_uInt16 m_nState; 288cdf0e10cSrcweir 289cdf0e10cSrcweir osl::Mutex m_aMutex; 290cdf0e10cSrcweir 291cdf0e10cSrcweir osl::Mutex m_aEventListenerMutex; 292cdf0e10cSrcweir cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; 293cdf0e10cSrcweir cppu::OInterfaceContainerHelper* m_pContentEventListeners; 294cdf0e10cSrcweir cppu::OInterfaceContainerHelper* m_pPropertySetInfoChangeListeners; 295cdf0e10cSrcweir PropertyListeners* m_pPropertyListener; 296cdf0e10cSrcweir 297cdf0e10cSrcweir 298cdf0e10cSrcweir // Private Methods 299cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo > SAL_CALL 300cdf0e10cSrcweir getCommandInfo() 301cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 302cdf0e10cSrcweir 303cdf0e10cSrcweir virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL 304cdf0e10cSrcweir getPropertySetInfo( 305cdf0e10cSrcweir sal_Int32 nMyCommandIdentifier ) 306cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 307cdf0e10cSrcweir 308cdf0e10cSrcweir virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > SAL_CALL 309cdf0e10cSrcweir getPropertyValues( 310cdf0e10cSrcweir sal_Int32 nMyCommandIdentifier, 311cdf0e10cSrcweir const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& PropertySet ) 312cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 313cdf0e10cSrcweir 314cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Any > SAL_CALL 315cdf0e10cSrcweir setPropertyValues( 316cdf0e10cSrcweir sal_Int32 nMyCommandIdentifier, 317cdf0e10cSrcweir const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Values ) 318cdf0e10cSrcweir throw( ); 319cdf0e10cSrcweir 320cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::ucb::XDynamicResultSet > SAL_CALL 321cdf0e10cSrcweir open( 322cdf0e10cSrcweir sal_Int32 nMyCommandIdentifier, 323cdf0e10cSrcweir const com::sun::star::ucb::OpenCommandArgument2& aCommandArgument ) 324cdf0e10cSrcweir throw(); 325cdf0e10cSrcweir 326cdf0e10cSrcweir void SAL_CALL 327cdf0e10cSrcweir deleteContent( sal_Int32 nMyCommandIdentifier ) 328cdf0e10cSrcweir throw(); 329cdf0e10cSrcweir 330cdf0e10cSrcweir 331cdf0e10cSrcweir void SAL_CALL 332cdf0e10cSrcweir transfer( sal_Int32 nMyCommandIdentifier, 333cdf0e10cSrcweir const com::sun::star::ucb::TransferInfo& aTransferInfo ) 334cdf0e10cSrcweir throw(); 335cdf0e10cSrcweir 336cdf0e10cSrcweir void SAL_CALL 337cdf0e10cSrcweir insert( sal_Int32 nMyCommandIdentifier, 338cdf0e10cSrcweir const com::sun::star::ucb::InsertCommandArgument& aInsertArgument ) 339cdf0e10cSrcweir throw(); 340cdf0e10cSrcweir 341cdf0e10cSrcweir void SAL_CALL endTask( sal_Int32 CommandId ); 342cdf0e10cSrcweir 343cdf0e10cSrcweir friend class ContentEventNotifier; 344cdf0e10cSrcweir }; 345cdf0e10cSrcweir 346cdf0e10cSrcweir } // end namespace fileaccess 347cdf0e10cSrcweir 348cdf0e10cSrcweir #endif 349cdf0e10cSrcweir 350