1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "dbu_reghelper.hxx"
21 #include "uiservices.hxx"
22 #include <com/sun/star/document/XEventListener.hpp>
23 #include <com/sun/star/container/XSet.hpp>
24 #include "DBTypeWizDlgSetup.hxx"
25 #include "dbwizsetup.hxx"
26 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
27 #include <com/sun/star/sdbc/XDataSource.hpp>
28 #include <vcl/msgbox.hxx>
29 #include <comphelper/processfactory.hxx>
31 using namespace dbaui
;
33 extern "C" void SAL_CALL
createRegistryInfo_ODBTypeWizDialogSetup()
35 static OMultiInstanceAutoRegistration
< ODBTypeWizDialogSetup
> aAutoRegistration
;
41 using namespace ::com::sun::star::uno
;
42 using namespace ::com::sun::star::lang
;
43 using namespace ::com::sun::star::beans
;
44 using namespace ::com::sun::star::sdb
;
45 using namespace ::com::sun::star::sdbc
;
47 ODBTypeWizDialogSetup::ODBTypeWizDialogSetup(const Reference
< XComponentContext
>& _rxORB
)
48 :ODatabaseAdministrationDialog(_rxORB
)
49 ,m_bOpenDatabase(true)
50 ,m_bStartTableWizard(false)
52 registerProperty(OUString("OpenDatabase"), 3, PropertyAttribute::TRANSIENT
,
53 &m_bOpenDatabase
, cppu::UnoType
<bool>::get());
55 registerProperty(OUString("StartTableWizard"), 4, PropertyAttribute::TRANSIENT
,
56 &m_bStartTableWizard
, cppu::UnoType
<bool>::get());
59 Sequence
<sal_Int8
> SAL_CALL
ODBTypeWizDialogSetup::getImplementationId( ) throw(RuntimeException
, std::exception
)
61 return css::uno::Sequence
<sal_Int8
>();
64 Reference
< XInterface
> SAL_CALL
ODBTypeWizDialogSetup::Create(const Reference
< XMultiServiceFactory
>& _rxFactory
)
66 Reference
< XInterface
> xDBWizard
= *(new ODBTypeWizDialogSetup( comphelper::getComponentContext(_rxFactory
) ));
70 OUString SAL_CALL
ODBTypeWizDialogSetup::getImplementationName() throw(RuntimeException
, std::exception
)
72 return getImplementationName_Static();
75 OUString
ODBTypeWizDialogSetup::getImplementationName_Static() throw(RuntimeException
)
77 return OUString("org.openoffice.comp.dbu.ODBTypeWizDialogSetup");
80 ::comphelper::StringSequence SAL_CALL
ODBTypeWizDialogSetup::getSupportedServiceNames() throw(RuntimeException
, std::exception
)
82 return getSupportedServiceNames_Static();
85 ::comphelper::StringSequence
ODBTypeWizDialogSetup::getSupportedServiceNames_Static() throw(RuntimeException
)
87 ::comphelper::StringSequence
aSupported(1);
88 aSupported
[0] = "com.sun.star.sdb.DatabaseWizardDialog";
92 Reference
<XPropertySetInfo
> SAL_CALL
ODBTypeWizDialogSetup::getPropertySetInfo() throw(RuntimeException
, std::exception
)
94 return createPropertySetInfo( getInfoHelper() );
97 ::cppu::IPropertyArrayHelper
& ODBTypeWizDialogSetup::getInfoHelper()
99 return *getArrayHelper();
102 ::cppu::IPropertyArrayHelper
* ODBTypeWizDialogSetup::createArrayHelper( ) const
104 Sequence
< Property
> aProps
;
105 describeProperties(aProps
);
106 return new ::cppu::OPropertyArrayHelper(aProps
);
109 VclPtr
<Dialog
> ODBTypeWizDialogSetup::createDialog(vcl::Window
* _pParent
)
111 return VclPtr
<ODbTypeWizDialogSetup
>::Create(_pParent
, m_pDatasourceItems
, m_aContext
, m_aInitialSelection
);
114 void ODBTypeWizDialogSetup::executedDialog(sal_Int16 _nExecutionResult
)
116 if ( _nExecutionResult
== RET_OK
)
118 const ODbTypeWizDialogSetup
* pDialog
= static_cast< ODbTypeWizDialogSetup
* >( m_pDialog
.get() );
119 m_bOpenDatabase
= pDialog
->IsDatabaseDocumentToBeOpened();
120 m_bStartTableWizard
= pDialog
->IsTableWizardToBeStarted();
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */