1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DBTypeWizDlgSetup.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #ifndef _DBU_REGHELPER_HXX_
35 #include "dbu_reghelper.hxx"
37 #ifndef _COM_SUN_STAR_DOCUMENT_XEVENTLISTENER_HPP_
38 #include <com/sun/star/document/XEventListener.hpp>
40 #ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
41 #include <com/sun/star/container/XSet.hpp>
43 #ifndef DBAUI_DBTYPEWIZDLGSETUP_HXX
44 #include "DBTypeWizDlgSetup.hxx"
46 #ifndef DBAUI_DBWIZSETUP_HXX
47 #include "dbwizsetup.hxx"
49 #ifndef _COM_SUN_STAR_SDB_XOFFICEDATABASEDOCUMENT_HPP_
50 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
52 #ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_
53 #include <com/sun/star/sdbc/XDataSource.hpp>
55 #ifndef _SV_MSGBOX_HXX
56 #include <vcl/msgbox.hxx>
59 using namespace dbaui
;
60 namespace css
= ::com::sun::star
;
62 extern "C" void SAL_CALL
createRegistryInfo_ODBTypeWizDialogSetup()
64 static OMultiInstanceAutoRegistration
< ODBTypeWizDialogSetup
> aAutoRegistration
;
67 //.........................................................................
70 //.........................................................................
72 using namespace ::com::sun::star::uno
;
73 using namespace ::com::sun::star::lang
;
74 using namespace ::com::sun::star::beans
;
75 using namespace ::com::sun::star::sdb
;
76 using namespace ::com::sun::star::sdbc
;
78 //=========================================================================
79 //-------------------------------------------------------------------------
80 ODBTypeWizDialogSetup::ODBTypeWizDialogSetup(const Reference
< XMultiServiceFactory
>& _rxORB
)
81 :ODatabaseAdministrationDialog(_rxORB
)
82 ,m_bOpenDatabase(sal_True
)
83 ,m_bStartTableWizard(sal_False
)
85 registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenDatabase")), 3, PropertyAttribute::TRANSIENT
,
86 &m_bOpenDatabase
, getBooleanCppuType());
88 registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartTableWizard")), 4, PropertyAttribute::TRANSIENT
,
89 &m_bStartTableWizard
, getBooleanCppuType());
91 //-------------------------------------------------------------------------
92 Sequence
<sal_Int8
> SAL_CALL
ODBTypeWizDialogSetup::getImplementationId( ) throw(RuntimeException
)
94 static ::cppu::OImplementationId aId
;
95 return aId
.getImplementationId();
98 //-------------------------------------------------------------------------
99 Reference
< XInterface
> SAL_CALL
ODBTypeWizDialogSetup::Create(const Reference
< XMultiServiceFactory
>& _rxFactory
)
101 Reference
< XInterface
> xDBWizard
= *(new ODBTypeWizDialogSetup(_rxFactory
));
105 //-------------------------------------------------------------------------
106 ::rtl::OUString SAL_CALL
ODBTypeWizDialogSetup::getImplementationName() throw(RuntimeException
)
108 return getImplementationName_Static();
111 //-------------------------------------------------------------------------
112 ::rtl::OUString
ODBTypeWizDialogSetup::getImplementationName_Static() throw(RuntimeException
)
114 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbu.ODBTypeWizDialogSetup"));
117 //-------------------------------------------------------------------------
118 ::comphelper::StringSequence SAL_CALL
ODBTypeWizDialogSetup::getSupportedServiceNames() throw(RuntimeException
)
120 return getSupportedServiceNames_Static();
123 //-------------------------------------------------------------------------
124 ::comphelper::StringSequence
ODBTypeWizDialogSetup::getSupportedServiceNames_Static() throw(RuntimeException
)
126 ::comphelper::StringSequence
aSupported(1);
127 aSupported
.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseWizardDialog"));
131 //-------------------------------------------------------------------------
132 Reference
<XPropertySetInfo
> SAL_CALL
ODBTypeWizDialogSetup::getPropertySetInfo() throw(RuntimeException
)
134 return createPropertySetInfo( getInfoHelper() );
137 //-------------------------------------------------------------------------
138 ::cppu::IPropertyArrayHelper
& ODBTypeWizDialogSetup::getInfoHelper()
140 return *const_cast<ODBTypeWizDialogSetup
*>(this)->getArrayHelper();
143 //------------------------------------------------------------------------------
144 ::cppu::IPropertyArrayHelper
* ODBTypeWizDialogSetup::createArrayHelper( ) const
146 Sequence
< Property
> aProps
;
147 describeProperties(aProps
);
148 return new ::cppu::OPropertyArrayHelper(aProps
);
150 //------------------------------------------------------------------------------
151 Dialog
* ODBTypeWizDialogSetup::createDialog(Window
* _pParent
)
153 return new ODbTypeWizDialogSetup(_pParent
, m_pDatasourceItems
, m_aContext
.getLegacyServiceFactory(), m_aInitialSelection
);
155 // -----------------------------------------------------------------------------
156 void ODBTypeWizDialogSetup::executedDialog(sal_Int16 _nExecutionResult
)
158 if ( _nExecutionResult
== RET_OK
)
160 const ODbTypeWizDialogSetup
* pDialog
= static_cast< ODbTypeWizDialogSetup
* >( m_pDialog
);
161 m_bOpenDatabase
= pDialog
->IsDatabaseDocumentToBeOpened();
162 m_bStartTableWizard
= pDialog
->IsTableWizardToBeStarted();
166 //.........................................................................
168 //.........................................................................