summaryrefslogtreecommitdiffstats
path: root/extensions/source/propctrlr/formcomponenthandler.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/source/propctrlr/formcomponenthandler.cxx')
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx97
1 files changed, 46 insertions, 51 deletions
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 20a21ad8ae72..1b36dd64e387 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -100,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>
@@ -117,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;
@@ -192,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;
@@ -210,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;
@@ -243,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
@@ -274,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 ) )
@@ -318,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 )
{
@@ -327,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
@@ -440,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 )
@@ -717,7 +721,7 @@ namespace pcr
break;
}
- aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName, makeAny( nNormalized ), _rControlValueType );
+ aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName, Any( nNormalized ), _rControlValueType );
}
break;
@@ -735,8 +739,7 @@ namespace pcr
else
{
// font name
- displayName.append( aFont.Name );
- displayName.append( ", " );
+ displayName.append( aFont.Name + ", " );
// font style
::FontWeight eWeight = vcl::unohelper::ConvertFontWeight( aFont.Weight );
@@ -758,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 ) ) );
}
}
@@ -877,7 +879,6 @@ namespace pcr
Sequence< OUString > SAL_CALL FormComponentPropertyHandler::getActuatingProperties( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
return
{
PROPERTY_DATASOURCE,
@@ -999,8 +1000,8 @@ namespace pcr
aDescriptor.Control = pControl;
aDescriptor.PrimaryButtonId = PROPERTY_ID_TARGET_URL == nPropId
- ? OUString(UID_PROP_DLG_ATTR_TARGET_URL)
- : OUString(UID_PROP_DLG_IMAGE_URL);
+ ? UID_PROP_DLG_ATTR_TARGET_URL
+ : UID_PROP_DLG_IMAGE_URL;
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)
{
@@ -2269,7 +2270,7 @@ namespace pcr
break;
case PROPERTY_ID_WRITING_MODE:
- if ( !SvtCTLOptions().IsCTLFontEnabled() )
+ if ( !SvtCTLOptions::IsCTLFontEnabled() )
return true;
break;
}
@@ -2421,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 );
}
@@ -2523,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() );
}
@@ -2629,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 );
@@ -2715,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;
}
}
@@ -2839,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
@@ -2860,7 +2855,7 @@ namespace pcr
}
}
- ControlCharacterDialog::destroyItemSet(pSet, pPool, pDefaults);
+ ControlCharacterDialog::destroyItemSet(pSet, pPool);
return bSuccess;
}
@@ -3025,23 +3020,23 @@ namespace pcr
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;
@@ -3125,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 ) );
}
@@ -3133,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;
@@ -3154,7 +3149,7 @@ namespace pcr
return true;
}
m_xCommandDesigner->dispose();
- m_xCommandDesigner.set( nullptr );
+ m_xCommandDesigner.clear();
}
if ( !impl_ensureRowsetConnection_nothrow() )