diff -rup OpenOffice_3_1_0/starmath/inc/node.hxx OpenOffice_3_1_0_test/starmath/inc/node.hxx --- OpenOffice_3_1_0/starmath/inc/node.hxx 2010-01-29 19:17:29.000000000 +0100 +++ OpenOffice_3_1_0_test/starmath/inc/node.hxx 2010-02-06 14:15:31.000000000 +0100 @@ -488,15 +488,24 @@ public: class SmLineNode : public SmStructureNode { + BOOL bUseExtraSpaces; + protected: SmLineNode(SmNodeType eNodeType, const SmToken &rNodeToken) : SmStructureNode(eNodeType, rNodeToken) - {} + { + bUseExtraSpaces = TRUE; + } public: SmLineNode(const SmToken &rNodeToken) : SmStructureNode(NLINE, rNodeToken) - {} + { + bUseExtraSpaces = TRUE; + } + + void SetUseExtraSpaces(BOOL bVal) { bUseExtraSpaces = bVal; } + BOOL IsUseExtraSpaces() const { return bUseExtraSpaces; }; virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); diff -rup OpenOffice_3_1_0/starmath/inc/parse.hxx OpenOffice_3_1_0_test/starmath/inc/parse.hxx --- OpenOffice_3_1_0/starmath/inc/parse.hxx 2010-01-29 19:17:29.000000000 +0100 +++ OpenOffice_3_1_0_test/starmath/inc/parse.hxx 2010-02-06 14:15:31.000000000 +0100 @@ -109,7 +109,7 @@ enum SmTokenType TLEFTARROW, TRIGHTARROW, TUPARROW, TDOWNARROW, TDIVIDES, TNDIBVIDES, TSETN, TSETZ, TSETQ, TSETR, TSETC, TWIDEVEC, TWIDETILDE, TWIDEHAT, TWIDESLASH, - TWIDEBACKSLASH, TLDBRACKET, TRDBRACKET, + TWIDEBACKSLASH, TLDBRACKET, TRDBRACKET, TNOSPACE, TUNKNOWN, TDEBUG }; diff -rup OpenOffice_3_1_0/starmath/inc/starmath.hrc OpenOffice_3_1_0_test/starmath/inc/starmath.hrc --- OpenOffice_3_1_0/starmath/inc/starmath.hrc 2010-01-29 19:17:29.000000000 +0100 +++ OpenOffice_3_1_0_test/starmath/inc/starmath.hrc 2010-02-06 14:47:25.000000000 +0100 @@ -384,6 +384,7 @@ #define RID_LSUPX (RID_APP_START + 1916) #define RID_CSUBX (RID_APP_START + 1917) #define RID_CSUPX (RID_APP_START + 1918) +#define RID_NOSPACE (RID_APP_START + 1919) #define RID_ALEPH (RID_APP_START + 2001) #define RID_EMPTYSET (RID_APP_START + 2002) @@ -699,6 +700,7 @@ #define HID_SMA_DOTSDOWN (HID_SMA_START + 240) #define HID_SMA_DOTSLOW (HID_SMA_START + 241) #define HID_SMA_DOTSVERT (HID_SMA_START + 242) +#define HID_SMA_NOSPACE (HID_SMA_START + 243) #define HID_SMA_SETN (HID_SMA2_START + 1) #define HID_SMA_SETZ (HID_SMA2_START + 2) diff -rup OpenOffice_3_1_0/starmath/source/commands.src OpenOffice_3_1_0_test/starmath/source/commands.src --- OpenOffice_3_1_0/starmath/source/commands.src 2010-01-29 19:17:28.000000000 +0100 +++ OpenOffice_3_1_0_test/starmath/source/commands.src 2010-02-07 04:34:01.000000000 +0100 @@ -227,6 +227,7 @@ String RID_LEFTARROW { Text = "leftarro String RID_RIGHTARROW { Text = "rightarrow " ; }; String RID_UPARROW { Text = "uparrow " ; }; String RID_DOWNARROW { Text = "downarrow " ; }; +String RID_NOSPACE { Text = "nospace {} " ; }; ////////////////////////////////////////// @@ -1331,6 +1332,12 @@ Menu RID_COMMANDMENU }; MenuItem { + Identifier = RID_NOSPACE; + HelpId = HID_SMA_NOSPACE; + Text [ en-US ] = "nospace {...}"; + }; + MenuItem + { Identifier = RID_BINOMXY; HelpId = HID_SMA_BINOMXY; Text = "binom x y"; diff -rup OpenOffice_3_1_0/starmath/source/node.cxx OpenOffice_3_1_0_test/starmath/source/node.cxx --- OpenOffice_3_1_0/starmath/source/node.cxx 2010-01-29 19:17:28.000000000 +0100 +++ OpenOffice_3_1_0_test/starmath/source/node.cxx 2010-02-06 14:15:31.000000000 +0100 @@ -831,8 +831,10 @@ void SmLineNode::Arrange(const OutputDev if (nSize < 1) return; - // make distance depend on font size - long nDist = +(rFormat.GetDistance(DIS_HORIZONTAL) + long nDist = 0; + if (IsUseExtraSpaces()) + // make distance depend on font size + nDist = +(rFormat.GetDistance(DIS_HORIZONTAL) * GetFont().GetSize().Height()) / 100L; Point aPos; diff -rup OpenOffice_3_1_0/starmath/source/parse.cxx OpenOffice_3_1_0_test/starmath/source/parse.cxx --- OpenOffice_3_1_0/starmath/source/parse.cxx 2010-01-29 19:17:28.000000000 +0100 +++ OpenOffice_3_1_0_test/starmath/source/parse.cxx 2010-02-06 14:15:31.000000000 +0100 @@ -245,12 +245,13 @@ static const SmTokenTableEntry aTokenTab { "ni", TNI, MS_NI, TGRELATION, 0}, { "nitalic", TNITALIC, '\0', TGFONTATTR, 5}, { "none", TNONE, '\0', TGLBRACES | TGRBRACES, 0}, + { "nospace", TNOSPACE, '\0', TGSTANDALONE, 5}, { "notin", TNOTIN, MS_NOTIN, TGRELATION, 0}, + { "nroot", TNROOT, MS_SQRT, TGUNOPER, 5}, { "nsubset", TNSUBSET, MS_NSUBSET, TGRELATION, 0 }, { "nsupset", TNSUPSET, MS_NSUPSET, TGRELATION, 0 }, { "nsubseteq", TNSUBSETEQ, MS_NSUBSETEQ, TGRELATION, 0 }, { "nsupseteq", TNSUPSETEQ, MS_NSUPSETEQ, TGRELATION, 0 }, - { "nroot", TNROOT, MS_SQRT, TGUNOPER, 5}, { "odivide", TODIVIDE, MS_ODIVIDE, TGPRODUCT, 0}, { "odot", TODOT, MS_ODOT, TGPRODUCT, 0}, { "ominus", TOMINUS, MS_OMINUS, TGSUM, 0}, @@ -734,7 +735,7 @@ void SmParser::NextToken() xub_StrLen nTmpStart = sal::static_int_cast< xub_StrLen >(rnEndPos + aTmpRes.LeadingWhiteSpace); - // default setting fo the case that no identifier + // default setting for the case that no identifier // i.e. a valid symbol-name is following the '%' // character CurToken.eType = TTEXT; @@ -1135,6 +1136,14 @@ void SmParser::Line() void SmParser::Expression() { + BOOL bUseExtraSpaces = TRUE; + SmNode *pNode = NodeStack.Pop(); + if (pNode) + if (pNode->GetToken().eType == TNOSPACE) + bUseExtraSpaces = FALSE; + else + NodeStack.Push(pNode); + USHORT n = 0; SmNodeArray RelationArray; @@ -1150,8 +1159,9 @@ void SmParser::Expression() RelationArray.Put(n - 1, NodeStack.Pop()); } - SmStructureNode *pSNode = new SmExpressionNode(CurToken); + SmExpressionNode *pSNode = new SmExpressionNode(CurToken); pSNode->SetSubNodes(RelationArray); + pSNode->SetUseExtraSpaces(bUseExtraSpaces); NodeStack.Push(pSNode); } @@ -1273,7 +1283,7 @@ void SmParser::SubSup(ULONG nActiveGroup return; SmSubSupNode *pNode = new SmSubSupNode(CurToken); - //! Of course 'CurToken' ist just the first sub-/supscript token. + //! Of course 'CurToken' is just the first sub-/supscript token. //! It should be of no further interest. The positions of the //! sub-/supscripts will be identified by the corresponding subnodes //! index in the 'aSubNodes' array (enum value from 'SmSubSup'). @@ -1409,6 +1419,35 @@ void SmParser::Term() Blank(); break; + case TNOSPACE : + NodeStack.Push(new SmExpressionNode(CurToken)); + NextToken(); + if (CurToken.eType != TLGROUP) + { NodeStack.Pop(); + Term(); + } + else // _almost_ the same as in TLGROUP + { NextToken(); + // allow for empty group + if (CurToken.eType == TRGROUP) + { NodeStack.Pop(); + SmStructureNode *pSNode = new SmExpressionNode(CurToken); + pSNode->SetSubNodes(NULL, NULL); + NodeStack.Push(pSNode); + + NextToken(); + } + else // go as usual + { Align(); + if (CurToken.eType != TRGROUP) + Error(PE_RGROUP_EXPECTED); + else + { NextToken(); + } + } + } + break; + case TTEXT : NodeStack.Push(new SmTextNode(CurToken, FNT_TEXT)); NextToken(); diff -rup OpenOffice_3_1_0/starmath/source/smres.src OpenOffice_3_1_0_test/starmath/source/smres.src --- OpenOffice_3_1_0/starmath/source/smres.src 2010-01-29 19:17:28.000000000 +0100 +++ OpenOffice_3_1_0_test/starmath/source/smres.src 2010-02-07 04:29:49.000000000 +0100 @@ -2655,7 +2655,7 @@ FloatingWindow RID_TOOLBOXWINDOW Size = MAP_APPFONT ( 65 , 95 ) ; SVLook = TRUE ; Hide = TRUE ; - LineCount = 3 ; + LineCount = 4 ; ItemList = { ToolBoxItem @@ -2757,6 +2757,16 @@ FloatingWindow RID_TOOLBOXWINDOW HelpId = HID_SMA_BLANK ; Text [ en-US ] = "Gap" ; }; + ToolBoxItem + { + Type = TOOLBOXITEM_BREAK ; + }; + ToolBoxItem + { + Identifier = RID_NOSPACE ; + HelpId = HID_SMA_NOSPACE ; + Text [ en-US ] = "Remove extra spaces" ; + }; }; }; ToolBox 9 @@ -3291,8 +3301,9 @@ DockingWindow RID_CMDBOXWINDOW\ RID_LSUPX ; \ RID_CSUBX ; \ RID_CSUPX ; \ + RID_NOSPACE ; \ }; \ - IdCount = { 15 ; }; + IdCount = { 16 ; }; ImageList RID_IL_FORMAT { diff -rup OpenOffice_3_1_0/starmath/source/toolbox.cxx OpenOffice_3_1_0_test/starmath/source/toolbox.cxx --- OpenOffice_3_1_0/starmath/source/toolbox.cxx 2010-01-29 19:17:28.000000000 +0100 +++ OpenOffice_3_1_0_test/starmath/source/toolbox.cxx 2010-02-06 14:51:24.000000000 +0100 @@ -345,7 +345,7 @@ void SmToolBoxWindow::SetCategory(USHORT case RID_ATTRIBUTES_CAT: nLines = 5; break; case RID_MISC_CAT: nLines = 4; break; case RID_BRACKETS_CAT: nLines = 5; break; - case RID_FORMAT_CAT: nLines = 3; break; + case RID_FORMAT_CAT: nLines = 4; break; default: // nothing to be done return;