Branch libreoffice-5-0-4
[LibreOffice.git] / include / editeng / AccessibleImageBullet.hxx
blob79f2dbf56dd49646b6247517ae593bc70f5908a6
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 .
20 #ifndef INCLUDED_EDITENG_ACCESSIBLEIMAGEBULLET_HXX
21 #define INCLUDED_EDITENG_ACCESSIBLEIMAGEBULLET_HXX
23 #include <tools/gen.hxx>
24 #include <cppuhelper/weakref.hxx>
25 #include <cppuhelper/implbase5.hxx>
27 #include <cppuhelper/interfacecontainer.hxx>
28 #include <com/sun/star/uno/Reference.hxx>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/accessibility/XAccessible.hpp>
31 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
32 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
33 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
34 #include <editeng/AccessibleParaManager.hxx>
35 #include <editeng/unoedsrc.hxx>
37 namespace accessibility
39 typedef ::cppu::WeakImplHelper5< ::com::sun::star::accessibility::XAccessible,
40 ::com::sun::star::accessibility::XAccessibleContext,
41 ::com::sun::star::accessibility::XAccessibleComponent,
42 ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
43 ::com::sun::star::lang::XServiceInfo > AccessibleImageBulletInterfaceBase;
45 /** This class implements the image bullets for the EditEngine/Outliner UAA
47 class AccessibleImageBullet : public AccessibleImageBulletInterfaceBase
50 public:
51 /// Create accessible object for given parent
52 AccessibleImageBullet ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent );
54 virtual ~AccessibleImageBullet ();
56 // XInterface
57 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
59 // XAccessible
60 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
62 // XAccessibleContext
63 virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
64 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, std::exception) SAL_OVERRIDE;
65 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
66 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
67 virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
68 /// Maximal length of text returned by getAccessibleDescription()
69 enum { MaxDescriptionLen = 40 };
70 virtual OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 virtual OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
72 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
74 virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
76 // XAccessibleEventBroadcaster
77 virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
78 virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 // XAccessibleComponent
81 virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 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;
83 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 // XServiceInfo
92 virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 /** Set the current index in the accessibility parent
98 @attention This method does not lock the SolarMutex,
99 leaving that to the calling code. This is because only
100 there potential deadlock situations can be resolved. Thus,
101 make sure SolarMutex is locked when calling this.
103 void SetIndexInParent( sal_Int32 nIndex );
105 /** Set the edit engine offset
107 @attention This method does not lock the SolarMutex,
108 leaving that to the calling code. This is because only
109 there potential deadlock situations can be resolved. Thus,
110 make sure SolarMutex is locked when calling this.
112 void SetEEOffset( const Point& rOffset );
114 /** Set the EditEngine offset
116 @attention This method does not lock the SolarMutex,
117 leaving that to the calling code. This is because only
118 there potential deadlock situations can be resolved. Thus,
119 make sure SolarMutex is locked when calling this.
121 void SetEditSource( SvxEditSource* pEditSource );
123 /** Dispose this object
125 Notifies and deregisters the listeners, drops all references.
127 void Dispose();
129 /** Set the current paragraph number
131 @attention This method does not lock the SolarMutex,
132 leaving that to the calling code. This is because only
133 there potential deadlock situations can be resolved. Thus,
134 make sure SolarMutex is locked when calling this.
136 void SetParagraphIndex( sal_Int32 nIndex );
138 /** Query the current paragraph number (0 - nParas-1)
140 @attention This method does not lock the SolarMutex,
141 leaving that to the calling code. This is because only
142 there potential deadlock situations can be resolved. Thus,
143 make sure SolarMutex is locked when calling this.
145 sal_Int32 GetParagraphIndex() const { return mnParagraphIndex; }
147 /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
148 void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
150 private:
151 AccessibleImageBullet( const AccessibleImageBullet& ) SAL_DELETED_FUNCTION;
152 AccessibleImageBullet& operator= ( const AccessibleImageBullet& ) SAL_DELETED_FUNCTION;
154 // syntactic sugar for FireEvent
155 void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
156 void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
158 // maintain state set and send STATE_CHANGE events
159 void SetState( const sal_Int16 nStateId );
160 void UnSetState( const sal_Int16 nStateId );
162 SvxEditSource& GetEditSource() const;
164 int getNotifierClientId() const { return mnNotifierClientId; }
166 /** Query the SvxTextForwarder for EditEngine access.
168 @attention This method does not lock the SolarMutex,
169 leaving that to the calling code. This is because only
170 there potential deadlock situations can be resolved. Thus,
171 make sure SolarMutex is locked when calling this.
173 SvxTextForwarder& GetTextForwarder() const;
175 /** Query the SvxViewForwarder for EditEngine access.
177 @attention This method does not lock the SolarMutex,
178 leaving that to the calling code. This is because only
179 there potential deadlock situations can be resolved. Thus,
180 make sure SolarMutex is locked when calling this.
182 SvxViewForwarder& GetViewForwarder() const;
184 const Point& GetEEOffset() const { return maEEOffset; }
186 // the paragraph index in the edit engine (guarded by solar mutex)
187 sal_Int32 mnParagraphIndex;
189 // our current index in the parent (guarded by solar mutex)
190 sal_Int32 mnIndexInParent;
192 // the current edit source (guarded by solar mutex)
193 SvxEditSource* mpEditSource;
195 // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
196 Point maEEOffset;
198 // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
199 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
201 /// The shape we're the accessible for (unguarded)
202 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
204 /// Our listeners (guarded by maMutex)
205 int mnNotifierClientId;
208 } // end of namespace accessibility
210 #endif
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */