diff options
author | Matthew Pottage <matthewpottage@invincitech.com> | 2015-07-01 16:51:45 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-07-16 09:11:55 +0000 |
commit | 091f6c382394390206f784a5ec79842709e0f3bc (patch) | |
tree | 9e43414643259d2eacfdd7d75125770b83bc3f8e /writerfilter/source/dmapper/DomainMapper.cxx | |
parent | 4439e5f689c8564a092cf40337ead04e1d024f03 (diff) |
Removed singleton PropertyNameSupplier and replaced it with single function.
Measurements showed that the "optimisation" of caching PropertyIds and their
string equivalent leads to an increase of approx. 6 times in the total overall
time spent in PropertyNameSupplier::getName(eId), when running the unit tests.
PropertyNameSupplier was the only PropertyNameSupplier (no derived classes).
This means that getPropertyName can easily provide the same functionality.
Change-Id: I933b67c11d4cc35395a0c70e15f1c24ac9842ab0
Reviewed-on: https://gerrit.libreoffice.org/16665
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper.cxx')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index becde28daa91..8a875ae982d8 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -104,13 +104,13 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon { // #i24363# tab stops relative to indent m_pImpl->SetDocumentSettingsProperty( - PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_TABS_RELATIVE_TO_INDENT ), + getPropertyName( PROP_TABS_RELATIVE_TO_INDENT ), uno::makeAny( false ) ); m_pImpl->SetDocumentSettingsProperty( - PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_SURROUND_TEXT_WRAP_SMALL ), + getPropertyName( PROP_SURROUND_TEXT_WRAP_SMALL ), uno::makeAny( true ) ); m_pImpl->SetDocumentSettingsProperty( - PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING ), + getPropertyName( PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING ), uno::makeAny( true ) ); // Don't load the default style definitions to avoid weird mix @@ -271,7 +271,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) { uno::Reference< beans::XPropertySet > xAnchorProps( m_pImpl->GetTopContext()->GetFootnote()->getAnchor(), uno::UNO_QUERY ); xAnchorProps->setPropertyValue( - PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_CHAR_FONT_NAME), + getPropertyName( PROP_CHAR_FONT_NAME), uno::makeAny( sStringValue )); } else //a real symbol @@ -1166,7 +1166,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) Value::Pointer_t pValue = rSprm.getValue(); sal_Int32 nIntValue = pValue->getInt(); const OUString sStringValue = pValue->getString(); - PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); switch(nSprmId) { @@ -1525,7 +1524,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle()); if (xCharStyle.is()) - xCharStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_WEIGHT), aBold); + xCharStyle->setPropertyValue(getPropertyName(PROP_CHAR_WEIGHT), aBold); if (nSprmId == NS_ooxml::LN_EG_RPrBase_b) m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "b", OUString::number(nIntValue)); else if (nSprmId == NS_ooxml::LN_EG_RPrBase_bCs) @@ -1605,7 +1604,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle()); if (xCharStyle.is()) - xCharStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_HEIGHT), aVal); + xCharStyle->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT), aVal); } } // Make sure char sizes defined in the stylesheets don't affect char props from direct formatting. @@ -1865,13 +1864,12 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) { uno::Reference< text::XLineNumberingProperties > xLineNumberingProperties( m_pImpl->GetTextDocument(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xLineNumberingPropSet = xLineNumberingProperties->getLineNumberingProperties(); - PropertyNameSupplier& rNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); - xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_IS_ON ), uno::makeAny(true) ); + xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_IS_ON ), uno::makeAny(true) ); if( aSettings.nInterval ) - xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_INTERVAL ), uno::makeAny((sal_Int16)aSettings.nInterval) ); + xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_INTERVAL ), uno::makeAny((sal_Int16)aSettings.nInterval) ); if( aSettings.nDistance ) - xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_DISTANCE ), uno::makeAny(aSettings.nDistance) ); - xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_RESTART_AT_EACH_PAGE ), uno::makeAny(aSettings.bRestartAtEachPage) ); + xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_DISTANCE ), uno::makeAny(aSettings.nDistance) ); + xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_RESTART_AT_EACH_PAGE ), uno::makeAny(aSettings.bRestartAtEachPage) ); } catch( const uno::Exception& ) { @@ -1978,13 +1976,13 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) if( xTOC.is() ) { uno::Reference<text::XTextColumns> xTextColumns; - xTOC->getPropertyValue(rPropNameSupplier.GetName( PROP_TEXT_COLUMNS )) >>= xTextColumns; + xTOC->getPropertyValue(getPropertyName( PROP_TEXT_COLUMNS )) >>= xTextColumns; if (xTextColumns.is()) { uno::Reference< beans::XPropertySet > xColumnPropSet( xTextColumns, uno::UNO_QUERY_THROW ); if ( xColumnPropSet.is() ) - xColumnPropSet->setPropertyValue( rPropNameSupplier.GetName( PROP_AUTOMATIC_DISTANCE ), uno::makeAny( pSectHdl->GetSpace() )); - xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xTextColumns ) ); + xColumnPropSet->setPropertyValue( getPropertyName( PROP_AUTOMATIC_DISTANCE ), uno::makeAny( pSectHdl->GetSpace() )); + xTOC->setPropertyValue( getPropertyName( PROP_TEXT_COLUMNS ), uno::makeAny( xTextColumns ) ); } } } @@ -2194,7 +2192,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) if( NS_ooxml::LN_EG_FtnEdnNumProps_numStart == nSprmId && xFtnEdnSettings.is()) { xFtnEdnSettings->setPropertyValue( - PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_START_AT), + getPropertyName( PROP_START_AT), uno::makeAny( sal_Int16( nIntValue - 1 ))); } else if( NS_ooxml::LN_EG_FtnEdnNumProps_numRestart == nSprmId && xFtnEdnSettings.is()) @@ -2208,14 +2206,14 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) default: break; } xFtnEdnSettings->setPropertyValue( - PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_FOOTNOTE_COUNTING ), + getPropertyName( PROP_FOOTNOTE_COUNTING ), uno::makeAny( nFootnoteCounting )); } else if (xFtnEdnSettings.is()) { sal_Int16 nNumType = ConversionHelper::ConvertNumberingType( nIntValue ); xFtnEdnSettings->setPropertyValue( - PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_NUMBERING_TYPE), + getPropertyName( PROP_NUMBERING_TYPE), uno::makeAny( nNumType )); } } |