23#include <com/sun/star/accessibility/AccessibleRole.hpp>
24#include <com/sun/star/accessibility/AccessibleStateType.hpp>
25#include <com/sun/star/accessibility/AccessibleEventId.hpp>
26#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
54constexpr OUStringLiteral
sServiceName =
u"com.sun.star.text.AccessibleTextDocumentView";
60using lang::IndexOutOfBoundsException;
66 std::shared_ptr<SwAccessibleMap>
const& pMap)
69 ,
mxParent(pMap->
GetShell()->GetWin()->GetAccessibleParentWindow()->GetAccessible())
84 if( aOldVisArea != rNewVisArea )
98 OSL_ENSURE( !
mpChildWin,
"only one child window is supported" );
105 AccessibleEventObject
aEvent;
106 aEvent.EventId = AccessibleEventId::CHILD;
121 AccessibleEventObject
aEvent;
122 aEvent.EventId = AccessibleEventId::CHILD;
144uno::Reference< XAccessible> SAL_CALL
171 uno::Reference < XAccessibleContext > xAcc(
mxParent->getAccessibleContext() );
172 uno::Reference < XAccessible > xThis(
this );
173 sal_Int64
nCount = xAcc->getAccessibleChildCount();
179 if( xAcc->getAccessibleChild(
i ) == xThis )
182 catch(
const css::lang::IndexOutOfBoundsException &)
199 OUString sAccName =
GetResource( STR_ACCESS_DOC_WORDPROCESSING );
204 if ( sFileName.isEmpty() )
213 if ( !sFileName.isEmpty() )
215 sAccName = sFileName +
" - " + sAccName;
235 awt::Rectangle aBox( aPixBounds.
Left(), aPixBounds.
Top(),
240 catch(
const css::lang::IndexOutOfBoundsException &)
242 return awt::Rectangle();
257 awt::Point aLoc( aPixPos.
getX(), aPixPos.
getY() );
273 awt::Point aLoc( aPixPos.
getX(), aPixPos.
getY() );
289 awt::Size aSize( aPixSize.
Width(), aPixSize.
Height() );
295 const awt::Point& aPoint )
306 aPixBounds.
Move(-aPixBounds.
Left(), -aPixBounds.
Top());
308 Point aPixPoint( aPoint.X, aPoint.Y );
309 return aPixBounds.
Contains( aPixPoint );
313 const awt::Point& aPoint )
329 Point aPixPoint( aPoint.X, aPoint.Y );
330 if(
mpChildWin->GetWindowExtentsRelative( *pWin ).Contains( aPixPoint ) )
344 rStateSet |= AccessibleStateType::MULTI_SELECTABLE;
345 rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
349 std::shared_ptr<SwAccessibleMap>
const& pInitMap)
351 , maSelectionHelper(*this)
353 SetName(pInitMap->GetDocName());
354 vcl::Window *pWin = pInitMap->GetShell()->GetWin();
388 OSL_ENSURE( rEvent.GetWindow(),
"Window???" );
389 switch ( rEvent.GetId() )
391 case VclEventId::WindowShow:
394 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
396 AddChild( pChildWin );
400 case VclEventId::WindowHide:
403 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
405 RemoveChild( pChildWin );
409 case VclEventId::ObjectDying:
412 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
414 RemoveChild( pChildWin );
445 uno::Reference<XAccessibleSelection> aSelect =
this;
450 uno::Reference<XAccessibleExtendedAttributes> aAttribute =
this;
454 aRet = SwAccessibleContext::queryInterface( rType );
463 SwAccessibleDocumentBase::getTypes() ).
getTypes();
468 return css::uno::Sequence<sal_Int8>();
474 sal_Int64 nChildIndex )
480 sal_Int64 nChildIndex )
500 sal_Int64 nSelectedChildIndex )
507 sal_Int64 nChildIndex )
529 sal_uInt16 nPage, nLogPage;
532 OUString sValue =
"page-name:" +
sDisplay +
534 OUString::number( nPage ) +
536 OUString::number( pCursorShell->
GetPageCnt() ) +
";";
540 sValue +=
"cursor-position-in-page-horizontal:" + OUString::number(aCursorPagePos.
getX())
541 +
";cursor-position-in-page-vertical:" + OUString::number(aCursorPagePos.
getY()) +
";";
545 sal_Int32 nLineNum = 0;
554 if(eAnchorId == RndStdIds::FLY_AS_CHAR)
564 pCurrTextFrame =
static_cast<SwTextFrame*
>(pCurrFrame);
567 SwFrame* pFrame = pCurrTextFrame;
571 pCurrTextFrame =
nullptr;
581 if( RndStdIds::FLY_AS_CHAR != rAnchor.
GetAnchorId() )
582 pCurrTextFrame =
nullptr;
586 if (pCurrTextFrame && pTextFrame)
590 while( pTextFrame && pTextFrame != pCurrTextFrame )
606 if (!pCurrTextFrame->
IsEmpty() && pCaret)
616 pCurrTextFrame = pNode
634 sValue +=
"line-number:" + OUString::number( nLineNum ) +
";";
636 SwFrame* pCurrCol=
static_cast<SwFrame*
>(pCurrFrame)->FindColFrame();
638 sValue +=
"column-number:";
641 if(pCurrCol!=
nullptr)
644 SwFrame* pCurrPageCol=
static_cast<SwFrame*
>(pCurrFrame)->FindColFrame();
647 pCurrPageCol = pCurrPageCol->
GetUpper();
655 while(pCol&&(pCol!=pCurrPageCol))
662 sValue += OUString::number( nCurrCol ) +
";";
666 nColCount = nColCount>0?nColCount:1;
667 sValue +=
"total-columns:" + OUString::number( nColCount ) +
";";
670 if(pCurrSctFrame!=
nullptr && pCurrSctFrame->
GetSection()!=nullptr )
674 sectionName = sectionName.replaceFirst(
"\\" ,
"\\\\" );
675 sectionName = sectionName.replaceFirst(
"=" ,
"\\=" );
676 sectionName = sectionName.replaceFirst(
";" ,
"\\;" );
677 sectionName = sectionName.replaceFirst(
"," ,
"\\," );
678 sectionName = sectionName.replaceFirst(
":" ,
"\\:" );
680 sValue +=
"section-name:" + sectionName +
";";
686 if(pCurrCol!=
nullptr)
692 while(pCol&&(pCol!=pCurrCol))
699 sValue +=
"section-columns-number:" +
700 OUString::number( nCurrCol ) +
";";
704 sal_uInt16 nSctColCount=rFormatSctCol.
GetNumCols();
705 nSctColCount = nSctColCount>0?nSctColCount:1;
706 sValue +=
"section-total-columns:" +
707 OUString::number( nSctColCount ) +
";";
710 anyAttribute <<= sValue;
718 return sal_Int32(
SW_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor);
constexpr OUStringLiteral sAccessibleServiceName
IMPL_LINK(SwAccessibleDocument, WindowChildEventListener, VclWindowEvent &, rEvent, void)
constexpr OUStringLiteral sServiceName
constexpr OUStringLiteral sImplementationName
unotools::WeakReference< AnimationNode > mxParent
constexpr tools::Long getX() const
constexpr tools::Long getY() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
SdrObject * GetMarkedSdrObj() const
SdrObjUserCall * GetUserCall() const
OUString GetTitle(sal_uInt16 nMaxLen=0) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
virtual void Dispose(bool bRecursive, bool bCanSkipInvisible=true)
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
void SetName(const OUString &rName)
void FireAccessibleEvent(css::accessibility::AccessibleEventObject &rEvent)
virtual void GetStates(sal_Int64 &rStateSet)
vcl::Window * GetWindow()
SwAccessibleMap * GetMap()
SwCursorShell * GetCursorShell()
convenience method to get SwCursorShell through accessibility map
void Scrolled(const SwRect &rOldVisArea)
static OUString GetResource(TranslateId pResId, const OUString *pArg1=nullptr, const OUString *pArg2=nullptr)
SwViewShell * GetShell()
convenience method to get the SwViewShell through accessibility map
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nIndex) override
virtual OUString SAL_CALL getAccessibleName() override
css::uno::Reference< css::accessibility::XAccessible > mxParent
void AddChild(vcl::Window *pWin, bool bFireEvent=true)
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
virtual css::awt::Point SAL_CALL getLocation() override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
virtual ~SwAccessibleDocumentBase() override
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
virtual css::awt::Size SAL_CALL getSize() override
SwAccessibleDocumentBase(std::shared_ptr< SwAccessibleMap > const &pInitMap)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual css::awt::Rectangle SAL_CALL getBounds() override
void RemoveChild(vcl::Window *pWin)
VclPtr< vcl::Window > mpChildWin
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nIndex) override
virtual OUString SAL_CALL getAccessibleDescription() override
access to an accessible Writer document
SwAccessibleSelectionHelper maSelectionHelper
virtual css::uno::Any SAL_CALL getExtendedAttributes() override
virtual void SAL_CALL selectAccessibleChild(sal_Int64 nChildIndex) override
virtual ~SwAccessibleDocument() override
virtual void SAL_CALL selectAllAccessibleChildren() override
SwAccessibleDocument(std::shared_ptr< SwAccessibleMap > const &pInitMap)
sal_Int32 SAL_CALL getBackground() override
virtual void Dispose(bool bRecursive, bool bCanSkipInvisible=true) override
virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount() override
virtual void SAL_CALL clearAccessibleSelection() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int64 nChildIndex) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void SAL_CALL deselectAccessibleChild(sal_Int64 nChildIndex) override
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Return whether the specified service is supported by this class.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void GetStates(sal_Int64 &rStateSet) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
static sal_Int32 GetChildCount(SwAccessibleMap &rAccMap, const SwRect &rVisArea, const SwFrame *pFrame, bool bInPagePreviewr)
const SwFrame * GetFrame() const
void SetVisArea(const SwRect &rNewVisArea)
const SwRect & GetVisArea() const
const SwRect & GetVisArea() const
SwViewShell * GetShell() const
bool isAccessibleChildSelected(sal_Int64 nChildIndex)
void selectAccessibleChild(sal_Int64 nChildIndex)
void selectAllAccessibleChildren()
css::uno::Reference< css::accessibility::XAccessible > getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex)
void deselectAccessibleChild(sal_Int64 nChildIndex)
sal_Int64 getSelectedAccessibleChildCount()
const SwFrame * GetAnchorFrame() const
const SwFormatCol & GetCol(bool=true) const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
SwContentFrame * GetNextContentFrame() const
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Point GetCursorPagePos() const
SwContentFrame * GetCurrFrame(const bool bCalcFrame=true) const
Get current frame in which the cursor is positioned.
SwDocShell * GetDocShell()
const OUString & getDocAccTitle() const
sal_uInt16 GetPageNumber(const Point &rPoint) const
Page number of the page containing Point, O if no page.
general base class for all free-flowing frames
virtual const SwFlyFrameFormat * GetFormat() const override
Base class of the Writer layout elements.
SwFlyFrame * FindFlyFrame()
bool IsInFootnote() const
bool IsHeaderFrame() const
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame,...
bool IsFooterFrame() const
SwLayoutFrame * GetUpper()
SwRootFrame * getRootFrame()
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
const SwFrame * Lower() const
SwContentNode * GetContentNode()
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetPoint() const
A page of the document layout.
Of course Writer needs its own rectangles.
const OUString & GetSectionName() const
Represents the visualization of a paragraph.
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
sal_Int32 GetLineCount(TextFrameIndex nPos)
Determines the line count.
sal_Int32 GetThisLines() const
SwDrawView * GetDrawView()
vcl::Window * GetWin() const
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
tools::Rectangle GetWindowExtentsAbsolute() const
sal_uInt16 GetAccessibleRole() const
sal_uInt16 GetChildCount() const
vcl::Window * GetAccessibleParentWindow() const
void AddChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
void RemoveChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
tools::Rectangle GetWindowExtentsRelative(const vcl::Window &rRelativeWindow) const
vcl::Window * GetChild(sal_uInt16 nChild) const
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
#define LINK(Instance, Class, Member)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
#define SFX_TITLE_APINAME
Marks a position in the document model.