xref: /trunk/main/dbaccess/source/ui/uno/admindlg.cxx (revision cdf0e10c)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_dbaccess.hxx"
30 
31 #ifndef _DBU_REGHELPER_HXX_
32 #include "dbu_reghelper.hxx"
33 #endif
34 #ifndef _DBAUI_ADMINDLG_HXX
35 #include "admindlg.hxx"
36 #endif
37 #ifndef _DBAUI_DBADMIN_HXX_
38 #include "dbadmin.hxx"
39 #endif
40 
41 
42 using namespace dbaui;
43 
44 extern "C" void SAL_CALL createRegistryInfo_ODataSourcePropertyDialog()
45 {
46 	static OMultiInstanceAutoRegistration< ODataSourcePropertyDialog > aAutoRegistration;
47 }
48 
49 //.........................................................................
50 namespace dbaui
51 {
52 //.........................................................................
53 
54 	using namespace ::com::sun::star::uno;
55 	using namespace ::com::sun::star::lang;
56 	using namespace ::com::sun::star::beans;
57 
58 //=========================================================================
59 //-------------------------------------------------------------------------
60 ODataSourcePropertyDialog::ODataSourcePropertyDialog(const Reference< XMultiServiceFactory >& _rxORB)
61 	:ODatabaseAdministrationDialog(_rxORB)
62 {
63 }
64 //-------------------------------------------------------------------------
65 Sequence<sal_Int8> SAL_CALL ODataSourcePropertyDialog::getImplementationId(  ) throw(RuntimeException)
66 {
67 	static ::cppu::OImplementationId aId;
68 	return aId.getImplementationId();
69 }
70 
71 //-------------------------------------------------------------------------
72 Reference< XInterface > SAL_CALL ODataSourcePropertyDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
73 {
74 	return *(new ODataSourcePropertyDialog(_rxFactory));
75 }
76 
77 //-------------------------------------------------------------------------
78 ::rtl::OUString SAL_CALL ODataSourcePropertyDialog::getImplementationName() throw(RuntimeException)
79 {
80 	return getImplementationName_Static();
81 }
82 
83 //-------------------------------------------------------------------------
84 ::rtl::OUString ODataSourcePropertyDialog::getImplementationName_Static() throw(RuntimeException)
85 {
86 	return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbu.ODatasourceAdministrationDialog"));
87 }
88 
89 //-------------------------------------------------------------------------
90 ::comphelper::StringSequence SAL_CALL ODataSourcePropertyDialog::getSupportedServiceNames() throw(RuntimeException)
91 {
92 	return getSupportedServiceNames_Static();
93 }
94 
95 //-------------------------------------------------------------------------
96 ::comphelper::StringSequence ODataSourcePropertyDialog::getSupportedServiceNames_Static() throw(RuntimeException)
97 {
98 	::comphelper::StringSequence aSupported(1);
99 	aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatasourceAdministrationDialog"));
100 	return aSupported;
101 }
102 
103 //-------------------------------------------------------------------------
104 Reference<XPropertySetInfo>  SAL_CALL ODataSourcePropertyDialog::getPropertySetInfo() throw(RuntimeException)
105 {
106 	Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) );
107 	return xInfo;
108 }
109 
110 //-------------------------------------------------------------------------
111 ::cppu::IPropertyArrayHelper& ODataSourcePropertyDialog::getInfoHelper()
112 {
113 	return *const_cast<ODataSourcePropertyDialog*>(this)->getArrayHelper();
114 }
115 
116 //------------------------------------------------------------------------------
117 ::cppu::IPropertyArrayHelper* ODataSourcePropertyDialog::createArrayHelper( ) const
118 {
119 	Sequence< Property > aProps;
120 	describeProperties(aProps);
121 	return new ::cppu::OPropertyArrayHelper(aProps);
122 }
123 //------------------------------------------------------------------------------
124 Dialog*	ODataSourcePropertyDialog::createDialog(Window* _pParent)
125 {
126 
127 	ODbAdminDialog* pDialog = new ODbAdminDialog(_pParent, m_pDatasourceItems, m_aContext.getLegacyServiceFactory());
128 
129 	// the initial selection
130 	if ( m_aInitialSelection.hasValue() )
131 		pDialog->selectDataSource(m_aInitialSelection);
132 
133 	return pDialog;
134 }
135 
136 //.........................................................................
137 }	// namespace dbaui
138 //.........................................................................
139 
140