1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski 
24*b1cdbd2cSJim Jagielski #ifndef _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
25*b1cdbd2cSJim Jagielski #define _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
26*b1cdbd2cSJim Jagielski 
27*b1cdbd2cSJim Jagielski #include <tools/gen.hxx>
28*b1cdbd2cSJim Jagielski #include <cppuhelper/weakref.hxx>
29*b1cdbd2cSJim Jagielski #include <cppuhelper/implbase5.hxx>
30*b1cdbd2cSJim Jagielski 
31*b1cdbd2cSJim Jagielski #ifndef _CPPUHELPER_INTERFACECONTAINER_H_
32*b1cdbd2cSJim Jagielski #include <cppuhelper/interfacecontainer.hxx>
33*b1cdbd2cSJim Jagielski #endif
34*b1cdbd2cSJim Jagielski #include <com/sun/star/uno/Reference.hxx>
35*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XServiceInfo.hpp>
36*b1cdbd2cSJim Jagielski #include <com/sun/star/accessibility/XAccessible.hpp>
37*b1cdbd2cSJim Jagielski #include <com/sun/star/accessibility/XAccessibleContext.hpp>
38*b1cdbd2cSJim Jagielski #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
39*b1cdbd2cSJim Jagielski #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
40*b1cdbd2cSJim Jagielski #include "editeng/AccessibleParaManager.hxx"
41*b1cdbd2cSJim Jagielski #include <editeng/unoedsrc.hxx>
42*b1cdbd2cSJim Jagielski 
43*b1cdbd2cSJim Jagielski namespace accessibility
44*b1cdbd2cSJim Jagielski {
45*b1cdbd2cSJim Jagielski     typedef ::cppu::WeakImplHelper5< ::com::sun::star::accessibility::XAccessible,
46*b1cdbd2cSJim Jagielski                                      ::com::sun::star::accessibility::XAccessibleContext,
47*b1cdbd2cSJim Jagielski                                      ::com::sun::star::accessibility::XAccessibleComponent,
48*b1cdbd2cSJim Jagielski                                      ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
49*b1cdbd2cSJim Jagielski                                      ::com::sun::star::lang::XServiceInfo >  AccessibleImageBulletInterfaceBase;
50*b1cdbd2cSJim Jagielski 
51*b1cdbd2cSJim Jagielski     /** This class implements the image bullets for the EditEngine/Outliner UAA
52*b1cdbd2cSJim Jagielski      */
53*b1cdbd2cSJim Jagielski     class AccessibleImageBullet : public AccessibleImageBulletInterfaceBase
54*b1cdbd2cSJim Jagielski     {
55*b1cdbd2cSJim Jagielski 
56*b1cdbd2cSJim Jagielski     public:
57*b1cdbd2cSJim Jagielski         /// Create accessible object for given parent
58*b1cdbd2cSJim Jagielski         AccessibleImageBullet ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent );
59*b1cdbd2cSJim Jagielski 
60*b1cdbd2cSJim Jagielski         virtual ~AccessibleImageBullet	();
61*b1cdbd2cSJim Jagielski 
62*b1cdbd2cSJim Jagielski         // XInterface
63*b1cdbd2cSJim Jagielski         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException);
64*b1cdbd2cSJim Jagielski 
65*b1cdbd2cSJim Jagielski         // XAccessible
66*b1cdbd2cSJim Jagielski         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
67*b1cdbd2cSJim Jagielski 
68*b1cdbd2cSJim Jagielski         // XAccessibleContext
69*b1cdbd2cSJim Jagielski         virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
70*b1cdbd2cSJim Jagielski         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);
71*b1cdbd2cSJim Jagielski         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException);
72*b1cdbd2cSJim Jagielski         virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException);
73*b1cdbd2cSJim Jagielski         virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException);
74*b1cdbd2cSJim Jagielski         /// Maximal length of text returned by getAccessibleDescription()
75*b1cdbd2cSJim Jagielski         enum { MaxDescriptionLen = 40 };
76*b1cdbd2cSJim Jagielski         virtual ::rtl::OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException);
77*b1cdbd2cSJim Jagielski         virtual ::rtl::OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException);
78*b1cdbd2cSJim Jagielski         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException);
79*b1cdbd2cSJim Jagielski         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException);
80*b1cdbd2cSJim Jagielski         virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
81*b1cdbd2cSJim Jagielski 
82*b1cdbd2cSJim Jagielski         // XAccessibleEventBroadcaster
83*b1cdbd2cSJim Jagielski         virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
84*b1cdbd2cSJim Jagielski         virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
85*b1cdbd2cSJim Jagielski 
86*b1cdbd2cSJim Jagielski         // XAccessibleComponent
87*b1cdbd2cSJim Jagielski         virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
88*b1cdbd2cSJim Jagielski         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);
89*b1cdbd2cSJim Jagielski         virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException);
90*b1cdbd2cSJim Jagielski         virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException);
91*b1cdbd2cSJim Jagielski         virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException);
92*b1cdbd2cSJim Jagielski         virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException);
93*b1cdbd2cSJim Jagielski         virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
94*b1cdbd2cSJim Jagielski         virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
95*b1cdbd2cSJim Jagielski         virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
96*b1cdbd2cSJim Jagielski 
97*b1cdbd2cSJim Jagielski         // XServiceInfo
98*b1cdbd2cSJim Jagielski         virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
99*b1cdbd2cSJim Jagielski         virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
100*b1cdbd2cSJim Jagielski         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
101*b1cdbd2cSJim Jagielski 
102*b1cdbd2cSJim Jagielski         // XServiceName
103*b1cdbd2cSJim Jagielski         virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
104*b1cdbd2cSJim Jagielski 
105*b1cdbd2cSJim Jagielski         /** Set the current index in the accessibility parent
106*b1cdbd2cSJim Jagielski 
107*b1cdbd2cSJim Jagielski             @attention This method does not lock the SolarMutex,
108*b1cdbd2cSJim Jagielski             leaving that to the calling code. This is because only
109*b1cdbd2cSJim Jagielski             there potential deadlock situations can be resolved. Thus,
110*b1cdbd2cSJim Jagielski             make sure SolarMutex is locked when calling this.
111*b1cdbd2cSJim Jagielski          */
112*b1cdbd2cSJim Jagielski         void SetIndexInParent( sal_Int32 nIndex );
113*b1cdbd2cSJim Jagielski 
114*b1cdbd2cSJim Jagielski         /** Get the current index in the accessibility parent
115*b1cdbd2cSJim Jagielski 
116*b1cdbd2cSJim Jagielski             @attention This method does not lock the SolarMutex,
117*b1cdbd2cSJim Jagielski             leaving that to the calling code. This is because only
118*b1cdbd2cSJim Jagielski             there potential deadlock situations can be resolved. Thus,
119*b1cdbd2cSJim Jagielski             make sure SolarMutex is locked when calling this.
120*b1cdbd2cSJim Jagielski          */
121*b1cdbd2cSJim Jagielski         sal_Int32 GetIndexInParent() const;
122*b1cdbd2cSJim Jagielski 
123*b1cdbd2cSJim Jagielski         /** Set the edit engine offset
124*b1cdbd2cSJim Jagielski 
125*b1cdbd2cSJim Jagielski             @attention This method does not lock the SolarMutex,
126*b1cdbd2cSJim Jagielski             leaving that to the calling code. This is because only
127*b1cdbd2cSJim Jagielski             there potential deadlock situations can be resolved. Thus,
128*b1cdbd2cSJim Jagielski             make sure SolarMutex is locked when calling this.
129*b1cdbd2cSJim Jagielski          */
130*b1cdbd2cSJim Jagielski         void SetEEOffset( const Point& rOffset );
131*b1cdbd2cSJim Jagielski 
132*b1cdbd2cSJim Jagielski         /** Set the EditEngine offset
133*b1cdbd2cSJim Jagielski 
134*b1cdbd2cSJim Jagielski             @attention This method does not lock the SolarMutex,
135*b1cdbd2cSJim Jagielski             leaving that to the calling code. This is because only
136*b1cdbd2cSJim Jagielski             there potential deadlock situations can be resolved. Thus,
137*b1cdbd2cSJim Jagielski             make sure SolarMutex is locked when calling this.
138*b1cdbd2cSJim Jagielski          */
139*b1cdbd2cSJim Jagielski         void SetEditSource( SvxEditSource* pEditSource );
140*b1cdbd2cSJim Jagielski 
141*b1cdbd2cSJim Jagielski         /** Dispose this object
142*b1cdbd2cSJim Jagielski 
143*b1cdbd2cSJim Jagielski         	Notifies and deregisters the listeners, drops all references.
144*b1cdbd2cSJim Jagielski          */
145*b1cdbd2cSJim Jagielski         void Dispose();
146*b1cdbd2cSJim Jagielski 
147*b1cdbd2cSJim Jagielski         /** Set the current paragraph number
148*b1cdbd2cSJim Jagielski 
149*b1cdbd2cSJim Jagielski             @attention This method does not lock the SolarMutex,
150*b1cdbd2cSJim Jagielski             leaving that to the calling code. This is because only
151*b1cdbd2cSJim Jagielski             there potential deadlock situations can be resolved. Thus,
152*b1cdbd2cSJim Jagielski             make sure SolarMutex is locked when calling this.
153*b1cdbd2cSJim Jagielski          */
154*b1cdbd2cSJim Jagielski         void SetParagraphIndex( sal_Int32 nIndex );
155*b1cdbd2cSJim Jagielski 
156*b1cdbd2cSJim Jagielski         /** Query the current paragraph number (0 - nParas-1)
157*b1cdbd2cSJim Jagielski 
158*b1cdbd2cSJim Jagielski             @attention This method does not lock the SolarMutex,
159*b1cdbd2cSJim Jagielski             leaving that to the calling code. This is because only
160*b1cdbd2cSJim Jagielski             there potential deadlock situations can be resolved. Thus,
161*b1cdbd2cSJim Jagielski             make sure SolarMutex is locked when calling this.
162*b1cdbd2cSJim Jagielski          */
163*b1cdbd2cSJim Jagielski         sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException));
164*b1cdbd2cSJim Jagielski 
165*b1cdbd2cSJim Jagielski         /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
166*b1cdbd2cSJim Jagielski         virtual 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;
167*b1cdbd2cSJim Jagielski 
168*b1cdbd2cSJim Jagielski     private:
169*b1cdbd2cSJim Jagielski 
170*b1cdbd2cSJim Jagielski         // declared, but not defined
171*b1cdbd2cSJim Jagielski         AccessibleImageBullet( const AccessibleImageBullet& );
172*b1cdbd2cSJim Jagielski         AccessibleImageBullet& operator= ( const AccessibleImageBullet& );
173*b1cdbd2cSJim Jagielski 
174*b1cdbd2cSJim Jagielski         // syntactic sugar for FireEvent
175*b1cdbd2cSJim Jagielski         void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
176*b1cdbd2cSJim Jagielski         void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
177*b1cdbd2cSJim Jagielski 
178*b1cdbd2cSJim Jagielski         // maintain state set and send STATE_CHANGE events
179*b1cdbd2cSJim Jagielski         void SetState( const sal_Int16 nStateId );
180*b1cdbd2cSJim Jagielski         void UnSetState( const sal_Int16 nStateId );
181*b1cdbd2cSJim Jagielski 
182*b1cdbd2cSJim Jagielski         SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
183*b1cdbd2cSJim Jagielski 
184*b1cdbd2cSJim Jagielski         int getNotifierClientId() const;
185*b1cdbd2cSJim Jagielski 
186*b1cdbd2cSJim Jagielski         /** Query the SvxTextForwarder for EditEngine access.
187*b1cdbd2cSJim Jagielski 
188*b1cdbd2cSJim Jagielski             @attention This method does not lock the SolarMutex,
189*b1cdbd2cSJim Jagielski             leaving that to the calling code. This is because only
190*b1cdbd2cSJim Jagielski             there potential deadlock situations can be resolved. Thus,
191*b1cdbd2cSJim Jagielski             make sure SolarMutex is locked when calling this.
192*b1cdbd2cSJim Jagielski          */
193*b1cdbd2cSJim Jagielski         SvxTextForwarder&	GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
194*b1cdbd2cSJim Jagielski 
195*b1cdbd2cSJim Jagielski         /** Query the SvxViewForwarder for EditEngine access.
196*b1cdbd2cSJim Jagielski 
197*b1cdbd2cSJim Jagielski             @attention This method does not lock the SolarMutex,
198*b1cdbd2cSJim Jagielski             leaving that to the calling code. This is because only
199*b1cdbd2cSJim Jagielski             there potential deadlock situations can be resolved. Thus,
200*b1cdbd2cSJim Jagielski             make sure SolarMutex is locked when calling this.
201*b1cdbd2cSJim Jagielski          */
202*b1cdbd2cSJim Jagielski         SvxViewForwarder&	GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
203*b1cdbd2cSJim Jagielski 
204*b1cdbd2cSJim Jagielski         const Point& GetEEOffset() const;
205*b1cdbd2cSJim Jagielski 
206*b1cdbd2cSJim Jagielski         // the paragraph index in the edit engine (guarded by solar mutex)
207*b1cdbd2cSJim Jagielski         sal_Int32	mnParagraphIndex;
208*b1cdbd2cSJim Jagielski 
209*b1cdbd2cSJim Jagielski         // our current index in the parent (guarded by solar mutex)
210*b1cdbd2cSJim Jagielski         sal_Int32	mnIndexInParent;
211*b1cdbd2cSJim Jagielski 
212*b1cdbd2cSJim Jagielski         // the current edit source (guarded by solar mutex)
213*b1cdbd2cSJim Jagielski         SvxEditSource* mpEditSource;
214*b1cdbd2cSJim Jagielski 
215*b1cdbd2cSJim Jagielski         // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
216*b1cdbd2cSJim Jagielski         Point maEEOffset;
217*b1cdbd2cSJim Jagielski 
218*b1cdbd2cSJim Jagielski         // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
219*b1cdbd2cSJim Jagielski         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
220*b1cdbd2cSJim Jagielski 
221*b1cdbd2cSJim Jagielski         mutable osl::Mutex	maMutex;
222*b1cdbd2cSJim Jagielski 
223*b1cdbd2cSJim Jagielski         /// The shape we're the accessible for (unguarded)
224*b1cdbd2cSJim Jagielski         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
225*b1cdbd2cSJim Jagielski 
226*b1cdbd2cSJim Jagielski         /// Our listeners (guarded by maMutex)
227*b1cdbd2cSJim Jagielski         int mnNotifierClientId;
228*b1cdbd2cSJim Jagielski     };
229*b1cdbd2cSJim Jagielski 
230*b1cdbd2cSJim Jagielski } // end of namespace accessibility
231*b1cdbd2cSJim Jagielski 
232*b1cdbd2cSJim Jagielski #endif
233*b1cdbd2cSJim Jagielski 
234