30#include <showhide.hrc>
41#include <com/sun/star/lang/NullPointerException.hpp>
42#include <com/sun/star/lang/XServiceInfo.hpp>
43#include <com/sun/star/form/FormComponentType.hpp>
44#include <com/sun/star/beans/PropertyAttribute.hpp>
45#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
46#include <com/sun/star/container/XNameAccess.hpp>
47#include <com/sun/star/form/XForm.hpp>
48#include <com/sun/star/container/XChild.hpp>
49#include <com/sun/star/sdb/OrderDialog.hpp>
50#include <com/sun/star/sdb/FilterDialog.hpp>
51#include <com/sun/star/sdbc/XConnection.hpp>
52#include <com/sun/star/sdb/CommandType.hpp>
53#include <com/sun/star/sdb/DatabaseContext.hpp>
54#include <com/sun/star/form/XGridColumnFactory.hpp>
55#include <com/sun/star/sdb/SQLContext.hpp>
56#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
57#include <com/sun/star/sdb/XQueriesSupplier.hpp>
58#include <com/sun/star/form/ListSourceType.hpp>
59#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
60#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
61#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
62#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
63#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
64#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
65#include <com/sun/star/awt/XTabControllerModel.hpp>
66#include <com/sun/star/form/FormSubmitEncoding.hpp>
67#include <com/sun/star/awt/VisualEffect.hpp>
68#include <com/sun/star/form/FormButtonType.hpp>
69#include <com/sun/star/inspection/PropertyControlType.hpp>
70#include <com/sun/star/util/MeasureUnit.hpp>
71#include <com/sun/star/inspection/XObjectInspectorUI.hpp>
72#include <com/sun/star/inspection/PropertyLineElement.hpp>
73#include <com/sun/star/resource/XStringResourceManager.hpp>
74#include <com/sun/star/resource/MissingResourceException.hpp>
75#include <com/sun/star/report/XReportDefinition.hpp>
76#include <com/sun/star/graphic/GraphicObject.hpp>
77#include <com/sun/star/text/WritingMode2.hpp>
97#include <svx/dialogs.hrc>
100#include <svx/svxids.hrc>
109#include <string_view>
117 using namespace lang;
118 using namespace beans;
119 using namespace frame;
121 using namespace form;
122 using namespace util;
125 using namespace sdbc;
126 using namespace sdbcx;
127 using namespace report;
128 using namespace container;
129 using namespace ui::dialogs;
130 using namespace inspection;
133 namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
138#define PROPERTY_ID_ROWSET 1
141 :PropertyHandlerComponent( _rxContext )
142 ,::
comphelper::OPropertyContainer(PropertyHandlerComponent::rBHelper)
143 ,m_sDefaultValueString(
PcrRes(RID_STR_STANDARD) )
145 ,m_bComponentIsSubForm( false )
146 ,m_bHaveListSource( false )
147 ,m_bHaveCommand( false )
154 FormComponentPropertyHandler::~FormComponentPropertyHandler()
162 return "com.sun.star.comp.extensions.FormComponentPropertyHandler";
166 Sequence< OUString > FormComponentPropertyHandler::getSupportedServiceNames( )
168 return {
"com.sun.star.form.inspection.FormComponentPropertyHandler" };
174 struct LanguageDependentProp
176 const char* pPropName;
177 sal_Int32 nPropNameLength;
188 {
"CurrencySymbol", 14 },
189 {
"StringItemList", 14 },
195 bool lcl_isLanguageDependentProperty( std::u16string_view aName )
200 while( pLangDepProp->pPropName !=
nullptr )
202 if(
o3tl::equalsAscii( aName, std::string_view(pLangDepProp->pPropName, pLangDepProp->nPropNameLength) ))
212 Reference< resource::XStringResourceResolver > lcl_getStringResourceResolverForProperty
213 (
const Reference< XPropertySet >& _xComponent, std::u16string_view _rPropertyName,
214 const Any& _rPropertyValue )
216 Reference< resource::XStringResourceResolver > xRet;
217 const TypeClass
eType = _rPropertyValue.getValueType().getTypeClass();
218 if ( (eType == TypeClass_STRING || eType == TypeClass_SEQUENCE) &&
219 lcl_isLanguageDependentProperty( _rPropertyName ) )
221 Reference< resource::XStringResourceResolver > xStringResourceResolver;
224 xStringResourceResolver.set( _xComponent->getPropertyValue(
"ResourceResolver" ),UNO_QUERY);
225 if( xStringResourceResolver.is() &&
226 xStringResourceResolver->getLocales().hasElements() )
228 xRet = xStringResourceResolver;
231 catch(
const UnknownPropertyException&)
242 Any FormComponentPropertyHandler::impl_getPropertyValue_throw(
const OUString& _rPropertyName )
const
244 const PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
250 Any aPropertyValue( m_xComponent->getPropertyValue( _rPropertyName ) );
252 Reference< resource::XStringResourceResolver > xStringResourceResolver
253 = lcl_getStringResourceResolverForProperty( m_xComponent, _rPropertyName, aPropertyValue );
254 if( xStringResourceResolver.is() )
256 TypeClass
eType = aPropertyValue.getValueType().getTypeClass();
257 if(
eType == TypeClass_STRING )
260 aPropertyValue >>= aPropStr;
261 if( aPropStr.getLength() > 1 )
263 OUString aPureIdStr = aPropStr.copy( 1 );
264 if( xStringResourceResolver->hasEntryForId( aPureIdStr ) )
266 OUString aResourceStr = xStringResourceResolver->resolveString( aPureIdStr );
267 aPropertyValue <<= aResourceStr;
272 else if(
eType == TypeClass_SEQUENCE )
274 Sequence< OUString > aStrings;
275 aPropertyValue >>= aStrings;
277 std::vector< OUString > aResolvedStrings;
278 aResolvedStrings.reserve( aStrings.getLength() );
281 for (
const OUString& rIdStr : std::as_const(aStrings) )
283 OUString aPureIdStr = rIdStr.copy( 1 );
284 if( xStringResourceResolver->hasEntryForId( aPureIdStr ) )
285 aResolvedStrings.push_back(xStringResourceResolver->resolveString( aPureIdStr ));
287 aResolvedStrings.push_back(rIdStr);
290 catch(
const resource::MissingResourceException & )
296 impl_normalizePropertyValue_nothrow( aPropertyValue, nPropId );
298 return aPropertyValue;
301 Any SAL_CALL FormComponentPropertyHandler::getPropertyValue(
const OUString& _rPropertyName )
304 return ::comphelper::OPropertyContainer::getPropertyValue( _rPropertyName );
306 ::osl::MutexGuard aGuard(
m_aMutex );
307 return impl_getPropertyValue_throw( _rPropertyName );
310 void SAL_CALL FormComponentPropertyHandler::setPropertyValue(
const OUString& _rPropertyName,
const Any& _rValue )
314 ::comphelper::OPropertyContainer::setPropertyValue( _rPropertyName, _rValue );
318 ::osl::MutexGuard aGuard(
m_aMutex );
319 PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
321 Reference< graphic::XGraphicObject > xGrfObj;
324 DBG_ASSERT( xGrfObj.is(),
"FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid");
330 Sequence< NamedValue > aFontPropertyValues;
331 if( ! (_rValue >>= aFontPropertyValues) )
334 for (
const NamedValue& fontPropertyValue : std::as_const(aFontPropertyValues) )
335 m_xComponent->setPropertyValue( fontPropertyValue.Name, fontPropertyValue.Value );
339 Any aValue = _rValue;
341 Reference< resource::XStringResourceResolver > xStringResourceResolver
342 = lcl_getStringResourceResolverForProperty( m_xComponent, _rPropertyName, _rValue );
343 if( xStringResourceResolver.is() )
345 Reference< resource::XStringResourceManager >
346 xStringResourceManager( xStringResourceResolver, UNO_QUERY );
347 if( xStringResourceManager.is() )
349 Any aPropertyValue( m_xComponent->getPropertyValue( _rPropertyName ) );
350 TypeClass
eType = aPropertyValue.getValueType().getTypeClass();
351 if(
eType == TypeClass_STRING )
354 aPropertyValue >>= aPropStr;
355 if( aPropStr.getLength() > 1 )
357 OUString aPureIdStr = aPropStr.copy( 1 );
359 _rValue >>= aValueStr;
360 xStringResourceManager->setString( aPureIdStr, aValueStr );
361 aValue = aPropertyValue;
365 else if(
eType == TypeClass_SEQUENCE )
367 static const char aDot[] =
".";
370 Sequence< OUString > aNewStrings;
371 _rValue >>= aNewStrings;
373 const sal_Int32 nNewCount = aNewStrings.getLength();
376 std::unique_ptr<OUString[]> pNewPureIds(
new OUString[nNewCount]);
378 OUString sControlName;
379 aNameAny >>= sControlName;
380 OUString aIdStrBase = aDot
385 for (
i = 0;
i < nNewCount; ++
i )
387 sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId();
388 OUString aPureIdStr = OUString::number( nUniqueId ) + aIdStrBase;
389 pNewPureIds[
i] = aPureIdStr;
391 xStringResourceManager->setString( aPureIdStr, OUString() );
395 const Sequence< Locale > aLocaleSeq = xStringResourceManager->getLocales();
396 Sequence< OUString > aOldIdStrings;
397 aPropertyValue >>= aOldIdStrings;
400 const OUString* pOldIdStrings = aOldIdStrings.getConstArray();
401 sal_Int32 nOldIdCount = aOldIdStrings.getLength();
402 for (
i = 0;
i < nNewCount; ++
i )
404 OUString aOldPureIdStr;
405 if(
i < nOldIdCount )
407 OUString aOldIdStr = pOldIdStrings[
i];
408 aOldPureIdStr = aOldIdStr.copy( 1 );
410 OUString aNewPureIdStr = pNewPureIds[
i];
412 for (
const Locale& rLocale : aLocaleSeq )
414 OUString aResourceStr;
415 if( !aOldPureIdStr.isEmpty() )
417 if( xStringResourceManager->hasEntryForIdAndLocale( aOldPureIdStr, rLocale ) )
419 aResourceStr = xStringResourceManager->
420 resolveStringForLocale( aOldPureIdStr, rLocale );
423 xStringResourceManager->setStringForLocale( aNewPureIdStr, aResourceStr, rLocale );
427 catch(
const resource::MissingResourceException & )
433 Sequence< OUString > aNewIdStrings;
434 aNewIdStrings.realloc( nNewCount );
435 OUString* pNewIdStrings = aNewIdStrings.getArray();
436 for (
i = 0;
i < nNewCount; ++
i )
438 const OUString& aPureIdStr = pNewPureIds[
i];
439 const OUString&
aStr = aNewStrings[
i];
440 xStringResourceManager->setString( aPureIdStr,
aStr );
442 pNewIdStrings[
i] =
"&" + aPureIdStr;
444 aValue <<= aNewIdStrings;
447 for(
const OUString& rIdStr : std::as_const(aOldIdStrings) )
449 OUString aPureIdStr = rIdStr.copy( 1 );
450 for (
const Locale& rLocale : aLocaleSeq )
454 xStringResourceManager->removeIdForLocale( aPureIdStr, rLocale );
456 catch(
const resource::MissingResourceException & )
464 m_xComponent->setPropertyValue( _rPropertyName, aValue );
468 Any SAL_CALL FormComponentPropertyHandler::convertToPropertyValue(
const OUString& _rPropertyName,
const Any& _rControlValue )
470 ::osl::MutexGuard aGuard(
m_aMutex );
471 PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
472 Property aProperty( impl_getPropertyFromId_throw( nPropId ) );
474 Any aPropertyValue( _rControlValue );
475 if ( !aPropertyValue.hasValue() )
477 if ( ( aProperty.Attributes & PropertyAttribute::MAYBEVOID ) == 0 )
479 aPropertyValue =
Any(
nullptr, aProperty.Type );
481 return aPropertyValue;
485 if ( m_aPropertiesWithDefListEntry.find( _rPropertyName ) != m_aPropertiesWithDefListEntry.end() )
488 OUString sStringValue;
489 if ( _rControlValue >>= sStringValue )
492 if ( sStringValue == m_sDefaultValueString )
501 OUString sControlValue;
502 if( ! (_rControlValue >>= sControlValue) )
505 if ( !sControlValue.isEmpty() )
507 Reference< XDatabaseContext > xDatabaseContext = sdb::DatabaseContext::create(
m_xContext );
508 if ( !xDatabaseContext->hasByName( sControlValue ) )
522 OUString sControlValue;
523 if( ! (_rControlValue >>= sControlValue) )
524 SAL_WARN(
"extensions.propctrlr",
"convertToControlValue: unable to get property for Show/Hide");
526 static_assert(
SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2,
"FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!");
527 bool bShow = sControlValue ==
PcrRes(RID_RSC_ENUM_SHOWHIDE[1]);
529 aPropertyValue <<= bShow;
536 OUString sControlValue;
537 if( ! (_rControlValue >>= sControlValue) )
538 SAL_WARN(
"extensions.propctrlr",
"convertToPropertyValue: unable to get property for URLs");
541 aPropertyValue <<= sControlValue;
545 aPropertyValue <<= URIHelper::SmartRel2Abs( aDocURL, sControlValue, Link<OUString *, bool>(),
false, true );
556 if( ! (_rControlValue >>= aDate) )
557 SAL_WARN(
"extensions.propctrlr",
"convertToControlValue: unable to get property for date");
558 aPropertyValue <<= aDate;
568 if( ! (_rControlValue >>= aTime) )
569 SAL_WARN(
"extensions.propctrlr",
"convertToControlValue: unable to get property for time");
570 aPropertyValue <<= aTime;
576 aPropertyValue = PropertyHandlerComponent::convertToPropertyValue( _rPropertyName, _rControlValue );
578 sal_Int16 nNormalizedValue( 2 );
579 if( ! (aPropertyValue >>= nNormalizedValue) )
582 sal_Int16 nWritingMode = WritingMode2::CONTEXT;
583 switch ( nNormalizedValue )
585 case 0: nWritingMode = WritingMode2::LR_TB;
break;
586 case 1: nWritingMode = WritingMode2::RL_TB;
break;
587 case 2: nWritingMode = WritingMode2::CONTEXT;
break;
589 OSL_FAIL(
"FormComponentPropertyHandler::convertToPropertyValue: unexpected 'normalized value' for WritingMode!" );
590 nWritingMode = WritingMode2::CONTEXT;
594 aPropertyValue <<= nWritingMode;
599 aPropertyValue = PropertyHandlerComponent::convertToPropertyValue( _rPropertyName, _rControlValue );
604 return aPropertyValue;
607 Any SAL_CALL FormComponentPropertyHandler::convertToControlValue(
const OUString& _rPropertyName,
const Any& _rPropertyValue,
const Type& _rControlValueType )
609 ::osl::MutexGuard aGuard(
m_aMutex );
610 sal_Int32 nPropId = m_pInfoService->getPropertyId( _rPropertyName );
611 DBG_ASSERT( nPropId != -1,
"FormComponentPropertyHandler::convertToPropertyValue: not one of my properties!!" );
613 impl_getPropertyFromId_throw( nPropId );
615 Any aControlValue( _rPropertyValue );
616 if ( !aControlValue.hasValue() )
620 if ( m_aPropertiesWithDefListEntry.find( _rPropertyName ) != m_aPropertiesWithDefListEntry.end() )
621 aControlValue <<= m_sDefaultValueString;
623 return aControlValue;
634 static_assert(
SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2,
"FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!");
635 OUString sControlValue = ::comphelper::getBOOL(_rPropertyValue)
636 ?
PcrRes(RID_RSC_ENUM_SHOWHIDE[1])
637 :
PcrRes(RID_RSC_ENUM_SHOWHIDE[0]);
638 aControlValue <<= sControlValue;
645 OSL_ENSURE( _rControlValueType.getTypeClass() == TypeClass_STRING,
646 "FormComponentPropertyHandler::convertToControlValue: wrong ControlValueType!" );
648 OUString sDataSource;
649 _rPropertyValue >>= sDataSource;
650 if ( !sDataSource.isEmpty() )
655 aControlValue <<= sDataSource;
662 OUString sControlValue;
664 Reference< XPropertySet > xSet;
665 _rPropertyValue >>= xSet;
666 Reference< XPropertySetInfo > xPSI;
668 xPSI = xSet->getPropertySetInfo();
674 sControlValue =
"<" + sLabel +
">";
677 aControlValue <<= sControlValue;
688 if( ! (_rPropertyValue >>= nDate) )
689 SAL_WARN(
"extensions.propctrlr",
"convertToControlValue: unable to get property for dates");
690 aControlValue <<= DBTypeConversion::toDate( nDate );
700 if( ! (_rPropertyValue >>= nTime) )
701 SAL_WARN(
"extensions.propctrlr",
"convertToControlValue: unable to get property for times");
702 aControlValue <<= DBTypeConversion::toTime( nTime );
708 sal_Int16 nWritingMode( WritingMode2::CONTEXT );
709 if( ! (_rPropertyValue >>= nWritingMode) )
712 sal_Int16 nNormalized = 2;
713 switch ( nWritingMode )
715 case WritingMode2::LR_TB: nNormalized = 0;
break;
716 case WritingMode2::RL_TB: nNormalized = 1;
break;
717 case WritingMode2::CONTEXT: nNormalized = 2;
break;
719 OSL_FAIL(
"FormComponentPropertyHandler::convertToControlValue: unsupported API value for WritingMode!" );
724 aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName,
Any( nNormalized ), _rControlValueType );
730 FontDescriptor aFont;
731 if( ! (_rPropertyValue >>= aFont) )
734 OUStringBuffer displayName;
735 if ( aFont.Name.isEmpty() )
737 displayName.append(
PcrRes(RID_STR_FONT_DEFAULT) );
742 displayName.append( aFont.Name +
", " );
746 TranslateId pStyleResID = RID_STR_FONTSTYLE_REGULAR;
747 if ( aFont.Slant == FontSlant_ITALIC )
750 pStyleResID = RID_STR_FONTSTYLE_BOLD_ITALIC;
752 pStyleResID = RID_STR_FONTSTYLE_ITALIC;
757 pStyleResID = RID_STR_FONTSTYLE_BOLD;
759 displayName.append(
PcrRes(pStyleResID));
764 displayName.append(
", " + OUString::number( sal_Int32( aFont.Height ) ) );
768 aControlValue <<= displayName.makeStringAndClear();
773 aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType );
778 return aControlValue;
781 PropertyState SAL_CALL FormComponentPropertyHandler::getPropertyState(
const OUString& _rPropertyName )
783 ::osl::MutexGuard aGuard(
m_aMutex );
784 if ( m_xPropertyState.is() )
785 return m_xPropertyState->getPropertyState( _rPropertyName );
786 return PropertyState_DIRECT_VALUE;
789 void SAL_CALL FormComponentPropertyHandler::addPropertyChangeListener(
const Reference< XPropertyChangeListener >& _rxListener )
791 ::osl::MutexGuard aGuard(
m_aMutex );
792 PropertyHandlerComponent::addPropertyChangeListener( _rxListener );
793 if ( m_xComponent.is() )
794 m_xComponent->addPropertyChangeListener( OUString(), _rxListener );
797 void SAL_CALL FormComponentPropertyHandler::removePropertyChangeListener(
const Reference< XPropertyChangeListener >& _rxListener )
799 ::osl::MutexGuard aGuard(
m_aMutex );
800 if ( m_xComponent.is() )
801 m_xComponent->removePropertyChangeListener( OUString(), _rxListener );
802 PropertyHandlerComponent::removePropertyChangeListener( _rxListener );
805 Sequence< Property > FormComponentPropertyHandler::doDescribeSupportedProperties()
const
807 if ( !m_xComponentPropertyInfo.is() )
808 return Sequence< Property >();
812 Sequence< Property > aAllProperties( m_xComponentPropertyInfo->getProperties() );
819 for (
Property & rProperty : asNonConstRange(aAllProperties) )
821 nPropId = m_pInfoService->getPropertyId( rProperty.Name );
824 rProperty.Handle = nPropId;
826 sDisplayName = m_pInfoService->getPropertyTranslation( nPropId );
830 sal_uInt32 nPropertyUIFlags = m_pInfoService->getPropertyUIFlags( nPropId );
836 if ( ( m_eComponentClass ==
eFormControl && !bIsVisibleForForms )
837 || ( m_eComponentClass ==
eDialogControl && !bIsVisibleForDialogs )
842 if ( impl_shouldExcludeProperty_nothrow( rProperty ) )
851 rProperty.Attributes &= ~PropertyAttribute::MAYBEVOID;
871 return Sequence< Property >();
875 Sequence< OUString > SAL_CALL FormComponentPropertyHandler::getSupersededProperties( )
877 return Sequence< OUString >( );
880 Sequence< OUString > SAL_CALL FormComponentPropertyHandler::getActuatingProperties( )
909 LineDescriptor SAL_CALL FormComponentPropertyHandler::describePropertyLine(
const OUString& _rPropertyName,
910 const Reference< XPropertyControlFactory >& _rxControlFactory )
912 if ( !_rxControlFactory.is() )
913 throw NullPointerException();
915 ::osl::MutexGuard aGuard(
m_aMutex );
916 PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
917 Property aProperty( impl_getPropertyFromId_throw( nPropId ) );
924 if ( ( m_nClassId == FormComponentType::FIXEDTEXT )
925 || ( m_nClassId == FormComponentType::COMMANDBUTTON )
926 || ( m_nClassId == FormComponentType::RADIOBUTTON )
927 || ( m_nClassId == FormComponentType::CHECKBOX )
932 OUString
sDisplayName = m_pInfoService->getPropertyTranslation( nPropId );
935 OSL_FAIL(
"FormComponentPropertyHandler::describePropertyLine: did getSupportedProperties not work properly?" );
936 throw UnknownPropertyException();
940 LineDescriptor aDescriptor;
941 aDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nPropId ) );
945 sal_Int16 nControlType = PropertyControlType::TextField;
947 aDescriptor.Control.clear();
950 bool bNeedDefaultStringIfVoidAllowed =
false;
952 TypeClass
eType = aProperty.Type.getTypeClass();
971 nControlType = PropertyControlType::StringListField;
981 Reference< XControlContainer > xControlContext( impl_getContextControlContainer_nothrow() );
982 if ( xControlContext.is() )
984 nControlType = PropertyControlType::NumericField;
996 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder(
"modules/spropctrlr/ui/urlcontrol.ui",
m_xContext));
997 auto pURLBox = std::make_unique<SvtURLBox>(xBuilder->weld_combo_box(
"urlcontrol"));
999 pControl->SetModifyHandler();
1000 aDescriptor.Control = pControl;
1009 nControlType = PropertyControlType::CharacterField;
1023 nControlType = PropertyControlType::ColorListBox;
1054 nControlType = PropertyControlType::MultiLineTextField;
1059 if (FormComponentType::FILECONTROL == m_nClassId)
1060 nControlType = PropertyControlType::TextField;
1062 nControlType = PropertyControlType::MultiLineTextField;
1068 nControlType = PropertyControlType::MultiLineTextField;
1083 Reference< XNumberFormatsSupplier > xSupplier;
1087 Reference< XUnoTunnel > xTunnel(xSupplier,UNO_QUERY);
1088 DBG_ASSERT(xTunnel.is(),
"FormComponentPropertyHandler::describePropertyLine : xTunnel is invalid!");
1089 if (
auto pSupplier = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xTunnel))
1097 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder(
"modules/spropctrlr/ui/formattedsample.ui",
m_xContext));
1098 auto pContainer = xBuilder->weld_container(
"formattedsample");
1100 pControl->SetModifyHandler();
1102 pControl->SetFormatSupplier(pSupplier);
1104 aDescriptor.Control = pControl;
1110 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder(
"modules/spropctrlr/ui/formattedcontrol.ui",
m_xContext));
1111 auto pSpinButton = xBuilder->weld_formatted_spin_button(
"formattedcontrol");
1113 pControl->SetModifyHandler();
1118 if ( !( aFormatKeyValue >>= aDesc.
nKey ) )
1121 pControl->SetFormatDescription( aDesc );
1123 aDescriptor.Control = pControl;
1134 nControlType = PropertyControlType::DateField;
1141 nControlType = PropertyControlType::TimeField;
1149 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder(
"modules/spropctrlr/ui/formattedcontrol.ui",
m_xContext));
1150 auto pSpinButton = xBuilder->weld_formatted_spin_button(
"formattedcontrol");
1152 pControl->SetModifyHandler();
1153 aDescriptor.Control = pControl;
1158 pControl->SetDecimalDigits(
1167 double nDefault = 0;
1168 if ( m_xPropertyState->getPropertyDefault( aProperty.Name ) >>= nDefault )
1169 pControl->SetDefaultValue(nDefault);
1181 if ( TypeClass_BYTE <=
eType &&
eType <= TypeClass_DOUBLE )
1183 sal_Int16 nDigits = 0;
1184 sal_Int16 nValueUnit = -1;
1185 sal_Int16 nDisplayUnit = -1;
1193 nValueUnit = MeasureUnit::MM_10TH;
1194 nDisplayUnit = impl_getDocumentMeasurementUnit_throw();
1199 Optional< double > aValueNotPresent(
false, 0 );
1200 aDescriptor.Control = PropertyHandlerHelper::createNumericControl(
1201 _rxControlFactory, nDigits, aValueNotPresent, aValueNotPresent );
1203 Reference< XNumericControl > xNumericControl( aDescriptor.Control, UNO_QUERY_THROW );
1204 if ( nValueUnit != -1 )
1205 xNumericControl->setValueUnit( nValueUnit );
1206 if ( nDisplayUnit != -1 )
1207 xNumericControl->setDisplayUnit( nDisplayUnit );
1212 if (
eType == TypeClass_SEQUENCE )
1213 nControlType = PropertyControlType::StringListField;
1216 if (
eType == TypeClass_BOOLEAN )
1224 aDescriptor.Control = PropertyHandlerHelper::createListBoxControl(_rxControlFactory, RID_RSC_ENUM_SHOWHIDE,
SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE),
false);
1227 aDescriptor.Control = PropertyHandlerHelper::createListBoxControl(_rxControlFactory, RID_RSC_ENUM_YESNO,
SAL_N_ELEMENTS(RID_RSC_ENUM_YESNO),
false);
1228 bNeedDefaultStringIfVoidAllowed =
true;
1233 sal_uInt32 nPropertyUIFlags = m_pInfoService->getPropertyUIFlags( nPropId );
1234 bool bIsEnumProperty = ( nPropertyUIFlags &
PROP_FLAG_ENUM ) != 0;
1237 std::vector< OUString > aEnumValues = m_pInfoService->getPropertyEnumRepresentations( nPropId );
1238 std::vector< OUString >::const_iterator pStart = aEnumValues.begin();
1239 std::vector< OUString >::const_iterator pEnd = aEnumValues.end();
1248 if ( !::comphelper::getBOOL( m_xComponent->getPropertyValue(
PROPERTY_TRISTATE ) ) )
1250 if ( pEnd > pStart )
1259 if ( FormComponentType::COMBOBOX == m_nClassId )
1264 std::vector< OUString > aListEntries( pEnd - pStart );
1265 std::copy( pStart, pEnd, aListEntries.begin() );
1269 aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aListEntries),
false );
1272 aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, std::move(aListEntries),
false,
false );
1273 bNeedDefaultStringIfVoidAllowed =
true;
1282 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder(
"modules/spropctrlr/ui/numericfield.ui",
m_xContext));
1283 auto pSpinButton = xBuilder->weld_metric_spin_button(
"numericfield", FieldUnit::MILLISECOND);
1285 pControl->SetModifyHandler();
1286 pControl->setMinValue( Optional< double >(
true, 0 ) );
1287 pControl->setMaxValue( Optional< double >(
true, std::numeric_limits< double >::max() ) );
1288 aDescriptor.Control = pControl;
1300 Optional< double > aMinValue(
true, 0 );
1301 Optional< double > aMaxValue(
true, 0x7FFFFFFF );
1304 aMinValue.Value = -1;
1306 aMinValue.Value = 1;
1308 aMinValue.Value = 0;
1310 aDescriptor.Control = PropertyHandlerHelper::createNumericControl(
1311 _rxControlFactory, 0, aMinValue, aMaxValue );
1317 Optional< double > aMinValue(
true, 0 );
1318 Optional< double > aMaxValue(
true, 20 );
1320 aDescriptor.Control = PropertyHandlerHelper::createNumericControl(
1321 _rxControlFactory, 0, aMinValue, aMaxValue );
1331 std::vector< OUString > aListEntries;
1333 Reference< XDatabaseContext > xDatabaseContext = sdb::DatabaseContext::create(
m_xContext );
1334 const Sequence< OUString > aDatasources = xDatabaseContext->getElementNames();
1335 aListEntries.resize( aDatasources.getLength() );
1336 std::copy( aDatasources.begin(), aDatasources.end(), aListEntries.begin() );
1337 aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl(
1338 _rxControlFactory, std::move(aListEntries),
true );
1346 aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl(
1347 _rxControlFactory, std::move(
aFieldNames),
false );
1352 impl_describeCursorSource_nothrow( aDescriptor, _rxControlFactory );
1356 impl_describeListSourceUI_throw( aDescriptor, _rxControlFactory );
1360 if ( !aDescriptor.Control.is() )
1361 aDescriptor.Control = _rxControlFactory->createPropertyControl( nControlType,
bReadOnly );
1363 if ( ( aProperty.Attributes & PropertyAttribute::MAYBEVOID ) != 0 )
1366 if (bNeedDefaultStringIfVoidAllowed)
1368 Reference< XStringListControl > xStringList( aDescriptor.Control, UNO_QUERY_THROW );
1369 xStringList->prependListEntry( m_sDefaultValueString );
1370 m_aPropertiesWithDefListEntry.insert( _rPropertyName );
1374 if ( !aDescriptor.PrimaryButtonId.isEmpty() )
1375 aDescriptor.HasPrimaryButton =
true;
1376 if ( !aDescriptor.SecondaryButtonId.isEmpty() )
1377 aDescriptor.HasSecondaryButton =
true;
1380 aDescriptor.Category = bIsDataProperty ? std::u16string_view(
u"Data") : std::u16string_view(
u"General");
1384 InteractiveSelectionResult SAL_CALL FormComponentPropertyHandler::onInteractivePropertySelection(
const OUString& _rPropertyName,
sal_Bool , Any& _rData,
const Reference< XObjectInspectorUI >& _rxInspectorUI )
1386 if ( !_rxInspectorUI.is() )
1387 throw NullPointerException();
1389 ::osl::ClearableMutexGuard aGuard(
m_aMutex );
1390 PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
1392 InteractiveSelectionResult eResult = InteractiveSelectionResult_Cancelled;
1397 if ( impl_dialogListSelection_nothrow( _rPropertyName, aGuard ) )
1398 eResult = InteractiveSelectionResult_Success;
1405 if ( impl_dialogFilterOrSort_nothrow(
PROPERTY_ID_FILTER == nPropId, sClause, aGuard ) )
1408 eResult = InteractiveSelectionResult_ObtainedValue;
1415 if ( impl_dialogLinkedFormFields_nothrow( aGuard ) )
1416 eResult = InteractiveSelectionResult_Success;
1420 if ( impl_dialogFormatting_nothrow( _rData, aGuard ) )
1421 eResult = InteractiveSelectionResult_ObtainedValue;
1425 if ( impl_browseForImage_nothrow( _rData, aGuard ) )
1426 eResult = InteractiveSelectionResult_ObtainedValue;
1430 if ( impl_browseForTargetURL_nothrow( _rData, aGuard ) )
1431 eResult = InteractiveSelectionResult_ObtainedValue;
1435 if ( impl_executeFontDialog_nothrow( _rData, aGuard ) )
1436 eResult = InteractiveSelectionResult_ObtainedValue;
1440 if ( impl_browseForDatabaseDocument_throw( _rData, aGuard ) )
1441 eResult = InteractiveSelectionResult_ObtainedValue;
1455 if ( impl_dialogColorChooser_throw( nPropId, _rData, aGuard ) )
1456 eResult = InteractiveSelectionResult_ObtainedValue;
1460 if ( impl_dialogChooseLabelControl_nothrow( _rData, aGuard ) )
1461 eResult = InteractiveSelectionResult_ObtainedValue;
1465 if ( impl_dialogChangeTabOrder_nothrow( aGuard ) )
1466 eResult = InteractiveSelectionResult_Success;
1471 if ( impl_doDesignSQLCommand_nothrow( _rxInspectorUI, nPropId ) )
1472 eResult = InteractiveSelectionResult_Pending;
1475 OSL_FAIL(
"FormComponentPropertyHandler::onInteractivePropertySelection: request for a property which does not have dedicated UI!" );
1483 void lcl_rebuildAndResetCommand(
const Reference< XObjectInspectorUI >& _rxInspectorUI,
const Reference< XPropertyHandler >& _rxHandler )
1485 OSL_PRECOND( _rxInspectorUI.is(),
"lcl_rebuildAndResetCommand: invalid BrowserUI!" );
1486 OSL_PRECOND( _rxHandler.is(),
"lcl_rebuildAndResetCommand: invalid handler!" );
1492 void SAL_CALL FormComponentPropertyHandler::actuatingPropertyChanged(
const OUString& _rActuatingPropertyName,
const Any& _rNewValue,
const Any& ,
const Reference< XObjectInspectorUI >& _rxInspectorUI,
sal_Bool _bFirstTimeInit )
1494 if ( !_rxInspectorUI.is() )
1495 throw NullPointerException();
1497 ::osl::MutexGuard aGuard(
m_aMutex );
1498 PropertyId nActuatingPropId( impl_getPropertyId_nothrow( _rActuatingPropertyName ) );
1500 std::vector< PropertyId > aDependentProperties;
1502 switch ( nActuatingPropId )
1513 if ( !_bFirstTimeInit && m_bHaveCommand )
1514 lcl_rebuildAndResetCommand( _rxInspectorUI,
this );
1521 m_xRowSetConnection.clear();
1524 if ( !_bFirstTimeInit && m_bHaveListSource )
1528 if ( !_bFirstTimeInit && m_bHaveCommand )
1529 lcl_rebuildAndResetCommand( _rxInspectorUI,
this );
1539 if ( m_bComponentIsSubForm )
1545 if ( !_bFirstTimeInit && m_bHaveListSource )
1569 OUString sControlSource;
1570 _rNewValue >>= sControlSource;
1590 FormSubmitEncoding eEncoding = FormSubmitEncoding_URL;
1591 if( ! (_rNewValue >>= eEncoding) )
1600 bool bIsRepeating =
false;
1601 if( ! (_rNewValue >>= bIsRepeating) )
1612 bool bHasTabStop =
false;
1613 _rNewValue >>= bHasTabStop;
1621 sal_Int16 nBordeType = VisualEffect::NONE;
1622 if( ! (_rNewValue >>= nBordeType) )
1633 bool bDropDown =
true;
1634 _rNewValue >>= bDropDown;
1646 if( ! (_rNewValue >>= sImageURL) )
1659 FormButtonType eButtonType( FormButtonType_PUSH );
1660 if( ! (_rNewValue >>= eButtonType) )
1662 _rxInspectorUI->enablePropertyUI(
PROPERTY_TARGET_URL, FormButtonType_URL == eButtonType );
1673 if ( !_bFirstTimeInit )
1683 sal_uInt16 nNewDigits = 0;
1686 if( ! (_rNewValue >>= nNewDigits) )
1691 bool bUseSep =
false;
1692 if( ! (_rNewValue >>= bUseSep) )
1698 for (
const OUString & aAffectedProp : aAffectedProps)
1700 Reference< XPropertyControl > xControl;
1703 xControl = _rxInspectorUI->getPropertyControl( aAffectedProp );
1705 catch(
const UnknownPropertyException& ) {}
1706 if ( xControl.is() )
1709 DBG_ASSERT( pControl,
"FormComponentPropertyHandler::actuatingPropertyChanged: invalid control!" );
1725 Reference< XNumberFormatsSupplier > xSupplier;
1729 Reference< XUnoTunnel > xTunnel( xSupplier, UNO_QUERY );
1730 DBG_ASSERT(xTunnel.is(),
"FormComponentPropertyHandler::actuatingPropertyChanged: xTunnel is invalid!");
1737 if ( !( _rNewValue >>= aNewDesc.
nKey ) )
1741 OUString aFormattedPropertyControls[] = {
1744 for (
const OUString & aFormattedPropertyControl : aFormattedPropertyControls)
1746 Reference< XPropertyControl > xControl;
1749 xControl = _rxInspectorUI->getPropertyControl( aFormattedPropertyControl );
1751 catch(
const UnknownPropertyException& ) {}
1752 if ( xControl.is() )
1755 DBG_ASSERT( pControl,
"FormComponentPropertyHandler::actuatingPropertyChanged: invalid control!" );
1766 bool bIsToggleButton =
false;
1767 if( ! (_rNewValue >>= bIsToggleButton) )
1776 OSL_FAIL(
"FormComponentPropertyHandler::actuatingPropertyChanged: did not register for this property!" );
1781 for (
auto const& dependentProperty : aDependentProperties)
1783 if ( impl_isSupportedProperty_nothrow(dependentProperty) )
1784 impl_updateDependentProperty_nothrow(dependentProperty, _rxInspectorUI);
1788 void FormComponentPropertyHandler::impl_updateDependentProperty_nothrow(
PropertyId _nPropId,
const Reference< XObjectInspectorUI >& _rxInspectorUI )
const
1797 ListSourceType eLSType = ListSourceType_VALUELIST;
1801 OUString sListSource;
1803 Sequence< OUString > aListSource;
1805 if ( aListSourceValue >>= aListSource )
1807 if ( aListSource.hasElements() )
1808 sListSource = aListSource[0];
1811 if( ! (aListSourceValue >>= sListSource) )
1815 bool bIsEnabled = ( ( eLSType == ListSourceType_VALUELIST )
1816 || ( sListSource.isEmpty() )
1832 ListSourceType eLSType = ListSourceType_VALUELIST;
1837 ( eLSType != ListSourceType_VALUELIST )
1846 OUString sControlSource;
1853 _rxInspectorUI->enablePropertyUI( impl_getPropertyNameFromId_nothrow( _nPropId ),
1854 ( !sControlSource.isEmpty() ) || ( !sImageURL.isEmpty() )
1862 OUString sControlSource;
1866 bool bEmptyIsNULL =
false;
1868 if ( bHasEmptyIsNULL )
1878 ( !sControlSource.isEmpty() ) && ( !bHasEmptyIsNULL || bEmptyIsNULL )
1889 bool isEnabled =
aEntries.hasElements();
1891 if ( ( m_nClassId == FormComponentType::LISTBOX ) && ( m_eComponentClass ==
eFormControl ) )
1893 ListSourceType eLSType = ListSourceType_VALUELIST;
1895 isEnabled &= ( eLSType == ListSourceType_VALUELIST );
1897 _rxInspectorUI->enablePropertyUIElements( impl_getPropertyNameFromId_nothrow( _nPropId ),
1898 PropertyLineElement::PrimaryButton, isEnabled );
1905 OUString sTargetURL;
1907 FormButtonType eButtonType( FormButtonType_URL );
1908 if ( 0 != m_nClassId )
1916 ( eButtonType == FormButtonType_URL ) && ( !sTargetURL.isEmpty() )
1926 Reference< XConnection > xConnection;
1927 bool bAllowEmptyDS = ::dbtools::isEmbeddedInDatabase( m_xComponent, xConnection );
1930 bool bDoEscapeProcessing(
false );
1932 _rxInspectorUI->enablePropertyUI(
1933 impl_getPropertyNameFromId_nothrow( _nPropId ),
1939 _rxInspectorUI->enablePropertyUIElements(
1940 impl_getPropertyNameFromId_nothrow( _nPropId ),
1941 PropertyLineElement::PrimaryButton,
1942 impl_hasValidDataSourceSignature_nothrow( m_xComponent, bAllowEmptyDS )
1943 && bDoEscapeProcessing
1951 sal_Int32 nCommandType( CommandType::COMMAND );
1955 impl_ensureRowsetConnection_nothrow();
1956 Reference< XConnection > xConnection = m_xRowSetConnection.getTyped();
1957 bool bAllowEmptyDS =
false;
1958 if ( !xConnection.is() )
1959 bAllowEmptyDS = ::dbtools::isEmbeddedInDatabase( m_xComponent, xConnection );
1961 bool doEnable = ( nCommandType == CommandType::COMMAND )
1962 && ( m_xRowSetConnection.is()
1964 || impl_hasValidDataSourceSignature_nothrow( m_xComponent, bAllowEmptyDS)
1967 _rxInspectorUI->enablePropertyUIElements(
1969 PropertyLineElement::PrimaryButton,
1978 Reference< XConnection > xConnection;
1979 bool bAllowEmptyDS = ::dbtools::isEmbeddedInDatabase( m_xComponent, xConnection );
1983 bool bDoEnableMasterDetailFields =
1984 impl_hasValidDataSourceSignature_nothrow( m_xComponent, bAllowEmptyDS )
1985 && impl_hasValidDataSourceSignature_nothrow( Reference< XPropertySet >( m_xObjectParent, UNO_QUERY ), bAllowEmptyDS );
1989 _rxInspectorUI->enablePropertyUIElements(
PROPERTY_DETAILFIELDS, PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields );
1990 _rxInspectorUI->enablePropertyUIElements(
PROPERTY_MASTERFIELDS, PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields );
1995 OSL_FAIL(
"FormComponentPropertyHandler::impl_updateDependentProperty_nothrow: unexpected property to update!" );
2002 TOOLS_WARN_EXCEPTION(
"extensions.propctrlr",
"FormComponentPropertyHandler::impl_updateDependentProperty_nothrow" );
2006 void SAL_CALL FormComponentPropertyHandler::disposing()
2008 PropertyHandlerComponent::disposing();
2009 if ( m_xCommandDesigner.is() && m_xCommandDesigner->isActive() )
2010 m_xCommandDesigner->dispose();
2015 ::osl::MutexGuard aGuard(
m_aMutex );
2017 if ( m_xCommandDesigner.is() && m_xCommandDesigner->isActive() )
2018 return m_xCommandDesigner->suspend();
2022 void FormComponentPropertyHandler::onNewComponent()
2024 PropertyHandlerComponent::onNewComponent();
2025 if ( !m_xComponentPropertyInfo.is() && m_xComponent.is() )
2026 throw NullPointerException();
2028 m_xPropertyState.set( m_xComponent, UNO_QUERY );
2030 m_bComponentIsSubForm = m_bHaveListSource = m_bHaveCommand =
false;
2055 Reference< XForm > xAsForm( m_xComponent, UNO_QUERY );
2058 Reference< XForm > xFormsParent( xAsForm->getParent(), css::uno::UNO_QUERY );
2059 m_bComponentIsSubForm = xFormsParent.is();
2064 Reference< XChild > xCompAsChild( m_xComponent, UNO_QUERY );
2065 if ( xCompAsChild.is() )
2066 m_xObjectParent = xCompAsChild->getParent();
2070 impl_classifyControlModel_throw();
2078 TOOLS_WARN_EXCEPTION(
"extensions.propctrlr",
"FormComponentPropertyHandler::onNewComponent" );
2082 void FormComponentPropertyHandler::impl_classifyControlModel_throw( )
2086 if( ! (m_xComponent->getPropertyValue(
PROPERTY_CLASSID ) >>= m_nClassId) )
2091 Reference< XServiceInfo > xServiceInfo( m_xComponent, UNO_QUERY );
2092 if ( xServiceInfo.is() )
2095 m_nClassId = FormComponentType::CONTROL;
2097 const char* aControlModelServiceNames[] =
2099 "UnoControlButtonModel",
2100 "UnoControlCheckBoxModel",
2101 "UnoControlComboBoxModel",
2102 "UnoControlCurrencyFieldModel",
2103 "UnoControlDateFieldModel",
2104 "UnoControlEditModel",
2105 "UnoControlFileControlModel",
2106 "UnoControlFixedTextModel",
2107 "UnoControlGroupBoxModel",
2108 "UnoControlImageControlModel",
2109 "UnoControlListBoxModel",
2110 "UnoControlNumericFieldModel",
2111 "UnoControlPatternFieldModel",
2112 "UnoControlRadioButtonModel",
2113 "UnoControlScrollBarModel",
2114 "UnoControlSpinButtonModel",
2115 "UnoControlTimeFieldModel",
2117 "UnoControlFixedLineModel",
2118 "UnoControlFormattedFieldModel",
2119 "UnoControlProgressBarModel"
2121 const sal_Int16 nClassIDs[] =
2123 FormComponentType::COMMANDBUTTON,
2124 FormComponentType::CHECKBOX,
2125 FormComponentType::COMBOBOX,
2126 FormComponentType::CURRENCYFIELD,
2127 FormComponentType::DATEFIELD,
2128 FormComponentType::TEXTFIELD,
2129 FormComponentType::FILECONTROL,
2130 FormComponentType::FIXEDTEXT,
2131 FormComponentType::GROUPBOX,
2132 FormComponentType::IMAGECONTROL,
2133 FormComponentType::LISTBOX,
2134 FormComponentType::NUMERICFIELD,
2135 FormComponentType::PATTERNFIELD,
2136 FormComponentType::RADIOBUTTON,
2137 FormComponentType::SCROLLBAR,
2138 FormComponentType::SPINBUTTON,
2139 FormComponentType::TIMEFIELD,
2141 ControlType::FIXEDLINE,
2142 ControlType::FORMATTEDFIELD,
2146 sal_Int32 nKnownControlTypes =
SAL_N_ELEMENTS( aControlModelServiceNames );
2148 "FormComponentPropertyHandler::impl_classifyControlModel_throw: inconsistence" );
2150 for ( sal_Int32
i = 0;
i < nKnownControlTypes; ++
i )
2153 OUString::createFromAscii( aControlModelServiceNames[
i ] );
2157 m_nClassId = nClassIDs[
i ];
2165 void FormComponentPropertyHandler::impl_normalizePropertyValue_nothrow( Any& _rValue,
PropertyId _nPropId )
const
2170 if ( !_rValue.hasValue() )
2172 switch ( m_nClassId )
2174 case FormComponentType::COMMANDBUTTON:
2175 case FormComponentType::RADIOBUTTON:
2176 case FormComponentType::CHECKBOX:
2177 case FormComponentType::TEXTFIELD:
2178 case FormComponentType::LISTBOX:
2179 case FormComponentType::COMBOBOX:
2180 case FormComponentType::FILECONTROL:
2181 case FormComponentType::DATEFIELD:
2182 case FormComponentType::TIMEFIELD:
2183 case FormComponentType::NUMERICFIELD:
2184 case ControlType::FORMATTEDFIELD:
2185 case FormComponentType::CURRENCYFIELD:
2186 case FormComponentType::PATTERNFIELD:
2198 bool FormComponentPropertyHandler::isReportModel()
const
2200 Reference<XModel>
xModel(impl_getContextDocument_nothrow());
2201 Reference<XReportDefinition> xReportDef(
xModel, css::uno::UNO_QUERY);
2202 return xReportDef.is();
2205 bool FormComponentPropertyHandler::impl_shouldExcludeProperty_nothrow(
const Property& _rProperty )
const
2207 OSL_ENSURE( _rProperty.Handle == m_pInfoService->getPropertyId( _rProperty.Name ),
2208 "FormComponentPropertyHandler::impl_shouldExcludeProperty_nothrow: inconsistency in the property!" );
2214 if ( ( _rProperty.Type.getTypeClass() == TypeClass_INTERFACE )
2215 || ( _rProperty.Type.getTypeClass() == TypeClass_UNKNOWN )
2219 if ( ( _rProperty.Attributes & PropertyAttribute::TRANSIENT ) && ( m_eComponentClass !=
eDialogControl ) )
2223 if ( _rProperty.Attributes & PropertyAttribute::READONLY )
2226 switch ( _rProperty.Handle )
2230 if ( !m_bComponentIsSubForm )
2238 Reference< XConnection > xConn;
2246 if ( ControlType::FORMATTEDFIELD == m_nClassId )
2260 if ( ( FormComponentType::DATEFIELD == m_nClassId )
2261 || ( FormComponentType::TIMEFIELD == m_nClassId )
2278 sal_uInt32 nPropertyUIFlags = m_pInfoService->getPropertyUIFlags( _rProperty.Handle );
2295 Reference< XRowSet > FormComponentPropertyHandler::impl_getRowSet_throw( )
const
2297 Reference< XRowSet > xRowSet = m_xRowSet;
2298 if ( !xRowSet.is() )
2300 xRowSet.set( m_xComponent, UNO_QUERY );
2301 if ( !xRowSet.is() )
2303 xRowSet.set( m_xObjectParent, UNO_QUERY );
2304 if ( !xRowSet.is() )
2307 if (Reference< XGridColumnFactory >( m_xObjectParent, UNO_QUERY) .is())
2309 Reference< XChild > xParentAsChild( m_xObjectParent, UNO_QUERY );
2310 if ( xParentAsChild.is() )
2311 xRowSet.set( xParentAsChild->getParent(), UNO_QUERY );
2314 if ( !xRowSet.is() )
2315 xRowSet = m_xRowSet;
2317 DBG_ASSERT( xRowSet.is(),
"FormComponentPropertyHandler::impl_getRowSet_throw: could not obtain the rowset for the introspectee!" );
2323 Reference< XRowSet > FormComponentPropertyHandler::impl_getRowSet_nothrow( )
const
2325 Reference< XRowSet > xReturn;
2328 xReturn = impl_getRowSet_throw();
2332 TOOLS_WARN_EXCEPTION(
"extensions.propctrlr",
"FormComponentPropertyHandler::impl_getRowSet_nothrow" );
2338 void FormComponentPropertyHandler::impl_initFieldList_nothrow( std::vector< OUString >& _rFieldNames )
const
2346 Reference< XPropertySet > xFormSet( impl_getRowSet_throw(), UNO_QUERY );
2347 if ( !xFormSet.is() )
2350 OUString sObjectName;
2354 if ( !sObjectName.isEmpty() && impl_ensureRowsetConnection_nothrow() )
2356 OUString aDatabaseName;
2359 sal_Int32 nObjectType = CommandType::COMMAND;
2363 const Sequence<OUString> aNames = ::dbtools::getFieldNamesByCommandDescriptor( m_xRowSetConnection, nObjectType, sObjectName );
2364 _rFieldNames.insert( _rFieldNames.end(), aNames.begin(), aNames.end() );
2369 TOOLS_WARN_EXCEPTION(
"extensions.propctrlr",
"FormComponentPropertyHandler::impl_initFieldList_nothrow" );
2373 void FormComponentPropertyHandler::impl_displaySQLError_nothrow( const ::dbtools::SQLExceptionInfo& _rErrorDescriptor )
const
2375 auto pTopLevel = impl_getDefaultDialogFrame_nothrow();
2376 ::dbtools::showError(_rErrorDescriptor, pTopLevel ? pTopLevel->GetXWindow() :
nullptr,
m_xContext);
2379 bool FormComponentPropertyHandler::impl_ensureRowsetConnection_nothrow()
const
2381 if ( !m_xRowSetConnection.is() )
2383 uno::Reference<sdbc::XConnection> xConnection;
2385 any >>= xConnection;
2388 if ( m_xRowSetConnection.is() )
2391 Reference< XRowSet > xRowSet( impl_getRowSet_throw() );
2392 Reference< XPropertySet > xRowSetProps( xRowSet, UNO_QUERY );
2395 SQLExceptionInfo aError;
2398 if ( xRowSetProps.is() )
2401 m_xRowSetConnection = ::dbtools::ensureRowSetConnection( xRowSet,
m_xContext,
nullptr );
2404 catch (
const SQLException& ) { aError = SQLExceptionInfo( ::cppu::getCaughtException() ); }
2405 catch (
const WrappedTargetException& e ) { aError = SQLExceptionInfo( e.TargetException ); }
2409 if ( aError.isValid() )
2411 OUString sDataSourceName;
2418 TOOLS_WARN_EXCEPTION(
"extensions.propctrlr",
"FormComponentPropertyHandler::impl_ensureRowsetConnection_nothrow: caught an exception during error handling!" );
2422 if ( aParser.
GetProtocol() != INetProtocol::NotValid )
2424 OUString sInfo(
PcrRes(RID_STR_UNABLETOCONNECT).replaceAll(
"$name$", sDataSourceName));
2425 SQLContext aContext;
2426 aContext.Message = sInfo;
2427 aContext.NextException = aError.get();
2428 impl_displaySQLError_nothrow( aContext );
2431 return m_xRowSetConnection.is();
2435 void FormComponentPropertyHandler::impl_describeCursorSource_nothrow( LineDescriptor& _out_rProperty,
const Reference< XPropertyControlFactory >& _rxControlFactory )
const
2443 _out_rProperty.DisplayName = m_pInfoService->getPropertyTranslation(
PROPERTY_ID_COMMAND );
2445 _out_rProperty.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId(
PROPERTY_ID_COMMAND ) );
2449 sal_Int32 nCommandType = CommandType::COMMAND;
2452 switch ( nCommandType )
2454 case CommandType::TABLE:
2455 case CommandType::QUERY:
2457 std::vector< OUString > aNames;
2458 if ( impl_ensureRowsetConnection_nothrow() )
2460 if ( nCommandType == CommandType::TABLE )
2461 impl_fillTableNames_throw( aNames );
2463 impl_fillQueryNames_throw( aNames );
2465 _out_rProperty.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aNames),
true );
2470 _out_rProperty.Control = _rxControlFactory->createPropertyControl( PropertyControlType::MultiLineTextField,
false );
2476 TOOLS_WARN_EXCEPTION(
"extensions.propctrlr",
"FormComponentPropertyHandler::impl_describeCursorSource_nothrow");
2481 void FormComponentPropertyHandler::impl_fillTableNames_throw( std::vector< OUString >& _out_rNames )
const
2483 OSL_PRECOND( m_xRowSetConnection.is(),
"FormComponentPropertyHandler::impl_fillTableNames_throw: need a connection!" );
2484 _out_rNames.resize( 0 );
2486 Reference< XTablesSupplier > xSupplyTables( m_xRowSetConnection, UNO_QUERY );
2487 Reference< XNameAccess > xTableNames;
2488 if ( xSupplyTables.is() )
2489 xTableNames = xSupplyTables->getTables();
2490 DBG_ASSERT( xTableNames.is(),
"FormComponentPropertyHandler::impl_fillTableNames_throw: no way to obtain the tables of the connection!" );
2491 if ( !xTableNames.is() )
2494 const Sequence<OUString> aNames = xTableNames->getElementNames();
2495 _out_rNames.insert( _out_rNames.end(), aNames.begin(), aNames.end() );
2499 void FormComponentPropertyHandler::impl_fillQueryNames_throw( std::vector< OUString >& _out_rNames )
const
2501 OSL_PRECOND( m_xRowSetConnection.is(),
"FormComponentPropertyHandler::impl_fillQueryNames_throw: need a connection!" );
2502 _out_rNames.resize( 0 );
2504 Reference< XQueriesSupplier > xSupplyQueries( m_xRowSetConnection, UNO_QUERY );
2505 Reference< XNameAccess > xQueryNames;
2506 if ( xSupplyQueries.is() )
2508 xQueryNames = xSupplyQueries->getQueries();
2509 impl_fillQueryNames_throw(xQueryNames,_out_rNames);
2513 void FormComponentPropertyHandler::impl_fillQueryNames_throw(
const Reference< XNameAccess >& _xQueryNames,std::vector< OUString >& _out_rNames,std::u16string_view _sName )
const
2515 DBG_ASSERT( _xQueryNames.is(),
"FormComponentPropertyHandler::impl_fillQueryNames_throw: no way to obtain the queries of the connection!" );
2516 if ( !_xQueryNames.is() )
2519 bool bAdd = !_sName.empty();
2521 const Sequence<OUString> aQueryNames =_xQueryNames->getElementNames();
2522 for (
const OUString& rQueryName : aQueryNames )
2524 OUStringBuffer sTemp;
2527 sTemp.append(OUString::Concat(_sName) +
"/");
2529 sTemp.append(rQueryName);
2530 Reference< XNameAccess > xSubQueries(_xQueryNames->getByName(rQueryName),UNO_QUERY);
2531 if ( xSubQueries.is() )
2532 impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp);
2534 _out_rNames.push_back( sTemp.makeStringAndClear() );
2539 void FormComponentPropertyHandler::impl_describeListSourceUI_throw( LineDescriptor& _out_rDescriptor,
const Reference< XPropertyControlFactory >& _rxControlFactory )
const
2541 OSL_PRECOND( m_xComponent.is(),
"FormComponentPropertyHandler::impl_describeListSourceUI_throw: no component!" );
2547 sal_Int32 nListSourceType = sal_Int32(ListSourceType_VALUELIST);
2548 ::cppu::enum2int( nListSourceType, aListSourceType );
2549 ListSourceType eListSourceType =
static_cast<ListSourceType
>(nListSourceType);
2552 _out_rDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId(
PROPERTY_ID_LISTSOURCE ) );
2556 switch( eListSourceType )
2558 case ListSourceType_VALUELIST:
2559 _out_rDescriptor.Control = _rxControlFactory->createPropertyControl( PropertyControlType::StringListField,
false );
2562 case ListSourceType_TABLEFIELDS:
2563 case ListSourceType_TABLE:
2564 case ListSourceType_QUERY:
2566 std::vector< OUString > aListEntries;
2567 if ( impl_ensureRowsetConnection_nothrow() )
2569 if ( eListSourceType == ListSourceType_QUERY )
2570 impl_fillQueryNames_throw( aListEntries );
2572 impl_fillTableNames_throw( aListEntries );
2574 _out_rDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aListEntries),
false );
2577 case ListSourceType_SQL:
2578 case ListSourceType_SQLPASSTHROUGH:
2579 impl_ensureRowsetConnection_nothrow();
2580 _out_rDescriptor.HasPrimaryButton = m_xRowSetConnection.is();
2586 bool FormComponentPropertyHandler::impl_dialogListSelection_nothrow(
const OUString& _rProperty, ::osl::ClearableMutexGuard& _rClearBeforeDialog )
const
2588 OSL_PRECOND(m_pInfoService,
"FormComponentPropertyHandler::impl_dialogListSelection_"
2589 "nothrow: no property meta data!");
2591 OUString sPropertyUIName( m_pInfoService->getPropertyTranslation( m_pInfoService->getPropertyId( _rProperty ) ) );
2592 ListSelectionDialog aDialog(impl_getDefaultDialogFrame_nothrow(), m_xComponent, _rProperty, sPropertyUIName);
2593 _rClearBeforeDialog.clear();
2597 bool FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow(
bool _bFilter, OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog )
const
2599 OSL_PRECOND( Reference< XRowSet >( m_xComponent, UNO_QUERY ).is(),
2600 "FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow: to be called for forms only!" );
2602 _out_rSelectedClause.clear();
2603 bool bSuccess =
false;
2604 SQLExceptionInfo aErrorInfo;
2607 if ( !impl_ensureRowsetConnection_nothrow() )
2611 Reference< XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( m_xComponent,
m_xContext,
nullptr ) );
2612 OSL_ENSURE( xComposer.is(),
"FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow: could not obtain a composer!" );
2613 if ( !xComposer.is() )
2619 Reference< XExecutableDialog > xDialog;
2622 xDialog.set( sdb::FilterDialog::createDefault(
m_xContext) );
2626 xDialog.set( sdb::OrderDialog::createDefault(
m_xContext) );
2631 Reference< XPropertySet > xDialogProps( xDialog, UNO_QUERY_THROW );
2632 xDialogProps->setPropertyValue(
"QueryComposer",
Any( xComposer ) );
2633 xDialogProps->setPropertyValue(
"RowSet",
Any( m_xComponent ) );
2634 if (
auto pTopLevel = impl_getDefaultDialogFrame_nothrow())
2635 xDialogProps->setPropertyValue(
"ParentWindow",
Any(pTopLevel->GetXWindow()));
2636 xDialogProps->setPropertyValue(
"Title",
Any( sPropertyUIName ) );
2638 _rClearBeforeDialog.clear();
2639 bSuccess = ( xDialog->execute() != 0 );
2641 _out_rSelectedClause = _bFilter ? xComposer->getFilter() : xComposer->getOrder();
2643 catch (
const SQLContext& e) { aErrorInfo = e; }
2644 catch (
const SQLWarning& e) { aErrorInfo = e; }
2645 catch (
const SQLException& e) { aErrorInfo = e; }
2648 TOOLS_WARN_EXCEPTION(
"extensions.propctrlr",
"FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow" );
2651 if ( aErrorInfo.isValid() )
2652 impl_displaySQLError_nothrow( aErrorInfo );
2658 bool FormComponentPropertyHandler::impl_dialogLinkedFormFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog )
const
2660 Reference< XForm > xDetailForm( m_xComponent, UNO_QUERY );
2661 Reference< XForm > xMasterForm( m_xObjectParent, UNO_QUERY );
2662 uno::Reference<beans::XPropertySet> xMasterProp(m_xObjectParent,uno::UNO_QUERY);
2663 OSL_PRECOND( xDetailForm.is() && xMasterForm.is(),
"FormComponentPropertyHandler::impl_dialogLinkedFormFields_nothrow: no forms!" );
2664 if ( !xDetailForm.is() || !xMasterForm.is() )
2668 _rClearBeforeDialog.clear();
2672 bool FormComponentPropertyHandler::impl_dialogFormatting_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog )
const
2674 bool bChanged =
false;
2681 SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO>);
2685 Reference< XNumberFormatsSupplier > xSupplier;
2688 DBG_ASSERT(xSupplier.is(),
"FormComponentPropertyHandler::impl_dialogFormatting_nothrow: invalid call !" );
2689 Reference< XUnoTunnel > xTunnel( xSupplier, UNO_QUERY_THROW );
2692 DBG_ASSERT( pSupplier !=
nullptr,
"FormComponentPropertyHandler::impl_dialogFormatting_nothrow: invalid call !" );
2694 sal_Int32 nFormatKey = 0;
2699 double dPreviewVal = OFormatSampleControl::getPreviewValue(pFormatter,nFormatKey);
2700 SvxNumberInfoItem aFormatter( pFormatter, dPreviewVal,
PcrRes(RID_STR_TEXT_FORMAT), SID_ATTR_NUMBERFORMAT_INFO );
2701 aCoreSet.
Put( aFormatter );
2705 "cui/ui/formatnumberdialog.ui",
"FormatNumberDialog");
2707 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT );
2708 if ( !fnCreatePage )
2713 _rClearBeforeDialog.clear();
2714 if (
RET_OK == aDialog.run() )
2720 for (sal_uInt32 key : pInfoItem->GetDelFormats())
2726 _out_rNewValue <<= static_cast<sal_Int32>( pItem->GetValue() );
2733 TOOLS_WARN_EXCEPTION(
"extensions.propctrlr",
"FormComponentPropertyHandler::impl_dialogFormatting_nothrow" );
2738 bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog )
const
2740 bool bIsLink =
true;
2743 weld::Window* pWin = impl_getDefaultDialogFrame_nothrow();
2745 ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW,
2746 FileDialogFlags::Graphic, pWin);
2751 bool bHandleNonLink;
2753 Reference< XModel >
xModel( impl_getContextDocument_nothrow() );
2754 bHandleNonLink =
xModel.is();
2758 Reference< XReportDefinition > xReportDef(
xModel, css::uno::UNO_QUERY );
2759 bHandleNonLink = !xReportDef.is();
2764 DBG_ASSERT(
xController.is(),
"FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!");
2768 xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, css::uno::Any(
true));
2770 xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, css::uno::Any(bIsLink));
2771 xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, bHandleNonLink );
2778 if (!sCurValue.isEmpty())
2784 _rClearBeforeDialog.clear();
2790 xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink;
2797 Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create(
m_xContext );
2800 _out_rNewValue <<= xGrfObj;
2804 _out_rNewValue <<= aFileDlg.
GetPath();
2809 bool FormComponentPropertyHandler::impl_browseForTargetURL_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog )
const
2811 weld::Window* pWin = impl_getDefaultDialogFrame_nothrow();
2813 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
2814 FileDialogFlags::NONE, pWin);
2820 if ( INetProtocol::File == aParser.
GetProtocol() )
2825 _rClearBeforeDialog.clear();
2828 _out_rNewValue <<= aFileDlg.
GetPath();
2832 bool FormComponentPropertyHandler::impl_executeFontDialog_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog )
const
2834 bool bSuccess =
false;
2837 std::unique_ptr<SfxItemSet> pSet;
2839 std::vector<SfxPoolItem*>* pDefaults =
nullptr;
2840 ControlCharacterDialog::createItemSet(pSet, pPool, pDefaults);
2841 ControlCharacterDialog::translatePropertiesToItems(m_xComponent, pSet.get());
2846 _rClearBeforeDialog.clear();
2852 std::vector< NamedValue > aFontPropertyValues;
2853 ControlCharacterDialog::translateItemsToProperties( *
pOut, aFontPropertyValues );
2860 ControlCharacterDialog::destroyItemSet(pSet, pPool, pDefaults);
2865 bool FormComponentPropertyHandler::impl_browseForDatabaseDocument_throw( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog )
const
2867 weld::Window* pWin = impl_getDefaultDialogFrame_nothrow();
2869 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, FileDialogFlags::NONE,
2870 "sdatabase", SfxFilterFlags::NONE, SfxFilterFlags::NONE, pWin);
2872 OUString sDataSource;
2876 if ( INetProtocol::File == aParser.
GetProtocol() )
2882 OSL_ENSURE(pFilter,
"Filter: StarOffice XML (Base) could not be found!");
2889 _rClearBeforeDialog.clear();
2892 _out_rNewValue <<= aFileDlg.
GetPath();
2896 bool FormComponentPropertyHandler::impl_dialogColorChooser_throw( sal_Int32 _nColorPropertyId, Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog )
const
2899 if( ! (impl_getPropertyValue_throw( impl_getPropertyNameFromId_nothrow( _nColorPropertyId )) >>= aColor) )
2900 SAL_WARN(
"extensions.propctrlr",
"impl_dialogColorChooser_throw: unable to get property " << _nColorPropertyId);
2904 _rClearBeforeDialog.clear();
2905 weld::Window* pParent = impl_getDefaultDialogFrame_nothrow();
2906 if (!aColorDlg.
Execute(pParent))
2909 _out_rNewValue <<= aColorDlg.
GetColor();
2913 bool FormComponentPropertyHandler::impl_dialogChooseLabelControl_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog )
const
2915 weld::Window* pParent = impl_getDefaultDialogFrame_nothrow();
2917 _rClearBeforeDialog.clear();
2918 bool bSuccess = (
RET_OK == dlgSelectLabel.
run());
2925 Reference< XControlContainer > FormComponentPropertyHandler::impl_getContextControlContainer_nothrow()
const
2927 Reference< XControlContainer > xControlContext;
2929 any >>= xControlContext;
2930 return xControlContext;
2934 bool FormComponentPropertyHandler::impl_dialogChangeTabOrder_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog )
const
2936 OSL_PRECOND( impl_getContextControlContainer_nothrow().is(),
"FormComponentPropertyHandler::impl_dialogChangeTabOrder_nothrow: invalid control context!" );
2938 Reference< XTabControllerModel > xTabControllerModel( impl_getRowSet_nothrow(), UNO_QUERY );
2939 TabOrderDialog aDialog(impl_getDefaultDialogFrame_nothrow(), xTabControllerModel,
2940 impl_getContextControlContainer_nothrow(),
m_xContext);
2941 _rClearBeforeDialog.clear();
2957 virtual OUString* getPropertiesToDisable() = 0;
2963 class SQLCommandPropertyUI :
public ISQLCommandPropertyUI
2966 explicit SQLCommandPropertyUI(
const Reference< XPropertySet >& _rxObject )
2967 : m_xObject(_rxObject)
2969 if ( !m_xObject.is() )
2970 throw NullPointerException();
2974 Reference< XPropertySet > m_xObject;
2980 class FormSQLCommandUI :
public SQLCommandPropertyUI
2983 explicit FormSQLCommandUI(
const Reference< XPropertySet >& _rxForm );
2986 virtual OUString getSQLCommand()
const override;
2987 virtual bool getEscapeProcessing()
const override;
2988 virtual void setSQLCommand(
const OUString& _rCommand )
const override;
2989 virtual void setEscapeProcessing(
const bool _bEscapeProcessing )
const override;
2992 virtual OUString* getPropertiesToDisable()
override;
2999 FormSQLCommandUI::FormSQLCommandUI(
const Reference< XPropertySet >& _rxForm )
3000 :SQLCommandPropertyUI( _rxForm )
3005 OUString FormSQLCommandUI::getSQLCommand()
const
3014 bool FormSQLCommandUI::getEscapeProcessing()
const
3016 bool bEscapeProcessing(
false );
3019 return bEscapeProcessing;
3023 void FormSQLCommandUI::setSQLCommand(
const OUString& _rCommand )
const
3029 void FormSQLCommandUI::setEscapeProcessing(
const bool _bEscapeProcessing )
const
3035 OUString* FormSQLCommandUI::getPropertiesToDisable()
3037 static OUString s_aCommandProps[] = {
3044 return s_aCommandProps;
3049 class ValueListCommandUI :
public SQLCommandPropertyUI
3052 explicit ValueListCommandUI(
const Reference< XPropertySet >& _rxListOrCombo );
3055 virtual OUString getSQLCommand()
const override;
3056 virtual bool getEscapeProcessing()
const override;
3057 virtual void setSQLCommand(
const OUString& _rCommand )
const override;
3058 virtual void setEscapeProcessing(
const bool _bEscapeProcessing )
const override;
3061 virtual OUString* getPropertiesToDisable()
override;
3063 mutable bool m_bPropertyValueIsList;
3070 ValueListCommandUI::ValueListCommandUI(
const Reference< XPropertySet >& _rxListOrCombo )
3071 :SQLCommandPropertyUI( _rxListOrCombo )
3072 ,m_bPropertyValueIsList( false )
3077 OUString ValueListCommandUI::getSQLCommand()
const
3080 m_bPropertyValueIsList =
false;
3084 if ( aValue >>= sValue )
3087 Sequence< OUString > aValueList;
3088 if ( aValue >>= aValueList )
3090 m_bPropertyValueIsList =
true;
3091 if ( aValueList.hasElements() )
3092 sValue = aValueList[0];
3096 OSL_FAIL(
"ValueListCommandUI::getSQLCommand: unexpected property type!" );
3101 bool ValueListCommandUI::getEscapeProcessing()
const
3103 ListSourceType
eType = ListSourceType_SQL;
3106 OSL_ENSURE( ( eType == ListSourceType_SQL ) || ( eType == ListSourceType_SQLPASSTHROUGH ),
3107 "ValueListCommandUI::getEscapeProcessing: unexpected list source type!" );
3108 return ( eType == ListSourceType_SQL );
3112 void ValueListCommandUI::setSQLCommand(
const OUString& _rCommand )
const
3115 if ( m_bPropertyValueIsList )
3116 aValue <<= Sequence< OUString >( &_rCommand, 1 );
3118 aValue <<= _rCommand;
3123 void ValueListCommandUI::setEscapeProcessing(
const bool _bEscapeProcessing )
const
3126 _bEscapeProcessing ? ListSourceType_SQL : ListSourceType_SQLPASSTHROUGH ) );
3130 OUString* ValueListCommandUI::getPropertiesToDisable()
3132 static OUString s_aListSourceProps[] = {
3137 return s_aListSourceProps;
3160 Reference< XPropertySet > xComponentProperties(
m_xComponent, UNO_SET_THROW );
3163 switch ( _nDesignForProperty )
3166 xCommandUI =
new FormSQLCommandUI( xComponentProperties );
3169 xCommandUI =
new ValueListCommandUI( xComponentProperties );
3172 OSL_FAIL(
"FormComponentPropertyHandler::OnDesignerClosed: invalid property id!" );
3178 DBG_ASSERT( _rxInspectorUI.is(),
"FormComponentPropertyHandler::OnDesignerClosed: no access to the property browser ui!" );
3183 const OUString* pToDisable = xCommandUI->getPropertiesToDisable();
3184 while ( !pToDisable->isEmpty() )
3186 m_xBrowserUI->enablePropertyUIElements( *pToDisable++, PropertyLineElement::All,
false );
3191 m_xBrowserUI->enablePropertyUIElements( sPropertyName, PropertyLineElement::PrimaryButton,
true );
3204 OSL_ENSURE( m_xBrowserUI.is() && m_xCommandDesigner.is(),
"FormComponentPropertyHandler::OnDesignerClosed: too many NULLs!" );
3205 if ( !(m_xBrowserUI.is() && m_xCommandDesigner.is()) )
3211 dynamic_cast< ISQLCommandPropertyUI*
>( m_xCommandDesigner->getPropertyAdapter().get() ) );
3212 if ( !xCommandUI.is() )
3213 throw NullPointerException();
3215 const OUString* pToEnable = xCommandUI->getPropertiesToDisable();
3216 while ( !pToEnable->isEmpty() )
3218 m_xBrowserUI->enablePropertyUIElements( *pToEnable++, PropertyLineElement::All,
true );
3231 if ( _xFormProperties.is() )
3235 OUString sPropertyValue;
3239 bHas = ( !sPropertyValue.isEmpty() ) || _bAllowEmptyDataSourceName;
3244 if ( _xFormProperties->getPropertySetInfo()->hasPropertyByName(
PROPERTY_COMMAND) )
3246 bHas = !sPropertyValue.isEmpty();
3251 TOOLS_WARN_EXCEPTION(
"extensions.propctrlr",
"FormComponentPropertyHandler::impl_hasValidDataSourceSignature_nothrow" );
3263 if ( xDocument.is() )
3264 sURL = xDocument->getURL();
3275 uno::Sequence< beans::Property > aProps;
3277 return new ::cppu::OPropertyArrayHelper(aProps);
3288 return ::cppu::OPropertySetHelper::createPropertySetInfo(
getInfoHelper());
3294extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
3296 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any>
const&)
PropertiesInfo aProperties
constexpr OUStringLiteral sServiceName
SfxApplication * SfxGetpApp()
const char *const aFieldNames[]
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
OUString getBase(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
static std::shared_ptr< const SfxFilter > GetFilterByName(const OUString &rName)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxItemSet * GetOutputItemSet() const
void SetTabPage(std::unique_ptr< SfxTabPage > xTabPage)
weld::Container * get_content_area()
virtual short run() override
const SfxItemSet * GetOutputItemSet() const
const Color & GetColor() const
short Execute(weld::Window *pParent)
void SetColor(const Color &rColor)
static bool IsCTLFontEnabled()
bool IsModuleInstalled(EModule eModule) const
static SvxAbstractDialogFactory * Create()
::cppu::IPropertyArrayHelper * getArrayHelper()
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
an adapter to forward changed SQL command property values to a component
virtual short run() override
css::uno::Reference< css::beans::XPropertySet > GetSelected() const
PropertyHandler implementation which additionally supports XServiceInfo.
css::uno::Reference< css::uno::XComponentContext > m_xContext
the context in which the instance was created
css::uno::Reference< css::beans::XPropertySet > m_xComponent
the component we're inspecting
OUString impl_getPropertyNameFromId_nothrow(PropertyId _nPropId) const
get the name of a property given by handle
css::uno::Reference< css::frame::XModel > impl_getContextDocument_nothrow() const
returns the value of the ContextDocument property in the ComponentContext which was used to create th...
encapsulates the code for calling and managing a query design frame, used for interactively designing...
void SetDisplayDirectory(const OUString &rPath)
const css::uno::Reference< css::ui::dialogs::XFilePicker3 > & GetFilePicker() const
void SetTitle(const OUString &rNewTitle)
void SetCurrentFilter(const OUString &rFilter)
void SetContext(Context _eNewContext)
ErrCode GetGraphic(Graphic &rGraphic) const
OUString get(NOTATION _eOutputNotation) const
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
ScXMLEditAttributeMap::Entry const aEntries[]
Reference< XComponentContext > m_xContext
constexpr OUStringLiteral HID_PROP_ACTIVESELECTIONBACKGROUNDCOLOR
constexpr OUStringLiteral HID_PROP_INACTIVESELECTIONBACKGROUNDCOLOR
constexpr OUStringLiteral HID_PROP_GRIDLINECOLOR
constexpr OUStringLiteral HID_PROP_HEADERBACKGROUNDCOLOR
constexpr OUStringLiteral HID_PROP_HEADERTEXTCOLOR
constexpr OUStringLiteral HID_PROP_ACTIVESELECTIONTEXTCOLOR
constexpr OUStringLiteral HID_PROP_INACTIVESELECTIONTEXTCOLOR
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
bool equalsAscii(std::u16string_view s1, std::string_view s2)
const sal_Int16 PROGRESSBAR
a property handler for any virtual string properties
OUString PcrRes(TranslateId aId)
void clearContainer(CONTAINER &_rContainer)
IMPL_LINK_NOARG(OBrowserLine, OnButtonFocus, weld::Widget &, void)
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
static constexpr auto Items
VCL_DLLPUBLIC float ConvertFontWeight(FontWeight eWeight)
constexpr OUStringLiteral UID_PROP_DLG_TABINDEX
constexpr OUStringLiteral UID_PROP_DLG_ORDER
constexpr OUStringLiteral UID_PROP_DLG_CONTROLLABEL
constexpr OUStringLiteral UID_PROP_DLG_SQLCOMMAND
constexpr OUStringLiteral UID_PROP_DLG_FONT_TYPE
constexpr OUStringLiteral UID_PROP_DLG_FILTER
constexpr OUStringLiteral UID_PROP_DLG_IMAGE_URL
constexpr OUStringLiteral UID_PROP_DLG_SELECTION
constexpr OUStringLiteral UID_PROP_DLG_FILLCOLOR
constexpr OUStringLiteral UID_PROP_DLG_BORDERCOLOR
constexpr OUStringLiteral UID_PROP_DLG_NUMBER_FORMAT
constexpr OUStringLiteral UID_PROP_DLG_FORMLINKFIELDS
constexpr OUStringLiteral UID_PROP_DLG_SYMBOLCOLOR
constexpr OUStringLiteral UID_PROP_DLG_ATTR_DATASOURCE
constexpr OUStringLiteral UID_PROP_DLG_ATTR_TARGET_URL
constexpr OUStringLiteral UID_PROP_DLG_BACKGROUNDCOLOR
Reference< XController > xController
Reference< XModel > xModel
const LanguageDependentProp aLanguageDependentProp[]