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 "unoDirectSql.hxx"
22 : : #include "dbu_reghelper.hxx"
23 : : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
24 : : #include <com/sun/star/container/XNameAccess.hpp>
25 : : #include <com/sun/star/connection/XConnection.hpp>
26 : : #include <com/sun/star/container/XNamed.hpp>
27 : : #include "directsql.hxx"
28 : : #include "dbustrings.hrc"
29 : : #include "datasourceconnector.hxx"
30 : : #include <tools/diagnose_ex.h>
31 : :
32 : :
33 : 8 : extern "C" void SAL_CALL createRegistryInfo_ODirectSQLDialog()
34 : : {
35 [ + - ][ + - ]: 8 : static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::ODirectSQLDialog > aAutoRegistration;
[ + - ][ # # ]
36 : 8 : }
37 : :
38 : : //.........................................................................
39 : : namespace dbaui
40 : : {
41 : : //.........................................................................
42 : :
43 : : using namespace ::com::sun::star::uno;
44 : : using namespace ::com::sun::star::lang;
45 : : using namespace ::com::sun::star::beans;
46 : : using namespace ::com::sun::star::container;
47 : : using namespace ::com::sun::star::sdbcx;
48 : : using namespace ::com::sun::star::sdbc;
49 : : using namespace ::com::sun::star::sdb;
50 : :
51 : : //=====================================================================
52 : : //= ODirectSQLDialog
53 : : //=====================================================================
54 : : DBG_NAME(ODirectSQLDialog)
55 : : //---------------------------------------------------------------------
56 : 0 : ODirectSQLDialog::ODirectSQLDialog(const Reference< XMultiServiceFactory >& _rxORB)
57 [ # # ][ # # ]: 0 : :ODirectSQLDialog_BASE( _rxORB )
58 : : {
59 : : DBG_CTOR(ODirectSQLDialog,NULL);
60 : :
61 : 0 : }
62 : :
63 : : //---------------------------------------------------------------------
64 [ # # ][ # # ]: 0 : ODirectSQLDialog::~ODirectSQLDialog()
65 : : {
66 : :
67 : : DBG_DTOR(ODirectSQLDialog,NULL);
68 [ # # ]: 0 : }
69 : :
70 : : //---------------------------------------------------------------------
71 [ # # ][ # # ]: 0 : IMPLEMENT_IMPLEMENTATION_ID( ODirectSQLDialog )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
72 : :
73 : : //---------------------------------------------------------------------
74 [ # # ][ # # ]: 24 : IMPLEMENT_SERVICE_INFO1_STATIC( ODirectSQLDialog, "com.sun.star.comp.sdb.DirectSQLDialog", SERVICE_SDB_DIRECTSQLDIALOG.ascii )
[ + - ][ # # ]
[ # # ][ # # ]
[ # # ]
75 : :
76 : : //---------------------------------------------------------------------
77 [ # # ][ # # ]: 0 : IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ODirectSQLDialog )
[ # # ][ # # ]
78 : :
79 : : //---------------------------------------------------------------------
80 : 0 : Dialog* ODirectSQLDialog::createDialog(Window* _pParent)
81 : : {
82 : : // obtain all the objects needed for the dialog
83 : 0 : Reference< XConnection > xConnection = m_xActiveConnection;
84 [ # # ]: 0 : if ( !xConnection.is() )
85 : : {
86 : : try
87 : : {
88 : : // the connection the row set is working with
89 [ # # ][ # # ]: 0 : ODatasourceConnector aDSConnector(m_aContext.getLegacyServiceFactory(),_pParent);
90 [ # # ][ # # ]: 0 : xConnection = aDSConnector.connect( m_sInitialSelection, NULL );
[ # # ][ # # ]
91 : : }
92 [ # # ]: 0 : catch( const Exception& )
93 : : {
94 : : DBG_UNHANDLED_EXCEPTION();
95 : : }
96 : : }
97 [ # # ]: 0 : if ( !xConnection.is() )
98 : : // can't create the dialog if I have improper settings
99 : 0 : return NULL;
100 : :
101 [ # # ][ # # ]: 0 : return new DirectSQLDialog( _pParent, xConnection);
102 : : }
103 : : //---------------------------------------------------------------------
104 : 0 : void ODirectSQLDialog::implInitialize(const Any& _rValue)
105 : : {
106 : 0 : PropertyValue aProperty;
107 [ # # ][ # # ]: 0 : if (_rValue >>= aProperty)
108 : : {
109 [ # # ]: 0 : if (0 == aProperty.Name.compareToAscii("InitialSelection"))
110 : : {
111 : 0 : OSL_VERIFY( aProperty.Value >>= m_sInitialSelection );
112 : : return;
113 : : }
114 [ # # ]: 0 : else if (0 == aProperty.Name.compareToAscii("ActiveConnection"))
115 : : {
116 [ # # ]: 0 : m_xActiveConnection.set( aProperty.Value, UNO_QUERY );
117 : : OSL_ENSURE( m_xActiveConnection.is(), "ODirectSQLDialog::implInitialize: invalid connection!" );
118 : : return;
119 : : }
120 : : }
121 [ # # ][ # # ]: 0 : ODirectSQLDialog_BASE::implInitialize(_rValue);
122 : : }
123 : : //.........................................................................
124 : : } // namespace dbaui
125 : : //.........................................................................
126 : :
127 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|