15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file
55b190011SAndrew Rist * distributed with this work for additional information
65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file
75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist * "License"); you may not use this file except in compliance
95b190011SAndrew Rist * with the License. You may obtain a copy of the License at
105b190011SAndrew Rist *
115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist *
135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist * software distributed under the License is distributed on an
155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist * KIND, either express or implied. See the License for the
175b190011SAndrew Rist * specific language governing permissions and limitations
185b190011SAndrew Rist * under the License.
195b190011SAndrew Rist *
205b190011SAndrew Rist *************************************************************/
215b190011SAndrew Rist
225b190011SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir #include "AccessibleDocumentViewBase.hxx"
27cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp>
28cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp>
29cdf0e10cSrcweir #include <com/sun/star/drawing/XShapes.hpp>
30cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
31cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp>
32cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
33cdf0e10cSrcweir #include <com/sun/star/document/XEventBroadcaster.hpp>
34cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
35cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
36cdf0e10cSrcweir #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
37cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38cdf0e10cSrcweir #include <rtl/ustring.h>
39cdf0e10cSrcweir #include<sfx2/viewfrm.hxx>
400deba7fbSSteve Yin #include <com/sun/star/accessibility/AccessibleStateType.hpp>
410deba7fbSSteve Yin #include <sfx2/objsh.hxx>
42cdf0e10cSrcweir #include <svx/AccessibleShape.hxx>
43cdf0e10cSrcweir
44cdf0e10cSrcweir #include <svx/svdobj.hxx>
45cdf0e10cSrcweir #include <svx/svdmodel.hxx>
46cdf0e10cSrcweir #include <svx/unoapi.hxx>
47cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
48cdf0e10cSrcweir #include "Window.hxx"
49cdf0e10cSrcweir #include <vcl/svapp.hxx>
500deba7fbSSteve Yin #include "OutlineViewShell.hxx"
51cdf0e10cSrcweir
520deba7fbSSteve Yin #include "SlideViewShell.hxx"
53cdf0e10cSrcweir
540deba7fbSSteve Yin #include <svx/svdlayer.hxx>
550deba7fbSSteve Yin #include <editeng/editobj.hxx>
560deba7fbSSteve Yin #include "LayerTabBar.hxx"
570deba7fbSSteve Yin #include <svtools/colorcfg.hxx>
58cdf0e10cSrcweir #include "ViewShell.hxx"
59cdf0e10cSrcweir #include "View.hxx"
60cdf0e10cSrcweir #include <memory>
61cdf0e10cSrcweir
62cdf0e10cSrcweir using ::rtl::OUString;
63cdf0e10cSrcweir using namespace ::com::sun::star;
64cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
65cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
66cdf0e10cSrcweir
67cdf0e10cSrcweir class SfxViewFrame;
68cdf0e10cSrcweir
69cdf0e10cSrcweir namespace accessibility {
70cdf0e10cSrcweir
71cdf0e10cSrcweir //===== internal ============================================================
AccessibleDocumentViewBase(::sd::Window * pSdWindow,::sd::ViewShell * pViewShell,const uno::Reference<frame::XController> & rxController,const uno::Reference<XAccessible> & rxParent)72cdf0e10cSrcweir AccessibleDocumentViewBase::AccessibleDocumentViewBase (
73cdf0e10cSrcweir ::sd::Window* pSdWindow,
74cdf0e10cSrcweir ::sd::ViewShell* pViewShell,
75cdf0e10cSrcweir const uno::Reference<frame::XController>& rxController,
76cdf0e10cSrcweir const uno::Reference<XAccessible>& rxParent)
77cdf0e10cSrcweir : AccessibleContextBase (rxParent, AccessibleRole::DOCUMENT),
78cdf0e10cSrcweir mpWindow (pSdWindow),
79cdf0e10cSrcweir mxController (rxController),
80cdf0e10cSrcweir mxModel (NULL),
81cdf0e10cSrcweir maViewForwarder (
82cdf0e10cSrcweir static_cast<SdrPaintView*>(pViewShell->GetView()),
83cdf0e10cSrcweir *static_cast<OutputDevice*>(pSdWindow))
84cdf0e10cSrcweir {
85cdf0e10cSrcweir if (mxController.is())
86cdf0e10cSrcweir mxModel = mxController->getModel();
87cdf0e10cSrcweir
88cdf0e10cSrcweir // Fill the shape tree info.
89cdf0e10cSrcweir maShapeTreeInfo.SetModelBroadcaster (
90cdf0e10cSrcweir uno::Reference<document::XEventBroadcaster>(
91cdf0e10cSrcweir mxModel, uno::UNO_QUERY));
92cdf0e10cSrcweir maShapeTreeInfo.SetController (mxController);
93cdf0e10cSrcweir maShapeTreeInfo.SetSdrView (pViewShell->GetView());
94cdf0e10cSrcweir maShapeTreeInfo.SetWindow (pSdWindow);
95cdf0e10cSrcweir maShapeTreeInfo.SetViewForwarder (&maViewForwarder);
96cdf0e10cSrcweir
97cdf0e10cSrcweir mxWindow = ::VCLUnoHelper::GetInterface (pSdWindow);
980deba7fbSSteve Yin mpViewShell = pViewShell;
99cdf0e10cSrcweir }
100cdf0e10cSrcweir
101cdf0e10cSrcweir
102cdf0e10cSrcweir
103cdf0e10cSrcweir
~AccessibleDocumentViewBase(void)104cdf0e10cSrcweir AccessibleDocumentViewBase::~AccessibleDocumentViewBase (void)
105cdf0e10cSrcweir {
106cdf0e10cSrcweir // At this place we should be disposed. You may want to add a
107cdf0e10cSrcweir // corresponding assertion into the destructor of a derived class.
108cdf0e10cSrcweir }
109cdf0e10cSrcweir
110cdf0e10cSrcweir
111cdf0e10cSrcweir
112cdf0e10cSrcweir
Init(void)113cdf0e10cSrcweir void AccessibleDocumentViewBase::Init (void)
114cdf0e10cSrcweir {
115cdf0e10cSrcweir // Finish the initialization of the shape tree info container.
116cdf0e10cSrcweir maShapeTreeInfo.SetDocumentWindow (this);
117cdf0e10cSrcweir
118cdf0e10cSrcweir // Register as window listener to stay up to date with its size and
119cdf0e10cSrcweir // position.
120cdf0e10cSrcweir mxWindow->addWindowListener (this);
121cdf0e10cSrcweir // Register as focus listener to
122cdf0e10cSrcweir mxWindow->addFocusListener (this);
123cdf0e10cSrcweir
124cdf0e10cSrcweir // Determine the list of shapes on the current page.
125cdf0e10cSrcweir uno::Reference<drawing::XShapes> xShapeList;
126cdf0e10cSrcweir uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
127cdf0e10cSrcweir if (xView.is())
128cdf0e10cSrcweir xShapeList = uno::Reference<drawing::XShapes> (
129cdf0e10cSrcweir xView->getCurrentPage(), uno::UNO_QUERY);
130cdf0e10cSrcweir
131cdf0e10cSrcweir // Register this object as dispose event listener at the model.
132cdf0e10cSrcweir if (mxModel.is())
133cdf0e10cSrcweir mxModel->addEventListener (
134cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this));
135cdf0e10cSrcweir
136cdf0e10cSrcweir // Register as property change listener at the controller.
137cdf0e10cSrcweir uno::Reference<beans::XPropertySet> xSet (mxController, uno::UNO_QUERY);
138cdf0e10cSrcweir if (xSet.is())
139cdf0e10cSrcweir xSet->addPropertyChangeListener (
140cdf0e10cSrcweir OUString (RTL_CONSTASCII_USTRINGPARAM("")),
141cdf0e10cSrcweir static_cast<beans::XPropertyChangeListener*>(this));
142cdf0e10cSrcweir
143cdf0e10cSrcweir // Register this object as dispose event listener at the controller.
144cdf0e10cSrcweir if (mxController.is())
145cdf0e10cSrcweir mxController->addEventListener (
146cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this));
147cdf0e10cSrcweir
148cdf0e10cSrcweir // Register at VCL Window to be informed of activated and deactivated
149cdf0e10cSrcweir // OLE objects.
150cdf0e10cSrcweir Window* pWindow = maShapeTreeInfo.GetWindow();
151cdf0e10cSrcweir if (pWindow != NULL)
152cdf0e10cSrcweir {
153cdf0e10cSrcweir maWindowLink = LINK(
154cdf0e10cSrcweir this, AccessibleDocumentViewBase, WindowChildEventListener);
155cdf0e10cSrcweir
156cdf0e10cSrcweir pWindow->AddChildEventListener (maWindowLink);
157cdf0e10cSrcweir
158cdf0e10cSrcweir sal_uInt16 nCount = pWindow->GetChildCount();
159cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount; i++)
160cdf0e10cSrcweir {
161cdf0e10cSrcweir Window* pChildWindow = pWindow->GetChild (i);
162cdf0e10cSrcweir if (pChildWindow &&
163cdf0e10cSrcweir (AccessibleRole::EMBEDDED_OBJECT
164cdf0e10cSrcweir ==pChildWindow->GetAccessibleRole()))
165cdf0e10cSrcweir {
166cdf0e10cSrcweir SetAccessibleOLEObject (pChildWindow->GetAccessible());
167cdf0e10cSrcweir }
168cdf0e10cSrcweir }
169cdf0e10cSrcweir }
1700deba7fbSSteve Yin SfxObjectShell* pObjShell = mpViewShell->GetViewFrame()->GetObjectShell();
1710deba7fbSSteve Yin if(!pObjShell->IsReadOnly())
1720deba7fbSSteve Yin SetState(AccessibleStateType::EDITABLE);
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
175cdf0e10cSrcweir
176cdf0e10cSrcweir
177cdf0e10cSrcweir
IMPL_LINK(AccessibleDocumentViewBase,WindowChildEventListener,VclSimpleEvent *,pEvent)178cdf0e10cSrcweir IMPL_LINK(AccessibleDocumentViewBase, WindowChildEventListener,
179cdf0e10cSrcweir VclSimpleEvent*, pEvent)
180cdf0e10cSrcweir {
181cdf0e10cSrcweir OSL_ASSERT(pEvent!=NULL && pEvent->ISA(VclWindowEvent));
182cdf0e10cSrcweir if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
183cdf0e10cSrcweir {
184cdf0e10cSrcweir VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
185cdf0e10cSrcweir // DBG_ASSERT( pVclEvent->GetWindow(), "Window???" );
186cdf0e10cSrcweir switch (pWindowEvent->GetId())
187cdf0e10cSrcweir {
188cdf0e10cSrcweir case VCLEVENT_OBJECT_DYING:
189cdf0e10cSrcweir {
190cdf0e10cSrcweir // Window is dying. Unregister from VCL Window.
191cdf0e10cSrcweir // This is also attempted in the disposing() method.
192cdf0e10cSrcweir Window* pWindow = maShapeTreeInfo.GetWindow();
193cdf0e10cSrcweir Window* pDyingWindow = static_cast<Window*>(
194cdf0e10cSrcweir pWindowEvent->GetWindow());
195cdf0e10cSrcweir if (pWindow==pDyingWindow && pWindow!=NULL && maWindowLink.IsSet())
196cdf0e10cSrcweir {
197cdf0e10cSrcweir pWindow->RemoveChildEventListener (maWindowLink);
198cdf0e10cSrcweir maWindowLink = Link();
199cdf0e10cSrcweir }
200cdf0e10cSrcweir }
201cdf0e10cSrcweir break;
202cdf0e10cSrcweir
203cdf0e10cSrcweir case VCLEVENT_WINDOW_SHOW:
204cdf0e10cSrcweir {
205cdf0e10cSrcweir // A new window has been created. Is it an OLE object?
206cdf0e10cSrcweir Window* pChildWindow = static_cast<Window*>(
207cdf0e10cSrcweir pWindowEvent->GetData());
208cdf0e10cSrcweir if (pChildWindow!=NULL
209cdf0e10cSrcweir && (pChildWindow->GetAccessibleRole()
210cdf0e10cSrcweir == AccessibleRole::EMBEDDED_OBJECT))
211cdf0e10cSrcweir {
212cdf0e10cSrcweir SetAccessibleOLEObject (pChildWindow->GetAccessible());
213cdf0e10cSrcweir }
214cdf0e10cSrcweir }
215cdf0e10cSrcweir break;
216cdf0e10cSrcweir
217cdf0e10cSrcweir case VCLEVENT_WINDOW_HIDE:
218cdf0e10cSrcweir {
219cdf0e10cSrcweir // A window has been destroyed. Has that been an OLE
220cdf0e10cSrcweir // object?
221cdf0e10cSrcweir Window* pChildWindow = static_cast<Window*>(
222cdf0e10cSrcweir pWindowEvent->GetData());
223cdf0e10cSrcweir if (pChildWindow!=NULL
224cdf0e10cSrcweir && (pChildWindow->GetAccessibleRole()
225cdf0e10cSrcweir == AccessibleRole::EMBEDDED_OBJECT))
226cdf0e10cSrcweir {
227cdf0e10cSrcweir SetAccessibleOLEObject (NULL);
228cdf0e10cSrcweir }
229cdf0e10cSrcweir }
230cdf0e10cSrcweir break;
231cdf0e10cSrcweir }
232cdf0e10cSrcweir }
233cdf0e10cSrcweir
234cdf0e10cSrcweir return 0;
235cdf0e10cSrcweir }
236cdf0e10cSrcweir
237cdf0e10cSrcweir
238cdf0e10cSrcweir
239cdf0e10cSrcweir
240cdf0e10cSrcweir //===== IAccessibleViewForwarderListener ====================================
241cdf0e10cSrcweir
ViewForwarderChanged(ChangeType,const IAccessibleViewForwarder *)242cdf0e10cSrcweir void AccessibleDocumentViewBase::ViewForwarderChanged(ChangeType, const IAccessibleViewForwarder* )
243cdf0e10cSrcweir {
244cdf0e10cSrcweir // Empty
245cdf0e10cSrcweir }
246cdf0e10cSrcweir
247cdf0e10cSrcweir
248cdf0e10cSrcweir
249cdf0e10cSrcweir
250cdf0e10cSrcweir //===== XAccessibleContext ==================================================
251cdf0e10cSrcweir
252cdf0e10cSrcweir Reference<XAccessible> SAL_CALL
getAccessibleParent(void)253cdf0e10cSrcweir AccessibleDocumentViewBase::getAccessibleParent (void)
254cdf0e10cSrcweir throw (uno::RuntimeException)
255cdf0e10cSrcweir {
256cdf0e10cSrcweir ThrowIfDisposed ();
257cdf0e10cSrcweir
258cdf0e10cSrcweir return AccessibleContextBase::getAccessibleParent();
259cdf0e10cSrcweir }
260cdf0e10cSrcweir
261cdf0e10cSrcweir
262cdf0e10cSrcweir
263cdf0e10cSrcweir sal_Int32 SAL_CALL
getAccessibleChildCount(void)264cdf0e10cSrcweir AccessibleDocumentViewBase::getAccessibleChildCount (void)
265cdf0e10cSrcweir throw (uno::RuntimeException)
266cdf0e10cSrcweir {
267cdf0e10cSrcweir ThrowIfDisposed ();
268cdf0e10cSrcweir
269cdf0e10cSrcweir if (mxAccessibleOLEObject.is())
270cdf0e10cSrcweir return 1;
271cdf0e10cSrcweir else
272cdf0e10cSrcweir return 0;
273cdf0e10cSrcweir }
274cdf0e10cSrcweir
275cdf0e10cSrcweir
276cdf0e10cSrcweir
277cdf0e10cSrcweir
278cdf0e10cSrcweir Reference<XAccessible> SAL_CALL
getAccessibleChild(sal_Int32 nIndex)279cdf0e10cSrcweir AccessibleDocumentViewBase::getAccessibleChild (sal_Int32 nIndex)
280cdf0e10cSrcweir throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
281cdf0e10cSrcweir {
282cdf0e10cSrcweir ThrowIfDisposed ();
283cdf0e10cSrcweir
284cdf0e10cSrcweir ::osl::MutexGuard aGuard (maMutex);
285cdf0e10cSrcweir if (mxAccessibleOLEObject.is())
286cdf0e10cSrcweir if (nIndex == 0)
287cdf0e10cSrcweir return mxAccessibleOLEObject;
288cdf0e10cSrcweir
289cdf0e10cSrcweir throw lang::IndexOutOfBoundsException (
290cdf0e10cSrcweir ::rtl::OUString::createFromAscii ("no child with index ")
291cdf0e10cSrcweir + rtl::OUString::valueOf(nIndex),
292cdf0e10cSrcweir NULL);
293cdf0e10cSrcweir }
294cdf0e10cSrcweir
295cdf0e10cSrcweir
296cdf0e10cSrcweir
297cdf0e10cSrcweir
298cdf0e10cSrcweir //===== XAccessibleComponent ================================================
299cdf0e10cSrcweir
300cdf0e10cSrcweir /** Iterate over all children and test whether the specified point lies
301cdf0e10cSrcweir within one of their bounding boxes. Return the first child for which
302cdf0e10cSrcweir this is true.
303cdf0e10cSrcweir */
304cdf0e10cSrcweir uno::Reference<XAccessible > SAL_CALL
getAccessibleAtPoint(const awt::Point & aPoint)305cdf0e10cSrcweir AccessibleDocumentViewBase::getAccessibleAtPoint (
306cdf0e10cSrcweir const awt::Point& aPoint)
307cdf0e10cSrcweir throw (uno::RuntimeException)
308cdf0e10cSrcweir {
309cdf0e10cSrcweir ThrowIfDisposed ();
310cdf0e10cSrcweir
311cdf0e10cSrcweir ::osl::MutexGuard aGuard (maMutex);
312cdf0e10cSrcweir uno::Reference<XAccessible> xChildAtPosition;
313cdf0e10cSrcweir
314cdf0e10cSrcweir sal_Int32 nChildCount = getAccessibleChildCount ();
315cdf0e10cSrcweir for (sal_Int32 i=nChildCount-1; i>=0; --i)
316cdf0e10cSrcweir {
317cdf0e10cSrcweir Reference<XAccessible> xChild (getAccessibleChild (i));
318cdf0e10cSrcweir if (xChild.is())
319cdf0e10cSrcweir {
320cdf0e10cSrcweir Reference<XAccessibleComponent> xChildComponent (
321cdf0e10cSrcweir xChild->getAccessibleContext(), uno::UNO_QUERY);
322cdf0e10cSrcweir if (xChildComponent.is())
323cdf0e10cSrcweir {
324cdf0e10cSrcweir awt::Rectangle aBBox (xChildComponent->getBounds());
325cdf0e10cSrcweir if ( (aPoint.X >= aBBox.X)
326cdf0e10cSrcweir && (aPoint.Y >= aBBox.Y)
327cdf0e10cSrcweir && (aPoint.X < aBBox.X+aBBox.Width)
328cdf0e10cSrcweir && (aPoint.Y < aBBox.Y+aBBox.Height) )
329cdf0e10cSrcweir {
330cdf0e10cSrcweir xChildAtPosition = xChild;
331cdf0e10cSrcweir break;
332cdf0e10cSrcweir }
333cdf0e10cSrcweir }
334cdf0e10cSrcweir }
335cdf0e10cSrcweir }
336cdf0e10cSrcweir
337cdf0e10cSrcweir // Have not found a child under the given point. Returning empty
338cdf0e10cSrcweir // reference to indicate this.
339cdf0e10cSrcweir return xChildAtPosition;
340cdf0e10cSrcweir }
341cdf0e10cSrcweir
342cdf0e10cSrcweir
343cdf0e10cSrcweir
344cdf0e10cSrcweir
345cdf0e10cSrcweir awt::Rectangle SAL_CALL
getBounds(void)346cdf0e10cSrcweir AccessibleDocumentViewBase::getBounds (void)
347cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
348cdf0e10cSrcweir {
349cdf0e10cSrcweir ThrowIfDisposed ();
350cdf0e10cSrcweir
351cdf0e10cSrcweir // Transform visible area into screen coordinates.
352cdf0e10cSrcweir ::Rectangle aVisibleArea (
353cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->GetVisibleArea());
354cdf0e10cSrcweir ::Point aPixelTopLeft (
355cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
356cdf0e10cSrcweir aVisibleArea.TopLeft()));
357cdf0e10cSrcweir ::Point aPixelSize (
358cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
359cdf0e10cSrcweir aVisibleArea.BottomRight())
360cdf0e10cSrcweir - aPixelTopLeft);
361cdf0e10cSrcweir
362cdf0e10cSrcweir // Prepare to subtract the parent position to transform into relative
363cdf0e10cSrcweir // coordinates.
364cdf0e10cSrcweir awt::Point aParentPosition;
365cdf0e10cSrcweir Reference<XAccessible> xParent = getAccessibleParent ();
366cdf0e10cSrcweir if (xParent.is())
367cdf0e10cSrcweir {
368cdf0e10cSrcweir Reference<XAccessibleComponent> xParentComponent (
369cdf0e10cSrcweir xParent->getAccessibleContext(), uno::UNO_QUERY);
370cdf0e10cSrcweir if (xParentComponent.is())
371cdf0e10cSrcweir aParentPosition = xParentComponent->getLocationOnScreen();
372cdf0e10cSrcweir }
373cdf0e10cSrcweir
374cdf0e10cSrcweir return awt::Rectangle (
375cdf0e10cSrcweir aPixelTopLeft.X() - aParentPosition.X,
376cdf0e10cSrcweir aPixelTopLeft.Y() - aParentPosition.Y,
377cdf0e10cSrcweir aPixelSize.X(),
378cdf0e10cSrcweir aPixelSize.Y());
379cdf0e10cSrcweir }
380cdf0e10cSrcweir
381cdf0e10cSrcweir
382cdf0e10cSrcweir
383cdf0e10cSrcweir
384cdf0e10cSrcweir awt::Point SAL_CALL
getLocation(void)385cdf0e10cSrcweir AccessibleDocumentViewBase::getLocation (void)
386cdf0e10cSrcweir throw (uno::RuntimeException)
387cdf0e10cSrcweir {
388cdf0e10cSrcweir ThrowIfDisposed ();
389cdf0e10cSrcweir awt::Rectangle aBoundingBox (getBounds());
390cdf0e10cSrcweir return awt::Point (aBoundingBox.X, aBoundingBox.Y);
391cdf0e10cSrcweir }
392cdf0e10cSrcweir
393cdf0e10cSrcweir
394cdf0e10cSrcweir
395cdf0e10cSrcweir
396cdf0e10cSrcweir awt::Point SAL_CALL
getLocationOnScreen(void)397cdf0e10cSrcweir AccessibleDocumentViewBase::getLocationOnScreen (void)
398cdf0e10cSrcweir throw (uno::RuntimeException)
399cdf0e10cSrcweir {
400cdf0e10cSrcweir ThrowIfDisposed ();
401cdf0e10cSrcweir ::Point aLogicalPoint (maShapeTreeInfo.GetViewForwarder()->GetVisibleArea().TopLeft());
402cdf0e10cSrcweir ::Point aPixelPoint (maShapeTreeInfo.GetViewForwarder()->LogicToPixel (aLogicalPoint));
403cdf0e10cSrcweir return awt::Point (aPixelPoint.X(), aPixelPoint.Y());
404cdf0e10cSrcweir }
405cdf0e10cSrcweir
406cdf0e10cSrcweir
407cdf0e10cSrcweir
408cdf0e10cSrcweir
409cdf0e10cSrcweir awt::Size SAL_CALL
getSize(void)410cdf0e10cSrcweir AccessibleDocumentViewBase::getSize (void)
411cdf0e10cSrcweir throw (uno::RuntimeException)
412cdf0e10cSrcweir {
413cdf0e10cSrcweir ThrowIfDisposed ();
414cdf0e10cSrcweir
415cdf0e10cSrcweir // Transform visible area into screen coordinates.
416cdf0e10cSrcweir ::Rectangle aVisibleArea (
417cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->GetVisibleArea());
418cdf0e10cSrcweir ::Point aPixelTopLeft (
419cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
420cdf0e10cSrcweir aVisibleArea.TopLeft()));
421cdf0e10cSrcweir ::Point aPixelSize (
422cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
423cdf0e10cSrcweir aVisibleArea.BottomRight())
424cdf0e10cSrcweir - aPixelTopLeft);
425cdf0e10cSrcweir
426cdf0e10cSrcweir return awt::Size (aPixelSize.X(), aPixelSize.Y());
427cdf0e10cSrcweir }
428cdf0e10cSrcweir
429cdf0e10cSrcweir
430cdf0e10cSrcweir
431cdf0e10cSrcweir
432cdf0e10cSrcweir //===== XInterface ==========================================================
433cdf0e10cSrcweir
434cdf0e10cSrcweir uno::Any SAL_CALL
queryInterface(const uno::Type & rType)435cdf0e10cSrcweir AccessibleDocumentViewBase::queryInterface (const uno::Type & rType)
436cdf0e10cSrcweir throw (uno::RuntimeException)
437cdf0e10cSrcweir {
438cdf0e10cSrcweir uno::Any aReturn = AccessibleContextBase::queryInterface (rType);
439cdf0e10cSrcweir if ( ! aReturn.hasValue())
440cdf0e10cSrcweir aReturn = ::cppu::queryInterface (rType,
441cdf0e10cSrcweir static_cast<XAccessibleComponent*>(this),
442cdf0e10cSrcweir static_cast<XAccessibleSelection*>(this),
443cdf0e10cSrcweir static_cast<lang::XEventListener*>(
444cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this)),
445cdf0e10cSrcweir static_cast<beans::XPropertyChangeListener*>(this),
446cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this),
447cdf0e10cSrcweir static_cast<awt::XFocusListener*>(this)
4480deba7fbSSteve Yin ,static_cast<XAccessibleExtendedAttributes*>(this)
4490deba7fbSSteve Yin ,static_cast<XAccessibleGetAccFlowTo*>(this)
450cdf0e10cSrcweir );
451cdf0e10cSrcweir return aReturn;
452cdf0e10cSrcweir }
453cdf0e10cSrcweir
454cdf0e10cSrcweir
455cdf0e10cSrcweir
456cdf0e10cSrcweir
457cdf0e10cSrcweir void SAL_CALL
acquire(void)458cdf0e10cSrcweir AccessibleDocumentViewBase::acquire (void)
459cdf0e10cSrcweir throw ()
460cdf0e10cSrcweir {
461cdf0e10cSrcweir AccessibleContextBase::acquire ();
462cdf0e10cSrcweir }
463cdf0e10cSrcweir
464cdf0e10cSrcweir
465cdf0e10cSrcweir
466cdf0e10cSrcweir
467cdf0e10cSrcweir void SAL_CALL
release(void)468cdf0e10cSrcweir AccessibleDocumentViewBase::release (void)
469cdf0e10cSrcweir throw ()
470cdf0e10cSrcweir {
471cdf0e10cSrcweir AccessibleContextBase::release ();
472cdf0e10cSrcweir }
473cdf0e10cSrcweir
474cdf0e10cSrcweir
475cdf0e10cSrcweir
476cdf0e10cSrcweir
477cdf0e10cSrcweir //===== XServiceInfo ========================================================
478cdf0e10cSrcweir
479cdf0e10cSrcweir ::rtl::OUString SAL_CALL
getImplementationName(void)480cdf0e10cSrcweir AccessibleDocumentViewBase::getImplementationName (void)
481cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
482cdf0e10cSrcweir {
483cdf0e10cSrcweir return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleDocumentViewBase"));
484cdf0e10cSrcweir }
485cdf0e10cSrcweir
486cdf0e10cSrcweir
487cdf0e10cSrcweir
488cdf0e10cSrcweir
489cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
getSupportedServiceNames(void)490cdf0e10cSrcweir AccessibleDocumentViewBase::getSupportedServiceNames (void)
491cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
492cdf0e10cSrcweir {
493cdf0e10cSrcweir ThrowIfDisposed ();
494cdf0e10cSrcweir return AccessibleContextBase::getSupportedServiceNames ();
495cdf0e10cSrcweir }
496cdf0e10cSrcweir
497cdf0e10cSrcweir
498cdf0e10cSrcweir
499cdf0e10cSrcweir
500cdf0e10cSrcweir
501cdf0e10cSrcweir //===== XTypeProvider =======================================================
502cdf0e10cSrcweir
503cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
getTypes(void)504cdf0e10cSrcweir AccessibleDocumentViewBase::getTypes (void)
505cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
506cdf0e10cSrcweir {
507cdf0e10cSrcweir ThrowIfDisposed ();
508cdf0e10cSrcweir
509cdf0e10cSrcweir // Get list of types from the context base implementation, ...
510cdf0e10cSrcweir uno::Sequence<uno::Type> aTypeList (AccessibleContextBase::getTypes());
511cdf0e10cSrcweir // ... get list of types from component base implementation, ...
512cdf0e10cSrcweir uno::Sequence<uno::Type> aComponentTypeList (AccessibleComponentBase::getTypes());
513cdf0e10cSrcweir
514cdf0e10cSrcweir
515cdf0e10cSrcweir // ...and add the additional type for the component, ...
516cdf0e10cSrcweir const uno::Type aLangEventListenerType =
517cdf0e10cSrcweir ::getCppuType((const uno::Reference<lang::XEventListener>*)0);
518cdf0e10cSrcweir const uno::Type aPropertyChangeListenerType =
519cdf0e10cSrcweir ::getCppuType((const uno::Reference<beans::XPropertyChangeListener>*)0);
520cdf0e10cSrcweir const uno::Type aWindowListenerType =
521cdf0e10cSrcweir ::getCppuType((const uno::Reference<awt::XWindowListener>*)0);
522cdf0e10cSrcweir const uno::Type aFocusListenerType =
523cdf0e10cSrcweir ::getCppuType((const uno::Reference<awt::XFocusListener>*)0);
524cdf0e10cSrcweir const uno::Type aEventBroadcaster =
525cdf0e10cSrcweir ::getCppuType((const uno::Reference<XAccessibleEventBroadcaster>*)0);
526cdf0e10cSrcweir
527cdf0e10cSrcweir // ... and merge them all into one list.
528cdf0e10cSrcweir sal_Int32 nTypeCount (aTypeList.getLength()),
529cdf0e10cSrcweir nComponentTypeCount (aComponentTypeList.getLength()),
530cdf0e10cSrcweir i;
531cdf0e10cSrcweir
532cdf0e10cSrcweir aTypeList.realloc (nTypeCount + nComponentTypeCount + 5);
533cdf0e10cSrcweir
534cdf0e10cSrcweir for (i=0; i<nComponentTypeCount; i++)
535cdf0e10cSrcweir aTypeList[nTypeCount + i] = aComponentTypeList[i];
536cdf0e10cSrcweir
537cdf0e10cSrcweir aTypeList[nTypeCount + i++ ] = aLangEventListenerType;
538cdf0e10cSrcweir aTypeList[nTypeCount + i++] = aPropertyChangeListenerType;
539cdf0e10cSrcweir aTypeList[nTypeCount + i++] = aWindowListenerType;
540cdf0e10cSrcweir aTypeList[nTypeCount + i++] = aFocusListenerType;
541cdf0e10cSrcweir aTypeList[nTypeCount + i++] = aEventBroadcaster;
542cdf0e10cSrcweir
543cdf0e10cSrcweir return aTypeList;
544cdf0e10cSrcweir }
545cdf0e10cSrcweir
546cdf0e10cSrcweir
547cdf0e10cSrcweir
548cdf0e10cSrcweir
impl_dispose()549cdf0e10cSrcweir void AccessibleDocumentViewBase::impl_dispose()
550cdf0e10cSrcweir {
551cdf0e10cSrcweir // Unregister from VCL Window.
552cdf0e10cSrcweir Window* pWindow = maShapeTreeInfo.GetWindow();
553cdf0e10cSrcweir if (maWindowLink.IsSet())
554cdf0e10cSrcweir {
555cdf0e10cSrcweir if (pWindow)
556cdf0e10cSrcweir pWindow->RemoveChildEventListener (maWindowLink);
557cdf0e10cSrcweir maWindowLink = Link();
558cdf0e10cSrcweir }
559cdf0e10cSrcweir else
560cdf0e10cSrcweir {
561cdf0e10cSrcweir DBG_ASSERT (pWindow, "AccessibleDocumentViewBase::disposing");
562cdf0e10cSrcweir }
563cdf0e10cSrcweir
564cdf0e10cSrcweir // Unregister from window.
565cdf0e10cSrcweir if (mxWindow.is())
566cdf0e10cSrcweir {
567cdf0e10cSrcweir mxWindow->removeWindowListener (this);
568cdf0e10cSrcweir mxWindow->removeFocusListener (this);
569cdf0e10cSrcweir mxWindow = NULL;
570cdf0e10cSrcweir }
571cdf0e10cSrcweir
572cdf0e10cSrcweir // Unregister form the model.
573cdf0e10cSrcweir if (mxModel.is())
574cdf0e10cSrcweir mxModel->removeEventListener (
575cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this));
576cdf0e10cSrcweir
577cdf0e10cSrcweir // Unregister from the controller.
578cdf0e10cSrcweir if (mxController.is())
579cdf0e10cSrcweir {
580cdf0e10cSrcweir uno::Reference<beans::XPropertySet> xSet (mxController, uno::UNO_QUERY);
581cdf0e10cSrcweir if (xSet.is())
582cdf0e10cSrcweir xSet->removePropertyChangeListener (
583cdf0e10cSrcweir OUString (RTL_CONSTASCII_USTRINGPARAM("")),
584cdf0e10cSrcweir static_cast<beans::XPropertyChangeListener*>(this));
585cdf0e10cSrcweir
586cdf0e10cSrcweir mxController->removeEventListener (
587cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this));
588cdf0e10cSrcweir }
589cdf0e10cSrcweir
590cdf0e10cSrcweir // Propagate change of controller down the shape tree.
591cdf0e10cSrcweir maShapeTreeInfo.SetControllerBroadcaster (NULL);
592cdf0e10cSrcweir
593cdf0e10cSrcweir // Reset the model reference.
594cdf0e10cSrcweir mxModel = NULL;
595cdf0e10cSrcweir // Reset the model reference.
596cdf0e10cSrcweir mxController = NULL;
597cdf0e10cSrcweir
598cdf0e10cSrcweir maShapeTreeInfo.SetDocumentWindow (NULL);
599cdf0e10cSrcweir }
600cdf0e10cSrcweir
601cdf0e10cSrcweir
602cdf0e10cSrcweir
603cdf0e10cSrcweir
604cdf0e10cSrcweir //===== XEventListener ======================================================
605cdf0e10cSrcweir
606cdf0e10cSrcweir void SAL_CALL
disposing(const lang::EventObject & rEventObject)607cdf0e10cSrcweir AccessibleDocumentViewBase::disposing (const lang::EventObject& rEventObject)
608cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
609cdf0e10cSrcweir {
610cdf0e10cSrcweir ThrowIfDisposed ();
611cdf0e10cSrcweir
612cdf0e10cSrcweir // Register this object as dispose event and document::XEventListener
613cdf0e10cSrcweir // listener at the model.
614cdf0e10cSrcweir
615cdf0e10cSrcweir if ( ! rEventObject.Source.is())
616cdf0e10cSrcweir {
617cdf0e10cSrcweir // Paranoia. Can this really happen?
618cdf0e10cSrcweir }
619cdf0e10cSrcweir else if (rEventObject.Source == mxModel || rEventObject.Source == mxController)
620cdf0e10cSrcweir {
621cdf0e10cSrcweir impl_dispose();
622cdf0e10cSrcweir }
623cdf0e10cSrcweir }
624cdf0e10cSrcweir
625cdf0e10cSrcweir //===== XPropertyChangeListener =============================================
626cdf0e10cSrcweir
propertyChange(const beans::PropertyChangeEvent &)627cdf0e10cSrcweir void SAL_CALL AccessibleDocumentViewBase::propertyChange (const beans::PropertyChangeEvent& )
628cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
629cdf0e10cSrcweir {
630cdf0e10cSrcweir // Empty
631cdf0e10cSrcweir }
632cdf0e10cSrcweir
633cdf0e10cSrcweir
634cdf0e10cSrcweir
635cdf0e10cSrcweir
636cdf0e10cSrcweir //===== XWindowListener =====================================================
637cdf0e10cSrcweir
638cdf0e10cSrcweir void SAL_CALL
windowResized(const::com::sun::star::awt::WindowEvent &)639cdf0e10cSrcweir AccessibleDocumentViewBase::windowResized (const ::com::sun::star::awt::WindowEvent& )
640cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
641cdf0e10cSrcweir {
642cdf0e10cSrcweir if( IsDisposed() )
643cdf0e10cSrcweir return;
644cdf0e10cSrcweir
645cdf0e10cSrcweir ViewForwarderChanged (
646cdf0e10cSrcweir IAccessibleViewForwarderListener::VISIBLE_AREA,
647cdf0e10cSrcweir &maViewForwarder);
648cdf0e10cSrcweir }
649cdf0e10cSrcweir
650cdf0e10cSrcweir
651cdf0e10cSrcweir
652cdf0e10cSrcweir
653cdf0e10cSrcweir void SAL_CALL
windowMoved(const::com::sun::star::awt::WindowEvent &)654cdf0e10cSrcweir AccessibleDocumentViewBase::windowMoved (const ::com::sun::star::awt::WindowEvent& )
655cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
656cdf0e10cSrcweir {
657cdf0e10cSrcweir if( IsDisposed() )
658cdf0e10cSrcweir return;
659cdf0e10cSrcweir
660cdf0e10cSrcweir ViewForwarderChanged (
661cdf0e10cSrcweir IAccessibleViewForwarderListener::VISIBLE_AREA,
662cdf0e10cSrcweir &maViewForwarder);
663cdf0e10cSrcweir }
664cdf0e10cSrcweir
665cdf0e10cSrcweir
666cdf0e10cSrcweir
667cdf0e10cSrcweir
668cdf0e10cSrcweir void SAL_CALL
windowShown(const::com::sun::star::lang::EventObject &)669cdf0e10cSrcweir AccessibleDocumentViewBase::windowShown (const ::com::sun::star::lang::EventObject& )
670cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
671cdf0e10cSrcweir {
672cdf0e10cSrcweir if( IsDisposed() )
673cdf0e10cSrcweir return;
674cdf0e10cSrcweir
675cdf0e10cSrcweir ViewForwarderChanged (
676cdf0e10cSrcweir IAccessibleViewForwarderListener::VISIBLE_AREA,
677cdf0e10cSrcweir &maViewForwarder);
678cdf0e10cSrcweir }
679cdf0e10cSrcweir
680cdf0e10cSrcweir
681cdf0e10cSrcweir
682cdf0e10cSrcweir
683cdf0e10cSrcweir void SAL_CALL
windowHidden(const::com::sun::star::lang::EventObject &)684cdf0e10cSrcweir AccessibleDocumentViewBase::windowHidden (const ::com::sun::star::lang::EventObject& )
685cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
686cdf0e10cSrcweir {
687cdf0e10cSrcweir if( IsDisposed() )
688cdf0e10cSrcweir return;
689cdf0e10cSrcweir
690cdf0e10cSrcweir ViewForwarderChanged (
691cdf0e10cSrcweir IAccessibleViewForwarderListener::VISIBLE_AREA,
692cdf0e10cSrcweir &maViewForwarder);
693cdf0e10cSrcweir }
694cdf0e10cSrcweir
695cdf0e10cSrcweir
696cdf0e10cSrcweir
697cdf0e10cSrcweir
698cdf0e10cSrcweir //===== XFocusListener ==================================================
699cdf0e10cSrcweir
focusGained(const::com::sun::star::awt::FocusEvent & e)700cdf0e10cSrcweir void AccessibleDocumentViewBase::focusGained (const ::com::sun::star::awt::FocusEvent& e)
701cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
702cdf0e10cSrcweir {
703cdf0e10cSrcweir ThrowIfDisposed ();
704cdf0e10cSrcweir if (e.Source == mxWindow)
705cdf0e10cSrcweir Activated ();
706cdf0e10cSrcweir }
707cdf0e10cSrcweir
focusLost(const::com::sun::star::awt::FocusEvent & e)708cdf0e10cSrcweir void AccessibleDocumentViewBase::focusLost (const ::com::sun::star::awt::FocusEvent& e)
709cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
710cdf0e10cSrcweir {
711cdf0e10cSrcweir ThrowIfDisposed ();
712cdf0e10cSrcweir if (e.Source == mxWindow)
713cdf0e10cSrcweir Deactivated ();
714cdf0e10cSrcweir }
715cdf0e10cSrcweir
716cdf0e10cSrcweir
717cdf0e10cSrcweir
718cdf0e10cSrcweir
719cdf0e10cSrcweir //===== protected internal ==================================================
720cdf0e10cSrcweir
721cdf0e10cSrcweir // This method is called from the component helper base class while disposing.
disposing(void)722cdf0e10cSrcweir void SAL_CALL AccessibleDocumentViewBase::disposing (void)
723cdf0e10cSrcweir {
724cdf0e10cSrcweir impl_dispose();
725cdf0e10cSrcweir
726cdf0e10cSrcweir AccessibleContextBase::disposing ();
727cdf0e10cSrcweir }
728cdf0e10cSrcweir
729cdf0e10cSrcweir
730cdf0e10cSrcweir
731cdf0e10cSrcweir
732cdf0e10cSrcweir /// Create a name for this view.
733cdf0e10cSrcweir ::rtl::OUString
CreateAccessibleName(void)734cdf0e10cSrcweir AccessibleDocumentViewBase::CreateAccessibleName (void)
735cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
736cdf0e10cSrcweir {
737cdf0e10cSrcweir return ::rtl::OUString (
738cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("AccessibleDocumentViewBase"));
739cdf0e10cSrcweir }
740cdf0e10cSrcweir
741cdf0e10cSrcweir
742cdf0e10cSrcweir
743cdf0e10cSrcweir
744cdf0e10cSrcweir /** Create a description for this view. Use the model's description or URL
745cdf0e10cSrcweir if a description is not available.
746cdf0e10cSrcweir */
747cdf0e10cSrcweir ::rtl::OUString
CreateAccessibleDescription(void)748cdf0e10cSrcweir AccessibleDocumentViewBase::CreateAccessibleDescription (void)
749cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
750cdf0e10cSrcweir {
751cdf0e10cSrcweir rtl::OUString sDescription;
752cdf0e10cSrcweir
753cdf0e10cSrcweir uno::Reference<lang::XServiceInfo> xInfo (mxController, uno::UNO_QUERY);
754cdf0e10cSrcweir if (xInfo.is())
755cdf0e10cSrcweir {
756cdf0e10cSrcweir OUString sFirstService = xInfo->getSupportedServiceNames()[0];
757cdf0e10cSrcweir if (sFirstService == OUString (
758cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentDrawView")))
759cdf0e10cSrcweir {
760cdf0e10cSrcweir sDescription = OUString (RTL_CONSTASCII_USTRINGPARAM("Draw Document"));
761cdf0e10cSrcweir }
762cdf0e10cSrcweir else
763cdf0e10cSrcweir sDescription = sFirstService;
764cdf0e10cSrcweir }
765cdf0e10cSrcweir else
766cdf0e10cSrcweir sDescription = OUString (
767cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("Accessible Draw Document"));
768cdf0e10cSrcweir return sDescription;
769cdf0e10cSrcweir }
770cdf0e10cSrcweir
771cdf0e10cSrcweir
772cdf0e10cSrcweir
773cdf0e10cSrcweir
Activated(void)774cdf0e10cSrcweir void AccessibleDocumentViewBase::Activated (void)
775cdf0e10cSrcweir {
77686e1cf34SPedro Giffuni // Empty. Overwrite to do something useful.
777cdf0e10cSrcweir }
778cdf0e10cSrcweir
779cdf0e10cSrcweir
780cdf0e10cSrcweir
781cdf0e10cSrcweir
Deactivated(void)782cdf0e10cSrcweir void AccessibleDocumentViewBase::Deactivated (void)
783cdf0e10cSrcweir {
78486e1cf34SPedro Giffuni // Empty. Overwrite to do something useful.
785cdf0e10cSrcweir }
786cdf0e10cSrcweir
787cdf0e10cSrcweir
788cdf0e10cSrcweir
789cdf0e10cSrcweir
SetAccessibleOLEObject(const Reference<XAccessible> & xOLEObject)790cdf0e10cSrcweir void AccessibleDocumentViewBase::SetAccessibleOLEObject (
791cdf0e10cSrcweir const Reference <XAccessible>& xOLEObject)
792cdf0e10cSrcweir {
793cdf0e10cSrcweir // Send child event about removed accessible OLE object if necessary.
794cdf0e10cSrcweir if (mxAccessibleOLEObject != xOLEObject)
795cdf0e10cSrcweir if (mxAccessibleOLEObject.is())
796cdf0e10cSrcweir CommitChange (
797cdf0e10cSrcweir AccessibleEventId::CHILD,
798cdf0e10cSrcweir uno::Any(),
799cdf0e10cSrcweir uno::makeAny (mxAccessibleOLEObject));
800cdf0e10cSrcweir
801cdf0e10cSrcweir // Assume that the accessible OLE Object disposes itself correctly.
802cdf0e10cSrcweir
803cdf0e10cSrcweir {
804cdf0e10cSrcweir ::osl::MutexGuard aGuard (maMutex);
805cdf0e10cSrcweir mxAccessibleOLEObject = xOLEObject;
806cdf0e10cSrcweir }
807cdf0e10cSrcweir
808cdf0e10cSrcweir // Send child event about new accessible OLE object if necessary.
809cdf0e10cSrcweir if (mxAccessibleOLEObject.is())
810cdf0e10cSrcweir CommitChange (
811cdf0e10cSrcweir AccessibleEventId::CHILD,
812cdf0e10cSrcweir uno::makeAny (mxAccessibleOLEObject),
813cdf0e10cSrcweir uno::Any());
814cdf0e10cSrcweir }
815cdf0e10cSrcweir
816cdf0e10cSrcweir
817cdf0e10cSrcweir
818cdf0e10cSrcweir
819cdf0e10cSrcweir //===== methods from AccessibleSelectionBase ==================================================
820cdf0e10cSrcweir
821cdf0e10cSrcweir // return the member maMutex;
822cdf0e10cSrcweir ::osl::Mutex&
implGetMutex()823cdf0e10cSrcweir AccessibleDocumentViewBase::implGetMutex()
824cdf0e10cSrcweir {
825cdf0e10cSrcweir return( maMutex );
826cdf0e10cSrcweir }
827cdf0e10cSrcweir
828cdf0e10cSrcweir // return ourself as context in default case
829cdf0e10cSrcweir uno::Reference< XAccessibleContext >
implGetAccessibleContext()830cdf0e10cSrcweir AccessibleDocumentViewBase::implGetAccessibleContext()
831cdf0e10cSrcweir throw (uno::RuntimeException)
832cdf0e10cSrcweir {
833cdf0e10cSrcweir return( this );
834cdf0e10cSrcweir }
835cdf0e10cSrcweir
836cdf0e10cSrcweir // return sal_False in default case
837cdf0e10cSrcweir sal_Bool
implIsSelected(sal_Int32)838cdf0e10cSrcweir AccessibleDocumentViewBase::implIsSelected( sal_Int32 )
839cdf0e10cSrcweir throw (uno::RuntimeException)
840cdf0e10cSrcweir {
841cdf0e10cSrcweir return( sal_False );
842cdf0e10cSrcweir }
843cdf0e10cSrcweir
844cdf0e10cSrcweir // return nothing in default case
845cdf0e10cSrcweir void
implSelect(sal_Int32,sal_Bool)846cdf0e10cSrcweir AccessibleDocumentViewBase::implSelect( sal_Int32, sal_Bool )
847cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
848cdf0e10cSrcweir {
849cdf0e10cSrcweir }
850cdf0e10cSrcweir
getExtendedAttributes()8510deba7fbSSteve Yin uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes()
8520deba7fbSSteve Yin throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
8530deba7fbSSteve Yin {
8540deba7fbSSteve Yin uno::Any anyAtrribute;
8550deba7fbSSteve Yin rtl::OUString sValue;
8560deba7fbSSteve Yin if (mpViewShell && mpViewShell->ISA(::sd::DrawViewShell))
8570deba7fbSSteve Yin {
8580deba7fbSSteve Yin ::sd::DrawViewShell* pDrViewSh = (::sd::DrawViewShell*) mpViewShell;
8590deba7fbSSteve Yin rtl::OUString sName;
8600deba7fbSSteve Yin String sDisplay;
8610deba7fbSSteve Yin sName = rtl::OUString::createFromAscii("page-name:");
8620deba7fbSSteve Yin // MT IA2: Not used...
8630deba7fbSSteve Yin // SdPage* pCurrPge = pDrViewSh->getCurrentPage();
8640deba7fbSSteve Yin SdDrawDocument* pDoc = pDrViewSh->GetDoc();
8650deba7fbSSteve Yin sDisplay = pDrViewSh->getCurrentPage()->GetName();
8660deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( "\\" ), String::CreateFromAscii("\\\\" ));
8670deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( "=" ), String::CreateFromAscii("\\=" ) );
8680deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( ";" ), String::CreateFromAscii("\\;" ) );
8690deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( "," ), String::CreateFromAscii("\\," ) );
8700deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( ":" ), String::CreateFromAscii("\\:" ) );
8710deba7fbSSteve Yin sValue = sName + sDisplay ;
8720deba7fbSSteve Yin sName = rtl::OUString::createFromAscii(";page-number:");
8730deba7fbSSteve Yin sValue += sName;
8740deba7fbSSteve Yin sValue += String::CreateFromInt32((sal_Int16)((sal_uInt16)((pDrViewSh->getCurrentPage()->GetPageNum()-1)>>1) + 1)) ;
8750deba7fbSSteve Yin sName = rtl::OUString::createFromAscii(";total-pages:");
8760deba7fbSSteve Yin sValue += sName;
8770deba7fbSSteve Yin sValue += String::CreateFromInt32(pDrViewSh->GetPageTabControl()->GetPageCount()) ;
8780deba7fbSSteve Yin sValue += rtl::OUString::createFromAscii(";");
8792d19362eSArmin Le Grand
8802d19362eSArmin Le Grand if(pDrViewSh->IsLayerModeActive() && pDrViewSh->GetLayerTabControl()) // #87182#
8810deba7fbSSteve Yin {
8820deba7fbSSteve Yin sName = rtl::OUString::createFromAscii("page-name:");
8830deba7fbSSteve Yin sValue = sName;
8840deba7fbSSteve Yin sDisplay = pDrViewSh->GetLayerTabControl()->GetPageText(pDrViewSh->GetLayerTabControl()->GetCurPageId());
8850deba7fbSSteve Yin if( pDoc )
8860deba7fbSSteve Yin {
8870deba7fbSSteve Yin SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
8880deba7fbSSteve Yin SdrLayer* aSdrLayer = rLayerAdmin.GetLayer(sDisplay, sal_False);
8890deba7fbSSteve Yin if( aSdrLayer )
8900deba7fbSSteve Yin {
8910deba7fbSSteve Yin String layerAltText = aSdrLayer->GetTitle();
8920deba7fbSSteve Yin if( layerAltText.Len() > 0)
8930deba7fbSSteve Yin {
8940deba7fbSSteve Yin sName = rtl::OUString::createFromAscii(" ");
8950deba7fbSSteve Yin sDisplay = sDisplay + sName;
8960deba7fbSSteve Yin sDisplay += layerAltText;
8970deba7fbSSteve Yin }
8980deba7fbSSteve Yin }
8990deba7fbSSteve Yin }
9000deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( "\\" ), String::CreateFromAscii("\\\\" ));
9010deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( "=" ), String::CreateFromAscii("\\=" ));
9020deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( ";" ), String::CreateFromAscii("\\;" ));
9030deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( "," ), String::CreateFromAscii("\\," ));
9040deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( ":" ), String::CreateFromAscii("\\:" ));
9050deba7fbSSteve Yin sValue += sDisplay;
9060deba7fbSSteve Yin sName = rtl::OUString::createFromAscii(";page-number:");
9070deba7fbSSteve Yin sValue += sName;
9080deba7fbSSteve Yin sValue += String::CreateFromInt32(pDrViewSh->GetActiveTabLayerIndex()+1) ;
9090deba7fbSSteve Yin sName = rtl::OUString::createFromAscii(";total-pages:");
9100deba7fbSSteve Yin sValue += sName;
9110deba7fbSSteve Yin sValue += String::CreateFromInt32(pDrViewSh->GetLayerTabControl()->GetPageCount()) ;
9120deba7fbSSteve Yin sValue += rtl::OUString::createFromAscii(";");
9130deba7fbSSteve Yin }
9140deba7fbSSteve Yin }
9150deba7fbSSteve Yin if (mpViewShell && mpViewShell->ISA(::sd::PresentationViewShell))
9160deba7fbSSteve Yin {
9170deba7fbSSteve Yin ::sd::PresentationViewShell* pPresViewSh = (::sd::PresentationViewShell*) mpViewShell;
9180deba7fbSSteve Yin SdPage* pCurrPge = pPresViewSh->getCurrentPage();
9190deba7fbSSteve Yin SdDrawDocument* pDoc = pPresViewSh->GetDoc();
9200deba7fbSSteve Yin SdPage* pNotesPge = (SdPage*)pDoc->GetSdPage((pCurrPge->GetPageNum()-1)>>1, PK_NOTES);
9210deba7fbSSteve Yin if (pNotesPge)
9220deba7fbSSteve Yin {
9230deba7fbSSteve Yin SdrObject* pNotesObj = pNotesPge->GetPresObj(PRESOBJ_NOTES);
9240deba7fbSSteve Yin if (pNotesObj)
9250deba7fbSSteve Yin {
9260deba7fbSSteve Yin OutlinerParaObject* pPara = pNotesObj->GetOutlinerParaObject();
9270deba7fbSSteve Yin if (pPara)
9280deba7fbSSteve Yin {
9290deba7fbSSteve Yin sValue += rtl::OUString::createFromAscii("note:");
9300deba7fbSSteve Yin const EditTextObject& rEdit = pPara->GetTextObject();
931*7a980842SDamjanJovanovic for (sal_uInt32 i=0;i<rEdit.GetParagraphCount();i++)
9320deba7fbSSteve Yin {
9330deba7fbSSteve Yin String strNote = rEdit.GetText(i);
9340deba7fbSSteve Yin strNote.SearchAndReplace( String::CreateFromAscii( "\\" ), String::CreateFromAscii("\\\\" ));
9350deba7fbSSteve Yin strNote.SearchAndReplace( String::CreateFromAscii( "=" ), String::CreateFromAscii("\\=" ));
9360deba7fbSSteve Yin strNote.SearchAndReplace( String::CreateFromAscii( ";" ), String::CreateFromAscii("\\;" ));
9370deba7fbSSteve Yin strNote.SearchAndReplace( String::CreateFromAscii( "," ), String::CreateFromAscii("\\," ));
9380deba7fbSSteve Yin strNote.SearchAndReplace( String::CreateFromAscii( ":" ), String::CreateFromAscii("\\:" ));
9390deba7fbSSteve Yin sValue += rtl::OUString( strNote );
9400deba7fbSSteve Yin sValue += rtl::OUString::createFromAscii(";");//to divide each paragraph
9410deba7fbSSteve Yin }
9420deba7fbSSteve Yin }
9430deba7fbSSteve Yin }
9440deba7fbSSteve Yin }
9450deba7fbSSteve Yin }
9460deba7fbSSteve Yin if (mpViewShell && mpViewShell->ISA(::sd::OutlineViewShell) )
9470deba7fbSSteve Yin {
9480deba7fbSSteve Yin rtl::OUString sName;
9490deba7fbSSteve Yin String sDisplay;
9500deba7fbSSteve Yin SdPage* pCurrPge = mpViewShell->GetActualPage();
9510deba7fbSSteve Yin SdDrawDocument* pDoc = mpViewShell->GetDoc();
9520deba7fbSSteve Yin if(pCurrPge && pDoc)
9530deba7fbSSteve Yin {
9540deba7fbSSteve Yin sName = rtl::OUString::createFromAscii("page-name:");
9550deba7fbSSteve Yin sDisplay = pCurrPge->GetName();
9560deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( "=" ), String::CreateFromAscii("\\=" ) );
9570deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( ";" ), String::CreateFromAscii("\\;" ) );
9580deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( "," ), String::CreateFromAscii("\\," ) );
9590deba7fbSSteve Yin sDisplay.SearchAndReplace( String::CreateFromAscii( ":" ), String::CreateFromAscii("\\:" ) );
9600deba7fbSSteve Yin sValue = sName + sDisplay ;
9610deba7fbSSteve Yin sName = rtl::OUString::createFromAscii(";page-number:");
9620deba7fbSSteve Yin sValue += sName;
9630deba7fbSSteve Yin sValue += String::CreateFromInt32((sal_Int16)((sal_uInt16)((pCurrPge->GetPageNum()-1)>>1) + 1)) ;
9640deba7fbSSteve Yin sName = rtl::OUString::createFromAscii(";total-pages:");
9650deba7fbSSteve Yin sValue += sName;
9660deba7fbSSteve Yin sValue += String::CreateFromInt32(pDoc->GetSdPageCount(PK_STANDARD)) ;
9670deba7fbSSteve Yin sValue += rtl::OUString::createFromAscii(";");
9680deba7fbSSteve Yin }
9690deba7fbSSteve Yin }
9700deba7fbSSteve Yin if (sValue.getLength())
9710deba7fbSSteve Yin anyAtrribute <<= sValue;
9720deba7fbSSteve Yin return anyAtrribute;
9730deba7fbSSteve Yin }
9740deba7fbSSteve Yin ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
get_AccFlowTo(const::com::sun::star::uno::Any &,sal_Int32)9750deba7fbSSteve Yin SAL_CALL AccessibleDocumentViewBase::get_AccFlowTo(const ::com::sun::star::uno::Any&, sal_Int32 )
9760deba7fbSSteve Yin throw ( ::com::sun::star::uno::RuntimeException )
9770deba7fbSSteve Yin {
9780deba7fbSSteve Yin ::com::sun::star::uno::Sequence< uno::Any> aRet;
9790deba7fbSSteve Yin
9800deba7fbSSteve Yin return aRet;
9810deba7fbSSteve Yin }
9820deba7fbSSteve Yin
getForeground()9830deba7fbSSteve Yin sal_Int32 SAL_CALL AccessibleDocumentViewBase::getForeground( )
9840deba7fbSSteve Yin throw (uno::RuntimeException)
9850deba7fbSSteve Yin {
9860deba7fbSSteve Yin return COL_BLACK;
9870deba7fbSSteve Yin }
9880deba7fbSSteve Yin
getBackground()9890deba7fbSSteve Yin sal_Int32 SAL_CALL AccessibleDocumentViewBase::getBackground( )
9900deba7fbSSteve Yin throw (uno::RuntimeException)
9910deba7fbSSteve Yin {
9920deba7fbSSteve Yin ThrowIfDisposed ();
9930deba7fbSSteve Yin ::osl::MutexGuard aGuard (maMutex);
9940deba7fbSSteve Yin return mpViewShell->GetView()->getColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor;
9950deba7fbSSteve Yin }
996cdf0e10cSrcweir } // end of namespace accessibility
997