1*50e6b072SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*50e6b072SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*50e6b072SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*50e6b072SAndrew Rist * distributed with this work for additional information 6*50e6b072SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*50e6b072SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*50e6b072SAndrew Rist * "License"); you may not use this file except in compliance 9*50e6b072SAndrew Rist * with the License. You may obtain a copy of the License at 10*50e6b072SAndrew Rist * 11*50e6b072SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*50e6b072SAndrew Rist * 13*50e6b072SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*50e6b072SAndrew Rist * software distributed under the License is distributed on an 15*50e6b072SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*50e6b072SAndrew Rist * KIND, either express or implied. See the License for the 17*50e6b072SAndrew Rist * specific language governing permissions and limitations 18*50e6b072SAndrew Rist * under the License. 19*50e6b072SAndrew Rist * 20*50e6b072SAndrew Rist *************************************************************/ 21*50e6b072SAndrew Rist 22*50e6b072SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef TOOLKIT_ACCESSIBLE_CONTROL_CONTEXT_HXX 25cdf0e10cSrcweir #define TOOLKIT_ACCESSIBLE_CONTROL_CONTEXT_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <comphelper/accessiblecomponenthelper.hxx> 28cdf0e10cSrcweir #include <comphelper/accimplaccess.hxx> 29cdf0e10cSrcweir #include <comphelper/uno3.hxx> 30cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp> 31cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 32cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 33cdf0e10cSrcweir 34cdf0e10cSrcweir class Window; 35cdf0e10cSrcweir //........................................................................ 36cdf0e10cSrcweir namespace toolkit 37cdf0e10cSrcweir { 38cdf0e10cSrcweir //........................................................................ 39cdf0e10cSrcweir 40cdf0e10cSrcweir //==================================================================== 41cdf0e10cSrcweir //= OAccessibleControlContext 42cdf0e10cSrcweir //==================================================================== 43cdf0e10cSrcweir 44cdf0e10cSrcweir typedef ::comphelper::OAccessibleComponentHelper OAccessibleControlContext_Base; 45cdf0e10cSrcweir typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XEventListener 46cdf0e10cSrcweir > OAccessibleControlContext_IBase; 47cdf0e10cSrcweir 48cdf0e10cSrcweir /** class implementing the AccessibleContext for an UNO control - to be used in design mode of the control. 49cdf0e10cSrcweir <p><b>life time control<b/><br/> 50cdf0e10cSrcweir This control should be held weak by the creator (an UNO control), it itself holds a hard reference to the 51cdf0e10cSrcweir control model, and a weak reference to the control. The reference to the model is freed when the model 52cdf0e10cSrcweir is beeing disposed.</p> 53cdf0e10cSrcweir */ 54cdf0e10cSrcweir class OAccessibleControlContext 55cdf0e10cSrcweir :public ::comphelper::OAccessibleImplementationAccess 56cdf0e10cSrcweir ,public OAccessibleControlContext_Base 57cdf0e10cSrcweir ,public OAccessibleControlContext_IBase 58cdf0e10cSrcweir { 59cdf0e10cSrcweir private: 60cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > 61cdf0e10cSrcweir m_xControlModel; // the model of the control which's context we implement 62cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > 63cdf0e10cSrcweir m_xModelPropsInfo; // the cached property set info of the model 64cdf0e10cSrcweir 65cdf0e10cSrcweir protected: 66cdf0e10cSrcweir /// ctor. @see Init 67cdf0e10cSrcweir OAccessibleControlContext(); 68cdf0e10cSrcweir ~OAccessibleControlContext(); 69cdf0e10cSrcweir 70cdf0e10cSrcweir /** late ctor 71cdf0e10cSrcweir */ 72cdf0e10cSrcweir void Init( 73cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator 74cdf0e10cSrcweir ) SAL_THROW( ( ::com::sun::star::uno::Exception ) ); 75cdf0e10cSrcweir 76cdf0e10cSrcweir // OCommonAccessibleComponent overridables 77cdf0e10cSrcweir virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); 78cdf0e10cSrcweir 79cdf0e10cSrcweir public: 80cdf0e10cSrcweir /** creates an accessible context for an uno control 81cdf0e10cSrcweir @param _rxCreator 82cdf0e10cSrcweir the uno control's XAccessible interface. This must be an XControl, from which an XControlModel 83cdf0e10cSrcweir can be retrieved. 84cdf0e10cSrcweir */ 85cdf0e10cSrcweir static OAccessibleControlContext* create( 86cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator 87cdf0e10cSrcweir ) SAL_THROW( ( ) ); 88cdf0e10cSrcweir 89cdf0e10cSrcweir protected: 90cdf0e10cSrcweir // XInterface 91cdf0e10cSrcweir DECLARE_XINTERFACE( ) 92cdf0e10cSrcweir DECLARE_XTYPEPROVIDER( ) 93cdf0e10cSrcweir 94cdf0e10cSrcweir // XAccessibleContext 95cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 96cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 97cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); 98cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); 99cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); 100cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); 101cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); 102cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); 103cdf0e10cSrcweir 104cdf0e10cSrcweir // XAccessibleComponent 105cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 106cdf0e10cSrcweir virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); 107cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException); 108cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); 110cdf0e10cSrcweir 111cdf0e10cSrcweir // XEventListener 112cdf0e10cSrcweir using comphelper::OAccessibleContextHelper::disposing; 113cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); 114cdf0e10cSrcweir 115cdf0e10cSrcweir private: 116cdf0e10cSrcweir // retrieves the value of a string property from the model, if the property is present 117cdf0e10cSrcweir ::rtl::OUString getModelStringProperty( const sal_Char* _pPropertyName ) SAL_THROW( ( ) ); 118cdf0e10cSrcweir 119cdf0e10cSrcweir // starts listening at the control model (currently for disposal only) 120cdf0e10cSrcweir void startModelListening( ) SAL_THROW( ( ::com::sun::star::uno::Exception ) ); 121cdf0e10cSrcweir // stops listening at the control model 122cdf0e10cSrcweir void stopModelListening( ) SAL_THROW( ( ::com::sun::star::uno::Exception ) ); 123cdf0e10cSrcweir 124cdf0e10cSrcweir Window* implGetWindow( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >* _pxUNOWindow = NULL ) const; 125cdf0e10cSrcweir }; 126cdf0e10cSrcweir 127cdf0e10cSrcweir //........................................................................ 128cdf0e10cSrcweir } // namespace toolkit 129cdf0e10cSrcweir //........................................................................ 130cdf0e10cSrcweir 131cdf0e10cSrcweir #endif // TOOLKIT_ACCESSIBLE_CONTROL_CONTEXT_HXX 132cdf0e10cSrcweir 133