diff options
Diffstat (limited to 'extensions/source/propctrlr/formcomponenthandler.cxx')
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.cxx | 219 |
1 files changed, 106 insertions, 113 deletions
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 5631014ef211..1b36dd64e387 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -90,6 +90,7 @@ #include <svl/filenotation.hxx> #include <svl/intitem.hxx> #include <svl/itemset.hxx> +#include <svl/numformat.hxx> #include <unotools/moduleoptions.hxx> #include <svl/numuno.hxx> #include <svl/urihelper.hxx> @@ -99,9 +100,10 @@ #include <svx/svxids.hrc> #include <vcl/graph.hxx> #include <vcl/unohelp.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <sal/macros.h> #include <sal/log.hxx> +#include <vcl/svapp.hxx> #include <limits> #include <memory> @@ -116,7 +118,6 @@ namespace pcr using namespace lang; using namespace beans; using namespace frame; - using namespace script; using namespace form; using namespace util; using namespace awt; @@ -191,14 +192,14 @@ namespace pcr namespace { - bool lcl_isLanguageDependentProperty( const OUString& aName ) + bool lcl_isLanguageDependentProperty( std::u16string_view aName ) { bool bRet = false; const LanguageDependentProp* pLangDepProp = aLanguageDependentProp; while( pLangDepProp->pPropName != nullptr ) { - if( aName.equalsAsciiL( pLangDepProp->pPropName, pLangDepProp->nPropNameLength )) + if( o3tl::equalsAscii( aName, std::string_view(pLangDepProp->pPropName, pLangDepProp->nPropNameLength) )) { bRet = true; break; @@ -209,7 +210,7 @@ namespace pcr } Reference< resource::XStringResourceResolver > lcl_getStringResourceResolverForProperty - ( const Reference< XPropertySet >& _xComponent, const OUString& _rPropertyName, + ( const Reference< XPropertySet >& _xComponent, std::u16string_view _rPropertyName, const Any& _rPropertyValue ) { Reference< resource::XStringResourceResolver > xRet; @@ -242,6 +243,10 @@ namespace pcr { const PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) ); + // tdf#117159 crash with chart in database report + if (!m_xComponent) + return Any(); + Any aPropertyValue( m_xComponent->getPropertyValue( _rPropertyName ) ); Reference< resource::XStringResourceResolver > xStringResourceResolver @@ -273,7 +278,7 @@ namespace pcr aResolvedStrings.reserve( aStrings.getLength() ); try { - for ( const OUString& rIdStr : std::as_const(aStrings) ) + for (const OUString& rIdStr : aStrings) { OUString aPureIdStr = rIdStr.copy( 1 ); if( xStringResourceResolver->hasEntryForId( aPureIdStr ) ) @@ -317,7 +322,7 @@ namespace pcr if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) ) { DBG_ASSERT( xGrfObj.is(), "FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid"); - m_xComponent->setPropertyValue(PROPERTY_GRAPHIC, uno::makeAny(xGrfObj->getGraphic())); + m_xComponent->setPropertyValue(PROPERTY_GRAPHIC, uno::Any(xGrfObj->getGraphic())); } else if ( PROPERTY_ID_FONT == nPropId ) { @@ -326,7 +331,7 @@ namespace pcr if( ! (_rValue >>= aFontPropertyValues) ) SAL_WARN("extensions.propctrlr", "setPropertyValue: unable to get property " << PROPERTY_ID_FONT); - for ( const NamedValue& fontPropertyValue : std::as_const(aFontPropertyValues) ) + for (const NamedValue& fontPropertyValue : aFontPropertyValues) m_xComponent->setPropertyValue( fontPropertyValue.Name, fontPropertyValue.Value ); } else @@ -439,7 +444,7 @@ namespace pcr aValue <<= aNewIdStrings; // Remove old ids from resource for all locales - for( const OUString& rIdStr : std::as_const(aOldIdStrings) ) + for (const OUString& rIdStr : aOldIdStrings) { OUString aPureIdStr = rIdStr.copy( 1 ); for ( const Locale& rLocale : aLocaleSeq ) @@ -518,7 +523,7 @@ namespace pcr if( ! (_rControlValue >>= sControlValue) ) SAL_WARN("extensions.propctrlr", "convertToControlValue: unable to get property for Show/Hide"); - assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2 && "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!"); + static_assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2, "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!"); bool bShow = sControlValue == PcrRes(RID_RSC_ENUM_SHOWHIDE[1]); aPropertyValue <<= bShow; @@ -626,7 +631,7 @@ namespace pcr case PROPERTY_ID_SHOW_RECORDACTIONS: case PROPERTY_ID_SHOW_FILTERSORT: { - assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2 && "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!"); + static_assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2, "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!"); OUString sControlValue = ::comphelper::getBOOL(_rPropertyValue) ? PcrRes(RID_RSC_ENUM_SHOWHIDE[1]) : PcrRes(RID_RSC_ENUM_SHOWHIDE[0]); @@ -665,7 +670,7 @@ namespace pcr { OUString sLabel; if( ! (xSet->getPropertyValue( PROPERTY_LABEL) >>= sLabel) ) - SAL_WARN("extensions.propctrlr", "convertToPropertyValue: unable to get property " PROPERTY_LABEL); + SAL_WARN("extensions.propctrlr", "convertToPropertyValue: unable to get property " << PROPERTY_LABEL); sControlValue = "<" + sLabel + ">"; } @@ -716,7 +721,7 @@ namespace pcr break; } - aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName, makeAny( nNormalized ), _rControlValueType ); + aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName, Any( nNormalized ), _rControlValueType ); } break; @@ -734,12 +739,11 @@ namespace pcr else { // font name - displayName.append( aFont.Name ); - displayName.append( ", " ); + displayName.append( aFont.Name + ", " ); // font style ::FontWeight eWeight = vcl::unohelper::ConvertFontWeight( aFont.Weight ); - const char* pStyleResID = RID_STR_FONTSTYLE_REGULAR; + TranslateId pStyleResID = RID_STR_FONTSTYLE_REGULAR; if ( aFont.Slant == FontSlant_ITALIC ) { if ( eWeight > WEIGHT_NORMAL ) @@ -757,8 +761,7 @@ namespace pcr // font size if ( aFont.Height ) { - displayName.append( ", " ); - displayName.append( sal_Int32( aFont.Height ) ); + displayName.append( ", " + OUString::number( sal_Int32( aFont.Height ) ) ); } } @@ -813,7 +816,7 @@ namespace pcr PropertyId nPropId( 0 ); OUString sDisplayName; - for ( Property & rProperty : aAllProperties ) + for ( Property & rProperty : asNonConstRange(aAllProperties) ) { nPropId = m_pInfoService->getPropertyId( rProperty.Name ); if ( nPropId == -1 ) @@ -876,31 +879,31 @@ namespace pcr Sequence< OUString > SAL_CALL FormComponentPropertyHandler::getActuatingProperties( ) { - ::osl::MutexGuard aGuard( m_aMutex ); - std::vector< OUString > aInterestingProperties; - aInterestingProperties.push_back( PROPERTY_DATASOURCE ); - aInterestingProperties.push_back( PROPERTY_COMMAND ); - aInterestingProperties.push_back( PROPERTY_COMMANDTYPE ); - aInterestingProperties.push_back( PROPERTY_LISTSOURCE ); - aInterestingProperties.push_back( PROPERTY_LISTSOURCETYPE ); - aInterestingProperties.push_back( PROPERTY_SUBMIT_ENCODING ); - aInterestingProperties.push_back( PROPERTY_REPEAT ); - aInterestingProperties.push_back( PROPERTY_TABSTOP ); - aInterestingProperties.push_back( PROPERTY_BORDER ); - aInterestingProperties.push_back( PROPERTY_CONTROLSOURCE ); - aInterestingProperties.push_back( PROPERTY_DROPDOWN ); - aInterestingProperties.push_back( PROPERTY_IMAGE_URL ); - aInterestingProperties.push_back( PROPERTY_TARGET_URL ); - aInterestingProperties.push_back( PROPERTY_STRINGITEMLIST ); - aInterestingProperties.push_back( PROPERTY_BUTTONTYPE ); - aInterestingProperties.push_back( PROPERTY_ESCAPE_PROCESSING ); - aInterestingProperties.push_back( PROPERTY_TRISTATE ); - aInterestingProperties.push_back( PROPERTY_DECIMAL_ACCURACY ); - aInterestingProperties.push_back( PROPERTY_SHOWTHOUSANDSEP ); - aInterestingProperties.push_back( PROPERTY_FORMATKEY ); - aInterestingProperties.push_back( PROPERTY_EMPTY_IS_NULL ); - aInterestingProperties.push_back( PROPERTY_TOGGLE ); - return comphelper::containerToSequence(aInterestingProperties); + return + { + PROPERTY_DATASOURCE, + PROPERTY_COMMAND, + PROPERTY_COMMANDTYPE, + PROPERTY_LISTSOURCE, + PROPERTY_LISTSOURCETYPE, + PROPERTY_SUBMIT_ENCODING, + PROPERTY_REPEAT, + PROPERTY_TABSTOP, + PROPERTY_BORDER, + PROPERTY_CONTROLSOURCE, + PROPERTY_DROPDOWN, + PROPERTY_IMAGE_URL, + PROPERTY_TARGET_URL, + PROPERTY_STRINGITEMLIST, + PROPERTY_BUTTONTYPE, + PROPERTY_ESCAPE_PROCESSING, + PROPERTY_TRISTATE, + PROPERTY_DECIMAL_ACCURACY, + PROPERTY_SHOWTHOUSANDSEP, + PROPERTY_FORMATKEY, + PROPERTY_EMPTY_IS_NULL, + PROPERTY_TOGGLE + }; } LineDescriptor SAL_CALL FormComponentPropertyHandler::describePropertyLine( const OUString& _rPropertyName, @@ -997,8 +1000,8 @@ namespace pcr aDescriptor.Control = pControl; aDescriptor.PrimaryButtonId = PROPERTY_ID_TARGET_URL == nPropId - ? std::u16string_view(u"" UID_PROP_DLG_ATTR_TARGET_URL) - : std::u16string_view(u"" UID_PROP_DLG_IMAGE_URL); + ? UID_PROP_DLG_ATTR_TARGET_URL + : UID_PROP_DLG_IMAGE_URL; break; } @@ -1083,9 +1086,7 @@ namespace pcr { Reference< XUnoTunnel > xTunnel(xSupplier,UNO_QUERY); DBG_ASSERT(xTunnel.is(), "FormComponentPropertyHandler::describePropertyLine : xTunnel is invalid!"); - SvNumberFormatsSupplierObj* pSupplier = reinterpret_cast<SvNumberFormatsSupplierObj*>(xTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId())); - - if (pSupplier != nullptr) + if (auto pSupplier = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xTunnel)) { bool bIsFormatKey = (PROPERTY_ID_FORMATKEY == nPropId); @@ -1265,10 +1266,10 @@ namespace pcr // create the control if ( PROPERTY_ID_TARGET_FRAME == nPropId ) - aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, false ); + aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aListEntries), false ); else { - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, false ); + aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, std::move(aListEntries), false, false ); bNeedDefaultStringIfVoidAllowed = true; } } @@ -1330,11 +1331,11 @@ namespace pcr std::vector< OUString > aListEntries; Reference< XDatabaseContext > xDatabaseContext = sdb::DatabaseContext::create( m_xContext ); - Sequence< OUString > aDatasources = xDatabaseContext->getElementNames(); + const Sequence< OUString > aDatasources = xDatabaseContext->getElementNames(); aListEntries.resize( aDatasources.getLength() ); std::copy( aDatasources.begin(), aDatasources.end(), aListEntries.begin() ); aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( - _rxControlFactory, aListEntries, true ); + _rxControlFactory, std::move(aListEntries), true ); } break; @@ -1343,7 +1344,7 @@ namespace pcr std::vector< OUString > aFieldNames; impl_initFieldList_nothrow( aFieldNames ); aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( - _rxControlFactory, aFieldNames, false ); + _rxControlFactory, std::move(aFieldNames), false ); } break; @@ -1484,7 +1485,7 @@ namespace pcr OSL_PRECOND( _rxInspectorUI.is(), "lcl_rebuildAndResetCommand: invalid BrowserUI!" ); OSL_PRECOND( _rxHandler.is(), "lcl_rebuildAndResetCommand: invalid handler!" ); _rxInspectorUI->rebuildPropertyUI( PROPERTY_COMMAND ); - _rxHandler->setPropertyValue( PROPERTY_COMMAND, makeAny( OUString() ) ); + _rxHandler->setPropertyValue( PROPERTY_COMMAND, Any( OUString() ) ); } } @@ -1670,7 +1671,7 @@ namespace pcr // ----- TriState ----- case PROPERTY_ID_TRISTATE: if ( !_bFirstTimeInit ) - _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? OUString(PROPERTY_DEFAULT_STATE) : OUString(PROPERTY_STATE) ); + _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? PROPERTY_DEFAULT_STATE : PROPERTY_STATE ); break; // case PROPERTY_ID_TRISTATE // ----- DecimalAccuracy ----- @@ -1693,7 +1694,7 @@ namespace pcr } // propagate the changes to the min/max/default fields - OUString aAffectedProps[] = { OUString(PROPERTY_VALUE), OUString(PROPERTY_DEFAULT_VALUE), OUString(PROPERTY_VALUEMIN), OUString(PROPERTY_VALUEMAX) }; + OUString aAffectedProps[] = { PROPERTY_VALUE, PROPERTY_DEFAULT_VALUE, PROPERTY_VALUEMIN, PROPERTY_VALUEMAX }; for (const OUString & aAffectedProp : aAffectedProps) { Reference< XPropertyControl > xControl; @@ -1738,7 +1739,7 @@ namespace pcr // give each control which has to know this an own copy of the description OUString aFormattedPropertyControls[] = { - OUString(PROPERTY_EFFECTIVE_MIN), OUString(PROPERTY_EFFECTIVE_MAX), OUString(PROPERTY_EFFECTIVE_DEFAULT), OUString(PROPERTY_EFFECTIVE_VALUE) + PROPERTY_EFFECTIVE_MIN, PROPERTY_EFFECTIVE_MAX, PROPERTY_EFFECTIVE_DEFAULT, PROPERTY_EFFECTIVE_VALUE }; for (const OUString & aFormattedPropertyControl : aFormattedPropertyControls) { @@ -1795,7 +1796,7 @@ namespace pcr { ListSourceType eLSType = ListSourceType_VALUELIST; if( ! (impl_getPropertyValue_throw( PROPERTY_LISTSOURCETYPE ) >>= eLSType) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_LISTSOURCETYPE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_LISTSOURCETYPE); OUString sListSource; { @@ -1808,7 +1809,7 @@ namespace pcr } else if( ! (aListSourceValue >>= sListSource) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_LISTSOURCE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_LISTSOURCE); } bool bIsEnabled = ( ( eLSType == ListSourceType_VALUELIST ) @@ -1830,7 +1831,7 @@ namespace pcr { ListSourceType eLSType = ListSourceType_VALUELIST; if( ! (impl_getPropertyValue_throw( PROPERTY_LISTSOURCETYPE ) >>= eLSType) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_LISTSOURCETYPE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_LISTSOURCETYPE); _rxInspectorUI->enablePropertyUI( PROPERTY_BOUNDCOLUMN, ( eLSType != ListSourceType_VALUELIST ) @@ -1860,13 +1861,13 @@ namespace pcr { OUString sControlSource; if( ! (impl_getPropertyValue_throw( PROPERTY_CONTROLSOURCE ) >>= sControlSource) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_CONTROLSOURCE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_CONTROLSOURCE); bool bEmptyIsNULL = false; bool bHasEmptyIsNULL = impl_componentHasProperty_throw( PROPERTY_EMPTY_IS_NULL ); if ( bHasEmptyIsNULL ) if( ! (impl_getPropertyValue_throw( PROPERTY_EMPTY_IS_NULL ) >>= bEmptyIsNULL) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_EMPTY_IS_NULL); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_EMPTY_IS_NULL); // if the control is not bound to a DB field, there is no sense in having the "Input required" // property @@ -1907,7 +1908,7 @@ namespace pcr if ( 0 != m_nClassId ) { if( ! (impl_getPropertyValue_throw( PROPERTY_BUTTONTYPE ) >>= eButtonType) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_BUTTONTYPE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_BUTTONTYPE); } // if m_nClassId is 0, then we're inspecting a form. In this case, eButtonType is always // FormButtonType_URL here @@ -1949,7 +1950,7 @@ namespace pcr { sal_Int32 nCommandType( CommandType::COMMAND ); if( ! (impl_getPropertyValue_throw( PROPERTY_COMMANDTYPE ) >>= nCommandType) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_COMMANDTYPE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_COMMANDTYPE); impl_ensureRowsetConnection_nothrow(); Reference< XConnection > xConnection = m_xRowSetConnection.getTyped(); @@ -2083,7 +2084,7 @@ namespace pcr if ( impl_componentHasProperty_throw( PROPERTY_CLASSID ) ) { if( ! (m_xComponent->getPropertyValue( PROPERTY_CLASSID ) >>= m_nClassId) ) - SAL_WARN("extensions.propctrlr", "impl_classifyControlModel_throw: unable to get property " PROPERTY_CLASSID); + SAL_WARN("extensions.propctrlr", "impl_classifyControlModel_throw: unable to get property " << PROPERTY_CLASSID); } else if ( eDialogControl == m_eComponentClass ) { @@ -2269,7 +2270,7 @@ namespace pcr break; case PROPERTY_ID_WRITING_MODE: - if ( !SvtCTLOptions().IsCTLFontEnabled() ) + if ( !SvtCTLOptions::IsCTLFontEnabled() ) return true; break; } @@ -2348,20 +2349,19 @@ namespace pcr OUString sObjectName; if( ! (xFormSet->getPropertyValue( PROPERTY_COMMAND ) >>= sObjectName) ) - SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " PROPERTY_COMMAND); + SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " << PROPERTY_COMMAND); // when there is no command we don't need to ask for columns if ( !sObjectName.isEmpty() && impl_ensureRowsetConnection_nothrow() ) { OUString aDatabaseName; if( ! (xFormSet->getPropertyValue( PROPERTY_DATASOURCE ) >>= aDatabaseName) ) - SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " PROPERTY_DATASOURCE); + SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " << PROPERTY_DATASOURCE); sal_Int32 nObjectType = CommandType::COMMAND; if( ! (xFormSet->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nObjectType) ) - SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " PROPERTY_COMMANDTYPE); + SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " << PROPERTY_COMMANDTYPE); const Sequence<OUString> aNames = ::dbtools::getFieldNamesByCommandDescriptor( m_xRowSetConnection, nObjectType, sObjectName ); - for ( const OUString& rField : aNames ) - _rFieldNames.push_back( rField ); + _rFieldNames.insert( _rFieldNames.end(), aNames.begin(), aNames.end() ); } } catch (const Exception&) @@ -2422,9 +2422,7 @@ namespace pcr if ( aParser.GetProtocol() != INetProtocol::NotValid ) sDataSourceName = aParser.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset ); OUString sInfo(PcrRes(RID_STR_UNABLETOCONNECT).replaceAll("$name$", sDataSourceName)); - SQLContext aContext; - aContext.Message = sInfo; - aContext.NextException = aError.get(); + SQLContext aContext(sInfo, {}, {}, 0, aError.get(), {}); impl_displaySQLError_nothrow( aContext ); } @@ -2462,7 +2460,7 @@ namespace pcr else impl_fillQueryNames_throw( aNames ); } - _out_rProperty.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aNames, true ); + _out_rProperty.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aNames), true ); } break; @@ -2492,8 +2490,7 @@ namespace pcr return; const Sequence<OUString> aNames = xTableNames->getElementNames(); - for ( const OUString& rTableName : aNames ) - _out_rNames.push_back( rTableName ); + _out_rNames.insert( _out_rNames.end(), aNames.begin(), aNames.end() ); } @@ -2525,13 +2522,12 @@ namespace pcr OUStringBuffer sTemp; if ( bAdd ) { - sTemp.append(_sName); - sTemp.append("/"); + sTemp.append(OUString::Concat(_sName) + "/"); } sTemp.append(rQueryName); Reference< XNameAccess > xSubQueries(_xQueryNames->getByName(rQueryName),UNO_QUERY); if ( xSubQueries.is() ) - impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp.makeStringAndClear()); + impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp); else _out_rNames.push_back( sTemp.makeStringAndClear() ); } @@ -2573,7 +2569,7 @@ namespace pcr else impl_fillTableNames_throw( aListEntries ); } - _out_rDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, false ); + _out_rDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aListEntries), false ); } break; case ListSourceType_SQL: @@ -2631,11 +2627,11 @@ namespace pcr // initialize the dialog Reference< XPropertySet > xDialogProps( xDialog, UNO_QUERY_THROW ); - xDialogProps->setPropertyValue("QueryComposer", makeAny( xComposer ) ); - xDialogProps->setPropertyValue("RowSet", makeAny( m_xComponent ) ); + xDialogProps->setPropertyValue("QueryComposer", Any( xComposer ) ); + xDialogProps->setPropertyValue("RowSet", Any( m_xComponent ) ); if (auto pTopLevel = impl_getDefaultDialogFrame_nothrow()) - xDialogProps->setPropertyValue("ParentWindow", makeAny(pTopLevel->GetXWindow())); - xDialogProps->setPropertyValue("Title", makeAny( sPropertyUIName ) ); + xDialogProps->setPropertyValue("ParentWindow", Any(pTopLevel->GetXWindow())); + xDialogProps->setPropertyValue("Title", Any( sPropertyUIName ) ); _rClearBeforeDialog.clear(); bSuccess = ( xDialog->execute() != 0 ); @@ -2680,7 +2676,7 @@ namespace pcr SfxItemSet aCoreSet( SfxGetpApp()->GetPool(), svl::Items< - SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO>{}); + SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO>); // ripped this somewhere ... don't understand it :( // get the number formats supplier @@ -2717,18 +2713,15 @@ namespace pcr { const SfxItemSet* pResult = aDialog.GetOutputItemSet(); - const SfxPoolItem* pItem = pResult->GetItem( SID_ATTR_NUMBERFORMAT_INFO ); - const SvxNumberInfoItem* pInfoItem = dynamic_cast< const SvxNumberInfoItem* >( pItem ); - if (pInfoItem) + if (const SvxNumberInfoItem* pInfoItem = pResult->GetItem( SID_ATTR_NUMBERFORMAT_INFO )) { for (sal_uInt32 key : pInfoItem->GetDelFormats()) pFormatter->DeleteEntry(key); } - pItem = nullptr; - if ( SfxItemState::SET == pResult->GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, false, &pItem ) ) + if ( const SfxUInt32Item* pItem = pResult->GetItemIfSet( SID_ATTR_NUMBERFORMAT_VALUE, false ) ) { - _out_rNewValue <<= static_cast<sal_Int32>( static_cast< const SfxUInt32Item* >( pItem )->GetValue() ); + _out_rNewValue <<= static_cast<sal_Int32>( pItem->GetValue() ); bChanged = true; } } @@ -2749,7 +2742,7 @@ namespace pcr ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, FileDialogFlags::Graphic, pWin); - + aFileDlg.SetContext(sfx2::FileDialogHelper::FormsInsertImage); aFileDlg.SetTitle(aStrTrans); // non-linked images ( e.g. those located in the document // stream ) only if document is available @@ -2779,7 +2772,7 @@ namespace pcr OUString sCurValue; if( ! (impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sCurValue) ) - SAL_WARN("extensions.propctrlr", "impl_browseForImage_nothrow: unable to get property " PROPERTY_IMAGE_URL); + SAL_WARN("extensions.propctrlr", "impl_browseForImage_nothrow: unable to get property " << PROPERTY_IMAGE_URL); if (!sCurValue.isEmpty()) { aFileDlg.SetDisplayDirectory( sCurValue ); @@ -2820,7 +2813,7 @@ namespace pcr OUString sURL; if( ! (impl_getPropertyValue_throw( PROPERTY_TARGET_URL ) >>= sURL) ) - SAL_WARN("extensions.propctrlr", "impl_browseForTargetURL_nothrow: unable to get property " PROPERTY_TARGET_URL); + SAL_WARN("extensions.propctrlr", "impl_browseForTargetURL_nothrow: unable to get property " << PROPERTY_TARGET_URL); INetURLObject aParser( sURL ); if ( INetProtocol::File == aParser.GetProtocol() ) // set the initial directory only for file-URLs. Everything else @@ -2841,8 +2834,8 @@ namespace pcr // create an item set for use with the dialog std::unique_ptr<SfxItemSet> pSet; rtl::Reference<SfxItemPool> pPool; - std::vector<SfxPoolItem*>* pDefaults = nullptr; - ControlCharacterDialog::createItemSet(pSet, pPool, pDefaults); + FontList aFontList(Application::GetDefaultDevice()); + ControlCharacterDialog::createItemSet(pSet, pPool, aFontList); ControlCharacterDialog::translatePropertiesToItems(m_xComponent, pSet.get()); { // do this in an own block. The dialog needs to be destroyed before we call @@ -2862,7 +2855,7 @@ namespace pcr } } - ControlCharacterDialog::destroyItemSet(pSet, pPool, pDefaults); + ControlCharacterDialog::destroyItemSet(pSet, pPool); return bSuccess; } @@ -2876,7 +2869,7 @@ namespace pcr OUString sDataSource; if( ! (impl_getPropertyValue_throw( PROPERTY_DATASOURCE ) >>= sDataSource) ) - SAL_WARN("extensions.propctrlr", "impl_browseForDatabaseDocument_throw: unable to get property " PROPERTY_DATASOURCE); + SAL_WARN("extensions.propctrlr", "impl_browseForDatabaseDocument_throw: unable to get property " << PROPERTY_DATASOURCE); INetURLObject aParser( sDataSource ); if ( INetProtocol::File == aParser.GetProtocol() ) // set the initial directory only for file-URLs. Everything else @@ -3011,7 +3004,7 @@ namespace pcr { OUString sCommand; if( ! (m_xObject->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand) ) - SAL_WARN("extensions.propctrlr", "getSQLCommand: unable to get property " PROPERTY_COMMAND); + SAL_WARN("extensions.propctrlr", "getSQLCommand: unable to get property " << PROPERTY_COMMAND); return sCommand; } @@ -3020,30 +3013,30 @@ namespace pcr { bool bEscapeProcessing( false ); if( ! (m_xObject->getPropertyValue( PROPERTY_ESCAPE_PROCESSING ) >>= bEscapeProcessing) ) - SAL_WARN("extensions.propctrlr", "getSQLCommand: unable to get property " PROPERTY_ESCAPE_PROCESSING); + SAL_WARN("extensions.propctrlr", "getSQLCommand: unable to get property " << PROPERTY_ESCAPE_PROCESSING); return bEscapeProcessing; } void FormSQLCommandUI::setSQLCommand( const OUString& _rCommand ) const { - m_xObject->setPropertyValue( PROPERTY_COMMAND, makeAny( _rCommand ) ); + m_xObject->setPropertyValue( PROPERTY_COMMAND, Any( _rCommand ) ); } void FormSQLCommandUI::setEscapeProcessing( const bool _bEscapeProcessing ) const { - m_xObject->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( _bEscapeProcessing ) ); + m_xObject->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, Any( _bEscapeProcessing ) ); } OUString* FormSQLCommandUI::getPropertiesToDisable() { static OUString s_aCommandProps[] = { - OUString(PROPERTY_DATASOURCE), - OUString(PROPERTY_COMMAND), - OUString(PROPERTY_COMMANDTYPE), - OUString(PROPERTY_ESCAPE_PROCESSING), + PROPERTY_DATASOURCE, + PROPERTY_COMMAND, + PROPERTY_COMMANDTYPE, + PROPERTY_ESCAPE_PROCESSING, OUString() }; return s_aCommandProps; @@ -3107,7 +3100,7 @@ namespace pcr { ListSourceType eType = ListSourceType_SQL; if( ! (m_xObject->getPropertyValue( PROPERTY_LISTSOURCETYPE ) >>= eType) ) - SAL_WARN("extensions.propctrlr", "getEscapeProcessing: unable to get property " PROPERTY_LISTSOURCETYPE); + SAL_WARN("extensions.propctrlr", "getEscapeProcessing: unable to get property " << PROPERTY_LISTSOURCETYPE); OSL_ENSURE( ( eType == ListSourceType_SQL ) || ( eType == ListSourceType_SQLPASSTHROUGH ), "ValueListCommandUI::getEscapeProcessing: unexpected list source type!" ); return ( eType == ListSourceType_SQL ); @@ -3127,7 +3120,7 @@ namespace pcr void ValueListCommandUI::setEscapeProcessing( const bool _bEscapeProcessing ) const { - m_xObject->setPropertyValue( PROPERTY_LISTSOURCETYPE, makeAny( + m_xObject->setPropertyValue( PROPERTY_LISTSOURCETYPE, Any( _bEscapeProcessing ? ListSourceType_SQL : ListSourceType_SQLPASSTHROUGH ) ); } @@ -3135,8 +3128,8 @@ namespace pcr OUString* ValueListCommandUI::getPropertiesToDisable() { static OUString s_aListSourceProps[] = { - OUString(PROPERTY_LISTSOURCETYPE), - OUString(PROPERTY_LISTSOURCE), + PROPERTY_LISTSOURCETYPE, + PROPERTY_LISTSOURCE, OUString() }; return s_aListSourceProps; @@ -3156,7 +3149,7 @@ namespace pcr return true; } m_xCommandDesigner->dispose(); - m_xCommandDesigner.set( nullptr ); + m_xCommandDesigner.clear(); } if ( !impl_ensureRowsetConnection_nothrow() ) |