LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - submissionhandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 168 0.0 %
Date: 2012-08-25 Functions: 0 19 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "submissionhandler.hxx"
      30                 :            : #include "formmetadata.hxx"
      31                 :            : #include "formstrings.hxx"
      32                 :            : #include "handlerhelper.hxx"
      33                 :            : 
      34                 :            : #include <com/sun/star/form/FormButtonType.hpp>
      35                 :            : #include <com/sun/star/container/XNamed.hpp>
      36                 :            : #include <com/sun/star/container/XIndexAccess.hpp>
      37                 :            : #include <com/sun/star/form/submission/XSubmissionSupplier.hpp>
      38                 :            : #include <com/sun/star/inspection/XObjectInspectorUI.hpp>
      39                 :            : #include <tools/debug.hxx>
      40                 :            : #include <rtl/ustrbuf.hxx>
      41                 :            : 
      42                 :            : //------------------------------------------------------------------------
      43                 :          0 : extern "C" void SAL_CALL createRegistryInfo_SubmissionPropertyHandler()
      44                 :            : {
      45                 :          0 :     ::pcr::SubmissionPropertyHandler::registerImplementation();
      46                 :          0 : }
      47                 :            : 
      48                 :            : //........................................................................
      49                 :            : namespace pcr
      50                 :            : {
      51                 :            : //........................................................................
      52                 :            : 
      53                 :            :     using namespace ::comphelper;
      54                 :            :     using namespace ::com::sun::star;
      55                 :            :     using namespace ::com::sun::star::uno;
      56                 :            :     using namespace ::com::sun::star::lang;
      57                 :            :     using namespace ::com::sun::star::beans;
      58                 :            :     using namespace ::com::sun::star::script;
      59                 :            :     using namespace ::com::sun::star::form;
      60                 :            :     using namespace ::com::sun::star::xforms;
      61                 :            :     using namespace ::com::sun::star::container;
      62                 :            :     using namespace ::com::sun::star::inspection;
      63                 :            : 
      64                 :            :     //====================================================================
      65                 :            :     //= SubmissionHelper
      66                 :            :     //====================================================================
      67                 :            :     //--------------------------------------------------------------------
      68                 :          0 :     SubmissionHelper::SubmissionHelper( ::osl::Mutex& _rMutex, const Reference< XPropertySet >& _rxIntrospectee, const Reference< frame::XModel >& _rxContextDocument )
      69                 :          0 :         :EFormsHelper( _rMutex, _rxIntrospectee, _rxContextDocument )
      70                 :            :     {
      71                 :            :         OSL_ENSURE( canTriggerSubmissions( _rxIntrospectee, _rxContextDocument ),
      72                 :            :             "SubmissionHelper::SubmissionHelper: you should not have instantiated me!" );
      73                 :          0 :     }
      74                 :            : 
      75                 :            :     //--------------------------------------------------------------------
      76                 :          0 :     bool SubmissionHelper::canTriggerSubmissions( const Reference< XPropertySet >& _rxControlModel,
      77                 :            :         const Reference< frame::XModel >& _rxContextDocument ) SAL_THROW(())
      78                 :            :     {
      79                 :          0 :         if ( !EFormsHelper::isEForm( _rxContextDocument ) )
      80                 :          0 :             return false;
      81                 :            : 
      82                 :            :         try
      83                 :            :         {
      84                 :          0 :             Reference< submission::XSubmissionSupplier > xSubmissionSupp( _rxControlModel, UNO_QUERY );
      85                 :          0 :             if ( xSubmissionSupp.is() )
      86                 :          0 :                 return true;
      87                 :            :         }
      88                 :          0 :         catch( const Exception& )
      89                 :            :         {
      90                 :            :             OSL_FAIL( "SubmissionHelper::canTriggerSubmissions: caught an exception!" );
      91                 :            :         }
      92                 :          0 :         return false;
      93                 :            :     }
      94                 :            : 
      95                 :            :     //====================================================================
      96                 :            :     //= SubmissionPropertyHandler
      97                 :            :     //====================================================================
      98                 :            :     DBG_NAME( SubmissionPropertyHandler )
      99                 :            :     //--------------------------------------------------------------------
     100                 :          0 :     SubmissionPropertyHandler::SubmissionPropertyHandler( const Reference< XComponentContext >& _rxContext )
     101                 :            :         :EditPropertyHandler_Base( _rxContext )
     102                 :            :         ,OPropertyChangeListener( m_aMutex )
     103                 :          0 :         ,m_pPropChangeMultiplexer( NULL )
     104                 :            :     {
     105                 :            :         DBG_CTOR( SubmissionPropertyHandler, NULL );
     106                 :          0 :     }
     107                 :            : 
     108                 :            :     //--------------------------------------------------------------------
     109                 :          0 :     SubmissionPropertyHandler::~SubmissionPropertyHandler( )
     110                 :            :     {
     111                 :          0 :         disposeAdapter();
     112                 :            :         DBG_DTOR( SubmissionPropertyHandler, NULL );
     113                 :          0 :     }
     114                 :            : 
     115                 :            :     //--------------------------------------------------------------------
     116                 :          0 :     ::rtl::OUString SAL_CALL SubmissionPropertyHandler::getImplementationName_static(  ) throw (RuntimeException)
     117                 :            :     {
     118                 :          0 :         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.SubmissionPropertyHandler" ) );
     119                 :            :     }
     120                 :            : 
     121                 :            :     //--------------------------------------------------------------------
     122                 :          0 :     Sequence< ::rtl::OUString > SAL_CALL SubmissionPropertyHandler::getSupportedServiceNames_static(  ) throw (RuntimeException)
     123                 :            :     {
     124                 :          0 :         Sequence< ::rtl::OUString > aSupported( 1 );
     125                 :          0 :         aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.SubmissionPropertyHandler" ) );
     126                 :          0 :         return aSupported;
     127                 :            :     }
     128                 :            : 
     129                 :            :     //--------------------------------------------------------------------
     130                 :          0 :     Any SAL_CALL SubmissionPropertyHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException)
     131                 :            :     {
     132                 :          0 :         ::osl::MutexGuard aGuard( m_aMutex );
     133                 :          0 :         PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
     134                 :            : 
     135                 :            :         OSL_ENSURE( m_pHelper.get(), "SubmissionPropertyHandler::getPropertyValue: inconsistency!" );
     136                 :            :             // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
     137                 :            : 
     138                 :          0 :         Any aReturn;
     139                 :            :         try
     140                 :            :         {
     141                 :          0 :             switch ( nPropId )
     142                 :            :             {
     143                 :            :             case PROPERTY_ID_SUBMISSION_ID:
     144                 :            :             {
     145                 :          0 :                 Reference< submission::XSubmissionSupplier > xSubmissionSupp( m_xComponent, UNO_QUERY );
     146                 :            :                 OSL_ENSURE( xSubmissionSupp.is(), "SubmissionPropertyHandler::getPropertyValue: this should never happen ..." );
     147                 :            :                     // this handler is not intended for components which are no XSubmissionSupplier
     148                 :          0 :                 Reference< submission::XSubmission > xSubmission;
     149                 :          0 :                 if ( xSubmissionSupp.is() )
     150                 :          0 :                     xSubmission = xSubmissionSupp->getSubmission( );
     151                 :          0 :                 aReturn <<= xSubmission;
     152                 :            :             }
     153                 :          0 :             break;
     154                 :            : 
     155                 :            :             case PROPERTY_ID_XFORMS_BUTTONTYPE:
     156                 :            :             {
     157                 :          0 :                 FormButtonType eType = FormButtonType_PUSH;
     158                 :          0 :                 OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_BUTTONTYPE ) >>= eType );
     159                 :          0 :                 if ( ( eType != FormButtonType_PUSH ) && ( eType != FormButtonType_SUBMIT ) )
     160                 :          0 :                     eType = FormButtonType_PUSH;
     161                 :          0 :                 aReturn <<= eType;
     162                 :            :             }
     163                 :          0 :             break;
     164                 :            : 
     165                 :            :             default:
     166                 :            :                 OSL_FAIL( "SubmissionPropertyHandler::getPropertyValue: cannot handle this property!" );
     167                 :          0 :                 break;
     168                 :            :             }
     169                 :            :         }
     170                 :          0 :         catch( const Exception& )
     171                 :            :         {
     172                 :            :             OSL_FAIL( "SubmissionPropertyHandler::getPropertyValue: caught an exception!" );
     173                 :            :         }
     174                 :            : 
     175                 :          0 :         return aReturn;
     176                 :            :     }
     177                 :            : 
     178                 :            :     //--------------------------------------------------------------------
     179                 :          0 :     void SAL_CALL SubmissionPropertyHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException)
     180                 :            :     {
     181                 :          0 :         ::osl::MutexGuard aGuard( m_aMutex );
     182                 :          0 :         PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
     183                 :            : 
     184                 :            :         OSL_ENSURE( m_pHelper.get(), "SubmissionPropertyHandler::setPropertyValue: inconsistency!" );
     185                 :            :             // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
     186                 :            : 
     187                 :            :         try
     188                 :            :         {
     189                 :          0 :             switch ( nPropId )
     190                 :            :             {
     191                 :            :             case PROPERTY_ID_SUBMISSION_ID:
     192                 :            :             {
     193                 :          0 :                 Reference< submission::XSubmission > xSubmission;
     194                 :          0 :                 OSL_VERIFY( _rValue >>= xSubmission );
     195                 :            : 
     196                 :          0 :                 Reference< submission::XSubmissionSupplier > xSubmissionSupp( m_xComponent, UNO_QUERY );
     197                 :            :                 OSL_ENSURE( xSubmissionSupp.is(), "SubmissionPropertyHandler::setPropertyValue: this should never happen ..." );
     198                 :            :                     // this handler is not intended for components which are no XSubmissionSupplier
     199                 :          0 :                 if ( xSubmissionSupp.is() )
     200                 :            :                 {
     201                 :          0 :                     xSubmissionSupp->setSubmission( xSubmission );
     202                 :          0 :                     impl_setContextDocumentModified_nothrow();
     203                 :          0 :                 }
     204                 :            :             }
     205                 :          0 :             break;
     206                 :            : 
     207                 :            :             case PROPERTY_ID_XFORMS_BUTTONTYPE:
     208                 :          0 :                 m_xComponent->setPropertyValue( PROPERTY_BUTTONTYPE, _rValue );
     209                 :          0 :                 break;
     210                 :            : 
     211                 :            :             default:
     212                 :            :                 OSL_FAIL( "SubmissionPropertyHandler::setPropertyValue: cannot handle this id!" );
     213                 :            :             }
     214                 :            :         }
     215                 :          0 :         catch( const Exception& )
     216                 :            :         {
     217                 :            :             OSL_FAIL( "SubmissionPropertyHandler::setPropertyValue: caught an exception!" );
     218                 :          0 :         }
     219                 :          0 :     }
     220                 :            : 
     221                 :            :     //--------------------------------------------------------------------
     222                 :          0 :     Sequence< ::rtl::OUString > SAL_CALL SubmissionPropertyHandler::getActuatingProperties( ) throw (RuntimeException)
     223                 :            :     {
     224                 :          0 :         ::osl::MutexGuard aGuard( m_aMutex );
     225                 :          0 :         if ( !m_pHelper.get() )
     226                 :          0 :             return Sequence< ::rtl::OUString >();
     227                 :            : 
     228                 :          0 :         Sequence< ::rtl::OUString > aReturn( 1 );
     229                 :          0 :         aReturn[ 0 ] = PROPERTY_XFORMS_BUTTONTYPE;
     230                 :          0 :         return aReturn;
     231                 :            :     }
     232                 :            : 
     233                 :            :     //--------------------------------------------------------------------
     234                 :          0 :     Sequence< ::rtl::OUString > SAL_CALL SubmissionPropertyHandler::getSupersededProperties( ) throw (RuntimeException)
     235                 :            :     {
     236                 :          0 :         ::osl::MutexGuard aGuard( m_aMutex );
     237                 :          0 :         if ( !m_pHelper.get() )
     238                 :          0 :             return Sequence< ::rtl::OUString >();
     239                 :            : 
     240                 :          0 :         Sequence< ::rtl::OUString > aReturn( 3 );
     241                 :          0 :         aReturn[ 0 ] = PROPERTY_TARGET_URL;
     242                 :          0 :         aReturn[ 1 ] = PROPERTY_TARGET_FRAME;
     243                 :          0 :         aReturn[ 2 ] = PROPERTY_BUTTONTYPE;
     244                 :          0 :         return aReturn;
     245                 :            :     }
     246                 :            : 
     247                 :            :     //--------------------------------------------------------------------
     248                 :          0 :     void SubmissionPropertyHandler::onNewComponent()
     249                 :            :     {
     250                 :          0 :         if ( m_pPropChangeMultiplexer )
     251                 :            :         {
     252                 :          0 :             m_pPropChangeMultiplexer->dispose();
     253                 :          0 :             m_pPropChangeMultiplexer->release();
     254                 :          0 :             m_pPropChangeMultiplexer = NULL;
     255                 :            :         }
     256                 :            : 
     257                 :          0 :         EditPropertyHandler_Base::onNewComponent();
     258                 :            : 
     259                 :          0 :         Reference< frame::XModel > xDocument( impl_getContextDocument_nothrow() );
     260                 :            :         DBG_ASSERT( xDocument.is(), "SubmissionPropertyHandler::onNewComponent: no document!" );
     261                 :            : 
     262                 :          0 :         m_pHelper.reset( NULL );
     263                 :            : 
     264                 :          0 :         if ( SubmissionHelper::canTriggerSubmissions( m_xComponent, xDocument ) )
     265                 :            :         {
     266                 :          0 :             m_pHelper.reset( new SubmissionHelper( m_aMutex, m_xComponent, xDocument ) );
     267                 :            : 
     268                 :          0 :             m_pPropChangeMultiplexer = new OPropertyChangeMultiplexer( this, m_xComponent );
     269                 :          0 :             m_pPropChangeMultiplexer->acquire();
     270                 :          0 :             m_pPropChangeMultiplexer->addProperty( PROPERTY_BUTTONTYPE );
     271                 :          0 :         }
     272                 :          0 :     }
     273                 :            : 
     274                 :            :     //--------------------------------------------------------------------
     275                 :          0 :     Sequence< Property > SAL_CALL SubmissionPropertyHandler::doDescribeSupportedProperties() const
     276                 :            :     {
     277                 :          0 :         ::std::vector< Property > aProperties;
     278                 :          0 :         if ( m_pHelper.get() )
     279                 :            :         {
     280                 :          0 :             implAddPropertyDescription( aProperties, PROPERTY_SUBMISSION_ID, ::getCppuType( static_cast< Reference< submission::XSubmission > * >( NULL ) ) );
     281                 :          0 :             implAddPropertyDescription( aProperties, PROPERTY_XFORMS_BUTTONTYPE, ::getCppuType( static_cast< FormButtonType* >( NULL ) ) );
     282                 :            :         }
     283                 :          0 :         if ( aProperties.empty() )
     284                 :          0 :             return Sequence< Property >();
     285                 :          0 :         return Sequence< Property >( &(*aProperties.begin()), aProperties.size() );
     286                 :            :     }
     287                 :            : 
     288                 :            :     //--------------------------------------------------------------------
     289                 :          0 :     LineDescriptor SAL_CALL SubmissionPropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName,
     290                 :            :         const Reference< XPropertyControlFactory >& _rxControlFactory )
     291                 :            :         throw (UnknownPropertyException, NullPointerException, RuntimeException)
     292                 :            :     {
     293                 :          0 :         ::osl::MutexGuard aGuard( m_aMutex );
     294                 :          0 :         if ( !_rxControlFactory.is() )
     295                 :          0 :             throw NullPointerException();
     296                 :          0 :         if ( !m_pHelper.get() )
     297                 :          0 :             RuntimeException();
     298                 :            : 
     299                 :          0 :         ::std::vector< ::rtl::OUString > aListEntries;
     300                 :          0 :         PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
     301                 :          0 :         switch ( nPropId )
     302                 :            :         {
     303                 :            :         case PROPERTY_ID_SUBMISSION_ID:
     304                 :          0 :             const_cast< SubmissionHelper* >( m_pHelper.get() )->getAllElementUINames( EFormsHelper::Submission, aListEntries, false );
     305                 :          0 :             break;
     306                 :            : 
     307                 :            :         case PROPERTY_ID_XFORMS_BUTTONTYPE:
     308                 :            :         {
     309                 :            :             // available options are nearly the same as for the "normal" button type, but only the
     310                 :            :             // first two options
     311                 :          0 :             aListEntries = m_pInfoService->getPropertyEnumRepresentations( PROPERTY_ID_BUTTONTYPE );
     312                 :          0 :             aListEntries.resize( 2 );
     313                 :            :         }
     314                 :          0 :         break;
     315                 :            : 
     316                 :            :         default:
     317                 :            :             OSL_FAIL( "SubmissionPropertyHandler::describePropertyLine: cannot handle this id!" );
     318                 :          0 :             return LineDescriptor();
     319                 :            :         }
     320                 :            : 
     321                 :          0 :         LineDescriptor aDescriptor;
     322                 :          0 :         aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, sal_False, sal_True );
     323                 :          0 :         aDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( nPropId );
     324                 :          0 :         aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "General" ) );
     325                 :          0 :         aDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nPropId ) );
     326                 :          0 :         return aDescriptor;
     327                 :            :     }
     328                 :            : 
     329                 :            :     //--------------------------------------------------------------------
     330                 :          0 :     void SAL_CALL SubmissionPropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool ) throw (NullPointerException, RuntimeException)
     331                 :            :     {
     332                 :          0 :         if ( !_rxInspectorUI.is() )
     333                 :          0 :             throw NullPointerException();
     334                 :            : 
     335                 :          0 :         ::osl::MutexGuard aGuard( m_aMutex );
     336                 :          0 :         PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) );
     337                 :            :         OSL_PRECOND( m_pHelper.get(), "SubmissionPropertyHandler::actuatingPropertyChanged: inconsistentcy!" );
     338                 :            :             // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
     339                 :            : 
     340                 :          0 :         switch ( nActuatingPropId )
     341                 :            :         {
     342                 :            :         case PROPERTY_ID_XFORMS_BUTTONTYPE:
     343                 :            :         {
     344                 :          0 :             FormButtonType eType = FormButtonType_PUSH;
     345                 :          0 :             OSL_VERIFY( _rNewValue >>= eType );
     346                 :          0 :             _rxInspectorUI->enablePropertyUI( PROPERTY_SUBMISSION_ID, eType == FormButtonType_SUBMIT );
     347                 :            :         }
     348                 :          0 :         break;
     349                 :            : 
     350                 :            :         default:
     351                 :            :             OSL_FAIL( "SubmissionPropertyHandler::actuatingPropertyChanged: cannot handle this id!" );
     352                 :          0 :         }
     353                 :          0 :     }
     354                 :            : 
     355                 :            :     //--------------------------------------------------------------------
     356                 :          0 :     Any SAL_CALL SubmissionPropertyHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException)
     357                 :            :     {
     358                 :          0 :         ::osl::MutexGuard aGuard( m_aMutex );
     359                 :          0 :         Any aPropertyValue;
     360                 :            : 
     361                 :            :         OSL_ENSURE( m_pHelper.get(), "SubmissionPropertyHandler::convertToPropertyValue: we have no SupportedProperties!" );
     362                 :          0 :         if ( !m_pHelper.get() )
     363                 :            :             return aPropertyValue;
     364                 :            : 
     365                 :          0 :         ::rtl::OUString sControlValue;
     366                 :          0 :         OSL_VERIFY( _rControlValue >>= sControlValue );
     367                 :            : 
     368                 :          0 :         PropertyId nPropId( m_pInfoService->getPropertyId( _rPropertyName ) );
     369                 :          0 :         switch ( nPropId )
     370                 :            :         {
     371                 :            :         case PROPERTY_ID_SUBMISSION_ID:
     372                 :            :         {
     373                 :          0 :             Reference< XSubmission > xSubmission( m_pHelper->getModelElementFromUIName( EFormsHelper::Submission, sControlValue ), UNO_QUERY );
     374                 :          0 :             aPropertyValue <<= xSubmission;
     375                 :            :         }
     376                 :          0 :         break;
     377                 :            : 
     378                 :            :         case PROPERTY_ID_XFORMS_BUTTONTYPE:
     379                 :            :         {
     380                 :            :             ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion(
     381                 :          0 :                 new DefaultEnumRepresentation( *m_pInfoService, ::getCppuType( static_cast< FormButtonType* >( NULL ) ), PROPERTY_ID_BUTTONTYPE ) );
     382                 :            :             // TODO/UNOize: make aEnumConversion a member?
     383                 :          0 :             aEnumConversion->getValueFromDescription( sControlValue, aPropertyValue );
     384                 :            :         }
     385                 :          0 :         break;
     386                 :            : 
     387                 :            :         default:
     388                 :            :             OSL_FAIL( "SubmissionPropertyHandler::convertToPropertyValue: cannot handle this id!" );
     389                 :            :         }
     390                 :            : 
     391                 :          0 :         return aPropertyValue;
     392                 :            :     }
     393                 :            : 
     394                 :            :     //--------------------------------------------------------------------
     395                 :          0 :     Any SAL_CALL SubmissionPropertyHandler::convertToControlValue( const ::rtl::OUString& _rPropertyName, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException)
     396                 :            :     {
     397                 :          0 :         ::osl::MutexGuard aGuard( m_aMutex );
     398                 :          0 :         Any aControlValue;
     399                 :            : 
     400                 :            :         OSL_ENSURE( m_pHelper.get(), "SubmissionPropertyHandler::convertToControlValue: we have no SupportedProperties!" );
     401                 :          0 :         if ( !m_pHelper.get() )
     402                 :            :             return aControlValue;
     403                 :            : 
     404                 :            :         OSL_ENSURE( _rControlValueType.getTypeClass() == TypeClass_STRING,
     405                 :            :             "SubmissionPropertyHandler::convertToControlValue: all our controls should use strings for value exchange!" );
     406                 :            :         (void)_rControlValueType;
     407                 :            : 
     408                 :          0 :         PropertyId nPropId( m_pInfoService->getPropertyId( _rPropertyName ) );
     409                 :          0 :         switch ( nPropId )
     410                 :            :         {
     411                 :            :         case PROPERTY_ID_SUBMISSION_ID:
     412                 :            :         {
     413                 :          0 :             Reference< XPropertySet > xSubmission( _rPropertyValue, UNO_QUERY );
     414                 :          0 :             if ( xSubmission.is() )
     415                 :          0 :                 aControlValue <<= m_pHelper->getModelElementUIName( EFormsHelper::Submission, xSubmission );
     416                 :            :         }
     417                 :          0 :         break;
     418                 :            : 
     419                 :            :         case PROPERTY_ID_XFORMS_BUTTONTYPE:
     420                 :            :         {
     421                 :            :             ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion(
     422                 :          0 :                 new DefaultEnumRepresentation( *m_pInfoService, _rPropertyValue.getValueType(), PROPERTY_ID_BUTTONTYPE ) );
     423                 :            :             // TODO/UNOize: make aEnumConversion a member?
     424                 :          0 :             aControlValue <<= aEnumConversion->getDescriptionForValue( _rPropertyValue );
     425                 :            :         }
     426                 :          0 :         break;
     427                 :            : 
     428                 :            :         default:
     429                 :            :             OSL_FAIL( "SubmissionPropertyHandler::convertToControlValue: cannot handle this id!" );
     430                 :            :         }
     431                 :            : 
     432                 :          0 :         return aControlValue;
     433                 :            :     }
     434                 :            : 
     435                 :            :     //--------------------------------------------------------------------
     436                 :          0 :     void SubmissionPropertyHandler::_propertyChanged( const PropertyChangeEvent& _rEvent ) throw(RuntimeException)
     437                 :            :     {
     438                 :          0 :         if ( _rEvent.PropertyName == PROPERTY_BUTTONTYPE )
     439                 :          0 :             firePropertyChange( PROPERTY_XFORMS_BUTTONTYPE, PROPERTY_ID_XFORMS_BUTTONTYPE, _rEvent.OldValue, _rEvent.NewValue );
     440                 :          0 :     }
     441                 :            : 
     442                 :            : //........................................................................
     443                 :            : } // namespace pcr
     444                 :            : //........................................................................
     445                 :            : 
     446                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10