[Libreoffice-commits] core.git: sw/inc sw/Library_sw.mk sw/source

Steve Yin steve_y at apache.org
Mon Dec 2 02:25:58 PST 2013


 sw/Library_sw.mk                             |    2 
 sw/inc/PostItMgr.hxx                         |    2 
 sw/inc/access.hrc                            |    5 
 sw/inc/accmap.hxx                            |   45 
 sw/inc/crsrsh.hxx                            |    5 
 sw/inc/doc.hxx                               |   38 
 sw/inc/docsh.hxx                             |    6 
 sw/inc/fesh.hxx                              |    2 
 sw/inc/fldbas.hxx                            |   12 
 sw/inc/frmfmt.hxx                            |   11 
 sw/inc/index.hrc                             |    8 
 sw/inc/mdiexp.hxx                            |    1 
 sw/inc/ndole.hxx                             |    1 
 sw/inc/node.hxx                              |    8 
 sw/inc/tblsel.hxx                            |    3 
 sw/inc/viewsh.hxx                            |    1 
 sw/source/core/access/acccell.cxx            |  224 +++
 sw/source/core/access/acccell.hxx            |   45 
 sw/source/core/access/acccontext.cxx         |   78 -
 sw/source/core/access/acccontext.hxx         |   12 
 sw/source/core/access/accdoc.cxx             |  510 +++++++
 sw/source/core/access/accdoc.hxx             |   27 
 sw/source/core/access/accembedded.cxx        |   59 
 sw/source/core/access/accembedded.hxx        |   22 
 sw/source/core/access/accfield.cxx           |  314 ++++
 sw/source/core/access/accfield.hxx           |  175 ++
 sw/source/core/access/accfootnote.cxx        |   12 
 sw/source/core/access/accfootnote.hxx        |    1 
 sw/source/core/access/accframe.cxx           |   12 
 sw/source/core/access/accframe.hxx           |    7 
 sw/source/core/access/accframebase.cxx       |  153 ++
 sw/source/core/access/accframebase.hxx       |    5 
 sw/source/core/access/accfrmobj.cxx          |   19 
 sw/source/core/access/accfrmobj.hxx          |    2 
 sw/source/core/access/accfrmobjmap.hxx       |   37 
 sw/source/core/access/accgraphic.cxx         |   12 
 sw/source/core/access/accgraphic.hxx         |    2 
 sw/source/core/access/accheaderfooter.cxx    |   15 
 sw/source/core/access/accheaderfooter.hxx    |    3 
 sw/source/core/access/acchyperlink.cxx       |   92 +
 sw/source/core/access/accmap.cxx             | 1043 +++++++++++++++-
 sw/source/core/access/accnotextframe.cxx     |  154 ++
 sw/source/core/access/accnotextframe.hxx     |   56 
 sw/source/core/access/accnotexthyperlink.cxx |  225 +++
 sw/source/core/access/accnotexthyperlink.hxx |   83 +
 sw/source/core/access/accpara.cxx            | 1725 ++++++++++++++++++++++++++-
 sw/source/core/access/accpara.hxx            |   52 
 sw/source/core/access/accportions.cxx        |  114 +
 sw/source/core/access/accportions.hxx        |   39 
 sw/source/core/access/accpreview.cxx         |   21 
 sw/source/core/access/accpreview.hxx         |    4 
 sw/source/core/access/accselectionhelper.cxx |   93 +
 sw/source/core/access/acctable.cxx           |  303 ++++
 sw/source/core/access/acctable.hxx           |   23 
 sw/source/core/access/acctextframe.cxx       |  118 +
 sw/source/core/access/acctextframe.hxx       |   40 
 sw/source/core/attr/format.cxx               |    2 
 sw/source/core/crsr/crsrsh.cxx               |   69 +
 sw/source/core/doc/tblcpy.cxx                |    3 
 sw/source/core/docnode/node.cxx              |   63 
 sw/source/core/docnode/nodes.cxx             |    9 
 sw/source/core/frmedt/feshview.cxx           |   20 
 sw/source/core/frmedt/tblsel.cxx             |    9 
 sw/source/core/inc/SwPortionHandler.hxx      |    2 
 sw/source/core/inc/doctxm.hxx                |    2 
 sw/source/core/inc/frame.hxx                 |   12 
 sw/source/core/inc/txtfrm.hxx                |    2 
 sw/source/core/inc/viewimp.hxx               |    4 
 sw/source/core/layout/atrfrm.cxx             |   17 
 sw/source/core/layout/wsfrm.cxx              |    1 
 sw/source/core/ole/ndole.cxx                 |    8 
 sw/source/core/text/frmform.cxx              |   45 
 sw/source/core/text/porfld.cxx               |    5 
 sw/source/core/text/porfld.hxx               |    1 
 sw/source/core/text/txtfld.cxx               |   41 
 sw/source/core/unocore/unomap.cxx            |   34 
 sw/source/core/view/viewimp.cxx              |   18 
 sw/source/filter/ww8/wrtw8esh.cxx            |    2 
 sw/source/ui/app/docsh.cxx                   |   52 
 sw/source/ui/cctrl/actctrl.cxx               |    3 
 sw/source/ui/chrdlg/swuiccoll.cxx            |   13 
 sw/source/ui/dialog/uiregionsw.cxx           |    1 
 sw/source/ui/docvw/edtwin.cxx                |   13 
 sw/source/ui/docvw/edtwin3.cxx               |   27 
 sw/source/ui/frmdlg/column.cxx               |   26 
 sw/source/ui/frmdlg/frmpage.cxx              |   12 
 sw/source/ui/inc/cnttab.hxx                  |    5 
 sw/source/ui/inc/conttree.hxx                |    9 
 sw/source/ui/inc/edtwin.hxx                  |    1 
 sw/source/ui/inc/pview.hxx                   |   13 
 sw/source/ui/inc/swlbox.hxx                  |    1 
 sw/source/ui/inc/swuicnttab.hxx              |    9 
 sw/source/ui/inc/view.hxx                    |    3 
 sw/source/ui/index/cnttab.cxx                |  136 ++
 sw/source/ui/index/cnttab.src                |   50 
 sw/source/ui/ribbar/inputwin.cxx             |    6 
 sw/source/ui/ribbar/inputwin.hrc             |    3 
 sw/source/ui/ribbar/inputwin.src             |   17 
 sw/source/ui/ribbar/workctrl.cxx             |    7 
 sw/source/ui/shells/textsh1.cxx              |   51 
 sw/source/ui/shells/txtnum.cxx               |    4 
 sw/source/ui/uiview/pview.cxx                |  188 +-
 sw/source/ui/uiview/view.cxx                 |    1 
 sw/source/ui/uiview/view2.cxx                |   30 
 sw/source/ui/uiview/viewsrch.cxx             |   45 
 sw/source/ui/utlui/content.cxx               |  386 +++++-
 sw/source/ui/utlui/navipi.hrc                |    3 
 sw/source/ui/wrtsh/select.cxx                |    7 
 108 files changed, 7198 insertions(+), 374 deletions(-)

New commits:
commit 76c549eb01dcb7b5bf28a271ce00e386f3d388ba
Author: Steve Yin <steve_y at apache.org>
Date:   Fri Nov 29 13:03:27 2013 +0000

    Integrate branch of IAccessible2
    
    Conflicts:
    	everything
    
    Change-Id: I9619634ee1e60d449025c006803da29c1e9d14b3

diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index ead4148..3564c89 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -93,6 +93,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
     sw/source/core/access/accdoc \
     sw/source/core/access/accembedded \
     sw/source/core/access/accfootnote \
+    sw/source/core/access/accfield \
     sw/source/core/access/accframe \
     sw/source/core/access/accframebase\
     sw/source/core/access/accfrmobj \
@@ -104,6 +105,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
     sw/source/core/access/acchypertextdata \
     sw/source/core/access/accmap \
     sw/source/core/access/accnotextframe \
+    sw/source/core/access/accnotexthyperlink \
     sw/source/core/access/accpage \
     sw/source/core/access/accpara \
     sw/source/core/access/accportions \
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 4c38d40..a87a9ba 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -267,6 +267,8 @@ class SwPostItMgr: public SfxListener
             sal_uInt16 SearchReplace(const SwFmtFld &pFld, const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
             sal_uInt16 FinishSearchReplace(const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
 
+            // get the PostIt window by index
+            sal_Int32 GetPostItCount() const {return mvPostItFlds.size();}
             void AssureStdModeAtShell();
 
             void ConnectSidebarWinToFrm( const SwFrm& rFrm,
diff --git a/sw/inc/access.hrc b/sw/inc/access.hrc
index c2df846..d42845f 100644
--- a/sw/inc/access.hrc
+++ b/sw/inc/access.hrc
@@ -50,8 +50,11 @@
 
 #define STR_ACCESS_TL_GLOBAL                    (RC_ACCESS_BEGIN + 30)
 #define STR_ACCESS_TL_CONTENT                   (RC_ACCESS_BEGIN + 31)
+#define STR_ACCESS_FORMULA_TYPE                 (RC_ACCESS_BEGIN + 32)
+#define STR_ACCESS_FORMULA_TEXT                 (RC_ACCESS_BEGIN + 33)
+#define STR_ACCESS_FORMULA_TOOLBAR              (RC_ACCESS_BEGIN + 34)
 
-#define ACCESS_ACT_END STR_ACCESS_TL_CONTENT
+#define ACCESS_ACT_END STR_ACCESS_FORMULA_TOOLBAR
 
 #if ACCESS_ACT_END > RC_ACCESS_END
 #error Resource-Id Ueberlauf in #file, #line
diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
index 6df6388..731518c 100644
--- a/sw/inc/accmap.hxx
+++ b/sw/inc/accmap.hxx
@@ -27,7 +27,12 @@
 #include <svx/IAccessibleParent.hxx>
 #include <tools/fract.hxx>
 
+#include <svx/AccessibleControlShape.hxx>
+#include <svx/AccessibleShape.hxx>
+#include "fesh.hxx"
 #include <vector>
+#include <set>
+class SwAccessibleParagraph;
 
 class SwViewShell;
 class Rectangle;
@@ -69,8 +74,8 @@ class Window;
 
 typedef sal_uInt16 tAccessibleStates;
 
-class SwAccessibleMap : public accessibility::IAccessibleViewForwarder,
-                        public accessibility::IAccessibleParent
+class SwAccessibleMap : public ::accessibility::IAccessibleViewForwarder,
+                        public ::accessibility::IAccessibleParent
 {
     mutable ::osl::Mutex maMutex;
     ::osl::Mutex maEventMutex;
@@ -103,10 +108,15 @@ class SwAccessibleMap : public accessibility::IAccessibleViewForwarder,
     void InvalidateCursorPosition(
         const ::com::sun::star::uno::Reference<
             ::com::sun::star::accessibility::XAccessible>& rAcc );
-    void DoInvalidateShapeSelection();
-    void DoInvalidateShapeFocus();
+    void DoInvalidateShapeSelection(sal_Bool bInvalidateFocusMode = sal_False);
+
     void InvalidateShapeSelection();
 
+    //mpSelectedFrmMap contains the old selected objects.
+    SwAccessibleContextMap_Impl *mpSeletedFrmMap;
+    //IvalidateShapeInParaSelection() method is reponsible for the updating the selected states of the objects.
+    void InvalidateShapeInParaSelection();
+
     void _InvalidateRelationSet( const SwFrm* pFrm, bool bFrom );
 
     ::com::sun::star::uno::Reference<
@@ -159,6 +169,13 @@ public:
     {
         return mpVSh;
     }
+    sal_Bool IsInSameLevel(const SdrObject* pObj, const SwFEShell* pFESh);
+    void AddShapeContext(const SdrObject *pObj,
+                             ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccShape);
+
+    void AddGroupContext(const SdrObject *pParentObj,
+                    ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccParent);
+    void RemoveGroupContext(const SdrObject *pParentObj, ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccParent);
 
     const SwRect& GetVisArea() const;
 
@@ -193,7 +210,9 @@ public:
 
     void InvalidateCursorPosition( const SwFrm *pFrm );
     void InvalidateFocus();
-
+    void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage);
+    void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection);
+    void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn);
     void SetCursorContext(
         const ::rtl::Reference < SwAccessibleContext >& rCursorContext );
 
@@ -262,6 +281,12 @@ public:
         const long _nIndex,
         const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
     )   throw (::com::sun::star::uno::RuntimeException);
+    virtual ::accessibility::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);
 
     // additional Core/Pixel conversions for internal use; also works
     // for preview
