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

Generated by: LCOV version 1.10