Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
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>
30 :
31 : using namespace dbaui;
32 :
33 12 : extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialogSetup()
34 : {
35 12 : static OMultiInstanceAutoRegistration< ODBTypeWizDialogSetup > aAutoRegistration;
36 12 : }
37 :
38 : namespace dbaui
39 : {
40 :
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;
46 :
47 0 : ODBTypeWizDialogSetup::ODBTypeWizDialogSetup(const Reference< XComponentContext >& _rxORB)
48 : :ODatabaseAdministrationDialog(_rxORB)
49 : ,m_bOpenDatabase(true)
50 0 : ,m_bStartTableWizard(false)
51 : {
52 : registerProperty(OUString("OpenDatabase"), 3, PropertyAttribute::TRANSIENT,
53 0 : &m_bOpenDatabase, cppu::UnoType<bool>::get());
54 :
55 : registerProperty(OUString("StartTableWizard"), 4, PropertyAttribute::TRANSIENT,
56 0 : &m_bStartTableWizard, cppu::UnoType<bool>::get());
57 0 : }
58 :
59 0 : Sequence<sal_Int8> SAL_CALL ODBTypeWizDialogSetup::getImplementationId( ) throw(RuntimeException, std::exception)
60 : {
61 0 : return css::uno::Sequence<sal_Int8>();
62 : }
63 :
64 0 : Reference< XInterface > SAL_CALL ODBTypeWizDialogSetup::Create(const Reference< XMultiServiceFactory >& _rxFactory)
65 : {
66 0 : Reference < XInterface > xDBWizard = *(new ODBTypeWizDialogSetup( comphelper::getComponentContext(_rxFactory) ));
67 0 : return xDBWizard;
68 : }
69 :
70 0 : OUString SAL_CALL ODBTypeWizDialogSetup::getImplementationName() throw(RuntimeException, std::exception)
71 : {
72 0 : return getImplementationName_Static();
73 : }
74 :
75 24 : OUString ODBTypeWizDialogSetup::getImplementationName_Static() throw(RuntimeException)
76 : {
77 24 : return OUString("org.openoffice.comp.dbu.ODBTypeWizDialogSetup");
78 : }
79 :
80 0 : ::comphelper::StringSequence SAL_CALL ODBTypeWizDialogSetup::getSupportedServiceNames() throw(RuntimeException, std::exception)
81 : {
82 0 : return getSupportedServiceNames_Static();
83 : }
84 :
85 12 : ::comphelper::StringSequence ODBTypeWizDialogSetup::getSupportedServiceNames_Static() throw(RuntimeException)
86 : {
87 12 : ::comphelper::StringSequence aSupported(1);
88 12 : aSupported[0] = "com.sun.star.sdb.DatabaseWizardDialog";
89 12 : return aSupported;
90 : }
91 :
92 0 : Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialogSetup::getPropertySetInfo() throw(RuntimeException, std::exception)
93 : {
94 0 : return createPropertySetInfo( getInfoHelper() );
95 : }
96 :
97 0 : ::cppu::IPropertyArrayHelper& ODBTypeWizDialogSetup::getInfoHelper()
98 : {
99 0 : return *getArrayHelper();
100 : }
101 :
102 0 : ::cppu::IPropertyArrayHelper* ODBTypeWizDialogSetup::createArrayHelper( ) const
103 : {
104 0 : Sequence< Property > aProps;
105 0 : describeProperties(aProps);
106 0 : return new ::cppu::OPropertyArrayHelper(aProps);
107 : }
108 :
109 0 : VclPtr<Dialog> ODBTypeWizDialogSetup::createDialog(vcl::Window* _pParent)
110 : {
111 0 : return VclPtr<ODbTypeWizDialogSetup>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection);
112 : }
113 :
114 0 : void ODBTypeWizDialogSetup::executedDialog(sal_Int16 _nExecutionResult)
115 : {
116 0 : if ( _nExecutionResult == RET_OK )
117 : {
118 0 : const ODbTypeWizDialogSetup* pDialog = static_cast< ODbTypeWizDialogSetup* >( m_pDialog.get() );
119 0 : m_bOpenDatabase = pDialog->IsDatabaseDocumentToBeOpened();
120 0 : m_bStartTableWizard = pDialog->IsTableWizardToBeStarted();
121 : }
122 0 : }
123 :
124 36 : } // namespace dbaui
125 :
126 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|