convert C_ constants to typed_flags

Change-Id: Ia80cef26edce3e0a664044f3ca65d33998546d0f
This commit is contained in:
Noel Grandin
2016-09-21 16:09:53 +02:00
parent 12a2f6dfef
commit a1720f3a01

View File

@@ -75,10 +75,15 @@ using namespace ::com::sun::star;
using namespace ::xmloff::token; using namespace ::xmloff::token;
using namespace ::utl; using namespace ::utl;
static const int C_NONE = 0x00; enum class Flags {
static const int C_FULL_STOP = 0x01; NONE = 0x00,
static const int C_EXCLAMATION_MARK = 0x02; FullStop = 0x01,
static const int C_QUESTION_MARK = 0x04; ExclamationMark = 0x02,
QuestionMark = 0x04,
};
namespace o3tl {
template<> struct typed_flags<Flags> : is_typed_flags<Flags, 0x07> {};
}
static const sal_Unicode cNonBreakingSpace = 0xA0; static const sal_Unicode cNonBreakingSpace = 0xA0;
static const sal_Char pXMLImplWrdStt_ExcptLstStr[] = "WordExceptList.xml"; static const sal_Char pXMLImplWrdStt_ExcptLstStr[] = "WordExceptList.xml";
@@ -915,7 +920,7 @@ bool SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
if( !bAtStart ) if( !bAtStart )
{ {
bool bContinue = true; bool bContinue = true;
int nFlag = C_NONE; Flags nFlag = Flags::NONE;
do { do {
switch( *pStr ) switch( *pStr )
{ {
@@ -933,30 +938,30 @@ bool SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
//previous sentence, so don't autocapitalize this word //previous sentence, so don't autocapitalize this word
return false; return false;
} }
if( nFlag & C_FULL_STOP ) if( nFlag & Flags::FullStop )
return false; // no valid separator -> no replacement return false; // no valid separator -> no replacement
nFlag |= C_FULL_STOP; nFlag |= Flags::FullStop;
pExceptStt = pStr; pExceptStt = pStr;
} }
break; break;
case '!': case '!':
case 0xFF01 : case 0xFF01 :
{ {
if( nFlag & C_EXCLAMATION_MARK ) if( nFlag & Flags::ExclamationMark )
return false; // no valid separator -> no replacement return false; // no valid separator -> no replacement
nFlag |= C_EXCLAMATION_MARK; nFlag |= Flags::ExclamationMark;
} }
break; break;
case '?': case '?':
case 0xFF1F : case 0xFF1F :
{ {
if( nFlag & C_QUESTION_MARK) if( nFlag & Flags::QuestionMark)
return false; // no valid separator -> no replacement return false; // no valid separator -> no replacement
nFlag |= C_QUESTION_MARK; nFlag |= Flags::QuestionMark;
} }
break; break;
default: default:
if( !nFlag ) if( nFlag == Flags::NONE )
return false; // no valid separator -> no replacement return false; // no valid separator -> no replacement
else else
bContinue = false; bContinue = false;
@@ -968,7 +973,7 @@ bool SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
return false; // no valid separator -> no replacement return false; // no valid separator -> no replacement
} }
} while( bContinue ); } while( bContinue );
if( C_FULL_STOP != nFlag ) if( Flags::FullStop != nFlag )
pExceptStt = nullptr; pExceptStt = nullptr;
} }