[Libreoffice-commits] core.git: sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Thu Sep 8 09:31:16 UTC 2016
sw/source/core/doc/DocumentRedlineManager.cxx | 28 ++++++++------------------
1 file changed, 9 insertions(+), 19 deletions(-)
New commits:
commit 4e5ec21c5191dc6c90c51ae786ac692e804c1fb7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Sep 8 11:30:35 2016 +0200
workaround lack of constexpr
when dealing with switch statements and o3tl::typed_flags
Change-Id: Ia72a3ff643ea1c41f9b328e980ba51f3cdfdf582
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 10ba317..38a4c77 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -603,22 +603,17 @@ void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode )
// and then hide/display everything
void (SwRangeRedline::*pFnc)(sal_uInt16, size_t) = nullptr;
- switch( RedlineFlags::ShowMask & eMode )
- {
- case RedlineFlags::ShowInsert | RedlineFlags::ShowDelete :
+ RedlineFlags eShowMode = RedlineFlags::ShowMask & eMode;
+ if (eShowMode == (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete))
pFnc = &SwRangeRedline::Show;
- break;
- case RedlineFlags::ShowInsert:
+ else if (eShowMode == RedlineFlags::ShowInsert)
pFnc = &SwRangeRedline::Hide;
- break;
- case RedlineFlags::ShowDelete:
+ else if (eShowMode == RedlineFlags::ShowDelete)
pFnc = &SwRangeRedline::ShowOriginal;
- break;
-
- default:
+ else
+ {
pFnc = &SwRangeRedline::Hide;
eMode |= RedlineFlags::ShowInsert;
- break;
}
CheckAnchoredFlyConsistency(m_rDoc);
@@ -1781,16 +1776,11 @@ void DocumentRedlineManager::CompressRedlines()
CHECK_REDLINE( *this )
void (SwRangeRedline::*pFnc)(sal_uInt16, size_t) = nullptr;
- switch( RedlineFlags::ShowMask & meRedlineFlags )
- {
- case RedlineFlags::ShowInsert | RedlineFlags::ShowDelete:
+ RedlineFlags eShow = RedlineFlags::ShowMask & meRedlineFlags;
+ if( eShow == (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete))
pFnc = &SwRangeRedline::Show;
- break;
- case RedlineFlags::ShowInsert:
+ else if (eShow == RedlineFlags::ShowInsert)
pFnc = &SwRangeRedline::Hide;
- break;
- default: break;
- }
// Try to merge identical ones
for( size_t n = 1; n < mpRedlineTable->size(); ++n )
More information about the Libreoffice-commits
mailing list