Integrate branch of IAccessible2

Change-Id: I8327fb4ba2a86d4caa52b875221175b80464842a
diff --git a/include/svx/AccessibleControlShape.hxx b/include/svx/AccessibleControlShape.hxx
index c84391b..3f901e1 100644
--- a/include/svx/AccessibleControlShape.hxx
+++ b/include/svx/AccessibleControlShape.hxx
@@ -59,6 +59,8 @@ public:
        const AccessibleShapeTreeInfo& rShapeTreeInfo);
    virtual ~AccessibleControlShape( );

    ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL  GetControlModel( ) { return m_xControlModel;} ;
    AccessibleControlShape* SAL_CALL GetLabeledByControlShape();
protected:
    //---  XAccessible  ----------------------------------------
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext( ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/include/svx/AccessibleGraphicShape.hxx b/include/svx/AccessibleGraphicShape.hxx
index b558baa..6347c75 100644
--- a/include/svx/AccessibleGraphicShape.hxx
+++ b/include/svx/AccessibleGraphicShape.hxx
@@ -85,7 +85,8 @@ public:
    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
        getTypes (void)
        throw (::com::sun::star::uno::RuntimeException);

/// Return this object's role.
    virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
protected:
    /// Create a name string that contains the accessible name.
    virtual OUString
diff --git a/include/svx/AccessibleOLEShape.hxx b/include/svx/AccessibleOLEShape.hxx
index 18b6ed2..ce213bb 100644
--- a/include/svx/AccessibleOLEShape.hxx
+++ b/include/svx/AccessibleOLEShape.hxx
@@ -91,7 +91,8 @@ public:
    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
        getTypes (void)
        throw (::com::sun::star::uno::RuntimeException);

// ====== XAccessibleExtendedAttributes =====================================
    virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
protected:
    /// Create a name string that contains the accessible name.
    virtual OUString
diff --git a/include/svx/AccessibleShape.hxx b/include/svx/AccessibleShape.hxx
index 56a36d5..a684887 100644
--- a/include/svx/AccessibleShape.hxx
+++ b/include/svx/AccessibleShape.hxx
@@ -28,6 +28,12 @@
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <com/sun/star/accessibility/XAccessibleText.hpp>
#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
#include <com/sun/star/accessibility/XAccessibleGroupPosition.hpp>
#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -70,6 +76,10 @@ class IAccessibleParent;
class SVX_DLLPUBLIC AccessibleShape
    :   public AccessibleContextBase,
        public AccessibleComponentBase,
        public ::com::sun::star::accessibility::XAccessibleSelection,
        public ::com::sun::star::accessibility::XAccessibleExtendedAttributes,
        public ::com::sun::star::accessibility::XAccessibleGroupPosition,
        public com::sun::star::accessibility::XAccessibleHypertext,
        public IAccessibleViewForwarderListener,
        public ::com::sun::star::document::XEventListener,
        public ::com::sun::star::lang::XUnoTunnel
@@ -95,7 +105,54 @@ public:
    AccessibleShape (
        const AccessibleShapeInfo& rShapeInfo,
        const AccessibleShapeTreeInfo& rShapeTreeInfo);
    AccessibleShape (
        const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& rxShape, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, const AccessibleShapeTreeInfo& rShapeTreeInfo, sal_Int32 nIndex = -1);
     //Solution: Overwrite the object's current name.
    virtual OUString SAL_CALL    getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
    virtual OUString SAL_CALL    getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet (void) throw (::com::sun::star::uno::RuntimeException);
//=====  XAccessibleSelection  ============================================

    virtual void SAL_CALL selectAccessibleChild(
        sal_Int32 nChildIndex )
        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
        ::com::sun::star::uno::RuntimeException );

    virtual sal_Bool SAL_CALL isAccessibleChildSelected(
        sal_Int32 nChildIndex )
        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
        ::com::sun::star::uno::RuntimeException );

    virtual void SAL_CALL clearAccessibleSelection(  )
        throw ( ::com::sun::star::uno::RuntimeException );

    virtual void SAL_CALL selectAllAccessibleChildren(  )
        throw ( ::com::sun::star::uno::RuntimeException );

    virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  )
        throw ( ::com::sun::star::uno::RuntimeException );

    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
        sal_Int32 nSelectedChildIndex )
        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
        ::com::sun::star::uno::RuntimeException);

    virtual void SAL_CALL deselectAccessibleChild(
        sal_Int32 nSelectedChildIndex )
        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
        ::com::sun::star::uno::RuntimeException );

    // ====== XAccessibleExtendedAttributes =====================================
    virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
    throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
    /// Return this object's role.
    virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
    //=====  XAccessibleGroupPosition  =========================================
    virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
        getGroupPosition( const ::com::sun::star::uno::Any& rAny )
        throw (::com::sun::star::uno::RuntimeException);
    virtual OUString SAL_CALL getObjectLink( const ::com::sun::star::uno::Any& accoject )
        throw (::com::sun::star::uno::RuntimeException);
    /** The destructor releases its children manager and text engine if
        still existent.  These are responsible to send appropriate events.
    */
@@ -301,6 +358,32 @@ public:
    static AccessibleShape*                                     getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace ) throw();
    sal_Int64                                                   SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rIdentifier ) throw(::com::sun::star::uno::RuntimeException);

    //===== XAccessibleHypertext ========================================================
    virtual sal_Int32 SAL_CALL getHyperLinkCount()  throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink >
        SAL_CALL getHyperLink( sal_Int32 nLinkIndex )
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual sal_Int32 SAL_CALL getHyperLinkIndex( sal_Int32 nCharIndex )
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    //=====  XAccesibleText  ==================================================
        virtual sal_Int32 SAL_CALL getCaretPosition(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::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);//Shen Zhen Jie changed sal_Unicode to sal_uInt32; change back to sal_Unicode
        virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes ) 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 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 OUString SAL_CALL getText(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
        virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);

    //===== Misc ========================================================

    ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
@@ -367,7 +450,12 @@ protected:
    virtual OUString
        CreateAccessibleDescription (void)
        throw (::com::sun::star::uno::RuntimeException);

    virtual OUString
       GetFullAccessibleName(AccessibleShape *shape)
       throw (::com::sun::star::uno::RuntimeException);
    virtual OUString GetStyle();
    void UpdateDocumentAllSelState(::com::sun::star::uno::Reference<
        ::com::sun::star::accessibility::XAccessibleStateSet > &xStateSet);
    /** Update the <const>OPAQUE</const> and <const>SELECTED</const> state.
    */
    virtual void UpdateStates (void);
@@ -381,6 +469,8 @@ private:
    SVX_DLLPRIVATE explicit AccessibleShape (const AccessibleShape&);
    /// Don't use the assignment operator.  Do we need this?
    SVX_DLLPRIVATE AccessibleShape& operator= (const AccessibleShape&);
    //Old accessible name
    OUString aAccName;

    /** Call this method when the title, name, or description of the mxShape
        member (may) have been changed.
diff --git a/include/svx/AccessibleSvxFindReplaceDialog.hxx b/include/svx/AccessibleSvxFindReplaceDialog.hxx
new file mode 100644
index 0000000..5c82f57
--- /dev/null
+++ b/include/svx/AccessibleSvxFindReplaceDialog.hxx
@@ -0,0 +1,55 @@
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
 */
#ifndef _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_
#define _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_

#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
#include <toolkit/awt/vclxwindows.hxx>


class VCLXAccessibleSvxFindReplaceDialog : public VCLXAccessibleComponent
{
public:
    VCLXAccessibleSvxFindReplaceDialog(VCLXWindow* pVCLXindow);
    virtual ~VCLXAccessibleSvxFindReplaceDialog();
    virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
    // XServiceInfo
    virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);

};


class VCLXSvxFindReplaceDialog : public VCLXDialog
{
public:
    VCLXSvxFindReplaceDialog(Window* pSplDlg)
    {
        SetWindow(pSplDlg);
    }
    virtual ~VCLXSvxFindReplaceDialog()
    {};
private:
    virtual ::com::sun::star::uno::Reference<
        ::com::sun::star::accessibility::XAccessibleContext >  CreateAccessibleContext()
    {
        return new VCLXAccessibleSvxFindReplaceDialog(this);
    }
};
#endif // _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_
diff --git a/include/svx/AccessibleTableShape.hxx b/include/svx/AccessibleTableShape.hxx
index e3d3484..a9309efc 100644
--- a/include/svx/AccessibleTableShape.hxx
+++ b/include/svx/AccessibleTableShape.hxx
@@ -30,6 +30,9 @@
#include <cppuhelper/implbase2.hxx>

#include <svx/AccessibleShape.hxx>
#include <com/sun/star/view/XSelectionChangeListener.hpp>
#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
#include <cppuhelper/compbase5.hxx>

#include <boost/noncopyable.hpp>

@@ -40,14 +43,15 @@ namespace sdr { namespace table {
namespace accessibility
{
    class AccessibleTableShapeImpl;
    class AccessibleCell;

    typedef ::cppu::ImplInheritanceHelper2< AccessibleShape,
                                            ::com::sun::star::accessibility::XAccessibleSelection,
                                            ::com::sun::star::accessibility::XAccessibleTable
                                            ::com::sun::star::accessibility::XAccessibleTable,
                                            ::com::sun::star::view::XSelectionChangeListener
                                          > AccessibleTableShape_Base;
/** @descr
*/
class AccessibleTableShape : boost::noncopyable, public AccessibleTableShape_Base
class AccessibleTableShape : boost::noncopyable, public AccessibleTableShape_Base, public ::com::sun::star::accessibility::XAccessibleTableSelection
{
public:
    AccessibleTableShape( const AccessibleShapeInfo& rShapeInfo, const AccessibleShapeTreeInfo& rShapeTreeInfo );
@@ -98,6 +102,15 @@ public:
    virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw ( ::com::sun::star::uno::RuntimeException );
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex )  throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
    //=====  XAccessibleTableSelection ============================================
    virtual sal_Bool SAL_CALL selectRow( sal_Int32 row )
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
    virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column )
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
    virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row )
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
    virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column )
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;

    // XServiceInfo
    virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
@@ -105,7 +118,26 @@ public:
    // XComponent
    virtual void SAL_CALL disposing( );

    // XSelectionChangeListener
    virtual void SAL_CALL
        disposing (const ::com::sun::star::lang::EventObject& Source)
        throw (::com::sun::star::uno::RuntimeException);
    virtual void  SAL_CALL
        selectionChanged (const ::com::sun::star::lang::EventObject& rEvent)
        throw (::com::sun::star::uno::RuntimeException);
    sal_Int32 mnPreviousSelectionCount;
    using AccessibleShape::disposing;
    friend class AccessibleTableHeaderShape;

    void getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException );
    // overwrite the SetState & ResetState to do special operation for table cell's internal text
    virtual sal_Bool SetState (sal_Int16 aState);
    virtual sal_Bool ResetState (sal_Int16 aState);
    // The following two methods are used to set state directly on table object, instread of the internal cell or paragraph.
    sal_Bool SetStateDirectly (sal_Int16 aState);
    sal_Bool ResetStateDirectly (sal_Int16 aState);
    // Get the currently active cell which is text editing
    AccessibleCell* GetActiveAccessibleCell();

protected:
    virtual OUString CreateAccessibleBaseName(void) throw (::com::sun::star::uno::RuntimeException);
@@ -113,10 +145,90 @@ protected:
    sdr::table::SvxTableController* getTableController();

    void checkCellPosition( sal_Int32 nCol, sal_Int32 nRow ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
    void getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException );

private:
    rtl::Reference< AccessibleTableShapeImpl > mxImpl;
    sal_Int32 GetIndexOfSelectedChild( sal_Int32 nSelectedChildIndex ) const;
};

typedef ::cppu::WeakImplHelper5<
            ::com::sun::star::accessibility::XAccessible,
            ::com::sun::star::accessibility::XAccessibleComponent,
            ::com::sun::star::accessibility::XAccessibleContext,
            ::com::sun::star::accessibility::XAccessibleTable,
            ::com::sun::star::accessibility::XAccessibleTableSelection >
            AccessibleTableHeaderShape_BASE;

class AccessibleTableHeaderShape : boost::noncopyable,
    public MutexOwner,
    public AccessibleTableHeaderShape_BASE
{
public:
    // bRow, sal_True means rowheader, sal_False means columnheader
    AccessibleTableHeaderShape( AccessibleTableShape* pTable, sal_Bool bRow );
    virtual ~AccessibleTableHeaderShape();

    // XAccessible
    virtual ::com::sun::star::uno::Reference< ::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< ::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< ::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);
    virtual OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);

    //XAccessibleComponent
    virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
    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_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);

    // XAccessibleTable
    virtual sal_Int32 SAL_CALL getAccessibleRowCount() throw (::com::sun::star::uno::RuntimeException);
    virtual sal_Int32 SAL_CALL getAccessibleColumnCount(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCaption(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleSummary(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);

    //=====  XAccessibleTableSelection  ============================================
    virtual sal_Bool SAL_CALL selectRow( sal_Int32 row )
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
    virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column )
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
    virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row )
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
    virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column )
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
private:
    SVX_DLLPRIVATE explicit AccessibleTableHeaderShape( const ::com::sun::star::uno::Reference<
            ::com::sun::star::accessibility::XAccessible>& rxParent );
    sal_Bool mbRow;
    rtl::Reference< AccessibleTableShape > mpTable;
};

} // end of namespace accessibility
diff --git a/include/svx/ChildrenManager.hxx b/include/svx/ChildrenManager.hxx
index 8de19aa..c2e6df8 100644
--- a/include/svx/ChildrenManager.hxx
+++ b/include/svx/ChildrenManager.hxx
@@ -126,6 +126,8 @@ public:
        GetChild (long nIndex)
        throw (::com::sun::star::uno::RuntimeException,
               ::com::sun::star::lang::IndexOutOfBoundsException);
        ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> GetChild (const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& xShape) throw (::com::sun::star::uno::RuntimeException);
        ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> GetChildShape (long nIndex) throw (::com::sun::star::uno::RuntimeException);

    /** Update the child manager.  Take care of a modified set of children
        and modified visible area.  This method can optimize the update
@@ -189,7 +191,6 @@ public:
    */
    void RemoveFocus (void);

    //=====  IAccessibleViewForwarderListener  ================================
    virtual void ViewForwarderChanged (ChangeType aChangeType,
        const IAccessibleViewForwarder* pViewForwarder);

diff --git a/include/svx/EnhancedCustomShapeTypeNames.hxx b/include/svx/EnhancedCustomShapeTypeNames.hxx
index 82ebe96..b91e1eb 100644
--- a/include/svx/EnhancedCustomShapeTypeNames.hxx
+++ b/include/svx/EnhancedCustomShapeTypeNames.hxx
@@ -26,6 +26,7 @@ namespace EnhancedCustomShapeTypeNames
{
    SVX_DLLPUBLIC MSO_SPT Get( const OUString& );
    SVX_DLLPUBLIC OUString Get( const MSO_SPT );
    SVX_DLLPUBLIC OUString GetAccName( const OUString& );
}

#endif
diff --git a/include/svx/IAccessibleParent.hxx b/include/svx/IAccessibleParent.hxx
index f50d024..23e2aa5 100644
--- a/include/svx/IAccessibleParent.hxx
+++ b/include/svx/IAccessibleParent.hxx
@@ -23,7 +23,7 @@
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <sal/types.h>

#include "AccessibleControlShape.hxx"
namespace accessibility {

class AccessibleShape;
@@ -80,6 +80,16 @@ public:
        const long _nIndex,
        const AccessibleShapeTreeInfo& _rShapeTreeInfo
    )   throw (::com::sun::star::uno::RuntimeException) = 0;
    //Add this method to support Form Controls
    virtual AccessibleControlShape* GetAccControlShapeFromModel
        (::com::sun::star::beans::XPropertySet*)
        throw (::com::sun::star::uno::RuntimeException){return NULL;};
    virtual  ::com::sun::star::uno::Reference<
            ::com::sun::star::accessibility::XAccessible>
        GetAccessibleCaption (const ::com::sun::star::uno::Reference<
            ::com::sun::star::drawing::XShape>&)
            throw (::com::sun::star::uno::RuntimeException){return NULL;};
    virtual sal_Bool IsDocumentSelAll(){ return sal_False; }
};

} // end of namespace accessibility
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index 829400f..882da38 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -63,6 +63,7 @@ typedef sal_uInt16 CTL_STATE;
#define CS_NOVERT   2       // no vertikal input information is used

class SvxRectCtlAccessibleContext;
class SvxPixelCtlAccessible;

class SVX_DLLPUBLIC SvxRectCtl : public Control
{
@@ -175,7 +176,9 @@ protected:
    Size        aRectSize;
    sal_uInt16*     pPixel;
    sal_Bool        bPaintable;

    //Add member identifying position
    Point       aFocusPosition;
    Rectangle   implCalFocusRect( const Point& aPosition );
    void    ChangePixel( sal_uInt16 nPixel );

public:
@@ -203,6 +206,23 @@ public:

    void    SetPaintable( sal_Bool bTmp ) { bPaintable = bTmp; }
    void    Reset();
    SvxPixelCtlAccessible*  m_pAccess;
    ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >        m_xAccess;
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
    long GetSquares() const { return nSquares ; }
    long GetWidth() const { return aRectSize.getWidth() ; }
    long GetHeight() const { return aRectSize.getHeight() ; }

    //Device Pixel .
    long ShowPosition( const Point &pt);

    long PointToIndex(const Point &pt) const;
    Point IndexToPoint(long nIndex) const ;
    long GetFoucsPosIndex() const ;
    //Keyboard function for key input and focus handling function
    virtual void        KeyInput( const KeyEvent& rKEvt );
    virtual void        GetFocus();
    virtual void        LoseFocus();
};

/************************************************************************/
diff --git a/include/svx/nbdtmg.hxx b/include/svx/nbdtmg.hxx
index b780495..bad5c14 100644
--- a/include/svx/nbdtmg.hxx
+++ b/include/svx/nbdtmg.hxx
@@ -185,7 +185,7 @@ class SVX_DLLPUBLIC NBOTypeMgrBase
    private:
        const SfxItemSet*   pSet;
        SfxMapUnit      eCoreUnit;
        //Sym3_2508    store the attributes passed from pSet
        // store the attributes passed from pSet
        OUString        aNumCharFmtName;
        void            StoreBulCharFmtName_impl();
        void            StoreMapUnit_impl();
@@ -222,7 +222,7 @@ class SVX_DLLPUBLIC NBOTypeMgrBase
        virtual sal_Bool IsCustomized(sal_uInt16 nIndex)=0;
        sal_uInt16 IsSingleLevel(sal_uInt16 nCurLevel);
        const SfxItemSet* GetItems() { return pSet;}
        //Sym3_2508    store the attributes passed from pSet
        // store the attributes passed from pSet
        void SetItems(const SfxItemSet* pArg) { pSet = pArg;StoreBulCharFmtName_impl();StoreMapUnit_impl();}
    protected:
        OUString GetBulCharFmtName();
diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx
index af613d88..908c531 100644
--- a/include/svx/sdr/table/tablecontroller.hxx
+++ b/include/svx/sdr/table/tablecontroller.hxx
@@ -28,7 +28,6 @@
#include <svx/selectioncontroller.hxx>
#include <svx/svdotable.hxx>
#include <svx/svdview.hxx>
//#include <tablemodel.hxx>

class SdrObjEditView;
class SdrObject;
@@ -102,6 +101,17 @@ public:

    SVX_DLLPRIVATE void onTableModified();

    sal_Bool selectRow( sal_Int32 row );
    sal_Bool selectColumn( sal_Int32 column );
    sal_Bool deselectRow( sal_Int32 row );
    sal_Bool deselectColumn( sal_Int32 column );
    sal_Bool isRowSelected( sal_Int32 nRow );
    sal_Bool isColumnSelected( sal_Int32 nColumn );
    sal_Bool isRowHeader();
    sal_Bool isColumnHeader();
    ::sdr::table::SdrTableObj* GetTableObj() { return dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() ); }
    //declare event notification method
    void NotifySelection( const CellPos& firstPos, const CellPos& lastPos, const CellPos& newPos );
private:
    SvxTableController(SvxTableController &); // not defined
    void operator =(SvxTableController &); // not defined
diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index 8797115..316a977 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -130,9 +130,19 @@ public:

    sal_Int32       GetTransliterationFlags() const;

    void SetDocWin( Window* pDocWin ) { mpDocWin = pDocWin; }
    Window* GetDocWin() { return mpDocWin; }
    void SetSrchFlag( sal_Bool bSuccess = sal_False ) { mbSuccess = bSuccess; }
    sal_Bool GetSrchFlag() { return mbSuccess; }
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
        GetComponentInterface( sal_Bool bCreate );

    void            SetSaveToModule(bool b);

private:
    Window*         mpDocWin;
    sal_Bool        mbSuccess;

    VclFrame*       m_pSearchFrame;
    ComboBox*       m_pSearchLB;
    ListBox*        m_pSearchTmplLB;
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index c2fbacf..81df0c4 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -75,6 +75,7 @@ class SotStorage;
class SdrOutlinerCache;
class SotStorageRef;
class SdrUndoFactory;
class ImageMap;
namespace comphelper
{
    class IEmbeddedHelper;
@@ -665,6 +666,9 @@ public:

    static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelImplementationId();

    virtual ImageMap* GetImageMapForObject(SdrObject*){return NULL;};
    virtual sal_Int32 GetHyperlinkCount(SdrObject*){return 0;}

    /** enables (true) or disables (false) recording of undo actions
        If undo actions are added while undo is disabled, they are deleted.
        Disabling undo does not clear the current undo buffer! */
diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx
index 55eb579..d3efe66 100644
--- a/include/svx/svdmrkv.hxx
+++ b/include/svx/svdmrkv.hxx
@@ -456,6 +456,7 @@ public:
    // End point of the axis of reflextion
    const Point& GetRef2() const { return aRef1; }
    void SetRef2(const Point& rPt);
    void UnmarkObj(SdrObject* pObj);
};

////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx
index 414ce15..ac78bc5 100644
--- a/include/svx/svdoashp.hxx
+++ b/include/svx/svdoashp.hxx
@@ -256,6 +256,8 @@ public:
    static bool doConstructOrthogonal(const OUString& rName);

    using SdrTextObj::NbcSetOutlinerParaObject;

    OUString GetCustomShapeName();
};

#endif // INCLUDED_SVX_SVDOASHP_HXX
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index f1b3dbba..ee08d6b 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -357,6 +357,7 @@ protected:
    SdrObjUserCall*             pUserCall;
    SdrObjPlusData*             pPlusData;    // Broadcaster, UserData, Konnektoren, ... (Das ist der Bitsack)

    SdrObject*  pCaptionObj;
    sal_uInt32                  nOrdNum;      // Rangnummer des Obj in der Liste

    SfxGrabBagItem*             pGrabBagItem; // Holds the GrabBagItem property
@@ -1035,6 +1036,7 @@ public:
    // #i121917#
    virtual bool HasText() const;

    const SdrObject* GetCaptionObj() const;
