LCOV - code coverage report
Current view: top level - dbaccess/source/ui/uno - textconnectionsettings_uno.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 86 0.0 %
Date: 2014-04-14 Functions: 0 27 0.0 %
Legend: Lines: hit not hit

          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 "textconnectionsettings.hxx"
      21             : #include "dbu_reghelper.hxx"
      22             : #include "moduledbu.hxx"
      23             : #include "apitools.hxx"
      24             : #include "unoadmin.hxx"
      25             : #include "dbustrings.hrc"
      26             : #include "propertystorage.hxx"
      27             : 
      28             : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      29             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      30             : #include <com/sun/star/sdb/XTextConnectionSettings.hpp>
      31             : 
      32             : #include <comphelper/processfactory.hxx>
      33             : #include <svtools/genericunodialog.hxx>
      34             : #include <cppuhelper/implbase1.hxx>
      35             : 
      36             : namespace dbaui
      37             : {
      38             : 
      39             :     using ::com::sun::star::uno::Reference;
      40             :     using ::com::sun::star::uno::XInterface;
      41             :     using ::com::sun::star::uno::UNO_QUERY;
      42             :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      43             :     using ::com::sun::star::uno::Exception;
      44             :     using ::com::sun::star::uno::RuntimeException;
      45             :     using ::com::sun::star::uno::Any;
      46             :     using ::com::sun::star::uno::makeAny;
      47             :     using ::com::sun::star::uno::XComponentContext;
      48             :     using ::com::sun::star::beans::XPropertySetInfo;
      49             :     using ::com::sun::star::uno::Sequence;
      50             :     using ::com::sun::star::beans::Property;
      51             :     using ::com::sun::star::lang::IllegalArgumentException;
      52             : 
      53             :     namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
      54             : 
      55             :     // OTextConnectionSettingsDialog
      56             : 
      57             :     class OTextConnectionSettingsDialog;
      58             :     typedef ::cppu::ImplInheritanceHelper1  <   ODatabaseAdministrationDialog
      59             :                                             ,   ::com::sun::star::sdb::XTextConnectionSettings
      60             :                                             >   OTextConnectionSettingsDialog_BASE;
      61             :     typedef ::comphelper::OPropertyArrayUsageHelper< OTextConnectionSettingsDialog >    OTextConnectionSettingsDialog_PBASE;
      62             : 
      63             :     class OTextConnectionSettingsDialog
      64             :             :public OTextConnectionSettingsDialog_BASE
      65             :             ,public OTextConnectionSettingsDialog_PBASE
      66             :             ,public ::cppu::WeakImplHelper1< com::sun::star::sdb::XTextConnectionSettings >
      67             :     {
      68             :         OModuleClient   m_aModuleClient;
      69             :         PropertyValues  m_aPropertyValues;
      70             : 
      71             :     protected:
      72             :         OTextConnectionSettingsDialog( const Reference<XComponentContext>& _rContext );
      73             :         virtual ~OTextConnectionSettingsDialog();
      74             : 
      75             :     public:
      76             :         virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId()
      77             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      78             : 
      79             :         DECLARE_SERVICE_INFO_STATIC( );
      80             :         DECLARE_PROPERTYCONTAINER_DEFAULTS( );
      81             : 
      82             :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw(Exception, std::exception) SAL_OVERRIDE;
      83             :         virtual sal_Bool SAL_CALL convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue) throw(IllegalArgumentException) SAL_OVERRIDE;
      84             :         virtual void SAL_CALL getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
      85             : 
      86             :         // Overrides to resolve inheritance ambiguity
      87           0 :         virtual void SAL_CALL setPropertyValue(const OUString& p1, const css::uno::Any& p2) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      88           0 :             { ODatabaseAdministrationDialog::setPropertyValue(p1, p2); }
      89           0 :         virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      90           0 :             { return ODatabaseAdministrationDialog::getPropertyValue(p1); }
      91           0 :         virtual void SAL_CALL addPropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      92           0 :             { ODatabaseAdministrationDialog::addPropertyChangeListener(p1, p2); }
      93           0 :         virtual void SAL_CALL removePropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      94           0 :             { ODatabaseAdministrationDialog::removePropertyChangeListener(p1, p2); }
      95           0 :         virtual void SAL_CALL addVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      96           0 :             { ODatabaseAdministrationDialog::addVetoableChangeListener(p1, p2); }
      97           0 :         virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      98           0 :             { ODatabaseAdministrationDialog::removeVetoableChangeListener(p1, p2); }
      99           0 :         virtual void SAL_CALL setTitle(const OUString& p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     100           0 :             { ODatabaseAdministrationDialog::setTitle(p1); }
     101           0 :         virtual sal_Int16 SAL_CALL execute() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     102           0 :             { return ODatabaseAdministrationDialog::execute(); }
     103             : 
     104             :     protected:
     105             :         // OGenericUnoDialog overridables
     106             :         virtual Dialog* createDialog( Window* _pParent ) SAL_OVERRIDE;
     107             :         virtual void implInitialize( const com::sun::star::uno::Any& _rValue ) SAL_OVERRIDE;
     108             :     protected:
     109             :         using OTextConnectionSettingsDialog_BASE::getFastPropertyValue;
     110             :     };
     111             : 
     112             :     // OTextConnectionSettingsDialog
     113           0 :     OTextConnectionSettingsDialog::OTextConnectionSettingsDialog( const Reference<XComponentContext>& _rContext )
     114           0 :         :OTextConnectionSettingsDialog_BASE( _rContext )
     115             :     {
     116           0 :         TextConnectionSettingsDialog::bindItemStorages( *m_pDatasourceItems, m_aPropertyValues );
     117           0 :     }
     118             : 
     119           0 :     OTextConnectionSettingsDialog::~OTextConnectionSettingsDialog()
     120             :     {
     121           0 :     }
     122             : 
     123             :     css::uno::Sequence<sal_Int8>
     124           0 :     OTextConnectionSettingsDialog::getImplementationId()
     125             :         throw (css::uno::RuntimeException, std::exception)
     126             :     {
     127           0 :         return css::uno::Sequence<sal_Int8>();
     128             :     }
     129             : 
     130           0 :     IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(OTextConnectionSettingsDialog, "com.sun.star.comp.dbaccess.OTextConnectionSettingsDialog")
     131           0 :     IMPLEMENT_SERVICE_INFO_SUPPORTS(OTextConnectionSettingsDialog)
     132           0 :     IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(OTextConnectionSettingsDialog, "com.sun.star.sdb.TextConnectionSettings")
     133             : 
     134             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
     135           0 :         SAL_CALL OTextConnectionSettingsDialog::Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB)
     136             :     {
     137           0 :         return static_cast< XServiceInfo* >(new OTextConnectionSettingsDialog( comphelper::getComponentContext(_rxORB)));
     138             :     }
     139             : 
     140           0 :     Reference< XPropertySetInfo >  SAL_CALL OTextConnectionSettingsDialog::getPropertySetInfo() throw(RuntimeException, std::exception)
     141             :     {
     142           0 :         return createPropertySetInfo( getInfoHelper() );
     143             :     }
     144             : 
     145           0 :     ::cppu::IPropertyArrayHelper& OTextConnectionSettingsDialog::getInfoHelper()
     146             :     {
     147           0 :         return *getArrayHelper();
     148             :     }
     149             : 
     150           0 :     ::cppu::IPropertyArrayHelper* OTextConnectionSettingsDialog::createArrayHelper( ) const
     151             :     {
     152           0 :         Sequence< Property > aProps;
     153           0 :         describeProperties( aProps );
     154             : 
     155             :         // in addition to the properties registered by the base class, we have
     156             :         // more properties which are not even handled by the PropertyContainer implementation,
     157             :         // but whose values are stored in our item set
     158           0 :         sal_Int32 nProp = aProps.getLength();
     159           0 :         aProps.realloc( nProp + 6 );
     160             : 
     161           0 :         aProps[ nProp++ ] = Property(
     162             :             OUString( "HeaderLine" ),
     163             :             PROPERTY_ID_HEADER_LINE,
     164           0 :             ::cppu::UnoType< sal_Bool >::get(),
     165             :             PropertyAttribute::TRANSIENT
     166           0 :         );
     167             : 
     168           0 :         aProps[ nProp++ ] = Property(
     169             :             OUString( "FieldDelimiter" ),
     170             :             PROPERTY_ID_FIELD_DELIMITER,
     171           0 :             ::cppu::UnoType< OUString >::get(),
     172             :             PropertyAttribute::TRANSIENT
     173           0 :         );
     174             : 
     175           0 :         aProps[ nProp++ ] = Property(
     176             :             OUString( "StringDelimiter" ),
     177             :             PROPERTY_ID_STRING_DELIMITER,
     178           0 :             ::cppu::UnoType< OUString >::get(),
     179             :             PropertyAttribute::TRANSIENT
     180           0 :         );
     181             : 
     182           0 :         aProps[ nProp++ ] = Property(
     183             :             OUString( "DecimalDelimiter" ),
     184             :             PROPERTY_ID_DECIMAL_DELIMITER,
     185           0 :             ::cppu::UnoType< OUString >::get(),
     186             :             PropertyAttribute::TRANSIENT
     187           0 :         );
     188             : 
     189           0 :         aProps[ nProp++ ] = Property(
     190             :             OUString( "ThousandDelimiter" ),
     191             :             PROPERTY_ID_THOUSAND_DELIMITER,
     192           0 :             ::cppu::UnoType< OUString >::get(),
     193             :             PropertyAttribute::TRANSIENT
     194           0 :         );
     195             : 
     196           0 :         aProps[ nProp++ ] = Property(
     197             :             OUString( "CharSet" ),
     198             :             PROPERTY_ID_ENCODING,
     199           0 :             ::cppu::UnoType< OUString >::get(),
     200             :             PropertyAttribute::TRANSIENT
     201           0 :         );
     202             : 
     203           0 :         return new ::cppu::OPropertyArrayHelper( aProps );
     204             :     }
     205             : 
     206           0 :     Dialog* OTextConnectionSettingsDialog::createDialog(Window* _pParent)
     207             :     {
     208           0 :         return new TextConnectionSettingsDialog( _pParent, *m_pDatasourceItems );
     209             :     }
     210             : 
     211           0 :     void OTextConnectionSettingsDialog::implInitialize(const Any& _rValue)
     212             :     {
     213           0 :         OTextConnectionSettingsDialog_BASE::implInitialize( _rValue );
     214           0 :     }
     215             : 
     216           0 :     void SAL_CALL OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw(Exception, std::exception)
     217             :     {
     218           0 :         PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
     219           0 :         if ( pos != m_aPropertyValues.end() )
     220             :         {
     221           0 :             pos->second->setPropertyValue( _rValue );
     222             :         }
     223             :         else
     224             :         {
     225           0 :             OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
     226             :         }
     227           0 :     }
     228             : 
     229           0 :     sal_Bool SAL_CALL OTextConnectionSettingsDialog::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) throw(IllegalArgumentException)
     230             :     {
     231           0 :         sal_Bool bModified = sal_False;
     232             : 
     233           0 :         PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
     234           0 :         if ( pos != m_aPropertyValues.end() )
     235             :         {
     236             :             // we're lazy here ...
     237           0 :             _rConvertedValue = _rValue;
     238           0 :             pos->second->getPropertyValue( _rOldValue );
     239           0 :             bModified = sal_True;
     240             :         }
     241             :         else
     242             :         {
     243           0 :             bModified = OTextConnectionSettingsDialog::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
     244             :         }
     245             : 
     246           0 :         return bModified;
     247             :     }
     248             : 
     249           0 :     void SAL_CALL OTextConnectionSettingsDialog::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
     250             :     {
     251           0 :         PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
     252           0 :         if ( pos != m_aPropertyValues.end() )
     253             :         {
     254           0 :             pos->second->getPropertyValue( _rValue );
     255             :         }
     256             :         else
     257             :         {
     258           0 :             OTextConnectionSettingsDialog::getFastPropertyValue( _rValue, _nHandle );
     259             :         }
     260           0 :     }
     261             : 
     262             : } // namespace dbaui
     263             : 
     264           0 : extern "C" void SAL_CALL createRegistryInfo_OTextConnectionSettingsDialog()
     265             : {
     266           0 :     static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OTextConnectionSettingsDialog > aAutoRegistration;
     267           0 : }
     268             : 
     269             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10