Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 : :
29 : : #include "fmservs.hxx"
30 : :
31 : : #include <com/sun/star/form/XFormController.hpp>
32 : : #include <com/sun/star/form/runtime/XFormController.hpp>
33 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 : : #include <com/sun/star/lang/XServiceInfo.hpp>
35 : :
36 : : #include <cppuhelper/implbase2.hxx>
37 : :
38 : : //........................................................................
39 : : namespace svxform
40 : : {
41 : : //........................................................................
42 : :
43 : : /** === begin UNO using === **/
44 : : using ::com::sun::star::uno::Reference;
45 : : using ::com::sun::star::uno::XInterface;
46 : : using ::com::sun::star::uno::UNO_QUERY;
47 : : using ::com::sun::star::uno::UNO_QUERY_THROW;
48 : : using ::com::sun::star::uno::UNO_SET_THROW;
49 : : using ::com::sun::star::uno::Exception;
50 : : using ::com::sun::star::uno::RuntimeException;
51 : : using ::com::sun::star::uno::Any;
52 : : using ::com::sun::star::uno::makeAny;
53 : : using ::com::sun::star::uno::Sequence;
54 : : using ::com::sun::star::uno::Type;
55 : : using ::com::sun::star::lang::XMultiServiceFactory;
56 : : using ::com::sun::star::awt::XControl;
57 : : using ::com::sun::star::awt::XTabControllerModel;
58 : : using ::com::sun::star::awt::XControlContainer;
59 : : using ::com::sun::star::lang::XServiceInfo;
60 : : /** === end UNO using === **/
61 : :
62 : : using namespace ::com::sun::star;
63 : :
64 : : //====================================================================
65 : : //= LegacyFormController
66 : : //====================================================================
67 : : typedef ::cppu::WeakImplHelper2 < form::XFormController
68 : : , XServiceInfo
69 : : > LegacyFormController_Base;
70 : : /** is an implementation of the legacy form controller service, namely css.form.FormController, supporting the
71 : : css.form.XFormController interface.
72 : :
73 : : This legacy API is superseded by css.form.runtime.(X)FormController, and though we migrated all OOo-internal
74 : : usage of this old API, their might be clients external to OOo still using it (though this is rather unlikely).
75 : : */
76 [ # # ]: 0 : class LegacyFormController : public LegacyFormController_Base
77 : : {
78 : : public:
79 : 0 : static Reference< XInterface > Create( const Reference< XMultiServiceFactory >& _rxFactory )
80 : : {
81 [ # # ]: 0 : return *( new LegacyFormController( _rxFactory ) );
82 : : }
83 : :
84 : : protected:
85 : 0 : LegacyFormController( const Reference< XMultiServiceFactory >& _rxFactory )
86 [ # # ][ # # ]: 0 : :m_xDelegator( _rxFactory->createInstance( FM_FORM_CONTROLLER ), UNO_QUERY_THROW )
[ # # ][ # # ]
87 : : {
88 : 0 : }
89 : :
90 : : // form::XFormController
91 : : virtual Reference< XControl > SAL_CALL getCurrentControl( ) throw (RuntimeException);
92 : : virtual void SAL_CALL addActivateListener( const Reference< form::XFormControllerListener >& l ) throw (RuntimeException);
93 : : virtual void SAL_CALL removeActivateListener( const Reference< form::XFormControllerListener >& l ) throw (RuntimeException);
94 : :
95 : : // awt::XTabController
96 : : virtual void SAL_CALL setModel( const Reference< XTabControllerModel >& Model ) throw (RuntimeException);
97 : : virtual Reference< XTabControllerModel > SAL_CALL getModel( ) throw (RuntimeException);
98 : : virtual void SAL_CALL setContainer( const Reference< XControlContainer >& Container ) throw (RuntimeException);
99 : : virtual Reference< XControlContainer > SAL_CALL getContainer( ) throw (RuntimeException);
100 : : virtual Sequence< Reference< XControl > > SAL_CALL getControls( ) throw (RuntimeException);
101 : : virtual void SAL_CALL autoTabOrder( ) throw (RuntimeException);
102 : : virtual void SAL_CALL activateTabOrder( ) throw (RuntimeException);
103 : : virtual void SAL_CALL activateFirst( ) throw (RuntimeException);
104 : : virtual void SAL_CALL activateLast( ) throw (RuntimeException);
105 : :
106 : : // XServiceInfo
107 : : virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
108 : : virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
109 : : virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
110 : :
111 : : private:
112 : : const Reference< form::runtime::XFormController > m_xDelegator;
113 : : };
114 : :
115 : : //--------------------------------------------------------------------
116 : 0 : Reference< XControl > SAL_CALL LegacyFormController::getCurrentControl( ) throw (RuntimeException)
117 : : {
118 : 0 : return m_xDelegator->getCurrentControl();
119 : : }
120 : :
121 : : //--------------------------------------------------------------------
122 : 0 : void SAL_CALL LegacyFormController::addActivateListener( const Reference< form::XFormControllerListener >& _listener ) throw (RuntimeException)
123 : : {
124 : 0 : m_xDelegator->addActivateListener( _listener );
125 : 0 : }
126 : :
127 : : //--------------------------------------------------------------------
128 : 0 : void SAL_CALL LegacyFormController::removeActivateListener( const Reference< form::XFormControllerListener >& _listener ) throw (RuntimeException)
129 : : {
130 : 0 : m_xDelegator->removeActivateListener( _listener );
131 : 0 : }
132 : :
133 : : //--------------------------------------------------------------------
134 : 0 : void SAL_CALL LegacyFormController::setModel( const Reference< XTabControllerModel >& _model ) throw (RuntimeException)
135 : : {
136 : 0 : m_xDelegator->setModel( _model );
137 : 0 : }
138 : :
139 : : //--------------------------------------------------------------------
140 : 0 : Reference< XTabControllerModel > SAL_CALL LegacyFormController::getModel( ) throw (RuntimeException)
141 : : {
142 : 0 : return m_xDelegator->getModel();
143 : : }
144 : :
145 : : //--------------------------------------------------------------------
146 : 0 : void SAL_CALL LegacyFormController::setContainer( const Reference< XControlContainer >& _container ) throw (RuntimeException)
147 : : {
148 : 0 : m_xDelegator->setContainer( _container );
149 : 0 : }
150 : :
151 : : //--------------------------------------------------------------------
152 : 0 : Reference< XControlContainer > SAL_CALL LegacyFormController::getContainer( ) throw (RuntimeException)
153 : : {
154 : 0 : return m_xDelegator->getContainer();
155 : : }
156 : :
157 : : //--------------------------------------------------------------------
158 : 0 : Sequence< Reference< XControl > > SAL_CALL LegacyFormController::getControls( ) throw (RuntimeException)
159 : : {
160 : 0 : return m_xDelegator->getControls();
161 : : }
162 : :
163 : : //--------------------------------------------------------------------
164 : 0 : void SAL_CALL LegacyFormController::autoTabOrder( ) throw (RuntimeException)
165 : : {
166 : 0 : m_xDelegator->autoTabOrder();
167 : 0 : }
168 : :
169 : : //--------------------------------------------------------------------
170 : 0 : void SAL_CALL LegacyFormController::activateTabOrder( ) throw (RuntimeException)
171 : : {
172 : 0 : m_xDelegator->activateTabOrder();
173 : 0 : }
174 : :
175 : : //--------------------------------------------------------------------
176 : 0 : void SAL_CALL LegacyFormController::activateFirst( ) throw (RuntimeException)
177 : : {
178 : 0 : m_xDelegator->activateFirst();
179 : 0 : }
180 : :
181 : : //--------------------------------------------------------------------
182 : 0 : void SAL_CALL LegacyFormController::activateLast( ) throw (RuntimeException)
183 : : {
184 : 0 : m_xDelegator->activateLast();
185 : 0 : }
186 : :
187 : : //--------------------------------------------------------------------
188 : 0 : ::rtl::OUString SAL_CALL LegacyFormController::getImplementationName( ) throw (RuntimeException)
189 : : {
190 : 0 : return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.svx.LegacyFormController" ) );
191 : : }
192 : :
193 : : //--------------------------------------------------------------------
194 : 0 : ::sal_Bool SAL_CALL LegacyFormController::supportsService( const ::rtl::OUString& _serviceName ) throw (RuntimeException)
195 : : {
196 [ # # ]: 0 : Sequence< ::rtl::OUString > aServices( getSupportedServiceNames() );
197 : 0 : const ::rtl::OUString* pServices = aServices.getConstArray();
198 [ # # ]: 0 : for ( sal_Int32 i = 0; i < aServices.getLength(); ++i, ++pServices )
199 [ # # ]: 0 : if( pServices->equals( _serviceName ) )
200 : 0 : return sal_True;
201 [ # # ]: 0 : return sal_False;
202 : : }
203 : :
204 : : //--------------------------------------------------------------------
205 : 0 : Sequence< ::rtl::OUString > SAL_CALL LegacyFormController::getSupportedServiceNames( ) throw (RuntimeException)
206 : : {
207 : 0 : Sequence< ::rtl::OUString > aServices(2);
208 [ # # ][ # # ]: 0 : aServices.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.FormController" ) );
209 [ # # ][ # # ]: 0 : aServices.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.control.TabController") );
210 : 0 : return aServices;
211 : : }
212 : :
213 : : //........................................................................
214 : : } // namespace svxform
215 : : //........................................................................
216 : :
217 : : //------------------------------------------------------------------
218 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
219 : 0 : LegacyFormController_NewInstance_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _rxORB )
220 : : {
221 : 0 : return ::svxform::LegacyFormController::Create( _rxORB );
222 : : }
223 : :
224 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|