Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / form / legacyformcontroller.cxx
blob94b2ae9834f040655fbceefee1a80e79b24c1398
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <fmservs.hxx>
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>
28 #include <cppuhelper/implbase.hxx>
29 #include <cppuhelper/supportsservice.hxx>
30 #include <comphelper/processfactory.hxx>
33 namespace svxform
37 using ::com::sun::star::uno::Reference;
38 using ::com::sun::star::uno::XInterface;
39 using ::com::sun::star::uno::Sequence;
40 using ::com::sun::star::uno::XComponentContext;
41 using ::com::sun::star::lang::XMultiServiceFactory;
42 using ::com::sun::star::awt::XControl;
43 using ::com::sun::star::awt::XTabControllerModel;
44 using ::com::sun::star::awt::XControlContainer;
45 using ::com::sun::star::lang::XServiceInfo;
46 using ::com::sun::star::form::runtime::FormController;
48 using namespace ::com::sun::star;
51 //= LegacyFormController
53 typedef ::cppu::WeakImplHelper < form::XFormController
54 , XServiceInfo
55 > LegacyFormController_Base;
57 namespace {
59 /** is an implementation of the legacy form controller service, namely css.form.FormController, supporting the
60 css.form.XFormController interface.
62 This legacy API is superseded by css.form.runtime.(X)FormController, and though we migrated all OOo-internal
63 usage of this old API, their might be clients external to OOo still using it (though this is rather unlikely).
65 class LegacyFormController : public LegacyFormController_Base
67 public:
68 static Reference< XInterface > Create( const Reference< XMultiServiceFactory >& _rxFactory )
70 return *( new LegacyFormController( comphelper::getComponentContext(_rxFactory) ) );
73 protected:
74 explicit LegacyFormController( const Reference< XComponentContext >& _rxContext )
75 :m_xDelegator( FormController::create(_rxContext) )
79 // form::XFormController
80 virtual Reference< XControl > SAL_CALL getCurrentControl( ) override;
81 virtual void SAL_CALL addActivateListener( const Reference< form::XFormControllerListener >& l ) override;
82 virtual void SAL_CALL removeActivateListener( const Reference< form::XFormControllerListener >& l ) override;
84 // awt::XTabController
85 virtual void SAL_CALL setModel( const Reference< XTabControllerModel >& Model ) override;
86 virtual Reference< XTabControllerModel > SAL_CALL getModel( ) override;
87 virtual void SAL_CALL setContainer( const Reference< XControlContainer >& Container ) override;
88 virtual Reference< XControlContainer > SAL_CALL getContainer( ) override;
89 virtual Sequence< Reference< XControl > > SAL_CALL getControls( ) override;
90 virtual void SAL_CALL autoTabOrder( ) override;
91 virtual void SAL_CALL activateTabOrder( ) override;
92 virtual void SAL_CALL activateFirst( ) override;
93 virtual void SAL_CALL activateLast( ) override;
95 // XServiceInfo
96 virtual OUString SAL_CALL getImplementationName( ) override;
97 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
98 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
100 private:
101 const Reference< form::runtime::XFormController > m_xDelegator;
106 Reference< XControl > SAL_CALL LegacyFormController::getCurrentControl( )
108 return m_xDelegator->getCurrentControl();
112 void SAL_CALL LegacyFormController::addActivateListener( const Reference< form::XFormControllerListener >& _listener )
114 m_xDelegator->addActivateListener( _listener );
118 void SAL_CALL LegacyFormController::removeActivateListener( const Reference< form::XFormControllerListener >& _listener )
120 m_xDelegator->removeActivateListener( _listener );
124 void SAL_CALL LegacyFormController::setModel( const Reference< XTabControllerModel >& _model )
126 m_xDelegator->setModel( _model );
130 Reference< XTabControllerModel > SAL_CALL LegacyFormController::getModel( )
132 return m_xDelegator->getModel();
136 void SAL_CALL LegacyFormController::setContainer( const Reference< XControlContainer >& _container )
138 m_xDelegator->setContainer( _container );
142 Reference< XControlContainer > SAL_CALL LegacyFormController::getContainer( )
144 return m_xDelegator->getContainer();
148 Sequence< Reference< XControl > > SAL_CALL LegacyFormController::getControls( )
150 return m_xDelegator->getControls();
154 void SAL_CALL LegacyFormController::autoTabOrder( )
156 m_xDelegator->autoTabOrder();
160 void SAL_CALL LegacyFormController::activateTabOrder( )
162 m_xDelegator->activateTabOrder();
166 void SAL_CALL LegacyFormController::activateFirst( )
168 m_xDelegator->activateFirst();
172 void SAL_CALL LegacyFormController::activateLast( )
174 m_xDelegator->activateLast();
178 OUString SAL_CALL LegacyFormController::getImplementationName( )
180 return "org.openoffice.comp.svx.LegacyFormController";
183 sal_Bool SAL_CALL LegacyFormController::supportsService( const OUString& _serviceName )
185 return cppu::supportsService(this, _serviceName);
188 Sequence< OUString > SAL_CALL LegacyFormController::getSupportedServiceNames( )
190 return { "com.sun.star.form.FormController", "com.sun.star.awt.control.TabController" };
195 css::uno::Reference< css::uno::XInterface >
196 LegacyFormController_NewInstance_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory > & _rxORB )
198 return ::svxform::LegacyFormController::Create( _rxORB );
201 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */