basctl/source/basicide/unomodel.cxx | 2 +- basic/source/runtime/methods.cxx | 2 +- desktop/source/lib/init.cxx | 8 ++++---- editeng/source/editeng/impedit.hxx | 6 +++--- editeng/source/editeng/impedit2.cxx | 2 +- editeng/source/editeng/impedit4.cxx | 4 ++-- i18npool/source/search/textsearch.cxx | 20 ++++++++++---------- include/test/a11y/accessibletestbase.hxx | 2 +- sd/inc/drawdoc.hxx | 2 +- sd/source/core/drawdoc3.cxx | 2 +- sdext/source/pdfimport/inc/genericelements.hxx | 2 +- sdext/source/pdfimport/tree/genericelements.cxx | 2 +- slideshow/source/engine/shapes/gdimtftools.cxx | 4 ++-- slideshow/source/engine/shapes/gdimtftools.hxx | 4 ++-- slideshow/source/engine/slideshowimpl.cxx | 2 +- test/source/a11y/accessibletestbase.cxx | 3 ++- toolkit/source/controls/animatedimages.cxx | 2 +- 17 files changed, 35 insertions(+), 34 deletions(-)
New commits: commit 6845b8a9262089f673ee7cc147db5e0192b4b4bd Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Mar 31 10:53:30 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Mar 31 13:18:12 2025 +0200 loplugin:constparam in various Change-Id: I874a95777aed3471675bf03acfcf05ecfcb4f830 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183531 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/basctl/source/basicide/unomodel.cxx b/basctl/source/basicide/unomodel.cxx index 9f6ca6c98deb..b6bc89fa5a2b 100644 --- a/basctl/source/basicide/unomodel.cxx +++ b/basctl/source/basicide/unomodel.cxx @@ -42,7 +42,7 @@ private: bool m_bHasElements; public: - explicit SelectionEnumeration(OUString& sSelectedText) + explicit SelectionEnumeration(const OUString& sSelectedText) : m_sText(sSelectedText) , m_bHasElements(true) {} diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 688dbf64fe56..77f79291f035 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -3910,7 +3910,7 @@ static std::vector<sal_uInt8> byteArray2Vec(SbxArray* pArr) // Makes sure to get the byte array if passed, or the string converted to the bytes using // StringToByteArray in basic/source/sbx/sbxstr.cxx -static std::vector<sal_uInt8> getByteArray(SbxValue& val) +static std::vector<sal_uInt8> getByteArray(const SbxValue& val) { if (val.GetFullType() == SbxOBJECT) if (auto pObj = val.GetObject()) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7258f56393ef..f381deef94a1 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -4343,7 +4343,7 @@ inline static void enableViewCallbacks(LibLODocument_Impl* pDocument, const int handlerIt->second->enableCallbacks(); } -inline static int getAlternativeViewForPaint(LibreOfficeKitDocument* pThis, ITiledRenderable* pDoc, SfxViewShell* pCurrentViewShell, +inline static int getAlternativeViewForPaint(LibreOfficeKitDocument* pThis, ITiledRenderable* pDoc, const SfxViewShell* pCurrentViewShell, const std::string_view &sCurrentViewRenderState, const int nPart, const int nMode) { SfxViewShell* pViewShell = SfxViewShell::GetFirst(); @@ -5291,7 +5291,7 @@ void LibLibreOffice_Impl::dumpState(rtl::OStringBuffer &rState) } // We have special handling for some uno commands and it seems we need to check for readonly state. -static bool isCommandAllowed(OUString& command) { +static bool isCommandAllowed(std::u16string_view command) { static constexpr OUString nonAllowedList[] = { u".uno:Save"_ustr, u".uno:TransformDialog"_ustr, u".uno:SidebarShow"_ustr, u".uno:SidebarHide"_ustr }; if (!SfxViewShell::IsCurrentLokViewReadOnly()) @@ -5299,7 +5299,7 @@ static bool isCommandAllowed(OUString& command) { else { SfxViewShell* pViewShell = SfxViewShell::Current(); - if (command == u".uno:Save"_ustr && pViewShell && pViewShell->IsAllowChangeComments()) + if (command == u".uno:Save" && pViewShell && pViewShell->IsAllowChangeComments()) return true; for (size_t i = 0; i < std::size(nonAllowedList); i++) @@ -5307,7 +5307,7 @@ static bool isCommandAllowed(OUString& command) { if (nonAllowedList[i] == command) { bool bRet = false; - if (pViewShell && command == u".uno:TransformDialog"_ustr) + if (pViewShell && command == u".uno:TransformDialog") { // If the just added signature line shape is selected, allow moving it. bRet = pViewShell->GetSignPDFCertificate().Is(); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index d105afc6e269..76dea3933b68 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -652,7 +652,7 @@ private: void ParaAttribsChanged( ContentNode const * pNode, bool bIgnoreUndoCheck = false ); void TextModified(); void CalcHeight(ParaPortion& rParaPortion, bool bIsScaling = false); - bool isInEmptyClusterAtTheEnd(ParaPortion& rParaPortion, bool bIsScaling); + bool isInEmptyClusterAtTheEnd(const ParaPortion& rParaPortion, bool bIsScaling); void InsertUndo( std::unique_ptr<EditUndo> pUndo, bool bTryMerge = false ); void ResetUndoManager(); @@ -769,9 +769,9 @@ private: void WriteXML(SvStream& rOutput, const EditSelection& rSel); void WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_Int32 nPara, sal_Int32 nPos, - std::vector<std::unique_ptr<SvxFontItem>>& rFontTable, SvxColorList& rColorList ); + const std::vector<std::unique_ptr<SvxFontItem>>& rFontTable, SvxColorList& rColorList ); bool WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, sal_Int32 nPara, sal_Int32 nPos, - std::vector<std::unique_ptr<SvxFontItem>>& rFontTable, SvxColorList& rColorList ); + const std::vector<std::unique_ptr<SvxFontItem>>& rFontTable, SvxColorList& rColorList ); sal_Int32 LogicToTwips( sal_Int32 n ); double scaleXSpacingValue(tools::Long nXValue) const diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 5a232360e2be..2e61efacd028 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -4407,7 +4407,7 @@ tools::Long ImpEditEngine::GetXPos(ParaPortion const& rParaPortion, EditLine con } /** Is true if paragraph is in the empty cluster of paragraphs at the end */ -bool ImpEditEngine::isInEmptyClusterAtTheEnd(ParaPortion& rPortion, bool bIsScaling) +bool ImpEditEngine::isInEmptyClusterAtTheEnd(const ParaPortion& rPortion, bool bIsScaling) { sal_Int32 nPortion = GetParaPortions().GetPos(&rPortion); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index de167e657690..3b7520a39658 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -258,7 +258,7 @@ ErrCode ImpEditEngine::WriteText( SvStream& rOutput, EditSelection aSel ) } bool ImpEditEngine::WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, sal_Int32 nPara, sal_Int32 nPos, - std::vector<std::unique_ptr<SvxFontItem>>& rFontTable, SvxColorList& rColorList ) + const std::vector<std::unique_ptr<SvxFontItem>>& rFontTable, SvxColorList& rColorList ) { const SfxPoolItem* pAttrItem = rLst.First(); while ( pAttrItem ) @@ -761,7 +761,7 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel, bool bCl void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_Int32 nPara, sal_Int32 nPos, - std::vector<std::unique_ptr<SvxFontItem>>& rFontTable, SvxColorList& rColorList ) + const std::vector<std::unique_ptr<SvxFontItem>>& rFontTable, SvxColorList& rColorList ) { sal_uInt16 nWhich = rItem.Which(); switch ( nWhich ) diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 5475ef5b7dde..ae0d1fab4f0d 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -94,19 +94,19 @@ bool isSimpleRegexTrans( TransliterationFlags n ) return bool(maskSimpleRegexTrans(n)); } -bool isReplacePunctuation( OUString &rStr ) +bool isReplacePunctuation( std::u16string_view rStr ) { - return rStr.indexOf(u'\u2018') > -1 || - rStr.indexOf(u'\u2019') > -1 || - rStr.indexOf(u'\u201A') > -1 || - rStr.indexOf(u'\u201B') > -1 || - rStr.indexOf(u'\u201C') > -1 || - rStr.indexOf(u'\u201D') > -1 || - rStr.indexOf(u'\u201E') > -1 || - rStr.indexOf(u'\u201F') > -1; + return rStr.find(u'\u2018') != std::u16string_view::npos || + rStr.find(u'\u2019') != std::u16string_view::npos || + rStr.find(u'\u201A') != std::u16string_view::npos || + rStr.find(u'\u201B') != std::u16string_view::npos || + rStr.find(u'\u201C') != std::u16string_view::npos || + rStr.find(u'\u201D') != std::u16string_view::npos || + rStr.find(u'\u201E') != std::u16string_view::npos || + rStr.find(u'\u201F') != std::u16string_view::npos; } -OUString replacePunctuation( OUString &rStr ) +OUString replacePunctuation( const OUString &rStr ) { return rStr.replace(u'\u2018', '\'') .replace(u'\u2019', '\'') diff --git a/include/test/a11y/accessibletestbase.hxx b/include/test/a11y/accessibletestbase.hxx index 3c87005c12fb..6bd574f25941 100644 --- a/include/test/a11y/accessibletestbase.hxx +++ b/include/test/a11y/accessibletestbase.hxx @@ -207,7 +207,7 @@ protected: css::uno::Reference<css::accessibility::XAccessible> mxAccessible; public: - Dialog(css::uno::Reference<css::awt::XDialog2>& xDialog2, bool bAutoClose = true); + Dialog(const css::uno::Reference<css::awt::XDialog2>& xDialog2, bool bAutoClose = true); virtual ~Dialog(); void setAutoClose(bool bAutoClose) { mbAutoClose = bAutoClose; } diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index 393729f70c97..fc09e2d96e23 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -490,7 +490,7 @@ public: */ void updateInsertedPages(PageInsertionParams& rParams, const InsertBookmarkOptions& rOptions, - DocumentPageCounts& rPageCounts, + const DocumentPageCounts& rPageCounts, StyleTransferContext& rStyleContext); /** diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index d54f948fbc84..d3086d03f76e 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -817,7 +817,7 @@ void SdDrawDocument::removeDuplicateMasterPages(PageInsertionParams& rParams, void SdDrawDocument::updateInsertedPages(PageInsertionParams& rParams, const InsertBookmarkOptions& rOptions, - DocumentPageCounts& rPageCounts, + const DocumentPageCounts& rPageCounts, StyleTransferContext& rStyleContext) { // Update page names (from pExchangeList), layouts, scaling, etc. diff --git a/sdext/source/pdfimport/inc/genericelements.hxx b/sdext/source/pdfimport/inc/genericelements.hxx index 705773b9893a..430bd8332e3a 100644 --- a/sdext/source/pdfimport/inc/genericelements.hxx +++ b/sdext/source/pdfimport/inc/genericelements.hxx @@ -317,7 +317,7 @@ namespace pdfi { return std::make_shared<DocumentElement>(); } }; - bool isComplex(const css::uno::Reference<css::i18n::XBreakIterator>& rBreakIterator, TextElement* const pTextElem); + bool isComplex(const css::uno::Reference<css::i18n::XBreakIterator>& rBreakIterator, const TextElement* pTextElem); } #endif diff --git a/sdext/source/pdfimport/tree/genericelements.cxx b/sdext/source/pdfimport/tree/genericelements.cxx index aec9c999fcf6..4f9d52706884 100644 --- a/sdext/source/pdfimport/tree/genericelements.cxx +++ b/sdext/source/pdfimport/tree/genericelements.cxx @@ -437,7 +437,7 @@ void DocumentElement::visitedBy( ElementTreeVisitor& rV rVisitor.visit(*this, rParentIt); } -bool isComplex(const css::uno::Reference<css::i18n::XBreakIterator>& rBreakIterator, TextElement* const pTextElem) { +bool isComplex(const css::uno::Reference<css::i18n::XBreakIterator>& rBreakIterator, const TextElement* pTextElem) { OUString str(pTextElem->Text.toString()); for(int i=0; i< str.getLength(); i++) { diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx index d2ba02bf6cff..467da27811fa 100644 --- a/slideshow/source/engine/shapes/gdimtftools.cxx +++ b/slideshow/source/engine/shapes/gdimtftools.cxx @@ -249,8 +249,8 @@ sal_Int32 getNextActionOffset( MetaAction * pCurrAct ) bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames, sal_uInt32& o_rLoopCount, std::shared_ptr<Graphic> pGraphic, - ScopedVclPtrInstance<VirtualDevice>& pVDev, - ScopedVclPtrInstance<VirtualDevice>& pVDevMask, + const ScopedVclPtrInstance<VirtualDevice>& pVDev, + const ScopedVclPtrInstance<VirtualDevice>& pVDevMask, sal_uInt16& mnLoadedFrames, sal_uInt16 nFramesToLoad ) { diff --git a/slideshow/source/engine/shapes/gdimtftools.hxx b/slideshow/source/engine/shapes/gdimtftools.hxx index c23b16ae53c5..c3add0c07e4b 100644 --- a/slideshow/source/engine/shapes/gdimtftools.hxx +++ b/slideshow/source/engine/shapes/gdimtftools.hxx @@ -130,8 +130,8 @@ namespace slideshow::internal bool getAnimationFromGraphic(VectorOfMtfAnimationFrames& o_rFrames, sal_uInt32& o_rLoopCount, std::shared_ptr<Graphic> pGraphic, - ScopedVclPtrInstance<VirtualDevice> &pVDev, - ScopedVclPtrInstance<VirtualDevice> &pVDevMask, + const ScopedVclPtrInstance<VirtualDevice> &pVDev, + const ScopedVclPtrInstance<VirtualDevice> &pVDevMask, sal_uInt16& nLoadedFrames, sal_uInt16 nFramesToLoad); diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 27da8770b43b..b606c3f59794 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -1430,7 +1430,7 @@ lcl_createPointSequenceSequenceFromB2DPolygon(const basegfx::B2DPolygon& rPoly) void lcl_setPropertiesToShape(const drawing::PointSequenceSequence& rPoints, const cppcanvas::PolyPolygonSharedPtr pCanvasPolyPoly, - uno::Reference< drawing::XShape >& rPolyShape) + const uno::Reference< drawing::XShape >& rPolyShape) { uno::Reference< beans::XPropertySet > aXPropSet(rPolyShape, uno::UNO_QUERY); //Give the built PointSequenceSequence. diff --git a/test/source/a11y/accessibletestbase.cxx b/test/source/a11y/accessibletestbase.cxx index 692f72a474fc..c10077823e68 100644 --- a/test/source/a11y/accessibletestbase.cxx +++ b/test/source/a11y/accessibletestbase.cxx @@ -463,7 +463,8 @@ bool test::AccessibleTestBase::tabTo( * or interact with them. */ -test::AccessibleTestBase::Dialog::Dialog(uno::Reference<awt::XDialog2>& xDialog2, bool bAutoClose) +test::AccessibleTestBase::Dialog::Dialog(const uno::Reference<awt::XDialog2>& xDialog2, + bool bAutoClose) : mbAutoClose(bAutoClose) , mxDialog2(xDialog2) { diff --git a/toolkit/source/controls/animatedimages.cxx b/toolkit/source/controls/animatedimages.cxx index 971d6622130b..25e35accf3db 100644 --- a/toolkit/source/controls/animatedimages.cxx +++ b/toolkit/source/controls/animatedimages.cxx @@ -211,7 +211,7 @@ namespace toolkit { throw IndexOutOfBoundsException( OUString(), i_context ); } - void lcl_notify( std::unique_lock<std::mutex>& i_guard, comphelper::OInterfaceContainerHelper4<XContainerListener>& rContainer, + void lcl_notify( std::unique_lock<std::mutex>& i_guard, const comphelper::OInterfaceContainerHelper4<XContainerListener>& rContainer, void ( SAL_CALL XContainerListener::*i_notificationMethod )( const ContainerEvent& ), const sal_Int32 i_accessor, const Sequence< OUString >& i_imageURLs, const Reference< XInterface >& i_context ) {