sync master with lastest vba changes
[ooovba.git] / starmath / source / eqnolefilehdr.cxx
blob8992af52112fcc6df2adbee80f346aae213e2f47
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: eqnolefilehdr.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_starmath.hxx"
33 #include "eqnolefilehdr.hxx"
34 #include <sot/storage.hxx>
36 //////////////////////////////////////////////////////////////////////
38 void EQNOLEFILEHDR::Read(SvStorageStream *pS)
40 *pS >> nCBHdr;
41 *pS >> nVersion;
42 *pS >> nCf;
43 *pS >> nCBObject;
44 *pS >> nReserved1;
45 *pS >> nReserved2;
46 *pS >> nReserved3;
47 *pS >> nReserved4;
51 void EQNOLEFILEHDR::Write(SvStorageStream *pS)
53 *pS << nCBHdr;
54 *pS << nVersion;
55 *pS << nCf;
56 *pS << nCBObject;
57 *pS << nReserved1;
58 *pS << nReserved2;
59 *pS << nReserved3;
60 *pS << nReserved4;
64 sal_Bool GetMathTypeVersion( SotStorage* pStor, sal_uInt8 &nVersion )
66 sal_uInt8 nVer = 0;
67 sal_Bool bSuccess = sal_False;
70 // code sniplet copied from MathType::Parse
72 SvStorageStreamRef xSrc = pStor->OpenSotStream(
73 String::CreateFromAscii("Equation Native"),
74 STREAM_STD_READ | STREAM_NOCREATE);
75 if ( (!xSrc.Is()) || (SVSTREAM_OK != xSrc->GetError()))
76 return bSuccess;
77 SvStorageStream *pS = &xSrc;
78 pS->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
80 EQNOLEFILEHDR aHdr;
81 aHdr.Read(pS);
82 *pS >> nVer;
84 if (!pS->GetError())
86 nVersion = nVer;
87 bSuccess = sal_True;
89 return bSuccess;
92 //////////////////////////////////////////////////////////////////////