Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / dbaccess / source / ui / uno / unoadmin.cxx
blob49ca8049cbf231cce4e510be8c82e70e18d21998
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "dbustrings.hrc"
31 #include <toolkit/awt/vclxwindow.hxx>
32 #include "dbu_reghelper.hxx"
33 #ifndef _DBAUI_UNOADMIN_
34 #include "unoadmin.hxx"
35 #endif
36 #include "dbadmin.hxx"
37 #include <comphelper/extract.hxx>
38 #include <cppuhelper/typeprovider.hxx>
39 #include <comphelper/property.hxx>
40 #include <osl/diagnose.h>
41 #include <vcl/msgbox.hxx>
43 // --- needed because of the solar mutex
44 #include <osl/mutex.hxx>
45 #include <vcl/svapp.hxx>
46 // ---
48 #define THISREF() static_cast< XServiceInfo* >(this)
50 //.........................................................................
51 namespace dbaui
53 //.........................................................................
55 using namespace ::com::sun::star::uno;
56 using namespace ::com::sun::star::lang;
57 using namespace ::com::sun::star::beans;
59 //=========================================================================
60 DBG_NAME(ODatabaseAdministrationDialog)
61 //-------------------------------------------------------------------------
62 ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XMultiServiceFactory >& _rxORB)
63 :ODatabaseAdministrationDialogBase(_rxORB)
64 ,m_pDatasourceItems(NULL)
65 ,m_pItemPool(NULL)
66 ,m_pItemPoolDefaults(NULL)
67 ,m_pCollection(NULL)
69 DBG_CTOR(ODatabaseAdministrationDialog,NULL);
71 m_pCollection = new ::dbaccess::ODsnTypeCollection(_rxORB);
72 ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults, m_pCollection);
75 //-------------------------------------------------------------------------
76 ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog()
78 // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
79 // so this virtual-method-call the base class does does not work, we're already dead then ...
80 if (m_pDialog)
82 ::osl::MutexGuard aGuard(m_aMutex);
83 if (m_pDialog)
84 destroyDialog();
87 delete m_pCollection;
88 m_pCollection = NULL;
90 DBG_DTOR(ODatabaseAdministrationDialog,NULL);
92 //-------------------------------------------------------------------------
93 void ODatabaseAdministrationDialog::destroyDialog()
95 ODatabaseAdministrationDialogBase::destroyDialog();
96 ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults);
98 //------------------------------------------------------------------------------
99 void ODatabaseAdministrationDialog::implInitialize(const Any& _rValue)
101 PropertyValue aProperty;
102 if (_rValue >>= aProperty)
104 if (0 == aProperty.Name.compareToAscii("InitialSelection"))
106 m_aInitialSelection = aProperty.Value;
108 else if (0 == aProperty.Name.compareToAscii("ActiveConnection"))
110 m_xActiveConnection.set(aProperty.Value,UNO_QUERY);
112 else
113 ODatabaseAdministrationDialogBase::implInitialize(_rValue);
115 else
116 ODatabaseAdministrationDialogBase::implInitialize(_rValue);
119 //.........................................................................
120 } // namespace dbaui
121 //.........................................................................
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */