2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-04 15:25:45 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2005-07-12 10:10:19 +00:00
|
|
|
|
|
|
|
#include "eqnolefilehdr.hxx"
|
|
|
|
#include <sot/storage.hxx>
|
|
|
|
|
2014-02-25 20:41:20 +01:00
|
|
|
|
2005-07-12 10:10:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-24 12:22:08 +02:00
|
|
|
bool GetMathTypeVersion( SotStorage* pStor, sal_uInt8 &nVersion )
|
2005-07-12 10:10:19 +00:00
|
|
|
{
|
|
|
|
sal_uInt8 nVer = 0;
|
2014-04-24 12:22:08 +02:00
|
|
|
bool bSuccess = false;
|
2005-07-12 10:10:19 +00:00
|
|
|
|
2014-02-25 20:41:20 +01:00
|
|
|
|
2011-04-10 18:30:46 +09:00
|
|
|
// code snippet copied from MathType::Parse
|
2014-02-25 20:41:20 +01:00
|
|
|
|
2015-05-06 16:38:01 +02:00
|
|
|
tools::SvRef<SotStorageStream> xSrc = pStor->OpenSotStream(
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString("Equation Native"),
|
2015-01-07 09:28:42 +02:00
|
|
|
STREAM_STD_READ | StreamMode::NOCREATE);
|
2005-07-12 10:10:19 +00:00
|
|
|
if ( (!xSrc.Is()) || (SVSTREAM_OK != xSrc->GetError()))
|
|
|
|
return bSuccess;
|
2015-05-06 16:28:57 +02:00
|
|
|
SotStorageStream *pS = &xSrc;
|
2015-01-05 08:47:31 +02:00
|
|
|
pS->SetEndian( SvStreamEndian::LITTLE );
|
2014-02-25 20:41:20 +01:00
|
|
|
|
2005-07-12 10:10:19 +00:00
|
|
|
EQNOLEFILEHDR aHdr;
|
|
|
|
aHdr.Read(pS);
|
2014-02-05 10:41:04 +02:00
|
|
|
pS->ReadUChar( nVer );
|
2005-07-12 10:10:19 +00:00
|
|
|
|
|
|
|
if (!pS->GetError())
|
|
|
|
{
|
|
|
|
nVersion = nVer;
|
2014-04-24 12:22:08 +02:00
|
|
|
bSuccess = true;
|
2005-07-12 10:10:19 +00:00
|
|
|
}
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
2014-02-25 20:41:20 +01:00
|
|
|
|
2005-07-12 10:10:19 +00:00
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|