xref: /trunk/main/offapi/com/sun/star/frame/XFrame.idl (revision ffd38472365e95f6a578737bc9a5eb0fac624a86)
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
10cdf0e10cSrcweir *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
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.
19cdf0e10cSrcweir *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_frame_XFrame_idl__
24cdf0e10cSrcweir#define __com_sun_star_frame_XFrame_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_awt_XWindow_idl__
31cdf0e10cSrcweir#include <com/sun/star/awt/XWindow.idl>
32cdf0e10cSrcweir#endif
33cdf0e10cSrcweir
34cdf0e10cSrcweir//=============================================================================
35cdf0e10cSrcweir
36cdf0e10cSrcweir module com {  module sun {  module star {  module frame {
37cdf0e10cSrcweir
38cdf0e10cSrcweir published interface XFrameActionListener;
39cdf0e10cSrcweir published interface XController;
40cdf0e10cSrcweir published interface XFramesSupplier;
41cdf0e10cSrcweir
42cdf0e10cSrcweir//=============================================================================
43cdf0e10cSrcweir/** a frame object can be considered to be an "anchor" object where a component
44cdf0e10cSrcweir    can be attached to.
45cdf0e10cSrcweir
46cdf0e10cSrcweir    <p>
47cdf0e10cSrcweir    A frame can be (it's not a must!) a part of a frame tree. If not this frame willn't be
48cdf0e10cSrcweir    accessible by using the api. This mode make sense for previews.
49cdf0e10cSrcweir    The root node of the tree can be a <type>Desktop</type> implementation.
50cdf0e10cSrcweir    </p>
51cdf0e10cSrcweir
52cdf0e10cSrcweir    @see Desktop
53cdf0e10cSrcweir */
54cdf0e10cSrcweirpublished interface XFrame: com::sun::star::lang::XComponent
55cdf0e10cSrcweir{
56cdf0e10cSrcweir    //-------------------------------------------------------------------------
57cdf0e10cSrcweir    /** is called to initialize the frame within a window - the container window.
58cdf0e10cSrcweir
59cdf0e10cSrcweir        <p>
60cdf0e10cSrcweir        This window will be used as parent for the component window and to support
61cdf0e10cSrcweir        some UI relevant features of the frame service.
62cdf0e10cSrcweir        Note: Re-parenting mustn't supported by a real frame implementation!
63cdf0e10cSrcweir        It's designed for initializing - not for setting.
64cdf0e10cSrcweir        </p>
65cdf0e10cSrcweir
66a893be29SPedro Giffuni        <p>This frame will take over ownership of the window referred from
67cdf0e10cSrcweir        <var>xWindow</var>.  Thus, the previous owner is not allowed to
68cdf0e10cSrcweir        dispose this window anymore. </p>
69cdf0e10cSrcweir
70cdf0e10cSrcweir        @param xWindow
71cdf0e10cSrcweir            the new container window
72cdf0e10cSrcweir
73cdf0e10cSrcweir        @see XFrame::getContainerWindow()
74cdf0e10cSrcweir     */
75cdf0e10cSrcweir    void initialize( [in] com::sun::star::awt::XWindow xWindow );
76cdf0e10cSrcweir
77cdf0e10cSrcweir    //-------------------------------------------------------------------------
78cdf0e10cSrcweir    /** provides access to the container window of the frame.
79cdf0e10cSrcweir
80cdf0e10cSrcweir        <p>
81cdf0e10cSrcweir        Normally this is used as the parent window of the
82cdf0e10cSrcweir        component window.
83cdf0e10cSrcweir        </p>
84cdf0e10cSrcweir
85cdf0e10cSrcweir        @return
86cdf0e10cSrcweir            the container window of this frame
87cdf0e10cSrcweir
88cdf0e10cSrcweir        @see XFrame::initialize()
89cdf0e10cSrcweir     */
90cdf0e10cSrcweir    com::sun::star::awt::XWindow getContainerWindow();
91cdf0e10cSrcweir
92cdf0e10cSrcweir    //-------------------------------------------------------------------------
93cdf0e10cSrcweir    /** sets the frame container that created this frame.
94cdf0e10cSrcweir
95cdf0e10cSrcweir        <p>
96cdf0e10cSrcweir        Only the creator is allowed to call this method.
97cdf0e10cSrcweir        But creator doesn't mean the implementation which creates this instance ...
98cdf0e10cSrcweir        it means the parent frame of the frame hierarchy.
99*2e3a1b6eSmseidel        Because; normally a frame should be created by using the api
100a893be29SPedro Giffuni        and is necessary for searches inside the tree (e.g. <member>XFrame::findFrame()</member>)
101cdf0e10cSrcweir        </p>
102cdf0e10cSrcweir
103cdf0e10cSrcweir        @param Creator
104cdf0e10cSrcweir            the creator (parent) of this frame
105cdf0e10cSrcweir
106cdf0e10cSrcweir        @see XFrame::getCreator()
107cdf0e10cSrcweir     */
108cdf0e10cSrcweir    [oneway] void setCreator( [in] XFramesSupplier Creator );
109cdf0e10cSrcweir
110cdf0e10cSrcweir    //-------------------------------------------------------------------------
111cdf0e10cSrcweir    /** provides access to the creator (parent) of this frame
112cdf0e10cSrcweir
113cdf0e10cSrcweir        @returns
114cdf0e10cSrcweir            the frame container that created and contains this frame.
115cdf0e10cSrcweir
116cdf0e10cSrcweir        @see XFrame::setCreator()
117cdf0e10cSrcweir     */
118cdf0e10cSrcweir    XFramesSupplier getCreator();
119cdf0e10cSrcweir
120cdf0e10cSrcweir    //-------------------------------------------------------------------------
121cdf0e10cSrcweir    /** access to the name property of this frame
122cdf0e10cSrcweir
123cdf0e10cSrcweir        @returns
124cdf0e10cSrcweir            the programmatic name of this frame.
125cdf0e10cSrcweir
126cdf0e10cSrcweir        @see XFrame::setName()
127cdf0e10cSrcweir     */
128cdf0e10cSrcweir    string getName();
129cdf0e10cSrcweir
130cdf0e10cSrcweir    //-------------------------------------------------------------------------
131cdf0e10cSrcweir    /** sets the name of the frame.
132cdf0e10cSrcweir
133cdf0e10cSrcweir        <p>
134cdf0e10cSrcweir        Normally the name of the frame is set initially (e.g. by the creator).
135cdf0e10cSrcweir        The name of a frame will be used for identifying it if a frame search was started.
136cdf0e10cSrcweir        These searches can be forced by:
137cdf0e10cSrcweir        <ul>
138cdf0e10cSrcweir            <li><member>XFrame::findFrame()</member>
139cdf0e10cSrcweir            <li><member>XDispatchProvider::queryDispatch()</member>
140cdf0e10cSrcweir            <li><member>XComponentLoader::loadComponentFromURL()</member>
141cdf0e10cSrcweir        </ul>
142cdf0e10cSrcweir        Note: Special targets like "_blank", "_self" etc. are not allowed.
143cdf0e10cSrcweir        That's why frame names shouldn't start with a sign "_".
144cdf0e10cSrcweir        </p>
145cdf0e10cSrcweir
146cdf0e10cSrcweir        @param aName
147cdf0e10cSrcweir            the new programmatic name of this frame
148cdf0e10cSrcweir
149cdf0e10cSrcweir        @see XFrame::findFrame()
150cdf0e10cSrcweir        @see XFrame::getName()
151cdf0e10cSrcweir        @see XDispatchProvider
152cdf0e10cSrcweir        @see XComponentLoader
153cdf0e10cSrcweir     */
154cdf0e10cSrcweir    [oneway] void setName( [in] string aName );
155cdf0e10cSrcweir
156cdf0e10cSrcweir    //-------------------------------------------------------------------------
157cdf0e10cSrcweir    /** searches for a frame with the specified name.
158cdf0e10cSrcweir
159cdf0e10cSrcweir        <p>
160cdf0e10cSrcweir        Frames may contain other frames (e.g., a frameset) and may
161cdf0e10cSrcweir        be contained in other frames. This hierarchy is searched with
162cdf0e10cSrcweir        this method.
163cdf0e10cSrcweir        First some special names are taken into account, i.e. "",
164cdf0e10cSrcweir        "_self", "_top", "_blank" etc. <var>SearchFlags</var> is ignored when
165cdf0e10cSrcweir        comparing these names with <var>TargetFrameName</var>; further steps are
166cdf0e10cSrcweir        controlled by <var>SearchFlags</var>. If allowed, the name of the frame
167cdf0e10cSrcweir        itself is compared with the desired one, and then ( again if allowed )
168cdf0e10cSrcweir        the method is called for all children of the frame. Finally may be called
169cdf0e10cSrcweir        for the siblings and then for parent frame (if allowed).
170cdf0e10cSrcweir        </p>
171cdf0e10cSrcweir
172cdf0e10cSrcweir        <p>
173cdf0e10cSrcweir        List of special target names:
174cdf0e10cSrcweir        <table border=1>
175cdf0e10cSrcweir        <tr><td>""/"_self"</td><td>address the starting frame itself</td></tr>
176cdf0e10cSrcweir        <tr><td>"_parent"</td><td>address the direct parent frame only</td></tr>
177cdf0e10cSrcweir        <tr><td>"_top"</td><td>address the top frame of this subtree of the frametree</td></tr>
178cdf0e10cSrcweir        <tr><td>"_blank"</td><td>creates a new top frame</td></tr>
179cdf0e10cSrcweir        </table>
180cdf0e10cSrcweir        </p>
181cdf0e10cSrcweir
182cdf0e10cSrcweir        <p>
183cdf0e10cSrcweir        If no frame with the given name is found, a new top frame is
184cdf0e10cSrcweir        created; if this is allowed by a special flag <const>FrameSearchFlag::CREATE</const>.
185cdf0e10cSrcweir        The new frame also gets the desired name.
186cdf0e10cSrcweir        </p>
187cdf0e10cSrcweir
188cdf0e10cSrcweir        @param aTargetFrameName
189cdf0e10cSrcweir            identify
190cdf0e10cSrcweir            <ul><li>(a) a special target ("_blank","_self" ...) or</li>
191cdf0e10cSrcweir                <li>(b) any well known frame</li><ul>
192cdf0e10cSrcweir            to search it inside the current hierarchy
193cdf0e10cSrcweir
194cdf0e10cSrcweir        @param nSearchFlags
195cdf0e10cSrcweir            optional parameter to regulate search if no special target was used for <var>TargetFrameName</var>
196cdf0e10cSrcweir
197cdf0e10cSrcweir         @see FrameSearchFlag
198cdf0e10cSrcweir         */
199cdf0e10cSrcweir    XFrame findFrame(
200cdf0e10cSrcweir        [in] string aTargetFrameName,
201cdf0e10cSrcweir        [in] long nSearchFlags);
202cdf0e10cSrcweir
203cdf0e10cSrcweir    //-------------------------------------------------------------------------
204cdf0e10cSrcweir    /** determines if the frame is a top frame.
205cdf0e10cSrcweir
206cdf0e10cSrcweir        <p>
207cdf0e10cSrcweir        In general a top frame is the frame which is a direct child of
208cdf0e10cSrcweir        a task frame or which does not have a parent. Possible frame searches must
209cdf0e10cSrcweir        stop the search at such a frame unless the flag <const>FrameSearchFlag::TASKS</const>
210cdf0e10cSrcweir        is set.
211cdf0e10cSrcweir        </p>
212cdf0e10cSrcweir
213cdf0e10cSrcweir        @return
214cdf0e10cSrcweir            <TRUE/> if frame supports top frame specification
215cdf0e10cSrcweir            <br>
216cdf0e10cSrcweir            <FALSE/> otherwise
217cdf0e10cSrcweir     */
218cdf0e10cSrcweir    boolean isTop();
219cdf0e10cSrcweir
220cdf0e10cSrcweir    //-------------------------------------------------------------------------
221cdf0e10cSrcweir    /** activates this frame and thus the component within.
222cdf0e10cSrcweir
223cdf0e10cSrcweir        <p>
224cdf0e10cSrcweir        At first the frame sets itself as the active frame of its
225cdf0e10cSrcweir        creator by calling <member>XFramesSupplier::setActiveFrame()</member>,
226cdf0e10cSrcweir        then it broadcasts an <type>FrameActionEvent</type> with
227cdf0e10cSrcweir        <const>FrameAction::FRAME_ACTIVATED</const>. The component within
228cdf0e10cSrcweir        this frame may listen to this event to grab the focus on activation;
229cdf0e10cSrcweir        for simple components this can be done by the <type>FrameLoader</type>.
230cdf0e10cSrcweir        </p>
231cdf0e10cSrcweir
232cdf0e10cSrcweir        <p>
233cdf0e10cSrcweir        Finally, most frames may grab the focus to one of its windows
234cdf0e10cSrcweir        or forward the activation to a sub-frame.
235cdf0e10cSrcweir        </p>
236cdf0e10cSrcweir
237cdf0e10cSrcweir        @see XFrame::deactivate()
238cdf0e10cSrcweir        @see XFrame::isActive()
239cdf0e10cSrcweir    */
240cdf0e10cSrcweir    [oneway] void activate();
241cdf0e10cSrcweir
242cdf0e10cSrcweir    //-------------------------------------------------------------------------
243cdf0e10cSrcweir    /** is called by the creator frame when another sub-frame gets activated.
244cdf0e10cSrcweir
245cdf0e10cSrcweir        <p>
246cdf0e10cSrcweir        At first the frame deactivates its active sub-frame, if any.
247cdf0e10cSrcweir        Then broadcasts a <type>FrameActionEvent</type> with
248cdf0e10cSrcweir        <const>FrameAction::FRAME_DEACTIVATING</const>.
249cdf0e10cSrcweir        </p>
250cdf0e10cSrcweir
251cdf0e10cSrcweir        @see XFrame::activate()
252cdf0e10cSrcweir        @see XFrame::isActive()
253cdf0e10cSrcweir     */
254cdf0e10cSrcweir    [oneway] void deactivate();
255cdf0e10cSrcweir
256cdf0e10cSrcweir    //-------------------------------------------------------------------------
257cdf0e10cSrcweir    /** determines if the frame is active.
258cdf0e10cSrcweir
259cdf0e10cSrcweir        @return
260cdf0e10cSrcweir            <TRUE/> for active or UI active frames
261cdf0e10cSrcweir            <br>
262cdf0e10cSrcweir            <FALSE/> otherwise
263cdf0e10cSrcweir
264cdf0e10cSrcweir        @see XFrame::activate()
265cdf0e10cSrcweir        @see XFrame::deactivate()
266cdf0e10cSrcweir     */
267cdf0e10cSrcweir    boolean isActive();
268cdf0e10cSrcweir
269cdf0e10cSrcweir    //-------------------------------------------------------------------------
270cdf0e10cSrcweir    /** sets a new component into the frame or release an existing one from a frame.
271cdf0e10cSrcweir
272cdf0e10cSrcweir        @param xComponentWindow
273cdf0e10cSrcweir            the window of the new component or <NULL/> for release
274cdf0e10cSrcweir
275cdf0e10cSrcweir            <p>
276cdf0e10cSrcweir            A valid component window should be a child of the frame container window.
277cdf0e10cSrcweir            </p>
278cdf0e10cSrcweir
279cdf0e10cSrcweir        @param xController
280cdf0e10cSrcweir            the controller of the new component or <NULL/> for release
281cdf0e10cSrcweir
282cdf0e10cSrcweir            <p>
283cdf0e10cSrcweir            Simple components may implement a <type scope="com::sun::star::awt">XWindow</type> only.
284cdf0e10cSrcweir            In this case no controller must be given here.
285cdf0e10cSrcweir            </p>
286cdf0e10cSrcweir
287cdf0e10cSrcweir        @return
288cdf0e10cSrcweir            <TRUE/>if setting of new component or release of an existing one was successfully
289cdf0e10cSrcweir            <br>
290a893be29SPedro Giffuni            <FALSE/> otherwise (especially, if an existing controller disagree within his
291cdf0e10cSrcweir            <member>XController::suspend()</member> call)
292cdf0e10cSrcweir
293cdf0e10cSrcweir        @see XFrame::getComponentWindow()
294cdf0e10cSrcweir        @see XFrame::getContainerWindow()
295cdf0e10cSrcweir        @see XFrame::getController()
296cdf0e10cSrcweir     */
297cdf0e10cSrcweir    boolean setComponent(
298cdf0e10cSrcweir        [in] com::sun::star::awt::XWindow xComponentWindow,
299cdf0e10cSrcweir        [in] XController xController);
300cdf0e10cSrcweir
301cdf0e10cSrcweir    //-------------------------------------------------------------------------
302cdf0e10cSrcweir    /** provides access to the component window
303cdf0e10cSrcweir
304cdf0e10cSrcweir        <p>
305cdf0e10cSrcweir        Note: Don't dispose this window - the frame is the owner of it.
306cdf0e10cSrcweir        </p>
307cdf0e10cSrcweir
308cdf0e10cSrcweir        @returns
309cdf0e10cSrcweir            the current visible component in this frame
310cdf0e10cSrcweir            <br>
311cdf0e10cSrcweir            or <NULL/> if no one currently exist
312cdf0e10cSrcweir
313cdf0e10cSrcweir        @see XFrame::setComponent()
314cdf0e10cSrcweir     */
315cdf0e10cSrcweir    com::sun::star::awt::XWindow getComponentWindow();
316cdf0e10cSrcweir
317cdf0e10cSrcweir    //-------------------------------------------------------------------------
318cdf0e10cSrcweir    /** provides access to the controller
319cdf0e10cSrcweir
320cdf0e10cSrcweir        <p>
321cdf0e10cSrcweir        Note: Don't dispose it - the frame is the owner of it.
322cdf0e10cSrcweir        Use <member>XController::getFrame()</member> to dispose
323cdf0e10cSrcweir        the frame after you the controller agreed with a
324cdf0e10cSrcweir        <member>XController::suspend()</member> call.
325cdf0e10cSrcweir        </p>
326cdf0e10cSrcweir
327cdf0e10cSrcweir        @returns
328cdf0e10cSrcweir            the current controller within this frame
329cdf0e10cSrcweir            <br>
330cdf0e10cSrcweir            or <NULL/> if no one currently exist
331cdf0e10cSrcweir
332cdf0e10cSrcweir        @see XFrame::setComponent()
333cdf0e10cSrcweir     */
334cdf0e10cSrcweir    XController getController();
335cdf0e10cSrcweir
336cdf0e10cSrcweir    //-------------------------------------------------------------------------
337cdf0e10cSrcweir    /** notifies the frame that the context of the controller within this
338cdf0e10cSrcweir        frame changed (i.e. the selection).
339cdf0e10cSrcweir
340cdf0e10cSrcweir        <p>
341cdf0e10cSrcweir        According to a call to this interface, the frame calls
342cdf0e10cSrcweir        <method>XFrameEventListener::frameAction</method> with
343cdf0e10cSrcweir        <const>FrameAction::CONTEXT_CHANGED</const> to all listeners which
344cdf0e10cSrcweir        are registered using <member>XFrame::addFrameActionListener</member>.
345cdf0e10cSrcweir        For external controllers this event can be used to requery dispatches.
346cdf0e10cSrcweir
347cdf0e10cSrcweir        @see XFrameEventListener
348cdf0e10cSrcweir        @see FrameAction
349cdf0e10cSrcweir        @see XFrame::addFrameActionListener()
350cdf0e10cSrcweir    */
351cdf0e10cSrcweir    void contextChanged();
352cdf0e10cSrcweir
353cdf0e10cSrcweir    //-------------------------------------------------------------------------
354cdf0e10cSrcweir    /** registers an event listener, which will be called when certain things
355cdf0e10cSrcweir        happen to the components within this frame or within sub-frames of this frame.
356cdf0e10cSrcweir
357cdf0e10cSrcweir        <p>
358cdf0e10cSrcweir        E.g., it is possible to determine instantiation/destruction and
359cdf0e10cSrcweir        activation/deactivation of components.
360cdf0e10cSrcweir        </p>
361cdf0e10cSrcweir
362cdf0e10cSrcweir        @param xListener
363cdf0e10cSrcweir            specifies the listener which will be informed
364cdf0e10cSrcweir
365cdf0e10cSrcweir        @see XFrame::removeFrameActionListener()
366cdf0e10cSrcweir     */
367cdf0e10cSrcweir    [oneway] void addFrameActionListener( [in]XFrameActionListener xListener );
368cdf0e10cSrcweir
369cdf0e10cSrcweir    //-------------------------------------------------------------------------
370cdf0e10cSrcweir    /** unregisters an event listener
371cdf0e10cSrcweir
372cdf0e10cSrcweir        @param xListener
373cdf0e10cSrcweir            specifies the listener which willn't be informed any longer
374cdf0e10cSrcweir
375cdf0e10cSrcweir        @see XFrame::addFrameActionListener()
376cdf0e10cSrcweir     */
377cdf0e10cSrcweir    [oneway] void removeFrameActionListener( [in] XFrameActionListener xListener );
378cdf0e10cSrcweir};
379cdf0e10cSrcweir
380cdf0e10cSrcweir//=============================================================================
381cdf0e10cSrcweir
382cdf0e10cSrcweir}; }; }; };
383cdf0e10cSrcweir
384cdf0e10cSrcweir#endif
385