protected:
    /** Sets a new UNO shape
      *
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
index 7a93f4b..e909990 100644
--- a/include/svx/svdoole2.hxx
+++ b/include/svx/svdoole2.hxx
@@ -80,6 +80,7 @@ protected:
    void Init();

public:
    OUString GetStyleString();
    TYPEINFO();

    SdrOle2Obj(bool bFrame_ = false);
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index e1e7f45..df2aab64 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -82,6 +82,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
    svx/source/accessibility/AccessibleShape \
    svx/source/accessibility/AccessibleShapeInfo \
    svx/source/accessibility/AccessibleShapeTreeInfo \
    svx/source/accessibility/AccessibleSvxFindReplaceDialog \
    svx/source/accessibility/AccessibleTextEventQueue \
    svx/source/accessibility/AccessibleTextHelper \
    svx/source/accessibility/ChildrenManager \
@@ -92,6 +93,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
    svx/source/accessibility/SvxShapeTypes \
    svx/source/accessibility/charmapacc \
    svx/source/accessibility/lookupcolorname \
	svx/source/accessibility/svxpixelctlaccessiblecontext \
    svx/source/accessibility/svxrectctaccessiblecontext \
    svx/source/customshapes/EnhancedCustomShape3d \
    svx/source/customshapes/EnhancedCustomShapeEngine \
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx
index ebbd599..0c958e4 100644
--- a/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -21,13 +21,18 @@
#include <svx/AccessibleShapeInfo.hxx>
#include "svx/DescriptionGenerator.hxx"
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/reflection/ProxyFactory.hpp>
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/property.hxx>
#include <comphelper/types.hxx>
#include <unotools/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <svx/svdouno.hxx>
#include "svx/unoapi.hxx"
#include <svx/ShapeTypeHandler.hxx>
@@ -67,6 +72,11 @@ namespace
        static OUString s_sLabelPropertyLabel( "Label" );
        return s_sLabelPropertyLabel;
    }
    const OUString& lcl_getLabelControlPropertyName( )
    {
        static OUString s_sLabelControlPropertyLabel("LabelControl");
        return s_sLabelControlPropertyLabel;
    }
    // return the property which should be used as AccessibleName
    const OUString& lcl_getPreferredAccNameProperty( const Reference< XPropertySetInfo >& _rxPSI )
    {
@@ -581,21 +591,52 @@ Reference< XAccessible > SAL_CALL AccessibleControlShape::getAccessibleChild( sa

Reference< XAccessibleRelationSet > SAL_CALL AccessibleControlShape::getAccessibleRelationSet(  ) throw (RuntimeException)
{
    // TODO
    return AccessibleShape::getAccessibleRelationSet( );
    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
    ensureControlModelAccess();
    AccessibleControlShape* pCtlAccShape = GetLabeledByControlShape();
    if(pCtlAccShape)
    {
        Reference < XAccessible > xAcc (pCtlAccShape->getAccessibleContext(), UNO_QUERY);

        ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > aSequence(1);
        aSequence[0] = xAcc;
        if( getAccessibleRole() == AccessibleRole::RADIO_BUTTON )
        {
            pRelationSetHelper->AddRelation( AccessibleRelation( AccessibleRelationType::MEMBER_OF, aSequence ) );
        }
        else
        {
            pRelationSetHelper->AddRelation( AccessibleRelation( AccessibleRelationType::LABELED_BY, aSequence ) );
        }
    }
    Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
    return xSet;
}

OUString AccessibleControlShape::CreateAccessibleName (void) throw (RuntimeException)
{
    ensureControlModelAccess();

    // check if we can obtain the "Name" resp. "Label" property from the model
    const OUString& rAccNameProperty = lcl_getPreferredAccNameProperty( m_xModelPropsMeta );
    OUString sName;
    if ( getAccessibleRole() != AccessibleRole::SHAPE
        && getAccessibleRole() != AccessibleRole::RADIO_BUTTON  )
    {
        AccessibleControlShape* pCtlAccShape = GetLabeledByControlShape();
        if(pCtlAccShape)
        {
            sName = pCtlAccShape->CreateAccessibleName();
        }
    }

    OUString sName( getControlModelStringProperty( rAccNameProperty ) );
    if ( sName.isEmpty() )
    {   // no -> use the default
        sName = AccessibleShape::CreateAccessibleName();
    if (sName.isEmpty())
    {
        // check if we can obtain the "Name" resp. "Label" property from the model
        const OUString& rAccNameProperty = lcl_getPreferredAccNameProperty( m_xModelPropsMeta );
        sName = getControlModelStringProperty( rAccNameProperty );
        if ( !sName.getLength() )
        {   // no -> use the default
            sName = AccessibleShape::CreateAccessibleName();
        }
    }

    // now that somebody first asked us for our name, ensure that we are listening to name changes on the model
@@ -853,4 +894,25 @@ void SAL_CALL AccessibleControlShape::elementReplaced( const ::com::sun::star::c
    // not interested in
}

AccessibleControlShape* SAL_CALL AccessibleControlShape::GetLabeledByControlShape( )
{
    if(m_xControlModel.is())
    {
        const OUString& rAccLabelControlProperty = lcl_getLabelControlPropertyName();
        Any sCtlLabelBy;
        // get the "label by" property value of the control
        if (::comphelper::hasProperty(rAccLabelControlProperty, m_xControlModel))
        {
            m_xControlModel->getPropertyValue( rAccLabelControlProperty ) >>= sCtlLabelBy;
            if( sCtlLabelBy.hasValue() )
            {
                Reference< XPropertySet >  xAsSet (sCtlLabelBy, UNO_QUERY);
                AccessibleControlShape* pCtlAccShape = mpParent->GetAccControlShapeFromModel(xAsSet.get());
                return pCtlAccShape;
            }
        }
    }
    return NULL;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx
index c6e4794..9dee0d5 100644
--- a/svx/source/accessibility/AccessibleFrameSelector.cxx
+++ b/svx/source/accessibility/AccessibleFrameSelector.cxx
@@ -181,7 +181,7 @@ sal_Int32 AccFrameSelector::getAccessibleIndexInParent(  )

sal_Int16 AccFrameSelector::getAccessibleRole(  ) throw (RuntimeException)
{
    return AccessibleRole::OPTION_PANE;
    return meBorder == FRAMEBORDER_NONE ? AccessibleRole::OPTION_PANE : AccessibleRole::CHECK_BOX;
}

// ----------------------------------------------------------------------------
@@ -216,15 +216,24 @@ Reference< XAccessibleRelationSet > AccFrameSelector::getAccessibleRelationSet( 
    if(meBorder == FRAMEBORDER_NONE)
    {
        //add the label relation
        Window* pPrev = mpFrameSel->GetWindow( WINDOW_PREV );
        if(pPrev && WINDOW_FIXEDTEXT == pPrev->GetType())
        Window *pLabeledBy = mpFrameSel->GetAccessibleRelationLabeledBy();
        if ( pLabeledBy && pLabeledBy != mpFrameSel )
        {
            AccessibleRelation aLabelRelation;
            aLabelRelation.RelationType = AccessibleRelationType::LABELED_BY;
            aLabelRelation.TargetSet.realloc(1);
            aLabelRelation.TargetSet.getArray()[0]  = pPrev->GetAccessible();
            aLabelRelation.TargetSet.getArray()[0]  = pLabeledBy->GetAccessible();
            pHelper->AddRelation(aLabelRelation);
        }
        Window* pMemberOf = mpFrameSel->GetAccessibleRelationMemberOf();
        if ( pMemberOf && pMemberOf != mpFrameSel )
        {
            AccessibleRelation aMemberOfRelation;
            aMemberOfRelation.RelationType = AccessibleRelationType::MEMBER_OF;
            aMemberOfRelation.TargetSet.realloc(1);
            aMemberOfRelation.TargetSet.getArray()[0]  = pMemberOf->GetAccessible();
            pHelper->AddRelation(aMemberOfRelation);
        }
    }
    return xRet;
}
diff --git a/svx/source/accessibility/AccessibleGraphicShape.cxx b/svx/source/accessibility/AccessibleGraphicShape.cxx
index eb021c3..91cded2 100644
--- a/svx/source/accessibility/AccessibleGraphicShape.cxx
+++ b/svx/source/accessibility/AccessibleGraphicShape.cxx
@@ -21,6 +21,8 @@

#include <svx/ShapeTypeHandler.hxx>
#include <svx/SvxShapeTypes.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdmodel.hxx>

using namespace ::accessibility;
using namespace ::rtl;
@@ -51,6 +53,8 @@ AccessibleGraphicShape::~AccessibleGraphicShape (void)
OUString SAL_CALL AccessibleGraphicShape::getAccessibleImageDescription (void)
    throw (::com::sun::star::uno::RuntimeException)
{
    if (m_pShape)
        return m_pShape->GetTitle();
    return AccessibleShape::getAccessibleDescription ();
}

@@ -187,13 +191,28 @@ OUString
    return sName;
}



OUString
    AccessibleGraphicShape::CreateAccessibleDescription (void)
OUString AccessibleGraphicShape::CreateAccessibleDescription (void)
    throw (::com::sun::star::uno::RuntimeException)
{
    return CreateAccessibleName ();
    //Don't use the same information for accessible name and accessible description.
    OUString sDesc;
    if (m_pShape)
        sDesc =  m_pShape->GetTitle();
    if (!sDesc.isEmpty())
        return sDesc;
    return CreateAccessibleBaseName();
}

//  Return this object's role.
sal_Int16 SAL_CALL AccessibleGraphicShape::getAccessibleRole (void)
        throw (::com::sun::star::uno::RuntimeException)
{
    sal_Int16 nAccessibleRole =  AccessibleRole::SHAPE;
    if( m_pShape->GetModel()->GetImageMapForObject(m_pShape) != NULL )
        return AccessibleRole::IMAGE_MAP;
    else
        return AccessibleShape::getAccessibleRole();
    return nAccessibleRole;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/accessibility/AccessibleOLEShape.cxx b/svx/source/accessibility/AccessibleOLEShape.cxx
index d8b742c..14ed894 100644
--- a/svx/source/accessibility/AccessibleOLEShape.cxx
+++ b/svx/source/accessibility/AccessibleOLEShape.cxx
@@ -21,6 +21,7 @@

#include <svx/ShapeTypeHandler.hxx>
#include <svx/SvxShapeTypes.hxx>
#include <svx/svdoole2.hxx>

using namespace accessibility;
using namespace ::com::sun::star;
@@ -171,8 +172,22 @@ uno::Sequence<uno::Type> SAL_CALL
    return aTypeList;
}



//=====  XAccessibleExtendedAttributes  ========================================================
uno::Any SAL_CALL AccessibleOLEShape::getExtendedAttributes()
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
{
    uno::Any strRet;
    ::rtl::OUString style;
    if( m_pShape )
    {
        //style = ::rtl::OUString::createFromAscii("style=");
        style = ::rtl::OUString::createFromAscii("style:");
        style += ((SdrOle2Obj*)m_pShape)->GetStyleString();
    }
    style += ::rtl::OUString::createFromAscii(";");
    strRet <<= style;
    return strRet;
}

/// Set this object's name if is different to the current name.
OUString
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 426ab51..fa36b9c 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -22,7 +22,9 @@
#include <svx/AccessibleShapeInfo.hxx>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleTextType.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
@@ -36,7 +38,8 @@
#include <svx/unoshtxt.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdmodel.hxx>
#include "svx/unoapi.hxx"
#include <svx/unoapi.hxx>
#include <svx/svdpage.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <svx/ShapeTypeHandler.hxx>
#include <svx/SvxShapeTypes.hxx>
@@ -46,13 +49,18 @@
#include <svx/dialmgr.hxx>
#include <vcl/svapp.hxx>
#include <unotools/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <svx/svdview.hxx>
#include <comphelper/servicehelper.hxx>
#include "AccessibleEmptyEditSource.hxx"

#include <algorithm>

using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::lang::IndexOutOfBoundsException;
using ::com::sun::star::uno::RuntimeException;

namespace accessibility {

@@ -94,7 +102,7 @@ OUString GetOptionalProperty (
AccessibleShape::AccessibleShape (
    const AccessibleShapeInfo& rShapeInfo,
    const AccessibleShapeTreeInfo& rShapeTreeInfo)
    : AccessibleContextBase (rShapeInfo.mxParent,AccessibleRole::LIST_ITEM),
    : AccessibleContextBase (rShapeInfo.mxParent,AccessibleRole::SHAPE),
      mpChildrenManager(NULL),
      mxShape (rShapeInfo.mxShape),
      maShapeTreeInfo (rShapeTreeInfo),
@@ -107,8 +115,24 @@ AccessibleShape::AccessibleShape (
    UpdateNameAndDescription();
}



AccessibleShape::AccessibleShape (
        const ::com::sun::star::uno::Reference<
            ::com::sun::star::drawing::XShape>& rxShape,
        const ::com::sun::star::uno::Reference<
            ::com::sun::star::accessibility::XAccessible>& rxParent,
        const AccessibleShapeTreeInfo& rShapeTreeInfo,
        sal_Int32 nIndex)
    : AccessibleContextBase (rxParent,AccessibleRole::SHAPE),
      mpChildrenManager(NULL),
      mxShape (rxShape),
      maShapeTreeInfo (rShapeTreeInfo),
      mnIndex (nIndex),
      m_nIndexInParent(-1),
      mpText (NULL),
      mpParent (NULL)
{
    m_pShape = GetSdrObjectFromXShape(mxShape);
}

AccessibleShape::~AccessibleShape (void)
{
@@ -121,9 +145,6 @@ AccessibleShape::~AccessibleShape (void)
    // broadcasters would still hold a strong reference to this object.
}




void AccessibleShape::Init (void)
{
    // Update the OPAQUE and SELECTED shape.
@@ -248,8 +269,10 @@ void AccessibleShape::UpdateStates (void)
        pStateSet->RemoveState (AccessibleStateType::SELECTED);
}



OUString AccessibleShape::GetStyle()
{
    return ShapeTypeHandler::CreateAccessibleBaseName( mxShape );
}

bool AccessibleShape::operator== (const AccessibleShape& rShape)
{
@@ -313,8 +336,26 @@ sal_Bool AccessibleShape::GetState (sal_Int16 aState)
        return AccessibleContextBase::GetState (aState);
}

// OverWrite the parent's getAccessibleName method
OUString SAL_CALL AccessibleShape::getAccessibleName (void)
    throw (::com::sun::star::uno::RuntimeException)
{
        ThrowIfDisposed ();
    if (m_pShape && !m_pShape->GetTitle().isEmpty())
        return CreateAccessibleName() + " " + m_pShape->GetTitle();
    else
        return CreateAccessibleName();
}


OUString SAL_CALL AccessibleShape::getAccessibleDescription (void)
    throw (::com::sun::star::uno::RuntimeException)
{
    ThrowIfDisposed ();
    if( m_pShape && !m_pShape->GetDescription().isEmpty())
        return m_pShape->GetDescription() ;
    else
        return OUString(" ");
}

//=====  XAccessibleContext  ==================================================

@@ -375,8 +416,43 @@ uno::Reference<XAccessible> SAL_CALL
    return xChild;
}



uno::Reference<XAccessibleRelationSet> SAL_CALL
    AccessibleShape::getAccessibleRelationSet (void)
        throw (::com::sun::star::uno::RuntimeException)
{
    ::osl::MutexGuard aGuard (maMutex);
    ::utl::AccessibleRelationSetHelper* pRelationSet =
        new utl::AccessibleRelationSetHelper;
    SdrObject* pCaptionSdr = const_cast < SdrObject* > ( m_pShape->GetCaptionObj() )  ;
    if(pCaptionSdr!=NULL)
    {
            uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
            uno::Reference<drawing::XShape> xCaptionShape ( pCaptionSdr->getUnoShape(),uno::UNO_QUERY);
            if(xCaptionShape.is())
            {
                aSequence[0] = mpParent->GetAccessibleCaption(xCaptionShape);
                pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::DESCRIBED_BY, aSequence ) );
        }
    }
    else
    {
        //this mxshape is the captioned shape, only for sw
        if(mpParent->GetAccessibleCaption(mxShape).get())
        {
            uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
            aSequence[0] = mpParent->GetAccessibleCaption(mxShape);
            pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::DESCRIBED_BY, aSequence ) );
        }
    }
   if (pRelationSet != NULL)
    {
        return uno::Reference<XAccessibleRelationSet> (
            new ::utl::AccessibleRelationSetHelper (*pRelationSet));
    }
    else
        return uno::Reference<XAccessibleRelationSet>(NULL);
    return uno::Reference<XAccessibleRelationSet>();
}

/** Return a copy of the state set.
    Possible states are:
@@ -393,8 +469,38 @@ uno::Reference<XAccessibleStateSet> SAL_CALL

    if (rBHelper.bDisposed || mpText == NULL)
        // Return a minimal state set that only contains the DEFUNC state.
    {
        xStateSet = AccessibleContextBase::getAccessibleStateSet ();
    else
        ::utl::AccessibleStateSetHelper* pStateSet =
              static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
            ::com::sun::star::uno::Reference<XAccessible> xTempAcc = getAccessibleParent();
            if( xTempAcc.is() )
            {
                ::com::sun::star::uno::Reference<XAccessibleContext>
                                        xTempAccContext = xTempAcc->getAccessibleContext();
                if( xTempAccContext.is() )
                {
                    ::com::sun::star::uno::Reference<XAccessibleStateSet> rState =
                        xTempAccContext->getAccessibleStateSet();
                    if( rState.is() )           {
                        com::sun::star::uno::Sequence<short> pStates = rState->getStates();
                        int count = pStates.getLength();
                        for( int iIndex = 0;iIndex < count;iIndex++ )
                        {
                            if( pStates[iIndex] == AccessibleStateType::EDITABLE )
                            {
                                pStateSet->AddState (AccessibleStateType::EDITABLE);
                                pStateSet->AddState (AccessibleStateType::RESIZABLE);
                                pStateSet->AddState (AccessibleStateType::MOVEABLE);
                                break;
                            }
                        }
                    }
                }
            }
            xStateSet = Reference<XAccessibleStateSet>(
                new ::utl::AccessibleStateSetHelper (*pStateSet));
    }else
    {
        ::utl::AccessibleStateSetHelper* pStateSet =
              static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
@@ -409,14 +515,39 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
                else
                    pStateSet->RemoveState (AccessibleStateType::FOCUSED);
            }

            //Just when the document is not read-only,set states EDITABLE,RESIZABLE,MOVEABLE
            ::com::sun::star::uno::Reference<XAccessible> xTempAcc = getAccessibleParent();
            if( xTempAcc.is() )
            {
                ::com::sun::star::uno::Reference<XAccessibleContext>
                                        xTempAccContext = xTempAcc->getAccessibleContext();
                if( xTempAccContext.is() )
                {
                    ::com::sun::star::uno::Reference<XAccessibleStateSet> rState =
                        xTempAccContext->getAccessibleStateSet();
                    if( rState.is() )           {
                        com::sun::star::uno::Sequence<short> pStates = rState->getStates();
                        int count = pStates.getLength();
                        for( int iIndex = 0;iIndex < count;iIndex++ )
                        {
                            if( pStates[iIndex] == AccessibleStateType::EDITABLE )
                            {
                                pStateSet->AddState (AccessibleStateType::EDITABLE);
                                pStateSet->AddState (AccessibleStateType::RESIZABLE);
                                pStateSet->AddState (AccessibleStateType::MOVEABLE);
                                break;
                            }
                        }
                    }
                }
            }
            // Create a copy of the state set that may be modified by the
            // caller without affecting the current state set.
            xStateSet = Reference<XAccessibleStateSet>(
                new ::utl::AccessibleStateSetHelper (*pStateSet));
        }
    }

    UpdateDocumentAllSelState(xStateSet);
    return xStateSet;
}

@@ -670,6 +801,20 @@ sal_Int32 SAL_CALL AccessibleShape::getBackground (void)
            uno::Any aColor;
            aColor = aSet->getPropertyValue ("FillColor");
            aColor >>= nColor;
            aColor = aSet->getPropertyValue (OUString::createFromAscii ("FillTransparence"));
            short nTrans=0;
            aColor >>= nTrans;
            Color crBk(nColor);
            if (nTrans == 0 )
            {
                crBk.SetTransparency(0xff);
            }
            else
            {
                nTrans = short(256 - nTrans / 100. * 256);
                crBk.SetTransparency(sal_uInt8(nTrans));
            }
            nColor = crBk.GetColor();
        }
    }
    catch (const ::com::sun::star::beans::UnknownPropertyException &)
@@ -728,9 +873,13 @@ com::sun::star::uno::Any SAL_CALL
        aReturn = ::cppu::queryInterface (rType,
            static_cast<XAccessibleComponent*>(this),
            static_cast<XAccessibleExtendedComponent*>(this),
            static_cast< ::com::sun::star::accessibility::XAccessibleSelection* >(this),
            static_cast< ::com::sun::star::accessibility::XAccessibleExtendedAttributes* >(this),
            static_cast<lang::XEventListener*>(this),
            static_cast<document::XEventListener*>(this),
            static_cast<lang::XUnoTunnel*>(this)
            static_cast<lang::XUnoTunnel*>(this),
            static_cast<XAccessibleGroupPosition*>(this),
            static_cast<XAccessibleHypertext*>(this)
            );
    return aReturn;
}
@@ -755,8 +904,122 @@ void SAL_CALL
    AccessibleContextBase::release ();
}

//=====  XAccessibleSelection  ============================================
//

//--------------------------------------------------------------------------------
void SAL_CALL AccessibleShape::selectAccessibleChild( sal_Int32 )
throw ( IndexOutOfBoundsException, RuntimeException )
{
}

//----------------------------------------------------------------------------------
sal_Bool SAL_CALL AccessibleShape::isAccessibleChildSelected( sal_Int32 nChildIndex )
throw ( IndexOutOfBoundsException,
       RuntimeException )
{
    uno::Reference<XAccessible> xAcc = getAccessibleChild( nChildIndex );
    uno::Reference<XAccessibleContext> xContext;
    if( xAcc.is() )
    {
        xContext = xAcc->getAccessibleContext();
    }

    if( xContext.is() )
    {
        if( xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
        {
            uno::Reference< ::com::sun::star::accessibility::XAccessibleText >
                xText(xAcc, uno::UNO_QUERY);
            if( xText.is() )
            {
                if( xText->getSelectionStart() >= 0 ) return sal_True;
            }
        }
        else if( xContext->getAccessibleRole() == AccessibleRole::SHAPE )
        {
            Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet();
            if( !pRState.is() )
                return sal_False;

            uno::Sequence<short> pStates = pRState->getStates();
            int nCount = pStates.getLength();
            for( int i = 0; i < nCount; i++ )
            {
                if(pStates[i] == AccessibleStateType::SELECTED)
                    return sal_True;
            }
            return sal_False;
        }
    }

    return sal_False;
}

//---------------------------------------------------------------------
void SAL_CALL AccessibleShape::clearAccessibleSelection(  )
throw ( RuntimeException )
{
}

//-------------------------------------------------------------------------
void SAL_CALL AccessibleShape::selectAllAccessibleChildren(  )
throw ( RuntimeException )
{
}

//----------------------------------------------------------------------------
sal_Int32 SAL_CALL AccessibleShape::getSelectedAccessibleChildCount()
throw ( RuntimeException )
{
    sal_Int32 nCount = 0;
    sal_Int32 TotalCount = getAccessibleChildCount();
    for( sal_Int32 i = 0; i < TotalCount; i++ )
        if( isAccessibleChildSelected(i) ) nCount++;

    return nCount;
}

//--------------------------------------------------------------------------------------
Reference<XAccessible> SAL_CALL AccessibleShape::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
throw ( IndexOutOfBoundsException, RuntimeException)
{
    if ( nSelectedChildIndex > getSelectedAccessibleChildCount() )
        throw IndexOutOfBoundsException();
    sal_Int32 i1, i2;
    for( i1 = 0, i2 = 0; i1 < getAccessibleChildCount(); i1++ )
        if( isAccessibleChildSelected(i1) )
        {
            if( i2 == nSelectedChildIndex )
                return getAccessibleChild( i1 );
            i2++;
        }
    return Reference<XAccessible>();
}

//----------------------------------------------------------------------------------
void SAL_CALL AccessibleShape::deselectAccessibleChild( sal_Int32 )
                                                            throw ( IndexOutOfBoundsException,
                                                            RuntimeException )
{

}

//=====  XAccessibleExtendedAttributes  ========================================================
uno::Any SAL_CALL AccessibleShape::getExtendedAttributes()
        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
{
    uno::Any strRet;
    OUString style;
    if( getAccessibleRole() != AccessibleRole::SHAPE ) return strRet;
    if( m_pShape )
    {
        style = "style:" + GetStyle();
    }
    style += ";";
    strRet <<= style;
    return strRet;
}

//=====  XServiceInfo  ========================================================

@@ -878,6 +1141,11 @@ void SAL_CALL
    {
        if (rEventObject.EventName.equals (sShapeModified))
        {
            //Need to update text children when receiving ShapeModified hint when exiting edit mode for text box
            if (mpText)
                mpText->UpdateChildren();


            // Some property of a shape has been modified.  Send an event
            // that indicates a change of the visible data to all listeners.
            CommitChange (
@@ -958,59 +1226,55 @@ void AccessibleShape::ViewForwarderChanged (ChangeType aChangeType,

//=====  protected internal  ==================================================
/// Set this object's name if is different to the current name.
OUString
    AccessibleShape::CreateAccessibleBaseName (void)
OUString AccessibleShape::CreateAccessibleBaseName (void)
    throw (::com::sun::star::uno::RuntimeException)
{
    return ShapeTypeHandler::CreateAccessibleBaseName( mxShape );
}


OUString
    AccessibleShape::CreateAccessibleName (void)
OUString AccessibleShape::CreateAccessibleName (void)
    throw (::com::sun::star::uno::RuntimeException)
{
    OUString sName (CreateAccessibleBaseName());
    return GetFullAccessibleName(this);
}

OUString AccessibleShape::GetFullAccessibleName (AccessibleShape *shape)
    throw (::com::sun::star::uno::RuntimeException)
{
    OUString sName (shape->CreateAccessibleBaseName());
    // Append the shape's index to the name to disambiguate between shapes
    // of the same type.  If such an index where not given to the
    // constructor then use the z-order instead.  If even that does not exist
    // we throw an exception.
    long nIndex = mnIndex;
    if (nIndex == -1)
    OUString nameStr;
    if (shape->m_pShape)
        nameStr = shape->m_pShape->GetName();
    if (nameStr.isEmpty())
    {
        try
        {
            uno::Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY);
            if (xSet.is())
            {
                uno::Any aZOrder (xSet->getPropertyValue ("ZOrder"));
                aZOrder >>= nIndex;

                // Add one to be not zero based.
                nIndex += 1;
            }
        }
        catch (const beans::UnknownPropertyException &)
        {
            // We throw our own exception that is a bit more informative.
            throw uno::RuntimeException (OUString (
                "AccessibleShape has invalid index and no ZOrder property"),
                static_cast<uno::XWeak*>(this));
        }

        sName += " ";
    }
    else
    {
        sName = nameStr;
    }

    // Put a space between name and index because of Gnopernicus othewise
    // spells the name.
    sName += " " + OUString::number (nIndex);

    //If the new produced name if not the same with last,notify name changed
    //Event
    if (aAccName != sName && !aAccName.isEmpty())
    {
        uno::Any aOldValue, aNewValue;
        aOldValue <<= aAccName;
        aNewValue <<= sName;
        CommitChange(
            AccessibleEventId::NAME_CHANGED,
            aNewValue,
            aOldValue);
    }
    aAccName = sName;
    return sName;
}




OUString
    AccessibleShape::CreateAccessibleDescription (void)
    throw (::com::sun::star::uno::RuntimeException)
@@ -1178,6 +1442,248 @@ void AccessibleShape::UpdateNameAndDescription (void)
    }
}

//  Return this object's role.
sal_Int16 SAL_CALL AccessibleShape::getAccessibleRole (void)
        throw (::com::sun::star::uno::RuntimeException)
{
    sal_Int16 nAccessibleRole =  AccessibleRole::SHAPE ;
    switch (ShapeTypeHandler::Instance().GetTypeId (mxShape))
    {
        case     DRAWING_GRAPHIC_OBJECT:
                 nAccessibleRole =  AccessibleRole::GRAPHIC ;               break;
        case     DRAWING_OLE:
                 nAccessibleRole =  AccessibleRole::EMBEDDED_OBJECT ;       break;

        default:
            nAccessibleRole = AccessibleContextBase::getAccessibleRole();
            break;
    }

    return nAccessibleRole;
}


void AccessibleShape::UpdateDocumentAllSelState(Reference<XAccessibleStateSet> &xStateSet)
{
    if (mpParent && mpParent->IsDocumentSelAll())
    {
        ::utl::AccessibleStateSetHelper* pStateSet =
            static_cast< ::utl::AccessibleStateSetHelper*>(xStateSet.get());
        pStateSet->AddState (AccessibleStateType::SELECTED);

        //uno::Any NewValue;
        //NewValue <<= AccessibleStateType::SELECTED;

        //CommitChange(AccessibleEventId::STATE_CHANGED,NewValue,uno::Any());
    }
}

//sort the drawing objects from up to down, from left to right
struct XShapePosCompareHelper
{
    bool operator() ( const uno::Reference<drawing::XShape>& xshape1,
        const uno::Reference<drawing::XShape>& xshape2 ) const
    {
        SdrObject* pObj1 = GetSdrObjectFromXShape(xshape1);
        SdrObject* pObj2 = GetSdrObjectFromXShape(xshape2);
        if(pObj1 && pObj2)
            return pObj1->GetOrdNum() < pObj2->GetOrdNum();
        else
            return 0;
    }
};
//end of group position

//=====  XAccessibleGroupPosition  =========================================
uno::Sequence< sal_Int32 > SAL_CALL
AccessibleShape::getGroupPosition( const uno::Any& )
throw (uno::RuntimeException)
{
    // we will return the:
    // [0] group level
    // [1] similar items counts in the group
    // [2] the position of the object in the group
    uno::Sequence< sal_Int32 > aRet( 3 );
    aRet[0] = 0;
    aRet[1] = 0;
    aRet[2] = 0;

    ::com::sun::star::uno::Reference<XAccessible> xParent = getAccessibleParent();
    if (!xParent.is())
    {
        return aRet;
    }
    SdrObject *pObj = GetSdrObjectFromXShape(mxShape);


    if(pObj == NULL )
    {
        return aRet;
    }

    // Compute object's group level.
    sal_Int32 nGroupLevel = 0;
    SdrObject * pUper = pObj->GetUpGroup();
    while( pUper )
    {
        ++nGroupLevel;
        pUper = pUper->GetUpGroup();
    }

    ::com::sun::star::uno::Reference<XAccessibleContext> xParentContext = xParent->getAccessibleContext();
    if( xParentContext->getAccessibleRole()  == AccessibleRole::DOCUMENT)//Document
    {
        Reference< XAccessibleGroupPosition > xGroupPosition( xParent,uno::UNO_QUERY );
        if ( xGroupPosition.is() )
        {
            aRet = xGroupPosition->getGroupPosition( uno::makeAny( getAccessibleContext() ) );
        }
        return aRet;
    }
    if (xParentContext->getAccessibleRole() != AccessibleRole::SHAPE)
    {
        return aRet;
    }

    SdrObjList *pGrpList = NULL;
    if( pObj->GetUpGroup() )
        pGrpList = pObj->GetUpGroup()->GetSubList();
    else
        return aRet;

    std::vector< uno::Reference<drawing::XShape> > vXShapes;
    if (pGrpList)
    {
        const sal_Int32 nObj = pGrpList->GetObjCount();
        for(sal_Int32 i = 0 ; i < nObj ; ++i)
        {
            SdrObject *pSubObj = pGrpList->GetObj(i);
            if (pSubObj &&
                xParentContext->getAccessibleChild(i)->getAccessibleContext()->getAccessibleRole() != AccessibleRole::GROUP_BOX)
            {
                vXShapes.push_back( GetXShapeForSdrObject(pSubObj) );
            }
        }
    }

    std::sort( vXShapes.begin(), vXShapes.end(), XShapePosCompareHelper() );

    //get the the index of the selected object in the group
    std::vector< uno::Reference<drawing::XShape> >::iterator aIter;
    //we start counting position from 1
    sal_Int32 nPos = 1;
    for ( aIter = vXShapes.begin(); aIter != vXShapes.end(); aIter++, nPos++ )
    {
        if ( (*aIter).get() == mxShape.get() )
        {
            sal_Int32* pArray = aRet.getArray();
            pArray[0] = nGroupLevel;
            pArray[1] = vXShapes.size();
            pArray[2] = nPos;
            break;
        }
    }

    return aRet;
}

OUString AccessibleShape::getObjectLink( const uno::Any& )
    throw (uno::RuntimeException)
{
    OUString aRet;

    SdrObject *pObj = GetSdrObjectFromXShape(mxShape);
    if(pObj == NULL )
    {
        return aRet;
    }
    if (maShapeTreeInfo.GetDocumentWindow().is())
    {
        Reference< XAccessibleGroupPosition > xGroupPosition( maShapeTreeInfo.GetDocumentWindow(), uno::UNO_QUERY );
        if (xGroupPosition.is())
        {
            aRet = xGroupPosition->getObjectLink( uno::makeAny( getAccessibleContext() ) );
        }
    }
    return aRet;
}

//=====  XAccesibleHypertext  ==================================================
sal_Int32 SAL_CALL AccessibleShape::getHyperLinkCount()
    throw (::com::sun::star::uno::RuntimeException)
{
    // MT: Introduced with IA2 CWS, but SvxAccessibleHyperlink was redundant to svx::AccessibleHyperlink which we introduced meanwhile.
    // Code need to be adapted....
    return 0;

    /*
    SvxAccessibleHyperlink* pLink = new SvxAccessibleHyperlink(m_pShape,this);
    if (pLink->IsValidHyperlink())
        return 1;
    else
        return 0;
    */
}
uno::Reference< XAccessibleHyperlink > SAL_CALL
    AccessibleShape::getHyperLink( sal_Int32 )
    throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
{
    uno::Reference< XAccessibleHyperlink > xRet;
    // MT: Introduced with IA2 CWS, but SvxAccessibleHyperlink was redundant to svx::AccessibleHyperlink which we introduced meanwhile.
    // Code need to be adapted....
    /*
    SvxAccessibleHyperlink* pLink = new SvxAccessibleHyperlink(m_pShape,this);
    if (pLink->IsValidHyperlink())
        xRet = pLink;
    if( !xRet.is() )
        throw ::com::sun::star::lang::IndexOutOfBoundsException();
    */
    return xRet;
}
sal_Int32 SAL_CALL AccessibleShape::getHyperLinkIndex( sal_Int32 )
throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
{
    sal_Int32 nRet = 0;
    return nRet;
}
//=====  XAccesibleText  ==================================================
sal_Int32 SAL_CALL AccessibleShape::getCaretPosition(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
sal_Bool SAL_CALL AccessibleShape::setCaretPosition( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
sal_Unicode SAL_CALL AccessibleShape::getCharacter( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleShape::getCharacterAttributes( sal_Int32, const ::com::sun::star::uno::Sequence< OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
{
    uno::Sequence< ::com::sun::star::beans::PropertyValue > aValues(0);
    return aValues;
}
::com::sun::star::awt::Rectangle SAL_CALL AccessibleShape::getCharacterBounds( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
{
    return com::sun::star::awt::Rectangle(0, 0, 0, 0 );
}
sal_Int32 SAL_CALL AccessibleShape::getCharacterCount(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
sal_Int32 SAL_CALL AccessibleShape::getIndexAtPoint( const ::com::sun::star::awt::Point& ) throw (::com::sun::star::uno::RuntimeException){return 0;}
OUString SAL_CALL AccessibleShape::getSelectedText(  ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
sal_Int32 SAL_CALL AccessibleShape::getSelectionStart(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
sal_Int32 SAL_CALL AccessibleShape::getSelectionEnd(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
sal_Bool SAL_CALL AccessibleShape::setSelection( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}
OUString SAL_CALL AccessibleShape::getText(  ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
OUString SAL_CALL AccessibleShape::getTextRange( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return OUString();}
::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleShape::getTextAtIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
    ::com::sun::star::accessibility::TextSegment aResult;
    return aResult;
}
::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleShape::getTextBeforeIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
    ::com::sun::star::accessibility::TextSegment aResult;
    return aResult;
}
::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleShape::getTextBehindIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
    ::com::sun::star::accessibility::TextSegment aResult;
    return aResult;
}
sal_Bool SAL_CALL AccessibleShape::copyText( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}

} // end of namespace accessibility

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx b/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
new file mode 100644
index 0000000..c710f13
--- /dev/null
+++ b/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
@@ -0,0 +1,96 @@
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
 */
#include <svx/AccessibleSvxFindReplaceDialog.hxx>
#include <svx/srchdlg.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>

using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;

VCLXAccessibleSvxFindReplaceDialog::VCLXAccessibleSvxFindReplaceDialog(VCLXWindow* pVCLXindow)
    :VCLXAccessibleComponent( pVCLXindow )
{

}

VCLXAccessibleSvxFindReplaceDialog::~VCLXAccessibleSvxFindReplaceDialog()
{
}

void VCLXAccessibleSvxFindReplaceDialog::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
{
    VCLXAccessibleComponent::FillAccessibleRelationSet( rRelationSet );
    Window* pDlg = GetWindow();
    if ( pDlg )
    {
        SvxSearchDialog* pSrchDlg = static_cast<SvxSearchDialog*>( pDlg );
        Window* pDocWin = pSrchDlg->GetDocWin();
        if ( !pDocWin )
        {
            return;
        }
        Reference < accessibility::XAccessible > xDocAcc = pDocWin->GetAccessible();
        if ( !xDocAcc.is() )
        {
            return;
        }
        Reference< accessibility::XAccessibleGetAccFlowTo > xGetAccFlowTo( xDocAcc, UNO_QUERY );
        if ( !xGetAccFlowTo.is() )
        {
            return;
        }
        Any aAny;
        aAny <<= ( pSrchDlg->GetSrchFlag() );

        const sal_Int32 FORFINDREPLACEFLOWTO = 2;
        uno::Sequence<uno::Any> aAnySeq = xGetAccFlowTo->get_AccFlowTo( aAny,  FORFINDREPLACEFLOWTO );

        sal_Int32 nLen = aAnySeq.getLength();
        if ( nLen )
        {
            uno::Sequence< uno::Reference< uno::XInterface > > aSequence( nLen );
            for ( sal_Int32 i = 0; i < nLen; i++ )
            {
                uno::Reference < accessibility::XAccessible > xAcc;
                aAnySeq[i] >>= xAcc;
                aSequence[i] = xAcc;
            }
            rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence ) );
        }
    }
}
// -----------------------------------------------------------------------------
// XServiceInfo
// -----------------------------------------------------------------------------

OUString VCLXAccessibleSvxFindReplaceDialog::getImplementationName() throw (RuntimeException)
{
    return OUString( "VCLXAccessibleSvxFindReplaceDialog" );
}

// -----------------------------------------------------------------------------

Sequence< OUString > VCLXAccessibleSvxFindReplaceDialog::getSupportedServiceNames() throw (RuntimeException)
{
    Sequence< OUString > aNames(1);
    aNames[0] = OUString( "VCLXAccessibleSvxFindReplaceDialog" );
    return aNames;
}
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx
index 89ccb3e..8bbef58 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -42,8 +42,11 @@
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <comphelper/accessibleeventnotifier.hxx>
#include <unotools/accessiblestatesethelper.hxx>
#include <vcl/unohelp.hxx>
#include <vcl/svapp.hxx>
#include <vcl/textdata.hxx>
#include <vcl/unohelp.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/viewsh.hxx>

//------------------------------------------------------------------------
//
@@ -62,6 +65,8 @@
#include "editeng/AccessibleEditableTextPara.hxx"
#include <svx/svdmodel.hxx>
#include <svx/svdpntv.hxx>
#include "../table/cell.hxx"
#include "../table/accessiblecell.hxx"
#include <editeng/editdata.hxx>
#include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
@@ -71,6 +76,20 @@ using namespace ::com::sun::star::accessibility;

namespace accessibility
{
    Window* GetCurrentEditorWnd()
    {
        Window* pWin = NULL;
        SfxViewFrame* pFrame = SfxViewFrame::Current();
        if (pFrame)
        {
            const SfxViewShell * pViewShell = pFrame->GetViewShell();
            if(pViewShell)
            {
                pWin = pViewShell->GetWindow();
            }
        }
        return pWin;
    }

//------------------------------------------------------------------------
//
@@ -474,12 +493,36 @@ namespace accessibility
        {
            if( bHaveFocus )
            {
                GotPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
                if( mxFrontEnd.is() )
                {
                    AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() );
                    if ( !pAccessibleCell )
                        GotPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
                    else    // the focus event on cell should be fired on table directly
                    {
                        AccessibleTableShape* pAccTable = pAccessibleCell->GetParentTable();
                        if (pAccTable)
                            pAccTable->SetStateDirectly(AccessibleStateType::FOCUSED);
                    }
                }
                OSL_TRACE("AccessibleTextHelper_Impl::SetShapeFocus(): Parent object received focus" );
            }
            else
            {
                LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
                // The focus state should be reset directly on table.
                //LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
                if( mxFrontEnd.is() )
                {
                    AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() );
                    if ( !pAccessibleCell )
                            LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
                    else
                    {
                        AccessibleTableShape* pAccTable = pAccessibleCell->GetParentTable();
                        if (pAccTable)
                            pAccTable->ResetStateDirectly(AccessibleStateType::FOCUSED);
                    }
                }
                OSL_TRACE("AccessibleTextHelper_Impl::SetShapeFocus(): Parent object lost focus" );
            }
        }
@@ -533,6 +576,16 @@ namespace accessibility
            if( !pViewForwarder )
                return sal_False;

            if( mxFrontEnd.is() )
            {
                AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() );
                if ( pAccessibleCell )
                {
                    sdr::table::CellRef xCell = pAccessibleCell->getCellRef();
                    if ( xCell.is() )
                        return xCell->IsTextEditActive();
                }
            }
            if( pViewForwarder->IsValid() )
                return sal_True;
            else
@@ -839,42 +892,25 @@ namespace accessibility

                // convert to screen coordinates
                aParaBB = ::accessibility::AccessibleEditableTextPara::LogicToPixel( aTmpBB, rCacheTF.GetMapMode(), rCacheVF );

                if( aParaBB.IsOver( aViewArea ) )
                // at least partially visible
                if( bFirstChild )
                {
                    // at least partially visible
                    if( bFirstChild )
                    {
                        bFirstChild = sal_False;
                        mnFirstVisibleChild = nCurrPara;
                    }

                    mnLastVisibleChild = nCurrPara;

                    // child not yet created?
                    ::accessibility::AccessibleParaManager::WeakChild aChild( maParaManager.GetChild(nCurrPara) );
                    if( aChild.second.Width == 0 &&
                        aChild.second.Height == 0 &&
                        mxFrontEnd.is() &&
                        bBroadcastEvents )
                    {
                        GotPropertyEvent( uno::makeAny( maParaManager.CreateChild( nCurrPara - mnFirstVisibleChild,
                                                                                   mxFrontEnd, GetEditSource(), nCurrPara ).first ),
                                          AccessibleEventId::CHILD );
                    }
                    bFirstChild = sal_False;
                    mnFirstVisibleChild = nCurrPara;
                }
                else
                {
                    // not or no longer visible
                    if( maParaManager.IsReferencable( nCurrPara ) )
                    {
                        if( bBroadcastEvents )
                            LostPropertyEvent( uno::makeAny( maParaManager.GetChild( nCurrPara ).first.get().getRef() ),
                                               AccessibleEventId::CHILD );

                        // clear reference
                        maParaManager.Release( nCurrPara );
                    }
                mnLastVisibleChild = nCurrPara;

                // child not yet created?
                ::accessibility::AccessibleParaManager::WeakChild aChild( maParaManager.GetChild(nCurrPara) );
                if( aChild.second.Width == 0 &&
                    aChild.second.Height == 0 &&
                    mxFrontEnd.is() &&
                    bBroadcastEvents )
                {
                    GotPropertyEvent( uno::makeAny( maParaManager.CreateChild( nCurrPara - mnFirstVisibleChild,
                                                                               mxFrontEnd, GetEditSource(), nCurrPara ).first ),
                                      AccessibleEventId::CHILD );
                }
            }
        }
@@ -1356,6 +1392,10 @@ namespace accessibility
                        {
                            case HINT_BEGEDIT:
                            {
                                if(!IsActive())
                                {
                                    break;
                                }
                                // change children state
                                maParaManager.SetActive();

diff --git a/svx/source/accessibility/ChildrenManager.cxx b/svx/source/accessibility/ChildrenManager.cxx
index c2cfdcb..658e1cb 100644
--- a/svx/source/accessibility/ChildrenManager.cxx
+++ b/svx/source/accessibility/ChildrenManager.cxx
@@ -77,8 +77,20 @@ long ChildrenManager::GetChildCount (void) const throw ()
    return mpImpl->GetChild (nIndex);
}

Reference<XAccessible> ChildrenManager::GetChild (const Reference<drawing::XShape>& xShape)
    throw (::com::sun::star::uno::RuntimeException)
{
    OSL_ASSERT (mpImpl != NULL);
    return mpImpl->GetChild (xShape);
}


::com::sun::star::uno::Reference<
        ::com::sun::star::drawing::XShape> ChildrenManager::GetChildShape(long nIndex)
    throw (::com::sun::star::uno::RuntimeException)
{
    OSL_ASSERT (mpImpl != NULL);
    return mpImpl->GetChildShape(nIndex);
}

void ChildrenManager::Update (bool bCreateNewObjectsOnDemand)
{
diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx
index 0cb097b..3abce2e 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.cxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.cxx
@@ -29,12 +29,13 @@

#include <rtl/ustring.hxx>
#include <tools/debug.hxx>
#include <svx/SvxShapeTypes.hxx>
#include <vcl/window.hxx>

using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using ::com::sun::star::uno::Reference;


namespace accessibility {

namespace
@@ -109,7 +110,19 @@ long ChildrenManagerImpl::GetChildCount (void) const throw ()
}



::com::sun::star::uno::Reference<
        ::com::sun::star::drawing::XShape> ChildrenManagerImpl::GetChildShape(long nIndex)
    throw (::com::sun::star::uno::RuntimeException)
{
    uno::Reference<XAccessible> xAcc = GetChild(nIndex);
    ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
    for (I = maVisibleChildren.begin(); I != aEnd; ++I)
    {
        if (I->mxAccessibleShape == xAcc)
            return I->mxShape;
    }
    return uno::Reference< drawing::XShape > ();
}

/** Return the requested accessible child object.  Create it if it is not
    yet in the cache.
@@ -838,8 +851,34 @@ sal_Bool ChildrenManagerImpl::ReplaceChild (
    return bResult;
}



// Add the impl method for IAccessibleParent interface
AccessibleControlShape * ChildrenManagerImpl::GetAccControlShapeFromModel(::com::sun::star::beans::XPropertySet* pSet) throw (::com::sun::star::uno::RuntimeException)
{
    sal_Int32 count = GetChildCount();
    for (sal_Int32 index=0;index<count;index++)
    {
        AccessibleShape* pAccShape = maVisibleChildren[index].GetAccessibleShape();
            if (pAccShape  && ::accessibility::ShapeTypeHandler::Instance().GetTypeId (pAccShape->GetXShape()) == DRAWING_CONTROL)
            {
            ::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape);
            if (pCtlAccShape && pCtlAccShape->GetControlModel() == pSet)
                return pCtlAccShape;
                }
    }
    return NULL;
}
uno::Reference<XAccessible>
    ChildrenManagerImpl::GetAccessibleCaption (const uno::Reference<drawing::XShape>& xShape)
    throw (uno::RuntimeException)
{
    ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
    for (I = maVisibleChildren.begin(); I != aEnd; ++I)
    {
        if ( I->mxShape.get() == xShape.get() )
            return I->mxAccessibleShape;
    }
    return uno::Reference<XAccessible> ();
}

/** Update the <const>SELECTED</const> and the <const>FOCUSED</const> state
    of all visible children.  Maybe this should be changed to all children.
@@ -872,13 +911,26 @@ void ChildrenManagerImpl::UpdateSelection (void)
    // Remember the current and new focused shape.
    AccessibleShape* pCurrentlyFocusedShape = NULL;
    AccessibleShape* pNewFocusedShape = NULL;

    typedef std::pair< AccessibleShape* , sal_Bool > PAIR_SHAPE;//sal_Bool Selected,UnSelected.
    typedef std::vector< PAIR_SHAPE > VEC_SHAPE;
    VEC_SHAPE vecSelect;
    int nAddSelect=0;
    int nRemoveSelect=0;
    sal_Bool bHasSelectedShape=sal_False;
    ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
    for (I=maVisibleChildren.begin(); I != aEnd; ++I)
    {
        AccessibleShape* pAccessibleShape = I->GetAccessibleShape();
        if (I->mxAccessibleShape.is() && I->mxShape.is() && pAccessibleShape!=NULL)
        {
            short nRole = pAccessibleShape->getAccessibleRole();
            bool bDrawShape = (
                nRole == AccessibleRole::GRAPHIC ||
                nRole == AccessibleRole::EMBEDDED_OBJECT ||
                nRole == AccessibleRole::SHAPE ||
                nRole == AccessibleRole::IMAGE_MAP ||
                nRole == AccessibleRole::TABLE_CELL ||
                nRole == AccessibleRole::TABLE );
            bool bShapeIsSelected = false;

            // Look up the shape in the (single or multi-) selection.
@@ -905,35 +957,99 @@ void ChildrenManagerImpl::UpdateSelection (void)

            // Set or reset the SELECTED state.
            if (bShapeIsSelected)
                pAccessibleShape->SetState (AccessibleStateType::SELECTED);
            {
                if (pAccessibleShape->SetState (AccessibleStateType::SELECTED))
                {
                    if (bDrawShape)
                    {
                        vecSelect.push_back(std::make_pair(pAccessibleShape,sal_True));
                        ++nAddSelect;
                    }
                }
                else
                {//Selected not change,has selected shape before
                    bHasSelectedShape=sal_True;
                }
            }
            else
                pAccessibleShape->ResetState (AccessibleStateType::SELECTED);

                //pAccessibleShape->ResetState (AccessibleStateType::SELECTED);
            {
                if(pAccessibleShape->ResetState (AccessibleStateType::SELECTED))
                {
                    if(bDrawShape)
                    {
                        vecSelect.push_back(std::make_pair(pAccessibleShape,sal_False));
                        ++nRemoveSelect;
                    }
                }
            }
            // Does the shape have the current selection?
            if (pAccessibleShape->GetState (AccessibleStateType::FOCUSED))
                pCurrentlyFocusedShape = pAccessibleShape;
        }
    }

    // Check if the frame we are in is currently active.  If not then make
    // sure to not send a FOCUSED state change.
    if (xController.is())
    Window *pParentWidow = maShapeTreeInfo.GetWindow();
    bool bShapeActive= false;
    // For table cell, the table's parent must be checked to make sure it has focus.
    Window *pPWindow = pParentWidow->GetParent();
    if (pParentWidow && ( pParentWidow->HasFocus() || (pPWindow && pPWindow->HasFocus())))
    {
        Reference<frame::XFrame> xFrame (xController->getFrame());
        if (xFrame.is())
            if ( ! xFrame->isActive())
                pNewFocusedShape = NULL;
        bShapeActive =true;
    }

    // Move focus from current to newly focused shape.
    if (pCurrentlyFocusedShape != pNewFocusedShape)
    {
        if (pCurrentlyFocusedShape != NULL)
            pCurrentlyFocusedShape->ResetState (AccessibleStateType::FOCUSED);
        if (pNewFocusedShape != NULL)
        if (pNewFocusedShape != NULL && bShapeActive)
            pNewFocusedShape->SetState (AccessibleStateType::FOCUSED);
    }

    if (nAddSelect >= 10 )//fire selection  within
    {
        mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_WITHIN,uno::Any(),uno::Any());
        nAddSelect =0 ;//not fire selection event
    }
    //VEC_SHAPE::iterator vi = vecSelect.begin();
    //for (; vi != vecSelect.end() ;++vi)
    VEC_SHAPE::reverse_iterator vi = vecSelect.rbegin();
    for (; vi != vecSelect.rend() ;++vi)

    {
        PAIR_SHAPE &pairShape= *vi;
        Reference< XAccessible > xShape(pairShape.first);
        uno::Any anyShape;
        anyShape <<= xShape;

        if (pairShape.second)//Selection add
        {
            if (bHasSelectedShape)
            {
                if (  nAddSelect > 0 )
                {
                    mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD,anyShape,uno::Any());
                }
            }
            else
            {
                //if has not selected shape ,first selected shape is fire selection event;
                if (nAddSelect > 0 )
                {
                    mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED,anyShape,uno::Any());
                }
                if (nAddSelect > 1 )//check other selected shape fire selection add event
                {
                    bHasSelectedShape=sal_True;
                }
            }
        }
        else //selection remove
        {
            mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE,anyShape,uno::Any());
        }
    }

    // Remember whether there is a shape that now has the focus.
    mpFocusedShape = pNewFocusedShape;
}
diff --git a/svx/source/accessibility/ChildrenManagerImpl.hxx b/svx/source/accessibility/ChildrenManagerImpl.hxx
index 9e9929d..fcc9d7b 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.hxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.hxx
@@ -120,6 +120,9 @@ public:
    */
    long GetChildCount (void) const throw ();

    ::com::sun::star::uno::Reference<
        ::com::sun::star::drawing::XShape> GetChildShape(long nIndex)
        throw (::com::sun::star::uno::RuntimeException);
    /** Return the requested accessible child or throw and
        IndexOutOfBoundsException if the given index is invalid.
        @param nIndex
@@ -293,7 +296,15 @@ public:
        const AccessibleShapeTreeInfo& _rShapeTreeInfo
    )   throw (::com::sun::star::uno::RuntimeException);


    // Add the impl method for IAccessibleParent interface
    virtual AccessibleControlShape* GetAccControlShapeFromModel
        (::com::sun::star::beans::XPropertySet* pSet)
        throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference<
            ::com::sun::star::accessibility::XAccessible>
        GetAccessibleCaption (const ::com::sun::star::uno::Reference<
            ::com::sun::star::drawing::XShape>& xShape)
        throw (::com::sun::star::uno::RuntimeException);
protected:
    /** This list holds the descriptors of all currently visible shapes and
        associated accessible object.
diff --git a/svx/source/accessibility/ShapeTypeHandler.cxx b/svx/source/accessibility/ShapeTypeHandler.cxx
index 8eaee7f..f23b9ab 100644
--- a/svx/source/accessibility/ShapeTypeHandler.cxx
+++ b/svx/source/accessibility/ShapeTypeHandler.cxx
@@ -25,8 +25,12 @@
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <svx/dialmgr.hxx>
#include "svx/svdstr.hrc"

#include <svx/unoshape.hxx>
#include <svx/svdoashp.hxx>
#include "svx/unoapi.hxx"

#include "svx/svdstr.hrc"

using namespace ::rtl;
using namespace ::com::sun::star;
@@ -292,6 +296,36 @@ OUString
        case DRAWING_RECTANGLE:
            nResourceId = STR_ObjNameSingulRECT;
            break;
        case DRAWING_CUSTOM:
            {
                nResourceId = STR_ObjNameSingulCUSTOMSHAPE;

                SvxShape* pShape = SvxShape::getImplementation( rxShape );
                if (pShape)
                {
                    SdrObject *pSdrObj = pShape->GetSdrObject();
                    if (pSdrObj)
                    {
                        OUString aTmp(pSdrObj->TakeObjNameSingul());

                        if(pSdrObj->ISA(SdrObjCustomShape))
                        {
                            SdrObjCustomShape* pCustomShape = (SdrObjCustomShape*)pSdrObj;
                            if(pCustomShape)
                            {
                                if (pCustomShape->IsTextPath())
                                    nResourceId = STR_ObjNameSingulFONTWORK;
                                else
                                {
                                    nResourceId = -1;
                                    sName = pCustomShape->GetCustomShapeName();
                                }
                            }
                        }
                    }
                }
                break;
            }
        case DRAWING_TEXT:
            nResourceId = STR_ObjNameSingulTEXT;
            break;
diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx
index 7b65526..06cae40 100644
--- a/svx/source/accessibility/charmapacc.cxx
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -158,23 +158,22 @@ Reference< XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleParent(
// -----------------------------------------------------------------------------
::com::sun::star::awt::Rectangle SAL_CALL SvxShowCharSetVirtualAcc::implGetBounds(  ) throw (RuntimeException)
{
    const Point   aOutPos( mpParent->GetPosPixel() );
    Size          aOutSize( mpParent->GetOutputSizePixel() );
    if ( mpParent->getScrollBar()->IsVisible() )
    ::com::sun::star::awt::Rectangle aBounds ( 0, 0, 0, 0 );
    Window* pWindow = mpParent;
    if ( pWindow )
    {
        const Size aScrollBar = mpParent->getScrollBar()->GetOutputSizePixel();
        aOutSize.Width() -= aScrollBar.Width();
        aOutSize.Height() -= aScrollBar.Height();
        Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL );
        aBounds = AWTRectangle( aRect );
        Window* pParent = pWindow->GetAccessibleParentWindow();
        if ( pParent )
        {
            Rectangle aParentRect = pParent->GetWindowExtentsRelative( NULL );
            ::com::sun::star::awt::Point aParentScreenLoc = AWTPoint( aParentRect.TopLeft() );
            aBounds.X -= aParentScreenLoc.X;
            aBounds.Y -= aParentScreenLoc.Y;
        }
    }

    awt::Rectangle aRet;

    aRet.X = aOutPos.X();
    aRet.Y = aOutPos.Y();
    aRet.Width = aOutSize.Width();
    aRet.Height = aOutSize.Height();

    return aRet;
    return aBounds;
}
// -----------------------------------------------------------------------------
sal_Int16 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleRole(  ) throw (RuntimeException)
@@ -338,13 +337,12 @@ void SvxShowCharSetAcc::implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bS
// -----------------------------------------------------------------------------
::com::sun::star::awt::Rectangle SAL_CALL SvxShowCharSetAcc::implGetBounds(  ) throw (RuntimeException)
{
    const Point   aOutPos( m_pParent->getCharSetControl()->GetPosPixel() );
    const Point   aOutPos;//( m_pParent->getCharSetControl()->GetPosPixel() );
    Size          aOutSize( m_pParent->getCharSetControl()->GetOutputSizePixel());
    if ( m_pParent->getCharSetControl()->getScrollBar()->IsVisible() )
    {
        const Size aScrollBar = m_pParent->getCharSetControl()->getScrollBar()->GetOutputSizePixel();
        aOutSize.Width() -= aScrollBar.Width();
        aOutSize.Height() -= aScrollBar.Height();
    }

    awt::Rectangle aRet;
@@ -686,7 +684,7 @@ uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc
sal_Int16 SAL_CALL SvxShowCharSetItemAcc::getAccessibleRole()
    throw (uno::RuntimeException)
{
    return css::accessibility::AccessibleRole::LABEL;
    return css::accessibility::AccessibleRole::TABLE_CELL;
}

// -----------------------------------------------------------------------------
@@ -754,9 +752,13 @@ uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL SvxShowCharSe

    if( mpParent )
    {
        // SELECTABLE
        pStateSet->AddState( css::accessibility::AccessibleStateType::SELECTABLE );
        pStateSet->AddState( css::accessibility::AccessibleStateType::FOCUSABLE );
        if (mpParent->mrParent.IsEnabled())
        {
            pStateSet->AddState( accessibility::AccessibleStateType::ENABLED );
            // SELECTABLE
            pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE );
            pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE );
        }

        // SELECTED
        if( mpParent->mrParent.GetSelectIndexId() == mpParent->mnId )
@@ -765,7 +767,10 @@ uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL SvxShowCharSe
               pStateSet->AddState( css::accessibility::AccessibleStateType::FOCUSED );
        }
        if ( mpParent->mnId >= mpParent->mrParent.FirstInView() && mpParent->mnId <= mpParent->mrParent.LastInView() )
        {
            pStateSet->AddState( AccessibleStateType::VISIBLE );
            pStateSet->AddState( AccessibleStateType::SHOWING );
        }
        pStateSet->AddState( AccessibleStateType::TRANSIENT );
    }

diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
new file mode 100644
index 0000000..e433f67
--- /dev/null
+++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
@@ -0,0 +1,1043 @@
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
 */

#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <unotools/accessiblestatesethelper.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <cppuhelper/typeprovider.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <toolkit/helper/convert.hxx>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
#include <rtl/uuid.h>
#include <tools/debug.hxx>
#include <tools/gen.hxx>

#include <svx/dialogs.hrc>
#include "accessibility.hrc"
#include <svx/dlgctrl.hxx>

#include <svx/dialmgr.hxx>
#include <comphelper/accessibleeventnotifier.hxx>

#include <unotools/accessiblerelationsethelper.hxx>

#include "svxpixelctlaccessiblecontext.hxx"
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>

using namespace ::cppu;
using namespace ::osl;
using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::accessibility;

SvxPixelCtlAccessible::SvxPixelCtlAccessible( SvxPixelCtl& rControl) :
    SvxPixelCtlAccessible_BASE(m_aMutex),
    pPixelCtl(&rControl),
    mnClientId(0)
{
}

SvxPixelCtlAccessible::~SvxPixelCtlAccessible()
{
    if( IsAlive() )
    {
        osl_incrementInterlockedCount( &m_refCount );
        dispose();      // set mpRepr = NULL & release all childs
    }
}
/*-- 04.02.2002 14:11:55---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Reference< XAccessibleContext > SvxPixelCtlAccessible::getAccessibleContext(  )
    throw (uno::RuntimeException)
{
    return this;
}

sal_Int32 SvxPixelCtlAccessible::getAccessibleChildCount(  ) throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    if(pPixelCtl)
    {
        return pPixelCtl->GetSquares();
    }
    else
        return 0;
}
/*-- 04.02.2002 14:11:56---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleChild( sal_Int32 i )
    throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    if ( i < 0 || i >= getAccessibleChildCount())
    throw lang::IndexOutOfBoundsException();
    uno::Reference <XAccessible> xAcc;
    if(pPixelCtl)
    {
        return CreateChild(i, pPixelCtl->IndexToPoint(i));
    }
    else
        return xAcc;
}



uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleParent(  )
    throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    uno::Reference< XAccessible > xRet;
    if(pPixelCtl)
        xRet = pPixelCtl->GetParent()->GetAccessible( sal_True );
    return xRet;
}

sal_Int32 SvxPixelCtlAccessible::getAccessibleIndexInParent(  )
    throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    sal_uInt16 nIdx = 0;
    if(pPixelCtl)
    {
        Window* pTabPage = pPixelCtl->GetParent();
        sal_uInt16 nChildren = pTabPage->GetChildCount();
        for(nIdx = 0; nIdx < nChildren; nIdx++)
            if(pTabPage->GetChild( nIdx ) == pPixelCtl)
                break;
    }
    return nIdx;
}
/*-- 04.02.2002 14:11:57---------------------------------------------------

  -----------------------------------------------------------------------*/
sal_Int16 SvxPixelCtlAccessible::getAccessibleRole(  ) throw (uno::RuntimeException)
{
    return AccessibleRole::LIST;
}

OUString SvxPixelCtlAccessible::getAccessibleDescription(  )
    throw (uno::RuntimeException)
{

    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    if(pPixelCtl)
        return pPixelCtl->GetAccessibleDescription();
    else
        return OUString();
}

OUString SvxPixelCtlAccessible::getAccessibleName(  )
    throw (uno::RuntimeException)
{

    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    if(pPixelCtl)
        return pPixelCtl->GetAccessibleName();
    else
        return OUString();
}

uno::Reference< XAccessibleRelationSet > SvxPixelCtlAccessible::getAccessibleRelationSet(  )
    throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    Window* pWindow = (Window*)pPixelCtl;
    utl::AccessibleRelationSetHelper* rRelationSet = new utl::AccessibleRelationSetHelper;
    uno::Reference< accessibility::XAccessibleRelationSet > rSet = rRelationSet;
    if ( pWindow )
    {
        Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
        if ( pLabeledBy && pLabeledBy != pWindow )
        {
            uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
            aSequence[0] = pLabeledBy->GetAccessible();
            rRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
        }

        Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
        if ( pMemberOf && pMemberOf != pWindow )
        {
            uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
            aSequence[0] = pMemberOf->GetAccessible();
            rRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
        }
        return rSet;
    }

    return new utl::AccessibleRelationSetHelper;
}


uno::Reference< XAccessibleStateSet > SvxPixelCtlAccessible::getAccessibleStateSet(  )
    throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
    uno::Reference< XAccessibleStateSet > xRet = pStateSetHelper;

    if(!pPixelCtl)
        pStateSetHelper->AddState(AccessibleStateType::DEFUNC);
    else
    {
        const sal_Int16 aStandardStates[] =
        {
            AccessibleStateType::FOCUSABLE,
                AccessibleStateType::SELECTABLE,
                AccessibleStateType::SHOWING,
                AccessibleStateType::VISIBLE,
                AccessibleStateType::OPAQUE,
                0};

            sal_Int16 nState = 0;
            while(aStandardStates[nState])
            {
                pStateSetHelper->AddState(aStandardStates[nState++]);
            }
            if(pPixelCtl->IsEnabled())
                pStateSetHelper->AddState(AccessibleStateType::ENABLED);
            if(pPixelCtl->HasFocus())
                pStateSetHelper->AddState(AccessibleStateType::FOCUSED);
            pStateSetHelper->AddState(AccessibleStateType::MANAGES_DESCENDANTS);
    }
    return xRet;
}


com::sun::star::lang::Locale SvxPixelCtlAccessible::getLocale(  )
    throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    if( getAccessibleParent().is() )
    {
        uno::Reference< XAccessibleContext >        xParentContext( getAccessibleParent()->getAccessibleContext() );
        if( xParentContext.is() )
            return xParentContext->getLocale();
    }

    //  No locale and no parent.  Therefore throw exception to indicate this
    //  cluelessness.
    throw IllegalAccessibleComponentStateException();
}


sal_Bool SvxPixelCtlAccessible::containsPoint( const awt::Point& aPt )
    throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    Point aPoint(aPt.X, aPt.Y);
    if(pPixelCtl)
        return (aPoint.X() >= 0)
            && (aPoint.X() < pPixelCtl->GetSizePixel().getWidth())
            && (aPoint.Y() >= 0)
            && (aPoint.Y() < pPixelCtl->GetSizePixel().getHeight());
    else
        return sal_False;
}
uno::Reference<XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleAtPoint (
        const awt::Point& aPoint)
    throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    ensureIsAlive();
    uno::Reference <XAccessible> xAcc;

    Point childPoint;
    childPoint.X() = aPoint.X;
    childPoint.Y() = aPoint.Y;

    if(pPixelCtl)
    {
        Point pt= pPixelCtl->PixelToLogic(childPoint);
        long nIndex = pPixelCtl->PointToIndex(pt);
        return CreateChild(nIndex,pPixelCtl->IndexToPoint(nIndex));
    }
    else
       return xAcc;

}

awt::Rectangle SvxPixelCtlAccessible::getBounds(  ) throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    Size aSz;
    Point aPos(0,0);
    awt::Rectangle aRet;
    if(pPixelCtl)
    {
        aSz = pPixelCtl->GetSizePixel();
        aPos = pPixelCtl->GetPosPixel();
        aRet.X = aPos.X();
        aRet.Y = aPos.Y();
        aRet.Width = aSz.Width();
        aRet.Height = aSz.Height();
    }
    return aRet;
}

awt::Point SvxPixelCtlAccessible::getLocation(  ) throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    Point aPos;
    aPos = pPixelCtl->GetPosPixel();
    awt::Point aRet(aPos.X(), aPos.Y());
    return aRet;
}

awt::Point SvxPixelCtlAccessible::getLocationOnScreen(  ) throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    Rectangle rect;
    rect = pPixelCtl->GetWindowExtentsRelative(NULL);
    awt::Point aRet(rect.Left(),rect.Top() );
    return aRet;
}

awt::Size SvxPixelCtlAccessible::getSize(  ) throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    Size aSz;
    aSz = pPixelCtl->GetSizePixel();
    awt::Size aRet(aSz.Width(),aSz.Height());
    return aRet;
}
void SvxPixelCtlAccessible::grabFocus(  ) throw (uno::RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    if(pPixelCtl)
    pPixelCtl->GrabFocus();
}

sal_Int32 SvxPixelCtlAccessible::getForeground(  )
        throw (::com::sun::star::uno::RuntimeException)
{
    uno::Any aRet;
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    return pPixelCtl->GetControlForeground().GetColor();
}

sal_Int32 SvxPixelCtlAccessible::getBackground(  )
        throw (::com::sun::star::uno::RuntimeException)
{
    uno::Any aRet;
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();
    return pPixelCtl->GetControlBackground().GetColor();
}

OUString SvxPixelCtlAccessible::getImplementationName(  ) throw (uno::RuntimeException)
{
    return OUString("SvxPixelCtlAccessible");
}
/*-- 04.02.2002 14:12:05---------------------------------------------------

  -----------------------------------------------------------------------*/
const sal_Char sAccessible[]          = "Accessible";
const sal_Char sAccessibleContext[]   = "AccessibleContext";
const sal_Char sAccessibleComponent[] = "AccessibleComponent";

sal_Bool SvxPixelCtlAccessible::supportsService( const OUString& rServiceName )
    throw (uno::RuntimeException)
{
    return  rServiceName.equalsAsciiL( sAccessible         , sizeof(sAccessible         )-1 ) ||
            rServiceName.equalsAsciiL( sAccessibleContext  , sizeof(sAccessibleContext  )-1 ) ||
            rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );// ||
//            rServiceName.equalsAsciiL( sAccessibleTable, sizeof(sAccessibleTable)-1 );
}
/*-- 04.02.2002 14:12:05---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Sequence< OUString > SvxPixelCtlAccessible::getSupportedServiceNames(  )
    throw (uno::RuntimeException)
{
    uno::Sequence< OUString > aRet(2);
    OUString* pArray = aRet.getArray();
    pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible         ) );
    pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext  ) );
    pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) );
//    pArray[3] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleTable) );
    return aRet;
}

// -----------------------------------------------------------------------------
// XAccessibleSelection
// -----------------------------------------------------------------------------
void SAL_CALL SvxPixelCtlAccessible::selectAccessibleChild( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    IsValid();

    if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount())
        throw lang::IndexOutOfBoundsException();

    long nIndex = pPixelCtl->ShowPosition(pPixelCtl->IndexToPoint(nChildIndex));
    NotifyChild(nIndex,sal_True,sal_False);
}
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );

    IsValid();

    return pPixelCtl->GetFoucsPosIndex() == nChildIndex;
}
// -----------------------------------------------------------------------------
void SAL_CALL SvxPixelCtlAccessible::clearAccessibleSelection(  ) throw (RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );

    IsValid();

}
// -----------------------------------------------------------------------------
void SAL_CALL SvxPixelCtlAccessible::selectAllAccessibleChildren(  ) throw (RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );

    IsValid();

}
// -----------------------------------------------------------------------------
sal_Int32 SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChildCount(  ) throw (RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );

    IsValid();

    return 1;
}
// -----------------------------------------------------------------------------
uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );

    IsValid();

    if ( nSelectedChildIndex >= 1)
        throw lang::IndexOutOfBoundsException();

    uno::Reference< XAccessible > xChild;
    if(pPixelCtl)
    {
        if(m_xCurChild.is())
        {
            xChild = m_xCurChild;
        }
    }
    return xChild;
}
// -----------------------------------------------------------------------------
void SAL_CALL SvxPixelCtlAccessible::deselectAccessibleChild( sal_Int32 ) throw (lang::IndexOutOfBoundsException, RuntimeException)
{
    ::osl::MutexGuard   aGuard( m_aMutex );

    IsValid();


}

// Added by lq
void SvxPixelCtlAccessible::ensureIsAlive() const
    throw ( lang::DisposedException )
{
    if( !IsAlive() )
        throw lang::DisposedException();
}

void SvxPixelCtlAccessible::ensureIsValidRow( sal_Int32 nRow )
    throw ( lang::IndexOutOfBoundsException )
{
    if( nRow >= pPixelCtl->GetHeight() || nRow <0)
        throw lang::IndexOutOfBoundsException(
            OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this );
}

void SvxPixelCtlAccessible::ensureIsValidColumn( sal_Int32 nColumn )
    throw ( lang::IndexOutOfBoundsException )
{
    if( nColumn >= pPixelCtl->GetWidth() || nColumn <0 )
        throw lang::IndexOutOfBoundsException(
            OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this );
}

void SvxPixelCtlAccessible::ensureIsValidAddress(
        sal_Int32 nRow, sal_Int32 nColumn )
    throw ( lang::IndexOutOfBoundsException )
{
    ensureIsValidRow( nRow );
    ensureIsValidColumn( nColumn );
}

void SvxPixelCtlAccessible::ensureIsValidIndex( sal_Int32 nChildIndex )
    throw ( lang::IndexOutOfBoundsException )
{
    if( nChildIndex >=  pPixelCtl->GetSquares())
        throw lang::IndexOutOfBoundsException(
            OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this );
}


//XAccessibleEventBroadcaster
void SAL_CALL SvxPixelCtlAccessible::addAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener )  throw( RuntimeException )
{
    if (xListener.is())
    {
        ::osl::MutexGuard   aGuard( m_aMutex );
        if (!mnClientId)
                mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
        comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
    }
}

void SAL_CALL SvxPixelCtlAccessible::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
    throw( RuntimeException )
{
    if (xListener.is())
    {
        ::osl::MutexGuard   aGuard( m_aMutex );

        sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener );
        if ( !nListenerCount )
        {
            comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
            mnClientId = 0;
        }
    }
}
void SvxPixelCtlAccessible::CommitChange( const AccessibleEventObject& rEvent )
{
    if (mnClientId)
        comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent );
}

//Solution:Add the event handling method
void SvxPixelCtlAccessible::FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew)
{
    const uno::Reference< XInterface >  xSource( *this );
    CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) );
}

void SAL_CALL SvxPixelCtlAccessible::disposing()
{
    if( !rBHelper.bDisposed )
    {
        {
            ::osl::MutexGuard   aGuard( m_aMutex );
            if ( mnClientId )
            {
                comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
                mnClientId =  0;
            }
        }
        //mxParent = uno::Reference< XAccessible >();

    }
}
void SvxPixelCtlAccessible::Invalidate()
{
    pPixelCtl = 0;
}
void SvxPixelCtlAccessible::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException )
{
    if( IsNotAlive() )
        throw lang::DisposedException();
}
void SvxPixelCtlAccessible::IsValid() throw (uno::RuntimeException)
{
    if(!pPixelCtl)
        throw uno::RuntimeException();
}


void SvxPixelCtlAccessible::NotifyChild(long nIndex,sal_Bool bSelect ,sal_Bool bCheck)
{
    DBG_ASSERT( !(!bSelect && !bCheck),"" );//non is false

    SvxPixelCtlAccessibleChild *pChild= NULL;

    if (m_xCurChild.is())
    {
        pChild= static_cast<SvxPixelCtlAccessibleChild*>(m_xCurChild.get());
        DBG_ASSERT(pChild,"Child Must be Valid");
        if (pChild->getAccessibleIndexInParent() == nIndex )
        {
            if (bSelect)
            {
                pChild->SelectChild(sal_True);
            }
            if (bCheck)
            {
                pChild->ChangePixelColorOrBG(sal_Bool(pPixelCtl->GetBitmapPixel(sal_uInt16(nIndex))));
                pChild->CheckChild();
            }
            return ;
        }
    }
    uno::Reference <XAccessible> xNewChild =CreateChild(nIndex, pPixelCtl->IndexToPoint(nIndex));
    SvxPixelCtlAccessibleChild *pNewChild= static_cast<SvxPixelCtlAccessibleChild*>(xNewChild.get());
    DBG_ASSERT(pNewChild,"Child Must be Valid");

    Any aNewValue,aOldValue;
    aNewValue<<= xNewChild;
    FireAccessibleEvent(    AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
                            aOldValue,
                            aNewValue );

    if (bSelect)
    {
        if (pChild)
        {
            pChild->SelectChild(sal_False);
        }
        pNewChild->SelectChild(sal_True);
    }
    if (bCheck)
    {
        pNewChild->CheckChild();
    }
    m_xCurChild= xNewChild;


}

uno::Reference<XAccessible> SvxPixelCtlAccessible::CreateChild (long nIndex,Point mPoint)
{
    long nX = mPoint.X();
    long nY = mPoint.Y();
    if( Application::GetSettings().GetLayoutRTL())
    {
        nX = (sal_uInt16) pPixelCtl->GetWidth() - 1 - nX;
    }

    sal_Bool bPixelColorOrBG= sal_Bool(pPixelCtl->GetBitmapPixel(sal_uInt16(nIndex)));
    Size size(pPixelCtl->GetWidth() / pPixelCtl->GetLineCount(),pPixelCtl->GetHeight() / pPixelCtl->GetLineCount());
    uno::Reference<XAccessible> xChild;
    xChild = new SvxPixelCtlAccessibleChild(pPixelCtl,
                bPixelColorOrBG,
                Point(nX,nY),
                Rectangle(mPoint,size),
                this,
                nIndex);

    return xChild;
}


void SvxPixelCtlAccessible::LoseFocus()
{
    m_xCurChild = uno::Reference< XAccessible >() ;
}

void SvxPixelCtlAccessibleChild::CheckChild()
{
    Any aChecked;
    aChecked <<= AccessibleStateType::CHECKED;

    if (m_bPixelColorOrBG)//Current Child State
    {
        FireAccessibleEvent(    AccessibleEventId::STATE_CHANGED,
                                Any(),
                                aChecked);
    }
    else
    {
        FireAccessibleEvent(    AccessibleEventId::STATE_CHANGED,
                                aChecked,
                                Any() );
    }
}

void SvxPixelCtlAccessibleChild::SelectChild( sal_Bool bSelect)
{
    Any aSelected;
    aSelected <<= AccessibleStateType::SELECTED;

    if (bSelect)
    {
        FireAccessibleEvent(    AccessibleEventId::STATE_CHANGED,
                                Any(),
                                aSelected);
    }
    else
    {
        FireAccessibleEvent(    AccessibleEventId::STATE_CHANGED,
                                aSelected,
                                Any());
    }
}
void SvxPixelCtlAccessibleChild::FireAccessibleEvent (
    short nEventId,
    const ::com::sun::star::uno::Any& rOld,
    const ::com::sun::star::uno::Any& rNew)
{
    const uno::Reference< XInterface >  xSource( *this );
    CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) );
}



DBG_NAME( SvxPixelCtlAccessibleChild )


SvxPixelCtlAccessibleChild::SvxPixelCtlAccessibleChild(
    SvxPixelCtl* rWindow,
    sal_Bool bPixelColorOrBG,
    const Point &aPoint,
    const Rectangle& rBoundingBox,
    const uno::Reference<XAccessible>&  rxParent,
    long nIndexInParent ) :
    SvxPixelCtlAccessibleChild_BASE( m_aMutex ),
    mrParentWindow( rWindow ),
    mxParent(rxParent),
    m_bPixelColorOrBG(bPixelColorOrBG),
    maPoint(aPoint),
    mpBoundingBox( new Rectangle( rBoundingBox ) ),
    mnIndexInParent( nIndexInParent ),
    mnClientId( 0 )
{
    DBG_CTOR( SvxPixelCtlAccessibleChild, NULL );
}


SvxPixelCtlAccessibleChild::~SvxPixelCtlAccessibleChild()
{
    DBG_DTOR( SvxPixelCtlAccessibleChild, NULL );

    if( IsAlive() )
    {
        osl_incrementInterlockedCount( &m_refCount );
        dispose();      // set mpRepr = NULL & release all childs
    }
}

//=====  XAccessible  =========================================================

uno::Reference< XAccessibleContext> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleContext( void ) throw( RuntimeException )
{
    return this;
}

//=====  XAccessibleComponent  ================================================

sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::containsPoint( const awt::Point& rPoint ) throw( RuntimeException )
{
    // no guard -> done in getBounds()
//  return GetBoundingBox().IsInside( VCLPoint( rPoint ) );
    return Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
}

uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleAtPoint( const awt::Point& ) throw( RuntimeException )
{
    return uno::Reference< XAccessible >();
}

awt::Rectangle SAL_CALL SvxPixelCtlAccessibleChild::getBounds() throw( RuntimeException )
{
    // no guard -> done in getBoundingBox()
    //Modified by lq, 09/26
    //return AWTRectangle( GetBoundingBox() );
    awt::Rectangle rect = AWTRectangle( GetBoundingBox() );
    rect.X = rect.X + mrParentWindow->GetClientWindowExtentsRelative(NULL).Left()-mrParentWindow->GetWindowExtentsRelative(NULL).Left();
    rect.Y = rect.Y + mrParentWindow->GetClientWindowExtentsRelative(NULL).Top()-mrParentWindow->GetWindowExtentsRelative(NULL).Top();
    return rect;
    // End
}

awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocation() throw( RuntimeException )
{
    // no guard -> done in getBoundingBox()
    return AWTPoint( GetBoundingBox().TopLeft() );
}

awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocationOnScreen() throw( RuntimeException )
{
    // no guard -> done in getBoundingBoxOnScreen()
    return AWTPoint( GetBoundingBoxOnScreen().TopLeft() );
}

awt::Size SAL_CALL SvxPixelCtlAccessibleChild::getSize() throw( RuntimeException )
{
    // no guard -> done in getBoundingBox()
    return AWTSize( GetBoundingBox().GetSize() );
}

void SAL_CALL SvxPixelCtlAccessibleChild::grabFocus() throw( RuntimeException )
{
}

sal_Int32 SvxPixelCtlAccessibleChild::getForeground(  )
        throw (::com::sun::star::uno::RuntimeException)
{
    //::vos::OGuard       aSolarGuard( Application::GetSolarMutex() );
    ::osl::MutexGuard   aGuard( m_aMutex );
    ThrowExceptionIfNotAlive();
    return mrParentWindow->GetControlForeground().GetColor();
}
sal_Int32 SvxPixelCtlAccessibleChild::getBackground(  )
        throw (::com::sun::star::uno::RuntimeException)
{
    //::vos::OGuard       aSolarGuard( Application::GetSolarMutex() );
    ::osl::MutexGuard   aGuard( m_aMutex );

    ThrowExceptionIfNotAlive();
    return mrParentWindow->GetControlBackground().GetColor();
}

//=====  XAccessibleContext  ==================================================

sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChildCount( void ) throw( RuntimeException )
{
    return 0;
}

uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChild( sal_Int32 ) throw ( RuntimeException )
{
    throw lang::IndexOutOfBoundsException();
}

uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleParent( void ) throw( RuntimeException )
{
    return mxParent;
}

sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleIndexInParent( void ) throw( RuntimeException )
{
   return mnIndexInParent;
}

sal_Int16 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRole( void ) throw( RuntimeException )
{
    return AccessibleRole::CHECK_BOX;
}

OUString SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleDescription( void ) throw( RuntimeException )
{
    ::osl::MutexGuard   aGuard( m_aMutex );

    return  GetName();
}

OUString SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleName( void ) throw( RuntimeException )
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    return  GetName();
}

/** Return empty uno::Reference to indicate that the relation set is not
    supported.
*/
uno::Reference<XAccessibleRelationSet> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRelationSet( void ) throw( RuntimeException )
{
    return uno::Reference< XAccessibleRelationSet >();
}

uno::Reference< XAccessibleStateSet > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleStateSet( void ) throw( RuntimeException )
{
    ::osl::MutexGuard                       aGuard( m_aMutex );
    utl::AccessibleStateSetHelper*          pStateSetHelper = new utl::AccessibleStateSetHelper;

    if( IsAlive() )
    {

        pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
        pStateSetHelper->AddState( AccessibleStateType::ENABLED );
        pStateSetHelper->AddState( AccessibleStateType::OPAQUE );
        pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
        pStateSetHelper->AddState( AccessibleStateType::SHOWING );
        pStateSetHelper->AddState( AccessibleStateType::VISIBLE );

        if (mrParentWindow )
        {
            long nIndex = mrParentWindow->GetFoucsPosIndex();
            if ( nIndex == mnIndexInParent)
            {
                pStateSetHelper->AddState( AccessibleStateType::SELECTED );
            }
            if (mrParentWindow->GetBitmapPixel(sal_uInt16(mnIndexInParent)))
            {
                pStateSetHelper->AddState( AccessibleStateType::CHECKED );
            }
        }
    }
    else
        pStateSetHelper->AddState( AccessibleStateType::DEFUNC );

    return pStateSetHelper;
}

lang::Locale SAL_CALL SvxPixelCtlAccessibleChild::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException )
{
    ::osl::MutexGuard                       aGuard( m_aMutex );
    if( mxParent.is() )
    {
        uno::Reference< XAccessibleContext >        xParentContext( mxParent->getAccessibleContext() );
        if( xParentContext.is() )
            return xParentContext->getLocale();
    }

    //  No locale and no parent.  Therefore throw exception to indicate this
    //  cluelessness.
    throw IllegalAccessibleComponentStateException();
}

void SAL_CALL SvxPixelCtlAccessibleChild::addAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
    throw( RuntimeException )
{
    if (xListener.is())
    {
        ::osl::MutexGuard   aGuard( m_aMutex );
        if (!mnClientId)
            mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
        comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
    }
}




void SAL_CALL SvxPixelCtlAccessibleChild::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
    throw( RuntimeException )
{
    if (xListener.is())
    {
        ::osl::MutexGuard   aGuard( m_aMutex );

        sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener );
        if ( !nListenerCount )
        {
            // no listeners anymore
            // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
            // and at least to us not firing any events anymore, in case somebody calls
            // NotifyAccessibleEvent, again
            comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
            mnClientId = 0;
        }
    }
}


//=====  XServiceInfo  ========================================================

OUString SAL_CALL SvxPixelCtlAccessibleChild::getImplementationName( void ) throw( RuntimeException )
{
    return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxPixelCtlAccessibleChild" ) );
}

sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::supportsService( const OUString& rServiceName ) throw( RuntimeException )
{
    return  rServiceName.equalsAsciiL( sAccessible         , sizeof(sAccessible         )-1 ) ||
            rServiceName.equalsAsciiL( sAccessibleContext  , sizeof(sAccessibleContext  )-1 ) ||
            rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );

}

Sequence< OUString > SAL_CALL SvxPixelCtlAccessibleChild::getSupportedServiceNames( void ) throw( RuntimeException )
{
    uno::Sequence< OUString > aRet(3);
    OUString* pArray = aRet.getArray();
    pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible         ) );
    pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext  ) );
    pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) );
    return aRet;
}

//=====  internal  ============================================================

void SvxPixelCtlAccessibleChild::CommitChange( const AccessibleEventObject& rEvent )
{
    if (mnClientId)
        comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent );
}

void SAL_CALL SvxPixelCtlAccessibleChild::disposing()
{
    if( !rBHelper.bDisposed )
    {
        ::osl::MutexGuard   aGuard( m_aMutex );

        // Send a disposing to all listeners.
        if ( mnClientId )
        {
            comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
            mnClientId =  0;
        }

        mxParent = uno::Reference< XAccessible >();

        delete mpBoundingBox;
    }
}

void SvxPixelCtlAccessibleChild::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException )
{
    if( IsNotAlive() )
        throw lang::DisposedException();
}

Rectangle SvxPixelCtlAccessibleChild::GetBoundingBoxOnScreen( void ) throw( RuntimeException )
{
    ::osl::MutexGuard   aGuard( m_aMutex );

    // no ThrowExceptionIfNotAlive() because its done in GetBoundingBox()
    Rectangle           aRect( GetBoundingBox() );

    return Rectangle( mrParentWindow->OutputToAbsoluteScreenPixel( aRect.TopLeft() ), aRect.GetSize() );
}

Rectangle SvxPixelCtlAccessibleChild::GetBoundingBox( void ) throw( RuntimeException )
{
    // no guard neccessary, because no one changes mpBoundingBox after creating it
    ThrowExceptionIfNotAlive();

    return *mpBoundingBox;
}

OUString SvxPixelCtlAccessibleChild::GetName()
{
    sal_Int32 nXIndex = mnIndexInParent % mrParentWindow->GetLineCount();
    sal_Int32 nYIndex = mnIndexInParent / mrParentWindow->GetLineCount();

    OUString str;
    str += "(";
    str += OUString::number(nXIndex);
    str += ",";
    str += OUString::number(nYIndex);
    str += ")";
    return str;
}
diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
index 55792db..cda769a 100644
--- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx
+++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
@@ -38,7 +38,8 @@
#include <svx/dlgctrl.hxx>
#include <svx/dialmgr.hxx>
#include <comphelper/accessibleeventnotifier.hxx>

#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <unotools/accessiblerelationsethelper.hxx>

using namespace ::cppu;
using namespace ::osl;
@@ -46,6 +47,7 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::accessibility;

using namespace ::com::sun::star::lang;

#define MAX_NUM_OF_CHILDREN   9
#define NOCHILDSELECTED     -1
@@ -348,7 +350,7 @@ sal_Int16 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRole( void ) throw(
OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleDescription( void ) throw( RuntimeException )
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    return msDescription;
    return msDescription + " Please use arrow key to selection.";
}

OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleName( void ) throw( RuntimeException )
@@ -362,7 +364,36 @@ OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleName( void ) throw( 
*/
Reference< XAccessibleRelationSet > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException )
{
    return Reference< XAccessibleRelationSet >();
    //return Reference< XAccessibleRelationSet >();
    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
    uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
    Window* pWindow = mpRepr;
    if ( pWindow )
    {
        // Window *pLabeledBy = pWindow->GetAccRelationLabeledBy();
        Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
        if ( pLabeledBy && pLabeledBy != pWindow )
        {
            uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
            aSequence[0] = pLabeledBy->GetAccessible();
            pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
        }
        Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
        if ( pMemberOf && pMemberOf != pWindow )
        {
            uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
            aSequence[0] = pMemberOf->GetAccessible();
            pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
        }
    }
    return xSet;
}

//Add the event handling method
void SvxRectCtlAccessibleContext::FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew)
{
    const Reference< XInterface >   xSource( *this );
    CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) );
}

Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException )
@@ -372,6 +403,7 @@ Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlAccessibleContext::getAccess

    if( IsAlive() )
    {
        pStateSetHelper->AddState( AccessibleStateType::ENABLED );
        pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
        if( mpRepr->HasFocus() )
            pStateSetHelper->AddState( AccessibleStateType::FOCUSED );
@@ -607,7 +639,37 @@ void SvxRectCtlAccessibleContext::checkChildIndexOnSelection( long nIndex ) thro
        throw lang::IndexOutOfBoundsException();
}

void SvxRectCtlAccessibleContext::selectChild( long nNew )
void SvxRectCtlAccessibleContext::FireChildFocus( RECT_POINT eButton )
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    long nNew = PointToIndex( eButton, mbAngleMode );
    long nNumOfChildren = getAccessibleChildCount();
    if( nNew < nNumOfChildren )
    {
        // select new child
        SvxRectCtlChildAccessibleContext*   pChild;
        mnSelectedChild = nNew;
        if( nNew != NOCHILDSELECTED )
        {
            pChild = mpChildren[ nNew ];
            if( pChild )
            {
                pChild->FireFocusEvent();
            }
        }
        else
        {
            const Reference< XInterface >   xSource( *this );
            Any                             aOld;
            Any                             aNew;
            aNew <<= AccessibleStateType::FOCUSED;
            CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
        }
    }
    else
        mnSelectedChild = NOCHILDSELECTED;
}
void SvxRectCtlAccessibleContext::selectChild( long nNew, sal_Bool bFireFocus )
{
    ::osl::MutexGuard   aGuard( m_aMutex );
    if( nNew != mnSelectedChild )
@@ -620,7 +682,7 @@ void SvxRectCtlAccessibleContext::selectChild( long nNew )
            {   // deselect old selected child if one is selected
                pChild = mpChildren[ mnSelectedChild ];
                if( pChild )
                    pChild->setStateChecked( false );
                    pChild->setStateChecked( false, bFireFocus );
            }

            // select new child
@@ -630,7 +692,7 @@ void SvxRectCtlAccessibleContext::selectChild( long nNew )
            {
                pChild = mpChildren[ nNew ];
                if( pChild )
                    pChild->setStateChecked( true );
                    pChild->setStateChecked( true, bFireFocus );
            }
        }
        else
@@ -638,10 +700,10 @@ void SvxRectCtlAccessibleContext::selectChild( long nNew )
    }
}

void SvxRectCtlAccessibleContext::selectChild( RECT_POINT eButton )
void SvxRectCtlAccessibleContext::selectChild(RECT_POINT eButton, sal_Bool bFireFocus )
{
    // no guard -> is done in next selectChild
    selectChild( PointToIndex( eButton, mbAngleMode ) );
    selectChild(PointToIndex( eButton, mbAngleMode ), bFireFocus);
}

void SvxRectCtlAccessibleContext::CommitChange( const AccessibleEventObject& rEvent )
@@ -915,7 +977,17 @@ OUString SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleName( void ) th
*/
Reference<XAccessibleRelationSet> SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException )
{
    return Reference< XAccessibleRelationSet >();
    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
    uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
    if( mxParent.is() )
      {
        uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
        aSequence[0] = mxParent;
        pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );

    }

    return xSet;
}

Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException )
@@ -1024,6 +1096,57 @@ Any SAL_CALL SvxRectCtlChildAccessibleContext::getMinimumValue() throw( RuntimeE
    return aRet;
}

// -----------------------------------------------------------------------------
// XAccessibleAction
// -----------------------------------------------------------------------------

sal_Int32 SvxRectCtlChildAccessibleContext::getAccessibleActionCount( ) throw (RuntimeException)
{
    ::osl::MutexGuard   aGuard( maMutex );

    return 1;
}

// -----------------------------------------------------------------------------

sal_Bool SvxRectCtlChildAccessibleContext::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
{
    ::osl::MutexGuard   aGuard( maMutex );

    if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
        throw IndexOutOfBoundsException();

    Reference<XAccessibleSelection> xSelection( mxParent, UNO_QUERY);

    xSelection->selectAccessibleChild(mnIndexInParent);

    return sal_True;
}

// -----------------------------------------------------------------------------

OUString SvxRectCtlChildAccessibleContext::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
{
    ::osl::MutexGuard   aGuard( maMutex );

    if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
        throw IndexOutOfBoundsException();

    return OUString("select");
}

// -----------------------------------------------------------------------------

Reference< XAccessibleKeyBinding > SvxRectCtlChildAccessibleContext::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
{
    ::osl::MutexGuard   aGuard( maMutex );

    if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
        throw IndexOutOfBoundsException();

    return Reference< XAccessibleKeyBinding >();
}

//=====  XServiceInfo  ========================================================
OUString SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationName( void ) throw( RuntimeException )
{
@@ -1108,7 +1231,7 @@ Rectangle SvxRectCtlChildAccessibleContext::GetBoundingBox( void ) throw( Runtim
    return *mpBoundingBox;
}

void SvxRectCtlChildAccessibleContext::setStateChecked( bool bChecked )
void SvxRectCtlChildAccessibleContext::setStateChecked( bool bChecked, bool bFireFocus )
{
    if( mbIsChecked != bChecked )
    {
@@ -1120,10 +1243,25 @@ void SvxRectCtlChildAccessibleContext::setStateChecked( bool bChecked )
        Any                             aNew;
        Any&                            rMod = bChecked? aNew : aOld;

        if( bFireFocus )
        {
            //Send the STATE_CHANGED(Focused) event to accessible
            rMod <<= AccessibleStateType::FOCUSED;
            CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
        }
        rMod <<= AccessibleStateType::CHECKED;

        CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
    }
}

void SvxRectCtlChildAccessibleContext::FireFocusEvent()
{
    const Reference< XInterface >   xSource( *this );
    Any                             aOld;
    Any                             aNew;
    aNew <<= AccessibleStateType::FOCUSED;
    CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
index 88115ee..8e79662 100644
--- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
@@ -305,4 +305,253 @@ OUString EnhancedCustomShapeTypeNames::Get( const MSO_SPT eShapeType )
        : OUString();
}

typedef boost::unordered_map< const char*, const char*, rtl::CStringHash, rtl::CStringEqual> TypeACCNameHashMap;

static TypeACCNameHashMap* pACCHashMap = NULL;
struct ACCNameTypeTable
{
    const char* pS;
    const char* pE;
};

static const ACCNameTypeTable pACCNameTypeTableArray[] =
{
    { "non-primitive", "Non Primitive Shape" },
    { "rectangle", "Rectangle" },
    { "round-rectangle", "Rounded Rectangle" },
    { "ellipse", "Ellipse" },
    { "diamond", "Diamond" },
    { "isosceles-triangle", "Triangle" },
    { "right-triangle", "Right Triangle" },
    { "parallelogram", "Parallelogram" },
    { "trapezoid", "Trapezoid" },
    { "hexagon", "Hexagon" },
    { "octagon", "Octagon" },
    { "cross", "Cross" },
    { "star5", "5-Point Star" },
    { "right-arrow", "Right Arrow" },
    //{ "mso-spt14", mso_sptThickArrow },
    { "pentagon-right", "Pentagon" },
    { "cube", "Cube" },
    { "mso-spt21", "Doorplate" },
    /*{ "mso-spt17", mso_sptBalloon },
    { "mso-spt18", mso_sptSeal },
    { "mso-spt19", mso_sptArc },
    { "mso-spt20", mso_sptLine },
    { "mso-spt21", mso_sptPlaque },
    { "can", mso_sptCan },*/
    { "ring", "Ring" },
    /*{ "mso-spt24", mso_sptTextSimple },
    { "mso-spt25", mso_sptTextOctagon },
    { "mso-spt26", mso_sptTextHexagon },
    { "mso-spt27", mso_sptTextCurve },
    { "mso-spt28", mso_sptTextWave },
    { "mso-spt29", mso_sptTextRing },
    { "mso-spt30", mso_sptTextOnCurve },
    { "mso-spt31", mso_sptTextOnRing },
    { "mso-spt32", mso_sptStraightConnector1 },
    { "mso-spt33", mso_sptBentConnector2 },
    { "mso-spt34", mso_sptBentConnector3 },
    { "mso-spt35", mso_sptBentConnector4 },
    { "mso-spt36", mso_sptBentConnector5 },
    { "mso-spt37", mso_sptCurvedConnector2 },
    { "mso-spt38", mso_sptCurvedConnector3 },
    { "mso-spt39", mso_sptCurvedConnector4 },
    { "mso-spt40", mso_sptCurvedConnector5 },
    { "mso-spt41", mso_sptCallout1 },
    { "mso-spt42", mso_sptCallout2 },
    { "mso-spt43", mso_sptCallout3 },
    { "mso-spt44", mso_sptAccentCallout1 },
    { "mso-spt45", mso_sptAccentCallout2 },
    { "mso-spt46", mso_sptAccentCallout3 },*/
    { "line-callout-1", "Line Callout 1" },
    { "line-callout-2", "Line Callout 2" },
    /*{ "mso-spt49", mso_sptBorderCallout3 },
    { "mso-spt50", mso_sptAccentBorderCallout1 },
    { "mso-spt51", mso_sptAccentBorderCallout2 },
    { "mso-spt52", mso_sptAccentBorderCallout3 },
    { "mso-spt53", mso_sptRibbon },
    { "mso-spt54", mso_sptRibbon2 },*/
    { "chevron", "Chevron" },
    { "pentagon", "Regular Pentagon" },
    { "forbidden", "'No' Symbol" },
    { "star8", "8-Point Star" },
    /*{ "mso-spt59", mso_sptSeal16 },
    { "mso-spt60", mso_sptSeal32 },*/
    { "rectangular-callout", "Rectangular Callout" },
    { "round-rectangular-callout", "Rounded Rectangular Callout" },
    { "round-callout", "Round Callout" },
    //{ "mso-spt64", mso_sptWave },
    { "paper", "Folded Corner" },
    { "left-arrow", "Left Arrow" },
    { "down-arrow", "Down Arrow" },
    { "up-arrow", "Up Arrow" },
    { "left-right-arrow", "Left and Right Arrow" },
    { "up-down-arrow", "Up and Down Arrow" },
    //{ "mso-spt71", mso_sptIrregularSeal1 },
    { "bang", "Explosion" },
    { "lightning", "Lighting Bolt" },
    { "heart", "Heart" },
    //{ "mso-spt75", mso_sptPictureFrame },
    { "quad-arrow", "4-Way Arrow" },
    { "left-arrow-callout", "Left Arrow Callout" },
    { "right-arrow-callout", "Right Arrow Callout" },
    { "up-arrow-callout", "Up Arrow Callout" },
    { "down-arrow-callout", "Down Arrow Callout" },
    { "left-right-arrow-callout", "Left and Right Arrow Callout" },
    { "up-down-arrow-callout", "Up and Down Arrow Callout" },
    { "quad-arrow-callout", "4-Way Arrow Callout" },
    { "quad-bevel", "Square Bevel" },
    { "left-bracket", "Left Bracket" },
    { "right-bracket", "Right Bracket" },
    { "left-brace", "Left Brace" },
    { "right-brace", "Right Brace" },
    { "mso-spt89", "Up and Left Arrow" },
    //{ "mso-spt90", mso_sptBentUpArrow },
    //{ "mso-spt91", mso_sptBentArrow },
    { "star24", "24-Point Star" },
    { "striped-right-arrow", "Striped Right Arrow" },
    { "notched-right-arrow", "Notched Right Arrow" },
    { "block-arc", "Block Arc" },
    { "smiley", "Smile Face" },
    { "vertical-scroll", "Vertical Scroll" },
    { "horizontal-scroll", "Horizontal Scroll" },
    { "circular-arrow", "Circular Arrow" },
    { "mso-spt100", "Notched Circular Arrow" },
    /*
    { "mso-spt101", mso_sptUturnArrow },
    { "mso-spt102", mso_sptCurvedRightArrow },
    { "mso-spt103", mso_sptCurvedLeftArrow },
    { "mso-spt104", mso_sptCurvedUpArrow },
    { "mso-spt105", mso_sptCurvedDownArrow },*/
    { "cloud-callout", "Cloud Callout" },
    /*{ "mso-spt107", mso_sptEllipseRibbon },
    { "mso-spt108", mso_sptEllipseRibbon2 },*/
    { "flowchart-process", "Flowchart:Process" },
    { "flowchart-decision", "Flowchart:Decision" },
    { "flowchart-data", "Flowchart:Data" },
    { "flowchart-predefined-process", "Flowchart:Predefined Process" },
    { "flowchart-internal-storage", "Flowchart:Internal Storage" },
    { "flowchart-document", "Flowchart:Document" },
    { "flowchart-multidocument", "Flowchart:Multidocument" },
    { "flowchart-terminator", "Flowchart:Terminator" },
    { "flowchart-preparation", "Flowchart:Preparation" },
    { "flowchart-manual-input", "Flowchart:Manual Input" },
    { "flowchart-manual-operation", "Flowchart:Manual Operation" },
    { "flowchart-connector", "Flowchart:Connector" },
    { "flowchart-card", "Flowchart:Card" },
    { "flowchart-punched-tape", "Flowchart:Punched Tape" },
    { "flowchart-summing-junction", "Flowchart:Summing Junction" },
    { "flowchart-or", "Flowchart:Or" },
    { "flowchart-collate", "Flowchart:Collate" },
    { "flowchart-sort", "Flowchart:Sort" },
    { "flowchart-extract", "Flowchart:Extract" },
    { "flowchart-merge", "Flowchart:Merge" },
    //{ "mso-spt129", mso_sptFlowChartOfflineStorage },
    { "flowchart-stored-data", "Flowchart:Stored Data" },
    { "flowchart-sequential-access", "drawingbar.fc.25=Flowchart:Sequential Access" },
    { "flowchart-magnetic-disk", "Flowchart:Magnetic Disk" },
    { "flowchart-direct-access-storage", "Flowchart:Direct Access Storage" },
    { "flowchart-display", "Flowchart:Display" },
    { "flowchart-delay", "Flowchart:Delay" },
    /*{ "fontwork-plain-text", mso_sptTextPlainText },
    { "fontwork-stop", mso_sptTextStop },
    { "fontwork-triangle-up", mso_sptTextTriangle },
    { "fontwork-triangle-down", mso_sptTextTriangleInverted },
    { "fontwork-chevron-up", mso_sptTextChevron },
    { "fontwork-chevron-down", mso_sptTextChevronInverted },
    { "mso-spt142", mso_sptTextRingInside },
    { "mso-spt143", mso_sptTextRingOutside },
    { "fontwork-arch-up-curve", mso_sptTextArchUpCurve },
    { "fontwork-arch-down-curve", mso_sptTextArchDownCurve },
    { "fontwork-circle-curve", mso_sptTextCircleCurve },
    { "fontwork-open-circle-curve", mso_sptTextButtonCurve },
    { "fontwork-arch-up-pour", mso_sptTextArchUpPour },
    { "fontwork-arch-down-pour", mso_sptTextArchDownPour },
    { "fontwork-circle-pour", mso_sptTextCirclePour },
    { "fontwork-open-circle-pour", mso_sptTextButtonPour },
    { "fontwork-curve-up", mso_sptTextCurveUp },
    { "fontwork-curve-down", mso_sptTextCurveDown },
    { "fontwork-fade-up-and-right", mso_sptTextCascadeUp },
    { "fontwork-fade-up-and-left", mso_sptTextCascadeDown },
    { "fontwork-wave", mso_sptTextWave1 },
    { "mso-spt157", mso_sptTextWave2 },
    { "mso-spt158", mso_sptTextWave3 },
    { "mso-spt159", mso_sptTextWave4 },
    { "fontwork-inflate", mso_sptTextInflate },
    { "mso-spt161", mso_sptTextDeflate },
    { "mso-spt162", mso_sptTextInflateBottom },
    { "mso-spt163", mso_sptTextDeflateBottom },
    { "mso-spt164", mso_sptTextInflateTop },
    { "mso-spt165", mso_sptTextDeflateTop },
    { "mso-spt166", mso_sptTextDeflateInflate },
    { "mso-spt167", mso_sptTextDeflateInflateDeflate },
    { "fontwork-fade-right", mso_sptTextFadeRight },
    { "fontwork-fade-left", mso_sptTextFadeLeft },
    { "fontwork-fade-up", mso_sptTextFadeUp },
    { "fontwork-fade-down", mso_sptTextFadeDown },
    { "fontwork-slant-up", mso_sptTextSlantUp },
    { "fontwork-slant-down", mso_sptTextSlantDown },
    { "mso-spt174", mso_sptTextCanUp },
    { "mso-spt175", mso_sptTextCanDown },*/
    { "flowchart-alternate-process", "Flowchart:Alternate Process " },
    { "flowchart-off-page-connector", "Flowchart:Off-page Connector" },
    /*{ "mso-spt178", mso_sptCallout90 },
    { "mso-spt179", mso_sptAccentCallout90 },
    { "mso-spt180", mso_sptBorderCallout90 },*/
    { "line-callout-3", "Line Callout 3" },
    //{ "mso-spt182", mso_sptLeftRightUpArrow },
    { "sun", "Sun" },
    { "moon", "Moon" },
    { "bracket-pair", "Double Bracket" },
    { "brace-pair", "Double Brace" },
    { "star4", "4-Point Star" },
    /*{ "mso-spt188", mso_sptDoubleWave },
    { "mso-spt189", mso_sptActionButtonBlank },
    { "mso-spt190", mso_sptActionButtonHome },
    { "mso-spt191", mso_sptActionButtonHelp },
    { "mso-spt192", mso_sptActionButtonInformation },
    { "mso-spt193", mso_sptActionButtonForwardNext },
    { "mso-spt194", mso_sptActionButtonBackPrevious },
    { "mso-spt195", mso_sptActionButtonEnd },
    { "mso-spt196", mso_sptActionButtonBeginning },
    { "mso-spt197", mso_sptActionButtonReturn },
    { "mso-spt198", mso_sptActionButtonDocument },
    { "mso-spt199", mso_sptActionButtonSound },
    { "mso-spt200", mso_sptActionButtonMovie },
    { "mso-spt201", mso_sptHostControl },
    { "mso-spt202", mso_sptTextBox },*/
    { "frame", "Frame" },
    { "col-60da8460", "Octagon Bevel" },
    { "col-502ad400", "Diamond Bevel" }
};

OUString EnhancedCustomShapeTypeNames::GetAccName( const OUString& rShapeType )
{
    if ( !pACCHashMap )
    {   // init hash map
        ::osl::MutexGuard aGuard( getHashMapMutex() );
        if ( !pACCHashMap )
        {
            TypeACCNameHashMap* pH = new TypeACCNameHashMap;
            const ACCNameTypeTable* pPtr = pACCNameTypeTableArray;
            const ACCNameTypeTable* pEnd = pPtr + ( sizeof( pACCNameTypeTableArray ) / sizeof( ACCNameTypeTable ) );
            for ( ; pPtr < pEnd; pPtr++ )
                (*pH)[ pPtr->pS ] = pPtr->pE;
            pACCHashMap = pH;
        }
    }
    OUString sRetValue;
    int i, nLen = rShapeType.getLength();
    char* pBuf = new char[ nLen + 1 ];
    for ( i = 0; i < nLen; i++ )
        pBuf[ i ] = (char)rShapeType[ i ];
    pBuf[ i ] = 0;
    TypeACCNameHashMap::iterator aHashIter( pACCHashMap->find( pBuf ) );
    delete[] pBuf;
    if ( aHashIter != pACCHashMap->end() )
        sRetValue = OUString::createFromAscii( (*aHashIter).second );
    return sRetValue;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index ea97d6c..8ee996d 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -121,6 +121,7 @@ void MaskSet::Select()

void MaskSet::GetFocus()
{
    ValueSet::GetFocus();
    SelectItem( 1 );
    pSvxBmpMask->onSelect( this );
}
@@ -311,10 +312,11 @@ IMPL_LINK( MaskData, CbxTransHdl, CheckBox*, pCbx )

IMPL_LINK( MaskData, FocusLbHdl, ColorLB*, pLb )
{
    pMask->pQSet1->SelectItem( pLb == &( pMask->aLbColor1 ) ? 1 : 0 );
    pMask->pQSet2->SelectItem( pLb == &( pMask->aLbColor2 ) ? 1 : 0 );
    pMask->pQSet3->SelectItem( pLb == &( pMask->aLbColor3 ) ? 1 : 0 );
    pMask->pQSet4->SelectItem( pLb == &( pMask->aLbColor4 ) ? 1 : 0 );
    // MT: bFireFox as API parameter is ugly, find better solution????
    pMask->pQSet1->SelectItem( pLb == &( pMask->aLbColor1 ) ? 1 : 0 /* , false */ );
    pMask->pQSet2->SelectItem( pLb == &( pMask->aLbColor2 ) ? 1 : 0 /* , false */ );
    pMask->pQSet3->SelectItem( pLb == &( pMask->aLbColor3 ) ? 1 : 0 /* , false */ );
    pMask->pQSet4->SelectItem( pLb == &( pMask->aLbColor4 ) ? 1 : 0 /* , false */ );

    return 0;
}
@@ -458,25 +460,35 @@ SvxBmpMask::SvxBmpMask( SfxBindings *pBindinx,
    pQSet1->SetStyle( pQSet1->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
    pQSet1->SetColCount( 1 );
    pQSet1->SetLineCount( 1 );
    pQSet1->InsertItem( 1, aPipetteColor );
    OUString sColorPalette (BMP_RESID( RID_SVXDLG_BMPMASK_STR_PALETTE));
    OUString sColorPaletteN;
    sColorPaletteN = sColorPalette;
    sColorPaletteN += " 1";
    pQSet1->InsertItem( 1, aPipetteColor, sColorPaletteN);
    pQSet1->SelectItem( 1 );

    pQSet2->SetStyle( pQSet2->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
    pQSet2->SetColCount( 1 );
    pQSet2->SetLineCount( 1 );
    pQSet2->InsertItem( 1, aPipetteColor );
    sColorPaletteN = sColorPalette;
    sColorPaletteN += " 2";
    pQSet2->InsertItem( 1, aPipetteColor, sColorPaletteN);
    pQSet2->SelectItem( 0 );

    pQSet3->SetStyle( pQSet3->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
    pQSet3->SetColCount( 1 );
    pQSet3->SetLineCount( 1 );
    pQSet3->InsertItem( 1, aPipetteColor );
    sColorPaletteN = sColorPalette;
    sColorPaletteN += " 3";
    pQSet3->InsertItem( 1, aPipetteColor, sColorPaletteN);
    pQSet3->SelectItem( 0 );

    pQSet4->SetStyle( pQSet4->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
    pQSet4->SetColCount( 1 );
    pQSet4->SetLineCount( 1 );
    pQSet4->InsertItem( 1, aPipetteColor );
    sColorPaletteN = sColorPalette;
    sColorPaletteN += " 4";
    pQSet4->InsertItem( 1, aPipetteColor, sColorPaletteN);
    pQSet4->SelectItem( 0 );

    pQSet1->Show();
@@ -1228,6 +1240,51 @@ void SvxBmpMask::SetAccessibleNames (void)
    sSourceColorN = sSourceColor;
    sSourceColorN += " 4";
    aCbx4.SetAccessibleName (sSourceColorN);
    // set the accessible name for valueset
    OUString sColorPalette (BMP_RESID( RID_SVXDLG_BMPMASK_STR_PALETTE));
    OUString sColorPaletteN;
    sColorPaletteN = sColorPalette;
    sColorPaletteN += " 1";
    pQSet1->SetText (sColorPaletteN);
    sColorPaletteN = sColorPalette;
    sColorPaletteN += " 2";
    pQSet2->SetText (sColorPaletteN);
    sColorPaletteN = sColorPalette;
    sColorPaletteN += " 3";
    pQSet3->SetText (sColorPaletteN);
    sColorPaletteN = sColorPalette;
    sColorPaletteN += " 4";
    pQSet4->SetText (sColorPaletteN);
    // set the accessible for replace with spin boxes.
    OUString sTolerance(BMP_RESID( RID_SVXDLG_BMPMASK_STR_TOLERANCE));
    OUString sToleranceN;
    sToleranceN = sTolerance;
    sToleranceN += " 1";
    aSp1.SetAccessibleName (sToleranceN);
    sToleranceN = sTolerance;
    sToleranceN += " 2";
    aSp2.SetAccessibleName (sToleranceN);
    sToleranceN = sTolerance;
    sToleranceN += " 3";
    aSp3.SetAccessibleName (sToleranceN);
    sToleranceN = sTolerance;
    sToleranceN += " 4";
    aSp4.SetAccessibleName (sToleranceN);
    // set the accessible for replace with combo boxes.
    OUString sReplaceWith(BMP_RESID( RID_SVXDLG_BMPMASK_STR_REPLACEWITH));
    OUString sReplaceWithN;
    sReplaceWithN = sReplaceWith;
    sReplaceWithN += " 1";
    aLbColor1.SetAccessibleName (sReplaceWithN);
    sReplaceWithN = sReplaceWith;
    sReplaceWithN += " 2";
    aLbColor2.SetAccessibleName (sReplaceWithN);
    sReplaceWithN = sReplaceWith;
    sReplaceWithN += " 3";
    aLbColor3.SetAccessibleName (sReplaceWithN);
    sReplaceWithN = sReplaceWith;
    sReplaceWithN += " 4";
    aLbColor4.SetAccessibleName (sReplaceWithN);
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 24fc2ce..7315edf 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -149,7 +149,8 @@ void SvxShowCharSet::MouseButtonDown( const MouseEvent& rMEvt )
            CaptureMouse();

            int nIndex = PixelToMapIndex( rMEvt.GetPosPixel() );
            SelectIndex( nIndex );
        // Fire the focus event
            SelectIndex( nIndex , sal_True);
        }

        if ( !(rMEvt.GetClicks() % 2) )
@@ -190,7 +191,8 @@ void SvxShowCharSet::MouseMove( const MouseEvent& rMEvt )
            aPos.Y() = aSize.Height()-5;

        int nIndex = PixelToMapIndex( aPos );
        SelectIndex( nIndex );
    // Fire the focus event.
        SelectIndex( nIndex , sal_True );
    }
}

@@ -629,12 +631,18 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, sal_Bool bFocus )
        if( m_pAccessible )
        {
            ::svx::SvxShowCharSetItem* pItem = ImplGetItem(nSelectedIndex);
            m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
            // Don't fire the focus event.
            if ( bFocus )
                m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
            else
                m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set

            OSL_ENSURE(pItem->m_pItem,"No accessible created!");
            Any aOldAny, aNewAny;
            aNewAny <<= AccessibleStateType::FOCUSED;
            pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
            // Don't fire the focus event.
            if ( bFocus )
                pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );

            aNewAny <<= AccessibleStateType::SELECTED;
            pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 8ed8014..1081bf4 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -31,6 +31,10 @@
#include <vcl/region.hxx>
#include <vcl/gradient.hxx>
#include <vcl/hatch.hxx>
#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include "svxpixelctlaccessiblecontext.hxx"
#include <svtools/colorcfg.hxx>
#include <svxrectctaccessiblecontext.hxx>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -582,6 +586,13 @@ Point SvxRectCtl::SetActualRPWithoutInvalidate( RECT_POINT eNewRP )
void SvxRectCtl::GetFocus()
{
    SetFocusRect();
    // Send the accessible focused event
    Control::GetFocus();
    // Send accessibility event.
    if(pAccContext)
    {
        pAccContext->FireChildFocus(GetActualRP());
    }
}


@@ -667,7 +678,7 @@ void SvxRectCtl::SetActualRP( RECT_POINT eNewRP )

    // notify accessibility object about change
    if( pAccContext )
        pAccContext->selectChild( eNewRP );
        pAccContext->selectChild( eNewRP /* MT, bFireFocus */ );
}

void SvxRectCtl::SetState( CTL_STATE nState )
@@ -761,10 +772,74 @@ void SvxRectCtl::SetCS(CTL_STYLE eNew)

// Control for editing bitmaps

::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SvxPixelCtl::CreateAccessible()
{
    if(!m_xAccess.is())
    {
        m_xAccess = m_pAccess =  new SvxPixelCtlAccessible(*this);
    }
    return m_xAccess;
}

//Logic Pixel
long SvxPixelCtl::PointToIndex(const Point &aPt) const
{
    sal_uInt16  nX, nY;

    nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
    nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );

    return nX + nY * nLines ;
}

Point SvxPixelCtl::IndexToPoint(long nIndex) const
{
    DBG_ASSERT(nIndex >= 0 && nIndex < nSquares ," Check Index");

    sal_uInt16 nXIndex = nIndex % nLines ;
    sal_uInt16 nYIndex = sal_uInt16(nIndex / nLines) ;

    Point aPtTl;
    aPtTl.Y() = aRectSize.Height() * nYIndex / nLines + 1;
    aPtTl.X() = aRectSize.Width() * nXIndex / nLines + 1;

    return aPtTl;
}

long SvxPixelCtl::GetFoucsPosIndex() const
{
    return aFocusPosition.getX() + aFocusPosition.getY() * nLines ;
}

long SvxPixelCtl::ShowPosition( const Point &pt)
{
    Point aPt = PixelToLogic( pt );

    sal_uInt16  nX, nY;
    nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
    nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );

    ChangePixel( nX + nY * nLines );

    //Solution:Set new focus position and repaint
    //Invalidate( Rectangle( aPtTl, aPtBr ) );
    aFocusPosition.setX(nX);
    aFocusPosition.setY(nY);
    Invalidate(Rectangle(Point(0,0),aRectSize));

    Window *pTabPage = getNonLayoutParent(this);
    if (pTabPage && WINDOW_TABPAGE == pTabPage->GetType())
        ( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy

    return GetFoucsPosIndex();

}

SvxPixelCtl::SvxPixelCtl(Window* pParent, sal_uInt16 nNumber)
    : Control(pParent, WB_BORDER)
    , nLines(nNumber)
    , bPaintable(true)
    , aFocusPosition(0,0)
{
    SetPixelColor( Color( COL_BLACK ) );
    SetBackgroundColor( Color( COL_WHITE ) );
@@ -773,6 +848,7 @@ SvxPixelCtl::SvxPixelCtl(Window* pParent, sal_uInt16 nNumber)
    nSquares = nLines * nLines;
    pPixel = new sal_uInt16[ nSquares ];
    memset(pPixel, 0, nSquares * sizeof(sal_uInt16));
    m_pAccess=NULL;
}

void SvxPixelCtl::Resize()
@@ -814,25 +890,18 @@ void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt )
    if (!aRectSize.Width() || !aRectSize.Height())
        return;

    Point aPt = PixelToLogic( rMEvt.GetPosPixel() );
    Point aPtTl, aPtBr;
    sal_uInt16  nX, nY;
    //Grab focus when click in window
    if (!HasFocus())
    {
        GrabFocus();
    }

    nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
    nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );
    long nIndex = ShowPosition(rMEvt.GetPosPixel());

    ChangePixel( nX + nY * nLines );

    aPtTl.X() = aRectSize.Width() * nX / nLines + 1;
    aPtBr.X() = aRectSize.Width() * (nX + 1) / nLines - 1;
    aPtTl.Y() = aRectSize.Height() * nY / nLines + 1;
    aPtBr.Y() = aRectSize.Height() * (nY + 1) / nLines - 1;

    Invalidate( Rectangle( aPtTl, aPtBr ) );

    Window *pTabPage = getNonLayoutParent(this);
    if (pTabPage && WINDOW_TABPAGE == pTabPage->GetType())
        ((SvxTabPage*)pTabPage)->PointChanged(this, RP_MM); // RectPoint is a dummy
    if(m_pAccess)
    {
        m_pAccess->NotifyChild(nIndex,sal_True, sal_True);
    }
}

