diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2019-05-27 00:12:28 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2019-06-13 05:11:25 +0200 |
commit | 93eeaf0ad902214fb6b4205606b24046a458ee45 (patch) | |
tree | 8b124795dd6c6aec34e9f6f8886e6a80b7b01086 /starmath | |
parent | 5e6af47dc87a55fea595c952ea3e59c93d0620db (diff) |
tdf#120047 Support attribute harpoon/wideharpoon in Math
... for an alternative style of vectors.
They are vec/widevec analogs but with COMBINING RIGHT HARPOON ABOVE
(U+20D1). The new attribute names are deliberately long in order to
make fewer accidental collisions with variable names in formulae of
exising documents.
This also adds a glyph uni20D1 to OpenSymbol.
Change-Id: I31666e57808aa0e0327500916d3b862549891886
Reviewed-on: https://gerrit.libreoffice.org/72987
Tested-by: Jenkins
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/node.hxx | 2 | ||||
-rw-r--r-- | starmath/inc/strings.hrc | 2 | ||||
-rw-r--r-- | starmath/inc/strings.hxx | 2 | ||||
-rw-r--r-- | starmath/inc/token.hxx | 4 | ||||
-rw-r--r-- | starmath/inc/types.hxx | 1 | ||||
-rw-r--r-- | starmath/qa/cppunit/test_nodetotextvisitors.cxx | 2 | ||||
-rw-r--r-- | starmath/source/ElementsDockingWindow.cxx | 4 | ||||
-rw-r--r-- | starmath/source/mathmlexport.cxx | 1 | ||||
-rw-r--r-- | starmath/source/mathtype.cxx | 2 | ||||
-rw-r--r-- | starmath/source/node.cxx | 3 | ||||
-rw-r--r-- | starmath/source/ooxmlexport.cxx | 1 | ||||
-rw-r--r-- | starmath/source/ooxmlimport.cxx | 3 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 3 | ||||
-rw-r--r-- | starmath/source/rtfexport.cxx | 1 | ||||
-rw-r--r-- | starmath/uiconfig/smath/popupmenu/edit.xml | 2 |
15 files changed, 30 insertions, 3 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index da67e9bdece6..73bfb17132c9 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -1019,7 +1019,7 @@ public: /** Attribute node * * Used to give an attribute to another node. Used for commands such as: - * UNDERLINE, OVERLINE, OVERSTRIKE, WIDEVEC, WIDEHAT and WIDETILDE. + * UNDERLINE, OVERLINE, OVERSTRIKE, WIDEVEC, WIDEHARPOON, WIDEHAT and WIDETILDE. * * Children:<BR> * 0: Attribute<BR> diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index eec600990ba0..f12677d26eca 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -165,6 +165,7 @@ #define RID_HATX_HELP NC_("RID_HATX_HELP", "Circumflex" ) #define RID_TILDEX_HELP NC_("RID_TILDEX_HELP", "Tilde" ) #define RID_VECX_HELP NC_("RID_VECX_HELP", "Vector Arrow" ) +#define RID_HARPOONX_HELP NC_("RID_HARPOONX_HELP", "Harpoon" ) #define RID_UNDERLINEX_HELP NC_("RID_UNDERLINEX_HELP", "Line Below" ) #define RID_OVERLINEX_HELP NC_("RID_OVERLINEX_HELP", "Line Over" ) #define RID_OVERSTRIKEX_HELP NC_("RID_OVERSTRIKEX_HELP", "Line Through" ) @@ -256,6 +257,7 @@ #define RID_WIDEHATX_HELP NC_("RID_WIDEHATX_HELP", "Large Circumflex" ) #define RID_WIDETILDEX_HELP NC_("RID_WIDETILDEX_HELP", "Large Tilde" ) #define RID_WIDEVECX_HELP NC_("RID_WIDEVECX_HELP", "Large Vector Arrow" ) +#define RID_WIDEHARPOONX_HELP NC_("RID_WIDEHARPOONX_HELP", "Large Harpoon" ) #define RID_HBAR_HELP NC_("RID_HBAR_HELP", "h Bar" ) #define RID_LAMBDABAR_HELP NC_("RID_LAMBDABAR_HELP", "Lambda Bar" ) #define RID_LEFTARROW_HELP NC_("RID_LEFTARROW_HELP", "Left Arrow" ) diff --git a/starmath/inc/strings.hxx b/starmath/inc/strings.hxx index beeb1519730c..ba7826a3dd75 100644 --- a/starmath/inc/strings.hxx +++ b/starmath/inc/strings.hxx @@ -158,6 +158,7 @@ #define RID_HATX "hat <?> " #define RID_TILDEX "tilde <?> " #define RID_VECX "vec <?> " +#define RID_HARPOONX "harpoon <?> " #define RID_UNDERLINEX "underline {<?>} " #define RID_OVERLINEX "overline {<?>} " #define RID_OVERSTRIKEX "overstrike {<?>} " @@ -249,6 +250,7 @@ #define RID_WIDEHATX "widehat {<?>} " #define RID_WIDETILDEX "widetilde {<?>} " #define RID_WIDEVECX "widevec {<?>} " +#define RID_WIDEHARPOONX "wideharpoon {<?>} " #define RID_HBAR "hbar " #define RID_LAMBDABAR "lambdabar " #define RID_LEFTARROW "leftarrow " diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index c2b948bd7b70..8abe85e61858 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -63,6 +63,7 @@ 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, @@ -93,7 +94,8 @@ enum SmTokenType TUNDERBRACE, TOVERBRACE, TCIRC, THBAR, TLAMBDABAR, TLEFTARROW, TRIGHTARROW, TUPARROW, TDOWNARROW, TDIVIDES, TSETN, TSETZ, TSETQ, - TSETR, TSETC, TWIDEVEC, TWIDETILDE, TWIDEHAT, + TSETR, TSETC, TWIDEVEC, TWIDEHARPOON, TWIDETILDE, + TWIDEHAT, TWIDESLASH, TWIDEBACKSLASH, TLDBRACKET, TRDBRACKET, TNOSPACE, TUNKNOWN, TPRECEDES, TSUCCEEDS, TPRECEDESEQUAL, TSUCCEEDSEQUAL, TPRECEDESEQUIV, TSUCCEEDSEQUIV, TNOTPRECEDES, TNOTSUCCEEDS, TSILVER, diff --git a/starmath/inc/types.hxx b/starmath/inc/types.hxx index 78e33b62905a..b5cca6087346 100644 --- a/starmath/inc/types.hxx +++ b/starmath/inc/types.hxx @@ -141,6 +141,7 @@ sal_Unicode const MS_CIRCLE = 0x02DA; sal_Unicode const MS_COMBCIRCLE = 0x030A; sal_Unicode const MS_CHECK = 0x02C7; sal_Unicode const MS_COMBCHECK = 0x030C; +sal_Unicode const MS_HARPOON = 0x20D1; sal_Unicode const MS_VEC = 0x20D7; sal_Unicode const MS_DOT = 0x02D9; sal_Unicode const MS_DDOT = 0x00A8; diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx index e76cc4e1d5e9..5fba90348dae 100644 --- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx +++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx @@ -249,11 +249,13 @@ void Test::SimpleAttributes() parseandparseagain("breve a", "Breve"); parseandparseagain("circle a", "Circle"); parseandparseagain("vec a", "Vector arrow"); + parseandparseagain("harpoon a", "Harpoon"); parseandparseagain("tilde a", "Tilde"); parseandparseagain("hat a", "Circumflex"); parseandparseagain("bar a", "Line above"); parseandparseagain("dot a", "Dot"); parseandparseagain("widevec abc", "Wide vector arrow"); + parseandparseagain("wideharpoon abc", "Wide harpoon"); parseandparseagain("widetilde abc", "Wide tilde"); parseandparseagain("widehat abc", "Wide circumflex"); parseandparseagain("ddot a", "Double dot"); diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 12d362208a88..72787b5c6a12 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -167,9 +167,11 @@ const SmElementDescr SmElementsControl::m_aAttributesList[] = {RID_ACUTEX, RID_ACUTEX_HELP}, {RID_GRAVEX, RID_GRAVEX_HELP}, {RID_BREVEX, RID_BREVEX_HELP}, {RID_CIRCLEX, RID_CIRCLEX_HELP}, {RID_DOTX, RID_DOTX_HELP}, {RID_DDOTX, RID_DDOTX_HELP}, {RID_DDDOTX, RID_DDDOTX_HELP}, {RID_BARX, RID_BARX_HELP}, {RID_VECX, RID_VECX_HELP}, + {RID_HARPOONX, RID_HARPOONX_HELP}, {RID_TILDEX, RID_TILDEX_HELP}, {RID_HATX, RID_HATX_HELP}, {RID_CHECKX, RID_CHECKX_HELP}, {nullptr, nullptr}, - {RID_WIDEVECX, RID_WIDEVECX_HELP}, {RID_WIDETILDEX, RID_WIDETILDEX_HELP}, {RID_WIDEHATX, RID_WIDEHATX_HELP}, + {RID_WIDEVECX, RID_WIDEVECX_HELP}, {RID_WIDEHARPOONX, RID_WIDEHARPOONX_HELP}, + {RID_WIDETILDEX, RID_WIDETILDEX_HELP}, {RID_WIDEHATX, RID_WIDEHATX_HELP}, {RID_OVERLINEX, RID_OVERLINEX_HELP}, {RID_UNDERLINEX, RID_UNDERLINEX_HELP}, {RID_OVERSTRIKEX, RID_OVERSTRIKEX_HELP}, {nullptr, nullptr}, {RID_PHANTOMX, RID_PHANTOMX_HELP}, {RID_BOLDX, RID_BOLDX_HELP}, {RID_ITALX, RID_ITALX_HELP}, diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index 9538a74c2e57..e5523c7ed122 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -1128,6 +1128,7 @@ void SmXMLExport::ExportAttributes(const SmNode *pNode, int nLevel) case TWIDETILDE: case TWIDEHAT: case TWIDEVEC: + case TWIDEHARPOON: { // make these wide accents stretchy AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_TRUE); diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index afedfc192e9b..65a7bb834009 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -3165,6 +3165,7 @@ void MathType::HandleAttributes(SmNode *pNode,int nLevel) case TACUTE: //Not Exportable case TGRAVE: //Not Exportable case TCIRCLE: //Not Exportable + case TWIDEHARPOON: //Not Exportable case TWIDETILDE: //Not Exportable case TWIDEHAT: //Not Exportable break; @@ -3248,6 +3249,7 @@ void MathType::HandleAttributes(SmNode *pNode,int nLevel) pS->WriteUChar( 20 ); break; case TWIDEVEC: + case TWIDEHARPOON: case TUNDERLINE: case TWIDETILDE: case TWIDEHAT: diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index eab5ff5ac1a7..ca5dd1a24a4e 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -2535,6 +2535,9 @@ void SmAttributNode::CreateTextFromNode(OUStringBuffer &rText) case MS_VEC: // COMBINING RIGHT ARROW ABOVE rText.append("vec "); break; + case MS_HARPOON: // COMBINING RIGHT HARPOON ABOVE + rText.append("harpoon "); + break; case MS_TILDE: // TILDE case MS_COMBTILDE: // COMBINING TILDE rText.append("tilde "); diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx index 2d5a8e6253ca..f52c7275b399 100644 --- a/starmath/source/ooxmlexport.cxx +++ b/starmath/source/ooxmlexport.cxx @@ -167,6 +167,7 @@ void SmOoxmlExport::HandleAttribute( const SmAttributNode* pNode, int nLevel ) case TDDDOT: case TWIDETILDE: case TWIDEHAT: + case TWIDEHARPOON: case TWIDEVEC: case TBAR: { diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index 4b2100439143..912136e69aa8 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -199,6 +199,9 @@ OUString SmOoxmlImport::handleAcc() // shouldn't matter, but short above a longer expression doesn't look right acc = "widevec"; break; + case MS_HARPOON: + acc = "wideharpoon"; + break; case MS_TILDE: case MS_COMBTILDE: acc = "widetilde"; diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 2c76ace91243..84c8508d4fe2 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -143,6 +143,7 @@ static const SmTokenTableEntry aTokenTable[] = { "gray", TGRAY, '\0', TG::Color, 0}, { "green", TGREEN, '\0', TG::Color, 0}, { "gt", TGT, MS_GT, TG::Relation, 0}, + { "harpoon", THARPOON, MS_HARPOON, TG::Attribute, 5}, { "hat", THAT, MS_HAT, TG::Attribute, 5}, { "hbar" , THBAR, MS_HBAR, TG::Standalone, 5}, { "iiint", TIIINT, MS_IIINT, TG::Oper, 5}, @@ -287,6 +288,7 @@ static const SmTokenTableEntry aTokenTable[] = { "vec", TVEC, MS_VEC, TG::Attribute, 5}, { "white", TWHITE, '\0', TG::Color, 0}, { "widebslash", TWIDEBACKSLASH, MS_BACKSLASH, TG::Product, 0 }, + { "wideharpoon", TWIDEHARPOON, MS_HARPOON, TG::Attribute, 5}, { "widehat", TWIDEHAT, MS_HAT, TG::Attribute, 5}, { "wideslash", TWIDESLASH, MS_SLASH, TG::Product, 0 }, { "widetilde", TWIDETILDE, MS_TILDE, TG::Attribute, 5}, @@ -1778,6 +1780,7 @@ std::unique_ptr<SmStructureNode> SmParser::DoAttribut() break; case TWIDEVEC : + case TWIDEHARPOON : case TWIDEHAT : case TWIDETILDE : xAttr.reset(new SmMathSymbolNode(m_aCurToken)); diff --git a/starmath/source/rtfexport.cxx b/starmath/source/rtfexport.cxx index 2f3839c54a39..87e51a3b9374 100644 --- a/starmath/source/rtfexport.cxx +++ b/starmath/source/rtfexport.cxx @@ -106,6 +106,7 @@ void SmRtfExport::HandleAttribute(const SmAttributNode* pNode, int nLevel) case TDDDOT: case TWIDETILDE: case TWIDEHAT: + case TWIDEHARPOON: case TWIDEVEC: case TBAR: { diff --git a/starmath/uiconfig/smath/popupmenu/edit.xml b/starmath/uiconfig/smath/popupmenu/edit.xml index 211776eea9a8..85a90675a703 100644 --- a/starmath/uiconfig/smath/popupmenu/edit.xml +++ b/starmath/uiconfig/smath/popupmenu/edit.xml @@ -166,10 +166,12 @@ <menu:menuitem menu:label="dddot a" menu:id=".uno:InsertCommandText?Text:string=dddot <?> "/> <menu:menuitem menu:label="bar a" menu:id=".uno:InsertCommandText?Text:string=bar <?> "/> <menu:menuitem menu:label="vec a" menu:id=".uno:InsertCommandText?Text:string=vec <?> "/> + <menu:menuitem menu:label="harpoon a" menu:id=".uno:InsertCommandText?Text:string=harpoon <?> "/> <menu:menuitem menu:label="tilde a" menu:id=".uno:InsertCommandText?Text:string=tilde <?> "/> <menu:menuitem menu:label="hat a" menu:id=".uno:InsertCommandText?Text:string=hat <?> "/> <menu:menuseparator/> <menu:menuitem menu:label="widevec abc" menu:id=".uno:InsertCommandText?Text:string=widevec {<?>} "/> + <menu:menuitem menu:label="wideharpoon abc" menu:id=".uno:InsertCommandText?Text:string=wideharpoon {<?>} "/> <menu:menuitem menu:label="widetilde abc" menu:id=".uno:InsertCommandText?Text:string=widetilde {<?>} "/> <menu:menuitem menu:label="widehat abc" menu:id=".uno:InsertCommandText?Text:string=widehat {<?>} "/> <menu:menuitem menu:label="overline abc" menu:id=".uno:InsertCommandText?Text:string=overline {<?>} "/> |