fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / ui / uno / unoDirectSql.cxx
blob94b57f10f0905bc350b11bf9731f136b5cd69412
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include "uiservices.hxx"
23 #include "unoDirectSql.hxx"
24 #include "dbu_reghelper.hxx"
25 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
26 #include <com/sun/star/container/XNameAccess.hpp>
27 #include <com/sun/star/connection/XConnection.hpp>
28 #include <com/sun/star/container/XNamed.hpp>
29 #include "directsql.hxx"
30 #include "dbustrings.hrc"
31 #include "datasourceconnector.hxx"
32 #include <tools/diagnose_ex.h>
33 #include <comphelper/processfactory.hxx>
35 extern "C" void SAL_CALL createRegistryInfo_ODirectSQLDialog()
37 static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::ODirectSQLDialog > aAutoRegistration;
40 namespace dbaui
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;
51 // ODirectSQLDialog
52 ODirectSQLDialog::ODirectSQLDialog(const Reference< XComponentContext >& _rxORB)
53 :ODirectSQLDialog_BASE( _rxORB )
58 ODirectSQLDialog::~ODirectSQLDialog()
63 css::uno::Sequence<sal_Int8> ODirectSQLDialog::getImplementationId()
64 throw (css::uno::RuntimeException, std::exception)
66 return css::uno::Sequence<sal_Int8>();
69 IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(ODirectSQLDialog, "com.sun.star.comp.sdb.DirectSQLDialog")
70 IMPLEMENT_SERVICE_INFO_SUPPORTS(ODirectSQLDialog)
71 IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(ODirectSQLDialog, SERVICE_SDB_DIRECTSQLDIALOG)
73 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
74 SAL_CALL ODirectSQLDialog::Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB)
76 return static_cast< XServiceInfo* >(new ODirectSQLDialog( comphelper::getComponentContext(_rxORB)));
79 IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ODirectSQLDialog )
81 VclPtr<Dialog> ODirectSQLDialog::createDialog(vcl::Window* _pParent)
83 // obtain all the objects needed for the dialog
84 Reference< XConnection > xConnection = m_xActiveConnection;
85 if ( !xConnection.is() )
87 try
89 // the connection the row set is working with
90 ODatasourceConnector aDSConnector(m_aContext, _pParent);
91 xConnection = aDSConnector.connect( m_sInitialSelection, NULL );
93 catch( const Exception& )
95 DBG_UNHANDLED_EXCEPTION();
98 if ( !xConnection.is() )
99 // can't create the dialog if I have improper settings
100 return NULL;
102 return VclPtr<DirectSQLDialog>::Create( _pParent, xConnection );
104 void ODirectSQLDialog::implInitialize(const Any& _rValue)
106 PropertyValue aProperty;
107 if (_rValue >>= aProperty)
109 if (aProperty.Name == "InitialSelection")
111 OSL_VERIFY( aProperty.Value >>= m_sInitialSelection );
112 return;
114 else if (aProperty.Name == "ActiveConnection")
116 m_xActiveConnection.set( aProperty.Value, UNO_QUERY );
117 OSL_ENSURE( m_xActiveConnection.is(), "ODirectSQLDialog::implInitialize: invalid connection!" );
118 return;
121 ODirectSQLDialog_BASE::implInitialize(_rValue);
123 } // namespace dbaui
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */