xref: /aoo42x/main/dbaccess/source/ui/uno/unoadmin.cxx (revision 96de5490)
1*96de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96de5490SAndrew Rist  * distributed with this work for additional information
6*96de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96de5490SAndrew Rist  * "License"); you may not use this file except in compliance
9*96de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*96de5490SAndrew Rist  *
11*96de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*96de5490SAndrew Rist  *
13*96de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96de5490SAndrew Rist  * software distributed under the License is distributed on an
15*96de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96de5490SAndrew Rist  * specific language governing permissions and limitations
18*96de5490SAndrew Rist  * under the License.
19*96de5490SAndrew Rist  *
20*96de5490SAndrew Rist  *************************************************************/
21*96de5490SAndrew Rist 
22*96de5490SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
28cdf0e10cSrcweir #include "dbustrings.hrc"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
31cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _DBU_REGHELPER_HXX_
34cdf0e10cSrcweir #include "dbu_reghelper.hxx"
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _DBAUI_UNOADMIN_
37cdf0e10cSrcweir #include "unoadmin.hxx"
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _DBAUI_DBADMIN_HXX_
40cdf0e10cSrcweir #include "dbadmin.hxx"
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef _COMPHELPER_EXTRACT_HXX_
43cdf0e10cSrcweir #include <comphelper/extract.hxx>
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
46cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir #ifndef _COMPHELPER_PROPERTY_HXX_
49cdf0e10cSrcweir #include <comphelper/property.hxx>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #ifndef _OSL_DIAGNOSE_H_
52cdf0e10cSrcweir #include <osl/diagnose.h>
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX
55cdf0e10cSrcweir #include <vcl/msgbox.hxx>
56cdf0e10cSrcweir #endif
57cdf0e10cSrcweir 
58cdf0e10cSrcweir // --- needed because of the solar mutex
59cdf0e10cSrcweir #ifndef _VOS_MUTEX_HXX_
60cdf0e10cSrcweir #include <vos/mutex.hxx>
61cdf0e10cSrcweir #endif
62cdf0e10cSrcweir #ifndef _SV_SVAPP_HXX
63cdf0e10cSrcweir #include <vcl/svapp.hxx>
64cdf0e10cSrcweir #endif
65cdf0e10cSrcweir // ---
66cdf0e10cSrcweir 
67cdf0e10cSrcweir #define THISREF()	static_cast< XServiceInfo* >(this)
68cdf0e10cSrcweir 
69cdf0e10cSrcweir //.........................................................................
70cdf0e10cSrcweir namespace dbaui
71cdf0e10cSrcweir {
72cdf0e10cSrcweir //.........................................................................
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
75cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
76cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir //=========================================================================
79cdf0e10cSrcweir DBG_NAME(ODatabaseAdministrationDialog)
80cdf0e10cSrcweir //-------------------------------------------------------------------------
81cdf0e10cSrcweir ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XMultiServiceFactory >& _rxORB)
82cdf0e10cSrcweir 	:ODatabaseAdministrationDialogBase(_rxORB)
83cdf0e10cSrcweir 	,m_pDatasourceItems(NULL)
84cdf0e10cSrcweir 	,m_pItemPool(NULL)
85cdf0e10cSrcweir 	,m_pItemPoolDefaults(NULL)
86cdf0e10cSrcweir 	,m_pCollection(NULL)
87cdf0e10cSrcweir {
88cdf0e10cSrcweir     DBG_CTOR(ODatabaseAdministrationDialog,NULL);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	m_pCollection = new ::dbaccess::ODsnTypeCollection(_rxORB);
91cdf0e10cSrcweir 	ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults, m_pCollection);
92cdf0e10cSrcweir }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir //-------------------------------------------------------------------------
95cdf0e10cSrcweir ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog()
96cdf0e10cSrcweir {
97cdf0e10cSrcweir 	// we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
98cdf0e10cSrcweir 	// so this virtual-method-call the base class does does not work, we're already dead then ...
99cdf0e10cSrcweir 	if (m_pDialog)
100cdf0e10cSrcweir 	{
101cdf0e10cSrcweir 		::osl::MutexGuard aGuard(m_aMutex);
102cdf0e10cSrcweir 		if (m_pDialog)
103cdf0e10cSrcweir 			destroyDialog();
104cdf0e10cSrcweir 	}
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	delete m_pCollection;
107cdf0e10cSrcweir 	m_pCollection = NULL;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     DBG_DTOR(ODatabaseAdministrationDialog,NULL);
110cdf0e10cSrcweir }
111cdf0e10cSrcweir //-------------------------------------------------------------------------
112cdf0e10cSrcweir void ODatabaseAdministrationDialog::destroyDialog()
113cdf0e10cSrcweir {
114cdf0e10cSrcweir 	ODatabaseAdministrationDialogBase::destroyDialog();
115cdf0e10cSrcweir 	ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults);
116cdf0e10cSrcweir }
117cdf0e10cSrcweir //------------------------------------------------------------------------------
118cdf0e10cSrcweir void ODatabaseAdministrationDialog::implInitialize(const Any& _rValue)
119cdf0e10cSrcweir {
120cdf0e10cSrcweir 	PropertyValue aProperty;
121cdf0e10cSrcweir 	if (_rValue >>= aProperty)
122cdf0e10cSrcweir 	{
123cdf0e10cSrcweir 		if (0 == aProperty.Name.compareToAscii("InitialSelection"))
124cdf0e10cSrcweir 		{
125cdf0e10cSrcweir 			m_aInitialSelection = aProperty.Value;
126cdf0e10cSrcweir 		}
127cdf0e10cSrcweir         else if (0 == aProperty.Name.compareToAscii("ActiveConnection"))
128cdf0e10cSrcweir 		{
129cdf0e10cSrcweir 			m_xActiveConnection.set(aProperty.Value,UNO_QUERY);
130cdf0e10cSrcweir 		}
131cdf0e10cSrcweir         else
132cdf0e10cSrcweir 		    ODatabaseAdministrationDialogBase::implInitialize(_rValue);
133cdf0e10cSrcweir 	}
134cdf0e10cSrcweir     else
135cdf0e10cSrcweir 	    ODatabaseAdministrationDialogBase::implInitialize(_rValue);
136cdf0e10cSrcweir }
137cdf0e10cSrcweir 
138cdf0e10cSrcweir //.........................................................................
139cdf0e10cSrcweir }	// namespace dbaui
140cdf0e10cSrcweir //.........................................................................
141cdf0e10cSrcweir 
142