LibreOffice Module svx (master)  1
AccessibleControlShape.hxx
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 #ifndef INCLUDED_SVX_ACCESSIBLECONTROLSHAPE_HXX
21 #define INCLUDED_SVX_ACCESSIBLECONTROLSHAPE_HXX
22 
23 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
24 #include <com/sun/star/container/XContainerListener.hpp>
25 #include <com/sun/star/lang/EventObject.hpp>
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <com/sun/star/util/XModeChangeListener.hpp>
28 #include <comphelper/uno3.hxx>
29 #include <cppuhelper/implbase4.hxx>
30 #include <cppuhelper/weakref.hxx>
31 #include <rtl/ref.hxx>
32 #include <rtl/ustring.hxx>
33 #include <sal/types.h>
34 #include <svx/AccessibleShape.hxx>
35 
36 namespace com::sun::star {
37  namespace accessibility { class XAccessible; }
38  namespace accessibility { class XAccessibleContext; }
39  namespace accessibility { struct AccessibleEventObject; }
40  namespace accessibility { class XAccessibleRelationSet; }
41  namespace awt { class XControl; }
42  namespace beans { class XPropertySet; }
43  namespace beans { class XPropertySetInfo; }
44  namespace beans { struct PropertyChangeEvent; }
45  namespace container { struct ContainerEvent; }
46  namespace lang { class XComponent; }
47  namespace lang { class XTypeProvider; }
48  namespace uno { class XAggregation; }
49  namespace util { struct ModeChangeEvent; }
50 }
51 
52 namespace comphelper
53 {
54  class OWrappedAccessibleChildrenManager;
55 }
56 
57 namespace accessibility {
58 
59  class AccessibleShapeInfo;
61 
62  typedef ::cppu::ImplHelper4 < css::beans::XPropertyChangeListener
63  , css::util::XModeChangeListener
64  , css::container::XContainerListener
65  , css::accessibility::XAccessibleEventListener
69 class SAL_DLLPUBLIC_RTTI AccessibleControlShape final
70  :public AccessibleShape
71  ,public AccessibleControlShape_Base
72 {
73 public:
74  //===== internal ========================================================
76  const AccessibleShapeInfo& rShapeInfo,
77  const AccessibleShapeTreeInfo& rShapeTreeInfo);
78  virtual ~AccessibleControlShape( ) override;
79 
80  const css::uno::Reference< css::beans::XPropertySet >& GetControlModel( ) const { return m_xControlModel;}
81  AccessibleControlShape* GetLabeledByControlShape();
82 
83 private:
84  //--- XAccessibleComponent -------------------------------
86  virtual void SAL_CALL grabFocus( ) override;
87 
88  //--- XAccessibleContext ---------------------------------
89  virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
90  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
91  virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
92 
93  //--- XServiceInfo ---------------------------------------
94  virtual OUString SAL_CALL getImplementationName( ) override;
95 
96  //--- XInterface -----------------------------------------
98 
99  //--- XTypeProvider --------------------------------------
100  DECLARE_XTYPEPROVIDER( )
101 
102  //--- XPropertyChangeListener ----------------------------
103  virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& _rEvent ) override;
104 
105  //--- XComponent -----------------------------------------
106  virtual void SAL_CALL disposing( ) override;
107 
108  //--- XEventListener -------------------------------------
109  virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
110 
111  //--- XModeChangeListener --------------------------------
112  virtual void SAL_CALL modeChanged( const css::util::ModeChangeEvent& _rSource ) override;
113 
114  //--- XAccessibleEventListener ----------------------------
115  virtual void SAL_CALL notifyEvent( const css::accessibility::AccessibleEventObject& aEvent ) override;
116 
117  // XVclContainerListener
118  virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override;
119  virtual void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override;
120  virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
121 
125  virtual void Init( ) override;
126 
128  virtual OUString
129  CreateAccessibleBaseName( ) override;
130 
134  virtual OUString
135  CreateAccessibleName( ) override;
136 
138  OUString CreateAccessibleDescription();
139 
140 #ifdef DBG_UTIL
141  virtual bool SetState( sal_Int16 _nState ) override;
143 #endif // DBG_UTIL
144 
146  OUString getControlModelStringProperty( const OUString& _rPropertyName ) const;
147 
149  bool ensureControlModelAccess( );
150 
152  bool ensureListeningState( const bool _bCurrentlyListening, const bool _bNeedNewListening,
153  const OUString& _rPropertyName );
154 
156  void startStateMultiplexing( );
158  void stopStateMultiplexing( );
159 
164  void adjustAccessibleRole( );
165 
172  void initializeComposedState( );
173 
175  AccessibleControlShape& operator= (const AccessibleControlShape&) = delete;
176 
177  css::uno::Reference< css::beans::XPropertySet >
179  css::uno::Reference< css::beans::XPropertySetInfo >
180  m_xModelPropsMeta; // cache this for performance reasons
181  css::uno::Reference< css::awt::XControl >
182  m_xUnoControl; // our UNO control
183 
184  css::uno::WeakReference< css::accessibility::XAccessibleContext >
185  m_aControlContext; // the AccessibleContext of the control
186  css::uno::Reference< css::uno::XAggregation >
187  m_xControlContextProxy; // the proxy for "aggregating" the AccessibleContext of the control
188  css::uno::Reference< css::lang::XTypeProvider >
189  m_xControlContextTypeAccess; // cached interface of our aggregate
190  css::uno::Reference< css::lang::XComponent >
191  m_xControlContextComponent; // cached interface of our aggregate
192 
195 
196  bool m_bListeningForName : 1; // are we currently listening for changes of the "Name" property?
197  bool m_bListeningForDesc : 1; // are we currently listening for changes of the "HelpText" property?
198  bool m_bMultiplexingStates : 1; // are we currently multiplexing state changes of the native context?
199  bool m_bDisposeNativeContext : 1; // do we need to dispose mxNativeContextComponent?
200  bool m_bWaitingForControl : 1; // if we are created before our control exists, we need to wait for it to appear ...
201 };
202 
203 } // end of namespace accessibility
204 
205 #endif
206 
207 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
exports com.sun.star.lib. util
css::uno::WeakReference< css::accessibility::XAccessibleContext > m_aControlContext
css::uno::Reference< css::awt::XControl > m_xUnoControl
css::uno::Reference< css::uno::XAggregation > m_xControlContextProxy
exports com.sun.star. awt
OUString getImplementationName()
exports com.sun.star. container
::cppu::ImplHelper4< css::beans::XPropertyChangeListener, css::util::XModeChangeListener, css::container::XContainerListener, css::accessibility::XAccessibleEventListener > AccessibleControlShape_Base
rtl::Reference<::comphelper::OWrappedAccessibleChildrenManager > m_pChildManager
css::uno::Reference< css::beans::XPropertySetInfo > m_xModelPropsMeta
class SAL_NO_VTABLE XPropertySet
Definition: xmlexchg.hxx:28
const css::uno::Reference< css::beans::XPropertySet > & GetControlModel() const
This base class provides a base implementation for all shapes.
exports com.sun.star. beans
exports com.sun.star. lang
css::uno::Reference< css::lang::XComponent > m_xControlContextComponent
css::uno::Reference< css::beans::XPropertySet > m_xControlModel
This class is a container for the information specific for a single shape that is passed to the const...
This class bundles all information that is passed down the tree of accessible shapes so that each sha...
#define DECLARE_XINTERFACE()
css::uno::Reference< css::lang::XTypeProvider > m_xControlContextTypeAccess