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 :
21 : #include "dbu_reghelper.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 4 : extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialogSetup()
34 : {
35 4 : static OMultiInstanceAutoRegistration< ODBTypeWizDialogSetup > aAutoRegistration;
36 4 : }
37 :
38 : //.........................................................................
39 : namespace dbaui
40 : {
41 : //.........................................................................
42 :
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::sdb;
47 : using namespace ::com::sun::star::sdbc;
48 :
49 : //=========================================================================
50 : //-------------------------------------------------------------------------
51 0 : ODBTypeWizDialogSetup::ODBTypeWizDialogSetup(const Reference< XComponentContext >& _rxORB)
52 : :ODatabaseAdministrationDialog(_rxORB)
53 : ,m_bOpenDatabase(sal_True)
54 0 : ,m_bStartTableWizard(sal_False)
55 : {
56 : registerProperty(OUString("OpenDatabase"), 3, PropertyAttribute::TRANSIENT,
57 0 : &m_bOpenDatabase, getBooleanCppuType());
58 :
59 : registerProperty(OUString("StartTableWizard"), 4, PropertyAttribute::TRANSIENT,
60 0 : &m_bStartTableWizard, getBooleanCppuType());
61 0 : }
62 : //-------------------------------------------------------------------------
63 0 : Sequence<sal_Int8> SAL_CALL ODBTypeWizDialogSetup::getImplementationId( ) throw(RuntimeException)
64 : {
65 0 : static ::cppu::OImplementationId aId;
66 0 : return aId.getImplementationId();
67 : }
68 :
69 : //-------------------------------------------------------------------------
70 0 : Reference< XInterface > SAL_CALL ODBTypeWizDialogSetup::Create(const Reference< XMultiServiceFactory >& _rxFactory)
71 : {
72 0 : Reference < XInterface > xDBWizard = *(new ODBTypeWizDialogSetup( comphelper::getComponentContext(_rxFactory) ));
73 0 : return xDBWizard;
74 : }
75 :
76 : //-------------------------------------------------------------------------
77 0 : OUString SAL_CALL ODBTypeWizDialogSetup::getImplementationName() throw(RuntimeException)
78 : {
79 0 : return getImplementationName_Static();
80 : }
81 :
82 : //-------------------------------------------------------------------------
83 8 : OUString ODBTypeWizDialogSetup::getImplementationName_Static() throw(RuntimeException)
84 : {
85 8 : return OUString("org.openoffice.comp.dbu.ODBTypeWizDialogSetup");
86 : }
87 :
88 : //-------------------------------------------------------------------------
89 0 : ::comphelper::StringSequence SAL_CALL ODBTypeWizDialogSetup::getSupportedServiceNames() throw(RuntimeException)
90 : {
91 0 : return getSupportedServiceNames_Static();
92 : }
93 :
94 : //-------------------------------------------------------------------------
95 4 : ::comphelper::StringSequence ODBTypeWizDialogSetup::getSupportedServiceNames_Static() throw(RuntimeException)
96 : {
97 4 : ::comphelper::StringSequence aSupported(1);
98 4 : aSupported.getArray()[0] = OUString("com.sun.star.sdb.DatabaseWizardDialog");
99 4 : return aSupported;
100 : }
101 :
102 : //-------------------------------------------------------------------------
103 0 : Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialogSetup::getPropertySetInfo() throw(RuntimeException)
104 : {
105 0 : return createPropertySetInfo( getInfoHelper() );
106 : }
107 :
108 : //-------------------------------------------------------------------------
109 0 : ::cppu::IPropertyArrayHelper& ODBTypeWizDialogSetup::getInfoHelper()
110 : {
111 0 : return *const_cast<ODBTypeWizDialogSetup*>(this)->getArrayHelper();
112 : }
113 :
114 : //------------------------------------------------------------------------------
115 0 : ::cppu::IPropertyArrayHelper* ODBTypeWizDialogSetup::createArrayHelper( ) const
116 : {
117 0 : Sequence< Property > aProps;
118 0 : describeProperties(aProps);
119 0 : return new ::cppu::OPropertyArrayHelper(aProps);
120 : }
121 : //------------------------------------------------------------------------------
122 0 : Dialog* ODBTypeWizDialogSetup::createDialog(Window* _pParent)
123 : {
124 0 : return new ODbTypeWizDialogSetup(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection);
125 : }
126 : // -----------------------------------------------------------------------------
127 0 : void ODBTypeWizDialogSetup::executedDialog(sal_Int16 _nExecutionResult)
128 : {
129 0 : if ( _nExecutionResult == RET_OK )
130 : {
131 0 : const ODbTypeWizDialogSetup* pDialog = static_cast< ODbTypeWizDialogSetup* >( m_pDialog );
132 0 : m_bOpenDatabase = pDialog->IsDatabaseDocumentToBeOpened();
133 0 : m_bStartTableWizard = pDialog->IsTableWizardToBeStarted();
134 : }
135 0 : }
136 :
137 : //.........................................................................
138 12 : } // namespace dbaui
139 : //.........................................................................
140 :
141 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|