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 _CONNECTIVITY_SDBCX_VIEW_HXX_
29 #define _CONNECTIVITY_SDBCX_VIEW_HXX_
30 
31 #include <osl/diagnose.h>
32 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
33 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
34 #include <comphelper/proparrhlp.hxx>
35 #include <cppuhelper/compbase1.hxx>
36 #include "connectivity/CommonTools.hxx"
37 #include <cppuhelper/interfacecontainer.h>
38 #include <com/sun/star/container/XNamed.hpp>
39 #include "connectivity/sdbcx/VDescriptor.hxx"
40 #include "connectivity/dbtoolsdllapi.hxx"
41 #include <comphelper/IdPropArrayHelper.hxx>
42 #include <cppuhelper/implbase2.hxx>
43 
44 namespace connectivity
45 {
46 	namespace sdbcx
47 	{
48 
49         typedef ::cppu::WeakImplHelper2<    ::com::sun::star::lang::XServiceInfo,
50 							            ::com::sun::star::container::XNamed> OView_BASE;
51 
52 
53 
54 		class OOO_DLLPUBLIC_DBTOOLS OView :
55                         public ::comphelper::OMutexAndBroadcastHelper,
56 						public OView_BASE,
57 						public ::comphelper::OIdPropertyArrayUsageHelper<OView>,
58 						public ODescriptor
59 		{
60 		protected:
61 			::rtl::OUString m_CatalogName;
62 			::rtl::OUString m_SchemaName;
63 			::rtl::OUString m_Command;
64 			sal_Int32		m_CheckOption;
65 			// need for the getName method
66 			::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >       m_xMetaData;
67 
68 			// OPropertyArrayUsageHelper
69 			virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
70 			// OPropertySetHelper
71 			virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
72 
73 		public:
74 			DECLARE_SERVICE_INFO();
75 
76 			OView(sal_Bool _bCase,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData);
77 			OView(  sal_Bool _bCase,
78 					const ::rtl::OUString& _rName,
79 					const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData,
80 					sal_Int32 _nCheckOption = 0,
81 					const ::rtl::OUString& _rCommand = ::rtl::OUString(),
82 					const ::rtl::OUString& _rSchemaName = ::rtl::OUString(),
83 					const ::rtl::OUString& _rCatalogName = ::rtl::OUString());
84 			virtual ~OView();
85 
86 			// ODescriptor
87 			virtual void construct();
88 
89 			// ::cppu::OComponentHelper
90 			virtual void SAL_CALL disposing(void);
91 
92 			// XInterface
93             virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
94 			virtual void SAL_CALL acquire() throw();
95             virtual void SAL_CALL release() throw();
96 			//XTypeProvider
97             virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
98 			// XPropertySet
99             virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
100 			// XNamed
101             virtual ::rtl::OUString SAL_CALL getName(  ) throw(::com::sun::star::uno::RuntimeException);
102             virtual void SAL_CALL setName( const ::rtl::OUString& ) throw(::com::sun::star::uno::RuntimeException);
103 		};
104 	}
105 }
106 
107 #endif // _CONNECTIVITY_SDBCX_VIEW_HXX_
108 
109