// Draws the Control (Rectangle with nine circles)
@@ -882,6 +951,11 @@ void SvxPixelCtl::Paint( const Rectangle& )
                DrawRect( Rectangle( aPtTl, aPtBr ) );
            }
        }
        //Draw visual focus when has focus
        if( HasFocus() )
        {
            ShowFocus(implCalFocusRect(aFocusPosition));
        }
    } // bPaintable
    else
    {
@@ -892,6 +966,129 @@ void SvxPixelCtl::Paint( const Rectangle& )
    }
}

//Calculate visual focus rectangle via focus position
Rectangle SvxPixelCtl::implCalFocusRect( const Point& aPosition )
{
    long nLeft,nTop,nRight,nBottom;
    long i,j;
    i = aPosition.Y();
    j = aPosition.X();
    nLeft = aRectSize.Width() * j / nLines + 1;
    nRight = aRectSize.Width() * (j + 1) / nLines - 1;
    nTop = aRectSize.Height() * i / nLines + 1;
    nBottom = aRectSize.Height() * (i + 1) / nLines - 1;
    return Rectangle(nLeft,nTop,nRight,nBottom);
}

//Solution:Keyboard fucntion
void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt )
{
    KeyCode aKeyCode = rKEvt.GetKeyCode();
    sal_uInt16 nCode = aKeyCode.GetCode();
    sal_Bool bIsMod = aKeyCode.IsShift() || aKeyCode.IsMod1() || aKeyCode.IsMod2();

    if( !bIsMod )
    {
        Point pRepaintPoint( aRectSize.Width() *( aFocusPosition.getX() - 1)/ nLines - 1,
                             aRectSize.Height() *( aFocusPosition.getY() - 1)/ nLines -1
                            );
        Size  mRepaintSize( aRectSize.Width() *3/ nLines + 2,aRectSize.Height() *3/ nLines + 2);
        Rectangle mRepaintRect( pRepaintPoint, mRepaintSize );
        sal_Bool bFocusPosChanged=sal_False;
        switch(nCode)
        {
            case KEY_LEFT:
                if((aFocusPosition.getX() >= 1))
                {
                    aFocusPosition.setX( aFocusPosition.getX() - 1 );
                    Invalidate(mRepaintRect);
                    bFocusPosChanged=sal_True;
                }
                break;
            case KEY_RIGHT:
                if( aFocusPosition.getX() < (nLines - 1) )
                {
                    aFocusPosition.setX( aFocusPosition.getX() + 1 );
                    Invalidate(mRepaintRect);
                    bFocusPosChanged=sal_True;
                }
                break;
            case KEY_UP:
                if((aFocusPosition.getY() >= 1))
                {
                    aFocusPosition.setY( aFocusPosition.getY() - 1 );
                    Invalidate(mRepaintRect);
                    bFocusPosChanged=sal_True;
                }
                break;
            case KEY_DOWN:
                if( aFocusPosition.getY() < ( nLines - 1 ) )
                {
                    aFocusPosition.setY( aFocusPosition.getY() + 1 );
                    Invalidate(mRepaintRect);
                    bFocusPosChanged=sal_True;
                }
                break;
            case KEY_SPACE:
                ChangePixel( sal_uInt16(aFocusPosition.getX() + aFocusPosition.getY() * nLines) );
                Invalidate( implCalFocusRect(aFocusPosition) );
                break;
            default:
                Control::KeyInput( rKEvt );
                return;
        }
        if(m_xAccess.is())
        {
            long nIndex = GetFoucsPosIndex();
            switch(nCode)
            {
            case KEY_LEFT:
            case KEY_RIGHT:
            case KEY_UP:
            case KEY_DOWN:
                if (bFocusPosChanged)
                {
                    m_pAccess->NotifyChild(nIndex,sal_False,sal_False);
                }
                break;
            case KEY_SPACE:
                m_pAccess->NotifyChild(nIndex,sal_False,sal_True);
                break;
            default:
                break;
            }
        }
    }
    else
    {
        Control::KeyInput( rKEvt );
    }
}

//Draw focus when get focus
void SvxPixelCtl::GetFocus()
{
    Invalidate(implCalFocusRect(aFocusPosition));

    if(m_pAccess)
    {
        m_pAccess->NotifyChild(GetFoucsPosIndex(),sal_True,sal_False);
    }

    Control::GetFocus();
}

//Hide focus when lose focus
void SvxPixelCtl::LoseFocus()
{
    HideFocus();
    if (m_pAccess)
    {
        m_pAccess->LoseFocus();
    }
    Control::LoseFocus();
}

void SvxPixelCtl::SetXBitmap( const BitmapEx& rBitmapEx )
{
    BitmapColor aBack;
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index f29a42a..a280289 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -25,6 +25,8 @@
#include "frmselimpl.hxx"
#include "AccessibleFrameSelector.hxx"
#include <svx/dialmgr.hxx>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>

#include <svx/dialogs.hrc>
#include "frmsel.hrc"
@@ -37,8 +39,9 @@ using namespace ::editeng;
namespace svx {

using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Any;
using ::com::sun::star::accessibility::XAccessible;

using namespace ::com::sun::star::accessibility;
// ============================================================================
// global functions from framebordertype.hxx

@@ -719,10 +722,22 @@ void FrameSelectorImpl::DoInvalidate( bool bFullRepaint )
void FrameSelectorImpl::SetBorderState( FrameBorder& rBorder, FrameBorderState eState )
{
    DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SetBorderState - access to disabled border" );
    Any aOld;
    Any aNew;
    Any& rMod = eState == FRAMESTATE_SHOW ? aNew : aOld;
    rMod <<= AccessibleStateType::CHECKED;
    Reference< XAccessible > xRet;
    size_t nVecIdx = static_cast< size_t >( rBorder.GetType() );
    if( GetBorder(rBorder.GetType()).IsEnabled() && (1 <= nVecIdx) && (nVecIdx <= maChildVec.size()) )
        xRet = mxChildVec[ --nVecIdx ];
    a11y::AccFrameSelector* pFrameSelector = static_cast<a11y::AccFrameSelector*>(xRet.get());

    if( eState == FRAMESTATE_SHOW )
        SetBorderCoreStyle( rBorder, &maCurrStyle );
    else
        rBorder.SetState( eState );
    if (pFrameSelector)
            pFrameSelector->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOld, aNew );
    DoInvalidate( true );
}

@@ -942,9 +957,21 @@ bool FrameSelector::IsBorderSelected( FrameBorderType eBorder ) const
    return mxImpl->GetBorder( eBorder ).IsSelected();
}

void FrameSelector::SelectBorder( FrameBorderType eBorder, bool bSelect )
void FrameSelector::SelectBorder( FrameBorderType eBorder, bool bSelect /*, bool bFocus */ )
{
    mxImpl->SelectBorder( mxImpl->GetBorderAccess( eBorder ), bSelect );
    // MT: bFireFox as API parameter is ugly...
    // if (bFocus)
    {
        Reference< XAccessible > xRet = GetChildAccessible(eBorder);
        a11y::AccFrameSelector* pFrameSelector = static_cast<a11y::AccFrameSelector*>(xRet.get());
        if (pFrameSelector)
        {
            Any aOldValue, aNewValue;
            aNewValue <<= AccessibleStateType::FOCUSED;
            pFrameSelector->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
        }
    }
}

bool FrameSelector::IsAnyBorderSelected() const
@@ -1090,7 +1117,8 @@ void FrameSelector::MouseButtonDown( const MouseEvent& rMEvt )
                if( !(*aIt)->IsSelected() )
                {
                    bNewSelected = true;
                    mxImpl->SelectBorder( **aIt, true );
                    //mxImpl->SelectBorder( **aIt, true );
                    SelectBorder((**aIt).GetType(), true);
                }
            }
            else
@@ -1189,6 +1217,29 @@ void FrameSelector::GetFocus()
    mxImpl->DoInvalidate( false );
    if( mxImpl->mxAccess.is() )
        mxImpl->mpAccess->NotifyFocusListeners( sal_True );
    if (IsAnyBorderSelected())
    {
        FrameBorderType borderType = FRAMEBORDER_NONE;
        if (mxImpl->maLeft.IsSelected())
            borderType = FRAMEBORDER_LEFT;
        else if (mxImpl->maRight.IsSelected())
            borderType = FRAMEBORDER_RIGHT;
        else if (mxImpl->maTop.IsSelected())
            borderType = FRAMEBORDER_TOP;
        else if (mxImpl->maBottom.IsSelected())
            borderType = FRAMEBORDER_BOTTOM;
        else if (mxImpl->maHor.IsSelected())
            borderType = FRAMEBORDER_HOR;
        else if (mxImpl->maVer.IsSelected())
            borderType = FRAMEBORDER_VER;
        else if (mxImpl->maTLBR.IsSelected())
            borderType = FRAMEBORDER_TLBR;
        else if (mxImpl->maBLTR.IsSelected())
            borderType = FRAMEBORDER_BLTR;
        SelectBorder(borderType);
    }
    for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
            mxImpl->SetBorderState( **aIt, FRAMESTATE_SHOW );
    Control::GetFocus();
}

diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 0b2fcad..e6afc1c 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -55,6 +55,7 @@
#include <svx/svxitems.hrc>

#include <svl/srchitem.hxx>
#include <svx/AccessibleSvxFindReplaceDialog.hxx>
#include <svx/pageitem.hxx>
#include "srchctrl.hxx"
#include <svx/dialmgr.hxx>
@@ -64,6 +65,8 @@
#include <svx/svxdlg.hxx>

using namespace com::sun::star::i18n;
using namespace com::sun::star::uno;
using namespace com::sun::star::accessibility;
using namespace com::sun::star;
using namespace comphelper;

@@ -252,6 +255,8 @@ void SearchAttrItemList::Remove(size_t nPos, size_t nLen)
SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind )
    : SfxModelessDialog(&rBind, pChildWin, pParent, "FindReplaceDialog",
        "svx/ui/findreplacedialog.ui")
    , mpDocWin(NULL)
    , mbSuccess(false)
    , rBindings(rBind)
    , bWriter(false)
    , bSearch(true)
@@ -2263,6 +2268,21 @@ void SvxSearchDialog::SaveToModule_Impl()
    rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SFX_CALLMODE_SLOT, ppArgs );
}

::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
        SvxSearchDialog::GetComponentInterface( sal_Bool bCreate )
{
    ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer
        (Window::GetComponentInterface(false));
    if ( !xPeer.is() && bCreate )
    {
        ::com::sun::star::awt::XWindowPeer* mxPeer = new VCLXSvxFindReplaceDialog(this);
        SetComponentInterface(mxPeer);
        return mxPeer;
    }
    else
        return xPeer;
}

// class SvxSearchDialogWrapper ------------------------------------------

SFX_IMPL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper, SID_SEARCH_DLG);
diff --git a/svx/source/inc/AccessibleFrameSelector.hxx b/svx/source/inc/AccessibleFrameSelector.hxx
index d42c34b..9dd4325 100644
--- a/svx/source/inc/AccessibleFrameSelector.hxx
+++ b/svx/source/inc/AccessibleFrameSelector.hxx
@@ -106,16 +106,13 @@ public:

    void    Invalidate();
    void    NotifyFocusListeners(sal_Bool bGetFocus);
    void    NotifyAccessibleEvent( const sal_Int16 _nEventId, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Any& _rNewValue );

protected:
    DECL_LINK( WindowEventListener, VclSimpleEvent* );

    virtual void    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );

    void    NotifyAccessibleEvent( const sal_Int16 _nEventId,
                                   const ::com::sun::star::uno::Any& _rOldValue,
                                   const ::com::sun::star::uno::Any& _rNewValue );

private:
    void                IsValid() throw (::com::sun::star::uno::RuntimeException);
    void                RemoveFrameSelEventListener();
diff --git a/svx/source/inc/svxpixelctlaccessiblecontext.hxx b/svx/source/inc/svxpixelctlaccessiblecontext.hxx
new file mode 100644
index 0000000..ea3a0da
--- /dev/null
+++ b/svx/source/inc/svxpixelctlaccessiblecontext.hxx
@@ -0,0 +1,304 @@
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
 */
#ifndef _SVXPIXELACCESSIBLECONTEXT_HXX
#define _SVXPIXELACCESSIBLECONTEXT_HXX

#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <com/sun/star/accessibility/XAccessibleValue.hpp>

#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <cppuhelper/weak.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/compbase6.hxx>
#include <cppuhelper/compbase7.hxx>
#include <cppuhelper/compbase5.hxx>
#include <comphelper/broadcasthelper.hxx>
#include <cppuhelper/implbase6.hxx>
#include <comphelper/servicehelper.hxx>

#include <svx/rectenum.hxx>
#include <tools/gen.hxx>


namespace com { namespace sun { namespace star { namespace awt {
    struct Point;
    struct Rectangle;
    struct Size;
    class XFocusListener;
} } } };
class SvxPixelCtl;


