1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_dbui.hxx"
26 
27 #include "unoadmin.hxx"
28 #include "dbu_reghelper.hxx"
29 #include "advancedsettingsdlg.hxx"
30 
31 //.........................................................................
32 namespace dbaui
33 {
34 //.........................................................................
35 
36 	using namespace ::com::sun::star::uno;
37 	using namespace ::com::sun::star::lang;
38 	using namespace ::com::sun::star::beans;
39 
40     //=========================================================================
41     //= OAdvancedSettingsDialog
42     //=========================================================================
43     class OAdvancedSettingsDialog
44 		    :public ODatabaseAdministrationDialog
45 		    ,public ::comphelper::OPropertyArrayUsageHelper< OAdvancedSettingsDialog >
46     {
47 
48     protected:
49 	    OAdvancedSettingsDialog(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
50 
51     public:
52 	    // XTypeProvider
53         virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
54 
55 	    // XServiceInfo
56 	    virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
57 	    virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
58 
59 	    // XServiceInfo - static methods
60 	    static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
61 	    static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
62 	    static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
63 			    SAL_CALL Create(const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >&);
64 
65 	    // XPropertySet
66 	    virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo>  SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
67 	    virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
68 
69 	    // OPropertyArrayUsageHelper
70 	    virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
71     protected:
72     // OGenericUnoDialog overridables
73 	    virtual Dialog*	createDialog(Window* _pParent);
74     };
75 
76     //=========================================================================
77     //-------------------------------------------------------------------------
OAdvancedSettingsDialog(const Reference<XMultiServiceFactory> & _rxORB)78     OAdvancedSettingsDialog::OAdvancedSettingsDialog(const Reference< XMultiServiceFactory >& _rxORB)
79 	    :ODatabaseAdministrationDialog(_rxORB)
80     {
81     }
82     //-------------------------------------------------------------------------
getImplementationId()83     Sequence<sal_Int8> SAL_CALL OAdvancedSettingsDialog::getImplementationId(  ) throw(RuntimeException)
84     {
85 	    static ::cppu::OImplementationId aId;
86 	    return aId.getImplementationId();
87     }
88 
89     //-------------------------------------------------------------------------
Create(const Reference<XMultiServiceFactory> & _rxFactory)90     Reference< XInterface > SAL_CALL OAdvancedSettingsDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
91     {
92 	    return *(new OAdvancedSettingsDialog(_rxFactory));
93     }
94 
95     //-------------------------------------------------------------------------
getImplementationName()96     ::rtl::OUString SAL_CALL OAdvancedSettingsDialog::getImplementationName() throw(RuntimeException)
97     {
98 	    return getImplementationName_Static();
99     }
100 
101     //-------------------------------------------------------------------------
getImplementationName_Static()102     ::rtl::OUString OAdvancedSettingsDialog::getImplementationName_Static() throw(RuntimeException)
103     {
104 	    return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbu.OAdvancedSettingsDialog"));
105     }
106 
107     //-------------------------------------------------------------------------
getSupportedServiceNames()108     ::comphelper::StringSequence SAL_CALL OAdvancedSettingsDialog::getSupportedServiceNames() throw(RuntimeException)
109     {
110 	    return getSupportedServiceNames_Static();
111     }
112 
113     //-------------------------------------------------------------------------
getSupportedServiceNames_Static()114     ::comphelper::StringSequence OAdvancedSettingsDialog::getSupportedServiceNames_Static() throw(RuntimeException)
115     {
116 	    ::comphelper::StringSequence aSupported(1);
117 	    aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.AdvancedDatabaseSettingsDialog"));
118 	    return aSupported;
119     }
120 
121     //-------------------------------------------------------------------------
getPropertySetInfo()122     Reference<XPropertySetInfo>  SAL_CALL OAdvancedSettingsDialog::getPropertySetInfo() throw(RuntimeException)
123     {
124 	    Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) );
125 	    return xInfo;
126     }
127 
128     //-------------------------------------------------------------------------
getInfoHelper()129     ::cppu::IPropertyArrayHelper& OAdvancedSettingsDialog::getInfoHelper()
130     {
131 	    return *const_cast<OAdvancedSettingsDialog*>(this)->getArrayHelper();
132     }
133 
134     //------------------------------------------------------------------------------
createArrayHelper() const135     ::cppu::IPropertyArrayHelper* OAdvancedSettingsDialog::createArrayHelper( ) const
136     {
137 	    Sequence< Property > aProps;
138 	    describeProperties(aProps);
139 	    return new ::cppu::OPropertyArrayHelper(aProps);
140     }
141     //------------------------------------------------------------------------------
createDialog(Window * _pParent)142     Dialog*	OAdvancedSettingsDialog::createDialog(Window* _pParent)
143     {
144 	    AdvancedSettingsDialog* pDlg = new AdvancedSettingsDialog(_pParent, m_pDatasourceItems, m_aContext.getLegacyServiceFactory(),m_aInitialSelection);
145 	    return pDlg;
146     }
147 
148 //.........................................................................
149 }	// namespace dbaui
150 //.........................................................................
151 
createRegistryInfo_OAdvancedSettingsDialog()152 extern "C" void SAL_CALL createRegistryInfo_OAdvancedSettingsDialog()
153 {
154     static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OAdvancedSettingsDialog > aAutoRegistration;
155 }
156