1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_STARMATH_SOURCE_MATHTYPE_HXX
21 #define INCLUDED_STARMATH_SOURCE_MATHTYPE_HXX
24 #include "eqnolefilehdr.hxx"
26 #include <sot/storage.hxx>
37 MathTypeFont() : nTface(0),nStyle(0) {}
38 explicit MathTypeFont(sal_uInt8 nFace
) : nTface(nFace
),nStyle(0) {}
39 void AppendStyleToText(OUString
&rS
);
42 struct LessMathTypeFont
44 bool operator() (const MathTypeFont
&rValue1
,
45 const MathTypeFont
&rValue2
) const
47 return rValue1
.nTface
< rValue2
.nTface
;
51 typedef ::std::set
< MathTypeFont
, LessMathTypeFont
> MathTypeFontSet
;
56 explicit MathType(OUString
&rIn
)
67 , nPendingAttributes(0)
76 , bIsReInterpBrace(false)
84 MathType(OUString
&rIn
,SmNode
*pIn
)
95 , nPendingAttributes(0)
104 , bIsReInterpBrace(false)
112 int Parse( SotStorage
* pStor
);
113 int ConvertFromStarMath( SfxMedium
& rMedium
);
120 sal_uInt8 nProdVersion
;
121 sal_uInt8 nProdSubVersion
;
123 SotStorageStream
*pS
;
127 int HandleRecords(int nLevel
=0,sal_uInt8 nSelector
=0xFF,
128 sal_uInt8 nVariation
=0xFF,int nRows
=0,int nCols
=0);
129 bool HandleSize(sal_Int16 nLSize
,sal_Int16 nDSize
, int &rSetSize
);
130 void HandleAlign(sal_uInt8 nHAlign
,sal_uInt8 nVAlign
, int &rSetAlign
);
131 int HandlePile(int &rSetAlign
,int nLevel
,sal_uInt8 nSelector
,
132 sal_uInt8 nVariation
);
133 int HandleMatrix(int nLevel
,sal_uInt8 nSelector
,sal_uInt8 nVariarion
);
134 void HandleMatrixSeparator(int nMatrixRows
,int nMatrixCols
,int &rCurCol
,
136 int HandleTemplate(int nLevel
,sal_uInt8
&rSelector
,sal_uInt8
&rVariation
,
137 sal_Int32
&rLastTemplateBracket
);
138 void HandleEmblishments();
139 void HandleSetSize();
140 int HandleChar(sal_Int32
&rTextStart
,int &rSetSize
,int nLevel
,
141 sal_uInt8 nTag
,sal_uInt8 nSelector
,sal_uInt8 nVariation
,
144 static int xfLMOVE(sal_uInt8 nTest
) {return nTest
&0x80;}
145 static int xfAUTO(sal_uInt8 nTest
) {return nTest
&0x10;}
146 static int xfEMBELL(sal_uInt8 nTest
) {return nTest
&0x20;}
147 static int xfNULL(sal_uInt8 nTest
) {return nTest
&0x10;}
148 static int xfLSPACE(sal_uInt8 nTest
) {return nTest
&0x40;}
149 static int xfRULER(sal_uInt8 nTest
) {return nTest
&0x20;}
151 void HandleNodes(SmNode
*pNode
,int nLevel
=0);
152 int StartTemplate(sal_uInt16 nSelector
,sal_uInt16 nVariation
=0);
153 void EndTemplate(int nOldPendingAttributes
);
154 void HandleSmMatrix(SmMatrixNode
*pMatrix
,int nLevel
);
155 void HandleTable(SmNode
*pNode
,int nLevel
);
156 void HandleRoot(SmNode
*pNode
,int nLevel
);
157 void HandleSubSupScript(SmNode
*pNode
,int nLevel
);
158 sal_uInt8
HandleCScript(SmNode
*pNode
,SmNode
*pContent
,int nLevel
,
159 sal_uLong
*pPos
=NULL
,bool bTest
=true);
160 void HandleFractions(SmNode
*pNode
,int nLevel
);
161 void HandleBrace(SmNode
*pNode
,int nLevel
);
162 void HandleVerticalBrace(SmNode
*pNode
,int nLevel
);
163 void HandleOperator(SmNode
*pNode
,int nLevel
);
164 bool HandleLim(SmNode
*pNode
,int nLevel
);
165 void HandleMAlign(SmNode
*pNode
,int nLevel
);
166 void HandleMath(SmNode
*pNode
,int nLevel
);
167 void HandleText(SmNode
*pNode
,int nLevel
);
168 void HandleAttributes(SmNode
*pNode
,int nLevel
);
169 void TypeFaceToString(OUString
&rRet
,sal_uInt8 nFace
);
177 int nPendingAttributes
;
178 sal_uLong nInsertion
;
180 std::vector
<sal_Int16
> aSizeTable
;
181 sal_Int16 nDefaultSize
;
187 bool bIsSilent
, bIsReInterpBrace
;
192 MathTypeFontSet aUserStyles
;
194 enum MTOKENS
{END
,LINE
,CHAR
,TMPL
,PILE
,MATRIX
,EMBEL
,RULER
,FONT
,SIZE
};
197 tmANGLE
,tmPAREN
,tmBRACE
,tmBRACK
,tmBAR
,tmDBAR
,tmFLOOR
,tmCEILING
,
198 tmLBLB
,tmRBRB
,tmRBLB
,tmLBRP
,tmLPRB
,tmROOT
,tmFRACT
,tmSCRIPT
,tmUBAR
,
199 tmOBAR
,tmLARROW
,tmRARROW
,tmBARROW
,tmSINT
,tmDINT
,tmTINT
,tmSSINT
,
200 tmDSINT
,tmTSINT
,tmUHBRACE
,tmLHBRACE
,tmSUM
,tmTINTD
203 static bool LookupChar(sal_Unicode nChar
,OUString
&rRet
,
204 sal_uInt8 nVersion
=3,sal_uInt8 nTypeFace
=0);
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */