convert STRING_TYP to scoped enum

Change-Id: If0bcc6e13864fd534eb65eda06b1bc2b5498cee9
This commit is contained in:
Noel Grandin
2016-11-24 13:22:18 +02:00
parent 63a6de2cab
commit c2775560ab
10 changed files with 23 additions and 23 deletions

View File

@@ -103,9 +103,9 @@ enum class ExportListType {
NONE, String, Filter, Item, Paired
};
#define STRING_TYP_TEXT 0x0010
#define STRING_TYP_QUICKHELPTEXT 0x0040
#define STRING_TYP_TITLE 0x0080
enum class StringType {
Text, QuickHelpText, Title
};
typedef ::std::vector< ResData* > ResStack;
@@ -152,7 +152,7 @@ private:
static void CleanValue( OString &rValue );
static OString GetText(const OString &rSource, int nToken);
void ResData2Output( MergeEntrys *pEntry, sal_uInt16 nType, const OString& rTextType );
void ResData2Output( MergeEntrys *pEntry, StringType nType, const OString& rTextType );
void MergeRest( ResData *pResData );
static void ConvertMergeContent( OString &rText );
static void ConvertExportContent( OString &rText );
@@ -204,7 +204,7 @@ public:
sTitle[ rId ] = rTitle;
bTitleFirst[ rId ] = true;
}
bool GetText( OString &rReturn, sal_uInt16 nTyp, const OString &nLangIndex, bool bDel = false );
bool GetText( OString &rReturn, StringType nTyp, const OString &nLangIndex, bool bDel = false );
/**
Generate QTZ string with ResData

View File

@@ -471,7 +471,7 @@ void CfgMerge::WorkOnResourceEnd()
sCur = aLanguages[ i ];
OString sContent;
pEntrys->GetText( sContent, STRING_TYP_TEXT, sCur , true );
pEntrys->GetText( sContent, StringType::Text, sCur , true );
if (
( !sCur.equalsIgnoreAsciiCase("en-US") ) && !sContent.isEmpty())
{

View File

@@ -996,7 +996,7 @@ void Export::ConvertExportContent( OString& rText )
rText = helper::unEscapeAll(rText,"\\n""\\t""\\\\""\\\"","\n""\t""\\""\"");
}
void Export::ResData2Output( MergeEntrys *pEntry, sal_uInt16 nType, const OString& rTextType )
void Export::ResData2Output( MergeEntrys *pEntry, StringType nType, const OString& rTextType )
{
bool bAddSemicolon = false;
bool bFirst = true;
@@ -1058,13 +1058,13 @@ void Export::MergeRest( ResData *pResData )
if ( pEntry )
{
if ( pResData->bText )
ResData2Output( pEntry, STRING_TYP_TEXT, pResData->sTextTyp );
ResData2Output( pEntry, StringType::Text, pResData->sTextTyp );
if ( pResData->bQuickHelpText )
ResData2Output( pEntry, STRING_TYP_QUICKHELPTEXT, OString("QuickHelpText") );
ResData2Output( pEntry, StringType::QuickHelpText, OString("QuickHelpText") );
if ( pResData->bTitle )
ResData2Output( pEntry, STRING_TYP_TITLE, OString("Title") );
ResData2Output( pEntry, StringType::Title, OString("Title") );
}
// Merge Lists
@@ -1143,7 +1143,7 @@ void Export::MergeRest( ResData *pResData )
if( pEntrys )
{
OString sText;
pEntrys->GetText( sText, STRING_TYP_TEXT, sCur );
pEntrys->GetText( sText, StringType::Text, sCur );
if( !sText.isEmpty())
{
ConvertMergeContent( sText );

View File

@@ -243,7 +243,7 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const OString& sCur , ResDa
pEntrys = pMergeDataFile->GetMergeEntrys( pResData );
if( pEntrys != nullptr)
{
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, true );
pEntrys->GetText( sNewText, StringType::Text, sCur, true );
if (helper::isWellFormedXML(XMLUtil::QuotHTML(sNewText)))
{
sNewdata = sSourceText.copy(0,nPreSpaces) + sNewText;

View File

@@ -241,7 +241,7 @@ bool LngParser::Merge(
if( !sLang.isEmpty() )
{
OString sNewText;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sLang, true );
pEntrys->GetText( sNewText, StringType::Text, sLang, true );
if( sLang == "qtz" )
continue;
@@ -279,7 +279,7 @@ bool LngParser::Merge(
{
OString sNewText;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, true );
pEntrys->GetText( sNewText, StringType::Text, sCur, true );
if( sCur == "qtz" )
continue;
if ( !sNewText.isEmpty() && sCur != "x-comment")

View File

@@ -92,25 +92,25 @@ ResData::ResData( const OString &rGId, const OString &rFilename)
bool MergeEntrys::GetText( OString &rReturn,
sal_uInt16 nTyp, const OString &nLangIndex, bool bDel )
StringType nTyp, const OString &nLangIndex, bool bDel )
{
bool bReturn = true;
switch ( nTyp ) {
case STRING_TYP_TEXT :
case StringType::Text :
rReturn = sText[ nLangIndex ];
if ( bDel )
sText[ nLangIndex ] = "";
bReturn = bTextFirst[ nLangIndex ];
bTextFirst[ nLangIndex ] = false;
break;
case STRING_TYP_QUICKHELPTEXT :
case StringType::QuickHelpText :
rReturn = sQuickHelpText[ nLangIndex ];
if ( bDel )
sQuickHelpText[ nLangIndex ] = "";
bReturn = bQuickHelpTextFirst[ nLangIndex ];
bQuickHelpTextFirst[ nLangIndex ] = false;
break;
case STRING_TYP_TITLE :
case StringType::Title :
rReturn = sTitle[ nLangIndex ];
if ( bDel )
sTitle[ nLangIndex ] = "";

View File

@@ -205,7 +205,7 @@ void PropParser::Merge( const OString &rMergeSrc, const OString &rDestinationFil
MergeEntrys* pEntrys = pMergeDataFile->GetMergeEntrys( &aResData );
if( pEntrys )
{
pEntrys->GetText( sNewText, STRING_TYP_TEXT, m_sLang );
pEntrys->GetText( sNewText, StringType::Text, m_sLang );
}
}
if( !sNewText.isEmpty() )

View File

@@ -168,7 +168,7 @@ namespace
pMergeDataFile->GetMergeEntrys( &aResData );
if( pEntrys )
{
pEntrys->GetText( sNewText, STRING_TYP_TEXT, rLang );
pEntrys->GetText( sNewText, StringType::Text, rLang );
}
}
else if( rLang == "qtz" )

View File

@@ -108,7 +108,7 @@ namespace
MergeEntrys* pEntrys = aI->second->GetMergeEntries();
OString sOut;
pEntrys->GetText( sOut, STRING_TYP_TEXT, rLanguage );
pEntrys->GetText( sOut, StringType::Text, rLanguage );
if (sOut.isEmpty())
continue;

View File

@@ -411,7 +411,7 @@ void XRMResMerge::WorkOnDesc(
OString sContent;
if ( !sCur.equalsIgnoreAsciiCase("en-US") &&
( pEntrys->GetText(
sContent, STRING_TYP_TEXT, sCur, true )) &&
sContent, StringType::Text, sCur, true )) &&
!sContent.isEmpty())
{
OString sText( sContent );
@@ -499,7 +499,7 @@ void XRMResMerge::EndOfText(
OString sContent;
if (!sCur.equalsIgnoreAsciiCase("en-US") &&
( pEntrys->GetText(
sContent, STRING_TYP_TEXT, sCur, true )) &&
sContent, StringType::Text, sCur, true )) &&
!sContent.isEmpty() &&
helper::isWellFormedXML( sContent ))
{