xref: /aoo42x/main/basic/source/inc/dlgcont.hxx (revision 234bd5c5)
1*234bd5c5SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*234bd5c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*234bd5c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*234bd5c5SAndrew Rist  * distributed with this work for additional information
6*234bd5c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*234bd5c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*234bd5c5SAndrew Rist  * "License"); you may not use this file except in compliance
9*234bd5c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*234bd5c5SAndrew Rist  *
11*234bd5c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*234bd5c5SAndrew Rist  *
13*234bd5c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*234bd5c5SAndrew Rist  * software distributed under the License is distributed on an
15*234bd5c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*234bd5c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17*234bd5c5SAndrew Rist  * specific language governing permissions and limitations
18*234bd5c5SAndrew Rist  * under the License.
19*234bd5c5SAndrew Rist  *
20*234bd5c5SAndrew Rist  *************************************************************/
21*234bd5c5SAndrew Rist 
22*234bd5c5SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef BASIC_DIALOGCONTAINER_HXX
25cdf0e10cSrcweir #define BASIC_DIALOGCONTAINER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "namecont.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #ifndef _COM_SUN_STAR_AWT_XSTRINGRESOURCESUPPLIER_HPP_
30cdf0e10cSrcweir #include <com/sun/star/resource/XStringResourceSupplier.hpp>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #include "com/sun/star/resource/XStringResourcePersistence.hpp"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
35cdf0e10cSrcweir #include <comphelper/uno3.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace basic
38cdf0e10cSrcweir {
39cdf0e10cSrcweir 
40cdf0e10cSrcweir //============================================================================
41cdf0e10cSrcweir 
42cdf0e10cSrcweir class SfxDialogLibraryContainer : public SfxLibraryContainer
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	// Methods to distinguish between different library types
45cdf0e10cSrcweir 	virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName );
46cdf0e10cSrcweir     virtual SfxLibrary* SAL_CALL implCreateLibraryLink
47cdf0e10cSrcweir 		( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
48cdf0e10cSrcweir           const ::rtl::OUString& StorageURL, sal_Bool ReadOnly );
49cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void );
50cdf0e10cSrcweir 	virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
51cdf0e10cSrcweir 	virtual void SAL_CALL writeLibraryElement
52cdf0e10cSrcweir 	(
53cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
54cdf0e10cSrcweir 		const ::rtl::OUString& aElementName,
55cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput
56cdf0e10cSrcweir 	)
57cdf0e10cSrcweir 		throw(::com::sun::star::uno::Exception);
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
60cdf0e10cSrcweir 	(
61cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
62cdf0e10cSrcweir 		const ::rtl::OUString& aElementName,
63cdf0e10cSrcweir 		const ::rtl::OUString& aFile,
64cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream );
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile );
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     virtual SfxLibraryContainer* createInstanceImpl( void );
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	virtual void onNewRootStorage();
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     virtual const sal_Char* SAL_CALL    getInfoFileName() const;
73cdf0e10cSrcweir     virtual const sal_Char* SAL_CALL    getOldInfoFileName() const;
74cdf0e10cSrcweir     virtual const sal_Char* SAL_CALL    getLibElementFileExtension() const;
75cdf0e10cSrcweir     virtual const sal_Char* SAL_CALL    getLibrariesDir() const;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir public:
78cdf0e10cSrcweir 	SfxDialogLibraryContainer( void );
79cdf0e10cSrcweir 	SfxDialogLibraryContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     // Methods XStorageBasedLibraryContainer
82cdf0e10cSrcweir     virtual void SAL_CALL storeLibrariesToStorage(
83cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& RootStorage )
84cdf0e10cSrcweir             throw (::com::sun::star::uno::RuntimeException);
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	// Resource handling
87cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourcePersistence >
88cdf0e10cSrcweir 		implCreateStringResource( class SfxDialogLibrary* pDialog );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     // Methods XServiceInfo
91cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName( )
92cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
94cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     // Service
97cdf0e10cSrcweir 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
98cdf0e10cSrcweir 	static ::rtl::OUString getImplementationName_static();
99cdf0e10cSrcweir 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create
100cdf0e10cSrcweir         ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xServiceManager )
101cdf0e10cSrcweir             throw( ::com::sun::star::uno::Exception );
102cdf0e10cSrcweir };
103cdf0e10cSrcweir 
104cdf0e10cSrcweir //============================================================================
105cdf0e10cSrcweir 
106cdf0e10cSrcweir typedef ::cppu::ImplHelper1 <   ::com::sun::star::resource::XStringResourceSupplier
107cdf0e10cSrcweir                             >   SfxDialogLibrary_BASE;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir class SfxDialogLibrary  :public SfxLibrary
110cdf0e10cSrcweir                         ,public SfxDialogLibrary_BASE
111cdf0e10cSrcweir {
112cdf0e10cSrcweir 	SfxDialogLibraryContainer*										m_pParent;
113cdf0e10cSrcweir 	::com::sun::star::uno::Reference
114cdf0e10cSrcweir 		< ::com::sun::star::resource::XStringResourcePersistence>	m_xStringResourcePersistence;
115cdf0e10cSrcweir 	::rtl::OUString													m_aName;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	// Provide modify state including resources
118cdf0e10cSrcweir 	virtual sal_Bool isModified( void );
119cdf0e10cSrcweir 	virtual void storeResources( void );
120cdf0e10cSrcweir 	virtual void storeResourcesAsURL( const ::rtl::OUString& URL, const ::rtl::OUString& NewName );
121cdf0e10cSrcweir 	virtual void storeResourcesToURL( const ::rtl::OUString& URL,
122cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler  );
123cdf0e10cSrcweir 	virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
124cdf0e10cSrcweir 		< ::com::sun::star::embed::XStorage >& xStorage );
125cdf0e10cSrcweir 
126cdf0e10cSrcweir public:
127cdf0e10cSrcweir 	SfxDialogLibrary
128cdf0e10cSrcweir     (
129cdf0e10cSrcweir 		ModifiableHelper& _rModifiable,
130cdf0e10cSrcweir         const ::rtl::OUString& aName,
131cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
132cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
133cdf0e10cSrcweir 		SfxDialogLibraryContainer* pParent
134cdf0e10cSrcweir     );
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	SfxDialogLibrary
137cdf0e10cSrcweir     (
138cdf0e10cSrcweir 		ModifiableHelper& _rModifiable,
139cdf0e10cSrcweir         const ::rtl::OUString& aName,
140cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
141cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
142cdf0e10cSrcweir         const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly,
143cdf0e10cSrcweir 		SfxDialogLibraryContainer* pParent
144cdf0e10cSrcweir     );
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     DECLARE_XINTERFACE()
147cdf0e10cSrcweir     DECLARE_XTYPEPROVIDER()
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	// XStringResourceSupplier
150cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver >
151cdf0e10cSrcweir 		SAL_CALL getStringResource(  ) throw (::com::sun::star::uno::RuntimeException);
152cdf0e10cSrcweir 
getName(void)153cdf0e10cSrcweir 	::rtl::OUString getName( void )
154cdf0e10cSrcweir 		{ return m_aName; }
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourcePersistence >
getStringResourcePersistence(void)157cdf0e10cSrcweir 		getStringResourcePersistence( void )
158cdf0e10cSrcweir 	{
159cdf0e10cSrcweir 		return m_xStringResourcePersistence;
160cdf0e10cSrcweir 	}
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     static bool containsValidDialog( const ::com::sun::star::uno::Any& aElement );
163cdf0e10cSrcweir 
164cdf0e10cSrcweir protected:
165cdf0e10cSrcweir 	virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
166cdf0e10cSrcweir };
167cdf0e10cSrcweir 
168cdf0e10cSrcweir }   // namespace basic
169cdf0e10cSrcweir 
170cdf0e10cSrcweir #endif
171cdf0e10cSrcweir 
172