LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/ui/uno - textconnectionsettings_uno.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 65 0.0 %
Date: 2012-12-27 Functions: 0 20 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             : 
      21             : #include "textconnectionsettings.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"
      28             : 
      29             : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      30             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      31             : 
      32             : #include <comphelper/componentcontext.hxx>
      33             : #include <svtools/genericunodialog.hxx>
      34             : 
      35             : //........................................................................
      36             : namespace dbaui
      37             : {
      38             : //........................................................................
      39             : 
      40             :     /** === begin UNO using === **/
      41             :     using ::com::sun::star::uno::Reference;
      42             :     using ::com::sun::star::uno::XInterface;
      43             :     using ::com::sun::star::uno::UNO_QUERY;
      44             :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      45             :     using ::com::sun::star::uno::Exception;
      46             :     using ::com::sun::star::uno::RuntimeException;
      47             :     using ::com::sun::star::uno::Any;
      48             :     using ::com::sun::star::uno::makeAny;
      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;
      53             :     /** === end UNO using === **/
      54             :     namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
      55             : 
      56             :     //====================================================================
      57             :     //= OTextConnectionSettingsDialog
      58             :     //====================================================================
      59             : 
      60             :     class OTextConnectionSettingsDialog;
      61             :     typedef ODatabaseAdministrationDialog                                               OTextConnectionSettingsDialog_BASE;
      62             :     typedef ::comphelper::OPropertyArrayUsageHelper< OTextConnectionSettingsDialog >    OTextConnectionSettingsDialog_PBASE;
      63             : 
      64             :     class OTextConnectionSettingsDialog
      65             :             :public OTextConnectionSettingsDialog_BASE
      66             :             ,public OTextConnectionSettingsDialog_PBASE
      67             :     {
      68             :         OModuleClient   m_aModuleClient;
      69             :         PropertyValues  m_aPropertyValues;
      70             : 
      71             :     protected:
      72             :         OTextConnectionSettingsDialog( const ::comphelper::ComponentContext& _rContext );
      73             :         virtual ~OTextConnectionSettingsDialog();
      74             : 
      75             :     public:
      76             :         DECLARE_IMPLEMENTATION_ID( );
      77             :         DECLARE_SERVICE_INFO_STATIC( );
      78             :         DECLARE_PROPERTYCONTAINER_DEFAULTS( );
      79             : 
      80             :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw(Exception);
      81             :         virtual sal_Bool SAL_CALL convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue) throw(IllegalArgumentException);
      82             :         virtual void SAL_CALL getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const;
      83             : 
      84             :     protected:
      85             :         // OGenericUnoDialog overridables
      86             :         virtual Dialog* createDialog( Window* _pParent );
      87             :         virtual void implInitialize( const com::sun::star::uno::Any& _rValue );
      88             :     protected:
      89             :         using OTextConnectionSettingsDialog_BASE::getFastPropertyValue;
      90             :     };
      91             : 
      92             :     //====================================================================
      93             :     //= OTextConnectionSettingsDialog
      94             :     //====================================================================
      95             :     //--------------------------------------------------------------------
      96           0 :     OTextConnectionSettingsDialog::OTextConnectionSettingsDialog( const ::comphelper::ComponentContext& _rContext )
      97           0 :         :OTextConnectionSettingsDialog_BASE( _rContext.getLegacyServiceFactory() )
      98             :     {
      99           0 :         TextConnectionSettingsDialog::bindItemStorages( *m_pDatasourceItems, m_aPropertyValues );
     100           0 :     }
     101             : 
     102             :     //---------------------------------------------------------------------
     103           0 :     OTextConnectionSettingsDialog::~OTextConnectionSettingsDialog()
     104             :     {
     105           0 :     }
     106             : 
     107             :     //---------------------------------------------------------------------
     108           0 :     IMPLEMENT_IMPLEMENTATION_ID( OTextConnectionSettingsDialog )
     109             : 
     110             :     //---------------------------------------------------------------------
     111           0 :     IMPLEMENT_SERVICE_INFO1_STATIC( OTextConnectionSettingsDialog, "com.sun.star.comp.dbaccess.OTextConnectionSettingsDialog", "com.sun.star.sdb.TextConnectionSettings" )
     112             : 
     113             :     //---------------------------------------------------------------------
     114           0 :     Reference< XPropertySetInfo >  SAL_CALL OTextConnectionSettingsDialog::getPropertySetInfo() throw(RuntimeException)
     115             :     {
     116           0 :         return createPropertySetInfo( getInfoHelper() );
     117             :     }
     118             : 
     119             :     //---------------------------------------------------------------------
     120           0 :     ::cppu::IPropertyArrayHelper& OTextConnectionSettingsDialog::getInfoHelper()
     121             :     {
     122           0 :         return *getArrayHelper();
     123             :     }
     124             : 
     125             :     //---------------------------------------------------------------------
     126           0 :     ::cppu::IPropertyArrayHelper* OTextConnectionSettingsDialog::createArrayHelper( ) const
     127             :     {
     128           0 :         Sequence< Property > aProps;
     129           0 :         describeProperties( aProps );
     130             : 
     131             :         // in addition to the properties registered by the base class, we have
     132             :         // more properties which are not even handled by the PropertyContainer implementation,
     133             :         // but whose values are stored in our item set
     134           0 :         sal_Int32 nProp = aProps.getLength();
     135           0 :         aProps.realloc( nProp + 6 );
     136             : 
     137           0 :         aProps[ nProp++ ] = Property(
     138             :             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HeaderLine" ) ),
     139             :             PROPERTY_ID_HEADER_LINE,
     140           0 :             ::cppu::UnoType< sal_Bool >::get(),
     141             :             PropertyAttribute::TRANSIENT
     142           0 :         );
     143             : 
     144           0 :         aProps[ nProp++ ] = Property(
     145             :             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FieldDelimiter" ) ),
     146             :             PROPERTY_ID_FIELD_DELIMITER,
     147           0 :             ::cppu::UnoType< ::rtl::OUString >::get(),
     148             :             PropertyAttribute::TRANSIENT
     149           0 :         );
     150             : 
     151           0 :         aProps[ nProp++ ] = Property(
     152             :             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StringDelimiter" ) ),
     153             :             PROPERTY_ID_STRING_DELIMITER,
     154           0 :             ::cppu::UnoType< ::rtl::OUString >::get(),
     155             :             PropertyAttribute::TRANSIENT
     156           0 :         );
     157             : 
     158           0 :         aProps[ nProp++ ] = Property(
     159             :             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DecimalDelimiter" ) ),
     160             :             PROPERTY_ID_DECIMAL_DELIMITER,
     161           0 :             ::cppu::UnoType< ::rtl::OUString >::get(),
     162             :             PropertyAttribute::TRANSIENT
     163           0 :         );
     164             : 
     165           0 :         aProps[ nProp++ ] = Property(
     166             :             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThousandDelimiter" ) ),
     167             :             PROPERTY_ID_THOUSAND_DELIMITER,
     168           0 :             ::cppu::UnoType< ::rtl::OUString >::get(),
     169             :             PropertyAttribute::TRANSIENT
     170           0 :         );
     171             : 
     172           0 :         aProps[ nProp++ ] = Property(
     173             :             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharSet" ) ),
     174             :             PROPERTY_ID_ENCODING,
     175           0 :             ::cppu::UnoType< ::rtl::OUString >::get(),
     176             :             PropertyAttribute::TRANSIENT
     177           0 :         );
     178             : 
     179           0 :         return new ::cppu::OPropertyArrayHelper( aProps );
     180             :     }
     181             : 
     182             :     //---------------------------------------------------------------------
     183           0 :     Dialog* OTextConnectionSettingsDialog::createDialog(Window* _pParent)
     184             :     {
     185           0 :         return new TextConnectionSettingsDialog( _pParent, *m_pDatasourceItems );
     186             :     }
     187             : 
     188             :     //---------------------------------------------------------------------
     189           0 :     void OTextConnectionSettingsDialog::implInitialize(const Any& _rValue)
     190             :     {
     191           0 :         OTextConnectionSettingsDialog_BASE::implInitialize( _rValue );
     192           0 :     }
     193             : 
     194             :     //--------------------------------------------------------------------
     195           0 :     void SAL_CALL OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw(Exception)
     196             :     {
     197           0 :         PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
     198           0 :         if ( pos != m_aPropertyValues.end() )
     199             :         {
     200           0 :             pos->second->setPropertyValue( _rValue );
     201             :         }
     202             :         else
     203             :         {
     204           0 :             OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
     205             :         }
     206           0 :     }
     207             : 
     208             :     //--------------------------------------------------------------------
     209           0 :     sal_Bool SAL_CALL OTextConnectionSettingsDialog::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) throw(IllegalArgumentException)
     210             :     {
     211           0 :         sal_Bool bModified = sal_False;
     212             : 
     213           0 :         PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
     214           0 :         if ( pos != m_aPropertyValues.end() )
     215             :         {
     216             :             // we're lazy here ...
     217           0 :             _rConvertedValue = _rValue;
     218           0 :             pos->second->getPropertyValue( _rOldValue );
     219           0 :             bModified = sal_True;
     220             :         }
     221             :         else
     222             :         {
     223           0 :             bModified = OTextConnectionSettingsDialog::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
     224             :         }
     225             : 
     226           0 :         return bModified;
     227             :     }
     228             : 
     229             :     //--------------------------------------------------------------------
     230           0 :     void SAL_CALL OTextConnectionSettingsDialog::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
     231             :     {
     232           0 :         PropertyValues::const_iterator pos = m_aPropertyValues.find( _nHandle );
     233           0 :         if ( pos != m_aPropertyValues.end() )
     234             :         {
     235           0 :             pos->second->getPropertyValue( _rValue );
     236             :         }
     237             :         else
     238             :         {
     239           0 :             OTextConnectionSettingsDialog::getFastPropertyValue( _rValue, _nHandle );
     240             :         }
     241           0 :     }
     242             : 
     243             : //........................................................................
     244             : } // namespace dbaui
     245             : //........................................................................
     246             : 
     247           0 : extern "C" void SAL_CALL createRegistryInfo_OTextConnectionSettingsDialog()
     248             : {
     249           0 :     static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OTextConnectionSettingsDialog > aAutoRegistration;
     250           0 : }
     251             : 
     252             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10