Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "dbustrings.hrc"
21 : #include <toolkit/awt/vclxwindow.hxx>
22 : #include "dbu_reghelper.hxx"
23 : #include "unoadmin.hxx"
24 : #include "dbadmin.hxx"
25 : #include <comphelper/extract.hxx>
26 : #include <comphelper/processfactory.hxx>
27 : #include <cppuhelper/typeprovider.hxx>
28 : #include <comphelper/property.hxx>
29 : #include <osl/diagnose.h>
30 : #include <vcl/msgbox.hxx>
31 :
32 : // --- needed because of the solar mutex
33 : #include <osl/mutex.hxx>
34 : #include <vcl/svapp.hxx>
35 :
36 :
37 : namespace dbaui
38 : {
39 :
40 : using namespace ::com::sun::star::uno;
41 : using namespace ::com::sun::star::lang;
42 : using namespace ::com::sun::star::beans;
43 :
44 4 : ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XComponentContext >& _rxORB)
45 : :ODatabaseAdministrationDialogBase(_rxORB)
46 : ,m_pDatasourceItems(NULL)
47 : ,m_pItemPool(NULL)
48 : ,m_pItemPoolDefaults(NULL)
49 4 : ,m_pCollection(NULL)
50 : {
51 :
52 4 : m_pCollection = new ::dbaccess::ODsnTypeCollection(_rxORB);
53 4 : ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults, m_pCollection);
54 4 : }
55 :
56 8 : ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog()
57 : {
58 : // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
59 : // so this virtual-method-call the base class does does not work, we're already dead then ...
60 4 : if (m_pDialog)
61 : {
62 0 : ::osl::MutexGuard aGuard(m_aMutex);
63 0 : if (m_pDialog)
64 0 : destroyDialog();
65 : }
66 :
67 4 : delete m_pCollection;
68 4 : m_pCollection = NULL;
69 :
70 4 : }
71 :
72 0 : void ODatabaseAdministrationDialog::destroyDialog()
73 : {
74 0 : ODatabaseAdministrationDialogBase::destroyDialog();
75 0 : ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults);
76 0 : }
77 :
78 0 : void ODatabaseAdministrationDialog::implInitialize(const Any& _rValue)
79 : {
80 0 : PropertyValue aProperty;
81 0 : if (_rValue >>= aProperty)
82 : {
83 0 : if (aProperty.Name == "InitialSelection")
84 : {
85 0 : m_aInitialSelection = aProperty.Value;
86 : }
87 0 : else if (aProperty.Name == "ActiveConnection")
88 : {
89 0 : m_xActiveConnection.set(aProperty.Value,UNO_QUERY);
90 : }
91 : else
92 0 : ODatabaseAdministrationDialogBase::implInitialize(_rValue);
93 : }
94 : else
95 0 : ODatabaseAdministrationDialogBase::implInitialize(_rValue);
96 0 : }
97 :
98 36 : } // namespace dbaui
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|