summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcompilerplugins/clang/unusedenumconstants.py1
-rw-r--r--starmath/inc/cursor.hxx22
-rw-r--r--starmath/source/cursor.cxx71
-rw-r--r--starmath/source/view.cxx12
4 files changed, 22 insertions, 84 deletions
diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py
index 70ea2af1e114..81d4b089dc62 100755
--- a/compilerplugins/clang/unusedenumconstants.py
+++ b/compilerplugins/clang/unusedenumconstants.py
@@ -110,6 +110,7 @@ for d in definitionSet:
"svx/inc/galobj.hxx", # GalSoundType
"include/svx/msdffdef.hxx",
"include/svtools/rtftoken.h", # RTF_TOKEN_IDS
+ "starmath/source/mathtype.hxx", # MathType::MTOKENS
# unit test code
"cppu/source/uno/check.cxx",
# general weird nonsense going on
diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx
index 33f3718a0213..c5c99ef1f410 100644
--- a/starmath/inc/cursor.hxx
+++ b/starmath/inc/cursor.hxx
@@ -43,27 +43,13 @@ enum SmFormulaElement{
};
/** Bracket types that can be inserted */
-enum SmBracketType {
- /** None brackets, left command "none" */
- NoneBrackets,
+enum class SmBracketType {
/** Round brackets, left command "(" */
- RoundBrackets,
+ Round,
/**Square brackets, left command "[" */
- SquareBrackets,
- /** Double square brackets, left command "ldbracket" */
- DoubleSquareBrackets,
- /** Line brackets, left command "lline" */
- LineBrackets,
- /** Double line brackets, left command "ldline" */
- DoubleLineBrackets,
+ Square,
/** Curly brackets, left command "lbrace" */
- CurlyBrackets,
- /** Angle brackets, left command "langle" */
- AngleBrackets,
- /** Ceiling brackets, left command "lceil" */
- CeilBrackets,
- /** Floor brackets, left command "lfloor" */
- FloorBrackets
+ Curly,
};
/** A list of nodes */
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index db788d470ef9..1cd50ff54114 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -716,69 +716,27 @@ SmNode *SmCursor::CreateBracket(SmBracketType eBracketType, bool bIsLeft) {
SmToken aTok;
if(bIsLeft){
switch(eBracketType){
- case NoneBrackets:
- aTok = SmToken(TNONE, '\0', "none", TG::LBrace | TG::RBrace, 0);
- break;
- case RoundBrackets:
+ case SmBracketType::Round:
aTok = SmToken(TLPARENT, MS_LPARENT, "(", TG::LBrace, 5);
break;
- case SquareBrackets:
+ case SmBracketType::Square:
aTok = SmToken(TLBRACKET, MS_LBRACKET, "[", TG::LBrace, 5);
break;
- case DoubleSquareBrackets:
- aTok = SmToken(TLDBRACKET, MS_LDBRACKET, "ldbracket", TG::LBrace, 5);
- break;
- case LineBrackets:
- aTok = SmToken(TLLINE, MS_VERTLINE, "lline", TG::LBrace, 5);
- break;
- case DoubleLineBrackets:
- aTok = SmToken(TLDLINE, MS_DVERTLINE, "ldline", TG::LBrace, 5);
- break;
- case CurlyBrackets:
+ case SmBracketType::Curly:
aTok = SmToken(TLBRACE, MS_LBRACE, "lbrace", TG::LBrace, 5);
break;
- case AngleBrackets:
- aTok = SmToken(TLANGLE, MS_LMATHANGLE, "langle", TG::LBrace, 5);
- break;
- case CeilBrackets:
- aTok = SmToken(TLCEIL, MS_LCEIL, "lceil", TG::LBrace, 5);
- break;
- case FloorBrackets:
- aTok = SmToken(TLFLOOR, MS_LFLOOR, "lfloor", TG::LBrace, 5);
- break;
}
} else {
switch(eBracketType) {
- case NoneBrackets:
- aTok = SmToken(TNONE, '\0', "none", TG::LBrace | TG::RBrace, 0);
- break;
- case RoundBrackets:
+ case SmBracketType::Round:
aTok = SmToken(TRPARENT, MS_RPARENT, ")", TG::RBrace, 5);
break;
- case SquareBrackets:
+ case SmBracketType::Square:
aTok = SmToken(TRBRACKET, MS_RBRACKET, "]", TG::RBrace, 5);
break;
- case DoubleSquareBrackets:
- aTok = SmToken(TRDBRACKET, MS_RDBRACKET, "rdbracket", TG::RBrace, 5);
- break;
- case LineBrackets:
- aTok = SmToken(TRLINE, MS_VERTLINE, "rline", TG::RBrace, 5);
- break;
- case DoubleLineBrackets:
- aTok = SmToken(TRDLINE, MS_DVERTLINE, "rdline", TG::RBrace, 5);
- break;
- case CurlyBrackets:
+ case SmBracketType::Curly:
aTok = SmToken(TRBRACE, MS_RBRACE, "rbrace", TG::RBrace, 5);
break;
- case AngleBrackets:
- aTok = SmToken(TRANGLE, MS_RMATHANGLE, "rangle", TG::RBrace, 5);
- break;
- case CeilBrackets:
- aTok = SmToken(TRCEIL, MS_RCEIL, "rceil", TG::RBrace, 5);
- break;
- case FloorBrackets:
- aTok = SmToken(TRFLOOR, MS_RFLOOR, "rfloor", TG::RBrace, 5);
- break;
}
}
SmNode* pRetVal = new SmMathSymbolNode(aTok);
@@ -1359,8 +1317,8 @@ void SmCursor::FinishEdit(SmNodeList* pLineList,
SmToken aTok(TLEFT, '\0', "left", TG::NONE, 5);
SmBraceNode *pBrace = new SmBraceNode(aTok);
pBrace->SetScaleMode(SCALE_HEIGHT);
- SmNode *pLeft = CreateBracket(RoundBrackets, true),
- *pRight = CreateBracket(RoundBrackets, false);
+ SmNode *pLeft = CreateBracket(SmBracketType::Round, true),
+ *pRight = CreateBracket(SmBracketType::Round, false);
SmBracebodyNode *pBody = new SmBracebodyNode(SmToken());
pBody->SetSubNodes(pLine, nullptr);
pBrace->SetSubNodes(pLeft, pBody, pRight);
@@ -1509,16 +1467,9 @@ bool SmCursor::IsAtTailOfBracket(SmBracketType eBracketType, SmBraceNode** ppBra
// Check if the closing brace matches eBracketType.
SmTokenType eClosingTokenType = pClosingNode->GetToken().eType;
switch (eBracketType) {
- case NoneBrackets: if (eClosingTokenType != TNONE) { return false; } break;
- case RoundBrackets: if (eClosingTokenType != TRPARENT) { return false; } break;
- case SquareBrackets: if (eClosingTokenType != TRBRACKET) { return false; } break;
- case DoubleSquareBrackets: if (eClosingTokenType != TRDBRACKET) { return false; } break;
- case LineBrackets: if (eClosingTokenType != TRLINE) { return false; } break;
- case DoubleLineBrackets: if (eClosingTokenType != TRDLINE) { return false; } break;
- case CurlyBrackets: if (eClosingTokenType != TRBRACE) { return false; } break;
- case AngleBrackets: if (eClosingTokenType != TRANGLE) { return false; } break;
- case CeilBrackets: if (eClosingTokenType != TRCEIL) { return false; } break;
- case FloorBrackets: if (eClosingTokenType != TRFLOOR) { return false; } break;
+ case SmBracketType::Round: if (eClosingTokenType != TRPARENT) { return false; } break;
+ case SmBracketType::Square: if (eClosingTokenType != TRBRACKET) { return false; } break;
+ case SmBracketType::Curly: if (eClosingTokenType != TRBRACE) { return false; } break;
default:
return false;
}
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 0e93bdd52974..57aed30c893c 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -499,20 +499,20 @@ void SmGraphicWindow::KeyInput(const KeyEvent& rKEvt)
}else if(code == '^') {
rCursor.InsertSubSup(RSUP);
}else if(code == '(') {
- rCursor.InsertBrackets(RoundBrackets);
+ rCursor.InsertBrackets(SmBracketType::Round);
}else if(code == '[') {
- rCursor.InsertBrackets(SquareBrackets);
+ rCursor.InsertBrackets(SmBracketType::Square);
}else if(code == '{') {
- rCursor.InsertBrackets(CurlyBrackets);
+ rCursor.InsertBrackets(SmBracketType::Curly);
}else if(code == '!') {
rCursor.InsertElement(FactorialElement);
}else if(code == '%') {
rCursor.InsertElement(PercentElement);
- }else if(code == ')' && rCursor.IsAtTailOfBracket(RoundBrackets, &pBraceNode)) {
+ }else if(code == ')' && rCursor.IsAtTailOfBracket(SmBracketType::Round, &pBraceNode)) {
rCursor.MoveAfterBracket(pBraceNode);
- }else if(code == ']' && rCursor.IsAtTailOfBracket(SquareBrackets, &pBraceNode)) {
+ }else if(code == ']' && rCursor.IsAtTailOfBracket(SmBracketType::Square, &pBraceNode)) {
rCursor.MoveAfterBracket(pBraceNode);
- }else if(code == '}' && rCursor.IsAtTailOfBracket(CurlyBrackets, &pBraceNode)) {
+ }else if(code == '}' && rCursor.IsAtTailOfBracket(SmBracketType::Curly, &pBraceNode)) {
rCursor.MoveAfterBracket(pBraceNode);
}else{
if(code != 0){