xref: /aoo41x/main/dbaccess/source/ui/uno/unoadmin.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 DBACCESS_SHARED_DBUSTRINGS_HRC
32 #include "dbustrings.hrc"
33 #endif
34 #ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
35 #include <toolkit/awt/vclxwindow.hxx>
36 #endif
37 #ifndef _DBU_REGHELPER_HXX_
38 #include "dbu_reghelper.hxx"
39 #endif
40 #ifndef _DBAUI_UNOADMIN_
41 #include "unoadmin.hxx"
42 #endif
43 #ifndef _DBAUI_DBADMIN_HXX_
44 #include "dbadmin.hxx"
45 #endif
46 #ifndef _COMPHELPER_EXTRACT_HXX_
47 #include <comphelper/extract.hxx>
48 #endif
49 #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
50 #include <cppuhelper/typeprovider.hxx>
51 #endif
52 #ifndef _COMPHELPER_PROPERTY_HXX_
53 #include <comphelper/property.hxx>
54 #endif
55 #ifndef _OSL_DIAGNOSE_H_
56 #include <osl/diagnose.h>
57 #endif
58 #ifndef _SV_MSGBOX_HXX
59 #include <vcl/msgbox.hxx>
60 #endif
61 
62 // --- needed because of the solar mutex
63 #ifndef _VOS_MUTEX_HXX_
64 #include <vos/mutex.hxx>
65 #endif
66 #ifndef _SV_SVAPP_HXX
67 #include <vcl/svapp.hxx>
68 #endif
69 // ---
70 
71 #define THISREF()	static_cast< XServiceInfo* >(this)
72 
73 //.........................................................................
74 namespace dbaui
75 {
76 //.........................................................................
77 
78 	using namespace ::com::sun::star::uno;
79 	using namespace ::com::sun::star::lang;
80 	using namespace ::com::sun::star::beans;
81 
82 //=========================================================================
83 DBG_NAME(ODatabaseAdministrationDialog)
84 //-------------------------------------------------------------------------
85 ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XMultiServiceFactory >& _rxORB)
86 	:ODatabaseAdministrationDialogBase(_rxORB)
87 	,m_pDatasourceItems(NULL)
88 	,m_pItemPool(NULL)
89 	,m_pItemPoolDefaults(NULL)
90 	,m_pCollection(NULL)
91 {
92     DBG_CTOR(ODatabaseAdministrationDialog,NULL);
93 
94 	m_pCollection = new ::dbaccess::ODsnTypeCollection(_rxORB);
95 	ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults, m_pCollection);
96 }
97 
98 //-------------------------------------------------------------------------
99 ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog()
100 {
101 	// we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
102 	// so this virtual-method-call the base class does does not work, we're already dead then ...
103 	if (m_pDialog)
104 	{
105 		::osl::MutexGuard aGuard(m_aMutex);
106 		if (m_pDialog)
107 			destroyDialog();
108 	}
109 
110 	delete m_pCollection;
111 	m_pCollection = NULL;
112 
113     DBG_DTOR(ODatabaseAdministrationDialog,NULL);
114 }
115 //-------------------------------------------------------------------------
116 void ODatabaseAdministrationDialog::destroyDialog()
117 {
118 	ODatabaseAdministrationDialogBase::destroyDialog();
119 	ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults);
120 }
121 //------------------------------------------------------------------------------
122 void ODatabaseAdministrationDialog::implInitialize(const Any& _rValue)
123 {
124 	PropertyValue aProperty;
125 	if (_rValue >>= aProperty)
126 	{
127 		if (0 == aProperty.Name.compareToAscii("InitialSelection"))
128 		{
129 			m_aInitialSelection = aProperty.Value;
130 		}
131         else if (0 == aProperty.Name.compareToAscii("ActiveConnection"))
132 		{
133 			m_xActiveConnection.set(aProperty.Value,UNO_QUERY);
134 		}
135         else
136 		    ODatabaseAdministrationDialogBase::implInitialize(_rValue);
137 	}
138     else
139 	    ODatabaseAdministrationDialogBase::implInitialize(_rValue);
140 }
141 
142 //.........................................................................
143 }	// namespace dbaui
144 //.........................................................................
145 
146