Kaydet (Commit) ff3bdde2 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:passstuffbyref

Change-Id: I785e96599bbda029adf4698d11d7f981750dec07
Reviewed-on: https://gerrit.libreoffice.org/54802Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 305285bd
......@@ -1442,7 +1442,7 @@ namespace basegfx
return mpPolygon->count();
}
basegfx::B3DPoint B3DPolygon::getB3DPoint(sal_uInt32 nIndex) const
basegfx::B3DPoint const & B3DPolygon::getB3DPoint(sal_uInt32 nIndex) const
{
OSL_ENSURE(nIndex < mpPolygon->count(), "B3DPolygon access outside range (!)");
......@@ -1457,7 +1457,7 @@ namespace basegfx
mpPolygon->setPoint(nIndex, rValue);
}
BColor B3DPolygon::getBColor(sal_uInt32 nIndex) const
BColor const & B3DPolygon::getBColor(sal_uInt32 nIndex) const
{
OSL_ENSURE(nIndex < mpPolygon->count(), "B3DPolygon access outside range (!)");
......@@ -1488,7 +1488,7 @@ namespace basegfx
return mpPolygon->getNormal();
}
B3DVector B3DPolygon::getNormal(sal_uInt32 nIndex) const
B3DVector const & B3DPolygon::getNormal(sal_uInt32 nIndex) const
{
OSL_ENSURE(nIndex < mpPolygon->count(), "B3DPolygon access outside range (!)");
......@@ -1520,7 +1520,7 @@ namespace basegfx
mpPolygon->clearNormals();
}
B2DPoint B3DPolygon::getTextureCoordinate(sal_uInt32 nIndex) const
B2DPoint const & B3DPolygon::getTextureCoordinate(sal_uInt32 nIndex) const
{
OSL_ENSURE(nIndex < mpPolygon->count(), "B3DPolygon access outside range (!)");
......
......@@ -229,7 +229,7 @@ namespace basegfx
return mpPolyPolygon->count();
}
B3DPolygon B3DPolyPolygon::getB3DPolygon(sal_uInt32 nIndex) const
B3DPolygon const & B3DPolyPolygon::getB3DPolygon(sal_uInt32 nIndex) const
{
OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B3DPolyPolygon access outside range (!)");
......
......@@ -42,7 +42,7 @@ class SvRTLInputBox : public weld::GenericDialogController
public:
SvRTLInputBox(weld::Window* pParent, const OUString& rPrompt, const OUString& rTitle,
const OUString& rDefault, long nXTwips, long nYTwips );
OUString GetText() const { return m_aText; }
OUString const & GetText() const { return m_aText; }
};
SvRTLInputBox::SvRTLInputBox(weld::Window* pParent, const OUString& rPrompt,
......
......@@ -274,6 +274,10 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
if (startswith(type.getAsString(), "struct o3tl::strong_int")) {
return;
}
// extremely simple class, might as well pass by value
if (loplugin::TypeCheck(functionDecl->getReturnType()).Class("Color")) {
return;
}
// functionDecl->dump();
......
......@@ -214,7 +214,7 @@ void SvxCharacterMap::SetChar( sal_UCS4 c )
sal_UCS4 SvxCharacterMap::GetChar() const
{
return (m_aShowChar.GetText()).toChar();
return m_aShowChar.GetText().toChar();
}
void SvxCharacterMap::DisableFontSelection()
......
......@@ -58,9 +58,9 @@ public:
SvxShowText(const VclPtr<VirtualDevice>& rVirDev);
void SetFont(const vcl::Font& rFont);
vcl::Font GetFont() const { return m_aFont; }
vcl::Font const & GetFont() const { return m_aFont; }
void SetText(const OUString& rText);
OUString GetText() const { return m_sText; }
OUString const & GetText() const { return m_sText; }
void SetCentered(bool bCenter) { mbCenter = bCenter; }
Size get_preferred_size() const { return GetDrawingArea()->get_preferred_size(); }
......
......@@ -71,7 +71,7 @@ public:
{
m_xDialog->set_title(rTitle);
}
std::shared_ptr<weld::Dialog> GetDialog()
std::shared_ptr<weld::Dialog> const & GetDialog()
{
return m_xDialog;
}
......
......@@ -32,9 +32,9 @@ private:
protected:
AlterAction getActionType() const { return m_eAction; }
OUString getColumnName() const { return m_sColumnName; }
OUString const& getColumnName() const { return m_sColumnName; }
sal_Int32 getIdentityParam() const { return m_nIdentityParam; }
OUString getStatement() const { return m_sStmt; }
OUString const& getStatement() const { return m_sStmt; }
public:
virtual ~AlterStmtParser() = default;
......@@ -42,7 +42,7 @@ public:
/**
* @return name of the table which is to be created.
*/
OUString getTableName() const { return m_sTableName; }
OUString const& getTableName() const { return m_sTableName; }
void parse(const OUString& sSql);
......
......@@ -32,14 +32,14 @@ public:
bool bPrimary = false, sal_Int32 nAutoIncr = -1, bool bNullable = true,
bool bCaseInsensitive = false);
OUString getName() const { return m_sName; }
OUString const& getName() const { return m_sName; }
sal_Int32 getDataType() const { return m_eType; }
bool isPrimaryKey() const { return m_bPrimaryKey; }
bool isNullable() const { return m_bNullable; }
bool isAutoIncremental() const { return m_nAutoIncrement >= 0; }
bool isCaseInsensitive() const { return m_bCaseInsensitive; }
sal_Int32 getStartValue() const { return m_nAutoIncrement; }
const std::vector<sal_Int32> getParams() const { return m_aParams; }
const std::vector<sal_Int32>& getParams() const { return m_aParams; }
};
}
......
......@@ -34,12 +34,12 @@ public:
/**
* @return name of the table which is to be created.
*/
OUString getTableName() const { return m_sTableName; }
OUString const& getTableName() const { return m_sTableName; }
/**
* @return primary keys of parsed table.
*/
std::vector<OUString> getPrimaryKeys() const { return m_PrimaryKeys; }
std::vector<OUString> const& getPrimaryKeys() const { return m_PrimaryKeys; }
/**
* @return a vector of column descriptors, representing the columns of the
......
......@@ -66,28 +66,28 @@ namespace basegfx
sal_uInt32 count() const;
// Coordinate interface
B3DPoint getB3DPoint(sal_uInt32 nIndex) const;
B3DPoint const & getB3DPoint(sal_uInt32 nIndex) const;
void setB3DPoint(sal_uInt32 nIndex, const B3DPoint& rValue);
// Coordinate append
void append(const B3DPoint& rPoint, sal_uInt32 nCount = 1);
// BColor interface
BColor getBColor(sal_uInt32 nIndex) const;
BColor const & getBColor(sal_uInt32 nIndex) const;
void setBColor(sal_uInt32 nIndex, const BColor& rValue);
bool areBColorsUsed() const;
void clearBColors();
// Normals interface
B3DVector const & getNormal() const; // plane normal
B3DVector getNormal(sal_uInt32 nIndex) const; // normal in each point
B3DVector const & getNormal(sal_uInt32 nIndex) const; // normal in each point
void setNormal(sal_uInt32 nIndex, const B3DVector& rValue);
void transformNormals(const B3DHomMatrix& rMatrix);
bool areNormalsUsed() const;
void clearNormals();
// TextureCoordinate interface
B2DPoint getTextureCoordinate(sal_uInt32 nIndex) const;
B2DPoint const & getTextureCoordinate(sal_uInt32 nIndex) const;
void setTextureCoordinate(sal_uInt32 nIndex, const B2DPoint& rValue);
void transformTextureCoordinates(const B2DHomMatrix& rMatrix);
bool areTextureCoordinatesUsed() const;
......
......@@ -62,7 +62,7 @@ namespace basegfx
sal_uInt32 count() const;
// B3DPolygon interface
B3DPolygon getB3DPolygon(sal_uInt32 nIndex) const;
B3DPolygon const & getB3DPolygon(sal_uInt32 nIndex) const;
void setB3DPolygon(sal_uInt32 nIndex, const B3DPolygon& rPolygon);
// BColor interface
......
......@@ -195,8 +195,8 @@ struct MSFILTER_DLLPUBLIC PptDocumentAtom
public:
Size GetSlidesPageSize() const { return aSlidesPageSize; }
Size GetNotesPageSize() const { return aNotesPageSize; }
Size const & GetSlidesPageSize() const { return aSlidesPageSize; }
Size const & GetNotesPageSize() const { return aNotesPageSize; }
friend SvStream& ReadPptDocumentAtom( SvStream& rIn, PptDocumentAtom& rAtom );
};
......
......@@ -50,9 +50,9 @@ public:
SvxCharView(const VclPtr<VirtualDevice>& rVirDev);
void SetFont( const vcl::Font& rFont );
vcl::Font GetFont() const { return maFont; }
vcl::Font const & GetFont() const { return maFont; }
void SetText( const OUString& rText );
OUString GetText() const { return m_sText; }
OUString const & GetText() const { return m_sText; }
void SetHasInsert( bool bInsert );
void InsertCharToDoc();
......
......@@ -55,7 +55,7 @@ public:
OUString const & GetDetectedFilter() const;
void SetDetectedFilter(const OUString&);
css::uno::Reference<css::ui::dialogs::XFilePickerControlAccess> GetFilePickerControlAccess();
css::uno::Reference<css::ui::dialogs::XFilePickerControlAccess> const & GetFilePickerControlAccess();
private:
SvxOpenGraphicDialog (const SvxOpenGraphicDialog&) = delete;
......
......@@ -61,7 +61,7 @@ public:
virtual sal_uInt16 GetValueCount() const override;
sal_uInt16 GetValueByPos( sal_uInt16 nPos ) const;
OUString GetValueTextByPos( sal_uInt16 nPos ) const;
OUString const & GetValueTextByPos( sal_uInt16 nPos ) const;
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVersion) const override;
};
......
......@@ -80,7 +80,7 @@ public:
void SetFavClickHdl( const Link<SvxShowCharSet*,void>& rHdl ) { aFavClickHdl = rHdl; }
static sal_uInt32& getSelectedChar();
void SetFont( const vcl::Font& rFont );
vcl::Font GetFont() const { return mxVirDev->GetFont(); }
vcl::Font const & GetFont() const { return mxVirDev->GetFont(); }
bool GetFontCharMap(FontCharMapRef& rxFontCharMap) const { return mxVirDev->GetFontCharMap(rxFontCharMap); }
bool isFavChar(const OUString& sTitle, const OUString& rFont);
void getFavCharacterList(); //gets both Fav char and Fav char font list
......
......@@ -36,7 +36,7 @@ public:
}
virtual tools::Rectangle GetFocusRect() { return tools::Rectangle(); }
virtual FactoryFunction GetUITestFactory() const { return nullptr; }
Size GetOutputSizePixel() const { return m_aSize; }
Size const& GetOutputSizePixel() const { return m_aSize; }
void SetOutputSizePixel(const Size& rSize) { m_aSize = rSize; }
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) { m_pDrawingArea = pDrawingArea; }
weld::DrawingArea* GetDrawingArea() const { return m_pDrawingArea; }
......
......@@ -175,7 +175,7 @@ public:
void SetPrintOptions ( const ScPrintOptions& rOpt );
void InsertEntryToLRUList(sal_uInt16 nFIndex);
SC_DLLPUBLIC css::uno::Reference<css::datatransfer::XTransferable2>
SC_DLLPUBLIC const css::uno::Reference<css::datatransfer::XTransferable2> &
GetClipData() { return m_xClipData; }
SC_DLLPUBLIC void SetClipData(
const css::uno::Reference<css::datatransfer::XTransferable2>& xTransferable) { m_xClipData = xTransferable; }
......
......@@ -47,8 +47,8 @@ public:
explicit ScDrawObjData();
tools::Rectangle getShapeRect() { return maShapeRect; };
tools::Rectangle getLastCellRect() { return maLastCellRect; };
const tools::Rectangle & getShapeRect() { return maShapeRect; };
const tools::Rectangle & getLastCellRect() { return maLastCellRect; };
void setShapeRect(const ScDocument* rDoc, tools::Rectangle rNewRect, bool bIsVisible=true)
{
// bIsVisible should be false when the object is hidden obviously. we dont want to store the old cell rect in that
......
......@@ -395,7 +395,7 @@ public:
static bool isAnyEditViewInRange(bool bColumns, SCCOLROW nStart, SCCOLROW nEnd);
css::uno::Reference<css::drawing::XShapes> getSelectedXShapes();
css::uno::Reference<css::datatransfer::XTransferable2> GetClipData() { return m_xClipData; };
const css::uno::Reference<css::datatransfer::XTransferable2> & GetClipData() { return m_xClipData; };
void SetClipData(const css::uno::Reference<css::datatransfer::XTransferable2>& xTransferable) { m_xClipData = xTransferable; }
};
......
......@@ -215,7 +215,7 @@ NavigatorDragType SdNavigatorWin::GetNavigatorDragType()
return eDT;
}
VclPtr<SdPageObjsTLB> SdNavigatorWin::GetObjects()
VclPtr<SdPageObjsTLB> const & SdNavigatorWin::GetObjects()
{
return maTlbObjects;
}
......
......@@ -101,7 +101,7 @@ public:
bool InsertFile(const OUString& rFileName);
NavigatorDragType GetNavigatorDragType();
VclPtr<SdPageObjsTLB> GetObjects();
VclPtr<SdPageObjsTLB> const & GetObjects();
protected:
virtual bool EventNotify(NotifyEvent& rNEvt) override;
......
......@@ -281,7 +281,7 @@ void SvxOpenGraphicDialog::SetDetectedFilter(const OUString& rStr)
mpImpl->sDetectedFilter = rStr;
}
Reference<ui::dialogs::XFilePickerControlAccess> SvxOpenGraphicDialog::GetFilePickerControlAccess()
Reference<ui::dialogs::XFilePickerControlAccess> const & SvxOpenGraphicDialog::GetFilePickerControlAccess()
{
return mpImpl->xCtrlAcc;
}
......
......@@ -114,7 +114,7 @@ static OUString HelpLocaleString();
namespace {
/// Root path of the help.
OUString getHelpRootURL()
OUString const & getHelpRootURL()
{
static OUString s_instURL;
if (!s_instURL.isEmpty())
......
......@@ -66,7 +66,7 @@ sal_uInt16 SfxAllEnumItem::GetValueCount() const
return pValues ? pValues->size() : 0;
}
OUString SfxAllEnumItem::GetValueTextByPos( sal_uInt16 nPos ) const
OUString const & SfxAllEnumItem::GetValueTextByPos( sal_uInt16 nPos ) const
{
assert(pValues && nPos < pValues->size());
return (*pValues)[nPos].aText;
......
......@@ -116,7 +116,7 @@ private:
bool operator==( const ImpGraphic& rImpGraphic ) const;
bool operator!=( const ImpGraphic& rImpGraphic ) const { return !( *this == rImpGraphic ); }
OUString getOriginURL() const
OUString const & getOriginURL() const
{
return maGraphicExternalLink.msURL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment