#98735# Refactored unoedit/unoedacc.cxx
This commit is contained in:
1610
svx/source/accessibility/AccessibleEditableTextPara.cxx
Normal file
1610
svx/source/accessibility/AccessibleEditableTextPara.cxx
Normal file
File diff suppressed because it is too large
Load Diff
403
svx/source/accessibility/AccessibleEditableTextPara.hxx
Normal file
403
svx/source/accessibility/AccessibleEditableTextPara.hxx
Normal file
@@ -0,0 +1,403 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: AccessibleEditableTextPara.hxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2002-05-16 16:10:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX
|
||||
#define _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX
|
||||
|
||||
#ifndef _SV_GEN_HXX
|
||||
#include <tools/gen.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPUHELPER_WEAKREF_HXX_
|
||||
#include <cppuhelper/weakref.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPUHELPER_IMPLBASE6_HXX_
|
||||
#include <cppuhelper/implbase6.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
|
||||
#include <cppuhelper/typeprovider.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
|
||||
#include <cppuhelper/interfacecontainer.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/XAccessible.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECONTEXT_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/XAccessibleContext.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECOMPONENT_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/XAccessibleComponent.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEEDITABLETEXT_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/XAccessibleEditableText.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _SVX_ACCESSIBLE_PARA_MANAGER_HXX
|
||||
#include "AccessibleParaManager.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
|
||||
#include "AccessibleImageBullet.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _SVX_UNOEDPRX_HXX
|
||||
#include "unoedprx.hxx"
|
||||
#endif
|
||||
|
||||
|
||||
namespace accessibility
|
||||
{
|
||||
|
||||
typedef ::cppu::WeakImplHelper6< ::drafts::com::sun::star::accessibility::XAccessible,
|
||||
::drafts::com::sun::star::accessibility::XAccessibleContext,
|
||||
::drafts::com::sun::star::accessibility::XAccessibleComponent,
|
||||
::drafts::com::sun::star::accessibility::XAccessibleEditableText,
|
||||
::drafts::com::sun::star::accessibility::XAccessibleEventBroadcaster,
|
||||
::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase;
|
||||
|
||||
/** This class implements the actual text paragraphs for the EditEngine/Outliner UAA
|
||||
*/
|
||||
class AccessibleEditableTextPara : public AccessibleTextParaInterfaceBase
|
||||
{
|
||||
|
||||
public:
|
||||
/// Create accessible object for given parent
|
||||
AccessibleEditableTextPara ( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible >& rParent );
|
||||
|
||||
virtual ~AccessibleEditableTextPara ();
|
||||
|
||||
// XInterface
|
||||
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XAccessible
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XAccessibleContext
|
||||
virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException);
|
||||
/// Maximal length of text returned by getAccessibleDescription()
|
||||
enum { MaxDescriptionLen = 40 };
|
||||
virtual ::rtl::OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::rtl::OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::drafts::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XAccessibleEventBroadcaster
|
||||
virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XAccessibleComponent
|
||||
virtual sal_Bool SAL_CALL contains( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAt( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL isShowing( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL isVisible( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL isFocusTraversable( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XAccessibleText (this comes implicitely inherited by XAccessibleEditableText)
|
||||
virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
/// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
|
||||
virtual ::rtl::OUString SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
/// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
|
||||
virtual ::rtl::OUString SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
/// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
|
||||
virtual ::rtl::OUString SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XAccessibleEditableText
|
||||
virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
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);
|
||||
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);
|
||||
virtual sal_Bool SAL_CALL setText( const ::rtl::OUString& sText ) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XServiceInfo
|
||||
virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XServiceName
|
||||
virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/** Set the current index in the accessibility parent
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
void SetIndexInParent( sal_Int32 nIndex );
|
||||
|
||||
/** Get the current index in the accessibility parent
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
sal_Int32 GetIndexInParent() const;
|
||||
|
||||
/** Set the current paragraph number
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
void SetParagraphIndex( sal_Int32 nIndex );
|
||||
|
||||
/** Query the current paragraph number (0 - nParas-1)
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
sal_Int32 GetParagraphIndex() const throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/** Set the edit engine offset
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
void SetEEOffset( const Point& rOffset );
|
||||
|
||||
/** Set the EditEngine offset
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
void SetEditSource( SvxEditSourceAdapter* pEditSource );
|
||||
|
||||
/// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
|
||||
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;
|
||||
|
||||
static Rectangle LogicToPixel( const Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder& rForwarder );
|
||||
|
||||
private:
|
||||
|
||||
// declared, but not defined
|
||||
AccessibleEditableTextPara( const AccessibleEditableTextPara& );
|
||||
AccessibleEditableTextPara& operator= ( const AccessibleEditableTextPara& );
|
||||
|
||||
// syntactic sugar for FireEvent
|
||||
void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
|
||||
void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
|
||||
|
||||
/** Query the visibility state
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
|
||||
@return the visibility state. Per definition, a defunc object is no longer visible
|
||||
*/
|
||||
sal_Bool IsVisible() const;
|
||||
|
||||
// retrieve text interface for given paragraph index
|
||||
::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleText > GetParaInterface( sal_Int32 nIndex );
|
||||
|
||||
SvxEditSourceAdapter& GetEditSource() const throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/** Query the SvxTextForwarder for EditEngine access.
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
SvxAccessibleTextAdapter& GetTextForwarder() const throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/** Query the SvxViewForwarder for EditEngine access.
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
SvxViewForwarder& GetViewForwarder() const throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/** Query whether a GetEditViewForwarder( sal_False ) will return a forwarder
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
sal_Bool HaveEditView() const;
|
||||
|
||||
/** Query the SvxEditViewForwarder for EditEngine access.
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
SvxAccessibleTextEditViewAdapter& GetEditViewForwarder( sal_Bool bCreate = sal_False ) const throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/// Do we have children? This is the case for image bullets
|
||||
sal_Bool HaveChildren();
|
||||
|
||||
/// Is the underlying object in edit mode
|
||||
sal_Bool IsActive() const throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
const Point& GetEEOffset() const;
|
||||
|
||||
// Get text from forwarder
|
||||
String GetText( sal_Int32 nIndex ) throw (::com::sun::star::uno::RuntimeException);
|
||||
String GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::uno::RuntimeException);
|
||||
USHORT GetTextLen() const throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/** Get the current selection of this paragraph
|
||||
|
||||
@return sal_False, if nothing in this paragraph is selected
|
||||
*/
|
||||
sal_Bool GetSelection( USHORT& nStartPos, USHORT& nEndPos ) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/** create selection from Accessible selection.
|
||||
|
||||
*/
|
||||
ESelection MakeSelection( sal_Int32 nStartEEIndex, sal_Int32 nEndEEIndex );
|
||||
ESelection MakeSelection( sal_Int32 nEEIndex );
|
||||
|
||||
// check whether index value is within permitted range
|
||||
|
||||
/// Check whether 0<=nIndex<=n-1
|
||||
void CheckIndex( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
/// Check whether 0<=nIndex<=n
|
||||
void CheckPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
/// Check whether 0<=nStart<=n and 0<=nEnd<=n
|
||||
void CheckRange( sal_Int32 nStart, sal_Int32 nEnd ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// the paragraph index in the edit engine (guarded by solar mutex)
|
||||
sal_Int32 mnParagraphIndex;
|
||||
|
||||
// our current index in the parent (guarded by solar mutex)
|
||||
sal_Int32 mnIndexInParent;
|
||||
|
||||
// the current edit source (guarded by solar mutex)
|
||||
SvxEditSourceAdapter* mpEditSource;
|
||||
|
||||
// the possible child (for image bullets, guarded by solar mutex)
|
||||
typedef WeakCppRef < ::drafts::com::sun::star::accessibility::XAccessible, AccessibleImageBullet > WeakBullet;
|
||||
WeakBullet maImageBullet;
|
||||
|
||||
// the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
|
||||
Point maEEOffset;
|
||||
|
||||
mutable osl::Mutex maMutex;
|
||||
|
||||
/// The shape we're the accessible for (unguarded)
|
||||
::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > mxParent;
|
||||
|
||||
/// Our listeners (guarded by maMutex)
|
||||
::cppu::OInterfaceContainerHelper maStateListeners;
|
||||
};
|
||||
|
||||
} // end of namespace accessibility
|
||||
|
||||
#endif
|
||||
|
582
svx/source/accessibility/AccessibleImageBullet.cxx
Normal file
582
svx/source/accessibility/AccessibleImageBullet.cxx
Normal file
@@ -0,0 +1,582 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: AccessibleImageBullet.cxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2002-05-16 16:10:32 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _SV_GEN_HXX
|
||||
#include <tools/gen.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _VOS_MUTEX_HXX_
|
||||
#include <vos/mutex.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _SV_SVAPP_HXX
|
||||
#include <vcl/svapp.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _RTL_USTRING_HXX_
|
||||
#include <rtl/ustring.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_AWT_POINT_HPP_
|
||||
#include <com/sun/star/awt/Point.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_AWT_RECTANGLE_HPP_
|
||||
#include <com/sun/star/awt/Rectangle.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/AccessibleRole.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLETEXTTYPE_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/AccessibleTextType.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/AccessibleStateType.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/AccessibleEventId.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX_
|
||||
#include <unotools/accessiblestatesethelper.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _UNO_LINGU_HXX
|
||||
#include "unolingu.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX
|
||||
#include "AccessibleEditableTextPara.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
|
||||
#include "AccessibleImageBullet.hxx"
|
||||
#endif
|
||||
|
||||
#include "editdata.hxx"
|
||||
#include "editeng.hxx"
|
||||
#include "outliner.hxx"
|
||||
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::drafts::com::sun::star::accessibility;
|
||||
|
||||
namespace accessibility
|
||||
{
|
||||
|
||||
AccessibleImageBullet::AccessibleImageBullet ( const uno::Reference< XAccessible >& rParent ) :
|
||||
mnParagraphIndex( 0 ),
|
||||
mnIndexInParent( 0 ),
|
||||
mpEditSource( NULL ),
|
||||
maEEOffset( 0, 0 ),
|
||||
mxParent( rParent ),
|
||||
maStateListeners( maMutex )
|
||||
{
|
||||
}
|
||||
|
||||
AccessibleImageBullet::~AccessibleImageBullet()
|
||||
{
|
||||
}
|
||||
|
||||
uno::Any SAL_CALL AccessibleImageBullet::queryInterface (const uno::Type & rType) throw (uno::RuntimeException)
|
||||
{
|
||||
return AccessibleImageBulletInterfaceBase::queryInterface(rType);
|
||||
}
|
||||
|
||||
uno::Reference< XAccessibleContext > SAL_CALL AccessibleImageBullet::getAccessibleContext( ) throw (uno::RuntimeException)
|
||||
{
|
||||
// We implement the XAccessibleContext interface in the same object
|
||||
return uno::Reference< XAccessibleContext > ( this );
|
||||
}
|
||||
|
||||
sal_Int32 SAL_CALL AccessibleImageBullet::getAccessibleChildCount() throw (uno::RuntimeException)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleChild( sal_Int32 i ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
|
||||
{
|
||||
throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No childs available")),
|
||||
uno::Reference< uno::XInterface >
|
||||
( static_cast< ::cppu::OWeakObject* > (this) ) ); // static_cast: disambiguate hierarchy
|
||||
}
|
||||
|
||||
uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleParent() throw (uno::RuntimeException)
|
||||
{
|
||||
return mxParent;
|
||||
}
|
||||
|
||||
sal_Int32 SAL_CALL AccessibleImageBullet::getAccessibleIndexInParent() throw (uno::RuntimeException)
|
||||
{
|
||||
return mnIndexInParent;
|
||||
}
|
||||
|
||||
sal_Int16 SAL_CALL AccessibleImageBullet::getAccessibleRole() throw (uno::RuntimeException)
|
||||
{
|
||||
// TODO
|
||||
return AccessibleRole::GRAPHIC;
|
||||
}
|
||||
|
||||
::rtl::OUString SAL_CALL AccessibleImageBullet::getAccessibleDescription() throw (uno::RuntimeException)
|
||||
{
|
||||
::vos::OGuard aGuard( Application::GetSolarMutex() );
|
||||
|
||||
::rtl::OUString aStr( RTL_CONSTASCII_USTRINGPARAM("Image bullet in paragraph ") );
|
||||
|
||||
aStr += ::rtl::OUString::valueOf( GetParagraphIndex() );
|
||||
|
||||
return aStr;
|
||||
}
|
||||
|
||||
::rtl::OUString SAL_CALL AccessibleImageBullet::getAccessibleName() throw (uno::RuntimeException)
|
||||
{
|
||||
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Image bullet") );
|
||||
}
|
||||
|
||||
uno::Reference< XAccessibleRelationSet > SAL_CALL AccessibleImageBullet::getAccessibleRelationSet() throw (uno::RuntimeException)
|
||||
{
|
||||
// no relations, therefore empty
|
||||
return uno::Reference< XAccessibleRelationSet >();
|
||||
}
|
||||
|
||||
uno::Reference< XAccessibleStateSet > SAL_CALL AccessibleImageBullet::getAccessibleStateSet() throw (uno::RuntimeException)
|
||||
{
|
||||
::vos::OGuard aGuard( Application::GetSolarMutex() );
|
||||
|
||||
utl::AccessibleStateSetHelper* aStateSet = new utl::AccessibleStateSetHelper();
|
||||
uno::Reference< XAccessibleStateSet > xStateSet( static_cast< cppu::OWeakObject* > (aStateSet), uno::UNO_QUERY );
|
||||
|
||||
// are we defunc?
|
||||
if( !mpEditSource )
|
||||
{
|
||||
aStateSet->AddState( AccessibleStateType::DEFUNC );
|
||||
aStateSet->AddState( AccessibleStateType::INVALID );
|
||||
}
|
||||
|
||||
// are we visible?
|
||||
if( IsVisible() )
|
||||
{
|
||||
aStateSet->AddState( AccessibleStateType::SHOWING );
|
||||
aStateSet->AddState( AccessibleStateType::VISIBLE );
|
||||
}
|
||||
|
||||
return xStateSet;
|
||||
}
|
||||
|
||||
lang::Locale SAL_CALL AccessibleImageBullet::getLocale() throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
|
||||
{
|
||||
::vos::OGuard aGuard( Application::GetSolarMutex() );
|
||||
|
||||
lang::Locale aLocale;
|
||||
|
||||
DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
|
||||
"AccessibleImageBullet::getLocale: paragraph index value overflow");
|
||||
|
||||
// return locale of first character in the paragraph
|
||||
return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< USHORT >( GetParagraphIndex() ), 0 ));
|
||||
}
|
||||
|
||||
void SAL_CALL AccessibleImageBullet::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
|
||||
{
|
||||
maStateListeners.addInterface( xListener );
|
||||
}
|
||||
|
||||
void SAL_CALL AccessibleImageBullet::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
|
||||
{
|
||||
maStateListeners.removeInterface( xListener );
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL AccessibleImageBullet::contains( const awt::Point& rPoint ) throw (uno::RuntimeException)
|
||||
{
|
||||
::vos::OGuard aGuard( Application::GetSolarMutex() );
|
||||
|
||||
DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
|
||||
"AccessibleEditableTextPara::contains: index value overflow");
|
||||
|
||||
awt::Rectangle aTmpRect = getBounds();
|
||||
Rectangle aRect( Point(aTmpRect.X, aTmpRect.Y), Size(aTmpRect.Width, aTmpRect.Height) );
|
||||
Point aPoint( rPoint.X, rPoint.Y );
|
||||
|
||||
return aRect.IsInside( aPoint );
|
||||
}
|
||||
|
||||
uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleAt( const awt::Point& aPoint ) throw (uno::RuntimeException)
|
||||
{
|
||||
// as we have no children, empty reference
|
||||
return uno::Reference< XAccessible >();
|
||||
}
|
||||
|
||||
awt::Rectangle SAL_CALL AccessibleImageBullet::getBounds( ) throw (uno::RuntimeException)
|
||||
{
|
||||
::vos::OGuard aGuard( Application::GetSolarMutex() );
|
||||
|
||||
DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
|
||||
"AccessibleEditableTextPara::getBounds: index value overflow");
|
||||
|
||||
SvxTextForwarder& rCacheTF = GetTextForwarder();
|
||||
EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< USHORT > (GetParagraphIndex()) );
|
||||
|
||||
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
|
||||
aBulletInfo.bVisible &&
|
||||
aBulletInfo.nType == SVX_NUM_BITMAP )
|
||||
{
|
||||
Rectangle aRect = aBulletInfo.aBounds;
|
||||
|
||||
// convert to screen coordinates
|
||||
Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect,
|
||||
rCacheTF.GetMapMode(),
|
||||
GetViewForwarder() );
|
||||
|
||||
// offset from shape/cell
|
||||
Point aOffset = GetEEOffset();
|
||||
|
||||
return awt::Rectangle( aScreenRect.Left() + aOffset.X(),
|
||||
aScreenRect.Top() + aOffset.Y(),
|
||||
aScreenRect.GetSize().Width(),
|
||||
aScreenRect.GetSize().Height() );
|
||||
}
|
||||
|
||||
return awt::Rectangle();
|
||||
}
|
||||
|
||||
awt::Point SAL_CALL AccessibleImageBullet::getLocation( ) throw (uno::RuntimeException)
|
||||
{
|
||||
::vos::OGuard aGuard( Application::GetSolarMutex() );
|
||||
|
||||
awt::Rectangle aRect = getBounds();
|
||||
|
||||
return awt::Point( aRect.X, aRect.Y );
|
||||
}
|
||||
|
||||
awt::Point SAL_CALL AccessibleImageBullet::getLocationOnScreen( ) throw (uno::RuntimeException)
|
||||
{
|
||||
::vos::OGuard aGuard( Application::GetSolarMutex() );
|
||||
|
||||
// relate us to parent
|
||||
uno::Reference< XAccessible > xParent = getAccessibleParent();
|
||||
if( xParent.is() )
|
||||
{
|
||||
uno::Reference< XAccessibleComponent > xParentComponent( xParent, uno::UNO_QUERY );
|
||||
if( xParentComponent.is() )
|
||||
{
|
||||
awt::Point aRefPoint = xParentComponent->getLocationOnScreen();
|
||||
awt::Point aPoint = getLocation();
|
||||
aPoint.X += aRefPoint.X;
|
||||
aPoint.Y += aRefPoint.Y;
|
||||
|
||||
return aPoint;
|
||||
}
|
||||
}
|
||||
|
||||
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot access parent")),
|
||||
uno::Reference< uno::XInterface >
|
||||
( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy
|
||||
}
|
||||
|
||||
awt::Size SAL_CALL AccessibleImageBullet::getSize( ) throw (uno::RuntimeException)
|
||||
{
|
||||
::vos::OGuard aGuard( Application::GetSolarMutex() );
|
||||
|
||||
awt::Rectangle aRect = getBounds();
|
||||
|
||||
return awt::Size( aRect.Width, aRect.Height );
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL AccessibleImageBullet::isShowing( ) throw (uno::RuntimeException)
|
||||
{
|
||||
return IsVisible();
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL AccessibleImageBullet::isVisible( ) throw (uno::RuntimeException)
|
||||
{
|
||||
return IsVisible();
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL AccessibleImageBullet::isFocusTraversable( ) throw (uno::RuntimeException)
|
||||
{
|
||||
return sal_False;
|
||||
}
|
||||
|
||||
void SAL_CALL AccessibleImageBullet::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) throw (uno::RuntimeException)
|
||||
{
|
||||
// TODO: remove
|
||||
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Not focusable")),
|
||||
uno::Reference< uno::XInterface >
|
||||
( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy
|
||||
}
|
||||
|
||||
void SAL_CALL AccessibleImageBullet::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) throw (uno::RuntimeException)
|
||||
{
|
||||
// TODO: remove
|
||||
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Not focusable")),
|
||||
uno::Reference< uno::XInterface >
|
||||
( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy
|
||||
}
|
||||
|
||||
void SAL_CALL AccessibleImageBullet::grabFocus( ) throw (uno::RuntimeException)
|
||||
{
|
||||
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Not focusable")),
|
||||
uno::Reference< uno::XInterface >
|
||||
( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy
|
||||
}
|
||||
|
||||
uno::Any SAL_CALL AccessibleImageBullet::getAccessibleKeyBinding( ) throw (uno::RuntimeException)
|
||||
{
|
||||
// AFAIK, none.
|
||||
return uno::Any();
|
||||
}
|
||||
|
||||
::rtl::OUString SAL_CALL AccessibleImageBullet::getImplementationName (void) throw (uno::RuntimeException)
|
||||
{
|
||||
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("AccessibleImageBullet"));
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL AccessibleImageBullet::supportsService (const ::rtl::OUString& sServiceName) throw (uno::RuntimeException)
|
||||
{
|
||||
// Iterate over all supported service names and return true if on of them
|
||||
// matches the given name.
|
||||
uno::Sequence< ::rtl::OUString> aSupportedServices (
|
||||
getSupportedServiceNames ());
|
||||
for (int i=0; i<aSupportedServices.getLength(); i++)
|
||||
if (sServiceName == aSupportedServices[i])
|
||||
return sal_True;
|
||||
return sal_False;
|
||||
}
|
||||
|
||||
uno::Sequence< ::rtl::OUString> SAL_CALL AccessibleImageBullet::getSupportedServiceNames (void) throw (uno::RuntimeException)
|
||||
{
|
||||
const ::rtl::OUString sServiceName (RTL_CONSTASCII_USTRINGPARAM ("drafts.com.sun.star.accessibility.AccessibleContext"));
|
||||
return uno::Sequence< ::rtl::OUString > (&sServiceName, 1);
|
||||
}
|
||||
|
||||
::rtl::OUString SAL_CALL AccessibleImageBullet::getServiceName (void) throw (uno::RuntimeException)
|
||||
{
|
||||
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("drafts.com.sun.star.accessibility.AccessibleContext"));
|
||||
}
|
||||
|
||||
void AccessibleImageBullet::SetIndexInParent( sal_Int32 nIndex )
|
||||
{
|
||||
mnIndexInParent = nIndex;
|
||||
}
|
||||
|
||||
sal_Int32 AccessibleImageBullet::GetIndexInParent() const
|
||||
{
|
||||
return mnIndexInParent;
|
||||
}
|
||||
|
||||
void AccessibleImageBullet::SetEEOffset( const Point& rOffset )
|
||||
{
|
||||
maEEOffset = rOffset;
|
||||
}
|
||||
|
||||
void AccessibleImageBullet::SetEditSource( SvxEditSource* pEditSource )
|
||||
{
|
||||
mpEditSource = pEditSource;
|
||||
|
||||
if( !mpEditSource )
|
||||
{
|
||||
// going defunc
|
||||
FireEvent( AccessibleEventId::ACCESSIBLE_STATE_EVENT );
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference < XAccessibleContext > xThis = getAccessibleContext();
|
||||
|
||||
lang::EventObject aEvent (xThis);
|
||||
maStateListeners.disposeAndClear( aEvent );
|
||||
}
|
||||
catch( const uno::RuntimeException& ) {}
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleImageBullet::FireEvent(const sal_Int16 nEventId, const uno::Any& rNewValue, const uno::Any& rOldValue ) const
|
||||
{
|
||||
uno::Reference < XAccessibleContext > xThis( const_cast< AccessibleImageBullet* > (this)->getAccessibleContext() );
|
||||
|
||||
AccessibleEventObject aEvent(xThis, nEventId, rNewValue, rOldValue);
|
||||
|
||||
// no locking necessary, OInterfaceIteratorHelper copies listeners if someone removes/adds in between
|
||||
::cppu::OInterfaceIteratorHelper aIter( const_cast< AccessibleImageBullet* >(this)->maStateListeners );
|
||||
while( aIter.hasMoreElements() )
|
||||
{
|
||||
uno::Reference < XAccessibleEventListener > xListener( aIter.next(), uno::UNO_QUERY );
|
||||
|
||||
if( xListener.is() )
|
||||
{
|
||||
try
|
||||
{
|
||||
xListener->notifyEvent( aEvent );
|
||||
}
|
||||
catch( const uno::RuntimeException& )
|
||||
{
|
||||
#ifdef DBG_UTIL
|
||||
DBG_ERROR("AccessibleImageBullet::FireEvent: Caught runtime exception from listener, removing object (bridge/listener dead?)");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibleImageBullet::GotPropertyEvent( const uno::Any& rNewValue, const sal_Int16 nEventId ) const
|
||||
{
|
||||
FireEvent( nEventId, rNewValue );
|
||||
}
|
||||
|
||||
void AccessibleImageBullet::LostPropertyEvent( const uno::Any& rOldValue, const sal_Int16 nEventId ) const
|
||||
{
|
||||
FireEvent( nEventId, uno::Any(), rOldValue );
|
||||
}
|
||||
|
||||
sal_Bool AccessibleImageBullet::IsVisible() const
|
||||
{
|
||||
return mpEditSource ? sal_True : sal_False ;
|
||||
}
|
||||
|
||||
void AccessibleImageBullet::SetParagraphIndex( sal_Int32 nIndex )
|
||||
{
|
||||
sal_Int32 nOldIndex = mnParagraphIndex;
|
||||
|
||||
if( nOldIndex != nIndex )
|
||||
{
|
||||
// index and therefore description changed
|
||||
LostPropertyEvent( uno::makeAny( getAccessibleDescription() ), AccessibleEventId::ACCESSIBLE_DESCRIPTION_EVENT );
|
||||
LostPropertyEvent( uno::makeAny( getAccessibleName() ), AccessibleEventId::ACCESSIBLE_NAME_EVENT );
|
||||
}
|
||||
|
||||
mnParagraphIndex = nIndex;
|
||||
|
||||
if( nOldIndex != nIndex )
|
||||
{
|
||||
// index and therefore description changed
|
||||
GotPropertyEvent( uno::makeAny( getAccessibleDescription() ), AccessibleEventId::ACCESSIBLE_DESCRIPTION_EVENT );
|
||||
GotPropertyEvent( uno::makeAny( getAccessibleName() ), AccessibleEventId::ACCESSIBLE_NAME_EVENT );
|
||||
}
|
||||
}
|
||||
|
||||
sal_Int32 AccessibleImageBullet::GetParagraphIndex() const throw (uno::RuntimeException)
|
||||
{
|
||||
return mnParagraphIndex;
|
||||
}
|
||||
|
||||
SvxEditSource& AccessibleImageBullet::GetEditSource() const throw (uno::RuntimeException)
|
||||
{
|
||||
if( mpEditSource )
|
||||
return *mpEditSource;
|
||||
else
|
||||
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No edit source, object is defunct")),
|
||||
uno::Reference< uno::XInterface >
|
||||
( static_cast< ::cppu::OWeakObject* >
|
||||
( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy
|
||||
}
|
||||
|
||||
SvxTextForwarder& AccessibleImageBullet::GetTextForwarder() const throw (uno::RuntimeException)
|
||||
{
|
||||
SvxEditSource& rEditSource = GetEditSource();
|
||||
SvxTextForwarder* pTextForwarder = rEditSource.GetTextForwarder();
|
||||
|
||||
if( !pTextForwarder )
|
||||
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch text forwarder, object is defunct")),
|
||||
uno::Reference< uno::XInterface >
|
||||
( static_cast< ::cppu::OWeakObject* >
|
||||
( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy
|
||||
|
||||
if( pTextForwarder->IsValid() )
|
||||
return *pTextForwarder;
|
||||
else
|
||||
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text forwarder is invalid, object is defunct")),
|
||||
uno::Reference< uno::XInterface >
|
||||
( static_cast< ::cppu::OWeakObject* >
|
||||
( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy
|
||||
}
|
||||
|
||||
SvxViewForwarder& AccessibleImageBullet::GetViewForwarder() const throw (uno::RuntimeException)
|
||||
{
|
||||
SvxEditSource& rEditSource = GetEditSource();
|
||||
SvxViewForwarder* pViewForwarder = rEditSource.GetViewForwarder();
|
||||
|
||||
if( !pViewForwarder )
|
||||
{
|
||||
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch view forwarder, object is defunct")),
|
||||
uno::Reference< uno::XInterface >
|
||||
( static_cast< ::cppu::OWeakObject* >
|
||||
( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy
|
||||
}
|
||||
|
||||
if( pViewForwarder->IsValid() )
|
||||
return *pViewForwarder;
|
||||
else
|
||||
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, object is defunct")),
|
||||
uno::Reference< uno::XInterface >
|
||||
( static_cast< ::cppu::OWeakObject* >
|
||||
( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy
|
||||
}
|
||||
|
||||
const Point& AccessibleImageBullet::GetEEOffset() const
|
||||
{
|
||||
return maEEOffset;
|
||||
}
|
||||
|
||||
} // end of namespace accessibility
|
||||
|
304
svx/source/accessibility/AccessibleImageBullet.hxx
Normal file
304
svx/source/accessibility/AccessibleImageBullet.hxx
Normal file
@@ -0,0 +1,304 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: AccessibleImageBullet.hxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2002-05-16 16:10:25 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
|
||||
#define _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
|
||||
|
||||
#ifndef _SV_GEN_HXX
|
||||
#include <tools/gen.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPUHELPER_WEAKREF_HXX_
|
||||
#include <cppuhelper/weakref.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPUHELPER_IMPLBASE5_HXX_
|
||||
#include <cppuhelper/implbase5.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
|
||||
#include <cppuhelper/interfacecontainer.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/XAccessible.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECONTEXT_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/XAccessibleContext.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECOMPONENT_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/XAccessibleComponent.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEEVENTBROADCASTER_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _SVX_ACCESSIBLE_PARA_MANAGER_HXX
|
||||
#include "AccessibleParaManager.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _SVX_UNOEDSRC_HXX
|
||||
#include "unoedsrc.hxx"
|
||||
#endif
|
||||
|
||||
namespace accessibility
|
||||
{
|
||||
|
||||
typedef ::cppu::WeakImplHelper5< ::drafts::com::sun::star::accessibility::XAccessible,
|
||||
::drafts::com::sun::star::accessibility::XAccessibleContext,
|
||||
::drafts::com::sun::star::accessibility::XAccessibleComponent,
|
||||
::drafts::com::sun::star::accessibility::XAccessibleEventBroadcaster,
|
||||
::com::sun::star::lang::XServiceInfo > AccessibleImageBulletInterfaceBase;
|
||||
|
||||
/** This class implements the image bullets for the EditEngine/Outliner UAA
|
||||
*/
|
||||
class AccessibleImageBullet : public AccessibleImageBulletInterfaceBase
|
||||
{
|
||||
|
||||
public:
|
||||
/// Create accessible object for given parent
|
||||
AccessibleImageBullet ( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible >& rParent );
|
||||
|
||||
virtual ~AccessibleImageBullet ();
|
||||
|
||||
// XInterface
|
||||
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XAccessible
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XAccessibleContext
|
||||
virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException);
|
||||
/// Maximal length of text returned by getAccessibleDescription()
|
||||
enum { MaxDescriptionLen = 40 };
|
||||
virtual ::rtl::OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::rtl::OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::drafts::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XAccessibleEventBroadcaster
|
||||
virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XAccessibleComponent
|
||||
virtual sal_Bool SAL_CALL contains( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAt( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL isShowing( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL isVisible( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL isFocusTraversable( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XServiceInfo
|
||||
virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XServiceName
|
||||
virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/** Set the current index in the accessibility parent
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
void SetIndexInParent( sal_Int32 nIndex );
|
||||
|
||||
/** Get the current index in the accessibility parent
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
sal_Int32 GetIndexInParent() const;
|
||||
|
||||
/** Set the edit engine offset
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
void SetEEOffset( const Point& rOffset );
|
||||
|
||||
/** Set the EditEngine offset
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
void SetEditSource( SvxEditSource* pEditSource );
|
||||
|
||||
/** Set the current paragraph number
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
void SetParagraphIndex( sal_Int32 nIndex );
|
||||
|
||||
/** Query the current paragraph number (0 - nParas-1)
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
sal_Int32 GetParagraphIndex() const throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
|
||||
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;
|
||||
|
||||
private:
|
||||
|
||||
// declared, but not defined
|
||||
AccessibleImageBullet( const AccessibleImageBullet& );
|
||||
AccessibleImageBullet& operator= ( const AccessibleImageBullet& );
|
||||
|
||||
// syntactic sugar for FireEvent
|
||||
void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
|
||||
void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
|
||||
|
||||
/** Query the visibility state
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
|
||||
@return the visibility state. Per definition, a defunc object is no longer visible
|
||||
*/
|
||||
sal_Bool IsVisible() const;
|
||||
|
||||
SvxEditSource& GetEditSource() const throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/** Query the SvxTextForwarder for EditEngine access.
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
SvxTextForwarder& GetTextForwarder() const throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
/** Query the SvxViewForwarder for EditEngine access.
|
||||
|
||||
@attention This method does not lock the SolarMutex,
|
||||
leaving that to the calling code. This is because only
|
||||
there potential deadlock situations can be resolved. Thus,
|
||||
make sure SolarMutex is locked when calling this.
|
||||
*/
|
||||
SvxViewForwarder& GetViewForwarder() const throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
const Point& GetEEOffset() const;
|
||||
|
||||
// the paragraph index in the edit engine (guarded by solar mutex)
|
||||
sal_Int32 mnParagraphIndex;
|
||||
|
||||
// our current index in the parent (guarded by solar mutex)
|
||||
sal_Int32 mnIndexInParent;
|
||||
|
||||
// the current edit source (guarded by solar mutex)
|
||||
SvxEditSource* mpEditSource;
|
||||
|
||||
// the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
|
||||
Point maEEOffset;
|
||||
|
||||
mutable osl::Mutex maMutex;
|
||||
|
||||
/// The shape we're the accessible for (unguarded)
|
||||
::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > mxParent;
|
||||
|
||||
/// Our listeners (guarded by maMutex)
|
||||
::cppu::OInterfaceContainerHelper maStateListeners;
|
||||
};
|
||||
|
||||
} // end of namespace accessibility
|
||||
|
||||
#endif
|
||||
|
306
svx/source/accessibility/AccessibleParaManager.cxx
Normal file
306
svx/source/accessibility/AccessibleParaManager.cxx
Normal file
@@ -0,0 +1,306 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: AccessibleParaManager.cxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2002-05-16 16:10:49 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
// Global header
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
|
||||
#include <com/sun/star/uno/Any.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPUHELPER_WEAKREF_HXX_
|
||||
#include <cppuhelper/weakref.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/XAccessible.hpp>
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
// Project-local header
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#include "unoedhlp.hxx"
|
||||
#include "unopracc.hxx"
|
||||
#include "unoedsrc.hxx"
|
||||
#include "AccessibleParaManager.hxx"
|
||||
#include "AccessibleEditableTextPara.hxx"
|
||||
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::drafts::com::sun::star::accessibility;
|
||||
|
||||
|
||||
|
||||
namespace accessibility
|
||||
{
|
||||
AccessibleParaManager::AccessibleParaManager()
|
||||
{
|
||||
}
|
||||
|
||||
AccessibleParaManager::~AccessibleParaManager()
|
||||
{
|
||||
// owner is responsible for possible child defuncs
|
||||
}
|
||||
|
||||
void AccessibleParaManager::SetNum( sal_Int32 nNumParas )
|
||||
{
|
||||
maChildren.resize( nNumParas );
|
||||
}
|
||||
|
||||
AccessibleParaManager::VectorOfChildren::iterator AccessibleParaManager::begin()
|
||||
{
|
||||
return maChildren.begin();
|
||||
}
|
||||
|
||||
AccessibleParaManager::VectorOfChildren::iterator AccessibleParaManager::end()
|
||||
{
|
||||
return maChildren.end();
|
||||
}
|
||||
|
||||
AccessibleParaManager::VectorOfChildren::const_iterator AccessibleParaManager::begin() const
|
||||
{
|
||||
return maChildren.begin();
|
||||
}
|
||||
|
||||
AccessibleParaManager::VectorOfChildren::const_iterator AccessibleParaManager::end() const
|
||||
{
|
||||
return maChildren.end();
|
||||
}
|
||||
|
||||
void AccessibleParaManager::Release( sal_Int32 nPara )
|
||||
{
|
||||
ShutdownPara( maChildren[ nPara ] );
|
||||
|
||||
// clear reference and rect
|
||||
maChildren[ nPara ] = WeakChild();
|
||||
}
|
||||
|
||||
void AccessibleParaManager::FireEvent( sal_Int32 nPara,
|
||||
const sal_Int16 nEventId,
|
||||
const uno::Any& rNewValue,
|
||||
const uno::Any& rOldValue ) const
|
||||
{
|
||||
WeakPara::HardRefType maChild( maChildren[ nPara ].first.get() );
|
||||
if( maChild.is() )
|
||||
maChild->FireEvent( nEventId, rNewValue, rOldValue );
|
||||
}
|
||||
|
||||
sal_Bool AccessibleParaManager::IsReferencable( WeakPara::HardRefType aChild )
|
||||
{
|
||||
return aChild.is();
|
||||
}
|
||||
|
||||
sal_Bool AccessibleParaManager::IsReferencable( sal_Int32 nChild ) const
|
||||
{
|
||||
// retrieve hard reference from weak one
|
||||
return IsReferencable( maChildren[ nChild ].first.get() );
|
||||
}
|
||||
|
||||
AccessibleParaManager::Child AccessibleParaManager::GetChild( sal_Int32 nChild,
|
||||
const uno::Reference< XAccessible >& xFrontEnd,
|
||||
SvxEditSourceAdapter& rEditSource,
|
||||
sal_Int32 nParagraphIndex )
|
||||
{
|
||||
// retrieve hard reference from weak one
|
||||
WeakPara::HardRefType aChild( maChildren[ nChild ].first.get() );
|
||||
|
||||
if( !IsReferencable( nChild ) )
|
||||
{
|
||||
// there is no hard reference available, create object then
|
||||
AccessibleEditableTextPara* pChild = new AccessibleEditableTextPara( xFrontEnd );
|
||||
uno::Reference< XAccessible > xChild( static_cast< ::cppu::OWeakObject* > (pChild), uno::UNO_QUERY );
|
||||
|
||||
if( !xChild.is() )
|
||||
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Child creation failed")), xFrontEnd);
|
||||
|
||||
aChild = WeakPara::HardRefType( xChild, pChild );
|
||||
|
||||
aChild->SetEditSource( &rEditSource );
|
||||
aChild->SetIndexInParent( nChild );
|
||||
aChild->SetParagraphIndex( nParagraphIndex );
|
||||
|
||||
maChildren[ nChild ] = WeakChild( aChild, pChild->getBounds() );
|
||||
}
|
||||
|
||||
return Child( aChild.getRef(), maChildren[ nChild ].second );
|
||||
}
|
||||
|
||||
// TODO: refactor these functors to a single template
|
||||
class SetChildrenEEOffset : public ::std::unary_function< accessibility::AccessibleEditableTextPara&, void >
|
||||
{
|
||||
public:
|
||||
SetChildrenEEOffset( const Point& rOffset ) : mrOffset( rOffset ) {}
|
||||
void operator()( accessibility::AccessibleEditableTextPara& rPara )
|
||||
{
|
||||
rPara.SetEEOffset( mrOffset );
|
||||
}
|
||||
|
||||
private:
|
||||
const Point& mrOffset;
|
||||
};
|
||||
|
||||
void AccessibleParaManager::SetEEOffset( const Point& rOffset )
|
||||
{
|
||||
ForEach( SetChildrenEEOffset( rOffset ) );
|
||||
}
|
||||
|
||||
// TODO: refactor these functors to a single template
|
||||
class SetChildrenEditSource : public ::std::unary_function< accessibility::AccessibleEditableTextPara&, void >
|
||||
{
|
||||
public:
|
||||
SetChildrenEditSource( SvxEditSourceAdapter* pEditSource ) : mpEditSource( pEditSource ) {}
|
||||
void operator()( accessibility::AccessibleEditableTextPara& rPara )
|
||||
{
|
||||
rPara.SetEditSource( mpEditSource );
|
||||
}
|
||||
|
||||
private:
|
||||
SvxEditSourceAdapter* mpEditSource;
|
||||
};
|
||||
|
||||
void AccessibleParaManager::SetEditSource( SvxEditSourceAdapter* pEditSource )
|
||||
{
|
||||
ForEach( SetChildrenEditSource( pEditSource ) );
|
||||
}
|
||||
|
||||
// TODO: refactor these functors to a single template (EffSTL or MExC++)
|
||||
class StateChangeEvent : public ::std::unary_function< accessibility::AccessibleEditableTextPara&, void >
|
||||
{
|
||||
public:
|
||||
typedef void return_type;
|
||||
StateChangeEvent( const sal_Int16 nEventId,
|
||||
const uno::Any& rNewValue,
|
||||
const uno::Any& rOldValue ) :
|
||||
mnEventId( nEventId ),
|
||||
mrNewValue( rNewValue ),
|
||||
mrOldValue( rOldValue ) {}
|
||||
void operator()( accessibility::AccessibleEditableTextPara& rPara )
|
||||
{
|
||||
rPara.FireEvent( mnEventId, mrNewValue, mrOldValue );
|
||||
}
|
||||
|
||||
private:
|
||||
const sal_Int16 mnEventId;
|
||||
const uno::Any& mrNewValue;
|
||||
const uno::Any& mrOldValue;
|
||||
};
|
||||
|
||||
void AccessibleParaManager::FireEvent( sal_Int32 nStartPara,
|
||||
sal_Int32 nEndPara,
|
||||
const sal_Int16 nEventId,
|
||||
const uno::Any& rNewValue,
|
||||
const uno::Any& rOldValue ) const
|
||||
{
|
||||
VectorOfChildren::const_iterator begin = maChildren.begin();
|
||||
VectorOfChildren::const_iterator end = begin;
|
||||
|
||||
::std::advance< VectorOfChildren::const_iterator, sal_Int32 >( begin, nStartPara );
|
||||
::std::advance< VectorOfChildren::const_iterator, sal_Int32 >( end, nEndPara );
|
||||
|
||||
::std::for_each( begin, end, AccessibleParaManager::WeakChildAdapter< StateChangeEvent > (StateChangeEvent( nEventId, rNewValue, rOldValue )) );
|
||||
}
|
||||
|
||||
class ReleaseChild : public ::std::unary_function< const AccessibleParaManager::WeakChild&, AccessibleParaManager::WeakChild >
|
||||
{
|
||||
public:
|
||||
AccessibleParaManager::WeakChild operator()( const AccessibleParaManager::WeakChild& rPara )
|
||||
{
|
||||
AccessibleParaManager::ShutdownPara( rPara );
|
||||
|
||||
// clear reference
|
||||
return AccessibleParaManager::WeakChild();
|
||||
}
|
||||
};
|
||||
|
||||
void AccessibleParaManager::Release( sal_Int32 nStartPara, sal_Int32 nEndPara )
|
||||
{
|
||||
VectorOfChildren::iterator begin = maChildren.begin();
|
||||
VectorOfChildren::iterator end = begin;
|
||||
|
||||
::std::advance< VectorOfChildren::iterator, sal_Int32 >( begin, nStartPara );
|
||||
::std::advance< VectorOfChildren::iterator, sal_Int32 >( end, nEndPara );
|
||||
|
||||
::std::transform( begin, end, begin, ReleaseChild() );
|
||||
}
|
||||
|
||||
void AccessibleParaManager::ShutdownPara( const WeakChild& rChild )
|
||||
{
|
||||
WeakPara::HardRefType aChild( rChild.first.get() );
|
||||
|
||||
if( IsReferencable( aChild ) )
|
||||
aChild->SetEditSource( NULL );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
276
svx/source/accessibility/AccessibleParaManager.hxx
Normal file
276
svx/source/accessibility/AccessibleParaManager.hxx
Normal file
@@ -0,0 +1,276 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: AccessibleParaManager.hxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2002-05-16 16:10:41 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _SVX_ACCESSIBLE_PARA_MANAGER_HXX
|
||||
#define _SVX_ACCESSIBLE_PARA_MANAGER_HXX
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
#ifndef _SV_GEN_HXX
|
||||
#include <tools/gen.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_AWT_RECTANGLE_HPP_
|
||||
#include <com/sun/star/awt/Rectangle.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#endif
|
||||
#ifndef _CPPUHELPER_WEAKREF_HXX_
|
||||
#include <cppuhelper/weakref.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECONTEXT_HPP_
|
||||
#include <drafts/com/sun/star/accessibility/XAccessibleContext.hpp>
|
||||
#endif
|
||||
|
||||
class SvxEditSourceAdapter;
|
||||
|
||||
namespace accessibility
|
||||
{
|
||||
class AccessibleEditableTextPara;
|
||||
|
||||
/** Helper class for WeakCppRef
|
||||
|
||||
This class is returned by WeakChild::get() and contains a hard
|
||||
reference and a reference to the c++ object. This combination
|
||||
prevents the c++ object from destruction during usage. Hold
|
||||
this object only as long as absolutely necessary, prevents
|
||||
referenced object from vanishing otherwise
|
||||
*/
|
||||
template < class UnoType, class CppType > class HardCppRef
|
||||
{
|
||||
public:
|
||||
|
||||
typedef UnoType UnoInterfaceType;
|
||||
typedef CppType InterfaceType;
|
||||
|
||||
HardCppRef( const ::com::sun::star::uno::WeakReference< UnoInterfaceType >& xRef, InterfaceType* rImpl ) :
|
||||
mxRef( xRef ),
|
||||
mpImpl( rImpl )
|
||||
{
|
||||
}
|
||||
|
||||
/** Query whether the reference is still valid.
|
||||
|
||||
Hands off also from the implementation pointer if this
|
||||
returns sal_False!
|
||||
*/
|
||||
sal_Bool is() const { return mxRef.is(); }
|
||||
InterfaceType* operator->() const { return mpImpl; }
|
||||
InterfaceType& operator*() const { return *mpImpl; }
|
||||
::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() { return mxRef; }
|
||||
const ::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() const { return mxRef; }
|
||||
|
||||
// default copy constructor and assignment will do
|
||||
// HardCppRef( const HardCppRef& );
|
||||
// HardCppRef& operator= ( const HardCppRef& );
|
||||
|
||||
private:
|
||||
|
||||
// the interface, hard reference to prevent object from vanishing
|
||||
::com::sun::star::uno::Reference< UnoInterfaceType > mxRef;
|
||||
|
||||
// the c++ object, for our internal stuff
|
||||
InterfaceType* mpImpl;
|
||||
|
||||
};
|
||||
|
||||
/** Helper class for weak object references plus implementation
|
||||
|
||||
This class combines a weak reference (to facilitate automatic
|
||||
object disposal if user drops last reference) and hard
|
||||
reference to the c++ class (for fast access and bypassing of
|
||||
the UNO interface)
|
||||
*/
|
||||
template < class UnoType, class CppType > class WeakCppRef
|
||||
{
|
||||
public:
|
||||
|
||||
typedef UnoType UnoInterfaceType;
|
||||
typedef CppType InterfaceType;
|
||||
typedef HardCppRef< UnoInterfaceType, InterfaceType > HardRefType;
|
||||
|
||||
WeakCppRef() : maWeakRef(), maUnsafeRef( NULL ) {}
|
||||
WeakCppRef( InterfaceType& rImpl ) :
|
||||
maWeakRef( ::com::sun::star::uno::Reference< UnoInterfaceType >( rImpl, uno::UNO_QUERY ) ),
|
||||
maUnsafeRef( &rImpl )
|
||||
{
|
||||
}
|
||||
|
||||
WeakCppRef( HardRefType& rImpl ) :
|
||||
maWeakRef( rImpl.getRef() ),
|
||||
maUnsafeRef( rImpl.operator->() )
|
||||
{
|
||||
}
|
||||
|
||||
// get object with c++ object and hard reference (which
|
||||
// prevents the c++ object from destruction during use)
|
||||
HardRefType get() const { return HardRefType( maWeakRef, maUnsafeRef ); }
|
||||
|
||||
// default copy constructor and assignment will do
|
||||
// WeakCppRef( const WeakCppRef& );
|
||||
// WeakCppRef& operator= ( const WeakCppRef& );
|
||||
|
||||
private:
|
||||
|
||||
// the interface, hold weakly
|
||||
::com::sun::star::uno::WeakReference< UnoInterfaceType > maWeakRef;
|
||||
|
||||
// hard ref to c++ class, _only_ valid if maWeakRef.is() is true
|
||||
InterfaceType* maUnsafeRef;
|
||||
};
|
||||
|
||||
|
||||
/** This class manages the paragraphs of an AccessibleTextHelper
|
||||
|
||||
To facilitate automatic deletion of paragraphs no longer used,
|
||||
this class uses the WeakCppRef helper to hold the objects weakly.
|
||||
*/
|
||||
class AccessibleParaManager
|
||||
{
|
||||
public:
|
||||
typedef WeakCppRef < ::drafts::com::sun::star::accessibility::XAccessible, AccessibleEditableTextPara > WeakPara;
|
||||
typedef ::std::pair< WeakPara, ::com::sun::star::awt::Rectangle > WeakChild;
|
||||
typedef ::std::pair< ::com::sun::star::uno::Reference<
|
||||
::drafts::com::sun::star::accessibility::XAccessible > , ::com::sun::star::awt::Rectangle > Child;
|
||||
typedef ::std::vector< WeakChild > VectorOfChildren;
|
||||
|
||||
AccessibleParaManager();
|
||||
~AccessibleParaManager();
|
||||
|
||||
// changing the state of the AccessibleParaManager itself
|
||||
void SetNum( sal_Int32 nNumParas );
|
||||
|
||||
// iterators
|
||||
VectorOfChildren::iterator begin();
|
||||
VectorOfChildren::iterator end();
|
||||
VectorOfChildren::const_iterator begin() const;
|
||||
VectorOfChildren::const_iterator end() const;
|
||||
|
||||
// dealing with single paragraphs (release reference, return reference etc)
|
||||
void Release( sal_Int32 nPara );
|
||||
void FireEvent( sal_Int32 nPara,
|
||||
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;
|
||||
|
||||
static sal_Bool IsReferencable( WeakPara::HardRefType aChild );
|
||||
sal_Bool IsReferencable( sal_Int32 nChild ) const;
|
||||
static void ShutdownPara( const WeakChild& rChild );
|
||||
|
||||
Child GetChild( sal_Int32 nChild,
|
||||
const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible >& xFrontEnd,
|
||||
SvxEditSourceAdapter& rEditSource,
|
||||
sal_Int32 nParagraphIndex );
|
||||
|
||||
// forwarder to all paragraphs
|
||||
void SetEEOffset ( const Point& rOffset );
|
||||
void SetEditSource ( SvxEditSourceAdapter* pEditSource );
|
||||
|
||||
// forwarder to given paragraphs
|
||||
void Release( sal_Int32 nStartPara, sal_Int32 nEndPara );
|
||||
void FireEvent( sal_Int32 nStartPara,
|
||||
sal_Int32 nEndPara,
|
||||
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;
|
||||
|
||||
// functor adapter for ForEach template, accessing only the
|
||||
// paragraph object and hiding the fact that our children are
|
||||
// held weakly
|
||||
template < typename Functor > class WeakChildAdapter : public ::std::unary_function< const WeakChild&, void >
|
||||
{
|
||||
public:
|
||||
WeakChildAdapter( Functor& rFunctor ) : mrFunctor(rFunctor) {}
|
||||
void operator()( const WeakChild& rPara )
|
||||
{
|
||||
// retrieve hard reference from weak one
|
||||
WeakPara::HardRefType aHardRef( rPara.first.get() );
|
||||
|
||||
if( aHardRef.is() )
|
||||
mrFunctor( *aHardRef );
|
||||
}
|
||||
|
||||
private:
|
||||
Functor& mrFunctor;
|
||||
};
|
||||
|
||||
// generic algorithm on given paragraphs (non-mutating, i.e. the
|
||||
// original vector is unchanged). convenience.
|
||||
template < typename Functor > void ForEach( Functor& rFunctor )
|
||||
{
|
||||
::std::for_each( begin(), end(), WeakChildAdapter< Functor >(rFunctor) );
|
||||
}
|
||||
|
||||
private:
|
||||
// vector the size of the paragraph number of the underlying EditEngine
|
||||
VectorOfChildren maChildren;
|
||||
};
|
||||
|
||||
} // end of namespace accessibility
|
||||
|
||||
#endif
|
||||
|
1204
svx/source/accessibility/AccessibleTextHelper.cxx
Normal file
1204
svx/source/accessibility/AccessibleTextHelper.cxx
Normal file
File diff suppressed because it is too large
Load Diff
196
svx/source/inc/unoedprx.hxx
Normal file
196
svx/source/inc/unoedprx.hxx
Normal file
@@ -0,0 +1,196 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: unoedprx.hxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2002-05-16 16:11:24 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _SVX_UNOEDPRX_HXX
|
||||
#define _SVX_UNOEDPRX_HXX
|
||||
|
||||
#include <memory>
|
||||
|
||||
#ifndef _SFXBRDCST_HXX
|
||||
#include <svtools/brdcst.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _SVX_UNOEDSRC_HXX
|
||||
#include "unoedsrc.hxx"
|
||||
#endif
|
||||
|
||||
#include "editdata.hxx"
|
||||
|
||||
|
||||
class SvxAccessibleTextAdapter : public SvxTextForwarder
|
||||
{
|
||||
public:
|
||||
SvxAccessibleTextAdapter();
|
||||
virtual ~SvxAccessibleTextAdapter();
|
||||
|
||||
virtual USHORT GetParagraphCount() const;
|
||||
virtual USHORT GetTextLen( USHORT nParagraph ) const;
|
||||
virtual String GetText( const ESelection& rSel ) const;
|
||||
virtual SfxItemSet GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib = 0 ) const;
|
||||
virtual SfxItemSet GetParaAttribs( USHORT nPara ) const;
|
||||
virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet );
|
||||
virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const;
|
||||
|
||||
virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const;
|
||||
virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const;
|
||||
|
||||
virtual void QuickInsertText( const String& rText, const ESelection& rSel );
|
||||
virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
|
||||
virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
|
||||
virtual void QuickInsertLineBreak( const ESelection& rSel );
|
||||
|
||||
virtual SfxItemPool* GetPool() const;
|
||||
|
||||
virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor );
|
||||
virtual BOOL IsValid() const;
|
||||
|
||||
virtual LanguageType GetLanguage( USHORT, USHORT ) const;
|
||||
virtual USHORT GetFieldCount( USHORT nPara ) const;
|
||||
virtual EFieldInfo GetFieldInfo( USHORT nPara, USHORT nField ) const;
|
||||
virtual EBulletInfo GetBulletInfo( USHORT nPara ) const;
|
||||
virtual Rectangle GetCharBounds( USHORT nPara, USHORT nIndex ) const;
|
||||
virtual Rectangle GetParaBounds( USHORT nPara ) const;
|
||||
virtual MapMode GetMapMode() const;
|
||||
virtual OutputDevice* GetRefDevice() const;
|
||||
virtual sal_Bool GetIndexAtPoint( const Point&, USHORT& nPara, USHORT& nIndex ) const;
|
||||
virtual sal_Bool GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const;
|
||||
virtual USHORT GetLineCount( USHORT nPara ) const;
|
||||
virtual USHORT GetLineLen( USHORT nPara, USHORT nLine ) const;
|
||||
virtual sal_Bool Delete( const ESelection& );
|
||||
virtual sal_Bool InsertText( const String&, const ESelection& );
|
||||
virtual sal_Bool QuickFormatDoc( BOOL bFull=FALSE );
|
||||
|
||||
void SetForwarder( SvxTextForwarder& );
|
||||
sal_Bool HaveImageBullet( USHORT nPara ) const;
|
||||
sal_Bool HaveTextBullet( USHORT nPara ) const;
|
||||
|
||||
/** Query whether all text in given selection is editable
|
||||
|
||||
@return sal_True if every character in the given selection can
|
||||
be changed, and sal_False if e.g. a field or a bullet is
|
||||
contained therein.
|
||||
*/
|
||||
sal_Bool IsEditable( const ESelection& rSelection );
|
||||
|
||||
private:
|
||||
SvxTextForwarder* mrTextForwarder;
|
||||
};
|
||||
|
||||
class SvxAccessibleTextEditViewAdapter : public SvxEditViewForwarder
|
||||
{
|
||||
public:
|
||||
|
||||
SvxAccessibleTextEditViewAdapter();
|
||||
virtual ~SvxAccessibleTextEditViewAdapter();
|
||||
|
||||
virtual BOOL IsValid() const;
|
||||
|
||||
virtual Rectangle GetVisArea() const;
|
||||
virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
|
||||
virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
|
||||
|
||||
virtual sal_Bool GetSelection( ESelection& rSelection ) const;
|
||||
virtual sal_Bool SetSelection( const ESelection& rSelection );
|
||||
virtual sal_Bool Copy();
|
||||
virtual sal_Bool Cut();
|
||||
virtual sal_Bool Paste();
|
||||
|
||||
void SetForwarder( SvxEditViewForwarder&, SvxAccessibleTextAdapter& );
|
||||
|
||||
private:
|
||||
SvxEditViewForwarder* mrViewForwarder;
|
||||
SvxAccessibleTextAdapter* mrTextForwarder;
|
||||
};
|
||||
|
||||
class SvxEditSourceAdapter : public SvxEditSource
|
||||
{
|
||||
public:
|
||||
SvxEditSourceAdapter();
|
||||
~SvxEditSourceAdapter();
|
||||
|
||||
virtual SvxEditSource* Clone() const;
|
||||
virtual SvxTextForwarder* GetTextForwarder();
|
||||
SvxAccessibleTextAdapter* GetTextForwarderAdapter(); // covariant return types don't work on MSVC
|
||||
virtual SvxViewForwarder* GetViewForwarder();
|
||||
virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
|
||||
SvxAccessibleTextEditViewAdapter* GetEditViewForwarderAdapter( sal_Bool bCreate = sal_False ); // covariant return types don't work on MSVC
|
||||
virtual void UpdateData();
|
||||
virtual SfxBroadcaster& GetBroadcaster() const;
|
||||
|
||||
void SetEditSource( ::std::auto_ptr< SvxEditSource > pAdaptee );
|
||||
sal_Bool IsValid() const;
|
||||
|
||||
private:
|
||||
// declared, but not defined
|
||||
SvxEditSourceAdapter( const SvxEditSourceAdapter& );
|
||||
SvxEditSourceAdapter& operator= ( const SvxEditSourceAdapter& );
|
||||
|
||||
::std::auto_ptr< SvxEditSource > mpAdaptee;
|
||||
|
||||
SvxAccessibleTextAdapter maTextAdapter;
|
||||
SvxAccessibleTextEditViewAdapter maEditViewAdapter;
|
||||
|
||||
mutable SfxBroadcaster maDummyBroadcaster;
|
||||
|
||||
sal_Bool mbEditSourceValid;
|
||||
};
|
||||
|
||||
#endif
|
113
svx/source/inc/unopracc.hxx
Normal file
113
svx/source/inc/unopracc.hxx
Normal file
@@ -0,0 +1,113 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: unopracc.hxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2002-05-16 16:11:41 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _SVX_UNOPRACC_HXX
|
||||
#define _SVX_UNOPRACC_HXX
|
||||
|
||||
#ifndef _SVX_UNOSHAPE_HXX
|
||||
#include "unoshape.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _SVX_UNOTEXT_HXX
|
||||
#include "unotext.hxx"
|
||||
#endif
|
||||
|
||||
|
||||
class SvxEditSource;
|
||||
|
||||
/** Wraps SvxUnoTextRangeBase and provides us with the text properties
|
||||
|
||||
Inherits from SvxUnoTextRangeBase and provides XPropertySet and
|
||||
XMultiPropertySet interfaces. Just set the selection to the
|
||||
required text range and return a reference to a XPropertySet.
|
||||
*/
|
||||
class SvxAccessibleTextPropertySet : public SvxUnoTextRangeBase,
|
||||
public ::com::sun::star::lang::XTypeProvider,
|
||||
public ::cppu::OWeakObject
|
||||
{
|
||||
public:
|
||||
SvxAccessibleTextPropertySet( const SvxEditSource*, const SfxItemPropertyMap* );
|
||||
virtual ~SvxAccessibleTextPropertySet() throw();
|
||||
|
||||
// XTextRange
|
||||
virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// uno::XInterface
|
||||
virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL acquire() throw();
|
||||
virtual void SAL_CALL release() throw();
|
||||
|
||||
// lang::XServiceInfo
|
||||
virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// lang::XTypeProvider
|
||||
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XServiceName
|
||||
::rtl::OUString SAL_CALL SvxAccessibleTextPropertySet::getServiceName() throw (::com::sun::star::uno::RuntimeException);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
1175
svx/source/unoedit/unoedprx.cxx
Normal file
1175
svx/source/unoedit/unoedprx.cxx
Normal file
File diff suppressed because it is too large
Load Diff
227
svx/source/unoedit/unopracc.cxx
Normal file
227
svx/source/unoedit/unopracc.cxx
Normal file
@@ -0,0 +1,227 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: unopracc.cxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: thb $ $Date: 2002-05-16 16:12:04 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
// Global header
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#ifndef _VOS_MUTEX_HXX_
|
||||
#include <vos/mutex.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
|
||||
#include <com/sun/star/uno/Any.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPUHELPER_WEAKREF_HXX_
|
||||
#include <cppuhelper/weakref.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
|
||||
#include <com/sun/star/lang/XComponent.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
|
||||
#include <cppuhelper/typeprovider.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
// Project-local header
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#ifndef _SVX_UNOPRACC_HXX_
|
||||
#include "unopracc.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _SVX_UNOEDSRC_HXX
|
||||
#include "unoedsrc.hxx"
|
||||
#endif
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
// SvxAccessibleTextPropertySet implementation
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
SvxAccessibleTextPropertySet::SvxAccessibleTextPropertySet( const SvxEditSource* pEditSrc, const SfxItemPropertyMap* pPropMap )
|
||||
: SvxUnoTextRangeBase( pEditSrc, pPropMap )
|
||||
{
|
||||
}
|
||||
|
||||
SvxAccessibleTextPropertySet::~SvxAccessibleTextPropertySet() throw()
|
||||
{
|
||||
}
|
||||
|
||||
uno::Reference< text::XText > SAL_CALL SvxAccessibleTextPropertySet::getText() throw (uno::RuntimeException)
|
||||
{
|
||||
// TODO (empty?)
|
||||
return uno::Reference< text::XText > ();
|
||||
}
|
||||
|
||||
uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
|
||||
{
|
||||
// TODO (empty?)
|
||||
return uno::Any();
|
||||
}
|
||||
|
||||
uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryInterface( const uno::Type & rType )
|
||||
throw(uno::RuntimeException)
|
||||
{
|
||||
return OWeakObject::queryInterface(rType);
|
||||
}
|
||||
|
||||
void SAL_CALL SvxAccessibleTextPropertySet::acquire()
|
||||
throw()
|
||||
{
|
||||
OWeakObject::acquire();
|
||||
}
|
||||
|
||||
void SAL_CALL SvxAccessibleTextPropertySet::release()
|
||||
throw()
|
||||
{
|
||||
OWeakObject::release();
|
||||
}
|
||||
|
||||
// XTypeProvider
|
||||
uno::Sequence< uno::Type > SAL_CALL SvxAccessibleTextPropertySet::getTypes() throw ( uno::RuntimeException )
|
||||
{
|
||||
static ::cppu::OTypeCollection* pTypeCollection = NULL ;
|
||||
|
||||
// double-checked locking pattern.
|
||||
if ( pTypeCollection == NULL )
|
||||
{
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
|
||||
|
||||
// Control these pointer again ... it can be, that another instance will be faster then these!
|
||||
if ( pTypeCollection == NULL )
|
||||
{
|
||||
// Create a static typecollection ...
|
||||
static ::cppu::OTypeCollection aTypeCollection(
|
||||
::getCppuType( static_cast< const uno::Reference< beans::XPropertySet >* > (0) ),
|
||||
::getCppuType( static_cast< const uno::Reference< beans::XMultiPropertySet >* > (0) ),
|
||||
::getCppuType( static_cast< const uno::Reference< beans::XPropertyState >* > (0) ),
|
||||
::getCppuType( static_cast< const uno::Reference< lang::XServiceInfo >* > (0) ),
|
||||
::getCppuType( static_cast< const uno::Reference< lang::XTypeProvider >* > (0) ) );
|
||||
|
||||
// ... and set his address to static pointer!
|
||||
pTypeCollection = &aTypeCollection ;
|
||||
}
|
||||
}
|
||||
|
||||
return pTypeCollection->getTypes() ;
|
||||
}
|
||||
|
||||
uno::Sequence< sal_Int8 > SAL_CALL SvxAccessibleTextPropertySet::getImplementationId()
|
||||
throw (uno::RuntimeException)
|
||||
{
|
||||
static uno::Sequence< sal_Int8 > aId;
|
||||
if( aId.getLength() == 0 )
|
||||
{
|
||||
aId.realloc( 16 );
|
||||
rtl_createUuid( reinterpret_cast< sal_uInt8* > (aId.getArray()), 0, sal_True );
|
||||
}
|
||||
return aId;
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
::rtl::OUString SAL_CALL SAL_CALL SvxAccessibleTextPropertySet::getImplementationName (void) throw (uno::RuntimeException)
|
||||
{
|
||||
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("SvxAccessibleTextPropertySet"));
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL SvxAccessibleTextPropertySet::supportsService (const ::rtl::OUString& sServiceName) throw (uno::RuntimeException)
|
||||
{
|
||||
// Iterate over all supported service names and return true if on of them
|
||||
// matches the given name.
|
||||
uno::Sequence< ::rtl::OUString> aSupportedServices (
|
||||
getSupportedServiceNames ());
|
||||
for (int i=0; i<aSupportedServices.getLength(); i++)
|
||||
if (sServiceName == aSupportedServices[i])
|
||||
return sal_True;
|
||||
return sal_False;
|
||||
}
|
||||
|
||||
uno::Sequence< ::rtl::OUString> SAL_CALL SvxAccessibleTextPropertySet::getSupportedServiceNames (void) throw (uno::RuntimeException)
|
||||
{
|
||||
// TODO
|
||||
return SvxUnoTextRangeBase::getSupportedServiceNames();
|
||||
}
|
||||
|
||||
// XServiceName
|
||||
::rtl::OUString SAL_CALL SvxAccessibleTextPropertySet::getServiceName() throw (uno::RuntimeException)
|
||||
{
|
||||
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.PropertyValue"));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user