1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "dbu_reghelper.hxx"
31 #include <com/sun/star/document/XEventListener.hpp>
32 #include <com/sun/star/container/XSet.hpp>
33 #include "DBTypeWizDlgSetup.hxx"
34 #include "dbwizsetup.hxx"
35 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
36 #include <com/sun/star/sdbc/XDataSource.hpp>
37 #include <vcl/msgbox.hxx>
39 using namespace dbaui
;
41 extern "C" void SAL_CALL
createRegistryInfo_ODBTypeWizDialogSetup()
43 static OMultiInstanceAutoRegistration
< ODBTypeWizDialogSetup
> aAutoRegistration
;
46 //.........................................................................
49 //.........................................................................
51 using namespace ::com::sun::star::uno
;
52 using namespace ::com::sun::star::lang
;
53 using namespace ::com::sun::star::beans
;
54 using namespace ::com::sun::star::sdb
;
55 using namespace ::com::sun::star::sdbc
;
57 //=========================================================================
58 //-------------------------------------------------------------------------
59 ODBTypeWizDialogSetup::ODBTypeWizDialogSetup(const Reference
< XMultiServiceFactory
>& _rxORB
)
60 :ODatabaseAdministrationDialog(_rxORB
)
61 ,m_bOpenDatabase(sal_True
)
62 ,m_bStartTableWizard(sal_False
)
64 registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenDatabase")), 3, PropertyAttribute::TRANSIENT
,
65 &m_bOpenDatabase
, getBooleanCppuType());
67 registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartTableWizard")), 4, PropertyAttribute::TRANSIENT
,
68 &m_bStartTableWizard
, getBooleanCppuType());
70 //-------------------------------------------------------------------------
71 Sequence
<sal_Int8
> SAL_CALL
ODBTypeWizDialogSetup::getImplementationId( ) throw(RuntimeException
)
73 static ::cppu::OImplementationId aId
;
74 return aId
.getImplementationId();
77 //-------------------------------------------------------------------------
78 Reference
< XInterface
> SAL_CALL
ODBTypeWizDialogSetup::Create(const Reference
< XMultiServiceFactory
>& _rxFactory
)
80 Reference
< XInterface
> xDBWizard
= *(new ODBTypeWizDialogSetup(_rxFactory
));
84 //-------------------------------------------------------------------------
85 ::rtl::OUString SAL_CALL
ODBTypeWizDialogSetup::getImplementationName() throw(RuntimeException
)
87 return getImplementationName_Static();
90 //-------------------------------------------------------------------------
91 ::rtl::OUString
ODBTypeWizDialogSetup::getImplementationName_Static() throw(RuntimeException
)
93 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbu.ODBTypeWizDialogSetup"));
96 //-------------------------------------------------------------------------
97 ::comphelper::StringSequence SAL_CALL
ODBTypeWizDialogSetup::getSupportedServiceNames() throw(RuntimeException
)
99 return getSupportedServiceNames_Static();
102 //-------------------------------------------------------------------------
103 ::comphelper::StringSequence
ODBTypeWizDialogSetup::getSupportedServiceNames_Static() throw(RuntimeException
)
105 ::comphelper::StringSequence
aSupported(1);
106 aSupported
.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseWizardDialog"));
110 //-------------------------------------------------------------------------
111 Reference
<XPropertySetInfo
> SAL_CALL
ODBTypeWizDialogSetup::getPropertySetInfo() throw(RuntimeException
)
113 return createPropertySetInfo( getInfoHelper() );
116 //-------------------------------------------------------------------------
117 ::cppu::IPropertyArrayHelper
& ODBTypeWizDialogSetup::getInfoHelper()
119 return *const_cast<ODBTypeWizDialogSetup
*>(this)->getArrayHelper();
122 //------------------------------------------------------------------------------
123 ::cppu::IPropertyArrayHelper
* ODBTypeWizDialogSetup::createArrayHelper( ) const
125 Sequence
< Property
> aProps
;
126 describeProperties(aProps
);
127 return new ::cppu::OPropertyArrayHelper(aProps
);
129 //------------------------------------------------------------------------------
130 Dialog
* ODBTypeWizDialogSetup::createDialog(Window
* _pParent
)
132 return new ODbTypeWizDialogSetup(_pParent
, m_pDatasourceItems
, m_aContext
.getLegacyServiceFactory(), m_aInitialSelection
);
134 // -----------------------------------------------------------------------------
135 void ODBTypeWizDialogSetup::executedDialog(sal_Int16 _nExecutionResult
)
137 if ( _nExecutionResult
== RET_OK
)
139 const ODbTypeWizDialogSetup
* pDialog
= static_cast< ODbTypeWizDialogSetup
* >( m_pDialog
);
140 m_bOpenDatabase
= pDialog
->IsDatabaseDocumentToBeOpened();
141 m_bStartTableWizard
= pDialog
->IsTableWizardToBeStarted();
145 //.........................................................................
147 //.........................................................................
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */