tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sd / source / ui / accessibility / AccessibleDocumentViewBase.cxx
blob3fba334ce87260c0681ccd1f928400e9f64224c6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/XDrawView.hpp>
22 #include <com/sun/star/frame/XController.hpp>
23 #include <com/sun/star/document/XShapeEventBroadcaster.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
26 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
27 #include <comphelper/sequence.hxx>
28 #include <rtl/ustrbuf.hxx>
29 #include <sfx2/viewfrm.hxx>
30 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
31 #include <com/sun/star/accessibility/AccessibleRole.hpp>
32 #include <sfx2/objsh.hxx>
33 #include <tools/debug.hxx>
35 #include <cppuhelper/queryinterface.hxx>
36 #include <svx/svdobj.hxx>
37 #include <toolkit/helper/vclunohelper.hxx>
38 #include <Window.hxx>
39 #include <OutlineViewShell.hxx>
41 #include <svx/svdlayer.hxx>
42 #include <editeng/editobj.hxx>
43 #include <LayerTabBar.hxx>
44 #include <svtools/colorcfg.hxx>
45 #include <ViewShell.hxx>
46 #include <View.hxx>
47 #include <drawdoc.hxx>
48 #include <editeng/outlobj.hxx>
49 #include <sdpage.hxx>
50 #include <DrawViewShell.hxx>
51 #include <PresentationViewShell.hxx>
52 #include <utility>
54 using namespace ::com::sun::star;
55 using namespace ::com::sun::star::accessibility;
56 using ::com::sun::star::uno::Reference;
58 namespace accessibility {
60 //===== internal ============================================================
61 AccessibleDocumentViewBase::AccessibleDocumentViewBase (
62 ::sd::Window* pSdWindow,
63 ::sd::ViewShell* pViewShell,
64 uno::Reference<frame::XController> xController,
65 const uno::Reference<XAccessible>& rxParent)
66 : AccessibleContextBase (rxParent,
67 pViewShell->GetDoc()->GetDocumentType() == DocumentType::Impress ?
68 AccessibleRole::DOCUMENT_PRESENTATION :
69 AccessibleRole::DOCUMENT),
70 mxController (std::move(xController)),
71 maViewForwarder (
72 static_cast<SdrPaintView*>(pViewShell->GetView()),
73 *pSdWindow->GetOutDev())
75 if (mxController.is())
76 mxModel = mxController->getModel();
78 // Fill the shape tree info.
79 maShapeTreeInfo.SetModelBroadcaster (
80 uno::Reference<document::XShapeEventBroadcaster>(
81 mxModel, uno::UNO_QUERY_THROW));
82 maShapeTreeInfo.SetController (mxController);
83 maShapeTreeInfo.SetSdrView (pViewShell->GetView());
84 maShapeTreeInfo.SetWindow (pSdWindow);
85 maShapeTreeInfo.SetViewForwarder (&maViewForwarder);
87 mxWindow = ::VCLUnoHelper::GetInterface (pSdWindow);
88 mpViewShell = pViewShell;
91 AccessibleDocumentViewBase::~AccessibleDocumentViewBase()
93 // At this place we should be disposed. You may want to add a
94 // corresponding assertion into the destructor of a derived class.
97 void AccessibleDocumentViewBase::Init()
99 // Finish the initialization of the shape tree info container.
100 maShapeTreeInfo.SetDocumentWindow (this);
102 // Register as window listener to stay up to date with its size and
103 // position.
104 mxWindow->addWindowListener (this);
105 // Register as focus listener to
106 mxWindow->addFocusListener (this);
108 // Determine the list of shapes on the current page.
109 uno::Reference<drawing::XShapes> xShapeList;
110 uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
111 if (xView.is())
112 xShapeList = xView->getCurrentPage();
114 // Register this object as dispose event listener at the model.
115 if (mxModel.is())
116 mxModel->addEventListener (
117 static_cast<awt::XWindowListener*>(this));
119 // Register as property change listener at the controller.
120 uno::Reference<beans::XPropertySet> xSet (mxController, uno::UNO_QUERY);
121 if (xSet.is())
122 xSet->addPropertyChangeListener (
123 u""_ustr,
124 static_cast<beans::XPropertyChangeListener*>(this));
126 // Register this object as dispose event listener at the controller.
127 if (mxController.is())
128 mxController->addEventListener (
129 static_cast<awt::XWindowListener*>(this));
131 // Register at VCL Window to be informed of activated and deactivated
132 // OLE objects.
133 vcl::Window* pWindow = maShapeTreeInfo.GetWindow();
134 if (pWindow != nullptr)
136 maWindowLink = LINK(
137 this, AccessibleDocumentViewBase, WindowChildEventListener);
139 pWindow->AddChildEventListener (maWindowLink);
141 sal_uInt16 nCount = pWindow->GetChildCount();
142 for (sal_uInt16 i=0; i<nCount; i++)
144 vcl::Window* pChildWindow = pWindow->GetChild (i);
145 if (pChildWindow &&
146 (AccessibleRole::EMBEDDED_OBJECT
147 ==pChildWindow->GetAccessibleRole()))
149 SetAccessibleOLEObject (pChildWindow->GetAccessible());
153 SfxObjectShell* pObjShell = mpViewShell->GetViewFrame()->GetObjectShell();
154 if(!pObjShell->IsReadOnly())
155 SetState(AccessibleStateType::EDITABLE);
158 IMPL_LINK(AccessibleDocumentViewBase, WindowChildEventListener,
159 VclWindowEvent&, rEvent, void)
161 // DBG_ASSERT( pVclEvent->GetWindow(), "Window???" );
162 switch (rEvent.GetId())
164 case VclEventId::ObjectDying:
166 // Window is dying. Unregister from VCL Window.
167 // This is also attempted in the disposing() method.
168 vcl::Window* pWindow = maShapeTreeInfo.GetWindow();
169 vcl::Window* pDyingWindow = rEvent.GetWindow();
170 if (pWindow==pDyingWindow && pWindow!=nullptr && maWindowLink.IsSet())
172 pWindow->RemoveChildEventListener (maWindowLink);
173 maWindowLink = Link<VclWindowEvent&,void>();
176 break;
178 case VclEventId::WindowShow:
180 // A new window has been created. Is it an OLE object?
181 vcl::Window* pChildWindow = static_cast<vcl::Window*>(
182 rEvent.GetData());
183 if (pChildWindow!=nullptr
184 && (pChildWindow->GetAccessibleRole()
185 == AccessibleRole::EMBEDDED_OBJECT))
187 SetAccessibleOLEObject (pChildWindow->GetAccessible());
190 break;
192 case VclEventId::WindowHide:
194 // A window has been destroyed. Has that been an OLE
195 // object?
196 vcl::Window* pChildWindow = static_cast<vcl::Window*>(
197 rEvent.GetData());
198 if (pChildWindow!=nullptr
199 && (pChildWindow->GetAccessibleRole()
200 == AccessibleRole::EMBEDDED_OBJECT))
202 SetAccessibleOLEObject (nullptr);
205 break;
207 default: break;
211 //===== IAccessibleViewForwarderListener ====================================
213 void AccessibleDocumentViewBase::ViewForwarderChanged()
215 // Empty
218 //===== XAccessibleContext ==================================================
220 Reference<XAccessible> SAL_CALL
221 AccessibleDocumentViewBase::getAccessibleParent()
223 ThrowIfDisposed ();
225 return AccessibleContextBase::getAccessibleParent();
228 sal_Int64 SAL_CALL
229 AccessibleDocumentViewBase::getAccessibleChildCount()
231 ThrowIfDisposed ();
233 if (mxAccessibleOLEObject.is())
234 return 1;
235 else
236 return 0;
239 Reference<XAccessible> SAL_CALL
240 AccessibleDocumentViewBase::getAccessibleChild (sal_Int64 nIndex)
242 ThrowIfDisposed ();
244 ::osl::MutexGuard aGuard (m_aMutex);
245 if (mxAccessibleOLEObject.is())
246 if (nIndex == 0)
247 return mxAccessibleOLEObject;
249 throw lang::IndexOutOfBoundsException ( "no child with index " + OUString::number(nIndex) );
252 //===== XAccessibleComponent ================================================
254 /** Iterate over all children and test whether the specified point lies
255 within one of their bounding boxes. Return the first child for which
256 this is true.
258 uno::Reference<XAccessible > SAL_CALL
259 AccessibleDocumentViewBase::getAccessibleAtPoint (
260 const awt::Point& aPoint)
262 ThrowIfDisposed ();
264 ::osl::MutexGuard aGuard (m_aMutex);
265 uno::Reference<XAccessible> xChildAtPosition;
267 sal_Int64 nChildCount = getAccessibleChildCount ();
268 for (sal_Int64 i=nChildCount-1; i>=0; --i)
270 Reference<XAccessible> xChild (getAccessibleChild (i));
271 if (xChild.is())
273 Reference<XAccessibleComponent> xChildComponent (
274 xChild->getAccessibleContext(), uno::UNO_QUERY);
275 if (xChildComponent.is())
277 awt::Rectangle aBBox (xChildComponent->getBounds());
278 if ( (aPoint.X >= aBBox.X)
279 && (aPoint.Y >= aBBox.Y)
280 && (aPoint.X < aBBox.X+aBBox.Width)
281 && (aPoint.Y < aBBox.Y+aBBox.Height) )
283 xChildAtPosition = std::move(xChild);
284 break;
290 // Have not found a child under the given point. Returning empty
291 // reference to indicate this.
292 return xChildAtPosition;
295 awt::Rectangle SAL_CALL
296 AccessibleDocumentViewBase::getBounds()
298 ThrowIfDisposed ();
300 // Transform visible area into screen coordinates.
301 ::tools::Rectangle aVisibleArea (
302 maShapeTreeInfo.GetViewForwarder()->GetVisibleArea());
303 ::Point aPixelTopLeft (
304 maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
305 aVisibleArea.TopLeft()));
306 ::Point aPixelSize (
307 maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
308 aVisibleArea.BottomRight())
309 - aPixelTopLeft);
311 // Prepare to subtract the parent position to transform into relative
312 // coordinates.
313 awt::Point aParentPosition;
314 Reference<XAccessible> xParent = getAccessibleParent ();
315 if (xParent.is())
317 Reference<XAccessibleComponent> xParentComponent (
318 xParent->getAccessibleContext(), uno::UNO_QUERY);
319 if (xParentComponent.is())
320 aParentPosition = xParentComponent->getLocationOnScreen();
323 return awt::Rectangle (
324 aPixelTopLeft.X() - aParentPosition.X,
325 aPixelTopLeft.Y() - aParentPosition.Y,
326 aPixelSize.X(),
327 aPixelSize.Y());
330 awt::Point SAL_CALL
331 AccessibleDocumentViewBase::getLocation()
333 ThrowIfDisposed ();
334 awt::Rectangle aBoundingBox (getBounds());
335 return awt::Point (aBoundingBox.X, aBoundingBox.Y);
338 awt::Point SAL_CALL
339 AccessibleDocumentViewBase::getLocationOnScreen()
341 ThrowIfDisposed ();
342 ::Point aLogicalPoint (maShapeTreeInfo.GetViewForwarder()->GetVisibleArea().TopLeft());
343 ::Point aPixelPoint (maShapeTreeInfo.GetViewForwarder()->LogicToPixel (aLogicalPoint));
344 return awt::Point (aPixelPoint.X(), aPixelPoint.Y());
347 awt::Size SAL_CALL
348 AccessibleDocumentViewBase::getSize()
350 ThrowIfDisposed ();
352 // Transform visible area into screen coordinates.
353 ::tools::Rectangle aVisibleArea (
354 maShapeTreeInfo.GetViewForwarder()->GetVisibleArea());
355 ::Point aPixelTopLeft (
356 maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
357 aVisibleArea.TopLeft()));
358 ::Point aPixelSize (
359 maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
360 aVisibleArea.BottomRight())
361 - aPixelTopLeft);
363 return awt::Size (aPixelSize.X(), aPixelSize.Y());
366 //===== XInterface ==========================================================
368 uno::Any SAL_CALL
369 AccessibleDocumentViewBase::queryInterface (const uno::Type & rType)
371 uno::Any aReturn = AccessibleContextBase::queryInterface (rType);
372 if ( ! aReturn.hasValue())
373 aReturn = ::cppu::queryInterface (rType,
374 static_cast<XAccessibleComponent*>(this),
375 static_cast<XAccessibleSelection*>(this),
376 static_cast<lang::XEventListener*>(
377 static_cast<awt::XWindowListener*>(this)),
378 static_cast<beans::XPropertyChangeListener*>(this),
379 static_cast<awt::XWindowListener*>(this),
380 static_cast<awt::XFocusListener*>(this)
381 ,static_cast<XAccessibleExtendedAttributes*>(this)
383 return aReturn;
386 void SAL_CALL
387 AccessibleDocumentViewBase::acquire()
388 noexcept
390 AccessibleContextBase::acquire ();
393 void SAL_CALL
394 AccessibleDocumentViewBase::release()
395 noexcept
397 AccessibleContextBase::release ();
400 // XServiceInfo
402 OUString SAL_CALL
403 AccessibleDocumentViewBase::getImplementationName()
405 return u"AccessibleDocumentViewBase"_ustr;
408 css::uno::Sequence< OUString> SAL_CALL
409 AccessibleDocumentViewBase::getSupportedServiceNames()
411 ThrowIfDisposed ();
412 return AccessibleContextBase::getSupportedServiceNames ();
415 //===== XTypeProvider =======================================================
417 css::uno::Sequence< css::uno::Type> SAL_CALL
418 AccessibleDocumentViewBase::getTypes()
420 ThrowIfDisposed ();
422 return comphelper::concatSequences(
423 // Get list of types from the context base implementation, ...
424 AccessibleContextBase::getTypes(),
425 // ... get list of types from component base implementation, ...
426 AccessibleComponentBase::getTypes(),
427 // ...and add the additional type for the component, ...
428 css::uno::Sequence {
429 cppu::UnoType<lang::XEventListener>::get(),
430 cppu::UnoType<beans::XPropertyChangeListener>::get(),
431 cppu::UnoType<awt::XWindowListener>::get(),
432 cppu::UnoType<awt::XFocusListener>::get(),
433 cppu::UnoType<XAccessibleEventBroadcaster>::get() });
436 void AccessibleDocumentViewBase::impl_dispose()
438 // Unregister from VCL Window.
439 vcl::Window* pWindow = maShapeTreeInfo.GetWindow();
440 if (maWindowLink.IsSet())
442 if (pWindow)
443 pWindow->RemoveChildEventListener (maWindowLink);
444 maWindowLink = Link<VclWindowEvent&,void>();
446 else
448 DBG_ASSERT (pWindow, "AccessibleDocumentViewBase::disposing");
451 // Unregister from window.
452 if (mxWindow.is())
454 mxWindow->removeWindowListener (this);
455 mxWindow->removeFocusListener (this);
456 mxWindow = nullptr;
459 // Unregister from the model.
460 if (mxModel.is())
461 mxModel->removeEventListener (
462 static_cast<awt::XWindowListener*>(this));
464 // Unregister from the controller.
465 if (mxController.is())
467 uno::Reference<beans::XPropertySet> xSet (mxController, uno::UNO_QUERY);
468 if (xSet.is())
469 xSet->removePropertyChangeListener (u""_ustr, static_cast<beans::XPropertyChangeListener*>(this));
471 mxController->removeEventListener (
472 static_cast<awt::XWindowListener*>(this));
475 // Propagate change of controller down the shape tree.
476 maShapeTreeInfo.SetModelBroadcaster (nullptr);
478 // Reset the model reference.
479 mxModel = nullptr;
480 // Reset the model reference.
481 mxController = nullptr;
483 maShapeTreeInfo.SetDocumentWindow (nullptr);
484 maShapeTreeInfo.dispose();
485 mxAccessibleOLEObject.clear();
488 //===== XEventListener ======================================================
490 void SAL_CALL
491 AccessibleDocumentViewBase::disposing (const lang::EventObject& rEventObject)
493 ThrowIfDisposed ();
495 // Register this object as dispose event and document::XEventListener
496 // listener at the model.
498 if ( ! rEventObject.Source.is())
500 // Paranoia. Can this really happen?
502 else if (rEventObject.Source == mxModel || rEventObject.Source == mxController)
504 impl_dispose();
508 //===== XPropertyChangeListener =============================================
510 void SAL_CALL AccessibleDocumentViewBase::propertyChange (const beans::PropertyChangeEvent& )
512 // Empty
515 //===== XWindowListener =====================================================
517 void SAL_CALL
518 AccessibleDocumentViewBase::windowResized (const css::awt::WindowEvent& )
520 if( IsDisposed() )
521 return;
523 ViewForwarderChanged();
526 void SAL_CALL
527 AccessibleDocumentViewBase::windowMoved (const css::awt::WindowEvent& )
529 if( IsDisposed() )
530 return;
532 ViewForwarderChanged();
535 void SAL_CALL
536 AccessibleDocumentViewBase::windowShown (const css::lang::EventObject& )
538 if( IsDisposed() )
539 return;
541 ViewForwarderChanged();
544 void SAL_CALL
545 AccessibleDocumentViewBase::windowHidden (const css::lang::EventObject& )
547 if( IsDisposed() )
548 return;
550 ViewForwarderChanged();
553 //===== XFocusListener ==================================================
555 void AccessibleDocumentViewBase::focusGained (const css::awt::FocusEvent& e)
557 ThrowIfDisposed ();
558 if (e.Source == mxWindow)
559 Activated ();
562 void AccessibleDocumentViewBase::focusLost (const css::awt::FocusEvent& e)
564 ThrowIfDisposed ();
565 if (e.Source == mxWindow)
566 Deactivated ();
569 //===== protected internal ==================================================
571 // This method is called from the component helper base class while disposing.
572 void SAL_CALL AccessibleDocumentViewBase::disposing()
574 impl_dispose();
576 AccessibleContextBase::disposing ();
579 /// Create a name for this view.
580 OUString
581 AccessibleDocumentViewBase::CreateAccessibleName()
583 return u"AccessibleDocumentViewBase"_ustr;
586 void AccessibleDocumentViewBase::Activated()
588 // Empty. Overwrite to do something useful.
591 void AccessibleDocumentViewBase::Deactivated()
593 // Empty. Overwrite to do something useful.
596 void AccessibleDocumentViewBase::SetAccessibleOLEObject (
597 const Reference <XAccessible>& xOLEObject)
599 // Send child event about removed accessible OLE object if necessary.
600 if (mxAccessibleOLEObject != xOLEObject)
601 if (mxAccessibleOLEObject.is())
602 CommitChange (
603 AccessibleEventId::CHILD,
604 uno::Any(),
605 uno::Any (mxAccessibleOLEObject), -1);
607 // Assume that the accessible OLE Object disposes itself correctly.
610 ::osl::MutexGuard aGuard (m_aMutex);
611 mxAccessibleOLEObject = xOLEObject;
614 // Send child event about new accessible OLE object if necessary.
615 if (mxAccessibleOLEObject.is())
616 CommitChange (
617 AccessibleEventId::CHILD,
618 uno::Any (mxAccessibleOLEObject),
619 uno::Any(), -1);
622 //===== methods from AccessibleSelectionBase ==================================================
624 // return the member maMutex;
625 ::osl::Mutex&
626 AccessibleDocumentViewBase::implGetMutex()
628 return m_aMutex;
631 // return ourself as context in default case
632 uno::Reference< XAccessibleContext >
633 AccessibleDocumentViewBase::implGetAccessibleContext()
635 return this;
638 // return false in default case
639 bool
640 AccessibleDocumentViewBase::implIsSelected( sal_Int64 )
642 return false;
645 // do nothing in default case
646 void
647 AccessibleDocumentViewBase::implSelect( sal_Int64, bool )
651 uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes()
653 ::osl::MutexGuard aGuard (m_aMutex);
655 uno::Any anyAttribute;
656 OUStringBuffer sValue;
657 if (auto pDrViewSh = dynamic_cast<::sd::DrawViewShell* > (mpViewShell))
659 OUString sDisplay;
660 OUString sName = u"page-name:"_ustr;
661 // MT IA2: Not used...
662 // SdPage* pCurrPge = pDrViewSh->getCurrentPage();
663 SdDrawDocument* pDoc = pDrViewSh->GetDoc();
664 sDisplay = pDrViewSh->getCurrentPage()->GetName();
665 sDisplay = sDisplay.replaceFirst( "\\", "\\\\" );
666 sDisplay = sDisplay.replaceFirst( "=", "\\=" );
667 sDisplay = sDisplay.replaceFirst( ";", "\\;" );
668 sDisplay = sDisplay.replaceFirst( ",", "\\," );
669 sDisplay = sDisplay.replaceFirst( ":", "\\:" );
670 sValue = sName + sDisplay
671 + ";page-number:"
672 + OUString::number(static_cast<sal_Int32>(static_cast<sal_uInt16>((pDrViewSh->getCurrentPage()->GetPageNum()-1)>>1) + 1))
673 + ";total-pages:"
674 + OUString::number(static_cast<sal_Int32>(pDrViewSh->GetPageTabControl().GetPageCount()))
675 + ";";
676 if(pDrViewSh->IsLayerModeActive() && pDrViewSh->GetLayerTabControl()) // #i87182#
678 sName = "page-name:";
679 sValue = sName;
680 OUString sLayerName(pDrViewSh->GetLayerTabControl()->GetLayerName(pDrViewSh->GetLayerTabControl()->GetCurPageId()) );
681 sDisplay = pDrViewSh->GetLayerTabControl()->GetPageText(pDrViewSh->GetLayerTabControl()->GetCurPageId());
682 if( pDoc )
684 SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
685 SdrLayer* aSdrLayer = rLayerAdmin.GetLayer(sLayerName);
686 if( aSdrLayer )
688 const OUString& layerAltText = aSdrLayer->GetTitle();
689 if (!layerAltText.isEmpty())
691 sName = " ";
692 sDisplay += sName + layerAltText;
696 sDisplay = sDisplay.replaceFirst( "\\", "\\\\" );
697 sDisplay = sDisplay.replaceFirst( "=", "\\=" );
698 sDisplay = sDisplay.replaceFirst( ";", "\\;" );
699 sDisplay = sDisplay.replaceFirst( ",", "\\," );
700 sDisplay = sDisplay.replaceFirst( ":", "\\:" );
701 sValue.append(sDisplay
702 + ";page-number:"
703 + OUString::number(static_cast<sal_Int32>(pDrViewSh->GetActiveTabLayerIndex()+1))
704 + ";total-pages:"
705 + OUString::number(static_cast<sal_Int32>(pDrViewSh->GetLayerTabControl()->GetPageCount()))
706 + ";");
709 if (auto pPresViewSh = dynamic_cast<::sd::PresentationViewShell* >(mpViewShell))
711 SdPage* pCurrPge = pPresViewSh->getCurrentPage();
712 SdDrawDocument* pDoc = pPresViewSh->GetDoc();
713 SdPage* pNotesPge = pDoc->GetSdPage((pCurrPge->GetPageNum()-1)>>1, PageKind::Notes);
714 if (pNotesPge)
716 SdrObject* pNotesObj = pNotesPge->GetPresObj(PresObjKind::Notes);
717 if (pNotesObj)
719 OutlinerParaObject* pPara = pNotesObj->GetOutlinerParaObject();
720 if (pPara)
722 sValue.append("note:");
723 const EditTextObject& rEdit = pPara->GetTextObject();
724 for (sal_Int32 i=0;i<rEdit.GetParagraphCount();i++)
726 OUString strNote = rEdit.GetText(i);
727 strNote = strNote.replaceFirst( "\\", "\\\\" );
728 strNote = strNote.replaceFirst( "=", "\\=" );
729 strNote = strNote.replaceFirst( ";", "\\;" );
730 strNote = strNote.replaceFirst( ",", "\\," );
731 strNote = strNote.replaceFirst( ":", "\\:" );
732 sValue.append(strNote
733 + ";");//to divide each paragraph
739 if (dynamic_cast<const ::sd::OutlineViewShell* >(mpViewShell ) != nullptr )
741 SdPage* pCurrPge = mpViewShell->GetActualPage();
742 SdDrawDocument* pDoc = mpViewShell->GetDoc();
743 if(pCurrPge && pDoc)
745 OUString sDisplay;
746 sDisplay = pCurrPge->GetName();
747 sDisplay = sDisplay.replaceFirst( "=", "\\=" );
748 sDisplay = sDisplay.replaceFirst( ";", "\\;" );
749 sDisplay = sDisplay.replaceFirst( ",", "\\," );
750 sDisplay = sDisplay.replaceFirst( ":", "\\:" );
751 sValue = "page-name:" + sDisplay
752 + ";page-number:"
753 + OUString::number(static_cast<sal_Int32>(static_cast<sal_uInt16>((pCurrPge->GetPageNum()-1)>>1) + 1))
754 + ";total-pages:"
755 + OUString::number(static_cast<sal_Int32>(pDoc->GetSdPageCount(PageKind::Standard)))
756 + ";";
759 if (sValue.getLength())
760 anyAttribute <<= sValue.makeStringAndClear();
761 return anyAttribute;
764 sal_Int32 SAL_CALL AccessibleDocumentViewBase::getForeground( )
766 return sal_Int32(COL_BLACK);
769 sal_Int32 SAL_CALL AccessibleDocumentViewBase::getBackground( )
771 ThrowIfDisposed ();
772 ::osl::MutexGuard aGuard (m_aMutex);
773 return sal_Int32(mpViewShell->GetView()->getColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor);
775 } // end of namespace accessibility
777 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */