summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-01-07 15:57:43 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-01-08 10:04:05 +0100
commit60150ef4b8fc1d0a30f20c3d9ed6ba0725da16a5 (patch)
treef88aff4014d4055b9a459676ad1f597556326de4
parent08c4ed96cc94df4a3859aa167e92e6f6da9c2ce7 (diff)
cid#1560054 use RVO
Change-Id: I04644c9ca78930d42289368b9a596f44a14b7012 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161746 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--UnoControls/source/controls/OConnectionPointContainerHelper.cxx15
-rw-r--r--UnoControls/source/controls/OConnectionPointHelper.cxx15
-rw-r--r--UnoControls/source/controls/framecontrol.cxx22
-rw-r--r--UnoControls/source/controls/progressbar.cxx15
-rw-r--r--UnoControls/source/controls/progressmonitor.cxx12
-rw-r--r--extensions/source/propctrlr/cellbindinghelper.cxx12
-rw-r--r--extensions/source/propctrlr/eformshelper.cxx11
-rw-r--r--xmloff/source/forms/formcellbinding.cxx12
8 files changed, 39 insertions, 75 deletions
diff --git a/UnoControls/source/controls/OConnectionPointContainerHelper.cxx b/UnoControls/source/controls/OConnectionPointContainerHelper.cxx
index bf687a0df5d6..110174812a3e 100644
--- a/UnoControls/source/controls/OConnectionPointContainerHelper.cxx
+++ b/UnoControls/source/controls/OConnectionPointContainerHelper.cxx
@@ -46,7 +46,6 @@ OConnectionPointContainerHelper::~OConnectionPointContainerHelper()
}
// XInterface
-
Any SAL_CALL OConnectionPointContainerHelper::queryInterface( const Type& aType )
{
// Attention:
@@ -58,18 +57,15 @@ Any SAL_CALL OConnectionPointContainerHelper::queryInterface( const Type& aType
)
);
- // If searched interface not supported by this class ...
- if ( !aReturn.hasValue() )
- {
- // ... ask baseclasses.
- aReturn = OWeakObject::queryInterface( aType );
- }
+ if (aReturn.hasValue())
+ return aReturn;
- return aReturn;
+ // If searched interface not supported by this class ...
+ // ... ask baseclasses.
+ return OWeakObject::queryInterface( aType );
}
// XInterface
-
void SAL_CALL OConnectionPointContainerHelper::acquire() noexcept
{
// Attention:
@@ -80,7 +76,6 @@ void SAL_CALL OConnectionPointContainerHelper::acquire() noexcept
}
// XInterface
-
void SAL_CALL OConnectionPointContainerHelper::release() noexcept
{
// Attention:
diff --git a/UnoControls/source/controls/OConnectionPointHelper.cxx b/UnoControls/source/controls/OConnectionPointHelper.cxx
index b6ddaaa513a0..b17edc2ba3da 100644
--- a/UnoControls/source/controls/OConnectionPointHelper.cxx
+++ b/UnoControls/source/controls/OConnectionPointHelper.cxx
@@ -52,7 +52,6 @@ OConnectionPointHelper::~OConnectionPointHelper()
}
// XInterface
-
Any SAL_CALL OConnectionPointHelper::queryInterface( const Type& aType )
{
// Attention:
@@ -64,18 +63,15 @@ Any SAL_CALL OConnectionPointHelper::queryInterface( const Type& aType )
)
);
- // If searched interface not supported by this class ...
- if ( !aReturn.hasValue() )
- {
- // ... ask baseclasses.
- aReturn = OWeakObject::queryInterface( aType );
- }
+ if (aReturn.hasValue())
+ return aReturn;
- return aReturn;
+ // If searched interface not supported by this class ...
+ // ... ask baseclasses.
+ return OWeakObject::queryInterface(aType);
}
// XInterface
-
void SAL_CALL OConnectionPointHelper::acquire() noexcept
{
// Attention:
@@ -86,7 +82,6 @@ void SAL_CALL OConnectionPointHelper::acquire() noexcept
}
// XInterface
-
void SAL_CALL OConnectionPointHelper::release() noexcept
{
// Attention:
diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx
index f58c77a3b76a..ab841d906fde 100644
--- a/UnoControls/source/controls/framecontrol.cxx
+++ b/UnoControls/source/controls/framecontrol.cxx
@@ -70,7 +70,6 @@ FrameControl::~FrameControl()
}
// XInterface
-
Any SAL_CALL FrameControl::queryInterface( const Type& rType )
{
// Ask for my own supported interfaces ...
@@ -81,22 +80,18 @@ Any SAL_CALL FrameControl::queryInterface( const Type& rType )
)
);
- // If searched interface not supported by this class ...
- if ( !aReturn.hasValue() )
- {
- // ... ask baseclasses.
- aReturn = OPropertySetHelper::queryInterface( rType );
- if ( !aReturn.hasValue() )
- {
- aReturn = BaseControl::queryInterface( rType );
- }
- }
+ if (aReturn.hasValue())
+ return aReturn;
- return aReturn;
+ // If searched interface not supported by this class ...
+ // ... ask baseclasses.
+ aReturn = OPropertySetHelper::queryInterface(rType);
+ if (aReturn.hasValue())
+ return aReturn;
+ return BaseControl::queryInterface(rType);
}
// XInterface
-
void SAL_CALL FrameControl::acquire() noexcept
{
// Attention:
@@ -107,7 +102,6 @@ void SAL_CALL FrameControl::acquire() noexcept
}
// XInterface
-
void SAL_CALL FrameControl::release() noexcept
{
// Attention:
diff --git a/UnoControls/source/controls/progressbar.cxx b/UnoControls/source/controls/progressbar.cxx
index 6ba8874fbb88..1cf0bc08a36f 100644
--- a/UnoControls/source/controls/progressbar.cxx
+++ b/UnoControls/source/controls/progressbar.cxx
@@ -52,7 +52,6 @@ ProgressBar::~ProgressBar()
}
// XInterface
-
Any SAL_CALL ProgressBar::queryInterface( const Type& rType )
{
// Ask for my own supported interfaces ...
@@ -63,18 +62,15 @@ Any SAL_CALL ProgressBar::queryInterface( const Type& rType )
)
);
- // If searched interface not supported by this class ...
- if ( !aReturn.hasValue() )
- {
- // ... ask baseclasses.
- aReturn = BaseControl::queryInterface( rType );
- }
+ if (aReturn.hasValue())
+ return aReturn;
- return aReturn;
+ // If searched interface not supported by this class ...
+ // ... ask baseclasses.
+ return BaseControl::queryInterface(rType);
}
// XInterface
-
void SAL_CALL ProgressBar::acquire() noexcept
{
// Attention:
@@ -85,7 +81,6 @@ void SAL_CALL ProgressBar::acquire() noexcept
}
// XInterface
-
void SAL_CALL ProgressBar::release() noexcept
{
// Attention:
diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx
index 7df767760323..d58518e0e8ff 100644
--- a/UnoControls/source/controls/progressmonitor.cxx
+++ b/UnoControls/source/controls/progressmonitor.cxx
@@ -121,14 +121,12 @@ Any SAL_CALL ProgressMonitor::queryInterface( const Type& rType )
)
);
- // If searched interface not supported by this class ...
- if ( !aReturn.hasValue() )
- {
- // ... ask baseclasses.
- aReturn = BaseControl::queryInterface( rType );
- }
+ if (aReturn.hasValue())
+ return aReturn;
- return aReturn;
+ // If searched interface not supported by this class ...
+ // ... ask baseclasses.
+ return BaseControl::queryInterface(rType);
}
// XInterface
diff --git a/extensions/source/propctrlr/cellbindinghelper.cxx b/extensions/source/propctrlr/cellbindinghelper.cxx
index a9ab9ce745da..40ead3629f09 100644
--- a/extensions/source/propctrlr/cellbindinghelper.cxx
+++ b/extensions/source/propctrlr/cellbindinghelper.cxx
@@ -496,7 +496,6 @@ namespace pcr
return bDoes;
}
-
Reference< XValueBinding > CellBindingHelper::getCurrentBinding( ) const
{
Reference< XValueBinding > xBinding;
@@ -506,17 +505,14 @@ namespace pcr
return xBinding;
}
-
Reference< XListEntrySource > CellBindingHelper::getCurrentListSource( ) const
{
- Reference< XListEntrySource > xSource;
Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY );
- if ( xSink.is() )
- xSource = xSink->getListEntrySource();
- return xSource;
+ if (xSink.is())
+ return xSink->getListEntrySource();
+ return Reference<XListEntrySource>();
}
-
void CellBindingHelper::setBinding( const Reference< XValueBinding >& _rxBinding )
{
Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY );
@@ -525,7 +521,6 @@ namespace pcr
xBindable->setValueBinding( _rxBinding );
}
-
void CellBindingHelper::setListSource( const Reference< XListEntrySource >& _rxSource )
{
Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY );
@@ -534,7 +529,6 @@ namespace pcr
xSink->setListEntrySource( _rxSource );
}
-
} // namespace pcr
diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx
index 40aceed5dfe7..bcc0b25987c8 100644
--- a/extensions/source/propctrlr/eformshelper.cxx
+++ b/extensions/source/propctrlr/eformshelper.cxx
@@ -374,7 +374,6 @@ namespace pcr
return xModel;
}
-
OUString EFormsHelper::getCurrentFormModelName() const
{
OUString sModelName;
@@ -391,7 +390,6 @@ namespace pcr
return sModelName;
}
-
Reference< XPropertySet > EFormsHelper::getCurrentBinding() const
{
Reference< XPropertySet > xBinding;
@@ -409,7 +407,6 @@ namespace pcr
return xBinding;
}
-
OUString EFormsHelper::getCurrentBindingName() const
{
OUString sBindingName;
@@ -429,19 +426,18 @@ namespace pcr
Reference< XListEntrySource > EFormsHelper::getCurrentListSourceBinding() const
{
- Reference< XListEntrySource > xReturn;
try
{
Reference< XListEntrySink > xAsSink( m_xControlModel, UNO_QUERY );
OSL_ENSURE( xAsSink.is(), "EFormsHelper::getCurrentListSourceBinding: you should have used isListEntrySink before!" );
- if ( xAsSink.is() )
- xReturn = xAsSink->getListEntrySource();
+ if (xAsSink.is())
+ return xAsSink->getListEntrySource();
}
catch( const Exception& )
{
TOOLS_WARN_EXCEPTION( "extensions.propctrlr", "EFormsHelper::getCurrentListSourceBinding" );
}
- return xReturn;
+ return Reference<XListEntrySource>();
}
@@ -460,7 +456,6 @@ namespace pcr
}
}
-
void EFormsHelper::setBinding( const Reference< css::beans::XPropertySet >& _rxBinding )
{
if ( !m_xBindableControl.is() )
diff --git a/xmloff/source/forms/formcellbinding.cxx b/xmloff/source/forms/formcellbinding.cxx
index 74075eaa0502..f9b352d03018 100644
--- a/xmloff/source/forms/formcellbinding.cxx
+++ b/xmloff/source/forms/formcellbinding.cxx
@@ -332,20 +332,18 @@ bool FormCellBindingHelper::doesComponentSupport( const Reference< XInterface >&
Reference< XValueBinding > FormCellBindingHelper::getCurrentBinding( ) const
{
- Reference< XValueBinding > xBinding;
Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY );
if ( xBindable.is() )
- xBinding = xBindable->getValueBinding();
- return xBinding;
+ return xBindable->getValueBinding();
+ return Reference<XValueBinding>();
}
Reference< XListEntrySource > FormCellBindingHelper::getCurrentListSource( ) const
{
- Reference< XListEntrySource > xSource;
Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY );
- if ( xSink.is() )
- xSource = xSink->getListEntrySource();
- return xSource;
+ if (xSink.is())
+ return xSink->getListEntrySource();
+ return Reference<XListEntrySource>();
}
void FormCellBindingHelper::setBinding( const Reference< XValueBinding >& _rxBinding )