android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / access / accdoc.cxx
blobdeedc3b510a1fb57fbcb01dc00b0719ad44e8ca4
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 <vcl/window.hxx>
21 #include <rootfrm.hxx>
23 #include <com/sun/star/accessibility/AccessibleRole.hpp>
24 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
25 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
26 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
27 #include <cppuhelper/typeprovider.hxx>
28 #include <vcl/svapp.hxx>
29 #include <cppuhelper/supportsservice.hxx>
30 #include <viewsh.hxx>
31 #include <doc.hxx>
32 #include <accmap.hxx>
33 #include "accdoc.hxx"
34 #include <strings.hrc>
35 #include <pagefrm.hxx>
37 #include <swatrset.hxx>
38 #include <docsh.hxx>
39 #include <crsrsh.hxx>
40 #include <fesh.hxx>
41 #include <fmtclds.hxx>
42 #include <flyfrm.hxx>
43 #include <txtfrm.hxx>
44 #include <sectfrm.hxx>
45 #include <section.hxx>
46 #include <swmodule.hxx>
47 #include <svtools/colorcfg.hxx>
49 #include <fmtanchr.hxx>
50 #include <viewimp.hxx>
51 #include <dview.hxx>
52 #include <dcontact.hxx>
53 #include <svx/svdmark.hxx>
54 constexpr OUStringLiteral sServiceName = u"com.sun.star.text.AccessibleTextDocumentView";
55 constexpr OUStringLiteral sImplementationName = u"com.sun.star.comp.Writer.SwAccessibleDocumentView";
57 using namespace ::com::sun::star;
58 using namespace ::com::sun::star::accessibility;
60 using lang::IndexOutOfBoundsException;
62 // SwAccessibleDocumentBase: base class for SwAccessibleDocument and
63 // SwAccessiblePreview
65 SwAccessibleDocumentBase::SwAccessibleDocumentBase(
66 std::shared_ptr<SwAccessibleMap> const& pMap)
67 : SwAccessibleContext(pMap, AccessibleRole::DOCUMENT_TEXT,
68 pMap->GetShell()->GetLayout())
69 , mxParent(pMap->GetShell()->GetWin()->GetAccessibleParentWindow()->GetAccessible())
70 , mpChildWin(nullptr)
74 SwAccessibleDocumentBase::~SwAccessibleDocumentBase()
78 void SwAccessibleDocumentBase::SetVisArea()
80 SolarMutexGuard aGuard;
82 SwRect aOldVisArea( GetVisArea() );
83 const SwRect& rNewVisArea = GetMap()->GetVisArea();
84 if( aOldVisArea != rNewVisArea )
86 SwAccessibleFrame::SetVisArea( GetMap()->GetVisArea() );
87 // #i58139# - showing state of document view needs also be updated.
88 // Thus, call method <Scrolled(..)> instead of <ChildrenScrolled(..)>
89 // ChildrenScrolled( GetFrame(), aOldVisArea );
90 Scrolled( aOldVisArea );
94 void SwAccessibleDocumentBase::AddChild( vcl::Window *pWin, bool bFireEvent )
96 SolarMutexGuard aGuard;
98 OSL_ENSURE( !mpChildWin, "only one child window is supported" );
99 if( !mpChildWin )
101 mpChildWin = pWin;
103 if( bFireEvent )
105 AccessibleEventObject aEvent;
106 aEvent.EventId = AccessibleEventId::CHILD;
107 aEvent.NewValue <<= mpChildWin->GetAccessible();
108 aEvent.IndexHint = -1;
109 FireAccessibleEvent( aEvent );
114 void SwAccessibleDocumentBase::RemoveChild( vcl::Window *pWin )
116 SolarMutexGuard aGuard;
118 OSL_ENSURE( !mpChildWin || pWin == mpChildWin, "invalid child window to remove" );
119 if( mpChildWin && pWin == mpChildWin )
121 AccessibleEventObject aEvent;
122 aEvent.EventId = AccessibleEventId::CHILD;
123 aEvent.OldValue <<= mpChildWin->GetAccessible();
124 aEvent.IndexHint = -1;
125 FireAccessibleEvent( aEvent );
127 mpChildWin = nullptr;
131 sal_Int64 SAL_CALL SwAccessibleDocumentBase::getAccessibleChildCount()
133 SolarMutexGuard aGuard;
135 // ThrowIfDisposed is called by parent
137 sal_Int64 nChildren = SwAccessibleContext::getAccessibleChildCount();
138 if( !IsDisposing() && mpChildWin )
139 nChildren++;
141 return nChildren;
144 uno::Reference< XAccessible> SAL_CALL
145 SwAccessibleDocumentBase::getAccessibleChild( sal_Int64 nIndex )
147 SolarMutexGuard aGuard;
149 if( mpChildWin )
151 ThrowIfDisposed();
153 if ( nIndex == GetChildCount( *(GetMap()) ) )
155 return mpChildWin->GetAccessible();
159 return SwAccessibleContext::getAccessibleChild( nIndex );
162 uno::Reference< XAccessible> SAL_CALL SwAccessibleDocumentBase::getAccessibleParent()
164 return mxParent;
167 sal_Int64 SAL_CALL SwAccessibleDocumentBase::getAccessibleIndexInParent()
169 SolarMutexGuard aGuard;
171 uno::Reference < XAccessibleContext > xAcc( mxParent->getAccessibleContext() );
172 uno::Reference < XAccessible > xThis( this );
173 sal_Int64 nCount = xAcc->getAccessibleChildCount();
175 for( sal_Int64 i=0; i < nCount; i++ )
179 if( xAcc->getAccessibleChild( i ) == xThis )
180 return i;
182 catch(const css::lang::IndexOutOfBoundsException &)
184 return -1;
187 return -1;
190 OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleDescription()
192 return GetResource( STR_ACCESS_DOC_DESC );
195 OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleName()
197 SolarMutexGuard g;
199 OUString sAccName = GetResource( STR_ACCESS_DOC_WORDPROCESSING );
200 SwDoc *pDoc = GetMap() ? GetShell()->GetDoc() : nullptr;
201 if ( pDoc )
203 OUString sFileName = pDoc->getDocAccTitle();
204 if ( sFileName.isEmpty() )
206 SwDocShell* pDocSh = pDoc->GetDocShell();
207 if ( pDocSh )
209 sFileName = pDocSh->GetTitle( SFX_TITLE_APINAME );
213 if ( !sFileName.isEmpty() )
215 sAccName = sFileName + " - " + sAccName;
219 return sAccName;
222 awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds()
226 SolarMutexGuard aGuard;
228 vcl::Window *pWin = GetWindow();
229 if (!pWin)
231 throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
234 tools::Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) );
235 awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
236 aPixBounds.GetWidth(), aPixBounds.GetHeight() );
238 return aBox;
240 catch(const css::lang::IndexOutOfBoundsException &)
242 return awt::Rectangle();
246 awt::Point SAL_CALL SwAccessibleDocumentBase::getLocation()
248 SolarMutexGuard aGuard;
250 vcl::Window *pWin = GetWindow();
251 if (!pWin)
253 throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
256 Point aPixPos( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ).TopLeft() );
257 awt::Point aLoc( aPixPos.getX(), aPixPos.getY() );
259 return aLoc;
262 css::awt::Point SAL_CALL SwAccessibleDocumentBase::getLocationOnScreen()
264 SolarMutexGuard aGuard;
266 vcl::Window *pWin = GetWindow();
267 if (!pWin)
269 throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
272 Point aPixPos( pWin->GetWindowExtentsRelative( nullptr ).TopLeft() );
273 awt::Point aLoc( aPixPos.getX(), aPixPos.getY() );
275 return aLoc;
278 css::awt::Size SAL_CALL SwAccessibleDocumentBase::getSize()
280 SolarMutexGuard aGuard;
282 vcl::Window *pWin = GetWindow();
283 if (!pWin)
285 throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
288 Size aPixSize( pWin->GetWindowExtentsRelative( nullptr ).GetSize() );
289 awt::Size aSize( aPixSize.Width(), aPixSize.Height() );
291 return aSize;
294 sal_Bool SAL_CALL SwAccessibleDocumentBase::containsPoint(
295 const awt::Point& aPoint )
297 SolarMutexGuard aGuard;
299 vcl::Window *pWin = GetWindow();
300 if (!pWin)
302 throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
305 tools::Rectangle aPixBounds( pWin->GetWindowExtentsRelative( nullptr ) );
306 aPixBounds.Move(-aPixBounds.Left(), -aPixBounds.Top());
308 Point aPixPoint( aPoint.X, aPoint.Y );
309 return aPixBounds.Contains( aPixPoint );
312 uno::Reference< XAccessible > SAL_CALL SwAccessibleDocumentBase::getAccessibleAtPoint(
313 const awt::Point& aPoint )
315 SolarMutexGuard aGuard;
317 if( mpChildWin )
319 ThrowIfDisposed();
321 vcl::Window *pWin = GetWindow();
322 if (!pWin)
324 throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
326 if (pWin->isDisposed()) // tdf#147967
327 return nullptr;
329 Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to window
330 if( mpChildWin->GetWindowExtentsRelative( pWin ).Contains( aPixPoint ) )
331 return mpChildWin->GetAccessible();
334 return SwAccessibleContext::getAccessibleAtPoint( aPoint );
337 // SwAccessibleDocument
339 void SwAccessibleDocument::GetStates( sal_Int64& rStateSet )
341 SwAccessibleContext::GetStates( rStateSet );
343 // MULTISELECTABLE
344 rStateSet |= AccessibleStateType::MULTI_SELECTABLE;
345 rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
348 SwAccessibleDocument::SwAccessibleDocument(
349 std::shared_ptr<SwAccessibleMap> const& pInitMap)
350 : SwAccessibleDocumentBase(pInitMap)
351 , maSelectionHelper(*this)
353 SetName(pInitMap->GetDocName());
354 vcl::Window *pWin = pInitMap->GetShell()->GetWin();
355 if( pWin )
357 pWin->AddChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
358 sal_uInt16 nCount = pWin->GetChildCount();
359 for( sal_uInt16 i=0; i < nCount; i++ )
361 vcl::Window* pChildWin = pWin->GetChild( i );
362 if( pChildWin &&
363 AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
364 AddChild( pChildWin, false );
369 SwAccessibleDocument::~SwAccessibleDocument()
371 vcl::Window *pWin = GetMap() ? GetMap()->GetShell()->GetWin() : nullptr;
372 if( pWin )
373 pWin->RemoveChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
376 void SwAccessibleDocument::Dispose(bool bRecursive, bool bCanSkipInvisible)
378 OSL_ENSURE( GetFrame() && GetMap(), "already disposed" );
380 vcl::Window *pWin = GetMap() ? GetMap()->GetShell()->GetWin() : nullptr;
381 if( pWin )
382 pWin->RemoveChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
383 SwAccessibleContext::Dispose(bRecursive, bCanSkipInvisible);
386 IMPL_LINK( SwAccessibleDocument, WindowChildEventListener, VclWindowEvent&, rEvent, void )
388 OSL_ENSURE( rEvent.GetWindow(), "Window???" );
389 switch ( rEvent.GetId() )
391 case VclEventId::WindowShow: // send create on show for direct accessible children
393 vcl::Window* pChildWin = static_cast< vcl::Window* >( rEvent.GetData() );
394 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
396 AddChild( pChildWin );
399 break;
400 case VclEventId::WindowHide: // send destroy on hide for direct accessible children
402 vcl::Window* pChildWin = static_cast< vcl::Window* >( rEvent.GetData() );
403 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
405 RemoveChild( pChildWin );
408 break;
409 case VclEventId::ObjectDying: // send destroy on hide for direct accessible children
411 vcl::Window* pChildWin = rEvent.GetWindow();
412 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
414 RemoveChild( pChildWin );
417 break;
418 default: break;
422 OUString SAL_CALL SwAccessibleDocument::getImplementationName()
424 return sImplementationName;
427 sal_Bool SAL_CALL SwAccessibleDocument::supportsService(const OUString& sTestServiceName)
429 return cppu::supportsService(this, sTestServiceName);
432 uno::Sequence< OUString > SAL_CALL SwAccessibleDocument::getSupportedServiceNames()
434 return { sServiceName, sAccessibleServiceName };
437 // XInterface
439 uno::Any SwAccessibleDocument::queryInterface(
440 const uno::Type& rType )
442 uno::Any aRet;
443 if ( rType == cppu::UnoType<XAccessibleSelection>::get() )
445 uno::Reference<XAccessibleSelection> aSelect = this;
446 aRet <<= aSelect;
448 else if ( rType == cppu::UnoType<XAccessibleExtendedAttributes>::get())
450 uno::Reference<XAccessibleExtendedAttributes> aAttribute = this;
451 aRet <<= aAttribute;
453 else
454 aRet = SwAccessibleContext::queryInterface( rType );
455 return aRet;
458 // XTypeProvider
459 uno::Sequence< uno::Type > SAL_CALL SwAccessibleDocument::getTypes()
461 return cppu::OTypeCollection(
462 cppu::UnoType<XAccessibleSelection>::get(),
463 SwAccessibleDocumentBase::getTypes() ).getTypes();
466 uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleDocument::getImplementationId()
468 return css::uno::Sequence<sal_Int8>();
471 // XAccessibleSelection
473 void SwAccessibleDocument::selectAccessibleChild(
474 sal_Int64 nChildIndex )
476 maSelectionHelper.selectAccessibleChild(nChildIndex);
479 sal_Bool SwAccessibleDocument::isAccessibleChildSelected(
480 sal_Int64 nChildIndex )
482 return maSelectionHelper.isAccessibleChildSelected(nChildIndex);
485 void SwAccessibleDocument::clearAccessibleSelection( )
489 void SwAccessibleDocument::selectAllAccessibleChildren( )
491 maSelectionHelper.selectAllAccessibleChildren();
494 sal_Int64 SwAccessibleDocument::getSelectedAccessibleChildCount( )
496 return maSelectionHelper.getSelectedAccessibleChildCount();
499 uno::Reference<XAccessible> SwAccessibleDocument::getSelectedAccessibleChild(
500 sal_Int64 nSelectedChildIndex )
502 return maSelectionHelper.getSelectedAccessibleChild(nSelectedChildIndex);
505 // index has to be treated as global child index.
506 void SwAccessibleDocument::deselectAccessibleChild(
507 sal_Int64 nChildIndex )
509 maSelectionHelper.deselectAccessibleChild( nChildIndex );
512 uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes()
514 SolarMutexGuard g;
516 uno::Any anyAttribute;
517 SwDoc *pDoc = GetMap() ? GetShell()->GetDoc() : nullptr;
519 if (!pDoc)
520 return anyAttribute;
521 SwCursorShell* pCursorShell = GetCursorShell();
522 if( !pCursorShell )
523 return anyAttribute;
525 SwFEShell* pFEShell = dynamic_cast<SwFEShell*>(pCursorShell);
526 if( pFEShell )
528 OUString sDisplay;
529 sal_uInt16 nPage, nLogPage;
530 pFEShell->GetPageNumber(-1,true,nPage,nLogPage,sDisplay);
532 OUString sValue = "page-name:" + sDisplay +
533 ";page-number:" +
534 OUString::number( nPage ) +
535 ";total-pages:" +
536 OUString::number( pCursorShell->GetPageCnt() ) + ";";
538 // cursor position relative to the page
539 Point aCursorPagePos = pFEShell->GetCursorPagePos();
540 sValue += "cursor-position-in-page-horizontal:" + OUString::number(aCursorPagePos.getX())
541 + ";cursor-position-in-page-vertical:" + OUString::number(aCursorPagePos.getY()) + ";";
543 SwContentFrame* pCurrFrame = pCursorShell->GetCurrFrame();
544 SwPageFrame* pCurrPage=static_cast<SwFrame*>(pCurrFrame)->FindPageFrame();
545 sal_Int32 nLineNum = 0;
546 SwTextFrame* pTextFrame = nullptr;
547 SwTextFrame* pCurrTextFrame = nullptr;
548 pTextFrame = static_cast< SwTextFrame* >(pCurrPage->ContainsContent());
549 if (pCurrFrame->IsInFly())//such as, graphic,chart
551 SwFlyFrame *pFlyFrame = pCurrFrame->FindFlyFrame();
552 const SwFormatAnchor& rAnchor = pFlyFrame->GetFormat()->GetAnchor();
553 RndStdIds eAnchorId = rAnchor.GetAnchorId();
554 if(eAnchorId == RndStdIds::FLY_AS_CHAR)
556 const SwFrame *pSwFrame = pFlyFrame->GetAnchorFrame();
557 if(pSwFrame->IsTextFrame())
558 pCurrTextFrame = const_cast<SwTextFrame*>(static_cast<const SwTextFrame*>(pSwFrame));
561 else
563 assert(dynamic_cast<SwTextFrame*>(pCurrFrame));
564 pCurrTextFrame = static_cast<SwTextFrame* >(pCurrFrame);
566 //check whether the text frame where the Graph/OLE/Frame anchored is in the Header/Footer
567 SwFrame* pFrame = pCurrTextFrame;
568 while ( pFrame && !pFrame->IsHeaderFrame() && !pFrame->IsFooterFrame() )
569 pFrame = pFrame->GetUpper();
570 if ( pFrame )
571 pCurrTextFrame = nullptr;
572 //check shape
573 if(pCursorShell->Imp()->GetDrawView())
575 const SdrMarkList &rMrkList = pCursorShell->Imp()->GetDrawView()->GetMarkedObjectList();
576 for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
578 SdrObject *pObj = rMrkList.GetMark(i)->GetMarkedSdrObj();
579 SwFrameFormat* pFormat = static_cast<SwDrawContact*>(pObj->GetUserCall())->GetFormat();
580 const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
581 if( RndStdIds::FLY_AS_CHAR != rAnchor.GetAnchorId() )
582 pCurrTextFrame = nullptr;
585 //calculate line number
586 if (pCurrTextFrame && pTextFrame)
588 if (!(pCurrTextFrame->IsInTab() || pCurrTextFrame->IsInFootnote()))
590 while( pTextFrame && pTextFrame != pCurrTextFrame )
592 //check header/footer
593 pFrame = pTextFrame;
594 while ( pFrame && !pFrame->IsHeaderFrame() && !pFrame->IsFooterFrame() )
595 pFrame = pFrame->GetUpper();
596 if ( pFrame )
598 pTextFrame = static_cast< SwTextFrame*>(pTextFrame->GetNextContentFrame());
599 continue;
601 if (!(pTextFrame->IsInTab() || pTextFrame->IsInFootnote() || pTextFrame->IsInFly()))
602 nLineNum += pTextFrame->GetThisLines();
603 pTextFrame = static_cast< SwTextFrame* >(pTextFrame ->GetNextContentFrame());
605 SwPaM* pCaret = pCursorShell->GetCursor();
606 if (!pCurrTextFrame->IsEmpty() && pCaret)
608 assert(pCurrTextFrame->IsTextFrame());
609 const SwPosition* pPoint = nullptr;
610 if (pCurrTextFrame->IsInFly())
612 SwFlyFrame *pFlyFrame = pCurrTextFrame->FindFlyFrame();
613 const SwFormatAnchor& rAnchor = pFlyFrame->GetFormat()->GetAnchor();
614 pPoint = rAnchor.GetContentAnchor();
615 SwContentNode *const pNode(pPoint->GetNode().GetContentNode());
616 pCurrTextFrame = pNode
617 ? static_cast<SwTextFrame*>(pNode->getLayoutFrame(
618 pCurrTextFrame->getRootFrame(), pPoint))
619 : nullptr;
621 else
622 pPoint = pCaret->GetPoint();
623 if (pCurrTextFrame)
625 TextFrameIndex const nActPos(pCurrTextFrame->MapModelToViewPos(*pPoint));
626 nLineNum += pCurrTextFrame->GetLineCount( nActPos );
629 else
630 ++nLineNum;
634 sValue += "line-number:" + OUString::number( nLineNum ) + ";";
636 SwFrame* pCurrCol=static_cast<SwFrame*>(pCurrFrame)->FindColFrame();
638 sValue += "column-number:";
640 int nCurrCol = 1;
641 if(pCurrCol!=nullptr)
643 //SwLayoutFrame* pParent = pCurrCol->GetUpper();
644 SwFrame* pCurrPageCol=static_cast<SwFrame*>(pCurrFrame)->FindColFrame();
645 while(pCurrPageCol && pCurrPageCol->GetUpper() && pCurrPageCol->GetUpper()->IsPageFrame())
647 pCurrPageCol = pCurrPageCol->GetUpper();
650 SwLayoutFrame* pParent = pCurrPageCol->GetUpper();
652 if(pParent!=nullptr)
654 SwFrame* pCol = pParent->Lower();
655 while(pCol&&(pCol!=pCurrPageCol))
657 pCol = pCol->GetNext();
658 ++nCurrCol;
662 sValue += OUString::number( nCurrCol ) + ";";
664 const SwFormatCol &rFormatCol=pCurrPage->GetAttrSet()->GetCol();
665 sal_uInt16 nColCount=rFormatCol.GetNumCols();
666 nColCount = nColCount>0?nColCount:1;
667 sValue += "total-columns:" + OUString::number( nColCount ) + ";";
669 SwSectionFrame* pCurrSctFrame=static_cast<SwFrame*>(pCurrFrame)->FindSctFrame();
670 if(pCurrSctFrame!=nullptr && pCurrSctFrame->GetSection()!=nullptr )
672 OUString sectionName = pCurrSctFrame->GetSection()->GetSectionName();
674 sectionName = sectionName.replaceFirst( "\\" , "\\\\" );
675 sectionName = sectionName.replaceFirst( "=" , "\\=" );
676 sectionName = sectionName.replaceFirst( ";" , "\\;" );
677 sectionName = sectionName.replaceFirst( "," , "\\," );
678 sectionName = sectionName.replaceFirst( ":" , "\\:" );
680 sValue += "section-name:" + sectionName + ";";
682 //section-columns-number
684 nCurrCol = 1;
686 if(pCurrCol!=nullptr)
688 SwLayoutFrame* pParent = pCurrCol->GetUpper();
689 if(pParent!=nullptr)
691 SwFrame* pCol = pParent->Lower();
692 while(pCol&&(pCol!=pCurrCol))
694 pCol = pCol->GetNext();
695 nCurrCol +=1;
699 sValue += "section-columns-number:" +
700 OUString::number( nCurrCol ) + ";";
702 //section-total-columns
703 const SwFormatCol &rFormatSctCol=pCurrSctFrame->GetAttrSet()->GetCol();
704 sal_uInt16 nSctColCount=rFormatSctCol.GetNumCols();
705 nSctColCount = nSctColCount>0?nSctColCount:1;
706 sValue += "section-total-columns:" +
707 OUString::number( nSctColCount ) + ";";
710 anyAttribute <<= sValue;
712 return anyAttribute;
715 sal_Int32 SAL_CALL SwAccessibleDocument::getBackground()
717 SolarMutexGuard aGuard;
718 return sal_Int32(SW_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor);
721 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */