xref: /aoo42x/main/offapi/com/sun/star/frame/XModel.idl (revision fefd526c)
1d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10d1766043SAndrew Rist *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12d1766043SAndrew Rist *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19d1766043SAndrew Rist *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_frame_XModel_idl__
24cdf0e10cSrcweir#define __com_sun_star_frame_XModel_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweir#ifndef __com_sun_star_lang_XComponent_idl__
27cdf0e10cSrcweir#include <com/sun/star/lang/XComponent.idl>
28cdf0e10cSrcweir#endif
29cdf0e10cSrcweir
30cdf0e10cSrcweir#ifndef __com_sun_star_beans_PropertyValue_idl__
31cdf0e10cSrcweir#include <com/sun/star/beans/PropertyValue.idl>
32cdf0e10cSrcweir#endif
33cdf0e10cSrcweir
34cdf0e10cSrcweir#ifndef __com_sun_star_frame_XController_idl__
35cdf0e10cSrcweir#include <com/sun/star/frame/XController.idl>
36cdf0e10cSrcweir#endif
37cdf0e10cSrcweir
38cdf0e10cSrcweir#ifndef __com_sun_star_container_NoSuchElementException_idl__
39cdf0e10cSrcweir#include <com/sun/star/container/NoSuchElementException.idl>
40cdf0e10cSrcweir#endif
41cdf0e10cSrcweir
42cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
43cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
44cdf0e10cSrcweir#endif
45cdf0e10cSrcweir
46cdf0e10cSrcweir
47cdf0e10cSrcweir//=============================================================================
48cdf0e10cSrcweir
49cdf0e10cSrcweir module com {  module sun {  module star {  module frame {
50cdf0e10cSrcweir
51cdf0e10cSrcweir//=============================================================================
52cdf0e10cSrcweir/** represents a component which is created from an URL and arguments.
53cdf0e10cSrcweir
54cdf0e10cSrcweir    <p>
55cdf0e10cSrcweir    It is a representation of a resource in the sense that it was
56cdf0e10cSrcweir    created/loaded from the resource. The arguments are passed to the loader
57cdf0e10cSrcweir    to modify its behavior. An example for such an argument is "AsTemplate",
58cdf0e10cSrcweir    which loads the resource as a template for a new document.
59cdf0e10cSrcweir    (see <type scope="com::sun::star::document">MediaDescriptor</type> for further details)
60cdf0e10cSrcweir    </p>
61cdf0e10cSrcweir
62cdf0e10cSrcweir    <p>
63cdf0e10cSrcweir    Models can be controlled by controller components, which are usually
64cdf0e10cSrcweir    views of the model.
65cdf0e10cSrcweir    (see <type>Controller</type> for further details)
66cdf0e10cSrcweir    </p>
67cdf0e10cSrcweir
68cdf0e10cSrcweir    <p>
69cdf0e10cSrcweir    If there is at least one controller, there is by definition a
70cdf0e10cSrcweir    current controller. And if that controller supports the interface
71cdf0e10cSrcweir    <type scope="com::sun::star::view">XSelectionSupplier</type>, it has a current selection too.
72cdf0e10cSrcweir    </p>
73cdf0e10cSrcweir
74cdf0e10cSrcweir    @see com::sun::star::document::MediaDescriptor
75cdf0e10cSrcweir    @see Controller
76cdf0e10cSrcweir    @see com::sun::star::view::XSelectionSupplier
77cdf0e10cSrcweir */
78cdf0e10cSrcweirpublished interface XModel: com::sun::star::lang::XComponent
79cdf0e10cSrcweir{
80cdf0e10cSrcweir	//-------------------------------------------------------------------------
81cdf0e10cSrcweir	/** informs a model about its resource description.
82cdf0e10cSrcweir
83cdf0e10cSrcweir        @param URL
84cdf0e10cSrcweir            specifies the ressource
85cdf0e10cSrcweir
86cdf0e10cSrcweir        @param Arguments
87cdf0e10cSrcweir            are optional arguments for that ressource
88cdf0e10cSrcweir            (see <type scope="com::sun::star::document">MediaDescriptor</type>)
89cdf0e10cSrcweir
90cdf0e10cSrcweir        @return
91cdf0e10cSrcweir            <TRUE/> for success
92cdf0e10cSrcweir            <br>
93cdf0e10cSrcweir            <FALSE/> otherwise
94cdf0e10cSrcweir	 */
95cdf0e10cSrcweir    boolean attachResource(
96cdf0e10cSrcweir        [in] string URL,
97cdf0e10cSrcweir        [in] sequence<com::sun::star::beans::PropertyValue> Arguments);
98cdf0e10cSrcweir
99cdf0e10cSrcweir	//-------------------------------------------------------------------------
100cdf0e10cSrcweir    /** provides information about the location of this model
101cdf0e10cSrcweir
102cdf0e10cSrcweir        @returns
103cdf0e10cSrcweir            the URL of the resource which is represented by this model.
104cdf0e10cSrcweir
105cdf0e10cSrcweir        @see XStorable::getLocation()
106cdf0e10cSrcweir	 */
107cdf0e10cSrcweir	string getURL();
108cdf0e10cSrcweir
109cdf0e10cSrcweir	//-------------------------------------------------------------------------
110*fefd526cSmseidel    /** provides read access on currently representation of the
111cdf0e10cSrcweir        <type scope="com::sun::star::document">MediaDescriptor</type>
112cdf0e10cSrcweir        of this model which describes the model and his state
113cdf0e10cSrcweir
114cdf0e10cSrcweir        @returns
115cdf0e10cSrcweir            the arguments with which the model was originally created or
116cdf0e10cSrcweir            stored the last time.
117cdf0e10cSrcweir	 */
118cdf0e10cSrcweir    sequence< com::sun::star::beans::PropertyValue > getArgs();
119cdf0e10cSrcweir
120cdf0e10cSrcweir	//-------------------------------------------------------------------------
121cdf0e10cSrcweir	/** is called whenever a new controller is created for this model.
122cdf0e10cSrcweir
123cdf0e10cSrcweir        <p>
124cdf0e10cSrcweir        The <type scope="com::sun::star::lang">XComponent</type> interface
125cdf0e10cSrcweir        of the controller must be used to recognize when it is deleted.
126cdf0e10cSrcweir        </p>
127cdf0e10cSrcweir
128cdf0e10cSrcweir        @param Controller
129cdf0e10cSrcweir            a new controller for this model
130cdf0e10cSrcweir
131cdf0e10cSrcweir        @see XModel::disconnectController()
132cdf0e10cSrcweir	 */
133cdf0e10cSrcweir    [oneway] void connectController( [in] XController Controller );
134cdf0e10cSrcweir
135cdf0e10cSrcweir	//-------------------------------------------------------------------------
136cdf0e10cSrcweir    /** is called whenever an existing controller should be deregistered at this model.
137cdf0e10cSrcweir
138cdf0e10cSrcweir        <p>
139cdf0e10cSrcweir        The <type scope="com::sun::star::lang">XComponent</type> interface
140cdf0e10cSrcweir        of the controller must be used to recognize when it is deleted.
141cdf0e10cSrcweir        </p>
142cdf0e10cSrcweir
143cdf0e10cSrcweir        @param Controller
144cdf0e10cSrcweir            the existing controller which should be deregistered
145cdf0e10cSrcweir
146cdf0e10cSrcweir        @see XModel::connectController()
147cdf0e10cSrcweir	 */
148cdf0e10cSrcweir    [oneway] void disconnectController( [in] XController Controller );
149cdf0e10cSrcweir
150cdf0e10cSrcweir	//-------------------------------------------------------------------------
151cdf0e10cSrcweir	/** suspends some notifications to the controllers which are used
152cdf0e10cSrcweir		for display updates.
153cdf0e10cSrcweir
154cdf0e10cSrcweir        <p>
155cdf0e10cSrcweir        The calls to <member>XModel::lockControllers()</member> and
156cdf0e10cSrcweir        <member>XModel::unlockControllers()</member> may be
157cdf0e10cSrcweir		nested and even overlapping, but they must be in pairs. While
158cdf0e10cSrcweir		there is at least one lock remaining, some notifications
159cdf0e10cSrcweir        for display updates are not broadcasted.
160cdf0e10cSrcweir        </p>
161cdf0e10cSrcweir     */
162cdf0e10cSrcweir	[oneway] void lockControllers();
163cdf0e10cSrcweir
164cdf0e10cSrcweir	//-------------------------------------------------------------------------
165cdf0e10cSrcweir	/** resumes the notifications which were suspended by
166cdf0e10cSrcweir        <member>XModel::lockControllers()</member>.
167cdf0e10cSrcweir
168cdf0e10cSrcweir        <p>
169cdf0e10cSrcweir        The calls to <member>XModel::lockControllers()</member> and
170cdf0e10cSrcweir        <member>XModel::unlockControllers()</member> may be
171cdf0e10cSrcweir		nested and even overlapping, but they must be in pairs. While
172cdf0e10cSrcweir		there is at least one lock remaining, some notifications for
173cdf0e10cSrcweir		display updates are not broadcasted.
174cdf0e10cSrcweir        </p>
175cdf0e10cSrcweir	*/
176cdf0e10cSrcweir	[oneway] void unlockControllers();
177cdf0e10cSrcweir
178cdf0e10cSrcweir	//-------------------------------------------------------------------------
179cdf0e10cSrcweir	/** determines if there is at least one lock remaining.
180cdf0e10cSrcweir
181cdf0e10cSrcweir        <p>
182cdf0e10cSrcweir        While there is at least one lock remaining, some notifications
183cdf0e10cSrcweir        for display updates are not broadcasted to the controllers.
184cdf0e10cSrcweir        </p>
185cdf0e10cSrcweir
186cdf0e10cSrcweir        @return
187cdf0e10cSrcweir            <TRUE/> if any lock exist
188cdf0e10cSrcweir            <br>
189cdf0e10cSrcweir            <FALSE/> otherwise
190cdf0e10cSrcweir	 */
191cdf0e10cSrcweir	boolean hasControllersLocked();
192cdf0e10cSrcweir
193cdf0e10cSrcweir	//-------------------------------------------------------------------------
194cdf0e10cSrcweir    /** provides access to the controller which currently controls this model
195cdf0e10cSrcweir
196cdf0e10cSrcweir        @returns
197cdf0e10cSrcweir            If the controller which is active is a controller of this model,
198cdf0e10cSrcweir            it will be returned. If not, the controller which was the last
199cdf0e10cSrcweir            active of this model is returned. If no controller of this model
200cdf0e10cSrcweir            ever was active, the controller first registered is returned. If no
201cdf0e10cSrcweir            controller is registered for this model, <NULL/> is returned.
202cdf0e10cSrcweir	 */
203cdf0e10cSrcweir    XController getCurrentController();
204cdf0e10cSrcweir
205cdf0e10cSrcweir	//-------------------------------------------------------------------------
206cdf0e10cSrcweir	/** sets a registered controller as the current controller.
207cdf0e10cSrcweir
208cdf0e10cSrcweir        @param Controller
209cdf0e10cSrcweir            reference to an already existing connected controller, which should be
210cdf0e10cSrcweir            the new active one
211cdf0e10cSrcweir
212cdf0e10cSrcweir        @throws com::sun::star::container::NoSuchElementException
213cdf0e10cSrcweir            if <var>xController</var> isn't an already connected controller on this model
214cdf0e10cSrcweir	 */
215cdf0e10cSrcweir    void setCurrentController( [in] XController Controller )
216cdf0e10cSrcweir			raises( com::sun::star::container::NoSuchElementException );
217cdf0e10cSrcweir
218cdf0e10cSrcweir	//-------------------------------------------------------------------------
219cdf0e10cSrcweir    /** provides read access on current selection on controller
220cdf0e10cSrcweir
221cdf0e10cSrcweir        @returns
222cdf0e10cSrcweir            the current selection in the current controller.
223cdf0e10cSrcweir            If there is no current controller, it returns <NULL/>.
224cdf0e10cSrcweir	 */
225cdf0e10cSrcweir	com::sun::star::uno::XInterface getCurrentSelection();
226cdf0e10cSrcweir};
227cdf0e10cSrcweir
228cdf0e10cSrcweir//=============================================================================
229cdf0e10cSrcweir
230cdf0e10cSrcweir}; }; }; };
231cdf0e10cSrcweir
232cdf0e10cSrcweir#endif
233