typedef ::cppu::WeakAggComponentImplHelper5<
            ::com::sun::star::accessibility::XAccessible,
            ::com::sun::star::accessibility::XAccessibleComponent,
            ::com::sun::star::accessibility::XAccessibleContext,
            ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
            ::com::sun::star::lang::XServiceInfo >
            SvxPixelCtlAccessibleChild_BASE;

class SvxPixelCtlAccessibleChild :
    public ::comphelper::OBaseMutex,
    public SvxPixelCtlAccessibleChild_BASE
{
    SvxPixelCtl* mrParentWindow;
    ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
       void IsValid() throw (::com::sun::star::uno::RuntimeException);
    sal_Bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color
    Point maPoint;
    Rectangle*  mpBoundingBox;
    /// index of child in parent
    long                                mnIndexInParent;
    /// Mutex guarding this object.
    ::osl::Mutex                        m_aMutex;
public:
    SvxPixelCtlAccessibleChild(
                SvxPixelCtl* rWindow,
                sal_Bool bPixelColorOrBG,
                const Point& aPoint,
                const Rectangle& rBounds,
                const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xParent,
                long nIndexInParent );
    ~SvxPixelCtlAccessibleChild();

    //XAccessible
    virtual ::com::sun::star::uno::Reference< ::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< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::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);
    virtual OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);


    //XAccessibleComponent
    virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
    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_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);

    //XServiceInfo
    virtual OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);

    //Methods for XAccessibleEventBroadcaster
    sal_uInt32 mnClientId;

    virtual void SAL_CALL
        addAccessibleEventListener(
            const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
            throw( com::sun::star::uno::RuntimeException );

    virtual void SAL_CALL
        removeAccessibleEventListener(
            const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
            throw( com::sun::star::uno::RuntimeException );
    void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent );

    //Solution: Add the event handling method
    void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew);
    virtual void SAL_CALL disposing();

    virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException );

    virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException );

    /// @returns true if it's disposed or in disposing
    inline sal_Bool IsAlive( void ) const;
    /// @returns true if it's not disposed and no in disposing
    inline sal_Bool IsNotAlive( void ) const;
    /// throws the exception DisposedException if it's not alive
    void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException );


    void CheckChild();
    void SelectChild( sal_Bool bSelect);
    void ChangePixelColorOrBG(sal_Bool bPixelColorOrBG){ m_bPixelColorOrBG = bPixelColorOrBG ;}
    OUString GetName();
};


typedef ::cppu::WeakAggComponentImplHelper6<
            ::com::sun::star::accessibility::XAccessible,
            ::com::sun::star::accessibility::XAccessibleComponent,
            ::com::sun::star::accessibility::XAccessibleContext,
            ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
            ::com::sun::star::accessibility::XAccessibleSelection,
//          ::com::sun::star::accessibility::XAccessibleTable,
            ::com::sun::star::lang::XServiceInfo >
            SvxPixelCtlAccessible_BASE;

class SvxPixelCtlAccessible :
    public ::comphelper::OBaseMutex,
    public SvxPixelCtlAccessible_BASE
{
    SvxPixelCtl* pPixelCtl;
    void IsValid() throw (::com::sun::star::uno::RuntimeException);

public:
    SvxPixelCtlAccessible(SvxPixelCtl& rWindow);
    ~SvxPixelCtlAccessible();

    void ensureIsAlive() const throw ( ::com::sun::star::lang::DisposedException );

    //XAccessible
    virtual ::com::sun::star::uno::Reference< ::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< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::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);
    virtual OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);


    //XAccessibleComponent
    virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
    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_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
    //XServiceInfo
    virtual OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
    // XAccessibleSelection
    void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException);
    void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException);
    sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
    ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);

    //Methods for XAccessibleEventBroadcaster
    sal_uInt32 mnClientId;

    virtual void SAL_CALL
        addAccessibleEventListener(
            const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
            throw( com::sun::star::uno::RuntimeException );

    virtual void SAL_CALL
        removeAccessibleEventListener(
            const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
            throw( com::sun::star::uno::RuntimeException );
    void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent );
    //Solution: Add the event handling method
    void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew);
    virtual void SAL_CALL disposing();

    /// select child
    void SelectChild( Point pos );
    void SelectChild( long nIndex);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
         CreateChild (long nIndex, Point mPoint);


    void LoseFocus();

    void Invalidate();
    /// @returns true if it's disposed or in disposing
    inline sal_Bool IsAlive( void ) const;
    /// @returns true if it's not disposed and no in disposing
    inline sal_Bool IsNotAlive( void ) const;
    /// throws the exception DisposedException if it's not alive
    void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException );

protected:
    /** @attention  This method requires locked mutex's and a living object.
        @throws <type>IndexOutOfBoundsException</type>
        If the specified row index is invalid. */
    void ensureIsValidRow( sal_Int32 nRow )
        throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
    /** @attention  This method requires locked mutex's and a living object.
        @throws <type>IndexOutOfBoundsException</type>
        If the specified column index is invalid. */
    void ensureIsValidColumn( sal_Int32 nColumn )
        throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
    /** @attention  This method requires locked mutex's and a living object.
        @throws <type>IndexOutOfBoundsException</type>
        If the specified cell address is invalid. */
    void ensureIsValidAddress( sal_Int32 nRow, sal_Int32 nColumn )
        throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
    /** @attention  This method requires locked mutex's and a living object.
        @throws <type>IndexOutOfBoundsException</type>
        If the specified child index is invalid. */
    void ensureIsValidIndex( sal_Int32 nChildIndex )
        throw ( ::com::sun::star::lang::IndexOutOfBoundsException );


    ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> m_xCurChild;
public:
    void NotifyChild(long nIndex,sal_Bool bSelect ,sal_Bool bCheck);
};

inline sal_Bool SvxPixelCtlAccessible::IsAlive( void ) const
{
    return !rBHelper.bDisposed && !rBHelper.bInDispose;
}

inline sal_Bool SvxPixelCtlAccessible::IsNotAlive( void ) const
{
    return rBHelper.bDisposed || rBHelper.bInDispose;
}

inline sal_Bool SvxPixelCtlAccessibleChild::IsAlive( void ) const
{
    return !rBHelper.bDisposed && !rBHelper.bInDispose;
}

inline sal_Bool SvxPixelCtlAccessibleChild::IsNotAlive( void ) const
{
    return rBHelper.bDisposed || rBHelper.bInDispose;
}


#endif
diff --git a/svx/source/inc/svxrectctaccessiblecontext.hxx b/svx/source/inc/svxrectctaccessiblecontext.hxx
index f0e328a..7357b1c 100644
--- a/svx/source/inc/svxrectctaccessiblecontext.hxx
+++ b/svx/source/inc/svxrectctaccessiblecontext.hxx
@@ -27,6 +27,7 @@
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <com/sun/star/accessibility/XAccessibleAction.hpp>
#include <com/sun/star/accessibility/XAccessibleValue.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/uno/Reference.hxx>
@@ -39,8 +40,10 @@
#include <osl/mutex.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/compbase6.hxx>
#include <cppuhelper/compbase7.hxx>
#include <comphelper/broadcasthelper.hxx>
#include <cppuhelper/implbase6.hxx>
#include <cppuhelper/implbase7.hxx>
#include <comphelper/servicehelper.hxx>
#include <svx/rectenum.hxx>

@@ -238,7 +241,7 @@ protected:
        @param nIndexOfChild
            Index of the new child which should be selected.
    */
    void selectChild( long nIndexOfChild );
    void selectChild( long nIndexOfChild, sal_Bool bFireFocus = sal_True);

public:
    /** Selects a new child by point.
@@ -249,7 +252,10 @@ public:
        @param eButton
            Button which belongs to the child which should be selected.
    */
    void selectChild( RECT_POINT ePoint );
    void selectChild( RECT_POINT ePoint, sal_Bool bFireFocus = sal_True );
    void FireChildFocus( RECT_POINT eButton );
    //Add the event handling method
    void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew);

private:
    static ::com::sun::star::uno::Sequence< sal_Int8 > getUniqueId( void );
@@ -315,17 +321,16 @@ inline bool SvxRectCtlAccessibleContext::IsNotAlive( void ) const
    return rBHelper.bDisposed || rBHelper.bInDispose;
}


typedef ::cppu::WeakAggComponentImplHelper6<
typedef ::cppu::WeakAggComponentImplHelper7<
            ::com::sun::star::accessibility::XAccessible,
            ::com::sun::star::accessibility::XAccessibleComponent,
            ::com::sun::star::accessibility::XAccessibleContext,
            ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
            ::com::sun::star::accessibility::XAccessibleValue,
            ::com::sun::star::accessibility::XAccessibleAction,
            ::com::sun::star::lang::XServiceInfo >
            SvxRectCtlChildAccessibleContext_Base;


class SvxRectCtlChildAccessibleContext : public SvxRectCtlChildAccessibleContext_Base
{
public:
@@ -450,6 +455,11 @@ public:
    virtual ::com::sun::star::uno::Any SAL_CALL
        getMinimumValue() throw( ::com::sun::star::uno::RuntimeException );

    // XAccessibleAction
    virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
    virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
    //=====  XServiceInfo  ====================================================

    virtual OUString SAL_CALL
@@ -470,7 +480,8 @@ public:
    //===== internal ==========================================================

