1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _DBA_COREDATAACCESS_DOCUMENTCONTAINER_HXX_
25 #define _DBA_COREDATAACCESS_DOCUMENTCONTAINER_HXX_
26 
27 #ifndef _DBA_CORE_DEFINITIONCONTAINER_HXX_
28 #include "definitioncontainer.hxx"
29 #endif
30 #ifndef _CPPUHELPER_IMPLBASE5_HXX_
31 #include <cppuhelper/implbase5.hxx>
32 #endif
33 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
34 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 #endif
36 #ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
37 #include <com/sun/star/frame/XComponentLoader.hpp>
38 #endif
39 #ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMECONTAINER_HPP_
40 #include <com/sun/star/container/XHierarchicalNameContainer.hpp>
41 #endif
42 #ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAME_HPP_
43 #include <com/sun/star/container/XHierarchicalName.hpp>
44 #endif
45 #ifndef _COM_SUN_STAR_EMBED_XTRANSACTEDOBJECT_HPP_
46 #include <com/sun/star/embed/XTransactedObject.hpp>
47 #endif
48 #ifndef COMPHELPER_PROPERTYSTATECONTAINER_HXX
49 #include <comphelper/propertystatecontainer.hxx>
50 #endif
51 #ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
52 #include <comphelper/proparrhlp.hxx>
53 #endif
54 #ifndef _DBASHARED_APITOOLS_HXX_
55 #include "apitools.hxx"
56 #endif
57 
58 //........................................................................
59 namespace dbaccess
60 {
61 //........................................................................
62 typedef ::cppu::ImplHelper5 <	::com::sun::star::frame::XComponentLoader
63 						    ,	::com::sun::star::lang::XMultiServiceFactory
64 						    ,	::com::sun::star::container::XHierarchicalNameContainer
65 						    ,	::com::sun::star::container::XHierarchicalName
66 						    ,	::com::sun::star::embed::XTransactedObject
67 						    >	ODocumentContainer_Base;
68 //==========================================================================
69 //= ODocumentContainer -	collections of database documents (reports/forms)
70 //==========================================================================
71 class ODocumentContainer	: public ODefinitionContainer
72 							, public ODocumentContainer_Base
73 							, public ::comphelper::OPropertyStateContainer
74 							, public ::comphelper::OPropertyArrayUsageHelper< ODocumentContainer >
75 {
76 	sal_Bool		m_bFormsContainer;
77 
78 public:
79 	/** constructs the container.<BR>
80 	*/
81 	ODocumentContainer(
82 		  const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB
83 		, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >&	_xParentContainer
84 		,const TContentPtr& _pImpl
85 		, sal_Bool _bFormsContainer
86 		);
87 
88 	// ::com::sun::star::uno::XInterface
89 	DECLARE_XINTERFACE( )
90 	// com::sun::star::lang::XTypeProvider
91 	DECLARE_TYPEPROVIDER( );
92 	// ::com::sun::star::lang::XServiceInfo
93 	DECLARE_SERVICE_INFO();
94 
95 	// XComponentLoader
96 	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);
97 
98 	// ::com::sun::star::lang::XMultiServiceFactory
99     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);
100     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);
101     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
102 
103 	// XCommandProcessor
104 	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) ;
105 
106 	// XHierarchicalNameAccess
107 	virtual ::com::sun::star::uno::Any SAL_CALL getByHierarchicalName( const ::rtl::OUString& _sName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
108     virtual sal_Bool SAL_CALL hasByHierarchicalName( const ::rtl::OUString& _sName ) throw (::com::sun::star::uno::RuntimeException);
109 
110 	// XHierarchicalNameContainer
111 	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);
112     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);
113 
114 	// XHierarchicalName
115     virtual ::rtl::OUString SAL_CALL getHierarchicalName(  ) throw (::com::sun::star::uno::RuntimeException);
116     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);
117 
118     // XNameContainer
119     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);
120 
121 	// XHierarchicalNameReplace
122 	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);
123 
124 	// ::com::sun::star::beans::XPropertySet
125 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
126 
127 	// XTransactedObject
128 	virtual void SAL_CALL commit(  ) throw (::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
129     virtual void SAL_CALL revert(  ) throw (::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
130 
131     // XRename
132 	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);
133 
134 	// OPropertySetHelper
135 	virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
136 
137 	// helper
138 	::rtl::Reference<OContentHelper> getContent(const ::rtl::OUString& _sName) const;
139 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > getContainerStorage() const;
140 
141 protected:
142 	virtual ~ODocumentContainer();
143 
144     /** OContentHelper
145     */
146     virtual ::rtl::OUString determineContentType() const;
147 
148     // ODefinitionContainer
149 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > createObject(
150 		const ::rtl::OUString& _rName
151 	);
152 
153 	virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const;
154 
155 	// OPropertyArrayUsageHelper
156     virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
157 };
158 
159 //........................................................................
160 }	// namespace dbaccess
161 //........................................................................
162 
163 #endif // _DBA_COREDATAACCESS_DOCUMENTCONTAINER_HXX_
164 
165