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

Generated by: LCOV version 1.10