@@ -290,6 +315,16 @@ private:
     */
     void GetMapMode( const Point& _rPoint,
                      MapMode&     _orMapMode ) const;
+public:
+    virtual sal_Bool IsDocumentSelAll();
+
+    ::com::sun::star::uno::WeakReference < ::com::sun::star::accessibility::XAccessible >
+        GetCursorContext() const { return mxCursorContext; }
+
+    //Para Container for InvalidateCursorPosition
+    typedef std::set< SwAccessibleParagraph* >  SET_PARA;
+    SET_PARA m_setParaAdd;
+    SET_PARA m_setParaRemove;
 };
 #endif
 
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index ddc4f2b..0e3c06b 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -824,6 +824,11 @@ public:
     // is cursor or the point in/over a right to left formatted text?
     sal_Bool IsInRightToLeftText( const Point* pPt = 0 ) const;
 
+    void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage);
+    SwFrm* oldColFrm;
+    bool   bColumnChange();
+    void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection);
+    void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn);
     // If the current cursor position is inside a hidden range, the hidden range
     // is selected and true is returned:
     bool SelectHiddenRange();
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 5898077..217590c 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -466,6 +466,7 @@ private:
     bool mbClipBoard             : 1;    ///< TRUE: this document represents the clipboard
     bool mbColumnSelection       : 1;    /**< TRUE: this content has bee created by a column selection
                                                 (clipboard docs only) */
+    bool mbIsPrepareSelAll       : 1;
 
 #ifdef DBG_UTIL
     bool mbXMLExport : 1;                ///< sal_True: during XML export
@@ -683,17 +684,21 @@ private:
     void DoUpdateAllCharts();
     DECL_LINK( DoUpdateModifiedOLE, Timer * );
 
-     SwFmt *_MakeCharFmt(const OUString &, SwFmt *, bool, bool );
-     SwFmt *_MakeFrmFmt(const OUString &, SwFmt *, bool, bool );
-     SwFmt *_MakeTxtFmtColl(const OUString &, SwFmt *, bool, bool );
+    SwFmt *_MakeCharFmt(const OUString &, SwFmt *, bool, bool );
+    SwFmt *_MakeFrmFmt(const OUString &, SwFmt *, bool, bool );
+    SwFmt *_MakeTxtFmtColl(const OUString &, SwFmt *, bool, bool );
 
-     void InitTOXTypes();
-     void   Paste( const SwDoc& );
-     bool DeleteAndJoinImpl(SwPaM&, const bool);
-     bool DeleteAndJoinWithRedlineImpl(SwPaM&, const bool unused = false);
-     bool DeleteRangeImpl(SwPaM&, const bool unused = false);
-     bool DeleteRangeImplImpl(SwPaM &);
-     bool ReplaceRangeImpl(SwPaM&, OUString const&, const bool);
+private:
+    sal_Bool mbReadOnly;
+    OUString msDocAccTitle;
+
+    void InitTOXTypes();
+    void Paste( const SwDoc& );
+    bool DeleteAndJoinImpl(SwPaM&, const bool);
+    bool DeleteAndJoinWithRedlineImpl(SwPaM&, const bool unused = false);
+    bool DeleteRangeImpl(SwPaM&, const bool unused = false);
+    bool DeleteRangeImplImpl(SwPaM &);
+    bool ReplaceRangeImpl(SwPaM&, OUString const&, const bool);
 
 public:
 
@@ -702,7 +707,7 @@ public:
     SwDoc();
     ~SwDoc();
 
-    inline bool IsInDtor() const { return mbDtor; }
+    bool IsInDtor() const { return mbDtor; }
 
     /* @@@MAINTAINABILITY-HORROR@@@
        Implementation details made public.
@@ -1015,6 +1020,11 @@ public:
                                  ::sw::tExternalDataPointer pPayload);
     virtual ::sw::tExternalDataPointer getExternalData(::sw::tExternalDataType eType);
 
+    virtual void setDocReadOnly( sal_Bool b) { mbReadOnly = b; }
+    virtual sal_Bool getDocReadOnly() const { return mbReadOnly; }
+    virtual void setDocAccTitle( const OUString& rTitle ) { msDocAccTitle = rTitle; }
+    virtual const OUString getDocAccTitle() const { return msDocAccTitle; }
+
     /** INextInterface here
     */
 
@@ -1031,6 +1041,12 @@ public:
     bool InXMLExport() const            { return mbXMLExport; }
     void SetXMLExport( bool bFlag )     { mbXMLExport = bFlag; }
 #endif
+    void SetSelAll( bool bSel )
+    {
+        mbIsPrepareSelAll = bSel;
+    }
+    bool IsPrepareSelAll() const { return mbIsPrepareSelAll; }
+    void SetPrepareSelAll() { mbIsPrepareSelAll = true; }
 
     void SetContainsAtPageObjWithContentAnchor( const bool bFlag )
     {
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 9c8f841..2670603 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -283,6 +283,12 @@ public:
      read by the binary filter: */
     virtual void UpdateLinks();
 
+    virtual void setDocAccTitle( const OUString& rTitle );
+    virtual const OUString getDocAccTitle() const;
+
+    void setDocReadOnly( bool bReadOnly);
+    bool getDocReadOnly() const;
+
     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
                                 GetController();
 
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 9daebe8..8f16c0d 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -460,6 +460,8 @@ public:
 
     sal_uInt16 IsObjSelected() const;   ///< @return object count, but doesn't count the objects in groups.
     sal_Bool IsObjSelected( const SdrObject& rObj ) const;
+    sal_Bool IsObjSameLevelWithMarked(const SdrObject* pObj) const;
+    const SdrMarkList* GetMarkList() const{ return _GetMarkList(); };
 
     void EndTextEdit();             ///< Deletes object if required.
 
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 453d246..1e20918 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -126,8 +126,16 @@ enum SwFldTypesEnum
     TYP_DROPDOWN,
     TYP_END
 };
-
-
+enum SwAttrFieldTYpe
+{
+    ATTR_NONE,
+    ATTR_DATEFLD,
+    ATTR_TIMEFLD,
+    ATTR_PAGENUMBERFLD,
+    ATTR_PAGECOOUNTFLD,
+    ATTR_BOOKMARKFLD,
+    ATTR_SETREFATTRFLD
+};
 enum SwFileNameFormat
 {
     FF_BEGIN,
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index aa86dce..1b26316 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -44,11 +44,13 @@ class SW_DLLPUBLIC SwFrmFmt: public SwFmt
         ::com::sun::star::uno::XInterface> m_wXObject;
 
 protected:
+    SwFrmFmt* pCaptionFmt;
     SwFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
                 SwFrmFmt *pDrvdFrm, sal_uInt16 nFmtWhich = RES_FRMFMT,
                 const sal_uInt16* pWhichRange = 0 )
           : SwFmt( rPool, pFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange),
                 pDrvdFrm, nFmtWhich )
+                ,pCaptionFmt( NULL )
     {}
 
     SwFrmFmt( SwAttrPool& rPool, const OUString &rFmtNm,
@@ -56,9 +58,10 @@ protected:
                 const sal_uInt16* pWhichRange = 0 )
           : SwFmt( rPool, rFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange),
                 pDrvdFrm, nFmtWhich )
+                ,pCaptionFmt( NULL )
     {}
 
-   virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue );
+    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue );
 
 public:
     TYPEINFO();     ///< Already in base class Client.
@@ -122,6 +125,10 @@ public:
 
     virtual OUString GetDescription() const;
 
+    sal_Bool HasCaption() const;
+    void SetCaptionFmt(SwFrmFmt* pFmt);
+    SwFrmFmt* GetCaptionFmt() const;
+
     SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
         ::com::sun::star::uno::XInterface> const& GetXObject() const
             { return m_wXObject; }
@@ -138,6 +145,8 @@ public:
 class SW_DLLPUBLIC SwFlyFrmFmt: public SwFrmFmt
 {
     friend class SwDoc;
+    OUString msTitle;
+    OUString msDesc;
 
     /** Both not existent.
        it stores the previous position of Prt rectangle from RequestObjectResize
diff --git a/sw/inc/index.hrc b/sw/inc/index.hrc
index bdb7796..192e3c1 100644
--- a/sw/inc/index.hrc
+++ b/sw/inc/index.hrc
@@ -68,9 +68,11 @@
 #define  STR_TOKEN_HELP_LINK_END      (STR_BUTTON_HELP_TEXT_START + 8)
 #define  STR_TOKEN_HELP_AUTHORITY     (STR_BUTTON_HELP_TEXT_START + 9)
 
-#define  STR_CHARSTYLE          (STR_TOKEN_HELP_AUTHORITY + 1)
-
-
+#define  STR_CHARSTYLE                  (STR_TOKEN_HELP_AUTHORITY + 1)
+#define  STR_STRUCTURE                  (STR_TOKEN_HELP_AUTHORITY + 2)
+#define  STR_ADDITIONAL_ACCNAME_STRING1 (STR_TOKEN_HELP_AUTHORITY + 3)
+#define  STR_ADDITIONAL_ACCNAME_STRING2 (STR_TOKEN_HELP_AUTHORITY + 4)
+#define  STR_ADDITIONAL_ACCNAME_STRING3 (STR_TOKEN_HELP_AUTHORITY + 5)
 
 #endif  // _INDEX_HRC
 
diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx
index e3319e5..fe7b902 100644
--- a/sw/inc/mdiexp.hxx
+++ b/sw/inc/mdiexp.hxx
@@ -65,6 +65,7 @@ TblChgMode GetTblChgDefaultMode();
 
 bool JumpToSwMark( SwViewShell* pVwSh, const OUString& rMark );
 
+extern void AccessibilityScrollMDI(SwViewShell* pVwSh, const SwRect &, sal_uInt16 nRangeX, sal_uInt16 nRangeY, sal_Bool isLeftTop);
 
 #endif
 
diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx
index 6f02727..423f41b 100644
--- a/sw/inc/ndole.hxx
+++ b/sw/inc/ndole.hxx
@@ -61,6 +61,7 @@ public:
     const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef();
     svt::EmbeddedObjectRef& GetObject();
     OUString GetCurrentPersistName() const { return aName; }
+    OUString GetStyleString();
     sal_Bool IsOleRef() const;  ///< To avoid unneccessary loading of object.
 };
 
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 93ebc5c..ee28196 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -422,8 +422,12 @@ public:
     void MakeFrms( SwCntntNode& rNode );
 
     /** Method deletes all views of document for the node. The content-
-       frames are removed from the respective layout. */
-    void DelFrms();
+        frames are removed from the respective layout.
+
+        Add an input param to identify if acc table should be disposed
+    */
+    void DelFrms( sal_Bool bNeedDel = sal_False, sal_Bool bIsAccTableDispose = sal_True );
+
 
     /** @return count of elements of node content. Default is 1.
        There are differences between text node and formula node. */
diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx
index 9c6cda6..62322ab 100644
--- a/sw/inc/tblsel.hxx
+++ b/sw/inc/tblsel.hxx
@@ -178,7 +178,8 @@ public:
 
     void SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable );
     void SetTableLines( const SwTable &rTable );
-    void DelFrms ( SwTable &rTable );
+    //Add an input param to identify if acc table should be disposed
+    void DelFrms ( SwTable &rTable,sal_Bool bAccTableDispose = sal_False );
     void MakeFrms( SwTable &rTable );
     void MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber,
                                        const sal_Bool bBehind );
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index fd314eb..ccd63e5 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -352,6 +352,7 @@ public:
     inline Window* GetWin()    const { return mpWin; }
     inline OutputDevice* GetOut()     const { return mpOut; }
 
+    void SetWin(Window* win) { mpWin = win; }
     static inline sal_Bool IsLstEndAction() { return SwViewShell::mbLstAct; }
 
     // Change of all page descriptors.
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
index a09408c..6bbf1fc 100644
--- a/sw/source/core/access/acccell.cxx
+++ b/sw/source/core/access/acccell.cxx
@@ -39,6 +39,12 @@
 #include <cfloat>
 #include <limits.h>
 
+#include <ndtxt.hxx>
+#include <editeng/brushitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+#include "acctable.hxx"
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
 using namespace sw::access;
@@ -79,6 +85,8 @@ void SwAccessibleCell::GetStates( ::utl::AccessibleStateSetHelper& rStateSet )
     OSL_ENSURE( pVSh, "no shell?" );
     if( pVSh->ISA( SwCrsrShell ) )
         rStateSet.AddState( AccessibleStateType::SELECTABLE );
+    //Add resizable state to table cell.
+    rStateSet.AddState( AccessibleStateType::RESIZABLE );
 
     // SELECTED
     if( IsSelected() )
@@ -93,6 +101,7 @@ void SwAccessibleCell::GetStates( ::utl::AccessibleStateSetHelper& rStateSet )
 SwAccessibleCell::SwAccessibleCell( SwAccessibleMap *pInitMap,
                                     const SwCellFrm *pCellFrm )
     : SwAccessibleContext( pInitMap, AccessibleRole::TABLE_CELL, pCellFrm )
+    , aSelectionHelper( *this )
     , bIsSelected( sal_False )
 {
     SolarMutexGuard aGuard;
@@ -100,6 +109,11 @@ SwAccessibleCell::SwAccessibleCell( SwAccessibleMap *pInitMap,
     SetName( sBoxName );
 
     bIsSelected = IsSelected();
+
+    //Need not assign the pointer of accessible table object to m_pAccTable,
+    //for it already done in SwAccessibleCell::GetTable(); Former codes:
+    //m_pAccTable= GetTable();
+    GetTable();
 }
 
 sal_Bool SwAccessibleCell::_InvalidateMyCursorPos()
@@ -121,8 +135,13 @@ sal_Bool SwAccessibleCell::_InvalidateMyCursorPos()
 
     sal_Bool bChanged = bOld != bNew;
     if( bChanged )
+    {
         FireStateChangedEvent( AccessibleStateType::SELECTED, bNew );
-
+        if (m_pAccTable)
+        {
+            m_pAccTable->AddSelectionCell(this,bNew);
+        }
+    }
     return bChanged;
 }
 
@@ -146,7 +165,7 @@ sal_Bool SwAccessibleCell::_InvalidateChildrenCursorPos( const SwFrm *pFrm )
                 {
                     OSL_ENSURE( xAccImpl->GetFrm()->IsCellFrm(),
                              "table child is not a cell frame" );
-                    bChanged |= static_cast< SwAccessibleCell *>(
+                    bChanged = static_cast< SwAccessibleCell *>(
                             xAccImpl.get() )->_InvalidateMyCursorPos();
                 }
                 else
@@ -168,6 +187,21 @@ sal_Bool SwAccessibleCell::_InvalidateChildrenCursorPos( const SwFrm *pFrm )
 
 void SwAccessibleCell::_InvalidateCursorPos()
 {
+    if (IsSelected())
+    {
+        const SwAccessibleChild aChild( GetChild( *(GetMap()), 0 ) );
+        if( aChild.IsValid()  && aChild.GetSwFrm() )
+        {
+            ::rtl::Reference < SwAccessibleContext > xChildImpl( GetMap()->GetContextImpl( aChild.GetSwFrm())  );
+            if (xChildImpl.is())
+            {
+                AccessibleEventObject aEvent;
+                aEvent.EventId = AccessibleEventId::STATE_CHANGED;
+                aEvent.NewValue <<= AccessibleStateType::FOCUSED;
+                xChildImpl->FireAccessibleEvent( aEvent );
+            }
+        }
+    }
 
     const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
     OSL_ENSURE( pParent->IsTabFrm(), "parent is not a tab frame" );
@@ -177,21 +211,13 @@ void SwAccessibleCell::_InvalidateCursorPos()
 
     while( pTabFrm )
     {
-        sal_Bool bChanged = _InvalidateChildrenCursorPos( pTabFrm );
-        if( bChanged )
-        {
-            ::rtl::Reference< SwAccessibleContext > xAccImpl(
-                GetMap()->GetContextImpl( pTabFrm, sal_False ) );
-            if( xAccImpl.is() )
-            {
-                AccessibleEventObject aEvent;
-                aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
-                xAccImpl->FireAccessibleEvent( aEvent );
-            }
-        }
-
+        _InvalidateChildrenCursorPos( pTabFrm );
         pTabFrm = pTabFrm->GetFollow();
     }
+    if (m_pAccTable)
+    {
+        m_pAccTable->FireSelectionEvent();
+    }
 }
 
 sal_Bool SwAccessibleCell::HasCursor()
@@ -261,6 +287,19 @@ void SwAccessibleCell::InvalidatePosOrSize( const SwRect& rOldBox )
 uno::Any SwAccessibleCell::queryInterface( const uno::Type& rType )
     throw( uno::RuntimeException )
 {
+    if (rType == ::getCppuType((const uno::Reference<XAccessibleExtendedAttributes>*)0))
+    {
+        uno::Any aR;
+        aR <<= uno::Reference<XAccessibleExtendedAttributes>(this);
+        return aR;
+    }
+
+    if (rType == ::getCppuType((const uno::Reference<XAccessibleSelection>*)0))
+    {
+        uno::Any aR;
+        aR <<= uno::Reference<XAccessibleSelection>(this);
+        return aR;
+    }
     if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleValue > * >( 0 ) ) )
     {
         uno::Reference<XAccessibleValue> xValue = this;
@@ -311,7 +350,7 @@ SwFrmFmt* SwAccessibleCell::GetTblBoxFormat() const
     return pCellFrm->GetTabBox()->GetFrmFmt();
 }
 
-
+//Implement TableCell currentValue
 uno::Any SwAccessibleCell::getCurrentValue( )
     throw( uno::RuntimeException )
 {
@@ -319,7 +358,30 @@ uno::Any SwAccessibleCell::getCurrentValue( )
     CHECK_FOR_DEFUNC( XAccessibleValue );
 
     uno::Any aAny;
-    aAny <<= GetTblBoxFormat()->GetTblBoxValue().GetValue();
+
+    const SwCellFrm* pCellFrm = static_cast<const SwCellFrm*>( GetFrm() );
+    const SwStartNode *pSttNd = pCellFrm->GetTabBox()->GetSttNd();
+    if( pSttNd )
+    {
+        OUString strRet;
+        SwNodeIndex aCntntIdx( *pSttNd, 0 );
+        SwCntntNode* pCNd=NULL;
+        for(int nIndex = 0 ;
+            0 != ( pCNd = pSttNd->GetNodes().GoNext( &aCntntIdx ) ) &&
+            aCntntIdx.GetIndex() < pSttNd->EndOfSectionIndex();
+            ++nIndex )
+        {
+            if(pCNd && pCNd->IsTxtNode())
+            {
+                if (0 != nIndex)
+                {
+                    strRet += " ";
+                }
+                strRet +=((SwTxtNode*)pCNd)->GetTxt();
+            }
+        }
+        aAny <<= strRet;
+    }
     return aAny;
 }
 
@@ -355,4 +417,132 @@ uno::Any SwAccessibleCell::getMinimumValue(  )
     return aAny;
 }
 
+OUString ReplaceOneChar(OUString oldOUString, OUString replacedChar, OUString replaceStr)
+{
+    int iReplace = -1;
+    iReplace = oldOUString.lastIndexOf(replacedChar);
+    if (iReplace > -1)
+    {
+        for(;iReplace>-1;)
+        {
+            oldOUString = oldOUString.replaceAt(iReplace,1, replaceStr);
+            iReplace=oldOUString.lastIndexOf(replacedChar,iReplace);
+        }
+    }
+    return oldOUString;
+}
+OUString ReplaceFourChar(OUString oldOUString)
+{
+    oldOUString = ReplaceOneChar(oldOUString,OUString("\\"),OUString("\\\\"));
+    oldOUString = ReplaceOneChar(oldOUString,OUString(";"),OUString("\\;"));
+    oldOUString = ReplaceOneChar(oldOUString,OUString("="),OUString("\\="));
+    oldOUString = ReplaceOneChar(oldOUString,OUString(","),OUString("\\,"));
+    oldOUString = ReplaceOneChar(oldOUString,OUString(":"),OUString("\\:"));
+    return oldOUString;
+}
+
+::com::sun::star::uno::Any SAL_CALL SwAccessibleCell::getExtendedAttributes()
+        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+    ::com::sun::star::uno::Any strRet;
+    SwFrmFmt *pFrmFmt = GetTblBoxFormat();
+    DBG_ASSERT(pFrmFmt,"Must be Valid");
+
+    const SwTblBoxFormula& tbl_formula = pFrmFmt->GetTblBoxFormula();
+
+    OUString strFormula = ReplaceFourChar(tbl_formula.GetFormula());
+    OUString strFor("Formula:");
+    strFor += strFormula;
+    strFor += ";" ;
+    strRet <<= strFor;
+
+    return strRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleCell::getBackground()
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    const SvxBrushItem &rBack = GetFrm()->GetAttrSet()->GetBackground();
+    sal_uInt32 crBack = rBack.GetColor().GetColor();
+
+    if (COL_AUTO == crBack)
+    {
+        uno::Reference<XAccessible> xAccDoc = getAccessibleParent();
+        if (xAccDoc.is())
+        {
+            uno::Reference<XAccessibleComponent> xCompoentDoc(xAccDoc, uno::UNO_QUERY);
+            if (xCompoentDoc.is())
+            {
+                crBack = (sal_uInt32)xCompoentDoc->getBackground();
+            }
+        }
+    }
+    return crBack;
+}
+
+//=====  XAccessibleSelection  ============================================
+void SwAccessibleCell::selectAccessibleChild(
+    sal_Int32 nChildIndex )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    aSelectionHelper.selectAccessibleChild(nChildIndex);
+}
+
+sal_Bool SwAccessibleCell::isAccessibleChildSelected(
+    sal_Int32 nChildIndex )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    return aSelectionHelper.isAccessibleChildSelected(nChildIndex);
+}
+
+void SwAccessibleCell::clearAccessibleSelection(  )
+    throw ( uno::RuntimeException )
+{
+    aSelectionHelper.clearAccessibleSelection();
+}
+
+void SwAccessibleCell::selectAllAccessibleChildren(  )
+    throw ( uno::RuntimeException )
+{
+    aSelectionHelper.selectAllAccessibleChildren();
+}
+
+sal_Int32 SwAccessibleCell::getSelectedAccessibleChildCount(  )
+    throw ( uno::RuntimeException )
+{
+    return aSelectionHelper.getSelectedAccessibleChildCount();
+}
+
+uno::Reference<XAccessible> SwAccessibleCell::getSelectedAccessibleChild(
+    sal_Int32 nSelectedChildIndex )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+    return aSelectionHelper.getSelectedAccessibleChild(nSelectedChildIndex);
+}
+
+void SwAccessibleCell::deselectAccessibleChild(
+    sal_Int32 nSelectedChildIndex )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    aSelectionHelper.deselectAccessibleChild(nSelectedChildIndex);
+}
+
+SwAccessibleTable *SwAccessibleCell::GetTable()
+{
+    if (!m_pAccTable)
+    {
+        if (!xTableReference.is())
+        {
+            xTableReference = getAccessibleParent();
+        #ifdef OSL_DEBUG_LEVEL
+            uno::Reference<XAccessibleContext> xContextTable(xTableReference, uno::UNO_QUERY);
+            OSL_ASSERT(xContextTable.is() && xContextTable->getAccessibleRole() == AccessibleRole::TABLE);
+        #endif
+            //SwAccessibleTable aTable = *(static_cast<SwAccessibleTable *>(xTable.get()));
+        }
+        m_pAccTable = static_cast<SwAccessibleTable *>(xTableReference.get());
+    }
+    return m_pAccTable;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/acccell.hxx b/sw/source/core/access/acccell.hxx
index 74d3185..dbf0e12 100644
--- a/sw/source/core/access/acccell.hxx
+++ b/sw/source/core/access/acccell.hxx
@@ -22,14 +22,19 @@
 
 #include "acccontext.hxx"
 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include <accselectionhelper.hxx>
 
 class SwCellFrm;
+class SwAccessibleTable;
 class SwFrmFmt;
 
 class SwAccessibleCell : public SwAccessibleContext,
-                  ::com::sun::star::accessibility::XAccessibleValue
-
+                  ::com::sun::star::accessibility::XAccessibleValue,
+                  ::com::sun::star::accessibility::XAccessibleSelection,
+                    public  ::com::sun::star::accessibility::XAccessibleExtendedAttributes
 {
+    // Implementation for XAccessibleSelection interface
+    SwAccessibleSelectionHelper aSelectionHelper;
     sal_Bool    bIsSelected;    // protected by base class mutex
 
     sal_Bool    IsSelected();
@@ -102,6 +107,9 @@ public:
 
     // XAccessibleValue
 
+    //=====  XAccessibleExtendedAttributes ================================================
+    ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
+        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
 private:
     SwFrmFmt* GetTblBoxFormat() const;
 
@@ -118,6 +126,39 @@ public:
 
     virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue(  )
         throw (::com::sun::star::uno::RuntimeException);
+    //=====  XAccessibleComponent  ============================================
+    sal_Int32 SAL_CALL getBackground()
+        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 );
+
+    SwAccessibleTable *GetTable();
+    ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xTableReference;
+    SwAccessibleTable *m_pAccTable;
 };
 
 #endif
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 1b02418..893c63c 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -44,6 +44,7 @@
 #include <acccontext.hxx>
 #include <svx/AccessibleShape.hxx>
 #include <comphelper/accessibleeventnotifier.hxx>
