28 #include <com/sun/star/accessibility/AccessibleRole.hpp>
29 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
30 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
55 , maShapeTreeInfo( rShapeTreeInfo )
56 , mnIndexInParent( nIndex )
66 DBG_ASSERT(
mpText ==
nullptr,
"svx::AccessibleCell::~AccessibleCell(), not disposed!?" );
74 if( !((pView !=
nullptr) && (pWindow !=
nullptr) &&
mxCell.is()))
78 if(
mxCell->CanCreateEditOutlinerParaObject() ||
mxCell->GetOutlinerParaObject() != nullptr )
85 mpText->SetEventSource(
this);
92 bool bStateHasChanged =
false;
94 if (aState == AccessibleStateType::FOCUSED &&
mpText !=
nullptr)
98 bool bIsFocused =
mpText->HaveFocus ();
100 bStateHasChanged = (bIsFocused !=
mpText->HaveFocus ());
105 return bStateHasChanged;
111 bool bStateHasChanged =
false;
113 if (aState == AccessibleStateType::FOCUSED &&
mpText !=
nullptr)
117 bool bIsFocused =
mpText->HaveFocus ();
119 bStateHasChanged = (bIsFocused !=
mpText->HaveFocus ());
124 return bStateHasChanged;
133 return AccessibleCellBase::queryInterface( aType );
139 AccessibleCellBase::acquire();
145 AccessibleCellBase::release();
158 return mpText !=
nullptr ?
mpText->GetChildCount () : 0;
171 return mpText->GetChild (nIndex);
184 ::osl::MutexGuard aGuard (
m_aMutex);
185 Reference<XAccessibleStateSet> xStateSet;
187 if (rBHelper.bDisposed ||
mpText ==
nullptr)
200 mxStateSet->AddState (AccessibleStateType::FOCUSED);
202 mxStateSet->RemoveState (AccessibleStateType::FOCUSED);
206 mxStateSet->RemoveState(AccessibleStateType::VISIBLE);
208 mxStateSet->AddState(AccessibleStateType::VISIBLE);
212 css::uno::Reference<XAccessible> xTempAcc = getAccessibleParent();
215 css::uno::Reference<XAccessibleContext>
216 xTempAccContext = xTempAcc->getAccessibleContext();
217 if( xTempAccContext.is() )
219 css::uno::Reference<XAccessibleStateSet> rState =
220 xTempAccContext->getAccessibleStateSet();
223 const css::uno::Sequence<short> aStates = rState->getStates();
224 if (std::find(aStates.begin(), aStates.end(), AccessibleStateType::EDITABLE) != aStates.end())
226 mxStateSet->AddState (AccessibleStateType::EDITABLE);
227 mxStateSet->AddState (AccessibleStateType::RESIZABLE);
228 mxStateSet->AddState (AccessibleStateType::MOVEABLE);
235 xStateSet.set(new ::utl::AccessibleStateSetHelper (*mxStateSet));
262 ::osl::MutexGuard aGuard (
m_aMutex);
265 for (sal_Int32
i=0;
i<nChildCount; ++
i)
270 Reference<XAccessibleComponent> xChildComponent (xChild->getAccessibleContext(), uno::UNO_QUERY);
271 if (xChildComponent.is())
273 awt::Rectangle aBBox (xChildComponent->getBounds());
274 if ( (aPoint.X >= aBBox.X)
275 && (aPoint.Y >= aBBox.Y)
276 && (aPoint.X < aBBox.X+aBBox.Width)
277 && (aPoint.Y < aBBox.Y+aBBox.Height) )
285 return uno::Reference<XAccessible>();
292 ::osl::MutexGuard aGuard (
m_aMutex);
295 css::awt::Rectangle aBoundingBox;
299 const ::tools::Rectangle aCellRect(
mxCell->getCellRect() );
303 throw uno::RuntimeException (
"AccessibleCell has no valid view forwarder",static_cast<uno::XWeak*>(
this));
309 Reference<XAccessibleComponent> xParentComponent ( getAccessibleParent(), uno::UNO_QUERY);
310 if (xParentComponent.is())
313 awt::Point aParentLocation (xParentComponent->getLocationOnScreen());
314 int x = aPixelPosition.getX() - aParentLocation.X;
315 int y = aPixelPosition.getY() - aParentLocation.Y;
318 ::tools::Rectangle aBBox ( x, y, x + aPixelSize.getWidth(), y + aPixelSize.getHeight());
319 awt::Size aParentSize (xParentComponent->getSize());
321 aBBox = aBBox.GetIntersection (aParentBBox);
322 aBoundingBox = awt::Rectangle ( aBBox.Left(), aBBox.Top(), aBBox.getWidth(), aBBox.getHeight());
326 SAL_INFO(
"svx",
"parent does not support component");
327 aBoundingBox = awt::Rectangle (aPixelPosition.getX(), aPixelPosition.getY(),aPixelSize.getWidth(), aPixelSize.getHeight());
338 css::awt::Rectangle aBoundingBox(
getBounds());
339 return css::awt::Point(aBoundingBox.X, aBoundingBox.Y);
351 Reference<XAccessibleComponent> xParentComponent( getAccessibleParent(), uno::UNO_QUERY);
352 if(xParentComponent.is())
354 css::awt::Point aParentLocation(xParentComponent->getLocationOnScreen());
355 aLocation.X += aParentLocation.X;
356 aLocation.Y += aParentLocation.Y;
360 SAL_WARN(
"svx",
"parent does not support XAccessibleComponent");
370 awt::Rectangle aBoundingBox (
getBounds());
371 return awt::Size (aBoundingBox.Width, aBoundingBox.Height);
386 return sal_Int32(0x0ffffffL);
427 ::osl::MutexGuard aGuard (
m_aMutex);
428 if (rBHelper.bDisposed || rBHelper.bInDispose)
430 Reference<XInterface> xSource( static_cast<XComponent *>(
this) );
431 lang::EventObject aEventObj(xSource);
432 rxListener->disposing(aEventObj);
438 mpText->AddEventListener (rxListener);
448 mpText->RemoveEventListener (rxListener);
457 return "AccessibleCell";
464 const css::uno::Sequence<OUString> vals {
"com.sun.star.drawing.AccessibleCell" };
476 CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED,
Any(),
Any());
490 ::osl::MutexGuard aGuard (
m_aMutex);
494 if (mxStateSet !=
nullptr)
495 mxStateSet->RemoveState(AccessibleStateType::FOCUSED);
509 AccessibleContextBase::dispose ();
526 aBuf.append( static_cast<sal_Unicode>(
'A' +
527 static_cast<sal_uInt16>(nCol)));
530 aBuf.append( static_cast<sal_Unicode>(
'A' +
531 (static_cast<sal_uInt16>(nCol) / 26) - 1));
532 aBuf.append( static_cast<sal_Unicode>(
'A' +
533 (static_cast<sal_uInt16>(nCol) % 26)));
541 sal_Int32 nC = nCol % 26;
542 aStr.append(static_cast<sal_Unicode>(
'A' +
543 static_cast<sal_uInt16>(nC)));
545 nCol = nCol / 26 - 1;
547 aStr.append(static_cast<sal_Unicode>(
'A' +
548 static_cast<sal_uInt16>(nCol)));
552 return aBuf.makeStringAndClear();
564 sal_Int32 nRow = 0, nCol = 0;
573 return AccessibleCellBase::getAccessibleName();
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
virtual void SAL_CALL acquire() noexcept override
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
std::unique_ptr< AccessibleTextHelper > mpText
The accessible text engine. May be NULL if it can not be created.
virtual void ViewForwarderChanged() override
This method is called to indicate a change of the specified view forwarder, specifically, a change in visible area.
AccessibleTableShape * pAccTable
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
Helper class for objects containing EditEngine/Outliner text.
vcl::Window * GetWindow() const
Return the current Window.
virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont() override
SdrView * GetSdrView() const
Return the current SdrView.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
virtual OUString SAL_CALL getTitledBorderText() override
virtual sal_Int32 SAL_CALL getBackground() override
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &rxListener) override
virtual bool ResetState(sal_Int16 aState) override
virtual OUString SAL_CALL getAccessibleName() override
virtual bool SetState(sal_Int16 aState) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual void SAL_CALL disposing() override
This method is called from the component helper base class while disposing.
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &rxListener) override
#define DBG_ASSERT(sCon, aError)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
The implementation below is at the moment straightforward.
virtual css::awt::Rectangle SAL_CALL getBounds() override
virtual OUString SAL_CALL getToolTipText() override
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
The children of this cell come from the paragraphs of text.
AccessibleShapeTreeInfo maShapeTreeInfo
Bundle of information passed to all shapes in a document tree.
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
virtual Point LogicToPixel(const Point &rPoint) const =0
Transform the specified point from internal coordinates in 100th of mm to an absolute screen position...
virtual void SAL_CALL grabFocus() override
void getColumnAndRow(sal_Int32 nChildIndex, sal_Int32 &rnColumn, sal_Int32 &rnRow)
sal_Int32 mnIndexInParent
the index in parent.
sdr::table::CellRef mxCell
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
Return a copy of the state set.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override
virtual void SAL_CALL release() noexcept override
#define SAL_INFO(area, stream)
::OutputDevice const * GetOutDev() const
virtual ~AccessibleCell() override
const IAccessibleViewForwarder * GetViewForwarder() const
Return the current view forwarder.
virtual void SAL_CALL grabFocus() override
virtual sal_Int32 SAL_CALL getForeground() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
Forward the request to the shape.
virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont() override
virtual css::awt::Size SAL_CALL getSize() override
virtual bool SetState(sal_Int16 aState)
#define SAL_WARN(area, stream)
::cppu::ImplInheritanceHelper< AccessibleContextBase, css::accessibility::XAccessibleExtendedComponent > AccessibleCellBase
virtual bool ResetState(sal_Int16 aState)
static OUString getCellName(sal_Int32 nCol, sal_Int32 nRow)
OUString reverseString(std::u16string_view rStr)
virtual OUString SAL_CALL getToolTipText() override
virtual OUString SAL_CALL getTitledBorderText() override
This class bundles all information that is passed down the tree of accessible shapes so that each sha...
virtual css::awt::Point SAL_CALL getLocation() override
virtual OUString SAL_CALL getImplementationName() override