include/sfx2/sidebar/TabBar.hxx | 5 + sc/source/ui/view/gridwin.cxx | 16 ++--- sfx2/source/appl/appserv.cxx | 3 - sfx2/source/sidebar/TabBar.cxx | 2 starmath/source/mathml/export.cxx | 3 - svx/source/svdraw/svdotxdr.cxx | 23 +++---- sw/source/core/doc/docdesc.cxx | 52 +++++++++--------- sw/source/core/unocore/unoobj.cxx | 6 +- toolkit/source/controls/grid/defaultgriddatamodel.cxx | 2 ucb/source/ucp/cmis/cmis_content.cxx | 6 -- vcl/source/gdi/CommonSalLayout.cxx | 18 ++---- 11 files changed, 65 insertions(+), 71 deletions(-)
New commits: commit 5e55d482b19812e2fc3063eb7e718d7013635b33 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Jul 12 08:53:09 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Jul 12 20:04:43 2024 +0200 cid#1555962 Use of auto that causes a copy and cid#1556100 Use of auto that causes a copy cid#1556199 Use of auto that causes a copy cid#1556239 Use of auto that causes a copy cid#1556313 Use of auto that causes a copy cid#1556373 Use of auto that causes a copy cid#1556680 Use of auto that causes a copy cid#1557020 Use of auto that causes a copy cid#1557099 Use of auto that causes a copy cid#1557251 Use of auto that causes a copy cid#1557334 Use of auto that causes a copy cid#1557468 Use of auto that causes a copy Change-Id: Ib5ab5b33eabcac3d18899ceaaa9119e13b0139f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170412 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index c83c320e7f9f..48d9bddbce4e 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -622,12 +622,12 @@ public: rDoc.GetFilterEntries(rPos.Col(), rPos.Row(), rPos.Tab(), aFilterEntries); bool bActive = false; - auto aItem = pEntry->GetQueryItem(); - if (aItem.maColor == m_aColor + ScQueryEntry::Item& rItem = pEntry->GetQueryItem(); + if (rItem.maColor == m_aColor && ((meMode == ScGridWindow::AutoFilterMode::TextColor - && aItem.meType == ScQueryEntry::ByTextColor) + && rItem.meType == ScQueryEntry::ByTextColor) || (meMode == ScGridWindow::AutoFilterMode::BackgroundColor - && aItem.meType == ScQueryEntry::ByBackgroundColor))) + && rItem.meType == ScQueryEntry::ByBackgroundColor))) { bActive = true; } @@ -788,12 +788,12 @@ public: if (pEntry) { - auto aItem = pEntry->GetQueryItem(); - if (aItem.maColor == rColor + ScQueryEntry::Item& rItem = pEntry->GetQueryItem(); + if (rItem.maColor == rColor && ((eMode == ScGridWindow::AutoFilterMode::TextColor - && aItem.meType == ScQueryEntry::ByTextColor) + && rItem.meType == ScQueryEntry::ByTextColor) || (eMode == ScGridWindow::AutoFilterMode::BackgroundColor - && aItem.meType == ScQueryEntry::ByBackgroundColor))) + && rItem.meType == ScQueryEntry::ByBackgroundColor))) { bActive = true; } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index c9c37f554a96..1505e3944d55 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -342,9 +342,8 @@ weld::Window* SfxRequest::GetFrameWeld() const const SfxUnoAnyItem* pItem = nullptr; if (pIntArgs && (pItem = pIntArgs->GetItemIfSet(SID_DIALOG_PARENT, false))) { - auto aAny = pItem->GetValue(); Reference<awt::XWindow> xWindow; - aAny >>= xWindow; + pItem->GetValue() >>= xWindow; return Application::GetFrameWeld(xWindow); } diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index 30926f590831..a1611b3eee8a 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -919,8 +919,7 @@ void SmMLExport::exportMlAttributes(const SmMlElement* pMlElement) case SmMlAttributeValueType::MlRspace: { auto aSizeData = aAttribute.getMlRspace(); - auto aLengthData = aSizeData->m_aLengthValue; - exportMlAttributeLength(XML_RSPACE, aLengthData); + exportMlAttributeLength(XML_RSPACE, aSizeData->m_aLengthValue); break; } case SmMlAttributeValueType::MlSeparator: diff --git a/svx/source/svdraw/svdotxdr.cxx b/svx/source/svdraw/svdotxdr.cxx index b758b75fe59c..b5348094a295 100644 --- a/svx/source/svdraw/svdotxdr.cxx +++ b/svx/source/svdraw/svdotxdr.cxx @@ -44,21 +44,21 @@ void SdrTextObj::AddToHdlList(SdrHdlList& rHdlList) const { Point aPnt; SdrHdlKind eKind = SdrHdlKind::UpperLeft; - auto aRectangle = getRectangle(); + const tools::Rectangle rRectangle = getRectangle(); switch (nHdlNum) { - case 0: aPnt = aRectangle.TopLeft(); eKind=SdrHdlKind::UpperLeft; break; - case 1: aPnt = aRectangle.TopCenter(); eKind=SdrHdlKind::Upper; break; - case 2: aPnt = aRectangle.TopRight(); eKind=SdrHdlKind::UpperRight; break; - case 3: aPnt = aRectangle.LeftCenter(); eKind=SdrHdlKind::Left ; break; - case 4: aPnt = aRectangle.RightCenter(); eKind=SdrHdlKind::Right; break; - case 5: aPnt = aRectangle.BottomLeft(); eKind=SdrHdlKind::LowerLeft; break; - case 6: aPnt = aRectangle.BottomCenter(); eKind=SdrHdlKind::Lower; break; - case 7: aPnt = aRectangle.BottomRight(); eKind=SdrHdlKind::LowerRight; break; + case 0: aPnt = rRectangle.TopLeft(); eKind=SdrHdlKind::UpperLeft; break; + case 1: aPnt = rRectangle.TopCenter(); eKind=SdrHdlKind::Upper; break; + case 2: aPnt = rRectangle.TopRight(); eKind=SdrHdlKind::UpperRight; break; + case 3: aPnt = rRectangle.LeftCenter(); eKind=SdrHdlKind::Left ; break; + case 4: aPnt = rRectangle.RightCenter(); eKind=SdrHdlKind::Right; break; + case 5: aPnt = rRectangle.BottomLeft(); eKind=SdrHdlKind::LowerLeft; break; + case 6: aPnt = rRectangle.BottomCenter(); eKind=SdrHdlKind::Lower; break; + case 7: aPnt = rRectangle.BottomRight(); eKind=SdrHdlKind::LowerRight; break; } if (maGeo.m_nShearAngle) - ShearPoint(aPnt, aRectangle.TopLeft(), maGeo.mfTanShearAngle); + ShearPoint(aPnt, rRectangle.TopLeft(), maGeo.mfTanShearAngle); if (maGeo.m_nRotationAngle) - RotatePoint(aPnt, aRectangle.TopLeft(), maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle); + RotatePoint(aPnt, rRectangle.TopLeft(), maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle); std::unique_ptr<SdrHdl> pH(new SdrHdl(aPnt,eKind)); pH->SetObj(const_cast<SdrTextObj*>(this)); pH->SetRotationAngle(maGeo.m_nRotationAngle); @@ -66,7 +66,6 @@ void SdrTextObj::AddToHdlList(SdrHdlList& rHdlList) const } } - bool SdrTextObj::hasSpecialDrag() const { return true; diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index d497d4632fb4..a2a3cc977f4a 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -437,19 +437,19 @@ void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged ) if (SwUndoId::HEADER_FOOTER == nBeingUndone) { // The last format change is currently being undone. Remove header/footer and corresponding nodes. - auto rDescMasterHeaderFormat = rDesc.GetMaster().GetFormatAttr(RES_HEADER); - auto rDescLeftHeaderFormat = rDesc.GetLeft().GetFormatAttr(RES_HEADER); - auto rDescFirstLeftHeaderFormat = rDesc.GetFirstLeft().GetFormatAttr(RES_HEADER); - auto rDescMasterFooterFormat = rDesc.GetMaster().GetFormatAttr(RES_FOOTER); - auto rDescLeftFooterFormat = rDesc.GetLeft().GetFormatAttr(RES_FOOTER); - auto rDescFirstLeftFooterFormat = rDesc.GetFirstLeft().GetFormatAttr(RES_FOOTER); - - auto rChgedMasterHeaderFormat = rChged.GetMaster().GetFormatAttr(RES_HEADER); - auto rChgedLeftHeaderFormat = rChged.GetLeft().GetFormatAttr(RES_HEADER); - auto rChgedFirstLeftHeaderFormat = rChged.GetFirstLeft().GetFormatAttr(RES_HEADER); - auto rChgedMasterFooterFormat = rChged.GetMaster().GetFormatAttr(RES_FOOTER); - auto rChgedLeftFooterFormat = rChged.GetLeft().GetFormatAttr(RES_FOOTER); - auto rChgedFirstLeftFooterFormat = rChged.GetFirstLeft().GetFormatAttr(RES_FOOTER); + SwFormatHeader aDescMasterHeaderFormat = rDesc.GetMaster().GetFormatAttr(RES_HEADER); + SwFormatHeader aDescLeftHeaderFormat = rDesc.GetLeft().GetFormatAttr(RES_HEADER); + SwFormatHeader aDescFirstLeftHeaderFormat = rDesc.GetFirstLeft().GetFormatAttr(RES_HEADER); + SwFormatFooter aDescMasterFooterFormat = rDesc.GetMaster().GetFormatAttr(RES_FOOTER); + SwFormatFooter aDescLeftFooterFormat = rDesc.GetLeft().GetFormatAttr(RES_FOOTER); + SwFormatFooter aDescFirstLeftFooterFormat = rDesc.GetFirstLeft().GetFormatAttr(RES_FOOTER); + + SwFormatHeader aChgedMasterHeaderFormat = rChged.GetMaster().GetFormatAttr(RES_HEADER); + SwFormatHeader aChgedLeftHeaderFormat = rChged.GetLeft().GetFormatAttr(RES_HEADER); + SwFormatHeader aChgedFirstLeftHeaderFormat = rChged.GetFirstLeft().GetFormatAttr(RES_HEADER); + SwFormatFooter aChgedMasterFooterFormat = rChged.GetMaster().GetFormatAttr(RES_FOOTER); + SwFormatFooter aChgedLeftFooterFormat = rChged.GetLeft().GetFormatAttr(RES_FOOTER); + SwFormatFooter aChgedFirstLeftFooterFormat = rChged.GetFirstLeft().GetFormatAttr(RES_FOOTER); rDesc.GetMaster().ResetFormatAttr(RES_HEADER); rDesc.GetLeft().ResetFormatAttr(RES_HEADER); @@ -496,19 +496,19 @@ void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged ) delete pFormat; }; - if (rDescMasterHeaderFormat.GetHeaderFormat() && rDescMasterHeaderFormat != rChgedMasterHeaderFormat) - lDelHFFormat(&rDescMasterHeaderFormat, rDescMasterHeaderFormat.GetHeaderFormat()); - else if (rDescLeftHeaderFormat.GetHeaderFormat() && rDescLeftHeaderFormat != rChgedLeftHeaderFormat) - lDelHFFormat(&rDescLeftHeaderFormat, rDescLeftHeaderFormat.GetHeaderFormat()); - else if (rDescFirstLeftHeaderFormat.GetHeaderFormat() && rDescFirstLeftHeaderFormat != rChgedFirstLeftHeaderFormat) - lDelHFFormat(&rDescFirstLeftHeaderFormat, rDescFirstLeftHeaderFormat.GetHeaderFormat()); - - else if (rDescMasterFooterFormat.GetFooterFormat() && rDescMasterFooterFormat != rChgedMasterFooterFormat) - lDelHFFormat(&rDescMasterFooterFormat, rDescMasterFooterFormat.GetFooterFormat()); - else if (rDescLeftFooterFormat.GetFooterFormat() && rDescLeftFooterFormat != rChgedLeftFooterFormat) - lDelHFFormat(&rDescLeftFooterFormat, rDescLeftFooterFormat.GetFooterFormat()); - else if (rDescFirstLeftFooterFormat.GetFooterFormat() && rDescFirstLeftFooterFormat != rChgedFirstLeftFooterFormat) - lDelHFFormat(&rDescFirstLeftFooterFormat, rDescFirstLeftFooterFormat.GetFooterFormat()); + if (aDescMasterHeaderFormat.GetHeaderFormat() && aDescMasterHeaderFormat != aChgedMasterHeaderFormat) + lDelHFFormat(&aDescMasterHeaderFormat, aDescMasterHeaderFormat.GetHeaderFormat()); + else if (aDescLeftHeaderFormat.GetHeaderFormat() && aDescLeftHeaderFormat != aChgedLeftHeaderFormat) + lDelHFFormat(&aDescLeftHeaderFormat, aDescLeftHeaderFormat.GetHeaderFormat()); + else if (aDescFirstLeftHeaderFormat.GetHeaderFormat() && aDescFirstLeftHeaderFormat != aChgedFirstLeftHeaderFormat) + lDelHFFormat(&aDescFirstLeftHeaderFormat, aDescFirstLeftHeaderFormat.GetHeaderFormat()); + + else if (aDescMasterFooterFormat.GetFooterFormat() && aDescMasterFooterFormat != aChgedMasterFooterFormat) + lDelHFFormat(&aDescMasterFooterFormat, aDescMasterFooterFormat.GetFooterFormat()); + else if (aDescLeftFooterFormat.GetFooterFormat() && aDescLeftFooterFormat != aChgedLeftFooterFormat) + lDelHFFormat(&aDescLeftFooterFormat, aDescLeftFooterFormat.GetFooterFormat()); + else if (aDescFirstLeftFooterFormat.GetFooterFormat() && aDescFirstLeftFooterFormat != aChgedFirstLeftFooterFormat) + lDelHFFormat(&aDescFirstLeftFooterFormat, aDescFirstLeftFooterFormat.GetFooterFormat()); } } ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 3fe6ef6d096b..ad86db593144 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -886,7 +886,7 @@ bool SwXTextCursor::IsAtEndOfMeta() const { if (CursorType::Meta == m_eType) { - auto pCursor( m_pUnoCursor ); + sw::UnoCursorPointer pCursor( m_pUnoCursor ); SwXMeta const*const pXMeta( dynamic_cast<SwXMeta*>(m_xParentText.get()) ); OSL_ENSURE(pXMeta, "no meta?"); @@ -916,7 +916,7 @@ bool SwXTextCursor::IsAtEndOfContentControl() const { if (CursorType::ContentControl == m_eType) { - auto pCursor( m_pUnoCursor ); + sw::UnoCursorPointer pCursor( m_pUnoCursor ); auto pXContentControl( dynamic_cast<SwXContentControl*>(m_xParentText.get()) ); if (!pXContentControl) @@ -1010,7 +1010,7 @@ sal_Bool SAL_CALL SwXTextCursor::isCollapsed() SolarMutexGuard aGuard; bool bRet = true; - auto pUnoCursor(m_pUnoCursor); + sw::UnoCursorPointer pUnoCursor(m_pUnoCursor); if(pUnoCursor && pUnoCursor->GetMark()) { bRet = (*pUnoCursor->GetPoint() == *pUnoCursor->GetMark()); diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx index 83d15eb6dcec..0eca84e6e5cd 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx @@ -220,7 +220,7 @@ private: RowData& rRowData = impl_getRowDataAccess_throw( aGuard, i_rowIndex, m_nColumnCount ); ::std::transform( rRowData.begin(), rRowData.end(), resultData.getArray(), - [] ( const CellData& rCellData ) + [] ( const CellData& rCellData ) -> const Any& { return rCellData.first; }); return resultData; } diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 2fc413b913bd..7838ba6238d8 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -1189,8 +1189,7 @@ namespace cmis std::vector< std::string > aPaths = pVersion->getPaths( ); if ( !aPaths.empty() ) { - auto sPath = aPaths.front( ); - aCmisUrl.setObjectPath( STD_TO_OUSTR( sPath ) ); + aCmisUrl.setObjectPath(STD_TO_OUSTR(aPaths.front())); } else { @@ -1319,11 +1318,10 @@ namespace cmis getXWeak() ) ), xEnv ); } - auto newName = it->second->getStrings( ).front( ); auto newPath = OUSTR_TO_STDSTR( m_sObjectPath ); if ( !newPath.empty( ) && newPath[ newPath.size( ) - 1 ] != '/' ) newPath += "/"; - newPath += newName; + newPath += it->second->getStrings( ).front( ); try { if ( !m_sObjectId.isEmpty( ) ) diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 37a640645999..e11fcbacd35a 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -240,24 +240,22 @@ void GenericSalLayout::SetNeedFallback(vcl::text::ImplLayoutArgs& rArgs, sal_Int if (nCharPos < 0 || nCharPos == nCharEnd || mbFuzzing) return; - using namespace ::com::sun::star; - if (!mxBreak.is()) mxBreak = vcl::unohelper::CreateBreakIterator(); - lang::Locale aLocale(rArgs.maLanguageTag.getLocale()); + const css::lang::Locale& rLocale(rArgs.maLanguageTag.getLocale()); //if position nCharPos is missing in the font, grab the entire grapheme and //mark all glyphs as missing so the whole thing is rendered with the same //font sal_Int32 nDone; - int nGraphemeEndPos = mxBreak->nextCharacters(rArgs.mrStr, nCharEnd - 1, aLocale, - i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); + int nGraphemeEndPos = mxBreak->nextCharacters(rArgs.mrStr, nCharEnd - 1, rLocale, + css::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); // Safely advance nCharPos in case it is a non-BMP character. rArgs.mrStr.iterateCodePoints(&nCharPos); int nGraphemeStartPos = - mxBreak->previousCharacters(rArgs.mrStr, nCharPos, aLocale, - i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); + mxBreak->previousCharacters(rArgs.mrStr, nCharPos, rLocale, + css::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); // tdf#107612 // If the start of the fallback run is Mongolian character and the previous @@ -764,7 +762,7 @@ void GenericSalLayout::GetCharWidths(std::vector<double>& rCharWidths, const OUS rCharWidths.resize(nCharCount, 0); css::uno::Reference<css::i18n::XBreakIterator> xBreak; - auto aLocale(maLanguageTag.getLocale()); + const css::lang::Locale& rLocale(maLanguageTag.getLocale()); for (auto const& aGlyphItem : m_GlyphItems) { @@ -784,7 +782,7 @@ void GenericSalLayout::GetCharWidths(std::vector<double>& rCharWidths, const OUS sal_Int32 nPos = aGlyphItem.charPos(); while (nPos < aGlyphItem.charPos() + aGlyphItem.charCount()) { - nPos = xBreak->nextCharacters(rStr, nPos, aLocale, + nPos = xBreak->nextCharacters(rStr, nPos, rLocale, css::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); nGraphemeCount++; } @@ -845,7 +843,7 @@ void GenericSalLayout::GetCharWidths(std::vector<double>& rCharWidths, const OUS for (auto nWidth : aWidths) { rCharWidths[nPos - mnMinCharPos] += nWidth; - nPos = xBreak->nextCharacters(rStr, nPos, aLocale, + nPos = xBreak->nextCharacters(rStr, nPos, rLocale, css::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); } } commit 6f0f0bbaebfc0added603a04918324df58b6c27b Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Jul 12 08:51:42 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Jul 12 20:04:35 2024 +0200 cid#1555513 silence Use of auto that causes a copy Change-Id: I9c079460215ca2c62126a04caec2b1246dff0f46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170411 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx index 8778c9bd2e21..7c9b032562ad 100644 --- a/include/sfx2/sidebar/TabBar.hxx +++ b/include/sfx2/sidebar/TabBar.hxx @@ -101,13 +101,14 @@ private: DECL_LINK(HandleClick, const OUString&, void); std::unique_ptr<weld::Toolbar> mxButton; OUString msDeckId; - ::std::function<void (const OUString& rsDeckId)> maDeckActivationFunctor; + typedef ::std::function<void (const OUString& rsDeckId)> DeckActivationFunctor; + DeckActivationFunctor maDeckActivationFunctor; bool mbIsHidden; bool mbIsHiddenByDefault; }; typedef ::std::vector<std::unique_ptr<Item>> ItemContainer; ItemContainer maItems; - const ::std::function<void (const OUString& rsDeckId)> maDeckActivationFunctor; + const Item::DeckActivationFunctor maDeckActivationFunctor; void CreateTabItem(weld::Toolbar& rButton, const DeckDescriptor& rDeckDescriptor); css::uno::Reference<css::graphic::XGraphic> GetItemImage(const DeckDescriptor& rDeskDescriptor) const; diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index 184f42877667..c9a68edcf840 100644 --- a/sfx2/source/sidebar/TabBar.cxx +++ b/sfx2/source/sidebar/TabBar.cxx @@ -265,7 +265,7 @@ IMPL_LINK_NOARG(TabBar::Item, HandleClick, const OUString&, void) { // tdf#143146 copy the functor and arg before calling // GrabFocusToDocument which may destroy this object - auto aDeckActivationFunctor = maDeckActivationFunctor; + DeckActivationFunctor aDeckActivationFunctor = maDeckActivationFunctor; auto sDeckId = msDeckId; mrTabBar.GrabFocusToDocument();