196de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
396de5490SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
496de5490SAndrew Rist * or more contributor license agreements. See the NOTICE file
596de5490SAndrew Rist * distributed with this work for additional information
696de5490SAndrew Rist * regarding copyright ownership. The ASF licenses this file
796de5490SAndrew Rist * to you under the Apache License, Version 2.0 (the
896de5490SAndrew Rist * "License"); you may not use this file except in compliance
996de5490SAndrew Rist * with the License. You may obtain a copy of the License at
1096de5490SAndrew Rist *
1196de5490SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
1296de5490SAndrew Rist *
1396de5490SAndrew Rist * Unless required by applicable law or agreed to in writing,
1496de5490SAndrew Rist * software distributed under the License is distributed on an
1596de5490SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1696de5490SAndrew Rist * KIND, either express or implied. See the License for the
1796de5490SAndrew Rist * specific language governing permissions and limitations
1896de5490SAndrew Rist * under the License.
1996de5490SAndrew Rist *
2096de5490SAndrew Rist *************************************************************/
2196de5490SAndrew Rist
2296de5490SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25*b63233d8Sdamjan #include "precompiled_dbui.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #ifndef DBAUI_UNODIRECTSQL_HXX
28cdf0e10cSrcweir #include "unoDirectSql.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _DBU_REGHELPER_HXX_
31cdf0e10cSrcweir #include "dbu_reghelper.hxx"
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
34cdf0e10cSrcweir #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
37cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONNECTION_XCONNECTION_HPP_
40cdf0e10cSrcweir #include <com/sun/star/connection/XConnection.hpp>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
43cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #ifndef _DBACCESS_UI_DIRECTSQL_HXX_
46cdf0e10cSrcweir #include "directsql.hxx"
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
49cdf0e10cSrcweir #include "dbustrings.hrc"
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #ifndef _DBAUI_DATASOURCECONNECTOR_HXX_
52cdf0e10cSrcweir #include "datasourceconnector.hxx"
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #ifndef TOOLS_DIAGNOSE_EX_H
55cdf0e10cSrcweir #include <tools/diagnose_ex.h>
56cdf0e10cSrcweir #endif
57cdf0e10cSrcweir
58cdf0e10cSrcweir
createRegistryInfo_ODirectSQLDialog()59cdf0e10cSrcweir extern "C" void SAL_CALL createRegistryInfo_ODirectSQLDialog()
60cdf0e10cSrcweir {
61cdf0e10cSrcweir static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::ODirectSQLDialog > aAutoRegistration;
62cdf0e10cSrcweir }
63cdf0e10cSrcweir
64cdf0e10cSrcweir //.........................................................................
65cdf0e10cSrcweir namespace dbaui
66cdf0e10cSrcweir {
67cdf0e10cSrcweir //.........................................................................
68cdf0e10cSrcweir
69cdf0e10cSrcweir using namespace ::com::sun::star::uno;
70cdf0e10cSrcweir using namespace ::com::sun::star::lang;
71cdf0e10cSrcweir using namespace ::com::sun::star::beans;
72cdf0e10cSrcweir using namespace ::com::sun::star::container;
73cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx;
74cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
75cdf0e10cSrcweir using namespace ::com::sun::star::sdb;
76cdf0e10cSrcweir
77cdf0e10cSrcweir //=====================================================================
78cdf0e10cSrcweir //= ODirectSQLDialog
79cdf0e10cSrcweir //=====================================================================
DBG_NAME(ODirectSQLDialog)80cdf0e10cSrcweir DBG_NAME(ODirectSQLDialog)
81cdf0e10cSrcweir //---------------------------------------------------------------------
82cdf0e10cSrcweir ODirectSQLDialog::ODirectSQLDialog(const Reference< XMultiServiceFactory >& _rxORB)
83cdf0e10cSrcweir :ODirectSQLDialog_BASE( _rxORB )
84cdf0e10cSrcweir {
85cdf0e10cSrcweir DBG_CTOR(ODirectSQLDialog,NULL);
86cdf0e10cSrcweir
87cdf0e10cSrcweir }
88cdf0e10cSrcweir
89cdf0e10cSrcweir //---------------------------------------------------------------------
~ODirectSQLDialog()90cdf0e10cSrcweir ODirectSQLDialog::~ODirectSQLDialog()
91cdf0e10cSrcweir {
92cdf0e10cSrcweir
93cdf0e10cSrcweir DBG_DTOR(ODirectSQLDialog,NULL);
94cdf0e10cSrcweir }
95cdf0e10cSrcweir
96cdf0e10cSrcweir //---------------------------------------------------------------------
97cdf0e10cSrcweir IMPLEMENT_IMPLEMENTATION_ID( ODirectSQLDialog )
98cdf0e10cSrcweir
99cdf0e10cSrcweir //---------------------------------------------------------------------
100cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO1_STATIC( ODirectSQLDialog, "com.sun.star.comp.sdb.DirectSQLDialog", SERVICE_SDB_DIRECTSQLDIALOG )
101cdf0e10cSrcweir
102cdf0e10cSrcweir //---------------------------------------------------------------------
IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(ODirectSQLDialog)103cdf0e10cSrcweir IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ODirectSQLDialog )
104cdf0e10cSrcweir
105cdf0e10cSrcweir //---------------------------------------------------------------------
106cdf0e10cSrcweir Dialog* ODirectSQLDialog::createDialog(Window* _pParent)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir // obtain all the objects needed for the dialog
109cdf0e10cSrcweir Reference< XConnection > xConnection = m_xActiveConnection;
110cdf0e10cSrcweir if ( !xConnection.is() )
111cdf0e10cSrcweir {
112cdf0e10cSrcweir try
113cdf0e10cSrcweir {
114cdf0e10cSrcweir // the connection the row set is working with
115cdf0e10cSrcweir ODatasourceConnector aDSConnector(m_aContext.getLegacyServiceFactory(),_pParent);
116cdf0e10cSrcweir xConnection = aDSConnector.connect( m_sInitialSelection, NULL );
117cdf0e10cSrcweir }
118cdf0e10cSrcweir catch( const Exception& )
119cdf0e10cSrcweir {
120cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
121cdf0e10cSrcweir }
122cdf0e10cSrcweir }
123cdf0e10cSrcweir if ( !xConnection.is() )
124cdf0e10cSrcweir // can't create the dialog if I have improper settings
125cdf0e10cSrcweir return NULL;
126cdf0e10cSrcweir
127cdf0e10cSrcweir return new DirectSQLDialog( _pParent, xConnection);
128cdf0e10cSrcweir }
129cdf0e10cSrcweir //---------------------------------------------------------------------
implInitialize(const Any & _rValue)130cdf0e10cSrcweir void ODirectSQLDialog::implInitialize(const Any& _rValue)
131cdf0e10cSrcweir {
132cdf0e10cSrcweir PropertyValue aProperty;
133cdf0e10cSrcweir if (_rValue >>= aProperty)
134cdf0e10cSrcweir {
135cdf0e10cSrcweir if (0 == aProperty.Name.compareToAscii("InitialSelection"))
136cdf0e10cSrcweir {
137cdf0e10cSrcweir OSL_VERIFY( aProperty.Value >>= m_sInitialSelection );
138cdf0e10cSrcweir return;
139cdf0e10cSrcweir }
140cdf0e10cSrcweir else if (0 == aProperty.Name.compareToAscii("ActiveConnection"))
141cdf0e10cSrcweir {
142cdf0e10cSrcweir m_xActiveConnection.set( aProperty.Value, UNO_QUERY );
143cdf0e10cSrcweir OSL_ENSURE( m_xActiveConnection.is(), "ODirectSQLDialog::implInitialize: invalid connection!" );
144cdf0e10cSrcweir return;
145cdf0e10cSrcweir }
146cdf0e10cSrcweir }
147cdf0e10cSrcweir ODirectSQLDialog_BASE::implInitialize(_rValue);
148cdf0e10cSrcweir }
149cdf0e10cSrcweir //.........................................................................
150cdf0e10cSrcweir } // namespace dbaui
151cdf0e10cSrcweir //.........................................................................
152cdf0e10cSrcweir
153