LibreOffice Module svx (master)  1
legacyformcontroller.cxx
Go to the documentation of this file.
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/implbase.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::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;
47 
48  using namespace ::com::sun::star;
49 
50 
51  //= LegacyFormController
52 
53  typedef ::cppu::WeakImplHelper < form::XFormController
54  , XServiceInfo
56 
57  namespace {
58 
65  class LegacyFormController : public LegacyFormController_Base
66  {
67  public:
68  static Reference< XInterface > Create( const Reference< XMultiServiceFactory >& _rxFactory )
69  {
70  return *( new LegacyFormController( comphelper::getComponentContext(_rxFactory) ) );
71  }
72 
73  protected:
74  explicit LegacyFormController( const Reference< XComponentContext >& _rxContext )
75  :m_xDelegator( FormController::create(_rxContext) )
76  {
77  }
78 
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;
83 
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;
94 
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;
99 
100  private:
101  const Reference< form::runtime::XFormController > m_xDelegator;
102  };
103 
104  }
105 
106  Reference< XControl > SAL_CALL LegacyFormController::getCurrentControl( )
107  {
108  return m_xDelegator->getCurrentControl();
109  }
110 
111 
112  void SAL_CALL LegacyFormController::addActivateListener( const Reference< form::XFormControllerListener >& _listener )
113  {
114  m_xDelegator->addActivateListener( _listener );
115  }
116 
117 
118  void SAL_CALL LegacyFormController::removeActivateListener( const Reference< form::XFormControllerListener >& _listener )
119  {
120  m_xDelegator->removeActivateListener( _listener );
121  }
122 
123 
124  void SAL_CALL LegacyFormController::setModel( const Reference< XTabControllerModel >& _model )
125  {
126  m_xDelegator->setModel( _model );
127  }
128 
129 
130  Reference< XTabControllerModel > SAL_CALL LegacyFormController::getModel( )
131  {
132  return m_xDelegator->getModel();
133  }
134 
135 
136  void SAL_CALL LegacyFormController::setContainer( const Reference< XControlContainer >& _container )
137  {
138  m_xDelegator->setContainer( _container );
139  }
140 
141 
142  Reference< XControlContainer > SAL_CALL LegacyFormController::getContainer( )
143  {
144  return m_xDelegator->getContainer();
145  }
146 
147 
148  Sequence< Reference< XControl > > SAL_CALL LegacyFormController::getControls( )
149  {
150  return m_xDelegator->getControls();
151  }
152 
153 
154  void SAL_CALL LegacyFormController::autoTabOrder( )
155  {
156  m_xDelegator->autoTabOrder();
157  }
158 
159 
160  void SAL_CALL LegacyFormController::activateTabOrder( )
161  {
162  m_xDelegator->activateTabOrder();
163  }
164 
165 
166  void SAL_CALL LegacyFormController::activateFirst( )
167  {
168  m_xDelegator->activateFirst();
169  }
170 
171 
172  void SAL_CALL LegacyFormController::activateLast( )
173  {
174  m_xDelegator->activateLast();
175  }
176 
177 
178  OUString SAL_CALL LegacyFormController::getImplementationName( )
179  {
180  return "org.openoffice.comp.svx.LegacyFormController";
181  }
182 
183  sal_Bool SAL_CALL LegacyFormController::supportsService( const OUString& _serviceName )
184  {
185  return cppu::supportsService(this, _serviceName);
186  }
187 
188  Sequence< OUString > SAL_CALL LegacyFormController::getSupportedServiceNames( )
189  {
190  return { "com.sun.star.form.FormController", "com.sun.star.awt.control.TabController" };
191  }
192 
193 }
194 
195 css::uno::Reference< css::uno::XInterface >
196  LegacyFormController_NewInstance_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory > & _rxORB )
197 {
199 }
200 
201 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const Reference< form::runtime::XFormController > m_xDelegator
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
::cppu::WeakImplHelper< form::XFormController, XServiceInfo > LegacyFormController_Base
css::uno::Reference< css::uno::XInterface > LegacyFormController_NewInstance_Impl(const css::uno::Reference< css::lang::XMultiServiceFactory > &_rxORB)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
void Create(SvxOrientationItem &rItem, SvStream &rStrm, sal_uInt16)
Definition: legacyitem.cxx:34
unsigned char sal_Bool
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
class FmSearchEngine - Impl class for FmSearchDialog