Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "fmservs.hxx"
22 :
23 : #include <com/sun/star/form/XFormController.hpp>
24 : #include <com/sun/star/form/runtime/FormController.hpp>
25 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 : #include <com/sun/star/lang/XServiceInfo.hpp>
27 :
28 : #include <cppuhelper/implbase2.hxx>
29 : #include <cppuhelper/supportsservice.hxx>
30 : #include <comphelper/processfactory.hxx>
31 :
32 :
33 : namespace svxform
34 : {
35 :
36 :
37 : using ::com::sun::star::uno::Reference;
38 : using ::com::sun::star::uno::XInterface;
39 : using ::com::sun::star::uno::UNO_QUERY;
40 : using ::com::sun::star::uno::UNO_QUERY_THROW;
41 : using ::com::sun::star::uno::UNO_SET_THROW;
42 : using ::com::sun::star::uno::Exception;
43 : using ::com::sun::star::uno::RuntimeException;
44 : using ::com::sun::star::uno::Any;
45 : using ::com::sun::star::uno::makeAny;
46 : using ::com::sun::star::uno::Sequence;
47 : using ::com::sun::star::uno::Type;
48 : using ::com::sun::star::uno::XComponentContext;
49 : using ::com::sun::star::lang::XMultiServiceFactory;
50 : using ::com::sun::star::awt::XControl;
51 : using ::com::sun::star::awt::XTabControllerModel;
52 : using ::com::sun::star::awt::XControlContainer;
53 : using ::com::sun::star::lang::XServiceInfo;
54 : using ::com::sun::star::form::runtime::FormController;
55 :
56 : using namespace ::com::sun::star;
57 :
58 :
59 : //= LegacyFormController
60 :
61 : typedef ::cppu::WeakImplHelper2 < form::XFormController
62 : , XServiceInfo
63 : > LegacyFormController_Base;
64 : /** is an implementation of the legacy form controller service, namely css.form.FormController, supporting the
65 : css.form.XFormController interface.
66 :
67 : This legacy API is superseded by css.form.runtime.(X)FormController, and though we migrated all OOo-internal
68 : usage of this old API, their might be clients external to OOo still using it (though this is rather unlikely).
69 : */
70 0 : class LegacyFormController : public LegacyFormController_Base
71 : {
72 : public:
73 0 : static Reference< XInterface > Create( const Reference< XMultiServiceFactory >& _rxFactory )
74 : {
75 0 : return *( new LegacyFormController( comphelper::getComponentContext(_rxFactory) ) );
76 : }
77 :
78 : protected:
79 0 : explicit LegacyFormController( const Reference< XComponentContext >& _rxContext )
80 0 : :m_xDelegator( FormController::create(_rxContext) )
81 : {
82 0 : }
83 :
84 : // form::XFormController
85 : virtual Reference< XControl > SAL_CALL getCurrentControl( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
86 : virtual void SAL_CALL addActivateListener( const Reference< form::XFormControllerListener >& l ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
87 : virtual void SAL_CALL removeActivateListener( const Reference< form::XFormControllerListener >& l ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
88 :
89 : // awt::XTabController
90 : virtual void SAL_CALL setModel( const Reference< XTabControllerModel >& Model ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
91 : virtual Reference< XTabControllerModel > SAL_CALL getModel( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
92 : virtual void SAL_CALL setContainer( const Reference< XControlContainer >& Container ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
93 : virtual Reference< XControlContainer > SAL_CALL getContainer( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
94 : virtual Sequence< Reference< XControl > > SAL_CALL getControls( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
95 : virtual void SAL_CALL autoTabOrder( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
96 : virtual void SAL_CALL activateTabOrder( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
97 : virtual void SAL_CALL activateFirst( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
98 : virtual void SAL_CALL activateLast( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
99 :
100 : // XServiceInfo
101 : virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
102 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
103 : virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
104 :
105 : private:
106 : const Reference< form::runtime::XFormController > m_xDelegator;
107 : };
108 :
109 :
110 0 : Reference< XControl > SAL_CALL LegacyFormController::getCurrentControl( ) throw (RuntimeException, std::exception)
111 : {
112 0 : return m_xDelegator->getCurrentControl();
113 : }
114 :
115 :
116 0 : void SAL_CALL LegacyFormController::addActivateListener( const Reference< form::XFormControllerListener >& _listener ) throw (RuntimeException, std::exception)
117 : {
118 0 : m_xDelegator->addActivateListener( _listener );
119 0 : }
120 :
121 :
122 0 : void SAL_CALL LegacyFormController::removeActivateListener( const Reference< form::XFormControllerListener >& _listener ) throw (RuntimeException, std::exception)
123 : {
124 0 : m_xDelegator->removeActivateListener( _listener );
125 0 : }
126 :
127 :
128 0 : void SAL_CALL LegacyFormController::setModel( const Reference< XTabControllerModel >& _model ) throw (RuntimeException, std::exception)
129 : {
130 0 : m_xDelegator->setModel( _model );
131 0 : }
132 :
133 :
134 0 : Reference< XTabControllerModel > SAL_CALL LegacyFormController::getModel( ) throw (RuntimeException, std::exception)
135 : {
136 0 : return m_xDelegator->getModel();
137 : }
138 :
139 :
140 0 : void SAL_CALL LegacyFormController::setContainer( const Reference< XControlContainer >& _container ) throw (RuntimeException, std::exception)
141 : {
142 0 : m_xDelegator->setContainer( _container );
143 0 : }
144 :
145 :
146 0 : Reference< XControlContainer > SAL_CALL LegacyFormController::getContainer( ) throw (RuntimeException, std::exception)
147 : {
148 0 : return m_xDelegator->getContainer();
149 : }
150 :
151 :
152 0 : Sequence< Reference< XControl > > SAL_CALL LegacyFormController::getControls( ) throw (RuntimeException, std::exception)
153 : {
154 0 : return m_xDelegator->getControls();
155 : }
156 :
157 :
158 0 : void SAL_CALL LegacyFormController::autoTabOrder( ) throw (RuntimeException, std::exception)
159 : {
160 0 : m_xDelegator->autoTabOrder();
161 0 : }
162 :
163 :
164 0 : void SAL_CALL LegacyFormController::activateTabOrder( ) throw (RuntimeException, std::exception)
165 : {
166 0 : m_xDelegator->activateTabOrder();
167 0 : }
168 :
169 :
170 0 : void SAL_CALL LegacyFormController::activateFirst( ) throw (RuntimeException, std::exception)
171 : {
172 0 : m_xDelegator->activateFirst();
173 0 : }
174 :
175 :
176 0 : void SAL_CALL LegacyFormController::activateLast( ) throw (RuntimeException, std::exception)
177 : {
178 0 : m_xDelegator->activateLast();
179 0 : }
180 :
181 :
182 0 : OUString SAL_CALL LegacyFormController::getImplementationName( ) throw (RuntimeException, std::exception)
183 : {
184 0 : return OUString( "org.openoffice.comp.svx.LegacyFormController" );
185 : }
186 :
187 0 : sal_Bool SAL_CALL LegacyFormController::supportsService( const OUString& _serviceName ) throw (RuntimeException, std::exception)
188 : {
189 0 : return cppu::supportsService(this, _serviceName);
190 : }
191 :
192 0 : Sequence< OUString > SAL_CALL LegacyFormController::getSupportedServiceNames( ) throw (RuntimeException, std::exception)
193 : {
194 0 : Sequence< OUString > aServices(2);
195 0 : aServices.getArray()[0] = "com.sun.star.form.FormController";
196 0 : aServices.getArray()[1] = "com.sun.star.awt.control.TabController";
197 0 : return aServices;
198 : }
199 :
200 : }
201 :
202 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
203 0 : LegacyFormController_NewInstance_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _rxORB )
204 : throw (css::uno::Exception)
205 : {
206 0 : return ::svxform::LegacyFormController::Create( _rxORB );
207 : }
208 :
209 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|