summaryrefslogtreecommitdiff
path: root/starmath/inc
diff options
context:
space:
mode:
authorDante DM <dante19031999@gmail.com>2020-10-21 15:43:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-03 20:57:12 +0100
commit351f620baa64ecabd4f7f93ec0139724766c7c59 (patch)
treea245aa3e7102f7b3e00f817f35ef73f238030aa6 /starmath/inc
parent8ef56c7cb4008c6290da82b305ec2deefc8d94d5 (diff)
Added hexadecimal number and color support for starmath.
Adds hidden command on guy hex number wich allows to use numbers of base 16 and also 0-9-A-Z. Added support for custom RGB colors on hexadecimal on starmath via command color hex colornumber. Improved RGB color handle on starmath. Changed the way the color is handled on starmath. Colors keywords won't give errors. They have been moved to an independent tokens list so starmath will load tokens faster. Changed the way the font size is handeled on starmath. This won't change anything, just related with the structural change. Implemented premature support for rgba colors on math. This change only adds the possibility on the parser, node and node visitors. For now end-user can not access it since in a future there'll be work to do on the renderer to add full support. Added hex entrie on the docking window. Changes made on Color.hxx, will save some nanoseconds on build. If you are interested on allowing rgba and do the job on the renderer (and all the other stuff than there are a lot of .GetRGBColor()), you may find usefull color hex colnum. Since transparency setting is ignored, the hexadecimal color has hidden support for it since did not instore the max value (255 + 255*256 + 255*256*256) and everything is loaded into the sal_uInt32. Change-Id: Iafb38b142fffa329ca468e3d62643154fcdd2bbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104630 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath/inc')
-rw-r--r--starmath/inc/error.hxx3
-rw-r--r--starmath/inc/parse.hxx3
-rw-r--r--starmath/inc/strings.hrc5
-rw-r--r--starmath/inc/strings.hxx2
-rw-r--r--starmath/inc/token.hxx28
5 files changed, 26 insertions, 15 deletions
diff --git a/starmath/inc/error.hxx b/starmath/inc/error.hxx
index a05123d6e080..d8179da593d5 100644
--- a/starmath/inc/error.hxx
+++ b/starmath/inc/error.hxx
@@ -39,7 +39,8 @@ enum class SmParseError
FontExpected,
SizeExpected,
DoubleAlign,
- DoubleSubsupscript
+ DoubleSubsupscript,
+ NumberExpected
};
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index 519a90041f65..4f1e3024ccb3 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -83,6 +83,8 @@ class SmParser
SmParser& operator=(const SmParser&) = delete;
void NextToken();
+ void NextTokenColor();
+ void NextTokenFontSize();
sal_Int32 GetTokenIndex() const { return m_nTokenIndex; }
void Replace( sal_Int32 nPos, sal_Int32 nLen, const OUString &rText );
@@ -140,7 +142,6 @@ public:
const SmErrorDesc* NextError();
const SmErrorDesc* PrevError();
const SmErrorDesc* GetError();
- static const SmTokenTableEntry* GetTokenTableEntry( const OUString &rName );
const std::set< OUString >& GetUsedSymbols() const { return m_aUsedSymbols; }
};
diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc
index 64144759f5cc..50adc4a3e042 100644
--- a/starmath/inc/strings.hrc
+++ b/starmath/inc/strings.hrc
@@ -195,6 +195,8 @@
#define RID_COLORX_TEAL_HELP NC_("RID_COLORX_TEAL_HELP", "Color Teal" )
#define RID_COLORX_YELLOW_HELP NC_("RID_COLORX_YELLOW_HELP", "Color Yellow" )
#define RID_COLORX_RGB_HELP NC_("RID_COLORX_RGB_HELP", "Color RGB" )
+#define RID_COLORX_RGBA_HELP NC_("RID_COLORX_RGBA_HELP", "Color RGBA" )
+#define RID_COLORX_HEX_HELP NC_("RID_COLORX_HEX_HELP", "Color hexadecimal" )
#define RID_LRGROUPX_HELP NC_("RID_LRGROUPX_HELP", "Group Brackets" )
#define RID_LRPARENTX_HELP NC_("RID_LRPARENTX_HELP", "Round Brackets" )
#define RID_LRBRACKETX_HELP NC_("RID_LRBRACKETX_HELP", "Square Brackets" )
@@ -317,6 +319,8 @@
#define STR_TEAL NC_("STR_TEAL", "teal" )
#define STR_YELLOW NC_("STR_YELLOW", "yellow" )
#define STR_RGB NC_("STR_RGB", "rgb" )
+#define STR_RGBA NC_("STR_RGBA", "rgba" )
+#define STR_HEX NC_("STR_HEX", "hex" )
#define STR_HIDE NC_("STR_HIDE", "hide" )
#define STR_SIZE NC_("STR_SIZE", "size" )
#define STR_FONT NC_("STR_FONT", "font" )
@@ -339,6 +343,7 @@
#define RID_ERR_SIZEEXPECTED NC_("RID_ERR_SIZEEXPECTED", "'size' followed by an unexpected token" )
#define RID_ERR_DOUBLEALIGN NC_("RID_ERR_DOUBLEALIGN", "Double aligning is not allowed" )
#define RID_ERR_DOUBLESUBSUPSCRIPT NC_("RID_ERR_DOUBLESUBSUPSCRIPT", "Double sub/superscripts is not allowed" )
+#define RID_ERR_NUMBEREXPECTED NC_("RID_ERR_NUMBEREXPECTED", "Expected number" )
#define RID_ERR_POUNDEXPECTED NC_("RID_ERR_POUNDEXPECTED", "'#' expected" )
#define RID_ERR_COLOREXPECTED NC_("RID_ERR_COLOREXPECTED", "Color required" )
#define RID_ERR_RIGHTEXPECTED NC_("RID_ERR_RIGHTEXPECTED", "'RIGHT' expected" )
diff --git a/starmath/inc/strings.hxx b/starmath/inc/strings.hxx
index fb00ac2f4782..2daf463afd25 100644
--- a/starmath/inc/strings.hxx
+++ b/starmath/inc/strings.hxx
@@ -188,6 +188,8 @@
#define RID_COLORX_TEAL "color teal {<?>} "
#define RID_COLORX_YELLOW "color yellow {<?>} "
#define RID_COLORX_RGB "color rgb 0 0 0 {<?>} "
+#define RID_COLORX_RGBA "color rgba 0 0 0 0 {<?>} "
+#define RID_COLORX_HEX "color hex 000000 {<?>} "
#define RID_LRGROUPX "{<?>} "
#define RID_LRPARENTX "(<?>) "
#define RID_LRBRACKETX "[<?>] "
diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx
index 1403e96987a2..a58e28d42be8 100644
--- a/starmath/inc/token.hxx
+++ b/starmath/inc/token.hxx
@@ -64,14 +64,12 @@ enum SmTokenType
TDOTSDIAG, TDOTSUP, TDOTSDOWN, TACUTE, TBAR,
TBREVE, TCHECK, TCIRCLE, TDOT, TDDOT,
TDDDOT, TGRAVE, THAT, TTILDE, TVEC,
- THARPOON,
TUNDERLINE, TOVERLINE, TOVERSTRIKE, TITALIC, TNITALIC,
TBOLD, TNBOLD, TPHANTOM, TFONT, TSIZE,
TCOLOR, TALIGNL, TALIGNC, TALIGNR, TLEFT,
TRIGHT, TLANGLE, TLBRACE, TLLINE, TLDLINE,
TLCEIL, TLFLOOR, TNONE, TMLINE, TRANGLE,
TRBRACE, TRLINE, TRDLINE, TRCEIL, TRFLOOR,
- TSIN, TCOS, TTAN, TCOT, TFUNC,
TSTACK, TMATRIX, TDPOUND, TPLACE,
TTEXT, TNUMBER, TCHARACTER, TIDENT, TNEQ,
TEQUIV, TDEF, TPROP, TSIM, TSIMEQ,
@@ -81,12 +79,7 @@ enum SmTokenType
TODIVIDE, TTRANSL, TTRANSR, TIINT, TIIINT,
TLINT, TLLINT, TLLLINT, TPROD, TCOPROD,
TFORALL, TEXISTS, TNOTEXISTS, TLIM, TNABLA,
- TTOWARD, TSINH, TCOSH, TTANH, TCOTH,
- TASIN, TACOS, TATAN, TLN, TLOG,
- TUOPER, TBOPER, TBLACK, TWHITE, TRED,
- TGREEN, TBLUE, TCYAN, TMAGENTA, TYELLOW,
- TFIXED, TSANS, TSERIF, TASINH,
- TACOSH, TATANH, TACOTH, TACOT, TEXP,
+ TUOPER, TBOPER, TFIXED, TSANS, TSERIF,
TCDOT, TODOT, TLESLANT, TGESLANT, TNSUBSET,
TNSUPSET, TNSUBSETEQ, TNSUPSETEQ, TPARTIAL, TNEG,
TNI, TBACKEPSILON, TALEPH, TIM, TRE,
@@ -96,13 +89,22 @@ enum SmTokenType
TLAMBDABAR, TLEFTARROW, TRIGHTARROW, TUPARROW, TDOWNARROW,
TDIVIDES, TSETN, TSETZ, TSETQ,
TSETR, TSETC, TWIDEVEC, TWIDEHARPOON, TWIDETILDE,
- TWIDEHAT,
TWIDESLASH, TWIDEBACKSLASH, TLDBRACKET, TRDBRACKET, TNOSPACE,
TUNKNOWN, TPRECEDES, TSUCCEEDS, TPRECEDESEQUAL, TSUCCEEDSEQUAL,
- TPRECEDESEQUIV, TSUCCEEDSEQUIV, TNOTPRECEDES, TNOTSUCCEEDS, TSILVER,
- TGRAY, TMAROON, TPURPLE, TLIME, TOLIVE,
- TNAVY, TTEAL, TAQUA, TFUCHSIA, TINTD,
- TRGB, TLAPLACE, TFOURIER
+ TPRECEDESEQUIV, TSUCCEEDSEQUIV, TNOTPRECEDES, TNOTSUCCEEDS, THARPOON,
+ TINTD, TLAPLACE, TFOURIER, TTOWARD, TWIDEHAT,
+ // Function
+ TFUNC, TLN, TLOG, TEXP, // Exp - Log
+ TSIN, TCOS, TTAN, TCOT, // Trigo
+ TSINH, TCOSH, TTANH, TCOTH, // Trigo hyperbolic
+ TASIN, TACOS, TATAN, TACOT, // Arctrigo
+ TASINH, TACOSH, TATANH, TACOTH, // Arctrigo hyperbolic
+ // Color
+ TRGB, TRGBA, THEX,
+ TAQUA, TBLACK, TBLUE, TCYAN, TFUCHSIA,
+ TGRAY, TGREEN, TLIME, TMAGENTA, TMAROON,
+ TNAVY, TOLIVE, TPURPLE, TRED, TSILVER,
+ TTEAL, TWHITE, TYELLOW
};
struct SmToken