tdf#170595 elide some exception throw overhead
which we are just going to ignore Change-Id: I4921a1871437f3d51733e790e631290aa40d1389 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198600 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -82,7 +82,8 @@ protected:
|
||||
void SetPropertyValue(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&,
|
||||
const css::uno::Any&, SwStyleBase_Impl&);
|
||||
void SetPropertyValues_Impl(const css::uno::Sequence<OUString>& aPropertyNames,
|
||||
const css::uno::Sequence<css::uno::Any>& aValues);
|
||||
const css::uno::Sequence<css::uno::Any>& aValues,
|
||||
bool bIgnoreUnknown);
|
||||
SfxStyleSheetBase* GetStyleSheetBase();
|
||||
void PrepareStyleBase(SwStyleBase_Impl& rBase);
|
||||
template <sal_uInt16>
|
||||
@@ -219,6 +220,10 @@ public:
|
||||
css::awt::FontSlant& reCharStylePosture, css::awt::FontSlant& reCharStylePostureComplex,
|
||||
sal_Int16& rnCharStyleCaseMap, sal_Int16& rnCharStyleRelief, bool& rbCharStyleContoured,
|
||||
bool& rbCharStyleShadowed, sal_Int16& rnCharStyleStrikeThrough, bool& rbCharStyleHidden);
|
||||
// Set without throwing exceptions for unknown props, which is faster than throwing and then
|
||||
// ignoring.
|
||||
SW_DLLPUBLIC void setPropertyValueIgnoreUnknown(const OUString& aPropertyName,
|
||||
const css::uno::Any& aValue);
|
||||
};
|
||||
|
||||
typedef cppu::ImplInheritanceHelper<SwXStyle, css::document::XEventsSupplier> SwXFrameStyle_Base;
|
||||
|
||||
@@ -2046,7 +2046,7 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertyMapEntry& rEntry, const Sfx
|
||||
}
|
||||
}
|
||||
|
||||
void SwXStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNames, const uno::Sequence<uno::Any>& rValues)
|
||||
void SwXStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNames, const uno::Sequence<uno::Any>& rValues, bool bIgnoreUnknown)
|
||||
{
|
||||
if(!m_pDoc)
|
||||
throw uno::RuntimeException();
|
||||
@@ -2074,7 +2074,11 @@ void SwXStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNa
|
||||
{
|
||||
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(pNames[nProp]);
|
||||
if(!pEntry || (!m_bIsConditional && pNames[nProp] == UNO_NAME_PARA_STYLE_CONDITIONS))
|
||||
{
|
||||
if (bIgnoreUnknown)
|
||||
continue;
|
||||
throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], getXWeak());
|
||||
}
|
||||
if(pEntry->nFlags & beans::PropertyAttribute::READONLY)
|
||||
throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], getXWeak());
|
||||
if(aBaseImpl.getNewBase().is())
|
||||
@@ -2093,7 +2097,7 @@ void SwXStyle::setPropertyValues(const uno::Sequence<OUString>& rPropertyNames,
|
||||
// workaround for bad designed API
|
||||
try
|
||||
{
|
||||
SetPropertyValues_Impl( rPropertyNames, rValues );
|
||||
SetPropertyValues_Impl( rPropertyNames, rValues, /*bIgnoreUnknown*/false );
|
||||
}
|
||||
catch (const beans::UnknownPropertyException &rException)
|
||||
{
|
||||
@@ -2565,7 +2569,15 @@ void SwXStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& r
|
||||
SolarMutexGuard aGuard;
|
||||
const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
|
||||
const uno::Sequence<uno::Any> aValues(&rValue, 1);
|
||||
SetPropertyValues_Impl(aProperties, aValues);
|
||||
SetPropertyValues_Impl(aProperties, aValues, /*bIgnoreUnknown*/false);
|
||||
}
|
||||
|
||||
void SwXStyle::setPropertyValueIgnoreUnknown(const OUString& rPropertyName, const uno::Any& rValue)
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
|
||||
const uno::Sequence<uno::Any> aValues(&rValue, 1);
|
||||
SetPropertyValues_Impl(aProperties, aValues, /*bIgnoreUnknown*/true);
|
||||
}
|
||||
|
||||
beans::PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName)
|
||||
|
||||
@@ -2204,7 +2204,7 @@ OUString StyleSheetTable::getOrCreateCharStyle( const PropertyValueVector_t& rCh
|
||||
{
|
||||
try
|
||||
{
|
||||
xStyle->setPropertyValue( rCharProp.Name, rCharProp.Value );
|
||||
xStyle->setPropertyValueIgnoreUnknown( rCharProp.Name, rCharProp.Value );
|
||||
}
|
||||
catch( const uno::Exception& )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user