/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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 .
*/
sal_uInt64 SotStorageStream::TellEnd()
{ // Need to flush the buffer so we materialise the stream and return the correct answer // otherwise we return a 0 value from StgEntry::GetSize
FlushBuffer();
/** * SotStorage::SotStorage() * * A I... object must be passed to SvObject, because otherwise itself will * create and define an IUnknown, so that all other I... objects would be * destroyed with delete (Owner() == true). * But IStorage objects are only used and not implemented by ourselves, * therefore we pretend the IStorage object was passed from the outside * and it will be freed with Release(). * The CreateStorage methods are needed to create an IStorage object before the * call of SvObject (Own, !Own automatic). * If CreateStorage has created an object, then the RefCounter was already * incremented. * The transfer is done in pStorageCTor and the variable is NULL, if it didn't * work.
*/ #define INIT_SotStorage() \
: m_pOwnStg( nullptr ) \
, m_pStorStm( nullptr ) \
, m_nError( ERRCODE_NONE ) \
, m_bIsRoot( false ) \
, m_bDelStm( false ) \
, m_nVersion( SOFFICE_FILEFORMAT_CURRENT )
if ( m_pStorStm )
{ // try as UCBStorage, next try as OLEStorage bool bIsUCBStorage = UCBStorage::IsStorageFile( m_pStorStm ); if ( !bIsUCBStorage && bForceUCBStorage ) // if UCBStorage has priority, it should not be used only if it is really an OLEStorage
bIsUCBStorage = !Storage::IsStorageFile( m_pStorStm );
if ( bIsUCBStorage )
{ // UCBStorage always works directly on the UCB content, so discard the stream first delete m_pStorStm;
m_pStorStm = nullptr;
m_pOwnStg = new UCBStorage( m_aName, nMode, true, true/*bIsRoot*/ );
} else
{ // OLEStorage can be opened with a stream
m_pOwnStg = new Storage( *m_pStorStm, true );
m_bDelStm = true;
}
} elseif ( bForceUCBStorage )
{
m_pOwnStg = new UCBStorage( m_aName, nMode, true, true/*bIsRoot*/ );
SetError( ERRCODE_IO_NOTSUPPORTED );
} else
{
m_pOwnStg = new Storage( m_aName, nMode, true );
SetError( ERRCODE_IO_NOTSUPPORTED );
}
} else
{ // temporary storage if ( bForceUCBStorage )
m_pOwnStg = new UCBStorage( m_aName, nMode, true, true/*bIsRoot*/ ); else
m_pOwnStg = new Storage( m_aName, nMode, true );
m_aName = m_pOwnStg->GetName();
}
// try as UCBStorage, next try as OLEStorage if ( UCBStorage::IsStorageFile( &rStm ) )
m_pOwnStg = new UCBStorage( rStm, false ); else
m_pOwnStg = new Storage( rStm, false );
SetError( m_pOwnStg->GetError() );
if ( IsOLEStorage() )
m_nVersion = SOFFICE_FILEFORMAT_50;
// try as UCBStorage, next try as OLEStorage if ( UCBStorage::IsStorageFile( pStm ) )
m_pOwnStg = new UCBStorage( *pStm, false ); else
m_pOwnStg = new Storage( *pStm, false );
sal_Int32 SotStorage::GetVersion( const css::uno::Reference < css::embed::XStorage >& xStorage )
{
SotClipboardFormatId nSotFormatID = SotStorage::GetFormatID( xStorage ); switch( nSotFormatID )
{ case SotClipboardFormatId::STARWRITER_8: case SotClipboardFormatId::STARWRITER_8_TEMPLATE: case SotClipboardFormatId::STARWRITERWEB_8: case SotClipboardFormatId::STARWRITERGLOB_8: case SotClipboardFormatId::STARWRITERGLOB_8_TEMPLATE: case SotClipboardFormatId::STARDRAW_8: case SotClipboardFormatId::STARDRAW_8_TEMPLATE: case SotClipboardFormatId::STARIMPRESS_8: case SotClipboardFormatId::STARIMPRESS_8_TEMPLATE: case SotClipboardFormatId::STARCALC_8: case SotClipboardFormatId::STARCALC_8_TEMPLATE: case SotClipboardFormatId::STARCHART_8: case SotClipboardFormatId::STARCHART_8_TEMPLATE: case SotClipboardFormatId::STARMATH_8: case SotClipboardFormatId::STARMATH_8_TEMPLATE: return SOFFICE_FILEFORMAT_8; case SotClipboardFormatId::STARWRITER_60: case SotClipboardFormatId::STARWRITERWEB_60: case SotClipboardFormatId::STARWRITERGLOB_60: case SotClipboardFormatId::STARDRAW_60: case SotClipboardFormatId::STARIMPRESS_60: case SotClipboardFormatId::STARCALC_60: case SotClipboardFormatId::STARCHART_60: case SotClipboardFormatId::STARMATH_60: return SOFFICE_FILEFORMAT_60; default: break;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.