/Users/ericb/Desktop/SRC680_m247/starmath/source/eqnolefilehdr.cxx

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  OpenOffice.org - a multi-platform office productivity suite
00004  *
00005  *  $RCSfile: eqnolefilehdr.cxx,v $
00006  *
00007  *  $Revision: 1.4 $
00008  *
00009  *  last change: $Author: obo $ $Date: 2006/09/17 07:52:51 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
00037 #include "precompiled_starmath.hxx"
00038 
00039 #ifndef __EQNOLEFILEHDR_HXX__
00040 #include "eqnolefilehdr.hxx"
00041 #endif
00042 
00043 #ifndef _SOT_STORAGE_HXX
00044 #include <sot/storage.hxx>
00045 #endif
00046 
00048 
00049 void EQNOLEFILEHDR::Read(SvStorageStream *pS)
00050 {
00051     *pS >> nCBHdr;
00052     *pS >> nVersion;
00053     *pS >> nCf;
00054     *pS >> nCBObject;
00055     *pS >> nReserved1;
00056     *pS >> nReserved2;
00057     *pS >> nReserved3;
00058     *pS >> nReserved4;
00059 }
00060 
00061 
00062 void EQNOLEFILEHDR::Write(SvStorageStream *pS)
00063 {
00064     *pS << nCBHdr;
00065     *pS << nVersion;
00066     *pS << nCf;
00067     *pS << nCBObject;
00068     *pS << nReserved1;
00069     *pS << nReserved2;
00070     *pS << nReserved3;
00071     *pS << nReserved4;
00072 }
00073 
00074 
00075 sal_Bool GetMathTypeVersion( SotStorage* pStor, sal_uInt8 &nVersion )
00076 {
00077     sal_uInt8 nVer = 0;
00078     sal_Bool bSuccess = sal_False;
00079 
00080     //
00081     // code sniplet copied from MathType::Parse
00082     //
00083     SvStorageStreamRef xSrc = pStor->OpenSotStream(
00084         String::CreateFromAscii("Equation Native"),
00085         STREAM_STD_READ | STREAM_NOCREATE);
00086     if ( (!xSrc.Is()) || (SVSTREAM_OK != xSrc->GetError()))
00087         return bSuccess;
00088     SvStorageStream *pS = &xSrc;
00089     pS->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
00090     //
00091     EQNOLEFILEHDR aHdr;
00092     aHdr.Read(pS);
00093     *pS >> nVer;
00094     
00095     if (!pS->GetError())
00096     {
00097         nVersion = nVer;
00098         bSuccess = sal_True;
00099     }
00100     return bSuccess;
00101 }
00102 
00104 

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