1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package com.sun.star.comp.beans;
29 
30 import com.sun.star.uno.UnoRuntime;
31 
32 /** Wrapper class for a com.sun.star.frame.XController.
33  *
34  * @since OOo 2.0.0
35  */
36 public class Controller
37 	extends Wrapper
38 	implements
39 		com.sun.star.frame.XController
40 {
41 	private com.sun.star.frame.XController xController;
42 	private com.sun.star.frame.XDispatchProvider xDispatchProvider;
43 
44 	Controller( com.sun.star.frame.XController xController )
45 	{
46 		super( xController );
47 		this.xController = xController;
48 		xDispatchProvider = (com.sun.star.frame.XDispatchProvider)
49 			UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class,
50 				xController );
51 	}
52 
53 	//==============================================================
54 	// com.sun.star.frame.XController
55 	//--------------------------------------------------------------
56 
57 	public void attachFrame( /*IN*/ com.sun.star.frame.XFrame xFrame )
58 	{
59 	    xController.attachFrame( xFrame );
60 	}
61 
62 	public boolean attachModel( /*IN*/ com.sun.star.frame.XModel xModel )
63 	{
64 	    return xController.attachModel( xModel );
65 	}
66 
67 	public boolean suspend( /*IN*/boolean bSuspend )
68 	{
69 	    return xController.suspend( bSuspend );
70 	}
71 
72 	public java.lang.Object getViewData(  )
73 	{
74 	    return xController.getViewData();
75 	}
76 
77 	public void restoreViewData( /*IN*/java.lang.Object aData )
78 	{
79 	    xController.restoreViewData( aData );
80 	}
81 
82 	public com.sun.star.frame.XModel getModel(  )
83 	{
84 	    return xController.getModel();
85 	}
86 
87 	public com.sun.star.frame.XFrame getFrame(  )
88 	{
89 	    return xController.getFrame();
90 	}
91 
92 	//==============================================================
93 	// com.sun.star.frame.XDispatchProvider
94 	//--------------------------------------------------------------
95 
96 	public com.sun.star.frame.XDispatch queryDispatch(
97 			/*IN*/ com.sun.star.util.URL aURL,
98 			/*IN*/ String aTargetFrameName,
99 			/*IN*/ int nSearchFlags )
100 	{
101 		return xDispatchProvider.queryDispatch( aURL, aTargetFrameName, nSearchFlags );
102 	}
103 
104 	public com.sun.star.frame.XDispatch[] queryDispatches(
105 			/*IN*/ com.sun.star.frame.DispatchDescriptor[] aRequests )
106 	{
107 		return xDispatchProvider.queryDispatches( aRequests );
108 	}
109 }
110 
111