+#include "accpara.hxx"
 #include <PostItMgr.hxx>
 
 using namespace sw::access;
@@ -185,8 +186,7 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
                             "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
                     const SwFrm* pLower( rLower.GetSwFrm() );
                     ::rtl::Reference< SwAccessibleContext > xAccImpl =
-                        GetMap()->GetContextImpl( pLower, SCROLLED_OUT == eAction ||
-                                                SCROLLED_IN == eAction );
+                        GetMap()->GetContextImpl( pLower, true );
                     if( xAccImpl.is() )
                     {
                         switch( eAction )
@@ -219,8 +219,7 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
                     ::rtl::Reference< ::accessibility::AccessibleShape > xAccImpl =
                         GetMap()->GetContextImpl( rLower.GetDrawObject(),
                                                   this,
-                                                  SCROLLED_OUT == eAction ||
-                                                  SCROLLED_IN == eAction );
+                                                  true );
                     if( xAccImpl.is() )
                     {
                         switch( eAction )
@@ -240,8 +239,6 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
                                 xAccImpl->ViewForwarderChanged(
                                     ::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA,
                                     GetMap() );
-                                DisposeShape( rLower.GetDrawObject(),
-                                              xAccImpl.get() );
                             }
                             break;
                         case NONE:
@@ -348,9 +345,6 @@ void SwAccessibleContext::ScrolledOut( const SwRect& rOldVisArea )
     // It might be that the child is freshly created just to send
     // the child event. In this case no listener will exist.
     FireStateChangedEvent( AccessibleStateType::SHOWING, sal_False );
-
-    // We now dispose the frame
-    Dispose( sal_True );
 }
 
 // #i27301# - use new type definition for <_nStates>
@@ -483,8 +477,12 @@ void SwAccessibleContext::GetStates(
 
     // EDITABLE
     if( bIsEditableState )
+    //Set editable state to graphic and other object when the document is editable
+    {
         rStateSet.AddState( AccessibleStateType::EDITABLE );
-
+        rStateSet.AddState( AccessibleStateType::RESIZABLE );
+        rStateSet.AddState( AccessibleStateType::MOVEABLE );
+    }
     // ENABLED
     rStateSet.AddState( AccessibleStateType::ENABLED );
 
@@ -520,6 +518,10 @@ SwAccessibleContext::SwAccessibleContext( SwAccessibleMap *pM,
     , nRole( nR )
     , bDisposing( sal_False )
     , bRegisteredAtAccessibleMap( true )
+    //Initialize the begin document load and IfAsynLoad to true
+    , bBeginDocumentLoad( sal_True )
+    , isIfAsynLoad( sal_True )
+    , bIsSeletedInDoc( sal_False)
 {
     InitStates();
 }
@@ -544,6 +546,9 @@ sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleChildCount( void )
     SolarMutexGuard aGuard;
 
     CHECK_FOR_DEFUNC( XAccessibleContext )
+    //Notify the frame is a document
+    if( nRole == AccessibleRole::DOCUMENT )
+        bIsAccDocUse = sal_True;
 
     return bDisposing ? 0 : GetChildCount( *(GetMap()) );
 }
@@ -556,6 +561,10 @@ uno::Reference< XAccessible> SAL_CALL
 
     CHECK_FOR_DEFUNC( XAccessibleContext )
 
+    //Notify the frame is a document
+    if( nRole == AccessibleRole::DOCUMENT )
+        bIsAccDocUse = sal_True;
+
     const SwAccessibleChild aChild( GetChild( *(GetMap()), nIndex ) );
     if( !aChild.IsValid() )
     {
@@ -571,6 +580,24 @@ uno::Reference< XAccessible> SAL_CALL
     {
         ::rtl::Reference < SwAccessibleContext > xChildImpl(
                 GetMap()->GetContextImpl( aChild.GetSwFrm(), !bDisposing )  );
+        //Send out accessible event when begin load.
+        if( bBeginDocumentLoad && nRole == AccessibleRole::DOCUMENT )
+        {
+
+            FireStateChangedEvent( AccessibleStateType::FOCUSABLE,sal_True );
+            FireStateChangedEvent( AccessibleStateType::BUSY,sal_True );
+            if( !isIfAsynLoad )
+            {
+                FireStateChangedEvent( AccessibleStateType::FOCUSED,sal_True );
+                // OFFSCREEN == !SHOWING, should stay consistent
+                // FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_True );
+                FireStateChangedEvent( AccessibleStateType::SHOWING,sal_True );
+                FireStateChangedEvent( AccessibleStateType::BUSY,sal_False );
+                // OFFSCREEN again?
+                // FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_False );
+            }
+            bBeginDocumentLoad = sal_False;
+        }
         if( xChildImpl.is() )
         {
             xChildImpl->SetParent( this );
@@ -680,6 +707,9 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
     ::utl::AccessibleStateSetHelper *pStateSet =
         new ::utl::AccessibleStateSetHelper;
 
+    if( bIsSeletedInDoc )
+        pStateSet->AddState( AccessibleStateType::SELECTED );
+
     uno::Reference<XAccessibleStateSet> xStateSet( pStateSet );
     GetStates( *pStateSet );
 
@@ -941,13 +971,13 @@ uno::Any SAL_CALL SwAccessibleContext::getAccessibleKeyBinding()
 sal_Int32 SAL_CALL SwAccessibleContext::getForeground()
         throw (uno::RuntimeException)
 {
-    return 0;
+    return COL_BLACK;
 }
 
 sal_Int32 SAL_CALL SwAccessibleContext::getBackground()
         throw (uno::RuntimeException)
 {
-    return 0xffffff;
+    return COL_WHITE;
 }
 
 OUString SAL_CALL SwAccessibleContext::getImplementationName()
@@ -993,6 +1023,10 @@ void SwAccessibleContext::DisposeShape( const SdrObject *pObj,
 void SwAccessibleContext::ScrolledInShape( const SdrObject* ,
                                 ::accessibility::AccessibleShape *pAccImpl )
 {
+    if(NULL == pAccImpl)
+    {
+        return ;
+    }
     AccessibleEventObject aEvent;
     aEvent.EventId = AccessibleEventId::CHILD;
     uno::Reference< XAccessible > xAcc( pAccImpl );
@@ -1133,13 +1167,10 @@ void SwAccessibleContext::InvalidatePosOrSize( const SwRect& )
     if( !bIsNewShowingState &&
         SwAccessibleChild( GetParent() ).IsVisibleChildrenOnly() )
     {
-        // The frame is now invisible -> dispose it
-        Dispose( sal_True );
-    }
-    else
-    {
-        _InvalidateContent( sal_True );
+        return;
     }
+
+    _InvalidateContent( sal_True );
 }
 
 void SwAccessibleContext::InvalidateChildPosOrSize(
@@ -1465,4 +1496,15 @@ void SwAccessibleContext::GetAdditionalAccessibleChildren( std::vector< Window*
     }
 }
 
+sal_Bool SwAccessibleContext::SetSelectedState(sal_Bool bSeleted)
+{
+    if(bIsSeletedInDoc != bSeleted)
+    {
+        bIsSeletedInDoc = bSeleted;
+        FireStateChangedEvent( AccessibleStateType::SELECTED, bSeleted );
+        return sal_True;
+    }
+    return sal_False;
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx
index b8d164b..e99b1f9 100644
--- a/sw/source/core/access/acccontext.hxx
+++ b/sw/source/core/access/acccontext.hxx
@@ -89,6 +89,8 @@ private:
     bool bRegisteredAtAccessibleMap;
 
     void InitStates();
+    //Add a member to identify the firt time that document load
+    sal_Bool bBeginDocumentLoad;
 
 protected:
     void SetName( const OUString& rName ) { sName = rName; }
@@ -96,7 +98,10 @@ protected:
     {
         return nRole;
     }
-
+    //Add a member to identify if the document is Asyn load.
+    sal_Bool isIfAsynLoad;
+    //This flag is used to mark the object's selected state.
+    sal_Bool   bIsSeletedInDoc;
     void SetParent( SwAccessibleContext *pParent );
     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> GetWeakParent() const;
 
@@ -161,6 +166,7 @@ protected:
     virtual void _InvalidateFocus();
 
 public:
+    void SetMap(SwAccessibleMap *pM){pMap = pM;}
     void FireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventObject& rEvent );
 
 protected:
@@ -372,6 +378,10 @@ public:
         return Select( 0, pObj, bAdd );
     }
 
+    //This method is used to updated the selected state and fire the selected state changed event.
+    virtual sal_Bool SetSelectedState(sal_Bool bSeleted);
+    sal_Bool  IsSeletedInDoc(){  return bIsSeletedInDoc; }
+
     static OUString GetResource( sal_uInt16 nResId,
                                         const OUString *pArg1 = 0,
                                         const OUString *pArg2 = 0 );
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index 5fb1e5f..7403608 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -36,6 +36,29 @@
 #include "access.hrc"
 #include <pagefrm.hxx>
 
+#include <editeng/brushitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+#include "unostyle.hxx"
+#include "viewsh.hxx"
+#include "docsh.hxx"
+#include <crsrsh.hxx>
+#include "fesh.hxx"
+#include <fmtclds.hxx>
+#include <flyfrm.hxx>
+#include <colfrm.hxx>
+#include <txtfrm.hxx>
+#include <sectfrm.hxx>
+#include <section.hxx>
+#include <svx/unoapi.hxx>
+#include <swmodule.hxx>
+#include <svtools/colorcfg.hxx>
+
+#include <fmtanchr.hxx>
+#include <viewimp.hxx>
+#include <dview.hxx>
+#include <dcontact.hxx>
+#include <svx/svdmark.hxx>
 const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentView";
 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentView";
 
@@ -160,8 +183,15 @@ sal_Int32 SAL_CALL SwAccessibleDocumentBase::getAccessibleIndexInParent (void)
 
     for( sal_Int32 i=0; i < nCount; i++ )
     {
-        if( xAcc->getAccessibleChild( i ) == xThis )
-            return i;
+        try
+        {
+            if( xAcc->getAccessibleChild( i ) == xThis )
+                return i;
+        }
+        catch(::com::sun::star::lang::IndexOutOfBoundsException e)
+        {
+            return -1L;
+        }
     }
     return -1L;
 }
@@ -172,20 +202,58 @@ OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleDescription (void)
     return GetResource( STR_ACCESS_DOC_DESC );
 }
 
+OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleName (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    OUString sAccName = GetResource( STR_ACCESS_DOC_WORDPROCESSING );
+    SwDoc *pDoc = GetShell()->GetDoc();
+    if ( pDoc )
+    {
+        OUString sFileName = pDoc->getDocAccTitle();
+        if ( sFileName.isEmpty() )
+        {
+            SwDocShell* pDocSh = pDoc->GetDocShell();
+            if ( pDocSh )
+            {
+                sFileName = pDocSh->GetTitle( SFX_TITLE_APINAME );
+            }
+        }
+        OUString sReadOnly;
+        if(pDoc->getDocReadOnly())
+        {
+            sReadOnly = GetResource( STR_ACCESS_DOC_WORDPROCESSING_READONLY );
+        }
+
+        if ( !sFileName.isEmpty() )
+        {
+            sAccName = sFileName + sReadOnly + " - " + sAccName;
+        }
+    }
+
+    return sAccName;
+}
+
 awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds()
         throw (uno::RuntimeException)
 {
-    SolarMutexGuard aGuard;
+    try
+    {
+        SolarMutexGuard aGuard;
 
-    Window *pWin = GetWindow();
+        Window *pWin = GetWindow();
 
-    CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+        CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
 
-    Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) );
-    awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
-                         aPixBounds.GetWidth(), aPixBounds.GetHeight() );
+        Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) );
+        awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
+                             aPixBounds.GetWidth(), aPixBounds.GetHeight() );
 
-    return aBox;
+        return aBox;
+    }
+    catch(::com::sun::star::lang::IndexOutOfBoundsException e)
+    {
+        return awt::Rectangle();
+    }
 }
 
 awt::Point SAL_CALL SwAccessibleDocumentBase::getLocation()
