Kaydet (Commit) 6cc9f910 authored tarafından Miklos Vajna's avatar Miklos Vajna

DomainMapper_Impl::finishParagraph: refactor to avoid manual realloc

Change-Id: Ia52a2e3d6d98cfcc33a307ddcfc218a8426058dd
Reviewed-on: https://gerrit.libreoffice.org/15538Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst d311260c
...@@ -1118,24 +1118,22 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) ...@@ -1118,24 +1118,22 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
lcl_AddRangeAndStyle(pToBeSavedProperties, xTextAppend, pPropertyMap, rAppendContext); lcl_AddRangeAndStyle(pToBeSavedProperties, xTextAppend, pPropertyMap, rAppendContext);
} }
} }
uno::Sequence< beans::PropertyValue > aProperties; std::vector<beans::PropertyValue> aProperties;
if( pPropertyMap.get() ) if (pPropertyMap.get())
{ aProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(pPropertyMap->GetPropertyValues());
aProperties = pPropertyMap->GetPropertyValues();
}
if( !bIsDropCap ) if( !bIsDropCap )
{ {
if( aDrop.Lines > 1 ) if( aDrop.Lines > 1 )
{ {
sal_uInt32 nLength = aProperties.getLength(); beans::PropertyValue aValue;
aProperties.realloc( nLength + 1 ); aValue.Name = rPropNameSupplier.GetName(PROP_DROP_CAP_FORMAT);
aProperties[nLength].Value <<= aDrop; aValue.Value <<= aDrop;
aProperties[nLength].Name = rPropNameSupplier.GetName(PROP_DROP_CAP_FORMAT); aProperties.push_back(aValue);
} }
uno::Reference< text::XTextRange > xTextRange; uno::Reference< text::XTextRange > xTextRange;
if (rAppendContext.xInsertPosition.is()) if (rAppendContext.xInsertPosition.is())
{ {
xTextRange = xTextAppend->finishParagraphInsert( aProperties, rAppendContext.xInsertPosition ); xTextRange = xTextAppend->finishParagraphInsert( comphelper::containerToSequence(aProperties), rAppendContext.xInsertPosition );
rAppendContext.xCursor->gotoNextParagraph(false); rAppendContext.xCursor->gotoNextParagraph(false);
if (rAppendContext.pLastParagraphProperties.get()) if (rAppendContext.pLastParagraphProperties.get())
rAppendContext.pLastParagraphProperties->SetEndingRange(xTextRange->getEnd()); rAppendContext.pLastParagraphProperties->SetEndingRange(xTextRange->getEnd());
...@@ -1154,7 +1152,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) ...@@ -1154,7 +1152,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
appendTextPortion(sMarker, pEmpty); appendTextPortion(sMarker, pEmpty);
} }
xTextRange = xTextAppend->finishParagraph( aProperties ); xTextRange = xTextAppend->finishParagraph( comphelper::containerToSequence(aProperties) );
if (xCursor.is()) if (xCursor.is())
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment