summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-08-09 15:22:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-10 08:07:03 +0200
commit4c909d1466bf940f653984b61772cf19c320439d (patch)
treec29129af77615725b3cee5cf5e18796821b426e6
parent91d77d65190e7cf11dd7cd0b29d5de6b66061faf (diff)
loplugin:passstuffbyref
Change-Id: Ib2b2650da7abc9260897f9b5aad619a0ea6ae941 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138052 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--compilerplugins/clang/passstuffbyref.cxx35
-rw-r--r--include/svx/ChildrenManager.hxx2
-rw-r--r--include/svx/svdobj.hxx2
-rw-r--r--oox/source/drawingml/diagram/diagramhelper.cxx2
-rw-r--r--oox/source/drawingml/diagram/diagramhelper.hxx2
-rw-r--r--pyuno/source/module/pyuno_adapter.cxx2
-rw-r--r--pyuno/source/module/pyuno_impl.hxx2
-rw-r--r--sfx2/source/dialog/backingwindow.cxx2
-rw-r--r--svx/source/accessibility/ChildrenManager.cxx2
-rw-r--r--svx/source/accessibility/ChildrenManagerImpl.cxx2
-rw-r--r--svx/source/accessibility/ChildrenManagerImpl.hxx2
-rw-r--r--svx/source/svdraw/svdobj.cxx2
-rw-r--r--sw/inc/doc.hxx2
-rw-r--r--sw/inc/formatcontentcontrol.hxx29
-rw-r--r--sw/inc/viscrs.hxx2
-rw-r--r--sw/source/core/crsr/viscrs.cxx2
-rw-r--r--sw/source/core/txtnode/attrcontentcontrol.cxx2
-rw-r--r--ucbhelper/source/client/content.cxx4
-rw-r--r--vcl/source/treelist/treelistbox.cxx2
-rw-r--r--writerfilter/source/dmapper/SdtHelper.cxx8
-rw-r--r--writerfilter/source/dmapper/SdtHelper.hxx14
21 files changed, 64 insertions, 58 deletions
diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index d6ab91fc82a1..549987e43b53 100644
--- a/compilerplugins/clang/passstuffbyref.cxx
+++ b/compilerplugins/clang/passstuffbyref.cxx
@@ -280,7 +280,9 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
if (dc.Function("convertItems").Class("ValueParser").Namespace("configmgr").GlobalNamespace()
|| dc.Function("parseListValue").AnonymousNamespace().Namespace("configmgr").GlobalNamespace()
|| dc.Function("parseSingleValue").AnonymousNamespace().Namespace("configmgr").GlobalNamespace()
- || dc.Function("Create").Class("HandlerComponentBase").Namespace("pcr").GlobalNamespace()) {
+ || dc.Function("Create").Class("HandlerComponentBase").Namespace("pcr").GlobalNamespace()
+ || dc.Function("toAny").Struct("Convert").Namespace("detail").Namespace("comphelper").GlobalNamespace()
+ || dc.Function("makeAny").Namespace("utl").GlobalNamespace()) {
return;
}
if (startswith(type.getAsString(), "struct o3tl::strong_int")) {
@@ -299,6 +301,9 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
if (tc.Struct("TranslateId")) {
return;
}
+ if (tc.Class("span").Namespace("o3tl")) {
+ return;
+ }
// functionDecl->dump();
@@ -332,7 +337,7 @@ bool PassStuffByRef::VisitReturnStmt(const ReturnStmt * returnStmt)
{
if (!mbInsideFunctionDecl)
return true;
- const Expr* expr = dyn_cast<Expr>(*returnStmt->child_begin())->IgnoreParenCasts();
+ const Expr* expr = dyn_cast<Expr>(*returnStmt->child_begin())->IgnoreParenImpCasts();
if (isReturnExprDisqualified(expr))
mbFoundReturnValueDisqualifier = true;
@@ -348,6 +353,7 @@ bool PassStuffByRef::isReturnExprDisqualified(const Expr* expr)
while (true)
{
expr = expr->IgnoreParens();
+// expr->dump();
if (auto implicitCast = dyn_cast<ImplicitCastExpr>(expr)) {
expr = implicitCast->getSubExpr();
continue;
@@ -427,6 +433,9 @@ bool PassStuffByRef::isReturnExprDisqualified(const Expr* expr)
return true;
// otherwise fall through to the checking below
}
+ if (Opc == OO_Arrow)
+ if (isReturnExprDisqualified(operatorCallExpr->getArg(0)))
+ return true;
}
if (auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(expr)) {
if (isReturnExprDisqualified(memberCallExpr->getImplicitObjectArgument()))
@@ -455,21 +464,19 @@ bool PassStuffByRef::isReturnExprDisqualified(const Expr* expr)
bool PassStuffByRef::VisitVarDecl(const VarDecl * varDecl)
{
- if (!mbInsideFunctionDecl)
+ if (!mbInsideFunctionDecl || mbFoundReturnValueDisqualifier)
return true;
// things guarded by locking are probably best left alone
loplugin::TypeCheck dc(varDecl->getType());
- if (dc.Class("Guard").Namespace("osl").GlobalNamespace())
- mbFoundReturnValueDisqualifier = true;
- if (dc.Class("ClearableGuard").Namespace("osl").GlobalNamespace())
- mbFoundReturnValueDisqualifier = true;
- if (dc.Class("ResettableGuard").Namespace("osl").GlobalNamespace())
- mbFoundReturnValueDisqualifier = true;
- else if (dc.Class("SolarMutexGuard").GlobalNamespace())
- mbFoundReturnValueDisqualifier = true;
- else if (dc.Class("SfxModelGuard").GlobalNamespace())
- mbFoundReturnValueDisqualifier = true;
- else if (dc.Class("ReadWriteGuard").Namespace("utl").GlobalNamespace())
+ if (dc.Class("Guard").Namespace("osl").GlobalNamespace() ||
+ dc.Class("ClearableGuard").Namespace("osl").GlobalNamespace() ||
+ dc.Class("ResettableGuard").Namespace("osl").GlobalNamespace() ||
+ dc.Class("SolarMutexGuard").GlobalNamespace() ||
+ dc.Class("SfxModelGuard").GlobalNamespace() ||
+ dc.Class("ReadWriteGuard").Namespace("utl").GlobalNamespace() ||
+ dc.Class("unique_lock").StdNamespace() ||
+ dc.Class("lock_guard").StdNamespace() ||
+ dc.Class("scoped_lock").StdNamespace())
mbFoundReturnValueDisqualifier = true;
return true;
}
diff --git a/include/svx/ChildrenManager.hxx b/include/svx/ChildrenManager.hxx
index c14ae6c1c476..9f1d071ea9e7 100644
--- a/include/svx/ChildrenManager.hxx
+++ b/include/svx/ChildrenManager.hxx
@@ -137,7 +137,7 @@ public:
css::uno::Reference<css::accessibility::XAccessible> GetChild(tools::Long nIndex);
/// @throws css::lang::IndexOutOfBoundsException
/// @throws css::uno::RuntimeException
- css::uno::Reference<css::drawing::XShape> GetChildShape(tools::Long nIndex);
+ const css::uno::Reference<css::drawing::XShape>& GetChildShape(tools::Long nIndex);
/** Update the child manager. Take care of a modified set of children
and modified visible area. This method can optimize the update
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index daf6cde70319..971eba741ec8 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -885,7 +885,7 @@ public:
void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept;
protected:
- tools::Rectangle getOutRectangle() const;
+ const tools::Rectangle& getOutRectangle() const;
void setOutRectangleConst(tools::Rectangle const& rRectangle) const; // need to do something about this
void setOutRectangle(tools::Rectangle const& rRectangle);
void resetOutRectangle();
diff --git a/oox/source/drawingml/diagram/diagramhelper.cxx b/oox/source/drawingml/diagram/diagramhelper.cxx
index ebd6f3ebbf4a..e0e7202d3966 100644
--- a/oox/source/drawingml/diagram/diagramhelper.cxx
+++ b/oox/source/drawingml/diagram/diagramhelper.cxx
@@ -236,7 +236,7 @@ void AdvancedDiagramHelper::doAnchor(SdrObjGroup& rTarget, ::oox::drawingml::Sha
anchorToSdrObjGroup(rTarget);
}
-std::shared_ptr< ::oox::drawingml::Theme > AdvancedDiagramHelper::getOrCreateThemePtr(
+const std::shared_ptr< ::oox::drawingml::Theme >& AdvancedDiagramHelper::getOrCreateThemePtr(
rtl::Reference< oox::shape::ShapeFilterBase >& rxFilter) const
{
// (Re-)Use already existing Theme if existing/imported if possible.
diff --git a/oox/source/drawingml/diagram/diagramhelper.hxx b/oox/source/drawingml/diagram/diagramhelper.hxx
index 6059c2261d50..626d40382d7e 100644
--- a/oox/source/drawingml/diagram/diagramhelper.hxx
+++ b/oox/source/drawingml/diagram/diagramhelper.hxx
@@ -83,7 +83,7 @@ public:
virtual void applyDiagramDataState(const std::shared_ptr< svx::diagram::DiagramDataState >& rState) override;
void doAnchor(SdrObjGroup& rTarget, ::oox::drawingml::Shape& rRootShape);
- std::shared_ptr< ::oox::drawingml::Theme > getOrCreateThemePtr(
+ const std::shared_ptr< ::oox::drawingml::Theme >& getOrCreateThemePtr(
rtl::Reference< oox::shape::ShapeFilterBase>& rxFilter ) const;
};
diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx
index b15387a2074e..27c7eeae2ec7 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -65,7 +65,7 @@ Adapter::~Adapter()
mWrappedObject.scratch();
}
-Sequence<sal_Int8> Adapter::getUnoTunnelId()
+const Sequence<sal_Int8> & Adapter::getUnoTunnelId()
{
static const comphelper::UnoIdInit g_id;
return g_id.getSeq();
diff --git a/pyuno/source/module/pyuno_impl.hxx b/pyuno/source/module/pyuno_impl.hxx
index 9fda901886cb..422f3fdb3dff 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -262,7 +262,7 @@ public:
Adapter( const PyRef &obj,
const css::uno::Sequence< css::uno::Type > & types );
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
const PyRef& getWrappedObject() const { return mWrappedObject; }
const css::uno::Sequence< css::uno::Type >& getWrappedTypes() const { return mTypes; }
virtual ~Adapter() override;
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 4a507142bf3b..3506336be76e 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -69,7 +69,7 @@ private:
Size m_BmpSize;
public:
- Size getSize() { return m_BmpSize; }
+ const Size & getSize() { return m_BmpSize; }
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
{
diff --git a/svx/source/accessibility/ChildrenManager.cxx b/svx/source/accessibility/ChildrenManager.cxx
index d0e681b550f1..8b08b930dc7b 100644
--- a/svx/source/accessibility/ChildrenManager.cxx
+++ b/svx/source/accessibility/ChildrenManager.cxx
@@ -59,7 +59,7 @@ css::uno::Reference<XAccessible> ChildrenManager::GetChild (tools::Long nIndex)
return mpImpl->GetChild (nIndex);
}
-css::uno::Reference<css::drawing::XShape> ChildrenManager::GetChildShape(tools::Long nIndex)
+const css::uno::Reference<css::drawing::XShape>& ChildrenManager::GetChildShape(tools::Long nIndex)
{
return mpImpl->GetChildShape(nIndex);
}
diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx
index 988bb4532c0c..36fa9ffecdb9 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.cxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.cxx
@@ -114,7 +114,7 @@ tools::Long ChildrenManagerImpl::GetChildCount() const noexcept
}
-css::uno::Reference<css::drawing::XShape> ChildrenManagerImpl::GetChildShape(tools::Long nIndex)
+const css::uno::Reference<css::drawing::XShape>& ChildrenManagerImpl::GetChildShape(tools::Long nIndex)
{
// Check whether the given index is valid.
if (nIndex < 0 || o3tl::make_unsigned(nIndex) >= maVisibleChildren.size())
diff --git a/svx/source/accessibility/ChildrenManagerImpl.hxx b/svx/source/accessibility/ChildrenManagerImpl.hxx
index 6b59e22551c3..517530fa64e7 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.hxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.hxx
@@ -119,7 +119,7 @@ public:
/// @throws css::uno::RuntimeException
/// @throws css::lang::IndexOutOfBoundsException
- css::uno::Reference<css::drawing::XShape> GetChildShape(tools::Long nIndex);
+ const css::uno::Reference<css::drawing::XShape>& GetChildShape(tools::Long nIndex);
/** Return the requested accessible child or throw and
IndexOutOfBoundsException if the given index is invalid.
@param nIndex
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 585988077edc..995ae52ee9e6 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -3222,7 +3222,7 @@ void SdrObject::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygo
}
}
-tools::Rectangle SdrObject::getOutRectangle() const
+const tools::Rectangle& SdrObject::getOutRectangle() const
{
return m_aOutRect;
}
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 0606ac4c33d1..05afd162cdd1 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1624,7 +1624,7 @@ public:
void SetDefaultPageMode(bool bSquaredPageMode);
bool IsSquaredPageMode() const;
- css::uno::Reference< ooo::vba::word::XFind > getVbaFind() const { return mxVbaFind; }
+ const css::uno::Reference< ooo::vba::word::XFind >& getVbaFind() const { return mxVbaFind; }
void setVbaFind( const css::uno::Reference< ooo::vba::word::XFind > &xFind) { mxVbaFind = xFind; }
css::uno::Reference< css::script::vba::XVBAEventProcessor > const & GetVbaEventProcessor();
void SetVBATemplateToProjectCache( css::uno::Reference< css::container::XNameContainer > const & xCache ) { m_xTemplateToProjectCache = xCache; };
diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index d7fc62fc2ecd..d265d2f098e9 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -78,7 +78,6 @@ public:
*/
void NotifyChangeTextNode(SwTextNode* pTextNode);
static SwFormatContentControl* CreatePoolDefault(sal_uInt16 nWhich);
- std::shared_ptr<SwContentControl> GetContentControl() { return m_pContentControl; }
const std::shared_ptr<SwContentControl>& GetContentControl() const { return m_pContentControl; }
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
@@ -95,7 +94,7 @@ public:
void dumpAsXml(xmlTextWriterPtr pWriter) const;
- OUString ToString() const;
+ const OUString& ToString() const;
bool operator==(const SwContentControlListItem& rOther) const;
@@ -216,13 +215,13 @@ public:
void SetCheckedState(const OUString& rCheckedState) { m_aCheckedState = rCheckedState; }
- OUString GetCheckedState() const { return m_aCheckedState; }
+ const OUString& GetCheckedState() const { return m_aCheckedState; }
void SetUncheckedState(const OUString& rUncheckedState) { m_aUncheckedState = rUncheckedState; }
- OUString GetUncheckedState() const { return m_aUncheckedState; }
+ const OUString& GetUncheckedState() const { return m_aUncheckedState; }
- std::vector<SwContentControlListItem> GetListItems() const { return m_aListItems; }
+ const std::vector<SwContentControlListItem>& GetListItems() const { return m_aListItems; }
bool HasListItems() const { return !m_aListItems.empty(); }
@@ -241,15 +240,15 @@ public:
void SetDateFormat(const OUString& rDateFormat) { m_aDateFormat = rDateFormat; }
- OUString GetDateFormat() const { return m_aDateFormat; }
+ const OUString& GetDateFormat() const { return m_aDateFormat; }
void SetDateLanguage(const OUString& rDateLanguage) { m_aDateLanguage = rDateLanguage; }
- OUString GetDateLanguage() const { return m_aDateLanguage; }
+ const OUString& GetDateLanguage() const { return m_aDateLanguage; }
void SetCurrentDate(const OUString& rCurrentDate) { m_aCurrentDate = rCurrentDate; }
- OUString GetCurrentDate() const { return m_aCurrentDate; }
+ const OUString& GetCurrentDate() const { return m_aCurrentDate; }
/// Formats fCurrentDate and sets it.
void SetCurrentDateValue(double fCurrentDate);
@@ -269,18 +268,18 @@ public:
m_aPlaceholderDocPart = rPlaceholderDocPart;
}
- OUString GetPlaceholderDocPart() const { return m_aPlaceholderDocPart; }
+ const OUString& GetPlaceholderDocPart() const { return m_aPlaceholderDocPart; }
void SetSelectedListItem(std::optional<size_t> oSelectedListItem)
{
m_oSelectedListItem = oSelectedListItem;
}
- std::optional<size_t> GetSelectedListItem() const { return m_oSelectedListItem; }
+ const std::optional<size_t>& GetSelectedListItem() const { return m_oSelectedListItem; }
void SetSelectedDate(std::optional<double> oSelectedDate) { m_oSelectedDate = oSelectedDate; }
- std::optional<double> GetSelectedDate() const { return m_oSelectedDate; }
+ const std::optional<double>& GetSelectedDate() const { return m_oSelectedDate; }
/// Should this character (during key input) interact with the content control?
bool IsInteractingCharacter(sal_Unicode cCh);
@@ -295,25 +294,25 @@ public:
m_aDataBindingPrefixMappings = rDataBindingPrefixMappings;
}
- OUString GetDataBindingPrefixMappings() const { return m_aDataBindingPrefixMappings; }
+ const OUString& GetDataBindingPrefixMappings() const { return m_aDataBindingPrefixMappings; }
void SetDataBindingXpath(const OUString& rDataBindingXpath)
{
m_aDataBindingXpath = rDataBindingXpath;
}
- OUString GetDataBindingXpath() const { return m_aDataBindingXpath; }
+ const OUString& GetDataBindingXpath() const { return m_aDataBindingXpath; }
void SetDataBindingStoreItemID(const OUString& rDataBindingStoreItemID)
{
m_aDataBindingStoreItemID = rDataBindingStoreItemID;
}
- OUString GetDataBindingStoreItemID() const { return m_aDataBindingStoreItemID; }
+ const OUString& GetDataBindingStoreItemID() const { return m_aDataBindingStoreItemID; }
void SetColor(const OUString& rColor) { m_aColor = rColor; }
- OUString GetColor() const { return m_aColor; }
+ const OUString& GetColor() const { return m_aColor; }
void SetReadWrite(bool bReadWrite) { m_bReadWrite = bReadWrite; }
diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx
index 6126f5ffa0c0..6c41fcb61b7e 100644
--- a/sw/inc/viscrs.hxx
+++ b/sw/inc/viscrs.hxx
@@ -115,7 +115,7 @@ public:
void SetShowContentControlOverlay(const bool bShow) { m_bShowContentControlOverlay = bShow; }
- VclPtr<SwContentControlButton> GetContentControlButton() const;
+ const VclPtr<SwContentControlButton>& GetContentControlButton() const;
const SwCursorShell* GetShell() const { return m_pCursorShell; }
// check current MapMode of the shell and set possibly the static members.
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 8246dfcf8dd8..588f572de73d 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -796,7 +796,7 @@ void SwSelPaintRects::HighlightContentControl()
}
}
-VclPtr<SwContentControlButton> SwSelPaintRects::GetContentControlButton() const
+const VclPtr<SwContentControlButton>& SwSelPaintRects::GetContentControlButton() const
{
return m_pContentControlButton;
}
diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx b/sw/source/core/txtnode/attrcontentcontrol.cxx
index f809b1b26cc5..b9992975f05a 100644
--- a/sw/source/core/txtnode/attrcontentcontrol.cxx
+++ b/sw/source/core/txtnode/attrcontentcontrol.cxx
@@ -395,7 +395,7 @@ void SwContentControlListItem::dumpAsXml(xmlTextWriterPtr pWriter) const
(void)xmlTextWriterEndElement(pWriter);
}
-OUString SwContentControlListItem::ToString() const
+const OUString& SwContentControlListItem::ToString() const
{
if (!m_aDisplayText.isEmpty())
{
diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx
index 48d3ee84a9da..8feab846baee 100644
--- a/ucbhelper/source/client/content.cxx
+++ b/ucbhelper/source/client/content.cxx
@@ -164,7 +164,7 @@ friend ContentEventListener_Impl;
private:
void reinit( const Reference< XContent >& xContent );
void disposing(const EventObject& Source);
- Reference< XContent > getContent_NoLock();
+ const Reference< XContent > & getContent_NoLock();
const OUString& getURL_NoLock() const;
public:
@@ -1205,7 +1205,7 @@ Reference< XContent > Content_Impl::getContent()
return m_xContent;
}
-Reference< XContent > Content_Impl::getContent_NoLock()
+const Reference< XContent > & Content_Impl::getContent_NoLock()
{
if ( !m_xContent.is() && !m_aURL.isEmpty() )
{
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index e5062c085b80..e799de53ff31 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -84,7 +84,7 @@ public:
OUString const & GetSavedValue() const;
void StopEditing( bool bCancel );
void Hide();
- VclPtr<Edit> GetEditWidget() const { return pEdit; };
+ const VclPtr<Edit> & GetEditWidget() const { return pEdit; };
};
// ***************************************************************
diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx
index 1df5319f85f3..32570db71813 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -430,14 +430,14 @@ bool SdtHelper::GetChecked() const { return m_bChecked; }
void SdtHelper::SetCheckedState(const OUString& rCheckedState) { m_aCheckedState = rCheckedState; }
-OUString SdtHelper::GetCheckedState() const { return m_aCheckedState; }
+const OUString& SdtHelper::GetCheckedState() const { return m_aCheckedState; }
void SdtHelper::SetUncheckedState(const OUString& rUncheckedState)
{
m_aUncheckedState = rUncheckedState;
}
-OUString SdtHelper::GetUncheckedState() const { return m_aUncheckedState; }
+const OUString& SdtHelper::GetUncheckedState() const { return m_aUncheckedState; }
void SdtHelper::clear()
{
@@ -460,11 +460,11 @@ void SdtHelper::SetPlaceholderDocPart(const OUString& rPlaceholderDocPart)
m_aPlaceholderDocPart = rPlaceholderDocPart;
}
-OUString SdtHelper::GetPlaceholderDocPart() const { return m_aPlaceholderDocPart; }
+const OUString& SdtHelper::GetPlaceholderDocPart() const { return m_aPlaceholderDocPart; }
void SdtHelper::SetColor(const OUString& rColor) { m_aColor = rColor; }
-OUString SdtHelper::GetColor() const { return m_aColor; }
+const OUString& SdtHelper::GetColor() const { return m_aColor; }
} // namespace writerfilter::dmapper
diff --git a/writerfilter/source/dmapper/SdtHelper.hxx b/writerfilter/source/dmapper/SdtHelper.hxx
index fbf33de2c0fc..7be862cd45f4 100644
--- a/writerfilter/source/dmapper/SdtHelper.hxx
+++ b/writerfilter/source/dmapper/SdtHelper.hxx
@@ -143,13 +143,13 @@ public:
{
m_sDataBindingPrefixMapping = sValue;
}
- OUString GetDataBindingPrefixMapping() const { return m_sDataBindingPrefixMapping; }
+ const OUString& GetDataBindingPrefixMapping() const { return m_sDataBindingPrefixMapping; }
void setDataBindingXPath(const OUString& sValue) { m_sDataBindingXPath = sValue; }
- OUString GetDataBindingXPath() const { return m_sDataBindingXPath; }
+ const OUString& GetDataBindingXPath() const { return m_sDataBindingXPath; }
void setDataBindingStoreItemID(const OUString& sValue) { m_sDataBindingStoreItemID = sValue; }
- OUString GetDataBindingStoreItemID() const { return m_sDataBindingStoreItemID; }
+ const OUString& GetDataBindingStoreItemID() const { return m_sDataBindingStoreItemID; }
void setDateFieldStartRange(const css::uno::Reference<css::text::XTextRange>& xStartRange)
{
@@ -192,18 +192,18 @@ public:
void SetChecked();
bool GetChecked() const;
void SetCheckedState(const OUString& rCheckedState);
- OUString GetCheckedState() const;
+ const OUString& GetCheckedState() const;
void SetUncheckedState(const OUString& rUncheckedState);
- OUString GetUncheckedState() const;
+ const OUString& GetUncheckedState() const;
/// Clear all collected attributes for further reuse
void clear();
void SetPlaceholderDocPart(const OUString& rPlaceholderDocPart);
- OUString GetPlaceholderDocPart() const;
+ const OUString& GetPlaceholderDocPart() const;
void SetColor(const OUString& rColor);
- OUString GetColor() const;
+ const OUString& GetColor() const;
};
} // namespace writerfilter::dmapper