@@ -280,6 +348,7 @@ void SwAccessibleDocument::GetStates(
 
     // MULTISELECTABLE
     rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
+    rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
 }
 
 SwAccessibleDocument::SwAccessibleDocument ( SwAccessibleMap* pInitMap ) :
@@ -398,6 +467,22 @@ uno::Any SwAccessibleDocument::queryInterface(
         uno::Reference<XAccessibleSelection> aSelect = this;
         aRet <<= aSelect;
     }
+    //Add XEventListener interface support.
+    else if ( (rType == ::getCppuType((uno::Reference<com::sun::star::document::XEventListener> *)NULL)) )
+    {
+        uno::Reference<com::sun::star::document::XEventListener> aSelect = this;
+        aRet <<= aSelect;
+    }
+    else  if ( rType == ::getCppuType((uno::Reference<XAccessibleExtendedAttributes> *)NULL) )
+    {
+        uno::Reference<XAccessibleExtendedAttributes> aAttribute = this;
+        aRet <<= aAttribute;
+    }
+    else if(rType == ::getCppuType((uno::Reference<XAccessibleGetAccFlowTo> *)NULL) )
+    {
+        uno::Reference<XAccessibleGetAccFlowTo> AccFlowTo = this;
+        aRet <<= AccFlowTo;
+    }
     else
         aRet = SwAccessibleContext::queryInterface( rType );
     return aRet;
@@ -410,11 +495,14 @@ uno::Sequence< uno::Type > SAL_CALL SwAccessibleDocument::getTypes()
     uno::Sequence< uno::Type > aTypes( SwAccessibleDocumentBase::getTypes() );
 
     sal_Int32 nIndex = aTypes.getLength();
-    aTypes.realloc( nIndex + 1 );
+    //Reset types memory alloc
+    //aTypes.realloc( nIndex + 1 );
+    aTypes.realloc( nIndex + 2 );
 
     uno::Type* pTypes = aTypes.getArray();
     pTypes[nIndex] = ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) );
-
+    //Add XEventListener interface support.
+    pTypes[nIndex + 1 ] = ::getCppuType( static_cast< uno::Reference< com::sun::star::document::XEventListener > * >( 0 ) );
     return aTypes;
 }
 
@@ -482,4 +570,404 @@ void SwAccessibleDocument::deselectAccessibleChild(
     maSelectionHelper.deselectAccessibleChild( nChildIndex );
 }
 
+//Implement XEventListener interfaces
+void SAL_CALL SwAccessibleDocument::notifyEvent( const ::com::sun::star::document::EventObject& Event )
+            throw (::com::sun::star::uno::RuntimeException)
+{
+    if ( Event.EventName.equalsAscii( "FirstPageShows" ) )
+    {
+        FireStateChangedEvent( AccessibleStateType::FOCUSED,sal_True );
+    }
+    else if ( Event.EventName.equalsAscii( "LoadFinished" ) )
+    {
+        // IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent
+        // FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_True );
+        // MT: LoadFinished => Why not SHOWING == TRUE?
+        FireStateChangedEvent( AccessibleStateType::SHOWING,sal_False );
+    }
+    else if ( Event.EventName.equalsAscii( "FormatFinished" ) )
+    {
+        FireStateChangedEvent( AccessibleStateType::BUSY,sal_False );
+        // FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_False );
+        FireStateChangedEvent( AccessibleStateType::SHOWING,sal_True );
+    }
+    else
+    {
+        isIfAsynLoad = sal_False;
+    }
+}
+
+void SAL_CALL SwAccessibleDocument::disposing( const ::com::sun::star::lang::EventObject& )
+            throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes()
+        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+    uno::Any anyAtrribute;
+    SwDoc *pDoc = GetShell()->GetDoc();
+
+    if (!pDoc)
+        return anyAtrribute;
+    SwCrsrShell* pCrsrShell = GetCrsrShell();
+    if( !pCrsrShell )
+        return anyAtrribute;
+
+    SwFEShell* pFEShell = pCrsrShell->ISA( SwFEShell )
+                                ? static_cast<SwFEShell*>( pCrsrShell )
+                            : 0;
+    OUString sAttrName;
+    OUString sValue;
+    sal_uInt16 nPage, nLogPage;
+    OUString sDisplay;
+
+    if( pFEShell )
+    {
+        pFEShell->GetPageNumber(-1,sal_True,nPage,nLogPage,sDisplay);
+        sAttrName = "page-name:";
+
+
+        sValue = sAttrName + sDisplay ;
+        sAttrName = ";page-number:";
+        sValue += sAttrName;
+        sValue += OUString::number( nPage ) ;
+        sAttrName = ";total-pages:";
+        sValue += sAttrName;
+        sValue += OUString::number( pCrsrShell->GetPageCnt() ) ;
+        sValue += ";";
+
+
+        sAttrName = "line-number:";
+
+
+
+        SwCntntFrm* pCurrFrm = pCrsrShell->GetCurrFrm();
+        SwPageFrm* pCurrPage=((SwFrm*)pCurrFrm)->FindPageFrm();
+        sal_uLong nLineNum = 0;
+        SwTxtFrm* pTxtFrm = NULL;
+        SwTxtFrm* pCurrTxtFrm = NULL;
+        pTxtFrm = static_cast< SwTxtFrm* >(static_cast< SwPageFrm* > (pCurrPage)->ContainsCntnt());
+        if (pCurrFrm->IsInFly())//such as, graphic,chart
+        {
+            SwFlyFrm *pFlyFrm = pCurrFrm->FindFlyFrm();
+            const SwFmtAnchor& rAnchor = pFlyFrm->GetFmt()->GetAnchor();
+            RndStdIds eAnchorId = rAnchor.GetAnchorId();
+            if(eAnchorId == FLY_AS_CHAR)
+            {
+                const SwFrm *pSwFrm = pFlyFrm->GetAnchorFrm();
+                if(pSwFrm->IsTxtFrm())
+                    pCurrTxtFrm = ((SwTxtFrm*)(pSwFrm));
+            }
+        }
+        else
+            pCurrTxtFrm = static_cast< SwTxtFrm* >(pCurrFrm);
+        //check whether the text frame where the Graph/OLE/Frame anchored is in the Header/Footer
+        SwFrm* pFrm = pCurrTxtFrm;
+        while ( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() )
+            pFrm = pFrm->GetUpper();
+        if ( pFrm )
+            pCurrTxtFrm = NULL;
+        //check shape
+        if(pCrsrShell->Imp()->GetDrawView())
+        {
+            const SdrMarkList &rMrkList = pCrsrShell->Imp()->GetDrawView()->GetMarkedObjectList();
+            for ( sal_uInt16 i = 0; i < rMrkList.GetMarkCount(); ++i )
+            {
+                SdrObject *pObj = rMrkList.GetMark(i)->GetMarkedSdrObj();
+                SwFrmFmt* pFmt = ((SwDrawContact*)pObj->GetUserCall())->GetFmt();
+                const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+                if( FLY_AS_CHAR != rAnchor.GetAnchorId() )
+                    pCurrTxtFrm = NULL;
+            }
+        }
+        //calculate line number
+        if (pCurrTxtFrm && pTxtFrm)
+        {
+            if (!(pCurrTxtFrm->IsInTab() || pCurrTxtFrm->IsInFtn()))
+            {
+                while( pTxtFrm != pCurrTxtFrm )
+                {
+                    //check header/footer
+                    pFrm = pTxtFrm;
+                    while ( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() )
+                        pFrm = pFrm->GetUpper();
+                    if ( pFrm )
+                    {
+                        pTxtFrm = static_cast< SwTxtFrm*>(pTxtFrm->GetNextCntntFrm());
+                        continue;
+                    }
+                    if (!(pTxtFrm->IsInTab() || pTxtFrm->IsInFtn() || pTxtFrm->IsInFly()))
+                        nLineNum += pTxtFrm->GetThisLines();
+                    pTxtFrm = static_cast< SwTxtFrm* >(pTxtFrm ->GetNextCntntFrm());
+                }
+                SwPaM* pCaret = pCrsrShell->GetCrsr();
+                if (!pCurrTxtFrm->IsEmpty() && pCaret)
+                {
+                    sal_uInt16 nActPos = 0;
+                    if (pCurrTxtFrm->IsTxtFrm())
+                    {
+                        const SwPosition* pPoint = NULL;
+                        if(pCurrTxtFrm->IsInFly())
+                        {
+                            SwFlyFrm *pFlyFrm = pCurrTxtFrm->FindFlyFrm();
+                            const SwFmtAnchor& rAnchor = pFlyFrm->GetFmt()->GetAnchor();
+                            pPoint= rAnchor.GetCntntAnchor();
+                        }
+                        else
+                            pPoint = pCaret->GetPoint();
+                        nActPos = pPoint->nContent.GetIndex();
+                        nLineNum += pCurrTxtFrm->GetLineCount( nActPos );
+                    }
+                    else//graphic, form, shape, etc.
+                    {
+                        SwPosition* pPoint =  pCaret->GetPoint();
+                        Point aPt = pCrsrShell->_GetCrsr()->GetPtPos();
+                        if( pCrsrShell->GetLayout()->GetCrsrOfst( pPoint, aPt/*,* &eTmpState*/ ) )
+                        {
+                            nActPos = pPoint->nContent.GetIndex();
+                            nLineNum += pCurrTxtFrm->GetLineCount( nActPos );
+                        }
+                    }
+                }
+                else
+                    ++nLineNum;
+            }
+        }
+
+        sValue += sAttrName;
+        sValue += OUString::number( nLineNum ) ;
+
+        sValue += ";";
+
+
+        SwFrm* pCurrCol=((SwFrm*)pCurrFrm)->FindColFrm();
+
+        sAttrName = "column-number:";
+        sValue += sAttrName;
+
+        sal_uInt16 nCurrCol = 1;
+        if(pCurrCol!=NULL)
+        {
+            //SwLayoutFrm* pParent = pCurrCol->GetUpper();
+            SwFrm* pCurrPageCol=((SwFrm*)pCurrFrm)->FindColFrm();
+            while(pCurrPageCol && pCurrPageCol->GetUpper() && pCurrPageCol->GetUpper()->IsPageFrm())
+            {
+                pCurrPageCol = pCurrPageCol->GetUpper();
+            }
+
+            SwLayoutFrm* pParent = (SwLayoutFrm*)(pCurrPageCol->GetUpper());
+
+            if(pParent!=NULL)
+            {
+                SwFrm* pCol = pParent->Lower();
+                while(pCol&&(pCol!=pCurrPageCol))
+                {
+                    pCol = pCol->GetNext();
+                    nCurrCol +=1;
+                }
+            }
+        }
+        sValue += OUString::number( nCurrCol ) ;
+        sValue += ";";
+
+        sAttrName = "total-columns:";
+
+        const SwFmtCol &rFmtCol=pCurrPage->GetAttrSet()->GetCol();
+        sal_uInt16 nColCount=rFmtCol.GetNumCols();
+        nColCount = nColCount>0?nColCount:1;
+        sValue += sAttrName;
+        sValue += OUString::number( nColCount ) ;
+
+        sValue += ";";
+
+        if(pCurrFrm!=NULL)
+        {
+            SwSectionFrm* pCurrSctFrm=((SwFrm*)pCurrFrm)->FindSctFrm();
+            if(pCurrSctFrm!=NULL && pCurrSctFrm->GetSection()!=NULL )
+            {
+                sAttrName = "section-name:";
+
+                sValue += sAttrName;
+                OUString sectionName = pCurrSctFrm->GetSection()->GetSectionName();
+
+                sectionName = sectionName.replaceFirst( "\\" , "\\\\" );
+                sectionName = sectionName.replaceFirst( "=" , "\\=" );
+                sectionName = sectionName.replaceFirst( ";" , "\\;" );
+                sectionName = sectionName.replaceFirst( "," , "\\," );
+                sectionName = sectionName.replaceFirst( ":" , "\\:" );
+
+                sValue += sectionName;
+
+                sValue += ";";
+
+                //section-columns-number
+                {
+                sAttrName = "section-columns-number:";
+
+                nCurrCol = 1;
+
+                if(pCurrCol!=NULL)
+                {
+                    SwLayoutFrm* pParent = pCurrCol->GetUpper();
+                    if(pParent!=NULL)
+                    {
+                        SwFrm* pCol = pParent->Lower();
+                        while(pCol&&(pCol!=pCurrCol))
+                        {
+                            pCol = pCol->GetNext();
+                            nCurrCol +=1;
+                        }
+                    }
+                }
+                sValue += sAttrName;
+                sValue += OUString::number( nCurrCol ) ;
+                sValue += ";";
+                }
+
+                //section-total-columns
+                {
+                sAttrName = "section-total-columns:";
+                const SwFmtCol &rFmtSctCol=pCurrSctFrm->GetAttrSet()->GetCol();
+                sal_uInt16 nSctColCount=rFmtSctCol.GetNumCols();
+                nSctColCount = nSctColCount>0?nSctColCount:1;
+                sValue += sAttrName;
+                sValue += OUString::number( nSctColCount ) ;
+
+                sValue += ";";
+                }
+            }
+        }
+        anyAtrribute <<= sValue;
+    }
+    return anyAtrribute;
+}
+
+sal_Int32 SAL_CALL SwAccessibleDocument::getBackground()
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    SolarMutexGuard aGuard;
+    return SW_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+        SAL_CALL SwAccessibleDocument::get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
+        throw ( ::com::sun::star::uno::RuntimeException )
+{
+    const sal_Int32 FORSPELLCHECKFLOWTO = 1;
+    const sal_Int32 FORFINDREPLACEFLOWTO = 2;
+    SwAccessibleMap* pAccMap = GetMap();
+    if ( !pAccMap )
+    {
+        return uno::Sequence< uno::Any >();
+    }
+
+    if ( nType == FORSPELLCHECKFLOWTO )
+    {
+        uno::Reference< ::com::sun::star::drawing::XShape > xShape;
+        rAny >>= xShape;
+        if( xShape.is() )
+        {
+            SdrObject* pObj = GetSdrObjectFromXShape(xShape);
+            if( pObj )
+            {
+                uno::Reference<XAccessible> xAcc = pAccMap->GetContext(pObj, this, sal_False);
+                uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY );
+                if ( xAccSelection.is() )
+                {
+                    try
+                    {
+                        if ( xAccSelection->getSelectedAccessibleChildCount() )
+                        {
+                            uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 );
+                            if ( xSel.is() )
+                            {
+                                uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() );
+                                if ( xSelContext.is() )
+                                {
+                                    //if in sw we find the selected paragraph here
+                                    if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+                                    {
+                                        uno::Sequence<uno::Any> aRet( 1 );
+                                        aRet[0] = uno::makeAny( xSel );
+                                        return aRet;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    catch ( const com::sun::star::lang::IndexOutOfBoundsException& )
+                    {
+                        return uno::Sequence< uno::Any >();
+                    }
+                    //end of try...catch
+                }
+            }
+        }
+        else
+        {
+            uno::Reference< XAccessible > xAcc = pAccMap->GetCursorContext();
+            SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
+            if ( pAccImpl && pAccImpl->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+            {
+                uno::Sequence< uno::Any > aRet(1);
+                aRet[0] = uno::makeAny( xAcc );
+                return aRet;
+            }
+        }
+    }
+    else if ( nType == FORFINDREPLACEFLOWTO )
+    {
+        SwCrsrShell* pCrsrShell = GetCrsrShell();
+        if ( pCrsrShell )
+        {
+            SwPaM *_pStartCrsr = pCrsrShell->GetCrsr(), *__pStartCrsr = _pStartCrsr;
+            SwCntntNode* pPrevNode = NULL;
+            std::vector<SwFrm*> vFrmList;
+            do
+            {
+                if ( _pStartCrsr && _pStartCrsr->HasMark() )
+                {
+                    SwCntntNode* pCntntNode = _pStartCrsr->GetCntntNode();
+                    if ( pCntntNode == pPrevNode )
+                    {
+                        continue;
+                    }
+                    SwFrm* pFrm = pCntntNode ? pCntntNode->getLayoutFrm( pCrsrShell->GetLayout() ) : NULL;
+                    if ( pFrm )
+                    {
+                        vFrmList.push_back( pFrm );
+                    }
+
+                    pPrevNode = pCntntNode;
+                }
+            }
+
+            while( _pStartCrsr && ( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr) );
+
+            if ( vFrmList.size() )
+            {
+                uno::Sequence< uno::Any > aRet(vFrmList.size());
+                std::vector<SwFrm*>::iterator aIter = vFrmList.begin();
+                for ( sal_Int32 nIndex = 0; aIter != vFrmList.end(); aIter++, nIndex++ )
+                {
+                    uno::Reference< XAccessible > xAcc = pAccMap->GetContext(*aIter, sal_False);
+                    if ( xAcc.is() )
+                    {
+                        SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
+                        if ( pAccImpl && pAccImpl->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+                        {
+                            aRet[nIndex] = uno::makeAny( xAcc );
+                        }
+                    }
+                }
+
+                return aRet;
+            }
+        }
+    }
+
+    return uno::Sequence< uno::Any >();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx
index 2ff5576..580e0bf 100644
--- a/sw/source/core/access/accdoc.hxx
+++ b/sw/source/core/access/accdoc.hxx
@@ -22,6 +22,9 @@
 
 #include "acccontext.hxx"
 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
 #include <accselectionhelper.hxx>
 
 class VclSimpleEvent;
@@ -74,6 +77,8 @@ public:
     virtual OUString SAL_CALL
         getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException);
 
+    virtual OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
+
     // XAccessibleComponent
     virtual sal_Bool SAL_CALL containsPoint(
             const ::com::sun::star::awt::Point& aPoint )
@@ -101,7 +106,10 @@ public:
  * access to an accessible Writer document
  */
 class SwAccessibleDocument : public SwAccessibleDocumentBase,
-                             public com::sun::star::accessibility::XAccessibleSelection
+                             public com::sun::star::accessibility::XAccessibleSelection,
+                             public com::sun::star::document::XEventListener,
+                             public com::sun::star::accessibility::XAccessibleExtendedAttributes,
+                             public com::sun::star::accessibility::XAccessibleGetAccFlowTo
 {
     // Implementation for XAccessibleSelection interface
     SwAccessibleSelectionHelper maSelectionHelper;
@@ -117,6 +125,11 @@ public:
     SwAccessibleDocument( SwAccessibleMap* pInitMap );
 
     DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
+    //=====  XEventListener====================================================
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event )
+            throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Event )
+            throw (::com::sun::star::uno::RuntimeException);
 
     // XServiceInfo
 
@@ -184,10 +197,22 @@ public:
         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
                 ::com::sun::star::uno::RuntimeException );
 
+    virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
+        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+
     // thread safe C++ interface
 
     // The object is not visible an longer and should be destroyed
     virtual void Dispose( sal_Bool bRecursive = sal_False );
+
+    // XAccessibleComponent
+    sal_Int32 SAL_CALL getBackground()
+        throw (::com::sun::star::uno::RuntimeException);
+
+    // XAccessibleGetAccFlowTo
+    ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+        SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
+        throw ( ::com::sun::star::uno::RuntimeException );
 };
 
 #endif
diff --git a/sw/source/core/access/accembedded.cxx b/sw/source/core/access/accembedded.cxx
index 8994438..7744efc 100644
--- a/sw/source/core/access/accembedded.cxx
+++ b/sw/source/core/access/accembedded.cxx
@@ -23,6 +23,12 @@
 #include <comphelper/servicehelper.hxx>
 #include <flyfrm.hxx>
 #include "accembedded.hxx"
+#include "cntfrm.hxx"
+#include "ndole.hxx"
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <../../ui/inc/wrtsh.hxx>
+#include <../../ui/inc/view.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::lang;
@@ -42,6 +48,32 @@ SwAccessibleEmbeddedObject::~SwAccessibleEmbeddedObject()
 {
 }
 
+//=====  XInterface  ==========================================================
+com::sun::star::uno::Any SAL_CALL
+    SwAccessibleEmbeddedObject::queryInterface (const com::sun::star::uno::Type & rType)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+    ::com::sun::star::uno::Any aReturn = SwAccessibleNoTextFrame::queryInterface (rType);
+    if ( ! aReturn.hasValue())
+        aReturn = ::cppu::queryInterface (rType,
+         static_cast< ::com::sun::star::accessibility::XAccessibleExtendedAttributes* >(this) );
+    return aReturn;
+}
+
+void SAL_CALL
+    SwAccessibleEmbeddedObject::acquire (void)
+    throw ()
+{
+    SwAccessibleNoTextFrame::acquire ();
+}
+
+void SAL_CALL
+    SwAccessibleEmbeddedObject::release (void)
+    throw ()
+{
+    SwAccessibleNoTextFrame::release ();
+}
+
 OUString SAL_CALL SwAccessibleEmbeddedObject::getImplementationName()
         throw( uno::RuntimeException )
 {
@@ -79,4 +111,31 @@ uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleEmbeddedObject::getImplementation
     return theSwAccessibleEmbeddedObjectImplementationId::get().getSeq();
 }
 
+// XAccessibleExtendedAttributes
+::com::sun::star::uno::Any SAL_CALL SwAccessibleEmbeddedObject::getExtendedAttributes()
+        throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+    ::com::sun::star::uno::Any strRet;
+    OUString style;
+    SwFlyFrm* pFFrm = getFlyFrm();
+
+    if( pFFrm )
+    {
+        style = "style:";
+        SwCntntFrm* pCFrm;
+        pCFrm = pFFrm->ContainsCntnt();
+        if( pCFrm )
+        {
+            SwCntntNode* pCNode = pCFrm->GetNode();
+            if( pCNode )
+            {
+                style += ((SwOLENode*)pCNode)->GetOLEObj().GetStyleString();
+            }
+        }
+        style += ";";
+    }
+    strRet <<= style;
+    return strRet;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/accembedded.hxx b/sw/source/core/access/accembedded.hxx
index a459eb1..097b468 100644
--- a/sw/source/core/access/accembedded.hxx
+++ b/sw/source/core/access/accembedded.hxx
@@ -22,7 +22,11 @@
 
 #include "accnotextframe.hxx"
 
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+
 class SwAccessibleEmbeddedObject : public   SwAccessibleNoTextFrame
+            , public ::com::sun::star::accessibility::XAccessibleExtendedAttributes
+
 {
 protected:
     virtual ~SwAccessibleEmbeddedObject();
@@ -31,6 +35,20 @@ public:
     SwAccessibleEmbeddedObject( SwAccessibleMap* pInitMap,
                                 const SwFlyFrm* pFlyFrm );
 
+    // XInterface
+
+    virtual com::sun::star::uno::Any SAL_CALL
+        queryInterface (const com::sun::star::uno::Type & rType)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    virtual void SAL_CALL
+        acquire (void)
+        throw ();
+
+    virtual void SAL_CALL
+        release (void)
+        throw ();
+
     // XServiceInfo
 
     // Returns an identifier for the implementation of this object.
@@ -51,6 +69,10 @@ public:
 
     // XTypeProvider
     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) 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) ;
 };
 
 #endif
