[Libreoffice-commits] core.git: 2 commits - sax/source svx/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sun Apr 18 18:13:00 UTC 2021
sax/source/fastparser/fastparser.cxx | 3 ++-
svx/source/unodraw/unoshape.cxx | 28 ++++++++++++++--------------
2 files changed, 16 insertions(+), 15 deletions(-)
New commits:
commit ceef618f77e3d7d2f1b904aa66ed503da0059010
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Apr 18 16:17:27 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Apr 18 20:12:29 2021 +0200
reduce log noise
Change-Id: I1172470ededff6cacc0d35f069e7afb9c97a425e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114245
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index f35e56e8ab7f..aa3bb66c18f8 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -1319,7 +1319,8 @@ void FastSaxParserImpl::addUnknownElementWithPrefix(const xmlChar **attributes,
OString aQualifiedName = (rPrefix.isEmpty())? rLocalName : rPrefix + ":" + rLocalName;
xAttributes->addUnknown( aNamespaceURI, aQualifiedName,
OString( XML_CAST( attributes[ i + 3 ] ), attributes[ i + 4 ] - attributes[ i + 3 ] ));
- SAL_WARN("xmloff", "unknown element " << aQualifiedName << " " << aNamespaceURI);
+ // ignore an element that otherwise generates a lot of noise in the logs
+ SAL_WARN_IF(aQualifiedName != "x14ac:dyDescent", "xmloff", "unknown element " << aQualifiedName << " " << aNamespaceURI);
}
void FastSaxParserImpl::callbackEndElement()
commit 9cff36d37df95bb9d2b552259c718459b2f81682
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Apr 18 18:43:44 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Apr 18 20:12:18 2021 +0200
reduce allocation cost in SvxShape::SetProperty
use std::optional so we don't need to heap allocate all the time.
note that I couldn't use the normal SfxItemSet constructor,
std::optional::emplace on macOS doesn't seem to play nice with
the template magic there
Change-Id: Ic5de23e9a20dceae56f894cf0706b89ced77ff58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114246
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index a111ea46be04..33549e3c7978 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -88,6 +88,7 @@
#include <svx/svdopath.hxx>
#include <memory>
+#include <optional>
#include <vector>
#include <iostream>
@@ -106,7 +107,7 @@ class GDIMetaFile;
struct SvxShapeImpl
{
SvxShape& mrAntiImpl;
- std::unique_ptr<SfxItemSet> mpItemSet;
+ std::optional<SfxItemSet> mxItemSet;
sal_uInt32 mnObjId;
SvxShapeMaster* mpMaster;
bool mbHasSdrObjectOwnership;
@@ -1653,22 +1654,26 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
throw IllegalArgumentException();
}
+ std::optional<SfxItemSet> xLocalSet;
SfxItemSet* pSet;
if( mbIsMultiPropertyCall && !bIsNotPersist )
{
- if( mpImpl->mpItemSet == nullptr )
+ if( !mpImpl->mxItemSet )
{
- mpImpl->mpItemSet.reset(new SfxItemSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), {{pMap->nWID, pMap->nWID}}));
+ sal_uInt16 aWhichPairTable[] = { pMap->nWID, pMap->nWID, 0, 0 };
+ mpImpl->mxItemSet.emplace( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), aWhichPairTable);
}
else
{
- mpImpl->mpItemSet->MergeRange(pMap->nWID, pMap->nWID);
+ mpImpl->mxItemSet->MergeRange(pMap->nWID, pMap->nWID);
}
- pSet = mpImpl->mpItemSet.get();
+ pSet = &*mpImpl->mxItemSet;
}
else
{
- pSet = new SfxItemSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), {{pMap->nWID, pMap->nWID}});
+ sal_uInt16 aWhichPairTable[] = { pMap->nWID, pMap->nWID, 0, 0 };
+ xLocalSet.emplace( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), aWhichPairTable);
+ pSet = &*xLocalSet;
}
if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
@@ -1702,18 +1707,13 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
{
// set not-persistent attribute extra
GetSdrObject()->ApplyNotPersistAttr( *pSet );
- delete pSet;
}
else
{
// if we have a XMultiProperty call then the item set
// will be set in setPropertyValues later
if( !mbIsMultiPropertyCall )
- {
GetSdrObject()->SetMergedItemSetAndBroadcast( *pSet );
-
- delete pSet;
- }
}
}
@@ -1828,15 +1828,15 @@ void SAL_CALL SvxShape::setPropertyValues( const css::uno::Sequence< OUString >&
}
}
- if( mpImpl->mpItemSet && HasSdrObject() )
- GetSdrObject()->SetMergedItemSetAndBroadcast( *mpImpl->mpItemSet );
+ if( mpImpl->mxItemSet && HasSdrObject() )
+ GetSdrObject()->SetMergedItemSetAndBroadcast( *mpImpl->mxItemSet );
}
void SvxShape::endSetPropertyValues()
{
mbIsMultiPropertyCall = false;
- mpImpl->mpItemSet.reset();
+ mpImpl->mxItemSet.reset();
}
More information about the Libreoffice-commits
mailing list