/Users/ericb/Desktop/SRC680_m247/starmath/source/cfgitem.hxx

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  OpenOffice.org - a multi-platform office productivity suite
00004  *
00005  *  $RCSfile: cfgitem.hxx,v $
00006  *
00007  *  $Revision: 1.12 $
00008  *
00009  *  last change: $Author: vg $ $Date: 2007/05/25 12:11:54 $
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 
00036 #ifdef _MSC_VER
00037 #pragma hdrstop
00038 #endif
00039 
00040 #ifndef _MATH_CFGITEM_HXX_
00041 #define _MATH_CFGITEM_HXX_
00042 
00043 #include <vector>
00044 
00045 #include <com/sun/star/beans/PropertyValues.hpp>
00046 #include <com/sun/star/uno/Sequence.hxx>
00047 
00048 #ifndef _COM_SUN_STAR_UNO_ANY_H_
00049 #include <com/sun/star/uno/Any.h>
00050 #endif
00051 
00052 #include <tools/solar.h>
00053 
00054 #ifndef _RTL_USTRING_HXX_
00055 #include <rtl/ustring.hxx>
00056 #endif
00057 #ifndef _UTL_CONFIGITEM_HXX_
00058 #include <unotools/configitem.hxx>
00059 #endif
00060 #ifndef _SVARRAY_HXX
00061 #include <svtools/svarray.hxx>
00062 #endif
00063 #ifndef _SV_TIMER_HXX
00064 #include <vcl/timer.hxx>
00065 #endif
00066 
00067 #include <symbol.hxx>
00068 #include <types.hxx>
00069 
00070 using namespace com::sun::star;
00071 
00072 class SmSym;
00073 class SmFormat;
00074 class Font;
00075 struct SmCfgOther;
00076 
00078 
00079 
00080 struct SmFontFormat
00081 {
00082     String      aName;
00083     INT16       nCharSet;
00084     INT16       nFamily;
00085     INT16       nPitch;
00086     INT16       nWeight;
00087     INT16       nItalic;
00088 
00089     SmFontFormat();
00090     SmFontFormat( const Font &rFont );
00091 
00092     const Font      GetFont() const;
00093     BOOL            operator == ( const SmFontFormat &rFntFmt ) const;
00094 };
00095 
00096 
00097 struct SmFntFmtListEntry
00098 {
00099     String          aId;
00100     SmFontFormat    aFntFmt;
00101 
00102     SmFntFmtListEntry( const String &rId, const SmFontFormat &rFntFmt );
00103 };
00104 
00105 
00106 SV_DECL_OBJARR( SmFntFmtListEntryArr, SmFntFmtListEntry, 8, 8 )
00107 
00108 
00109 class SmFontFormatList
00110 {
00111     SmFntFmtListEntryArr    aEntries;
00112     BOOL                    bModified;
00113 
00114         // disallow copy-constructor and assignment-operator for now
00115     SmFontFormatList( const SmFontFormatList & );
00116     SmFontFormatList & operator = ( const SmFontFormatList & );
00117 
00118 public:
00119     SmFontFormatList();
00120 
00121     void    Clear();
00122     void    AddFontFormat( const String &rFntFmtId, const SmFontFormat &rFntFmt );
00123     void    RemoveFontFormat( const String &rFntFmtId );
00124 
00125     const SmFontFormat *    GetFontFormat( const String &rFntFmtId ) const;
00126     const SmFontFormat *    GetFontFormat( USHORT nPos ) const;
00127     const String            GetFontFormatId( const SmFontFormat &rFntFmt ) const;
00128     const String            GetFontFormatId( const SmFontFormat &rFntFmt, BOOL bAdd );
00129     const String            GetFontFormatId( USHORT nPos ) const;
00130     const String            GetNewFontFormatId() const;
00131     USHORT                  GetCount() const    { return aEntries.Count(); }
00132 
00133     BOOL    IsModified() const          { return bModified; }
00134     void    SetModified( BOOL bVal )    { bModified = bVal; }
00135 };
00136 
00137 
00139 
00140 class SmMathConfig : public utl::ConfigItem
00141 {
00142     SmFormat *          pFormat;
00143     SmCfgOther *        pOther;
00144     SmFontFormatList *  pFontFormatList;
00145     SmSymSetManager *   pSymSetMgr;
00146     BOOL                bIsOtherModified;
00147     BOOL                bIsFormatModified;
00148 
00149         // disallow copy-constructor and assignment-operator for now
00150         SmMathConfig( const SmMathConfig & );
00151         SmMathConfig & operator = ( const SmMathConfig & );
00152 
00153 
00154     void    StripFontFormatList( const std::vector< SmSym > &rSymbols );
00155 
00156 
00157     void    Save();
00158 
00159     void    ReadSymbol( SmSym &rSymbol,
00160                                                 const rtl::OUString &rSymbolName,
00161                                                 const rtl::OUString &rBaseNode ) const;
00162     void    ReadFontFormat( SmFontFormat &rFontFormat,
00163                                                 const rtl::OUString &rSymbolName,
00164                                                 const rtl::OUString &rBaseNode ) const;
00165 
00166     void            SetOtherIfNotEqual( BOOL &rbItem, BOOL bNewVal );
00167 
00168 protected:
00169     void    LoadOther();
00170     void    SaveOther();
00171     void    LoadFormat();
00172     void    SaveFormat();
00173     void    LoadFontFormatList();
00174     void    SaveFontFormatList();
00175 
00176         void        SetOtherModified( BOOL bVal );
00177     inline BOOL IsOtherModified() const     { return bIsOtherModified; }
00178     void        SetFormatModified( BOOL bVal );
00179     inline BOOL IsFormatModified() const    { return bIsFormatModified; }
00180 
00181     SmFontFormatList &          GetFontFormatList();
00182     const SmFontFormatList &    GetFontFormatList() const
00183     {
00184         return ((SmMathConfig *) this)->GetFontFormatList();
00185     }
00186 
00187 public:
00188         SmMathConfig();
00189     virtual ~SmMathConfig();
00190 
00191     // utl::ConfigItem
00192     //virtual void    Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames );
00193     virtual void    Commit();
00194 
00195     // make some protected functions of utl::ConfigItem public
00196     //using utl::ConfigItem::GetNodeNames;
00197     //using utl::ConfigItem::GetProperties;
00198     //using utl::ConfigItem::PutProperties;
00199     //using utl::ConfigItem::SetSetProperties;
00200     //using utl::ConfigItem::ReplaceSetProperties;
00201     //using utl::ConfigItem::GetReadOnlyStates;
00202 
00203     SmSymSetManager &   GetSymSetManager();
00204     void                GetSymbols( std::vector< SmSym > &rSymbols ) const;
00205     void                SetSymbols( const std::vector< SmSym > &rNewSymbols );
00206     USHORT              GetSymbolCount() const;
00207     const SmSym *       GetSymbol( USHORT nIndex ) const;
00208 
00209     const SmFormat &    GetStandardFormat() const;
00210     void                SetStandardFormat( const SmFormat &rFormat );
00211 
00212     BOOL            IsPrintTitle() const;
00213     void            SetPrintTitle( BOOL bVal );
00214     BOOL            IsPrintFormulaText() const;
00215     void            SetPrintFormulaText( BOOL bVal );
00216     BOOL            IsPrintFrame() const;
00217     void            SetPrintFrame( BOOL bVal );
00218     SmPrintSize     GetPrintSize() const;
00219     void            SetPrintSize( SmPrintSize eSize );
00220     USHORT          GetPrintZoomFactor() const;
00221     void            SetPrintZoomFactor( USHORT nVal );
00222 
00223     BOOL            IsIgnoreSpacesRight() const;
00224     void            SetIgnoreSpacesRight( BOOL bVal );
00225     BOOL            IsToolboxVisible() const;
00226     void            SetToolboxVisible( BOOL bVal );
00227     BOOL            IsAutoRedraw() const;
00228     void            SetAutoRedraw( BOOL bVal );
00229     BOOL            IsShowFormulaCursor() const;
00230     void            SetShowFormulaCursor( BOOL bVal );
00231 };
00232 
00234 
00235 #endif
00236 

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