LCOV - code coverage report
Current view: top level - starmath/source - mathtype.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 12 17 70.6 %
Date: 2014-04-11 Functions: 8 10 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_STARMATH_SOURCE_MATHTYPE_HXX
      21             : #define INCLUDED_STARMATH_SOURCE_MATHTYPE_HXX
      22             : 
      23             : #include "node.hxx"
      24             : #include "eqnolefilehdr.hxx"
      25             : 
      26             : #include <sot/storage.hxx>
      27             : 
      28             : #include <set>
      29             : 
      30             : class SfxMedium;
      31             : 
      32             : class MathTypeFont
      33             : {
      34             : public:
      35             :     sal_uInt8 nTface;
      36             :     sal_uInt8 nStyle;
      37          10 :     MathTypeFont() : nTface(0),nStyle(0) {}
      38           0 :     MathTypeFont(sal_uInt8 nFace) : nTface(nFace),nStyle(0) {}
      39             :     void AppendStyleToText(OUString &rS);
      40             : };
      41             : 
      42             : struct LessMathTypeFont
      43             : {
      44         520 :     sal_Bool operator() (const MathTypeFont &rValue1,
      45             :         const MathTypeFont &rValue2) const
      46             :     {
      47         520 :         return rValue1.nTface < rValue2.nTface;
      48             :     }
      49             : };
      50             : 
      51             : typedef ::std::set< MathTypeFont, LessMathTypeFont > MathTypeFontSet;
      52             : 
      53          10 : class MathType
      54             : {
      55             : public:
      56          10 :     MathType(OUString &rIn)
      57             :         : nVersion(0)
      58             :         , nPlatform(0)
      59             :         , nProduct(0)
      60             :         , nProdVersion(0)
      61             :         , nProdSubVersion(0)
      62             :         , pS(NULL)
      63             :         , rRet(rIn)
      64             :         , pTree(NULL)
      65             :         , nHAlign(0)
      66             :         , nVAlign(0)
      67             :         , nPendingAttributes(0)
      68             :         , nInsertion(0)
      69             :         , nDefaultSize(12)
      70             :         , nLSize(0)
      71             :         , nDSize(0)
      72             :         , nCurSize(0)
      73             :         , nLastSize(0)
      74             :         , nSpec(0)
      75             :         , bIsSilent(sal_False)
      76             :         , bIsReInterpBrace(sal_False)
      77             :         , nPostSup(0)
      78             :         , nPostlSup(0)
      79          10 :         , nTypeFace(0)
      80             :     {
      81          10 :         Init();
      82          10 :     }
      83             : 
      84           0 :     MathType(OUString &rIn,SmNode *pIn)
      85             :         : nVersion(0)
      86             :         , nPlatform(0)
      87             :         , nProduct(0)
      88             :         , nProdVersion(0)
      89             :         , nProdSubVersion(0)
      90             :         , pS(NULL)
      91             :         , rRet(rIn)
      92             :         , pTree(pIn)
      93             :         , nHAlign(2)
      94             :         , nVAlign(0)
      95             :         , nPendingAttributes(0)
      96             :         , nInsertion(0)
      97             :         , nDefaultSize(12)
      98             :         , nLSize(0)
      99             :         , nDSize(0)
     100             :         , nCurSize(0)
     101             :         , nLastSize(0)
     102             :         , nSpec(0)
     103             :         , bIsSilent(sal_False)
     104             :         , bIsReInterpBrace(sal_False)
     105             :         , nPostSup(0)
     106             :         , nPostlSup(0)
     107           0 :         , nTypeFace(0)
     108             :     {
     109           0 :         Init();
     110           0 :     }
     111             : 
     112             :     int Parse( SotStorage* pStor );
     113             :     int ConvertFromStarMath( SfxMedium& rMedium );
     114             : 
     115             : private:
     116             : /*Ver 2 Header*/
     117             :     sal_uInt8 nVersion;
     118             :     sal_uInt8 nPlatform;
     119             :     sal_uInt8 nProduct;
     120             :     sal_uInt8 nProdVersion;
     121             :     sal_uInt8 nProdSubVersion;
     122             : 
     123             :     SvStorageStream *pS;
     124             : 
     125             :     void Init();
     126             : 
     127             :     int HandleRecords(int nLevel=0,sal_uInt8 nSelector=0xFF,
     128             :         sal_uInt8 nVariation=0xFF,int nRows=0,int nCols=0);
     129             :     sal_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,
     135             :         int &rCurRow);
     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,
     142             :         sal_Bool bSilent);
     143             :     void HandleNudge();
     144          64 :     int xfLMOVE(sal_uInt8 nTest) const {return nTest&0x80;}
     145          24 :     int xfAUTO(sal_uInt8 nTest) const {return nTest&0x10;}
     146          48 :     int xfEMBELL(sal_uInt8 nTest) const {return nTest&0x20;}
     147          30 :     int xfNULL(sal_uInt8 nTest) const {return nTest&0x10;}
     148             :     int xfLSPACE(sal_uInt8 nTest) const {return nTest&0x40;}
     149             :     int xfRULER(sal_uInt8 nTest) const {return nTest&0x20;}
     150             : 
     151             :     sal_uInt8 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,sal_Bool bTest=sal_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             :     sal_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);
     170             : 
     171             :     OUString &rRet;
     172             :     SmNode *pTree;
     173             : 
     174             :     sal_uInt8 nHAlign;
     175             :     sal_uInt8 nVAlign;
     176             : 
     177             :     int nPendingAttributes;
     178             :     sal_uLong nInsertion;
     179             : 
     180             :     sal_Int16 aSizeTable[7];
     181             :     sal_Int16 nDefaultSize;
     182             :     sal_Int16 nLSize;
     183             :     sal_Int16 nDSize;
     184             :     sal_Int16 nCurSize;
     185             :     sal_Int16 nLastSize;
     186             :     sal_uInt8 nSpec;
     187             :     sal_Bool  bIsSilent, bIsReInterpBrace;
     188             :     OUString  sPost;
     189             :     sal_Int32 nPostSup;
     190             :     sal_Int32 nPostlSup;
     191             :     sal_uInt8 nTypeFace;
     192             :     MathTypeFontSet aUserStyles;
     193             : 
     194             :     enum MTOKENS {END,LINE,CHAR,TMPL,PILE,MATRIX,EMBEL,RULER,FONT,SIZE};
     195             :     enum MTEMPLATES
     196             :     {
     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
     201             :     };
     202             : public:
     203             :     static sal_Bool LookupChar(sal_Unicode nChar,OUString &rRet,
     204             :         sal_uInt8 nVersion=3,sal_uInt8 nTypeFace=0);
     205             : };
     206             : 
     207             : 
     208             : #endif
     209             : 
     210             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10