summaryrefslogtreecommitdiff
path: root/sw/source/ui/vba/vbacontentcontrol.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-08-23 13:47:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-08-28 09:43:40 +0200
commit68e797402692c5c8abf1b2c4374e12a8d2707d07 (patch)
treed10643f2ce00efe809de0e9548a2c38943e2d11f /sw/source/ui/vba/vbacontentcontrol.cxx
parent5733cdba90b099637805648b193510268def74be (diff)
new loplugin:optionalbool
which warns against using the 'operator bool' conversion of std::optional<bool> which can lead to interesting bugs The bugs that this plugin have been submitted independantly, so this change is just using has_value() in relevant places. Change-Id: I259b837feeecddcb8cd1d7e5db1e85bf505907cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155978 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/ui/vba/vbacontentcontrol.cxx')
-rw-r--r--sw/source/ui/vba/vbacontentcontrol.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sw/source/ui/vba/vbacontentcontrol.cxx b/sw/source/ui/vba/vbacontentcontrol.cxx
index 8e8d8a12382b..dc4e4afc236a 100644
--- a/sw/source/ui/vba/vbacontentcontrol.cxx
+++ b/sw/source/ui/vba/vbacontentcontrol.cxx
@@ -481,20 +481,20 @@ sal_Int32 SwVbaContentControl::getLevel()
sal_Bool SwVbaContentControl::getLockContentControl()
{
std::optional<bool> oLock = m_pCC->GetLock(/*bControl=*/true);
- return oLock && *oLock;
+ return oLock.has_value() && *oLock;
}
void SwVbaContentControl::setLockContentControl(sal_Bool bSet)
{
std::optional<bool> oLock = m_pCC->GetLock(/*bControl=*/false);
- m_pCC->SetLock(/*bContents=*/oLock && *oLock, /*bControl=*/bSet);
+ m_pCC->SetLock(/*bContents=*/oLock.has_value() && *oLock, /*bControl=*/bSet);
}
sal_Bool SwVbaContentControl::getLockContents()
{
// If the theoretical design model says it is locked, then report as locked.
std::optional<bool> oLock = m_pCC->GetLock(/*bControl=*/false);
- if (oLock && *oLock)
+ if (oLock.has_value() && *oLock)
return true;
// Now check the real implementation.
@@ -513,7 +513,7 @@ void SwVbaContentControl::setLockContents(sal_Bool bSet)
{
// Set the lock both theoretically and actually.
std::optional<bool> oLock = m_pCC->GetLock(/*bControl=*/true);
- m_pCC->SetLock(/*bContents=*/bSet, /*bControl=*/oLock && *oLock);
+ m_pCC->SetLock(/*bContents=*/bSet, /*bControl=*/oLock.has_value() && *oLock);
// Checkbox/DropDown/Picture are normally locked in LO implementation - don't unlock them.
if (m_pCC->GetType() == SwContentControlType::CHECKBOX