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;
120 AccessibleEventObject
aEvent;
121 aEvent.EventId = AccessibleEventId::CHILD;
142uno::Reference< XAccessible> SAL_CALL
169 uno::Reference < XAccessibleContext > xAcc(
mxParent->getAccessibleContext() );
170 uno::Reference < XAccessible > xThis(
this );
171 sal_Int64
nCount = xAcc->getAccessibleChildCount();
177 if( xAcc->getAccessibleChild(
i ) == xThis )
180 catch(
const css::lang::IndexOutOfBoundsException &)
197 OUString sAccName =
GetResource( STR_ACCESS_DOC_WORDPROCESSING );
202 if ( sFileName.isEmpty() )
211 if ( !sFileName.isEmpty() )
213 sAccName = sFileName +
" - " + sAccName;
233 awt::Rectangle aBox( aPixBounds.
Left(), aPixBounds.
Top(),
238 catch(
const css::lang::IndexOutOfBoundsException &)
240 return awt::Rectangle();
255 awt::Point aLoc( aPixPos.getX(), aPixPos.getY() );
271 awt::Point aLoc( aPixPos.getX(), aPixPos.getY() );
287 awt::Size aSize( aPixSize.
Width(), aPixSize.
Height() );
293 const awt::Point& aPoint )
304 aPixBounds.
Move(-aPixBounds.
Left(), -aPixBounds.
Top());
306 Point aPixPoint( aPoint.X, aPoint.Y );
307 return aPixBounds.
Contains( aPixPoint );
311 const awt::Point& aPoint )
327 Point aPixPoint( aPoint.X, aPoint.Y );
328 if(
mpChildWin->GetWindowExtentsRelative( pWin ).Contains( aPixPoint ) )
342 rStateSet |= AccessibleStateType::MULTI_SELECTABLE;
343 rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
347 std::shared_ptr<SwAccessibleMap>
const& pInitMap)
349 , maSelectionHelper(*this)
351 SetName(pInitMap->GetDocName());
352 vcl::Window *pWin = pInitMap->GetShell()->GetWin();
386 OSL_ENSURE( rEvent.GetWindow(),
"Window???" );
387 switch ( rEvent.GetId() )
389 case VclEventId::WindowShow:
392 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
394 AddChild( pChildWin );
398 case VclEventId::WindowHide:
401 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
403 RemoveChild( pChildWin );
407 case VclEventId::ObjectDying:
410 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->
GetAccessibleRole() )
412 RemoveChild( pChildWin );
443 uno::Reference<XAccessibleSelection> aSelect =
this;
448 uno::Reference<XAccessibleExtendedAttributes> aAttribute =
this;
452 aRet = SwAccessibleContext::queryInterface( rType );
461 SwAccessibleDocumentBase::getTypes() ).
getTypes();
466 return css::uno::Sequence<sal_Int8>();
472 sal_Int64 nChildIndex )
478 sal_Int64 nChildIndex )
498 sal_Int64 nSelectedChildIndex )
505 sal_Int64 nChildIndex )
527 sal_uInt16 nPage, nLogPage;
530 OUString sValue =
"page-name:" +
sDisplay +
532 OUString::number( nPage ) +
534 OUString::number( pCursorShell->
GetPageCnt() ) +
";";
538 sValue +=
"cursor-position-in-page-horizontal:" + OUString::number(aCursorPagePos.getX())
539 +
";cursor-position-in-page-vertical:" + OUString::number(aCursorPagePos.getY()) +
";";
552 if(eAnchorId == RndStdIds::FLY_AS_CHAR)
562 pCurrTextFrame =
static_cast<SwTextFrame*
>(pCurrFrame);
565 SwFrame* pFrame = pCurrTextFrame;
569 pCurrTextFrame =
nullptr;
579 if( RndStdIds::FLY_AS_CHAR != rAnchor.
GetAnchorId() )
580 pCurrTextFrame =
nullptr;
584 if (pCurrTextFrame && pTextFrame)
588 while( pTextFrame && pTextFrame != pCurrTextFrame )
604 if (!pCurrTextFrame->
IsEmpty() && pCaret)
614 pCurrTextFrame = pNode
632 sValue +=
"line-number:" + OUString::number( nLineNum ) +
";";
634 SwFrame* pCurrCol=
static_cast<SwFrame*
>(pCurrFrame)->FindColFrame();
636 sValue +=
"column-number:";
639 if(pCurrCol!=
nullptr)
642 SwFrame* pCurrPageCol=
static_cast<SwFrame*
>(pCurrFrame)->FindColFrame();
645 pCurrPageCol = pCurrPageCol->
GetUpper();
653 while(pCol&&(pCol!=pCurrPageCol))
660 sValue += OUString::number( nCurrCol ) +
";";
664 nColCount = nColCount>0?nColCount:1;
665 sValue +=
"total-columns:" + OUString::number( nColCount ) +
";";
668 if(pCurrSctFrame!=
nullptr && pCurrSctFrame->
GetSection()!=nullptr )
672 sectionName = sectionName.replaceFirst(
"\\" ,
"\\\\" );
673 sectionName = sectionName.replaceFirst(
"=" ,
"\\=" );
674 sectionName = sectionName.replaceFirst(
";" ,
"\\;" );
675 sectionName = sectionName.replaceFirst(
"," ,
"\\," );
676 sectionName = sectionName.replaceFirst(
":" ,
"\\:" );
678 sValue +=
"section-name:" + sectionName +
";";
684 if(pCurrCol!=
nullptr)
690 while(pCol&&(pCol!=pCurrCol))
697 sValue +=
"section-columns-number:" +
698 OUString::number( nCurrCol ) +
";";
702 sal_uInt16 nSctColCount=rFormatSctCol.
GetNumCols();
703 nSctColCount = nSctColCount>0?nSctColCount:1;
704 sValue +=
"section-total-columns:" +
705 OUString::number( nSctColCount ) +
";";
708 anyAttribute <<= sValue;
716 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
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.
sal_uLong GetThisLines() const
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
sal_uInt16 GetLineCount(TextFrameIndex nPos)
Determines the line count.
SwDrawView * GetDrawView()
vcl::Window * GetWin() const
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
sal_uInt16 GetAccessibleRole() const
sal_uInt16 GetChildCount() const
vcl::Window * GetAccessibleParentWindow() const
tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
void AddChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
void RemoveChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
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.