SSL customshapeitem.cxx
Interaktion und PortierbarkeitC
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
void SdrCustomShapeGeometryItem::SetPropertyValue( const css::beans::PropertyValue& rPropVal )
{
ASSERT_CHANGE_REFCOUNTED_ITEM;
css::uno::Any* pAny = GetPropertyValueByName( rPropVal.Name ); if ( pAny )
{ // property is already available if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pAny) )
{ // old property is a sequence->each entry has to be removed from the HashPairMap for ( autoconst & i : *rSecSequence )
{
PropertyPairHashMap::iterator aHashIter( m_aPropPairHashMap.find( PropertyPair( rPropVal.Name, i.Name ) ) ); if ( aHashIter != m_aPropPairHashMap.end() )
m_aPropPairHashMap.erase( aHashIter );
}
}
*pAny = rPropVal.Value; if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pAny) )
{ // the new property is a sequence->each entry has to be inserted into the HashPairMap for ( sal_Int32 i = 0; i < rSecSequence->getLength(); i++ )
{
beans::PropertyValue const & rPropVal2 = (*rSecSequence)[ i ];
m_aPropPairHashMap[ PropertyPair( rPropVal.Name, rPropVal2.Name ) ] = i;
}
}
} else
{ // it's a new property
assert(std::none_of(std::cbegin(m_aPropSeq), std::cend(m_aPropSeq),
[&rPropVal](beans::PropertyValue const& rVal)
{ return rVal.Name == rPropVal.Name; } ));
sal_uInt32 nIndex = m_aPropSeq.getLength();
m_aPropSeq.realloc( nIndex + 1 );
m_aPropSeq.getArray()[ nIndex ] = rPropVal ;
bool SdrCustomShapeGeometryItem::operator==( const SfxPoolItem& rCmp ) const
{ if( !SfxPoolItem::operator==( rCmp )) returnfalse; const SdrCustomShapeGeometryItem& other = static_cast<const SdrCustomShapeGeometryItem&>(rCmp); // This is called often by SfxItemPool, and comparing uno sequences is relatively slow. // So keep a hash of the sequence and if either of the sequences has a usable hash, // compare using that.
UpdateHash();
other.UpdateHash(); if( m_aHashState != other.m_aHashState ) returnfalse; if( m_aHashState == HashState::Valid && m_aHash != other.m_aHash ) returnfalse;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.