1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _DBA_COREDATAACCESS_DOCUMENTCONTAINER_HXX_
29 #define _DBA_COREDATAACCESS_DOCUMENTCONTAINER_HXX_
30 
31 #ifndef _DBA_CORE_DEFINITIONCONTAINER_HXX_
32 #include "definitioncontainer.hxx"
33 #endif
34 #ifndef _CPPUHELPER_IMPLBASE5_HXX_
35 #include <cppuhelper/implbase5.hxx>
36 #endif
37 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 #endif
40 #ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
41 #include <com/sun/star/frame/XComponentLoader.hpp>
42 #endif
43 #ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMECONTAINER_HPP_
44 #include <com/sun/star/container/XHierarchicalNameContainer.hpp>
45 #endif
46 #ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAME_HPP_
47 #include <com/sun/star/container/XHierarchicalName.hpp>
48 #endif
49 #ifndef _COM_SUN_STAR_EMBED_XTRANSACTEDOBJECT_HPP_
50 #include <com/sun/star/embed/XTransactedObject.hpp>
51 #endif
52 #ifndef COMPHELPER_PROPERTYSTATECONTAINER_HXX
53 #include <comphelper/propertystatecontainer.hxx>
54 #endif
55 #ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
56 #include <comphelper/proparrhlp.hxx>
57 #endif
58 #ifndef _DBASHARED_APITOOLS_HXX_
59 #include "apitools.hxx"
60 #endif
61 
62 //........................................................................
63 namespace dbaccess
64 {
65 //........................................................................
66 typedef ::cppu::ImplHelper5 <	::com::sun::star::frame::XComponentLoader
67 						    ,	::com::sun::star::lang::XMultiServiceFactory
68 						    ,	::com::sun::star::container::XHierarchicalNameContainer
69 						    ,	::com::sun::star::container::XHierarchicalName
70 						    ,	::com::sun::star::embed::XTransactedObject
71 						    >	ODocumentContainer_Base;
72 //==========================================================================
73 //= ODocumentContainer -	collections of database documents (reports/forms)
74 //==========================================================================
75 class ODocumentContainer	: public ODefinitionContainer
76 							, public ODocumentContainer_Base
77 							, public ::comphelper::OPropertyStateContainer
78 							, public ::comphelper::OPropertyArrayUsageHelper< ODocumentContainer >
79 {
80 	sal_Bool		m_bFormsContainer;
81 
82 public:
83 	/** constructs the container.<BR>
84 	*/
85 	ODocumentContainer(
86 		  const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB
87 		, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >&	_xParentContainer
88 		,const TContentPtr& _pImpl
89 		, sal_Bool _bFormsContainer
90 		);
91 
92 	// ::com::sun::star::uno::XInterface
93 	DECLARE_XINTERFACE( )
94 	// com::sun::star::lang::XTypeProvider
95 	DECLARE_TYPEPROVIDER( );
96 	// ::com::sun::star::lang::XServiceInfo
97 	DECLARE_SERVICE_INFO();
98 
99 	// XComponentLoader
100 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponentFromURL( const ::rtl::OUString& URL, const ::rtl::OUString& TargetFrameName, sal_Int32 SearchFlags, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::io::IOException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
101 
102 	// ::com::sun::star::lang::XMultiServiceFactory
103     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
104     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
105     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
106 
107 	// XCommandProcessor
108 	virtual ::com::sun::star::uno::Any SAL_CALL execute( const ::com::sun::star::ucb::Command& aCommand, sal_Int32 CommandId, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& Environment ) throw (::com::sun::star::uno::Exception, ::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::RuntimeException) ;
109 
110 	// XHierarchicalNameAccess
111 	virtual ::com::sun::star::uno::Any SAL_CALL getByHierarchicalName( const ::rtl::OUString& _sName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
112     virtual sal_Bool SAL_CALL hasByHierarchicalName( const ::rtl::OUString& _sName ) throw (::com::sun::star::uno::RuntimeException);
113 
114 	// XHierarchicalNameContainer
115 	virtual void SAL_CALL insertByHierarchicalName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
116     virtual void SAL_CALL removeByHierarchicalName( const ::rtl::OUString& Name ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
117 
118 	// XHierarchicalName
119     virtual ::rtl::OUString SAL_CALL getHierarchicalName(  ) throw (::com::sun::star::uno::RuntimeException);
120     virtual ::rtl::OUString SAL_CALL composeHierarchicalName( const ::rtl::OUString& aRelativeName ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
121 
122     // XNameContainer
123     virtual void SAL_CALL removeByName( const ::rtl::OUString& _rName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
124 
125 	// XHierarchicalNameReplace
126 	virtual void SAL_CALL replaceByHierarchicalName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
127 
128 	// ::com::sun::star::beans::XPropertySet
129 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
130 
131 	// XTransactedObject
132 	virtual void SAL_CALL commit(  ) throw (::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
133     virtual void SAL_CALL revert(  ) throw (::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
134 
135     // XRename
136 	virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
137 
138 	// OPropertySetHelper
139 	virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
140 
141 	// helper
142 	::rtl::Reference<OContentHelper> getContent(const ::rtl::OUString& _sName) const;
143 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > getContainerStorage() const;
144 
145 protected:
146 	virtual ~ODocumentContainer();
147 
148     /** OContentHelper
149     */
150     virtual ::rtl::OUString determineContentType() const;
151 
152     // ODefinitionContainer
153 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > createObject(
154 		const ::rtl::OUString& _rName
155 	);
156 
157 	virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const;
158 
159 	// OPropertyArrayUsageHelper
160     virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
161 };
162 
163 //........................................................................
164 }	// namespace dbaccess
165 //........................................................................
166 
167 #endif // _DBA_COREDATAACCESS_DOCUMENTCONTAINER_HXX_
168 
169