1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_dbaccess.hxx"
30 
31 #include "unoadmin.hxx"
32 #include "dbu_reghelper.hxx"
33 #include "advancedsettingsdlg.hxx"
34 
35 //.........................................................................
36 namespace dbaui
37 {
38 //.........................................................................
39 
40 	using namespace ::com::sun::star::uno;
41 	using namespace ::com::sun::star::lang;
42 	using namespace ::com::sun::star::beans;
43 
44     //=========================================================================
45     //= OAdvancedSettingsDialog
46     //=========================================================================
47     class OAdvancedSettingsDialog
48 		    :public ODatabaseAdministrationDialog
49 		    ,public ::comphelper::OPropertyArrayUsageHelper< OAdvancedSettingsDialog >
50     {
51 
52     protected:
53 	    OAdvancedSettingsDialog(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
54 
55     public:
56 	    // XTypeProvider
57         virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
58 
59 	    // XServiceInfo
60 	    virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
61 	    virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
62 
63 	    // XServiceInfo - static methods
64 	    static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
65 	    static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
66 	    static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
67 			    SAL_CALL Create(const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >&);
68 
69 	    // XPropertySet
70 	    virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo>  SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
71 	    virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
72 
73 	    // OPropertyArrayUsageHelper
74 	    virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
75     protected:
76     // OGenericUnoDialog overridables
77 	    virtual Dialog*	createDialog(Window* _pParent);
78     };
79 
80     //=========================================================================
81     //-------------------------------------------------------------------------
82     OAdvancedSettingsDialog::OAdvancedSettingsDialog(const Reference< XMultiServiceFactory >& _rxORB)
83 	    :ODatabaseAdministrationDialog(_rxORB)
84     {
85     }
86     //-------------------------------------------------------------------------
87     Sequence<sal_Int8> SAL_CALL OAdvancedSettingsDialog::getImplementationId(  ) throw(RuntimeException)
88     {
89 	    static ::cppu::OImplementationId aId;
90 	    return aId.getImplementationId();
91     }
92 
93     //-------------------------------------------------------------------------
94     Reference< XInterface > SAL_CALL OAdvancedSettingsDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
95     {
96 	    return *(new OAdvancedSettingsDialog(_rxFactory));
97     }
98 
99     //-------------------------------------------------------------------------
100     ::rtl::OUString SAL_CALL OAdvancedSettingsDialog::getImplementationName() throw(RuntimeException)
101     {
102 	    return getImplementationName_Static();
103     }
104 
105     //-------------------------------------------------------------------------
106     ::rtl::OUString OAdvancedSettingsDialog::getImplementationName_Static() throw(RuntimeException)
107     {
108 	    return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbu.OAdvancedSettingsDialog"));
109     }
110 
111     //-------------------------------------------------------------------------
112     ::comphelper::StringSequence SAL_CALL OAdvancedSettingsDialog::getSupportedServiceNames() throw(RuntimeException)
113     {
114 	    return getSupportedServiceNames_Static();
115     }
116 
117     //-------------------------------------------------------------------------
118     ::comphelper::StringSequence OAdvancedSettingsDialog::getSupportedServiceNames_Static() throw(RuntimeException)
119     {
120 	    ::comphelper::StringSequence aSupported(1);
121 	    aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.AdvancedDatabaseSettingsDialog"));
122 	    return aSupported;
123     }
124 
125     //-------------------------------------------------------------------------
126     Reference<XPropertySetInfo>  SAL_CALL OAdvancedSettingsDialog::getPropertySetInfo() throw(RuntimeException)
127     {
128 	    Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) );
129 	    return xInfo;
130     }
131 
132     //-------------------------------------------------------------------------
133     ::cppu::IPropertyArrayHelper& OAdvancedSettingsDialog::getInfoHelper()
134     {
135 	    return *const_cast<OAdvancedSettingsDialog*>(this)->getArrayHelper();
136     }
137 
138     //------------------------------------------------------------------------------
139     ::cppu::IPropertyArrayHelper* OAdvancedSettingsDialog::createArrayHelper( ) const
140     {
141 	    Sequence< Property > aProps;
142 	    describeProperties(aProps);
143 	    return new ::cppu::OPropertyArrayHelper(aProps);
144     }
145     //------------------------------------------------------------------------------
146     Dialog*	OAdvancedSettingsDialog::createDialog(Window* _pParent)
147     {
148 	    AdvancedSettingsDialog* pDlg = new AdvancedSettingsDialog(_pParent, m_pDatasourceItems, m_aContext.getLegacyServiceFactory(),m_aInitialSelection);
149 	    return pDlg;
150     }
151 
152 //.........................................................................
153 }	// namespace dbaui
154 //.........................................................................
155 
156 extern "C" void SAL_CALL createRegistryInfo_OAdvancedSettingsDialog()
157 {
158     static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OAdvancedSettingsDialog > aAutoRegistration;
159 }
160