1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX 29*cdf0e10cSrcweir #define _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <tools/gen.hxx> 32*cdf0e10cSrcweir #include <tools/string.hxx> 33*cdf0e10cSrcweir #include <cppuhelper/weakref.hxx> 34*cdf0e10cSrcweir #include <cppuhelper/compbase9.hxx> 35*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 36*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx> 39*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleContext.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleComponent.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleHypertext.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp> 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir #include <comphelper/accessibletexthelper.hxx> 49*cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx> 50*cdf0e10cSrcweir #include "editeng/AccessibleParaManager.hxx" 51*cdf0e10cSrcweir #include "editeng/AccessibleImageBullet.hxx" 52*cdf0e10cSrcweir #include "editeng/unoedprx.hxx" 53*cdf0e10cSrcweir #include "editeng/editengdllapi.h" 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir namespace accessibility 56*cdf0e10cSrcweir { 57*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible, 58*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleContext, 59*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleComponent, 60*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleEditableText, 61*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleEventBroadcaster, 62*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleTextAttributes, 63*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleHypertext, 64*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleMultiLineText, 65*cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir /** This class implements the actual text paragraphs for the EditEngine/Outliner UAA 68*cdf0e10cSrcweir */ 69*cdf0e10cSrcweir class EDITENG_DLLPUBLIC AccessibleEditableTextPara : public ::comphelper::OBaseMutex, public AccessibleTextParaInterfaceBase, public ::comphelper::OCommonAccessibleText 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir protected: 73*cdf0e10cSrcweir // override OCommonAccessibleText methods 74*cdf0e10cSrcweir virtual ::rtl::OUString implGetText(); 75*cdf0e10cSrcweir virtual ::com::sun::star::lang::Locale implGetLocale(); 76*cdf0e10cSrcweir virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); 77*cdf0e10cSrcweir virtual void implGetParagraphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ); 78*cdf0e10cSrcweir virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ); 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir public: 81*cdf0e10cSrcweir /// Create accessible object for given parent 82*cdf0e10cSrcweir // --> OD 2006-01-11 #i27138# 83*cdf0e10cSrcweir // - add parameter <_pParaManager> (default value NULL) 84*cdf0e10cSrcweir // This has to be the the instance of <AccessibleParaManager>, which 85*cdf0e10cSrcweir // created and manages this accessible paragraph. 86*cdf0e10cSrcweir AccessibleEditableTextPara ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent, 87*cdf0e10cSrcweir const AccessibleParaManager* _pParaManager = NULL ); 88*cdf0e10cSrcweir // <-- 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir virtual ~AccessibleEditableTextPara (); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir // XInterface 93*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir // XComponent 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir using WeakComponentImplHelperBase::addEventListener; 98*cdf0e10cSrcweir using WeakComponentImplHelperBase::removeEventListener; 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir // XAccessible 101*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir // XAccessibleContext 104*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException); 105*cdf0e10cSrcweir 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); 106*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException); 107*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException); 108*cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException); 109*cdf0e10cSrcweir /// Maximal length of text returned by getAccessibleDescription() 110*cdf0e10cSrcweir enum { MaxDescriptionLen = 40 }; 111*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException); 112*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException); 113*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException); 114*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException); 115*cdf0e10cSrcweir virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir // XAccessibleEventBroadcaster 118*cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 119*cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir // XAccessibleComponent 122*cdf0e10cSrcweir virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 123*cdf0e10cSrcweir 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); 124*cdf0e10cSrcweir virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); 125*cdf0e10cSrcweir virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); 126*cdf0e10cSrcweir virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); 127*cdf0e10cSrcweir virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); 128*cdf0e10cSrcweir virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); 129*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); 130*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir // XAccessibleText (this comes implicitely inherited by XAccessibleEditableText AND by XAccessibleMultiLineText) 133*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); 134*cdf0e10cSrcweir virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 135*cdf0e10cSrcweir virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 136*cdf0e10cSrcweir 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); 137*cdf0e10cSrcweir virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 138*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); 139*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 140*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); 141*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); 142*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); 143*cdf0e10cSrcweir virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 144*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); 145*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 146*cdf0e10cSrcweir /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) 147*cdf0e10cSrcweir 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); 148*cdf0e10cSrcweir /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) 149*cdf0e10cSrcweir 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); 150*cdf0e10cSrcweir /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) 151*cdf0e10cSrcweir 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); 152*cdf0e10cSrcweir virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir // XAccessibleEditableText 155*cdf0e10cSrcweir virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 156*cdf0e10cSrcweir virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 157*cdf0e10cSrcweir virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 158*cdf0e10cSrcweir virtual sal_Bool SAL_CALL insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 159*cdf0e10cSrcweir virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 160*cdf0e10cSrcweir virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 161*cdf0e10cSrcweir virtual sal_Bool SAL_CALL setText( const ::rtl::OUString& sText ) throw (::com::sun::star::uno::RuntimeException); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir // XAccessibleTextAttributes 164*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException); 165*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir // XAccessibleHypertext 168*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException); 169*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 170*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir // XAccessibleMultiLineText 173*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 174*cdf0e10cSrcweir virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 175*cdf0e10cSrcweir virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException); 176*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException); 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir // XServiceInfo 179*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException); 180*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException); 181*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException); 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir // XServiceName 184*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir /** Set the current index in the accessibility parent 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 189*cdf0e10cSrcweir leaving that to the calling code. This is because only 190*cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 191*cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 192*cdf0e10cSrcweir */ 193*cdf0e10cSrcweir void SetIndexInParent( sal_Int32 nIndex ); 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir /** Get the current index in the accessibility parent 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 198*cdf0e10cSrcweir leaving that to the calling code. This is because only 199*cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 200*cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 201*cdf0e10cSrcweir */ 202*cdf0e10cSrcweir sal_Int32 GetIndexInParent() const; 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir /** Set the current paragraph number 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 207*cdf0e10cSrcweir leaving that to the calling code. This is because only 208*cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 209*cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 210*cdf0e10cSrcweir */ 211*cdf0e10cSrcweir void SetParagraphIndex( sal_Int32 nIndex ); 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir /** Query the current paragraph number (0 - nParas-1) 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 216*cdf0e10cSrcweir leaving that to the calling code. This is because only 217*cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 218*cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 219*cdf0e10cSrcweir */ 220*cdf0e10cSrcweir sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir /** Set the edit engine offset 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 225*cdf0e10cSrcweir leaving that to the calling code. This is because only 226*cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 227*cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 228*cdf0e10cSrcweir */ 229*cdf0e10cSrcweir void SetEEOffset( const Point& rOffset ); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir /** Set the EditEngine offset 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 234*cdf0e10cSrcweir leaving that to the calling code. This is because only 235*cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 236*cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 237*cdf0e10cSrcweir */ 238*cdf0e10cSrcweir void SetEditSource( SvxEditSourceAdapter* pEditSource ); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir /** Dispose this object 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir Notifies and deregisters the listeners, drops all references. 243*cdf0e10cSrcweir */ 244*cdf0e10cSrcweir void Dispose(); 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir /// Calls all Listener objects to tell them the change. Don't hold locks when calling this! 247*cdf0e10cSrcweir 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; 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir /// Queries the given state on the internal state set 250*cdf0e10cSrcweir bool HasState( const sal_Int16 nStateId ); 251*cdf0e10cSrcweir /// Sets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this! 252*cdf0e10cSrcweir void SetState( const sal_Int16 nStateId ); 253*cdf0e10cSrcweir /// Unsets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this! 254*cdf0e10cSrcweir void UnSetState( const sal_Int16 nStateId ); 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir static Rectangle LogicToPixel( const Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder& rForwarder ); 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir SvxEditSourceAdapter& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir /** Query the SvxTextForwarder for EditEngine access. 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 263*cdf0e10cSrcweir leaving that to the calling code. This is because only 264*cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 265*cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 266*cdf0e10cSrcweir */ 267*cdf0e10cSrcweir SvxAccessibleTextAdapter& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir /** Query the SvxViewForwarder for EditEngine access. 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 272*cdf0e10cSrcweir leaving that to the calling code. This is because only 273*cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 274*cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 275*cdf0e10cSrcweir */ 276*cdf0e10cSrcweir SvxViewForwarder& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir /** Query whether a GetEditViewForwarder( sal_False ) will return a forwarder 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 281*cdf0e10cSrcweir leaving that to the calling code. This is because only 282*cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 283*cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 284*cdf0e10cSrcweir */ 285*cdf0e10cSrcweir sal_Bool HaveEditView() const; 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir /** Query the SvxEditViewForwarder for EditEngine access. 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 290*cdf0e10cSrcweir leaving that to the calling code. This is because only 291*cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 292*cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 293*cdf0e10cSrcweir */ 294*cdf0e10cSrcweir SvxAccessibleTextEditViewAdapter& GetEditViewForwarder( sal_Bool bCreate = sal_False ) const SAL_THROW((::com::sun::star::uno::RuntimeException)); 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir /** Send a TEXT_CHANGED event for this paragraph 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir This method internally caters for calculating text 299*cdf0e10cSrcweir differences, and sends the appropriate Anys in the 300*cdf0e10cSrcweir Accessibility::TEXT_CHANGED event 301*cdf0e10cSrcweir */ 302*cdf0e10cSrcweir void TextChanged(); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir private: 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir // declared, but not defined 307*cdf0e10cSrcweir AccessibleEditableTextPara( const AccessibleEditableTextPara& ); 308*cdf0e10cSrcweir AccessibleEditableTextPara& operator= ( const AccessibleEditableTextPara& ); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir /** Calculate character range of similar attributes 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir @param nStartIndex 313*cdf0e10cSrcweir Therein, the start of the character range with the same attributes is returned 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir @param nEndIndex 316*cdf0e10cSrcweir Therein, the end (exclusively) of the character range with the same attributes is returned 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir @param nIndex 319*cdf0e10cSrcweir The character index at where to look for similar character attributes 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir @return sal_False, if the method was not able to determine the range 322*cdf0e10cSrcweir */ 323*cdf0e10cSrcweir sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nIndex ); 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir // syntactic sugar for FireEvent 326*cdf0e10cSrcweir void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const; 327*cdf0e10cSrcweir void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const; 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir /** Query the visibility state 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 332*cdf0e10cSrcweir leaving that to the calling code. This is because only 333*cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 334*cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir @return the visibility state. Per definition, a defunc object is no longer visible 337*cdf0e10cSrcweir */ 338*cdf0e10cSrcweir sal_Bool IsVisible() const; 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir int getNotifierClientId() const; 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir // retrieve text interface for given paragraph index 343*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleText > GetParaInterface( sal_Int32 nIndex ); 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir /// Do we have children? This is the case for image bullets 346*cdf0e10cSrcweir sal_Bool HaveChildren(); 347*cdf0e10cSrcweir 348*cdf0e10cSrcweir /// Is the underlying object in edit mode 349*cdf0e10cSrcweir sal_Bool IsActive() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir const Point& GetEEOffset() const; 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir // Get text from forwarder 354*cdf0e10cSrcweir String GetText( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::uno::RuntimeException)); 355*cdf0e10cSrcweir String GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) SAL_THROW((::com::sun::star::uno::RuntimeException)); 356*cdf0e10cSrcweir sal_uInt16 GetTextLen() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir /** Get the current selection of this paragraph 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir @return sal_False, if nothing in this paragraph is selected 361*cdf0e10cSrcweir */ 362*cdf0e10cSrcweir sal_Bool GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ) SAL_THROW((::com::sun::star::uno::RuntimeException)); 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir /** create selection from Accessible selection. 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir */ 367*cdf0e10cSrcweir ESelection MakeSelection( sal_Int32 nStartEEIndex, sal_Int32 nEndEEIndex ); 368*cdf0e10cSrcweir ESelection MakeSelection( sal_Int32 nEEIndex ); 369*cdf0e10cSrcweir ESelection MakeCursor( sal_Int32 nEEIndex ); 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir // check whether index value is within permitted range 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir /// Check whether 0<=nIndex<=n-1 374*cdf0e10cSrcweir void CheckIndex( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)); 375*cdf0e10cSrcweir /// Check whether 0<=nIndex<=n 376*cdf0e10cSrcweir void CheckPosition( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)); 377*cdf0e10cSrcweir /// Check whether 0<=nStart<=n and 0<=nEnd<=n 378*cdf0e10cSrcweir void CheckRange( sal_Int32 nStart, sal_Int32 nEnd ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)); 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir // the paragraph index in the edit engine (guarded by solar mutex) 381*cdf0e10cSrcweir sal_Int32 mnParagraphIndex; 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir // our current index in the parent (guarded by solar mutex) 384*cdf0e10cSrcweir sal_Int32 mnIndexInParent; 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir // the current edit source (guarded by solar mutex) 387*cdf0e10cSrcweir SvxEditSourceAdapter* mpEditSource; 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir // the possible child (for image bullets, guarded by solar mutex) 390*cdf0e10cSrcweir typedef WeakCppRef < ::com::sun::star::accessibility::XAccessible, AccessibleImageBullet > WeakBullet; 391*cdf0e10cSrcweir WeakBullet maImageBullet; 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir // the last string used for an Accessibility::TEXT_CHANGED event (guarded by solar mutex) 394*cdf0e10cSrcweir ::rtl::OUString maLastTextString; 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex) 397*cdf0e10cSrcweir Point maEEOffset; 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir // the current state set (updated from SetState/UnSetState and guarded by solar mutex) 400*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet; 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir /// The shape we're the accessible for (unguarded) 403*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent; 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir /// Our listeners (guarded by maMutex) 406*cdf0e10cSrcweir int mnNotifierClientId; 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir // --> OD 2006-01-11 #i27138# 409*cdf0e10cSrcweir // the paragraph manager, which created this instance - is NULL, if 410*cdf0e10cSrcweir // instance isn't created by AccessibleParaManager. 411*cdf0e10cSrcweir // Needed for method <getAccessibleRelationSet()> to retrieve predecessor 412*cdf0e10cSrcweir // paragraph and the successor paragraph. 413*cdf0e10cSrcweir const AccessibleParaManager* mpParaManager; 414*cdf0e10cSrcweir }; 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir } // end of namespace accessibility 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir #endif 419*cdf0e10cSrcweir 420