1*cdf0e10cSrcweir/************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir#ifndef __com_sun_star_packages_Package_idl__ 28*cdf0e10cSrcweir#define __com_sun_star_packages_Package_idl__ 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir#ifndef __com_sun_star_lang_XInitialization_idl__ 31*cdf0e10cSrcweir#include <com/sun/star/lang/XInitialization.idl> 32*cdf0e10cSrcweir#endif 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir#ifndef __com_sun_star_container_XHierarchicalNameAccess_idl__ 35*cdf0e10cSrcweir#include <com/sun/star/container/XHierarchicalNameAccess.idl> 36*cdf0e10cSrcweir#endif 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir#ifndef __com_sun_star_lang_XSingleServiceFactory_idl__ 39*cdf0e10cSrcweir#include <com/sun/star/lang/XSingleServiceFactory.idl> 40*cdf0e10cSrcweir#endif 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir#ifndef __com_sun_star_util_XChangesBatch_idl__ 43*cdf0e10cSrcweir#include <com/sun/star/util/XChangesBatch.idl> 44*cdf0e10cSrcweir#endif 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir//============================================================================= 48*cdf0e10cSrcweir 49*cdf0e10cSrcweirmodule com { module sun { module star { module packages { 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir//============================================================================= 52*cdf0e10cSrcweir/** The <type>Package</type> is a service that provides access to a set of 53*cdf0e10cSrcweir files and folders contained within a Package. One instance of the 54*cdf0e10cSrcweir Package service exists for each Package file to be manipulated. 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir Each instance is created with an argument which specifies the URL of 57*cdf0e10cSrcweir the Package file to which the user requires access. If the instance is 58*cdf0e10cSrcweir created without arguments, it must be initialised with the 59*cdf0e10cSrcweir <type scope="com::sun::star::lang">XInitialization</type> service methods 60*cdf0e10cSrcweir before it is a valid instance of the service. 61*cdf0e10cSrcweir*/ 62*cdf0e10cSrcweirpublished service Package 63*cdf0e10cSrcweir{ 64*cdf0e10cSrcweir /** 65*cdf0e10cSrcweir A Package can be initialised with one of the following: 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir 1. A file URL referring to a package. 68*cdf0e10cSrcweir 2. An XInputStream referring to a package (it must also 69*cdf0e10cSrcweir support an XSeekable interface). 70*cdf0e10cSrcweir 3. An XStream referring to a package. The XInputStream must support 71*cdf0e10cSrcweir an XSeekable interface, and the XOutputStream must support an 72*cdf0e10cSrcweir XTruncate interface. 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir It will throw a css::uno::Exception if initialised with bad data or 75*cdf0e10cSrcweir if the package has an invalid format (for example, a corrupt central d 76*cdf0e10cSrcweir irectory record if the file is a ZIP file). 77*cdf0e10cSrcweir */ 78*cdf0e10cSrcweir interface com::sun::star::lang::XInitialization; 79*cdf0e10cSrcweir /** 80*cdf0e10cSrcweir This interface is used to get access to any entry within the package 81*cdf0e10cSrcweir For example: 82*cdf0e10cSrcweir getByHierarchicalName ("folder/subfolder/file1.txt"); 83*cdf0e10cSrcweir This will return a PackageStream which refers to the specified stream. 84*cdf0e10cSrcweir This is also used to get access to a particular folder within the 85*cdf0e10cSrcweir Package. For example: 86*cdf0e10cSrcweir getByHierarchicalName ("folder/subfolder/"); 87*cdf0e10cSrcweir This will return a PackageFolder which describes the contents of the specified 88*cdf0e10cSrcweir folder. 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir Calls to methods of XHierarchicalNameAccess must NOT have a leading slash. 91*cdf0e10cSrcweir */ 92*cdf0e10cSrcweir interface com::sun::star::container::XHierarchicalNameAccess; 93*cdf0e10cSrcweir /** 94*cdf0e10cSrcweir This interface is used to create new PackageStream or PackageFolder 95*cdf0e10cSrcweir implementation objects for addition to the Package. 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir createInstance - creates a new stream implementation object (when first 98*cdf0e10cSrcweir created, the new object is not part of the Package). It must be added 99*cdf0e10cSrcweir to the PackageFolder in which it will reside using the methods in the 100*cdf0e10cSrcweir PackageFolder service. 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir createInstanceWithArguments - This accepts one boolean value as an 103*cdf0e10cSrcweir argument. If it set to true, a PackageFolder implementation is created, 104*cdf0e10cSrcweir if it is set to false, a PackageStream implementation is created. 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir Creating and inserting a new stream would be done as follows: 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir 1. xNewStream = package->createInstanceWithArguments( false ); 109*cdf0e10cSrcweir 2. xDataStream = new MyStreamImpl(). (wherever the data comes from) 110*cdf0e10cSrcweir 3. xNewStream->setInputStream( xDataStream ); 111*cdf0e10cSrcweir 4. parentFolder->insertByName( "image.png", xNewStream ); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir Replacing an existing stream would be very similar, except that the 114*cdf0e10cSrcweir call ->insertByName would be replaced by ->replaceByName. 115*cdf0e10cSrcweir */ 116*cdf0e10cSrcweir interface com::sun::star::lang::XSingleServiceFactory; 117*cdf0e10cSrcweir /** 118*cdf0e10cSrcweir This interface is used to commit any changes to the Package. A new 119*cdf0e10cSrcweir Package file will be written with any new or changed streams/folders and 120*cdf0e10cSrcweir omitting any PackageStream or PackageFolder that has been removed. 121*cdf0e10cSrcweir */ 122*cdf0e10cSrcweir interface com::sun::star::util::XChangesBatch; 123*cdf0e10cSrcweir}; 124*cdf0e10cSrcweir}; }; }; }; 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir#endif 127