diff --git a/sw/source/core/access/accfield.cxx b/sw/source/core/access/accfield.cxx
new file mode 100644
index 0000000..cb9532c
--- /dev/null
+++ b/sw/source/core/access/accfield.cxx
@@ -0,0 +1,314 @@
+/*
+ * 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 <comphelper/accessiblekeybindinghelper.hxx>
+#include <swurl.hxx>
+#include <vcl/svapp.hxx>
+#include <ndtxt.hxx>
+#include <txtinet.hxx>
+
+#include <accpara.hxx>
+#include <accfield.hxx>
+
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/document/XLinkTargetSupplier.hpp>
+#include <comphelper/accessibleeventnotifier.hxx>
+
+//Add end
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+
+SwAccessibleField::SwAccessibleField( SwField *pSwFld,SwAccessibleParagraph *p,sal_Int16 nRole) :
+    m_xPara( p ),m_pSwField(pSwFld),m_nRole(nRole)
+{
+    m_nClientId=0;
+}
+
+uno::Reference< XAccessibleContext > SAL_CALL
+    SwAccessibleField::getAccessibleContext( void )
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    uno::Reference < XAccessibleContext > xRet( this );
+    return xRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleField::getAccessibleChildCount( void )
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    SolarMutexGuard aGuard;
+    return 0;
+}
+
+uno::Reference< XAccessible> SAL_CALL
+    SwAccessibleField::getAccessibleChild( sal_Int32 )
+        throw (::com::sun::star::uno::RuntimeException,
+                ::com::sun::star::lang::IndexOutOfBoundsException)
+{
+    SolarMutexGuard aGuard;
+    return uno::Reference< XAccessible >();
+}
+
+uno::Reference< XAccessible> SAL_CALL SwAccessibleField::getAccessibleParent (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    SolarMutexGuard aGuard;
+
+    uno::Reference< XAccessible > xParent(static_cast<XAccessible*>(m_xPara.get()),UNO_QUERY);
+    return xParent;
+}
+
+sal_Int32 SAL_CALL SwAccessibleField::getAccessibleIndexInParent (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    SolarMutexGuard aGuard;
+    return 0;
+}
+
+sal_Int16 SAL_CALL SwAccessibleField::getAccessibleRole (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    return m_nRole;
+}
+
+OUString SAL_CALL SwAccessibleField::getAccessibleDescription (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    OSL_ENSURE( !this, "description needs to be overloaded" );
+    return OUString();
+}
+
+OUString SAL_CALL SwAccessibleField::getAccessibleName (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    return OUString();
+}
+
+uno::Reference< XAccessibleRelationSet> SAL_CALL
+    SwAccessibleField::getAccessibleRelationSet (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    return NULL;
+}
+
+uno::Reference<XAccessibleStateSet> SAL_CALL
+    SwAccessibleField::getAccessibleStateSet (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    SolarMutexGuard aGuard;
+    return uno::Reference<XAccessibleStateSet>();
+}
+
+com::sun::star::lang::Locale SAL_CALL SwAccessibleField::getLocale (void)
+        throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException)
+{
+    SolarMutexGuard aGuard;
+
+    com::sun::star::lang::Locale aLoc( Application::GetSettings().GetLanguageTag().getLocale() );
+    return aLoc;
+}
+
+static sal_Bool lcl_PointInRectangle(const awt::Point & aPoint,
+                                     const awt::Rectangle & aRect)
+{
+    long nDiffX = aPoint.X - aRect.X;
+    long nDiffY = aPoint.Y - aRect.Y;
+
+    return
+        nDiffX >= 0 && nDiffX < aRect.Width && nDiffY >= 0 &&
+        nDiffY < aRect.Height;
+
+}
+
+sal_Bool SAL_CALL SwAccessibleField::containsPoint(
+            const ::com::sun::star::awt::Point& aPoint )
+        throw (RuntimeException)
+{
+    awt::Rectangle aPixBounds = getBoundsImpl(sal_True);
+    aPixBounds.X = 0;
+    aPixBounds.Y = 0;
+
+    return lcl_PointInRectangle(aPoint, aPixBounds);
+}
+
+uno::Reference< XAccessible > SAL_CALL SwAccessibleField::getAccessibleAtPoint(
+                const awt::Point& aPoint )
+        throw (RuntimeException)
+{
+    SolarMutexGuard aGuard;
+
+    uno::Reference< XAccessible > xAcc;
+    awt::Rectangle rc = getBounds();
+    if(aPoint.X >= rc.X && aPoint.X <= rc.X + rc.Width &&
+        aPoint.Y >= rc.Y && aPoint.Y <= rc.Y + rc.Height )
+    {
+        xAcc =this;
+    }
+    return xAcc;
+}
+
+
+/**
+   Get bounding box.
+
+   There are two modes.
+
+   - realative
+
+     Return bounding box relative to parent if parent is no root
+     frame. Otherwise return the absolute bounding box.
+
+   - absolute
+
+     Return the absolute bounding box.
+
+   @param bRelative
+   true: Use relative mode.
+   false: Use absolute mode.
+*/
+awt::Rectangle SAL_CALL SwAccessibleField::getBoundsImpl( sal_Bool )
+        throw (RuntimeException)
+{
+    SolarMutexGuard aGuard;
+    return awt::Rectangle();
+}
+
+awt::Rectangle SAL_CALL SwAccessibleField::getBounds()
+        throw (RuntimeException)
+{
+    return getBoundsImpl(sal_True);
+}
+
+awt::Point SAL_CALL SwAccessibleField::getLocation()
+    throw (RuntimeException)
+{
+    awt::Rectangle aRect = getBoundsImpl(sal_True);
+    awt::Point aPoint(aRect.X, aRect.Y);
+
+    return aPoint;
+}
+
+
+awt::Point SAL_CALL SwAccessibleField::getLocationOnScreen()
+        throw (RuntimeException)
+{
+    awt::Rectangle aRect = getBoundsImpl(sal_False);
+    //Point aPixPos = m_xPara->getLocationOnScreen();
+    return awt::Point( aRect.X,aRect.Y);//aPixPos.X() + aRect.nLeft , aPixPos.Y() + + aRect.nRight );
+}
+
+
+awt::Size SAL_CALL SwAccessibleField::getSize()
+        throw (RuntimeException)
+{
+    awt::Rectangle aRect = getBoundsImpl(sal_False);
+    awt::Size aSize( aRect.Width, aRect.Height );
+
+    return aSize;
+}
+
+void SAL_CALL SwAccessibleField::grabFocus()
+        throw (RuntimeException)
+{
+    SolarMutexGuard aGuard;
+    return;
+}
+
+
+sal_Int32 SAL_CALL SwAccessibleField::getForeground()
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    return 0;
+}
+
+sal_Int32 SAL_CALL SwAccessibleField::getBackground()
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    return 0xffffff;
+}
+::com::sun::star::uno::Any SAL_CALL SwAccessibleField::queryInterface(
+        const ::com::sun::star::uno::Type& rType )
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    Any aRet;
+    if ( rType == ::getCppuType((uno::Reference<XAccessibleContext> *)0) )
+    {
+        Reference<XAccessibleContext> aAccContext = (XAccessibleContext *) this; // resolve ambiguity
+        aRet <<= aAccContext;
+    }
+    else if ( rType == ::getCppuType((Reference<XAccessibleComponent> *)0) )
+    {
+        Reference<XAccessibleComponent> aAccEditComponent = this;
+        aRet <<= aAccEditComponent;
+    }
+    if (rType == ::getCppuType((Reference<XAccessibleEventBroadcaster> *)0))
+    {
+        Reference<XAccessibleEventBroadcaster> aAccBroadcaster= this;
+        aRet <<= aAccBroadcaster;
+    }
+    return aRet;
+}
+
+void SAL_CALL SwAccessibleField::acquire(  ) throw ()
+{
+}
+void SAL_CALL SwAccessibleField::release(  ) throw ()
+{
+}
+
+void SAL_CALL SwAccessibleField::addEventListener(
+            const Reference< XAccessibleEventListener >& xListener )
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    //DBG_MSG( "accessible event listener added" )
+
+    if (xListener.is())
+    {
+        SolarMutexGuard aGuard;
+        if (!m_nClientId)
+            m_nClientId = comphelper::AccessibleEventNotifier::registerClient( );
+        comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener );
+    }
+}
+
+void SAL_CALL SwAccessibleField::removeEventListener(
+            const Reference< XAccessibleEventListener >& xListener )
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    //DBG_MSG( "accessible event listener removed" )
+
+    if (xListener.is())
+    {
+        SolarMutexGuard aGuard;
+        sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, 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( m_nClientId );
+            m_nClientId = 0;
+        }
+    }
+}
diff --git a/sw/source/core/access/accfield.hxx b/sw/source/core/access/accfield.hxx
new file mode 100644
index 0000000..0e6402b
--- /dev/null
+++ b/sw/source/core/access/accfield.hxx
@@ -0,0 +1,175 @@
+/*
+ * 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 _ACCFIELD_HXX
+#define _ACCFIELD_HXX
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <cppuhelper/implbase4.hxx>
+#include <fmtinfmt.hxx>
+
+class SwAccessibleParagraph;
+class SwField;
+class SwAccessibleField :
+    public ::cppu::WeakImplHelper4<
+                ::com::sun::star::accessibility::XAccessible,
+                ::com::sun::star::accessibility::XAccessibleContext,
+                ::com::sun::star::accessibility::XAccessibleComponent,
+                ::com::sun::star::accessibility::XAccessibleEventBroadcaster
+                >
+{
+    friend class SwAccessibleParagraph;
+    friend class SwAccessibleHyperTextData;
+
+protected:
+    ::rtl::Reference< SwAccessibleParagraph > m_xPara;
+    SwField *m_pSwField;
+
+    sal_uInt32 m_nClientId;   // client id in the AccessibleEventNotifier queue
+    sal_Int16 m_nRole;      // immutable outside constructor
+public:
+    SwAccessibleField( SwField *pSwFld,SwAccessibleParagraph *p,sal_Int16);
+
+    virtual void SAL_CALL addEventListener(
+            const ::com::sun::star::uno::Reference<
+                ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+        throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL removeEventListener(
+            const ::com::sun::star::uno::Reference<
+                ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+        throw (::com::sun::star::uno::RuntimeException);
+
+    virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+        const ::com::sun::star::uno::Type& aType )
+        throw (::com::sun::star::uno::RuntimeException);
+
+    virtual void SAL_CALL acquire(  ) throw () ;
+    virtual void SAL_CALL release(  ) throw () ;
+
+public:
+    //=====  XAccessible  =====================================================
+
+    /// Return the XAccessibleContext.
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+        getAccessibleContext (void) throw (com::sun::star::uno::RuntimeException);
+
+    //=====  XAccessibleContext  ==============================================
+
+    /// Return the number of currently visible children.
+    virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    /// Return the specified child or NULL if index is invalid.
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+        getAccessibleChild (sal_Int32 nIndex)
+        throw (::com::sun::star::uno::RuntimeException,
+                ::com::sun::star::lang::IndexOutOfBoundsException);
+
+    /// Return a reference to the parent.
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+        getAccessibleParent (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    /// Return this objects index among the parents children.
+    virtual sal_Int32 SAL_CALL
+        getAccessibleIndexInParent (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);
+
+    /// Return this object's description.
+    virtual OUString SAL_CALL
+        getAccessibleDescription (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    /// Return the object's current name.
+    virtual OUString SAL_CALL
+        getAccessibleName (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    /// Return NULL to indicate that an empty relation set.
+    virtual ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+        getAccessibleRelationSet (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    /// Return the set of current states.
+    virtual ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
+        getAccessibleStateSet (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    /** Return the parents locale or throw exception if this object has no
+        parent yet/anymore.
+    */
+    virtual ::com::sun::star::lang::Locale SAL_CALL
+        getLocale (void)
+        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 void SAL_CALL grabFocus()
+        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 ::com::sun::star::awt::Rectangle SAL_CALL
+        getBoundsImpl(sal_Bool bRelative)
+        throw (::com::sun::star::uno::RuntimeException) ;
+
+
+};
+
+#endif
+
diff --git a/sw/source/core/access/accfootnote.cxx b/sw/source/core/access/accfootnote.cxx
index e44371c..24afed8 100644
--- a/sw/source/core/access/accfootnote.cxx
+++ b/sw/source/core/access/accfootnote.cxx
@@ -44,7 +44,6 @@ const sal_Char sImplementationNameEndnote[] = "com.sun.star.comp.Writer.SwAccess
 SwAccessibleFootnote::SwAccessibleFootnote(
         SwAccessibleMap* pInitMap,
         sal_Bool bIsEndnote,
-        sal_Int32 nFootEndNote,
         const SwFtnFrm *pFtnFrm ) :
     SwAccessibleContext( pInitMap,
         bIsEndnote ? AccessibleRole::END_NOTE : AccessibleRole::FOOTNOTE,
@@ -54,7 +53,16 @@ SwAccessibleFootnote::SwAccessibleFootnote(
 
     sal_uInt16 nResId = bIsEndnote ? STR_ACCESS_ENDNOTE_NAME
                                    : STR_ACCESS_FOOTNOTE_NAME;
-    OUString sArg( OUString::number( nFootEndNote ) );
+
+    OUString sArg;
+    const SwTxtFtn *pTxtFtn =
+        static_cast< const SwFtnFrm *>( GetFrm() )->GetAttr();
+    if( pTxtFtn )
+    {
+        const SwDoc *pDoc = GetShell()->GetDoc();
+        sArg = pTxtFtn->GetFtn().GetViewNumStr( *pDoc );
+    }
+
     SetName( GetResource( nResId, &sArg ) );
 }
 
diff --git a/sw/source/core/access/accfootnote.hxx b/sw/source/core/access/accfootnote.hxx
index 6b0f4a5..2396aca 100644
--- a/sw/source/core/access/accfootnote.hxx
+++ b/sw/source/core/access/accfootnote.hxx
@@ -34,7 +34,6 @@ protected:
 public:
     SwAccessibleFootnote( SwAccessibleMap* pInitMap,
                           sal_Bool bIsEndnote,
-                          sal_Int32 nFootEndNote,
                           const SwFtnFrm *pFtnFrm );
 
     // XAccessibleContext
diff --git a/sw/source/core/access/accframe.cxx b/sw/source/core/access/accframe.cxx
index 4726a0b..fb1771f 100644
--- a/sw/source/core/access/accframe.cxx
+++ b/sw/source/core/access/accframe.cxx
@@ -51,7 +51,9 @@ sal_Int32 SwAccessibleFrame::GetChildCount( SwAccessibleMap& rAccMap,
 {
     sal_Int32 nCount = 0;
 
-    const SwAccessibleChildSList aVisList( rVisArea, *pFrm, rAccMap );
+    // const SwAccessibleChildSList aVisList( rVisArea, *pFrm, rAccMap );
+    const SwAccessibleChildSList aVisList( pFrm->PaintArea(), *pFrm, rAccMap );
+
     SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
     while( aIter != aVisList.end() )
     {
@@ -153,7 +155,7 @@ sal_Bool SwAccessibleFrame::GetChildIndex(
     if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
     {
         // We need a sorted list here
-        const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+        const SwAccessibleChildMap aVisMap( rFrm.PaintArea(), rFrm, rAccMap );
         SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
         while( aIter != aVisMap.end() && !bFound )
         {
@@ -179,7 +181,8 @@ sal_Bool SwAccessibleFrame::GetChildIndex(
     {
         // The unsorted list is sorted enough, because it returns lower
         // frames in the correct order.
-        const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+
+        const SwAccessibleChildSList aVisList( rFrm.PaintArea(), rFrm, rAccMap );
         SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
         while( aIter != aVisList.end() && !bFound )
         {
@@ -413,7 +416,8 @@ SwAccessibleFrame::SwAccessibleFrame( const SwRect& rVisArea,
                                       sal_Bool bIsPagePreview ) :
     maVisArea( rVisArea ),
     mpFrm( pF ),
-    mbIsInPagePreview( bIsPagePreview )
+    mbIsInPagePreview( bIsPagePreview ),
+    bIsAccDocUse( sal_False )
 {
 }
 
diff --git a/sw/source/core/access/accframe.hxx b/sw/source/core/access/accframe.hxx
index 08c8139..afbe6af 100644
--- a/sw/source/core/access/accframe.hxx
+++ b/sw/source/core/access/accframe.hxx
@@ -48,8 +48,9 @@ protected:
     static sal_Int32 GetChildCount( SwAccessibleMap& rAccMap,
                                     const SwRect& rVisArea,
                                     const SwFrm *pFrm,
-                                    sal_Bool bInPagePreview );
-private:
+                                    sal_Bool bInPagePreviewr );
+
+// private:
     static sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
                                                    const SwRect& rVisArea,
                                                    const SwFrm& rFrm,
@@ -100,6 +101,8 @@ protected:
                        sal_Bool bIsPagePreview );
     virtual ~SwAccessibleFrame();
 
+    // MT: Move to private area?
+    sal_Bool bIsAccDocUse;
 public:
     // Return the SwFrm this context is attached to.
     const SwFrm* GetFrm() const { return mpFrm; };
diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx
index 4e2f874..8697c57 100644
--- a/sw/source/core/access/accframebase.cxx
+++ b/sw/source/core/access/accframebase.cxx
@@ -34,6 +34,13 @@
 #include "accmap.hxx"
 #include "accframebase.hxx"
 
+#include <crsrsh.hxx>
+#include "fesh.hxx"
+#include <txtfrm.hxx>
+#include <ndtxt.hxx>
+#include <dcontact.hxx>
+#include <fmtanchr.hxx>
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
 
@@ -84,6 +91,8 @@ void SwAccessibleFrameBase::GetStates(
         if( pWin && pWin->HasFocus() )
             rStateSet.AddState( AccessibleStateType::FOCUSED );
     }
+    if( GetSelectedState() )
+        rStateSet.AddState( AccessibleStateType::SELECTED );
 }
 
 sal_uInt8 SwAccessibleFrameBase::GetNodeType( const SwFlyFrm *pFlyFrm )
@@ -156,19 +165,22 @@ void SwAccessibleFrameBase::_InvalidateCursorPos()
         Window *pWin = GetWindow();
         if( pWin && pWin->HasFocus() && bNewSelected )
             FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected );
-        FireStateChangedEvent( AccessibleStateType::SELECTED, bNewSelected );
         if( pWin && pWin->HasFocus() && !bNewSelected )
             FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected );
-
-        uno::Reference< XAccessible > xParent( GetWeakParent() );
-        if( xParent.is() )
+        if(bNewSelected)
         {
-            SwAccessibleContext *pAcc =
-                static_cast <SwAccessibleContext *>( xParent.get() );
+            uno::Reference< XAccessible > xParent( GetWeakParent() );
+            if( xParent.is() )
+            {
+                SwAccessibleContext *pAcc =
+                    static_cast <SwAccessibleContext *>( xParent.get() );
 
-            AccessibleEventObject aEvent;
-            aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
-            pAcc->FireAccessibleEvent( aEvent );
+                AccessibleEventObject aEvent;
+                aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+                uno::Reference< XAccessible > xChild(this);
+                aEvent.NewValue <<= xChild;
+                pAcc->FireAccessibleEvent( aEvent );
+            }
         }
     }
 }
@@ -235,13 +247,13 @@ void SwAccessibleFrameBase::Modify( const SfxPoolItem* pOld, const SfxPoolItem *
         break;
     case RES_OBJECTDYING:
         // mba: it seems that this class intentionally does not call code in base class SwClient
-        if( GetRegisteredIn() ==
-                static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) )
+        if( pOld && ( GetRegisteredIn() == static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) ) )
             GetRegisteredInNonConst()->Remove( this );
         break;
 
     case RES_FMT_CHG:
-        if( static_cast< const SwFmtChg * >(pNew)->pChangedFmt == GetRegisteredIn() &&
+        if( pOld &&
+            static_cast< const SwFmtChg * >(pNew)->pChangedFmt == GetRegisteredIn() &&
             static_cast< const SwFmtChg * >(pOld)->pChangedFmt->IsFmtInDTOR() )
             GetRegisteredInNonConst()->Remove( this );
         break;
@@ -262,4 +274,121 @@ void SwAccessibleFrameBase::Dispose( sal_Bool bRecursive )
     SwAccessibleContext::Dispose( bRecursive );
 }
 
+//Get the selection cursor of the document.
+SwPaM* SwAccessibleFrameBase::GetCrsr()
+{
+    // get the cursor shell; if we don't have any, we don't have a
+    // cursor/selection either
+    SwPaM* pCrsr = NULL;
+    SwCrsrShell* pCrsrShell = GetCrsrShell();
+    if( pCrsrShell != NULL && !pCrsrShell->IsTableMode() )
+    {
+        SwFEShell *pFESh = pCrsrShell->ISA( SwFEShell )
+                            ? static_cast< SwFEShell * >( pCrsrShell ) : 0;
+        if( !pFESh ||
+            !(pFESh->IsFrmSelected() || pFESh->IsObjSelected() > 0) )
+        {
+            // get the selection, and test whether it affects our text node
+            pCrsr = pCrsrShell->GetCrsr( sal_False /* ??? */ );
+        }
+    }
+
+    return pCrsr;
+}
+
+//Return the selected state of the object.
+//when the object's anchor are in the selection cursor, we should return true.
+sal_Bool SwAccessibleFrameBase::GetSelectedState( )
+{
+    SolarMutexGuard aGuard;
+
+    if(GetMap()->IsDocumentSelAll())
+    {
+        return sal_True;
+    }
+
+    // SELETED.
+    SwFlyFrm* pFlyFrm = getFlyFrm();
+    const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
+    const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+    const SwPosition *pPos = pAnchor.GetCntntAnchor();
+    if( !pPos )
+        return sal_False;
+    int pIndex = pPos->nContent.GetIndex();
+    if( pPos->nNode.GetNode().GetTxtNode() )
+    {
+        SwPaM* pCrsr = GetCrsr();
+        if( pCrsr != NULL )
+        {
+            const SwTxtNode* pNode = pPos->nNode.GetNode().GetTxtNode();
+            sal_uLong nHere = pNode->GetIndex();
+
+            // iterate over ring
+            SwPaM* pRingStart = pCrsr;
+            do
+            {
+                // ignore, if no mark
+                if( pCrsr->HasMark() )
+                {
+                    // check whether nHere is 'inside' pCrsr
+                    SwPosition* pStart = pCrsr->Start();
+                    sal_uLong nStartIndex = pStart->nNode.GetIndex();
+                    SwPosition* pEnd = pCrsr->End();
+                    sal_uLong nEndIndex = pEnd->nNode.GetIndex();
+                    if( ( nHere >= nStartIndex ) && (nHere <= nEndIndex)  )
+                    {
+                        if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
+                        {
+                            if( ((nHere == nStartIndex) && (pIndex >= pStart->nContent.GetIndex())) || (nHere > nStartIndex) )
+                                if( ((nHere == nEndIndex) && (pIndex < pEnd->nContent.GetIndex())) || (nHere < nEndIndex) )
+                                    return sal_True;
+                        }
+                        else if( pAnchor.GetAnchorId() == FLY_AT_PARA )
+                        {
+                            if( ((nHere > nStartIndex) || pStart->nContent.GetIndex() ==0 )
+                                && (nHere < nEndIndex ) )
+                                return sal_True;
+                        }
+                        break;
+                    }
+                    // else: this PaM doesn't point to this paragraph
+                }
+                // else: this PaM is collapsed and doesn't select anything
+
+                // next PaM in ring
+                pCrsr = static_cast<SwPaM*>( pCrsr->GetNext() );
+            }
+            while( pCrsr != pRingStart );
+        }
+    }
+    return sal_False;
+}
+
+SwFlyFrm* SwAccessibleFrameBase::getFlyFrm() const
+{
+    SwFlyFrm* pFlyFrm = NULL;
+
+    const SwFrm* pFrm = GetFrm();
+    DBG_ASSERT( pFrm != NULL, "frame expected" );
+    if( pFrm->IsFlyFrm() )
+    {
+        pFlyFrm = static_cast<SwFlyFrm*>( const_cast<SwFrm*>( pFrm ) );
+    }
+
+    return pFlyFrm;
+}
+
+sal_Bool SwAccessibleFrameBase::SetSelectedState( sal_Bool )
+{
+    sal_Bool bParaSeleted = GetSelectedState() || IsSelected();
+
+    if(bIsSeletedInDoc != bParaSeleted)
+    {
+        bIsSeletedInDoc = bParaSeleted;
+        FireStateChangedEvent( AccessibleStateType::SELECTED, bParaSeleted );
+        return sal_True;
+    }
+    return sal_False;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/accframebase.hxx b/sw/source/core/access/accframebase.hxx
index dd99bd8..4f0cd4e 100644
--- a/sw/source/core/access/accframebase.hxx
+++ b/sw/source/core/access/accframebase.hxx
@@ -22,6 +22,7 @@
 
 #include <acccontext.hxx>
 #include <calbck.hxx>
+#include <pam.hxx>
 
 class SwFlyFrm;
 
@@ -36,6 +37,9 @@ protected:
     // This drived class additionaly sets SELECTABLE(1), SELECTED(+),
     // FOCUSABLE(1) and FOCUSED(+)
     virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
+    SwFlyFrm* getFlyFrm() const;
+    sal_Bool GetSelectedState( );
+    SwPaM* GetCrsr();
 
     virtual void _InvalidateCursorPos();
     virtual void _InvalidateFocus();
@@ -54,6 +58,7 @@ public:
 
     // The object is not visible an longer and should be destroyed
     virtual void Dispose( sal_Bool bRecursive = sal_False );
+    virtual sal_Bool SetSelectedState( sal_Bool bSeleted );
 };
 
 #endif
diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx
index 0f3cf5b..461a420 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -33,6 +33,8 @@
 #include <fmtanchr.hxx>
 #include <dcontact.hxx>
 
+#include <pam.hxx>
+
 #include <vcl/window.hxx>
 
 namespace sw { namespace access {
@@ -164,6 +166,23 @@ bool SwAccessibleChild::IsBoundAsChar() const
     return bRet;
 }
 
+sal_uInt32 SwAccessibleChild::GetAnchorPosition() const
+{
+    if( mpDrawObj )
+    {
+            const SwFrmFmt *pFrmFmt = ::FindFrmFmt( mpDrawObj );
+            if ( pFrmFmt )
+            {
+        const SwPosition *pPos = pFrmFmt->GetAnchor().GetCntntAnchor();
+                if ( pPos )
+                {
+            return pPos->nContent.GetIndex();
+                }
+            }
+    }
+    return 0;
+}
+
 SwAccessibleChild::SwAccessibleChild( const SwAccessibleChild& r )
     : mpFrm( r.mpFrm )

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list