From e75a545f2869a4406bb434c356d481745f000271 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 28 Sep 2019 10:01:04 +0200 Subject: loplugin:constmethod in sdext..starmath Change-Id: Ib1b60382c9ec62f35f0f232c3f2c2d5664ea669e Reviewed-on: https://gerrit.libreoffice.org/79779 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sdext/source/minimizer/optimizerdialog.hxx | 2 +- sdext/source/pdfimport/inc/pdfiprocessor.hxx | 4 ++-- sdext/source/pdfimport/tree/pdfiprocessor.cxx | 2 +- sdext/source/presenter/PresenterScrollBar.hxx | 2 +- sdext/source/presenter/PresenterTextView.cxx | 4 ++-- sdext/source/presenter/PresenterTextView.hxx | 4 ++-- slideshow/source/engine/shapes/shapeimporter.cxx | 2 +- slideshow/source/engine/slide/userpaintoverlay.cxx | 4 ++-- slideshow/source/engine/slide/userpaintoverlay.hxx | 2 +- slideshow/source/engine/slidebitmap.cxx | 2 +- slideshow/source/inc/shapeimporter.hxx | 4 ++-- slideshow/source/inc/slidebitmap.hxx | 2 +- starmath/inc/cursor.hxx | 2 +- starmath/inc/document.hxx | 8 ++++---- starmath/inc/visitors.hxx | 2 +- starmath/source/cursor.cxx | 4 ++-- starmath/source/document.cxx | 2 +- starmath/source/mathmlexport.hxx | 2 +- starmath/source/mathmlimport.hxx | 4 ++-- 19 files changed, 29 insertions(+), 29 deletions(-) diff --git a/sdext/source/minimizer/optimizerdialog.hxx b/sdext/source/minimizer/optimizerdialog.hxx index 9d421488046a..c40a7b9b99c0 100644 --- a/sdext/source/minimizer/optimizerdialog.hxx +++ b/sdext/source/minimizer/optimizerdialog.hxx @@ -122,7 +122,7 @@ public: OUString GetSelectedString( OUString const & token ); css::uno::Reference< css::frame::XDispatch >& GetStatusDispatcher() { return mxStatusDispatcher; }; css::uno::Reference< css::frame::XFrame>& GetFrame() { return mxFrame; }; - const css::uno::Reference< css::uno::XComponentContext >& GetComponentContext() { return UnoDialog::mxContext; }; + const css::uno::Reference< css::uno::XComponentContext >& GetComponentContext() const { return UnoDialog::mxContext; }; }; diff --git a/sdext/source/pdfimport/inc/pdfiprocessor.hxx b/sdext/source/pdfimport/inc/pdfiprocessor.hxx index 196a59ba3a8b..a4c16407a39d 100644 --- a/sdext/source/pdfimport/inc/pdfiprocessor.hxx +++ b/sdext/source/pdfimport/inc/pdfiprocessor.hxx @@ -205,8 +205,8 @@ namespace pdfi m_Width(width), m_PrevSpaceWidth(prevSpaceWidth), m_rGlyphs(rGlyphs) {}; OUString& getGlyph(){ return m_rGlyphs; } - double getWidth(){ return m_Width; } - double getPrevSpaceWidth(){ return m_PrevSpaceWidth; } + double getWidth() const { return m_Width; } + double getPrevSpaceWidth() const { return m_PrevSpaceWidth; } GraphicsContext& getGC(){ return m_rCurrentContext; } Element* getCurElement(){ return m_pCurElement; } diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 509e4a72d9e8..15b77b8627b8 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -217,7 +217,7 @@ void PDFIProcessor::processGlyphLine() if (spaceDetectBoundary == 0.0) { double avgGlyphWidth = 0.0; - for (CharGlyph & i : m_GlyphsList) + for (const CharGlyph & i : m_GlyphsList) avgGlyphWidth += i.getWidth(); avgGlyphWidth /= m_GlyphsList.size(); spaceDetectBoundary = avgGlyphWidth * 0.2; diff --git a/sdext/source/presenter/PresenterScrollBar.hxx b/sdext/source/presenter/PresenterScrollBar.hxx index a181753ee2f7..cf46420b186c 100644 --- a/sdext/source/presenter/PresenterScrollBar.hxx +++ b/sdext/source/presenter/PresenterScrollBar.hxx @@ -58,7 +58,7 @@ public: virtual void SAL_CALL disposing() override; css::uno::Reference const& - GetComponentContext() { return mxComponentContext; } + GetComponentContext() const { return mxComponentContext; } void SetVisible (const bool bIsVisible); diff --git a/sdext/source/presenter/PresenterTextView.cxx b/sdext/source/presenter/PresenterTextView.cxx index 10eec2e4b630..166d56cf5123 100644 --- a/sdext/source/presenter/PresenterTextView.cxx +++ b/sdext/source/presenter/PresenterTextView.cxx @@ -657,7 +657,7 @@ awt::Point PresenterTextParagraph::GetRelativeLocation() const sal_Int32(mnYOrigin + mnVerticalOffset)); } -awt::Size PresenterTextParagraph::GetSize() +awt::Size PresenterTextParagraph::GetSize() const { return awt::Size( sal_Int32(mnWidth), @@ -725,7 +725,7 @@ void PresenterTextParagraph::AddLine ( rCurrentLine.startPos = rCurrentLine.endPos; } -double PresenterTextParagraph::GetTotalTextHeight() +double PresenterTextParagraph::GetTotalTextHeight() const { return maLines.size() * mnLineHeight; } diff --git a/sdext/source/presenter/PresenterTextView.hxx b/sdext/source/presenter/PresenterTextView.hxx index 86bc04652f91..edd818cc385c 100644 --- a/sdext/source/presenter/PresenterTextView.hxx +++ b/sdext/source/presenter/PresenterTextView.hxx @@ -106,7 +106,7 @@ public: const double nClipTop, const double nClipBottom); - double GetTotalTextHeight(); + double GetTotalTextHeight() const; void SetCharacterOffset (const sal_Int32 nCharacterOffset); sal_Int32 GetCharacterCount() const; @@ -138,7 +138,7 @@ public: void SetCaretPosition (const sal_Int32 nPosition) const; void SetOrigin (const double nXOrigin, const double nYOrigin); css::awt::Point GetRelativeLocation() const; - css::awt::Size GetSize(); + css::awt::Size GetSize() const; private: OUString msParagraphText; diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx index 65b0414d2645..542308813d36 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -517,7 +517,7 @@ bool ShapeImporter::isImportDone() const return maShapesStack.empty(); } -const PolyPolygonVector& ShapeImporter::getPolygons() +const PolyPolygonVector& ShapeImporter::getPolygons() const { return maPolygons; } diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx index 2382a50875c2..3ad95c1a6cdb 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.cxx +++ b/slideshow/source/engine/slide/userpaintoverlay.cxx @@ -222,7 +222,7 @@ namespace slideshow } //Retrieve all registered polygons. - const PolyPolygonVector& getPolygons() + const PolyPolygonVector& getPolygons() const { return maPolygons; } @@ -462,7 +462,7 @@ namespace slideshow mrMultiplexer.addUserPaintHandler(mpHandler); } - PolyPolygonVector const & UserPaintOverlay::getPolygons() + PolyPolygonVector const & UserPaintOverlay::getPolygons() const { return mpHandler->getPolygons(); } diff --git a/slideshow/source/engine/slide/userpaintoverlay.hxx b/slideshow/source/engine/slide/userpaintoverlay.hxx index 3dc6fa976a7f..449b34174fa9 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.hxx +++ b/slideshow/source/engine/slide/userpaintoverlay.hxx @@ -65,7 +65,7 @@ namespace slideshow ~UserPaintOverlay(); UserPaintOverlay(const UserPaintOverlay&) = delete; UserPaintOverlay& operator=(const UserPaintOverlay&) = delete; - PolyPolygonVector const & getPolygons(); + PolyPolygonVector const & getPolygons() const; void drawPolygons(); private: diff --git a/slideshow/source/engine/slidebitmap.cxx b/slideshow/source/engine/slidebitmap.cxx index 7acd82207748..9c52fccd2359 100644 --- a/slideshow/source/engine/slidebitmap.cxx +++ b/slideshow/source/engine/slidebitmap.cxx @@ -107,7 +107,7 @@ namespace slideshow maClipPoly = rClipPoly; } - const css::uno::Reference< css::rendering::XBitmap >& SlideBitmap::getXBitmap() + const css::uno::Reference< css::rendering::XBitmap >& SlideBitmap::getXBitmap() const { return mxBitmap; } diff --git a/slideshow/source/inc/shapeimporter.hxx b/slideshow/source/inc/shapeimporter.hxx index 584b40941f37..b29c0b079d0c 100644 --- a/slideshow/source/inc/shapeimporter.hxx +++ b/slideshow/source/inc/shapeimporter.hxx @@ -90,9 +90,9 @@ public: importShape() call. */ bool isImportDone() const; - const PolyPolygonVector& getPolygons(); + const PolyPolygonVector& getPolygons() const; - double getImportedShapesCount() { return mnAscendingPrio; } + double getImportedShapesCount() const{ return mnAscendingPrio; } private: bool isSkip( css::uno::Reference const& xPropSet, OUString const& shapeType, diff --git a/slideshow/source/inc/slidebitmap.hxx b/slideshow/source/inc/slidebitmap.hxx index d311a6d1470c..f149138c4a7c 100644 --- a/slideshow/source/inc/slidebitmap.hxx +++ b/slideshow/source/inc/slidebitmap.hxx @@ -68,7 +68,7 @@ namespace slideshow void move( const ::basegfx::B2DPoint& rNewPos ); void clip( const ::basegfx::B2DPolyPolygon& rClipPoly ); - const css::uno::Reference< css::rendering::XBitmap >& getXBitmap(); + const css::uno::Reference< css::rendering::XBitmap >& getXBitmap() const; private: ::basegfx::B2DPoint maOutputPos; diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index 2ba17fb0a46c..14897656c0a3 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -83,7 +83,7 @@ public: const SmCaretPos& GetPosition() const { return mpPosition->CaretPos; } /** True, if the cursor has a selection */ - bool HasSelection() { return mpAnchor != mpPosition; } + bool HasSelection() const { return mpAnchor != mpPosition; } /** Move the position of this cursor */ void Move(OutputDevice* pDev, SmMovementDirection direction, bool bMoveAnchor = true); diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index c192ef2fc655..dd1f540a3fe3 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -157,7 +157,7 @@ public: //Access for the View. This access is not for the OLE-case! //and for the communication with the SFX! //All internal printer uses should work with the SmPrinterAccess only - bool HasPrinter() { return mpPrinter != nullptr; } + bool HasPrinter() const { return mpPrinter != nullptr; } SfxPrinter *GetPrinter() { GetPrt(); return mpPrinter; } void SetPrinter( SfxPrinter * ); @@ -168,9 +168,9 @@ public: void UpdateText(); void SetText(const OUString& rBuffer); - const OUString& GetText() { return maText; } + const OUString& GetText() const { return maText; } void SetFormat(SmFormat const & rFormat); - const SmFormat& GetFormat() { return maFormat; } + const SmFormat& GetFormat() const { return maFormat; } void Parse(); SmParser & GetParser() { return maParser; } @@ -205,7 +205,7 @@ public: /** True, if cursor have previously been requested and thus * has some sort of position. */ - bool HasCursor(); + bool HasCursor() const; void writeFormulaOoxml(const ::sax_fastparser::FSHelperPtr& pSerializer, oox::core::OoxmlVersion version, diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx index 39f5c6323064..e90e3e187a40 100644 --- a/starmath/inc/visitors.hxx +++ b/starmath/inc/visitors.hxx @@ -141,7 +141,7 @@ public: virtual ~SmCaretPos2LineVisitor() {} void Visit( SmTextNode* pNode ) override; using SmDefaultingVisitor::Visit; - const SmCaretLine& GetResult( ) { + const SmCaretLine& GetResult( ) const { return maLine; } private: diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index b6575b8655b3..c7a1ba31e90e 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -40,7 +40,7 @@ void SmCursor::Move(OutputDevice* pDev, SmMovementDirection direction, bool bMov best_line, //Best approximated line found so far curr_line; //Current line long dbp_sq = 0; //Distance squared to best line - for(auto &pEntry : *mpGraph) + for(const auto &pEntry : *mpGraph) { //Reject it if it's the current position if(pEntry->CaretPos == mpPosition->CaretPos) continue; @@ -84,7 +84,7 @@ void SmCursor::MoveTo(OutputDevice* pDev, const Point& pos, bool bMoveAnchor) SmCaretPosGraphEntry* NewPos = nullptr; long dp_sq = 0, //Distance to current line squared dbp_sq = 1; //Distance to best line squared - for(auto &pEntry : *mpGraph) + for(const auto &pEntry : *mpGraph) { OSL_ENSURE(pEntry->CaretPos.IsValid(), "The caret position graph may not have invalid positions!"); //Compute current line diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index b3c7c512e3b0..62f0e0fc04fd 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -468,7 +468,7 @@ SmCursor& SmDocShell::GetCursor(){ return *mpCursor; } -bool SmDocShell::HasCursor() { return mpCursor != nullptr; } +bool SmDocShell::HasCursor() const { return mpCursor != nullptr; } SmPrinterAccess::SmPrinterAccess( SmDocShell &rDocShell ) { diff --git a/starmath/source/mathmlexport.hxx b/starmath/source/mathmlexport.hxx index ba7abf51d0ce..72ce800ad3af 100644 --- a/starmath/source/mathmlexport.hxx +++ b/starmath/source/mathmlexport.hxx @@ -107,7 +107,7 @@ public: virtual void GetViewSettings(css::uno::Sequence& aProps) override; virtual void GetConfigurationSettings(css::uno::Sequence& aProps) override; - bool GetSuccess() {return bSuccess;} + bool GetSuccess() const {return bSuccess;} }; diff --git a/starmath/source/mathmlimport.hxx b/starmath/source/mathmlimport.hxx index c9a2f9d1f17c..2357c9f09bf9 100644 --- a/starmath/source/mathmlimport.hxx +++ b/starmath/source/mathmlimport.hxx @@ -180,8 +180,8 @@ public: SmNodeStack & GetNodeStack() { return aNodeStack; } - bool GetSuccess() { return bSuccess; } - [[nodiscard]] const OUString& GetText() { return aText; } + bool GetSuccess() const { return bSuccess; } + [[nodiscard]] const OUString& GetText() const { return aText; } void SetText(const OUString &rStr) { aText = rStr; } virtual void SetViewSettings(const css::uno::Sequence& aViewProps) override; -- cgit