android: Update app-specific/MIME type icons
[LibreOffice.git] / sd / source / ui / accessibility / AccessibleDocumentViewBase.cxx
blob61d4bd154ee3c5a1a41ec13755b739eb0987a291
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 <rtl/ustrbuf.hxx>
28 #include <sfx2/viewfrm.hxx>
29 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
30 #include <com/sun/star/accessibility/AccessibleRole.hpp>
31 #include <sfx2/objsh.hxx>
32 #include <tools/debug.hxx>
34 #include <cppuhelper/queryinterface.hxx>
35 #include <svx/svdobj.hxx>
36 #include <toolkit/helper/vclunohelper.hxx>
37 #include <Window.hxx>
38 #include <OutlineViewShell.hxx>
40 #include <svx/svdlayer.hxx>
41 #include <editeng/editobj.hxx>
42 #include <LayerTabBar.hxx>
43 #include <svtools/colorcfg.hxx>
44 #include <ViewShell.hxx>
45 #include <View.hxx>
46 #include <drawdoc.hxx>
47 #include <editeng/outlobj.hxx>
48 #include <sdpage.hxx>
49 #include <DrawViewShell.hxx>
50 #include <PresentationViewShell.hxx>
51 #include <utility>
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 uno::Reference<frame::XController> xController,
64 const uno::Reference<XAccessible>& rxParent)
65 : AccessibleContextBase (rxParent,
66 pViewShell->GetDoc()->GetDocumentType() == DocumentType::Impress ?
67 AccessibleRole::DOCUMENT_PRESENTATION :
68 AccessibleRole::DOCUMENT),
69 mxController (std::move(xController)),
70 maViewForwarder (
71 static_cast<SdrPaintView*>(pViewShell->GetView()),
72 *pSdWindow->GetOutDev())
74 if (mxController.is())
75 mxModel = mxController->getModel();
77 // Fill the shape tree info.
78 maShapeTreeInfo.SetModelBroadcaster (
79 uno::Reference<document::XShapeEventBroadcaster>(
80 mxModel, uno::UNO_QUERY_THROW));
81 maShapeTreeInfo.SetController (mxController);
82 maShapeTreeInfo.SetSdrView (pViewShell->GetView());
83 maShapeTreeInfo.SetWindow (pSdWindow);
84 maShapeTreeInfo.SetViewForwarder (&maViewForwarder);
86 mxWindow = ::VCLUnoHelper::GetInterface (pSdWindow);
87 mpViewShell = pViewShell;
90 AccessibleDocumentViewBase::~AccessibleDocumentViewBase()
92 // At this place we should be disposed. You may want to add a
93 // corresponding assertion into the destructor of a derived class.
96 void AccessibleDocumentViewBase::Init()
98 // Finish the initialization of the shape tree info container.
99 maShapeTreeInfo.SetDocumentWindow (this);
101 // Register as window listener to stay up to date with its size and
102 // position.
103 mxWindow->addWindowListener (this);
104 // Register as focus listener to
105 mxWindow->addFocusListener (this);
107 // Determine the list of shapes on the current page.
108 uno::Reference<drawing::XShapes> xShapeList;
109 uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
110 if (xView.is())
111 xShapeList = xView->getCurrentPage();
113 // Register this object as dispose event listener at the model.
114 if (mxModel.is())
115 mxModel->addEventListener (
116 static_cast<awt::XWindowListener*>(this));
118 // Register as property change listener at the controller.
119 uno::Reference<beans::XPropertySet> xSet (mxController, uno::UNO_QUERY);
120 if (xSet.is())
121 xSet->addPropertyChangeListener (
123 static_cast<beans::XPropertyChangeListener*>(this));
125 // Register this object as dispose event listener at the controller.
126 if (mxController.is())
127 mxController->addEventListener (
128 static_cast<awt::XWindowListener*>(this));
130 // Register at VCL Window to be informed of activated and deactivated
131 // OLE objects.
132 vcl::Window* pWindow = maShapeTreeInfo.GetWindow();
133 if (pWindow != nullptr)
135 maWindowLink = LINK(
136 this, AccessibleDocumentViewBase, WindowChildEventListener);
138 pWindow->AddChildEventListener (maWindowLink);
140 sal_uInt16 nCount = pWindow->GetChildCount();
141 for (sal_uInt16 i=0; i<nCount; i++)
143 vcl::Window* pChildWindow = pWindow->GetChild (i);
144 if (pChildWindow &&
145 (AccessibleRole::EMBEDDED_OBJECT
146 ==pChildWindow->GetAccessibleRole()))
148 SetAccessibleOLEObject (pChildWindow->GetAccessible());
152 SfxObjectShell* pObjShell = mpViewShell->GetViewFrame()->GetObjectShell();
153 if(!pObjShell->IsReadOnly())
154 SetState(AccessibleStateType::EDITABLE);
157 IMPL_LINK(AccessibleDocumentViewBase, WindowChildEventListener,
158 VclWindowEvent&, rEvent, void)
160 // DBG_ASSERT( pVclEvent->GetWindow(), "Window???" );
161 switch (rEvent.GetId())
163 case VclEventId::ObjectDying:
165 // Window is dying. Unregister from VCL Window.
166 // This is also attempted in the disposing() method.
167 vcl::Window* pWindow = maShapeTreeInfo.GetWindow();
168 vcl::Window* pDyingWindow = rEvent.GetWindow();
169 if (pWindow==pDyingWindow && pWindow!=nullptr && maWindowLink.IsSet())
171 pWindow->RemoveChildEventListener (maWindowLink);
172 maWindowLink = Link<VclWindowEvent&,void>();
175 break;
177 case VclEventId::WindowShow:
179 // A new window has been created. Is it an OLE object?
180 vcl::Window* pChildWindow = static_cast<vcl::Window*>(
181 rEvent.GetData());
182 if (pChildWindow!=nullptr
183 && (pChildWindow->GetAccessibleRole()
184 == AccessibleRole::EMBEDDED_OBJECT))
186 SetAccessibleOLEObject (pChildWindow->GetAccessible());
189 break;
191 case VclEventId::WindowHide:
193 // A window has been destroyed. Has that been an OLE
194 // object?
195 vcl::Window* pChildWindow = static_cast<vcl::Window*>(
196 rEvent.GetData());
197 if (pChildWindow!=nullptr
198 && (pChildWindow->GetAccessibleRole()
199 == AccessibleRole::EMBEDDED_OBJECT))
201 SetAccessibleOLEObject (nullptr);
204 break;
206 default: break;
210 //===== IAccessibleViewForwarderListener ====================================
212 void AccessibleDocumentViewBase::ViewForwarderChanged()
214 // Empty
217 //===== XAccessibleContext ==================================================
219 Reference<XAccessible> SAL_CALL
220 AccessibleDocumentViewBase::getAccessibleParent()
222 ThrowIfDisposed ();
224 return AccessibleContextBase::getAccessibleParent();
227 sal_Int64 SAL_CALL
228 AccessibleDocumentViewBase::getAccessibleChildCount()
230 ThrowIfDisposed ();
232 if (mxAccessibleOLEObject.is())
233 return 1;
234 else
235 return 0;
238 Reference<XAccessible> SAL_CALL
239 AccessibleDocumentViewBase::getAccessibleChild (sal_Int64 nIndex)
241 ThrowIfDisposed ();
243 ::osl::MutexGuard aGuard (m_aMutex);
244 if (mxAccessibleOLEObject.is())
245 if (nIndex == 0)
246 return mxAccessibleOLEObject;
248 throw lang::IndexOutOfBoundsException ( "no child with index " + OUString::number(nIndex) );
251 //===== XAccessibleComponent ================================================
253 /** Iterate over all children and test whether the specified point lies
254 within one of their bounding boxes. Return the first child for which
255 this is true.
257 uno::Reference<XAccessible > SAL_CALL
258 AccessibleDocumentViewBase::getAccessibleAtPoint (
259 const awt::Point& aPoint)
261 ThrowIfDisposed ();
263 ::osl::MutexGuard aGuard (m_aMutex);
264 uno::Reference<XAccessible> xChildAtPosition;
266 sal_Int64 nChildCount = getAccessibleChildCount ();
267 for (sal_Int64 i=nChildCount-1; i>=0; --i)
269 Reference<XAccessible> xChild (getAccessibleChild (i));
270 if (xChild.is())
272 Reference<XAccessibleComponent> xChildComponent (
273 xChild->getAccessibleContext(), uno::UNO_QUERY);
274 if (xChildComponent.is())
276 awt::Rectangle aBBox (xChildComponent->getBounds());
277 if ( (aPoint.X >= aBBox.X)
278 && (aPoint.Y >= aBBox.Y)
279 && (aPoint.X < aBBox.X+aBBox.Width)
280 && (aPoint.Y < aBBox.Y+aBBox.Height) )
282 xChildAtPosition = xChild;
283 break;
289 // Have not found a child under the given point. Returning empty
290 // reference to indicate this.
291 return xChildAtPosition;
294 awt::Rectangle SAL_CALL
295 AccessibleDocumentViewBase::getBounds()
297 ThrowIfDisposed ();
299 // Transform visible area into screen coordinates.
300 ::tools::Rectangle aVisibleArea (
301 maShapeTreeInfo.GetViewForwarder()->GetVisibleArea());
302 ::Point aPixelTopLeft (
303 maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
304 aVisibleArea.TopLeft()));
305 ::Point aPixelSize (
306 maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
307 aVisibleArea.BottomRight())
308 - aPixelTopLeft);
310 // Prepare to subtract the parent position to transform into relative
311 // coordinates.
312 awt::Point aParentPosition;
313 Reference<XAccessible> xParent = getAccessibleParent ();
314 if (xParent.is())
316 Reference<XAccessibleComponent> xParentComponent (
317 xParent->getAccessibleContext(), uno::UNO_QUERY);
318 if (xParentComponent.is())
319 aParentPosition = xParentComponent->getLocationOnScreen();
322 return awt::Rectangle (
323 aPixelTopLeft.X() - aParentPosition.X,
324 aPixelTopLeft.Y() - aParentPosition.Y,
325 aPixelSize.X(),
326 aPixelSize.Y());
329 awt::Point SAL_CALL
330 AccessibleDocumentViewBase::getLocation()
332 ThrowIfDisposed ();
333 awt::Rectangle aBoundingBox (getBounds());
334 return awt::Point (aBoundingBox.X, aBoundingBox.Y);
337 awt::Point SAL_CALL
338 AccessibleDocumentViewBase::getLocationOnScreen()
340 ThrowIfDisposed ();
341 ::Point aLogicalPoint (maShapeTreeInfo.GetViewForwarder()->GetVisibleArea().TopLeft());
342 ::Point aPixelPoint (maShapeTreeInfo.GetViewForwarder()->LogicToPixel (aLogicalPoint));
343 return awt::Point (aPixelPoint.X(), aPixelPoint.Y());
346 awt::Size SAL_CALL
347 AccessibleDocumentViewBase::getSize()
349 ThrowIfDisposed ();
351 // Transform visible area into screen coordinates.
352 ::tools::Rectangle aVisibleArea (
353 maShapeTreeInfo.GetViewForwarder()->GetVisibleArea());
354 ::Point aPixelTopLeft (
355 maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
356 aVisibleArea.TopLeft()));
357 ::Point aPixelSize (
358 maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
359 aVisibleArea.BottomRight())
360 - aPixelTopLeft);
362 return awt::Size (aPixelSize.X(), aPixelSize.Y());
365 //===== XInterface ==========================================================
367 uno::Any SAL_CALL
368 AccessibleDocumentViewBase::queryInterface (const uno::Type & rType)
370 uno::Any aReturn = AccessibleContextBase::queryInterface (rType);
371 if ( ! aReturn.hasValue())
372 aReturn = ::cppu::queryInterface (rType,
373 static_cast<XAccessibleComponent*>(this),
374 static_cast<XAccessibleSelection*>(this),
375 static_cast<lang::XEventListener*>(
376 static_cast<awt::XWindowListener*>(this)),
377 static_cast<beans::XPropertyChangeListener*>(this),
378 static_cast<awt::XWindowListener*>(this),
379 static_cast<awt::XFocusListener*>(this)
380 ,static_cast<XAccessibleExtendedAttributes*>(this)
382 return aReturn;
385 void SAL_CALL
386 AccessibleDocumentViewBase::acquire()
387 noexcept
389 AccessibleContextBase::acquire ();
392 void SAL_CALL
393 AccessibleDocumentViewBase::release()
394 noexcept
396 AccessibleContextBase::release ();
399 // XServiceInfo
401 OUString SAL_CALL
402 AccessibleDocumentViewBase::getImplementationName()
404 return "AccessibleDocumentViewBase";
407 css::uno::Sequence< OUString> SAL_CALL
408 AccessibleDocumentViewBase::getSupportedServiceNames()
410 ThrowIfDisposed ();
411 return AccessibleContextBase::getSupportedServiceNames ();
414 //===== XTypeProvider =======================================================
416 css::uno::Sequence< css::uno::Type> SAL_CALL
417 AccessibleDocumentViewBase::getTypes()
419 ThrowIfDisposed ();
421 return comphelper::concatSequences(
422 // Get list of types from the context base implementation, ...
423 AccessibleContextBase::getTypes(),
424 // ... get list of types from component base implementation, ...
425 AccessibleComponentBase::getTypes(),
426 // ...and add the additional type for the component, ...
427 css::uno::Sequence {
428 cppu::UnoType<lang::XEventListener>::get(),
429 cppu::UnoType<beans::XPropertyChangeListener>::get(),
430 cppu::UnoType<awt::XWindowListener>::get(),
431 cppu::UnoType<awt::XFocusListener>::get(),
432 cppu::UnoType<XAccessibleEventBroadcaster>::get() });
435 void AccessibleDocumentViewBase::impl_dispose()
437 // Unregister from VCL Window.
438 vcl::Window* pWindow = maShapeTreeInfo.GetWindow();
439 if (maWindowLink.IsSet())
441 if (pWindow)
442 pWindow->RemoveChildEventListener (maWindowLink);
443 maWindowLink = Link<VclWindowEvent&,void>();
445 else
447 DBG_ASSERT (pWindow, "AccessibleDocumentViewBase::disposing");
450 // Unregister from window.
451 if (mxWindow.is())
453 mxWindow->removeWindowListener (this);
454 mxWindow->removeFocusListener (this);
455 mxWindow = nullptr;
458 // Unregister from the model.
459 if (mxModel.is())
460 mxModel->removeEventListener (
461 static_cast<awt::XWindowListener*>(this));
463 // Unregister from the controller.
464 if (mxController.is())
466 uno::Reference<beans::XPropertySet> xSet (mxController, uno::UNO_QUERY);
467 if (xSet.is())
468 xSet->removePropertyChangeListener ("", static_cast<beans::XPropertyChangeListener*>(this));
470 mxController->removeEventListener (
471 static_cast<awt::XWindowListener*>(this));
474 // Propagate change of controller down the shape tree.
475 maShapeTreeInfo.SetModelBroadcaster (nullptr);
477 // Reset the model reference.
478 mxModel = nullptr;
479 // Reset the model reference.
480 mxController = nullptr;
482 maShapeTreeInfo.SetDocumentWindow (nullptr);
483 maShapeTreeInfo.dispose();
484 mxAccessibleOLEObject.clear();
487 //===== XEventListener ======================================================
489 void SAL_CALL
490 AccessibleDocumentViewBase::disposing (const lang::EventObject& rEventObject)
492 ThrowIfDisposed ();
494 // Register this object as dispose event and document::XEventListener
495 // listener at the model.
497 if ( ! rEventObject.Source.is())
499 // Paranoia. Can this really happen?
501 else if (rEventObject.Source == mxModel || rEventObject.Source == mxController)
503 impl_dispose();
507 //===== XPropertyChangeListener =============================================
509 void SAL_CALL AccessibleDocumentViewBase::propertyChange (const beans::PropertyChangeEvent& )
511 // Empty
514 //===== XWindowListener =====================================================
516 void SAL_CALL
517 AccessibleDocumentViewBase::windowResized (const css::awt::WindowEvent& )
519 if( IsDisposed() )
520 return;
522 ViewForwarderChanged();
525 void SAL_CALL
526 AccessibleDocumentViewBase::windowMoved (const css::awt::WindowEvent& )
528 if( IsDisposed() )
529 return;
531 ViewForwarderChanged();
534 void SAL_CALL
535 AccessibleDocumentViewBase::windowShown (const css::lang::EventObject& )
537 if( IsDisposed() )
538 return;
540 ViewForwarderChanged();
543 void SAL_CALL
544 AccessibleDocumentViewBase::windowHidden (const css::lang::EventObject& )
546 if( IsDisposed() )
547 return;
549 ViewForwarderChanged();
552 //===== XFocusListener ==================================================
554 void AccessibleDocumentViewBase::focusGained (const css::awt::FocusEvent& e)
556 ThrowIfDisposed ();
557 if (e.Source == mxWindow)
558 Activated ();
561 void AccessibleDocumentViewBase::focusLost (const css::awt::FocusEvent& e)
563 ThrowIfDisposed ();
564 if (e.Source == mxWindow)
565 Deactivated ();
568 //===== protected internal ==================================================
570 // This method is called from the component helper base class while disposing.
571 void SAL_CALL AccessibleDocumentViewBase::disposing()
573 impl_dispose();
575 AccessibleContextBase::disposing ();
578 /// Create a name for this view.
579 OUString
580 AccessibleDocumentViewBase::CreateAccessibleName()
582 return "AccessibleDocumentViewBase";
585 void AccessibleDocumentViewBase::Activated()
587 // Empty. Overwrite to do something useful.
590 void AccessibleDocumentViewBase::Deactivated()
592 // Empty. Overwrite to do something useful.
595 void AccessibleDocumentViewBase::SetAccessibleOLEObject (
596 const Reference <XAccessible>& xOLEObject)
598 // Send child event about removed accessible OLE object if necessary.
599 if (mxAccessibleOLEObject != xOLEObject)
600 if (mxAccessibleOLEObject.is())
601 CommitChange (
602 AccessibleEventId::CHILD,
603 uno::Any(),
604 uno::Any (mxAccessibleOLEObject), -1);
606 // Assume that the accessible OLE Object disposes itself correctly.
609 ::osl::MutexGuard aGuard (m_aMutex);
610 mxAccessibleOLEObject = xOLEObject;
613 // Send child event about new accessible OLE object if necessary.
614 if (mxAccessibleOLEObject.is())
615 CommitChange (
616 AccessibleEventId::CHILD,
617 uno::Any (mxAccessibleOLEObject),
618 uno::Any(), -1);
621 //===== methods from AccessibleSelectionBase ==================================================
623 // return the member maMutex;
624 ::osl::Mutex&
625 AccessibleDocumentViewBase::implGetMutex()
627 return m_aMutex;
630 // return ourself as context in default case
631 uno::Reference< XAccessibleContext >
632 AccessibleDocumentViewBase::implGetAccessibleContext()
634 return this;
637 // return false in default case
638 bool
639 AccessibleDocumentViewBase::implIsSelected( sal_Int64 )
641 return false;
644 // do nothing in default case
645 void
646 AccessibleDocumentViewBase::implSelect( sal_Int64, bool )
650 uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes()
652 ::osl::MutexGuard aGuard (m_aMutex);
654 uno::Any anyAttribute;
655 OUStringBuffer sValue;
656 if (auto pDrViewSh = dynamic_cast<::sd::DrawViewShell* > (mpViewShell))
658 OUString sDisplay;
659 OUString sName = "page-name:";
660 // MT IA2: Not used...
661 // SdPage* pCurrPge = pDrViewSh->getCurrentPage();
662 SdDrawDocument* pDoc = pDrViewSh->GetDoc();
663 sDisplay = pDrViewSh->getCurrentPage()->GetName();
664 sDisplay = sDisplay.replaceFirst( "\\", "\\\\" );
665 sDisplay = sDisplay.replaceFirst( "=", "\\=" );
666 sDisplay = sDisplay.replaceFirst( ";", "\\;" );
667 sDisplay = sDisplay.replaceFirst( ",", "\\," );
668 sDisplay = sDisplay.replaceFirst( ":", "\\:" );
669 sValue = sName + sDisplay
670 + ";page-number:"
671 + OUString::number(static_cast<sal_Int32>(static_cast<sal_uInt16>((pDrViewSh->getCurrentPage()->GetPageNum()-1)>>1) + 1))
672 + ";total-pages:"
673 + OUString::number(static_cast<sal_Int32>(pDrViewSh->GetPageTabControl().GetPageCount()))
674 + ";";
675 if(pDrViewSh->IsLayerModeActive() && pDrViewSh->GetLayerTabControl()) // #i87182#
677 sName = "page-name:";
678 sValue = sName;
679 OUString sLayerName(pDrViewSh->GetLayerTabControl()->GetLayerName(pDrViewSh->GetLayerTabControl()->GetCurPageId()) );
680 sDisplay = pDrViewSh->GetLayerTabControl()->GetPageText(pDrViewSh->GetLayerTabControl()->GetCurPageId());
681 if( pDoc )
683 SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
684 SdrLayer* aSdrLayer = rLayerAdmin.GetLayer(sLayerName);
685 if( aSdrLayer )
687 const OUString& layerAltText = aSdrLayer->GetTitle();
688 if (!layerAltText.isEmpty())
690 sName = " ";
691 sDisplay += sName + layerAltText;
695 sDisplay = sDisplay.replaceFirst( "\\", "\\\\" );
696 sDisplay = sDisplay.replaceFirst( "=", "\\=" );
697 sDisplay = sDisplay.replaceFirst( ";", "\\;" );
698 sDisplay = sDisplay.replaceFirst( ",", "\\," );
699 sDisplay = sDisplay.replaceFirst( ":", "\\:" );
700 sValue.append(sDisplay
701 + ";page-number:"
702 + OUString::number(static_cast<sal_Int32>(pDrViewSh->GetActiveTabLayerIndex()+1))
703 + ";total-pages:"
704 + OUString::number(static_cast<sal_Int32>(pDrViewSh->GetLayerTabControl()->GetPageCount()))
705 + ";");
708 if (auto pPresViewSh = dynamic_cast<::sd::PresentationViewShell* >(mpViewShell))
710 SdPage* pCurrPge = pPresViewSh->getCurrentPage();
711 SdDrawDocument* pDoc = pPresViewSh->GetDoc();
712 SdPage* pNotesPge = pDoc->GetSdPage((pCurrPge->GetPageNum()-1)>>1, PageKind::Notes);
713 if (pNotesPge)
715 SdrObject* pNotesObj = pNotesPge->GetPresObj(PresObjKind::Notes);
716 if (pNotesObj)
718 OutlinerParaObject* pPara = pNotesObj->GetOutlinerParaObject();
719 if (pPara)
721 sValue.append("note:");
722 const EditTextObject& rEdit = pPara->GetTextObject();
723 for (sal_Int32 i=0;i<rEdit.GetParagraphCount();i++)
725 OUString strNote = rEdit.GetText(i);
726 strNote = strNote.replaceFirst( "\\", "\\\\" );
727 strNote = strNote.replaceFirst( "=", "\\=" );
728 strNote = strNote.replaceFirst( ";", "\\;" );
729 strNote = strNote.replaceFirst( ",", "\\," );
730 strNote = strNote.replaceFirst( ":", "\\:" );
731 sValue.append(strNote
732 + ";");//to divide each paragraph
738 if (dynamic_cast<const ::sd::OutlineViewShell* >(mpViewShell ) != nullptr )
740 SdPage* pCurrPge = mpViewShell->GetActualPage();
741 SdDrawDocument* pDoc = mpViewShell->GetDoc();
742 if(pCurrPge && pDoc)
744 OUString sDisplay;
745 sDisplay = pCurrPge->GetName();
746 sDisplay = sDisplay.replaceFirst( "=", "\\=" );
747 sDisplay = sDisplay.replaceFirst( ";", "\\;" );
748 sDisplay = sDisplay.replaceFirst( ",", "\\," );
749 sDisplay = sDisplay.replaceFirst( ":", "\\:" );
750 sValue = "page-name:" + sDisplay
751 + ";page-number:"
752 + OUString::number(static_cast<sal_Int32>(static_cast<sal_uInt16>((pCurrPge->GetPageNum()-1)>>1) + 1))
753 + ";total-pages:"
754 + OUString::number(static_cast<sal_Int32>(pDoc->GetSdPageCount(PageKind::Standard)))
755 + ";";
758 if (sValue.getLength())
759 anyAttribute <<= sValue.makeStringAndClear();
760 return anyAttribute;
763 sal_Int32 SAL_CALL AccessibleDocumentViewBase::getForeground( )
765 return sal_Int32(COL_BLACK);
768 sal_Int32 SAL_CALL AccessibleDocumentViewBase::getBackground( )
770 ThrowIfDisposed ();
771 ::osl::MutexGuard aGuard (m_aMutex);
772 return sal_Int32(mpViewShell->GetView()->getColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor);
774 } // end of namespace accessibility
776 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */