1*d107581fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*d107581fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*d107581fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*d107581fSAndrew Rist * distributed with this work for additional information 6*d107581fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*d107581fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*d107581fSAndrew Rist * "License"); you may not use this file except in compliance 9*d107581fSAndrew Rist * with the License. You may obtain a copy of the License at 10*d107581fSAndrew Rist * 11*d107581fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*d107581fSAndrew Rist * 13*d107581fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*d107581fSAndrew Rist * software distributed under the License is distributed on an 15*d107581fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*d107581fSAndrew Rist * KIND, either express or implied. See the License for the 17*d107581fSAndrew Rist * specific language governing permissions and limitations 18*d107581fSAndrew Rist * under the License. 19*d107581fSAndrew Rist * 20*d107581fSAndrew Rist *************************************************************/ 21*d107581fSAndrew Rist 22*d107581fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_starmath.hxx" 26cdf0e10cSrcweir #include "eqnolefilehdr.hxx" 27cdf0e10cSrcweir #include <sot/storage.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 30cdf0e10cSrcweir Read(SvStorageStream * pS)31cdf0e10cSrcweirvoid EQNOLEFILEHDR::Read(SvStorageStream *pS) 32cdf0e10cSrcweir { 33cdf0e10cSrcweir *pS >> nCBHdr; 34cdf0e10cSrcweir *pS >> nVersion; 35cdf0e10cSrcweir *pS >> nCf; 36cdf0e10cSrcweir *pS >> nCBObject; 37cdf0e10cSrcweir *pS >> nReserved1; 38cdf0e10cSrcweir *pS >> nReserved2; 39cdf0e10cSrcweir *pS >> nReserved3; 40cdf0e10cSrcweir *pS >> nReserved4; 41cdf0e10cSrcweir } 42cdf0e10cSrcweir 43cdf0e10cSrcweir Write(SvStorageStream * pS)44cdf0e10cSrcweirvoid EQNOLEFILEHDR::Write(SvStorageStream *pS) 45cdf0e10cSrcweir { 46cdf0e10cSrcweir *pS << nCBHdr; 47cdf0e10cSrcweir *pS << nVersion; 48cdf0e10cSrcweir *pS << nCf; 49cdf0e10cSrcweir *pS << nCBObject; 50cdf0e10cSrcweir *pS << nReserved1; 51cdf0e10cSrcweir *pS << nReserved2; 52cdf0e10cSrcweir *pS << nReserved3; 53cdf0e10cSrcweir *pS << nReserved4; 54cdf0e10cSrcweir } 55cdf0e10cSrcweir 56cdf0e10cSrcweir GetMathTypeVersion(SotStorage * pStor,sal_uInt8 & nVersion)57cdf0e10cSrcweirsal_Bool GetMathTypeVersion( SotStorage* pStor, sal_uInt8 &nVersion ) 58cdf0e10cSrcweir { 59cdf0e10cSrcweir sal_uInt8 nVer = 0; 60cdf0e10cSrcweir sal_Bool bSuccess = sal_False; 61cdf0e10cSrcweir 62cdf0e10cSrcweir // 63cdf0e10cSrcweir // code sniplet copied from MathType::Parse 64cdf0e10cSrcweir // 65cdf0e10cSrcweir SvStorageStreamRef xSrc = pStor->OpenSotStream( 66cdf0e10cSrcweir String::CreateFromAscii("Equation Native"), 67cdf0e10cSrcweir STREAM_STD_READ | STREAM_NOCREATE); 68cdf0e10cSrcweir if ( (!xSrc.Is()) || (SVSTREAM_OK != xSrc->GetError())) 69cdf0e10cSrcweir return bSuccess; 70cdf0e10cSrcweir SvStorageStream *pS = &xSrc; 71cdf0e10cSrcweir pS->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); 72cdf0e10cSrcweir // 73cdf0e10cSrcweir EQNOLEFILEHDR aHdr; 74cdf0e10cSrcweir aHdr.Read(pS); 75cdf0e10cSrcweir *pS >> nVer; 76cdf0e10cSrcweir 77cdf0e10cSrcweir if (!pS->GetError()) 78cdf0e10cSrcweir { 79cdf0e10cSrcweir nVersion = nVer; 80cdf0e10cSrcweir bSuccess = sal_True; 81cdf0e10cSrcweir } 82cdf0e10cSrcweir return bSuccess; 83cdf0e10cSrcweir } 84cdf0e10cSrcweir 85cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 86cdf0e10cSrcweir 87