LCOV - code coverage report
Current view: top level - libreoffice/extensions/source/propctrlr - formcomponenthandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1499 0.0 %
Date: 2012-12-17 Functions: 0 93 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 "controltype.hxx"
      22             : #include "propctrlr.hrc"
      23             : #include "extensio.hrc"
      24             : #include "fontdialog.hxx"
      25             : #include "formcomponenthandler.hxx"
      26             : #include "formlinkdialog.hxx"
      27             : #include "formmetadata.hxx"
      28             : #include "formresid.hrc"
      29             : #include "formstrings.hxx"
      30             : #include "handlerhelper.hxx"
      31             : #include "listselectiondlg.hxx"
      32             : #include "pcrcommon.hxx"
      33             : #include "selectlabeldialog.hxx"
      34             : #include "taborder.hxx"
      35             : #include "usercontrol.hxx"
      36             : 
      37             : #include <com/sun/star/lang/NullPointerException.hpp>
      38             : #include <com/sun/star/awt/XControlModel.hpp>
      39             : #include <com/sun/star/lang/XServiceInfo.hpp>
      40             : #include <com/sun/star/form/FormComponentType.hpp>
      41             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      42             : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
      43             : #include <com/sun/star/container/XNameAccess.hpp>
      44             : #include <com/sun/star/form/XForm.hpp>
      45             : #include <com/sun/star/container/XChild.hpp>
      46             : #include <com/sun/star/sdbc/XConnection.hpp>
      47             : #include <com/sun/star/sdb/CommandType.hpp>
      48             : #include <com/sun/star/sdb/DatabaseContext.hpp>
      49             : #include <com/sun/star/form/XGridColumnFactory.hpp>
      50             : #include <com/sun/star/sdb/SQLContext.hpp>
      51             : #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
      52             : #include <com/sun/star/sdb/XQueriesSupplier.hpp>
      53             : #include <com/sun/star/form/ListSourceType.hpp>
      54             : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
      55             : #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
      56             : #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
      57             : #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
      58             : #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
      59             : #include <com/sun/star/awt/XTabControllerModel.hpp>
      60             : #include <com/sun/star/form/FormSubmitEncoding.hpp>
      61             : #include <com/sun/star/awt/VisualEffect.hpp>
      62             : #include <com/sun/star/form/FormButtonType.hpp>
      63             : #include <com/sun/star/inspection/PropertyControlType.hpp>
      64             : #include <com/sun/star/util/MeasureUnit.hpp>
      65             : #include <com/sun/star/inspection/XObjectInspectorUI.hpp>
      66             : #include <com/sun/star/inspection/PropertyLineElement.hpp>
      67             : #include <com/sun/star/resource/XStringResourceManager.hpp>
      68             : #include <com/sun/star/resource/MissingResourceException.hpp>
      69             : #include <com/sun/star/graphic/GraphicObject.hpp>
      70             : #include <com/sun/star/text/WritingMode2.hpp>
      71             : 
      72             : #include <comphelper/extract.hxx>
      73             : #include <connectivity/dbconversion.hxx>
      74             : #include <connectivity/dbexception.hxx>
      75             : #include <cppuhelper/exc_hlp.hxx>
      76             : #include <sfx2/app.hxx>
      77             : #include <sfx2/basedlgs.hxx>
      78             : #include <sfx2/docfilt.hxx>
      79             : #include <sfx2/filedlghelper.hxx>
      80             : #include <svl/ctloptions.hxx>
      81             : #include <svtools/colrdlg.hxx>
      82             : #include <svl/filenotation.hxx>
      83             : #include <svl/intitem.hxx>
      84             : #include <svl/itemset.hxx>
      85             : #include <unotools/moduleoptions.hxx>
      86             : #include <svl/numuno.hxx>
      87             : #include <svl/urihelper.hxx>
      88             : #include <svx/dialogs.hrc>
      89             : #include <svx/numinf.hxx>
      90             : #include <svx/svxdlg.hxx>
      91             : #include <svx/svxids.hrc>
      92             : #include <toolkit/helper/vclunohelper.hxx>
      93             : #include <tools/diagnose_ex.h>
      94             : #include <vcl/msgbox.hxx>
      95             : #include <vcl/stdtext.hxx>
      96             : #include <vcl/wrkwin.hxx>
      97             : #include <tools/StringListResource.hxx>
      98             : #include <sal/macros.h>
      99             : 
     100             : #include <limits>
     101             : 
     102             : #define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
     103             : //------------------------------------------------------------------------
     104           0 : extern "C" void SAL_CALL createRegistryInfo_FormComponentPropertyHandler()
     105             : {
     106           0 :     ::pcr::FormComponentPropertyHandler::registerImplementation();
     107           0 : }
     108             : 
     109             : //........................................................................
     110             : namespace pcr
     111             : {
     112             : //........................................................................
     113             : 
     114             :     using namespace ::com::sun::star;
     115             :     using namespace uno;
     116             :     using namespace lang;
     117             :     using namespace beans;
     118             :     using namespace frame;
     119             :     using namespace script;
     120             :     using namespace form;
     121             :     using namespace util;
     122             :     using namespace awt;
     123             :     using namespace sdb;
     124             :     using namespace sdbc;
     125             :     using namespace sdbcx;
     126             :     using namespace form;
     127             :     using namespace container;
     128             :     using namespace ui::dialogs;
     129             :     using namespace inspection;
     130             :     using namespace ::dbtools;
     131             : 
     132             :     namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
     133             : 
     134             :     //====================================================================
     135             :     //= FormComponentPropertyHandler
     136             :     //====================================================================
     137             :     DBG_NAME( FormComponentPropertyHandler )
     138             : #define PROPERTY_ID_ROWSET 1
     139             :     //--------------------------------------------------------------------
     140           0 :     FormComponentPropertyHandler::FormComponentPropertyHandler( const Reference< XComponentContext >& _rxContext )
     141             :         :FormComponentPropertyHandler_Base( _rxContext )
     142             :         ,::comphelper::OPropertyContainer(FormComponentPropertyHandler_Base::rBHelper)
     143             :         ,m_sDefaultValueString( String( PcrRes( RID_STR_STANDARD ) ) )
     144             :         ,m_eComponentClass( eUnknown )
     145             :         ,m_bComponentIsSubForm( false )
     146             :         ,m_bHaveListSource( false )
     147             :         ,m_bHaveCommand( false )
     148           0 :         ,m_nClassId( 0 )
     149             :     {
     150             :         DBG_CTOR( FormComponentPropertyHandler, NULL );
     151           0 :         registerProperty(PROPERTY_ROWSET,PROPERTY_ID_ROWSET,0,&m_xRowSet,::getCppuType(&m_xRowSet));
     152           0 :     }
     153             : 
     154             :     //--------------------------------------------------------------------
     155           0 :     FormComponentPropertyHandler::~FormComponentPropertyHandler()
     156             :     {
     157             :         DBG_DTOR( FormComponentPropertyHandler, NULL );
     158           0 :     }
     159             :     //--------------------------------------------------------------------
     160           0 :     IMPLEMENT_FORWARD_XINTERFACE2(FormComponentPropertyHandler,FormComponentPropertyHandler_Base,::comphelper::OPropertyContainer)
     161             :     //--------------------------------------------------------------------
     162           0 :     ::rtl::OUString SAL_CALL FormComponentPropertyHandler::getImplementationName_static(  ) throw (RuntimeException)
     163             :     {
     164           0 :         return ::rtl::OUString(  "com.sun.star.comp.extensions.FormComponentPropertyHandler"  );
     165             :     }
     166             : 
     167             :     //--------------------------------------------------------------------
     168           0 :     Sequence< ::rtl::OUString > SAL_CALL FormComponentPropertyHandler::getSupportedServiceNames_static(  ) throw (RuntimeException)
     169             :     {
     170           0 :         Sequence< ::rtl::OUString > aSupported( 1 );
     171           0 :         aSupported[0] = ::rtl::OUString(  "com.sun.star.form.inspection.FormComponentPropertyHandler"  );
     172           0 :         return aSupported;
     173             :     }
     174             : 
     175             :     //============================================
     176             :     // TODO: -> export from toolkit
     177             :     struct LanguageDependentProp
     178             :     {
     179             :         const char* pPropName;
     180             :         sal_Int32   nPropNameLength;
     181             :     };
     182             : 
     183             :     static LanguageDependentProp aLanguageDependentProp[] =
     184             :     {
     185             :         { "Text",            4 },
     186             :         { "Label",           5 },
     187             :         { "Title",           5 },
     188             :         { "HelpText",        8 },
     189             :         { "CurrencySymbol", 14 },
     190             :         { "StringItemList", 14 },
     191             :         { 0, 0                 }
     192             :     };
     193             : 
     194             :     namespace
     195             :     {
     196           0 :         bool lcl_isLanguageDependentProperty( ::rtl::OUString aName )
     197             :         {
     198           0 :             bool bRet = false;
     199             : 
     200           0 :             LanguageDependentProp* pLangDepProp = aLanguageDependentProp;
     201           0 :             while( pLangDepProp->pPropName != 0 )
     202             :             {
     203           0 :                 if( aName.equalsAsciiL( pLangDepProp->pPropName, pLangDepProp->nPropNameLength ))
     204             :                 {
     205           0 :                     bRet = true;
     206           0 :                     break;
     207             :                 }
     208           0 :                 pLangDepProp++;
     209             :             }
     210           0 :             return bRet;
     211             :         }
     212             : 
     213           0 :         Reference< resource::XStringResourceResolver > lcl_getStringResourceResolverForProperty
     214             :             ( Reference< XPropertySet > _xComponent, const ::rtl::OUString& _rPropertyName,
     215             :               const Any& _rPropertyValue )
     216             :         {
     217           0 :             Reference< resource::XStringResourceResolver > xRet;
     218           0 :             const TypeClass eType = _rPropertyValue.getValueType().getTypeClass();
     219           0 :             if ( (eType == TypeClass_STRING || eType == TypeClass_SEQUENCE) &&
     220           0 :                     lcl_isLanguageDependentProperty( _rPropertyName ) )
     221             :             {
     222           0 :                 static const ::rtl::OUString s_sResourceResolverPropName("ResourceResolver");
     223             : 
     224           0 :                 Reference< resource::XStringResourceResolver > xStringResourceResolver;
     225             :                 try
     226             :                 {
     227           0 :                     xStringResourceResolver.set( _xComponent->getPropertyValue( s_sResourceResolverPropName ),UNO_QUERY);
     228           0 :                     if( xStringResourceResolver.is() &&
     229           0 :                         xStringResourceResolver->getLocales().getLength() > 0 )
     230             :                     {
     231           0 :                         xRet = xStringResourceResolver;
     232             :                     }
     233             :                 }
     234           0 :                 catch(const UnknownPropertyException&)
     235             :                 {
     236             :                     // nii
     237           0 :                 }
     238             :             }
     239             : 
     240           0 :             return xRet;
     241             :         }
     242             :     }
     243             : 
     244             :     //--------------------------------------------------------------------
     245           0 :     Any FormComponentPropertyHandler::impl_getPropertyValue_throw( const ::rtl::OUString& _rPropertyName ) const
     246             :     {
     247           0 :         const PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
     248             : 
     249           0 :         Any aPropertyValue( m_xComponent->getPropertyValue( _rPropertyName ) );
     250             : 
     251             :         Reference< resource::XStringResourceResolver > xStringResourceResolver
     252           0 :             = lcl_getStringResourceResolverForProperty( m_xComponent, _rPropertyName, aPropertyValue );
     253           0 :         if( xStringResourceResolver.is() )
     254             :         {
     255           0 :             TypeClass eType = aPropertyValue.getValueType().getTypeClass();
     256           0 :             if( eType == TypeClass_STRING )
     257             :             {
     258           0 :                 ::rtl::OUString aPropStr;
     259           0 :                 aPropertyValue >>= aPropStr;
     260           0 :                 if( aPropStr.getLength() > 1 )
     261             :                 {
     262           0 :                     ::rtl::OUString aPureIdStr = aPropStr.copy( 1 );
     263           0 :                     if( xStringResourceResolver->hasEntryForId( aPureIdStr ) )
     264             :                     {
     265           0 :                         ::rtl::OUString aResourceStr = xStringResourceResolver->resolveString( aPureIdStr );
     266           0 :                         aPropertyValue <<= aResourceStr;
     267           0 :                     }
     268           0 :                 }
     269             :             }
     270             :             // StringItemList?
     271           0 :             else if( eType == TypeClass_SEQUENCE )
     272             :             {
     273           0 :                 Sequence< ::rtl::OUString > aStrings;
     274           0 :                 aPropertyValue >>= aStrings;
     275             : 
     276           0 :                 const ::rtl::OUString* pStrings = aStrings.getConstArray();
     277           0 :                 sal_Int32 nCount = aStrings.getLength();
     278             : 
     279           0 :                 Sequence< ::rtl::OUString > aResolvedStrings;
     280           0 :                 aResolvedStrings.realloc( nCount );
     281           0 :                 ::rtl::OUString* pResolvedStrings = aResolvedStrings.getArray();
     282             :                 try
     283             :                 {
     284           0 :                     for ( sal_Int32 i = 0; i < nCount; ++i )
     285             :                     {
     286           0 :                         ::rtl::OUString aIdStr = pStrings[i];
     287           0 :                         ::rtl::OUString aPureIdStr = aIdStr.copy( 1 );
     288           0 :                         if( xStringResourceResolver->hasEntryForId( aPureIdStr ) )
     289           0 :                             pResolvedStrings[i] = xStringResourceResolver->resolveString( aPureIdStr );
     290             :                         else
     291           0 :                             pResolvedStrings[i] = aIdStr;
     292           0 :                     }
     293             :                 }
     294           0 :                 catch( const resource::MissingResourceException & )
     295             :                 {}
     296           0 :                 aPropertyValue <<= aResolvedStrings;
     297             :             }
     298             :         }
     299             :         else
     300           0 :             impl_normalizePropertyValue_nothrow( aPropertyValue, nPropId );
     301             : 
     302           0 :         return aPropertyValue;
     303             :     }
     304             : 
     305             :     //--------------------------------------------------------------------
     306           0 :     Any SAL_CALL FormComponentPropertyHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException)
     307             :     {
     308           0 :         if( _rPropertyName == PROPERTY_ROWSET )
     309           0 :             return ::comphelper::OPropertyContainer::getPropertyValue( _rPropertyName );
     310             : 
     311           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     312           0 :         return impl_getPropertyValue_throw( _rPropertyName );
     313             :     }
     314             : 
     315             :     //--------------------------------------------------------------------
     316           0 :     void SAL_CALL FormComponentPropertyHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException)
     317             :     {
     318           0 :         if( _rPropertyName == PROPERTY_ROWSET )
     319             :         {
     320           0 :             ::comphelper::OPropertyContainer::setPropertyValue( _rPropertyName, _rValue );
     321           0 :             return;
     322             :         }
     323             : 
     324           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     325           0 :         PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); // check if property is known by the handler
     326             : 
     327           0 :         Reference< graphic::XGraphicObject > xGrfObj;
     328           0 :         if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) )
     329             :         {
     330             :             DBG_ASSERT( xGrfObj.is(), "FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid");
     331           0 :             rtl::OUString sObjectID(  GRAPHOBJ_URLPREFIX  );
     332           0 :             sObjectID = sObjectID + xGrfObj->getUniqueID();
     333           0 :             m_xComponent->setPropertyValue( _rPropertyName, uno::makeAny( sObjectID ) );
     334             :         }
     335           0 :         else if ( PROPERTY_ID_FONT == nPropId )
     336             :         {
     337             :             // special handling, the value is a faked value we generated ourself in impl_executeFontDialog_nothrow
     338           0 :             Sequence< NamedValue > aFontPropertyValues;
     339           0 :             OSL_VERIFY( _rValue >>= aFontPropertyValues );
     340           0 :             const NamedValue* fontPropertyValue = aFontPropertyValues.getConstArray();
     341           0 :             const NamedValue* fontPropertyValueEnd = fontPropertyValue + aFontPropertyValues.getLength();
     342           0 :             for ( ; fontPropertyValue != fontPropertyValueEnd; ++fontPropertyValue )
     343           0 :                 m_xComponent->setPropertyValue( fontPropertyValue->Name, fontPropertyValue->Value );
     344             :         }
     345             :         else
     346             :         {
     347           0 :             Any aValue = _rValue;
     348             : 
     349             :             Reference< resource::XStringResourceResolver > xStringResourceResolver
     350           0 :                 = lcl_getStringResourceResolverForProperty( m_xComponent, _rPropertyName, _rValue );
     351           0 :             if( xStringResourceResolver.is() )
     352             :             {
     353             :                 Reference< resource::XStringResourceManager >
     354           0 :                     xStringResourceManager( xStringResourceResolver, UNO_QUERY );
     355           0 :                 if( xStringResourceManager.is() )
     356             :                 {
     357           0 :                     Any aPropertyValue( m_xComponent->getPropertyValue( _rPropertyName ) );
     358           0 :                     TypeClass eType = aPropertyValue.getValueType().getTypeClass();
     359           0 :                     if( eType == TypeClass_STRING )
     360             :                     {
     361           0 :                         ::rtl::OUString aPropStr;
     362           0 :                         aPropertyValue >>= aPropStr;
     363           0 :                         if( aPropStr.getLength() > 1 )
     364             :                         {
     365           0 :                             ::rtl::OUString aPureIdStr = aPropStr.copy( 1 );
     366           0 :                             ::rtl::OUString aValueStr;
     367           0 :                             _rValue >>= aValueStr;
     368           0 :                             xStringResourceManager->setString( aPureIdStr, aValueStr );
     369           0 :                             aValue = aPropertyValue;    // set value to force modified
     370           0 :                         }
     371             :                     }
     372             :                     // StringItemList?
     373           0 :                     else if( eType == TypeClass_SEQUENCE )
     374             :                     {
     375           0 :                         static ::rtl::OUString aDot(".");
     376           0 :                         static ::rtl::OUString aEsc("&");
     377             : 
     378             :                         // Put strings into resource using new ids
     379           0 :                         Sequence< ::rtl::OUString > aNewStrings;
     380           0 :                         _rValue >>= aNewStrings;
     381             : 
     382           0 :                         const ::rtl::OUString* pNewStrings = aNewStrings.getConstArray();
     383           0 :                         sal_Int32 nNewCount = aNewStrings.getLength();
     384             : 
     385             :                         // Create new Ids
     386           0 :                         ::rtl::OUString* pNewPureIds = new ::rtl::OUString[nNewCount];
     387           0 :                         ::rtl::OUString aIdStrBase = aDot;
     388           0 :                         Any aNameAny = m_xComponent->getPropertyValue(PROPERTY_NAME);
     389           0 :                         ::rtl::OUString sControlName;
     390           0 :                         aNameAny >>= sControlName;
     391           0 :                         aIdStrBase += sControlName;
     392           0 :                         aIdStrBase += aDot;
     393           0 :                         aIdStrBase += _rPropertyName;
     394             :                         sal_Int32 i;
     395           0 :                         ::rtl::OUString aDummyStr;
     396           0 :                         for ( i = 0; i < nNewCount; ++i )
     397             :                         {
     398           0 :                             sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId();
     399           0 :                             ::rtl::OUString aPureIdStr = ::rtl::OUString::valueOf( nUniqueId );
     400           0 :                             aPureIdStr += aIdStrBase;
     401           0 :                             pNewPureIds[i] = aPureIdStr;
     402             :                             // Force usage of next Unique Id
     403           0 :                             xStringResourceManager->setString( aPureIdStr, aDummyStr );
     404           0 :                         }
     405             : 
     406             :                         // Move strings to new Ids for all locales
     407           0 :                         Sequence< Locale > aLocaleSeq = xStringResourceManager->getLocales();
     408           0 :                         const Locale* pLocale = aLocaleSeq.getConstArray();
     409           0 :                         sal_Int32 nLocaleCount = aLocaleSeq.getLength();
     410           0 :                         Sequence< ::rtl::OUString > aOldIdStrings;
     411           0 :                         aPropertyValue >>= aOldIdStrings;
     412             :                         try
     413             :                         {
     414           0 :                             const ::rtl::OUString* pOldIdStrings = aOldIdStrings.getConstArray();
     415           0 :                             sal_Int32 nOldIdCount = aOldIdStrings.getLength();
     416           0 :                             for ( i = 0; i < nNewCount; ++i )
     417             :                             {
     418           0 :                                 ::rtl::OUString aOldIdStr;
     419           0 :                                 ::rtl::OUString aOldPureIdStr;
     420           0 :                                 if( i < nOldIdCount )
     421             :                                 {
     422           0 :                                     aOldIdStr = pOldIdStrings[i];
     423           0 :                                     aOldPureIdStr = aOldIdStr.copy( 1 );
     424             :                                 }
     425           0 :                                 ::rtl::OUString aNewPureIdStr = pNewPureIds[i];
     426             : 
     427           0 :                                 for ( sal_Int32 iLocale = 0; iLocale < nLocaleCount; ++iLocale )
     428             :                                 {
     429           0 :                                     Locale aLocale = pLocale[iLocale];
     430             : 
     431           0 :                                     ::rtl::OUString aResourceStr;
     432           0 :                                     if( !aOldPureIdStr.isEmpty() )
     433             :                                     {
     434           0 :                                         if( xStringResourceManager->hasEntryForIdAndLocale( aOldPureIdStr, aLocale ) )
     435             :                                         {
     436           0 :                                             aResourceStr = xStringResourceManager->
     437           0 :                                                 resolveStringForLocale( aOldPureIdStr, aLocale );
     438             :                                         }
     439             :                                     }
     440           0 :                                     xStringResourceManager->setStringForLocale( aNewPureIdStr, aResourceStr, aLocale );
     441           0 :                                 }
     442           0 :                             }
     443             :                         }
     444           0 :                         catch( const resource::MissingResourceException & )
     445             :                         {}
     446             : 
     447             : 
     448             :                         // Set new strings for current locale and create
     449             :                         // new Id sequence as new property value
     450           0 :                         Sequence< ::rtl::OUString > aNewIdStrings;
     451           0 :                         aNewIdStrings.realloc( nNewCount );
     452           0 :                         ::rtl::OUString* pNewIdStrings = aNewIdStrings.getArray();
     453           0 :                         for ( i = 0; i < nNewCount; ++i )
     454             :                         {
     455           0 :                             ::rtl::OUString aPureIdStr = pNewPureIds[i];
     456           0 :                             ::rtl::OUString aStr = pNewStrings[i];
     457           0 :                             xStringResourceManager->setString( aPureIdStr, aStr );
     458             : 
     459           0 :                             ::rtl::OUString aIdStr = aEsc;
     460           0 :                             aIdStr += aPureIdStr;
     461           0 :                             pNewIdStrings[i] = aIdStr;
     462           0 :                         }
     463           0 :                         aValue <<= aNewIdStrings;
     464             : 
     465             :                         // Remove old ids from resource for all locales
     466           0 :                         const ::rtl::OUString* pOldIdStrings = aOldIdStrings.getConstArray();
     467           0 :                         sal_Int32 nOldIdCount = aOldIdStrings.getLength();
     468           0 :                         for( i = 0 ; i < nOldIdCount ; ++i )
     469             :                         {
     470           0 :                             ::rtl::OUString aIdStr = pOldIdStrings[i];
     471           0 :                             ::rtl::OUString aPureIdStr = aIdStr.copy( 1 );
     472           0 :                             for ( sal_Int32 iLocale = 0; iLocale < nLocaleCount; ++iLocale )
     473             :                             {
     474           0 :                                 Locale aLocale = pLocale[iLocale];
     475             :                                 try
     476             :                                 {
     477           0 :                                     xStringResourceManager->removeIdForLocale( aPureIdStr, aLocale );
     478             :                                 }
     479           0 :                                 catch( const resource::MissingResourceException & )
     480             :                                 {}
     481           0 :                             }
     482           0 :                         }
     483           0 :                         delete[] pNewPureIds;
     484           0 :                     }
     485           0 :                 }
     486             :             }
     487             : 
     488           0 :             m_xComponent->setPropertyValue( _rPropertyName, aValue );
     489           0 :         }
     490             :     }
     491             : 
     492             :     //--------------------------------------------------------------------
     493           0 :     Any SAL_CALL FormComponentPropertyHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException)
     494             :     {
     495           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     496           0 :         PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
     497           0 :         Property aProperty( impl_getPropertyFromId_throw( nPropId ) );
     498             : 
     499           0 :         Any aPropertyValue( _rControlValue );
     500           0 :         if ( !aPropertyValue.hasValue() )
     501             :         {
     502           0 :             if ( ( aProperty.Attributes & PropertyAttribute::MAYBEVOID ) == 0 )
     503             :                 // default construct an instance of the proper type
     504           0 :                 aPropertyValue = Any( NULL, aProperty.Type );
     505             :             // nothing to do
     506           0 :             return aPropertyValue;
     507             :         }
     508             : 
     509             :         /// care for the special "default" string, translate it to VOID
     510           0 :         if ( m_aPropertiesWithDefListEntry.find( _rPropertyName ) != m_aPropertiesWithDefListEntry.end() )
     511             :         {
     512             :             // it's a control with a string list
     513           0 :             ::rtl::OUString sStringValue;
     514           0 :             if ( _rControlValue >>= sStringValue )
     515             :             {   // note that ColorListBoxes might transfer values either as string or as css.util.Color,
     516             :                 // so this check here is important
     517           0 :                 if ( sStringValue == m_sDefaultValueString )
     518           0 :                     return Any();
     519           0 :             }
     520             :         }
     521             : 
     522           0 :         switch ( nPropId )
     523             :         {
     524             :         case PROPERTY_ID_DATASOURCE:
     525             :         {
     526           0 :             ::rtl::OUString sControlValue;
     527           0 :             OSL_VERIFY( _rControlValue >>= sControlValue );
     528             : 
     529           0 :             if ( !sControlValue.isEmpty() )
     530             :             {
     531           0 :                 Reference< XDatabaseContext > xDatabaseContext = sdb::DatabaseContext::create( m_aContext.getUNOContext() );
     532           0 :                 if ( !xDatabaseContext->hasByName( sControlValue ) )
     533             :                 {
     534           0 :                     ::svt::OFileNotation aTransformer(sControlValue);
     535           0 :                     aPropertyValue <<= ::rtl::OUString( aTransformer.get( ::svt::OFileNotation::N_URL ) );
     536           0 :                 }
     537           0 :             }
     538             :         }
     539           0 :         break;  // case PROPERTY_ID_DATASOURCE
     540             : 
     541             :         case PROPERTY_ID_SHOW_POSITION:
     542             :         case PROPERTY_ID_SHOW_NAVIGATION:
     543             :         case PROPERTY_ID_SHOW_RECORDACTIONS:
     544             :         case PROPERTY_ID_SHOW_FILTERSORT:
     545             :         {
     546           0 :             ::rtl::OUString sControlValue;
     547           0 :             OSL_VERIFY( _rControlValue >>= sControlValue );
     548             : 
     549           0 :             ::std::vector< ::rtl::OUString > aListEntries;
     550           0 :             tools::StringListResource aRes( PcrRes( RID_RSC_ENUM_SHOWHIDE ), aListEntries );
     551             :             OSL_ENSURE( aListEntries.size() == 2, "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!" );
     552           0 :             sal_Bool bShow = ( aListEntries.size() < 2 ) || ( sControlValue == aListEntries[1] );
     553             : 
     554           0 :             aPropertyValue <<= bShow;
     555             :         }
     556           0 :         break;
     557             : 
     558             :         case PROPERTY_ID_TARGET_URL:
     559             :         case PROPERTY_ID_IMAGE_URL:
     560             :         {
     561           0 :             ::rtl::OUString sControlValue;
     562           0 :             OSL_VERIFY( _rControlValue >>= sControlValue );
     563             :             // Don't convert a placeholder
     564           0 :             if ( nPropId == PROPERTY_ID_IMAGE_URL && sControlValue.equals( String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ) ) )
     565           0 :                 aPropertyValue <<= sControlValue;
     566             :             else
     567             :             {
     568           0 :                 INetURLObject aDocURL( impl_getDocumentURL_nothrow() );
     569           0 :                 aPropertyValue <<= (::rtl::OUString)URIHelper::SmartRel2Abs( aDocURL, sControlValue, Link(), false, true, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI );
     570           0 :             }
     571             :         }
     572           0 :         break;
     573             : 
     574             :         case PROPERTY_ID_DATEMIN:
     575             :         case PROPERTY_ID_DATEMAX:
     576             :         case PROPERTY_ID_DEFAULT_DATE:
     577             :         case PROPERTY_ID_DATE:
     578             :         {
     579           0 :             util::Date aDate;
     580           0 :             OSL_VERIFY( _rControlValue >>= aDate );
     581           0 :             aPropertyValue <<= (sal_Int32)DBTypeConversion::toINT32( aDate );
     582             :         }
     583           0 :         break;
     584             : 
     585             :         case PROPERTY_ID_TIMEMIN:
     586             :         case PROPERTY_ID_TIMEMAX:
     587             :         case PROPERTY_ID_DEFAULT_TIME:
     588             :         case PROPERTY_ID_TIME:
     589             :         {
     590           0 :             util::Time aTime;
     591           0 :             OSL_VERIFY( _rControlValue >>= aTime );
     592           0 :             aPropertyValue <<= (sal_Int32)DBTypeConversion::toINT32( aTime );
     593             :         }
     594           0 :         break;
     595             : 
     596             :         case PROPERTY_ID_WRITING_MODE:
     597             :         {
     598           0 :             aPropertyValue = FormComponentPropertyHandler_Base::convertToPropertyValue( _rPropertyName, _rControlValue );
     599             : 
     600           0 :             sal_Int16 nNormalizedValue( 2 );
     601           0 :             OSL_VERIFY( aPropertyValue >>= nNormalizedValue );
     602           0 :             sal_Int16 nWritingMode = WritingMode2::CONTEXT;
     603           0 :             switch ( nNormalizedValue )
     604             :             {
     605           0 :             case 0: nWritingMode = WritingMode2::LR_TB;      break;
     606           0 :             case 1: nWritingMode = WritingMode2::RL_TB;      break;
     607           0 :             case 2: nWritingMode = WritingMode2::CONTEXT;    break;
     608             :             default:
     609             :                 OSL_FAIL( "FormComponentPropertyHandler::convertToPropertyValue: unexpected 'normalized value' for WritingMode!" );
     610           0 :                 nWritingMode = WritingMode2::CONTEXT;
     611           0 :                 break;
     612             :             }
     613             : 
     614           0 :             aPropertyValue <<= nWritingMode;
     615             :         }
     616           0 :         break;
     617             : 
     618             :         default:
     619           0 :             aPropertyValue = FormComponentPropertyHandler_Base::convertToPropertyValue( _rPropertyName, _rControlValue );
     620           0 :             break;  // default
     621             : 
     622             :         }   // switch ( nPropId )
     623             : 
     624           0 :         return aPropertyValue;
     625             :     }
     626             : 
     627             :     //--------------------------------------------------------------------
     628           0 :     Any SAL_CALL FormComponentPropertyHandler::convertToControlValue( const ::rtl::OUString& _rPropertyName, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException)
     629             :     {
     630           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     631           0 :         sal_Int32 nPropId = m_pInfoService->getPropertyId( _rPropertyName );
     632             :         DBG_ASSERT( nPropId != -1, "FormComponentPropertyHandler::convertToPropertyValue: not one of my properties!!" );
     633             : 
     634           0 :         Property aProperty( impl_getPropertyFromId_throw( nPropId ) );
     635             : 
     636           0 :         Any aControlValue( _rPropertyValue );
     637           0 :         if ( !aControlValue.hasValue() )
     638             :         {
     639             :             // if the property is represented with a list box or color list box, we need to
     640             :             // translate this into the string "Default"
     641           0 :             if ( m_aPropertiesWithDefListEntry.find( _rPropertyName ) != m_aPropertiesWithDefListEntry.end() )
     642           0 :                 aControlValue <<= m_sDefaultValueString;
     643             : 
     644             :             return aControlValue;
     645             :         }
     646             : 
     647           0 :         switch ( nPropId )
     648             :         {
     649             :         //////////////////////////////////////////////////////////////
     650             :         case PROPERTY_ID_SHOW_POSITION:
     651             :         case PROPERTY_ID_SHOW_NAVIGATION:
     652             :         case PROPERTY_ID_SHOW_RECORDACTIONS:
     653             :         case PROPERTY_ID_SHOW_FILTERSORT:
     654             :         {
     655           0 :             ::std::vector< ::rtl::OUString > aListEntries;
     656           0 :             tools::StringListResource aRes( PcrRes( RID_RSC_ENUM_SHOWHIDE ), aListEntries );
     657             :             OSL_ENSURE( aListEntries.size() == 2, "FormComponentPropertyHandler::convertToControlValue: broken resource for Show/Hide!" );
     658             : 
     659           0 :             if ( aListEntries.size() == 2 )
     660             :             {
     661           0 :                 ::rtl::OUString sControlValue =     ::comphelper::getBOOL( _rPropertyValue )
     662             :                                                 ?   aListEntries[1]
     663           0 :                                                 :   aListEntries[0];
     664           0 :                 aControlValue <<= sControlValue;
     665           0 :             }
     666             :         }
     667           0 :         break;
     668             : 
     669             :         //////////////////////////////////////////////////////////////
     670             :         case PROPERTY_ID_DATASOURCE:
     671             :         {
     672             :             OSL_ENSURE( _rControlValueType.getTypeClass() == TypeClass_STRING,
     673             :                 "FormComponentPropertyHandler::convertToControlValue: wrong ControlValueType!" );
     674             : 
     675           0 :             ::rtl::OUString sDataSource;
     676           0 :             _rPropertyValue >>= sDataSource;
     677           0 :             if ( !sDataSource.isEmpty() )
     678             :             {
     679           0 :                 ::svt::OFileNotation aTransformer( sDataSource );
     680           0 :                 sDataSource = aTransformer.get( ::svt::OFileNotation::N_SYSTEM );
     681             :             }
     682           0 :             aControlValue <<= sDataSource;
     683             :         }
     684           0 :         break;
     685             : 
     686             :         //////////////////////////////////////////////////////////////
     687             :         case PROPERTY_ID_CONTROLLABEL:
     688             :         {
     689           0 :             ::rtl::OUString sControlValue;
     690             : 
     691           0 :             Reference< XPropertySet >  xSet;
     692           0 :             _rPropertyValue >>= xSet;
     693           0 :             Reference< XPropertySetInfo > xPSI;
     694           0 :             if ( xSet.is() )
     695           0 :                 xPSI = xSet->getPropertySetInfo();
     696           0 :             if ( xPSI.is() && xPSI->hasPropertyByName( PROPERTY_LABEL ) )
     697             :             {
     698           0 :                 ::rtl::OUStringBuffer aValue;
     699           0 :                 aValue.append( (sal_Unicode)'<' );
     700           0 :                 ::rtl::OUString sLabel;
     701           0 :                 OSL_VERIFY( xSet->getPropertyValue( PROPERTY_LABEL ) >>= sLabel );
     702           0 :                 aValue.append( sLabel );
     703           0 :                 aValue.append( (sal_Unicode)'>' );
     704           0 :                 sControlValue = aValue.makeStringAndClear();
     705             :             }
     706             : 
     707           0 :             aControlValue <<= sControlValue;
     708             :         }
     709           0 :         break;
     710             : 
     711             :         //////////////////////////////////////////////////////////////
     712             :         case PROPERTY_ID_DATEMIN:
     713             :         case PROPERTY_ID_DATEMAX:
     714             :         case PROPERTY_ID_DEFAULT_DATE:
     715             :         case PROPERTY_ID_DATE:
     716             :         {
     717           0 :             sal_Int32 nDate = 0;
     718           0 :             OSL_VERIFY( _rPropertyValue >>= nDate );
     719           0 :             aControlValue <<= DBTypeConversion::toDate( nDate );
     720             :         }
     721           0 :         break;
     722             : 
     723             :         case PROPERTY_ID_TIMEMIN:
     724             :         case PROPERTY_ID_TIMEMAX:
     725             :         case PROPERTY_ID_DEFAULT_TIME:
     726             :         case PROPERTY_ID_TIME:
     727             :         {
     728           0 :             sal_Int32 nTime = 0;
     729           0 :             OSL_VERIFY( _rPropertyValue >>= nTime );
     730           0 :             aControlValue <<= DBTypeConversion::toTime( nTime );
     731             :         }
     732           0 :         break;
     733             : 
     734             :         case PROPERTY_ID_WRITING_MODE:
     735             :         {
     736           0 :             sal_Int16 nWritingMode( WritingMode2::CONTEXT );
     737           0 :             OSL_VERIFY( _rPropertyValue >>= nWritingMode );
     738           0 :             sal_Int16 nNormalized = 2;
     739           0 :             switch ( nWritingMode )
     740             :             {
     741           0 :             case WritingMode2::LR_TB:   nNormalized = 0;    break;
     742           0 :             case WritingMode2::RL_TB:   nNormalized = 1;    break;
     743           0 :             case WritingMode2::CONTEXT: nNormalized = 2;    break;
     744             :             default:
     745             :                 OSL_FAIL( "FormComponentPropertyHandler::convertToControlValue: unsupported API value for WritingMode!" );
     746           0 :                 nNormalized = 2;
     747           0 :                 break;
     748             :             }
     749             : 
     750           0 :             aControlValue = FormComponentPropertyHandler_Base::convertToControlValue( _rPropertyName, makeAny( nNormalized ), _rControlValueType );
     751             :         }
     752           0 :         break;
     753             : 
     754             :         case PROPERTY_ID_FONT:
     755             :         {
     756           0 :             FontDescriptor aFont;
     757           0 :             OSL_VERIFY( _rPropertyValue >>= aFont );
     758             : 
     759           0 :             ::rtl::OUStringBuffer displayName;
     760           0 :             if ( aFont.Name.isEmpty() )
     761             :             {
     762           0 :                 displayName.append( String( PcrRes( RID_STR_FONT_DEFAULT ) ) );
     763             :             }
     764             :             else
     765             :             {
     766             :                 // font name
     767           0 :                 displayName.append( aFont.Name );
     768           0 :                 displayName.appendAscii( ", " );
     769             : 
     770             :                 // font style
     771           0 :                 ::FontWeight  eWeight = VCLUnoHelper::ConvertFontWeight( aFont.Weight );
     772           0 :                 sal_uInt16 nStyleResID = RID_STR_FONTSTYLE_REGULAR;
     773           0 :                 if ( aFont.Slant == FontSlant_ITALIC )
     774             :                 {
     775           0 :                     if ( eWeight > WEIGHT_NORMAL )
     776           0 :                         nStyleResID = RID_STR_FONTSTYLE_BOLD_ITALIC;
     777             :                     else
     778           0 :                         nStyleResID = RID_STR_FONTSTYLE_ITALIC;
     779             :                 }
     780             :                 else
     781             :                 {
     782           0 :                     if ( eWeight > WEIGHT_NORMAL )
     783           0 :                         nStyleResID = RID_STR_FONTSTYLE_BOLD;
     784             :                 }
     785           0 :                 displayName.append( String( PcrRes( nStyleResID ) ) );
     786             : 
     787             :                 // font size
     788           0 :                 if ( aFont.Height )
     789             :                 {
     790           0 :                     displayName.appendAscii( ", " );
     791           0 :                     displayName.append( sal_Int32( aFont.Height ) );
     792             :                 }
     793             :             }
     794             : 
     795           0 :             aControlValue <<= displayName.makeStringAndClear();
     796             :         }
     797           0 :         break;
     798             : 
     799             :         default:
     800           0 :             aControlValue = FormComponentPropertyHandler_Base::convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType );
     801           0 :             break;
     802             : 
     803             :         }   // switch ( nPropId )
     804             : 
     805           0 :         return aControlValue;
     806             :     }
     807             : 
     808             :     //--------------------------------------------------------------------
     809           0 :     PropertyState SAL_CALL FormComponentPropertyHandler::getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException)
     810             :     {
     811           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     812           0 :         if ( m_xPropertyState.is() )
     813           0 :             return m_xPropertyState->getPropertyState( _rPropertyName );
     814           0 :         return PropertyState_DIRECT_VALUE;
     815             :     }
     816             : 
     817             :     //--------------------------------------------------------------------
     818           0 :     void SAL_CALL FormComponentPropertyHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException)
     819             :     {
     820           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     821           0 :         FormComponentPropertyHandler_Base::addPropertyChangeListener( _rxListener );
     822           0 :         if ( m_xComponent.is() )
     823           0 :             m_xComponent->addPropertyChangeListener( ::rtl::OUString(), _rxListener );
     824           0 :     }
     825             : 
     826             :     //--------------------------------------------------------------------
     827           0 :     void SAL_CALL FormComponentPropertyHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException)
     828             :     {
     829           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     830           0 :         if ( m_xComponent.is() )
     831           0 :             m_xComponent->removePropertyChangeListener( ::rtl::OUString(), _rxListener );
     832           0 :         FormComponentPropertyHandler_Base::removePropertyChangeListener( _rxListener );
     833           0 :     }
     834             : 
     835             :     //--------------------------------------------------------------------
     836           0 :     void FormComponentPropertyHandler::onNewComponent()
     837             :     {
     838           0 :         FormComponentPropertyHandler_Base::onNewComponent();
     839           0 :         if ( !m_xComponentPropertyInfo.is() && m_xComponent.is() )
     840           0 :             throw NullPointerException();
     841             : 
     842           0 :         m_xPropertyState.set( m_xComponent, UNO_QUERY );
     843           0 :         m_eComponentClass = eUnknown;
     844           0 :         m_bComponentIsSubForm = m_bHaveListSource = m_bHaveCommand = false;
     845           0 :         m_nClassId = 0;
     846             : 
     847           0 :         impl_initComponentMetaData_throw();
     848           0 :     }
     849             : 
     850             :     //--------------------------------------------------------------------
     851           0 :     Sequence< Property > SAL_CALL FormComponentPropertyHandler::doDescribeSupportedProperties() const
     852             :     {
     853           0 :         if ( !m_xComponentPropertyInfo.is() )
     854           0 :             return Sequence< Property >();
     855             : 
     856           0 :         ::std::vector< Property > aProperties;
     857             : 
     858           0 :         Sequence< Property > aAllProperties( m_xComponentPropertyInfo->getProperties() );
     859           0 :         aProperties.reserve( aAllProperties.getLength() );
     860             : 
     861             :         // filter the properties
     862           0 :         PropertyId nPropId( 0 );
     863           0 :         ::rtl::OUString sDisplayName;
     864             : 
     865           0 :         Property* pProperty = aAllProperties.getArray();
     866           0 :         Property* pPropertiesEnd = pProperty + aAllProperties.getLength();
     867           0 :         for ( ; pProperty != pPropertiesEnd; ++pProperty )
     868             :         {
     869           0 :             nPropId = m_pInfoService->getPropertyId( pProperty->Name );
     870           0 :             if ( nPropId == -1 )
     871           0 :                 continue;
     872           0 :             pProperty->Handle = nPropId;
     873             : 
     874           0 :             sDisplayName = m_pInfoService->getPropertyTranslation( nPropId );
     875           0 :             if ( sDisplayName.isEmpty() )
     876           0 :                 continue;
     877             : 
     878           0 :             sal_uInt32  nPropertyUIFlags = m_pInfoService->getPropertyUIFlags( nPropId );
     879           0 :             bool bIsVisibleForForms   = ( nPropertyUIFlags & PROP_FLAG_FORM_VISIBLE   ) != 0;
     880           0 :             bool bIsVisibleForDialogs = ( nPropertyUIFlags & PROP_FLAG_DIALOG_VISIBLE ) != 0;
     881             : 
     882             :             // depending on whether we're working for a form or a UNO dialog, some
     883             :             // properties are not displayed
     884           0 :             if  (  ( m_eComponentClass == eFormControl   && !bIsVisibleForForms )
     885           0 :                 || ( m_eComponentClass == eDialogControl && !bIsVisibleForDialogs )
     886             :                 )
     887           0 :                 continue;
     888             : 
     889             :             // some generic sanity checks
     890           0 :             if ( impl_shouldExcludeProperty_nothrow( *pProperty ) )
     891           0 :                 continue;
     892             : 
     893           0 :             switch ( nPropId )
     894             :             {
     895             :             case PROPERTY_ID_BORDER:
     896             :             case PROPERTY_ID_TABSTOP:
     897             :                 // BORDER and TABSTOP are normalized (see impl_normalizePropertyValue_nothrow)
     898             :                 // to not allow VOID values
     899           0 :                 pProperty->Attributes &= ~( PropertyAttribute::MAYBEVOID );
     900           0 :                 break;
     901             : 
     902             :             case PROPERTY_ID_LISTSOURCE:
     903             :                 // no cursor source if no Base is installed. #124939#
     904             :                 // This fix is not intendend to appear on the main trunk. If you find it there,
     905             :                 // please tell me! frank.schoenheit@sun.com
     906           0 :                 if ( SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
     907           0 :                     const_cast< FormComponentPropertyHandler* >( this )->m_bHaveListSource = true;
     908           0 :                 break;
     909             : 
     910             :             case PROPERTY_ID_COMMAND:
     911             :                 // no cursor source if no Base is installed. #124939#
     912             :                 // This fix is not intendend to appear on the main trunk. If you find it there,
     913             :                 // please tell me! frank.schoenheit@sun.com
     914           0 :                 if ( SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
     915           0 :                     const_cast< FormComponentPropertyHandler* >( this )->m_bHaveCommand = true;
     916           0 :                 break;
     917             :             }   // switch ( nPropId )
     918             : 
     919           0 :             aProperties.push_back( *pProperty );
     920             :         }
     921             : 
     922           0 :         if ( aProperties.empty() )
     923           0 :             return Sequence< Property >();
     924           0 :         return Sequence< Property >( &(*aProperties.begin()), aProperties.size() );
     925             :     }
     926             : 
     927             :     //--------------------------------------------------------------------
     928           0 :     Sequence< ::rtl::OUString > SAL_CALL FormComponentPropertyHandler::getSupersededProperties( ) throw (RuntimeException)
     929             :     {
     930           0 :         return Sequence< ::rtl::OUString >( );
     931             :     }
     932             : 
     933             :     //--------------------------------------------------------------------
     934           0 :     Sequence< ::rtl::OUString > SAL_CALL FormComponentPropertyHandler::getActuatingProperties( ) throw (RuntimeException)
     935             :     {
     936           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     937           0 :         ::std::vector< ::rtl::OUString > aInterestingProperties;
     938           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_DATASOURCE) );
     939           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_COMMAND) );
     940           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_COMMANDTYPE) );
     941           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_LISTSOURCE) );
     942           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_LISTSOURCETYPE) );
     943           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_SUBMIT_ENCODING) );
     944           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_REPEAT) );
     945           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_TABSTOP) );
     946           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_BORDER) );
     947           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_CONTROLSOURCE) );
     948           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_DROPDOWN) );
     949           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_IMAGE_URL) );
     950           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_TARGET_URL) );
     951           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_STRINGITEMLIST) );
     952           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_BUTTONTYPE) );
     953           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_ESCAPE_PROCESSING) );
     954           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_TRISTATE) );
     955           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_DECIMAL_ACCURACY) );
     956           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_SHOWTHOUSANDSEP) );
     957           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_FORMATKEY) );
     958           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_EMPTY_IS_NULL) );
     959           0 :         aInterestingProperties.push_back(  static_cast<const rtl::OUString&>(PROPERTY_TOGGLE) );
     960           0 :         return Sequence< ::rtl::OUString >( &(*aInterestingProperties.begin()), aInterestingProperties.size() );
     961             :     }
     962             : 
     963             :     //--------------------------------------------------------------------
     964           0 :     LineDescriptor SAL_CALL FormComponentPropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName,
     965             :         const Reference< XPropertyControlFactory >& _rxControlFactory )
     966             :         throw (UnknownPropertyException, NullPointerException, RuntimeException)
     967             :     {
     968           0 :         if ( !_rxControlFactory.is() )
     969           0 :             throw NullPointerException();
     970             : 
     971           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     972           0 :         PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
     973           0 :         Property aProperty( impl_getPropertyFromId_throw( nPropId ) );
     974             : 
     975             :         //////////////////////////////////////////////////////////////////////
     976             :         // for the MultiLine property, we have different UI translations depending on the control
     977             :         // type
     978           0 :         if ( nPropId == PROPERTY_ID_MULTILINE )
     979             :         {
     980           0 :             if (  ( m_nClassId == FormComponentType::FIXEDTEXT )
     981             :                || ( m_nClassId == FormComponentType::COMMANDBUTTON )
     982             :                || ( m_nClassId == FormComponentType::RADIOBUTTON )
     983             :                || ( m_nClassId == FormComponentType::CHECKBOX )
     984             :                )
     985           0 :                 nPropId = PROPERTY_ID_WORDBREAK;
     986             :         }
     987             : 
     988           0 :         String sDisplayName = m_pInfoService->getPropertyTranslation( nPropId );
     989           0 :         if ( !sDisplayName.Len() )
     990             :         {
     991             :             OSL_FAIL( "FormComponentPropertyHandler::describePropertyLine: did getSupportedProperties not work properly?" );
     992           0 :             throw UnknownPropertyException();
     993             :         }
     994             : 
     995             :         //////////////////////////////////////////////////////////////////////
     996             : 
     997           0 :         LineDescriptor aDescriptor;
     998           0 :         aDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nPropId ) );
     999           0 :         aDescriptor.DisplayName = sDisplayName;
    1000             : 
    1001             :         // for the moment, assume a text field
    1002           0 :         sal_Int16 nControlType = PropertyControlType::TextField;
    1003           0 :         sal_Bool bReadOnly = sal_False;
    1004           0 :         aDescriptor.Control.clear();
    1005             : 
    1006             :         //////////////////////////////////////////////////////////////////////
    1007             : 
    1008           0 :         bool bNeedDefaultStringIfVoidAllowed = false;
    1009             : 
    1010           0 :         TypeClass eType = aProperty.Type.getTypeClass();
    1011             : 
    1012           0 :         switch ( nPropId )
    1013             :         {
    1014             :         case PROPERTY_ID_DEFAULT_SELECT_SEQ:
    1015             :         case PROPERTY_ID_SELECTEDITEMS:
    1016           0 :             aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_SELECTION);
    1017           0 :             break;
    1018             : 
    1019             :         case PROPERTY_ID_FILTER:
    1020           0 :             aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_FILTER);
    1021           0 :             break;
    1022             : 
    1023             :         case PROPERTY_ID_SORT:
    1024           0 :             aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_ORDER);
    1025           0 :             break;
    1026             : 
    1027             :         case PROPERTY_ID_MASTERFIELDS:
    1028             :         case PROPERTY_ID_DETAILFIELDS:
    1029           0 :             nControlType = PropertyControlType::StringListField;
    1030           0 :             aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_FORMLINKFIELDS);
    1031           0 :             break;
    1032             : 
    1033             :         case PROPERTY_ID_COMMAND:
    1034           0 :             aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_SQLCOMMAND);
    1035           0 :             break;
    1036             : 
    1037             :         case PROPERTY_ID_TABINDEX:
    1038             :         {
    1039           0 :             Reference< XControlContainer > xControlContext( impl_getContextControlContainer_nothrow() );
    1040           0 :             if ( xControlContext.is() )
    1041           0 :                 aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_TABINDEX);
    1042           0 :             nControlType = PropertyControlType::NumericField;
    1043             :         };
    1044           0 :         break;
    1045             : 
    1046             :         case PROPERTY_ID_FONT:
    1047           0 :             bReadOnly = sal_True;
    1048           0 :             aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_FONT_TYPE);
    1049           0 :             break;
    1050             : 
    1051             :         case PROPERTY_ID_TARGET_URL:
    1052             :         case PROPERTY_ID_IMAGE_URL:
    1053             :         {
    1054           0 :             aDescriptor.Control = new OFileUrlControl( impl_getDefaultDialogParent_nothrow(), WB_TABSTOP | WB_BORDER );
    1055             : 
    1056             :             aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(( PROPERTY_ID_TARGET_URL == nPropId )
    1057           0 :                 ? UID_PROP_DLG_ATTR_TARGET_URL : UID_PROP_DLG_IMAGE_URL);
    1058             :         }
    1059           0 :         break;
    1060             : 
    1061             :         case PROPERTY_ID_ECHO_CHAR:
    1062           0 :             nControlType = PropertyControlType::CharacterField;
    1063           0 :             break;
    1064             : 
    1065             :         case PROPERTY_ID_BACKGROUNDCOLOR:
    1066             :         case PROPERTY_ID_FILLCOLOR:
    1067             :         case PROPERTY_ID_SYMBOLCOLOR:
    1068             :         case PROPERTY_ID_BORDERCOLOR:
    1069           0 :             nControlType = PropertyControlType::ColorListBox;
    1070             : 
    1071           0 :             switch( nPropId )
    1072             :             {
    1073             :             case PROPERTY_ID_BACKGROUNDCOLOR:
    1074           0 :                 aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_BACKGROUNDCOLOR); break;
    1075             :             case PROPERTY_ID_FILLCOLOR:
    1076           0 :                 aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_FILLCOLOR); break;
    1077             :             case PROPERTY_ID_SYMBOLCOLOR:
    1078           0 :                 aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_SYMBOLCOLOR); break;
    1079             :             case PROPERTY_ID_BORDERCOLOR:
    1080           0 :                 aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_BORDERCOLOR); break;
    1081             :             }
    1082           0 :             break;
    1083             : 
    1084             :         case PROPERTY_ID_LABEL:
    1085           0 :             nControlType = PropertyControlType::MultiLineTextField;
    1086           0 :             break;
    1087             : 
    1088             :         case PROPERTY_ID_DEFAULT_TEXT:
    1089             :         {
    1090           0 :             if (FormComponentType::FILECONTROL == m_nClassId)
    1091           0 :                 nControlType = PropertyControlType::TextField;
    1092             :             else
    1093           0 :                 nControlType = PropertyControlType::MultiLineTextField;
    1094             :         }
    1095           0 :         break;
    1096             : 
    1097             :         case PROPERTY_ID_TEXT:
    1098           0 :             if ( impl_componentHasProperty_throw( PROPERTY_MULTILINE ) )
    1099           0 :                 nControlType = PropertyControlType::MultiLineTextField;
    1100           0 :             break;
    1101             : 
    1102             :         case PROPERTY_ID_CONTROLLABEL:
    1103           0 :             bReadOnly = sal_True;
    1104           0 :             aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_CONTROLLABEL);
    1105           0 :             break;
    1106             : 
    1107             :         case PROPERTY_ID_FORMATKEY:
    1108             :         case PROPERTY_ID_EFFECTIVE_MIN:
    1109             :         case PROPERTY_ID_EFFECTIVE_MAX:
    1110             :         case PROPERTY_ID_EFFECTIVE_DEFAULT:
    1111             :         case PROPERTY_ID_EFFECTIVE_VALUE:
    1112             :         {
    1113             :             // and the supplier is really available
    1114           0 :             Reference< XNumberFormatsSupplier >  xSupplier;
    1115           0 :             m_xComponent->getPropertyValue( PROPERTY_FORMATSSUPPLIER ) >>= xSupplier;
    1116           0 :             if (xSupplier.is())
    1117             :             {
    1118           0 :                 Reference< XUnoTunnel > xTunnel(xSupplier,UNO_QUERY);
    1119             :                 DBG_ASSERT(xTunnel.is(), "FormComponentPropertyHandler::describePropertyLine : xTunnel is invalid!");
    1120           0 :                 SvNumberFormatsSupplierObj* pSupplier = reinterpret_cast<SvNumberFormatsSupplierObj*>(xTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId()));
    1121             : 
    1122           0 :                 if (pSupplier != NULL)
    1123             :                 {
    1124           0 :                     sal_Bool bIsFormatKey = (PROPERTY_ID_FORMATKEY == nPropId);
    1125             : 
    1126           0 :                     bReadOnly = bIsFormatKey;
    1127             : 
    1128           0 :                     if ( bIsFormatKey )
    1129             :                     {
    1130           0 :                         OFormatSampleControl* pControl = new OFormatSampleControl( impl_getDefaultDialogParent_nothrow(), WB_READONLY | WB_TABSTOP | WB_BORDER );
    1131           0 :                         aDescriptor.Control = pControl;
    1132           0 :                         pControl->SetFormatSupplier( pSupplier );
    1133             : 
    1134           0 :                         aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_NUMBER_FORMAT);
    1135             :                     }
    1136             :                     else
    1137             :                     {
    1138           0 :                         OFormattedNumericControl* pControl = new OFormattedNumericControl( impl_getDefaultDialogParent_nothrow(), WB_TABSTOP | WB_BORDER );
    1139           0 :                         aDescriptor.Control = pControl;
    1140             : 
    1141             :                         FormatDescription aDesc;
    1142           0 :                         aDesc.pSupplier = pSupplier;
    1143           0 :                         Any aFormatKeyValue = m_xComponent->getPropertyValue(PROPERTY_FORMATKEY);
    1144           0 :                         if ( !( aFormatKeyValue >>= aDesc.nKey ) )
    1145           0 :                             aDesc.nKey = 0;
    1146             : 
    1147           0 :                         pControl->SetFormatDescription( aDesc );
    1148             :                     }
    1149           0 :                 }
    1150           0 :             }
    1151             :         }
    1152           0 :         break;
    1153             : 
    1154             :         case PROPERTY_ID_DATEMIN:
    1155             :         case PROPERTY_ID_DATEMAX:
    1156             :         case PROPERTY_ID_DEFAULT_DATE:
    1157             :         case PROPERTY_ID_DATE:
    1158           0 :             nControlType = PropertyControlType::DateField;
    1159           0 :             break;
    1160             : 
    1161             :         case PROPERTY_ID_TIMEMIN:
    1162             :         case PROPERTY_ID_TIMEMAX:
    1163             :         case PROPERTY_ID_DEFAULT_TIME:
    1164             :         case PROPERTY_ID_TIME:
    1165           0 :             nControlType = PropertyControlType::TimeField;
    1166           0 :             break;
    1167             : 
    1168             :         case PROPERTY_ID_VALUEMIN:
    1169             :         case PROPERTY_ID_VALUEMAX:
    1170             :         case PROPERTY_ID_DEFAULT_VALUE:
    1171             :         case PROPERTY_ID_VALUE:
    1172             :             {
    1173           0 :                 OFormattedNumericControl* pControl = new OFormattedNumericControl( impl_getDefaultDialogParent_nothrow(), WB_TABSTOP | WB_BORDER | WB_SPIN | WB_REPEAT );
    1174           0 :                 aDescriptor.Control = pControl;
    1175             : 
    1176             :                 // we don't set a formatter so the control uses a default (which uses the application
    1177             :                 // language and a default numeric format)
    1178             :                 // but we set the decimal digits
    1179             :                 pControl->SetDecimalDigits(
    1180           0 :                     ::comphelper::getINT16( m_xComponent->getPropertyValue( PROPERTY_DECIMAL_ACCURACY ) )
    1181           0 :                 );
    1182             : 
    1183             :                 // and the thousands separator
    1184             :                 pControl->SetThousandsSep(
    1185           0 :                     ::comphelper::getBOOL( m_xComponent->getPropertyValue(PROPERTY_SHOWTHOUSANDSEP) )
    1186           0 :                 );
    1187             : 
    1188             :                 // and the default value for the property
    1189             :                 try
    1190             :                 {
    1191           0 :                     if (m_xPropertyState.is() && ((PROPERTY_ID_VALUEMIN == nPropId) || (PROPERTY_ID_VALUEMAX == nPropId)))
    1192             :                     {
    1193           0 :                         double nDefault = 0;
    1194           0 :                         if ( m_xPropertyState->getPropertyDefault( aProperty.Name ) >>= nDefault )
    1195           0 :                             pControl->SetDefaultValue( nDefault );
    1196             :                     }
    1197             :                 }
    1198           0 :                 catch (const Exception&)
    1199             :                 {
    1200             :                     // just ignore it
    1201             :                 }
    1202             : 
    1203             :                 // and allow empty values only for the default value and the value
    1204             :                 pControl->EnableEmptyField( ( PROPERTY_ID_DEFAULT_VALUE == nPropId )
    1205           0 :                                         ||  ( PROPERTY_ID_VALUE == nPropId ) );
    1206             :             }
    1207           0 :             break;
    1208             : 
    1209             :         default:
    1210           0 :             if ( TypeClass_BYTE <= eType && eType <= TypeClass_DOUBLE )
    1211             :             {
    1212           0 :                 sal_Int16 nDigits = 0;
    1213           0 :                 sal_Int16 nValueUnit = -1;
    1214           0 :                 sal_Int16 nDisplayUnit = -1;
    1215           0 :                 if ( m_eComponentClass == eFormControl )
    1216             :                 {
    1217           0 :                     if  (  ( nPropId == PROPERTY_ID_WIDTH )
    1218             :                         || ( nPropId == PROPERTY_ID_ROWHEIGHT )
    1219             :                         || ( nPropId == PROPERTY_ID_HEIGHT )
    1220             :                         )
    1221             :                     {
    1222           0 :                         nValueUnit = MeasureUnit::MM_10TH;
    1223           0 :                         nDisplayUnit = impl_getDocumentMeasurementUnit_throw();
    1224           0 :                         nDigits = 2;
    1225             :                     }
    1226             :                 }
    1227             : 
    1228           0 :                 Optional< double > aValueNotPresent( sal_False, 0 );
    1229             :                 aDescriptor.Control = PropertyHandlerHelper::createNumericControl(
    1230           0 :                     _rxControlFactory, nDigits, aValueNotPresent, aValueNotPresent, sal_False );
    1231             : 
    1232           0 :                 Reference< XNumericControl > xNumericControl( aDescriptor.Control, UNO_QUERY_THROW );
    1233           0 :                 if ( nValueUnit != -1 )
    1234           0 :                     xNumericControl->setValueUnit( nValueUnit );
    1235           0 :                 if ( nDisplayUnit != -1 )
    1236           0 :                     xNumericControl->setDisplayUnit( nDisplayUnit );
    1237             :             }
    1238           0 :             break;
    1239             :         }
    1240             : 
    1241             :         //////////////////////////////////////////////////////////////////////
    1242           0 :         if ( eType == TypeClass_SEQUENCE )
    1243           0 :             nControlType = PropertyControlType::StringListField;
    1244             : 
    1245             :         //////////////////////////////////////////////////////////////////////
    1246             :         // boolean values
    1247           0 :         if ( eType == TypeClass_BOOLEAN )
    1248             :         {
    1249           0 :             sal_uInt16 nResId = RID_RSC_ENUM_YESNO;
    1250           0 :             if  (   ( nPropId == PROPERTY_ID_SHOW_POSITION )
    1251             :                 ||  ( nPropId == PROPERTY_ID_SHOW_NAVIGATION )
    1252             :                 ||  ( nPropId == PROPERTY_ID_SHOW_RECORDACTIONS )
    1253             :                 ||  ( nPropId == PROPERTY_ID_SHOW_FILTERSORT )
    1254             :                 )
    1255           0 :                 nResId = RID_RSC_ENUM_SHOWHIDE;
    1256             : 
    1257           0 :             ::std::vector< ::rtl::OUString > aListEntries;
    1258           0 :             tools::StringListResource aRes(PcrRes(nResId),aListEntries);
    1259           0 :             aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, sal_False, sal_False );
    1260           0 :             bNeedDefaultStringIfVoidAllowed = true;
    1261             :         }
    1262             : 
    1263             :         //////////////////////////////////////////////////////////////////////
    1264             :         // enum properties
    1265           0 :         sal_uInt32 nPropertyUIFlags = m_pInfoService->getPropertyUIFlags( nPropId );
    1266           0 :         bool bIsEnumProperty = ( nPropertyUIFlags & PROP_FLAG_ENUM ) != 0;
    1267           0 :         if ( bIsEnumProperty || ( PROPERTY_ID_TARGET_FRAME == nPropId ) )
    1268             :         {
    1269           0 :             ::std::vector< ::rtl::OUString > aEnumValues = m_pInfoService->getPropertyEnumRepresentations( nPropId );
    1270           0 :             ::std::vector< ::rtl::OUString >::const_iterator pStart = aEnumValues.begin();
    1271           0 :             ::std::vector< ::rtl::OUString >::const_iterator pEnd = aEnumValues.end();
    1272             : 
    1273             :             // for a checkbox: if "ambiguous" is not allowed, remove this from the sequence
    1274           0 :             if  (   ( PROPERTY_ID_DEFAULT_STATE == nPropId )
    1275             :                 ||  ( PROPERTY_ID_STATE == nPropId )
    1276             :                 )
    1277             :             {
    1278           0 :                 if ( impl_componentHasProperty_throw( PROPERTY_TRISTATE ) )
    1279             :                 {
    1280           0 :                     if ( !::comphelper::getBOOL( m_xComponent->getPropertyValue( PROPERTY_TRISTATE ) ) )
    1281             :                     {   // remove the last sequence element
    1282           0 :                         if ( pEnd > pStart )
    1283           0 :                             --pEnd;
    1284             :                     }
    1285             :                 }
    1286             :                 else
    1287           0 :                     --pEnd;
    1288             :             }
    1289             : 
    1290           0 :             if ( PROPERTY_ID_LISTSOURCETYPE == nPropId )
    1291           0 :                 if ( FormComponentType::COMBOBOX == m_nClassId )
    1292             :                     // remove the first sequence element -> value list not possible for combo boxes
    1293           0 :                     ++pStart;
    1294             : 
    1295             :             // copy the sequence
    1296           0 :             ::std::vector< ::rtl::OUString > aListEntries( pEnd - pStart );
    1297           0 :             ::std::copy( pStart, pEnd, aListEntries.begin() );
    1298             : 
    1299             :             // create the control
    1300           0 :             if ( PROPERTY_ID_TARGET_FRAME == nPropId )
    1301           0 :                 aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, sal_False, sal_False );
    1302             :             else
    1303             :             {
    1304           0 :                 aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, sal_False, sal_False );
    1305           0 :                 bNeedDefaultStringIfVoidAllowed = true;
    1306           0 :             }
    1307             :         }
    1308             : 
    1309             :         //////////////////////////////////////////////////////////////////////
    1310           0 :         switch( nPropId )
    1311             :         {
    1312             :             case PROPERTY_ID_REPEAT_DELAY:
    1313             :             {
    1314           0 :                 OTimeDurationControl* pControl = new OTimeDurationControl( impl_getDefaultDialogParent_nothrow(), WB_BORDER | WB_TABSTOP );
    1315           0 :                 aDescriptor.Control = pControl;
    1316             : 
    1317           0 :                 pControl->setMinValue( Optional< double >( sal_True, 0 ) );
    1318           0 :                 pControl->setMaxValue( Optional< double >( sal_True, ::std::numeric_limits< double >::max() ) );
    1319             :             }
    1320           0 :             break;
    1321             : 
    1322             :             case PROPERTY_ID_TABINDEX:
    1323             :             case PROPERTY_ID_BOUNDCOLUMN:
    1324             :             case PROPERTY_ID_VISIBLESIZE:
    1325             :             case PROPERTY_ID_MAXTEXTLEN:
    1326             :             case PROPERTY_ID_LINEINCREMENT:
    1327             :             case PROPERTY_ID_BLOCKINCREMENT:
    1328             :             case PROPERTY_ID_SPININCREMENT:
    1329             :             {
    1330           0 :                 Optional< double > aMinValue( sal_True, 0 );
    1331           0 :                 Optional< double > aMaxValue( sal_True, 0x7FFFFFFF );
    1332             : 
    1333           0 :                 if ( nPropId == PROPERTY_ID_MAXTEXTLEN )
    1334           0 :                     aMinValue.Value = -1;
    1335           0 :                 else if ( nPropId == PROPERTY_ID_VISIBLESIZE )
    1336           0 :                     aMinValue.Value = 1;
    1337             :                 else
    1338           0 :                     aMinValue.Value = 0;
    1339             : 
    1340             :                 aDescriptor.Control = PropertyHandlerHelper::createNumericControl(
    1341           0 :                     _rxControlFactory, 0, aMinValue, aMaxValue, sal_False );
    1342             :             }
    1343           0 :             break;
    1344             : 
    1345             :             case PROPERTY_ID_DECIMAL_ACCURACY:
    1346             :             {
    1347           0 :                 Optional< double > aMinValue( sal_True, 0 );
    1348           0 :                 Optional< double > aMaxValue( sal_True, 20 );
    1349             : 
    1350             :                 aDescriptor.Control = PropertyHandlerHelper::createNumericControl(
    1351           0 :                     _rxControlFactory, 0, aMinValue, aMaxValue, sal_False );
    1352             :             }
    1353           0 :             break;
    1354             : 
    1355             :             //////////////////////////////////////////////////////////////////////
    1356             :             // DataSource
    1357             :             case PROPERTY_ID_DATASOURCE:
    1358             :             {
    1359           0 :                 aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_ATTR_DATASOURCE);
    1360             : 
    1361           0 :                 ::std::vector< ::rtl::OUString > aListEntries;
    1362             : 
    1363           0 :                 Reference< XDatabaseContext > xDatabaseContext = sdb::DatabaseContext::create( m_aContext.getUNOContext() );
    1364           0 :                 Sequence< ::rtl::OUString > aDatasources = xDatabaseContext->getElementNames();
    1365           0 :                 aListEntries.resize( aDatasources.getLength() );
    1366           0 :                 ::std::copy( aDatasources.getConstArray(), aDatasources.getConstArray() + aDatasources.getLength(),
    1367           0 :                     aListEntries.begin() );
    1368             :                 aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl(
    1369           0 :                     _rxControlFactory, aListEntries, sal_False, sal_True );
    1370             :             }
    1371           0 :             break;
    1372             : 
    1373             :             case PROPERTY_ID_CONTROLSOURCE:
    1374             :             {
    1375           0 :                 ::std::vector< ::rtl::OUString > aFieldNames;
    1376           0 :                 impl_initFieldList_nothrow( aFieldNames );
    1377             :                 aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl(
    1378           0 :                     _rxControlFactory, aFieldNames, sal_False, sal_False );
    1379             :             }
    1380           0 :             break;
    1381             : 
    1382             :             case PROPERTY_ID_COMMAND:
    1383           0 :                 impl_describeCursorSource_nothrow( aDescriptor, _rxControlFactory );
    1384           0 :                 break;
    1385             : 
    1386             :             case PROPERTY_ID_LISTSOURCE:
    1387           0 :                 impl_describeListSourceUI_throw( aDescriptor, _rxControlFactory );
    1388           0 :                 break;
    1389             :         }
    1390             : 
    1391           0 :         if ( !aDescriptor.Control.is() )
    1392           0 :             aDescriptor.Control = _rxControlFactory->createPropertyControl( nControlType, bReadOnly );
    1393             : 
    1394           0 :         if ( ( aProperty.Attributes & PropertyAttribute::MAYBEVOID ) != 0 )
    1395             :         {
    1396             :             // insert the string "Default" string, if necessary
    1397           0 :             if ( bNeedDefaultStringIfVoidAllowed || ( nControlType == PropertyControlType::ColorListBox ) )
    1398             :             {
    1399           0 :                 Reference< XStringListControl > xStringList( aDescriptor.Control, UNO_QUERY_THROW );
    1400           0 :                 xStringList->prependListEntry( m_sDefaultValueString );
    1401           0 :                 m_aPropertiesWithDefListEntry.insert( _rPropertyName );
    1402             :             }
    1403             :         }
    1404             : 
    1405           0 :         if ( !aDescriptor.PrimaryButtonId.isEmpty() )
    1406           0 :             aDescriptor.HasPrimaryButton = sal_True;
    1407           0 :         if ( !aDescriptor.SecondaryButtonId.isEmpty() )
    1408           0 :             aDescriptor.HasSecondaryButton = sal_True;
    1409             : 
    1410           0 :         bool bIsDataProperty = ( nPropertyUIFlags & PROP_FLAG_DATA_PROPERTY ) != 0;
    1411           0 :         aDescriptor.Category = bIsDataProperty ? ::rtl::OUString("Data") : ::rtl::OUString("General");
    1412           0 :         return aDescriptor;
    1413             :     }
    1414             : 
    1415             :     //--------------------------------------------------------------------
    1416           0 :     InteractiveSelectionResult SAL_CALL FormComponentPropertyHandler::onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool /*_bPrimary*/, Any& _rData, const Reference< XObjectInspectorUI >& _rxInspectorUI ) throw (UnknownPropertyException, NullPointerException, RuntimeException)
    1417             :     {
    1418           0 :         if ( !_rxInspectorUI.is() )
    1419           0 :             throw NullPointerException();
    1420             : 
    1421           0 :         ::osl::ClearableMutexGuard aGuard( m_aMutex );
    1422           0 :         PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
    1423             : 
    1424           0 :         InteractiveSelectionResult eResult = InteractiveSelectionResult_Cancelled;
    1425           0 :         switch ( nPropId )
    1426             :         {
    1427             :         case PROPERTY_ID_DEFAULT_SELECT_SEQ:
    1428             :         case PROPERTY_ID_SELECTEDITEMS:
    1429           0 :             if ( impl_dialogListSelection_nothrow( _rPropertyName, aGuard ) )
    1430           0 :                 eResult = InteractiveSelectionResult_Success;
    1431           0 :             break;
    1432             : 
    1433             :         case PROPERTY_ID_FILTER:
    1434             :         case PROPERTY_ID_SORT:
    1435             :         {
    1436           0 :             ::rtl::OUString sClause;
    1437           0 :             if ( impl_dialogFilterOrSort_nothrow( PROPERTY_ID_FILTER == nPropId, sClause, aGuard ) )
    1438             :             {
    1439           0 :                 _rData <<= sClause;
    1440           0 :                 eResult = InteractiveSelectionResult_ObtainedValue;
    1441           0 :             }
    1442             :         }
    1443           0 :         break;
    1444             : 
    1445             :         case PROPERTY_ID_MASTERFIELDS:
    1446             :         case PROPERTY_ID_DETAILFIELDS:
    1447           0 :             if ( impl_dialogLinkedFormFields_nothrow( aGuard ) )
    1448           0 :                 eResult = InteractiveSelectionResult_Success;
    1449           0 :             break;
    1450             : 
    1451             :         case PROPERTY_ID_FORMATKEY:
    1452           0 :             if ( impl_dialogFormatting_nothrow( _rData, aGuard ) )
    1453           0 :                 eResult = InteractiveSelectionResult_ObtainedValue;
    1454           0 :             break;
    1455             : 
    1456             :         case PROPERTY_ID_IMAGE_URL:
    1457           0 :             if ( impl_browseForImage_nothrow( _rData, aGuard ) )
    1458           0 :                 eResult = InteractiveSelectionResult_ObtainedValue;
    1459           0 :             break;
    1460             : 
    1461             :         case PROPERTY_ID_TARGET_URL:
    1462           0 :             if ( impl_browseForTargetURL_nothrow( _rData, aGuard ) )
    1463           0 :                 eResult = InteractiveSelectionResult_ObtainedValue;
    1464           0 :             break;
    1465             : 
    1466             :         case PROPERTY_ID_FONT:
    1467           0 :             if ( impl_executeFontDialog_nothrow( _rData, aGuard ) )
    1468           0 :                 eResult = InteractiveSelectionResult_ObtainedValue;
    1469           0 :             break;
    1470             : 
    1471             :         case PROPERTY_ID_DATASOURCE:
    1472           0 :             if ( impl_browseForDatabaseDocument_throw( _rData, aGuard ) )
    1473           0 :                 eResult = InteractiveSelectionResult_ObtainedValue;
    1474           0 :             break;
    1475             : 
    1476             :         case PROPERTY_ID_BACKGROUNDCOLOR:
    1477             :         case PROPERTY_ID_FILLCOLOR:
    1478             :         case PROPERTY_ID_SYMBOLCOLOR:
    1479             :         case PROPERTY_ID_BORDERCOLOR:
    1480           0 :             if ( impl_dialogColorChooser_throw( nPropId, _rData, aGuard ) )
    1481           0 :                 eResult = InteractiveSelectionResult_ObtainedValue;
    1482           0 :             break;
    1483             : 
    1484             :         case PROPERTY_ID_CONTROLLABEL:
    1485           0 :             if ( impl_dialogChooseLabelControl_nothrow( _rData, aGuard ) )
    1486           0 :                 eResult = InteractiveSelectionResult_ObtainedValue;
    1487           0 :             break;
    1488             : 
    1489             :         case PROPERTY_ID_TABINDEX:
    1490           0 :             if ( impl_dialogChangeTabOrder_nothrow( aGuard ) )
    1491           0 :                 eResult = InteractiveSelectionResult_Success;
    1492           0 :             break;
    1493             : 
    1494             :         case PROPERTY_ID_COMMAND:
    1495             :         case PROPERTY_ID_LISTSOURCE:
    1496           0 :             if ( impl_doDesignSQLCommand_nothrow( _rxInspectorUI, nPropId ) )
    1497           0 :                 eResult = InteractiveSelectionResult_Pending;
    1498           0 :             break;
    1499             :         default:
    1500             :             OSL_FAIL( "FormComponentPropertyHandler::onInteractivePropertySelection: request for a property which does not have dedicated UI!" );
    1501           0 :             break;
    1502             :         }
    1503           0 :         return eResult;
    1504             :     }
    1505             : 
    1506             :     //--------------------------------------------------------------------
    1507             :     namespace
    1508             :     {
    1509           0 :         void lcl_rebuildAndResetCommand( const Reference< XObjectInspectorUI >& _rxInspectorUI, const Reference< XPropertyHandler >& _rxHandler )
    1510             :         {
    1511             :             OSL_PRECOND( _rxInspectorUI.is(), "lcl_rebuildAndResetCommand: invalid BrowserUI!" );
    1512             :             OSL_PRECOND( _rxHandler.is(), "lcl_rebuildAndResetCommand: invalid handler!" );
    1513           0 :             _rxInspectorUI->rebuildPropertyUI( PROPERTY_COMMAND );
    1514           0 :             _rxHandler->setPropertyValue( PROPERTY_COMMAND, makeAny( ::rtl::OUString() ) );
    1515           0 :         }
    1516             :     }
    1517             : 
    1518             :     //--------------------------------------------------------------------
    1519           0 :     void SAL_CALL FormComponentPropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (NullPointerException, RuntimeException)
    1520             :     {
    1521           0 :         if ( !_rxInspectorUI.is() )
    1522           0 :             throw NullPointerException();
    1523             : 
    1524           0 :         ::osl::MutexGuard aGuard( m_aMutex );
    1525           0 :         PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) );
    1526             : 
    1527           0 :         ::std::vector< PropertyId > aDependentProperties;
    1528             : 
    1529           0 :         switch ( nActuatingPropId )
    1530             :         {
    1531             :         // ----- EscapeProcessing -----
    1532             :         case PROPERTY_ID_ESCAPE_PROCESSING:
    1533           0 :             aDependentProperties.push_back( PROPERTY_ID_FILTER );
    1534           0 :             aDependentProperties.push_back( PROPERTY_ID_SORT );
    1535           0 :             break;  // case PROPERTY_ID_ESCAPE_PROCESSING
    1536             : 
    1537             :         // ----- CommandType -----
    1538             :         case PROPERTY_ID_COMMANDTYPE:
    1539             :             // available commands (tables or queries) might have changed
    1540           0 :             if ( !_bFirstTimeInit && m_bHaveCommand )
    1541           0 :                 lcl_rebuildAndResetCommand( _rxInspectorUI, this );
    1542           0 :             aDependentProperties.push_back( PROPERTY_ID_COMMAND );
    1543           0 :             break;  // case PROPERTY_ID_COMMANDTYPE
    1544             : 
    1545             :         // ----- DataSourceName -----
    1546             :         case PROPERTY_ID_DATASOURCE:
    1547             :             // reset the connection, now that we have a new data source
    1548           0 :             impl_clearRowsetConnection_nothrow();
    1549             : 
    1550             :             // available list source values (tables or queries) might have changed
    1551           0 :             if ( !_bFirstTimeInit && m_bHaveListSource )
    1552           0 :                 _rxInspectorUI->rebuildPropertyUI( PROPERTY_LISTSOURCE );
    1553             : 
    1554             :             // available commands (tables or queries) might have changed
    1555           0 :             if ( !_bFirstTimeInit && m_bHaveCommand )
    1556           0 :                 lcl_rebuildAndResetCommand( _rxInspectorUI, this );
    1557             : 
    1558             :             // Command also depends on DataSource
    1559           0 :             aDependentProperties.push_back( PROPERTY_ID_COMMAND );
    1560             :             // NO break!
    1561             : 
    1562             :         // ----- Command -----
    1563             :         case PROPERTY_ID_COMMAND:
    1564           0 :             aDependentProperties.push_back( PROPERTY_ID_FILTER );
    1565           0 :             aDependentProperties.push_back( PROPERTY_ID_SORT );
    1566           0 :             if ( m_bComponentIsSubForm )
    1567           0 :                 aDependentProperties.push_back( PROPERTY_ID_DETAILFIELDS );
    1568           0 :             break;
    1569             : 
    1570             :         // ----- ListSourceType -----
    1571             :         case PROPERTY_ID_LISTSOURCETYPE:
    1572           0 :             if ( !_bFirstTimeInit && m_bHaveListSource )
    1573             :                 // available list source values (tables or queries) might have changed
    1574           0 :                 _rxInspectorUI->rebuildPropertyUI( PROPERTY_LISTSOURCE );
    1575           0 :             aDependentProperties.push_back( PROPERTY_ID_BOUNDCOLUMN );
    1576           0 :             aDependentProperties.push_back( PROPERTY_ID_STRINGITEMLIST );
    1577             :             // NO break!
    1578             : 
    1579             :         // ----- StringItemList -----
    1580             :         case PROPERTY_ID_STRINGITEMLIST:
    1581           0 :             aDependentProperties.push_back( PROPERTY_ID_SELECTEDITEMS );
    1582           0 :             aDependentProperties.push_back( PROPERTY_ID_DEFAULT_SELECT_SEQ );
    1583           0 :             break;
    1584             : 
    1585             :         // ----- ListSource -----
    1586             :         case PROPERTY_ID_LISTSOURCE:
    1587           0 :             aDependentProperties.push_back( PROPERTY_ID_STRINGITEMLIST );
    1588           0 :             break;
    1589             : 
    1590             :         // ----- DataField -----
    1591             :         case PROPERTY_ID_CONTROLSOURCE:
    1592             :         {
    1593           0 :             ::rtl::OUString sControlSource;
    1594           0 :             _rNewValue >>= sControlSource;
    1595           0 :             if ( impl_componentHasProperty_throw( PROPERTY_FILTERPROPOSAL ) )
    1596           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_FILTERPROPOSAL, !sControlSource.isEmpty() );
    1597           0 :             if ( impl_componentHasProperty_throw( PROPERTY_EMPTY_IS_NULL ) )
    1598           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_EMPTY_IS_NULL, !sControlSource.isEmpty() );
    1599             : 
    1600           0 :             aDependentProperties.push_back( PROPERTY_ID_BOUNDCOLUMN );
    1601           0 :             aDependentProperties.push_back( PROPERTY_ID_SCALEIMAGE );
    1602           0 :             aDependentProperties.push_back( PROPERTY_ID_SCALE_MODE );
    1603           0 :             aDependentProperties.push_back( PROPERTY_ID_INPUT_REQUIRED );
    1604             :         }
    1605           0 :         break;
    1606             : 
    1607             :         case PROPERTY_ID_EMPTY_IS_NULL:
    1608           0 :             aDependentProperties.push_back( PROPERTY_ID_INPUT_REQUIRED );
    1609           0 :             break;
    1610             : 
    1611             :         // ----- SubmitEncoding -----
    1612             :         case PROPERTY_ID_SUBMIT_ENCODING:
    1613             :         {
    1614           0 :             FormSubmitEncoding eEncoding = FormSubmitEncoding_URL;
    1615           0 :             OSL_VERIFY( _rNewValue >>= eEncoding );
    1616           0 :             _rxInspectorUI->enablePropertyUI( PROPERTY_SUBMIT_METHOD, eEncoding == FormSubmitEncoding_URL );
    1617             :         }
    1618           0 :         break;
    1619             : 
    1620             :         // ----- Repeat -----
    1621             :         case PROPERTY_ID_REPEAT:
    1622             :         {
    1623           0 :             sal_Bool bIsRepeating = sal_False;
    1624           0 :             OSL_VERIFY( _rNewValue >>= bIsRepeating );
    1625           0 :             _rxInspectorUI->enablePropertyUI( PROPERTY_REPEAT_DELAY, bIsRepeating );
    1626             :         }
    1627           0 :         break;
    1628             : 
    1629             :         // ----- TabStop -----
    1630             :         case PROPERTY_ID_TABSTOP:
    1631             :         {
    1632           0 :             if ( !impl_componentHasProperty_throw( PROPERTY_TABINDEX ) )
    1633             :                 break;
    1634           0 :             sal_Bool bHasTabStop = sal_False;
    1635           0 :             _rNewValue >>= bHasTabStop;
    1636           0 :             _rxInspectorUI->enablePropertyUI( PROPERTY_TABINDEX, bHasTabStop );
    1637             :         }
    1638           0 :         break;
    1639             : 
    1640             :         // ----- Border -----
    1641             :         case PROPERTY_ID_BORDER:
    1642             :         {
    1643           0 :             sal_Int16 nBordeType = VisualEffect::NONE;
    1644           0 :             OSL_VERIFY( _rNewValue >>= nBordeType );
    1645           0 :             _rxInspectorUI->enablePropertyUI( PROPERTY_BORDERCOLOR, nBordeType == VisualEffect::FLAT );
    1646             :         }
    1647           0 :         break;
    1648             : 
    1649             :         // ----- DropDown -----
    1650             :         case PROPERTY_ID_DROPDOWN:
    1651             :         {
    1652           0 :             if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_LINECOUNT ) )
    1653             :             {
    1654           0 :                 sal_Bool bDropDown = sal_True;
    1655           0 :                 _rNewValue >>= bDropDown;
    1656           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_LINECOUNT, bDropDown );
    1657             :             }
    1658             :         }
    1659           0 :         break;
    1660             : 
    1661             :         // ----- ImageURL -----
    1662             :         case PROPERTY_ID_IMAGE_URL:
    1663             :         {
    1664           0 :             if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_IMAGEPOSITION ) )
    1665             :             {
    1666           0 :                 ::rtl::OUString sImageURL;
    1667           0 :                 OSL_VERIFY( _rNewValue >>= sImageURL );
    1668           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_IMAGEPOSITION, !sImageURL.isEmpty() );
    1669             :             }
    1670             : 
    1671           0 :             aDependentProperties.push_back( PROPERTY_ID_SCALEIMAGE );
    1672           0 :             aDependentProperties.push_back( PROPERTY_ID_SCALE_MODE );
    1673             :         }
    1674           0 :         break;
    1675             : 
    1676             :         // ----- ButtonType -----
    1677             :         case PROPERTY_ID_BUTTONTYPE:
    1678             :         {
    1679           0 :             FormButtonType eButtonType( FormButtonType_PUSH );
    1680           0 :             OSL_VERIFY( _rNewValue >>= eButtonType );
    1681           0 :             _rxInspectorUI->enablePropertyUI( PROPERTY_TARGET_URL, FormButtonType_URL == eButtonType );
    1682             :         }
    1683             :         // NO break!
    1684             : 
    1685             :         // ----- TargetURL -----
    1686             :         case PROPERTY_ID_TARGET_URL:
    1687           0 :             aDependentProperties.push_back( PROPERTY_ID_TARGET_FRAME );
    1688           0 :             break;  // case PROPERTY_ID_TARGET_URL
    1689             : 
    1690             :         // ----- TriState -----
    1691             :         case PROPERTY_ID_TRISTATE:
    1692           0 :             if ( !_bFirstTimeInit )
    1693           0 :                 _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? PROPERTY_DEFAULT_STATE : PROPERTY_STATE );
    1694           0 :             break;  // case PROPERTY_ID_TRISTATE
    1695             : 
    1696             :         // ----- DecimalAccuracy -----
    1697             :         case PROPERTY_ID_DECIMAL_ACCURACY:
    1698             :         // ----- ShowThousandsSeparator -----
    1699             :         case PROPERTY_ID_SHOWTHOUSANDSEP:
    1700             :         {
    1701           0 :             sal_Bool bAccuracy = (PROPERTY_ID_DECIMAL_ACCURACY == nActuatingPropId);
    1702           0 :             sal_uInt16  nNewDigits = 0;
    1703           0 :             sal_Bool    bUseSep = sal_False;
    1704           0 :             if ( bAccuracy )
    1705           0 :                 OSL_VERIFY( _rNewValue >>= nNewDigits );
    1706             :             else
    1707           0 :                 OSL_VERIFY( _rNewValue >>= bUseSep );
    1708             : 
    1709             :             // propagate the changes to the min/max/default fields
    1710           0 :             Any aCurrentProp;
    1711           0 :             ::rtl::OUString aAffectedProps[] = { PROPERTY_VALUE, PROPERTY_DEFAULT_VALUE, PROPERTY_VALUEMIN, PROPERTY_VALUEMAX };
    1712           0 :             for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(aAffectedProps); ++i)
    1713             :             {
    1714           0 :                 Reference< XPropertyControl > xControl;
    1715             :                 try
    1716             :                 {
    1717           0 :                     xControl = _rxInspectorUI->getPropertyControl( aAffectedProps[i] );
    1718             :                 }
    1719           0 :                 catch( const UnknownPropertyException& ) {}
    1720           0 :                 if ( xControl.is() )
    1721             :                 {
    1722           0 :                     OFormattedNumericControl* pControl = dynamic_cast< OFormattedNumericControl* >( xControl.get() );
    1723             :                     DBG_ASSERT( pControl, "FormComponentPropertyHandler::actuatingPropertyChanged: invalid control!" );
    1724           0 :                     if ( pControl )
    1725             :                     {
    1726           0 :                         if ( bAccuracy )
    1727           0 :                             pControl->SetDecimalDigits( nNewDigits );
    1728             :                         else
    1729           0 :                             pControl->SetThousandsSep( bUseSep );
    1730             :                     }
    1731             :                 }
    1732           0 :             }
    1733             :         }
    1734           0 :         break;
    1735             : 
    1736             :         // ----- FormatKey -----
    1737             :         case PROPERTY_ID_FORMATKEY:
    1738             :         {
    1739             :             FormatDescription aNewDesc;
    1740             : 
    1741           0 :             Reference< XNumberFormatsSupplier >  xSupplier;
    1742           0 :             OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_FORMATSSUPPLIER ) >>= xSupplier );
    1743             : 
    1744           0 :             Reference< XUnoTunnel > xTunnel( xSupplier, UNO_QUERY );
    1745             :             DBG_ASSERT(xTunnel.is(), "FormComponentPropertyHandler::actuatingPropertyChanged: xTunnel is invalid!");
    1746           0 :             if ( xTunnel.is() )
    1747             :             {
    1748           0 :                 SvNumberFormatsSupplierObj* pSupplier = reinterpret_cast<SvNumberFormatsSupplierObj*>(xTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId()));
    1749             :                     // the same again
    1750             : 
    1751           0 :                 aNewDesc.pSupplier = pSupplier;
    1752           0 :                 if ( !( _rNewValue >>= aNewDesc.nKey ) )
    1753           0 :                     aNewDesc.nKey = 0;
    1754             : 
    1755             :                 // give each control which has to know this an own copy of the description
    1756             :                 ::rtl::OUString aFormattedPropertyControls[] = {
    1757             :                     PROPERTY_EFFECTIVE_MIN, PROPERTY_EFFECTIVE_MAX, PROPERTY_EFFECTIVE_DEFAULT, PROPERTY_EFFECTIVE_VALUE
    1758           0 :                 };
    1759           0 :                 for ( sal_uInt16 i=0; i<SAL_N_ELEMENTS(aFormattedPropertyControls); ++i )
    1760             :                 {
    1761           0 :                     Reference< XPropertyControl > xControl;
    1762             :                     try
    1763             :                     {
    1764           0 :                         xControl = _rxInspectorUI->getPropertyControl( aFormattedPropertyControls[i] );
    1765             :                     }
    1766           0 :                     catch( const UnknownPropertyException& ) {}
    1767           0 :                     if ( xControl.is() )
    1768             :                     {
    1769           0 :                         OFormattedNumericControl* pControl = dynamic_cast< OFormattedNumericControl* >( xControl.get() );
    1770             :                         DBG_ASSERT( pControl, "FormComponentPropertyHandler::actuatingPropertyChanged: invalid control!" );
    1771           0 :                         if ( pControl )
    1772           0 :                             pControl->SetFormatDescription( aNewDesc );
    1773             :                     }
    1774           0 :                 }
    1775           0 :             }
    1776             :         }
    1777           0 :         break;
    1778             : 
    1779             :         case PROPERTY_ID_TOGGLE:
    1780             :         {
    1781           0 :             sal_Bool bIsToggleButton = sal_False;
    1782           0 :             OSL_VERIFY( _rNewValue >>= bIsToggleButton );
    1783           0 :             _rxInspectorUI->enablePropertyUI( PROPERTY_DEFAULT_STATE, bIsToggleButton );
    1784             :         }
    1785           0 :         break;
    1786             : 
    1787             :         default:
    1788             :             OSL_FAIL( "FormComponentPropertyHandler::actuatingPropertyChanged: did not register for this property!" );
    1789           0 :             break;
    1790             : 
    1791             :         }   // switch ( nActuatingPropId )
    1792             : 
    1793           0 :         for ( ::std::vector< PropertyId >::const_iterator loopAffected = aDependentProperties.begin();
    1794           0 :               loopAffected != aDependentProperties.end();
    1795             :               ++loopAffected
    1796             :             )
    1797             :         {
    1798           0 :             if ( impl_isSupportedProperty_nothrow( *loopAffected ) )
    1799           0 :                 impl_updateDependentProperty_nothrow( *loopAffected, _rxInspectorUI );
    1800           0 :         }
    1801           0 :     }
    1802             : 
    1803             :     //------------------------------------------------------------------------
    1804           0 :     void FormComponentPropertyHandler::impl_updateDependentProperty_nothrow( PropertyId _nPropId, const Reference< XObjectInspectorUI >& _rxInspectorUI ) const
    1805             :     {
    1806             :         try
    1807             :         {
    1808           0 :             switch ( _nPropId )
    1809             :             {
    1810             :             // ----- StringItemList -----
    1811             :             case PROPERTY_ID_STRINGITEMLIST:
    1812             :             {
    1813           0 :                 ListSourceType eLSType = ListSourceType_VALUELIST;
    1814           0 :                 OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_LISTSOURCETYPE ) >>= eLSType );
    1815             : 
    1816           0 :                 ::rtl::OUString sListSource;
    1817             :                 {
    1818           0 :                     Sequence< ::rtl::OUString > aListSource;
    1819           0 :                     Any aListSourceValue( impl_getPropertyValue_throw( PROPERTY_LISTSOURCE ) );
    1820           0 :                     if ( aListSourceValue >>= aListSource )
    1821             :                     {
    1822           0 :                         if ( aListSource.getLength() )
    1823           0 :                             sListSource = aListSource[0];
    1824             :                     }
    1825             :                     else
    1826           0 :                         OSL_VERIFY( aListSourceValue >>= sListSource );
    1827             :                 }
    1828             : 
    1829             :                 sal_Bool bIsEnabled =   (  ( eLSType == ListSourceType_VALUELIST )
    1830           0 :                                         || ( sListSource.isEmpty() )
    1831           0 :                                         );
    1832           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_STRINGITEMLIST, bIsEnabled );
    1833             :             }
    1834           0 :             break;  // case PROPERTY_ID_STRINGITEMLIST
    1835             : 
    1836             :             // ----- BoundColumn -----
    1837             :             case PROPERTY_ID_BOUNDCOLUMN:
    1838             :             {
    1839           0 :                 ::rtl::OUString sControlSource;
    1840           0 :                 OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_CONTROLSOURCE ) >>= sControlSource );
    1841             : 
    1842           0 :                 ListSourceType eLSType = ListSourceType_VALUELIST;
    1843           0 :                 OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_LISTSOURCETYPE ) >>= eLSType );
    1844             : 
    1845           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_BOUNDCOLUMN,
    1846           0 :                         ( !sControlSource.isEmpty() )
    1847             :                     &&  ( eLSType != ListSourceType_TABLEFIELDS )
    1848             :                     &&  ( eLSType != ListSourceType_VALUELIST )
    1849           0 :                 );
    1850             :             }
    1851           0 :             break;  // case PROPERTY_ID_BOUNDCOLUMN
    1852             : 
    1853             :             // ----- ScaleImage, ScaleMode -----
    1854             :             case PROPERTY_ID_SCALEIMAGE:
    1855             :             case PROPERTY_ID_SCALE_MODE:
    1856             :             {
    1857           0 :                 ::rtl::OUString sControlSource;
    1858           0 :                 if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_CONTROLSOURCE ) )
    1859           0 :                     impl_getPropertyValue_throw( PROPERTY_CONTROLSOURCE ) >>= sControlSource;
    1860             : 
    1861           0 :                 ::rtl::OUString sImageURL;
    1862           0 :                 impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sImageURL;
    1863             : 
    1864           0 :                 _rxInspectorUI->enablePropertyUI( impl_getPropertyNameFromId_nothrow( _nPropId ),
    1865           0 :                     ( !sControlSource.isEmpty() ) || ( !sImageURL.isEmpty() )
    1866           0 :                 );
    1867             :             }
    1868           0 :             break;  // case PROPERTY_ID_SCALEIMAGE, PROPERTY_ID_SCALE_MODE
    1869             : 
    1870             :             // ----- InputRequired -----
    1871             :             case PROPERTY_ID_INPUT_REQUIRED:
    1872             :             {
    1873           0 :                 ::rtl::OUString sControlSource;
    1874           0 :                 OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_CONTROLSOURCE ) >>= sControlSource );
    1875             : 
    1876           0 :                 sal_Bool bEmptyIsNULL = sal_False;
    1877           0 :                 sal_Bool bHasEmptyIsNULL = impl_componentHasProperty_throw( PROPERTY_EMPTY_IS_NULL );
    1878           0 :                 if ( bHasEmptyIsNULL )
    1879           0 :                     OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_EMPTY_IS_NULL ) >>= bEmptyIsNULL );
    1880             : 
    1881             :                 // if the control is not bound to a DB field, there is no sense in having the "Input required"
    1882             :                 // property
    1883             :                 // Also, if an empty input of this control are *not* written as NULL, but as empty strings,
    1884             :                 // then "Input required" does not make sense, too (since there's always an input, even if the control
    1885             :                 // is empty).
    1886           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_INPUT_REQUIRED,
    1887           0 :                     ( !sControlSource.isEmpty() ) && ( !bHasEmptyIsNULL || bEmptyIsNULL )
    1888           0 :                 );
    1889             :             }
    1890           0 :             break;
    1891             : 
    1892             :             // ----- SelectedItems, DefaultSelection -----
    1893             :             case PROPERTY_ID_SELECTEDITEMS:
    1894             :             case PROPERTY_ID_DEFAULT_SELECT_SEQ:
    1895             :             {
    1896           0 :                 Sequence< ::rtl::OUString > aEntries;
    1897           0 :                 impl_getPropertyValue_throw( PROPERTY_STRINGITEMLIST ) >>= aEntries;
    1898           0 :                 bool isEnabled = aEntries.getLength() != 0;
    1899             : 
    1900           0 :                 if ( ( m_nClassId == FormComponentType::LISTBOX ) && ( m_eComponentClass == eFormControl ) )
    1901             :                 {
    1902           0 :                     ListSourceType eLSType = ListSourceType_VALUELIST;
    1903           0 :                     impl_getPropertyValue_throw( PROPERTY_LISTSOURCETYPE ) >>= eLSType;
    1904           0 :                     isEnabled &= ( eLSType == ListSourceType_VALUELIST );
    1905             :                 }
    1906           0 :                 _rxInspectorUI->enablePropertyUIElements( impl_getPropertyNameFromId_nothrow( _nPropId ),
    1907           0 :                     PropertyLineElement::PrimaryButton, isEnabled );
    1908             :             }
    1909           0 :             break;  // case PROPERTY_ID_DEFAULT_SELECT_SEQ
    1910             : 
    1911             :             // ----- TargetFrame ------
    1912             :             case PROPERTY_ID_TARGET_FRAME:
    1913             :             {
    1914           0 :                 ::rtl::OUString sTargetURL;
    1915           0 :                 impl_getPropertyValue_throw( PROPERTY_TARGET_URL ) >>= sTargetURL;
    1916           0 :                 FormButtonType eButtonType( FormButtonType_URL );
    1917           0 :                 if ( 0 != m_nClassId )
    1918             :                 {
    1919           0 :                     OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_BUTTONTYPE ) >>= eButtonType );
    1920             :                 }
    1921             :                 // if m_nClassId is 0, then we're inspecting a form. In this case, eButtonType is always
    1922             :                 // FormButtonType_URL here
    1923           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_TARGET_FRAME,
    1924           0 :                     ( eButtonType == FormButtonType_URL ) && ( !sTargetURL.isEmpty() )
    1925           0 :                 );
    1926             :             }
    1927           0 :             break;
    1928             : 
    1929             :             // ----- Order ------
    1930             :             case PROPERTY_ID_SORT:
    1931             :             // ----- Filter ------
    1932             :             case PROPERTY_ID_FILTER:
    1933             :             {
    1934           0 :                 Reference< XConnection > xConnection;
    1935           0 :                 bool bAllowEmptyDS = ::dbtools::isEmbeddedInDatabase( m_xComponent, xConnection );
    1936             : 
    1937             :                 // if there's no escape processing, we cannot enter any values for this property
    1938           0 :                 sal_Bool  bDoEscapeProcessing( sal_False );
    1939           0 :                 impl_getPropertyValue_throw( PROPERTY_ESCAPE_PROCESSING ) >>= bDoEscapeProcessing;
    1940           0 :                 _rxInspectorUI->enablePropertyUI(
    1941             :                     impl_getPropertyNameFromId_nothrow( _nPropId ),
    1942             :                     bDoEscapeProcessing
    1943           0 :                 );
    1944             : 
    1945             :                 // also care for the browse button - enabled if we have escape processing, and a valid
    1946             :                 // data source signature
    1947           0 :                 _rxInspectorUI->enablePropertyUIElements(
    1948             :                     impl_getPropertyNameFromId_nothrow( _nPropId ),
    1949             :                     PropertyLineElement::PrimaryButton,
    1950           0 :                         impl_hasValidDataSourceSignature_nothrow( m_xComponent, bAllowEmptyDS )
    1951             :                     &&  bDoEscapeProcessing
    1952           0 :                 );
    1953             :             }
    1954           0 :             break;  // case PROPERTY_ID_FILTER:
    1955             : 
    1956             :             // ----- Command -----
    1957             :             case PROPERTY_ID_COMMAND:
    1958             :             {
    1959           0 :                 sal_Int32   nCommandType( CommandType::COMMAND );
    1960           0 :                 OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_COMMANDTYPE ) >>= nCommandType );
    1961             : 
    1962           0 :                 impl_ensureRowsetConnection_nothrow();
    1963           0 :                 Reference< XConnection > xConnection = m_xRowSetConnection.getTyped();
    1964           0 :                 bool bAllowEmptyDS = false;
    1965           0 :                 if ( !xConnection.is() )
    1966           0 :                     bAllowEmptyDS = ::dbtools::isEmbeddedInDatabase( m_xComponent, xConnection );
    1967             : 
    1968             :                 bool doEnable = ( nCommandType == CommandType::COMMAND )
    1969           0 :                             &&  (  m_xRowSetConnection.is()
    1970           0 :                                 || xConnection.is()
    1971           0 :                                 || impl_hasValidDataSourceSignature_nothrow( m_xComponent, bAllowEmptyDS)
    1972           0 :                                 );
    1973             : 
    1974           0 :                 _rxInspectorUI->enablePropertyUIElements(
    1975             :                     PROPERTY_COMMAND,
    1976             :                     PropertyLineElement::PrimaryButton,
    1977             :                     doEnable
    1978           0 :                 );
    1979             :             }
    1980           0 :             break;  // case PROPERTY_ID_COMMAND
    1981             : 
    1982             :             // ----- DetailFields -----
    1983             :             case PROPERTY_ID_DETAILFIELDS:
    1984             :             {
    1985           0 :                 Reference< XConnection > xConnection;
    1986           0 :                 bool bAllowEmptyDS = ::dbtools::isEmbeddedInDatabase( m_xComponent, xConnection );
    1987             : 
    1988             :                 // both our current form, and it's parent form, need to have a valid
    1989             :                 // data source signature
    1990             :                 bool bDoEnableMasterDetailFields =
    1991           0 :                         impl_hasValidDataSourceSignature_nothrow( m_xComponent, bAllowEmptyDS )
    1992           0 :                     &&  impl_hasValidDataSourceSignature_nothrow( Reference< XPropertySet >( m_xObjectParent, UNO_QUERY ), bAllowEmptyDS );
    1993             : 
    1994             :                 // in opposite to the other properties, here in real *two* properties are
    1995             :                 // affected
    1996           0 :                 _rxInspectorUI->enablePropertyUIElements( PROPERTY_DETAILFIELDS, PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields );
    1997           0 :                 _rxInspectorUI->enablePropertyUIElements( PROPERTY_MASTERFIELDS, PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields );
    1998             :             }
    1999           0 :             break;
    2000             : 
    2001             :             default:
    2002             :                 OSL_FAIL( "FormComponentPropertyHandler::impl_updateDependentProperty_nothrow: unexpected property to update!" );
    2003           0 :                 break;
    2004             : 
    2005             :             }   // switch
    2006             :         }
    2007           0 :         catch( const Exception& )
    2008             :         {
    2009             :             OSL_FAIL( "FormComponentPropertyHandler::impl_updateDependentProperty_nothrow: caught an exception!" );
    2010             :         }
    2011           0 :     }
    2012             : 
    2013             :     //------------------------------------------------------------------------
    2014           0 :     void SAL_CALL FormComponentPropertyHandler::disposing()
    2015             :     {
    2016           0 :         FormComponentPropertyHandler_Base::disposing();
    2017           0 :         if ( m_xCommandDesigner.is() && m_xCommandDesigner->isActive() )
    2018           0 :             m_xCommandDesigner->dispose();
    2019           0 :     }
    2020             : 
    2021             :     //------------------------------------------------------------------------
    2022           0 :     sal_Bool SAL_CALL FormComponentPropertyHandler::suspend( sal_Bool _bSuspend ) throw (RuntimeException)
    2023             :     {
    2024           0 :         ::osl::MutexGuard aGuard( m_aMutex );
    2025           0 :         if ( _bSuspend )
    2026           0 :             if ( m_xCommandDesigner.is() && m_xCommandDesigner->isActive() )
    2027           0 :                 return m_xCommandDesigner->suspend();
    2028           0 :         return sal_True;
    2029             :     }
    2030             : 
    2031             :     //------------------------------------------------------------------------
    2032           0 :     void FormComponentPropertyHandler::impl_initComponentMetaData_throw()
    2033             :     {
    2034             :         try
    2035             :         {
    2036             :             //////////////////////////////////////////////////////////////////
    2037             :             // component class
    2038           0 :             m_eComponentClass = eUnknown;
    2039             : 
    2040           0 :             if  (   impl_componentHasProperty_throw( PROPERTY_WIDTH )
    2041           0 :                 &&  impl_componentHasProperty_throw( PROPERTY_HEIGHT )
    2042           0 :                 &&  impl_componentHasProperty_throw( PROPERTY_POSITIONX )
    2043           0 :                 &&  impl_componentHasProperty_throw( PROPERTY_POSITIONY )
    2044           0 :                 &&  impl_componentHasProperty_throw( PROPERTY_STEP )
    2045           0 :                 &&  impl_componentHasProperty_throw( PROPERTY_TABINDEX )
    2046             :                 )
    2047             :             {
    2048           0 :                 m_eComponentClass = eDialogControl;
    2049             :             }
    2050             :             else
    2051             :             {
    2052           0 :                 m_eComponentClass = eFormControl;
    2053             :             }
    2054             : 
    2055             :             //////////////////////////////////////////////////////////////////
    2056             :             // (database) sub form?
    2057           0 :             Reference< XForm > xAsForm( m_xComponent, UNO_QUERY );
    2058           0 :             if ( xAsForm.is() )
    2059             :             {
    2060           0 :                 Reference< XChild > xFormAsChild( xAsForm, UNO_QUERY );
    2061           0 :                 Reference< XForm > xFormsParent;
    2062           0 :                 if ( xFormAsChild.is() )
    2063           0 :                     xFormsParent = xFormsParent.query( xFormAsChild->getParent() );
    2064           0 :                 m_bComponentIsSubForm = xFormsParent.is();
    2065             :             }
    2066             : 
    2067             :             //////////////////////////////////////////////////////////////////
    2068             :             // ClassId
    2069           0 :             Reference< XChild > xCompAsChild( m_xComponent, UNO_QUERY );
    2070           0 :             if ( xCompAsChild.is() )
    2071           0 :                 m_xObjectParent = xCompAsChild->getParent();
    2072             : 
    2073             :             //////////////////////////////////////////////////////////////////
    2074             :             // ClassId
    2075           0 :             impl_classifyControlModel_throw();
    2076             :         }
    2077           0 :         catch( const RuntimeException& )
    2078             :         {
    2079           0 :             throw;
    2080             :         }
    2081           0 :         catch( const Exception& )
    2082             :         {
    2083             :             OSL_FAIL( "FormComponentPropertyHandler::impl_initComponentMetaData_throw: caught an exception!" );
    2084             :         }
    2085           0 :     }
    2086             : 
    2087             :     //------------------------------------------------------------------------
    2088           0 :     void FormComponentPropertyHandler::impl_classifyControlModel_throw( )
    2089             :     {
    2090           0 :         if ( impl_componentHasProperty_throw( PROPERTY_CLASSID ) )
    2091             :         {
    2092           0 :             OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_CLASSID ) >>= m_nClassId );
    2093             :         }
    2094           0 :         else if ( eDialogControl == m_eComponentClass )
    2095             :         {
    2096           0 :             Reference< XControlModel > xControlModel( m_xComponent, UNO_QUERY );
    2097           0 :             Reference< XServiceInfo > xServiceInfo( m_xComponent, UNO_QUERY );
    2098           0 :             if ( xServiceInfo.is() )
    2099             :             {
    2100             :                 // it's a control model, and can tell about it's supported services
    2101           0 :                 m_nClassId = FormComponentType::CONTROL;
    2102             : 
    2103             :                 const sal_Char* aControlModelServiceNames[] =
    2104             :                 {
    2105             :                     "UnoControlButtonModel",
    2106             :                     "UnoControlCheckBoxModel",
    2107             :                     "UnoControlComboBoxModel",
    2108             :                     "UnoControlCurrencyFieldModel",
    2109             :                     "UnoControlDateFieldModel",
    2110             :                     "UnoControlEditModel",
    2111             :                     "UnoControlFileControlModel",
    2112             :                     "UnoControlFixedTextModel",
    2113             :                     "UnoControlGroupBoxModel",
    2114             :                     "UnoControlImageControlModel",
    2115             :                     "UnoControlListBoxModel",
    2116             :                     "UnoControlNumericFieldModel",
    2117             :                     "UnoControlPatternFieldModel",
    2118             :                     "UnoControlRadioButtonModel",
    2119             :                     "UnoControlScrollBarModel",
    2120             :                     "UnoControlSpinButtonModel",
    2121             :                     "UnoControlTimeFieldModel",
    2122             : 
    2123             :                     "UnoControlFixedLineModel",
    2124             :                     "UnoControlFormattedFieldModel",
    2125             :                     "UnoControlProgressBarModel"
    2126           0 :                 };
    2127             :                 const sal_Int16 nClassIDs[] =
    2128             :                 {
    2129             :                     FormComponentType::COMMANDBUTTON,
    2130             :                     FormComponentType::CHECKBOX,
    2131             :                     FormComponentType::COMBOBOX,
    2132             :                     FormComponentType::CURRENCYFIELD,
    2133             :                     FormComponentType::DATEFIELD,
    2134             :                     FormComponentType::TEXTFIELD,
    2135             :                     FormComponentType::FILECONTROL,
    2136             :                     FormComponentType::FIXEDTEXT,
    2137             :                     FormComponentType::GROUPBOX,
    2138             :                     FormComponentType::IMAGECONTROL,
    2139             :                     FormComponentType::LISTBOX,
    2140             :                     FormComponentType::NUMERICFIELD,
    2141             :                     FormComponentType::PATTERNFIELD,
    2142             :                     FormComponentType::RADIOBUTTON,
    2143             :                     FormComponentType::SCROLLBAR,
    2144             :                     FormComponentType::SPINBUTTON,
    2145             :                     FormComponentType::TIMEFIELD,
    2146             : 
    2147             :                     ControlType::FIXEDLINE,
    2148             :                     ControlType::FORMATTEDFIELD,
    2149             :                     ControlType::PROGRESSBAR
    2150           0 :                 };
    2151             : 
    2152           0 :                 sal_Int32 nKnownControlTypes = SAL_N_ELEMENTS( aControlModelServiceNames );
    2153             :                 OSL_ENSURE( nKnownControlTypes == SAL_N_ELEMENTS( nClassIDs ),
    2154             :                     "FormComponentPropertyHandler::impl_classifyControlModel_throw: inconsistence" );
    2155             : 
    2156           0 :                 for ( sal_Int32 i = 0; i < nKnownControlTypes; ++i )
    2157             :                 {
    2158           0 :                     ::rtl::OUString sServiceName(  "com.sun.star.awt."  );
    2159           0 :                     sServiceName += ::rtl::OUString::createFromAscii( aControlModelServiceNames[ i ] );
    2160             : 
    2161           0 :                     if ( xServiceInfo->supportsService( sServiceName ) )
    2162             :                     {
    2163           0 :                         m_nClassId = nClassIDs[ i ];
    2164             :                         break;
    2165             :                     }
    2166           0 :                 }
    2167           0 :             }
    2168             :         }
    2169           0 :     }
    2170             : 
    2171             :     //------------------------------------------------------------------------
    2172           0 :     void FormComponentPropertyHandler::impl_normalizePropertyValue_nothrow( Any& _rValue, PropertyId _nPropId ) const
    2173             :     {
    2174           0 :         switch ( _nPropId )
    2175             :         {
    2176             :         case PROPERTY_ID_TABSTOP:
    2177           0 :             if ( !_rValue.hasValue() )
    2178             :             {
    2179           0 :                 switch ( m_nClassId )
    2180             :                 {
    2181             :                 case FormComponentType::COMMANDBUTTON:
    2182             :                 case FormComponentType::RADIOBUTTON:
    2183             :                 case FormComponentType::CHECKBOX:
    2184             :                 case FormComponentType::TEXTFIELD:
    2185             :                 case FormComponentType::LISTBOX:
    2186             :                 case FormComponentType::COMBOBOX:
    2187             :                 case FormComponentType::FILECONTROL:
    2188             :                 case FormComponentType::DATEFIELD:
    2189             :                 case FormComponentType::TIMEFIELD:
    2190             :                 case FormComponentType::NUMERICFIELD:
    2191             :                 case ControlType::FORMATTEDFIELD:
    2192             :                 case FormComponentType::CURRENCYFIELD:
    2193             :                 case FormComponentType::PATTERNFIELD:
    2194           0 :                     _rValue = makeAny( (sal_Bool)sal_True );
    2195           0 :                     break;
    2196             :                 default:
    2197           0 :                     _rValue = makeAny( (sal_Bool)sal_False );
    2198           0 :                     break;
    2199             :                 }
    2200             :             }
    2201           0 :             break;
    2202             :         }
    2203           0 :     }
    2204             : 
    2205             :     //------------------------------------------------------------------------
    2206           0 :     bool FormComponentPropertyHandler::impl_shouldExcludeProperty_nothrow( const Property& _rProperty ) const
    2207             :     {
    2208             :         OSL_ENSURE( _rProperty.Handle == m_pInfoService->getPropertyId( _rProperty.Name ),
    2209             :             "FormComponentPropertyHandler::impl_shouldExcludeProperty_nothrow: insonsistency in the property!" );
    2210             : 
    2211           0 :         if ( _rProperty.Handle == PROPERTY_ID_CONTROLLABEL )
    2212             :             // prevent that this is caught below
    2213           0 :             return false;
    2214             : 
    2215           0 :         if  (   ( _rProperty.Type.getTypeClass() == TypeClass_INTERFACE )
    2216           0 :             ||  ( _rProperty.Type.getTypeClass() == TypeClass_ARRAY )
    2217           0 :             ||  ( _rProperty.Type.getTypeClass() == TypeClass_UNKNOWN )
    2218             :             )
    2219           0 :             return true;
    2220             : 
    2221           0 :         if ( ( _rProperty.Attributes & PropertyAttribute::TRANSIENT ) && ( m_eComponentClass != eDialogControl ) )
    2222             :             // strange enough, dialog controls declare a lot of their properties as transient
    2223           0 :             return true;
    2224             : 
    2225           0 :         if ( _rProperty.Attributes & PropertyAttribute::READONLY )
    2226           0 :             return true;
    2227             : 
    2228           0 :         switch ( _rProperty.Handle )
    2229             :         {
    2230             :         case PROPERTY_ID_MASTERFIELDS:
    2231             :         case PROPERTY_ID_DETAILFIELDS:
    2232           0 :             if ( !m_bComponentIsSubForm )
    2233             :                 // no master and detail fields for forms which are no sub forms
    2234           0 :                 return true;
    2235           0 :             break;
    2236             : 
    2237             :         case PROPERTY_ID_DATASOURCE:
    2238             :         {
    2239             :             // don't show DataSource if the component is part of an embedded form document
    2240           0 :             Reference< XConnection > xConn;
    2241           0 :             if ( isEmbeddedInDatabase( m_xComponent, xConn ) )
    2242           0 :                 return true;
    2243             :         }
    2244           0 :         break;
    2245             : 
    2246             :         case PROPERTY_ID_TEXT:
    2247             :             // don't show the "Text" property of formatted fields
    2248           0 :             if ( ControlType::FORMATTEDFIELD == m_nClassId )
    2249           0 :                 return true;
    2250           0 :             break;
    2251             : 
    2252             :         case PROPERTY_ID_FORMATKEY:
    2253             :         case PROPERTY_ID_EFFECTIVE_MIN:
    2254             :         case PROPERTY_ID_EFFECTIVE_MAX:
    2255             :         case PROPERTY_ID_EFFECTIVE_DEFAULT:
    2256             :         case PROPERTY_ID_EFFECTIVE_VALUE:
    2257             :             // only if the set has a formats supplier, too
    2258           0 :             if  ( !impl_componentHasProperty_throw( PROPERTY_FORMATSSUPPLIER ) )
    2259           0 :                 return true;
    2260             :             // (form) date and time fields also have a formats supplier, but the format itself
    2261             :             // is reflected in another property
    2262           0 :             if  (   ( FormComponentType::DATEFIELD == m_nClassId )
    2263             :                 ||  ( FormComponentType::TIMEFIELD == m_nClassId )
    2264             :                 )
    2265           0 :                 return true;
    2266           0 :             break;
    2267             : 
    2268             :         case PROPERTY_ID_SCALEIMAGE:
    2269           0 :             if ( impl_componentHasProperty_throw( PROPERTY_SCALE_MODE ) )
    2270             :                 // ScaleImage is superseded by ScaleMode
    2271           0 :                 return true;
    2272           0 :             break;
    2273             : 
    2274             :         case PROPERTY_ID_WRITING_MODE:
    2275           0 :             if ( !SvtCTLOptions().IsCTLFontEnabled() )
    2276           0 :                 return true;
    2277           0 :             break;
    2278             :         }
    2279             : 
    2280           0 :         sal_uInt32 nPropertyUIFlags = m_pInfoService->getPropertyUIFlags( _rProperty.Handle );
    2281             : 
    2282             :         // don't show experimental properties unless allowed to do so
    2283           0 :         if ( ( nPropertyUIFlags & PROP_FLAG_EXPERIMENTAL ) != 0 )
    2284             :         {
    2285             :             if ( true ) // TODO
    2286           0 :                 return true;
    2287             :         }
    2288             : 
    2289             :         // no data properties if no Base is installed. #124939#
    2290             :         // This fix is not intendend to appear on the main trunk. If you find it there,
    2291             :         // please tell me! frank.schoenheit@sun.com
    2292           0 :         if ( ( nPropertyUIFlags & PROP_FLAG_DATA_PROPERTY ) != 0 )
    2293           0 :             if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
    2294           0 :                 return true;
    2295             : 
    2296           0 :         return false;
    2297             :     }
    2298             : 
    2299             :     //------------------------------------------------------------------------
    2300           0 :     Reference< XRowSet > FormComponentPropertyHandler::impl_getRowSet_throw( ) const
    2301             :     {
    2302           0 :         Reference< XRowSet > xRowSet = m_xRowSet;
    2303           0 :         if ( !xRowSet.is() )
    2304             :         {
    2305           0 :             xRowSet.set( m_xComponent, UNO_QUERY );
    2306           0 :             if ( !xRowSet.is() )
    2307             :             {
    2308           0 :                 xRowSet = Reference< XRowSet >( m_xObjectParent, UNO_QUERY );
    2309           0 :                 if ( !xRowSet.is() )
    2310             :                 {
    2311             :                     // are we inspecting a grid column?
    2312           0 :                     if (Reference< XGridColumnFactory >( m_xObjectParent, UNO_QUERY) .is())
    2313             :                     {   // yes
    2314           0 :                         Reference< XChild > xParentAsChild( m_xObjectParent, UNO_QUERY );
    2315           0 :                         if ( xParentAsChild.is() )
    2316           0 :                             xRowSet = Reference< XRowSet >( xParentAsChild->getParent(), UNO_QUERY );
    2317             :                     }
    2318             :                 }
    2319           0 :                 if ( !xRowSet.is() )
    2320           0 :                     xRowSet = m_xRowSet;
    2321             :             }
    2322             :             DBG_ASSERT( xRowSet.is(), "FormComponentPropertyHandler::impl_getRowSet_throw: could not obtain the rowset for the introspectee!" );
    2323             :         }
    2324           0 :         return xRowSet;
    2325             :     }
    2326             : 
    2327             :     //------------------------------------------------------------------------
    2328           0 :     Reference< XRowSet > FormComponentPropertyHandler::impl_getRowSet_nothrow( ) const
    2329             :     {
    2330           0 :         Reference< XRowSet > xReturn;
    2331             :         try
    2332             :         {
    2333           0 :             xReturn = impl_getRowSet_throw();
    2334             :         }
    2335           0 :         catch( const Exception& )
    2336             :         {
    2337             :             OSL_FAIL( "FormComponentPropertyHandler::impl_getRowSet_nothrow: caught an exception!" );
    2338             :         }
    2339           0 :         return xReturn;
    2340             :     }
    2341             : 
    2342             :     //------------------------------------------------------------------------
    2343           0 :     void FormComponentPropertyHandler::impl_initFieldList_nothrow( ::std::vector< ::rtl::OUString >& _rFieldNames ) const
    2344             :     {
    2345           0 :         clearContainer( _rFieldNames );
    2346             :         try
    2347             :         {
    2348           0 :             WaitCursor aWaitCursor( impl_getDefaultDialogParent_nothrow() );
    2349             : 
    2350           0 :             Reference< XPreparedStatement >  xStatement;
    2351             : 
    2352             :             // get the form of the control we're inspecting
    2353           0 :             Reference< XPropertySet > xFormSet( impl_getRowSet_throw(), UNO_QUERY );
    2354           0 :             if ( !xFormSet.is() )
    2355           0 :                 return;
    2356             : 
    2357           0 :             ::rtl::OUString sObjectName;
    2358           0 :             OSL_VERIFY( xFormSet->getPropertyValue( PROPERTY_COMMAND ) >>= sObjectName );
    2359             :             // when there is no command we don't need to ask for columns
    2360           0 :             if ( !sObjectName.isEmpty() && impl_ensureRowsetConnection_nothrow() )
    2361             :             {
    2362           0 :                 ::rtl::OUString aDatabaseName;
    2363           0 :                 OSL_VERIFY( xFormSet->getPropertyValue( PROPERTY_DATASOURCE ) >>= aDatabaseName );
    2364           0 :                 sal_Int32 nObjectType = CommandType::COMMAND;
    2365           0 :                 OSL_VERIFY( xFormSet->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nObjectType );
    2366             : 
    2367           0 :                 Sequence< ::rtl::OUString > aFields( ::dbtools::getFieldNamesByCommandDescriptor( m_xRowSetConnection, nObjectType, sObjectName ) );
    2368             : 
    2369           0 :                 const ::rtl::OUString* pFields = aFields.getConstArray();
    2370           0 :                 for ( sal_Int32 i = 0; i < aFields.getLength(); ++i, ++pFields )
    2371           0 :                     _rFieldNames.push_back( *pFields );
    2372           0 :             }
    2373             :         }
    2374           0 :         catch (const Exception&)
    2375             :         {
    2376             :             OSL_FAIL( "FormComponentPropertyHandler::impl_initFieldList_nothrow: caught an exception!" );
    2377             :         }
    2378             :     }
    2379             : 
    2380             :     //------------------------------------------------------------------------
    2381           0 :     void FormComponentPropertyHandler::impl_clearRowsetConnection_nothrow()
    2382             :     {
    2383           0 :         m_xRowSetConnection.clear();
    2384           0 :     }
    2385             : 
    2386             :     //------------------------------------------------------------------------
    2387           0 :     void FormComponentPropertyHandler::impl_displaySQLError_nothrow( const ::dbtools::SQLExceptionInfo& _rErrorDescriptor ) const
    2388             :     {
    2389           0 :         ::dbtools::showError( _rErrorDescriptor, VCLUnoHelper::GetInterface( impl_getDefaultDialogParent_nothrow() ), m_aContext.getUNOContext() );
    2390           0 :     }
    2391             : 
    2392             :     //------------------------------------------------------------------------
    2393           0 :     bool FormComponentPropertyHandler::impl_ensureRowsetConnection_nothrow() const
    2394             :     {
    2395           0 :         if ( !m_xRowSetConnection.is() )
    2396             :         {
    2397           0 :             uno::Reference<sdbc::XConnection> xConnection(m_aContext.getContextValueByAsciiName( "ActiveConnection" ),uno::UNO_QUERY);
    2398           0 :             m_xRowSetConnection.reset(xConnection,::dbtools::SharedConnection::NoTakeOwnership);
    2399             :         }
    2400           0 :         if ( m_xRowSetConnection.is() )
    2401           0 :             return true;
    2402             : 
    2403           0 :         Reference< XRowSet > xRowSet( impl_getRowSet_throw() );
    2404           0 :         Reference< XPropertySet > xRowSetProps( xRowSet, UNO_QUERY );
    2405             : 
    2406             :         // connect the row set - this is delegated to elsewhere - while observing errors
    2407           0 :         SQLExceptionInfo aError;
    2408             :         try
    2409             :         {
    2410           0 :             if ( xRowSetProps.is() )
    2411             :             {
    2412           0 :                 WaitCursor aWaitCursor( impl_getDefaultDialogParent_nothrow() );
    2413           0 :                 m_xRowSetConnection = ::dbtools::ensureRowSetConnection( xRowSet, m_aContext.getUNOContext(), false );
    2414             :             }
    2415             :         }
    2416           0 :         catch ( const SQLException& ) { aError = SQLExceptionInfo( ::cppu::getCaughtException() ); }
    2417           0 :         catch ( const WrappedTargetException& e ) { aError = SQLExceptionInfo( e.TargetException ); }
    2418           0 :         catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
    2419             : 
    2420             :         // report errors, if necessary
    2421           0 :         if ( aError.isValid() )
    2422             :         {
    2423           0 :             ::rtl::OUString sDataSourceName;
    2424             :             try
    2425             :             {
    2426           0 :                 xRowSetProps->getPropertyValue( PROPERTY_DATASOURCE ) >>= sDataSourceName;
    2427             :             }
    2428           0 :             catch( const Exception& )
    2429             :             {
    2430             :                 OSL_FAIL( "FormComponentPropertyHandler::impl_ensureRowsetConnection_nothrow: caught an exception during error handling!" );
    2431             :             }
    2432             :             // additional info about what happended
    2433           0 :             String sInfo( PcrRes( RID_STR_UNABLETOCONNECT ) );
    2434           0 :             INetURLObject aParser( sDataSourceName );
    2435           0 :             if ( aParser.GetProtocol() != INET_PROT_NOT_VALID )
    2436           0 :                 sDataSourceName = aParser.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
    2437           0 :             sInfo.SearchAndReplaceAllAscii( "$name$", sDataSourceName );
    2438             : 
    2439           0 :             SQLContext aContext;
    2440           0 :             aContext.Message = sInfo;
    2441           0 :             aContext.NextException = aError.get();
    2442           0 :             impl_displaySQLError_nothrow( aContext );
    2443             :         }
    2444             : 
    2445           0 :         return m_xRowSetConnection.is();
    2446             :     }
    2447             : 
    2448             :     //------------------------------------------------------------------------
    2449           0 :     void FormComponentPropertyHandler::impl_describeCursorSource_nothrow( LineDescriptor& _out_rProperty, const Reference< XPropertyControlFactory >& _rxControlFactory ) const
    2450             :     {
    2451             :         try
    2452             :         {
    2453           0 :             WaitCursor aWaitCursor( impl_getDefaultDialogParent_nothrow() );
    2454             : 
    2455             :             ////////////////////////////////////////////////////////////
    2456             :             // Setzen der UI-Daten
    2457           0 :             _out_rProperty.DisplayName = m_pInfoService->getPropertyTranslation( PROPERTY_ID_COMMAND );
    2458             : 
    2459           0 :             _out_rProperty.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( PROPERTY_ID_COMMAND ) );
    2460           0 :             _out_rProperty.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_SQLCOMMAND);
    2461             : 
    2462             :             ////////////////////////////////////////////////////////////
    2463           0 :             sal_Int32 nCommandType = CommandType::COMMAND;
    2464           0 :             impl_getPropertyValue_throw( PROPERTY_COMMANDTYPE ) >>= nCommandType;
    2465             : 
    2466           0 :             switch ( nCommandType )
    2467             :             {
    2468             :             case CommandType::TABLE:
    2469             :             case CommandType::QUERY:
    2470             :             {
    2471           0 :                 ::std::vector< ::rtl::OUString > aNames;
    2472           0 :                 if ( impl_ensureRowsetConnection_nothrow() )
    2473             :                 {
    2474           0 :                     if ( nCommandType == CommandType::TABLE )
    2475           0 :                         impl_fillTableNames_throw( aNames );
    2476             :                     else
    2477           0 :                         impl_fillQueryNames_throw( aNames );
    2478             :                 }
    2479           0 :                 _out_rProperty.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aNames, sal_False, sal_True );
    2480             :             }
    2481           0 :             break;
    2482             : 
    2483             :             default:
    2484           0 :                 _out_rProperty.Control = _rxControlFactory->createPropertyControl( PropertyControlType::MultiLineTextField, sal_False );
    2485           0 :                 break;
    2486           0 :             }
    2487             :         }
    2488           0 :         catch (const Exception&)
    2489             :         {
    2490             :             OSL_FAIL("FormComponentPropertyHandler::impl_describeCursorSource_nothrow: caught an exception !");
    2491             :         }
    2492           0 :     }
    2493             : 
    2494             :     //------------------------------------------------------------------------
    2495           0 :     void FormComponentPropertyHandler::impl_fillTableNames_throw( ::std::vector< ::rtl::OUString >& _out_rNames ) const
    2496             :     {
    2497             :         OSL_PRECOND( m_xRowSetConnection.is(), "FormComponentPropertyHandler::impl_fillTableNames_throw: need a connection!" );
    2498           0 :         _out_rNames.resize( 0 );
    2499             : 
    2500           0 :         Reference< XTablesSupplier > xSupplyTables( m_xRowSetConnection, UNO_QUERY );
    2501           0 :         Reference< XNameAccess > xTableNames;
    2502           0 :         if ( xSupplyTables.is() )
    2503           0 :             xTableNames = xSupplyTables->getTables();
    2504             :         DBG_ASSERT( xTableNames.is(), "FormComponentPropertyHandler::impl_fillTableNames_throw: no way to obtain the tables of the connection!" );
    2505           0 :         if ( !xTableNames.is() )
    2506           0 :             return;
    2507             : 
    2508           0 :         Sequence< ::rtl::OUString> aTableNames = xTableNames->getElementNames();
    2509           0 :         sal_uInt32 nCount = aTableNames.getLength();
    2510           0 :         const ::rtl::OUString* pTableNames = aTableNames.getConstArray();
    2511             : 
    2512           0 :         for ( sal_uInt32 i=0; i<nCount; ++i ,++pTableNames )
    2513           0 :             _out_rNames.push_back( *pTableNames );
    2514             :     }
    2515             : 
    2516             :     //------------------------------------------------------------------------
    2517           0 :     void FormComponentPropertyHandler::impl_fillQueryNames_throw( ::std::vector< ::rtl::OUString >& _out_rNames ) const
    2518             :     {
    2519             :         OSL_PRECOND( m_xRowSetConnection.is(), "FormComponentPropertyHandler::impl_fillQueryNames_throw: need a connection!" );
    2520           0 :         _out_rNames.resize( 0 );
    2521             : 
    2522           0 :         Reference< XQueriesSupplier > xSupplyQueries( m_xRowSetConnection, UNO_QUERY );
    2523           0 :         Reference< XNameAccess > xQueryNames;
    2524           0 :         if ( xSupplyQueries.is() )
    2525             :         {
    2526           0 :             xQueryNames = xSupplyQueries->getQueries();
    2527           0 :             impl_fillQueryNames_throw(xQueryNames,_out_rNames);
    2528           0 :         }
    2529           0 :     }
    2530             :     //------------------------------------------------------------------------
    2531           0 :     void FormComponentPropertyHandler::impl_fillQueryNames_throw( const Reference< XNameAccess >& _xQueryNames,::std::vector< ::rtl::OUString >& _out_rNames,const ::rtl::OUString& _sName ) const
    2532             :     {
    2533             :         DBG_ASSERT( _xQueryNames.is(), "FormComponentPropertyHandler::impl_fillQueryNames_throw: no way to obtain the queries of the connection!" );
    2534           0 :         if ( !_xQueryNames.is() )
    2535           0 :             return;
    2536             : 
    2537           0 :         Sequence< ::rtl::OUString> aQueryNames = _xQueryNames->getElementNames();
    2538           0 :         sal_uInt32 nCount = aQueryNames.getLength();
    2539           0 :         const ::rtl::OUString* pQueryNames = aQueryNames.getConstArray();
    2540           0 :         sal_Bool bAdd = !_sName.isEmpty();
    2541             : 
    2542           0 :         for ( sal_uInt32 i=0; i<nCount; i++, ++pQueryNames )
    2543             :         {
    2544           0 :             ::rtl::OUStringBuffer sTemp;
    2545           0 :             if ( bAdd )
    2546             :             {
    2547           0 :                 sTemp.append(_sName);
    2548           0 :                 sTemp.appendAscii("/");
    2549             :             }
    2550           0 :             sTemp.append(*pQueryNames);
    2551           0 :             Reference< XNameAccess > xSubQueries(_xQueryNames->getByName(*pQueryNames),UNO_QUERY);
    2552           0 :             if ( xSubQueries.is() )
    2553           0 :                 impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp.makeStringAndClear());
    2554             :             else
    2555           0 :                 _out_rNames.push_back( sTemp.makeStringAndClear() );
    2556           0 :         }
    2557             :     }
    2558             : 
    2559             :     //------------------------------------------------------------------------
    2560           0 :     void FormComponentPropertyHandler::impl_describeListSourceUI_throw( LineDescriptor& _out_rDescriptor, const Reference< XPropertyControlFactory >& _rxControlFactory ) const
    2561             :     {
    2562             :         OSL_PRECOND( m_xComponent.is(), "FormComponentPropertyHandler::impl_describeListSourceUI_throw: no component!" );
    2563             : 
    2564             :         ////////////////////////////////////////////////////////////
    2565             :         // Auslesen des ListSourceTypes
    2566           0 :         Any aListSourceType( m_xComponent->getPropertyValue( PROPERTY_LISTSOURCETYPE ) );
    2567             : 
    2568           0 :         sal_Int32 nListSourceType = ListSourceType_VALUELIST;
    2569           0 :         ::cppu::enum2int( nListSourceType, aListSourceType );
    2570             : 
    2571           0 :         _out_rDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( PROPERTY_ID_LISTSOURCE );
    2572           0 :         _out_rDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( PROPERTY_ID_LISTSOURCE ) );
    2573             : 
    2574             :         ////////////////////////////////////////////////////////////
    2575             :         // Enums setzen
    2576           0 :         switch( nListSourceType )
    2577             :         {
    2578             :         case ListSourceType_VALUELIST:
    2579           0 :             _out_rDescriptor.Control = _rxControlFactory->createPropertyControl( PropertyControlType::StringListField, sal_False );
    2580           0 :             break;
    2581             : 
    2582             :         case ListSourceType_TABLEFIELDS:
    2583             :         case ListSourceType_TABLE:
    2584             :         case ListSourceType_QUERY:
    2585             :         {
    2586           0 :             ::std::vector< ::rtl::OUString > aListEntries;
    2587           0 :             if ( impl_ensureRowsetConnection_nothrow() )
    2588             :             {
    2589           0 :                 if ( nListSourceType == ListSourceType_QUERY )
    2590           0 :                     impl_fillQueryNames_throw( aListEntries );
    2591             :                 else
    2592           0 :                     impl_fillTableNames_throw( aListEntries );
    2593             :             }
    2594           0 :             _out_rDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, sal_False, sal_False );
    2595             :         }
    2596           0 :         break;
    2597             :         case ListSourceType_SQL:
    2598             :         case ListSourceType_SQLPASSTHROUGH:
    2599           0 :             impl_ensureRowsetConnection_nothrow();
    2600           0 :             _out_rDescriptor.HasPrimaryButton = m_xRowSetConnection.is();
    2601           0 :             break;
    2602           0 :         }
    2603           0 :     }
    2604             : 
    2605             :     //------------------------------------------------------------------------
    2606           0 :     bool FormComponentPropertyHandler::impl_dialogListSelection_nothrow( const ::rtl::OUString& _rProperty, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
    2607             :     {
    2608             :         OSL_PRECOND( m_pInfoService.get(), "FormComponentPropertyHandler::impl_dialogListSelection_nothrow: no property meta data!" );
    2609             : 
    2610           0 :         String sPropertyUIName( m_pInfoService->getPropertyTranslation( m_pInfoService->getPropertyId( _rProperty ) ) );
    2611           0 :         ListSelectionDialog aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, _rProperty, sPropertyUIName );
    2612           0 :         _rClearBeforeDialog.clear();
    2613           0 :         return ( RET_OK == aDialog.Execute() );
    2614             :     }
    2615             : 
    2616             :     //------------------------------------------------------------------------
    2617           0 :     bool FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow( bool _bFilter, ::rtl::OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
    2618             :     {
    2619             :         OSL_PRECOND( Reference< XRowSet >( m_xComponent, UNO_QUERY ).is(),
    2620             :             "FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow: to be called for forms only!" );
    2621             : 
    2622           0 :         _out_rSelectedClause = ::rtl::OUString();
    2623           0 :         bool bSuccess = false;
    2624           0 :         SQLExceptionInfo aErrorInfo;
    2625             :         try
    2626             :         {
    2627           0 :             if ( !impl_ensureRowsetConnection_nothrow() )
    2628           0 :                 return false;
    2629             : 
    2630             :             // get a composer for the statement which the form is currently based on
    2631           0 :             Reference< XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( m_xComponent, m_aContext.getUNOContext() ) );
    2632             :             OSL_ENSURE( xComposer.is(), "FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow: could not obtain a composer!" );
    2633           0 :             if ( !xComposer.is() )
    2634           0 :                 return false;
    2635             : 
    2636           0 :             ::rtl::OUString sPropertyUIName( m_pInfoService->getPropertyTranslation( _bFilter ? PROPERTY_ID_FILTER : PROPERTY_ID_SORT ) );
    2637             : 
    2638           0 :             const sal_Char* pAsciiServiceName = _bFilter ? "com.sun.star.sdb.FilterDialog" : "com.sun.star.sdb.OrderDialog";
    2639             : 
    2640             :             // create the dialog
    2641           0 :             Reference< XExecutableDialog > xDialog;
    2642           0 :             if ( !m_aContext.createComponent( pAsciiServiceName, xDialog ) )
    2643             :             {
    2644           0 :                 ShowServiceNotAvailableError( impl_getDefaultDialogParent_nothrow(), ::rtl::OUString::createFromAscii( pAsciiServiceName ), sal_True );
    2645           0 :                 return false;
    2646             :             }
    2647             : 
    2648             :             // initialize the dialog
    2649           0 :             Reference< XPropertySet > xDialogProps( xDialog, UNO_QUERY_THROW );
    2650           0 :             xDialogProps->setPropertyValue( ::rtl::OUString(  "QueryComposer"  ), makeAny( xComposer ) );
    2651           0 :             xDialogProps->setPropertyValue( ::rtl::OUString(  "RowSet"  ),        makeAny( m_xComponent ) );
    2652           0 :             xDialogProps->setPropertyValue( ::rtl::OUString(  "ParentWindow"  ),  makeAny( VCLUnoHelper::GetInterface( impl_getDefaultDialogParent_nothrow() ) ) );
    2653           0 :             xDialogProps->setPropertyValue( ::rtl::OUString(  "Title"  ),         makeAny( sPropertyUIName ) );
    2654             : 
    2655           0 :             _rClearBeforeDialog.clear();
    2656           0 :             bSuccess = ( xDialog->execute() != 0 );
    2657           0 :             if ( bSuccess )
    2658           0 :                 _out_rSelectedClause = _bFilter ? xComposer->getFilter() : xComposer->getOrder();
    2659             :         }
    2660           0 :         catch (const SQLContext& e) { aErrorInfo = e; }
    2661           0 :         catch (const SQLWarning& e) { aErrorInfo = e; }
    2662           0 :         catch (const SQLException& e) { aErrorInfo = e; }
    2663           0 :         catch( const Exception& )
    2664             :         {
    2665             :             OSL_FAIL( "FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow: caught an exception!" );
    2666             :         }
    2667             : 
    2668           0 :         if ( aErrorInfo.isValid() )
    2669           0 :             impl_displaySQLError_nothrow( aErrorInfo );
    2670             : 
    2671           0 :         return bSuccess;
    2672             :     }
    2673             : 
    2674             :     //------------------------------------------------------------------------
    2675           0 :     bool FormComponentPropertyHandler::impl_dialogLinkedFormFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
    2676             :     {
    2677           0 :         Reference< XForm > xDetailForm( m_xComponent, UNO_QUERY );
    2678           0 :         Reference< XForm > xMasterForm( m_xObjectParent, UNO_QUERY );
    2679           0 :         uno::Reference<beans::XPropertySet> xMasterProp(m_xObjectParent,uno::UNO_QUERY);
    2680             :         OSL_PRECOND( xDetailForm.is() && xMasterForm.is(), "FormComponentPropertyHandler::impl_dialogLinkedFormFields_nothrow: no forms!" );
    2681           0 :         if ( !xDetailForm.is() || !xMasterForm.is() )
    2682           0 :             return false;
    2683             : 
    2684             : 
    2685           0 :         FormLinkDialog aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, xMasterProp, m_aContext.getUNOContext() );
    2686           0 :         _rClearBeforeDialog.clear();
    2687           0 :         return ( RET_OK == aDialog.Execute() );
    2688             :     }
    2689             : 
    2690             :     //------------------------------------------------------------------------
    2691           0 :     bool FormComponentPropertyHandler::impl_dialogFormatting_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
    2692             :     {
    2693           0 :         bool bChanged = false;
    2694             :         try
    2695             :         {
    2696             :             // create the itemset for the dialog
    2697           0 :             SfxItemSet aCoreSet(SFX_APP()->GetPool(),
    2698             :                 SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE,
    2699             :                 SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO,
    2700           0 :                 0);     // ripped this somewhere ... don't understand it :(
    2701             : 
    2702             :             // get the number formats supplier
    2703           0 :             Reference< XNumberFormatsSupplier >  xSupplier;
    2704           0 :             m_xComponent->getPropertyValue( PROPERTY_FORMATSSUPPLIER ) >>= xSupplier;
    2705             : 
    2706             :             DBG_ASSERT(xSupplier.is(), "FormComponentPropertyHandler::impl_dialogFormatting_nothrow: invalid call !" );
    2707           0 :             Reference< XUnoTunnel > xTunnel( xSupplier, UNO_QUERY_THROW );
    2708             :             SvNumberFormatsSupplierObj* pSupplier =
    2709           0 :                 reinterpret_cast< SvNumberFormatsSupplierObj* >( xTunnel->getSomething( SvNumberFormatsSupplierObj::getUnoTunnelId() ) );
    2710             :             DBG_ASSERT( pSupplier != NULL, "FormComponentPropertyHandler::impl_dialogFormatting_nothrow: invalid call !" );
    2711             : 
    2712           0 :             sal_Int32 nFormatKey = 0;
    2713           0 :             impl_getPropertyValue_throw( PROPERTY_FORMATKEY ) >>= nFormatKey;
    2714           0 :             aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, nFormatKey ) );
    2715             : 
    2716           0 :             SvNumberFormatter* pFormatter = pSupplier->GetNumberFormatter();
    2717           0 :             double dPreviewVal = OFormatSampleControl::getPreviewValue(pFormatter,nFormatKey);
    2718           0 :             SvxNumberInfoItem aFormatter( pFormatter, dPreviewVal, String( PcrRes( RID_STR_TEXT_FORMAT ) ), SID_ATTR_NUMBERFORMAT_INFO );
    2719           0 :             aCoreSet.Put( aFormatter );
    2720             : 
    2721             :             // a tab dialog with a single page
    2722           0 :             ::std::auto_ptr< SfxSingleTabDialog > pDialog( new SfxSingleTabDialog( impl_getDefaultDialogParent_nothrow(), aCoreSet, 0 ) );
    2723           0 :             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
    2724             :             DBG_ASSERT( pFact, "CreateFactory fail!" );
    2725           0 :             ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT );
    2726           0 :             if ( !fnCreatePage )
    2727           0 :                 throw RuntimeException();   // caught below
    2728             : 
    2729           0 :             SfxTabPage* pPage = (*fnCreatePage)( pDialog.get(), aCoreSet );
    2730           0 :             pDialog->SetTabPage( pPage );
    2731             : 
    2732           0 :             _rClearBeforeDialog.clear();
    2733           0 :             if ( RET_OK == pDialog->Execute() )
    2734             :             {
    2735           0 :                 const SfxItemSet* pResult = pDialog->GetOutputItemSet();
    2736             : 
    2737           0 :                 const SfxPoolItem* pItem = pResult->GetItem( SID_ATTR_NUMBERFORMAT_INFO );
    2738           0 :                 const SvxNumberInfoItem* pInfoItem = dynamic_cast< const SvxNumberInfoItem* >( pItem );
    2739           0 :                 if (pInfoItem && pInfoItem->GetDelCount())
    2740             :                 {
    2741           0 :                     const sal_uInt32* pDeletedKeys = pInfoItem->GetDelArray();
    2742             : 
    2743           0 :                     for (sal_uInt16 i=0; i< pInfoItem->GetDelCount(); ++i, ++pDeletedKeys)
    2744           0 :                         pFormatter->DeleteEntry(*pDeletedKeys);
    2745             :                 }
    2746             : 
    2747           0 :                 pItem = NULL;
    2748           0 :                 if ( SFX_ITEM_SET == pResult->GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, sal_False, &pItem ) )
    2749             :                 {
    2750           0 :                     _out_rNewValue <<= (sal_Int32)( static_cast< const SfxUInt32Item* >( pItem )->GetValue() );
    2751           0 :                     bChanged = true;
    2752             :                 }
    2753           0 :             }
    2754             :         }
    2755           0 :         catch( const Exception& )
    2756             :         {
    2757             :             OSL_FAIL( "FormComponentPropertyHandler::impl_dialogFormatting_nothrow: : caught an exception!" );
    2758             :         }
    2759           0 :         return bChanged;
    2760             :     }
    2761             : 
    2762             :     //------------------------------------------------------------------------
    2763           0 :     bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
    2764             :     {
    2765           0 :         bool bIsLink = true;// reflect the legacy behavior
    2766           0 :         ::rtl::OUString aStrTrans = m_pInfoService->getPropertyTranslation( PROPERTY_ID_IMAGE_URL );
    2767             : 
    2768             :         ::sfx2::FileDialogHelper aFileDlg(
    2769             :                 ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW,
    2770           0 :                 SFXWB_GRAPHIC);
    2771             : 
    2772           0 :         aFileDlg.SetTitle(aStrTrans);
    2773             :         // non-linked images ( e.g. those located in the document
    2774             :         // stream ) only if document is available
    2775           0 :         Reference< XModel > xModel( impl_getContextDocument_nothrow() );
    2776           0 :         bool bHandleNonLink = false;
    2777             : 
    2778           0 :         Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY);
    2779             :         DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!");
    2780           0 :         if (xController.is())
    2781             :         {
    2782             :             // do a preview by default
    2783           0 :             xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
    2784             : 
    2785           0 :             xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(bIsLink));
    2786           0 :             xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, bHandleNonLink );
    2787             : 
    2788             :         }
    2789             : 
    2790           0 :         ::rtl::OUString sCurValue;
    2791           0 :         OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sCurValue );
    2792           0 :         if ( !sCurValue.isEmpty() && sCurValue.compareToAscii(GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH(GRAPHOBJ_URLPREFIX) ) != 0 )
    2793             :         {
    2794           0 :             aFileDlg.SetDisplayDirectory( sCurValue );
    2795             :             // TODO: need to set the display directory _and_ the default name
    2796             :         }
    2797             : 
    2798           0 :         _rClearBeforeDialog.clear();
    2799           0 :         bool bSuccess = ( 0 == aFileDlg.Execute() );
    2800           0 :         if ( bSuccess )
    2801             :         {
    2802           0 :             if ( bHandleNonLink && xController.is() )
    2803             :             {
    2804           0 :                 xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink;
    2805             :             }
    2806           0 :             if ( !bIsLink )
    2807             :             {
    2808           0 :                 Graphic aGraphic;
    2809           0 :                 aFileDlg.GetGraphic( aGraphic );
    2810             : 
    2811           0 :                 Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create( m_aContext.getUNOContext() );
    2812           0 :                 xGrfObj->setGraphic( aGraphic.GetXGraphic() );
    2813             : 
    2814             : 
    2815           0 :                 _out_rNewValue <<= xGrfObj;
    2816             : 
    2817             :             }
    2818             :             else
    2819           0 :                 _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath();
    2820             :         }
    2821           0 :         return bSuccess;
    2822             :     }
    2823             : 
    2824             :     //------------------------------------------------------------------------
    2825           0 :     bool FormComponentPropertyHandler::impl_browseForTargetURL_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
    2826             :     {
    2827             :         ::sfx2::FileDialogHelper aFileDlg(
    2828           0 :                 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, 0);
    2829             : 
    2830           0 :         ::rtl::OUString sURL;
    2831           0 :         OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_TARGET_URL ) >>= sURL );
    2832           0 :         INetURLObject aParser( sURL );
    2833           0 :         if ( INET_PROT_FILE == aParser.GetProtocol() )
    2834             :             // set the initial directory only for file-URLs. Everything else
    2835             :             // is considered to be potentially expensive
    2836           0 :             aFileDlg.SetDisplayDirectory( sURL );
    2837             : 
    2838           0 :         _rClearBeforeDialog.clear();
    2839           0 :         bool bSuccess = ( 0 == aFileDlg.Execute() );
    2840           0 :         if ( bSuccess )
    2841           0 :             _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath();
    2842           0 :         return bSuccess;
    2843             :     }
    2844             : 
    2845             :     //------------------------------------------------------------------------
    2846           0 :     bool FormComponentPropertyHandler::impl_executeFontDialog_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
    2847             :     {
    2848           0 :         bool bSuccess = false;
    2849             : 
    2850             :         // create an item set for use with the dialog
    2851           0 :         SfxItemSet* pSet = NULL;
    2852           0 :         SfxItemPool* pPool = NULL;
    2853           0 :         SfxPoolItem** pDefaults = NULL;
    2854           0 :         ControlCharacterDialog::createItemSet(pSet, pPool, pDefaults);
    2855           0 :         ControlCharacterDialog::translatePropertiesToItems(m_xComponent, pSet);
    2856             : 
    2857             :         {   // do this in an own block. The dialog needs to be destroyed before we call
    2858             :             // destroyItemSet
    2859           0 :             ControlCharacterDialog aDlg( impl_getDefaultDialogParent_nothrow(), *pSet );
    2860           0 :             _rClearBeforeDialog.clear();
    2861           0 :             if ( RET_OK == aDlg.Execute() )
    2862             :             {
    2863           0 :                 const SfxItemSet* pOut = aDlg.GetOutputItemSet();
    2864           0 :                 if ( pOut )
    2865             :                 {
    2866           0 :                     Sequence< NamedValue > aFontPropertyValues;
    2867           0 :                     ControlCharacterDialog::translateItemsToProperties( *pOut, aFontPropertyValues );
    2868           0 :                     _out_rNewValue <<= aFontPropertyValues;
    2869           0 :                     bSuccess = true;
    2870             :                 }
    2871           0 :             }
    2872             :         }
    2873             : 
    2874           0 :         ControlCharacterDialog::destroyItemSet(pSet, pPool, pDefaults);
    2875           0 :         return bSuccess;
    2876             :     }
    2877             : 
    2878             :     //------------------------------------------------------------------------
    2879           0 :     bool FormComponentPropertyHandler::impl_browseForDatabaseDocument_throw( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
    2880             :     {
    2881             :         ::sfx2::FileDialogHelper aFileDlg(
    2882             :                 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, 0,
    2883           0 :                 rtl::OUString("sdatabase"));
    2884             : 
    2885           0 :         ::rtl::OUString sDataSource;
    2886           0 :         OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_DATASOURCE ) >>= sDataSource );
    2887           0 :         INetURLObject aParser( sDataSource );
    2888           0 :         if ( INET_PROT_FILE == aParser.GetProtocol() )
    2889             :             // set the initial directory only for file-URLs. Everything else
    2890             :             // is considered to be potentially expensive
    2891           0 :             aFileDlg.SetDisplayDirectory( sDataSource );
    2892             : 
    2893           0 :         const SfxFilter* pFilter = SfxFilter::GetFilterByName(rtl::OUString("StarOffice XML (Base)"));
    2894             :         OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
    2895           0 :         if ( pFilter )
    2896             :         {
    2897           0 :             aFileDlg.SetCurrentFilter(pFilter->GetUIName());
    2898             :             //aFileDlg.AddFilter(pFilter->GetFilterName(),pFilter->GetDefaultExtension());
    2899             :         }
    2900             : 
    2901           0 :         _rClearBeforeDialog.clear();
    2902           0 :         bool bSuccess = ( 0 == aFileDlg.Execute() );
    2903           0 :         if ( bSuccess )
    2904           0 :             _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath();
    2905           0 :         return bSuccess;
    2906             :     }
    2907             : 
    2908             :     //------------------------------------------------------------------------
    2909           0 :     bool FormComponentPropertyHandler::impl_dialogColorChooser_throw( sal_Int32 _nColorPropertyId, Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
    2910             :     {
    2911           0 :         sal_Int32 nColor = 0;
    2912           0 :         OSL_VERIFY( impl_getPropertyValue_throw( impl_getPropertyNameFromId_nothrow( _nColorPropertyId ) ) >>= nColor );
    2913           0 :         ::Color aColor( nColor );
    2914           0 :         SvColorDialog aColorDlg( impl_getDefaultDialogParent_nothrow() );
    2915           0 :         aColorDlg.SetColor( aColor );
    2916             : 
    2917           0 :         _rClearBeforeDialog.clear();
    2918           0 :         if ( !aColorDlg.Execute() )
    2919           0 :             return false;
    2920             : 
    2921           0 :         aColor = aColorDlg.GetColor();
    2922           0 :         nColor = aColor.GetColor();
    2923           0 :         _out_rNewValue <<= (sal_Int32)nColor;
    2924           0 :         return true;
    2925             :     }
    2926             : 
    2927             :     //------------------------------------------------------------------------
    2928           0 :     bool FormComponentPropertyHandler::impl_dialogChooseLabelControl_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
    2929             :     {
    2930           0 :         OSelectLabelDialog dlgSelectLabel( impl_getDefaultDialogParent_nothrow(), m_xComponent );
    2931           0 :         _rClearBeforeDialog.clear();
    2932           0 :         bool bSuccess = ( RET_OK == dlgSelectLabel.Execute() );
    2933           0 :         if ( bSuccess )
    2934           0 :             _out_rNewValue <<= dlgSelectLabel.GetSelected();
    2935           0 :         return bSuccess;
    2936             :     }
    2937             : 
    2938             :     //------------------------------------------------------------------------
    2939           0 :     Reference< XControlContainer > FormComponentPropertyHandler::impl_getContextControlContainer_nothrow() const
    2940             :     {
    2941             :         Reference< XControlContainer > xControlContext(
    2942             :             m_aContext.getContextValueByAsciiName( "ControlContext" ),
    2943           0 :             UNO_QUERY );
    2944           0 :         return xControlContext;
    2945             :     }
    2946             : 
    2947             :     //------------------------------------------------------------------------
    2948           0 :     bool FormComponentPropertyHandler::impl_dialogChangeTabOrder_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
    2949             :     {
    2950             :         OSL_PRECOND( impl_getContextControlContainer_nothrow().is(), "FormComponentPropertyHandler::impl_dialogChangeTabOrder_nothrow: invalid control context!" );
    2951             : 
    2952           0 :         Reference< XTabControllerModel > xTabControllerModel( impl_getRowSet_nothrow(), UNO_QUERY );
    2953             :         TabOrderDialog aDialog(
    2954             :             impl_getDefaultDialogParent_nothrow(),
    2955             :             xTabControllerModel,
    2956             :             impl_getContextControlContainer_nothrow(),
    2957             :             m_aContext.getLegacyServiceFactory()
    2958           0 :         );
    2959           0 :         _rClearBeforeDialog.clear();
    2960           0 :         return ( RET_OK == aDialog.Execute() );
    2961             :     }
    2962             : 
    2963             :     //------------------------------------------------------------------------
    2964             :     namespace
    2965             :     {
    2966             :         //--------------------------------------------------------------------
    2967             :         //- ISQLCommandPropertyUI
    2968             :         //--------------------------------------------------------------------
    2969           0 :         class ISQLCommandPropertyUI : public ISQLCommandAdapter
    2970             :         {
    2971             :         public:
    2972             :             /** returns the empty-string-terminated list of names of properties
    2973             :                 whose UI is to be disabled while the SQL command property is
    2974             :                 being edited.
    2975             :             */
    2976             :             virtual ::rtl::OUString*    getPropertiesToDisable() = 0;
    2977             :         };
    2978             : 
    2979             :         //--------------------------------------------------------------------
    2980             :         //- SQLCommandPropertyUI
    2981             :         //--------------------------------------------------------------------
    2982           0 :         class SQLCommandPropertyUI : public ISQLCommandPropertyUI
    2983             :         {
    2984             :         protected:
    2985           0 :             SQLCommandPropertyUI( const Reference< XPropertySet >& _rxObject )
    2986           0 :                 :m_xObject( _rxObject )
    2987             :             {
    2988           0 :                 if ( !m_xObject.is() )
    2989           0 :                     throw NullPointerException();
    2990           0 :             }
    2991             : 
    2992           0 :             virtual oslInterlockedCount SAL_CALL acquire()
    2993             :             {
    2994           0 :                 return osl_atomic_increment( &m_refCount );
    2995             :             }
    2996             : 
    2997           0 :             virtual oslInterlockedCount SAL_CALL release()
    2998             :             {
    2999           0 :                 if ( 0 == osl_atomic_decrement( &m_refCount ) )
    3000             :                 {
    3001           0 :                     delete this;
    3002           0 :                     return 0;
    3003             :                 }
    3004           0 :                 return m_refCount;
    3005             :             }
    3006             : 
    3007             :         protected:
    3008             :             Reference< XPropertySet >   m_xObject;
    3009             : 
    3010             :         private:
    3011             :             oslInterlockedCount         m_refCount;
    3012             :         };
    3013             : 
    3014             :         //--------------------------------------------------------------------
    3015             :         //- FormSQLCommandUI - declaration
    3016             :         //--------------------------------------------------------------------
    3017           0 :         class FormSQLCommandUI : public SQLCommandPropertyUI
    3018             :         {
    3019             :         public:
    3020             :             FormSQLCommandUI( const Reference< XPropertySet >& _rxForm );
    3021             : 
    3022             :             // ISQLCommandAdapter
    3023             :             virtual ::rtl::OUString getSQLCommand() const;
    3024             :             virtual sal_Bool        getEscapeProcessing() const;
    3025             :             virtual void            setSQLCommand( const ::rtl::OUString& _rCommand ) const;
    3026             :             virtual void            setEscapeProcessing( const sal_Bool _bEscapeProcessing ) const;
    3027             : 
    3028             :             // ISQLCommandPropertyUI
    3029             :             virtual ::rtl::OUString*    getPropertiesToDisable();
    3030             :         };
    3031             : 
    3032             :         //--------------------------------------------------------------------
    3033             :         //- FormSQLCommandUI - implementation
    3034             :         //--------------------------------------------------------------------
    3035             :         //....................................................................
    3036           0 :         FormSQLCommandUI::FormSQLCommandUI( const Reference< XPropertySet >& _rxForm )
    3037           0 :             :SQLCommandPropertyUI( _rxForm )
    3038             :         {
    3039           0 :         }
    3040             : 
    3041             :         //....................................................................
    3042           0 :         ::rtl::OUString FormSQLCommandUI::getSQLCommand() const
    3043             :         {
    3044           0 :             ::rtl::OUString sCommand;
    3045           0 :             OSL_VERIFY( m_xObject->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand );
    3046           0 :             return sCommand;
    3047             :         }
    3048             : 
    3049             :         //....................................................................
    3050           0 :         sal_Bool FormSQLCommandUI::getEscapeProcessing() const
    3051             :         {
    3052           0 :             sal_Bool bEscapeProcessing( sal_False );
    3053           0 :             OSL_VERIFY( m_xObject->getPropertyValue( PROPERTY_ESCAPE_PROCESSING ) >>= bEscapeProcessing );
    3054           0 :             return bEscapeProcessing;
    3055             :         }
    3056             : 
    3057             :         //....................................................................
    3058           0 :         void FormSQLCommandUI::setSQLCommand( const ::rtl::OUString& _rCommand ) const
    3059             :         {
    3060           0 :             m_xObject->setPropertyValue( PROPERTY_COMMAND, makeAny( _rCommand ) );
    3061           0 :         }
    3062             : 
    3063             :         //....................................................................
    3064           0 :         void FormSQLCommandUI::setEscapeProcessing( const sal_Bool _bEscapeProcessing ) const
    3065             :         {
    3066           0 :             m_xObject->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( _bEscapeProcessing ) );
    3067           0 :         }
    3068             : 
    3069             :         //....................................................................
    3070           0 :         ::rtl::OUString* FormSQLCommandUI::getPropertiesToDisable()
    3071             :         {
    3072             :             static ::rtl::OUString s_aCommandProps[] = {
    3073             :                 PROPERTY_DATASOURCE,
    3074             :                 PROPERTY_COMMAND,
    3075             :                 PROPERTY_COMMANDTYPE,
    3076             :                 PROPERTY_ESCAPE_PROCESSING,
    3077             :                 ::rtl::OUString()
    3078           0 :             };
    3079           0 :             return s_aCommandProps;
    3080             :         }
    3081             :         //--------------------------------------------------------------------
    3082             :         //- ValueListCommandUI - declaration
    3083             :         //--------------------------------------------------------------------
    3084           0 :         class ValueListCommandUI : public SQLCommandPropertyUI
    3085             :         {
    3086             :         public:
    3087             :             ValueListCommandUI( const Reference< XPropertySet >& _rxListOrCombo );
    3088             : 
    3089             :             // ISQLCommandAdapter
    3090             :             virtual ::rtl::OUString getSQLCommand() const;
    3091             :             virtual sal_Bool        getEscapeProcessing() const;
    3092             :             virtual void            setSQLCommand( const ::rtl::OUString& _rCommand ) const;
    3093             :             virtual void            setEscapeProcessing( const sal_Bool _bEscapeProcessing ) const;
    3094             : 
    3095             :             // ISQLCommandPropertyUI
    3096             :             virtual ::rtl::OUString*    getPropertiesToDisable();
    3097             :         private:
    3098             :             mutable bool    m_bPropertyValueIsList;
    3099             :         };
    3100             : 
    3101             :         //--------------------------------------------------------------------
    3102             :         //- ValueListCommandUI - implementation
    3103             :         //--------------------------------------------------------------------
    3104             :         //....................................................................
    3105           0 :         ValueListCommandUI::ValueListCommandUI( const Reference< XPropertySet >& _rxListOrCombo )
    3106             :             :SQLCommandPropertyUI( _rxListOrCombo )
    3107           0 :             ,m_bPropertyValueIsList( false )
    3108             :         {
    3109           0 :         }
    3110             : 
    3111             :         //....................................................................
    3112           0 :         ::rtl::OUString ValueListCommandUI::getSQLCommand() const
    3113             :         {
    3114           0 :             ::rtl::OUString sValue;
    3115           0 :             m_bPropertyValueIsList = false;
    3116             : 
    3117             :             // for combo boxes, the property is a mere string
    3118           0 :             Any aValue( m_xObject->getPropertyValue( PROPERTY_LISTSOURCE ) );
    3119           0 :             if ( aValue >>= sValue )
    3120             :                 return sValue;
    3121             : 
    3122           0 :             Sequence< ::rtl::OUString > aValueList;
    3123           0 :             if ( aValue >>= aValueList )
    3124             :             {
    3125           0 :                 m_bPropertyValueIsList = true;
    3126           0 :                 if ( aValueList.getLength() )
    3127           0 :                     sValue = aValueList[0];
    3128             :                 return sValue;
    3129             :             }
    3130             : 
    3131             :             OSL_FAIL( "ValueListCommandUI::getSQLCommand: unexpected property type!" );
    3132           0 :             return sValue;
    3133             :         }
    3134             : 
    3135             :         //....................................................................
    3136           0 :         sal_Bool ValueListCommandUI::getEscapeProcessing() const
    3137             :         {
    3138           0 :             enum ListSourceType eType( ListSourceType_SQL );
    3139           0 :             OSL_VERIFY( m_xObject->getPropertyValue( PROPERTY_LISTSOURCETYPE ) >>= eType );
    3140             :             OSL_ENSURE( ( eType == ListSourceType_SQL ) || ( eType == ListSourceType_SQLPASSTHROUGH ),
    3141             :                 "ValueListCommandUI::getEscapeProcessing: unexpected list source type!" );
    3142           0 :             return ( eType == ListSourceType_SQL );
    3143             :         }
    3144             : 
    3145             :         //....................................................................
    3146           0 :         void ValueListCommandUI::setSQLCommand( const ::rtl::OUString& _rCommand ) const
    3147             :         {
    3148           0 :             Any aValue;
    3149           0 :             if ( m_bPropertyValueIsList )
    3150           0 :                 aValue <<= Sequence< ::rtl::OUString >( &_rCommand, 1 );
    3151             :             else
    3152           0 :                 aValue <<= _rCommand;
    3153           0 :             m_xObject->setPropertyValue( PROPERTY_LISTSOURCE, aValue );
    3154           0 :         }
    3155             : 
    3156             :         //....................................................................
    3157           0 :         void ValueListCommandUI::setEscapeProcessing( const sal_Bool _bEscapeProcessing ) const
    3158             :         {
    3159           0 :             m_xObject->setPropertyValue( PROPERTY_LISTSOURCETYPE, makeAny(
    3160           0 :                 _bEscapeProcessing ? ListSourceType_SQL : ListSourceType_SQLPASSTHROUGH ) );
    3161           0 :         }
    3162             : 
    3163             :         //....................................................................
    3164           0 :         ::rtl::OUString* ValueListCommandUI::getPropertiesToDisable()
    3165             :         {
    3166             :             static ::rtl::OUString s_aListSourceProps[] = {
    3167             :                 PROPERTY_LISTSOURCETYPE,
    3168             :                 PROPERTY_LISTSOURCE,
    3169             :                 ::rtl::OUString()
    3170           0 :             };
    3171           0 :             return s_aListSourceProps;
    3172             :         }
    3173             :     }
    3174             : 
    3175             :     //------------------------------------------------------------------------
    3176           0 :     bool FormComponentPropertyHandler::impl_doDesignSQLCommand_nothrow( const Reference< XObjectInspectorUI >& _rxInspectorUI, PropertyId _nDesignForProperty )
    3177             :     {
    3178             :         try
    3179             :         {
    3180           0 :             if ( m_xCommandDesigner.is() )
    3181             :             {
    3182           0 :                 if ( m_xCommandDesigner->isActive() )
    3183             :                 {
    3184           0 :                     m_xCommandDesigner->raise();
    3185           0 :                     return true;
    3186             :                 }
    3187           0 :                 m_xCommandDesigner->dispose();
    3188           0 :                 m_xCommandDesigner.set( NULL );
    3189             :             }
    3190             : 
    3191           0 :             if ( !impl_ensureRowsetConnection_nothrow() )
    3192           0 :                 return false;
    3193             : 
    3194           0 :             Reference< XPropertySet > xComponentProperties( m_xComponent, UNO_QUERY_THROW );
    3195             : 
    3196           0 :             ::rtl::Reference< ISQLCommandPropertyUI > xCommandUI;
    3197           0 :             switch ( _nDesignForProperty )
    3198             :             {
    3199             :             case PROPERTY_ID_COMMAND:
    3200           0 :                 xCommandUI = new FormSQLCommandUI( xComponentProperties );
    3201           0 :                 break;
    3202             :             case PROPERTY_ID_LISTSOURCE:
    3203           0 :                 xCommandUI = new ValueListCommandUI( xComponentProperties );
    3204           0 :                 break;
    3205             :             default:
    3206             :                 OSL_FAIL( "FormComponentPropertyHandler::OnDesignerClosed: invalid property id!" );
    3207           0 :                 return false;
    3208             :             }
    3209             : 
    3210           0 :             m_xCommandDesigner.set( new SQLCommandDesigner( m_aContext.getUNOContext(), xCommandUI.get(), m_xRowSetConnection, LINK( this, FormComponentPropertyHandler, OnDesignerClosed ) ) );
    3211             : 
    3212             :             DBG_ASSERT( _rxInspectorUI.is(), "FormComponentPropertyHandler::OnDesignerClosed: no access to the property browser ui!" );
    3213           0 :             if ( m_xCommandDesigner->isActive() && _rxInspectorUI.is() )
    3214             :             {
    3215           0 :                 m_xBrowserUI = _rxInspectorUI;
    3216             :                 // disable everything which would affect this property
    3217           0 :                 const ::rtl::OUString* pToDisable = xCommandUI->getPropertiesToDisable();
    3218           0 :                 while ( !pToDisable->isEmpty() )
    3219             :                 {
    3220           0 :                     m_xBrowserUI->enablePropertyUIElements( *pToDisable++, PropertyLineElement::All, sal_False );
    3221             :                 }
    3222             : 
    3223             :                 // but enable the browse button for the property itself - so it can be used to raise the query designer
    3224           0 :                 ::rtl::OUString sPropertyName( impl_getPropertyNameFromId_nothrow( _nDesignForProperty ) );
    3225           0 :                 m_xBrowserUI->enablePropertyUIElements( sPropertyName, PropertyLineElement::PrimaryButton, sal_True );
    3226           0 :             }
    3227             :         }
    3228           0 :         catch( const Exception& )
    3229             :         {
    3230             :             DBG_UNHANDLED_EXCEPTION();
    3231             :         }
    3232           0 :         return m_xCommandDesigner.is();
    3233             :     }
    3234             : 
    3235             :     //------------------------------------------------------------------------
    3236           0 :     IMPL_LINK( FormComponentPropertyHandler, OnDesignerClosed, void*, /*NOTINTERESTEDIN*/ )
    3237             :     {
    3238             :         OSL_ENSURE( m_xBrowserUI.is() && m_xCommandDesigner.is(), "FormComponentPropertyHandler::OnDesignerClosed: too many NULLs!" );
    3239           0 :         if ( m_xBrowserUI.is() && m_xCommandDesigner.is() )
    3240             :         {
    3241             :             try
    3242             :             {
    3243             :                 ::rtl::Reference< ISQLCommandPropertyUI > xCommandUI(
    3244           0 :                     dynamic_cast< ISQLCommandPropertyUI* >( m_xCommandDesigner->getPropertyAdapter().get() ) );
    3245           0 :                 if ( !xCommandUI.is() )
    3246           0 :                     throw NullPointerException();
    3247             : 
    3248           0 :                 const ::rtl::OUString* pToEnable = xCommandUI->getPropertiesToDisable();
    3249           0 :                 while ( !pToEnable->isEmpty() )
    3250             :                 {
    3251           0 :                     m_xBrowserUI->enablePropertyUIElements( *pToEnable++, PropertyLineElement::All, sal_True );
    3252           0 :                 }
    3253             :             }
    3254           0 :             catch( const Exception& )
    3255             :             {
    3256             :                 DBG_UNHANDLED_EXCEPTION();
    3257             :             }
    3258             :         }
    3259             : 
    3260           0 :         return 0L;
    3261             :     }
    3262             : 
    3263             :     //------------------------------------------------------------------------
    3264           0 :     bool FormComponentPropertyHandler::impl_hasValidDataSourceSignature_nothrow( const Reference< XPropertySet >& _xFormProperties, bool _bAllowEmptyDataSourceName ) SAL_THROW(())
    3265             :     {
    3266           0 :         bool bHas = false;
    3267           0 :         if ( _xFormProperties.is() )
    3268             :         {
    3269             :             try
    3270             :             {
    3271           0 :                 ::rtl::OUString sPropertyValue;
    3272             :                 // first, we need the name of an existent data source
    3273           0 :                 if ( _xFormProperties->getPropertySetInfo()->hasPropertyByName(PROPERTY_DATASOURCE) )
    3274           0 :                     _xFormProperties->getPropertyValue( PROPERTY_DATASOURCE ) >>= sPropertyValue;
    3275           0 :                 bHas = ( !sPropertyValue.isEmpty() ) || _bAllowEmptyDataSourceName;
    3276             : 
    3277             :                 // then, the command should not be empty
    3278           0 :                 if ( bHas )
    3279             :                 {
    3280           0 :                     if ( _xFormProperties->getPropertySetInfo()->hasPropertyByName(PROPERTY_COMMAND) )
    3281           0 :                         _xFormProperties->getPropertyValue( PROPERTY_COMMAND ) >>= sPropertyValue;
    3282           0 :                     bHas = !sPropertyValue.isEmpty();
    3283           0 :                 }
    3284             :             }
    3285           0 :             catch( const Exception& )
    3286             :             {
    3287             :                 OSL_FAIL( "FormComponentPropertyHandler::impl_hasValidDataSourceSignature_nothrow: caught an exception!" );
    3288             :             }
    3289             :         }
    3290           0 :         return bHas;
    3291             :     }
    3292             :     //------------------------------------------------------------------------
    3293           0 :     ::rtl::OUString FormComponentPropertyHandler::impl_getDocumentURL_nothrow() const
    3294             :     {
    3295           0 :         ::rtl::OUString sURL;
    3296             :         try
    3297             :         {
    3298           0 :             Reference< XModel > xDocument( impl_getContextDocument_nothrow() );
    3299           0 :             if ( xDocument.is() )
    3300           0 :                 sURL = xDocument->getURL();
    3301             :         }
    3302           0 :         catch( const Exception& )
    3303             :         {
    3304             :             DBG_UNHANDLED_EXCEPTION();
    3305             :         }
    3306           0 :         return sURL;
    3307             :     }
    3308             :     // -------------------------------------------------------------------------
    3309           0 :     ::cppu::IPropertyArrayHelper* FormComponentPropertyHandler::createArrayHelper( ) const
    3310             :     {
    3311           0 :         uno::Sequence< beans::Property > aProps;
    3312           0 :         describeProperties(aProps);
    3313           0 :         return new ::cppu::OPropertyArrayHelper(aProps);
    3314             : 
    3315             :     }
    3316             :     // -------------------------------------------------------------------------
    3317           0 :     ::cppu::IPropertyArrayHelper & FormComponentPropertyHandler::getInfoHelper()
    3318             :     {
    3319           0 :         return *const_cast<FormComponentPropertyHandler*>(this)->getArrayHelper();
    3320             :     }
    3321             :     // -----------------------------------------------------------------------------
    3322           0 :     uno::Reference< beans::XPropertySetInfo > SAL_CALL FormComponentPropertyHandler::getPropertySetInfo(  ) throw(uno::RuntimeException)
    3323             :     {
    3324           0 :         return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
    3325             :     }
    3326             : 
    3327             : //........................................................................
    3328           0 : } // namespace pcr
    3329             : //........................................................................
    3330             : 
    3331             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10