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 : #ifndef INCLUDED_SVX_SOURCE_TABLE_ACCESSIBLECELL_HXX
21 : #define INCLUDED_SVX_SOURCE_TABLE_ACCESSIBLECELL_HXX
22 :
23 : #include <com/sun/star/accessibility/XAccessible.hpp>
24 : #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
25 : #include <com/sun/star/accessibility/AccessibleRole.hpp>
26 : #include <com/sun/star/drawing/XShape.hpp>
27 :
28 : #include <rtl/ref.hxx>
29 :
30 : #include <editeng/AccessibleContextBase.hxx>
31 : #include <editeng/AccessibleComponentBase.hxx>
32 : #include <svx/IAccessibleViewForwarderListener.hxx>
33 : #include <svx/AccessibleTextHelper.hxx>
34 : #include <svx/AccessibleShapeTreeInfo.hxx>
35 : #include <AccessibleTableShape.hxx>
36 :
37 : #include <cppuhelper/implbase1.hxx>
38 :
39 : #include "cell.hxx"
40 :
41 : #include <boost/noncopyable.hpp>
42 :
43 :
44 : namespace accessibility
45 : {
46 :
47 : class AccessibleShapeTreeInfo;
48 :
49 : typedef ::cppu::ImplInheritanceHelper1< AccessibleContextBase, ::com::sun::star::accessibility::XAccessibleExtendedComponent > AccessibleCellBase;
50 :
51 : class AccessibleCell : boost::noncopyable, public AccessibleCellBase, public AccessibleComponentBase, public IAccessibleViewForwarderListener
52 : {
53 : public:
54 : AccessibleCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, const sdr::table::CellRef& rCell, sal_Int32 nIndex, const AccessibleShapeTreeInfo& rShapeTreeInfo);
55 : virtual ~AccessibleCell (void);
56 :
57 : virtual void Init (void);
58 :
59 : virtual bool operator== (const AccessibleCell& rAccessibleCell);
60 :
61 : virtual bool SetState (sal_Int16 aState) SAL_OVERRIDE;
62 : virtual bool ResetState (sal_Int16 aState) SAL_OVERRIDE;
63 :
64 : // XInterface
65 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
66 : virtual void SAL_CALL acquire( ) throw () SAL_OVERRIDE;
67 : virtual void SAL_CALL release( ) throw () SAL_OVERRIDE;
68 :
69 : // XAccessibleContext
70 : virtual sal_Int32 SAL_CALL getAccessibleChildCount(void) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleChild(sal_Int32 nIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
72 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet(void) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73 : virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(void) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
74 : virtual OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 0 : sdr::table::CellRef getCellRef() { return mxCell;}
76 : void UpdateChildren();
77 : OUString getCellName( sal_Int32 nCol, sal_Int32 nRow );
78 :
79 : // XAccessibleComponent
80 : virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
81 : 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, std::exception) SAL_OVERRIDE;
82 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(void) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 : virtual ::com::sun::star::awt::Point SAL_CALL getLocation(void) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(void) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 : virtual ::com::sun::star::awt::Size SAL_CALL getSize(void) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 : virtual void SAL_CALL addFocusListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
87 : virtual void SAL_CALL removeFocusListener (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
88 : virtual void SAL_CALL grabFocus (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 : virtual sal_Int32 SAL_CALL getForeground(void) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 : virtual sal_Int32 SAL_CALL getBackground(void) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 :
92 : // XAccessibleExtendedComponent
93 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : virtual OUString SAL_CALL getTitledBorderText (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 : virtual OUString SAL_CALL getToolTipText (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 :
97 : // XAccessibleEventBroadcaster
98 : virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 : virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 :
101 : // XServiceInfo
102 : virtual OUString SAL_CALL getImplementationName (void) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 : virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames (void) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 :
105 : // IAccessibleViewForwarderListener
106 : virtual void ViewForwarderChanged (ChangeType aChangeType, const IAccessibleViewForwarder* pViewForwarder) SAL_OVERRIDE;
107 :
108 : // Misc
109 :
110 : /** set the index _nIndex at the accessible cell param _nIndex The new index in parent.
111 : */
112 0 : inline void setIndexInParent(sal_Int32 _nIndex) { mnIndexInParent = _nIndex; }
113 :
114 : //Get the parent table
115 0 : AccessibleTableShape* GetParentTable() { return pAccTable; }
116 : protected:
117 : /// Bundle of information passed to all shapes in a document tree.
118 : AccessibleShapeTreeInfo maShapeTreeInfo;
119 :
120 : /// the index in parent.
121 : sal_Int32 mnIndexInParent;
122 :
123 : /// The accessible text engine. May be NULL if it can not be created.
124 : AccessibleTextHelper* mpText;
125 :
126 : sdr::table::CellRef mxCell;
127 :
128 : /// This method is called from the component helper base class while disposing.
129 : virtual void SAL_CALL disposing (void) SAL_OVERRIDE;
130 :
131 : AccessibleTableShape *pAccTable;
132 :
133 : private:
134 : explicit AccessibleCell(void); // not implemented
135 : explicit AccessibleCell(const AccessibleCell&); // not implemented
136 : AccessibleCell& operator=(const AccessibleCell&); // not implemented
137 : };
138 :
139 : } // end of namespace accessibility
140 :
141 : #endif
142 :
143 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|