LCOV - code coverage report
Current view: top level - starmath/inc - format.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 27 0.0 %
Date: 2014-04-14 Functions: 0 25 0.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             : #ifndef INCLUDED_STARMATH_INC_FORMAT_HXX
      20             : #define INCLUDED_STARMATH_INC_FORMAT_HXX
      21             : 
      22             : 
      23             : #include <svl/smplhint.hxx>
      24             : #include <svl/brdcst.hxx>
      25             : #include "utility.hxx"
      26             : #include <types.hxx>
      27             : 
      28             : 
      29             : #define SM_FMT_VERSION_51   ((sal_uInt8) 0x01)
      30             : #define SM_FMT_VERSION_NOW  SM_FMT_VERSION_51
      31             : 
      32             : #define FNTNAME_TIMES   "Times New Roman"
      33             : #define FNTNAME_HELV    "Helvetica"
      34             : #define FNTNAME_COUR    "Courier"
      35             : #define FNTNAME_MATH    FONTNAME_MATH
      36             : 
      37             : 
      38             : // symbolic names used as array indices
      39             : #define SIZ_BEGIN       0
      40             : #define SIZ_TEXT        0
      41             : #define SIZ_INDEX       1
      42             : #define SIZ_FUNCTION    2
      43             : #define SIZ_OPERATOR    3
      44             : #define SIZ_LIMITS      4
      45             : #define SIZ_END         4
      46             : 
      47             : // symbolic names used as array indices
      48             : #define FNT_BEGIN       0
      49             : #define FNT_VARIABLE    0
      50             : #define FNT_FUNCTION    1
      51             : #define FNT_NUMBER      2
      52             : #define FNT_TEXT        3
      53             : #define FNT_SERIF       4
      54             : #define FNT_SANS        5
      55             : #define FNT_FIXED       6
      56             : #define FNT_MATH        7
      57             : #define FNT_END         7
      58             : 
      59             : // symbolic names used as array indices
      60             : #define DIS_BEGIN                0
      61             : #define DIS_HORIZONTAL           0
      62             : #define DIS_VERTICAL             1
      63             : #define DIS_ROOT                 2
      64             : #define DIS_SUPERSCRIPT          3
      65             : #define DIS_SUBSCRIPT            4
      66             : #define DIS_NUMERATOR            5
      67             : #define DIS_DENOMINATOR          6
      68             : #define DIS_FRACTION             7
      69             : #define DIS_STROKEWIDTH          8
      70             : #define DIS_UPPERLIMIT           9
      71             : #define DIS_LOWERLIMIT          10
      72             : #define DIS_BRACKETSIZE         11
      73             : #define DIS_BRACKETSPACE        12
      74             : #define DIS_MATRIXROW           13
      75             : #define DIS_MATRIXCOL           14
      76             : #define DIS_ORNAMENTSIZE        15
      77             : #define DIS_ORNAMENTSPACE       16
      78             : #define DIS_OPERATORSIZE        17
      79             : #define DIS_OPERATORSPACE       18
      80             : #define DIS_LEFTSPACE           19
      81             : #define DIS_RIGHTSPACE          20
      82             : #define DIS_TOPSPACE            21
      83             : #define DIS_BOTTOMSPACE         22
      84             : #define DIS_NORMALBRACKETSIZE   23
      85             : #define DIS_END                 23
      86             : 
      87             : 
      88             : // to be broadcastet on format changes:
      89             : #define HINT_FORMATCHANGED  10003
      90             : 
      91             : enum SmHorAlign { AlignLeft, AlignCenter, AlignRight };
      92             : 
      93             : OUString GetDefaultFontName( LanguageType nLang, sal_uInt16 nIdent );
      94             : 
      95           0 : class SmFormat : public SfxBroadcaster
      96             : {
      97             :     SmFace      vFont[FNT_END + 1];
      98             :     bool        bDefaultFont[FNT_END + 1];
      99             :     Size        aBaseSize;
     100             :     long        nVersion;
     101             :     sal_uInt16      vSize[SIZ_END + 1];
     102             :     sal_uInt16      vDist[DIS_END + 1];
     103             :     SmHorAlign  eHorAlign;
     104             :     sal_Int16       nGreekCharStyle;
     105             :     bool        bIsTextmode,
     106             :                 bScaleNormalBrackets;
     107             : 
     108             : public:
     109             :     SmFormat();
     110           0 :     SmFormat(const SmFormat &rFormat) : SfxBroadcaster() { *this = rFormat; }
     111             : 
     112           0 :     const Size &    GetBaseSize() const             { return aBaseSize; }
     113           0 :     void            SetBaseSize(const Size &rSize)  { aBaseSize = rSize; }
     114             : 
     115           0 :     const SmFace &  GetFont(sal_uInt16 nIdent) const { return vFont[nIdent]; }
     116             :     void            SetFont(sal_uInt16 nIdent, const SmFace &rFont, bool bDefault = false);
     117           0 :     void            SetFontSize(sal_uInt16 nIdent, const Size &rSize)   { vFont[nIdent].SetSize( rSize ); }
     118             : 
     119           0 :     void            SetDefaultFont(sal_uInt16 nIdent, bool bVal)    { bDefaultFont[nIdent] = bVal; }
     120           0 :     bool            IsDefaultFont(sal_uInt16 nIdent) const   { return bDefaultFont[nIdent]; }
     121             : 
     122           0 :     sal_uInt16      GetRelSize(sal_uInt16 nIdent) const         { return vSize[nIdent]; }
     123           0 :     void            SetRelSize(sal_uInt16 nIdent, sal_uInt16 nVal)  { vSize[nIdent] = nVal;}
     124             : 
     125           0 :     sal_uInt16      GetDistance(sal_uInt16 nIdent) const            { return vDist[nIdent]; }
     126           0 :     void            SetDistance(sal_uInt16 nIdent, sal_uInt16 nVal) { vDist[nIdent] = nVal; }
     127             : 
     128           0 :     SmHorAlign      GetHorAlign() const             { return eHorAlign; }
     129           0 :     void            SetHorAlign(SmHorAlign eAlign)  { eHorAlign = eAlign; }
     130             : 
     131           0 :     bool            IsTextmode() const     { return bIsTextmode; }
     132           0 :     void            SetTextmode(bool bVal) { bIsTextmode = bVal; }
     133             : 
     134           0 :     sal_Int16       GetGreekCharStyle() const     { return nGreekCharStyle; }
     135           0 :     void            SetGreekCharStyle(sal_Int16 nVal) { nGreekCharStyle = nVal; }
     136             : 
     137           0 :     bool            IsScaleNormalBrackets() const     { return bScaleNormalBrackets; }
     138           0 :     void            SetScaleNormalBrackets(bool bVal) { bScaleNormalBrackets = bVal; }
     139             : 
     140           0 :     long            GetVersion() const { return nVersion; }
     141             : 
     142             :     //! at time (5.1) use only the lower byte!!!
     143           0 :     void            SetVersion(long nVer) { nVersion = nVer; }
     144             : 
     145             :     SmFormat &      operator = (const SmFormat &rFormat);
     146             : 
     147             :     bool            operator == (const SmFormat &rFormat) const;
     148             :     inline bool     operator != (const SmFormat &rFormat) const;
     149             : 
     150           0 :     void RequestApplyChanges() const
     151             :     {
     152           0 :         ((SmFormat *) this)->Broadcast(SfxSimpleHint(HINT_FORMATCHANGED));
     153           0 :     }
     154             : 
     155             : };
     156             : 
     157           0 : inline bool    SmFormat::operator != (const SmFormat &rFormat) const
     158             : {
     159           0 :     return !(*this == rFormat);
     160             : }
     161             : 
     162             : #endif
     163             : 
     164             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10