1f6a9d5caSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f6a9d5caSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6a9d5caSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6a9d5caSAndrew Rist  * distributed with this work for additional information
6f6a9d5caSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6a9d5caSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6a9d5caSAndrew Rist  * "License"); you may not use this file except in compliance
9f6a9d5caSAndrew Rist  * with the License.  You may obtain a copy of the License at
10f6a9d5caSAndrew Rist  *
11f6a9d5caSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f6a9d5caSAndrew Rist  *
13f6a9d5caSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6a9d5caSAndrew Rist  * software distributed under the License is distributed on an
15f6a9d5caSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6a9d5caSAndrew Rist  * KIND, either express or implied.  See the License for the
17f6a9d5caSAndrew Rist  * specific language governing permissions and limitations
18f6a9d5caSAndrew Rist  * under the License.
19f6a9d5caSAndrew Rist  *
20f6a9d5caSAndrew Rist  *************************************************************/
21f6a9d5caSAndrew Rist 
22f6a9d5caSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifdef _MSC_VER
25cdf0e10cSrcweir #pragma hdrstop
26cdf0e10cSrcweir #endif
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifndef _ACCESSIBILITY_HXX_
29cdf0e10cSrcweir #define _ACCESSIBILITY_HXX_
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
32cdf0e10cSrcweir //#include <com/sun/star/lang/XComponent.hpp>
33cdf0e10cSrcweir //#endif
34cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
35cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
36cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleContext.hpp>
37cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleText.hpp>
38cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
39cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
40cdf0e10cSrcweir #ifndef _COM_SUN_STAR_lang_XSERVICEINFO_HPP_
41cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
42cdf0e10cSrcweir #endif
43cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
44cdf0e10cSrcweir #include <osl/mutex.hxx>
45cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h>
46cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx>
47cdf0e10cSrcweir #include <cppuhelper/implbase6.hxx>
48cdf0e10cSrcweir #include <svl/brdcst.hxx>
49cdf0e10cSrcweir 
50cdf0e10cSrcweir #include <editeng/editeng.hxx>
51cdf0e10cSrcweir #include <editeng/unoedsrc.hxx> // SvxEditSource, SvxTextForwarder, SvxViewForwarder, SvxEditViewForwarder
52cdf0e10cSrcweir #include <svx/AccessibleTextHelper.hxx>
53cdf0e10cSrcweir #include <edit.hxx>
54cdf0e10cSrcweir 
55cdf0e10cSrcweir class Window;
56cdf0e10cSrcweir class SmGraphicWindow;
57cdf0e10cSrcweir class SmEditWindow;
58cdf0e10cSrcweir class SmDocShell;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace accessibility {
61cdf0e10cSrcweir struct AccessibleEventObject;
62cdf0e10cSrcweir }}}}
63cdf0e10cSrcweir 
64cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
65cdf0e10cSrcweir //
66cdf0e10cSrcweir // classes and helper-classes used for accessibility in the graphic-window
67cdf0e10cSrcweir //
68cdf0e10cSrcweir 
69cdf0e10cSrcweir typedef
70cdf0e10cSrcweir cppu::WeakImplHelper6
71cdf0e10cSrcweir     <
72cdf0e10cSrcweir         com::sun::star::lang::XServiceInfo,
73cdf0e10cSrcweir         com::sun::star::accessibility::XAccessible,
74cdf0e10cSrcweir         com::sun::star::accessibility::XAccessibleComponent,
75cdf0e10cSrcweir         com::sun::star::accessibility::XAccessibleContext,
76cdf0e10cSrcweir         com::sun::star::accessibility::XAccessibleText,
77cdf0e10cSrcweir         com::sun::star::accessibility::XAccessibleEventBroadcaster
78cdf0e10cSrcweir     >
79cdf0e10cSrcweir SmGraphicAccessibleBaseClass;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir class SmGraphicAccessible :
82cdf0e10cSrcweir     public SmGraphicAccessibleBaseClass
83cdf0e10cSrcweir {
84cdf0e10cSrcweir     //vos::ORefCount    aRefCount;  // number of references to object
85cdf0e10cSrcweir     osl::Mutex                          aListenerMutex;
86cdf0e10cSrcweir     String                              aAccName;
87cdf0e10cSrcweir     /// client id in the AccessibleEventNotifier queue
88cdf0e10cSrcweir     sal_uInt32                          nClientId;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     SmGraphicWindow     *pWin;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     // disallow copy-ctor and assignment-operator for now
93cdf0e10cSrcweir     SmGraphicAccessible( const SmGraphicAccessible & );
94cdf0e10cSrcweir     SmGraphicAccessible & operator = ( const SmGraphicAccessible & );
95cdf0e10cSrcweir 
96cdf0e10cSrcweir protected:
97cdf0e10cSrcweir     SmDocShell *    GetDoc_Impl();
98cdf0e10cSrcweir     String          GetAccessibleText_Impl();
99cdf0e10cSrcweir 
100cdf0e10cSrcweir public:
101cdf0e10cSrcweir     SmGraphicAccessible( SmGraphicWindow *pGraphicWin );
102cdf0e10cSrcweir     virtual ~SmGraphicAccessible();
103cdf0e10cSrcweir 
GetWin()104cdf0e10cSrcweir     SmGraphicWindow *   GetWin()    { return pWin; }
105cdf0e10cSrcweir     void                ClearWin();     // to be called when view is destroyed
106cdf0e10cSrcweir     void                LaunchEvent(
107cdf0e10cSrcweir                             const sal_Int16 nAccesibleEventId,
108cdf0e10cSrcweir                             const ::com::sun::star::uno::Any &rOldVal,
109cdf0e10cSrcweir                             const ::com::sun::star::uno::Any &rNewVal);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     // XAccessible
112cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     // XAccessibleComponent
115cdf0e10cSrcweir     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
116cdf0e10cSrcweir     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);
117cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException);
119cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException);
120cdf0e10cSrcweir     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException);
121cdf0e10cSrcweir     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
122cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
123cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     // XAccessibleContext
126cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
127cdf0e10cSrcweir     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);
128cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
129cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
130cdf0e10cSrcweir     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
131cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
132cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
133cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
134cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
135cdf0e10cSrcweir     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     // XAccessibleEventBroadcaster
138cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
139cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     // XAccessibleText
142cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getCaretPosition(  ) throw (::com::sun::star::uno::RuntimeException);
143cdf0e10cSrcweir     virtual sal_Bool SAL_CALL setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
144cdf0e10cSrcweir     virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
145cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
146cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
147cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getCharacterCount(  ) throw (::com::sun::star::uno::RuntimeException);
148cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
149cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getSelectedText(  ) throw (::com::sun::star::uno::RuntimeException);
150cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getSelectionStart(  ) throw (::com::sun::star::uno::RuntimeException);
151cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getSelectionEnd(  ) throw (::com::sun::star::uno::RuntimeException);
152cdf0e10cSrcweir     virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
153cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getText(  ) throw (::com::sun::star::uno::RuntimeException);
154cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
155cdf0e10cSrcweir     virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
156cdf0e10cSrcweir     virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
157cdf0e10cSrcweir     virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
158cdf0e10cSrcweir     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     // XServiceInfo
161cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
162cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
163cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
164cdf0e10cSrcweir };
165cdf0e10cSrcweir 
166cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
167cdf0e10cSrcweir //
168cdf0e10cSrcweir // classes and helper-classes used for accessibility in the command-window
169cdf0e10cSrcweir //
170cdf0e10cSrcweir 
171cdf0e10cSrcweir class SmEditAccessible;
172cdf0e10cSrcweir class SmEditSource;
173cdf0e10cSrcweir class EditEngine;
174cdf0e10cSrcweir class EditView;
175cdf0e10cSrcweir class SvxFieldItem;
176cdf0e10cSrcweir struct ESelection;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 
179cdf0e10cSrcweir class SmViewForwarder :
180cdf0e10cSrcweir     public SvxViewForwarder
181cdf0e10cSrcweir {
182cdf0e10cSrcweir     SmEditAccessible &          rEditAcc;
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     // disallow copy-ctor and assignment-operator for now
185cdf0e10cSrcweir     SmViewForwarder( const SmViewForwarder & );
186cdf0e10cSrcweir     SmViewForwarder & operator = ( const SmViewForwarder & );
187cdf0e10cSrcweir 
188cdf0e10cSrcweir public:
189cdf0e10cSrcweir                         SmViewForwarder( SmEditAccessible &rAcc );
190cdf0e10cSrcweir     virtual             ~SmViewForwarder();
191cdf0e10cSrcweir 
192cdf0e10cSrcweir     virtual sal_Bool        IsValid() const;
193cdf0e10cSrcweir     virtual Rectangle   GetVisArea() const;
194cdf0e10cSrcweir     virtual Point       LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
195cdf0e10cSrcweir     virtual Point       PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
196cdf0e10cSrcweir };
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 
199cdf0e10cSrcweir class SmTextForwarder :     /* analog to SvxEditEngineForwarder */
200cdf0e10cSrcweir     public SvxTextForwarder
201cdf0e10cSrcweir {
202cdf0e10cSrcweir 	SmEditAccessible &	rEditAcc;
203cdf0e10cSrcweir     SmEditSource &      rEditSource;
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     DECL_LINK( NotifyHdl, EENotify * );
206cdf0e10cSrcweir 
207cdf0e10cSrcweir     // disallow copy-ctor and assignment-operator for now
208cdf0e10cSrcweir     SmTextForwarder( const SmTextForwarder & );
209cdf0e10cSrcweir     SmTextForwarder & operator = ( const SmTextForwarder & );
210cdf0e10cSrcweir 
211cdf0e10cSrcweir public:
212cdf0e10cSrcweir     SmTextForwarder( SmEditAccessible& rAcc, SmEditSource & rSource );
213cdf0e10cSrcweir     virtual ~SmTextForwarder();
214cdf0e10cSrcweir 
215*7a980842SDamjanJovanovic 	virtual sal_uInt32		GetParagraphCount() const;
216*7a980842SDamjanJovanovic 	virtual sal_uInt16		GetTextLen( sal_uInt32 nParagraph ) const;
217cdf0e10cSrcweir 	virtual String		GetText( const ESelection& rSel ) const;
218cdf0e10cSrcweir 	virtual SfxItemSet	GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All ) const;
219*7a980842SDamjanJovanovic 	virtual	SfxItemSet	GetParaAttribs( sal_uInt32 nPara ) const;
220*7a980842SDamjanJovanovic 	virtual void		SetParaAttribs( sal_uInt32 nPara, const SfxItemSet& rSet );
221cdf0e10cSrcweir     virtual void        RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
222*7a980842SDamjanJovanovic 	virtual void		GetPortions( sal_uInt32 nPara, SvUShorts& rList ) const;
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 	virtual sal_uInt16		GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
225*7a980842SDamjanJovanovic 	virtual sal_uInt16		GetItemState( sal_uInt32 nPara, sal_uInt16 nWhich ) const;
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 	virtual void		QuickInsertText( const String& rText, const ESelection& rSel );
228cdf0e10cSrcweir 	virtual void		QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
229cdf0e10cSrcweir 	virtual void		QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
230cdf0e10cSrcweir 	virtual void		QuickInsertLineBreak( const ESelection& rSel );
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	virtual SfxItemPool* GetPool() const;
233cdf0e10cSrcweir 
234*7a980842SDamjanJovanovic 	virtual XubString    CalcFieldValue( const SvxFieldItem& rField, sal_uInt32 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
235*7a980842SDamjanJovanovic 	virtual void 		FieldClicked(const SvxFieldItem&, sal_uInt32, sal_uInt16);
236cdf0e10cSrcweir 	virtual sal_Bool		 IsValid() const;
237cdf0e10cSrcweir 
238*7a980842SDamjanJovanovic     virtual LanguageType 	GetLanguage( sal_uInt32, sal_uInt16 ) const;
239*7a980842SDamjanJovanovic     virtual sal_uInt16			GetFieldCount( sal_uInt32 nPara ) const;
240*7a980842SDamjanJovanovic     virtual EFieldInfo		GetFieldInfo( sal_uInt32 nPara, sal_uInt16 nField ) const;
241*7a980842SDamjanJovanovic     virtual EBulletInfo     GetBulletInfo( sal_uInt32 nPara ) const;
242*7a980842SDamjanJovanovic     virtual Rectangle		GetCharBounds( sal_uInt32 nPara, sal_uInt16 nIndex ) const;
243*7a980842SDamjanJovanovic     virtual Rectangle		GetParaBounds( sal_uInt32 nPara ) const;
244cdf0e10cSrcweir     virtual MapMode			GetMapMode() const;
245cdf0e10cSrcweir 	virtual OutputDevice*	GetRefDevice() const;
246*7a980842SDamjanJovanovic     virtual sal_Bool		GetIndexAtPoint( const Point&, sal_uInt32& nPara, sal_uInt16& nIndex ) const;
247*7a980842SDamjanJovanovic     virtual sal_Bool		GetWordIndices( sal_uInt32 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
248*7a980842SDamjanJovanovic 	virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt32 nPara, sal_uInt16 nIndex, sal_Bool bInCell = sal_False ) const;
249*7a980842SDamjanJovanovic     virtual sal_uInt16		GetLineCount( sal_uInt32 nPara ) const;
250*7a980842SDamjanJovanovic     virtual sal_uInt16		GetLineLen( sal_uInt32 nPara, sal_uInt16 nLine ) const;
251*7a980842SDamjanJovanovic     virtual void            GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt32 nParagraph, sal_uInt16 nLine ) const;
252*7a980842SDamjanJovanovic     virtual sal_uInt16          GetLineNumberAtIndex( sal_uInt32 nPara, sal_uInt16 nLine ) const;
253cdf0e10cSrcweir     virtual sal_Bool		Delete( const ESelection& );
254cdf0e10cSrcweir     virtual sal_Bool		InsertText( const String&, const ESelection& );
255cdf0e10cSrcweir     virtual sal_Bool		QuickFormatDoc( sal_Bool bFull=sal_False );
256cdf0e10cSrcweir 
257*7a980842SDamjanJovanovic     virtual sal_Int16       GetDepth( sal_uInt32 nPara ) const;
258*7a980842SDamjanJovanovic     virtual sal_Bool        SetDepth( sal_uInt32 nPara, sal_Int16 nNewDepth );
259cdf0e10cSrcweir 
260cdf0e10cSrcweir     virtual const SfxItemSet*   GetEmptyItemSetPtr();
261cdf0e10cSrcweir     // implementation functions for XParagraphAppend and XTextPortionAppend
262cdf0e10cSrcweir     virtual void        AppendParagraph();
263*7a980842SDamjanJovanovic     virtual xub_StrLen  AppendTextPortion( sal_uInt32 nPara, const String &rText, const SfxItemSet &rSet );
264cdf0e10cSrcweir 
265cdf0e10cSrcweir     virtual void        CopyText(const SvxTextForwarder& rSource);
266cdf0e10cSrcweir };
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 
269cdf0e10cSrcweir class SmEditViewForwarder :     /* analog to SvxEditEngineViewForwarder */
270cdf0e10cSrcweir     public SvxEditViewForwarder
271cdf0e10cSrcweir {
272cdf0e10cSrcweir     SmEditAccessible&		rEditAcc;
273cdf0e10cSrcweir 
274cdf0e10cSrcweir     // disallow copy-ctor and assignment-operator for now
275cdf0e10cSrcweir     SmEditViewForwarder( const SmEditViewForwarder & );
276cdf0e10cSrcweir     SmEditViewForwarder & operator = ( const SmEditViewForwarder & );
277cdf0e10cSrcweir 
278cdf0e10cSrcweir public:
279cdf0e10cSrcweir                         SmEditViewForwarder( SmEditAccessible& rAcc );
280cdf0e10cSrcweir     virtual             ~SmEditViewForwarder();
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 	virtual sal_Bool		IsValid() const;
283cdf0e10cSrcweir 
284cdf0e10cSrcweir     virtual Rectangle	GetVisArea() const;
285cdf0e10cSrcweir     virtual Point		LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
286cdf0e10cSrcweir     virtual Point		PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
287cdf0e10cSrcweir 
288cdf0e10cSrcweir     virtual sal_Bool	GetSelection( ESelection& rSelection ) const;
289cdf0e10cSrcweir     virtual sal_Bool	SetSelection( const ESelection& rSelection );
290cdf0e10cSrcweir     virtual sal_Bool	Copy();
291cdf0e10cSrcweir     virtual sal_Bool	Cut();
292cdf0e10cSrcweir     virtual sal_Bool	Paste();
293cdf0e10cSrcweir };
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 
296cdf0e10cSrcweir class SmEditSource :
297cdf0e10cSrcweir     public SvxEditSource
298cdf0e10cSrcweir {
299cdf0e10cSrcweir     SfxBroadcaster          aBroadCaster;
300cdf0e10cSrcweir     SmViewForwarder         aViewFwd;
301cdf0e10cSrcweir     SmTextForwarder         aTextFwd;
302cdf0e10cSrcweir     SmEditViewForwarder     aEditViewFwd;
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 	SmEditAccessible&		rEditAcc;
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     // disallow copy-ctor and assignment-operator for now
307cdf0e10cSrcweir     SmEditSource( const SmEditSource &rSrc );
308cdf0e10cSrcweir     SmEditSource & operator = ( const SmEditSource & );
309cdf0e10cSrcweir 
310cdf0e10cSrcweir public:
311cdf0e10cSrcweir             SmEditSource( SmEditWindow *pWin, SmEditAccessible &rAcc );
312cdf0e10cSrcweir     virtual ~SmEditSource();
313cdf0e10cSrcweir 
314cdf0e10cSrcweir     virtual SvxEditSource*      Clone() const;
315cdf0e10cSrcweir     virtual SvxTextForwarder*   GetTextForwarder();
316cdf0e10cSrcweir  	virtual SvxViewForwarder*	GetViewForwarder();
317cdf0e10cSrcweir  	virtual SvxEditViewForwarder*	GetEditViewForwarder( sal_Bool bCreate = sal_False );
318cdf0e10cSrcweir     virtual void                UpdateData();
319cdf0e10cSrcweir     virtual SfxBroadcaster&		GetBroadcaster() const;
320cdf0e10cSrcweir };
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 
325cdf0e10cSrcweir typedef
326cdf0e10cSrcweir cppu::WeakImplHelper5
327cdf0e10cSrcweir     <
328cdf0e10cSrcweir         com::sun::star::lang::XServiceInfo,
329cdf0e10cSrcweir         com::sun::star::accessibility::XAccessible,
330cdf0e10cSrcweir         com::sun::star::accessibility::XAccessibleComponent,
331cdf0e10cSrcweir         com::sun::star::accessibility::XAccessibleContext,
332cdf0e10cSrcweir         com::sun::star::accessibility::XAccessibleEventBroadcaster
333cdf0e10cSrcweir     >
334cdf0e10cSrcweir SmEditAccessibleBaseClass;
335cdf0e10cSrcweir 
336cdf0e10cSrcweir class SmEditAccessible :
337cdf0e10cSrcweir     public SmEditAccessibleBaseClass
338cdf0e10cSrcweir {
339cdf0e10cSrcweir     osl::Mutex                              aListenerMutex;
340cdf0e10cSrcweir     String                                  aAccName;
341cdf0e10cSrcweir     ::accessibility::AccessibleTextHelper    *pTextHelper;
342cdf0e10cSrcweir     SmEditWindow                           *pWin;
343cdf0e10cSrcweir 
344cdf0e10cSrcweir     // disallow copy-ctor and assignment-operator for now
345cdf0e10cSrcweir     SmEditAccessible( const SmEditAccessible & );
346cdf0e10cSrcweir     SmEditAccessible & operator = ( const SmEditAccessible & );
347cdf0e10cSrcweir 
348cdf0e10cSrcweir protected:
349cdf0e10cSrcweir #ifdef TL_NOT_YET_USED
350cdf0e10cSrcweir     SmDocShell *    GetDoc_Impl();
351cdf0e10cSrcweir #endif //TL_NOT_YET_USED
352cdf0e10cSrcweir 
353cdf0e10cSrcweir public:
354cdf0e10cSrcweir     SmEditAccessible( SmEditWindow *pEditWin );
355cdf0e10cSrcweir     virtual ~SmEditAccessible();
356cdf0e10cSrcweir 
GetTextHelper()357cdf0e10cSrcweir     ::accessibility::AccessibleTextHelper *   GetTextHelper() { return pTextHelper; }
358cdf0e10cSrcweir 
359cdf0e10cSrcweir     void                Init();
GetWin()360cdf0e10cSrcweir     SmEditWindow *      GetWin()    { return pWin; }
361cdf0e10cSrcweir     void                ClearWin();     // to be called when view is destroyed
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 	//! access EditEngine and EditView via the functions in the respective window
364cdf0e10cSrcweir 	//! pointers may be 0 (e.g. during reload)
GetEditEngine()365cdf0e10cSrcweir 	EditEngine * GetEditEngine()	{ return pWin ? pWin->GetEditEngine() : 0; }
GetEditView()366cdf0e10cSrcweir     EditView   * GetEditView()		{ return pWin ? pWin->GetEditView() : 0; }
367cdf0e10cSrcweir 
368cdf0e10cSrcweir     // XAccessible
369cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
370cdf0e10cSrcweir 
371cdf0e10cSrcweir     // XAccessibleComponent
372cdf0e10cSrcweir     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
373cdf0e10cSrcweir     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);
374cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException);
375cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException);
376cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException);
377cdf0e10cSrcweir     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException);
378cdf0e10cSrcweir     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
379cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
380cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
381cdf0e10cSrcweir 
382cdf0e10cSrcweir     // XAccessibleContext
383cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
384cdf0e10cSrcweir     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);
385cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
386cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
387cdf0e10cSrcweir     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
388cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
389cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
390cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
391cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
392cdf0e10cSrcweir     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
393cdf0e10cSrcweir 
394cdf0e10cSrcweir     // XAccessibleEventBroadcaster
395cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
396cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
397cdf0e10cSrcweir 
398cdf0e10cSrcweir     // XServiceInfo
399cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
400cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
401cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
402cdf0e10cSrcweir };
403cdf0e10cSrcweir 
404cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
405cdf0e10cSrcweir 
406cdf0e10cSrcweir #endif
407cdf0e10cSrcweir 
408