1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "AccessibleDocumentViewBase.hxx"
21 #include <com/sun/star/drawing/XDrawPage.hpp>
22 #include <com/sun/star/drawing/XDrawView.hpp>
23 #include <com/sun/star/drawing/XShapes.hpp>
24 #include <com/sun/star/container/XChild.hpp>
25 #include <com/sun/star/frame/XController.hpp>
26 #include <com/sun/star/frame/XFrame.hpp>
27 #include <com/sun/star/document/XEventBroadcaster.hpp>
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
30 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <rtl/ustring.h>
33 #include <sfx2/viewfrm.hxx>
34 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
35 #include <sfx2/objsh.hxx>
36 #include <svx/AccessibleShape.hxx>
38 #include <svx/svdobj.hxx>
39 #include <svx/svdmodel.hxx>
40 #include <svx/unoapi.hxx>
41 #include <toolkit/helper/vclunohelper.hxx>
43 #include <vcl/svapp.hxx>
44 #include "OutlineViewShell.hxx"
46 #include <svx/svdlayer.hxx>
47 #include <editeng/editobj.hxx>
48 #include "LayerTabBar.hxx"
49 #include <svtools/colorcfg.hxx>
50 #include "ViewShell.hxx"
53 using namespace ::com::sun::star
;
54 using namespace ::com::sun::star::accessibility
;
55 using ::com::sun::star::uno::Reference
;
57 namespace accessibility
{
59 //===== internal ============================================================
60 AccessibleDocumentViewBase::AccessibleDocumentViewBase (
61 ::sd::Window
* pSdWindow
,
62 ::sd::ViewShell
* pViewShell
,
63 const uno::Reference
<frame::XController
>& rxController
,
64 const uno::Reference
<XAccessible
>& rxParent
)
65 : AccessibleContextBase (rxParent
,
66 pViewShell
->GetDoc()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS
?
67 AccessibleRole::DOCUMENT_PRESENTATION
:
68 AccessibleRole::DOCUMENT
),
70 mxController (rxController
),
73 static_cast<SdrPaintView
*>(pViewShell
->GetView()),
74 *static_cast<OutputDevice
*>(pSdWindow
))
76 if (mxController
.is())
77 mxModel
= mxController
->getModel();
79 // Fill the shape tree info.
80 maShapeTreeInfo
.SetModelBroadcaster (
81 uno::Reference
<document::XEventBroadcaster
>(
82 mxModel
, uno::UNO_QUERY
));
83 maShapeTreeInfo
.SetController (mxController
);
84 maShapeTreeInfo
.SetSdrView (pViewShell
->GetView());
85 maShapeTreeInfo
.SetWindow (pSdWindow
);
86 maShapeTreeInfo
.SetViewForwarder (&maViewForwarder
);
88 mxWindow
= ::VCLUnoHelper::GetInterface (pSdWindow
);
89 mpViewShell
= pViewShell
;
92 AccessibleDocumentViewBase::~AccessibleDocumentViewBase()
94 // At this place we should be disposed. You may want to add a
95 // corresponding assertion into the destructor of a derived class.
101 void AccessibleDocumentViewBase::Init()
103 // Finish the initialization of the shape tree info container.
104 maShapeTreeInfo
.SetDocumentWindow (this);
106 // Register as window listener to stay up to date with its size and
108 mxWindow
->addWindowListener (this);
109 // Register as focus listener to
110 mxWindow
->addFocusListener (this);
112 // Determine the list of shapes on the current page.
113 uno::Reference
<drawing::XShapes
> xShapeList
;
114 uno::Reference
<drawing::XDrawView
> xView (mxController
, uno::UNO_QUERY
);
116 xShapeList
= uno::Reference
<drawing::XShapes
> (
117 xView
->getCurrentPage(), uno::UNO_QUERY
);
119 // Register this object as dispose event listener at the model.
121 mxModel
->addEventListener (
122 static_cast<awt::XWindowListener
*>(this));
124 // Register as property change listener at the controller.
125 uno::Reference
<beans::XPropertySet
> xSet (mxController
, uno::UNO_QUERY
);
127 xSet
->addPropertyChangeListener (
129 static_cast<beans::XPropertyChangeListener
*>(this));
131 // Register this object as dispose event listener at the controller.
132 if (mxController
.is())
133 mxController
->addEventListener (
134 static_cast<awt::XWindowListener
*>(this));
136 // Register at VCL Window to be informed of activated and deactivated
138 vcl::Window
* pWindow
= maShapeTreeInfo
.GetWindow();
142 this, AccessibleDocumentViewBase
, WindowChildEventListener
);
144 pWindow
->AddChildEventListener (maWindowLink
);
146 sal_uInt16 nCount
= pWindow
->GetChildCount();
147 for (sal_uInt16 i
=0; i
<nCount
; i
++)
149 vcl::Window
* pChildWindow
= pWindow
->GetChild (i
);
151 (AccessibleRole::EMBEDDED_OBJECT
152 ==pChildWindow
->GetAccessibleRole()))
154 SetAccessibleOLEObject (pChildWindow
->GetAccessible());
158 SfxObjectShell
* pObjShell
= mpViewShell
->GetViewFrame()->GetObjectShell();
159 if(!pObjShell
->IsReadOnly())
160 SetState(AccessibleStateType::EDITABLE
);
163 IMPL_LINK(AccessibleDocumentViewBase
, WindowChildEventListener
,
164 VclSimpleEvent
*, pEvent
)
166 OSL_ASSERT(pEvent
!=NULL
&& pEvent
->ISA(VclWindowEvent
));
167 if (pEvent
!=NULL
&& pEvent
->ISA(VclWindowEvent
))
169 VclWindowEvent
* pWindowEvent
= static_cast<VclWindowEvent
*>(pEvent
);
170 // DBG_ASSERT( pVclEvent->GetWindow(), "Window???" );
171 switch (pWindowEvent
->GetId())
173 case VCLEVENT_OBJECT_DYING
:
175 // Window is dying. Unregister from VCL Window.
176 // This is also attempted in the disposing() method.
177 vcl::Window
* pWindow
= maShapeTreeInfo
.GetWindow();
178 vcl::Window
* pDyingWindow
= static_cast<vcl::Window
*>(
179 pWindowEvent
->GetWindow());
180 if (pWindow
==pDyingWindow
&& pWindow
!=NULL
&& maWindowLink
.IsSet())
182 pWindow
->RemoveChildEventListener (maWindowLink
);
183 maWindowLink
= Link
<>();
188 case VCLEVENT_WINDOW_SHOW
:
190 // A new window has been created. Is it an OLE object?
191 vcl::Window
* pChildWindow
= static_cast<vcl::Window
*>(
192 pWindowEvent
->GetData());
193 if (pChildWindow
!=NULL
194 && (pChildWindow
->GetAccessibleRole()
195 == AccessibleRole::EMBEDDED_OBJECT
))
197 SetAccessibleOLEObject (pChildWindow
->GetAccessible());
202 case VCLEVENT_WINDOW_HIDE
:
204 // A window has been destroyed. Has that been an OLE
206 vcl::Window
* pChildWindow
= static_cast<vcl::Window
*>(
207 pWindowEvent
->GetData());
208 if (pChildWindow
!=NULL
209 && (pChildWindow
->GetAccessibleRole()
210 == AccessibleRole::EMBEDDED_OBJECT
))
212 SetAccessibleOLEObject (NULL
);
222 //===== IAccessibleViewForwarderListener ====================================
224 void AccessibleDocumentViewBase::ViewForwarderChanged(ChangeType
, const IAccessibleViewForwarder
* )
229 //===== XAccessibleContext ==================================================
231 Reference
<XAccessible
> SAL_CALL
232 AccessibleDocumentViewBase::getAccessibleParent()
233 throw (uno::RuntimeException
, std::exception
)
237 return AccessibleContextBase::getAccessibleParent();
241 AccessibleDocumentViewBase::getAccessibleChildCount()
242 throw (uno::RuntimeException
, std::exception
)
246 if (mxAccessibleOLEObject
.is())
252 Reference
<XAccessible
> SAL_CALL
253 AccessibleDocumentViewBase::getAccessibleChild (sal_Int32 nIndex
)
254 throw (uno::RuntimeException
, lang::IndexOutOfBoundsException
, std::exception
)
258 ::osl::MutexGuard
aGuard (maMutex
);
259 if (mxAccessibleOLEObject
.is())
261 return mxAccessibleOLEObject
;
263 throw lang::IndexOutOfBoundsException ( "no child with index " + OUString::number(nIndex
) );
266 //===== XAccessibleComponent ================================================
268 /** Iterate over all children and test whether the specified point lies
269 within one of their bounding boxes. Return the first child for which
272 uno::Reference
<XAccessible
> SAL_CALL
273 AccessibleDocumentViewBase::getAccessibleAtPoint (
274 const awt::Point
& aPoint
)
275 throw (uno::RuntimeException
, std::exception
)
279 ::osl::MutexGuard
aGuard (maMutex
);
280 uno::Reference
<XAccessible
> xChildAtPosition
;
282 sal_Int32 nChildCount
= getAccessibleChildCount ();
283 for (sal_Int32 i
=nChildCount
-1; i
>=0; --i
)
285 Reference
<XAccessible
> xChild (getAccessibleChild (i
));
288 Reference
<XAccessibleComponent
> xChildComponent (
289 xChild
->getAccessibleContext(), uno::UNO_QUERY
);
290 if (xChildComponent
.is())
292 awt::Rectangle
aBBox (xChildComponent
->getBounds());
293 if ( (aPoint
.X
>= aBBox
.X
)
294 && (aPoint
.Y
>= aBBox
.Y
)
295 && (aPoint
.X
< aBBox
.X
+aBBox
.Width
)
296 && (aPoint
.Y
< aBBox
.Y
+aBBox
.Height
) )
298 xChildAtPosition
= xChild
;
305 // Have not found a child under the given point. Returning empty
306 // reference to indicate this.
307 return xChildAtPosition
;
310 awt::Rectangle SAL_CALL
311 AccessibleDocumentViewBase::getBounds()
312 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
316 // Transform visible area into screen coordinates.
317 ::Rectangle
aVisibleArea (
318 maShapeTreeInfo
.GetViewForwarder()->GetVisibleArea());
319 ::Point
aPixelTopLeft (
320 maShapeTreeInfo
.GetViewForwarder()->LogicToPixel (
321 aVisibleArea
.TopLeft()));
323 maShapeTreeInfo
.GetViewForwarder()->LogicToPixel (
324 aVisibleArea
.BottomRight())
327 // Prepare to subtract the parent position to transform into relative
329 awt::Point aParentPosition
;
330 Reference
<XAccessible
> xParent
= getAccessibleParent ();
333 Reference
<XAccessibleComponent
> xParentComponent (
334 xParent
->getAccessibleContext(), uno::UNO_QUERY
);
335 if (xParentComponent
.is())
336 aParentPosition
= xParentComponent
->getLocationOnScreen();
339 return awt::Rectangle (
340 aPixelTopLeft
.X() - aParentPosition
.X
,
341 aPixelTopLeft
.Y() - aParentPosition
.Y
,
347 AccessibleDocumentViewBase::getLocation()
348 throw (uno::RuntimeException
, std::exception
)
351 awt::Rectangle
aBoundingBox (getBounds());
352 return awt::Point (aBoundingBox
.X
, aBoundingBox
.Y
);
356 AccessibleDocumentViewBase::getLocationOnScreen()
357 throw (uno::RuntimeException
, std::exception
)
360 ::Point
aLogicalPoint (maShapeTreeInfo
.GetViewForwarder()->GetVisibleArea().TopLeft());
361 ::Point
aPixelPoint (maShapeTreeInfo
.GetViewForwarder()->LogicToPixel (aLogicalPoint
));
362 return awt::Point (aPixelPoint
.X(), aPixelPoint
.Y());
366 AccessibleDocumentViewBase::getSize()
367 throw (uno::RuntimeException
, std::exception
)
371 // Transform visible area into screen coordinates.
372 ::Rectangle
aVisibleArea (
373 maShapeTreeInfo
.GetViewForwarder()->GetVisibleArea());
374 ::Point
aPixelTopLeft (
375 maShapeTreeInfo
.GetViewForwarder()->LogicToPixel (
376 aVisibleArea
.TopLeft()));
378 maShapeTreeInfo
.GetViewForwarder()->LogicToPixel (
379 aVisibleArea
.BottomRight())
382 return awt::Size (aPixelSize
.X(), aPixelSize
.Y());
385 //===== XInterface ==========================================================
388 AccessibleDocumentViewBase::queryInterface (const uno::Type
& rType
)
389 throw (uno::RuntimeException
, std::exception
)
391 uno::Any aReturn
= AccessibleContextBase::queryInterface (rType
);
392 if ( ! aReturn
.hasValue())
393 aReturn
= ::cppu::queryInterface (rType
,
394 static_cast<XAccessibleComponent
*>(this),
395 static_cast<XAccessibleSelection
*>(this),
396 static_cast<lang::XEventListener
*>(
397 static_cast<awt::XWindowListener
*>(this)),
398 static_cast<beans::XPropertyChangeListener
*>(this),
399 static_cast<awt::XWindowListener
*>(this),
400 static_cast<awt::XFocusListener
*>(this)
401 ,static_cast<XAccessibleExtendedAttributes
*>(this)
402 ,static_cast<XAccessibleGetAccFlowTo
*>(this)
408 AccessibleDocumentViewBase::acquire()
411 AccessibleContextBase::acquire ();
415 AccessibleDocumentViewBase::release()
418 AccessibleContextBase::release ();
424 AccessibleDocumentViewBase::getImplementationName()
425 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
427 return OUString("AccessibleDocumentViewBase");
430 ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
431 AccessibleDocumentViewBase::getSupportedServiceNames()
432 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
435 return AccessibleContextBase::getSupportedServiceNames ();
438 //===== XTypeProvider =======================================================
440 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
441 AccessibleDocumentViewBase::getTypes()
442 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
446 // Get list of types from the context base implementation, ...
447 uno::Sequence
<uno::Type
> aTypeList (AccessibleContextBase::getTypes());
448 // ... get list of types from component base implementation, ...
449 uno::Sequence
<uno::Type
> aComponentTypeList (AccessibleComponentBase::getTypes());
451 // ...and add the additional type for the component, ...
452 const uno::Type aLangEventListenerType
=
453 cppu::UnoType
<lang::XEventListener
>::get();
454 const uno::Type aPropertyChangeListenerType
=
455 cppu::UnoType
<beans::XPropertyChangeListener
>::get();
456 const uno::Type aWindowListenerType
=
457 cppu::UnoType
<awt::XWindowListener
>::get();
458 const uno::Type aFocusListenerType
=
459 cppu::UnoType
<awt::XFocusListener
>::get();
460 const uno::Type aEventBroadcaster
=
461 cppu::UnoType
<XAccessibleEventBroadcaster
>::get();
463 // ... and merge them all into one list.
464 sal_Int32
nTypeCount (aTypeList
.getLength()),
465 nComponentTypeCount (aComponentTypeList
.getLength()),
468 aTypeList
.realloc (nTypeCount
+ nComponentTypeCount
+ 5);
470 for (i
=0; i
<nComponentTypeCount
; i
++)
471 aTypeList
[nTypeCount
+ i
] = aComponentTypeList
[i
];
473 aTypeList
[nTypeCount
+ i
++ ] = aLangEventListenerType
;
474 aTypeList
[nTypeCount
+ i
++] = aPropertyChangeListenerType
;
475 aTypeList
[nTypeCount
+ i
++] = aWindowListenerType
;
476 aTypeList
[nTypeCount
+ i
++] = aFocusListenerType
;
477 aTypeList
[nTypeCount
+ i
++] = aEventBroadcaster
;
482 void AccessibleDocumentViewBase::impl_dispose()
484 // Unregister from VCL Window.
485 vcl::Window
* pWindow
= maShapeTreeInfo
.GetWindow();
486 if (maWindowLink
.IsSet())
489 pWindow
->RemoveChildEventListener (maWindowLink
);
490 maWindowLink
= Link
<>();
494 DBG_ASSERT (pWindow
, "AccessibleDocumentViewBase::disposing");
497 // Unregister from window.
500 mxWindow
->removeWindowListener (this);
501 mxWindow
->removeFocusListener (this);
505 // Unregister form the model.
507 mxModel
->removeEventListener (
508 static_cast<awt::XWindowListener
*>(this));
510 // Unregister from the controller.
511 if (mxController
.is())
513 uno::Reference
<beans::XPropertySet
> xSet (mxController
, uno::UNO_QUERY
);
515 xSet
->removePropertyChangeListener ("", static_cast<beans::XPropertyChangeListener
*>(this));
517 mxController
->removeEventListener (
518 static_cast<awt::XWindowListener
*>(this));
521 // Propagate change of controller down the shape tree.
522 maShapeTreeInfo
.SetModelBroadcaster (NULL
);
524 // Reset the model reference.
526 // Reset the model reference.
529 maShapeTreeInfo
.SetDocumentWindow (NULL
);
532 //===== XEventListener ======================================================
535 AccessibleDocumentViewBase::disposing (const lang::EventObject
& rEventObject
)
536 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
540 // Register this object as dispose event and document::XEventListener
541 // listener at the model.
543 if ( ! rEventObject
.Source
.is())
545 // Paranoia. Can this really happen?
547 else if (rEventObject
.Source
== mxModel
|| rEventObject
.Source
== mxController
)
553 //===== XPropertyChangeListener =============================================
555 void SAL_CALL
AccessibleDocumentViewBase::propertyChange (const beans::PropertyChangeEvent
& )
556 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
561 //===== XWindowListener =====================================================
564 AccessibleDocumentViewBase::windowResized (const ::com::sun::star::awt::WindowEvent
& )
565 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
570 ViewForwarderChanged (
571 IAccessibleViewForwarderListener::VISIBLE_AREA
,
576 AccessibleDocumentViewBase::windowMoved (const ::com::sun::star::awt::WindowEvent
& )
577 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
582 ViewForwarderChanged (
583 IAccessibleViewForwarderListener::VISIBLE_AREA
,
588 AccessibleDocumentViewBase::windowShown (const ::com::sun::star::lang::EventObject
& )
589 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
594 ViewForwarderChanged (
595 IAccessibleViewForwarderListener::VISIBLE_AREA
,
600 AccessibleDocumentViewBase::windowHidden (const ::com::sun::star::lang::EventObject
& )
601 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
606 ViewForwarderChanged (
607 IAccessibleViewForwarderListener::VISIBLE_AREA
,
611 //===== XFocusListener ==================================================
613 void AccessibleDocumentViewBase::focusGained (const ::com::sun::star::awt::FocusEvent
& e
)
614 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
617 if (e
.Source
== mxWindow
)
621 void AccessibleDocumentViewBase::focusLost (const ::com::sun::star::awt::FocusEvent
& e
)
622 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
625 if (e
.Source
== mxWindow
)
629 //===== protected internal ==================================================
631 // This method is called from the component helper base class while disposing.
632 void SAL_CALL
AccessibleDocumentViewBase::disposing()
636 AccessibleContextBase::disposing ();
639 /// Create a name for this view.
641 AccessibleDocumentViewBase::CreateAccessibleName()
642 throw (::com::sun::star::uno::RuntimeException
)
644 return OUString ("AccessibleDocumentViewBase");
647 /** Create a description for this view. Use the model's description or URL
648 if a description is not available.
651 AccessibleDocumentViewBase::CreateAccessibleDescription()
652 throw (::com::sun::star::uno::RuntimeException
)
654 OUString sDescription
;
656 uno::Reference
<lang::XServiceInfo
> xInfo (mxController
, uno::UNO_QUERY
);
659 OUString sFirstService
= xInfo
->getSupportedServiceNames()[0];
660 if ( sFirstService
== "com.sun.star.drawing.DrawingDocumentDrawView" )
662 sDescription
= "Draw Document";
665 sDescription
= sFirstService
;
668 sDescription
= "Accessible Draw Document";
672 void AccessibleDocumentViewBase::Activated()
674 // Empty. Overwrite to do something useful.
677 void AccessibleDocumentViewBase::Deactivated()
679 // Empty. Overwrite to do something useful.
682 void AccessibleDocumentViewBase::SetAccessibleOLEObject (
683 const Reference
<XAccessible
>& xOLEObject
)
685 // Send child event about removed accessible OLE object if necessary.
686 if (mxAccessibleOLEObject
!= xOLEObject
)
687 if (mxAccessibleOLEObject
.is())
689 AccessibleEventId::CHILD
,
691 uno::makeAny (mxAccessibleOLEObject
));
693 // Assume that the accessible OLE Object disposes itself correctly.
696 ::osl::MutexGuard
aGuard (maMutex
);
697 mxAccessibleOLEObject
= xOLEObject
;
700 // Send child event about new accessible OLE object if necessary.
701 if (mxAccessibleOLEObject
.is())
703 AccessibleEventId::CHILD
,
704 uno::makeAny (mxAccessibleOLEObject
),
708 //===== methods from AccessibleSelectionBase ==================================================
710 // return the member maMutex;
712 AccessibleDocumentViewBase::implGetMutex()
717 // return ourself as context in default case
718 uno::Reference
< XAccessibleContext
>
719 AccessibleDocumentViewBase::implGetAccessibleContext()
720 throw (uno::RuntimeException
)
725 // return sal_False in default case
727 AccessibleDocumentViewBase::implIsSelected( sal_Int32
)
728 throw (uno::RuntimeException
)
733 // return nothing in default case
735 AccessibleDocumentViewBase::implSelect( sal_Int32
, bool )
736 throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
)
740 uno::Any SAL_CALL
AccessibleDocumentViewBase::getExtendedAttributes()
741 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
742 ::com::sun::star::uno::RuntimeException
,
745 ::osl::MutexGuard
aGuard (maMutex
);
747 uno::Any anyAtrribute
;
749 if (mpViewShell
&& mpViewShell
->ISA(::sd::DrawViewShell
))
751 ::sd::DrawViewShell
* pDrViewSh
= static_cast< ::sd::DrawViewShell
*>(mpViewShell
);
753 OUString sName
= "page-name:";
754 // MT IA2: Not used...
755 // SdPage* pCurrPge = pDrViewSh->getCurrentPage();
756 SdDrawDocument
* pDoc
= pDrViewSh
->GetDoc();
757 sDisplay
= pDrViewSh
->getCurrentPage()->GetName();
758 sDisplay
= sDisplay
.replaceFirst( "\\", "\\\\" );
759 sDisplay
= sDisplay
.replaceFirst( "=", "\\=" );
760 sDisplay
= sDisplay
.replaceFirst( ";", "\\;" );
761 sDisplay
= sDisplay
.replaceFirst( ",", "\\," );
762 sDisplay
= sDisplay
.replaceFirst( ":", "\\:" );
763 sValue
= sName
+ sDisplay
;
764 sName
= ";page-number:";
766 sValue
+= OUString::number((sal_Int16
)((sal_uInt16
)((pDrViewSh
->getCurrentPage()->GetPageNum()-1)>>1) + 1)) ;
767 sName
= ";total-pages:";
769 sValue
+= OUString::number(pDrViewSh
->GetPageTabControl().GetPageCount()) ;
771 if(pDrViewSh
->IsLayerModeActive() && pDrViewSh
->GetLayerTabControl()) // #i87182#
773 sName
= "page-name:";
775 sDisplay
= pDrViewSh
->GetLayerTabControl()->GetPageText(pDrViewSh
->GetLayerTabControl()->GetCurPageId());
778 SdrLayerAdmin
& rLayerAdmin
= pDoc
->GetLayerAdmin();
779 SdrLayer
* aSdrLayer
= rLayerAdmin
.GetLayer(sDisplay
, false);
782 OUString layerAltText
= aSdrLayer
->GetTitle();
783 if (!layerAltText
.isEmpty())
786 sDisplay
= sDisplay
+ sName
;
787 sDisplay
+= layerAltText
;
791 sDisplay
= sDisplay
.replaceFirst( "\\", "\\\\" );
792 sDisplay
= sDisplay
.replaceFirst( "=", "\\=" );
793 sDisplay
= sDisplay
.replaceFirst( ";", "\\;" );
794 sDisplay
= sDisplay
.replaceFirst( ",", "\\," );
795 sDisplay
= sDisplay
.replaceFirst( ":", "\\:" );
797 sName
= ";page-number:";
799 sValue
+= OUString::number(pDrViewSh
->GetActiveTabLayerIndex()+1) ;
800 sName
= ";total-pages:";
802 sValue
+= OUString::number(pDrViewSh
->GetLayerTabControl()->GetPageCount()) ;
806 if (mpViewShell
&& mpViewShell
->ISA(::sd::PresentationViewShell
))
808 ::sd::PresentationViewShell
* pPresViewSh
= static_cast< ::sd::PresentationViewShell
*>(mpViewShell
);
809 SdPage
* pCurrPge
= pPresViewSh
->getCurrentPage();
810 SdDrawDocument
* pDoc
= pPresViewSh
->GetDoc();
811 SdPage
* pNotesPge
= pDoc
->GetSdPage((pCurrPge
->GetPageNum()-1)>>1, PK_NOTES
);
814 SdrObject
* pNotesObj
= pNotesPge
->GetPresObj(PRESOBJ_NOTES
);
817 OutlinerParaObject
* pPara
= pNotesObj
->GetOutlinerParaObject();
821 const EditTextObject
& rEdit
= pPara
->GetTextObject();
822 for (sal_uInt16 i
=0;i
<rEdit
.GetParagraphCount();i
++)
824 OUString strNote
= rEdit
.GetText(i
);
825 strNote
= strNote
.replaceFirst( "\\", "\\\\" );
826 strNote
= strNote
.replaceFirst( "=", "\\=" );
827 strNote
= strNote
.replaceFirst( ";", "\\;" );
828 strNote
= strNote
.replaceFirst( ",", "\\," );
829 strNote
= strNote
.replaceFirst( ":", "\\:" );
831 sValue
+= ";";//to divide each paragraph
837 if (mpViewShell
&& mpViewShell
->ISA(::sd::OutlineViewShell
) )
841 SdPage
* pCurrPge
= mpViewShell
->GetActualPage();
842 SdDrawDocument
* pDoc
= mpViewShell
->GetDoc();
845 sName
= "page-name:";
846 sDisplay
= pCurrPge
->GetName();
847 sDisplay
= sDisplay
.replaceFirst( "=", "\\=" );
848 sDisplay
= sDisplay
.replaceFirst( ";", "\\;" );
849 sDisplay
= sDisplay
.replaceFirst( ",", "\\," );
850 sDisplay
= sDisplay
.replaceFirst( ":", "\\:" );
851 sValue
= sName
+ sDisplay
;
852 sName
= ";page-number:";
854 sValue
+= OUString::number((sal_Int16
)((sal_uInt16
)((pCurrPge
->GetPageNum()-1)>>1) + 1)) ;
855 sName
= ";total-pages:";
857 sValue
+= OUString::number(pDoc
->GetSdPageCount(PK_STANDARD
)) ;
861 if (sValue
.getLength())
862 anyAtrribute
<<= sValue
;
866 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>
867 SAL_CALL
AccessibleDocumentViewBase::getAccFlowTo(const ::com::sun::star::uno::Any
&, sal_Int32
)
868 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
)
870 ::com::sun::star::uno::Sequence
< uno::Any
> aRet
;
875 sal_Int32 SAL_CALL
AccessibleDocumentViewBase::getForeground( )
876 throw (uno::RuntimeException
, std::exception
)
881 sal_Int32 SAL_CALL
AccessibleDocumentViewBase::getBackground( )
882 throw (uno::RuntimeException
, std::exception
)
885 ::osl::MutexGuard
aGuard (maMutex
);
886 return mpViewShell
->GetView()->getColorConfig().GetColorValue( ::svtools::DOCCOLOR
).nColor
;
888 } // end of namespace accessibility
890 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */