fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / ui / uno / textconnectionsettings_uno.cxx
blob9744b5af026b25f94097cd23fa23474c2d457cd9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "textconnectionsettings.hxx"
21 #include "uiservices.hxx"
22 #include "dbu_reghelper.hxx"
23 #include "moduledbu.hxx"
24 #include "apitools.hxx"
25 #include "unoadmin.hxx"
26 #include "dbustrings.hrc"
27 #include "propertystorage.hxx"
29 #include <com/sun/star/beans/XPropertySetInfo.hpp>
30 #include <com/sun/star/beans/PropertyAttribute.hpp>
31 #include <com/sun/star/sdb/XTextConnectionSettings.hpp>
33 #include <comphelper/processfactory.hxx>
34 #include <svtools/genericunodialog.hxx>
35 #include <cppuhelper/implbase1.hxx>
37 namespace dbaui
40 using ::com::sun::star::uno::Reference;
41 using ::com::sun::star::uno::XInterface;
42 using ::com::sun::star::uno::UNO_QUERY;
43 using ::com::sun::star::uno::UNO_QUERY_THROW;
44 using ::com::sun::star::uno::Exception;
45 using ::com::sun::star::uno::RuntimeException;
46 using ::com::sun::star::uno::Any;
47 using ::com::sun::star::uno::makeAny;
48 using ::com::sun::star::uno::XComponentContext;
49 using ::com::sun::star::beans::XPropertySetInfo;
50 using ::com::sun::star::uno::Sequence;
51 using ::com::sun::star::beans::Property;
52 using ::com::sun::star::lang::IllegalArgumentException;
54 namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
56 // OTextConnectionSettingsDialog
58 class OTextConnectionSettingsDialog;
59 typedef ::cppu::ImplInheritanceHelper1 < ODatabaseAdministrationDialog
60 , ::com::sun::star::sdb::XTextConnectionSettings
61 > OTextConnectionSettingsDialog_BASE;
62 typedef ::comphelper::OPropertyArrayUsageHelper< OTextConnectionSettingsDialog > OTextConnectionSettingsDialog_PBASE;
64 class OTextConnectionSettingsDialog
65 :public OTextConnectionSettingsDialog_BASE
66 ,public OTextConnectionSettingsDialog_PBASE
67 ,public ::cppu::WeakImplHelper1< com::sun::star::sdb::XTextConnectionSettings >
69 OModuleClient m_aModuleClient;
70 PropertyValues m_aPropertyValues;
72 protected:
73 OTextConnectionSettingsDialog( const Reference<XComponentContext>& _rContext );
74 virtual ~OTextConnectionSettingsDialog();
76 public:
77 virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId()
78 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 DECLARE_SERVICE_INFO_STATIC( );
81 DECLARE_PROPERTYCONTAINER_DEFAULTS( );
83 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw(Exception, std::exception) SAL_OVERRIDE;
84 virtual sal_Bool SAL_CALL convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue) throw(IllegalArgumentException) SAL_OVERRIDE;
85 virtual void SAL_CALL getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
87 // Overrides to resolve inheritance ambiguity
88 virtual void SAL_CALL setPropertyValue(const OUString& p1, const css::uno::Any& p2) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
89 { ODatabaseAdministrationDialog::setPropertyValue(p1, p2); }
90 virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
91 { return ODatabaseAdministrationDialog::getPropertyValue(p1); }
92 virtual void SAL_CALL addPropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
93 { ODatabaseAdministrationDialog::addPropertyChangeListener(p1, p2); }
94 virtual void SAL_CALL removePropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
95 { ODatabaseAdministrationDialog::removePropertyChangeListener(p1, p2); }
96 virtual void SAL_CALL addVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
97 { ODatabaseAdministrationDialog::addVetoableChangeListener(p1, p2); }
98 virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
99 { ODatabaseAdministrationDialog::removeVetoableChangeListener(p1, p2); }
100 virtual void SAL_CALL setTitle(const OUString& p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
101 { ODatabaseAdministrationDialog::setTitle(p1); }
102 virtual sal_Int16 SAL_CALL execute() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
103 { return ODatabaseAdministrationDialog::execute(); }
105 protected:
106 // OGenericUnoDialog overridables
107 virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
108 virtual void implInitialize( const com::sun::star::uno::Any& _rValue ) SAL_OVERRIDE;
109 protected:
110 using OTextConnectionSettingsDialog_BASE::getFastPropertyValue;
113 // OTextConnectionSettingsDialog
114 OTextConnectionSettingsDialog::OTextConnectionSettingsDialog( const Reference<XComponentContext>& _rContext )
115 :OTextConnectionSettingsDialog_BASE( _rContext )
117 TextConnectionSettingsDialog::bindItemStorages( *m_pDatasourceItems, m_aPropertyValues );
120 OTextConnectionSettingsDialog::~OTextConnectionSettingsDialog()
124 css::uno::Sequence<sal_Int8>
125 OTextConnectionSettingsDialog::getImplementationId()
126 throw (css::uno::RuntimeException, std::exception)
128 return css::uno::Sequence<sal_Int8>();
131 IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(OTextConnectionSettingsDialog, "com.sun.star.comp.dbaccess.OTextConnectionSettingsDialog")
132 IMPLEMENT_SERVICE_INFO_SUPPORTS(OTextConnectionSettingsDialog)
133 IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(OTextConnectionSettingsDialog, "com.sun.star.sdb.TextConnectionSettings")
135 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
136 SAL_CALL OTextConnectionSettingsDialog::Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB)
138 return static_cast< XServiceInfo* >(new OTextConnectionSettingsDialog( comphelper::getComponentContext(_rxORB)));
141 Reference< XPropertySetInfo > SAL_CALL OTextConnectionSettingsDialog::getPropertySetInfo() throw(RuntimeException, std::exception)
143 return createPropertySetInfo( getInfoHelper() );
146 ::cppu::IPropertyArrayHelper& OTextConnectionSettingsDialog::getInfoHelper()
148 return *getArrayHelper();
151 ::cppu::IPropertyArrayHelper* OTextConnectionSettingsDialog::createArrayHelper( ) const
153 Sequence< Property > aProps;
154 describeProperties( aProps );
156 // in addition to the properties registered by the base class, we have
157 // more properties which are not even handled by the PropertyContainer implementation,
158 // but whose values are stored in our item set
159 sal_Int32 nProp = aProps.getLength();
160 aProps.realloc( nProp + 6 );
162 aProps[ nProp++ ] = Property(
163 OUString( "HeaderLine" ),
164 PROPERTY_ID_HEADER_LINE,
165 ::cppu::UnoType< sal_Bool >::get(),
166 PropertyAttribute::TRANSIENT
169 aProps[ nProp++ ] = Property(
170 OUString( "FieldDelimiter" ),
171 PROPERTY_ID_FIELD_DELIMITER,
172 ::cppu::UnoType< OUString >::get(),
173 PropertyAttribute::TRANSIENT
176 aProps[ nProp++ ] = Property(
177 OUString( "StringDelimiter" ),
178 PROPERTY_ID_STRING_DELIMITER,
179 ::cppu::UnoType< OUString >::get(),
180 PropertyAttribute::TRANSIENT
183 aProps[ nProp++ ] = Property(
184 OUString( "DecimalDelimiter" ),
185 PROPERTY_ID_DECIMAL_DELIMITER,
186 ::cppu::UnoType< OUString >::get(),
187 PropertyAttribute::TRANSIENT
190 aProps[ nProp++ ] = Property(
191 OUString( "ThousandDelimiter" ),
192 PROPERTY_ID_THOUSAND_DELIMITER,
193 ::cppu::UnoType< OUString >::get(),
194 PropertyAttribute::TRANSIENT
197 aProps[ nProp++ ] = Property(
198 OUString( "CharSet" ),
199 PROPERTY_ID_ENCODING,
200 ::cppu::UnoType< OUString >::get(),
201 PropertyAttribute::TRANSIENT
204 return new ::cppu::OPropertyArrayHelper( aProps );
207 VclPtr<Dialog> OTextConnectionSettingsDialog::createDialog(vcl::Window* _pParent)
209 return VclPtr<TextConnectionSettingsDialog>::Create( _pParent, *m_pDatasourceItems );
212 void OTextConnectionSettingsDialog::implInitialize(const Any& _rValue)
214 OTextConnectionSettingsDialog_BASE::implInitialize( _rValue );
217 void SAL_CALL OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw(Exception, std::exception)
219 PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
220 if ( pos != m_aPropertyValues.end() )
222 pos->second->setPropertyValue( _rValue );
224 else
226 OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
230 sal_Bool SAL_CALL OTextConnectionSettingsDialog::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) throw(IllegalArgumentException)
232 bool bModified = false;
234 PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
235 if ( pos != m_aPropertyValues.end() )
237 // we're lazy here ...
238 _rConvertedValue = _rValue;
239 pos->second->getPropertyValue( _rOldValue );
240 bModified = true;
242 else
244 bModified = OTextConnectionSettingsDialog::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
247 return bModified;
250 void SAL_CALL OTextConnectionSettingsDialog::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
252 PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
253 if ( pos != m_aPropertyValues.end() )
255 pos->second->getPropertyValue( _rValue );
257 else
259 OTextConnectionSettingsDialog::getFastPropertyValue( _rValue, _nHandle );
263 } // namespace dbaui
265 extern "C" void SAL_CALL createRegistryInfo_OTextConnectionSettingsDialog()
267 static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OTextConnectionSettingsDialog > aAutoRegistration;
270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */