/Users/ericb/Desktop/SRC680_m247/starmath/inc/format.hxx

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  OpenOffice.org - a multi-platform office productivity suite
00004  *
00005  *  $RCSfile: format.hxx,v $
00006  *
00007  *  $Revision: 1.8 $
00008  *
00009  *  last change: $Author: ihi $ $Date: 2007/07/12 10:36:56 $
00010  *
00011  *  The Contents of this file are made available subject to
00012  *  the terms of GNU Lesser General Public License Version 2.1.
00013  *
00014  *
00015  *    GNU Lesser General Public License Version 2.1
00016  *    =============================================
00017  *    Copyright 2005 by Sun Microsystems, Inc.
00018  *    901 San Antonio Road, Palo Alto, CA 94303, USA
00019  *
00020  *    This library is free software; you can redistribute it and/or
00021  *    modify it under the terms of the GNU Lesser General Public
00022  *    License version 2.1, as published by the Free Software Foundation.
00023  *
00024  *    This library is distributed in the hope that it will be useful,
00025  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00026  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027  *    Lesser General Public License for more details.
00028  *
00029  *    You should have received a copy of the GNU Lesser General Public
00030  *    License along with this library; if not, write to the Free Software
00031  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00032  *    MA  02111-1307  USA
00033  *
00034  ************************************************************************/
00035 #ifndef FORMAT_HXX
00036 #define FORMAT_HXX
00037 
00038 
00039 #ifndef _SFXSMPLHINT_HXX //autogen
00040 #include <svtools/smplhint.hxx>
00041 #endif
00042 #ifndef _SFXBRDCST_HXX //autogen
00043 #include <svtools/brdcst.hxx>
00044 #endif
00045 
00046 #ifndef UTILITY_HXX
00047 #include "utility.hxx"
00048 #endif
00049 #ifndef TYPES_HXX
00050 #include <types.hxx>
00051 #endif
00052 
00053 
00054 #define SM_FMT_VERSION_51       ((BYTE) 0x01)
00055 #define SM_FMT_VERSION_NOW      SM_FMT_VERSION_51
00056 
00057 #define FNTNAME_TIMES   "Times New Roman"
00058 #define FNTNAME_HELV    "Helvetica"
00059 #define FNTNAME_COUR    "Courier"
00060 #define FNTNAME_MATH    FONTNAME_MATH
00061 
00062 
00063 // symbolic names used as array indices
00064 #define SIZ_BEGIN               0
00065 #define SIZ_TEXT                0
00066 #define SIZ_INDEX               1
00067 #define SIZ_FUNCTION    2
00068 #define SIZ_OPERATOR    3
00069 #define SIZ_LIMITS              4
00070 #define SIZ_END                 4
00071 
00072 // symbolic names used as array indices
00073 #define FNT_BEGIN               0
00074 #define FNT_VARIABLE    0
00075 #define FNT_FUNCTION    1
00076 #define FNT_NUMBER              2
00077 #define FNT_TEXT                3
00078 #define FNT_SERIF               4
00079 #define FNT_SANS                5
00080 #define FNT_FIXED               6
00081 #define FNT_MATH                7
00082 #define FNT_END                 7
00083 
00084 // symbolic names used as array indices
00085 #define DIS_BEGIN                                0
00086 #define DIS_HORIZONTAL                   0
00087 #define DIS_VERTICAL                     1
00088 #define DIS_ROOT                                 2
00089 #define DIS_SUPERSCRIPT                  3
00090 #define DIS_SUBSCRIPT                    4
00091 #define DIS_NUMERATOR                    5
00092 #define DIS_DENOMINATOR                  6
00093 #define DIS_FRACTION                     7
00094 #define DIS_STROKEWIDTH                  8
00095 #define DIS_UPPERLIMIT                   9
00096 #define DIS_LOWERLIMIT                  10
00097 #define DIS_BRACKETSIZE                 11
00098 #define DIS_BRACKETSPACE                12
00099 #define DIS_MATRIXROW                   13
00100 #define DIS_MATRIXCOL                   14
00101 #define DIS_ORNAMENTSIZE                15
00102 #define DIS_ORNAMENTSPACE               16
00103 #define DIS_OPERATORSIZE                17
00104 #define DIS_OPERATORSPACE               18
00105 #define DIS_LEFTSPACE                   19
00106 #define DIS_RIGHTSPACE                  20
00107 #define DIS_TOPSPACE                    21
00108 #define DIS_BOTTOMSPACE                 22
00109 #define DIS_NORMALBRACKETSIZE   23
00110 #define DIS_END                                 23
00111 
00112 
00113 // to be broadcastet on format changes:
00114 #define HINT_FORMATCHANGED      10003
00115 
00116 enum SmHorAlign { AlignLeft, AlignCenter, AlignRight };
00117 
00118 String GetDefaultFontName( LanguageType nLang, USHORT nIdent );
00119 
00120 class SmFormat : public SfxBroadcaster
00121 {
00122         SmFace          vFont[FNT_END + 1];
00123     BOOL        bDefaultFont[FNT_END + 1];
00124         Size            aBaseSize;
00125         long            nVersion;
00126         USHORT          vSize[SIZ_END + 1];
00127         USHORT          vDist[DIS_END + 1];
00128         SmHorAlign      eHorAlign;
00129         BOOL            bIsTextmode,
00130                                 bScaleNormalBrackets;
00131 
00132 public:
00133         SmFormat();
00134     SmFormat(const SmFormat &rFormat) : SfxBroadcaster() { *this = rFormat; }
00135 
00136         const Size &    GetBaseSize() const                     { return aBaseSize; }
00137         void                    SetBaseSize(const Size &rSize)  { aBaseSize = rSize; }
00138 
00139         const SmFace &  GetFont(USHORT nIdent) const { return vFont[nIdent]; }
00140     void            SetFont(USHORT nIdent, const SmFace &rFont, BOOL bDefault = FALSE);
00141     void            SetFontSize(USHORT nIdent, const Size &rSize)   { vFont[nIdent].SetSize( rSize ); }
00142 
00143     void            SetDefaultFont(USHORT nIdent, BOOL bVal)    { bDefaultFont[nIdent] = bVal; }
00144     BOOL            IsDefaultFont(USHORT nIdent) const   { return bDefaultFont[nIdent]; }
00145 
00146         USHORT                  GetRelSize(USHORT nIdent) const                 { return vSize[nIdent]; }
00147         void                    SetRelSize(USHORT nIdent, USHORT nVal)  { vSize[nIdent] = nVal;}
00148 
00149         USHORT                  GetDistance(USHORT nIdent) const                        { return vDist[nIdent]; }
00150         void                    SetDistance(USHORT nIdent, USHORT nVal) { vDist[nIdent] = nVal; }
00151 
00152         SmHorAlign              GetHorAlign() const                             { return eHorAlign; }
00153         void                    SetHorAlign(SmHorAlign eAlign)  { eHorAlign = eAlign; }
00154 
00155         BOOL                    IsTextmode() const     { return bIsTextmode; }
00156         void                    SetTextmode(BOOL bVal) { bIsTextmode = bVal; }
00157 
00158         BOOL                    IsScaleNormalBrackets() const     { return bScaleNormalBrackets; }
00159         void                    SetScaleNormalBrackets(BOOL bVal) { bScaleNormalBrackets = bVal; }
00160 
00161         long                    GetVersion() const { return nVersion; }
00162 
00164         void                    SetVersion(long nVer) { nVersion = nVer; }
00165 
00166         SmFormat &              operator = (const SmFormat &rFormat);
00167 
00168     BOOL            operator == (const SmFormat &rFormat) const;
00169     inline BOOL     operator != (const SmFormat &rFormat) const;
00170 
00171         void RequestApplyChanges() const
00172         {
00173                 ((SmFormat *) this)->Broadcast(SfxSimpleHint(HINT_FORMATCHANGED));
00174         }
00175 
00176 };
00177     
00178 inline BOOL    SmFormat::operator != (const SmFormat &rFormat) const
00179 {
00180     return !(*this == rFormat);
00181 }
00182 
00183 #endif
00184 

Generated on Wed Feb 20 17:21:56 2008 for maths by  doxygen 1.5.1