xref: /trunk/main/offapi/com/sun/star/packages/Package.idl (revision ffd38472365e95f6a578737bc9a5eb0fac624a86)
1*d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*d1766043SAndrew Rist * distributed with this work for additional information
6*d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9*d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d1766043SAndrew Rist * software distributed under the License is distributed on an
15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17*d1766043SAndrew Rist * specific language governing permissions and limitations
18*d1766043SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*d1766043SAndrew Rist *************************************************************/
21*d1766043SAndrew Rist
22*d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_packages_Package_idl__
24cdf0e10cSrcweir#define __com_sun_star_packages_Package_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweir#ifndef __com_sun_star_lang_XInitialization_idl__
27cdf0e10cSrcweir#include <com/sun/star/lang/XInitialization.idl>
28cdf0e10cSrcweir#endif
29cdf0e10cSrcweir
30cdf0e10cSrcweir#ifndef __com_sun_star_container_XHierarchicalNameAccess_idl__
31cdf0e10cSrcweir#include <com/sun/star/container/XHierarchicalNameAccess.idl>
32cdf0e10cSrcweir#endif
33cdf0e10cSrcweir
34cdf0e10cSrcweir#ifndef __com_sun_star_lang_XSingleServiceFactory_idl__
35cdf0e10cSrcweir#include <com/sun/star/lang/XSingleServiceFactory.idl>
36cdf0e10cSrcweir#endif
37cdf0e10cSrcweir
38cdf0e10cSrcweir#ifndef __com_sun_star_util_XChangesBatch_idl__
39cdf0e10cSrcweir#include <com/sun/star/util/XChangesBatch.idl>
40cdf0e10cSrcweir#endif
41cdf0e10cSrcweir
42cdf0e10cSrcweir
43cdf0e10cSrcweir//=============================================================================
44cdf0e10cSrcweir
45cdf0e10cSrcweirmodule com {  module sun {  module star {  module packages {
46cdf0e10cSrcweir
47cdf0e10cSrcweir//=============================================================================
48cdf0e10cSrcweir/** The <type>Package</type> is a service that provides access to a set of
49cdf0e10cSrcweir    files and folders contained within a Package. One instance of the
50cdf0e10cSrcweir    Package service exists for each Package file to be manipulated.
51cdf0e10cSrcweir
52cdf0e10cSrcweir    Each instance is created with an argument which specifies the URL of
53cdf0e10cSrcweir    the Package file to which the user requires access. If the instance is
54cdf0e10cSrcweir    created without arguments, it must be initialised with the
55cdf0e10cSrcweir    <type scope="com::sun::star::lang">XInitialization</type> service methods
56cdf0e10cSrcweir    before it is a valid instance of the service.
57cdf0e10cSrcweir*/
58cdf0e10cSrcweirpublished service Package
59cdf0e10cSrcweir{
60cdf0e10cSrcweir    /**
61cdf0e10cSrcweir    A Package can be initialised with one of the following:
62cdf0e10cSrcweir
63cdf0e10cSrcweir    1. A file URL referring to a package.
64cdf0e10cSrcweir    2. An XInputStream referring to a package (it must also
65cdf0e10cSrcweir       support an XSeekable interface).
66cdf0e10cSrcweir    3. An XStream referring to a package. The XInputStream must support
67cdf0e10cSrcweir       an XSeekable interface, and the XOutputStream must support an
68cdf0e10cSrcweir       XTruncate interface.
69cdf0e10cSrcweir
70cdf0e10cSrcweir    It will throw a css::uno::Exception if initialised with bad data or
71cdf0e10cSrcweir    if the package has an invalid format (for example, a corrupt central d
72cdf0e10cSrcweir    irectory record if the file is a ZIP file).
73cdf0e10cSrcweir    */
74cdf0e10cSrcweir    interface com::sun::star::lang::XInitialization;
75cdf0e10cSrcweir    /**
76cdf0e10cSrcweir    This interface is used to get access to any entry within the package
77cdf0e10cSrcweir    For example:
78cdf0e10cSrcweir        getByHierarchicalName ("folder/subfolder/file1.txt");
79cdf0e10cSrcweir    This will return a PackageStream which refers to the specified stream.
80cdf0e10cSrcweir    This is also used to get access to a particular folder within the
81cdf0e10cSrcweir    Package. For example:
82cdf0e10cSrcweir        getByHierarchicalName ("folder/subfolder/");
83cdf0e10cSrcweir    This will return a PackageFolder which describes the contents of the specified
84cdf0e10cSrcweir    folder.
85cdf0e10cSrcweir
86cdf0e10cSrcweir    Calls to methods of XHierarchicalNameAccess must NOT have a leading slash.
87cdf0e10cSrcweir    */
88cdf0e10cSrcweir    interface com::sun::star::container::XHierarchicalNameAccess;
89cdf0e10cSrcweir    /**
90cdf0e10cSrcweir    This interface is used to create new PackageStream or PackageFolder
91cdf0e10cSrcweir    implementation objects for addition to the Package.
92cdf0e10cSrcweir
93cdf0e10cSrcweir    createInstance - creates a new stream implementation object (when first
94cdf0e10cSrcweir    created, the new object is not part of the Package). It must be added
95cdf0e10cSrcweir    to the PackageFolder in which it will reside using the methods in the
96cdf0e10cSrcweir    PackageFolder service.
97cdf0e10cSrcweir
98cdf0e10cSrcweir    createInstanceWithArguments - This accepts one boolean value as an
99cdf0e10cSrcweir    argument. If it set to true, a PackageFolder implementation is created,
100cdf0e10cSrcweir    if it is set to false, a PackageStream implementation is created.
101cdf0e10cSrcweir
102cdf0e10cSrcweir    Creating and inserting a new stream would be done as follows:
103cdf0e10cSrcweir
104cdf0e10cSrcweir        1. xNewStream = package->createInstanceWithArguments( false );
105cdf0e10cSrcweir        2. xDataStream = new MyStreamImpl(). (wherever the data comes from)
106cdf0e10cSrcweir        3. xNewStream->setInputStream( xDataStream );
107cdf0e10cSrcweir        4. parentFolder->insertByName( "image.png", xNewStream );
108cdf0e10cSrcweir
109cdf0e10cSrcweir    Replacing an existing stream would be very similar, except that the
110cdf0e10cSrcweir    call ->insertByName would be replaced by ->replaceByName.
111cdf0e10cSrcweir    */
112cdf0e10cSrcweir    interface com::sun::star::lang::XSingleServiceFactory;
113cdf0e10cSrcweir    /**
114cdf0e10cSrcweir    This interface is used to commit any changes to the Package. A new
115cdf0e10cSrcweir    Package file will be written with any new or changed streams/folders and
116cdf0e10cSrcweir    omitting any PackageStream or PackageFolder that has been removed.
117cdf0e10cSrcweir    */
118cdf0e10cSrcweir    interface com::sun::star::util::XChangesBatch;
119cdf0e10cSrcweir};
120cdf0e10cSrcweir}; }; }; };
121cdf0e10cSrcweir
122cdf0e10cSrcweir#endif
123