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