Branch data 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 : :
21 : : #include "dbustrings.hrc"
22 : : #include <toolkit/awt/vclxwindow.hxx>
23 : : #include "dbu_reghelper.hxx"
24 : : #ifndef _DBAUI_UNOADMIN_
25 : : #include "unoadmin.hxx"
26 : : #endif
27 : : #include "dbadmin.hxx"
28 : : #include <comphelper/extract.hxx>
29 : : #include <cppuhelper/typeprovider.hxx>
30 : : #include <comphelper/property.hxx>
31 : : #include <osl/diagnose.h>
32 : : #include <vcl/msgbox.hxx>
33 : :
34 : : // --- needed because of the solar mutex
35 : : #include <osl/mutex.hxx>
36 : : #include <vcl/svapp.hxx>
37 : : // ---
38 : :
39 : : #define THISREF() static_cast< XServiceInfo* >(this)
40 : :
41 : : //.........................................................................
42 : : namespace dbaui
43 : : {
44 : : //.........................................................................
45 : :
46 : : using namespace ::com::sun::star::uno;
47 : : using namespace ::com::sun::star::lang;
48 : : using namespace ::com::sun::star::beans;
49 : :
50 : : //=========================================================================
51 : : DBG_NAME(ODatabaseAdministrationDialog)
52 : : //-------------------------------------------------------------------------
53 : 4 : ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XMultiServiceFactory >& _rxORB)
54 : : :ODatabaseAdministrationDialogBase(_rxORB)
55 : : ,m_pDatasourceItems(NULL)
56 : : ,m_pItemPool(NULL)
57 : : ,m_pItemPoolDefaults(NULL)
58 [ + - ]: 4 : ,m_pCollection(NULL)
59 : : {
60 : : DBG_CTOR(ODatabaseAdministrationDialog,NULL);
61 : :
62 [ + - ][ + - ]: 4 : m_pCollection = new ::dbaccess::ODsnTypeCollection(_rxORB);
63 [ + - ]: 4 : ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults, m_pCollection);
64 : 4 : }
65 : :
66 : : //-------------------------------------------------------------------------
67 [ + - ]: 4 : ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog()
68 : : {
69 : : // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
70 : : // so this virtual-method-call the base class does does not work, we're already dead then ...
71 [ - + ]: 4 : if (m_pDialog)
72 : : {
73 [ # # ]: 0 : ::osl::MutexGuard aGuard(m_aMutex);
74 [ # # ]: 0 : if (m_pDialog)
75 [ # # ][ # # ]: 0 : destroyDialog();
76 : : }
77 : :
78 [ + - ][ + - ]: 4 : delete m_pCollection;
79 : 4 : m_pCollection = NULL;
80 : :
81 : : DBG_DTOR(ODatabaseAdministrationDialog,NULL);
82 [ - + ]: 4 : }
83 : : //-------------------------------------------------------------------------
84 : 0 : void ODatabaseAdministrationDialog::destroyDialog()
85 : : {
86 : 0 : ODatabaseAdministrationDialogBase::destroyDialog();
87 : 0 : ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults);
88 : 0 : }
89 : : //------------------------------------------------------------------------------
90 : 0 : void ODatabaseAdministrationDialog::implInitialize(const Any& _rValue)
91 : : {
92 : 0 : PropertyValue aProperty;
93 [ # # ][ # # ]: 0 : if (_rValue >>= aProperty)
94 : : {
95 [ # # ]: 0 : if (0 == aProperty.Name.compareToAscii("InitialSelection"))
96 : : {
97 : 0 : m_aInitialSelection = aProperty.Value;
98 : : }
99 [ # # ]: 0 : else if (0 == aProperty.Name.compareToAscii("ActiveConnection"))
100 : : {
101 [ # # ]: 0 : m_xActiveConnection.set(aProperty.Value,UNO_QUERY);
102 : : }
103 : : else
104 [ # # ]: 0 : ODatabaseAdministrationDialogBase::implInitialize(_rValue);
105 : : }
106 : : else
107 [ # # ]: 0 : ODatabaseAdministrationDialogBase::implInitialize(_rValue);
108 : 0 : }
109 : :
110 : : //.........................................................................
111 : : } // namespace dbaui
112 : : //.........................................................................
113 : :
114 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|