summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSteve Yin <steve_y@apache.org>2013-11-29 13:03:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-12-02 10:25:33 +0000
commit76c549eb01dcb7b5bf28a271ce00e386f3d388ba (patch)
treebb09874a25b3b29c52556228abdf4aafb9ca6515 /sw
parent84972949a3501003b0b6ad98f07f1b4ab83f3ca1 (diff)
Integrate branch of IAccessible2
Conflicts: everything Change-Id: I9619634ee1e60d449025c006803da29c1e9d14b3
Diffstat (limited to 'sw')
-rw-r--r--sw/Library_sw.mk2
-rw-r--r--sw/inc/PostItMgr.hxx2
-rw-r--r--sw/inc/access.hrc5
-rw-r--r--sw/inc/accmap.hxx45
-rw-r--r--sw/inc/crsrsh.hxx5
-rw-r--r--sw/inc/doc.hxx38
-rw-r--r--sw/inc/docsh.hxx6
-rw-r--r--sw/inc/fesh.hxx2
-rw-r--r--sw/inc/fldbas.hxx12
-rw-r--r--sw/inc/frmfmt.hxx11
-rw-r--r--sw/inc/index.hrc8
-rw-r--r--sw/inc/mdiexp.hxx1
-rw-r--r--sw/inc/ndole.hxx1
-rw-r--r--sw/inc/node.hxx8
-rw-r--r--sw/inc/tblsel.hxx3
-rw-r--r--sw/inc/viewsh.hxx1
-rw-r--r--sw/source/core/access/acccell.cxx224
-rw-r--r--sw/source/core/access/acccell.hxx45
-rw-r--r--sw/source/core/access/acccontext.cxx78
-rw-r--r--sw/source/core/access/acccontext.hxx12
-rw-r--r--sw/source/core/access/accdoc.cxx510
-rw-r--r--sw/source/core/access/accdoc.hxx27
-rw-r--r--sw/source/core/access/accembedded.cxx59
-rw-r--r--sw/source/core/access/accembedded.hxx22
-rw-r--r--sw/source/core/access/accfield.cxx314
-rw-r--r--sw/source/core/access/accfield.hxx175
-rw-r--r--sw/source/core/access/accfootnote.cxx12
-rw-r--r--sw/source/core/access/accfootnote.hxx1
-rw-r--r--sw/source/core/access/accframe.cxx12
-rw-r--r--sw/source/core/access/accframe.hxx7
-rw-r--r--sw/source/core/access/accframebase.cxx153
-rw-r--r--sw/source/core/access/accframebase.hxx5
-rw-r--r--sw/source/core/access/accfrmobj.cxx19
-rw-r--r--sw/source/core/access/accfrmobj.hxx2
-rw-r--r--sw/source/core/access/accfrmobjmap.hxx37
-rw-r--r--sw/source/core/access/accgraphic.cxx12
-rw-r--r--sw/source/core/access/accgraphic.hxx2
-rw-r--r--sw/source/core/access/accheaderfooter.cxx15
-rw-r--r--sw/source/core/access/accheaderfooter.hxx3
-rw-r--r--sw/source/core/access/acchyperlink.cxx92
-rw-r--r--sw/source/core/access/accmap.cxx1043
-rw-r--r--sw/source/core/access/accnotextframe.cxx154
-rw-r--r--sw/source/core/access/accnotextframe.hxx56
-rw-r--r--sw/source/core/access/accnotexthyperlink.cxx225
-rw-r--r--sw/source/core/access/accnotexthyperlink.hxx83
-rw-r--r--sw/source/core/access/accpara.cxx1713
-rw-r--r--sw/source/core/access/accpara.hxx52
-rw-r--r--sw/source/core/access/accportions.cxx114
-rw-r--r--sw/source/core/access/accportions.hxx39
-rw-r--r--sw/source/core/access/accpreview.cxx21
-rw-r--r--sw/source/core/access/accpreview.hxx4
-rw-r--r--sw/source/core/access/accselectionhelper.cxx93
-rw-r--r--sw/source/core/access/acctable.cxx303
-rw-r--r--sw/source/core/access/acctable.hxx23
-rw-r--r--sw/source/core/access/acctextframe.cxx118
-rw-r--r--sw/source/core/access/acctextframe.hxx40
-rw-r--r--sw/source/core/attr/format.cxx2
-rw-r--r--sw/source/core/crsr/crsrsh.cxx69
-rw-r--r--sw/source/core/doc/tblcpy.cxx3
-rw-r--r--sw/source/core/docnode/node.cxx63
-rw-r--r--sw/source/core/docnode/nodes.cxx9
-rw-r--r--sw/source/core/frmedt/feshview.cxx20
-rw-r--r--sw/source/core/frmedt/tblsel.cxx9
-rw-r--r--sw/source/core/inc/SwPortionHandler.hxx2
-rw-r--r--sw/source/core/inc/doctxm.hxx2
-rw-r--r--sw/source/core/inc/frame.hxx12
-rw-r--r--sw/source/core/inc/txtfrm.hxx2
-rw-r--r--sw/source/core/inc/viewimp.hxx4
-rw-r--r--sw/source/core/layout/atrfrm.cxx17
-rw-r--r--sw/source/core/layout/wsfrm.cxx1
-rw-r--r--sw/source/core/ole/ndole.cxx8
-rw-r--r--sw/source/core/text/frmform.cxx45
-rw-r--r--sw/source/core/text/porfld.cxx5
-rw-r--r--sw/source/core/text/porfld.hxx1
-rw-r--r--sw/source/core/text/txtfld.cxx41
-rw-r--r--sw/source/core/unocore/unomap.cxx34
-rw-r--r--sw/source/core/view/viewimp.cxx18
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx2
-rw-r--r--sw/source/ui/app/docsh.cxx52
-rw-r--r--sw/source/ui/cctrl/actctrl.cxx3
-rw-r--r--sw/source/ui/chrdlg/swuiccoll.cxx13
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx1
-rw-r--r--sw/source/ui/docvw/edtwin.cxx13
-rw-r--r--sw/source/ui/docvw/edtwin3.cxx27
-rw-r--r--sw/source/ui/frmdlg/column.cxx26
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx12
-rw-r--r--sw/source/ui/inc/cnttab.hxx5
-rw-r--r--sw/source/ui/inc/conttree.hxx9
-rw-r--r--sw/source/ui/inc/edtwin.hxx1
-rw-r--r--sw/source/ui/inc/pview.hxx13
-rw-r--r--sw/source/ui/inc/swlbox.hxx1
-rw-r--r--sw/source/ui/inc/swuicnttab.hxx9
-rw-r--r--sw/source/ui/inc/view.hxx3
-rw-r--r--sw/source/ui/index/cnttab.cxx136
-rw-r--r--sw/source/ui/index/cnttab.src50
-rw-r--r--sw/source/ui/ribbar/inputwin.cxx6
-rw-r--r--sw/source/ui/ribbar/inputwin.hrc3
-rw-r--r--sw/source/ui/ribbar/inputwin.src17
-rw-r--r--sw/source/ui/ribbar/workctrl.cxx7
-rw-r--r--sw/source/ui/shells/textsh1.cxx51
-rw-r--r--sw/source/ui/shells/txtnum.cxx4
-rw-r--r--sw/source/ui/uiview/pview.cxx188
-rw-r--r--sw/source/ui/uiview/view.cxx1
-rw-r--r--sw/source/ui/uiview/view2.cxx30
-rw-r--r--sw/source/ui/uiview/viewsrch.cxx45
-rw-r--r--sw/source/ui/utlui/content.cxx386
-rw-r--r--sw/source/ui/utlui/navipi.hrc3
-rw-r--r--sw/source/ui/wrtsh/select.cxx7
108 files changed, 7192 insertions, 368 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index ead414835643..3564c892e756 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 4c38d4053f12..a87a9ba8c5c0 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 c2df846a2053..d42845fa5db7 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 6df63884b7da..731518c57b0b 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 ddc4f2b4e601..0e3c06b14edf 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 58980778849d..217590ce8f8a 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 9c8f841a0dae..267060338d7a 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 9daebe88256a..8f16c0de0382 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 453d2468e866..1e2091840207 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 aa86dce5da9f..1b26316d7ee6 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 bdb77968a19e..192e3c108d26 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 e3319e5175f8..fe7b902de44b 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 6f027279f426..423f41bd1507 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 93ebc5cfd330..ee28196e338a 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 9c6cda63ddc1..62322abdae43 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 fd314eb2e7f5..ccd63e557fa6 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 a09408cd726a..6bbf1fc81dd0 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 74d3185908df..dbf0e1204bff 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 1b02418c8519..893c63c286df 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 b8d164b7a128..e99b1f9ef369 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 5fb1e5fcdb74..74036086e1ea 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 2ff5576059e7..580e0bf260d6 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 899443878938..7744efc25fc3 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 a459eb1cd8d0..097b468d6322 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 000000000000..cb9532c8b4de
--- /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 000000000000..0e6402b4be58
--- /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 e44371c31149..24afed8948db 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 6b0f4a5df613..2396acaa4306 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 4726a0b899f2..fb1771fa27cb 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 08c8139aa721..afbe6afb3266 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 4e2f8742097a..8697c57afd64 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 dd99bd8c503f..4f0cd4ed19c7 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 0f3cf5b4ac6b..461a42062734 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 )
, mpDrawObj( r.mpDrawObj )
diff --git a/sw/source/core/access/accfrmobj.hxx b/sw/source/core/access/accfrmobj.hxx
index 47e1f3ba6684..d37277e67f50 100644
--- a/sw/source/core/access/accfrmobj.hxx
+++ b/sw/source/core/access/accfrmobj.hxx
@@ -61,6 +61,8 @@ class SwAccessibleChild
bool IsAccessible( sal_Bool bPagePreview ) const;
bool IsBoundAsChar() const;
+ sal_uInt32 GetAnchorPosition() const;
+
bool IsVisibleChildrenOnly() const;
SwRect GetBox( const SwAccessibleMap& rAccMap ) const;
SwRect GetBounds( const SwAccessibleMap& rAccMap ) const;
diff --git a/sw/source/core/access/accfrmobjmap.hxx b/sw/source/core/access/accfrmobjmap.hxx
index 92e3402598cd..ac2331597f6f 100644
--- a/sw/source/core/access/accfrmobjmap.hxx
+++ b/sw/source/core/access/accfrmobjmap.hxx
@@ -20,8 +20,9 @@
#ifndef INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJMAP_HXX
#define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJMAP_HXX
-#include <accfrmobj.hxx>
+#include <tools/gen.hxx>
#include <svx/svdtypes.hxx>
+#include <accfrmobj.hxx>
#include <map>
class SwAccessibleMap;
@@ -34,28 +35,48 @@ class SwAccessibleChildMapKey
public:
enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS, XWINDOW };
- inline SwAccessibleChildMapKey()
+ SwAccessibleChildMapKey()
: eLayerId( INVALID )
, nOrdNum( 0 )
+ , nPosNum( 0, 0 )
+ {}
+
+ SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd )
+ : eLayerId( eId )
+ , nOrdNum( nOrd )
+ , nPosNum( 0, 0 )
{}
- inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd )
+ SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd, Point nPos )
: eLayerId( eId )
, nOrdNum( nOrd )
+ , nPosNum( nPos )
{}
- inline bool operator()( const SwAccessibleChildMapKey& r1,
+ bool operator()( const SwAccessibleChildMapKey& r1,
const SwAccessibleChildMapKey& r2 ) const
{
- return (r1.eLayerId == r2.eLayerId)
- ? (r1.nOrdNum < r2.nOrdNum)
- : (r1.eLayerId < r2.eLayerId);
+ return (r1.eLayerId == r2.eLayerId) ?
+ ( (r1.nPosNum == r2.nPosNum) ?(r1.nOrdNum < r2.nOrdNum) :
+ (r1.nPosNum.getY() == r2.nPosNum.getY()? r1.nPosNum.getX() < r2.nPosNum.getX() :
+ r1.nPosNum.getY() < r2.nPosNum.getY()) ) :
+ (r1.eLayerId < r2.eLayerId);
}
+ /* MT: Need to get this position parameter stuff in dev300 somehow...
+ //This methods are used to insert an object to the map, adding a position parameter.
+ ::std::pair< iterator, bool > insert( sal_uInt32 nOrd, Point nPos,
+ const SwFrmOrObj& rLower );
+ ::std::pair< iterator, bool > insert( const SdrObject *pObj,
+ const SwFrmOrObj& rLower,
+ const SwDoc *pDoc,
+ Point nPos);
+ */
+
private:
LayerId eLayerId;
sal_uInt32 nOrdNum;
-
+ Point nPosNum;
};
typedef ::std::map < SwAccessibleChildMapKey, sw::access::SwAccessibleChild, SwAccessibleChildMapKey >
diff --git a/sw/source/core/access/accgraphic.cxx b/sw/source/core/access/accgraphic.cxx
index d5abfff1efed..cc5b63d8aab2 100644
--- a/sw/source/core/access/accgraphic.cxx
+++ b/sw/source/core/access/accgraphic.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/uno/RuntimeException.hpp>
#include <comphelper/servicehelper.hxx>
#include <flyfrm.hxx>
+#include <fmturl.hxx>
#include "accgraphic.hxx"
using namespace ::com::sun::star;
@@ -80,4 +81,15 @@ Sequence< sal_Int8 > SAL_CALL SwAccessibleGraphic::getImplementationId()
return theSwAccessibleGraphicImplementationId::get().getSeq();
}
+// Return this object's role.
+sal_Int16 SAL_CALL SwAccessibleGraphic::getAccessibleRole (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
+
+ if (aURL.GetMap())
+ return AccessibleRole::IMAGE_MAP ;
+ return AccessibleRole::GRAPHIC ;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/accgraphic.hxx b/sw/source/core/access/accgraphic.hxx
index 51bbd7c5550f..a6eca173e810 100644
--- a/sw/source/core/access/accgraphic.hxx
+++ b/sw/source/core/access/accgraphic.hxx
@@ -51,6 +51,8 @@ public:
// XTypeProvider
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+ /// Return this object's role.
+ virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
};
#endif
diff --git a/sw/source/core/access/accheaderfooter.cxx b/sw/source/core/access/accheaderfooter.cxx
index 5e178241abc8..ed0eba419b0e 100644
--- a/sw/source/core/access/accheaderfooter.cxx
+++ b/sw/source/core/access/accheaderfooter.cxx
@@ -126,4 +126,19 @@ Sequence< sal_Int8 > SAL_CALL SwAccessibleHeaderFooter::getImplementationId()
return theSwAccessibleHeaderFooterImplementationId::get().getSeq();
}
+sal_Int32 SAL_CALL SwAccessibleHeaderFooter::getBackground()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if (xParent.is())
+ {
+ Reference< XAccessibleComponent > xAccContext (xParent,UNO_QUERY);
+ if(xAccContext.is())
+ {
+ return xAccContext->getBackground();
+ }
+ }
+ return SwAccessibleContext::getBackground();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/accheaderfooter.hxx b/sw/source/core/access/accheaderfooter.hxx
index f6eed47a9e0c..d4ed88d96815 100644
--- a/sw/source/core/access/accheaderfooter.hxx
+++ b/sw/source/core/access/accheaderfooter.hxx
@@ -63,6 +63,9 @@ public:
// XTypeProvider
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+ //===== XAccessibleComponent ============================================
+ sal_Int32 SAL_CALL getBackground()
+ throw (::com::sun::star::uno::RuntimeException);
};
#endif
diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx
index b26960e671af..79045f2c80d8 100644
--- a/sw/source/core/access/acchyperlink.cxx
+++ b/sw/source/core/access/acchyperlink.cxx
@@ -18,6 +18,10 @@
*/
#include <comphelper/accessiblekeybindinghelper.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 <swurl.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
@@ -28,6 +32,7 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
SwAccessibleHyperlink::SwAccessibleHyperlink( sal_uInt16 nHPos,
SwAccessibleParagraph *p, sal_Int32 nStt, sal_Int32 nEnd ) :
@@ -70,8 +75,10 @@ sal_Bool SAL_CALL SwAccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex )
sal_Bool bRet = sal_False;
+ if(nIndex != 0)
+ throw lang::IndexOutOfBoundsException();
const SwTxtAttr *pTxtAttr = GetTxtAttr();
- if( pTxtAttr && 0 == nIndex )
+ if( pTxtAttr )
{
const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
if( !rINetFmt.GetValue().isEmpty() )
@@ -101,8 +108,11 @@ OUString SAL_CALL SwAccessibleHyperlink::getAccessibleActionDescription(
sal_Int32 nIndex )
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
+ if(nIndex != 0)
+ throw lang::IndexOutOfBoundsException();
+
const SwTxtAttr *pTxtAttr = GetTxtAttr();
- if( pTxtAttr && 0 == nIndex )
+ if( pTxtAttr )
{
const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
return rINetFmt.GetValue();
@@ -112,12 +122,12 @@ OUString SAL_CALL SwAccessibleHyperlink::getAccessibleActionDescription(
}
uno::Reference< XAccessibleKeyBinding > SAL_CALL
- SwAccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex )
+ SwAccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 )
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
uno::Reference< XAccessibleKeyBinding > xKeyBinding;
- if( isValid() && 0==nIndex )
+ if( isValid() )
{
::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper =
new ::comphelper::OAccessibleKeyBindingHelper();
@@ -136,17 +146,34 @@ uno::Reference< XAccessibleKeyBinding > SAL_CALL
// XAccessibleHyperlink
uno::Any SAL_CALL SwAccessibleHyperlink::getAccessibleActionAnchor(
- sal_Int32 /*nIndex*/ )
+ sal_Int32 nIndex)
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
- return uno::Any();
+ uno::Any aRet;
+ if(nIndex != 0)
+ throw lang::IndexOutOfBoundsException();
+ OUString text( xPara->GetString() );
+ OUString retText = text.copy(nStartIdx, nEndIdx - nStartIdx);
+ aRet <<= retText;
+ return aRet;
}
uno::Any SAL_CALL SwAccessibleHyperlink::getAccessibleActionObject(
- sal_Int32 /*nIndex*/ )
+ sal_Int32 nIndex )
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
- return uno::Any();
+ if(nIndex != 0)
+ throw lang::IndexOutOfBoundsException();
+ const SwTxtAttr *pTxtAttr = GetTxtAttr();
+ OUString retText;
+ if( pTxtAttr )
+ {
+ const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
+ retText = OUString( rINetFmt.GetValue() );
+ }
+ uno::Any aRet;
+ aRet <<= retText;
+ return aRet;
}
sal_Int32 SAL_CALL SwAccessibleHyperlink::getStartIndex()
@@ -165,7 +192,54 @@ sal_Bool SAL_CALL SwAccessibleHyperlink::isValid( )
throw (uno::RuntimeException)
{
SolarMutexGuard aGuard;
- return xPara.is();
+ if (xPara.is())
+ {
+ const SwTxtAttr *pTxtAttr = GetTxtAttr();
+ OUString sText;
+ if( pTxtAttr )
+ {
+ const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
+ sText = OUString( rINetFmt.GetValue() );
+ OUString sToken = "#";
+ sal_Int32 nPos = sText.indexOf(sToken);
+ if (nPos==0)//document link
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if( ! xFactory.is() )
+ return sal_False;
+ uno::Reference< com::sun::star::frame::XDesktop > xDesktop( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ),
+ uno::UNO_QUERY );
+ if( !xDesktop.is() )
+ return sal_False;
+ uno::Reference< lang::XComponent > xComp;
+ xComp = xDesktop->getCurrentComponent();
+ if( !xComp.is() )
+ return sal_False;
+ uno::Reference< com::sun::star::document::XLinkTargetSupplier > xLTS(xComp, uno::UNO_QUERY);
+ if ( !xLTS.is())
+ return sal_False;
+
+ uno::Reference< ::com::sun::star::container::XNameAccess > xLinks = xLTS->getLinks();
+ uno::Reference< ::com::sun::star::container::XNameAccess > xSubLinks;
+ const uno::Sequence< OUString > aNames( xLinks->getElementNames() );
+ const sal_uLong nLinks = aNames.getLength();
+ const OUString* pNames = aNames.getConstArray();
+
+ for( sal_uLong i = 0; i < nLinks; i++ )
+ {
+ uno::Any aAny;
+ OUString aLink( *pNames++ );
+ aAny = xLinks->getByName( aLink );
+ aAny >>= xSubLinks;
+ if (xSubLinks->hasByName(sText.copy(1)) )
+ return sal_True;
+ }
+ }
+ else//internet
+ return sal_True;
+ }
+ }//xpara valid
+ return sal_False;
}
void SwAccessibleHyperlink::Invalidate()
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index b8a2ce56a8fa..cdb73ca65b8f 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -26,6 +26,7 @@
#include <algorithm>
#include <map>
#include <list>
+#include <vector>
#include <accmap.hxx>
#include <acccontext.hxx>
#include <accdoc.hxx>
@@ -52,11 +53,19 @@
#include <IDocumentDrawModelAccess.hxx>
#include <svx/ShapeTypeHandler.hxx>
#include <vcl/svapp.hxx>
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/SvxShapeTypes.hxx>
+#include <svx/svdpage.hxx>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <cppuhelper/implbase1.hxx>
#include <pagepreviewlayout.hxx>
+#include <dcontact.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdmark.hxx>
+#include <doc.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
#include <dflyobj.hxx>
@@ -256,7 +265,7 @@ SwAccessibleObjShape_Impl
{
const SdrObject *pObj = (*aIter).first;
uno::Reference < XAccessible > xAcc( (*aIter).second );
- if( nSelShapes && pFESh->IsObjSelected( *pObj ) )
+ if( nSelShapes && pFESh &&pFESh->IsObjSelected( *pObj ) )
{
// selected objects are inserted from the back
--pSelShape;
@@ -309,20 +318,29 @@ private:
SwAccessibleEvent_Impl& operator==( const SwAccessibleEvent_Impl& );
public:
+ const SwFrm* mpParentFrm; // The object that fires the event
+ sal_Bool IsNoXaccParentFrm() const
+ {
+ return CHILD_POS_CHANGED == meType && mpParentFrm != 0;
+ }
+ uno::WeakReference < XAccessible > GetxAcc() const { return mxAcc;}
+public:
SwAccessibleEvent_Impl( EventType eT,
SwAccessibleContext *pA,
const SwAccessibleChild& rFrmOrObj )
: mxAcc( pA ),
maFrmOrObj( rFrmOrObj ),
meType( eT ),
- mnStates( 0 )
+ mnStates( 0 ),
+ mpParentFrm( 0 )
{}
SwAccessibleEvent_Impl( EventType eT,
const SwAccessibleChild& rFrmOrObj )
: maFrmOrObj( rFrmOrObj ),
meType( eT ),
- mnStates( 0 )
+ mnStates( 0 ),
+ mpParentFrm( 0 )
{
OSL_ENSURE( SwAccessibleEvent_Impl::DISPOSE == meType,
"wrong event constructor, DISPOSE only" );
@@ -330,7 +348,8 @@ public:
SwAccessibleEvent_Impl( EventType eT )
: meType( eT ),
- mnStates( 0 )
+ mnStates( 0 ),
+ mpParentFrm( 0 )
{
OSL_ENSURE( SwAccessibleEvent_Impl::SHAPE_SELECTION == meType,
"wrong event constructor, SHAPE_SELECTION only" );
@@ -344,7 +363,8 @@ public:
mxAcc( pA ),
maFrmOrObj( rFrmOrObj ),
meType( eT ),
- mnStates( 0 )
+ mnStates( 0 ),
+ mpParentFrm( 0 )
{
OSL_ENSURE( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType ||
SwAccessibleEvent_Impl::POS_CHANGED == meType,
@@ -358,12 +378,27 @@ public:
: mxAcc( pA ),
maFrmOrObj( rFrmOrObj ),
meType( eT ),
- mnStates( _nStates )
+ mnStates( _nStates ),
+ mpParentFrm( 0 )
{
OSL_ENSURE( SwAccessibleEvent_Impl::CARET_OR_STATES == meType,
"wrong event constructor, CARET_OR_STATES only" );
}
+ SwAccessibleEvent_Impl( EventType eT,
+ const SwFrm *pParentFrm,
+ const SwAccessibleChild& rFrmOrObj,
+ const SwRect& rR ) :
+ maOldBox( rR ),
+ maFrmOrObj( rFrmOrObj ),
+ meType( eT ),
+ mnStates( 0 ),
+ mpParentFrm( pParentFrm )
+ {
+ OSL_ENSURE( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType,
+ "wrong event constructor, CHILD_POS_CHANGED only" );
+ }
+
// <SetType(..)> only used in method <SwAccessibleMap::AppendEvent(..)>
inline void SetType( EventType eT )
{
@@ -456,8 +491,44 @@ public:
{
return mbFiring;
}
+ struct XAccisNULL
+ {
+ bool operator()(const SwAccessibleEvent_Impl& e)
+ {
+ return e.IsNoXaccParentFrm();
+ }
+ };
+ void MoveInvalidXAccToEnd();
};
+void SwAccessibleEventList_Impl::MoveInvalidXAccToEnd()
+{
+ size_t nSize = size();
+ if (nSize < 2 )
+ {
+ return;
+ }
+ SwAccessibleEventList_Impl lstEvent;
+ iterator li = begin();
+ for ( ;li != end();)
+ {
+ SwAccessibleEvent_Impl e = *li;
+ if (e.IsNoXaccParentFrm())
+ {
+ iterator liNext = li;
+ ++liNext;
+ erase(li);
+ li = liNext;
+ lstEvent.insert(lstEvent.end(),e);
+ }
+ else
+ ++li;
+ }
+ OSL_ENSURE(size() + lstEvent.size() == nSize ,"");
+ insert(end(),lstEvent.begin(),lstEvent.end());
+ OSL_ENSURE(size() == nSize ,"");
+}
+
// The shape list is filled if an accessible shape is destroyed. It
// simply keeps a reference to the accessible shape's XShape. These
// references are destroyed within the EndAction when firing events.
@@ -761,6 +832,23 @@ static bool AreInSameTable( const uno::Reference< XAccessible >& rAcc,
void SwAccessibleMap::FireEvent( const SwAccessibleEvent_Impl& rEvent )
{
::rtl::Reference < SwAccessibleContext > xAccImpl( rEvent.GetContext() );
+ if (!xAccImpl.is() && rEvent.mpParentFrm != 0 )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( rEvent.mpParentFrm );
+ if( aIter != mpFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if (xAcc.is())
+ {
+ uno::Reference < XAccessibleContext > xContext(xAcc,uno::UNO_QUERY);
+ if (xContext.is() && xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+ {
+ xAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
+ }
+ }
+ }
+ }
if( SwAccessibleEvent_Impl::SHAPE_SELECTION == rEvent.GetType() )
{
DoInvalidateShapeSelection();
@@ -979,7 +1067,326 @@ void SwAccessibleMap::InvalidateShapeSelection()
}
}
-void SwAccessibleMap::DoInvalidateShapeSelection()
+//This method should implement the following functions:
+//1.find the shape objects and set the selected state.
+//2.find the Swframe objects and set the selected state.
+//3.find the paragraph objects and set the selected state.
+void SwAccessibleMap::InvalidateShapeInParaSelection()
+{
+ SwAccessibleObjShape_Impl *pShapes = 0;
+ SwAccessibleObjShape_Impl *pSelShape = 0;
+ size_t nShapes = 0;
+
+ const SwViewShell *pVSh = GetShell();
+ const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ?
+ static_cast< const SwFEShell * >( pVSh ) : 0;
+ SwPaM* pCrsr = pFESh ? pFESh->GetCrsr( sal_False /* ??? */ ) : NULL;
+
+ //sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0;
+
+ {
+ osl::MutexGuard aGuard( maMutex );
+ if( mpShapeMap )
+ pShapes = mpShapeMap->Copy( nShapes, pFESh, &pSelShape );
+ }
+
+ sal_Bool bIsSelAll =IsDocumentSelAll();
+
+ if( mpShapeMap )
+ {
+ //Checked for shapes.
+ _SwAccessibleShapeMap_Impl::const_iterator aIter = mpShapeMap->begin();
+ _SwAccessibleShapeMap_Impl::const_iterator aEndIter = mpShapeMap->end();
+ ::rtl::Reference< SwAccessibleContext > xParentAccImpl;
+
+ if( bIsSelAll)
+ {
+ while( aIter != aEndIter )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if( xAcc.is() )
+ (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->SetState( AccessibleStateType::SELECTED );
+
+ ++aIter;
+ }
+ }
+ else
+ {
+ while( aIter != aEndIter )
+ {
+ sal_Bool bChanged = sal_False;
+ sal_Bool bMarked = sal_False;
+ SwAccessibleChild pFrm( (*aIter).first );
+
+ const SwFrmFmt *pFrmFmt = (*aIter).first ? ::FindFrmFmt( (*aIter).first ) : 0;
+ if( !pFrmFmt ) { ++aIter; continue; }
+ const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+ const SwPosition *pPos = pAnchor.GetCntntAnchor();
+
+ if(pAnchor.GetAnchorId() == FLY_AT_PAGE)
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if(xAcc.is())
+ (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+
+ ++aIter; continue;
+ }
+
+ if( !pPos ) { ++aIter; continue; }
+ if( pPos->nNode.GetNode().GetTxtNode() )
+ {
+ int pIndex = pPos->nContent.GetIndex();
+ SwPaM* pTmpCrsr = pCrsr;
+ if( pTmpCrsr != NULL )
+ {
+ const SwTxtNode* pNode = pPos->nNode.GetNode().GetTxtNode();
+ sal_uLong nHere = pNode->GetIndex();
+
+ do
+ {
+ // ignore, if no mark
+ if( pTmpCrsr->HasMark() )
+ {
+ bMarked = sal_True;
+ // check whether nHere is 'inside' pCrsr
+ SwPosition* pStart = pTmpCrsr->Start();
+ sal_uLong nStartIndex = pStart->nNode.GetIndex();
+ SwPosition* pEnd = pTmpCrsr->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) )
+ &&( ((nHere == nEndIndex) && (pIndex < pEnd->nContent.GetIndex())) || (nHere < nEndIndex) ) )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if( xAcc.is() )
+ bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->SetState( AccessibleStateType::SELECTED );
+ }
+ else
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if( xAcc.is() )
+ bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+ }
+ }
+ else if( pAnchor.GetAnchorId() == FLY_AT_PARA )
+ {
+ if( ((nHere > nStartIndex) || pStart->nContent.GetIndex() ==0 )
+ && (nHere < nEndIndex ) )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if( xAcc.is() )
+ bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->SetState( AccessibleStateType::SELECTED );
+ }
+ else
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if(xAcc.is())
+ bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+ }
+ }
+ }
+ }
+ // next PaM in ring
+ pTmpCrsr = static_cast<SwPaM*>( pTmpCrsr->GetNext() );
+ }
+ while( pTmpCrsr != pCrsr );
+ }
+ if( !bMarked )
+ {
+ SwAccessibleObjShape_Impl *pShape = pShapes;
+ size_t nNumShapes = nShapes;
+ while( nNumShapes )
+ {
+ if( pShape < pSelShape && (pShape->first==(*aIter).first) )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if(xAcc.is())
+ bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+ }
+ --nNumShapes;
+ ++pShape;
+ }
+ }
+ }
+
+ (void)bChanged; //cmc: this is totally busted, bChanged is not used at all
+
+ ++aIter;
+ }//while( aIter != aEndIter )
+ }//else
+ }
+
+ //Checked for FlyFrm
+ SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->begin();
+ while( aIter != mpFrmMap->end() )
+ {
+ const SwFrm *pFrm = (*aIter).first;
+ if(pFrm->IsFlyFrm())
+ {
+ sal_Bool bFrmChanged = sal_False;
+ uno::Reference < XAccessible > xAcc = (*aIter).second;
+
+ if(xAcc.is())
+ {
+ SwAccessibleFrameBase *pAccFrame = (static_cast< SwAccessibleFrameBase * >(xAcc.get()));
+ bFrmChanged = pAccFrame->SetSelectedState( sal_True );
+ if (bFrmChanged)
+ {
+ const SwFlyFrm *pFlyFrm = static_cast< const SwFlyFrm * >( pFrm );
+ const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
+ if (pFrmFmt)
+ {
+ const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+ if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
+ {
+ uno::Reference< XAccessible > xAccParent = pAccFrame->getAccessibleParent();
+ if (xAccParent.is())
+ {
+ uno::Reference< XAccessibleContext > xAccContext = xAccParent->getAccessibleContext();
+ if(xAccContext.is() && xAccContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+ {
+ SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xAccContext.get());
+ if(pAccFrame->IsSeletedInDoc())
+ {
+ m_setParaAdd.insert(pAccPara);
+ }
+ else if(m_setParaAdd.count(pAccPara) == 0)
+ {
+ m_setParaRemove.insert(pAccPara);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ++aIter;
+ }
+ typedef std::vector< SwAccessibleContext* > VEC_PARA;
+ VEC_PARA vecAdd;
+ VEC_PARA vecRemove;
+ //Checked for Paras.
+ SwPaM* pTmpCrsr = pCrsr;
+ sal_Bool bMarkChanged = sal_False;
+ SwAccessibleContextMap_Impl mapTemp;
+ if( pTmpCrsr != NULL )
+ {
+ do
+ {
+ if( pTmpCrsr->HasMark() )
+ {
+ SwNodeIndex nStartIndex( pTmpCrsr->Start()->nNode );
+ SwNodeIndex nEndIndex( pTmpCrsr->End()->nNode );
+ while(nStartIndex <= nEndIndex)
+ {
+ SwFrm *pFrm = NULL;
+ if(nStartIndex.GetNode().IsCntntNode())
+ {
+ SwCntntNode* pCNd = (SwCntntNode*)&(nStartIndex.GetNode());
+ SwClientIter aClientIter( *pCNd );
+ pFrm = (SwFrm*)aClientIter.First( TYPE(SwFrm));
+ }
+ else if( nStartIndex.GetNode().IsTableNode() )
+ {
+ SwTableNode * pTable= (SwTableNode *)&(nStartIndex.GetNode());
+ SwFrmFmt* pFmt = const_cast<SwFrmFmt*>(pTable->GetTable().GetFrmFmt());
+ SwClientIter aClientIter( *pFmt );
+ pFrm = (SwFrm*)aClientIter.First( TYPE(SwFrm));
+ }
+
+ if( pFrm && mpFrmMap)
+ {
+ aIter = mpFrmMap->find( pFrm );
+ if( aIter != mpFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xAcc = (*aIter).second;
+ sal_Bool isChanged = sal_False;
+ if( xAcc.is() )
+ {
+ isChanged = (static_cast< SwAccessibleContext * >(xAcc.get()))->SetSelectedState( sal_True );
+ }
+ if(!isChanged)
+ {
+ SwAccessibleContextMap_Impl::iterator aEraseIter = mpSeletedFrmMap->find( pFrm );
+ if(aEraseIter != mpSeletedFrmMap->end())
+ mpSeletedFrmMap->erase(aEraseIter);
+ }
+ else
+ {
+ bMarkChanged = sal_True;
+ vecAdd.push_back(static_cast< SwAccessibleContext * >(xAcc.get()));
+ }
+
+ mapTemp.insert( SwAccessibleContextMap_Impl::value_type( pFrm, xAcc ) );
+ }
+ }
+ nStartIndex++;
+ }
+ }
+ pTmpCrsr = static_cast<SwPaM*>( pTmpCrsr->GetNext() );
+ }
+ while( pTmpCrsr != pCrsr );
+ }
+ if( !mpSeletedFrmMap )
+ mpSeletedFrmMap = new SwAccessibleContextMap_Impl;
+ if( !mpSeletedFrmMap->empty() )
+ {
+ aIter = mpSeletedFrmMap->begin();
+ while( aIter != mpSeletedFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xAcc = (*aIter).second;
+ if(xAcc.is())
+ (static_cast< SwAccessibleContext * >(xAcc.get()))->SetSelectedState( sal_False );
+ ++aIter;
+ vecRemove.push_back(static_cast< SwAccessibleContext * >(xAcc.get()));
+ }
+ bMarkChanged = sal_True;
+ mpSeletedFrmMap->clear();
+ }
+
+ if( !mapTemp.empty() )
+ {
+ aIter = mapTemp.begin();
+ while( aIter != mapTemp.end() )
+ {
+ mpSeletedFrmMap->insert( SwAccessibleContextMap_Impl::value_type( (*aIter).first, (*aIter).second ) );
+ ++aIter;
+ }
+ mapTemp.clear();
+ }
+ if( bMarkChanged && mpFrmMap)
+ {
+ VEC_PARA::iterator vi = vecAdd.begin();
+ for (; vi != vecAdd.end() ; ++vi)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+ SwAccessibleContext* pAccPara = *vi;
+ if (pAccPara)
+ {
+ pAccPara->FireAccessibleEvent( aEvent );
+ }
+ }
+ vi = vecRemove.begin();
+ for (; vi != vecRemove.end() ; ++vi)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
+ SwAccessibleContext* pAccPara = *vi;
+ if (pAccPara)
+ {
+ pAccPara->FireAccessibleEvent( aEvent );
+ }
+ }
+ }
+}
+
+//Marge with DoInvalidateShapeFocus
+void SwAccessibleMap::DoInvalidateShapeSelection(sal_Bool bInvalidateFocusMode /*=sal_False*/)
{
SwAccessibleObjShape_Impl *pShapes = 0;
SwAccessibleObjShape_Impl *pSelShape = 0;
@@ -990,6 +1397,13 @@ void SwAccessibleMap::DoInvalidateShapeSelection()
static_cast< const SwFEShell * >( pVSh ) : 0;
sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0;
+
+ //when InvalidateFocus Call this function ,and the current selected shape count is not 1 ,
+ //return
+ if (bInvalidateFocusMode && nSelShapes != 1)
+ {
+ return;
+ }
{
osl::MutexGuard aGuard( maMutex );
if( mpShapeMap )
@@ -998,24 +1412,64 @@ void SwAccessibleMap::DoInvalidateShapeSelection()
if( pShapes )
{
- ::std::list< const SwFrm * > aParents;
+ typedef std::vector< ::rtl::Reference < ::accessibility::AccessibleShape > > VEC_SHAPE;
+ VEC_SHAPE vecxShapeAdd;
+ VEC_SHAPE vecxShapeRemove;
+ int nCountSelectedShape=0;
+
Window *pWin = GetShell()->GetWin();
bool bFocused = pWin && pWin->HasFocus();
SwAccessibleObjShape_Impl *pShape = pShapes;
+ int nShapeCount = nShapes;
+ while( nShapeCount )
+ {
+ if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh))
+ {
+ if( pShape < pSelShape )
+ {
+ if(pShape->second->ResetState( AccessibleStateType::SELECTED ))
+ {
+ vecxShapeRemove.push_back(pShape->second);
+ }
+ pShape->second->ResetState( AccessibleStateType::FOCUSED );
+ }
+ }
+ --nShapeCount;
+ ++pShape;
+ }
+
+ VEC_SHAPE::iterator vi =vecxShapeRemove.begin();
+ for (; vi != vecxShapeRemove.end(); ++vi)
+ {
+ ::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->get());
+ if (pAccShape)
+ {
+ pAccShape->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(), uno::Any());
+ }
+ }
+
+ pShape = pShapes;
+
while( nShapes )
{
- if( pShape->second.is() )
+ if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh))
{
- sal_Bool bChanged;
if( pShape >= pSelShape )
{
- bChanged =
- pShape->second->SetState( AccessibleStateType::SELECTED );
+ //first fire focus event
if( bFocused && 1 == nSelShapes )
pShape->second->SetState( AccessibleStateType::FOCUSED );
else
pShape->second->ResetState( AccessibleStateType::FOCUSED );
+
+ if(pShape->second->SetState( AccessibleStateType::SELECTED ))
+ {
+ vecxShapeAdd.push_back(pShape->second);
+ }
+ ++nCountSelectedShape;
}
+ /* MT: This still was in DEV300m80, but was removed in IA2 CWS.
+ Someone needs to check what should happen here, see original diff CWS oo31ia2 vs. OOO310M11
else
{
bChanged =
@@ -1029,40 +1483,89 @@ void SwAccessibleMap::DoInvalidateShapeSelection()
GetShell()->IsPreview() );
aParents.push_back( pParent );
}
+ */
}
--nShapes;
++pShape;
}
- if( aParents.size() > 0 )
+
+ const int SELECTION_WITH_NUM =10;
+ if (vecxShapeAdd.size() > SELECTION_WITH_NUM )
{
- ::std::list< const SwFrm * >::const_iterator aIter = aParents.begin();
- ::std::list< const SwFrm * >::const_iterator aEndIter = aParents.end();
- while( aIter != aEndIter )
+ uno::Reference< XAccessible > xDoc = GetDocumentView( );
+ SwAccessibleContext * pCont = static_cast<SwAccessibleContext *>(xDoc.get());
+ if (pCont)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+ pCont->FireAccessibleEvent(aEvent);
+ }
+ }
+ else
+ {
+ short nEventID = AccessibleEventId::SELECTION_CHANGED_ADD;
+ if (nCountSelectedShape <= 1 && vecxShapeAdd.size() == 1 )
+ {
+ nEventID = AccessibleEventId::SELECTION_CHANGED;
+ }
+ vi = vecxShapeAdd.begin();
+ for (; vi != vecxShapeAdd.end(); ++vi)
+ {
+ ::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->get());
+ if (pAccShape)
+ {
+ pAccShape->CommitChange(nEventID, uno::Any(), uno::Any());
+ }
+ }
+ }
+
+ vi = vecxShapeAdd.begin();
+ for (; vi != vecxShapeAdd.end(); ++vi)
+ {
+ ::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->get());
+ if (pAccShape)
{
- ::rtl::Reference< SwAccessibleContext > xParentAccImpl;
+ SdrObject *pObj = GetSdrObjectFromXShape(pAccShape->GetXShape());
+ SwFrmFmt *pFrmFmt = pObj ? FindFrmFmt( pObj ) : NULL;
+ if (pFrmFmt)
{
- osl::MutexGuard aGuard( maMutex );
- if( mpFrmMap )
+ const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+ if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
{
- SwAccessibleContextMap_Impl::const_iterator aMapIter =
- mpFrmMap->find( *aIter );
- if( aMapIter != mpFrmMap->end() )
+ uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
+ if (xPara.is())
{
- uno::Reference < XAccessible > xAcc( (*aMapIter).second );
- xParentAccImpl =
- static_cast< SwAccessibleContext *>( xAcc.get() );
+ uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
+ if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+ {
+ SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
+ if (pAccPara)
+ {
+ m_setParaAdd.insert(pAccPara);
+ }
+ }
}
}
}
- if( xParentAccImpl.is() )
+ }
+ }
+ vi = vecxShapeRemove.begin();
+ for (; vi != vecxShapeRemove.end(); ++vi)
+ {
+ ::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->get());
+ if (pAccShape)
+ {
+ uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
+ uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
+ if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
- xParentAccImpl->FireAccessibleEvent( aEvent );
+ SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
+ if (m_setParaAdd.count(pAccPara) == 0 )
+ {
+ m_setParaRemove.insert(pAccPara);
+ }
}
-
- ++aIter;
}
}
@@ -1070,6 +1573,8 @@ void SwAccessibleMap::DoInvalidateShapeSelection()
}
}
+//Marge with DoInvalidateShapeSelection
+/*
void SwAccessibleMap::DoInvalidateShapeFocus()
{
const SwViewShell *pVSh = GetShell();
@@ -1113,6 +1618,8 @@ void SwAccessibleMap::DoInvalidateShapeFocus()
}
}
+*/
+
SwAccessibleMap::SwAccessibleMap( SwViewShell *pSh ) :
mpFrmMap( 0 ),
mpShapeMap( 0 ),
@@ -1125,7 +1632,8 @@ SwAccessibleMap::SwAccessibleMap( SwViewShell *pSh ) :
mnPara( 1 ),
mnFootnote( 1 ),
mnEndnote( 1 ),
- mbShapeSelected( false )
+ mbShapeSelected( false ),
+ mpSeletedFrmMap(NULL)
{
pSh->GetLayout()->AddAccessibleShell();
}
@@ -1146,10 +1654,26 @@ SwAccessibleMap::~SwAccessibleMap()
}
}
+ if(xAcc.is())
+ {
SwAccessibleDocument *pAcc =
static_cast< SwAccessibleDocument * >( xAcc.get() );
pAcc->Dispose( sal_True );
-
+ }
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->begin();
+ while( aIter != mpFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xTmp = (*aIter).second;
+ if( xTmp.is() )
+ {
+ SwAccessibleContext *pTmp = static_cast< SwAccessibleContext * >( xTmp.get() );
+ pTmp->SetMap(NULL);
+ }
+ ++aIter;
+ }
+ }
{
osl::MutexGuard aGuard( maMutex );
#if OSL_DEBUG_LEVEL > 0
@@ -1228,6 +1752,7 @@ SwAccessibleMap::~SwAccessibleMap()
mpEvents = 0;
}
mpVSh->GetLayout()->RemoveAccessibleShell();
+ delete mpSeletedFrmMap;
}
uno::Reference< XAccessible > SwAccessibleMap::_GetDocumentView(
@@ -1356,7 +1881,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrm *pFrm,
sal_Bool bIsEndnote =
SwAccessibleFootnote::IsEndnote( pFtnFrm );
pAcc = new SwAccessibleFootnote( this, bIsEndnote,
- (bIsEndnote ? mnEndnote++ : mnFootnote++),
+ /*(bIsEndnote ? mnEndnote++ : mnFootnote++),*/
pFtnFrm );
}
break;
@@ -1511,6 +2036,8 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext(
}
// TODO: focus!!!
}
+ if (xAcc.is())
+ AddGroupContext(pObj, xAcc);
}
}
}
@@ -1522,6 +2049,105 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext(
return xAcc;
}
+sal_Bool SwAccessibleMap::IsInSameLevel(const SdrObject* pObj, const SwFEShell* pFESh)
+{
+ if (pFESh)
+ return pFESh->IsObjSameLevelWithMarked(pObj);
+ return sal_False;
+}
+
+void SwAccessibleMap::AddShapeContext(const SdrObject *pObj, uno::Reference < XAccessible > xAccShape)
+{
+ osl::MutexGuard aGuard( maMutex );
+
+ if( mpShapeMap )
+ {
+ SwAccessibleShapeMap_Impl::value_type aEntry( pObj, xAccShape );
+ mpShapeMap->insert( aEntry );
+ }
+
+}
+
+//Added by yanjun for sym2_6407
+void SwAccessibleMap::RemoveGroupContext(const SdrObject *pParentObj, ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccParent)
+{
+ osl::MutexGuard aGuard( maMutex );
+ if (mpShapeMap && pParentObj && pParentObj->IsGroupObject() && xAccParent.is())
+ {
+ uno::Reference < XAccessibleContext > xContext = xAccParent->getAccessibleContext();
+ if (xContext.is())
+ {
+ for (sal_Int32 i = 0; i < xContext->getAccessibleChildCount(); ++i)
+ {
+ uno::Reference < XAccessible > xChild = xContext->getAccessibleChild(i);
+ if (xChild.is())
+ {
+ uno::Reference < XAccessibleContext > xChildContext = xChild->getAccessibleContext();
+ if (xChildContext.is())
+ {
+ if (xChildContext->getAccessibleRole() == AccessibleRole::SHAPE)
+ {
+ ::accessibility::AccessibleShape* pAccShape = static_cast < ::accessibility::AccessibleShape* >( xChild.get());
+ uno::Reference < drawing::XShape > xShape = pAccShape->GetXShape();
+ if (xShape.is())
+ {
+ SdrObject* pObj = GetSdrObjectFromXShape(xShape);
+ if (pObj)
+ RemoveContext(pObj);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+//End
+
+
+void SwAccessibleMap::AddGroupContext(const SdrObject *pParentObj, uno::Reference < XAccessible > xAccParent)
+{
+ osl::MutexGuard aGuard( maMutex );
+ if( mpShapeMap )
+ {
+ //here get all the sub list.
+ if (pParentObj->IsGroupObject())
+ {
+ if (xAccParent.is())
+ {
+ uno::Reference < XAccessibleContext > xContext = xAccParent->getAccessibleContext();
+ if (xContext.is())
+ {
+ sal_Int32 nChildren = xContext->getAccessibleChildCount();
+ for(sal_Int32 i = 0; i<nChildren; i++)
+ {
+ uno::Reference < XAccessible > xChild = xContext->getAccessibleChild(i);
+ if (xChild.is())
+ {
+ uno::Reference < XAccessibleContext > xChildContext = xChild->getAccessibleContext();
+ if (xChildContext.is())
+ {
+ short nRole = xChildContext->getAccessibleRole();
+ if (nRole == AccessibleRole::SHAPE)
+ {
+ ::accessibility::AccessibleShape* pAccShape = static_cast < ::accessibility::AccessibleShape* >( xChild.get());
+ uno::Reference < drawing::XShape > xShape = pAccShape->GetXShape();
+ if (xShape.is())
+ {
+ SdrObject* pObj = GetSdrObjectFromXShape(xShape);
+ AddShapeContext(pObj, xChild);
+ AddGroupContext(pObj,xChild);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
::rtl::Reference < ::accessibility::AccessibleShape > SwAccessibleMap::GetContextImpl(
const SdrObject *pObj,
SwAccessibleContext *pParentImpl,
@@ -1582,13 +2208,14 @@ void SwAccessibleMap::RemoveContext( const SdrObject *pObj )
mpShapeMap->find( pObj );
if( aIter != mpShapeMap->end() )
{
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
mpShapeMap->erase( aIter );
-
+ RemoveGroupContext(pObj, xAcc);
// The shape selection flag is not cleared, but one might do
// so but has to make sure that the removed context is the one
// that is selected.
- if( mpShapeMap->empty() )
+ if( mpShapeMap && mpShapeMap->empty() )
{
delete mpShapeMap;
mpShapeMap = 0;
@@ -1734,6 +2361,7 @@ void SwAccessibleMap::InvalidatePosOrSize( const SwFrm *pFrm,
{
::rtl::Reference< SwAccessibleContext > xAccImpl;
::rtl::Reference< SwAccessibleContext > xParentAccImpl;
+ const SwFrm *pParent =NULL;
{
osl::MutexGuard aGuard( maMutex );
@@ -1756,7 +2384,7 @@ void SwAccessibleMap::InvalidatePosOrSize( const SwFrm *pFrm,
{
// Otherwise we look if the parent is accessible.
// If not, there is nothing to do.
- const SwFrm *pParent =
+ pParent =
SwAccessibleFrame::GetParent( aFrmOrObj,
GetShell()->IsPreview());
@@ -1806,6 +2434,51 @@ void SwAccessibleMap::InvalidatePosOrSize( const SwFrm *pFrm,
rOldBox );
}
}
+ else if(pParent)
+ {
+/*
+For child graphic and it's parent paragraph,if split 2 graphic to 2 paragraph,
+will delete one graphic swfrm and new create 1 graphic swfrm ,
+then the new paragraph and the new graphic SwFrm will add .
+but when add graphic SwFrm ,the accessible of the new Paragraph is not created yet.
+so the new graphic accessible 'parent is NULL,
+so run here: save the parent's SwFrm not the accessible object parent,
+*/
+ sal_Bool bIsValidFrm = sal_False;
+ sal_Bool bIsTxtParent = sal_False;
+ if (aFrmOrObj.GetSwFrm())
+ {
+ int nType = pFrm->GetType();
+ if ( FRM_FLY == nType )
+ {
+ bIsValidFrm =sal_True;
+ }
+ }
+ else if(pObj)
+ {
+ int nType = pParent->GetType();
+ if (FRM_TXT == nType)
+ {
+ bIsTxtParent =sal_True;
+ }
+ }
+// sal_Bool bIsVisibleChildrenOnly =aFrmOrObj.IsVisibleChildrenOnly() ;
+// sal_Bool bIsBoundAsChar =aFrmOrObj.IsBoundAsChar() ;//bIsVisibleChildrenOnly && bIsBoundAsChar &&
+ if((bIsValidFrm || bIsTxtParent) )
+ {
+ if( GetShell()->ActionPend() )
+ {
+ SwAccessibleEvent_Impl aEvent(
+ SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
+ pParent, aFrmOrObj, rOldBox );
+ AppendEvent( aEvent );
+ }
+ else
+ {
+ OSL_ENSURE(false,"");
+ }
+ }
+ }
}
}
@@ -1938,6 +2611,27 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm )
mpFrmMap->find( aFrmOrObj.GetSwFrm() );
if( aIter != mpFrmMap->end() )
xAcc = (*aIter).second;
+ else
+ {
+ SwRect rcEmpty;
+ const SwTabFrm* pTabFrm = aFrmOrObj.GetSwFrm()->FindTabFrm();
+ if (pTabFrm)
+ {
+ InvalidatePosOrSize(pTabFrm,0,0,rcEmpty);
+ }
+ else
+ {
+ InvalidatePosOrSize(aFrmOrObj.GetSwFrm(),0,0,rcEmpty);
+ }
+
+
+ aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ {
+ xAcc = (*aIter).second;
+ }
+ }
// For cells, some extra thoughts are necessary,
// because invalidating the cursor for one cell
@@ -1966,25 +2660,201 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm )
xAcc = GetContext( aFrmOrObj.GetSwFrm(), sal_True );
}
}
+ else if (bShapeSelected)
+ {
+ const SwFEShell *pFESh = pVSh ? static_cast< const SwFEShell * >( pVSh ) : NULL ;
+ if(pFESh)
+ {
+ const SdrMarkList *pMarkList = pFESh->GetMarkList();
+ if (pMarkList != NULL && pMarkList->GetMarkCount() == 1)
+ {
+ SdrObject *pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
+ ::rtl::Reference < ::accessibility::AccessibleShape > pAccShapeImpl = GetContextImpl(pObj,NULL,sal_False);
+ if (!pAccShapeImpl.is())
+ {
+ while (pObj && pObj->GetUpGroup())
+ {
+ pObj = pObj->GetUpGroup();
+ }
+ if (pObj != NULL)
+ {
+ const SwFrm *pParent = SwAccessibleFrame::GetParent( SwAccessibleChild(pObj), GetShell()->IsPreview() );
+ if( pParent )
+ {
+ ::rtl::Reference< SwAccessibleContext > xParentAccImpl = GetContextImpl(pParent,sal_False);
+ if (!xParentAccImpl.is())
+ {
+ const SwTabFrm* pTabFrm = pParent->FindTabFrm();
+ if (pTabFrm)
+ {
+ //The Table should not add in acc.because the "pParent" is not add to acc .
+ uno::Reference< XAccessible> xAccParentTab = GetContext(pTabFrm,sal_True);//Should Create.
+
+ const SwFrm *pParentRoot = SwAccessibleFrame::GetParent( SwAccessibleChild(pTabFrm), GetShell()->IsPreview() );
+ if (pParentRoot)
+ {
+ ::rtl::Reference< SwAccessibleContext > xParentAccImplRoot = GetContextImpl(pParentRoot,sal_False);
+ if(xParentAccImplRoot.is())
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= xAccParentTab;
+ xParentAccImplRoot->FireAccessibleEvent( aEvent );
+ }
+ }
+
+ //Get "pParent" acc again.
+ xParentAccImpl = GetContextImpl(pParent,sal_False);
+ }
+ else
+ {
+ //directly create this acc para .
+ xParentAccImpl = GetContextImpl(pParent,sal_True);//Should Create.
+
+ const SwFrm *pParentRoot = SwAccessibleFrame::GetParent( SwAccessibleChild(pParent), GetShell()->IsPreview() );
+
+ ::rtl::Reference< SwAccessibleContext > xParentAccImplRoot = GetContextImpl(pParentRoot,sal_False);
+ if(xParentAccImplRoot.is())
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= uno::Reference< XAccessible>(xParentAccImpl.get());
+ xParentAccImplRoot->FireAccessibleEvent( aEvent );
+ }
+ }
+ }
+ if (xParentAccImpl.is())
+ {
+ uno::Reference< XAccessible> xAccShape =
+ GetContext(pObj,xParentAccImpl.get(),sal_True);
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= xAccShape;
+ xParentAccImpl->FireAccessibleEvent( aEvent );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
+ m_setParaAdd.clear();
+ m_setParaRemove.clear();
if( xOldAcc.is() && xOldAcc != xAcc )
InvalidateCursorPosition( xOldAcc );
if( bOldShapeSelected || bShapeSelected )
InvalidateShapeSelection();
if( xAcc.is() )
InvalidateCursorPosition( xAcc );
+
+ InvalidateShapeInParaSelection();
+
+ SET_PARA::iterator si = m_setParaRemove.begin();
+ for (; si != m_setParaRemove.end() ; ++si)
+ {
+ SwAccessibleParagraph* pAccPara = *si;
+ if(pAccPara && pAccPara->getSelectedAccessibleChildCount() == 0 && pAccPara->getSelectedText().getLength() == 0)
+ {
+ if(pAccPara->SetSelectedState(sal_False))
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
+ pAccPara->FireAccessibleEvent( aEvent );
+ }
+ }
+ }
+ si = m_setParaAdd.begin();
+ for (; si != m_setParaAdd.end() ; ++si)
+ {
+ SwAccessibleParagraph* pAccPara = *si;
+ if(pAccPara && pAccPara->SetSelectedState(sal_True))
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+ pAccPara->FireAccessibleEvent( aEvent );
+ }
+ }
+}
+
+//Notify the page change event to bridge.
+void SwAccessibleMap::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage)
+{
+ uno::Reference<XAccessible> xAcc = GetDocumentView( );
+ if ( xAcc.is() )
+ {
+ SwAccessibleDocumentBase *pAcc =
+ static_cast< SwAccessibleDocumentBase * >( xAcc.get() );
+ if (pAcc)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::PAGE_CHANGED;
+ aEvent.OldValue <<= nOldPage;
+ aEvent.NewValue <<= nNewPage;
+ pAcc->FireAccessibleEvent( aEvent );
+ }
+ }
+}
+
+void SwAccessibleMap::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection)
+{
+ uno::Reference<XAccessible> xAcc = GetDocumentView( );
+ if ( xAcc.is() )
+ {
+ SwAccessibleDocumentBase *pAcc =
+ static_cast< SwAccessibleDocumentBase * >( xAcc.get() );
+ if (pAcc)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SECTION_CHANGED;
+ aEvent.OldValue <<= nOldSection;
+ aEvent.NewValue <<= nNewSection;
+ pAcc->FireAccessibleEvent( aEvent );
+
+ }
+ }
+}
+void SwAccessibleMap::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn)
+{
+ uno::Reference<XAccessible> xAcc = GetDocumentView( );
+ if ( xAcc.is() )
+ {
+ SwAccessibleDocumentBase *pAcc =
+ static_cast< SwAccessibleDocumentBase * >( xAcc.get() );
+ if (pAcc)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::COLUMN_CHANGED;
+ aEvent.OldValue <<= nOldColumn;
+ aEvent.NewValue <<= nNewColumn;
+ pAcc->FireAccessibleEvent( aEvent );
+
+ }
+ }
}
void SwAccessibleMap::InvalidateFocus()
{
+ if(GetShell()->IsPreview())
+ {
+ uno::Reference<XAccessible> xAcc = _GetDocumentView( sal_True );
+ if (xAcc.get())
+ {
+ SwAccessiblePreview *pAccPreview = static_cast<SwAccessiblePreview *>(xAcc.get());
+ if (pAccPreview)
+ {
+ pAccPreview->InvalidateFocus();
+ return ;
+ }
+ }
+ }
uno::Reference < XAccessible > xAcc;
- bool bShapeSelected;
{
osl::MutexGuard aGuard( maMutex );
xAcc = mxCursorContext;
- bShapeSelected = mbShapeSelected;
}
if( xAcc.is() )
@@ -1993,9 +2863,9 @@ void SwAccessibleMap::InvalidateFocus()
static_cast< SwAccessibleContext *>( xAcc.get() );
pAccImpl->InvalidateFocus();
}
- else if( bShapeSelected )
+ else
{
- DoInvalidateShapeFocus();
+ DoInvalidateShapeSelection(sal_True);
}
}
@@ -2260,6 +3130,7 @@ void SwAccessibleMap::FireEvents()
if( mpEvents )
{
mpEvents->SetFiring();
+ mpEvents->MoveInvalidXAccToEnd();
::std::for_each(mpEvents->begin(), mpEvents->end(),
boost::bind(&SwAccessibleMap::FireEvent, this, _1));
@@ -2442,6 +3313,91 @@ sal_Bool SwAccessibleMap::ReplaceChild (
return sal_True;
}
+//Get the accessible control shape from the model object, here model object is with XPropertySet type
+::accessibility::AccessibleControlShape * SwAccessibleMap::GetAccControlShapeFromModel(::com::sun::star::beans::XPropertySet* pSet) throw (::com::sun::star::uno::RuntimeException)
+{
+ if( mpShapeMap )
+ {
+ SwAccessibleShapeMap_Impl::const_iterator aIter = mpShapeMap->begin();
+ SwAccessibleShapeMap_Impl::const_iterator aEndIter = mpShapeMap->end();
+ while( aIter != aEndIter)
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ ::accessibility::AccessibleShape *pAccShape =
+ static_cast < ::accessibility::AccessibleShape* >( xAcc.get() );
+ if(pAccShape && ::accessibility::ShapeTypeHandler::Instance().GetTypeId (pAccShape->GetXShape()) == ::accessibility::DRAWING_CONTROL)
+ {
+ ::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape);
+ if (pCtlAccShape && pCtlAccShape->GetControlModel() == pSet)
+ return pCtlAccShape;
+ }
+ ++aIter;
+ }
+ }
+ return NULL;
+}
+
+::com::sun::star::uno::Reference< XAccessible >
+ SwAccessibleMap::GetAccessibleCaption (const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SdrObject* captionedObject = GetSdrObjectFromXShape(xShape);
+
+ SwDrawContact *pContact = (SwDrawContact*)GetUserCall( captionedObject );
+ OSL_ENSURE( RES_DRAWFRMFMT == pContact->GetFmt()->Which(),
+ "fail" );
+ if( !pContact )
+ return 0;
+
+ SwDrawFrmFmt *pCaptionedFmt = (SwDrawFrmFmt *)pContact->GetFmt();
+ if( !pCaptionedFmt )
+ return 0;
+
+ SwFlyFrm* pFrm = NULL;
+ if (pCaptionedFmt->HasCaption())
+ {
+ const SwFrmFmt *pCaptionFrmFmt = pCaptionedFmt->GetCaptionFmt();
+ SwClientIter aIter (*(SwModify*)pCaptionFrmFmt);
+ pFrm = (SwFlyFrm*)aIter.First( TYPE ( SwFlyFrm ));
+ }
+ if (!pFrm)
+ return 0;
+ //SwFrmFmt* pFrm = pCaptionedFmt->GetCaptionFmt();
+ uno::Reference < XAccessible > xAcc( GetContext((SwFrm*)pFrm,sal_True) );
+ //Reference < XAccessibleShape > xAccShape( xAcc, UNO_QUERY );
+
+ uno::Reference< XAccessibleContext > xAccContext = xAcc->getAccessibleContext();
+ if( xAccContext.is() )
+ { //get the parent of caption frame, which is paragaph
+ uno::Reference< XAccessible > xAccParent = xAccContext->getAccessibleParent();
+ if(xAccParent.is())
+ {
+ //get the great parent of caption frame which is text frame.
+ uno::Reference< XAccessibleContext > xAccParentContext = xAccParent->getAccessibleContext();
+ uno::Reference< XAccessible > xAccGreatParent = xAccParentContext->getAccessibleParent();
+ if(xAccGreatParent.is())
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= xAccParent;
+ ( static_cast< SwAccessibleContext * >(xAccGreatParent.get()) )->FireAccessibleEvent( aEvent );
+
+ }
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= xAcc;
+ ( static_cast< SwAccessibleContext * >(xAccParent.get()) )->FireAccessibleEvent( aEvent );
+ }
+ }
+
+ if(xAcc.get())
+ return xAcc;
+ else
+ return NULL;
+
+}
+
Point SwAccessibleMap::PixelToCore( const Point& rPoint ) const
{
Point aPoint;
@@ -2745,4 +3701,9 @@ const SwRect& SwAccessibleMap::GetVisArea() const
: GetShell()->VisArea();
}
+sal_Bool SwAccessibleMap::IsDocumentSelAll()
+{
+ return GetShell()->GetDoc()->IsPrepareSelAll();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx
index d0a0de9d6731..f50b19d24cc1 100644
--- a/sw/source/core/access/accnotextframe.cxx
+++ b/sw/source/core/access/accnotextframe.cxx
@@ -29,9 +29,17 @@
#include <cntfrm.hxx>
#include <hints.hxx>
#include "accnotextframe.hxx"
+#include <fmturl.hxx>
+#include <accnotexthyperlink.hxx>
+#include <svtools/imap.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <doc.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
+using utl::AccessibleRelationSetHelper;
const SwNoTxtNode *SwAccessibleNoTextFrame::GetNoTxtNode() const
{
@@ -41,7 +49,11 @@ const SwNoTxtNode *SwAccessibleNoTextFrame::GetNoTxtNode() const
{
const SwCntntFrm *pCntFrm =
static_cast<const SwCntntFrm *>( pFlyFrm->Lower() );
- pNd = pCntFrm->GetNode()->GetNoTxtNode();
+ const SwCntntNode* pSwCntntNode = pCntFrm->GetNode();
+ if(pSwCntntNode != NULL)
+ {
+ pNd = pSwCntntNode->GetNoTxtNode();
+ }
}
return pNd;
@@ -193,6 +205,13 @@ uno::Any SAL_CALL SwAccessibleNoTextFrame::queryInterface( const uno::Type& aTyp
aAny <<= xImage;
return aAny;
}
+ else if ( aType == ::getCppuType((uno::Reference<XAccessibleHypertext> *)0) )
+ {
+ uno::Reference<XAccessibleHypertext> aAccHypertext = this;
+ uno::Any aAny;
+ aAny <<= aAccHypertext;
+ return aAny;
+ }
else
return SwAccessibleContext::queryInterface( aType );
}
@@ -235,4 +254,137 @@ sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getAccessibleImageWidth( )
return getSize().Width;
}
+//===== XAccesibleText ==================================================
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Bool SAL_CALL SwAccessibleNoTextFrame::setCaretPosition( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
+sal_Unicode SAL_CALL SwAccessibleNoTextFrame::getCharacter( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
+::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL SwAccessibleNoTextFrame::getCharacterAttributes( sal_Int32 , const ::com::sun::star::uno::Sequence< OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ uno::Sequence<beans::PropertyValue> aValues(0);
+ return aValues;
+}
+::com::sun::star::awt::Rectangle SAL_CALL SwAccessibleNoTextFrame::getCharacterBounds( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ return com::sun::star::awt::Rectangle(0, 0, 0, 0 );
+}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getIndexAtPoint( const ::com::sun::star::awt::Point& ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+OUString SAL_CALL SwAccessibleNoTextFrame::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Bool SAL_CALL SwAccessibleNoTextFrame::setSelection( sal_Int32 , sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}
+OUString SAL_CALL SwAccessibleNoTextFrame::getText( ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
+OUString SAL_CALL SwAccessibleNoTextFrame::getTextRange( sal_Int32 , sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return OUString();}
+::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextAtIndex( sal_Int32 , sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::accessibility::TextSegment aResult;
+ return aResult;
+}
+::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextBeforeIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::accessibility::TextSegment aResult;
+ return aResult;
+}
+::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextBehindIndex( sal_Int32 , sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::accessibility::TextSegment aResult;
+ return aResult;
+}
+
+sal_Bool SAL_CALL SwAccessibleNoTextFrame::copyText( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}
+
+
+//
+// XAccessibleHyperText
+//
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getHyperLinkCount()
+throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+ sal_Int32 nCount = 0;
+ SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
+
+ if(aURL.GetMap() || !aURL.GetURL().isEmpty())
+ nCount = 1;
+
+ return nCount;
+}
+
+uno::Reference< XAccessibleHyperlink > SAL_CALL
+ SwAccessibleNoTextFrame::getHyperLink( sal_Int32 nLinkIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+ uno::Reference< XAccessibleHyperlink > xRet;
+
+ SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
+
+ if( nLinkIndex > 0 )
+ throw lang::IndexOutOfBoundsException();
+
+ if( aURL.GetMap() || !aURL.GetURL().isEmpty() )
+ {
+ if ( !alink.is() )
+ {
+ alink = new SwAccessibleNoTextHyperlink( this, GetFrm() );
+ }
+
+ return alink;
+ }
+
+ return NULL;
+}
+
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getHyperLinkIndex( sal_Int32 )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+ sal_Int32 nRet = 0;
+
+ return nRet;
+}
+
+AccessibleRelation SwAccessibleNoTextFrame::makeRelation( sal_Int16 nType, const SwFlyFrm* pFrm )
+{
+ uno::Sequence<uno::Reference<XInterface> > aSequence(1);
+ aSequence[0] = GetMap()->GetContext( pFrm );
+ return AccessibleRelation( nType, aSequence );
+}
+
+
+uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleNoTextFrame::getAccessibleRelationSet( )
+ throw ( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ CHECK_FOR_DEFUNC( XAccessibleContext );
+
+ // get the caption frame, and insert label relations into helper
+
+ AccessibleRelationSetHelper* pHelper = new AccessibleRelationSetHelper();
+
+ SwFlyFrm* pFlyFrm = getFlyFrm();
+ DBG_ASSERT( pFlyFrm != NULL, "fly frame expected" );
+
+ SwFlyFrm* pCaptionFrm = NULL;
+ const SwFrmFmt* pFrm = pFlyFrm ->GetFmt()->GetCaptionFmt();
+ if (pFrm)
+ {
+ SwClientIter aIter (*(SwModify*)pFrm);
+ pCaptionFrm = (SwFlyFrm*)aIter.First( TYPE ( SwFlyFrm ));
+ }
+ if(pCaptionFrm!=NULL)
+ {
+ pHelper->AddRelation( makeRelation( AccessibleRelationType::DESCRIBED_BY, pCaptionFrm ) );
+ }
+
+ return pHelper;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/accnotextframe.hxx b/sw/source/core/access/accnotextframe.hxx
index bcbef05911f3..2ea05f15932c 100644
--- a/sw/source/core/access/accnotextframe.hxx
+++ b/sw/source/core/access/accnotextframe.hxx
@@ -22,13 +22,24 @@
#include "accframebase.hxx"
#include <com/sun/star/accessibility/XAccessibleImage.hpp>
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+
+namespace utl { class AccessibleRelationSetHelper; }
+namespace com { namespace star {
+ namespace accessibility { struct AccessibleRelation; }
+} }
class SwFlyFrm;
class SwNoTxtNode;
+class SwAccessibleNoTextHyperlink;
class SwAccessibleNoTextFrame : public SwAccessibleFrameBase,
- public ::com::sun::star::accessibility::XAccessibleImage
+ public ::com::sun::star::accessibility::XAccessibleImage,
+ public ::com::sun::star::accessibility::XAccessibleHypertext//Added by yangzhh for HyperLink
{
+ friend class SwAccessibleNoTextHyperlink;
+ //HyperLinksMap alinksMap;
+ com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > alink;
SwDepend aDepend;
OUString msTitle; // #i73249#
OUString msDesc;
@@ -89,6 +100,49 @@ public:
// The object is not visible an longer and should be destroyed
virtual void Dispose( sal_Bool bRecursive = sal_False );
+
+ virtual sal_Int32 SAL_CALL getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);//Shen Zhen Jie changed sal_Unicode to sal_uInt32
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getSelectedText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+
+ //===== XAccessibleHypertext ============================================
+ virtual sal_Int32 SAL_CALL getHyperLinkCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleHyperlink >
+ SAL_CALL getHyperLink( sal_Int32 nLinkIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getHyperLinkIndex( sal_Int32 nCharIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ SwAccessibleMap *GetAccessibleMap(){ return GetMap();}
+
+private:
+ com::sun::star::accessibility::AccessibleRelation makeRelation(
+ sal_Int16 nType, const SwFlyFrm* pFrm );
+
+public:
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+ getAccessibleRelationSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
};
#endif
diff --git a/sw/source/core/access/accnotexthyperlink.cxx b/sw/source/core/access/accnotexthyperlink.cxx
new file mode 100644
index 000000000000..1efe3924c8bc
--- /dev/null
+++ b/sw/source/core/access/accnotexthyperlink.cxx
@@ -0,0 +1,225 @@
+/*
+ * 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 <frmfmt.hxx>
+
+#include <accnotexthyperlink.hxx>
+
+#include <fmturl.hxx>
+
+#include <svtools/imap.hxx>
+#include <svtools/imapobj.hxx>
+
+#include <accmap.hxx>
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+
+SwAccessibleNoTextHyperlink::SwAccessibleNoTextHyperlink( SwAccessibleNoTextFrame *p, const SwFrm *aFrm, sal_uInt16 nIndex) :
+ xFrame( p ),
+ mpFrm( aFrm ),
+ mnIndex(nIndex)
+{
+}
+
+// XAccessibleAction
+sal_Int32 SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionCount()
+ throw (RuntimeException)
+{
+ SwFmtURL aURL( GetFmt()->GetURL() );
+ ImageMap* pMap = aURL.GetMap();
+ if( pMap != NULL )
+ {
+ return pMap->GetIMapObjectCount();
+ }
+ else if( !aURL.GetURL().isEmpty() )
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
+sal_Bool SAL_CALL SwAccessibleNoTextHyperlink::doAccessibleAction( sal_Int32 nIndex )
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+ throw lang::IndexOutOfBoundsException();
+
+ sal_Bool bRet = sal_False;
+ SwFmtURL aURL( GetFmt()->GetURL() );
+ ImageMap* pMap = aURL.GetMap();
+ if( pMap != NULL )
+ {
+ IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+ if (!pMapObj->GetURL().isEmpty())
+ {
+ SwViewShell *pVSh = xFrame->GetShell();
+ if( pVSh )
+ {
+ LoadURL( *pVSh, pMapObj->GetURL(), URLLOAD_NOFILTER,
+ pMapObj->GetTarget() );
+ bRet = sal_True;
+ }
+ }
+ }
+ else if (!aURL.GetURL().isEmpty())
+ {
+ SwViewShell *pVSh = xFrame->GetShell();
+ if( pVSh )
+ {
+ LoadURL( *pVSh, aURL.GetURL(), URLLOAD_NOFILTER,
+ aURL.GetTargetFrameName() );
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+OUString SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionDescription(
+ sal_Int32 nIndex )
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OUString sDesc;
+
+ if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+ throw lang::IndexOutOfBoundsException();
+
+ SwFmtURL aURL( GetFmt()->GetURL() );
+ ImageMap* pMap = aURL.GetMap();
+ if( pMap != NULL )
+ {
+ IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+ if (!pMapObj->GetDesc().isEmpty())
+ sDesc = pMapObj->GetDesc();
+ else if (!pMapObj->GetURL().isEmpty())
+ sDesc = pMapObj->GetURL();
+ }
+ else if( !aURL.GetURL().isEmpty() )
+ sDesc = aURL.GetName();
+
+ return sDesc;
+}
+
+Reference< XAccessibleKeyBinding > SAL_CALL
+ SwAccessibleNoTextHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex )
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XAccessibleKeyBinding > xKeyBinding;
+
+ if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+ throw lang::IndexOutOfBoundsException();
+
+ bool bIsValid = sal_False;
+ SwFmtURL aURL( GetFmt()->GetURL() );
+ ImageMap* pMap = aURL.GetMap();
+ if( pMap != NULL )
+ {
+ IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+ if (!pMapObj->GetURL().isEmpty())
+ bIsValid = sal_True;
+ }
+ else if (!aURL.GetURL().isEmpty())
+ bIsValid = sal_True;
+
+ if(bIsValid)
+ {
+ ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper =
+ new ::comphelper::OAccessibleKeyBindingHelper();
+ xKeyBinding = pKeyBindingHelper;
+
+ ::com::sun::star::awt::KeyStroke aKeyStroke;
+ aKeyStroke.Modifiers = 0;
+ aKeyStroke.KeyCode = KEY_RETURN;
+ aKeyStroke.KeyChar = 0;
+ aKeyStroke.KeyFunc = 0;
+ pKeyBindingHelper->AddKeyBinding( aKeyStroke );
+ }
+
+ return xKeyBinding;
+}
+
+// XAccessibleHyperlink
+Any SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionAnchor(
+ sal_Int32 nIndex )
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+ throw lang::IndexOutOfBoundsException();
+
+ Any aRet;
+ //SwFrm* pAnchor = ((SwFlyFrm*)mpFrm)->GetAnchor();
+ Reference< XAccessible > xAnchor = xFrame->GetAccessibleMap()->GetContext(mpFrm, sal_True);
+ //SwAccessibleNoTextFrame* pFrame = xFrame.get();
+ //Reference< XAccessible > xAnchor = (XAccessible*)pFrame;
+ aRet <<= xAnchor;
+ return aRet;
+}
+
+Any SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionObject(
+ sal_Int32 nIndex )
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+ throw lang::IndexOutOfBoundsException();
+
+ SwFmtURL aURL( GetFmt()->GetURL() );
+ OUString retText;
+ ImageMap* pMap = aURL.GetMap();
+ if( pMap != NULL )
+ {
+ IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+ if (!pMapObj->GetURL().isEmpty())
+ retText = pMapObj->GetURL();
+ }
+ else if ( !aURL.GetURL().isEmpty() )
+ retText = aURL.GetURL();
+
+ Any aRet;
+ aRet <<= retText;
+ return aRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleNoTextHyperlink::getStartIndex()
+ throw (RuntimeException)
+{
+ return 0;
+}
+
+sal_Int32 SAL_CALL SwAccessibleNoTextHyperlink::getEndIndex()
+ throw (RuntimeException)
+{
+ return 0;
+}
+
+sal_Bool SAL_CALL SwAccessibleNoTextHyperlink::isValid( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SwFmtURL aURL( GetFmt()->GetURL() );
+
+ if( aURL.GetMap() || !aURL.GetURL().isEmpty() )
+ return sal_True;
+ return sal_False;
+}
diff --git a/sw/source/core/access/accnotexthyperlink.hxx b/sw/source/core/access/accnotexthyperlink.hxx
new file mode 100644
index 000000000000..7e64c14024d2
--- /dev/null
+++ b/sw/source/core/access/accnotexthyperlink.hxx
@@ -0,0 +1,83 @@
+/*
+ * 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 _ACCNOTEXTHYPERLINK_HXX
+#define _ACCNOTEXTHYPERLINK_HXX
+
+
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <fmtinfmt.hxx>
+#include <frame.hxx>
+#include <layfrm.hxx>
+
+#include "accnotextframe.hxx"
+
+class SwAccessibleNoTextHyperlink :
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::accessibility::XAccessibleHyperlink >
+{
+ friend class SwAccessibleNoTextFrame;
+
+ ::rtl::Reference< SwAccessibleNoTextFrame > xFrame;
+ const SwFrm *mpFrm;
+ sal_uInt16 mnIndex;
+
+ SwFrmFmt *GetFmt()
+ {
+ return ((SwLayoutFrm*)mpFrm)->GetFmt();
+ }
+public:
+
+ SwAccessibleNoTextHyperlink( SwAccessibleNoTextFrame *p, const SwFrm* aFrm, sal_uInt16 nIndex = 0xFFFF );
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription(
+ sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL
+ getAccessibleActionKeyBinding( sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleHyperlink
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor(
+ sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject(
+ sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getStartIndex()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getEndIndex()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isValid( )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 470525116f05..1fca12752fb6 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -57,7 +57,29 @@
#include <acchypertextdata.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <section.hxx>
+#include <doctxm.hxx>
#include <comphelper/accessibletexthelper.hxx>
+#include <algorithm>
+#include <docufld.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <modcfg.hxx>
+//#include "accnote.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "swmodule.hxx"
+#include "redline.hxx"
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <wrong.hxx>
+#include <editeng/brushitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+#include <unosett.hxx>
+#include <paratr.hxx>
+#include <com/sun/star/container/XIndexReplace.hpp>
+// --> OD 2006-07-12 #i63870#
#include <unomap.hxx>
#include <unoprnms.hxx>
#include <com/sun/star/text/WritingMode2.hpp>
@@ -70,10 +92,19 @@
#include <com/sun/star/text/TextMarkupType.hpp>
#include <comphelper/servicehelper.hxx>
+#include <reffld.hxx>
+#include <docufld.hxx>
+#include <expfld.hxx>
+#include <flddat.hxx>
+#include <fldui.hrc>
+#include "../../ui/inc/fldmgr.hxx"
+#include "fldbas.hxx" // SwField
+
#include <algorithm>
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::container;
using beans::PropertyValue;
using beans::XMultiPropertySet;
@@ -133,6 +164,17 @@ sal_Int32 SwAccessibleParagraph::GetCaretPos()
// same node? Then check whether it's also within 'our' part
// of the paragraph
const sal_Int32 nIndex = pPoint->nContent.GetIndex();
+ if(!GetPortionData().IsValidCorePosition( nIndex ) ||
+ ( GetPortionData().IsZeroCorePositionData() && nIndex== 0) )
+ {
+ SwTxtFrm *pTxtFrm = PTR_CAST( SwTxtFrm, GetFrm() );
+ bool bFormat = (pTxtFrm && pTxtFrm->HasPara());
+ if(bFormat)
+ {
+ ClearPortionData();
+ UpdatePortionData();
+ }
+ }
if( GetPortionData().IsValidCorePosition( nIndex ) )
{
// Yes, it's us!
@@ -369,6 +411,18 @@ void SwAccessibleParagraph::_InvalidateContent( sal_Bool bVisibleDataFired )
aEvent.OldValue, aEvent.NewValue );
FireAccessibleEvent( aEvent );
+ uno::Reference< XAccessible > xparent = getAccessibleParent();
+ uno::Reference< XAccessibleContext > xAccContext(xparent,uno::UNO_QUERY);
+ if (xAccContext.is() && xAccContext->getAccessibleRole() == AccessibleRole::TABLE_CELL)
+ {
+ SwAccessibleContext* pPara = static_cast< SwAccessibleContext* >(xparent.get());
+ if(pPara)
+ {
+ AccessibleEventObject aParaEvent;
+ aParaEvent.EventId = AccessibleEventId::VALUE_CHANGED;
+ pPara->FireAccessibleEvent(aParaEvent);
+ }
+ }
}
else if( !bVisibleDataFired )
{
@@ -376,6 +430,8 @@ void SwAccessibleParagraph::_InvalidateContent( sal_Bool bVisibleDataFired )
}
sal_Bool bNewIsHeading = IsHeading();
+ //Get the real heading level, Heading1 ~ Heading10
+ nHeadingLevel = GetRealHeadingLevel();
sal_Bool bOldIsHeading;
{
osl::MutexGuard aGuard( aMutex );
@@ -442,6 +498,18 @@ void SwAccessibleParagraph::_InvalidateCursorPos()
if( pWin && pWin->HasFocus() && -1 == nNew )
FireStateChangedEvent( AccessibleStateType::FOCUSED, sal_False );
+ //To send TEXT_SELECTION_CHANGED event
+ sal_Int32 nStart=0;
+ sal_Int32 nEnd =0;
+ sal_Bool bCurSelection=GetSelection(nStart,nEnd);
+ if(m_bLastHasSelection || bCurSelection )
+ {
+ aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
+ aEvent.OldValue <<= uno::Any();
+ aEvent.NewValue <<= uno::Any();
+ FireAccessibleEvent(aEvent);
+ }
+ m_bLastHasSelection =bCurSelection;
}
}
@@ -472,16 +540,18 @@ SwAccessibleParagraph::SwAccessibleParagraph(
, pHyperTextData( NULL )
, nOldCaretPos( -1 )
, bIsHeading( sal_False )
+ //Get the real heading level, Heading1 ~ Heading10
+ , nHeadingLevel (-1)
, aSelectionHelper( *this )
, mpParaChangeTrackInfo( new SwParaChangeTrackingInfo( rTxtFrm ) ) // #i108125#
+ , m_bLastHasSelection(false) //To add TEXT_SELECTION_CHANGED event
{
SolarMutexGuard aGuard;
bIsHeading = IsHeading();
+ //Get the real heading level, Heading1 ~ Heading10
+ nHeadingLevel = GetRealHeadingLevel();
SetName( OUString() ); // set an empty accessibility name for paragraphs
-
- // If this object has the focus, then it is remembered by the map itself.
- nOldCaretPos = GetCaretPos();
}
SwAccessibleParagraph::~SwAccessibleParagraph()
@@ -600,6 +670,75 @@ sal_Bool SwAccessibleParagraph::IsValidRange(
return IsValidPosition(nBegin, nLength) && IsValidPosition(nEnd, nLength);
}
+SwTOXSortTabBase* SwAccessibleParagraph::GetTOXSortTabBase()
+{
+ const SwTxtNode* pTxtNd = GetTxtNode();
+ if( pTxtNd )
+ {
+ const SwSectionNode * pSectNd = pTxtNd->FindSectionNode();
+ if( pSectNd )
+ {
+ const SwSection * pSect = &pSectNd->GetSection();
+ SwTOXBaseSection *pTOXBaseSect = (SwTOXBaseSection *)pSect;
+ if( pSect->GetType() == TOX_CONTENT_SECTION )
+ {
+ SwTOXSortTabBase* pSortBase = 0;
+ size_t nSize = pTOXBaseSect->GetTOXSortTabBases()->size();
+
+ for(size_t nIndex = 0; nIndex<nSize; nIndex++ )
+ {
+ pSortBase = (*(pTOXBaseSect->GetTOXSortTabBases()))[nIndex];
+ if( pSortBase->pTOXNd == pTxtNd )
+ break;
+ }
+
+ if (pSortBase)
+ {
+ return pSortBase;
+ }
+ }
+ }
+ }
+ return NULL;
+}
+
+short SwAccessibleParagraph::GetTOCLevel()
+{
+ SwTOXSortTabBase* pToxBase = GetTOXSortTabBase();
+ if( pToxBase )
+ {
+ const SwCntntNode* pNd = pToxBase->aTOXSources[0].pNd;
+ if( pNd )
+ return pToxBase->GetLevel();
+ else
+ return -1;
+ }
+ else
+ return -1;
+}
+
+//the function is to check whether the position is in a redline range.
+const SwRedline* SwAccessibleParagraph::GetRedlineAtIndex( sal_Int32 )
+{
+ const SwRedline* pRedline = NULL;
+ SwPaM* pCrSr = GetCursor( true );
+ if ( pCrSr )
+ {
+ SwPosition* pStart = pCrSr->Start();
+ const SwTxtNode* pNode = GetTxtNode();
+ if ( pNode )
+ {
+ const SwDoc* pDoc = pNode->GetDoc();
+ if ( pDoc )
+ {
+ pRedline = pDoc->GetRedline( *pStart, NULL );
+ }
+ }
+ }
+
+ return pRedline;
+}
+
// text boundaries
sal_Bool SwAccessibleParagraph::GetCharBoundary(
@@ -607,6 +746,9 @@ sal_Bool SwAccessibleParagraph::GetCharBoundary(
const OUString&,
sal_Int32 nPos )
{
+ if( GetPortionData().FillBoundaryIFDateField( rBound, nPos) )
+ return sal_True;
+
rBound.startPos = nPos;
rBound.endPos = nPos+1;
return sal_True;
@@ -633,6 +775,44 @@ sal_Bool SwAccessibleParagraph::GetWordBoundary(
// (DICTIONARY_WORD includes punctuation, ANY_WORD doesn't.)
const sal_uInt16 nWordType = i18n::WordType::ANY_WORD;
+/*
+ // get word boundary, as the Break-Iterator sees fit.
+ sal_Unicode SpaceChar(' ');
+ if (rText.getCodePointAt(nPos) == SpaceChar)
+ {
+ int nStartPos = nPos;
+ int nEndPos = nPos+1;
+ while (nStartPos >= 0 && rText.getCodePointAt(nStartPos) == SpaceChar)
+ --nStartPos;
+ while (nEndPos < rText.getLength() && rText.getCodePointAt(nEndPos) == SpaceChar)
+ ++nEndPos;
+ //Get the previous word boundary + the followed space characters
+ if (nStartPos >= 0)
+ {
+ rBound = pBreakIt->xBreak->getWordBoundary( rText, nStartPos, aLocale, nWordType, sal_True );
+ rBound.endPos += (nEndPos-nStartPos - 1);
+ }
+ //When the frontal characters are whitespace, return the all space characters directly.
+ else
+ {
+ rBound.startPos = 0;
+ rBound.endPos = nEndPos;
+ }
+ }
+ // add the " " into the word boundry
+ else
+ {
+ rBound = pBreakIt->xBreak->getWordBoundary(rText, nPos, aLocale, nWordType, sal_True );
+ sal_Int32 nEndPos = rBound.endPos, nLength = rText.getLength();
+ while ( nEndPos < nLength && rText.getCodePointAt(nEndPos) == SpaceChar )
+ nEndPos++;
+ rBound.endPos = nEndPos;
+ }
+ tabCharInWord( nPos, rBound);
+ if( GetPortionData().FillBoundaryIFDateField( rBound, rBound.startPos) )
+ return sal_True;
+ return sal_True; // MT: So why do we need the return TRUE above???
+*/
// get word boundary, as the Break-Iterator sees fit.
rBound = g_pBreakIt->GetBreakIter()->getWordBoundary(
rText, nPos, aLocale, nWordType, sal_True );
@@ -653,9 +833,16 @@ sal_Bool SwAccessibleParagraph::GetWordBoundary(
sal_Bool SwAccessibleParagraph::GetSentenceBoundary(
i18n::Boundary& rBound,
- const OUString&,
+ const OUString& rText,
sal_Int32 nPos )
{
+ const sal_Unicode* pStr = rText.getStr();
+ if (pStr)
+ {
+ while( pStr[nPos] == sal_Unicode(' ') && nPos < rText.getLength())
+ nPos++;
+ }
+
GetPortionData().GetSentenceBoundary( rBound, nPos );
return sal_True;
}
@@ -767,11 +954,76 @@ sal_Bool SwAccessibleParagraph::GetTextBoundary(
break;
case AccessibleTextType::LINE:
- bRet = GetLineBoundary( rBound, rText, nPos );
+ //Solve the problem of returning wrong LINE and PARAGRAPH
+ if((nPos == rText.getLength()) && nPos > 0)
+ bRet = GetLineBoundary( rBound, rText, nPos - 1);
+ else
+ bRet = GetLineBoundary( rBound, rText, nPos );
break;
case AccessibleTextType::ATTRIBUTE_RUN:
bRet = GetAttributeBoundary( rBound, rText, nPos );
+ if(bRet)
+ {
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL && pCrsrShell->GetViewOptions() && pCrsrShell->GetViewOptions()->IsOnlineSpell())
+ {
+ SwTxtNode* pTxtNode = const_cast<SwTxtNode*>( GetTxtNode() );
+ if(pTxtNode)
+ {
+ const SwWrongList* pWrongList = pTxtNode->GetWrong();
+ if( NULL != pWrongList )
+ {
+ sal_Int32 nBegin = nPos;
+ sal_Int32 nLen = 1;
+ const xub_StrLen nNext = pWrongList->NextWrong(nBegin);
+ xub_StrLen nLast;
+ xub_StrLen nWrongPos = pWrongList->GetWrongPos( nBegin );
+ if ( nWrongPos >= pWrongList->Count() ||
+ ( nLast = pWrongList->Pos( nWrongPos ) ) >= nBegin )
+ {
+ nLast = nWrongPos
+ ? pWrongList->Pos( --nWrongPos )
+ : STRING_LEN;
+ }
+ if ( nBegin > pWrongList->GetBeginInv() &&
+ ( nLast == STRING_LEN || nLast < pWrongList->GetEndInv() ) )
+ {
+ nLast = nBegin > pWrongList->GetEndInv()
+ ? pWrongList->GetEndInv()
+ : nBegin;
+ }
+ else if ( nLast < STRING_LEN )
+ {
+ nLast += pWrongList->Len( nWrongPos );
+ }
+ //
+ sal_Bool bIn = pWrongList->InWrongWord(nBegin,nLen); // && !pTxtNode->IsSymbol(nBegin) )
+ if(bIn)
+ {
+ rBound.startPos = max(nNext,(xub_StrLen)rBound.startPos);
+ rBound.endPos = min(xub_StrLen(nNext + nLen),(xub_StrLen)rBound.endPos);
+ }
+ else
+ {
+ if (STRING_LEN == nLast)//first
+ {
+ rBound.endPos = min(nNext,(xub_StrLen)rBound.endPos);
+ }
+ else if(STRING_LEN == nNext)
+ {
+ rBound.startPos = max(nLast,(xub_StrLen)rBound.startPos);
+ }
+ else
+ {
+ rBound.startPos = max(nLast,(xub_StrLen)rBound.startPos);
+ rBound.endPos = min(nNext,(xub_StrLen)rBound.endPos);
+ }
+ }
+ }
+ }
+ }
+ }
break;
case AccessibleTextType::GLYPH:
@@ -983,6 +1235,76 @@ uno::Sequence< OUString > SAL_CALL SwAccessibleParagraph::getSupportedServiceNam
return aRet;
}
+uno::Sequence< OUString > getAttributeNames()
+{
+ static uno::Sequence< OUString >* pNames = NULL;
+
+ if( pNames == NULL )
+ {
+ // Add the font name to attribute list
+ uno::Sequence< OUString >* pSeq = new uno::Sequence< OUString >( 13 );
+
+ OUString* pStrings = pSeq->getArray();
+
+ // sorted list of strings
+ sal_Int32 i = 0;
+
+#define STR(x) pStrings[i++] = OUString::createFromAscii(x)
+ STR( GetPropName( UNO_NAME_CHAR_BACK_COLOR ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_COLOR ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_CONTOURED ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_EMPHASIS ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_ESCAPEMENT ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_FONT_NAME ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_HEIGHT ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_POSTURE ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_SHADOWED ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_STRIKEOUT ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_UNDERLINE ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_UNDERLINE_COLOR ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_WEIGHT ).pName );
+#undef STR
+ DBG_ASSERT( i == pSeq->getLength(), "Please adjust length" );
+ if( i != pSeq->getLength() )
+ pSeq->realloc( i );
+ pNames = pSeq;
+ }
+ return *pNames;
+}
+
+uno::Sequence< OUString > getSupplementalAttributeNames()
+{
+ static uno::Sequence< OUString >* pNames = NULL;
+
+ if( pNames == NULL )
+ {
+ uno::Sequence< OUString >* pSeq = new uno::Sequence< OUString >( 9 );
+
+ OUString* pStrings = pSeq->getArray();
+
+ // sorted list of strings
+ sal_Int32 i = 0;
+
+#define STR(x) pStrings[i++] = OUString::createFromAscii(x)
+ STR( GetPropName( UNO_NAME_NUMBERING_LEVEL ).pName );
+ STR( GetPropName( UNO_NAME_NUMBERING_RULES ).pName );
+ STR( GetPropName( UNO_NAME_PARA_ADJUST ).pName );
+ STR( GetPropName( UNO_NAME_PARA_BOTTOM_MARGIN ).pName );
+ STR( GetPropName( UNO_NAME_PARA_FIRST_LINE_INDENT ).pName );
+ STR( GetPropName( UNO_NAME_PARA_LEFT_MARGIN ).pName );
+ STR( GetPropName( UNO_NAME_PARA_LINE_SPACING ).pName );
+ STR( GetPropName( UNO_NAME_PARA_RIGHT_MARGIN ).pName );
+ STR( GetPropName( UNO_NAME_TABSTOPS ).pName );
+#undef STR
+ DBG_ASSERT( i == pSeq->getLength(), "Please adjust length" );
+ if( i != pSeq->getLength() )
+ pSeq->realloc( i );
+ pNames = pSeq;
+ }
+ return *pNames;
+}
+
+
// XInterface
uno::Any SwAccessibleParagraph::queryInterface( const uno::Type& rType )
@@ -1029,6 +1351,16 @@ uno::Any SwAccessibleParagraph::queryInterface( const uno::Type& rType )
uno::Reference<XAccessibleMultiLineText> aAccMultiLineText = this;
aRet <<= aAccMultiLineText;
}
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleTextSelection> *)NULL) )
+ {
+ uno::Reference< com::sun::star::accessibility::XAccessibleTextSelection > aTextExtension = this;
+ aRet <<= aTextExtension;
+ }
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleExtendedAttributes> *)NULL) )
+ {
+ uno::Reference<XAccessibleExtendedAttributes> xAttr = this;
+ aRet <<= xAttr;
+ }
else
{
aRet = SwAccessibleContext::queryInterface(rType);
@@ -1145,6 +1477,261 @@ sal_Unicode SwAccessibleParagraph::getCharacter( sal_Int32 nIndex )
throw lang::IndexOutOfBoundsException();
}
+com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > SwAccessibleParagraph::GetCurrentTabStop( sal_Int32 nIndex )
+{
+ SolarMutexGuard aGuard;
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ /* #i12332# The position after the string needs special treatment.
+ IsValidChar -> IsValidPosition
+ */
+ if( ! (IsValidPosition( nIndex, GetString().getLength() ) ) )
+ throw lang::IndexOutOfBoundsException();
+
+ /* #i12332# */
+ sal_Bool bBehindText = sal_False;
+ if ( nIndex == GetString().getLength() )
+ bBehindText = sal_True;
+
+ // get model position & prepare GetCharRect() arguments
+ SwCrsrMoveState aMoveState;
+ aMoveState.bRealHeight = sal_True;
+ aMoveState.bRealWidth = sal_True;
+ SwSpecialPos aSpecialPos;
+ SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() );
+
+ sal_uInt16 nPos = 0;
+
+ /* #i12332# FillSpecialPos does not accept nIndex ==
+ GetString().getLength(). In that case nPos is set to the
+ length of the string in the core. This way GetCharRect
+ returns the rectangle for a cursor at the end of the
+ paragraph. */
+ if (bBehindText)
+ {
+ nPos = pNode->GetTxt().getLength();
+ }
+ else
+ nPos = GetPortionData().FillSpecialPos
+ (nIndex, aSpecialPos, aMoveState.pSpecialPos );
+
+ // call GetCharRect
+ SwRect aCoreRect;
+ SwIndex aIndex( pNode, nPos );
+ SwPosition aPosition( *pNode, aIndex );
+ GetFrm()->GetCharRect( aCoreRect, aPosition, &aMoveState );
+
+ // already get the caret postion
+ com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > tabs;
+ const sal_Int32 nStrLen = GetTxtNode()->GetTxt().getLength();
+ if( nStrLen > 0 )
+ {
+ SwFrm* pTFrm = const_cast<SwFrm*>(GetFrm());
+ tabs = pTFrm->GetTabStopInfo(aCoreRect.Left());
+ }
+
+ if( tabs.hasElements() )
+ {
+ // translate core coordinates into accessibility coordinates
+ Window *pWin = GetWindow();
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
+
+ SwRect aTmpRect(0, 0, tabs[0].Position, 0);
+
+ Rectangle aScreenRect( GetMap()->CoreToPixel( aTmpRect.SVRect() ));
+ SwRect aFrmLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
+
+ Point aFrmPixPos( GetMap()->CoreToPixel( aFrmLogBounds.SVRect() ).TopLeft() );
+ aScreenRect.Move( -aFrmPixPos.X(), -aFrmPixPos.Y() );
+
+ tabs[0].Position = aScreenRect.GetWidth();
+ }
+
+ return tabs;
+}
+
+struct IndexCompare
+{
+ const PropertyValue* pValues;
+ IndexCompare( const PropertyValue* pVals ) : pValues(pVals) {}
+ bool operator() ( const sal_Int32& a, const sal_Int32& b ) const
+ {
+ return (pValues[a].Name < pValues[b].Name) ? true : false;
+ }
+};
+
+OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
+{
+ OUString strTypeName;
+ SwFldMgr aMgr;
+ SwTxtFld* pTxtFld = NULL;
+ SwTxtNode* pTxtNd = const_cast<SwTxtNode*>( GetTxtNode() );
+ SwIndex fldIndex( pTxtNd, nIndex );
+ sal_Int32 nFldIndex = GetPortionData().GetFieldIndex(nIndex);
+ if (nFldIndex >= 0)
+ {
+ const SwpHints* pSwpHints = GetTxtNode()->GetpSwpHints();
+ if (pSwpHints)
+ {
+ const sal_uInt16 nSize = pSwpHints ? pSwpHints->Count() : 0;
+ for( sal_uInt16 i = 0; i < nSize; ++i )
+ {
+ const SwTxtAttr* pHt = (*pSwpHints)[i];
+ if (pHt->Which() == RES_TXTATR_FIELD && (nFldIndex-- == 0))
+ {
+ pTxtFld = (SwTxtFld *)pHt;
+ break;
+ }
+ else if (pHt->Which() == RES_TXTATR_REFMARK && (nFldIndex-- == 0))
+ strTypeName = "set reference";
+ }
+ }
+ }
+ if (pTxtFld)
+ {
+ const SwField* pField = (pTxtFld->GetFmtFld()).GetField();
+ if (pField)
+ {
+ strTypeName = pField->GetTyp()->GetTypeStr(pField->GetTypeId());
+ sal_uInt16 nWhich = pField->GetTyp()->Which();
+ rtl::OUString sEntry;
+ sal_Int32 subType = 0;
+ switch (nWhich)
+ {
+ case RES_DOCSTATFLD:
+ subType = ((SwDocStatField*)pField)->GetSubType();
+ break;
+ case RES_GETREFFLD:
+ {
+ sal_uInt16 nSub = pField->GetSubType();
+ switch( nSub )
+ {
+ case REF_BOOKMARK:
+ {
+ const SwGetRefField* pRefFld = dynamic_cast<const SwGetRefField*>(pField);
+ if ( pRefFld && pRefFld->IsRefToHeadingCrossRefBookmark() )
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Headings"));
+ else if ( pRefFld && pRefFld->IsRefToNumItemCrossRefBookmark() )
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Numbered Paragraphs"));
+ else
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Bookmarks"));
+ }
+ break;
+ case REF_FOOTNOTE:
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Footnotes"));
+ break;
+ case REF_ENDNOTE:
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Endnotes"));
+ break;
+ case REF_SETREFATTR:
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Insert Reference"));
+ break;
+ case REF_SEQUENCEFLD:
+ sEntry = ((SwGetRefField*)pField)->GetSetRefName();
+ break;
+ }
+ //Get format string
+ strTypeName = sEntry;
+ // <pField->GetFormat() >= 0> is always true as <pField->GetFormat()> is unsigned
+// if (pField->GetFormat() >= 0)
+ {
+ sEntry = aMgr.GetFormatStr( pField->GetTypeId(), pField->GetFormat() );
+ if (sEntry.getLength() > 0)
+ {
+ strTypeName += "-";
+ strTypeName += sEntry;
+ }
+ }
+ }
+ break;
+ case RES_DATETIMEFLD:
+ subType = ((SwDateTimeField*)pField)->GetSubType();
+ break;
+ case RES_JUMPEDITFLD:
+ {
+ sal_uInt16 nFormat= pField->GetFormat();
+ sal_uInt16 nSize = aMgr.GetFormatCount(pField->GetTypeId(), sal_False);
+ if (nFormat < nSize)
+ {
+ sEntry = aMgr.GetFormatStr(pField->GetTypeId(), nFormat);
+ if (sEntry.getLength() > 0)
+ {
+ strTypeName += "-";
+ strTypeName += sEntry;
+ }
+ }
+ }
+ break;
+ case RES_EXTUSERFLD:
+ subType = ((SwExtUserField*)pField)->GetSubType();
+ break;
+ case RES_HIDDENTXTFLD:
+ case RES_SETEXPFLD:
+ {
+ sEntry = pField->GetTyp()->GetName();
+ if (sEntry.getLength() > 0)
+ {
+ strTypeName += "-";
+ strTypeName += sEntry;
+ }
+ }
+ break;
+ case RES_DOCINFOFLD:
+ subType = pField->GetSubType();
+ subType &= 0x00ff;
+ break;
+ case RES_REFPAGESETFLD:
+ {
+ SwRefPageSetField* pRPld = (SwRefPageSetField*)pField;
+ sal_Bool bOn = pRPld->IsOn();
+ strTypeName += "-";
+ if (bOn)
+ strTypeName += "on";
+ else
+ strTypeName += "off";
+ }
+ break;
+ case RES_AUTHORFLD:
+ {
+ strTypeName += "-";
+ strTypeName += aMgr.GetFormatStr(pField->GetTypeId(), pField->GetFormat() & 0xff);
+ }
+ break;
+ }
+ if (subType > 0 || (subType == 0 && (nWhich == RES_DOCINFOFLD || nWhich == RES_EXTUSERFLD || nWhich == RES_DOCSTATFLD)))
+ {
+ std::vector<OUString> aLst;
+ aMgr.GetSubTypes(pField->GetTypeId(), aLst);
+ if (static_cast<size_t>(subType) < aLst.size())
+ sEntry = aLst[subType];
+ if (sEntry.getLength() > 0)
+ {
+ if (nWhich == RES_DOCINFOFLD)
+ {
+ strTypeName = sEntry;
+ sal_uInt32 nSize = aMgr.GetFormatCount(pField->GetTypeId(), sal_False);
+ sal_uInt16 nExSub = pField->GetSubType() & 0xff00;
+ if (nSize > 0 && nExSub > 0)
+ {
+ //Get extra subtype string
+ strTypeName += "-";
+ sEntry = aMgr.GetFormatStr(pField->GetTypeId(), nExSub/0x0100-1);
+ strTypeName += sEntry;
+ }
+ }
+ else
+ {
+ strTypeName += "-";
+ strTypeName += sEntry;
+ }
+ }
+ }
+ }
+ }
+ return strTypeName;
+}
+
// #i63870# - re-implement method on behalf of methods
// <_getDefaultAttributesImpl(..)> and <_getRunAttributesImpl(..)>
uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
@@ -1158,16 +1745,23 @@ uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
const OUString& rText = GetString();
- if( ! IsValidChar( nIndex, rText.getLength() ) )
+ if( ! IsValidChar( nIndex, rText.getLength()+1 ) )
throw lang::IndexOutOfBoundsException();
+ bool bSupplementalMode = false;
+ uno::Sequence< OUString > aNames = aRequestedAttributes;
+ if (aNames.getLength() == 0)
+ {
+ bSupplementalMode = true;
+ aNames = getAttributeNames();
+ }
// retrieve default character attributes
tAccParaPropValMap aDefAttrSeq;
- _getDefaultAttributesImpl( aRequestedAttributes, aDefAttrSeq, true );
+ _getDefaultAttributesImpl( aNames, aDefAttrSeq, true );
// retrieved run character attributes
tAccParaPropValMap aRunAttrSeq;
- _getRunAttributesImpl( nIndex, aRequestedAttributes, aRunAttrSeq );
+ _getRunAttributesImpl( nIndex, aNames, aRunAttrSeq );
// merge default and run attributes
uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
@@ -1189,6 +1783,70 @@ uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
}
++i;
}
+ if( bSupplementalMode )
+ {
+ uno::Sequence< OUString > aSupplementalNames = aRequestedAttributes;
+ if (aSupplementalNames.getLength() == 0)
+ aSupplementalNames = getSupplementalAttributeNames();
+
+ tAccParaPropValMap aSupplementalAttrSeq;
+ _getSupplementalAttributesImpl( nIndex, aSupplementalNames, aSupplementalAttrSeq );
+
+ aValues.realloc( aValues.getLength() + aSupplementalAttrSeq.size() );
+ pValues = aValues.getArray();
+
+ for ( tAccParaPropValMap::const_iterator aSupplementalIter = aSupplementalAttrSeq.begin();
+ aSupplementalIter != aSupplementalAttrSeq.end();
+ ++aSupplementalIter )
+ {
+ pValues[i] = aSupplementalIter->second;
+ ++i;
+ }
+
+ _correctValues( nIndex, aValues );
+
+ aValues.realloc( aValues.getLength() + 1 );
+
+ pValues = aValues.getArray();
+
+ const SwTxtNode* pTxtNode( GetTxtNode() );
+ PropertyValue& rValue = pValues[aValues.getLength() - 1 ];
+ rValue.Name = OUString("NumberingPrefix");
+ OUString sNumBullet = pTxtNode->GetNumString();
+ rValue.Value <<= sNumBullet;
+ rValue.Handle = -1;
+ rValue.State = PropertyState_DIRECT_VALUE;
+
+ OUString strTypeName = GetFieldTypeNameAtIndex(nIndex);
+ if (!strTypeName.isEmpty())
+ {
+ aValues.realloc( aValues.getLength() + 1 );
+ pValues = aValues.getArray();
+ rValue = pValues[aValues.getLength() - 1];
+ rValue.Name = OUString("FieldType");
+ rValue.Value <<= strTypeName.toAsciiLowerCase();
+ rValue.Handle = -1;
+ rValue.State = PropertyState_DIRECT_VALUE;
+ }
+
+ //sort property values
+ // build sorted index array
+ sal_Int32 nLength = aValues.getLength();
+ const PropertyValue* pPairs = aValues.getConstArray();
+ sal_Int32* pIndices = new sal_Int32[nLength];
+ for( i = 0; i < nLength; i++ )
+ pIndices[i] = i;
+ sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) );
+ // create sorted sequences accoring to index array
+ uno::Sequence<PropertyValue> aNewValues( nLength );
+ PropertyValue* pNewValues = aNewValues.getArray();
+ for( i = 0; i < nLength; i++ )
+ {
+ pNewValues[i] = pPairs[pIndices[i]];
+ }
+ delete[] pIndices;
+ return aNewValues;
+ }
return aValues;
}
@@ -1570,6 +2228,307 @@ uno::Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes(
return aValues;
}
+void SwAccessibleParagraph::_getSupplementalAttributesImpl(
+ const sal_Int32,
+ const uno::Sequence< OUString >& aRequestedAttributes,
+ tAccParaPropValMap& rSupplementalAttrSeq )
+{
+ const SwTxtNode* pTxtNode( GetTxtNode() );
+ ::boost::scoped_ptr<SfxItemSet> pSet;
+ pSet.reset( new SfxItemSet( const_cast<SwAttrPool&>(pTxtNode->GetDoc()->GetAttrPool()),
+ RES_PARATR_ADJUST, RES_PARATR_ADJUST,
+ RES_PARATR_TABSTOP, RES_PARATR_TABSTOP,
+ RES_PARATR_LINESPACING, RES_PARATR_LINESPACING,
+ RES_UL_SPACE, RES_UL_SPACE,
+ RES_LR_SPACE, RES_LR_SPACE,
+ RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+ 0 ) );
+
+ if ( pTxtNode->HasBullet() || pTxtNode->HasNumber() )
+ {
+ pSet->Put( pTxtNode->GetAttr(RES_PARATR_LIST_LEVEL, RES_PARATR_LIST_LEVEL) );
+ }
+ pSet->Put( pTxtNode->SwCntntNode::GetAttr(RES_UL_SPACE) );
+ pSet->Put( pTxtNode->SwCntntNode::GetAttr(RES_LR_SPACE) );
+ pSet->Put( pTxtNode->SwCntntNode::GetAttr(RES_PARATR_ADJUST) );
+
+ tAccParaPropValMap aSupplementalAttrSeq;
+ {
+// const SfxItemPropertySet& rPropSet =
+// aSwMapProvider.GetPropertyMap( PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE );
+// const SfxItemPropertyMap* pPropMap( rPropSet.getPropertyMap() );
+ const SfxItemPropertyMapEntry* pPropMap(
+ aSwMapProvider.GetPropertyMapEntries( PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE ) );
+ while ( pPropMap->pName )
+ {
+ const SfxPoolItem* pItem = pSet->GetItem( pPropMap->nWID );
+ if ( pItem )
+ {
+ uno::Any aVal;
+ pItem->QueryValue( aVal, pPropMap->nMemberId );
+
+ PropertyValue rPropVal;
+ rPropVal.Name = OUString::createFromAscii( pPropMap->pName );
+ rPropVal.Value = aVal;
+ rPropVal.Handle = -1;
+ rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
+
+ aSupplementalAttrSeq[rPropVal.Name] = rPropVal;
+ }
+
+ ++pPropMap;
+ }
+ }
+
+ const OUString* pSupplementalAttrs = aRequestedAttributes.getConstArray();
+ const sal_Int32 nSupplementalLength = aRequestedAttributes.getLength();
+
+ for( sal_Int32 index = 0; index < nSupplementalLength; ++index )
+ {
+ tAccParaPropValMap::const_iterator const aIter = aSupplementalAttrSeq.find( pSupplementalAttrs[index] );
+ if ( aIter != aSupplementalAttrSeq.end() )
+ {
+ rSupplementalAttrSeq[ aIter->first ] = aIter->second;
+ }
+ }
+}
+
+void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex,
+ uno::Sequence< PropertyValue >& rValues)
+{
+ PropertyValue ChangeAttr, ChangeAttrColor;
+
+ const SwRedline* pRedline = GetRedlineAtIndex( nIndex );
+ if ( pRedline )
+ {
+
+ const SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
+ AuthorCharAttr aChangeAttr;
+ if ( pOpt )
+ {
+ switch( pRedline->GetType())
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ aChangeAttr = pOpt->GetInsertAuthorAttr();
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ aChangeAttr = pOpt->GetDeletedAuthorAttr();
+ break;
+ case nsRedlineType_t::REDLINE_FORMAT:
+ aChangeAttr = pOpt->GetFormatAuthorAttr();
+ break;
+ }
+ }
+ switch( aChangeAttr.nItemId )
+ {
+ case SID_ATTR_CHAR_WEIGHT:
+ ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_WEIGHT).pName );
+ ChangeAttr.Value <<= awt::FontWeight::BOLD;
+ break;
+ case SID_ATTR_CHAR_POSTURE:
+ ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_POSTURE).pName );
+ ChangeAttr.Value <<= awt::FontSlant_ITALIC; //char posture
+ break;
+ case SID_ATTR_CHAR_STRIKEOUT:
+ ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_STRIKEOUT).pName );
+ ChangeAttr.Value <<= awt::FontStrikeout::SINGLE; //char strikeout
+ break;
+ case SID_ATTR_CHAR_UNDERLINE:
+ ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_UNDERLINE).pName );
+ ChangeAttr.Value <<= aChangeAttr.nAttr; //underline line
+ break;
+ }
+ if( aChangeAttr.nColor != COL_NONE )
+ {
+ if( aChangeAttr.nItemId == SID_ATTR_BRUSH )
+ {
+ ChangeAttrColor.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_BACK_COLOR).pName );
+ if( aChangeAttr.nColor == COL_TRANSPARENT )//char backcolor
+ ChangeAttrColor.Value <<= COL_BLUE;
+ else
+ ChangeAttrColor.Value <<= aChangeAttr.nColor;
+ }
+ else
+ {
+ ChangeAttrColor.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_COLOR ).pName );
+ if( aChangeAttr.nColor == COL_TRANSPARENT )//char color
+ ChangeAttrColor.Value <<= COL_BLUE;
+ else
+ ChangeAttrColor.Value <<= aChangeAttr.nColor;
+ }
+ }
+ }
+
+ PropertyValue* pValues = rValues.getArray();
+
+ const SwTxtNode* pTxtNode( GetTxtNode() );
+
+ sal_Int32 nValues = rValues.getLength();
+ for (sal_Int32 i = 0; i < nValues; ++i)
+ {
+ PropertyValue& rValue = pValues[i];
+
+ if (rValue.Name.compareTo( ChangeAttr.Name )==0)
+ {
+ rValue.Value = ChangeAttr.Value;
+ continue;
+ }
+
+ if (rValue.Name.compareTo( ChangeAttrColor.Name )==0)
+ {
+ rValue.Value = ChangeAttr.Value;
+ continue;
+ }
+
+ //back color
+ if (rValue.Name.compareTo(OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_BACK_COLOR ).pName ) )==0)
+ {
+ uno::Any &anyChar = rValue.Value;
+ sal_uInt32 crBack = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
+ if (COL_AUTO == crBack)
+ {
+ uno::Reference<XAccessibleComponent> xComponent(this);
+ if (xComponent.is())
+ {
+ crBack = (sal_uInt32)xComponent->getBackground();
+ }
+ rValue.Value <<= crBack;
+ }
+ continue;
+ }
+
+ //char color
+ if (rValue.Name.compareTo(OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_COLOR ).pName ) )==0)
+ {
+ if( GetPortionData().IsInGrayPortion( nIndex ) )
+ rValue.Value <<= SwViewOption::GetFieldShadingsColor().GetColor();
+ uno::Any &anyChar = rValue.Value;
+ sal_uInt32 crChar = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
+
+ if( COL_AUTO == crChar )
+ {
+ uno::Reference<XAccessibleComponent> xComponent(this);
+ if (xComponent.is())
+ {
+ Color cr(xComponent->getBackground());
+ crChar = cr.IsDark() ? COL_WHITE : COL_BLACK;
+ rValue.Value <<= crChar;
+ }
+ }
+ continue;
+ }
+
+ // UnderLine
+ if (rValue.Name.compareTo(OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_UNDERLINE ).pName ) )==0)
+ {
+ //misspelled word
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL && pCrsrShell->GetViewOptions() && pCrsrShell->GetViewOptions()->IsOnlineSpell())
+ {
+ const SwWrongList* pWrongList = pTxtNode->GetWrong();
+ if( NULL != pWrongList )
+ {
+ sal_Int32 nBegin = nIndex;
+ sal_Int32 nLen = 1;
+ if( pWrongList->InWrongWord(nBegin,nLen) && !pTxtNode->IsSymbol(nBegin) )
+ {
+ rValue.Value <<= (sal_uInt16)UNDERLINE_WAVE;
+ }
+ }
+ }
+ continue;
+ }
+
+ // UnderLineColor
+ if (rValue.Name.compareTo(OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_UNDERLINE_COLOR ).pName ) )==0)
+ {
+ //misspelled word
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL && pCrsrShell->GetViewOptions() && pCrsrShell->GetViewOptions()->IsOnlineSpell())
+ {
+ const SwWrongList* pWrongList = pTxtNode->GetWrong();
+ if( NULL != pWrongList )
+ {
+ sal_Int32 nBegin = nIndex;
+ sal_Int32 nLen = 1;
+ if( pWrongList->InWrongWord(nBegin,nLen) && !pTxtNode->IsSymbol(nBegin) )
+ {
+ rValue.Value <<= (sal_Int32)0x00ff0000;
+ continue;
+ }
+ }
+ }
+
+ uno::Any &anyChar = rValue.Value;
+ sal_uInt32 crUnderline = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
+ if ( COL_AUTO == crUnderline )
+ {
+ uno::Reference<XAccessibleComponent> xComponent(this);
+ if (xComponent.is())
+ {
+ Color cr(xComponent->getBackground());
+ crUnderline = cr.IsDark() ? COL_WHITE : COL_BLACK;
+ rValue.Value <<= crUnderline;
+ }
+ }
+
+ continue;
+ }
+
+ //tab stop
+ if (rValue.Name.compareTo(OUString::createFromAscii( GetPropName( UNO_NAME_TABSTOPS ).pName ) )==0)
+ {
+ com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > tabs = GetCurrentTabStop( nIndex );
+ if( !tabs.hasElements() )
+ {
+ tabs.realloc(1);
+ ::com::sun::star::style::TabStop ts;
+ com::sun::star::awt::Rectangle rc0 = getCharacterBounds(0);
+ com::sun::star::awt::Rectangle rc1 = getCharacterBounds(nIndex);
+ if( rc1.X - rc0.X >= 48 )
+ ts.Position = (rc1.X - rc0.X) - (rc1.X - rc0.X - 48)% 47 + 47;
+ else
+ ts.Position = 48;
+ ts.DecimalChar = ' ';
+ ts.FillChar = ' ';
+ ts.Alignment = ::com::sun::star::style::TabAlign_LEFT;
+ tabs[0] = ts;
+ }
+ rValue.Value <<= tabs;
+ continue;
+ }
+
+ //number bullet
+ if (rValue.Name.compareTo(OUString::createFromAscii( GetPropName( UNO_NAME_NUMBERING_RULES ).pName ) )==0)
+ {
+ if ( pTxtNode->HasBullet() || pTxtNode->HasNumber() )
+ {
+ uno::Any aVal;
+ SwNumRule* pNumRule = pTxtNode->GetNumRule();
+ if (pNumRule)
+ {
+ uno::Reference< container::XIndexReplace > xNum = new SwXNumberingRules(*pNumRule);
+ aVal.setValue(&xNum, ::getCppuType((const uno::Reference< container::XIndexReplace >*)0));
+ }
+ rValue.Value <<= aVal;
+ }
+ continue;
+ }
+
+ //footnote & endnote
+ if (rValue.Name.compareTo(OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_ESCAPEMENT ).pName ) )==0)
+ {
+ if ( GetPortionData().IsIndexInFootnode(nIndex) )
+ {
+ const OUString sEscapmentName = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_ESCAPEMENT ).pName );
+ rValue.Value <<= (sal_Int32)101;
+ }
+ continue;
+ }
+ }
+}
+
awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
sal_Int32 nIndex )
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
@@ -1578,7 +2537,6 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
-
// #i12332# The position after the string needs special treatment.
// IsValidChar -> IsValidPosition
if( ! (IsValidPosition( nIndex, GetString().getLength() ) ) )
@@ -1870,6 +2828,10 @@ OUString SwAccessibleParagraph::getTextRange(
/*accessibility::*/TextSegment aResult;
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
+ //If nIndex = 0, then nobefore text so return -1 directly.
+ if( nIndex == 0 )
+ return aResult;
+ //Tab will be return when call WORDTYPE
// get starting pos
i18n::Boundary aBound;
@@ -1884,22 +2846,45 @@ OUString SwAccessibleParagraph::getTextRange(
}
// now skip to previous word
- sal_Bool bWord = sal_False;
- while( !bWord )
+ if (nTextType==2 || nTextType == 3)
{
- nIndex = min( nIndex, aBound.startPos ) - 1;
- if( nIndex >= 0 )
- bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
- else
- break; // exit if beginning of string is reached
+ i18n::Boundary preBound = aBound;
+ while(preBound.startPos==aBound.startPos && nIndex > 0)
+ {
+ nIndex = min( nIndex, preBound.startPos ) - 1;
+ if( nIndex < 0 ) break;
+ GetTextBoundary( preBound, rText, nIndex, nTextType );
+ }
+ //if (nIndex>0)
+ if (nIndex>=0)
+ //Tab will be return when call WORDTYPE
+ {
+ aResult.SegmentText = rText.copy( preBound.startPos, preBound.endPos - preBound.startPos );
+ aResult.SegmentStart = preBound.startPos;
+ aResult.SegmentEnd = preBound.endPos;
+ }
}
-
- if ( bWord )
+ else
{
- aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
- aResult.SegmentStart = aBound.startPos;
- aResult.SegmentEnd = aBound.endPos;
- };
+ sal_Bool bWord = sal_False;
+ while( !bWord )
+ {
+ nIndex = min( nIndex, aBound.startPos ) - 1;
+ if( nIndex >= 0 )
+ {
+ bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+ }
+ else
+ break; // exit if beginning of string is reached
+ }
+
+ if (bWord && nIndex<rText.getLength())
+ {
+ aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
+ aResult.SegmentStart = aBound.startPos;
+ aResult.SegmentEnd = aBound.endPos;
+ }
+ }
return aResult;
}
@@ -1940,6 +2925,64 @@ OUString SwAccessibleParagraph::getTextRange(
aResult.SegmentStart = aBound.startPos;
aResult.SegmentEnd = aBound.endPos;
}
+
+/*
+ sal_Bool bWord = sal_False;
+ bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+
+ if (nTextType==2)
+ {
+ Boundary nexBound=aBound;
+
+ // real current word
+ if( nIndex <= aBound.endPos && nIndex >= aBound.startPos )
+ {
+ while(nexBound.endPos==aBound.endPos&&nIndex<rText.getLength())
+ {
+ // nIndex = max( (sal_Int32)(nIndex), nexBound.endPos) + 1;
+ nIndex = max( (sal_Int32)(nIndex), nexBound.endPos) ;
+ const sal_Unicode* pStr = rText.getStr();
+ if (pStr)
+ {
+ if( pStr[nIndex] == sal_Unicode(' ') )
+ nIndex++;
+ }
+ if( nIndex < rText.getLength() )
+ {
+ bWord = GetTextBoundary( nexBound, rText, nIndex, nTextType );
+ }
+ }
+ }
+
+ if (bWord && nIndex<rText.getLength())
+ {
+ aResult.SegmentText = rText.copy( nexBound.startPos, nexBound.endPos - nexBound.startPos );
+ aResult.SegmentStart = nexBound.startPos;
+ aResult.SegmentEnd = nexBound.endPos;
+ }
+
+ }
+ else
+ {
+ bWord = sal_False;
+ while( !bWord )
+ {
+ nIndex = max( (sal_Int32)(nIndex+1), aBound.endPos );
+ if( nIndex < rText.getLength() )
+ {
+ bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+ }
+ else
+ break; // exit if end of string is reached
+ }
+ if (bWord && nIndex<rText.getLength())
+ {
+ aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
+ aResult.SegmentStart = aBound.startPos;
+ aResult.SegmentEnd = aBound.endPos;
+ }
+ }
+*/
return aResult;
}
@@ -2050,16 +3093,6 @@ sal_Bool SwAccessibleParagraph::replaceText(
throw lang::IndexOutOfBoundsException();
}
-struct IndexCompare
-{
- const PropertyValue* pValues;
- IndexCompare( const PropertyValue* pVals ) : pValues(pVals) {}
- bool operator() ( const sal_Int32& a, const sal_Int32& b ) const
- {
- return (pValues[a].Name < pValues[b].Name) ? true : false;
- }
-};
-
sal_Bool SwAccessibleParagraph::setAttributes(
sal_Int32 nStartIndex,
sal_Int32 nEndIndex,
@@ -2260,6 +3293,14 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkCount()
while( aIter.next() )
nCount++;
+ /* Can't fin the function "GetTOCFirstWordEndIndex" declaration in sym2.0 (Added by yanjun)
+ if( GetTOXSortTabBase() )
+ {
+ SwTxtNode* pNode = const_cast<SwTxtNode*>(GetTxtNode());
+ if(pNode && pNode->GetTOCFirstWordEndIndex() > 0)
+ nCount++;
+ }
+ */
return nCount;
}
@@ -2272,7 +3313,150 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
uno::Reference< XAccessibleHyperlink > xRet;
- // #i77108#
+ const SwTxtFrm *pTxtFrm = static_cast<const SwTxtFrm*>( GetFrm() );
+ SwHyperlinkIter_Impl aHIter( pTxtFrm );
+ //SwAccessibleAutoRecognizerHelper_Impl aARHelper( pTxtFrm );
+ sal_Int32 nARCount = 0;
+ sal_Int32 nARIndex = 0;
+ sal_Int32 nTIndex = -1;
+ SwTOXSortTabBase* pTBase = GetTOXSortTabBase();
+ SwTxtAttr* pHt = (SwTxtAttr*)(aHIter.next());
+ while( (nLinkIndex < getHyperLinkCount()) && nTIndex < nLinkIndex)
+ {
+ sal_Int32 nHStt = -1;
+ sal_Int32 nAStt = -1;
+ sal_Bool bH = sal_False;
+ sal_Bool bA = sal_False;
+
+
+ if( pHt )
+ nHStt = *pHt->GetStart();
+ if( nARIndex < nARCount )
+ {
+ /*
+ sal_Int32 nAEnd;
+ aARHelper.getPosition( nARIndex, nAStt, nAEnd );
+ */
+ }
+ sal_Bool bTOC = sal_False;
+ // Inside TOC & get the first link
+ if( pTBase && nTIndex == -1 )
+ {
+ nTIndex++;
+ bTOC = sal_True;
+ }
+ else
+ {
+ if( nHStt >=0 && nAStt >=0 )
+ { // both hyperlink and smart tag available
+ nTIndex++;
+ if( nHStt <= nAStt )
+ bH = sal_True;
+ else
+ bA = sal_True;
+ }
+ else if( nHStt >= 0 )
+ { // only hyperlink available
+ nTIndex++;
+ bH = sal_True;
+ }
+ else if( nAStt >= 0 )
+ { // only smart tag available
+ nTIndex++;
+ bA = sal_True;
+ }
+ }
+
+ if( nTIndex == nLinkIndex )
+ { // found
+ if( bH )
+ { // it's a hyperlink
+ if( pHt )
+ {
+// const SwField* pFFld = pHt->GetFld().GetFld();
+ {
+ if( !pHyperTextData )
+ pHyperTextData = new SwAccessibleHyperTextData;
+ SwAccessibleHyperTextData::iterator aIter =
+ pHyperTextData ->find( pHt );
+ if( aIter != pHyperTextData->end() )
+ {
+ xRet = (*aIter).second;
+ }
+ if( !xRet.is() )
+ {
+ {
+ const sal_Int32 nTmpHStt= GetPortionData().GetAccessiblePosition(
+ max( aHIter.startIdx(), *pHt->GetStart() ) );
+ const sal_Int32 nTmpHEnd= GetPortionData().GetAccessiblePosition(
+ min( aHIter.endIdx(), *pHt->GetAnyEnd() ) );
+ xRet = new SwAccessibleHyperlink( aHIter.getCurrHintPos(),
+ this, nTmpHStt, nTmpHEnd );
+ }
+ if( aIter != pHyperTextData->end() )
+ {
+ (*aIter).second = xRet;
+ }
+ else
+ {
+ SwAccessibleHyperTextData::value_type aEntry( pHt, xRet );
+ pHyperTextData->insert( aEntry );
+ }
+ }
+ }
+ }
+ }
+ else if( bTOC )
+ {
+ //xRet = new SwAccessibleTOCLink( this );
+ }
+ else if( bA )
+ {
+ /*
+ // it's a smart tag
+ if( !pAutoRecognizerData )
+ pAutoRecognizerData = new SwAccessibleAutoRecognizerData;
+ SwAccessibleAutoRecognizerData::iterator aIter =
+ pAutoRecognizerData ->find( nARIndex );
+ if( aIter != pAutoRecognizerData->end() )
+ {
+ xRet = (*aIter).second;
+ }
+ if( !xRet.is() )
+ {
+ sal_Int32 nAStt = 0;
+ sal_Int32 nAEnd = 0;
+ //aARHelper.getPosition( nARIndex, nAStt, nAEnd );
+ xRet = new SwAccessibleAutoRecognizer( this, nAStt, nAEnd );
+ if( aIter != pAutoRecognizerData->end() )
+ {
+ (*aIter).second = xRet;
+ }
+ else
+ {
+ SwAccessibleAutoRecognizerData::value_type aEntry( nARIndex, xRet );
+ pAutoRecognizerData->insert( aEntry );
+ }
+ }
+ */
+ }
+ break;
+ }
+
+ // iterate next
+ if( bH )
+ // iterate next hyperlink
+ pHt = (SwTxtAttr*)(aHIter.next());
+ else if( bA )
+ // iterate next smart tag
+ nARIndex++;
+ else if(bTOC)
+ continue;
+ else
+ // no candidate, exit
+ break;
+ }
+ /*
{
const SwTxtFrm *pTxtFrm = static_cast<const SwTxtFrm*>( GetFrm() );
SwHyperlinkIter_Impl aHIter( pTxtFrm );
@@ -2310,7 +3494,7 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
}
}
}
-
+ */
if( !xRet.is() )
throw lang::IndexOutOfBoundsException();
@@ -2347,10 +3531,13 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharInde
if( pHt )
nRet = nPos;
-
}
- return nRet;
+ if (nRet == -1)
+ throw lang::IndexOutOfBoundsException();
+ else
+ return nRet;
+ //return nRet;
}
// #i71360#, #i108125# - adjustments for change tracking text markup
@@ -2381,6 +3568,198 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getTextMarkupCount( sal_Int32 nTextMar
return pTextMarkupHelper->getTextMarkupCount( nTextMarkupType );
}
+//MSAA Extension Implementation in app module
+sal_Bool SAL_CALL SwAccessibleParagraph::scrollToPosition( const ::com::sun::star::awt::Point&, sal_Bool )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ return sal_False;
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getSelectedPortionCount( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 nSeleted = 0;
+ SwPaM* pCrsr = GetCursor( true );
+ if( pCrsr != NULL )
+ {
+ // get SwPosition for my node
+ const SwTxtNode* pNode = 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 ) )
+ {
+ nSeleted++;
+ }
+ // 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 nSeleted;
+
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getSeletedPositionStart( sal_Int32 nSelectedPortionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ sal_Int32 nStart, nEnd;
+ /*sal_Bool bSelected = */GetSelectionAtIndex(nSelectedPortionIndex, nStart, nEnd );
+ return nStart;
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getSeletedPositionEnd( sal_Int32 nSelectedPortionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ sal_Int32 nStart, nEnd;
+ /*sal_Bool bSelected = */GetSelectionAtIndex(nSelectedPortionIndex, nStart, nEnd );
+ return nEnd;
+}
+
+sal_Bool SAL_CALL SwAccessibleParagraph::removeSelection( sal_Int32 selectionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ if(selectionIndex < 0) return sal_False;
+
+ sal_Bool bRet = sal_False;
+ sal_Int32 nSelected = selectionIndex;
+
+ // get the selection, and test whether it affects our text node
+ SwPaM* pCrsr = GetCursor( true );
+
+ if( pCrsr != NULL )
+ {
+ // get SwPosition for my node
+ const SwTxtNode* pNode = 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( nSelected == 0 )
+ {
+ pCrsr->MoveTo((Ring*)0);
+ delete pCrsr;
+ bRet = sal_True;
+ }
+ else
+ {
+ nSelected--;
+ }
+ }
+ }
+ // else: this PaM is collapsed and doesn't select anything
+ pCrsr = static_cast<SwPaM*>( pCrsr->GetNext() );
+ }
+ while( !bRet && (pCrsr != pRingStart) );
+ }
+ return sal_True;
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::addSelection( sal_Int32, sal_Int32 startOffset, sal_Int32 endOffset)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ // parameter checking
+ sal_Int32 nLength = GetString().getLength();
+ if ( ! IsValidRange( startOffset, endOffset, nLength ) )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ sal_Int32 nSelectedCount = getSelectedPortionCount();
+ for ( sal_Int32 i = nSelectedCount ; i >= 0 ; i--)
+ {
+ sal_Int32 nStart, nEnd;
+ sal_Bool bSelected = GetSelectionAtIndex(i, nStart, nEnd );
+ if(bSelected)
+ {
+ if(nStart <= nEnd )
+ {
+ if (( startOffset>=nStart && startOffset <=nEnd ) || //startOffset in a selection
+ ( endOffset>=nStart && endOffset <=nEnd ) || //endOffset in a selection
+ ( startOffset <= nStart && endOffset >=nEnd) || //start and end include the old selection
+ ( startOffset >= nStart && endOffset <=nEnd) )
+ {
+ removeSelection(i);
+ }
+
+ }
+ else
+ {
+ if (( startOffset>=nEnd && startOffset <=nStart ) || //startOffset in a selection
+ ( endOffset>=nEnd && endOffset <=nStart ) || //endOffset in a selection
+ ( startOffset <= nStart && endOffset >=nEnd) || //start and end include the old selection
+ ( startOffset >= nStart && endOffset <=nEnd) )
+
+ {
+ removeSelection(i);
+ }
+ }
+ }
+
+ }
+
+ sal_Bool bRet = sal_False;
+
+ // get cursor shell
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL )
+ {
+ // create pam for selection
+ pCrsrShell->StartAction();
+ SwPaM* aPaM = pCrsrShell->CreateCrsr();
+ aPaM->SetMark();
+ aPaM->GetPoint()->nContent = GetPortionData().GetModelPosition(startOffset);
+ aPaM->GetMark()->nContent = GetPortionData().GetModelPosition(endOffset);
+ //pCrsrShell->ShowCrsr();
+ pCrsrShell->EndAction();
+ // set PaM at cursor shell
+ //bRet = Select( aPaM );
+ }
+
+ return bRet;
+}
+
/*accessibility::*/TextSegment SAL_CALL
SwAccessibleParagraph::getTextMarkup( sal_Int32 nTextMarkupIndex,
sal_Int32 nTextMarkupType )
@@ -2564,4 +3943,266 @@ void SwAccessibleParagraph::Modify( const SfxPoolItem* pOld, const SfxPoolItem*
CheckRegistration( pOld, pNew );
}
+sal_Bool SwAccessibleParagraph::GetSelectionAtIndex(
+ sal_Int32& nIndex, sal_Int32& nStart, sal_Int32& nEnd)
+{
+ if(nIndex < 0) return sal_False;
+
+
+ sal_Bool bRet = sal_False;
+ nStart = -1;
+ nEnd = -1;
+ sal_Int32 nSelected = nIndex;
+
+ // get the selection, and test whether it affects our text node
+ SwPaM* pCrsr = GetCursor( true );
+ if( pCrsr != NULL )
+ {
+ // get SwPosition for my node
+ const SwTxtNode* pNode = 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( nSelected == 0 )
+ {
+ // translate start and end positions
+
+ // start position
+ sal_Int32 nLocalStart = -1;
+ if( nHere > nStartIndex )
+ {
+ // selection starts in previous node:
+ // then our local selection starts with the paragraph
+ nLocalStart = 0;
+ }
+ else
+ {
+ DBG_ASSERT( nHere == nStartIndex,
+ "miscalculated index" );
+
+ // selection starts in this node:
+ // then check whether it's before or inside our part of
+ // the paragraph, and if so, get the proper position
+ sal_uInt16 nCoreStart = pStart->nContent.GetIndex();
+ if( nCoreStart <
+ GetPortionData().GetFirstValidCorePosition() )
+ {
+ nLocalStart = 0;
+ }
+ else if( nCoreStart <=
+ GetPortionData().GetLastValidCorePosition() )
+ {
+ DBG_ASSERT(
+ GetPortionData().IsValidCorePosition(
+ nCoreStart ),
+ "problem determining valid core position" );
+
+ nLocalStart =
+ GetPortionData().GetAccessiblePosition(
+ nCoreStart );
+ }
+ }
+
+ // end position
+ sal_Int32 nLocalEnd = -1;
+ if( nHere < nEndIndex )
+ {
+ // selection ends in following node:
+ // then our local selection extends to the end
+ nLocalEnd = GetPortionData().GetAccessibleString().
+ getLength();
+ }
+ else
+ {
+ DBG_ASSERT( nHere == nStartIndex,
+ "miscalculated index" );
+
+ // selection ends in this node: then select everything
+ // before our part of the node
+ sal_uInt16 nCoreEnd = pEnd->nContent.GetIndex();
+ if( nCoreEnd >
+ GetPortionData().GetLastValidCorePosition() )
+ {
+ // selection extends beyond out part of this para
+ nLocalEnd = GetPortionData().GetAccessibleString().
+ getLength();
+ }
+ else if( nCoreEnd >=
+ GetPortionData().GetFirstValidCorePosition() )
+ {
+ // selection is inside our part of this para
+ DBG_ASSERT(
+ GetPortionData().IsValidCorePosition(
+ nCoreEnd ),
+ "problem determining valid core position" );
+
+ nLocalEnd = GetPortionData().GetAccessiblePosition(
+ nCoreEnd );
+ }
+ }
+
+ if( ( nLocalStart != -1 ) && ( nLocalEnd != -1 ) )
+ {
+ nStart = nLocalStart;
+ nEnd = nLocalEnd;
+ bRet = sal_True;
+ }
+ } // if hit the index
+ else
+ {
+ nSelected--;
+ }
+ }
+ // 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( !bRet && (pCrsr != pRingStart) );
+ }
+ // else: nocursor -> no selection
+
+ if( bRet )
+ {
+ sal_Int32 nCaretPos = GetCaretPos();
+ if( nStart == nCaretPos )
+ {
+ sal_Int32 tmp = nStart;
+ nStart = nEnd;
+ nEnd = tmp;
+ }
+ }
+ return bRet;
+}
+
+sal_Int16 SAL_CALL SwAccessibleParagraph::getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException)
+{
+ //Get the real heading level, Heading1 ~ Heading10
+ if (nHeadingLevel > 0)
+ {
+ return AccessibleRole::HEADING;
+ }
+ else
+ {
+ return AccessibleRole::PARAGRAPH;
+ }
+}
+
+// End Add
+
+
+/* This funcion is already defined in accpara.cxx(Added by yanjun)
+sal_Int32 SAL_CALL SwAccessibleParagraph::getBackground()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+// Test Code
+// Sequence<OUString> seNames(1);
+// OUString* pStrings = seNames.getArray();
+// pStrings[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackColor"));
+//
+// Sequence<Any> aAnys(1);
+// Reference<XMultiPropertySet> xPortion = CreateUnoPortion( 0, 0 );
+// aAnys = xPortion->getPropertyValues( seNames );
+// const Any* pAnys = aAnys.getConstArray();
+//
+// sal_uInt32 crColorT=0;
+// pAnys[0] >>= crColorT;
+// End Test Code
+
+ const SvxBrushItem &rBack = GetFrm()->GetAttrSet()->GetBackground();
+ sal_uInt32 crBack = rBack.GetColor().GetColor();
+
+ if (COL_AUTO == crBack)
+ {
+ Reference<XAccessible> xAccDoc = getAccessibleParent();
+ if (xAccDoc.is())
+ {
+ Reference<XAccessibleComponent> xCompoentDoc(xAccDoc,UNO_QUERY);
+ if (xCompoentDoc.is())
+ {
+ crBack = (sal_uInt32)xCompoentDoc->getBackground();
+ }
+ }
+ }
+ return crBack;
+}
+*/
+
+//Get the real heading level, Heading1 ~ Heading10
+sal_Int32 SwAccessibleParagraph::GetRealHeadingLevel()
+{
+ uno::Reference< ::com::sun::star::beans::XPropertySet > xPortion = CreateUnoPortion( 0, 0 );
+ OUString pString = "ParaStyleName";
+ uno::Any styleAny = xPortion->getPropertyValue( pString );
+ OUString sValue;
+ if (styleAny >>= sValue)
+ {
+ //Modified by yanjun for acc migration
+ sal_Int32 length = sValue.getLength/*GetCharCount*/();
+ if (length == 9 || length == 10)
+ {
+ OUString headStr = sValue.copy(0, 7);
+ if (headStr.equals("Heading"))
+ {
+ OUString intStr = sValue.copy(8);
+ sal_Int32 headingLevel = intStr.toInt32(10);
+ return headingLevel;
+ }
+ }
+ }
+ return -1;
+}
+
+uno::Any SAL_CALL SwAccessibleParagraph::getExtendedAttributes()
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ uno::Any Ret;
+ OUString strHeading("heading-level:");
+ if( nHeadingLevel >= 0 )
+ strHeading += OUString::number(nHeadingLevel, 10);
+ strHeading += ";";
+
+ Ret <<= strHeading;
+
+ return Ret;
+}
+
+//Tab will be return when call WORDTYPE
+sal_Bool SwAccessibleParagraph::tabCharInWord( sal_Int32 nIndex, i18n::Boundary& aBound)
+{
+ sal_Bool bFind = sal_False;
+ if( aBound.startPos != nIndex)
+ {
+ OUString tabStr;
+ if(aBound.startPos>nIndex)
+ tabStr = GetString().copy(nIndex,(aBound.startPos - nIndex) );
+
+ sal_Unicode tabChar('\t');
+ sal_Int32 tabIndex = tabStr.indexOf(tabChar);
+ if( tabIndex > -1 )
+ {
+ aBound.startPos = nIndex + tabIndex ;
+ aBound.endPos = aBound.startPos + 1;
+ bFind = sal_True;
+ }
+ }
+ return bFind;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/accpara.hxx b/sw/source/core/access/accpara.hxx
index 55d2e77d7b2a..ddf0f5c07b90 100644
--- a/sw/source/core/access/accpara.hxx
+++ b/sw/source/core/access/accpara.hxx
@@ -25,22 +25,28 @@
#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
#include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp>
#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextSelection.hpp>
+#include <txmsrt.hxx>
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
#include <boost/unordered_map.hpp>
#include <accselectionhelper.hxx>
#include <calbck.hxx>
+class SwField;
class SwTxtFrm;
class SwTxtNode;
class SwPaM;
class SwAccessiblePortionData;
class SwAccessibleHyperTextData;
+class SwRedline;
class SwXTextPortion;
class SwParaChangeTrackingInfo; //#i108125#
namespace com { namespace sun { namespace star {
namespace i18n { struct Boundary; }
namespace accessibility { class XAccessibleHyperlink; }
+ namespace style { class TabStop; }
} } }
typedef ::boost::unordered_map< OUString,
@@ -56,7 +62,9 @@ class SwAccessibleParagraph :
public com::sun::star::accessibility::XAccessibleHypertext,
public com::sun::star::accessibility::XAccessibleTextMarkup,
public com::sun::star::accessibility::XAccessibleMultiLineText,
- public ::com::sun::star::accessibility::XAccessibleTextAttributes
+ public ::com::sun::star::accessibility::XAccessibleTextAttributes,
+ public com::sun::star::accessibility::XAccessibleTextSelection,
+ public com::sun::star::accessibility::XAccessibleExtendedAttributes
{
friend class SwAccessibleHyperlink;
@@ -75,6 +83,7 @@ class SwAccessibleParagraph :
// mutex)
sal_Bool bIsHeading; // protected by base classes mutex
+ sal_Int32 nHeadingLevel;
// implementation for XAccessibleSelection
SwAccessibleSelectionHelper aSelectionHelper;
@@ -122,7 +131,7 @@ class SwAccessibleParagraph :
sal_Bool IsValidRange(sal_Int32 nBegin, sal_Int32 nEnd, sal_Int32 nLength);
// Ensure ordered range (i.e. nBegin is smaller then nEnd)
- inline void OrderRange(sal_Int32& nBegin, sal_Int32& nEnd)
+ void OrderRange(sal_Int32& nBegin, sal_Int32& nEnd)
{
if( nBegin > nEnd )
{
@@ -130,6 +139,9 @@ class SwAccessibleParagraph :
}
}
+ const SwRedline* GetRedlineAtIndex( sal_Int32 nPos );
+ OUString GetFieldTypeNameAtIndex(sal_Int32 nIndex);
+
// #i63870#
void _getDefaultAttributesImpl(
const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes,
@@ -140,7 +152,18 @@ class SwAccessibleParagraph :
const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes,
tAccParaPropValMap& rRunAttrSeq );
+ void _getSupplementalAttributesImpl(
+ const sal_Int32 nIndex,
+ const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes,
+ tAccParaPropValMap& rSupplementalAttrSeq );
+
+ void _correctValues(
+ const sal_Int32 nIndex,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues );
+
public:
+ SwTOXSortTabBase* GetTOXSortTabBase();
+ short GetTOCLevel();
sal_Bool IsHeading() const;
@@ -225,6 +248,9 @@ public:
virtual sal_Bool HasCursor(); // required by map to remember that object
+ com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > GetCurrentTabStop( sal_Int32 nIndex );
+ virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
+
// XAccessibleContext
// Return this object's description.
@@ -380,6 +406,28 @@ public:
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
+ // XAccessibleTextSelection
+ virtual sal_Bool SAL_CALL scrollToPosition( const ::com::sun::star::awt::Point& aPoint, sal_Bool isLeftTop )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedPortionCount( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSeletedPositionStart( sal_Int32 nSelectedPortionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSeletedPositionEnd( sal_Int32 nSelectedPortionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL removeSelection( sal_Int32 selectionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL addSelection( sal_Int32 selectionIndex, sal_Int32 startOffset, sal_Int32 endOffset)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ // XAccessibleExtendedAttributes
+ virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+ sal_Bool GetSelectionAtIndex(sal_Int32& nIndex, sal_Int32& nStart, sal_Int32& nEnd);
+ sal_Int32 GetRealHeadingLevel();
+ // XAccessibleComponent
+ sal_Bool m_bLastHasSelection;
+ sal_Bool tabCharInWord(sal_Int32 nIndex, com::sun::star::i18n::Boundary& aBound);
+
// #i89175#
// XAccessibleMultiLineText
virtual sal_Int32 SAL_CALL getLineNumberAtIndex( sal_Int32 nIndex )
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index 2d0c6a4a0767..51fda461ca48 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -125,6 +125,12 @@ void SwAccessiblePortionData::Text(sal_uInt16 nLength, sal_uInt16 nType, sal_Int
bLastIsSpecial = sal_False;
}
+void SwAccessiblePortionData::SetAttrFieldType( sal_uInt16 nAttrFldType )
+{
+ aAttrFieldType.push_back(nAttrFldType);
+ return;
+}
+
void SwAccessiblePortionData::Special(
sal_uInt16 nLength, const OUString& rText, sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/)
{
@@ -140,10 +146,40 @@ void SwAccessiblePortionData::Special(
switch( nType )
{
case POR_POSTITS:
+ sDisplay = OUString(sal_Unicode(0xfffc));
+ break;
case POR_FLYCNT:
- case POR_GRFNUM:
sDisplay = OUString(sal_Unicode(0xfffc));
-
+ break;
+ case POR_GRFNUM:
+ case POR_BULLET:
+ break;
+ case POR_FLD:
+ case POR_HIDDEN:
+ case POR_COMBINED:
+ case POR_ISOREF:
+ {
+ //When the filed content is empty, input a special character.
+ if (rText.isEmpty())
+ sDisplay = OUString(sal_Unicode(0xfffc));
+ else
+ sDisplay = rText;
+ aFieldPosition.push_back(aBuffer.getLength());
+ aFieldPosition.push_back(aBuffer.getLength() + rText.getLength());
+ break;
+ }
+ case POR_FTNNUM:
+ {
+ break;
+ }
+ case POR_FTN:
+ {
+ sDisplay = rText;
+ sal_Int32 nStart=aBuffer.getLength();
+ sal_Int32 nEnd=nStart + rText.getLength();
+ m_vecPairPos.push_back(std::make_pair(nStart,nEnd));
+ break;
+ }
break;
case POR_NUMBER:
{
@@ -638,6 +674,36 @@ sal_uInt16 SwAccessiblePortionData::FillSpecialPos(
return static_cast<sal_uInt16>( nModelPos );
}
+sal_uInt16 SwAccessiblePortionData::GetAttrFldType( sal_Int32 nPos )
+{
+ if( aFieldPosition.size() < 2 ) return sal_False;
+ sal_Int32 nFieldIndex = 0;
+ for( size_t i = 0; i < aFieldPosition.size() - 1; i += 2 )
+ {
+ if( nPos < aFieldPosition[ i + 1 ] && nPos >= aFieldPosition[ i ] )
+ {
+ return aAttrFieldType[nFieldIndex];
+ }
+ nFieldIndex++ ;
+ }
+ return 0;
+}
+
+sal_Bool SwAccessiblePortionData::FillBoundaryIFDateField( com::sun::star::i18n::Boundary& rBound, const sal_Int32 nPos )
+{
+ if( aFieldPosition.size() < 2 ) return sal_False;
+ for( size_t i = 0; i < aFieldPosition.size() - 1; i += 2 )
+ {
+ if( nPos < aFieldPosition[ i + 1 ] && nPos >= aFieldPosition[ i ] )
+ {
+ rBound.startPos = aFieldPosition[i];
+ rBound.endPos = aFieldPosition[i + 1];
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
void SwAccessiblePortionData::AdjustAndCheck(
sal_Int32 nPos,
size_t& nPortionNo,
@@ -700,6 +766,50 @@ sal_Bool SwAccessiblePortionData::IsValidCorePosition( sal_Int32 nPos ) const
( nPos <= aModelPositions[ aModelPositions.size()-1 ] );
}
+sal_Bool SwAccessiblePortionData::IsZeroCorePositionData()
+{
+ if( aModelPositions.size() < 1 ) return sal_True;
+ return aModelPositions[0] == 0 && aModelPositions[aModelPositions.size()-1] == 0;
+}
+
+sal_Bool SwAccessiblePortionData::IsIndexInFootnode(sal_Int32 nIndex)
+{
+ VEC_PAIR_POS::iterator vi =m_vecPairPos.begin();
+ for (;vi != m_vecPairPos.end() ; ++vi)
+ {
+ const PAIR_POS &pairPos = *vi;
+ if(nIndex >= pairPos.first && nIndex < pairPos.second )
+ {
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+sal_Bool SwAccessiblePortionData::IsInGrayPortion( sal_Int32 nPos )
+{
+// return IsGrayPortion( FindBreak( aAccessiblePositions, nPos ) );
+ return IsPortionAttrSet( FindBreak( aAccessiblePositions, nPos ),
+ PORATTR_GRAY );
+}
+
+sal_Int32 SwAccessiblePortionData::GetFieldIndex(sal_Int32 nPos)
+{
+ sal_Int32 nIndex = -1;
+ if( aFieldPosition.size() >= 2 )
+ {
+ for( size_t i = 0; i < aFieldPosition.size() - 1; i += 2 )
+ {
+ if( nPos <= aFieldPosition[ i + 1 ] && nPos >= aFieldPosition[ i ] )
+ {
+ nIndex = i/2;
+ break;
+ }
+ }
+ }
+ return nIndex;
+}
+
sal_Int32 SwAccessiblePortionData::GetFirstValidCorePosition() const
{
return aModelPositions[0];
diff --git a/sw/source/core/access/accportions.hxx b/sw/source/core/access/accportions.hxx
index 25f1df840efa..fe319690d499 100644
--- a/sw/source/core/access/accportions.hxx
+++ b/sw/source/core/access/accportions.hxx
@@ -58,6 +58,8 @@ class SwAccessiblePortionData : public SwPortionHandler
Positions_t aLineBreaks; /// position of line breaks
Positions_t aModelPositions; /// position of portion breaks in the model
Positions_t aAccessiblePositions; /// portion breaks in sAccessibleString
+ Positions_t aFieldPosition;
+ Positions_t aAttrFieldType;
typedef std::vector<sal_uInt8> PortionAttrs_t;
PortionAttrs_t aPortionAttrs; /// additional portion attributes
@@ -101,6 +103,14 @@ public:
virtual void Skip(sal_uInt16 nLength);
virtual void Finish();
+ virtual void SetAttrFieldType( sal_uInt16 nAttrFldType );
+ sal_Bool FillBoundaryIFDateField( com::sun::star::i18n::Boundary& rBound, const sal_Int32 nPos );
+ sal_Bool IsIndexInFootnode(sal_Int32 nIndex);
+ sal_Bool IsInGrayPortion( sal_Int32 nPos );
+ sal_Int32 GetFieldIndex(sal_Int32 nPos);
+
+ sal_Bool IsZeroCorePositionData();
+
// access to the portion data
/// get the text string, as presented by the layout
@@ -113,6 +123,18 @@ public:
// get start and end position of the last line
void GetLastLineBoundary( com::sun::star::i18n::Boundary& rBound ) const;
+ /// Determine whether this core position is valid for these portions.
+ /// (A paragraph may be split into several frames, e.g. at page
+ /// boundaries. In this case, only part of a paragraph is represented
+ /// through this object. This method determines whether one particular
+ /// position is valid for this object or not.)
+ sal_Bool IsValidCorePosition( sal_Int32 nPos ) const;
+ sal_Int32 GetFirstValidCorePosition() const;
+ sal_Int32 GetLastValidCorePosition() const;
+
+ /// get the position in the accessibility string for a given model position
+ sal_Int32 GetAccessiblePosition( sal_Int32 nPos ) const;
+
// #i89175#
sal_Int32 GetLineCount() const;
sal_Int32 GetLineNo( const sal_Int32 nPos ) const;
@@ -123,9 +145,6 @@ public:
/// (accessibility) position
sal_Int32 GetModelPosition( sal_Int32 nPos ) const;
- /// get the position in the accessibility string for a given model position
- sal_Int32 GetAccessiblePosition( sal_Int32 nPos ) const;
-
/// fill a SwSpecialPos structure, suitable for calling
/// SwTxtFrm->GetCharRect
/// Returns the core position, and fills thr rpPos either with NULL or
@@ -143,21 +162,17 @@ public:
void GetAttributeBoundary( com::sun::star::i18n::Boundary& rBound,
sal_Int32 nPos ) const;
+ sal_uInt16 GetAttrFldType( sal_Int32 nPos );
/// Convert start and end positions into core positions.
/// @returns true if 'special' portions are included either completely
/// or not at all. This can be used to test whether editing
/// that range would be legal
sal_Bool GetEditableRange( sal_Int32 nStart, sal_Int32 nEnd,
sal_Int32& nCoreStart, sal_Int32& nCoreEnd ) const;
-
- /// Determine whether this core position is valid for these portions.
- /// (A paragraph may be split into several frames, e.g. at page
- /// boundaries. In this case, only part of a paragraph is represented
- /// through this object. This method determines whether one particular
- /// position is valid for this object or not.)
- sal_Bool IsValidCorePosition( sal_Int32 nPos ) const;
- sal_Int32 GetFirstValidCorePosition() const;
- sal_Int32 GetLastValidCorePosition() const;
+private:
+ typedef std::pair<sal_Int32,sal_Int32> PAIR_POS;
+ typedef std::vector<PAIR_POS> VEC_PAIR_POS;
+ VEC_PAIR_POS m_vecPairPos;
};
#endif
diff --git a/sw/source/core/access/accpreview.cxx b/sw/source/core/access/accpreview.cxx
index 5ce1976c1e3b..9ca0ffea7069 100644
--- a/sw/source/core/access/accpreview.cxx
+++ b/sw/source/core/access/accpreview.cxx
@@ -18,6 +18,7 @@
*/
#include <vcl/svapp.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <comphelper/servicehelper.hxx>
#include "access.hrc"
#include <accpreview.hxx>
@@ -34,7 +35,7 @@ using ::com::sun::star::uno::Sequence;
SwAccessiblePreview::SwAccessiblePreview( SwAccessibleMap *pMp ) :
SwAccessibleDocumentBase( pMp )
{
- SetName( GetResource( STR_ACCESS_DOC_NAME ) );
+ SetName( GetResource( STR_ACCESS_PREVIEW_DOC_NAME ) );
}
SwAccessiblePreview::~SwAccessiblePreview()
@@ -73,4 +74,22 @@ Sequence< sal_Int8 > SAL_CALL SwAccessiblePreview::getImplementationId()
return theSwAccessiblePreviewImplementationId::get().getSeq();
}
+OUString SAL_CALL SwAccessiblePreview::getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException)
+{
+ return GetResource( STR_ACCESS_PREVIEW_DOC_NAME );
+}
+
+OUString SAL_CALL SwAccessiblePreview::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException)
+{
+ OUString sLclName = SwAccessibleDocumentBase::getAccessibleName();
+ sLclName += " ";
+ sLclName += GetResource( STR_ACCESS_PREVIEW_DOC_SUFFIX );
+ return sLclName;
+}
+
+void SwAccessiblePreview::_InvalidateFocus()
+{
+ FireStateChangedEvent( ::com::sun::star::accessibility::AccessibleStateType::FOCUSED, sal_True );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/accpreview.hxx b/sw/source/core/access/accpreview.hxx
index b911da101be7..c5cd6c2c7031 100644
--- a/sw/source/core/access/accpreview.hxx
+++ b/sw/source/core/access/accpreview.hxx
@@ -60,6 +60,10 @@ public:
//====== XTypeProvider ====================================================
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ OUString SAL_CALL getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException);
+ OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual void _InvalidateFocus();
};
#endif
diff --git a/sw/source/core/access/accselectionhelper.cxx b/sw/source/core/access/accselectionhelper.cxx
index 8312ab216aab..d0817d439a43 100644
--- a/sw/source/core/access/accselectionhelper.cxx
+++ b/sw/source/core/access/accselectionhelper.cxx
@@ -28,6 +28,12 @@
#include <vcl/svapp.hxx>
#include <flyfrm.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <fmtanchr.hxx>
+
+using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -101,6 +107,41 @@ void SwAccessibleSelectionHelper::selectAccessibleChild(
// no frame shell, or no frame, or no fly frame -> can't select
}
+//When the selected state of the SwFrmOrObj is setted, return true.
+static sal_Bool lcl_getSelectedState(const SwAccessibleChild& aChild,
+ SwAccessibleContext* pContext,
+ SwAccessibleMap* pMap)
+{
+ Reference< XAccessible > xAcc;
+ if ( aChild.GetSwFrm() )
+ {
+ xAcc = pMap->GetContext( aChild.GetSwFrm(), sal_False );
+ }
+ else if ( aChild.GetDrawObject() )
+ {
+ xAcc = pMap->GetContext( aChild.GetDrawObject(), pContext, sal_False );
+ }
+
+ if( xAcc.is() )
+ {
+ Reference< XAccessibleContext > pRContext = xAcc->getAccessibleContext();
+ if(!pRContext.is())
+ return sal_False;
+ Reference<XAccessibleStateSet> pRStateSet = pRContext->getAccessibleStateSet();
+ if( pRStateSet.is() )
+ {
+ Sequence<short> pStates = pRStateSet->getStates();
+ long count = pStates.getLength();
+ for( int i = 0; i < count; i++ )
+ {
+ if( pStates[i] == AccessibleStateType::SELECTED)
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+
sal_Bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
sal_Int32 nChildIndex )
throw ( lang::IndexOutOfBoundsException,
@@ -127,6 +168,12 @@ sal_Bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
{
bRet = pFEShell->IsObjSelected( *aChild.GetDrawObject() );
}
+ //If the SwFrmOrObj is not selected directly in the UI, we should check whether it is selected in the selection cursor.
+ if( !bRet )
+ {
+ if( lcl_getSelectedState( aChild, &rContext, rContext.GetMap() ) == sal_True)
+ bRet = sal_True;
+ }
}
return bRet;
@@ -184,11 +231,7 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( )
const SwFlyFrm* pFlyFrm = pFEShell->GetCurrFlyFrm();
if( pFlyFrm )
{
- if( rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
- rContext.GetFrm() )
- {
- nCount = 1;
- }
+ nCount = 1;
}
else
{
@@ -216,6 +259,24 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( )
}
}
}
+ //If the SwFrmOrObj is not selected directly in the UI,
+ //we should check whether it is selected in the selection cursor.
+ if( nCount == 0 )
+ {
+ ::std::list< SwAccessibleChild > aChildren;
+ rContext.GetChildren( *(rContext.GetMap()), aChildren );
+ ::std::list< SwAccessibleChild >::const_iterator aIter =
+ aChildren.begin();
+ ::std::list< SwAccessibleChild >::const_iterator aEndIter =
+ aChildren.end();
+ while( aIter != aEndIter )
+ {
+ const SwAccessibleChild& aChild = *aIter;
+ if( lcl_getSelectedState( aChild, &rContext, rContext.GetMap() ) )
+ nCount++;
+ ++aIter;
+ }
+ }
}
return nCount;
}
@@ -239,11 +300,25 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild(
const SwFlyFrm *pFlyFrm = pFEShell->GetCurrFlyFrm();
if( pFlyFrm )
{
- if( 0 == nSelectedChildIndex &&
- rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
- rContext.GetFrm() )
+ if( 0 == nSelectedChildIndex )
{
- aChild = pFlyFrm;
+ if(rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) == rContext.GetFrm() )
+ {
+ aChild = pFlyFrm;
+ }
+ else
+ {
+ const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
+ if (pFrmFmt)
+ {
+ const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+ if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
+ {
+ const SwFrm *pParaFrm = rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview() );
+ aChild = pParaFrm;
+ }
+ }
+ }
}
}
else
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 4380713ee1f7..bb321301d9ea 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -44,7 +44,14 @@
#include <access.hrc>
#include <acctable.hxx>
+#include <rowfrm.hxx>
+#include <layfrm.hxx>
#include <com/sun/star/accessibility/XAccessibleText.hpp>
+
+#include <editeng/brushitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+
#include <comphelper/servicehelper.hxx>
using namespace ::com::sun::star;
@@ -60,6 +67,8 @@ typedef ::std::set < sal_Int32, Int32Less_Impl > Int32Set_Impl;
typedef ::std::pair < sal_Int32, sal_Int32 > Int32Pair_Impl;
typedef ::std::list < Int32Pair_Impl > Int32PairList_Impl;
+const int SELECTION_WITH_NUM =10;
+
class SwAccTableSelHander_Impl
{
public:
@@ -81,6 +90,8 @@ class SwAccessibleTableData_Impl
bool mbOnlyTableColumnHeader;
void CollectData( const SwFrm *pFrm );
+ void CollectColumnHeaderData( const SwFrm *pFrm );
+ void CollectRowHeaderData( const SwFrm *pFrm );
void CollectExtents( const SwFrm *pFrm );
sal_Bool FindCell( const Point& rPos, const SwFrm *pFrm ,
@@ -171,6 +182,97 @@ void SwAccessibleTableData_Impl::CollectData( const SwFrm *pFrm )
}
}
+void SwAccessibleTableData_Impl::CollectRowHeaderData( const SwFrm *pFrm )
+{
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
+ while( aIter != aEndIter )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm *pLower = rLower.GetSwFrm();
+ if( pLower )
+ {
+ if( pLower->IsRowFrm() )
+ {
+
+ const SwTableLine* pLine = ((SwRowFrm*)pLower)->GetTabLine();
+ while( pLine->GetUpper() )
+ pLine = pLine->GetUpper()->GetUpper();
+
+ // Headerline?
+ //if(mpTabFrm->GetTable()->GetTabLines()[ 0 ] != pLine)
+ //return ;
+
+ maRows.insert( pLower->Frm().Top() - maTabFrmPos.Y() );
+
+ CollectRowHeaderData( pLower );
+
+
+ }
+ else if( pLower->IsCellFrm() &&
+ rLower.IsAccessible( mbIsInPagePreview ) )
+ {
+ //Added by yanjun. Can't find the "GetRowHeaderFlag" function(Need vefiry).
+ //if(((SwCellFrm*)pLower)->GetRowHeaderFlag())
+ // maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() );
+ }
+ else
+ {
+ CollectRowHeaderData( pLower );
+ }
+ }
+ ++aIter;
+ }
+}
+
+void SwAccessibleTableData_Impl::CollectColumnHeaderData( const SwFrm *pFrm )
+{
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
+ while( aIter != aEndIter )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm *pLower = rLower.GetSwFrm();
+ if( pLower )
+ {
+ if( pLower->IsRowFrm() )
+ {
+
+ const SwTableLine* pLine = ((SwRowFrm*)pLower)->GetTabLine();
+ while( pLine->GetUpper() )
+ pLine = pLine->GetUpper()->GetUpper();
+
+ // Headerline?
+ //if(mpTabFrm->GetTable()->GetTabLines()[ 0 ] != pLine)
+ //return ;
+
+ //if the current line is now header line, then return ;
+ sal_Int16 iCurrentRowIndex = mpTabFrm->GetTable()->GetTabLines().GetPos( pLine);
+ if(iCurrentRowIndex >= mpTabFrm->GetTable()->_GetRowsToRepeat())
+ return ;
+
+ maRows.insert( pLower->Frm().Top() - maTabFrmPos.Y() );
+
+ CollectColumnHeaderData( pLower );
+
+
+ }
+ else if( pLower->IsCellFrm() &&
+ rLower.IsAccessible( mbIsInPagePreview ) )
+ {
+ maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() );
+ }
+ else
+ {
+ CollectColumnHeaderData( pLower );
+ }
+ }
+ ++aIter;
+ }
+}
+
void SwAccessibleTableData_Impl::CollectExtents( const SwFrm *pFrm )
{
const SwAccessibleChildSList aList( *pFrm, mrAccMap );
@@ -382,7 +484,9 @@ const SwFrm *SwAccessibleTableData_Impl::GetCellAtPos(
inline sal_Int32 SwAccessibleTableData_Impl::GetRowCount() const
{
- return static_cast< sal_Int32 >( maRows.size() );
+ sal_Int32 count = static_cast< sal_Int32 >( maRows.size() ) ;
+ count = (count <=0)? 1:count;
+ return count;
}
inline sal_Int32 SwAccessibleTableData_Impl::GetColumnCount() const
@@ -659,8 +763,10 @@ void SwAccessibleTable::GetStates(
::utl::AccessibleStateSetHelper& rStateSet )
{
SwAccessibleContext::GetStates( rStateSet );
-
+ //Add resizable state to table
+ rStateSet.AddState( AccessibleStateType::RESIZABLE );
// MULTISELECTABLE
+ rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
SwCrsrShell* pCrsrShell = GetCrsrShell();
if( pCrsrShell )
rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
@@ -683,6 +789,7 @@ SwAccessibleTable::SwAccessibleTable(
const OUString sArg2( GetFormattedPageNumber() );
sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
+ UpdateTableData();
}
SwAccessibleTable::~SwAccessibleTable()
@@ -735,8 +842,7 @@ void SwAccessibleTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew
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;
@@ -760,6 +866,11 @@ uno::Any SwAccessibleTable::queryInterface( const uno::Type& rType )
uno::Reference<XAccessibleSelection> xSelection( this );
aRet <<= xSelection;
}
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleTableSelection> *)0) )
+ {
+ uno::Reference<XAccessibleTableSelection> xTableExtent( this );
+ aRet <<= xTableExtent;
+ }
else
{
aRet = SwAccessibleContext::queryInterface(rType);
@@ -923,6 +1034,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowExtentAt(
CHECK_FOR_DEFUNC( XAccessibleTable )
+ UpdateTableData();
GetTableData().CheckRowAndCol( nRow, nColumn, this );
Int32Set_Impl::const_iterator aSttCol(
@@ -953,6 +1065,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumnExtentAt(
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
+ UpdateTableData();
GetTableData().CheckRowAndCol( nRow, nColumn, this );
@@ -1284,6 +1397,14 @@ void SwAccessibleTable::InvalidatePosOrSize( const SwRect& rOldBox )
{
SolarMutexGuard aGuard;
+ //need to update children
+ SwAccessibleTableData_Impl *pNewTableData = CreateNewTableData();
+ if( !pNewTableData->CompareExtents( GetTableData() ) )
+ {
+ delete mpTableData;
+ mpTableData = pNewTableData;
+ FireTableChangeEvent(*mpTableData);
+ }
if( HasTableData() )
GetTableData().SetTablePos( GetFrm()->Frm().Pos() );
@@ -1338,7 +1459,33 @@ void SwAccessibleTable::InvalidateChildPosOrSize( const SwAccessibleChild& rChil
SwAccessibleTableData_Impl *pNewTableData = CreateNewTableData(); // #i77106#
if( !pNewTableData->CompareExtents( GetTableData() ) )
{
- FireTableChangeEvent( GetTableData() );
+ if(pNewTableData->GetRowCount()!= mpTableData->GetRowCount())
+ {
+ Int32Set_Impl::const_iterator aSttCol( GetTableData().GetColumnIter( 0 ) );
+ Int32Set_Impl::const_iterator aSttRow( GetTableData().GetRowIter( 1 ) );
+ const SwFrm *pCellFrm = GetTableData().GetCellAtPos( *aSttCol, *aSttRow, sal_False );
+ Int32Set_Impl::const_iterator aSttCol2( pNewTableData->GetColumnIter( 0 ) );
+ Int32Set_Impl::const_iterator aSttRow2( pNewTableData->GetRowIter( 0 ) );
+ const SwFrm *pCellFrm2 = pNewTableData->GetCellAtPos( *aSttCol2, *aSttRow2, sal_False );
+
+ if(pCellFrm == pCellFrm2)
+ {
+ AccessibleTableModelChange aModelChange;
+ aModelChange.Type = AccessibleTableModelChangeType::UPDATE;
+ aModelChange.FirstRow = 0;
+ aModelChange.LastRow = mpTableData->GetRowCount() - 1;
+ aModelChange.FirstColumn = 0;
+ aModelChange.LastColumn = mpTableData->GetColumnCount() - 1;
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED;
+ aEvent.NewValue <<= aModelChange;
+
+ FireAccessibleEvent( aEvent );
+ }
+ }
+ else
+ FireTableChangeEvent( GetTableData() );
ClearTableData();
mpTableData = pNewTableData;
}
@@ -1569,6 +1716,152 @@ void SAL_CALL SwAccessibleTable::deselectAccessibleChild(
pCrsrShell->EndAction();
}
+void SwAccessibleTable::SetTableData(SwAccessibleTableData_Impl* mpNewTableData)
+{
+ mpTableData = mpNewTableData;
+}
+
+sal_Int32 SAL_CALL SwAccessibleTable::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;
+}
+
+void SwAccessibleTable::FireSelectionEvent( )
+{
+ AccessibleEventObject aEvent;
+
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
+
+// int nRemove = m_vecCellRemove.size();
+// int nAdd = m_vecCellAdd.size();
+
+ VEC_CELL::iterator vi = m_vecCellRemove.begin();
+ for (; vi != m_vecCellRemove.end() ; ++vi)
+ {
+ SwAccessibleContext *pAccCell = const_cast<SwAccessibleContext *>(*vi);
+ OSL_ASSERT(pAccCell != NULL );
+ pAccCell->FireAccessibleEvent(aEvent);
+ }
+
+ if (m_vecCellAdd.size() <= SELECTION_WITH_NUM)
+ {
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
+ vi = m_vecCellAdd.begin();
+ for (; vi != m_vecCellAdd.end() ; ++vi)
+ {
+ SwAccessibleContext *pAccCell = const_cast<SwAccessibleContext *>(*vi);
+ OSL_ASSERT(pAccCell != NULL );
+ pAccCell->FireAccessibleEvent(aEvent);
+ }
+ return ;
+ }
+ else
+ {
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+ FireAccessibleEvent(aEvent);
+ }
+}
+
+void SwAccessibleTable::ClearSelectionCellCache()
+{
+ m_vecCellAdd.clear();
+ m_vecCellRemove.clear();
+}
+
+void SwAccessibleTable::AddSelectionCell(const SwAccessibleContext* pAccCell ,sal_Bool bAddOrRemove)
+{
+ if (bAddOrRemove)
+ {
+ m_vecCellAdd.push_back(pAccCell);
+ }
+ else
+ {
+ m_vecCellRemove.push_back(pAccCell);
+ }
+}
+
+//===== XAccessibleTableSelection ============================================
+sal_Bool SAL_CALL SwAccessibleTable::selectRow( sal_Int32 row )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ if( isAccessibleColumnSelected( row ) )
+ return sal_True;
+
+ long lCol, lColumnCount, lChildIndex;
+ lColumnCount = getAccessibleColumnCount();
+ for(lCol = 0; lCol < lColumnCount; lCol ++)
+ {
+ lChildIndex = getAccessibleIndex(row, lCol);
+ selectAccessibleChild(lChildIndex);
+ }
+
+ return sal_True;
+}
+sal_Bool SAL_CALL SwAccessibleTable::selectColumn( sal_Int32 column )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ if( isAccessibleColumnSelected( column ) )
+ return sal_True;
+
+ long lRow, lRowCount, lChildIndex;
+ lRowCount = getAccessibleRowCount();
+
+ for(lRow = 0; lRow < lRowCount; lRow ++)
+ {
+ lChildIndex = getAccessibleIndex(lRow, column);
+ selectAccessibleChild(lChildIndex);
+ }
+ return sal_True;
+}
+sal_Bool SAL_CALL SwAccessibleTable::unselectRow( sal_Int32 row )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ if( isAccessibleSelected( row , 0 ) && isAccessibleSelected( row , getAccessibleColumnCount()-1 ) )
+ {
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL )
+ {
+ pCrsrShell->StartAction();
+ pCrsrShell->ClearMark();
+ pCrsrShell->EndAction();
+ return sal_True;
+ }
+ }
+ return sal_True;
+}
+sal_Bool SAL_CALL SwAccessibleTable::unselectColumn( sal_Int32 column )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ if( isAccessibleSelected( 0 , column ) && isAccessibleSelected( getAccessibleRowCount()-1,column))
+ {
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL )
+ {
+ pCrsrShell->StartAction();
+ pCrsrShell->ClearMark();
+ pCrsrShell->EndAction();
+ return sal_True;
+ }
+ }
+ return sal_True;
+}
+
// #i77106# - implementation of class <SwAccessibleTableColHeaders>
SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2,
const SwTabFrm *pTabFrm )
diff --git a/sw/source/core/access/acctable.hxx b/sw/source/core/access/acctable.hxx
index 9c0a365e2b6e..6ee40f7e9a8a 100644
--- a/sw/source/core/access/acctable.hxx
+++ b/sw/source/core/access/acctable.hxx
@@ -21,6 +21,8 @@
#define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCTABLE_HXX
#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
+#include <vector>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <acccontext.hxx>
@@ -38,6 +40,7 @@ class SwAccessibleTable :
public SwAccessibleContext,
public ::com::sun::star::accessibility::XAccessibleTable,
public ::com::sun::star::accessibility::XAccessibleSelection,
+ public ::com::sun::star::accessibility::XAccessibleTableSelection,
public SwClient
{
SwAccessibleTableData_Impl *mpTableData; // the table's data, prot by Sol-Mutex
@@ -80,6 +83,7 @@ protected:
// Is table data evailable?
sal_Bool HasTableData() const { return (mpTableData != 0); }
+ void SetTableData(SwAccessibleTableData_Impl* mpNewTableData) ;
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
public:
@@ -181,7 +185,15 @@ public:
virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::uno::RuntimeException);
-
+ //===== XAccessibleTableSelection ============================================
+ virtual sal_Bool SAL_CALL selectRow( sal_Int32 row )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+ virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+ virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+ virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
//===== XServiceInfo ====================================================
/** Returns an identifier for the implementation of this object.
@@ -248,6 +260,15 @@ public:
throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::uno::RuntimeException );
+ //===== XAccessibleComponent ============================================
+ sal_Int32 SAL_CALL getBackground()
+ throw (::com::sun::star::uno::RuntimeException);
+ typedef std::vector<const SwAccessibleContext*> VEC_CELL;
+ VEC_CELL m_vecCellAdd;
+ VEC_CELL m_vecCellRemove;
+ void FireSelectionEvent( );
+ void ClearSelectionCellCache();
+ void AddSelectionCell(const SwAccessibleContext* ,sal_Bool bAddOrRemove);
};
inline SwAccessibleTableData_Impl& SwAccessibleTable::GetTableData()
diff --git a/sw/source/core/access/acctextframe.cxx b/sw/source/core/access/acctextframe.cxx
index 118c3e003244..1a2aa61e17fa 100644
--- a/sw/source/core/access/acctextframe.cxx
+++ b/sw/source/core/access/acctextframe.cxx
@@ -32,6 +32,7 @@
#include <flyfrm.hxx>
#include <accmap.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
+#include <doc.hxx>
#include <hints.hxx>
#include "acctextframe.hxx"
@@ -140,6 +141,123 @@ void SwAccessibleTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *
}
}
+//===== XInterface ==========================================================
+
+com::sun::star::uno::Any SAL_CALL
+ SwAccessibleTextFrame::queryInterface (const com::sun::star::uno::Type & rType)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aReturn = SwAccessibleContext::queryInterface (rType);
+ if ( ! aReturn.hasValue())
+ aReturn = ::cppu::queryInterface (rType,
+ static_cast< ::com::sun::star::accessibility::XAccessibleSelection* >(this)
+ );
+ return aReturn;
+}
+
+
+
+
+void SAL_CALL
+ SwAccessibleTextFrame::acquire (void)
+ throw ()
+{
+ SwAccessibleContext::acquire ();
+}
+
+void SAL_CALL
+ SwAccessibleTextFrame::release (void)
+ throw ()
+{
+ SwAccessibleContext::release ();
+}
+
+//
+//===== XAccessibleSelection ============================================
+//
+
+//--------------------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::selectAccessibleChild( sal_Int32 )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAccessibleChild( sal_Int32 )> - missing implementation" );
+}
+
+//----------------------------------------------------------------------------------
+sal_Bool SAL_CALL SwAccessibleTextFrame::isAccessibleChildSelected( sal_Int32 nChildIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ uno::Reference<XAccessible> xAcc = getAccessibleChild( nChildIndex );
+ uno::Reference<XAccessibleContext> xContext;
+ if( xAcc.is() )
+ xContext = xAcc->getAccessibleContext();
+
+ if( xContext.is() )
+ {
+ if( xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+ {
+ uno::Reference< ::com::sun::star::accessibility::XAccessibleText >
+ xText(xAcc, uno::UNO_QUERY);
+ if( xText.is() )
+ {
+ if( xText->getSelectionStart() >= 0 ) return sal_True;
+ }
+ }
+ }
+
+ return sal_False;
+}
+
+//---------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::clearAccessibleSelection( )
+ throw ( uno::RuntimeException )
+{
+ DBG_ASSERT( false, "<SwAccessibleTextFrame::clearAccessibleSelection( )> - missing implementation" );
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::selectAllAccessibleChildren( )
+ throw ( uno::RuntimeException )
+{
+ DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAllAccessibleChildren( )> - missing implementation" );
+}
+
+//----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SwAccessibleTextFrame::getSelectedAccessibleChildCount()
+ throw ( uno::RuntimeException )
+{
+ sal_Int32 nCount = 0;
+ sal_Int32 TotalCount = getAccessibleChildCount();
+ for( sal_Int32 i = 0; i < TotalCount; i++ )
+ if( isAccessibleChildSelected(i) ) nCount++;
+
+ return nCount;
+}
+
+//--------------------------------------------------------------------------------------
+uno::Reference<XAccessible> SAL_CALL SwAccessibleTextFrame::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ if ( nSelectedChildIndex > getSelectedAccessibleChildCount() )
+ throw lang::IndexOutOfBoundsException();
+ sal_Int32 i1, i2;
+ for( i1 = 0, i2 = 0; i1 < getAccessibleChildCount(); i1++ )
+ if( isAccessibleChildSelected(i1) )
+ {
+ if( i2 == nSelectedChildIndex )
+ return getAccessibleChild( i1 );
+ i2++;
+ }
+ return uno::Reference<XAccessible>();
+}
+
+//----------------------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::deselectAccessibleChild( sal_Int32 )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAllAccessibleChildren( sal_Int32 )> - missing implementation" );
+}
+
// #i73249#
OUString SAL_CALL SwAccessibleTextFrame::getAccessibleName (void)
throw (uno::RuntimeException)
diff --git a/sw/source/core/access/acctextframe.hxx b/sw/source/core/access/acctextframe.hxx
index 8c891cf25975..6db706c150de 100644
--- a/sw/source/core/access/acctextframe.hxx
+++ b/sw/source/core/access/acctextframe.hxx
@@ -22,13 +22,16 @@
#include "accframebase.hxx"
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+
class SwFlyFrm;
namespace utl { class AccessibleRelationSetHelper; }
namespace com { namespace star {
namespace accessibility { struct AccessibleRelation; }
} }
-class SwAccessibleTextFrame : public SwAccessibleFrameBase
+class SwAccessibleTextFrame : public SwAccessibleFrameBase,
+ public ::com::sun::star::accessibility::XAccessibleSelection
{
private:
// #i73249#
@@ -42,6 +45,41 @@ protected:
public:
SwAccessibleTextFrame( SwAccessibleMap* pInitMap, const SwFlyFrm* pFlyFrm );
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ ::com::sun::star::uno::Type const & rType )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+ //===== 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 );
+
//===== XAccessibleContext ==============================================
// #i73249# - Return the object's current name.
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index f7747e387561..e5b019ce53f9 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -230,7 +230,7 @@ SwFmt::~SwFmt()
}
else
{
- while( GetDepends() )
+ while( GetDepends() && pParentFmt)
{
SwFmtChg aOldFmt( this );
SwFmtChg aNewFmt( pParentFmt );
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index b51c3cc8a835..cab3decd7a0e 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -432,6 +432,74 @@ void SwCrsrShell::UpdateMarkedListLevel()
}
}
+void SwCrsrShell::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage)
+{
+#ifdef ACCESSIBLE_LAYOUT
+ if( Imp()->IsAccessible() )
+ Imp()->FirePageChangeEvent( nOldPage, nNewPage );
+#else
+ (void)nOldPage;
+ (void)nNewPage;
+#endif
+}
+
+void SwCrsrShell::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn)
+{
+#ifdef ACCESSIBLE_LAYOUT
+ if( Imp()->IsAccessible() )
+ Imp()->FireColumnChangeEvent( nOldColumn, nNewColumn);
+#else
+ (void)nOldColumn;
+ (void)nNewColumn;
+#endif
+}
+
+
+void SwCrsrShell::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection)
+{
+#ifdef ACCESSIBLE_LAYOUT
+ if( Imp()->IsAccessible() )
+ Imp()->FireSectionChangeEvent( nOldSection, nNewSection );
+#else
+ (void)nOldSection;
+ (void)nNewSection;
+#endif
+}
+
+bool SwCrsrShell::bColumnChange()
+{
+ SwFrm* pCurrFrm = GetCurrFrm(sal_False);
+
+ if (pCurrFrm == NULL)
+ {
+ return sal_False;
+ }
+
+ SwFrm* pCurrCol=((SwFrm*)pCurrFrm)->FindColFrm();
+
+ while(pCurrCol== NULL && pCurrFrm!=NULL )
+ {
+ SwLayoutFrm* pParent = pCurrFrm->GetUpper();
+ if(pParent!=NULL)
+ {
+ pCurrCol=((SwFrm*)pParent)->FindColFrm();
+ pCurrFrm = (SwFrm*)pParent;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if(oldColFrm == pCurrCol)
+ return sal_False;
+ else
+ {
+ oldColFrm = pCurrCol;
+ return sal_True;
+ }
+}
+
sal_Bool SwCrsrShell::UpDown( sal_Bool bUp, sal_uInt16 nCnt )
{
SET_CURR_SHELL( this );
@@ -2528,6 +2596,7 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin )
m_bSetCrsrInReadOnly = sal_True;
m_pVisCrsr = new SwVisCrsr( this );
m_bMacroExecAllowed = rShell.IsMacroExecAllowed();
+ oldColFrm = NULL;
#if defined(ANDROID) || defined(IOS)
HideCrsr();
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index 0ca58384a917..c4995bcb228e 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -994,7 +994,8 @@ sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes,
// Delete the Frames
aFndBox.SetTableLines( *this );
- aFndBox.DelFrms( *this );
+ //Not dispose accessible table
+ aFndBox.DelFrms( *this,sal_False );
if( 1 == rCpyTbl.GetTabSortBoxes().size() )
{
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 6dee261bf79b..e474cb6ae07b 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -913,7 +913,7 @@ SwCntntNode::~SwCntntNode()
// The base class SwClient of SwFrm excludes itself from the dependency list!
// Thus, we need to delete all Frames in the dependency list.
if( GetDepends() )
- DelFrms();
+ DelFrms(sal_True, sal_False);
delete pCondColl;
@@ -1222,13 +1222,70 @@ void SwCntntNode::MakeFrms( SwCntntNode& rNode )
/**
* Deletes all Views from the Doc for this Node.
* The ContentFrames are removed from the corresponding Layout.
+ *
+ * An input param to identify if the acc table should be disposed. and a
+ * flag(bNeedDel) to indicate whether to del corresponding frm even in doc
+ * loading process,
*/
-void SwCntntNode::DelFrms()
+void SwCntntNode::DelFrms( sal_Bool /*bNeedDel*/, sal_Bool bIsDisposeAccTable )
{
if( !GetDepends() )
return;
- SwCntntFrm::DelFrms(*this);
+ SwIterator<SwCntntFrm,SwCntntNode> aIter( *this );
+ for( SwCntntFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() )
+ {
+ // #i27138#
+ // notify accessibility paragraphs objects about changed
+ // CONTENT_FLOWS_FROM/_TO relation.
+ // Relation CONTENT_FLOWS_FROM for current next paragraph will change
+ // and relation CONTENT_FLOWS_TO for current previous paragraph will change.
+ if ( pFrm->IsTxtFrm() )
+ {
+ SwViewShell* pViewShell( pFrm->getRootFrm()->GetCurrShell() );
+ if ( pViewShell && pViewShell->GetLayout() &&
+ pViewShell->GetLayout()->IsAnyShellAccessible() )
+ {
+ pViewShell->InvalidateAccessibleParaFlowRelation(
+ dynamic_cast<SwTxtFrm*>(pFrm->FindNextCnt( true )),
+ dynamic_cast<SwTxtFrm*>(pFrm->FindPrevCnt( true )) );
+ }
+ }
+
+ if( pFrm->IsFollow() )
+ {
+ SwCntntFrm* pMaster = (SwTxtFrm*)pFrm->FindMaster();
+ pMaster->SetFollow( pFrm->GetFollow() );
+ }
+ pFrm->SetFollow( 0 );//So it doesn't get funny ideas.
+ //Otherwise it could be possible that a follow
+ //gets destroyed before its master. Following
+ //the now invalid pointer will then lead to an
+ //illegal memory access. The chain can be
+ //crushed here because we'll destroy all of it
+ //anyway.
+
+ if( pFrm->GetUpper() && pFrm->IsInFtn() && !pFrm->GetIndNext() &&
+ !pFrm->GetIndPrev() )
+ {
+ SwFtnFrm *pFtn = pFrm->FindFtnFrm();
+ OSL_ENSURE( pFtn, "You promised a FtnFrm?" );
+ SwCntntFrm* pCFrm;
+ if( !pFtn->GetFollow() && !pFtn->GetMaster() &&
+ 0 != ( pCFrm = pFtn->GetRefFromAttr()) && pCFrm->IsFollow() )
+ {
+ OSL_ENSURE( pCFrm->IsTxtFrm(), "NoTxtFrm has Footnote?" );
+ ((SwTxtFrm*)pCFrm->FindMaster())->Prepare( PREP_FTN_GONE );
+ }
+ }
+ //Set acc table dispose state
+ pFrm->SetAccTableDispose( bIsDisposeAccTable );
+ pFrm->Cut();
+ //Set acc table dispose state to default value
+ pFrm->SetAccTableDispose( sal_True );
+ delete pFrm;
+ }
+
if( IsTxtNode() )
{
((SwTxtNode*)this)->SetWrong( NULL );
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index e30bb8ee3b48..b6af20e0fa0d 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -793,6 +793,15 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
break;
case ND_TEXTNODE:
+ //Add special function to text node.
+ {
+ if( bNewFrms && pAktNode->GetCntntNode() )
+ ((SwCntntNode*)pAktNode)->DelFrms( sal_False );
+ pAktNode->pStartOfSection = aSttNdStack[ nLevel ];
+ nInsPos++;
+ aRg.aEnd--;
+ }
+ break;
case ND_GRFNODE:
case ND_OLENODE:
{
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index c13dd1285af3..fd0b09aec8d5 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -999,6 +999,26 @@ sal_Bool SwFEShell::IsObjSelected( const SdrObject& rObj ) const
->IsObjMarked( const_cast< SdrObject * >( &rObj ) );
}
+sal_Bool SwFEShell::IsObjSameLevelWithMarked(const SdrObject* pObj) const
+{
+ if (pObj)
+ {
+ const SdrMarkList& aMarkList = Imp()->GetDrawView()->GetMarkedObjectList();
+ if (aMarkList.GetMarkCount() == 0)
+ {
+ return sal_True;
+ }
+ SdrMark* pM=aMarkList.GetMark(0);
+ if (pM)
+ {
+ SdrObject* pMarkObj = pM->GetMarkedSdrObj();
+ if (pMarkObj && pMarkObj->GetUpGroup() == pObj->GetUpGroup())
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
/*************************************************************************
|*
|* SwFEShell::EndTextEdit()
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 4042d6a26d21..dec5c7c86c23 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -2166,7 +2166,9 @@ inline void UnsetFollow( SwFlowFrm *pTab )
pTab->m_pPrecede = 0;
}
-void _FndBox::DelFrms( SwTable &rTable )
+//When bAccTableDispose is FALSE,the acc table should not be disposed.
+//void _FndBox::DelFrms( SwTable &rTable )
+void _FndBox::DelFrms( SwTable &rTable,sal_Bool bAccTableDispose )
{
// All lines between pLineBefore and pLineBehind should be cut
// from the layout and erased.
@@ -2282,8 +2284,11 @@ void _FndBox::DelFrms( SwTable &rTable )
// next turn.
((SwTabFrm*)pTabFrm)->SetFollowFlowLine( sal_False );
}
-
+ //Set acc table dispose state
+ pFrm->SetAccTableDispose( bAccTableDispose );
pFrm->Cut();
+ //Set acc table dispose state to default value.
+ pFrm->SetAccTableDispose( sal_True );
delete pFrm;
}
}
diff --git a/sw/source/core/inc/SwPortionHandler.hxx b/sw/source/core/inc/SwPortionHandler.hxx
index 1cb7670cea95..c30498cf94e7 100644
--- a/sw/source/core/inc/SwPortionHandler.hxx
+++ b/sw/source/core/inc/SwPortionHandler.hxx
@@ -93,6 +93,8 @@ public:
* paragraph's portions have been processed.
*/
virtual void Finish() = 0;
+ virtual void SetAttrFieldType( sal_uInt16 )
+ { return; }
};
#endif
diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx
index 0def0d698cc8..d2e30a95d8bc 100644
--- a/sw/source/core/inc/doctxm.hxx
+++ b/sw/source/core/inc/doctxm.hxx
@@ -86,6 +86,8 @@ public:
void UpdatePageNum(); // insert page numbering
TYPEINFO(); // for rtti
+ SwTOXSortTabBases* GetTOXSortTabBases() { return &aSortArr; }
+
bool SetPosAtStartEnd( SwPosition& rPos, bool bAtStart = true ) const;
};
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 8c1006174cf1..36a9622e0401 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -30,6 +30,9 @@
#include <svl/brdcst.hxx>
#include "IDocumentDrawModelAccess.hxx"
+#include <com/sun/star/style/TabStop.hpp>
+
+using namespace ::com::sun::star;
class SwLayoutFrm;
class SwRootFrm;
class SwPageFrm;
@@ -252,6 +255,8 @@ class SwFrm: public SwClient, public SfxBroadcaster
// cache for (border) attributes
static SwCache *mpCache;
+ bool mbIfAccTableShouldDisposing;
+
// #i65250#
// frame ID is now in general available - used for layout loop control
static sal_uInt32 mnLastFrmId;
@@ -429,6 +434,11 @@ protected:
virtual const IDocumentDrawModelAccess* getIDocumentDrawModelAccess( );
public:
+ virtual uno::Sequence< style::TabStop > GetTabStopInfo( SwTwips )
+ {
+ return uno::Sequence< style::TabStop >();
+ }
+
TYPEINFO(); // already in base class
sal_uInt16 GetType() const { return 0x1 << mnType; }
@@ -698,6 +708,8 @@ public:
virtual Size ChgSize( const Size& aNewSize );
virtual void Cut() = 0;
+ //Add a method to change the acc table dispose state.
+ void SetAccTableDispose(bool bDispose) { mbIfAccTableShouldDisposing = bDispose;}
virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) = 0;
void ValidateLineNum() { mbValidLineNum = sal_True; }
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 345a56967eac..10df18e8410a 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -19,6 +19,7 @@
#ifndef INCLUDED_SW_SOURCE_CORE_INC_TXTFRM_HXX
#define INCLUDED_SW_SOURCE_CORE_INC_TXTFRM_HXX
+#include <com/sun/star/uno/Sequence.hxx>
#include <tools/mempool.hxx>
#include "cntfrm.hxx"
#include "ndtxt.hxx"
@@ -214,6 +215,7 @@ protected:
public:
+ com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > GetTabStopInfo( SwTwips CurrentPos );
//public, weil der eine oder andere die Methode rufen darf um das
//Prepare zu sparen - mit Vorsicht zu geniessen!
void Init();
diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx
index 62442793f765..a5b7395d9ef4 100644
--- a/sw/source/core/inc/viewimp.hxx
+++ b/sw/source/core/inc/viewimp.hxx
@@ -256,6 +256,10 @@ public:
inline void AddAccessibleObj( const SdrObject *pObj );
+ void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage);
+ void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection);
+ void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn);
+
// Invalidate accessible frame's frame's content
void InvalidateAccessibleFrmContent( const SwFrm *pFrm );
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 4f482c556c44..eb540b4d58d5 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -3196,4 +3196,21 @@ IMapObject* SwFrmFmt::GetIMapObject( const Point& rPoint,
return 0;
}
+sal_Bool SwFrmFmt::HasCaption() const
+{
+ if(pCaptionFmt != NULL && pCaptionFmt->GetDepends())
+ return sal_True;
+ return sal_False;
+}
+
+void SwFrmFmt::SetCaptionFmt(SwFrmFmt * pFmt)
+{
+ pCaptionFmt = pFmt;
+}
+
+SwFrmFmt* SwFrmFmt::GetCaptionFmt() const
+{
+ return pCaptionFmt;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index bb7b03ffee54..3f7cff0a0547 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -77,6 +77,7 @@ using namespace ::com::sun::star;
SwFrm::SwFrm( SwModify *pMod, SwFrm* pSib ) :
SwClient( pMod ),
+ mbIfAccTableShouldDisposing( false ), //A member to identify if the acc table should dispose
// #i65250#
mnFrmId( SwFrm::mnLastFrmId++ ),
mpRoot( pSib ? pSib->getRootFrm() : 0 ),
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 7d876058d231..e3793afb9845 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -772,6 +772,14 @@ void SwOLEObj::SetNode( SwOLENode* pNode )
}
}
+OUString SwOLEObj::GetStyleString()
+{
+ OUString strStyle;
+ if (xOLERef.is() && xOLERef.IsChart())
+ strStyle = xOLERef.GetChartType();
+ return strStyle;
+}
+
sal_Bool SwOLEObj::IsOleRef() const
{
return xOLERef.is();
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 4291e9230b80..872d0713ad98 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -47,8 +47,11 @@
#include <rootfrm.hxx>
#include <frmfmt.hxx>
-// OD 2004-05-24 #i28701#
+// #i28701#
#include <sortedobjs.hxx>
+#include <portab.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/tstpitem.hxx>
// Tolerance in formatting and text output
#define SLOPPY_TWIPS 5
@@ -503,6 +506,46 @@ void SwTxtFrm::AdjustFrm( const SwTwips nChgHght, sal_Bool bHasToFit )
UNDO_SWAP( this )
}
+com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > SwTxtFrm::GetTabStopInfo( SwTwips CurrentPos )
+{
+ com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > tabs(1);
+ ::com::sun::star::style::TabStop ts;
+
+ SwTxtFormatInfo aInf( this );
+ SwTxtFormatter aLine( this, &aInf );
+ SwTxtCursor TxtCursor( this, &aInf );
+ const Point aCharPos( TxtCursor.GetTopLeft() );
+
+
+ SwTwips nRight = aLine.Right();
+ CurrentPos -= aCharPos.X();
+
+ // get current tab stop information stored in the Frm
+ const SvxTabStop *pTS = aLine.GetLineInfo().GetTabStop( CurrentPos, nRight );
+
+ if( !pTS )
+ {
+ return com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop >();
+ }
+
+ // copy tab stop information into a Sequence, which only contains one element.
+ ts.Position = pTS->GetTabPos();
+ ts.DecimalChar = pTS->GetDecimal();
+ ts.FillChar = pTS->GetFill();
+ switch( pTS->GetAdjustment() )
+ {
+ case SVX_TAB_ADJUST_LEFT : ts.Alignment = ::com::sun::star::style::TabAlign_LEFT; break;
+ case SVX_TAB_ADJUST_CENTER : ts.Alignment = ::com::sun::star::style::TabAlign_CENTER; break;
+ case SVX_TAB_ADJUST_RIGHT : ts.Alignment = ::com::sun::star::style::TabAlign_RIGHT; break;
+ case SVX_TAB_ADJUST_DECIMAL: ts.Alignment = ::com::sun::star::style::TabAlign_DECIMAL; break;
+ case SVX_TAB_ADJUST_DEFAULT: ts.Alignment = ::com::sun::star::style::TabAlign_DEFAULT; break;
+ default: break; // prevent warning
+ }
+
+ tabs[0] = ts;
+ return tabs;
+}
+
/*************************************************************************
* SwTxtFrm::AdjustFollow()
* AdjustFollow expects the following situation:
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index b0c57acf4cb8..55ce5976ec88 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -81,6 +81,7 @@ SwFldPortion::SwFldPortion( const OUString &rExpand, SwFont *pFont, bool bPlaceH
, m_bNoLength( sal_False )
{
SetWhichPor( POR_FLD );
+ m_nAttrFldType = 0;
}
SwFldPortion::SwFldPortion( const SwFldPortion& rFld )
@@ -468,6 +469,10 @@ void SwFldPortion::HandlePortion( SwPortionHandler& rPH ) const
if (pFnt)
nH = pFnt->GetSize(pFnt->GetActual()).Height();
rPH.Special( GetLen(), aExpand, GetWhichPor(), nH );
+ if( GetWhichPor() == POR_FLD )
+ {
+ rPH.SetAttrFieldType(m_nAttrFldType);
+ }
}
/*************************************************************************
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index ef9f9567f7a2..21696895cf43 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -61,6 +61,7 @@ public:
SwFldPortion( const OUString &rExpand, SwFont *pFnt = 0, bool bPlaceHolder = false );
~SwFldPortion();
+ sal_uInt16 m_nAttrFldType;
void TakeNextOffset( const SwFldPortion* pFld );
void CheckScript( const SwTxtSizeInfo &rInf );
inline bool HasFont() const { return 0 != pFnt; }
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 22058c36b989..59b8936bc50c 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -48,7 +48,8 @@
#include "pagedesc.hxx"
#include <pormulti.hxx>
#include "fmtmeta.hxx"
-
+#include "reffld.hxx"
+#include "flddat.hxx"
/*************************************************************************
* SwTxtFormatter::NewFldPortion()
@@ -80,6 +81,7 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
SwCharFmt* pChFmt = 0;
bool bNewFlyPor = false;
+ sal_uInt16 subType = 0;
// set language
((SwTxtFormatter*)this)->SeekAndChg( rInf );
@@ -146,6 +148,8 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
: pFld->ExpandField(bInClipboard) );
pRet = new SwFldPortion( aStr );
}
+ if(pRet)
+ ((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_PAGECOOUNTFLD;
break;
case RES_PAGENUMBERFLD:
@@ -173,6 +177,8 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
: pFld->ExpandField(bInClipboard) );
pRet = new SwFldPortion( aStr );
}
+ if(pRet)
+ ((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_PAGENUMBERFLD;
break;
}
case RES_GETEXPFLD:
@@ -234,7 +240,38 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
bNewFlyPor = true;
bPlaceHolder = true;
break;
-
+ case RES_GETREFFLD:
+ subType = ((SwGetRefField*)pFld)->GetSubType();
+ {
+ OUString const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion(str);
+ }
+ if(pRet)
+ {
+ if( subType == REF_BOOKMARK )
+ ((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_BOOKMARKFLD;
+ else if( subType == REF_SETREFATTR )
+ ((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_SETREFATTRFLD;
+ break;
+ }
+ case RES_DATETIMEFLD:
+ subType = ((SwDateTimeField*)pFld)->GetSubType();
+ {
+ OUString const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion(str);
+ }
+ if(pRet)
+ {
+ if( subType & DATEFLD )
+ ((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_DATEFLD;
+ else if( subType & TIMEFLD )
+ ((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_TIMEFLD;
+ break;
+ }
default:
{
OUString const aStr( (bName)
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index e90c345efa2b..394266fe9da7 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -498,6 +498,30 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
{ SW_PROP_NMID(UNO_NAME_IS_FIELD_USED), FIELD_PROP_IS_FIELD_USED, CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::READONLY, 0},\
{ SW_PROP_NMID(UNO_NAME_IS_FIELD_DISPLAYED), FIELD_PROP_IS_FIELD_DISPLAYED, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::READONLY, 0},\
+#define COMMON_ACCESSIBILITY_TEXT_ATTRIBUTE \
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_COLOR), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_EMPHASIS), RES_CHRATR_EMPHASIS_MARK, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_EMPHASIS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ESC }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_HEIGHT), RES_CHRATR_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_POSTURE), RES_CHRATR_POSTURE , CPPU_E2T(CPPUTYPE_FONTSLANT), PropertyAttribute::MAYBEVOID, MID_POSTURE}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_TL_COLOR}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_WEIGHT), RES_CHRATR_WEIGHT , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_WEIGHT}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_LEVEL), RES_PARATR_LIST_LEVEL,CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_TL_STYLE}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_RULES), RES_PARATR_NUMRULE,CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_PARA_ADJUST}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_LO_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_FIRST_LINE_INDENT|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_TXT_LMARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_SPACING), RES_PARATR_LINESPACING, CPPU_E2T(CPPUTYPE_LINESPACE), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_R_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_TABSTOPS), RES_PARATR_TABSTOP, CPPU_E2T(CPPUTYPE_SEQTABSTOP), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+
const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(sal_uInt16 nPropertyId)
{
@@ -516,6 +540,16 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
aMapEntriesArr[nPropertyId] = aCharAndParaMap_Impl;
}
break;
+ case PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE:
+ {
+ static SfxItemPropertyMapEntry aAccessibilityTextAttrMap_Impl[] =
+ {
+ COMMON_ACCESSIBILITY_TEXT_ATTRIBUTE
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aAccessibilityTextAttrMap_Impl;
+ }
+ break;
case PROPERTY_MAP_PARAGRAPH:
{
static SfxItemPropertyMapEntry aParagraphMap_Impl[] =
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 0eca42131c5d..852768706b4e 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -316,6 +316,24 @@ void SwViewImp::MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
} while ( pTmp != pVSh );
}
+void SwViewImp::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage)
+{
+ if( IsAccessible() )
+ GetAccessibleMap().FirePageChangeEvent( nOldPage, nNewPage);
+}
+
+void SwViewImp::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection)
+{
+ if( IsAccessible() )
+ GetAccessibleMap().FireSectionChangeEvent(nOldSection, nNewSection);
+}
+
+void SwViewImp::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn)
+{
+ if( IsAccessible() )
+ GetAccessibleMap().FireColumnChangeEvent(nOldColumn, nNewColumn);
+}
+
void SwViewImp::InvalidateAccessibleFrmContent( const SwFrm *pFrm )
{
OSL_ENSURE( pFrm->IsAccessibleFrm(), "frame is not accessible" );
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 93a1294f8655..47db18eb99ad 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2029,7 +2029,7 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrmFmt& rFmt,
{
const SvxShadowItem* pSI = (const SvxShadowItem*)pShadItem;
- const sal_uInt16 nCstScale = 635; // unit scale between SODC and MS Word
+ const sal_uInt16 nCstScale = 635; // unit scale between AOO and MS Word
const sal_uInt32 nShadowType = 131074; // shadow type of ms word. need to set the default value.
sal_uInt32 nColor = (sal_uInt32)(pSI->GetColor().GetColor()) ;
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index 7da8e090503b..e4f95338416f 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -93,6 +93,7 @@
#include <unotools/fltrcfg.hxx>
#include <svtools/htmlcfg.hxx>
#include <sfx2/fcontnr.hxx>
+#include <sfx2/viewfrm.hxx>
#include <sfx2/objface.hxx>
#include <comphelper/storagehelper.hxx>
@@ -221,6 +222,20 @@ sal_Bool SwDocShell::ConvertFrom( SfxMedium& rMedium )
return sal_False; // #129881# return if no reader is found
SotStorageRef pStg=pRead->getSotStorageRef(); // #i45333# save sot storage ref in case of recursive calls
+ pDoc->setDocAccTitle(OUString());
+ SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this );
+ if (pFrame1)
+ {
+ Window* pWindow = &pFrame1->GetWindow();
+ if ( pWindow )
+ {
+ Window* pSysWin = pWindow->GetSystemWindow();
+ if ( pSysWin )
+ {
+ pSysWin->SetAccessibleName(OUString());
+ }
+ }
+ }
SwWait aWait( *this, sal_True );
// Suppress SfxProgress, when we are Embedded
@@ -1173,6 +1188,43 @@ uno::Reference< frame::XController >
return aRet;
}
+void SwDocShell::setDocAccTitle( const OUString& rTitle )
+{
+ if (pDoc)
+ {
+ pDoc->setDocAccTitle( rTitle );
+ }
+}
+
+const OUString SwDocShell::getDocAccTitle() const
+{
+ OUString sRet;
+ if (pDoc)
+ {
+ sRet = pDoc->getDocAccTitle();
+ }
+
+ return sRet;
+}
+
+void SwDocShell::setDocReadOnly(bool bReadOnly)
+{
+ if (pDoc)
+ {
+ pDoc->setDocReadOnly( bReadOnly );
+ }
+}
+
+bool SwDocShell::getDocReadOnly() const
+{
+ if (pDoc)
+ {
+ return pDoc->getDocReadOnly();
+ }
+
+ return sal_False;
+}
+
static const char* s_EventNames[] =
{
"OnPageCountChange",
diff --git a/sw/source/ui/cctrl/actctrl.cxx b/sw/source/ui/cctrl/actctrl.cxx
index c060f9a8d7eb..ff5beb57b6b9 100644
--- a/sw/source/ui/cctrl/actctrl.cxx
+++ b/sw/source/ui/cctrl/actctrl.cxx
@@ -89,8 +89,7 @@ void NoSpaceEdit::Modify()
SetText(sTemp);
SetSelection(aSel);
}
- if(GetModifyHdl().IsSet())
- GetModifyHdl().Call(this);
+ Edit::Modify();
}
ReturnActionEdit::ReturnActionEdit(Window* pParent, const ResId& rResId)
diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx
index 369f6c5fade7..d0d6091905bc 100644
--- a/sw/source/ui/chrdlg/swuiccoll.cxx
+++ b/sw/source/ui/chrdlg/swuiccoll.cxx
@@ -106,12 +106,15 @@ SwCondCollPage::SwCondCollPage(Window *pParent, const SfxItemSet &rSet)
break;
}
- const SfxStyleFilter& rFilterList = pFamilyItem->GetFilterList();
- for( size_t i = 0; i < rFilterList.size(); ++i )
+ if (pFamilyItem)
{
- m_pFilterLB->InsertEntry( rFilterList[ i ]->aName);
- sal_uInt16* pFilter = new sal_uInt16(rFilterList[i]->nFlags);
- m_pFilterLB->SetEntryData(i, pFilter);
+ const SfxStyleFilter& rFilterList = pFamilyItem->GetFilterList();
+ for( size_t i = 0; i < rFilterList.size(); ++i )
+ {
+ m_pFilterLB->InsertEntry( rFilterList[ i ]->aName);
+ sal_uInt16* pFilter = new sal_uInt16(rFilterList[i]->nFlags);
+ m_pFilterLB->SetEntryData(i, pFilter);
+ }
}
m_pFilterLB->SelectEntryPos(1);
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 9961006afa69..87be42ee6424 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -380,6 +380,7 @@ SwEditRegionDlg::SwEditRegionDlg( Window* pParent, SwWrtShell& rWrtSh )
m_pTree->SetSelectionMode( MULTIPLE_SELECTION );
m_pTree->SetStyle(m_pTree->GetStyle()|WB_HASBUTTONSATROOT|WB_CLIPCHILDREN|WB_HSCROLL);
m_pTree->SetSpaceBetweenEntries(0);
+ m_pTree->SetAllEntriesAccessibleRoleType(TREEBOX_ALLITEM_ACCROLE_TYPE_TREE);
if(bWeb)
{
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index ba6bc82e7267..00926b199e4f 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -6099,4 +6099,17 @@ Selection SwEditWin::GetSurroundingTextSelection() const
}
}
+// MT: Removed Windows::SwitchView() introduced with IA2 CWS.
+// There are other notifications for this when the active view has changed, so please update the code to use that event mechanism
+void SwEditWin::SwitchView()
+{
+#ifdef ACCESSIBLE_LAYOUT
+ if (!Application::IsAccessibilityEnabled())
+ {
+ return ;
+ }
+ rView.GetWrtShell().InvalidateAccessibleFocus();
+#endif
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/docvw/edtwin3.cxx b/sw/source/ui/docvw/edtwin3.cxx
index 35b00fb385a3..1ca1025a6c8d 100644
--- a/sw/source/ui/docvw/edtwin3.cxx
+++ b/sw/source/ui/docvw/edtwin3.cxx
@@ -103,6 +103,33 @@ sal_Bool SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt,
return !rRuler.StartDocDrag( rMEvt, RULER_TYPE_INDENT);
}
+void SwAccessibilityScrollMDI(SwViewShell* pVwSh, const SwRect& rRect , sal_uInt16 nRangeX, sal_uInt16 nRangeY, sal_Bool isLeftTop)
+{
+ SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
+ if (pSfxVwSh && pSfxVwSh->ISA(SwView))
+ {
+ SwView* pView = (SwView *)pSfxVwSh;
+
+ Size aSz( rRect.Left(), rRect.Top());
+ aSz = pView->GetEditWin().PixelToLogic( aSz );
+
+ Point aTopLeft( aSz.Width(), aSz.Height() );
+ Point aPoint;
+ Rectangle aRect(aTopLeft,aPoint);
+
+ sal_Bool bIsCrsrAtTop = pView->IsCrsrAtTop();
+ sal_Bool bIsCrsrAtCenter = pView->IsCrsrAtCenter();
+ if(isLeftTop)
+ pView->SetCrsrAtTop(sal_True);
+
+ pView->Scroll( aRect, nRangeX, nRangeY );
+
+ if(isLeftTop)
+ pView->SetCrsrAtTop(bIsCrsrAtTop, bIsCrsrAtCenter);
+ }
+
+}
+
Dialog* GetSearchDialog()
{
return SwView::GetSearchDialog();
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index e4d94794f5df..9532ce199fa0 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -451,7 +451,31 @@ SwColumnPage::SwColumnPage(Window *pParent, const SfxItemSet &rSet)
m_pDefaultVS->SetColCount( 5 );
for (int i = 0; i < 5; ++i)
- m_pDefaultVS->InsertItem( i + 1, i );
+ //Set accessible name one by one
+ {
+ OUString aItemText;
+ switch( i )
+ {
+ case 0:
+ aItemText = SW_RESSTR( STR_COLUMN_VALUESET_ITEM0 ) ;
+ break;
+ case 1:
+ aItemText = SW_RESSTR( STR_COLUMN_VALUESET_ITEM1 ) ;
+ break;
+ case 2:
+ aItemText = SW_RESSTR( STR_COLUMN_VALUESET_ITEM2 ) ;
+ break;
+ case 3:
+ aItemText = SW_RESSTR( STR_COLUMN_VALUESET_ITEM3 );
+ break;
+ case 4:
+ aItemText = SW_RESSTR( STR_COLUMN_VALUESET_ITEM4 );
+ break;
+ default:
+ break;
+ }
+ m_pDefaultVS->InsertItem( i + 1, aItemText, i );
+ }
m_pDefaultVS->SetSelectHdl(LINK(this, SwColumnPage, SetDefaultsHdl));
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index de476b5ef73c..7679f6a4c230 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -598,10 +598,12 @@ static sal_uLong lcl_GetLBRelationsForStrID( const FrmMap* _pMap,
--------------------------------------------------------------------*/
namespace
{
- void HandleAutoCB( sal_Bool _bChecked, FixedText& _rFT_man, FixedText& _rFT_auto )
+ void HandleAutoCB( sal_Bool _bChecked, FixedText& _rFT_man, FixedText& _rFT_auto, MetricField& _rPF_Edit)
{
_rFT_man.Show( !_bChecked );
_rFT_auto.Show( _bChecked );
+ OUString accName = _bChecked ? _rFT_auto.GetText() : _rFT_man.GetText();
+ _rPF_Edit.SetAccessibleName(accName);
}
}
@@ -2048,14 +2050,14 @@ IMPL_LINK_NOARG_INLINE_END(SwFrmPage, RealSizeHdl)
IMPL_LINK_NOARG(SwFrmPage, AutoWidthClickHdl)
{
if( !IsInGraficMode() )
- HandleAutoCB( m_pAutoWidthCB->IsChecked(), *m_pWidthFT, *m_pWidthAutoFT );
+ HandleAutoCB( m_pAutoWidthCB->IsChecked(), *m_pWidthFT, *m_pWidthAutoFT, *m_aWidthED.get() );
return 0;
}
IMPL_LINK_NOARG(SwFrmPage, AutoHeightClickHdl)
{
if( !IsInGraficMode() )
- HandleAutoCB( m_pAutoHeightCB->IsChecked(), *m_pHeightFT, *m_pHeightAutoFT );
+ HandleAutoCB( m_pAutoHeightCB->IsChecked(), *m_pHeightFT, *m_pHeightAutoFT, *m_aWidthED.get() );
return 0;
}
@@ -2200,14 +2202,14 @@ void SwFrmPage::Init(const SfxItemSet& rSet, sal_Bool bReset)
SwFrmSize eSize = rSize.GetHeightSizeType();
sal_Bool bCheck = eSize != ATT_FIX_SIZE;
m_pAutoHeightCB->Check( bCheck );
- HandleAutoCB( bCheck, *m_pHeightFT, *m_pHeightAutoFT );
+ HandleAutoCB( bCheck, *m_pHeightFT, *m_pHeightAutoFT, *m_aWidthED.get() );
if( eSize == ATT_VAR_SIZE )
m_aHeightED.SetValue( m_aHeightED.GetMin(), FUNIT_NONE );
eSize = rSize.GetWidthSizeType();
bCheck = eSize != ATT_FIX_SIZE;
m_pAutoWidthCB->Check( bCheck );
- HandleAutoCB( bCheck, *m_pWidthFT, *m_pWidthAutoFT );
+ HandleAutoCB( bCheck, *m_pWidthFT, *m_pWidthAutoFT, *m_aWidthED.get() );
if( eSize == ATT_VAR_SIZE )
m_aWidthED.SetValue( m_aWidthED.GetMin(), FUNIT_NONE );
diff --git a/sw/source/ui/inc/cnttab.hxx b/sw/source/ui/inc/cnttab.hxx
index 83c2a605b56a..7ea8b42e1814 100644
--- a/sw/source/ui/inc/cnttab.hxx
+++ b/sw/source/ui/inc/cnttab.hxx
@@ -73,7 +73,10 @@ class SwOLENames : public Resource
public:
SwOLENames(const ResId& rResId) :
Resource(rResId),
- aNamesAry(ResId(1,*rResId.GetResMgr())){FreeResource();}
+ aNamesAry(ResId(1,*rResId.GetResMgr()))
+ {
+ FreeResource();
+ }
ResStringArray& GetNames() { return aNamesAry;}
diff --git a/sw/source/ui/inc/conttree.hxx b/sw/source/ui/inc/conttree.hxx
index b10f5eb6439f..3029f69444dd 100644
--- a/sw/source/ui/inc/conttree.hxx
+++ b/sw/source/ui/inc/conttree.hxx
@@ -34,7 +34,7 @@ class ToolBox;
class SwGlblDocContents;
class SwGlblDocContent;
class SfxObjectShell;
-
+class SdrObject;
#define EDIT_MODE_EDIT 0
#define EDIT_MODE_UPD_IDX 1
@@ -91,6 +91,9 @@ class SwContentTree : public SvTreeListBox
static bool bIsInDrag;
+ bool bIsKeySpace;
+ Rectangle oldRectangle;
+
void FindActiveTypeAndRemoveUserData();
using SvTreeListBox::ExecuteDrop;
@@ -144,6 +147,9 @@ protected:
public:
SwContentTree(Window* pParent, const ResId& rResId);
~SwContentTree();
+ OUString GetEntryAltText( SvTreeListEntry* pEntry ) const;
+ OUString GetEntryLongDescription( SvTreeListEntry* pEntry ) const;
+ SdrObject* GetDrawingObjectsByContent(const SwContent *pCnt);
bool ToggleToRoot();
bool IsRoot() const {return bIsRoot;}
@@ -195,6 +201,7 @@ public:
virtual void KeyInput(const KeyEvent& rKEvt);
virtual sal_Bool Select( SvTreeListEntry* pEntry, sal_Bool bSelect=sal_True );
+ virtual sal_Int32 GetEntryRealChildrenNum( SvTreeListEntry* pEntry ) const;
};
diff --git a/sw/source/ui/inc/edtwin.hxx b/sw/source/ui/inc/edtwin.hxx
index 15b4e540f893..934c3f7aedd4 100644
--- a/sw/source/ui/inc/edtwin.hxx
+++ b/sw/source/ui/inc/edtwin.hxx
@@ -297,6 +297,7 @@ public:
SwEditWin(Window *pParent, SwView &);
virtual ~SwEditWin();
+ virtual void SwitchView();
};
#endif
diff --git a/sw/source/ui/inc/pview.hxx b/sw/source/ui/inc/pview.hxx
index 5128f3fad9a5..dd4f519cef0d 100644
--- a/sw/source/ui/inc/pview.hxx
+++ b/sw/source/ui/inc/pview.hxx
@@ -140,6 +140,7 @@ public:
virtual ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible>
CreateAccessible();
+ virtual void SwitchView();
};
/**
@@ -149,7 +150,7 @@ class SW_DLLPUBLIC SwPagePreview: public SfxViewShell
{
// ViewWindow and handle to core
// current dispatcher shell
- SwPagePreviewWin aViewWin;
+ SwPagePreviewWin* pViewWin;
//viewdata of the previous SwView and the new crsrposition
OUString sSwViewData;
//and the new cursor position if the user double click in the PagePreview
@@ -221,11 +222,11 @@ public:
TYPEINFO();
inline Window* GetFrameWindow() const { return &(GetViewFrame())->GetWindow(); }
- inline SwViewShell* GetViewShell() const { return aViewWin.GetViewShell(); }
+ inline SwViewShell* GetViewShell() const { return pViewWin->GetViewShell(); }
inline const Rectangle& GetVisArea() const { return aVisArea; }
- inline void GrabFocusViewWin() { aViewWin.GrabFocus(); }
+ inline void GrabFocusViewWin() { pViewWin->GrabFocus(); }
inline void RepaintCoreRect( const SwRect& rRect )
- { aViewWin.RepaintCoreRect( rRect ); }
+ { pViewWin->RepaintCoreRect( rRect ); }
void DocSzChgd(const Size& rNewSize);
const Size& GetDocSz() const { return aDocSz; }
@@ -241,8 +242,8 @@ public:
void EnableHScrollbar(bool bEnable);
void EnableVScrollbar(bool bEnable);
- sal_uInt16 GetPageCount() const { return mnPageCount; }
- sal_uInt16 GetSelectedPage() const {return aViewWin.SelectedPage();}
+ sal_uInt16 GetPageCount() const { return mnPageCount; }
+ sal_uInt16 GetSelectedPage() const {return pViewWin->SelectedPage();}
sal_Bool HandleWheelCommands( const CommandEvent& );
diff --git a/sw/source/ui/inc/swlbox.hxx b/sw/source/ui/inc/swlbox.hxx
index 073c1237ee03..3f2cfbf69213 100644
--- a/sw/source/ui/inc/swlbox.hxx
+++ b/sw/source/ui/inc/swlbox.hxx
@@ -79,7 +79,6 @@ public:
sal_uInt16 GetRemovedCount() const;
const SwBoxEntry& GetRemovedEntry(sal_uInt16 nPos) const;
-
};
#endif // INCLUDED_SW_SOURCE_UI_INC_SWLBOX_HXX
diff --git a/sw/source/ui/inc/swuicnttab.hxx b/sw/source/ui/inc/swuicnttab.hxx
index 17fd68287071..3b1a0f25a4db 100644
--- a/sw/source/ui/inc/swuicnttab.hxx
+++ b/sw/source/ui/inc/swuicnttab.hxx
@@ -259,6 +259,10 @@ class SwTokenWindow : public VclHBox, public VclBuilderContainer
Link aButtonSelectedHdl;
Control* pActiveCtrl;
Link aModifyHdl;
+ OUString accessibleName;
+ OUString sAdditionalAccnameString1;
+ OUString sAdditionalAccnameString2;
+ OUString sAdditionalAccnameString3;
SwTOXEntryTabPage* m_pParent;
@@ -312,6 +316,9 @@ public:
virtual void GetFocus();
virtual void setAllocation(const Size &rAllocation);
+ void SetFocus2theAllBtn();
+private:
+ sal_uInt32 GetControlIndex(FormTokenType eType) const;
};
class SwTOXEntryTabPage;
@@ -440,6 +447,8 @@ public:
OUString GetLevelHelp(sal_uInt16 nLevel) const;
void PreTokenButtonRemoved(const SwFormToken& rToken);
+ void SetFocus2theAllBtn();
+ virtual long Notify( NotifyEvent& rNEvt );
};
class SwTOXStylesTabPage : public SfxTabPage
diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx
index 3cdd59c63615..597468989adc 100644
--- a/sw/source/ui/inc/view.hxx
+++ b/sw/source/ui/inc/view.hxx
@@ -182,6 +182,9 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
// to support keyboard the number of the page to go to can be set too
sal_uInt16 m_nNewPage;
+ sal_uInt16 m_nOldPageNum;
+ OUString m_sOldSectionName;
+
Point m_aTabColFromDocPos; // moving table colmns out of the document
SwTxtNode * m_pNumRuleNodeFromDoc; // Moving indent of numrule #i23726#
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 554b4878b325..28a10b7ba6f4 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -1549,7 +1549,13 @@ void SwTOXEdit::KeyInput( const KeyEvent& rKEvt )
bNextControl = false;
bCall = true;
}
-
+ else if ( (aCode.GetCode() == KEY_F3) && aCode.IsShift() && !aCode.IsMod1() && !aCode.IsMod2() )
+ {
+ if ( m_pParent )
+ {
+ m_pParent->SetFocus2theAllBtn();
+ }
+ }
if(bCall && aPrevNextControlLink.IsSet())
aPrevNextControlLink.Call(this);
@@ -1678,6 +1684,13 @@ void SwTOXButton::KeyInput( const KeyEvent& rKEvt )
//this is invalid here
return;
}
+ else if ( (aCode.GetCode() == KEY_F3) && aCode.IsShift() && !aCode.IsMod1() && !aCode.IsMod2() )
+ {
+ if ( m_pParent )
+ {
+ m_pParent->SetFocus2theAllBtn();
+ }
+ }
if(bCall && aPrevNextControlLink.IsSet())
aPrevNextControlLink.Call(this);
else
@@ -2159,6 +2172,30 @@ void SwTOXEntryTabPage::PreTokenButtonRemoved(const SwFormToken& rToken)
m_pAuthFieldsLB->SetEntryData(nPos, (void*)(sal_uIntPtr)(nData));
}
+void SwTOXEntryTabPage::SetFocus2theAllBtn()
+{
+ m_pAllLevelsPB->GrabFocus();
+}
+
+long SwTOXEntryTabPage::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent& rKEvt = *rNEvt.GetKeyEvent();
+ KeyCode aCode = rKEvt.GetKeyCode();
+ if ( (aCode.GetCode() == KEY_F4) && aCode.IsShift() && !aCode.IsMod1() && !aCode.IsMod2() )
+ {
+ if ( m_pTokenWIN->GetActiveControl() )
+ {
+ m_pTokenWIN->GetActiveControl()->GrabFocus();
+ }
+ }
+
+ }
+
+ return SfxTabPage::Notify( rNEvt );
+}
+
// This function initializes the default value in the Token
// put here the UI dependent initializations
IMPL_LINK(SwTOXEntryTabPage, InsertTokenHdl, PushButton*, pBtn)
@@ -2592,6 +2629,11 @@ SwTokenWindow::SwTokenWindow(Window* pParent)
aButtonHelpTexts[i] = SW_RESSTR(nHelpId);
}
+ accessibleName = SW_RESSTR(STR_STRUCTURE);
+ sAdditionalAccnameString1 = SW_RESSTR(STR_ADDITIONAL_ACCNAME_STRING1);
+ sAdditionalAccnameString2 = SW_RESSTR(STR_ADDITIONAL_ACCNAME_STRING2);
+ sAdditionalAccnameString3 = SW_RESSTR(STR_ADDITIONAL_ACCNAME_STRING3);
+
Link aLink(LINK(this, SwTokenWindow, ScrollHdl));
m_pLeftScrollWin->SetClickHdl(aLink);
m_pRightScrollWin->SetClickHdl(aLink);
@@ -2756,6 +2798,30 @@ Control* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken&
aControlList.push_back(pEdit);
pEdit->SetText(rText);
+ sal_uInt32 nIndex = GetControlIndex( TOKEN_TEXT );
+ OUString s1 = " (";
+ OUString s2 = ")";
+ OUString s3 = ", ";
+ OUString strName(accessibleName);
+ strName += OUString::number(nIndex);
+ if ( nIndex == 1 )
+ {
+ /*Press left or right arrow to choose the structure controls*/
+ strName += s1;
+ strName += sAdditionalAccnameString2;
+ strName += s3;
+ /*Press Ctrl+Alt+A to move focus for more operations*/
+ strName += sAdditionalAccnameString1;
+ strName += s3;
+ /*Press Ctrl+Alt+B to move focus back to the current structure control*/
+ strName += sAdditionalAccnameString3;
+ strName += s2;
+ pEdit->SetAccessibleName(strName);
+ }
+ else
+ {
+ pEdit->SetAccessibleName(strName);
+ }
Size aEditSize(aControlSize);
aEditSize.Width() = pEdit->GetTextWidth(rText) + EDIT_MINWIDTH;
pEdit->SetSizePixel(aEditSize);
@@ -2788,6 +2854,16 @@ Control* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken&
pButton->SetText(sTmp.copy(0, 2));
}
+ OUString sSpace = " ";
+ sal_uInt32 nIndex = GetControlIndex( rToken.eTokenType );
+ OUString sAccName = aButtonHelpTexts[rToken.eTokenType];
+ if ( nIndex )
+ {
+ sAccName += sSpace;
+ sAccName += OUString::number(nIndex);
+ }
+ pButton->SetAccessibleName( sAccName );
+
pButton->Show();
pRet = pButton;
}
@@ -2939,6 +3015,30 @@ void SwTokenWindow::InsertAtSelection(const OUString& rText, const SwFormToken&
iterActive = aControlList.insert(iterActive, pEdit);
pEdit->SetText(sRight);
+ sal_uInt32 nIndex = GetControlIndex( TOKEN_TEXT );
+ OUString s1 = " (";
+ OUString s2 = ")";
+ OUString s3 = ", ";
+ OUString strName(accessibleName);
+ strName += OUString::number(nIndex);
+ if ( nIndex == 1)
+ {
+ /*Press left or right arrow to choose the structure controls*/
+ strName += s1;
+ strName += sAdditionalAccnameString2;
+ strName += s3;
+ /*Press Ctrl+Alt+A to move focus for more operations*/
+ strName += sAdditionalAccnameString1;
+ strName += s3;
+ /*Press Ctrl+Alt+B to move focus back to the current structure control*/
+ strName += sAdditionalAccnameString3;
+ strName += s2;
+ pEdit->SetAccessibleName(strName);
+ }
+ else
+ {
+ pEdit->SetAccessibleName(strName);
+ }
pEdit->SetSizePixel(aControlSize);
pEdit->AdjustSize();
pEdit->SetModifyHdl(LINK(this, SwTokenWindow, EditResize ));
@@ -3419,6 +3519,40 @@ void SwTokenWindow::GetFocus()
}
}
+void SwTokenWindow::SetFocus2theAllBtn()
+{
+ if (m_pParent)
+ {
+ m_pParent->SetFocus2theAllBtn();
+ }
+}
+
+sal_uInt32 SwTokenWindow::GetControlIndex(FormTokenType eType) const
+{
+ //there are only one entry-text button and only one page-number button,
+ //so we need not add index for these two buttons.
+ if ( eType == TOKEN_ENTRY_TEXT || eType == TOKEN_PAGE_NUMS )
+ {
+ return 0;
+ }
+
+ sal_uInt32 nIndex = 0;
+ for (ctrl_const_iterator it = aControlList.begin(); it != aControlList.end(); ++it)
+ {
+ const Control* pControl = *it;
+ const SwFormToken& rNewToken = WINDOW_EDIT == pControl->GetType()
+ ? ((SwTOXEdit*)pControl)->GetFormToken()
+ : ((SwTOXButton*)pControl)->GetFormToken();
+
+ if(eType == rNewToken.eTokenType)
+ {
+ ++nIndex;
+ }
+ }
+
+ return nIndex;
+}
+
SwTOXStylesTabPage::SwTOXStylesTabPage(Window* pParent, const SfxItemSet& rAttrSet )
: SfxTabPage(pParent, "TocStylesPage",
"modules/swriter/ui/tocstylespage.ui", rAttrSet)
diff --git a/sw/source/ui/index/cnttab.src b/sw/source/ui/index/cnttab.src
index 39baa4424bc8..e7f43ca52b1b 100644
--- a/sw/source/ui/index/cnttab.src
+++ b/sw/source/ui/index/cnttab.src
@@ -141,25 +141,45 @@ Resource RES_SRCTYPES
{
StringArray 1
{
-/* ids from tox.hxx
-TOO_MATH = 0x01,
-TOO_CHART = 0x02,
-TOO_IMAGE = 0x04,
-TOO_CALC = 0x08,
-TOO_DRAW_IMPRESS= 0x10,
-TOO_OTHER = 0x80*/
-
- ItemList [ en-US ] =
- {
- < "%PRODUCTNAME Math" ; 1;> ;
- < "%PRODUCTNAME Chart" ; 2;> ;
- < "%PRODUCTNAME Calc" ; 8;> ;
- < "%PRODUCTNAME Draw/%PRODUCTNAME Impress" ; 16;> ;
- < "Other OLE Objects"; 128;> ;
+ /* ids from tox.hxx
+ TOO_MATH = 0x01,
+ TOO_CHART = 0x02,
+ TOO_IMAGE = 0x04,
+ TOO_CALC = 0x08,
+ TOO_DRAW_IMPRESS= 0x10,
+ TOO_OTHER = 0x80
+ */
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Math" ; 1;> ;
+ < "%PRODUCTNAME Chart" ; 2;> ;
+ < "%PRODUCTNAME Calc" ; 8;> ;
+ < "%PRODUCTNAME Draw/%PRODUCTNAME Impress" ; 16;> ;
+ < "Other OLE Objects"; 128;> ;
};
};
};
+String STR_STRUCTURE
+{
+ Text [ en-US ] = "Structure text";
+};
+
+String STR_ADDITIONAL_ACCNAME_STRING1
+{
+ Text [ en-US ] = "Press Ctrl+Alt+A to move focus for more operations";
+};
+
+String STR_ADDITIONAL_ACCNAME_STRING2
+{
+ Text [ en-US ] = "Press left or right arrow to choose the structure controls";
+};
+
+String STR_ADDITIONAL_ACCNAME_STRING3
+{
+ Text [ en-US ] = "Press Ctrl+Alt+B to move focus back to the current structure control";
+};
+
String STR_AUTOMARK_TYPE
{
Text [ en-US ] = "Selection file for the alphabetical index (*.sdi)";
diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx
index 1f08fbabb0a6..8112b55a95cd 100644
--- a/sw/source/ui/ribbar/inputwin.cxx
+++ b/sw/source/ui/ribbar/inputwin.cxx
@@ -42,6 +42,7 @@
#include "cellatr.hxx"
#include "edtwin.hxx"
#include "helpid.h"
+#include "access.hrc"
// Only for the UpdateRange: Delete the box in which the stacked cursor is positioned.
#include "pam.hxx"
@@ -82,9 +83,14 @@ SwInputWindow::SwInputWindow( Window* pParent, SfxBindings* pBind )
pWrtShell = pView ? pView->GetWrtShellPtr() : 0;
InsertWindow( ED_POS, &aPos, 0, 0);
+ SetItemText(ED_POS, SW_RESSTR(STR_ACCESS_FORMULA_TYPE));
+ aPos.SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TYPE));
+ SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TOOLBAR));
InsertSeparator ( 1 );
InsertSeparator ();
InsertWindow( ED_FORMULA, &aEdit);
+ SetItemText(ED_FORMULA, SW_RESSTR(STR_ACCESS_FORMULA_TEXT));
+ aEdit.SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TEXT));
SetHelpId(ED_FORMULA, HID_EDIT_FORMULA);
SetItemImage( FN_FORMULA_CALC, pManager->GetImage(FN_FORMULA_CALC ));
diff --git a/sw/source/ui/ribbar/inputwin.hrc b/sw/source/ui/ribbar/inputwin.hrc
index 9b5af0eb1f2a..5e168a0d0552 100644
--- a/sw/source/ui/ribbar/inputwin.hrc
+++ b/sw/source/ui/ribbar/inputwin.hrc
@@ -54,6 +54,9 @@
#define ED_POS 2
#define ED_FORMULA 3
+#define STR_ED_POS 1
+#define STR_ED_FORMULA 2
+#define STR_TOOLBAR_FORMULA 35
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/ribbar/inputwin.src b/sw/source/ui/ribbar/inputwin.src
index 9ca654f63b56..d228bbeed267 100644
--- a/sw/source/ui/ribbar/inputwin.src
+++ b/sw/source/ui/ribbar/inputwin.src
@@ -24,6 +24,8 @@
#include "globals.hrc"
#include "ribbar.hrc"
#include "inputwin.hrc"
+#include "access.hrc"
+
ToolBox RID_TBX_FORMULA
{
Pos = MAP_APPFONT ( 0 , 0 ) ;
@@ -270,4 +272,19 @@ String STR_TBL_FORMULA
Text [ en-US ] = "Text formula" ;
};
+String STR_ACCESS_FORMULA_TOOLBAR
+{
+ Text [ en-US ] = "Formula Tool Bar" ;
+};
+
+String STR_ACCESS_FORMULA_TYPE
+{
+ Text [ en-US ] = "Formula Type" ;
+};
+
+String STR_ACCESS_FORMULA_TEXT
+{
+ Text [ en-US ] = "Formula Text" ;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/ribbar/workctrl.cxx b/sw/source/ui/ribbar/workctrl.cxx
index f9fccd5fc259..95d2cad23790 100644
--- a/sw/source/ui/ribbar/workctrl.cxx
+++ b/sw/source/ui/ribbar/workctrl.cxx
@@ -474,6 +474,13 @@ SwScrollNaviPopup::SwScrollNaviPopup(sal_uInt16 nId, const Reference< XFrame >&
sText = SW_RESSTR(nResStr);
nTbxBits = TIB_CHECKABLE;
}
+ else
+ {
+ if (nNaviId == NID_PREV)
+ sText = SW_RESSTR(STR_IMGBTN_PGE_UP);
+ else if (nNaviId == NID_NEXT)
+ sText = SW_RESSTR(STR_IMGBTN_PGE_DOWN);
+ }
aToolBox.InsertItem(nNaviId, sText, nTbxBits);
aToolBox.SetHelpId( nNaviId, aNavigationHelpIds[i] );
}
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index 547657534fcb..091058ef6f84 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -1101,8 +1101,31 @@ void SwTextShell::Execute(SfxRequest &rReq)
case SID_DEC_INDENT:
case SID_INC_INDENT:
- rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
+ //According to the requirement, modified the behavior when user
+ //using the indent button on the toolbar. Now if we increase/decrease indent for a
+ //paragraph which has bullet style it will increase/decrease the bullet level.
+ {
+ //If the current paragraph has bullet call the function to
+ //increase or decrease the bullet level.
+ //Why could I know wheter a paragraph has bullet or not by checking the below conditions?
+ //Please refer to the "case KEY_TAB:" section in SwEditWin::KeyInput(..) :
+ // if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
+ // !rSh.HasReadonlySel() )
+ // eKeyState = KS_NumDown;
+ //Above code demonstrates that when the cursor is at the start of a paragraph which has bullet,
+ //press TAB will increase the bullet level.
+ //So I copied from that ^^
+ if ( rWrtSh.GetCurNumRule() && !rWrtSh.HasReadonlySel() )
+ {
+ rWrtSh.NumUpDown( SID_INC_INDENT == nSlot );
+ }
+ else//execute the original processing functions
+ {
+ //below is copied of the old codes
+ rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
rReq.GetModifier() != KEY_MOD1 );
+ }
+ }
rReq.Done();
break;
case FN_DEC_INDENT_OFFSET:
@@ -1480,11 +1503,27 @@ void SwTextShell::GetState( SfxItemSet &rSet )
case SID_DEC_INDENT:
case SID_INC_INDENT:
{
- sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
- nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
- if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
- SID_INC_INDENT == nWhich, true ))
- rSet.DisableItem( nWhich );
+ //if the paragrah has bullet we'll do the following things:
+ //1: if the bullet level is the first level, disable the decrease-indent button
+ //2: if the bullet level is the last level, disable the increase-indent button
+ if ( rSh.GetCurNumRule() && !rSh.HasReadonlySel() )
+ {
+ sal_uInt8 nLevel = rSh.GetNumLevel();
+ if ( (nLevel == (MAXLEVEL-1) && nWhich == SID_INC_INDENT) ||
+ (nLevel == 0 && nWhich == SID_DEC_INDENT) )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ }
+ else//if the paragraph has no bullet, execute the original functions
+ {
+ //below is copied of the old codes
+ sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
+ nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
+ if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
+ SID_INC_INDENT == nWhich, true ))
+ rSet.DisableItem( nWhich );
+ }
}
break;
diff --git a/sw/source/ui/shells/txtnum.cxx b/sw/source/ui/shells/txtnum.cxx
index d3b716f15ffd..bfea396f0117 100644
--- a/sw/source/ui/shells/txtnum.cxx
+++ b/sw/source/ui/shells/txtnum.cxx
@@ -315,7 +315,7 @@ void SwTextShell::ExecSetNumber(SfxRequest &rReq)
numfunc::GetDefaultPositionAndSpaceMode() );
SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
- //Sym3_2508, set unit attribute to NB Manager
+ // set unit attribute to NB Manager
SfxItemSet aSet(GetPool(),
SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
0 );
@@ -368,7 +368,7 @@ void SwTextShell::ExecSetNumber(SfxRequest &rReq)
numfunc::GetDefaultPositionAndSpaceMode() );
SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
- //Sym3_2508, set unit attribute to NB Manager
+ // set unit attribute to NB Manager
SfxItemSet aSet(GetPool(),
SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
0 );
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
index cf2263ac2c46..1af32ed76c9c 100644
--- a/sw/source/ui/uiview/pview.cxx
+++ b/sw/source/ui/uiview/pview.cxx
@@ -185,7 +185,6 @@ SwPagePreviewWin::SwPagePreviewWin( Window *pParent, SwPagePreview& rPView )
SwPagePreviewWin::~SwPagePreviewWin()
{
- delete mpViewShell;
}
void SwPagePreviewWin::Paint( const Rectangle& rRect )
@@ -609,46 +608,46 @@ void SwPagePreview::_ExecPgUpAndPgDown( const bool _bPgUp,
SwPagePreviewWin::MV_PAGE_UP :
SwPagePreviewWin::MV_PAGE_DOWN;
if ( ChgPage( eMvMode, sal_True ) )
- aViewWin.Invalidate();
+ pViewWin->Invalidate();
}
else
{
SwTwips nScrollAmount;
sal_uInt16 nNewSelectedPageNum = 0;
- const sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol();
+ const sal_uInt16 nVisPages = pViewWin->GetRow() * pViewWin->GetCol();
if( _bPgUp )
{
if ( pPagePreviewLay->DoesPreviewLayoutRowsFitIntoWindow() )
{
nScrollAmount = pPagePreviewLay->GetWinPagesScrollAmount( -1 );
- if ( (aViewWin.SelectedPage() - nVisPages) > 0 )
- nNewSelectedPageNum = aViewWin.SelectedPage() - nVisPages;
+ if ( (pViewWin->SelectedPage() - nVisPages) > 0 )
+ nNewSelectedPageNum = pViewWin->SelectedPage() - nVisPages;
else
nNewSelectedPageNum = 1;
}
else
- nScrollAmount = - std::min( aViewWin.GetOutputSize().Height(),
- aViewWin.GetPaintedPreviewDocRect().Top() );
+ nScrollAmount = - std::min( pViewWin->GetOutputSize().Height(),
+ pViewWin->GetPaintedPreviewDocRect().Top() );
}
else
{
if ( pPagePreviewLay->DoesPreviewLayoutRowsFitIntoWindow() )
{
nScrollAmount = pPagePreviewLay->GetWinPagesScrollAmount( 1 );
- if ( (aViewWin.SelectedPage() + nVisPages) <= mnPageCount )
- nNewSelectedPageNum = aViewWin.SelectedPage() + nVisPages;
+ if ( (pViewWin->SelectedPage() + nVisPages) <= mnPageCount )
+ nNewSelectedPageNum = pViewWin->SelectedPage() + nVisPages;
else
nNewSelectedPageNum = mnPageCount;
}
else
- nScrollAmount = std::min( aViewWin.GetOutputSize().Height(),
+ nScrollAmount = std::min( pViewWin->GetOutputSize().Height(),
( pPagePreviewLay->GetPreviewDocSize().Height() -
- aViewWin.GetPaintedPreviewDocRect().Bottom() ) );
+ pViewWin->GetPaintedPreviewDocRect().Bottom() ) );
}
- aViewWin.Scroll( 0, nScrollAmount );
+ pViewWin->Scroll( 0, nScrollAmount );
if ( nNewSelectedPageNum != 0 )
{
- aViewWin.SetSelectedPage( nNewSelectedPageNum );
+ pViewWin->SetSelectedPage( nNewSelectedPageNum );
}
ScrollViewSzChg();
// additional invalidate page status.
@@ -659,7 +658,7 @@ void SwPagePreview::_ExecPgUpAndPgDown( const bool _bPgUp,
};
SfxBindings& rBindings = GetViewFrame()->GetBindings();
rBindings.Invalidate( aInval );
- aViewWin.Invalidate();
+ pViewWin->Invalidate();
}
}
@@ -691,11 +690,11 @@ void SwPagePreview::Execute( SfxRequest &rReq )
SID_ATTR_TABLE_COLUMN)).GetValue();
sal_uInt8 nRows = (sal_uInt8)((SfxUInt16Item &)pArgs->Get(
SID_ATTR_TABLE_ROW)).GetValue();
- aViewWin.CalcWish( nRows, nCols );
+ pViewWin->CalcWish( nRows, nCols );
}
else
- SwPreviewZoomDlg( aViewWin ).Execute();
+ SwPreviewZoomDlg( *pViewWin ).Execute();
}
break;
@@ -710,7 +709,7 @@ void SwPagePreview::Execute( SfxRequest &rReq )
( ( SwViewOption* ) GetViewShell()->GetViewOptions() )->SetPagePrevBookview( bBookPreview );
// cast is not gentleman like, but it's common use in writer and in this case
}
- if ( aViewWin.SetBookPreviewMode( bBookPreview ) )
+ if ( pViewWin->SetBookPreviewMode( bBookPreview ) )
{
// book preview mode changed. Thus, adjust scrollbars and
// invalidate corresponding states.
@@ -722,13 +721,13 @@ void SwPagePreview::Execute( SfxRequest &rReq )
};
SfxBindings& rBindings = GetViewFrame()->GetBindings();
rBindings.Invalidate( aInval );
- aViewWin.Invalidate();
+ pViewWin->Invalidate();
}
}
break;
case FN_SHOW_TWO_PAGES:
- aViewWin.CalcWish( nRow, 2 );
+ pViewWin->CalcWish( nRow, 2 );
break;
case FN_PREVIEW_ZOOM:
@@ -822,7 +821,7 @@ void SwPagePreview::Execute( SfxRequest &rReq )
}
pPagePreviewLay->CalcStartValuesForSelectedPageMove( nHoriMove, nVertMove,
nNewSelectedPage, nNewStartPage, aNewStartPos );
- if ( aViewWin.SelectedPage() != nNewSelectedPage )
+ if ( pViewWin->SelectedPage() != nNewSelectedPage )
{
if ( pPagePreviewLay->IsPageVisible( nNewSelectedPage ) )
{
@@ -833,8 +832,8 @@ void SwPagePreview::Execute( SfxRequest &rReq )
}
else
{
- aViewWin.SetSelectedPage( nNewSelectedPage );
- aViewWin.SetSttPage( nNewStartPage );
+ pViewWin->SetSelectedPage( nNewSelectedPage );
+ pViewWin->SetSttPage( nNewStartPage );
int nRet = ChgPage( SwPagePreviewWin::MV_SELPAGE, sal_True );
bRefresh = 0 != nRet;
}
@@ -862,11 +861,11 @@ void SwPagePreview::Execute( SfxRequest &rReq )
}
case FN_START_OF_LINE:
case FN_START_OF_DOCUMENT:
- aViewWin.SetSelectedPage( 1 );
+ pViewWin->SetSelectedPage( 1 );
eMvMode = SwPagePreviewWin::MV_DOC_STT; bRetVal = true; goto MOVEPAGE;
case FN_END_OF_LINE:
case FN_END_OF_DOCUMENT:
- aViewWin.SetSelectedPage( mnPageCount );
+ pViewWin->SetSelectedPage( mnPageCount );
eMvMode = SwPagePreviewWin::MV_DOC_END; bRetVal = true; goto MOVEPAGE;
MOVEPAGE:
{
@@ -882,7 +881,7 @@ MOVEPAGE:
case FN_PRINT_PAGEPREVIEW:
{
- const SwPagePreviewPrtData* pPPVPD = aViewWin.GetViewShell()->GetDoc()->GetPreviewPrtData();
+ const SwPagePreviewPrtData* pPPVPD = pViewWin->GetViewShell()->GetDoc()->GetPreviewPrtData();
// The thing with the orientation
if(pPPVPD)
{
@@ -891,7 +890,7 @@ MOVEPAGE:
!= pPPVPD->GetLandscape())
pPrinter->SetOrientation(pPPVPD->GetLandscape() ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT);
}
- ::SetAppPrintOptions( aViewWin.GetViewShell(), sal_False );
+ ::SetAppPrintOptions( pViewWin->GetViewShell(), sal_False );
bNormalPrint = sal_False;
sal_uInt16 nPrtSlot = SID_PRINTDOC;
rReq.SetSlot( nPrtSlot );
@@ -901,7 +900,7 @@ MOVEPAGE:
}
case SID_PRINTDOCDIRECT:
case SID_PRINTDOC:
- ::SetAppPrintOptions( aViewWin.GetViewShell(), sal_False );
+ ::SetAppPrintOptions( pViewWin->GetViewShell(), sal_False );
bNormalPrint = sal_True;
SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() );
return;
@@ -914,7 +913,7 @@ MOVEPAGE:
break;
case FN_INSERT_BREAK:
{
- sal_uInt16 nSelPage = aViewWin.SelectedPage();
+ sal_uInt16 nSelPage = pViewWin->SelectedPage();
//if a dummy page is selected (e.g. a non-existing right/left page)
//the direct neighbor is used
if(GetViewShell()->IsDummyPage( nSelPage ) && GetViewShell()->IsDummyPage( --nSelPage ))
@@ -931,7 +930,7 @@ MOVEPAGE:
}
if( bRefresh )
- aViewWin.Invalidate();
+ pViewWin->Invalidate();
}
void SwPagePreview::GetState( SfxItemSet& rSet )
@@ -977,7 +976,7 @@ void SwPagePreview::GetState( SfxItemSet& rSet )
case FN_STAT_PAGE:
{
- OUString aStr = sPageStr + aViewWin.GetStatusStr( mnPageCount );
+ OUString aStr = sPageStr + pViewWin->GetStatusStr( mnPageCount );
rSet.Put( SfxStringItem( nWhich, aStr) );
}
break;
@@ -1034,7 +1033,7 @@ void SwPagePreview::GetState( SfxItemSet& rSet )
break;
case FN_SHOW_TWO_PAGES:
- if( 2 == aViewWin.GetCol() && nRow == aViewWin.GetRow() )
+ if( 2 == pViewWin->GetCol() && nRow == pViewWin->GetRow() )
rSet.DisableItem( nWhich );
break;
@@ -1143,7 +1142,7 @@ void SwPagePreview::Init(const SwViewOption * pPrefs)
SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
SfxViewShell( pViewFrame, SWVIEWFLAGS ),
- aViewWin( &pViewFrame->GetWindow(), *this ),
+ pViewWin( new SwPagePreviewWin(&(GetViewFrame())->GetWindow(), *this ) ),
nNewPage(USHRT_MAX),
sPageStr(SW_RES(STR_PAGE)),
pHScrollbar(0),
@@ -1155,7 +1154,7 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
mbFormDesignModeToReset( false )
{
SetName(OUString("PageView" ));
- SetWindow( &aViewWin );
+ SetWindow( pViewWin );
SetHelpId(SW_PAGEPREVIEW);
_CreateScrollbar( sal_True );
_CreateScrollbar( sal_False );
@@ -1190,9 +1189,9 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
// Set the current page as the first.
sal_uInt16 nPhysPg, nVirtPg;
((SwCrsrShell*)pVS)->GetPageNum( nPhysPg, nVirtPg, sal_True, sal_False );
- if( 1 != aViewWin.GetCol() && 1 == nPhysPg )
+ if( 1 != pViewWin->GetCol() && 1 == nPhysPg )
--nPhysPg;
- aViewWin.SetSttPage( nPhysPg );
+ pViewWin->SetSttPage( nPhysPg );
}
}
@@ -1205,13 +1204,13 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
}
if( pVS )
- pNew = new SwViewShell( *pVS, &aViewWin, 0, VSHELLFLAG_ISPREVIEW );
+ pNew = new SwViewShell( *pVS, pViewWin, 0, VSHELLFLAG_ISPREVIEW );
else
pNew = new SwViewShell(
*((SwDocShell*)pViewFrame->GetObjectShell())->GetDoc(),
- &aViewWin, 0, 0, VSHELLFLAG_ISPREVIEW );
+ pViewWin, 0, 0, VSHELLFLAG_ISPREVIEW );
- aViewWin.SetViewShell( pNew );
+ pViewWin->SetViewShell( pNew );
pNew->SetSfxViewShell( this );
Init();
}
@@ -1219,6 +1218,10 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
SwPagePreview::~SwPagePreview()
{
SetWindow( 0 );
+ SwViewShell* pVShell = pViewWin->GetViewShell();
+ pVShell->SetWin(0);
+ delete pVShell;
+ delete pViewWin;
delete pScrollFill;
delete pHScrollbar;
@@ -1252,16 +1255,16 @@ int SwPagePreview::_CreateScrollbar( sal_Bool bHori )
int SwPagePreview::ChgPage( int eMvMode, int bUpdateScrollbar )
{
- Rectangle aPixVisArea( aViewWin.LogicToPixel( aVisArea ) );
- int bChg = aViewWin.MovePage( eMvMode ) ||
+ Rectangle aPixVisArea( pViewWin->LogicToPixel( aVisArea ) );
+ int bChg = pViewWin->MovePage( eMvMode ) ||
eMvMode == SwPagePreviewWin::MV_CALC ||
eMvMode == SwPagePreviewWin::MV_NEWWINSIZE;
- aVisArea = aViewWin.PixelToLogic( aPixVisArea );
+ aVisArea = pViewWin->PixelToLogic( aPixVisArea );
if( bChg )
{
// Update statusbar
- OUString aStr = sPageStr + aViewWin.GetStatusStr( mnPageCount );
+ OUString aStr = sPageStr + pViewWin->GetStatusStr( mnPageCount );
SfxBindings& rBindings = GetViewFrame()->GetBindings();
if( bUpdateScrollbar )
@@ -1283,7 +1286,7 @@ int SwPagePreview::ChgPage( int eMvMode, int bUpdateScrollbar )
// From here, everything was taken from the SwView.
void SwPagePreview::CalcAndSetBorderPixel( SvBorder &rToFill, sal_Bool /*bInner*/ )
{
- const StyleSettings &rSet = aViewWin.GetSettings().GetStyleSettings();
+ const StyleSettings &rSet = pViewWin->GetSettings().GetStyleSettings();
const long nTmp = rSet.GetScrollBarSize();
if ( pVScrollbar->IsVisible( true ) )
rToFill.Right() = nTmp;
@@ -1298,8 +1301,8 @@ void SwPagePreview::InnerResizePixel( const Point &rOfst, const Size &rSize )
CalcAndSetBorderPixel( aBorder, sal_True );
Rectangle aRect( rOfst, rSize );
aRect += aBorder;
- ViewResizePixel( aViewWin, aRect.TopLeft(), aRect.GetSize(),
- aViewWin.GetOutputSizePixel(),
+ ViewResizePixel( *pViewWin, aRect.TopLeft(), aRect.GetSize(),
+ pViewWin->GetOutputSizePixel(),
*pVScrollbar, *pHScrollbar, *pScrollFill );
// Never set EditWin !
@@ -1313,8 +1316,8 @@ void SwPagePreview::OuterResizePixel( const Point &rOfst, const Size &rSize )
// Never set EditWin !
- Size aTmpSize( aViewWin.GetOutputSizePixel() );
- Point aBottomRight( aViewWin.PixelToLogic( Point( aTmpSize.Width(), aTmpSize.Height() ) ) );
+ Size aTmpSize( pViewWin->GetOutputSizePixel() );
+ Point aBottomRight( pViewWin->PixelToLogic( Point( aTmpSize.Width(), aTmpSize.Height() ) ) );
SetVisArea( Rectangle( Point(), aBottomRight ) );
// Call of the DocSzChgd-Methode of the scrollbars is necessary,
@@ -1327,7 +1330,7 @@ void SwPagePreview::OuterResizePixel( const Point &rOfst, const Size &rSize )
SvBorder aBorderNew;
CalcAndSetBorderPixel( aBorderNew, sal_False );
- ViewResizePixel( aViewWin, rOfst, rSize, aViewWin.GetOutputSizePixel(),
+ ViewResizePixel( *pViewWin, rOfst, rSize, pViewWin->GetOutputSizePixel(),
*pVScrollbar, *pHScrollbar, *pScrollFill );
}
@@ -1369,14 +1372,14 @@ void SwPagePreview::SetVisArea( const Rectangle &rRect, sal_Bool bUpdateScrollba
// because then we do not really paint but the rectangles are just
// bookmarked (in document coordinates).
if( GetViewShell()->ActionPend() )
- aViewWin.Update();
+ pViewWin->Update();
// Set at View-Win the current size
aVisArea = aLR;
- aViewWin.SetWinSize( aLR.GetSize() );
+ pViewWin->SetWinSize( aLR.GetSize() );
ChgPage( SwPagePreviewWin::MV_NEWWINSIZE, bUpdateScrollbar );
- aViewWin.Invalidate();
+ pViewWin->Invalidate();
}
IMPL_LINK( SwPagePreview, ScrollHdl, SwScrollbar *, pScrollbar )
@@ -1391,7 +1394,7 @@ IMPL_LINK( SwPagePreview, ScrollHdl, SwScrollbar *, pScrollbar )
// Scroll how many pages??
OUString sStateStr(sPageStr);
sal_uInt16 nThmbPos = (sal_uInt16)pScrollbar->GetThumbPos();
- if( 1 == aViewWin.GetCol() || !nThmbPos )
+ if( 1 == pViewWin->GetCol() || !nThmbPos )
++nThmbPos;
sStateStr += OUString::number( nThmbPos );
Point aPos = pScrollbar->GetParent()->OutputToScreenPixel(
@@ -1429,7 +1432,7 @@ IMPL_LINK( SwPagePreview, EndScrollHdl, SwScrollbar *, pScrollbar )
// Scroll how many pages ??
sal_uInt16 nThmbPos = (sal_uInt16)pScrollbar->GetThumbPos();
// adjust to new preview functionality
- if( nThmbPos != aViewWin.SelectedPage() )
+ if( nThmbPos != pViewWin->SelectedPage() )
{
// consider case that page <nThmbPos>
// is already visible
@@ -1446,8 +1449,8 @@ IMPL_LINK( SwPagePreview, EndScrollHdl, SwScrollbar *, pScrollbar )
// fit or not.
if ( !pPagePreviewLay->DoesPreviewLayoutColsFitIntoWindow() )
{
- aViewWin.SetSttPage( nThmbPos );
- aViewWin.SetSelectedPage( nThmbPos );
+ pViewWin->SetSttPage( nThmbPos );
+ pViewWin->SetSelectedPage( nThmbPos );
ChgPage( SwPagePreviewWin::MV_SCROLL, sal_False );
// update scrollbars
ScrollViewSzChg();
@@ -1455,16 +1458,16 @@ IMPL_LINK( SwPagePreview, EndScrollHdl, SwScrollbar *, pScrollbar )
else
{
// correct scroll amount
- const sal_Int16 nPageDiff = nThmbPos - aViewWin.SelectedPage();
- const sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol();
+ const sal_Int16 nPageDiff = nThmbPos - pViewWin->SelectedPage();
+ const sal_uInt16 nVisPages = pViewWin->GetRow() * pViewWin->GetCol();
sal_Int16 nWinPagesToScroll = nPageDiff / nVisPages;
if ( nPageDiff % nVisPages )
{
// decrease/increase number of preview pages to scroll
nPageDiff < 0 ? --nWinPagesToScroll : ++nWinPagesToScroll;
}
- aViewWin.SetSelectedPage( nThmbPos );
- aViewWin.Scroll( 0, pPagePreviewLay->GetWinPagesScrollAmount( nWinPagesToScroll ) );
+ pViewWin->SetSelectedPage( nThmbPos );
+ pViewWin->Scroll( 0, pPagePreviewLay->GetWinPagesScrollAmount( nWinPagesToScroll ) );
}
}
// update accessibility
@@ -1479,13 +1482,13 @@ IMPL_LINK( SwPagePreview, EndScrollHdl, SwScrollbar *, pScrollbar )
else
{
long nThmbPos = pScrollbar->GetThumbPos();
- aViewWin.Scroll(0, nThmbPos - aViewWin.GetPaintedPreviewDocRect().Top());
+ pViewWin->Scroll(0, nThmbPos - pViewWin->GetPaintedPreviewDocRect().Top());
}
}
else
{
long nThmbPos = pScrollbar->GetThumbPos();
- aViewWin.Scroll(nThmbPos - aViewWin.GetPaintedPreviewDocRect().Left(), 0);
+ pViewWin->Scroll(nThmbPos - pViewWin->GetPaintedPreviewDocRect().Left(), 0);
}
// additional invalidate page status.
static sal_uInt16 aInval[] =
@@ -1498,14 +1501,14 @@ IMPL_LINK( SwPagePreview, EndScrollHdl, SwScrollbar *, pScrollbar )
// control invalidation of window
if ( bInvalidateWin )
{
- aViewWin.Invalidate();
+ pViewWin->Invalidate();
}
return 0;
}
Point SwPagePreview::AlignToPixel(const Point &rPt) const
{
- return aViewWin.PixelToLogic( aViewWin.LogicToPixel( rPt ) );
+ return pViewWin->PixelToLogic( pViewWin->LogicToPixel( rPt ) );
}
void SwPagePreview::DocSzChgd( const Size &rSz )
@@ -1525,7 +1528,7 @@ void SwPagePreview::DocSzChgd( const Size &rSz )
ChgPage( SwPagePreviewWin::MV_CALC, sal_True );
ScrollDocSzChg();
- aViewWin.Invalidate();
+ pViewWin->Invalidate();
}
}
@@ -1542,21 +1545,21 @@ void SwPagePreview::ScrollViewSzChg()
{
//vertical scrolling by row
// adjust to new preview functionality
- sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol();
+ sal_uInt16 nVisPages = pViewWin->GetRow() * pViewWin->GetCol();
pVScrollbar->SetVisibleSize( nVisPages );
// set selected page as scroll bar position,
// if it is visible.
SwPagePreviewLayout* pPagePreviewLay = GetViewShell()->PagePreviewLayout();
- if ( pPagePreviewLay->IsPageVisible( aViewWin.SelectedPage() ) )
+ if ( pPagePreviewLay->IsPageVisible( pViewWin->SelectedPage() ) )
{
- pVScrollbar->SetThumbPos( aViewWin.SelectedPage() );
+ pVScrollbar->SetThumbPos( pViewWin->SelectedPage() );
}
else
{
- pVScrollbar->SetThumbPos( aViewWin.GetSttPage() );
+ pVScrollbar->SetThumbPos( pViewWin->GetSttPage() );
}
- pVScrollbar->SetLineSize( aViewWin.GetCol() );
+ pVScrollbar->SetLineSize( pViewWin->GetCol() );
pVScrollbar->SetPageSize( nVisPages );
// calculate and set scrollbar range
Range aScrollbarRange( 1, mnPageCount );
@@ -1570,7 +1573,7 @@ void SwPagePreview::ScrollViewSzChg()
}
else //vertical scrolling by pixel
{
- const Rectangle& rDocRect = aViewWin.GetPaintedPreviewDocRect();
+ const Rectangle& rDocRect = pViewWin->GetPaintedPreviewDocRect();
const Size& rPreviewSize =
GetViewShell()->PagePreviewLayout()->GetPreviewDocSize();
pVScrollbar->SetRangeMax(rPreviewSize.Height()) ;
@@ -1590,7 +1593,7 @@ void SwPagePreview::ScrollViewSzChg()
}
if(pHScrollbar)
{
- const Rectangle& rDocRect = aViewWin.GetPaintedPreviewDocRect();
+ const Rectangle& rDocRect = pViewWin->GetPaintedPreviewDocRect();
const Size& rPreviewSize =
GetViewShell()->PagePreviewLayout()->GetPreviewDocSize();
long nVisWidth = 0;
@@ -1628,7 +1631,7 @@ void SwPagePreview::ScrollDocSzChg()
// All about printing
SfxPrinter* SwPagePreview::GetPrinter( sal_Bool bCreate )
{
- return aViewWin.GetViewShell()->getIDocumentDeviceAccess()->getPrinter( bCreate );
+ return pViewWin->GetViewShell()->getIDocumentDeviceAccess()->getPrinter( bCreate );
}
sal_uInt16 SwPagePreview::SetPrinter( SfxPrinter *pNew, sal_uInt16 nDiffFlags, bool )
@@ -1661,7 +1664,7 @@ sal_uInt16 SwPagePreview::SetPrinter( SfxPrinter *pNew, sal_uInt16 nDiffFlags,
rSh.ChgAllPageSize( aSz );
}
if( !bNormalPrint )
- aViewWin.CalcWish( aViewWin.GetRow(), aViewWin.GetCol() );
+ pViewWin->CalcWish( pViewWin->GetRow(), pViewWin->GetCol() );
rESh.SetModified();
rESh.EndAllAction();
@@ -1777,7 +1780,8 @@ sal_Bool SwPagePreview::HandleWheelCommands( const CommandEvent& rCEvt )
const CommandWheelData* pWData = rCEvt.GetWheelData();
if( pWData && COMMAND_WHEEL_ZOOM == pWData->GetMode() )
{
- if(!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
+ //only the Preference shouldn't control the Zoom, it is better to detect AT tools running. So the bridge can be used here
+ if (!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
{
sal_uInt16 nFactor = GetViewShell()->GetViewOptions()->GetZoom();
const sal_uInt16 nOffset = 10;
@@ -1785,20 +1789,20 @@ sal_Bool SwPagePreview::HandleWheelCommands( const CommandEvent& rCEvt )
{
nFactor -= nOffset;
if(nFactor < MIN_PREVIEW_ZOOM)
- nFactor = MIN_PREVIEW_ZOOM;
+ nFactor = MIN_PREVIEW_ZOOM;
}
else
{
nFactor += nOffset;
if(nFactor > MAX_PREVIEW_ZOOM)
- nFactor = MAX_PREVIEW_ZOOM;
+ nFactor = MAX_PREVIEW_ZOOM;
}
SetZoom(SVX_ZOOM_PERCENT, nFactor);
}
bOk = sal_True;
}
else
- bOk = aViewWin.HandleScrollCommand( rCEvt, pHScrollbar, pVScrollbar );
+ bOk = pViewWin->HandleScrollCommand( rCEvt, pHScrollbar, pVScrollbar );
return bOk;
}
@@ -1808,7 +1812,33 @@ uno::Reference< ::com::sun::star::accessibility::XAccessible >
SolarMutexGuard aGuard; // this should have happened already!!!
OSL_ENSURE( GetViewShell() != NULL, "We need a view shell" );
- return GetViewShell()->CreateAccessiblePreview();
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc = GetAccessible( sal_False );
+ if (xAcc.is())
+ {
+ return xAcc;
+ }
+ if (mpViewShell)
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccPreview = mpViewShell->CreateAccessiblePreview();
+ SetAccessible(xAccPreview);
+ }
+ return GetAccessible( sal_False );
+}
+
+// MT: Removed Windows::SwitchView() introduced with IA2 CWS.
+// There are other notifications for this when the active view has chnaged, so please update the code to use that event mechanism
+void SwPagePreviewWin::SwitchView()
+{
+#ifdef ACCESSIBLE_LAYOUT
+ if (!Application::IsAccessibilityEnabled())
+ {
+ return ;
+ }
+ if (mpViewShell)
+ {
+ mpViewShell->InvalidateAccessibleFocus();
+ }
+#endif
}
void SwPagePreview::ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions)
@@ -1859,7 +1889,7 @@ void SwPagePreview::SetZoom(SvxZoomType eType, sal_uInt16 nFactor)
rSh.ApplyViewOptions( aOpt );
lcl_InvalidateZoomSlots(GetViewFrame()->GetBindings());
// #i19975# also consider zoom type
- aViewWin.AdjustPreviewToNewZoom( nFactor, eType );
+ pViewWin->AdjustPreviewToNewZoom( nFactor, eType );
ScrollViewSzChg();
}
}
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 9e3090972dd4..d76c77c5f0fe 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -695,6 +695,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
: SfxViewShell( _pFrame, SWVIEWFLAGS ),
m_aPageStr( SW_RES( STR_PAGE )),
m_nNewPage(USHRT_MAX),
+ m_nOldPageNum(0),
m_pNumRuleNodeFromDoc(0),
m_pEditWin( new SwEditWin( &_pFrame->GetWindow(), *this ) ),
m_pWrtShell(0),
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 9c04f5309514..ecfaa893e602 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -1235,6 +1235,28 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
sal_uInt16 nWhich = aIter.FirstWhich();
OSL_ENSURE( nWhich, "empty set");
+ //get section change event
+ const SwSection* CurrSect = rShell.GetCurrSection();
+ if( CurrSect )
+ {
+ OUString sCurrentSectionName = CurrSect->GetSectionName();
+ if(sCurrentSectionName != m_sOldSectionName)
+ {
+ rShell.FireSectionChangeEvent(2, 1);
+ }
+ m_sOldSectionName = sCurrentSectionName;
+ }
+ else if (!m_sOldSectionName.isEmpty())
+ {
+ rShell.FireSectionChangeEvent(2, 1);
+ m_sOldSectionName= OUString();
+ }
+ //get column change event
+ if(rShell.bColumnChange())
+ {
+ rShell.FireColumnChangeEvent(2, 1);
+ }
+
while( nWhich )
{
switch( nWhich )
@@ -1246,7 +1268,13 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
rShell.GetPageNumber( -1, rShell.IsCrsrVisible(), nPage, nLogPage, sDisplay );
rSet.Put( SfxStringItem( FN_STAT_PAGE,
GetPageStr( nPage, nLogPage, sDisplay) ));
-
+ //if existing page number is not equal to old page number, send out this event.
+ if (m_nOldPageNum != nLogPage )
+ {
+ if (m_nOldPageNum != 0)
+ rShell.FirePageChangeEvent(m_nOldPageNum, nLogPage);
+ m_nOldPageNum = nLogPage;
+ }
sal_uInt16 nCnt = GetWrtShell().GetPageCnt();
if (m_nPageCnt != nCnt) // notify Basic
{
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index a280dc7b12ef..dd5f12745617 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -211,6 +211,16 @@ void SwView::ExecSearch(SfxRequest& rReq, sal_Bool bNoMessage)
if( bRet )
Scroll(m_pWrtShell->GetCharRect().SVRect());
rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
+ {
+ const sal_uInt16 nChildId = SvxSearchDialogWrapper::GetChildWindowId();
+ SvxSearchDialogWrapper *pDlgWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nChildId);
+ if ( pDlgWrp )
+ {
+ m_pSrchDlg = (SvxSearchDialog*)(pDlgWrp->GetWindow());
+ m_pSrchDlg->SetDocWin( (Window*)m_pEditWin);
+ m_pSrchDlg->SetSrchFlag();
+ }
+ }
}
break;
case SVX_SEARCHCMD_FIND_ALL:
@@ -225,6 +235,17 @@ void SwView::ExecSearch(SfxRequest& rReq, sal_Bool bNoMessage)
m_bFound = sal_False;
}
rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
+ {
+ const sal_uInt16 nChildId = SvxSearchDialogWrapper::GetChildWindowId();
+ SvxSearchDialogWrapper *pDlgWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nChildId);
+
+ if ( pDlgWrp )
+ {
+ m_pSrchDlg = (SvxSearchDialog*)(pDlgWrp->GetWindow());
+ m_pSrchDlg->SetDocWin( (Window*)m_pEditWin);
+ m_pSrchDlg->SetSrchFlag();
+ }
+ }
}
break;
case SVX_SEARCHCMD_REPLACE:
@@ -273,6 +294,17 @@ void SwView::ExecSearch(SfxRequest& rReq, sal_Bool bNoMessage)
m_pSrchItem->SetCommand( nOldCmd );
rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
}
+ {
+ const sal_uInt16 nChildId = SvxSearchDialogWrapper::GetChildWindowId();
+ SvxSearchDialogWrapper *pDlgWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nChildId);
+
+ if ( pDlgWrp )
+ {
+ m_pSrchDlg = (SvxSearchDialog*)(pDlgWrp->GetWindow());
+ m_pSrchDlg->SetDocWin( (Window*)m_pEditWin);
+ m_pSrchDlg->SetSrchFlag();
+ }
+ }
break;
case SVX_SEARCHCMD_REPLACE_ALL:
@@ -330,6 +362,15 @@ void SwView::ExecSearch(SfxRequest& rReq, sal_Bool bNoMessage)
InfoBox( pParentWindow, aText ).Execute();
}
}
+ const sal_uInt16 nChildId = SvxSearchDialogWrapper::GetChildWindowId();
+ SvxSearchDialogWrapper *pDlgWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nChildId);
+
+ if ( pDlgWrp )
+ {
+ m_pSrchDlg = (SvxSearchDialog*)(pDlgWrp->GetWindow());
+ m_pSrchDlg->SetDocWin( (Window*)m_pEditWin);
+ m_pSrchDlg->SetSrchFlag();
+ }
break;
}
@@ -477,8 +518,8 @@ sal_Bool SwView::SearchAndWrap(sal_Bool bApi)
m_bExtra = !m_bExtra;
const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
- SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId);
- m_pSrchDlg = pWrp ? static_cast <SvxSearchDialog*> (pWrp->getDialog ()) : 0;
+ SvxSearchDialogWrapper *pDlgWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId);
+ m_pSrchDlg = pDlgWrp ? static_cast <SvxSearchDialog*> (pDlgWrp->getDialog ()) : 0;
// If starting position is at the end or beginning of the document.
if (aOpts.bDontWrap)
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index 20fb60fd832b..df288d45b88f 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -72,6 +72,7 @@
#include <numrule.hxx>
#include <swundo.hxx>
#include <ndtxt.hxx>
+#include <fmtcntnt.hxx>
#include <PostItMgr.hxx>
#include <postithelper.hxx>
#include <redline.hxx>
@@ -820,7 +821,8 @@ SwContentTree::SwContentTree(Window* pParent, const ResId& rResId) :
bIsLastReadOnly(sal_False),
bIsOutlineMoveable(true),
bViewHasChanged(false),
- bIsImageListInitialized(false)
+ bIsImageListInitialized(false),
+ bIsKeySpace(false)
{
sal_uInt16 i;
@@ -852,6 +854,177 @@ SwContentTree::~SwContentTree()
bIsInDrag = false;
}
+OUString SwContentTree::GetEntryAltText( SvTreeListEntry* pEntry ) const
+{
+ if( pEntry == NULL)
+ return OUString();
+
+ SwContent* pCnt = (SwContent*)pEntry->GetUserData();
+ if( pCnt == NULL || pCnt->GetParent() == NULL)
+ return OUString();
+
+ sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
+ SdrObject* pTemp;
+
+ switch(nJumpType)
+ {
+ case CONTENT_TYPE_DRAWOBJECT:
+ {
+ SdrView* pDrawView = pActiveShell->GetDrawView();
+ if (pDrawView)
+ {
+ SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+ SdrPage* pPage = pDrawModel->GetPage(0);
+ const sal_uInt32 nCount = pPage->GetObjCount();
+ for( sal_uInt32 i=0; i< nCount; i++ )
+ {
+ pTemp = pPage->GetObj(i);
+ sal_uInt16 nCmpId;
+ switch( pTemp->GetObjIdentifier() )
+ {
+ case OBJ_GRUP:
+ case OBJ_TEXT:
+ case OBJ_TEXTEXT:
+ case OBJ_wegFITTEXT:
+ case OBJ_LINE:
+ case OBJ_RECT:
+ //caoxueqin added custom shape
+ case OBJ_CUSTOMSHAPE:
+ //end 2005/08/05
+ case OBJ_CIRC:
+ case OBJ_SECT:
+ case OBJ_CARC:
+ case OBJ_CCUT:
+ case OBJ_POLY:
+ case OBJ_PLIN:
+ case OBJ_PATHLINE:
+ case OBJ_PATHFILL:
+ case OBJ_FREELINE:
+ case OBJ_FREEFILL:
+ case OBJ_PATHPOLY:
+ case OBJ_PATHPLIN:
+ case OBJ_CAPTION:
+ nCmpId = OBJ_GRUP;
+ break;
+ default:
+ nCmpId = pTemp->GetObjIdentifier();
+ }
+ if(nCmpId == OBJ_GRUP /*pTemp->ISA(SdrObjGroup)*/ && pTemp->GetName() == pCnt->GetName())
+ {
+ return pTemp->GetTitle();
+ }
+ //Commented End
+ }
+ }
+ }
+ break;
+ case CONTENT_TYPE_GRAPHIC :
+ {
+ if( pActiveShell && pActiveShell->GetDoc() )
+ {
+ const SwFlyFrmFmt* pFrmFmt = pActiveShell->GetDoc()->FindFlyByName( pCnt->GetName(), 0);
+ if( pFrmFmt )
+ {
+// SwNodeIndex aIdx( *(pFrmFmt->GetCntnt().GetCntntIdx()), 1 );
+// const SwGrfNode* pGrfNd = aIdx.GetNode().GetGrfNode();
+// if( pGrfNd )
+// return pGrfNd->GetAlternateText();
+ return pFrmFmt->GetObjTitle();
+ }
+ }
+ }
+ break;
+ case CONTENT_TYPE_OLE :
+ case CONTENT_TYPE_FRAME :
+ {
+ //Can't find the GetAlternateText function. Need to verify again.
+ const SwFlyFrmFmt* pFlyFmt = pActiveShell->GetDoc()->FindFlyByName( pCnt->GetName(), 0);
+ if( pFlyFmt )
+ return pFlyFmt->/*GetAlternateText*/GetName();
+ }
+ break;
+ }
+ return OUString();
+}
+
+OUString SwContentTree::GetEntryLongDescription( SvTreeListEntry* pEntry ) const
+{
+ if( pEntry == NULL)
+ return OUString();
+
+ SwContent* pCnt = (SwContent*)pEntry->GetUserData();
+ if( pCnt == NULL || pCnt->GetParent() == NULL)
+ return OUString();
+
+ sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
+ SdrObject* pTemp;
+
+ switch(nJumpType)
+ {
+ case CONTENT_TYPE_DRAWOBJECT:
+ {
+ SdrView* pDrawView = pActiveShell->GetDrawView();
+ if (pDrawView)
+ {
+ SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+ SdrPage* pPage = pDrawModel->GetPage(0);
+ sal_uInt32 nCount = pPage->GetObjCount();
+ for( sal_uInt32 i=0; i< nCount; i++ )
+ {
+ pTemp = pPage->GetObj(i);
+ sal_uInt16 nCmpId;
+ switch( pTemp->GetObjIdentifier() )
+ {
+ case OBJ_GRUP:
+ case OBJ_TEXT:
+ case OBJ_TEXTEXT:
+ case OBJ_wegFITTEXT:
+ case OBJ_LINE:
+ case OBJ_RECT:
+ //caoxueqin added custom shape
+ case OBJ_CUSTOMSHAPE:
+ //end 2005/08/05
+ case OBJ_CIRC:
+ case OBJ_SECT:
+ case OBJ_CARC:
+ case OBJ_CCUT:
+ case OBJ_POLY:
+ case OBJ_PLIN:
+ case OBJ_PATHLINE:
+ case OBJ_PATHFILL:
+ case OBJ_FREELINE:
+ case OBJ_FREEFILL:
+ case OBJ_PATHPOLY:
+ case OBJ_PATHPLIN:
+ case OBJ_CAPTION:
+ nCmpId = OBJ_GRUP;
+ break;
+ default:
+ nCmpId = pTemp->GetObjIdentifier();
+ }
+ if(nCmpId == OBJ_GRUP /*pTemp->ISA(SdrObjGroup)*/ && pTemp->GetName() == pCnt->GetName())
+ {
+ return pTemp->GetDescription();
+ }
+ //Commented End
+ }
+ }
+ }
+ break;
+ case CONTENT_TYPE_GRAPHIC :
+ case CONTENT_TYPE_OLE :
+ case CONTENT_TYPE_FRAME :
+ {
+ //Can't find the function "GetLongDescription". Need to verify again.
+ const SwFlyFrmFmt* pFlyFmt = pActiveShell->GetDoc()->FindFlyByName( pCnt->GetName(), 0);
+ if( pFlyFmt )
+ return pFlyFmt->GetDescription();
+ }
+ break;
+ }
+ return OUString();
+}
+
// Drag&Drop methods
void SwContentTree::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
@@ -1193,10 +1366,31 @@ void SwContentTree::RequestingChildren( SvTreeListEntry* pParent )
if(pCnt)
{
OUString sEntry = pCnt->GetName();
- if(sEntry.isEmpty())
+ if (sEntry.isEmpty())
sEntry = sSpace;
- InsertEntry(sEntry, pParent,
+ SvTreeListEntry* pChild = InsertEntry(sEntry, pParent,
sal_False, LIST_APPEND, (void*)pCnt);
+
+ //If object is marked , the corresponding entry is set true,
+ //else the corresponding entry is set false .
+ SdrObject * pObj = GetDrawingObjectsByContent(pCnt);
+ if(pChild)
+ pChild->SetMarked(sal_False);
+ if(pObj)
+ {
+ SdrView* pDrawView = pActiveShell->GetDrawView();
+ SdrPageView* pPV = pDrawView->/*GetPageViewPvNum*/GetSdrPageView(/*0*/);
+ if( pPV )
+ {
+ sal_Bool Marked = pDrawView->IsObjMarked(pObj);
+ if(Marked)
+ {
+ //sEntry += String::CreateFromAscii(" *");
+ pChild->SetMarked(sal_True);
+ }
+
+ }
+ }
}
}
}
@@ -1204,6 +1398,40 @@ void SwContentTree::RequestingChildren( SvTreeListEntry* pParent )
}
}
+//Get drawing Objects by content .
+SdrObject* SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt)
+{
+ SdrObject *pRetObj = NULL;
+ sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
+ switch(nJumpType)
+ {
+ case CONTENT_TYPE_DRAWOBJECT:
+ {
+ SdrView* pDrawView = pActiveShell->GetDrawView();
+ if (pDrawView)
+ {
+ SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+ SdrPage* pPage = pDrawModel->GetPage(0);
+ sal_uInt32 nCount = pPage->GetObjCount();
+
+ for( sal_uInt32 i=0; i< nCount; i++ )
+ {
+ SdrObject* pTemp = pPage->GetObj(i);
+ if( pTemp->GetName() == pCnt->GetName())
+ {
+ pRetObj = pTemp;
+ break;
+ }
+ }
+ }
+ break;
+ }
+ default:
+ pRetObj = NULL;
+ }
+ return pRetObj;
+}
+
// Expand - Remember the state for content types.
sal_Bool SwContentTree::Expand( SvTreeListEntry* pParent )
@@ -1697,6 +1925,12 @@ bool SwContentTree::ToggleToRoot()
bIsRoot = false;
FindActiveTypeAndRemoveUserData();
Display(bIsActive || bIsConstant);
+ if( bIsKeySpace )
+ {
+ HideFocus();
+ ShowFocus( oldRectangle);
+ bIsKeySpace = sal_False;
+ }
}
pConfig->SetRootType( nRootType );
GetParentWindow()->aContentToolBox.CheckItem(FN_SHOW_ROOT, bIsRoot ? sal_True : sal_False);
@@ -2399,6 +2633,120 @@ void SwContentTree::KeyInput(const KeyEvent& rEvent)
GrabFocus();
}
}
+ //Make KEY_SPACE has same function as DoubleClick ,
+ //and realize multi-selection .
+ else if(aCode.GetCode() == KEY_SPACE && 0 == aCode.GetModifier())
+ {
+
+ SvTreeListEntry* pEntry = GetCurEntry();
+ if( GetChildCount( pEntry ) == 0 )
+ bIsKeySpace = sal_True;
+ Point tempPoint = GetEntryPosition( pEntry );//Change from "GetEntryPos" to "GetEntryPosition" for acc migration
+ oldRectangle = GetFocusRect( pEntry,tempPoint.Y() );
+
+ if(pEntry)
+ {
+ if(bIsActive || bIsConstant)
+ {
+ if(bIsConstant)
+ {
+ pActiveShell->GetView().GetViewFrame()->GetWindow().ToTop();
+ }
+
+ SwContent* pCnt = (SwContent*)pEntry->GetUserData();
+
+ sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
+ switch(nJumpType)
+ {
+ case CONTENT_TYPE_DRAWOBJECT:
+ {
+ SdrView* pDrawView = pActiveShell->GetDrawView();
+ if (pDrawView)
+ {
+ pDrawView->SdrEndTextEdit();//Change from "EndTextEdit" to "SdrEndTextEdit" for acc migration
+
+ SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+ SdrPage* pPage = pDrawModel->GetPage(0);
+ sal_uInt32 nCount = pPage->GetObjCount();
+ sal_Bool hasObjectMarked = sal_False;
+
+ SdrObject* pObject = NULL;
+ pObject = GetDrawingObjectsByContent( pCnt );
+ if( pObject )
+ {
+ SdrPageView* pPV = pDrawView->GetSdrPageView/*GetPageViewPvNum*/(/*0*/);
+ if( pPV )
+ {
+ sal_Bool bUnMark = pDrawView->IsObjMarked(pObject);
+ pDrawView->MarkObj( pObject, pPV, bUnMark);
+
+ }
+ }
+ for( sal_uInt32 i=0; i< nCount; i++ )
+ {
+ SdrObject* pTemp = pPage->GetObj(i);
+ sal_Bool bMark = pDrawView->IsObjMarked(pTemp);
+ switch( pTemp->GetObjIdentifier() )
+ {
+ case OBJ_GRUP:
+ case OBJ_TEXT:
+ case OBJ_TEXTEXT:
+ case OBJ_wegFITTEXT:
+ case OBJ_LINE:
+ case OBJ_RECT:
+ case OBJ_CIRC:
+ case OBJ_SECT:
+ case OBJ_CARC:
+ case OBJ_CCUT:
+ case OBJ_POLY:
+ case OBJ_PLIN:
+ case OBJ_PATHLINE:
+ case OBJ_PATHFILL:
+ case OBJ_FREELINE:
+ case OBJ_FREEFILL:
+ case OBJ_PATHPOLY:
+ case OBJ_PATHPLIN:
+ case OBJ_CAPTION:
+ case OBJ_CUSTOMSHAPE:
+ if( bMark )
+ hasObjectMarked = sal_True;
+ break;
+ default:
+ if ( bMark )
+ {
+ SdrPageView* pPV = pDrawView->GetSdrPageView/*GetPageViewPvNum*/(/*0*/);
+ if (pPV)
+ {
+ pDrawView->MarkObj(pTemp, pPV, sal_True);
+ }
+ }
+ }
+ //mod end
+ }
+ if ( pActiveShell && !hasObjectMarked )
+ {
+ SwEditWin& pEditWindow =
+ pActiveShell->GetView().GetEditWin();
+ if( &pEditWindow )
+ {
+ KeyCode tempKeycode( KEY_ESCAPE );
+ KeyEvent rKEvt( 0 , tempKeycode );
+ ((Window*)&pEditWindow)->KeyInput( rKEvt );
+
+ }
+ //rView.GetEditWin().GrabFocus();
+ }
+ }
+ }
+ break;
+ }
+
+
+ bViewHasChanged = sal_True;
+ }
+ }
+
+ }
else
SvTreeListBox::KeyInput(rEvent);
@@ -3103,6 +3451,24 @@ void SwContentLBoxString::Paint(
rDev.DrawText( rPos, GetText() );
rDev.SetFont( aOldFont );
}
+ // IA2 CWS. MT: Removed for now (also in SvLBoxEntry) - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
+ /*
+ else if (pEntry->IsMarked())
+ {
+ rDev.DrawText( rPos, GetText() );
+ XubString str;
+ str = XubString::CreateFromAscii("*");
+ Point rPosStar(rPos.X()-6,rPos.Y());
+ Font aOldFont( rDev.GetFont());
+ Font aFont(aOldFont);
+ Color aCol( aOldFont.GetColor() );
+ aCol.DecreaseLuminance( 200 );
+ aFont.SetColor( aCol );
+ rDev.SetFont( aFont );
+ rDev.DrawText( rPosStar, str);
+ rDev.SetFont( aOldFont );
+ }
+ */
else
SvLBoxString::Paint( rPos, rDev, pView, pEntry);
}
@@ -3119,4 +3485,18 @@ void SwContentTree::DataChanged( const DataChangedEvent& rDCEvt )
SvTreeListBox::DataChanged( rDCEvt );
}
+sal_Int32 SwContentTree::GetEntryRealChildrenNum( SvTreeListEntry* pParent ) const
+{
+ // ist es ein Inhaltstyp?
+ if(lcl_IsContentType(pParent))
+ {
+ if(!pParent->HasChildren())
+ {
+ SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
+ return pCntType->GetMemberCount();
+ }
+ }
+ return 0;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/utlui/navipi.hrc b/sw/source/ui/utlui/navipi.hrc
index 651cd0dba506..daed23f3d77a 100644
--- a/sw/source/ui/utlui/navipi.hrc
+++ b/sw/source/ui/utlui/navipi.hrc
@@ -68,4 +68,7 @@
#define ST_POSTIT_HIDE (ST_GLOBAL_CONTEXT_FIRST +36)
#define ST_POSTIT_DELETE (ST_GLOBAL_CONTEXT_FIRST +37)
+#define ST_TL_GLOBAL (ST_GLOBAL_CONTEXT_FIRST +38)
+#define ST_TL_CONTENT (ST_GLOBAL_CONTEXT_FIRST +39)
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
index 972e3ef6e8f3..f60d86f20e07 100644
--- a/sw/source/ui/wrtsh/select.cxx
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -37,6 +37,7 @@
#include <swevent.hxx>
#include <swdtflvr.hxx>
#include <crsskip.hxx>
+#include <doc.hxx>
#include <wordcountdialog.hxx>
@@ -170,6 +171,12 @@ long SwWrtShell::SelAll()
ExtendedSelectAll(/*bFootnotes =*/ false);
}
+ SwDoc *pDoc = GetDoc();
+ if ( pDoc )
+ {
+ pDoc->SetPrepareSelAll();
+ }
+
if( pStartPos )
{
pTmpCrsr = getShellCrsr( false );