avoid double map lookup
Change-Id: I02018eaaf220c7835756eba6215425bac9cbc6f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159432 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
def8f76996
commit
d0e848dab0
10 changed files with 37 additions and 25 deletions
|
@ -4320,8 +4320,9 @@ void DrawingML::WritePresetShape( const OString& pShape, MSO_SPT eShapeType, boo
|
|||
static std::map< OString, std::vector<OString> > aAdjMap = lcl_getAdjNames();
|
||||
// If there are predefined adj names for this shape type, look them up now.
|
||||
std::vector<OString> aAdjustments;
|
||||
if (aAdjMap.find(pShape) != aAdjMap.end())
|
||||
aAdjustments = aAdjMap[pShape];
|
||||
auto it = aAdjMap.find(pShape);
|
||||
if (it != aAdjMap.end())
|
||||
aAdjustments = it->second;
|
||||
|
||||
mpFS->startElementNS(XML_a, XML_prstGeom, XML_prst, pShape);
|
||||
mpFS->startElementNS(XML_a, XML_avLst);
|
||||
|
|
|
@ -1236,8 +1236,9 @@ static OUString lcl_getAnchorIdFromGrabBag(const SdrObject* pSdrObject)
|
|||
if (xShape->getPropertySetInfo()->hasPropertyByName("InteropGrabBag"))
|
||||
{
|
||||
comphelper::SequenceAsHashMap aInteropGrabBag(xShape->getPropertyValue("InteropGrabBag"));
|
||||
if (aInteropGrabBag.find("AnchorId") != aInteropGrabBag.end())
|
||||
aInteropGrabBag["AnchorId"] >>= aResult;
|
||||
auto it = aInteropGrabBag.find("AnchorId");
|
||||
if (it != aInteropGrabBag.end())
|
||||
it->second >>= aResult;
|
||||
}
|
||||
|
||||
return aResult;
|
||||
|
|
|
@ -100,8 +100,9 @@ void SaveInteropProperties(uno::Reference<frame::XModel> const& xModel,
|
|||
|
||||
// get EmbeddedObjects property inside grab bag
|
||||
comphelper::SequenceAsHashMap objectsList;
|
||||
if (aGrabBag.find(sEmbeddingsPropName) != aGrabBag.end())
|
||||
objectsList << aGrabBag[sEmbeddingsPropName];
|
||||
auto grabIt = aGrabBag.find(sEmbeddingsPropName);
|
||||
if (grabIt != aGrabBag.end())
|
||||
objectsList << grabIt->second;
|
||||
|
||||
uno::Sequence< beans::PropertyValue > aGrabBagAttribute{ comphelper::makePropertyValue("ProgID",
|
||||
rProgId) };
|
||||
|
|
|
@ -1170,8 +1170,9 @@ uno::Reference<XAccessible > SAL_CALL
|
|||
throw lang::IndexOutOfBoundsException();
|
||||
}
|
||||
ScMyAddress addr = CalcScAddressFromRangeList(mpMarkedRanges.get(),nSelectedChildIndex);
|
||||
if( m_mapSelectionSend.find(addr) != m_mapSelectionSend.end() )
|
||||
xAccessible = m_mapSelectionSend[addr];
|
||||
auto it = m_mapSelectionSend.find(addr);
|
||||
if( it != m_mapSelectionSend.end() )
|
||||
xAccessible = it->second;
|
||||
else
|
||||
xAccessible = getAccessibleCellAt(addr.Row(), addr.Col());
|
||||
}
|
||||
|
|
|
@ -48,10 +48,11 @@ std::wstring CSimpleTag::getTagContent( )
|
|||
|
||||
::std::wstring CSimpleTag::getTagAttribute( ::std::wstring const & attrname )
|
||||
{
|
||||
if ( m_SimpleAttributes.find(attrname) != m_SimpleAttributes.end())
|
||||
return m_SimpleAttributes[attrname];
|
||||
auto it = m_SimpleAttributes.find(attrname);
|
||||
if ( it != m_SimpleAttributes.end())
|
||||
return it->second;
|
||||
else
|
||||
return ( ::std::wstring( EMPTY_STRING ) );
|
||||
return ::std::wstring( EMPTY_STRING );
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -224,8 +224,10 @@ static OUString lcl_dbg_out(const SfxPoolItem & rItem)
|
|||
{
|
||||
OUString aStr("[ ");
|
||||
|
||||
if (GetItemWhichMap().find(rItem.Which()) != GetItemWhichMap().end())
|
||||
aStr += GetItemWhichMap()[rItem.Which()];
|
||||
auto & rWhichMap = GetItemWhichMap();
|
||||
auto it = rWhichMap.find(rItem.Which());
|
||||
if ( it != rWhichMap.end())
|
||||
aStr += it->second;
|
||||
else
|
||||
aStr += OUString::number(rItem.Which());
|
||||
|
||||
|
|
|
@ -4413,8 +4413,9 @@ static void impl_borders( FSHelperPtr const & pSerializer,
|
|||
{
|
||||
const SvxBorderLine* pLn = rBox.GetLine( *pBrd );
|
||||
const table::BorderLine2 *aStyleProps = nullptr;
|
||||
if( rTableStyleConf.find( *pBrd ) != rTableStyleConf.end() )
|
||||
aStyleProps = &rTableStyleConf[ *pBrd ];
|
||||
auto it = rTableStyleConf.find( *pBrd );
|
||||
if( it != rTableStyleConf.end() )
|
||||
aStyleProps = &(it->second);
|
||||
|
||||
if (!tagWritten && rOptions.bWriteTag)
|
||||
{
|
||||
|
|
|
@ -251,8 +251,8 @@ void SwLabelConfig::FillLabels(const OUString& rManufacturer, SwLabRecs& rLab
|
|||
|
||||
bool SwLabelConfig::HasLabel(const OUString& rManufacturer, const OUString& rType)
|
||||
{
|
||||
return ( ( m_aLabels.find(rManufacturer) != m_aLabels.end() ) &&
|
||||
( m_aLabels[rManufacturer].find(rType) != m_aLabels[rManufacturer].end() ) );
|
||||
auto it = m_aLabels.find(rManufacturer);
|
||||
return ( it != m_aLabels.end() ) && ( it->second.find(rType) != it->second.end() );
|
||||
}
|
||||
|
||||
// label is always saved as a custom label
|
||||
|
|
|
@ -1135,8 +1135,9 @@ SwContentTree::SwContentTree(std::unique_ptr<weld::TreeView> xTreeView, SwNaviga
|
|||
if (SwView* pView = GetActiveView(); pView && pView->GetDocShell())
|
||||
{
|
||||
OUString sDocTitle = pView->GetDocShell()->GetTitle();
|
||||
if (lcl_DocOutLineExpandStateMap.find(sDocTitle) != lcl_DocOutLineExpandStateMap.end())
|
||||
mOutLineNodeMap = lcl_DocOutLineExpandStateMap[sDocTitle];
|
||||
auto it = lcl_DocOutLineExpandStateMap.find(sDocTitle);
|
||||
if (it != lcl_DocOutLineExpandStateMap.end())
|
||||
mOutLineNodeMap = it->second;
|
||||
if (comphelper::LibreOfficeKit::isActive()) {
|
||||
if (pView->m_nNaviExpandedStatus < 0)
|
||||
m_nActiveBlock = 1;
|
||||
|
|
|
@ -900,8 +900,9 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre
|
|||
if ( !pFD )
|
||||
{
|
||||
pFD.reset(new css::awt::FontDescriptor);
|
||||
if ( maData.find( BASEPROPERTY_FONTDESCRIPTOR ) != maData.end() ) // due to defaults...
|
||||
maData[ BASEPROPERTY_FONTDESCRIPTOR ] >>= *pFD;
|
||||
auto it = maData.find( BASEPROPERTY_FONTDESCRIPTOR );
|
||||
if ( it != maData.end() ) // due to defaults...
|
||||
it->second >>= *pFD;
|
||||
}
|
||||
pFD->Name = InStream->readUTF();
|
||||
pFD->StyleName = InStream->readUTF();
|
||||
|
@ -917,8 +918,9 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre
|
|||
if ( !pFD )
|
||||
{
|
||||
pFD.reset(new css::awt::FontDescriptor);
|
||||
if ( maData.find(BASEPROPERTY_FONTDESCRIPTOR) != maData.end() ) // due to defaults...
|
||||
maData[BASEPROPERTY_FONTDESCRIPTOR] >>= *pFD;
|
||||
auto it = maData.find(BASEPROPERTY_FONTDESCRIPTOR);
|
||||
if ( it != maData.end() ) // due to defaults...
|
||||
it->second >>= *pFD;
|
||||
}
|
||||
pFD->Width = static_cast<sal_Int16>(InStream->readLong());
|
||||
pFD->Height = static_cast<sal_Int16>(InStream->readLong());
|
||||
|
@ -934,8 +936,9 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre
|
|||
if ( !pFD )
|
||||
{
|
||||
pFD.reset(new css::awt::FontDescriptor);
|
||||
if ( maData.find(BASEPROPERTY_FONTDESCRIPTOR) != maData.end() ) // due to defaults...
|
||||
maData[BASEPROPERTY_FONTDESCRIPTOR] >>= *pFD;
|
||||
auto it = maData.find(BASEPROPERTY_FONTDESCRIPTOR);
|
||||
if ( it != maData.end() ) // due to defaults...
|
||||
it->second >>= *pFD;
|
||||
}
|
||||
pFD->Weight = vcl::unohelper::ConvertFontWeight(static_cast<FontWeight>(InStream->readShort()));
|
||||
pFD->Slant = static_cast<css::awt::FontSlant>(InStream->readShort());
|
||||
|
|
Loading…
Reference in a new issue