Update ooo320-m1
[ooovba.git] / dbaccess / source / ui / uno / unoadmin.cxx
blob31b493e3b08b1786532e6d3d827d6307dd813ab7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoadmin.cxx,v $
10 * $Revision: 1.20.34.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
35 #include "dbustrings.hrc"
36 #endif
37 #ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
38 #include <toolkit/awt/vclxwindow.hxx>
39 #endif
40 #ifndef _DBU_REGHELPER_HXX_
41 #include "dbu_reghelper.hxx"
42 #endif
43 #ifndef _DBAUI_UNOADMIN_
44 #include "unoadmin.hxx"
45 #endif
46 #ifndef _DBAUI_DBADMIN_HXX_
47 #include "dbadmin.hxx"
48 #endif
49 #ifndef _COMPHELPER_EXTRACT_HXX_
50 #include <comphelper/extract.hxx>
51 #endif
52 #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
53 #include <cppuhelper/typeprovider.hxx>
54 #endif
55 #ifndef _COMPHELPER_PROPERTY_HXX_
56 #include <comphelper/property.hxx>
57 #endif
58 #ifndef _OSL_DIAGNOSE_H_
59 #include <osl/diagnose.h>
60 #endif
61 #ifndef _SV_MSGBOX_HXX
62 #include <vcl/msgbox.hxx>
63 #endif
65 // --- needed because of the solar mutex
66 #ifndef _VOS_MUTEX_HXX_
67 #include <vos/mutex.hxx>
68 #endif
69 #ifndef _SV_SVAPP_HXX
70 #include <vcl/svapp.hxx>
71 #endif
72 // ---
74 #define THISREF() static_cast< XServiceInfo* >(this)
76 //.........................................................................
77 namespace dbaui
79 //.........................................................................
81 using namespace ::com::sun::star::uno;
82 using namespace ::com::sun::star::lang;
83 using namespace ::com::sun::star::beans;
85 //=========================================================================
86 DBG_NAME(ODatabaseAdministrationDialog)
87 //-------------------------------------------------------------------------
88 ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XMultiServiceFactory >& _rxORB)
89 :ODatabaseAdministrationDialogBase(_rxORB)
90 ,m_pDatasourceItems(NULL)
91 ,m_pItemPool(NULL)
92 ,m_pItemPoolDefaults(NULL)
93 ,m_pCollection(NULL)
95 DBG_CTOR(ODatabaseAdministrationDialog,NULL);
97 m_pCollection = new ::dbaccess::ODsnTypeCollection(_rxORB);
98 ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults, m_pCollection);
101 //-------------------------------------------------------------------------
102 ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog()
104 // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
105 // so this virtual-method-call the base class does does not work, we're already dead then ...
106 if (m_pDialog)
108 ::osl::MutexGuard aGuard(m_aMutex);
109 if (m_pDialog)
110 destroyDialog();
113 delete m_pCollection;
114 m_pCollection = NULL;
116 DBG_DTOR(ODatabaseAdministrationDialog,NULL);
118 //-------------------------------------------------------------------------
119 void ODatabaseAdministrationDialog::destroyDialog()
121 ODatabaseAdministrationDialogBase::destroyDialog();
122 ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults);
124 //------------------------------------------------------------------------------
125 void ODatabaseAdministrationDialog::implInitialize(const Any& _rValue)
127 PropertyValue aProperty;
128 if (_rValue >>= aProperty)
130 if (0 == aProperty.Name.compareToAscii("InitialSelection"))
132 m_aInitialSelection = aProperty.Value;
134 else if (0 == aProperty.Name.compareToAscii("ActiveConnection"))
136 m_xActiveConnection.set(aProperty.Value,UNO_QUERY);
138 else
139 ODatabaseAdministrationDialogBase::implInitialize(_rValue);
141 else
142 ODatabaseAdministrationDialogBase::implInitialize(_rValue);
145 //.........................................................................
146 } // namespace dbaui
147 //.........................................................................