/* * 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 .
*/
// open a new substorage
XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage1",
ElementModes.WRITE ); if ( xTempSubStorage == null )
{
m_aTestHelper.Error( "Can't create substorage!" ); returnfalse;
}
byte pBytes1[] = { 1, 1, 1, 1, 1 };
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "SubStream1", "MediaType1", true, pBytes1 ) ) returnfalse;
// open a new substorage in the existing substorage
XStorage xTempSubSubStorage = m_aTestHelper.openSubStorage( xTempSubStorage, "SubSubStorage1",
ElementModes.WRITE ); if ( xTempSubStorage == null )
{
m_aTestHelper.Error( "Can't create substorage!" ); returnfalse;
}
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubSubStorage, "SubSubStream1", "MediaType2", true, pBytes1 ) ) returnfalse;
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubSubStorage, "MediaType3", false,
ElementModes.WRITE ) ) returnfalse;
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage, "MediaType4", false,
ElementModes.WRITE ) ) returnfalse;
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, "MediaType5", true,
ElementModes.WRITE ) ) returnfalse;
// commit the storages, and check the renaming in all stages
// rename the storage before it is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage1", "SubSubStorage2" ) ) returnfalse;
// rename the stream if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream1", "SubStream2" ) ) returnfalse;
// commit lowlevel substorage first if ( !m_aTestHelper.commitStorage( xTempSubSubStorage ) ) returnfalse;
// rename the storage after it is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage2", "SubSubStorage3" ) ) returnfalse;
// rename the stream one more time if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream2", "SubStream3" ) ) returnfalse;
// commit substorage if ( !m_aTestHelper.commitStorage( xTempSubStorage ) ) returnfalse;
// rename the storage after it's parent is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage3", "SubSubStorage4" ) ) returnfalse;
// rename the stream after it's parent is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream3", "SubStream4" ) ) returnfalse;
// commit substorage to let the renaming take place if ( !m_aTestHelper.commitStorage( xTempSubStorage ) ) returnfalse;
// commit the root storage so the contents must be stored now if ( !m_aTestHelper.commitStorage( xTempStorage ) ) returnfalse;
// rename the storage after the package is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage4", "SubSubStorage5" ) ) returnfalse;
// rename the stream after it's parent is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream4", "SubStream5" ) ) returnfalse;
// commit substorage to let the renaming take place if ( !m_aTestHelper.commitStorage( xTempSubStorage ) ) returnfalse;
// commit the root storage so the contents must be stored now if ( !m_aTestHelper.commitStorage( xTempStorage ) ) returnfalse;
// rename the storage before it is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage5", "SubSubStorage6" ) ) returnfalse;
// rename the stream if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream5", "SubStream6" ) ) returnfalse;
// commit lowlevel substorage first if ( !m_aTestHelper.commitStorage( xTempSubSubStorage ) ) returnfalse;
// rename the storage after it is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage6", "SubSubStorage7" ) ) returnfalse;
// rename the stream one more time if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream6", "SubStream7" ) ) returnfalse;
// commit substorage if ( !m_aTestHelper.commitStorage( xTempSubStorage ) ) returnfalse;
// rename the storage after it's parent is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage7", "SubSubStorage8" ) ) returnfalse;
// rename the stream after it's parent is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream7", "SubStream8" ) ) returnfalse;
// commit substorage to let the renaming take place if ( !m_aTestHelper.commitStorage( xTempSubStorage ) ) returnfalse;
// commit the root storage so the contents must be stored now if ( !m_aTestHelper.commitStorage( xTempStorage ) ) returnfalse;
// rename the storage after the package is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage8", "SubSubStorage9" ) ) returnfalse;
// rename the stream after it`s parent is committed if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream8", "SubStream9" ) ) returnfalse;
// commit substorage to let the renaming take place if ( !m_aTestHelper.commitStorage( xTempSubStorage ) ) returnfalse;
// commit the root storage so the contents must be stored now if ( !m_aTestHelper.commitStorage( xTempStorage ) ) returnfalse;
// the storage is based on the temporary stream so it can be left undisposed, since it does not lock // any resource, later the garbage collector will release the object and it must die by refcount
returntrue;
} catch( Exception e )
{
m_aTestHelper.Error( "Exception: " + e ); returnfalse;
}
}
}
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.