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 BASIC_DIALOGCONTAINER_HXX 29*cdf0e10cSrcweir #define BASIC_DIALOGCONTAINER_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "namecont.hxx" 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_AWT_XSTRINGRESOURCESUPPLIER_HPP_ 34*cdf0e10cSrcweir #include <com/sun/star/resource/XStringResourceSupplier.hpp> 35*cdf0e10cSrcweir #endif 36*cdf0e10cSrcweir #include "com/sun/star/resource/XStringResourcePersistence.hpp" 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 39*cdf0e10cSrcweir #include <comphelper/uno3.hxx> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir namespace basic 42*cdf0e10cSrcweir { 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir //============================================================================ 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir class SfxDialogLibraryContainer : public SfxLibraryContainer 47*cdf0e10cSrcweir { 48*cdf0e10cSrcweir // Methods to distinguish between different library types 49*cdf0e10cSrcweir virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName ); 50*cdf0e10cSrcweir virtual SfxLibrary* SAL_CALL implCreateLibraryLink 51*cdf0e10cSrcweir ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL, 52*cdf0e10cSrcweir const ::rtl::OUString& StorageURL, sal_Bool ReadOnly ); 53*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void ); 54*cdf0e10cSrcweir virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const; 55*cdf0e10cSrcweir virtual void SAL_CALL writeLibraryElement 56*cdf0e10cSrcweir ( 57*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary, 58*cdf0e10cSrcweir const ::rtl::OUString& aElementName, 59*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput 60*cdf0e10cSrcweir ) 61*cdf0e10cSrcweir throw(::com::sun::star::uno::Exception); 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement 64*cdf0e10cSrcweir ( 65*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary, 66*cdf0e10cSrcweir const ::rtl::OUString& aElementName, 67*cdf0e10cSrcweir const ::rtl::OUString& aFile, 68*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream ); 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ); 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir virtual SfxLibraryContainer* createInstanceImpl( void ); 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir virtual void onNewRootStorage(); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir virtual const sal_Char* SAL_CALL getInfoFileName() const; 77*cdf0e10cSrcweir virtual const sal_Char* SAL_CALL getOldInfoFileName() const; 78*cdf0e10cSrcweir virtual const sal_Char* SAL_CALL getLibElementFileExtension() const; 79*cdf0e10cSrcweir virtual const sal_Char* SAL_CALL getLibrariesDir() const; 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir public: 82*cdf0e10cSrcweir SfxDialogLibraryContainer( void ); 83*cdf0e10cSrcweir SfxDialogLibraryContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir // Methods XStorageBasedLibraryContainer 86*cdf0e10cSrcweir virtual void SAL_CALL storeLibrariesToStorage( 87*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& RootStorage ) 88*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir // Resource handling 91*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourcePersistence > 92*cdf0e10cSrcweir implCreateStringResource( class SfxDialogLibrary* pDialog ); 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir // Methods XServiceInfo 95*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) 96*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 97*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) 98*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir // Service 101*cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(); 102*cdf0e10cSrcweir static ::rtl::OUString getImplementationName_static(); 103*cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create 104*cdf0e10cSrcweir ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xServiceManager ) 105*cdf0e10cSrcweir throw( ::com::sun::star::uno::Exception ); 106*cdf0e10cSrcweir }; 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir //============================================================================ 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir typedef ::cppu::ImplHelper1 < ::com::sun::star::resource::XStringResourceSupplier 111*cdf0e10cSrcweir > SfxDialogLibrary_BASE; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir class SfxDialogLibrary :public SfxLibrary 114*cdf0e10cSrcweir ,public SfxDialogLibrary_BASE 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir SfxDialogLibraryContainer* m_pParent; 117*cdf0e10cSrcweir ::com::sun::star::uno::Reference 118*cdf0e10cSrcweir < ::com::sun::star::resource::XStringResourcePersistence> m_xStringResourcePersistence; 119*cdf0e10cSrcweir ::rtl::OUString m_aName; 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir // Provide modify state including resources 122*cdf0e10cSrcweir virtual sal_Bool isModified( void ); 123*cdf0e10cSrcweir virtual void storeResources( void ); 124*cdf0e10cSrcweir virtual void storeResourcesAsURL( const ::rtl::OUString& URL, const ::rtl::OUString& NewName ); 125*cdf0e10cSrcweir virtual void storeResourcesToURL( const ::rtl::OUString& URL, 126*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); 127*cdf0e10cSrcweir virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference 128*cdf0e10cSrcweir < ::com::sun::star::embed::XStorage >& xStorage ); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir public: 131*cdf0e10cSrcweir SfxDialogLibrary 132*cdf0e10cSrcweir ( 133*cdf0e10cSrcweir ModifiableHelper& _rModifiable, 134*cdf0e10cSrcweir const ::rtl::OUString& aName, 135*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF, 136*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI, 137*cdf0e10cSrcweir SfxDialogLibraryContainer* pParent 138*cdf0e10cSrcweir ); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir SfxDialogLibrary 141*cdf0e10cSrcweir ( 142*cdf0e10cSrcweir ModifiableHelper& _rModifiable, 143*cdf0e10cSrcweir const ::rtl::OUString& aName, 144*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF, 145*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI, 146*cdf0e10cSrcweir const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly, 147*cdf0e10cSrcweir SfxDialogLibraryContainer* pParent 148*cdf0e10cSrcweir ); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir DECLARE_XINTERFACE() 151*cdf0e10cSrcweir DECLARE_XTYPEPROVIDER() 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir // XStringResourceSupplier 154*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver > 155*cdf0e10cSrcweir SAL_CALL getStringResource( ) throw (::com::sun::star::uno::RuntimeException); 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir ::rtl::OUString getName( void ) 158*cdf0e10cSrcweir { return m_aName; } 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourcePersistence > 161*cdf0e10cSrcweir getStringResourcePersistence( void ) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir return m_xStringResourcePersistence; 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir static bool containsValidDialog( const ::com::sun::star::uno::Any& aElement ); 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir protected: 169*cdf0e10cSrcweir virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const; 170*cdf0e10cSrcweir }; 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir } // namespace basic 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir #endif 175*cdf0e10cSrcweir 176