    /// Sets the checked status
    void setStateChecked( bool bChecked );
    void setStateChecked(bool bChecked, bool bFireFocus = true);
    void FireFocusEvent();

protected:
    virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException );
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 4a14f46..663c860 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -251,7 +251,7 @@ void NBOTypeMgrBase::StoreMapUnit_impl() {
        {
            eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
        } else {
            //Sym3_2508 sd use different sid for numbering rule
            //sd use different sid for numbering rule
            eState = pSet->GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem);
            if(eState == SFX_ITEM_SET)
            {
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 91207cb..783f046 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -3224,4 +3224,20 @@ void SdrObjCustomShape::impl_setUnoShape(const uno::Reference<uno::XInterface>& 
    mxCustomShapeEngine.set(0);
}

OUString SdrObjCustomShape::GetCustomShapeName()
{
    OUString sShapeName;
    OUString aEngine( ( (SdrCustomShapeEngineItem&)( *this ).GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE ) ).GetValue() );
    if ( aEngine.isEmpty() || aEngine.equalsAscii( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) )
    {
        OUString sShapeType;
        const OUString sType("Type");
        SdrCustomShapeGeometryItem& rGeometryItem( (SdrCustomShapeGeometryItem&)( *this ).GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
        Any* pAny = rGeometryItem.GetPropertyValueByName( sType );
        if ( pAny && ( *pAny >>= sShapeType ) )
            sShapeName = EnhancedCustomShapeTypeNames::GetAccName( sShapeType );
    }
    return sShapeName;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index b495c5b..4016094 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -3128,6 +3128,11 @@ void SdrObject::notifyShapePropertyChange( const ::svx::ShapeProperty _eProperty
        return pSvxShape->getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty );
}

const SdrObject* SdrObject::GetCaptionObj() const
{
    return pCaptionObj;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
//
// transformation interface for StarOfficeAPI. This implements support for
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 2929252..89a2ff9 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -788,6 +788,18 @@ void SdrOle2Obj::Init()

// -----------------------------------------------------------------------------

OUString SdrOle2Obj::GetStyleString()
{
    OUString strStyle;
    if( xObjRef.is() && xObjRef.IsChart() )
    {
        strStyle = xObjRef.GetChartType();
    }
    return strStyle;
}

// -----------------------------------------------------------------------------

SdrOle2Obj::~SdrOle2Obj()
{
    DBG_DTOR( SdrOle2Obj,NULL);
diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx
index 3204f2f..24792d5 100644
--- a/svx/source/table/accessiblecell.cxx
+++ b/svx/source/table/accessiblecell.cxx
@@ -28,7 +28,7 @@
#include <vcl/svapp.hxx>

#include <unotools/accessiblestatesethelper.hxx>

#include <comphelper/string.hxx>
#include <editeng/outlobj.hxx>
#include <svx/unoshtxt.hxx>
#include <svx/svdotext.hxx>
@@ -53,6 +53,8 @@ AccessibleCell::AccessibleCell( const ::com::sun::star::uno::Reference< ::com::s
, mpText( NULL )
, mxCell( rCell )
{
    //Init the pAccTable var
    pAccTable = dynamic_cast <AccessibleTableShape *> (rxParent.get());
}

// --------------------------------------------------------------------
@@ -223,7 +225,39 @@ Reference<XAccessibleStateSet> SAL_CALL AccessibleCell::getAccessibleStateSet (v
                else
                    pStateSet->RemoveState (AccessibleStateType::FOCUSED);
            }
            // Set the invisible state for merged cell
            if (mxCell.is() && mxCell->isMerged())
                pStateSet->RemoveState(AccessibleStateType::VISIBLE);
            else
                pStateSet->AddState(AccessibleStateType::VISIBLE);


            //Just when the parent table is not read-only,set states EDITABLE,RESIZABLE,MOVEABLE
            ::com::sun::star::uno::Reference<XAccessible> xTempAcc = getAccessibleParent();
            if( xTempAcc.is() )
            {
                ::com::sun::star::uno::Reference<XAccessibleContext>
                                        xTempAccContext = xTempAcc->getAccessibleContext();
                if( xTempAccContext.is() )
                {
                    ::com::sun::star::uno::Reference<XAccessibleStateSet> rState =
                        xTempAccContext->getAccessibleStateSet();
                    if( rState.is() )           {
                        com::sun::star::uno::Sequence<short> pStates = rState->getStates();
                        int count = pStates.getLength();
                        for( int iIndex = 0;iIndex < count;iIndex++ )
                        {
                            if( pStates[iIndex] == AccessibleStateType::EDITABLE )
                            {
                                pStateSet->AddState (AccessibleStateType::EDITABLE);
                                pStateSet->AddState (AccessibleStateType::RESIZABLE);
                                pStateSet->AddState (AccessibleStateType::MOVEABLE);
                                break;
                            }
                        }
                    }
                }
            }
            // Create a copy of the state set that may be modified by the
            // caller without affecting the current state set.
            xStateSet = Reference<XAccessibleStateSet>(new ::utl::AccessibleStateSetHelper (*pStateSet));
@@ -547,6 +581,78 @@ sal_Int32 SAL_CALL AccessibleCell::getAccessibleIndexInParent (void) throw (Runt
    return mnIndexInParent;
}

sdr::table::CellRef AccessibleCell::getCellRef()
{
    return mxCell;
}

OUString AccessibleCell::getCellName( sal_Int32 nCol, sal_Int32 nRow )
{
    OUStringBuffer aBuf;

    if (nCol < 26*26)
    {
        if (nCol < 26)
            aBuf.append( static_cast<sal_Unicode>( 'A' +
                        static_cast<sal_uInt16>(nCol)));
        else
        {
            aBuf.append( static_cast<sal_Unicode>( 'A' +
                        (static_cast<sal_uInt16>(nCol) / 26) - 1));
            aBuf.append( static_cast<sal_Unicode>( 'A' +
                        (static_cast<sal_uInt16>(nCol) % 26)));
        }
    }
    else
    {
        OUStringBuffer aStr;
        while (nCol >= 26)
        {
            sal_Int32 nC = nCol % 26;
            aStr.append(static_cast<sal_Unicode>( 'A' +
                    static_cast<sal_uInt16>(nC)));
            nCol = nCol - nC;
            nCol = nCol / 26 - 1;
        }
        aStr.append(static_cast<sal_Unicode>( 'A' +
                static_cast<sal_uInt16>(nCol)));
        aBuf.append(comphelper::string::reverseString(aStr.makeStringAndClear()));
    }
    aBuf.append( OUString::number(nRow+1) );
    return aBuf.makeStringAndClear();
}

OUString SAL_CALL AccessibleCell::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException)
{
    ThrowIfDisposed ();
    SolarMutexGuard aSolarGuard;

    if( pAccTable )
    {
        try
        {
            sal_Int32 nRow = 0, nCol = 0;
            pAccTable->getColumnAndRow(mnIndexInParent, nCol, nRow);
            return getCellName( nCol, nRow );
        }
        catch(const Exception&)
        {
        }
    }

    return AccessibleCellBase::getAccessibleName();
}

void AccessibleCell::UpdateChildren()
{
    if (mpText)
        mpText->UpdateChildren();
}

/* MT: Above getAccessibleName was introduced with IA2 CWS, while below was introduce in 3.3 meanwhile. Check which one is correct
+If this is correct, we also don't need  sdr::table::CellRef getCellRef(), UpdateChildren(), getCellName( sal_Int32 nCol, sal_Int32 nRow ) above
+

OUString SAL_CALL AccessibleCell::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException)
{
    ThrowIfDisposed ();
@@ -557,6 +663,7 @@ OUString SAL_CALL AccessibleCell::getAccessibleName (void) throw (::com::sun::st

    return AccessibleCellBase::getAccessibleName();
}
*/

} // end of namespace accessibility

diff --git a/svx/source/table/accessiblecell.hxx b/svx/source/table/accessiblecell.hxx
index db9710d..2cfc9ee 100644
--- a/svx/source/table/accessiblecell.hxx
+++ b/svx/source/table/accessiblecell.hxx
@@ -32,6 +32,7 @@
#include <svx/IAccessibleViewForwarderListener.hxx>
#include <svx/AccessibleTextHelper.hxx>
#include <svx/AccessibleShapeTreeInfo.hxx>
#include <svx/AccessibleTableShape.hxx>

#include <cppuhelper/implbase1.hxx>

@@ -71,6 +72,9 @@ public:
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet(void) throw(::com::sun::star::uno::RuntimeException);
    virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(void) throw(::com::sun::star::uno::RuntimeException);
    virtual OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
    sdr::table::CellRef getCellRef();
    void UpdateChildren();
    OUString getCellName( sal_Int32 nCol, sal_Int32 nRow );

    // XAccessibleComponent
    virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint) throw (::com::sun::star::uno::RuntimeException);
@@ -107,6 +111,8 @@ public:
    */
    inline void setIndexInParent(sal_Int32 _nIndex) { mnIndexInParent = _nIndex; }

    //Get the parent table
    AccessibleTableShape* GetParentTable() { return pAccTable; }
protected:
    /// Bundle of information passed to all shapes in a document tree.
    AccessibleShapeTreeInfo maShapeTreeInfo;
@@ -122,6 +128,8 @@ protected:
    /// This method is called from the component helper base class while disposing.
    virtual void SAL_CALL disposing (void);

    AccessibleTableShape *pAccTable;

private:
    explicit AccessibleCell(void);  // not implemented
    explicit AccessibleCell(const AccessibleCell&); // not implemented
diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx
index a5e910e..4d76285 100644
--- a/svx/source/table/accessibletableshape.cxx
+++ b/svx/source/table/accessibletableshape.cxx
@@ -33,6 +33,9 @@
#include <algorithm>

#include <cppuhelper/implbase1.hxx>
#include <svx/svdotable.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>


using namespace ::accessibility;
@@ -84,12 +87,17 @@ public:
    Reference< XTable > mxTable;
    AccessibleCellMap maChildMap;
    Reference< XAccessible> mxAccessible;
    sal_Int32 mRowCount, mColCount;
    //get the cached AccessibleCell from XCell
    Reference< AccessibleCell > getAccessibleCell (Reference< XCell > xCell);
};

//-----------------------------------------------------------------------------

AccessibleTableShapeImpl::AccessibleTableShapeImpl( AccessibleShapeTreeInfo& rShapeTreeInfo )
: mrShapeTreeInfo( rShapeTreeInfo )
, mRowCount(0)
, mColCount(0)
{
}

@@ -104,6 +112,13 @@ void AccessibleTableShapeImpl::init( const Reference< XAccessible>& xAccessible,
    {
        Reference< XModifyListener > xListener( this );
        mxTable->addModifyListener( xListener );
        //register the listener with table model
        Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(xTable, UNO_QUERY);
        Reference< ::com::sun::star::view::XSelectionChangeListener > xSelListener( xAccessible, UNO_QUERY );
        if (xSelSupplier.is())
            xSelSupplier->addSelectionChangeListener(xSelListener);
        mRowCount = mxTable->getRowCount();
        mColCount = mxTable->getColumnCount();
    }
}

@@ -113,6 +128,11 @@ void AccessibleTableShapeImpl::dispose()
{
    if( mxTable.is() )
    {
        //remove all the cell's acc object in table's dispose.
        for( AccessibleCellMap::iterator iter( maChildMap.begin() ); iter != maChildMap.end(); iter++ )
        {
            (*iter).second->dispose();
        }
        Reference< XModifyListener > xListener( this );
        mxTable->removeModifyListener( xListener );
        mxTable.clear();
@@ -121,7 +141,20 @@ void AccessibleTableShapeImpl::dispose()
}

//-----------------------------------------------------------------------------
//get the cached AccessibleCell from XCell
Reference< AccessibleCell > AccessibleTableShapeImpl::getAccessibleCell (Reference< XCell > xCell)
{
    AccessibleCellMap::iterator iter( maChildMap.find( xCell ) );

    if( iter != maChildMap.end() )
    {
        Reference< AccessibleCell > xChild( (*iter).second.get() );
        return xChild;
    }
    return Reference< AccessibleCell >();
}

//-----------------------------------------------------------------------------
Reference< XAccessible > AccessibleTableShapeImpl::getAccessibleChild( sal_Int32 nChildIndex ) throw(IndexOutOfBoundsException)
{
    sal_Int32 nColumn = 0, nRow = 0;
@@ -141,6 +174,7 @@ Reference< XAccessible > AccessibleTableShapeImpl::getAccessibleChild( sal_Int32

        rtl::Reference< AccessibleCell > xAccessibleCell( new AccessibleCell( mxAccessible, xCellRef, nChildIndex, mrShapeTreeInfo ) );

        xAccessibleCell->Init();
        maChildMap[xCell] = xAccessibleCell;

        xAccessibleCell->Init();
@@ -187,6 +221,13 @@ void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/ 
        const sal_Int32 nRowCount = mxTable->getRowCount();
        const sal_Int32 nColCount = mxTable->getColumnCount();

        sal_Bool bRowOrColumnChanged = sal_False;
        if (mRowCount != nRowCount || mColCount != nColCount )
        {
            bRowOrColumnChanged = sal_True;
            mRowCount = nRowCount;
            mColCount = nColCount;
        }
        sal_Int32 nChildIndex = 0;

        for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
@@ -200,12 +241,44 @@ void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/ 
                {
                    rtl::Reference< AccessibleCell > xAccessibleCell( (*iter).second );
                    xAccessibleCell->setIndexInParent( nChildIndex );
                    xAccessibleCell->CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any());
                    xAccessibleCell->UpdateChildren();
                    // If row or column count is changed, there is split or merge, so all cell's acc name should be updated
                    if (bRowOrColumnChanged)
                    {
                        xAccessibleCell->SetAccessibleName(xAccessibleCell->getAccessibleName(), AccessibleContextBase::ManuallySet);
                    }
                    // For merged cell, add invisible & disabled state.
                    Reference< XMergeableCell > xMergedCell( mxTable->getCellByPosition( nCol, nRow ),  UNO_QUERY );
                    if (xMergedCell.is() && xMergedCell->isMerged())
                    {
                        xAccessibleCell->ResetState(AccessibleStateType::VISIBLE);
                        xAccessibleCell->ResetState(AccessibleStateType::ENABLED);
                        // IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent
                        // xAccessibleCell->SetState(AccessibleStateType::OFFSCREEN);
                        xAccessibleCell->ResetState(AccessibleStateType::SHOWING);
                    }
                    else
                    {
                        xAccessibleCell->SetState(AccessibleStateType::VISIBLE);
                        xAccessibleCell->SetState(AccessibleStateType::ENABLED);
                        // IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent
                        // xAccessibleCell->ResetState(AccessibleStateType::OFFSCREEN);
                        xAccessibleCell->SetState(AccessibleStateType::SHOWING);
                    }

                    // move still existing cell from temporary child map to our child map
                    maChildMap[xCell] = xAccessibleCell;
                    aTempChildMap.erase( iter );
                }
                else
                {
                    CellRef xCellRef( dynamic_cast< Cell* >( xCell.get() ) );

                    rtl::Reference< AccessibleCell > xAccessibleCell( new AccessibleCell( mxAccessible, xCellRef, nChildIndex, mrShapeTreeInfo ) );

                    xAccessibleCell->Init();
                    maChildMap[xCell] = xAccessibleCell;
                }

                ++nChildIndex;
            }
@@ -218,6 +291,9 @@ void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/ 
        {
            (*iter).second->dispose();
        }
        //notify bridge to update the acc cache.
        AccessibleTableShape *pAccTable = dynamic_cast <AccessibleTableShape *> (mxAccessible.get());
        pAccTable->CommitChange(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
    }
    catch( Exception& )
    {
@@ -254,7 +330,7 @@ void AccessibleTableShape::Init()
{
    try
    {

        mnPreviousSelectionCount = 0;
        Reference< XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
        Reference< XTable > xTable( xSet->getPropertyValue("Model"), UNO_QUERY_THROW );

@@ -285,7 +361,15 @@ SvxTableController* AccessibleTableShape::getTableController()

Any SAL_CALL AccessibleTableShape::queryInterface( const Type& aType ) throw (RuntimeException)
{
    return AccessibleTableShape_Base::queryInterface( aType );
    if ( aType == ::getCppuType((Reference<XAccessibleTableSelection> *)0) )
    {
        Reference<XAccessibleTableSelection> xThis( this );
        Any aRet;
        aRet <<= xThis;
        return aRet;
    }
    else
        return AccessibleTableShape_Base::queryInterface( aType );
}

//-----------------------------------------------------------------------------
@@ -433,7 +517,16 @@ sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleColumnExtentAt( sal_Int32 

Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleRowHeaders(  ) throw (RuntimeException)
{
    Reference< XAccessibleTable > xRet( this ); // todo
    Reference< XAccessibleTable > xRet;
    SvxTableController* pController = getTableController();
    if( pController )
    {
        if( pController->isRowHeader() )
        {
            AccessibleTableHeaderShape* pTableHeader = new AccessibleTableHeaderShape( this, sal_True );
            xRet.set( pTableHeader );
        }
    }
    return xRet;
}

@@ -441,7 +534,16 @@ Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleRowHea

Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleColumnHeaders(  ) throw (RuntimeException)
{
    Reference< XAccessibleTable > xRet( this ); // todo
    Reference< XAccessibleTable > xRet;
    SvxTableController* pController = getTableController();
    if( pController )
    {
        if( pController->isColumnHeader() )
        {
            AccessibleTableHeaderShape* pTableHeader = new AccessibleTableHeaderShape( this, sal_False );
            xRet.set( pTableHeader );
        }
    }
    return xRet;
}

@@ -449,7 +551,36 @@ Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleColumn

Sequence< sal_Int32 > SAL_CALL AccessibleTableShape::getSelectedAccessibleRows(  ) throw (RuntimeException)
{
    Sequence< sal_Int32 > aRet;
    sal_Int32 nRow = getAccessibleRowCount();
    ::std::vector< sal_Bool > aSelected( nRow, sal_True );
    sal_Int32 nCount = nRow;
    for( sal_Int32 i = 0; i < nRow; i++ )
    {
        try
        {
            aSelected[i] = isAccessibleRowSelected( i );
        }
        catch( ... )
        {
            return Sequence< sal_Int32 >();
        }

        if( !aSelected[i] )
            nCount--;
    }
    Sequence < sal_Int32 > aRet( nCount );
    sal_Int32 *pRet = aRet.getArray();
    sal_Int32 nPos = 0;
    size_t nSize = aSelected.size();
    for( size_t i=0; i < nSize && nPos < nCount; i++ )
    {
        if( aSelected[i] )
        {
            *pRet++ = i;
            nPos++;
        }
    }

    return aRet;
}

@@ -457,7 +588,36 @@ Sequence< sal_Int32 > SAL_CALL AccessibleTableShape::getSelectedAccessibleRows( 

Sequence< sal_Int32 > SAL_CALL AccessibleTableShape::getSelectedAccessibleColumns(  ) throw (RuntimeException)
{
    Sequence< sal_Int32 > aRet;
    sal_Int32 nColumn = getAccessibleColumnCount();
    ::std::vector< sal_Bool > aSelected( nColumn, sal_True );
    sal_Int32 nCount = nColumn;
    for( sal_Int32 i = 0; i < nColumn; i++ )
    {
        try
        {
            aSelected[i] = isAccessibleColumnSelected( i );
        }
        catch( ... )
        {
            return Sequence< sal_Int32 >();
        }

        if( !aSelected[i] )
            nCount--;
    }
    Sequence < sal_Int32 > aRet( nCount );
    sal_Int32 *pRet = aRet.getArray();
    sal_Int32 nPos = 0;
    size_t nSize = aSelected.size();
    for( size_t i=0; i < nSize && nPos < nCount; i++ )
    {
        if( aSelected[i] )
        {
            *pRet++ = i;
            nPos++;
        }
    }

    return aRet;
}

@@ -467,6 +627,11 @@ sal_Bool SAL_CALL AccessibleTableShape::isAccessibleRowSelected( sal_Int32 nRow 
{
    SolarMutexGuard aSolarGuard;
    checkCellPosition( 0, nRow );
    SvxTableController* pController = getTableController();
    if( pController )
    {
        return pController->isRowSelected( nRow );
    }
    return sal_False;
}

@@ -476,6 +641,11 @@ sal_Bool SAL_CALL AccessibleTableShape::isAccessibleColumnSelected( sal_Int32 nC
{
    SolarMutexGuard aSolarGuard;
    checkCellPosition( nColumn, 0 );
    SvxTableController* pController = getTableController();
    if( pController )
    {
        return pController->isColumnSelected( nColumn );
    }
    return sal_False;
}

@@ -554,7 +724,7 @@ sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleColumn( sal_Int32 nChildIn
    SolarMutexGuard aSolarGuard;
    sal_Int32 nColumn = 0, nRow = 0;
    mxImpl->getColumnAndRow( nChildIndex, nColumn, nRow );
    return nChildIndex;
    return nColumn;
}

//--------------------------------------------------------------------
@@ -593,7 +763,7 @@ sal_Bool SAL_CALL AccessibleTableShape::isAccessibleChildSelected( sal_Int32 nCh
    CellPos aPos;
    mxImpl->getColumnAndRow( nChildIndex, aPos.mnCol, aPos.mnRow );

    return isAccessibleSelected(aPos.mnCol, aPos.mnRow);
    return isAccessibleSelected(aPos.mnRow, aPos.mnCol);
}

//--------------------------------------------------------------------
@@ -644,27 +814,20 @@ Reference< XAccessible > SAL_CALL AccessibleTableShape::getSelectedAccessibleChi
{
    SolarMutexGuard aSolarGuard;

    SvxTableController* pController = getTableController();
    if( pController && pController->hasSelectedCells() )
    if( nSelectedChildIndex < 0 )
        throw IndexOutOfBoundsException();

    sal_Int32 nChildIndex = GetIndexOfSelectedChild( nSelectedChildIndex );

    if( nChildIndex < 0 )
        throw IndexOutOfBoundsException();

    if ( nChildIndex >= getAccessibleChildCount() )
    {
        CellPos aFirstPos, aLastPos;
        pController->getSelectedCells( aFirstPos, aLastPos );

        const sal_Int32 nSelectedColumns = std::max( (sal_Int32)0, aLastPos.mnCol - aFirstPos.mnCol ) + 1;
        const sal_Int32 nSelectedRows = std::max( (sal_Int32)0, aLastPos.mnRow - aFirstPos.mnRow ) + 1;

        if( nSelectedChildIndex < (nSelectedRows * nSelectedColumns) )
        {
            while( nSelectedChildIndex >= nSelectedColumns )
            {
                aFirstPos.mnRow++;
                nSelectedChildIndex -= nSelectedColumns;
            }
            return getAccessibleCellAt( nSelectedColumns, aFirstPos.mnRow );
        }
        throw IndexOutOfBoundsException();
    }

    throw IndexOutOfBoundsException();
    return getAccessibleChild( nChildIndex );
}

//--------------------------------------------------------------------
@@ -695,9 +858,183 @@ void SAL_CALL AccessibleTableShape::deselectAccessibleChild( sal_Int32 nChildInd
            pController->setSelectedCells( aFirstPos, aLastPos );
    }
}

//--------------------------------------------------------------------

//=====  XAccessibleTableSelection  ============================================
sal_Bool SAL_CALL AccessibleTableShape::selectRow( sal_Int32 row )
throw (IndexOutOfBoundsException, RuntimeException)
{
    SolarMutexGuard aSolarGuard;
    SvxTableController* pController = getTableController();
    if( !pController )
        return sal_False;
    return pController->selectRow( row );
}

sal_Bool SAL_CALL AccessibleTableShape::selectColumn( sal_Int32 column )
    throw (IndexOutOfBoundsException, RuntimeException)
{
    SolarMutexGuard aSolarGuard;
    SvxTableController* pController = getTableController();
    if( !pController )
        return sal_False;
    return pController->selectColumn( column );
}

sal_Bool SAL_CALL AccessibleTableShape::unselectRow( sal_Int32 row )
throw (IndexOutOfBoundsException, RuntimeException)
{
    SolarMutexGuard aSolarGuard;
    SvxTableController* pController = getTableController();
    if( !pController )
        return sal_False;
    return pController->deselectRow( row );
}

sal_Bool SAL_CALL AccessibleTableShape::unselectColumn( sal_Int32 column )
throw (IndexOutOfBoundsException, RuntimeException)
{
    SolarMutexGuard aSolarGuard;
    SvxTableController* pController = getTableController();
    if( !pController )
        return sal_False;
    return pController->deselectColumn( column );
}

sal_Int32 AccessibleTableShape::GetIndexOfSelectedChild(
                sal_Int32 nSelectedChildIndex ) const
{
    sal_Int32 nChildren = const_cast<AccessibleTableShape*>(this)->getAccessibleChildCount();

    if( nSelectedChildIndex >= nChildren )
        return -1L;

    sal_Int32 n = 0;
    while( n < nChildren )
    {
        if( const_cast<AccessibleTableShape*>(this)->isAccessibleChildSelected( n ) )
        {
            if( 0 == nSelectedChildIndex )
                break;
            else
                --nSelectedChildIndex;
        }
        ++n;
    }

    return n < nChildren ? n : -1L;
}
void AccessibleTableShape::getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (IndexOutOfBoundsException )
{
    mxImpl->getColumnAndRow(nChildIndex, rnColumn, rnRow);
}
//--------------------------------------------------------------------
// XSelectionChangeListener
void SAL_CALL
    AccessibleTableShape::disposing (const EventObject& aEvent)
    throw (RuntimeException)
{
    AccessibleShape::disposing(aEvent);
}
void  SAL_CALL AccessibleTableShape::selectionChanged (const EventObject& rEvent)
        throw (RuntimeException)
{
    //::sdr::table::CellRef xCellRef = static_cast< ::sdr::table::CellRef > (rEvent.Source);
    Reference< XCell > xCell(rEvent.Source, UNO_QUERY);
    if (xCell.is())
    {
        Reference< AccessibleCell > xAccCell = mxImpl->getAccessibleCell( xCell );
        if (xAccCell.is())
        {
            sal_Int32 nIndex = xAccCell->getAccessibleIndexInParent(),
                nCount = getSelectedAccessibleChildCount();
            sal_Bool bSelected = isAccessibleChildSelected(nIndex);
            if (mnPreviousSelectionCount == 0 && nCount > 0 && bSelected)
            {
                xAccCell->SetState(AccessibleStateType::SELECTED);
                xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED, Any(), Any());
            }
            else if (bSelected)
            {
                xAccCell->SetState(AccessibleStateType::SELECTED);
                xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD, Any(), Any());
            }
            else
            {
                xAccCell->ResetState(AccessibleStateType::SELECTED);
                xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, Any(), Any());
            }
            mnPreviousSelectionCount = nCount;
        }
    }
}
// Get the currently active cell which is text editing
AccessibleCell* AccessibleTableShape::GetActiveAccessibleCell()
{
    sal_Bool bCellEditing = sal_False;
    Reference< AccessibleCell > xAccCell;
    AccessibleCell* pAccCell = NULL;
    SvxTableController* pController = getTableController();
    if (pController)
    {
        ::sdr::table::SdrTableObj* pTableObj = pController->GetTableObj();
        if ( pTableObj )
        {
            ::sdr::table::CellRef xCellRef (pTableObj->getActiveCell());
            if ( xCellRef.is() )
            {
                bCellEditing = xCellRef->IsTextEditActive();
                if (bCellEditing)
                {
                    //Reference< XCell > xCell(xCellRef.get(), UNO_QUERY);
                    xAccCell = mxImpl->getAccessibleCell(Reference< XCell >( xCellRef.get() ));
                    if (xAccCell.is())
                        pAccCell = xAccCell.get();
                }
            }
        }
    }
    return pAccCell;
}
//--------------------------------------------------------------------
//If current active cell is in editing, the focus state should be set to internal text
sal_Bool AccessibleTableShape::SetState (sal_Int16 aState)
{
    AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
    sal_Bool bStateHasChanged = sal_False;
    if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != NULL)
    {
        return pActiveAccessibleCell->SetState(aState);
    }
    else
        bStateHasChanged = AccessibleShape::SetState (aState);
    return bStateHasChanged;
}
//--------------------------------------------------------------------
//If current active cell is in editing, the focus state should be reset to internal text
sal_Bool AccessibleTableShape::ResetState (sal_Int16 aState)
{
    AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
    sal_Bool bStateHasChanged = sal_False;
    if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != NULL)
    {
        return pActiveAccessibleCell->ResetState(aState);
    }
    else
        bStateHasChanged = AccessibleShape::ResetState (aState);
    return bStateHasChanged;
}
//--------------------------------------------------------------------
sal_Bool AccessibleTableShape::SetStateDirectly (sal_Int16 aState)
{
    return AccessibleContextBase::SetState (aState);
}
//--------------------------------------------------------------------
sal_Bool AccessibleTableShape::ResetStateDirectly (sal_Int16 aState)
{
    return AccessibleContextBase::ResetState (aState);
}

void AccessibleTableShape::checkCellPosition( sal_Int32 nCol, sal_Int32 nRow ) throw ( IndexOutOfBoundsException )
{
    if( (nCol >= 0) && (nRow >= 0) && mxImpl->mxTable.is() && (nCol < mxImpl->mxTable->getColumnCount()) && (nRow < mxImpl->mxTable->getRowCount()) )
@@ -706,6 +1043,333 @@ void AccessibleTableShape::checkCellPosition( sal_Int32 nCol, sal_Int32 nRow ) t
    throw IndexOutOfBoundsException();
}

AccessibleTableHeaderShape::AccessibleTableHeaderShape( AccessibleTableShape* pTable, sal_Bool bRow )
{
    mpTable = pTable;
    mbRow = bRow;
}

AccessibleTableHeaderShape::~AccessibleTableHeaderShape (void)
{
    mpTable = NULL;
}

// XAccessible
Reference< XAccessibleContext > SAL_CALL AccessibleTableHeaderShape::getAccessibleContext(void) throw (RuntimeException)
{
    return this;
}

// XAccessibleContext
sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleChildCount( ) throw(RuntimeException)
{
    return getAccessibleRowCount() * getAccessibleColumnCount();
}

Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleChild( sal_Int32 i ) throw(IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->getAccessibleChild( i );
}

Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleParent (void) throw (RuntimeException)
{
    Reference< XAccessible > XParent;
    return XParent;
}

sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleIndexInParent (void) throw (RuntimeException)
{
    return -1;
}

sal_Int16 SAL_CALL AccessibleTableHeaderShape::getAccessibleRole (void) throw (RuntimeException)
{
    return mpTable->getAccessibleRole();
}

OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleDescription (void) throw (RuntimeException)
{
    return mpTable->getAccessibleDescription();
}

OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleName (void) throw (RuntimeException)
{
    return mpTable->getAccessibleName();
}

Reference< XAccessibleStateSet > SAL_CALL AccessibleTableHeaderShape::getAccessibleStateSet (void) throw (RuntimeException)
{
    return mpTable->getAccessibleStateSet();
}

Reference< XAccessibleRelationSet > SAL_CALL AccessibleTableHeaderShape::getAccessibleRelationSet (void) throw (RuntimeException)
{
    return mpTable->getAccessibleRelationSet();
}

Locale SAL_CALL AccessibleTableHeaderShape::getLocale (void) throw (IllegalAccessibleComponentStateException, RuntimeException)
{
    return mpTable->getLocale();
}

//XAccessibleComponent
sal_Bool SAL_CALL AccessibleTableHeaderShape::containsPoint ( const ::com::sun::star::awt::Point& aPoint ) throw (RuntimeException)
{
    return mpTable->containsPoint( aPoint );
}

Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleAtPoint ( const ::com::sun::star::awt::Point& aPoint) throw (RuntimeException)
{
    return mpTable->getAccessibleAtPoint( aPoint );
}

::com::sun::star::awt::Rectangle SAL_CALL AccessibleTableHeaderShape::getBounds (void) throw (RuntimeException)
{
    return mpTable->getBounds();
}

::com::sun::star::awt::Point SAL_CALL AccessibleTableHeaderShape::getLocation (void) throw (RuntimeException)
{
    return mpTable->getLocation();
}

::com::sun::star::awt::Point SAL_CALL AccessibleTableHeaderShape::getLocationOnScreen (void) throw (RuntimeException)
{
    return mpTable->getLocationOnScreen();
}

::com::sun::star::awt::Size SAL_CALL AccessibleTableHeaderShape::getSize (void) throw (RuntimeException)
{
    return mpTable->getSize();
}

sal_Int32 SAL_CALL AccessibleTableHeaderShape::getForeground (void) throw (RuntimeException)
{
    return mpTable->getForeground();
}

sal_Int32 SAL_CALL AccessibleTableHeaderShape::getBackground (void) throw (RuntimeException)
{
    return mpTable->getBackground();
}

void SAL_CALL AccessibleTableHeaderShape::grabFocus (void) throw (RuntimeException)
{
    mpTable->grabFocus();
}
//=====  XAccessibleTable  ============================================

sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRowCount() throw (RuntimeException)
{
    return mbRow ? 1 : mpTable->getAccessibleRowCount();
}

sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnCount() throw (RuntimeException)
{
    return !mbRow ? 1 : mpTable->getAccessibleColumnCount();
}

OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleRowDescription( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->getAccessibleRowDescription( nRow );
}

OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnDescription( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->getAccessibleColumnDescription( nColumn );
}

sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->getAccessibleRowExtentAt( nRow, nColumn );
}

sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->getAccessibleColumnExtentAt( nRow, nColumn );
}

Reference< XAccessibleTable > SAL_CALL AccessibleTableHeaderShape::getAccessibleRowHeaders(  ) throw (RuntimeException)
{
    Reference< XAccessibleTable > xRet;
    return xRet;
}

Reference< XAccessibleTable > SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnHeaders(  ) throw (RuntimeException)
{
    Reference< XAccessibleTable > xRet;
    return xRet;
}

Sequence< sal_Int32 > SAL_CALL AccessibleTableHeaderShape::getSelectedAccessibleRows(  ) throw (RuntimeException)
{
    sal_Int32 nRow = getAccessibleRowCount();
    ::std::vector< sal_Bool > aSelected( nRow, sal_True );
    sal_Int32 nCount = nRow;
    for( sal_Int32 i = 0; i < nRow; i++ )
    {
        try
        {
            aSelected[i] = isAccessibleRowSelected( i );
        }
        catch( ... )
        {
            return Sequence< sal_Int32 >();
        }

        if( !aSelected[i] )
            nCount--;
    }
    Sequence < sal_Int32 > aRet( nCount );
    sal_Int32 *pRet = aRet.getArray();
    sal_Int32 nPos = 0;
    size_t nSize = aSelected.size();
    for( size_t i=0; i < nSize && nPos < nCount; i++ )
    {
        if( aSelected[i] )
        {
            *pRet++ = i;
            nPos++;
        }
    }

    return aRet;
}

Sequence< sal_Int32 > SAL_CALL AccessibleTableHeaderShape::getSelectedAccessibleColumns(  ) throw (RuntimeException)
{
    sal_Int32 nColumn = getAccessibleColumnCount();
    ::std::vector< sal_Bool > aSelected( nColumn, sal_True );
    sal_Int32 nCount = nColumn;
    for( sal_Int32 i = 0; i < nColumn; i++ )
    {
        try
        {
            aSelected[i] = isAccessibleColumnSelected( i );
        }
        catch( ... )
        {
            return Sequence< sal_Int32 >();
        }

        if( !aSelected[i] )
            nCount--;
    }
    Sequence < sal_Int32 > aRet( nCount );
    sal_Int32 *pRet = aRet.getArray();
    sal_Int32 nPos = 0;
    size_t nSize = aSelected.size();
    for( size_t i=0; i < nSize && nPos < nCount; i++ )
    {
        if( aSelected[i] )
        {
            *pRet++ = i;
            nPos++;
        }
    }

    return aRet;
}

sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleRowSelected( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->isAccessibleRowSelected( nRow );
}

sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleColumnSelected( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->isAccessibleColumnSelected( nColumn );
}

Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->getAccessibleCellAt( nRow, nColumn );
}

Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleCaption(  ) throw (RuntimeException)
{
    return mpTable->getAccessibleCaption();
}

Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleSummary(  ) throw (RuntimeException)
{
    return mpTable->getAccessibleSummary();
}

sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->isAccessibleSelected( nRow, nColumn );
}

sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->getAccessibleIndex( nRow, nColumn );
}

sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRow( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->getAccessibleRow( nChildIndex );
}

sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumn( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
{
    return mpTable->getAccessibleColumn( nChildIndex );
}

//=====  XAccessibleTableSelection  ============================================
sal_Bool SAL_CALL AccessibleTableHeaderShape::selectRow( sal_Int32 row )
throw (IndexOutOfBoundsException, RuntimeException)
{
    if( mbRow )
        return mpTable->selectRow( row );
    else
    {
        mpTable->clearAccessibleSelection();
        sal_Int32 nIndex = mpTable->getAccessibleIndex( row, 0 );
        mpTable->selectAccessibleChild( nIndex );
        return sal_True;
    }
}

sal_Bool SAL_CALL AccessibleTableHeaderShape::selectColumn( sal_Int32 column )
throw (IndexOutOfBoundsException, RuntimeException)
{
    if( !mbRow )
        return mpTable->selectColumn( column );
    else
    {
        mpTable->clearAccessibleSelection();
        sal_Int32 nIndex = mpTable->getAccessibleIndex( 0, column );
        mpTable->selectAccessibleChild( nIndex );
        return sal_True;
    }
}

sal_Bool SAL_CALL AccessibleTableHeaderShape::unselectRow( sal_Int32 row )
throw (IndexOutOfBoundsException, RuntimeException)
{
    if( mbRow )
        return mpTable->unselectRow( row );
    else
    {
        sal_Int32 nIndex = mpTable->getAccessibleIndex( row, 0 );
        mpTable->deselectAccessibleChild( nIndex );
        return sal_True;
    }
}

sal_Bool SAL_CALL AccessibleTableHeaderShape::unselectColumn( sal_Int32 column )
throw (IndexOutOfBoundsException, RuntimeException)
{
    if( !mbRow )
        return mpTable->unselectColumn( column );
    else
    {
        sal_Int32 nIndex = mpTable->getAccessibleIndex( 0, column );
        mpTable->deselectAccessibleChild( nIndex );
        return sal_True;
    }
}
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index a2f68bd..a1bf2a9 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -2840,6 +2840,95 @@ void SvxTableController::FillCommonBorderAttrFromSelectedCells( SvxBoxItem& rBox
    }
}

sal_Bool SvxTableController::selectRow( sal_Int32 row )
{
    if( !mxTable.is() )
        return sal_False;
    CellPos aStart( 0, row ), aEnd( mxTable->getColumnCount() - 1, row );
    StartSelection( aEnd );
    gotoCell( aStart, true, 0 );
    return sal_True;
}

sal_Bool SvxTableController::selectColumn( sal_Int32 column )
{
    if( !mxTable.is() )
        return sal_False;
    CellPos aStart( column, 0 ), aEnd( column, mxTable->getRowCount() - 1 );
    StartSelection( aEnd );
    gotoCell( aStart, true, 0 );
    return sal_True;
}

sal_Bool SvxTableController::deselectRow( sal_Int32 row )
{
    if( !mxTable.is() )
        return sal_False;
    CellPos aStart( 0, row ), aEnd( mxTable->getColumnCount() - 1, row );
    StartSelection( aEnd );
    gotoCell( aStart, false, 0 );
    return sal_True;
}

sal_Bool SvxTableController::deselectColumn( sal_Int32 column )
{
    if( !mxTable.is() )
        return sal_False;
    CellPos aStart( column, 0 ), aEnd( column, mxTable->getRowCount() - 1 );
    StartSelection( aEnd );
    gotoCell( aStart, false, 0 );
    return sal_True;
}

sal_Bool SvxTableController::isRowSelected( sal_Int32 nRow )
{
    if( hasSelectedCells() )
    {
        CellPos aFirstPos, aLastPos;
        getSelectedCells( aFirstPos, aLastPos );
        if( (aFirstPos.mnCol == 0) && (nRow >= aFirstPos.mnRow && nRow <= aLastPos.mnRow) && (mxTable->getColumnCount() - 1 == aLastPos.mnCol) )
            return sal_True;
    }
    return sal_False;
}

sal_Bool SvxTableController::isColumnSelected( sal_Int32 nColumn )
{
    if( hasSelectedCells() )
    {
        CellPos aFirstPos, aLastPos;
        getSelectedCells( aFirstPos, aLastPos );
        if( (aFirstPos.mnRow == 0) && (nColumn >= aFirstPos.mnCol && nColumn <= aLastPos.mnCol) && (mxTable->getRowCount() - 1 == aLastPos.mnRow) )
            return sal_True;
    }
    return sal_False;
}

sal_Bool SvxTableController::isRowHeader()
{
    SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
    SdrModel* pModel = pTableObj ? pTableObj->GetModel() : 0;

    if( !pTableObj || !pModel )
        return sal_False;

    TableStyleSettings aSettings( pTableObj->getTableStyleSettings() );

    return aSettings.mbUseFirstRow;
}

sal_Bool SvxTableController::isColumnHeader()
{
    SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
    SdrModel* pModel = pTableObj ? pTableObj->GetModel() : 0;

    if( !pTableObj || !pModel )
        return sal_False;

    TableStyleSettings aSettings( pTableObj->getTableStyleSettings() );

    return aSettings.mbUseFirstColumn;
}
} }

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 38c3839..fd9e8fc 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -771,6 +771,7 @@ SfxItemPropertyMapEntry* ImplGetSvxTableShapePropertyMap()
        { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT),  SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
        { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT),  SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
        { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT),    OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
        { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_NAME),         SDRATTR_OBJECTNAME, &::getCppuType((const ::rtl::OUString*)0),    0,      0},
        { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE),        OWN_ATTR_MISC_OBJ_TITLE         , &::getCppuType((const OUString*)0),    0,  0},
        { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION),  OWN_ATTR_MISC_OBJ_DESCRIPTION   , &::getCppuType((const OUString*)0),    0,  0},
        { MAP_CHAR_LEN("Model"),                        OWN_ATTR_OLEMODEL               , &::com::sun::star::table::XTable::static_type(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index b4b2c62..da2a481 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -44,6 +44,8 @@
#include <editeng/unotext.hxx>
#include <com/sun/star/linguistic2/LinguServiceManager.hpp>
#include <comphelper/processfactory.hxx>
#include <svx/svdotable.hxx>
#include "../table/cell.hxx"
#include <svx/sdrpaintwindow.hxx>

using namespace ::osl;
@@ -374,6 +376,29 @@ void SvxTextEditSourceImpl::Notify( SfxBroadcaster&, const SfxHint& rHint )
            case HINT_BEGEDIT:
                if( mpObject == pSdrHint->GetObject() )
                {
                    // Once HINT_BEGEDIT is broadcast, each EditSource of
                    // AccessibleCell will handle it here and call below:
                    // mpView->GetTextEditOutliner()->SetNotifyHdl(), which
                    // will replace the Notifer for current editable cell. It
                    // is totally wrong. So add check here to avoid the
                    // incorrect replacement of notifer.
                    //
                    // Currently it only happens on the editsource of
                    // AccessibleCell
                    if (mpObject && mpText)
                    {
                        sdr::table::SdrTableObj* pTableObj = PTR_CAST( sdr::table::SdrTableObj, mpObject );
                        if(pTableObj)
                        {
                            sdr::table::CellRef xCell = pTableObj->getActiveCell();
                            if (xCell.is())
                            {
                                sdr::table::Cell* pCellObj = dynamic_cast< sdr::table::Cell* >( mpText );
                                if (pCellObj && xCell.get() != pCellObj)
                                    break;
                            }
                        }
                    }
                    // invalidate old forwarder
                    if( !mbForwarderIsEditMode )
                    {