21#include <com/sun/star/drawing/ShapeCollection.hpp>
22#include <com/sun/star/drawing/XDrawView.hpp>
23#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
24#include <com/sun/star/drawing/XShapes.hpp>
25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/accessibility/AccessibleEventId.hpp>
27#include <com/sun/star/accessibility/AccessibleStateType.hpp>
28#include <com/sun/star/frame/XController.hpp>
29#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
30#include <com/sun/star/lang/XMultiServiceFactory.hpp>
31#include <com/sun/star/view/XSelectionSupplier.hpp>
53#include <osl/mutex.hxx>
63struct XShapePosCompareHelper
65 bool operator() (
const uno::Reference<drawing::XShape>& xshape1,
66 const uno::Reference<drawing::XShape>& xshape2 )
const
85 const uno::Reference<frame::XController>& rxController,
86 const uno::Reference<XAccessible>& rxParent)
88 mpSdViewSh( pViewShell )
95 DBG_ASSERT (rBHelper.bDisposed || rBHelper.bInDispose,
96 "~AccessibleDrawDocumentView: object has not been disposed");
104 uno::Reference<drawing::XShapes> xShapeList;
105 uno::Reference<drawing::XDrawView> xView (
mxController, uno::UNO_QUERY);
107 xShapeList = xView->getCurrentPage();
138 uno::Reference<drawing::XDrawView> xView (
mxController, uno::UNO_QUERY);
141 uno::Reference<beans::XPropertySet> xSet (
142 uno::Reference<beans::XPropertySet> (xView->getCurrentPage(), uno::UNO_QUERY));
146 uno::Reference<lang::XMultiServiceFactory>
xFactory (
mxModel, uno::UNO_QUERY);
147 uno::Reference<drawing::XShape> xRectangle;
149 xRectangle.set(
xFactory->createInstance (
"com.sun.star.drawing.RectangleShape"),
156 awt::Point aPosition;
161 aValue = xSet->getPropertyValue (
"BorderLeft");
162 aValue >>= aPosition.X;
163 aValue = xSet->getPropertyValue (
"BorderTop");
164 aValue >>= aPosition.Y;
165 xRectangle->setPosition (aPosition);
167 aValue = xSet->getPropertyValue (
"Width");
168 aValue >>= aSize.Width;
169 aValue = xSet->getPropertyValue (
"Height");
170 aValue >>= aSize.Height;
171 xRectangle->setSize (aSize);
199uno::Reference<XAccessible> SAL_CALL
204 ::osl::ClearableMutexGuard aGuard (
m_aMutex);
222 if (pChildrenManager ==
nullptr)
223 throw lang::IndexOutOfBoundsException (
224 "no accessible child with index " + OUString::number(
nIndex),
225 static_cast<uno::XWeak*
>(
this));
241 if ( !sFileName.getLength() )
256 if ( sFileName.getLength() )
273 if (rEventObject.Source ==
mxModel)
275 ::osl::Guard< ::osl::Mutex> aGuard (::osl::Mutex::getGlobalMutex());
292 if (rEventObject.PropertyName ==
"CurrentPage" ||
293 rEventObject.PropertyName ==
"PageChange")
299 uno::Reference<drawing::XDrawView> xView (
mxController, uno::UNO_QUERY);
317 CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue, -1);
319 else if ( rEventObject.PropertyName ==
"VisibleArea" )
324 else if (rEventObject.PropertyName ==
"ActiveLayer")
326 CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue, -1);
328 else if (rEventObject.PropertyName ==
"UpdateAcc")
331 uno::Reference<drawing::XDrawView> xView (
mxController, uno::UNO_QUERY);
341 if( xSlideshow.is() && xSlideshow->isRunning() && xSlideshow->isFullScreen() )
343 css::uno::Reference< drawing::XDrawPage > xSlide;
346 css::uno::Reference< css::presentation::XSlideShowController > xSlideController = xSlideshow->getController();
347 if( xSlideController.is() )
349 xSlide = xSlideController->getCurrentSlide();
376 return "AccessibleDrawDocumentView";
379css::uno::Sequence< OUString> SAL_CALL
383 const css::uno::Sequence<OUString> vals {
"com.sun.star.drawing.AccessibleDrawDocumentView" };
397 aReturn = ::cppu::queryInterface (rType,
398 static_cast<XAccessibleGroupPosition*
>(
this)
416uno::Sequence< sal_Int32 > SAL_CALL
425 uno::Sequence< sal_Int32 > aRet( 3 );
427 uno::Reference<XAccessibleContext> xAccContent;
428 rAny >>= xAccContent;
429 if ( !xAccContent.is() )
433 AccessibleShape* pAcc = comphelper::getFromUnoTunnel<AccessibleShape>( xAccContent );
438 uno::Reference< drawing::XShape > xCurShape = pAcc->
GetXShape();
439 if ( !xCurShape.is() )
448 std::vector< uno::Reference<drawing::XShape> > vXShapes;
465 if ( pObj && pPV && pSdView && pSdView->
IsObjMarkable( pObj, pPV ) )
467 vXShapes.push_back( xShape );
471 std::sort( vXShapes.begin(), vXShapes.end(), XShapePosCompareHelper() );
473 auto aIter = std::find_if(vXShapes.begin(), vXShapes.end(),
474 [&xCurShape](
const uno::Reference<drawing::XShape>& rxShape) { return rxShape.get() == xCurShape.get(); });
475 if (aIter != vXShapes.end())
477 sal_Int32* pArray = aRet.getArray();
479 pArray[1] = vXShapes.size();
480 pArray[2] =
static_cast<sal_Int32
>(std::distance(vXShapes.begin(), aIter)) + 1;
491 uno::Reference<XAccessibleContext> xAccContent;
492 rAny >>= xAccContent;
493 if ( !xAccContent.is() )
497 AccessibleShape* pAcc = comphelper::getFromUnoTunnel<AccessibleShape>( xAccContent );
502 uno::Reference< drawing::XShape > xCurShape = pAcc->
GetXShape();
503 if ( !xCurShape.is() )
511 if( pInfo && (pInfo->
meClickAction == presentation::ClickAction_DOCUMENT) )
522 uno::Reference<lang::XServiceInfo> xInfo (
mxController, uno::UNO_QUERY);
525 uno::Sequence< OUString > aServices( xInfo->getSupportedServiceNames() );
526 OUString sFirstService = aServices[0];
527 if ( sFirstService ==
"com.sun.star.drawing.DrawingDocumentDrawView" )
529 if( aServices.getLength() >= 2 && aServices[1] ==
"com.sun.star.presentation.PresentationView")
542 else if ( sFirstService ==
"com.sun.star.presentation.NotesView" )
548 else if ( sFirstService ==
"com.sun.star.presentation.HandoutView" )
556 sName = sFirstService;
561 sName =
"AccessibleDrawDocumentView";
572 uno::Reference< view::XSelectionSupplier > xSel(
mxController, uno::UNO_QUERY );
575 OSL_ENSURE( 0 <= nAccessibleChildIndex,
"AccessibleDrawDocumentView::implIsSelected: invalid index!" );
577 if( xSel.is() && ( 0 <= nAccessibleChildIndex ) )
579 uno::Any aAny( xSel->getSelection() );
580 uno::Reference< drawing::XShapes > xShapes;
590 uno::Reference< drawing::XShape > xShape( pAcc->
GetXShape() );
594 for( sal_Int32
i = 0,
nCount = xShapes->getCount(); (
i <
nCount ) && !bRet; ++
i )
595 if( xShapes->getByIndex(
i ) == xShape )
613 uno::Reference< view::XSelectionSupplier > xSel(
mxController, uno::UNO_QUERY );
625 xSel->select( aAny );
628 uno::Reference< drawing::XShapes > xShapes = drawing::ShapeCollection::create(
639 if( xShapes->getCount() )
641 xSel->select(
Any(xShapes) );
645 else if( nAccessibleChildIndex >= 0 )
657 uno::Reference< drawing::XShape > xShape( pAcc->
GetXShape() );
661 uno::Reference< drawing::XShapes > xShapes;
664 aAny = xSel->getSelection();
670 sal_Int32
nCount = xShapes->getCount();
671 for (sal_Int32
i=0; (
i <
nCount ) && !bFound; ++
i )
672 if( xShapes->getByIndex(
i ) == xShape )
677 xShapes = drawing::ShapeCollection::create(
681 if( !bFound && bSelect )
682 xShapes->add( xShape );
683 else if( bFound && !bSelect )
684 xShapes->remove( xShape );
686 xSel->select(
Any(xShapes) );
697 bool bChange =
false;
702 SetState (AccessibleStateType::FOCUSED);
743 uno::Reference<drawing::XDrawView> xView (
mxController, uno::UNO_QUERY);
746 uno::Reference<beans::XPropertySet> xProperties (xView->getCurrentPage(), UNO_QUERY);
747 if (xProperties.is())
750 sal_Int16 nPageNumber (0);
751 if (xProperties->getPropertyValue(
"Number") >>= nPageNumber)
753 sNewName += OUString::number(nPageNumber);
756 catch (
const beans::UnknownPropertyException&)
762 Reference<drawing::XDrawPagesSupplier> xPagesSupplier (
mxModel, UNO_QUERY);
763 if (xPagesSupplier.is())
765 Reference<container::XIndexAccess> xPages = xPagesSupplier->getDrawPages();
768 sNewName +=
" / " + OUString::number(xPages->getCount());
#define ACCESSIBLE_SELECTION_CHILD_ALL
constexpr OUStringLiteral sReadOnly
css::presentation::ClickAction meClickAction
Action at mouse click.
OUString GetBookmark() const
static SdAnimationInfo * GetShapeUserData(SdrObject &rObject, bool bCreate=false)
SAL_DLLPRIVATE bool getDocReadOnly() const
SAL_DLLPRIVATE const OUString & getDocAccTitle() const
bool IsObjMarkable(SdrObject const *pObj, SdrPageView const *pPV) const
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
sal_uInt32 GetOrdNum() const
SdrPageView * GetSdrPageView() const
OUString GetTitle(sal_uInt16 nMaxLen=0) const
virtual bool SetState(sal_Int64 aState)
virtual bool ResetState(sal_Int64 aState)
void CommitChange(sal_Int16 aEventId, const css::uno::Any &rNewValue, const css::uno::Any &rOldValue, sal_Int32 nValueIndex)
void SetAccessibleName(const OUString &rsName, StringOrigin eNameOrigin)
Base class for the various document views of the Draw and Impress applications.
virtual void SAL_CALL release() noexcept override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nIndex) override
This implementation either returns the active accessible OLE object if it exists and the given index ...
virtual void SAL_CALL disposing() override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
This implementation returns either 1 or 0 depending on whether there is an active accessible OLE obje...
virtual void ViewForwarderChanged() override
A view forwarder change is signalled for instance when any of the window events is received.
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &rEventObject) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void Init()
Initialize a new object.
css::uno::Reference< css::frame::XModel > mxModel
Model of the document.
css::uno::Reference< css::frame::XController > mxController
The controller of the window in which this view is displayed.
virtual void impl_dispose()
virtual void SAL_CALL acquire() noexcept override
AccessibleShapeTreeInfo maShapeTreeInfo
std::unique_ptr< ChildrenManager > mpChildrenManager
This object manages the shapes of the represented draw page.
virtual void SAL_CALL disposing() override
This method is called from the component helper base class while disposing.
virtual void implSelect(sal_Int64 nAccessibleChildIndex, bool bSelect) override
Select or deselect the specified child or all children if the given index has the special value ACCES...
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
This implementation returns either 1 or 0 depending on whether there is an active accessible OLE obje...
void UpdateAccessibleName()
rtl::Reference< AccessiblePageShape > CreateDrawPageShape()
Create a shape the represents the page as seen on the screen.
virtual bool implIsSelected(sal_Int64 nAccessibleChildIndex) override
Return selection state of specified child.
virtual void ViewForwarderChanged() override
A view forwarder change is signalled for instance when any of the window events is received.
virtual OUString CreateAccessibleName() override
Create an accessible name that contains the current view mode.
virtual void SAL_CALL acquire() noexcept override
virtual void Activated() override
Make sure that the currently focused shape sends a FOCUSED state change event indicating that it has ...
virtual void impl_dispose() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
::sd::ViewShell * mpSdViewSh
AccessibleDrawDocumentView(::sd::Window *pSdWindow, ::sd::ViewShell *pViewShell, const css::uno::Reference< css::frame::XController > &rxController, const css::uno::Reference< css::accessibility::XAccessible > &rxParent)
virtual OUString SAL_CALL getImplementationName() override
Returns an identifier for the implementation of this object.
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &rEventObject) override
virtual OUString SAL_CALL getObjectLink(const css::uno::Any &accoject) override
virtual void Deactivated() override
Make sure that the currently focused shape sends a FOCUSED state change event indicating that it has ...
virtual OUString SAL_CALL getAccessibleName() override
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getGroupPosition(const css::uno::Any &rAny) override
virtual void Init() override
Complete the initialization begun in the constructor.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ~AccessibleDrawDocumentView() override
virtual void SAL_CALL release() noexcept override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nIndex) override
This implementation either returns the active accessible OLE object if it exists and the given index ...
A page shape represents the actual page as seen on the screen.
SdrView * GetSdrView() const
const css::uno::Reference< css::drawing::XShape > & GetXShape() const
css::uno::Reference< css::accessibility::XAccessible > GetChild(sal_Int64 nIndex)
static rtl::Reference< SlideShow > GetSlideShow(SdDrawDocument const *pDocument)
Base class of the stacked shell hierarchy.
::sd::View * GetView() const
SD_DLLPUBLIC ViewShellBase & GetViewShellBase() const
DrawDocShell * GetDocSh() const
SdDrawDocument & GetDoc() const
An SdWindow contains the actual working area of ViewShell.
#define DBG_ASSERT(sCon, aError)
Reference< XSingleServiceFactory > xFactory
Sequence< OUString > aServiceNames
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
Reference< XComponentContext > getProcessComponentContext()
#define SFX_TITLE_APINAME
OUString SdResId(TranslateId aId)