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