xref: /trunk/main/offapi/com/sun/star/frame/XStorable.idl (revision cdf0e10c)
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_frame_XStorable_idl__
28*cdf0e10cSrcweir#define __com_sun_star_frame_XStorable_idl__
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
31*cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
32*cdf0e10cSrcweir#endif
33*cdf0e10cSrcweir
34*cdf0e10cSrcweir#ifndef __com_sun_star_io_IOException_idl__
35*cdf0e10cSrcweir#include <com/sun/star/io/IOException.idl>
36*cdf0e10cSrcweir#endif
37*cdf0e10cSrcweir
38*cdf0e10cSrcweir#ifndef __com_sun_star_beans_PropertyValue_idl__
39*cdf0e10cSrcweir#include <com/sun/star/beans/PropertyValue.idl>
40*cdf0e10cSrcweir#endif
41*cdf0e10cSrcweir
42*cdf0e10cSrcweir
43*cdf0e10cSrcweir//=============================================================================
44*cdf0e10cSrcweir
45*cdf0e10cSrcweir module com {  module sun {  module star {  module frame {
46*cdf0e10cSrcweir
47*cdf0e10cSrcweir//=============================================================================
48*cdf0e10cSrcweir/** offers a simple way to store a component to an URL.
49*cdf0e10cSrcweir
50*cdf0e10cSrcweir    <p>
51*cdf0e10cSrcweir    It is usually only useful for two cases:
52*cdf0e10cSrcweir	</p>
53*cdf0e10cSrcweir	<ol>
54*cdf0e10cSrcweir        <li>
55*cdf0e10cSrcweir            Large components which are wrapped up in UNO interfaces
56*cdf0e10cSrcweir            and for which distinct filters are not available separately as
57*cdf0e10cSrcweir            components.
58*cdf0e10cSrcweir        </li>
59*cdf0e10cSrcweir        <li>
60*cdf0e10cSrcweir            Very small components for which only one or very few hard
61*cdf0e10cSrcweir            coded file format filters make sense or even exist.
62*cdf0e10cSrcweir        </li>
63*cdf0e10cSrcweir	</ol>
64*cdf0e10cSrcweir */
65*cdf0e10cSrcweirpublished interface XStorable: com::sun::star::uno::XInterface
66*cdf0e10cSrcweir{
67*cdf0e10cSrcweir	//-------------------------------------------------------------------------
68*cdf0e10cSrcweir    /** The object may know the location because it was loaded from there,
69*cdf0e10cSrcweir        or because it is stored there.
70*cdf0e10cSrcweir
71*cdf0e10cSrcweir        @returns
72*cdf0e10cSrcweir            <TRUE/> if the object knows a location where it is persistent
73*cdf0e10cSrcweir            <FALSE/> otherwise
74*cdf0e10cSrcweir	 */
75*cdf0e10cSrcweir	boolean hasLocation();
76*cdf0e10cSrcweir
77*cdf0e10cSrcweir	//-------------------------------------------------------------------------
78*cdf0e10cSrcweir    /** After <member>XStorable::storeAsURL()</member> it returns the
79*cdf0e10cSrcweir        URL the object was stored to.
80*cdf0e10cSrcweir
81*cdf0e10cSrcweir        @returns
82*cdf0e10cSrcweir            the URL of the resource which is represented by this object.
83*cdf0e10cSrcweir	 */
84*cdf0e10cSrcweir	string getLocation();
85*cdf0e10cSrcweir
86*cdf0e10cSrcweir	//-------------------------------------------------------------------------
87*cdf0e10cSrcweir    /** It is not possible to call <member>XStorable::store()</member> successfully
88*cdf0e10cSrcweir        when the data store is read-only.
89*cdf0e10cSrcweir
90*cdf0e10cSrcweir        @returns
91*cdf0e10cSrcweir            <TRUE/> if the data store is readonly or opened readonly
92*cdf0e10cSrcweir            <FALSE/> otherwise
93*cdf0e10cSrcweir	 */
94*cdf0e10cSrcweir	boolean isReadonly();
95*cdf0e10cSrcweir
96*cdf0e10cSrcweir	//-------------------------------------------------------------------------
97*cdf0e10cSrcweir	/** stores the data to the URL from which it was loaded.
98*cdf0e10cSrcweir
99*cdf0e10cSrcweir		<p>Only objects which know their locations can be stored.</p>
100*cdf0e10cSrcweir
101*cdf0e10cSrcweir        @throws com::sun::star::io::IOException
102*cdf0e10cSrcweir            if an IO error occured during save operation
103*cdf0e10cSrcweir            (may the location is unknown)
104*cdf0e10cSrcweir
105*cdf0e10cSrcweir        @see XStorable::storeAsURL
106*cdf0e10cSrcweir        @see XStorable::storeToURL
107*cdf0e10cSrcweir	 */
108*cdf0e10cSrcweir	void store()
109*cdf0e10cSrcweir			raises( com::sun::star::io::IOException );
110*cdf0e10cSrcweir
111*cdf0e10cSrcweir	//-------------------------------------------------------------------------
112*cdf0e10cSrcweir	/** stores the object's persistent data to a URL and
113*cdf0e10cSrcweir        makes this URL the new location of the object.
114*cdf0e10cSrcweir
115*cdf0e10cSrcweir        <p>This is the normal behavior for UI's "save-as" feature.</p>
116*cdf0e10cSrcweir
117*cdf0e10cSrcweir        <p>The change of the location makes it necessary to store the document in
118*cdf0e10cSrcweir        a format that the object can load. For this reason the implementation of
119*cdf0e10cSrcweir        <member>XStorable::storeAsURL()</member> will throw an exception if a pure
120*cdf0e10cSrcweir        export filter is used, it will accept only combined import/export filters.
121*cdf0e10cSrcweir        For such filters the method <member>XStorable::storeToURL()</member>
122*cdf0e10cSrcweir        must be used that does not change the location of the object.</p>
123*cdf0e10cSrcweir
124*cdf0e10cSrcweir        @param sURL
125*cdf0e10cSrcweir            specifies the new location of this component
126*cdf0e10cSrcweir
127*cdf0e10cSrcweir        @param lArguments
128*cdf0e10cSrcweir            optional parameters for saving
129*cdf0e10cSrcweir            (see <type scope="com::sun::star::document">MediaDescriptor</type> for further details)
130*cdf0e10cSrcweir
131*cdf0e10cSrcweir        @throws com::sun::star::io::IOException
132*cdf0e10cSrcweir            if an IO error occured during save operation
133*cdf0e10cSrcweir            (may the location is unknown)
134*cdf0e10cSrcweir
135*cdf0e10cSrcweir        @see XStorable::store
136*cdf0e10cSrcweir        @see XStorable::storeToURL
137*cdf0e10cSrcweir        @see com::sun::star::document::MediaDescriptor
138*cdf0e10cSrcweir	 */
139*cdf0e10cSrcweir    void storeAsURL(
140*cdf0e10cSrcweir        [in] string sURL,
141*cdf0e10cSrcweir        [in] sequence<com::sun::star::beans::PropertyValue> lArguments )
142*cdf0e10cSrcweir        raises( com::sun::star::io::IOException );
143*cdf0e10cSrcweir
144*cdf0e10cSrcweir	//-------------------------------------------------------------------------
145*cdf0e10cSrcweir	/** stores the object's persistent data to a URL and
146*cdf0e10cSrcweir		continues to be a representation of the old URL.
147*cdf0e10cSrcweir
148*cdf0e10cSrcweir        <p>This is the normal behavior for UI's export feature.</p>
149*cdf0e10cSrcweir
150*cdf0e10cSrcweir        <p>This method accepts all kinds of export filters, not only combined
151*cdf0e10cSrcweir        import/export filters because it implements an exporting capability, not a
152*cdf0e10cSrcweir        persistence capability.</p>
153*cdf0e10cSrcweir
154*cdf0e10cSrcweir        @throws com::sun::star::io::IOException
155*cdf0e10cSrcweir            if an IO error occured during save operation
156*cdf0e10cSrcweir            (may the location is unknown)
157*cdf0e10cSrcweir
158*cdf0e10cSrcweir        @param lArguments
159*cdf0e10cSrcweir            optional parameters for saving
160*cdf0e10cSrcweir            (see <type scope="com::sun::star::document">MediaDescriptor</type> for further details)
161*cdf0e10cSrcweir
162*cdf0e10cSrcweir        @see XStorable::store
163*cdf0e10cSrcweir        @see XStorable::storeAsURL
164*cdf0e10cSrcweir        @see com::sun::star::document::MediaDescriptor
165*cdf0e10cSrcweir	 */
166*cdf0e10cSrcweir    void storeToURL(
167*cdf0e10cSrcweir        [in] string sURL,
168*cdf0e10cSrcweir        [in] sequence<com::sun::star::beans::PropertyValue> lArguments )
169*cdf0e10cSrcweir        raises( com::sun::star::io::IOException );
170*cdf0e10cSrcweir};
171*cdf0e10cSrcweir
172*cdf0e10cSrcweir//=============================================================================
173*cdf0e10cSrcweir
174*cdf0e10cSrcweir}; }; }; };
175*cdf0e10cSrcweir
176*cdf0e10cSrcweir#endif
177