2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-16 19:34:24 +00:00
|
|
|
|
2002-02-04 13:10:18 +00:00
|
|
|
#include <vcl/window.hxx>
|
|
|
|
#include <rootfrm.hxx>
|
|
|
|
|
2003-04-24 15:10:35 +00:00
|
|
|
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
|
|
|
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
|
2002-02-18 15:27:35 +00:00
|
|
|
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
|
2003-04-24 15:10:35 +00:00
|
|
|
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
|
2002-02-05 14:52:06 +00:00
|
|
|
#include <unotools/accessiblestatesethelper.hxx>
|
2002-06-07 06:32:53 +00:00
|
|
|
#include <sfx2/viewsh.hxx>
|
2010-10-16 03:22:02 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2002-02-04 13:10:18 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
2011-06-01 22:40:08 +01:00
|
|
|
#include <comphelper/servicehelper.hxx>
|
2013-12-05 19:17:18 -02:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2002-02-20 16:55:57 +00:00
|
|
|
#include <viewsh.hxx>
|
|
|
|
#include <doc.hxx>
|
|
|
|
#include <accmap.hxx>
|
2002-02-04 13:10:18 +00:00
|
|
|
#include <accdoc.hxx>
|
|
|
|
#include "access.hrc"
|
2002-05-22 10:48:43 +00:00
|
|
|
#include <pagefrm.hxx>
|
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
#include <editeng/brushitem.hxx>
|
|
|
|
#include <swatrset.hxx>
|
|
|
|
#include <frmatr.hxx>
|
|
|
|
#include "unostyle.hxx"
|
|
|
|
#include "docsh.hxx"
|
|
|
|
#include <crsrsh.hxx>
|
|
|
|
#include "fesh.hxx"
|
|
|
|
#include <fmtclds.hxx>
|
|
|
|
#include <flyfrm.hxx>
|
|
|
|
#include <colfrm.hxx>
|
|
|
|
#include <txtfrm.hxx>
|
|
|
|
#include <sectfrm.hxx>
|
|
|
|
#include <section.hxx>
|
|
|
|
#include <svx/unoapi.hxx>
|
|
|
|
#include <swmodule.hxx>
|
|
|
|
#include <svtools/colorcfg.hxx>
|
|
|
|
|
|
|
|
#include <fmtanchr.hxx>
|
|
|
|
#include <viewimp.hxx>
|
|
|
|
#include <dview.hxx>
|
|
|
|
#include <dcontact.hxx>
|
|
|
|
#include <svx/svdmark.hxx>
|
2003-04-24 15:10:35 +00:00
|
|
|
const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentView";
|
2002-07-09 11:51:33 +00:00
|
|
|
const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentView";
|
2002-02-04 13:10:18 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
2003-04-24 15:10:35 +00:00
|
|
|
using namespace ::com::sun::star::accessibility;
|
2002-02-04 13:10:18 +00:00
|
|
|
|
2007-09-27 07:19:24 +00:00
|
|
|
using lang::IndexOutOfBoundsException;
|
2002-04-12 08:19:43 +00:00
|
|
|
|
2002-05-22 10:48:43 +00:00
|
|
|
// SwAccessibleDocumentBase: base class for SwAccessibleDocument and
|
|
|
|
// SwAccessiblePreview
|
2002-02-05 14:52:06 +00:00
|
|
|
|
2010-06-13 15:22:56 +02:00
|
|
|
SwAccessibleDocumentBase::SwAccessibleDocumentBase ( SwAccessibleMap *_pMap ) :
|
2014-02-03 19:08:31 +01:00
|
|
|
SwAccessibleContext( _pMap, AccessibleRole::DOCUMENT_TEXT,
|
2013-10-22 15:14:13 +03:00
|
|
|
_pMap->GetShell()->GetLayout() ),
|
2010-06-13 15:22:56 +02:00
|
|
|
mxParent( _pMap->GetShell()->GetWin()->GetAccessibleParentWindow()->GetAccessible() ),
|
2007-09-27 07:19:24 +00:00
|
|
|
mpChildWin( 0 )
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-05-22 10:48:43 +00:00
|
|
|
SwAccessibleDocumentBase::~SwAccessibleDocumentBase()
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-05-22 10:48:43 +00:00
|
|
|
void SwAccessibleDocumentBase::SetVisArea()
|
2002-04-11 13:04:40 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-04-11 13:04:40 +00:00
|
|
|
|
|
|
|
SwRect aOldVisArea( GetVisArea() );
|
|
|
|
const SwRect& rNewVisArea = GetMap()->GetVisArea();
|
|
|
|
if( aOldVisArea != rNewVisArea )
|
|
|
|
{
|
|
|
|
SwAccessibleFrame::SetVisArea( GetMap()->GetVisArea() );
|
2011-01-30 04:19:53 +09:00
|
|
|
// #i58139# - showing state of document view needs also be updated.
|
2008-01-15 12:48:13 +00:00
|
|
|
// Thus, call method <Scrolled(..)> instead of <ChildrenScrolled(..)>
|
2013-03-16 23:54:23 +01:00
|
|
|
// ChildrenScrolled( GetFrm(), aOldVisArea );
|
2008-01-15 12:48:13 +00:00
|
|
|
Scrolled( aOldVisArea );
|
2002-04-11 13:04:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
void SwAccessibleDocumentBase::AddChild( vcl::Window *pWin, bool bFireEvent )
|
2002-06-07 06:32:53 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-06-07 06:32:53 +00:00
|
|
|
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( !mpChildWin, "only one child window is supported" );
|
2007-09-27 07:19:24 +00:00
|
|
|
if( !mpChildWin )
|
2002-06-07 06:32:53 +00:00
|
|
|
{
|
2007-09-27 07:19:24 +00:00
|
|
|
mpChildWin = pWin;
|
2002-06-07 06:32:53 +00:00
|
|
|
|
|
|
|
if( bFireEvent )
|
|
|
|
{
|
|
|
|
AccessibleEventObject aEvent;
|
2003-04-24 15:10:35 +00:00
|
|
|
aEvent.EventId = AccessibleEventId::CHILD;
|
2007-09-27 07:19:24 +00:00
|
|
|
aEvent.NewValue <<= mpChildWin->GetAccessible();
|
2002-06-07 06:32:53 +00:00
|
|
|
FireAccessibleEvent( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
void SwAccessibleDocumentBase::RemoveChild( vcl::Window *pWin )
|
2002-06-07 06:32:53 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-06-07 06:32:53 +00:00
|
|
|
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( !mpChildWin || pWin == mpChildWin, "invalid child window to remove" );
|
2007-09-27 07:19:24 +00:00
|
|
|
if( mpChildWin && pWin == mpChildWin )
|
2002-06-07 06:32:53 +00:00
|
|
|
{
|
|
|
|
AccessibleEventObject aEvent;
|
2003-04-24 15:10:35 +00:00
|
|
|
aEvent.EventId = AccessibleEventId::CHILD;
|
2007-09-27 07:19:24 +00:00
|
|
|
aEvent.OldValue <<= mpChildWin->GetAccessible();
|
2002-06-07 06:32:53 +00:00
|
|
|
FireAccessibleEvent( aEvent );
|
|
|
|
|
2007-09-27 07:19:24 +00:00
|
|
|
mpChildWin = 0;
|
2002-06-07 06:32:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL SwAccessibleDocumentBase::getAccessibleChildCount( void )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-06-07 06:32:53 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-06-07 06:32:53 +00:00
|
|
|
|
|
|
|
// CHECK_FOR_DEFUNC is called by parent
|
|
|
|
|
|
|
|
sal_Int32 nChildren = SwAccessibleContext::getAccessibleChildCount();
|
2007-09-27 07:19:24 +00:00
|
|
|
if( !IsDisposing() && mpChildWin )
|
2002-06-07 06:32:53 +00:00
|
|
|
nChildren++;
|
|
|
|
|
|
|
|
return nChildren;
|
|
|
|
}
|
|
|
|
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Reference< XAccessible> SAL_CALL
|
2006-03-31 08:09:33 +00:00
|
|
|
SwAccessibleDocumentBase::getAccessibleChild( sal_Int32 nIndex )
|
2007-09-27 07:19:24 +00:00
|
|
|
throw (uno::RuntimeException,
|
2014-02-25 21:31:58 +01:00
|
|
|
lang::IndexOutOfBoundsException, std::exception)
|
2002-06-07 06:32:53 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-06-07 06:32:53 +00:00
|
|
|
|
2007-09-27 07:19:24 +00:00
|
|
|
if( mpChildWin )
|
2002-06-07 06:32:53 +00:00
|
|
|
{
|
|
|
|
CHECK_FOR_DEFUNC( XAccessibleContext )
|
2010-02-02 15:11:26 +01:00
|
|
|
if ( nIndex == GetChildCount( *(GetMap()) ) )
|
|
|
|
{
|
2007-09-27 07:19:24 +00:00
|
|
|
return mpChildWin->GetAccessible();
|
2010-02-02 15:11:26 +01:00
|
|
|
}
|
2002-06-07 06:32:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return SwAccessibleContext::getAccessibleChild( nIndex );
|
|
|
|
}
|
|
|
|
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Reference< XAccessible> SAL_CALL SwAccessibleDocumentBase::getAccessibleParent (void)
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
2007-09-27 07:19:24 +00:00
|
|
|
return mxParent;
|
2002-02-04 13:10:18 +00:00
|
|
|
}
|
|
|
|
|
2002-05-22 10:48:43 +00:00
|
|
|
sal_Int32 SAL_CALL SwAccessibleDocumentBase::getAccessibleIndexInParent (void)
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-02-04 13:10:18 +00:00
|
|
|
|
2007-09-27 07:19:24 +00:00
|
|
|
uno::Reference < XAccessibleContext > xAcc( mxParent->getAccessibleContext() );
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Reference < XAccessible > xThis( this );
|
2002-02-04 13:10:18 +00:00
|
|
|
sal_Int32 nCount = xAcc->getAccessibleChildCount();
|
|
|
|
|
|
|
|
for( sal_Int32 i=0; i < nCount; i++ )
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if( xAcc->getAccessibleChild( i ) == xThis )
|
|
|
|
return i;
|
|
|
|
}
|
2014-05-23 19:48:43 +09:00
|
|
|
catch(const ::com::sun::star::lang::IndexOutOfBoundsException &)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
return -1L;
|
|
|
|
}
|
2002-02-04 13:10:18 +00:00
|
|
|
}
|
|
|
|
return -1L;
|
|
|
|
}
|
|
|
|
|
2007-06-05 16:26:08 +00:00
|
|
|
OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleDescription (void)
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
|
|
|
return GetResource( STR_ACCESS_DOC_DESC );
|
|
|
|
}
|
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleName (void)
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (::com::sun::star::uno::RuntimeException, std::exception)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2013-12-13 22:10:17 +01:00
|
|
|
SolarMutexGuard g;
|
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
OUString sAccName = GetResource( STR_ACCESS_DOC_WORDPROCESSING );
|
2013-12-13 22:10:17 +01:00
|
|
|
SwDoc *pDoc = GetMap() ? GetShell()->GetDoc() : 0;
|
2013-11-29 13:03:27 +00:00
|
|
|
if ( pDoc )
|
|
|
|
{
|
|
|
|
OUString sFileName = pDoc->getDocAccTitle();
|
|
|
|
if ( sFileName.isEmpty() )
|
|
|
|
{
|
|
|
|
SwDocShell* pDocSh = pDoc->GetDocShell();
|
|
|
|
if ( pDocSh )
|
|
|
|
{
|
|
|
|
sFileName = pDocSh->GetTitle( SFX_TITLE_APINAME );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OUString sReadOnly;
|
|
|
|
if(pDoc->getDocReadOnly())
|
|
|
|
{
|
|
|
|
sReadOnly = GetResource( STR_ACCESS_DOC_WORDPROCESSING_READONLY );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !sFileName.isEmpty() )
|
|
|
|
{
|
|
|
|
sAccName = sFileName + sReadOnly + " - " + sAccName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return sAccName;
|
|
|
|
}
|
|
|
|
|
2002-05-22 10:48:43 +00:00
|
|
|
awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
SolarMutexGuard aGuard;
|
2002-02-04 13:10:18 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window *pWin = GetWindow();
|
2002-02-04 13:10:18 +00:00
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
|
2002-02-04 13:10:18 +00:00
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) );
|
|
|
|
awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
|
|
|
|
aPixBounds.GetWidth(), aPixBounds.GetHeight() );
|
2002-02-04 13:10:18 +00:00
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
return aBox;
|
|
|
|
}
|
2014-05-23 19:48:43 +09:00
|
|
|
catch(const ::com::sun::star::lang::IndexOutOfBoundsException &)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
return awt::Rectangle();
|
|
|
|
}
|
2002-02-04 13:10:18 +00:00
|
|
|
}
|
|
|
|
|
2002-05-22 10:48:43 +00:00
|
|
|
awt::Point SAL_CALL SwAccessibleDocumentBase::getLocation()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-02-04 13:10:18 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window *pWin = GetWindow();
|
2002-02-04 13:10:18 +00:00
|
|
|
|
|
|
|
CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
|
|
|
|
|
2002-04-17 13:07:39 +00:00
|
|
|
Point aPixPos( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ).TopLeft() );
|
2013-05-17 09:17:02 +02:00
|
|
|
awt::Point aLoc( aPixPos.getX(), aPixPos.getY() );
|
2002-02-04 13:10:18 +00:00
|
|
|
|
|
|
|
return aLoc;
|
|
|
|
}
|
|
|
|
|
2002-05-22 10:48:43 +00:00
|
|
|
::com::sun::star::awt::Point SAL_CALL SwAccessibleDocumentBase::getLocationOnScreen()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-02-04 13:10:18 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window *pWin = GetWindow();
|
2002-02-04 13:10:18 +00:00
|
|
|
|
|
|
|
CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
|
|
|
|
|
|
|
|
Point aPixPos( pWin->GetWindowExtentsRelative( 0 ).TopLeft() );
|
2013-05-17 09:17:02 +02:00
|
|
|
awt::Point aLoc( aPixPos.getX(), aPixPos.getY() );
|
2002-02-04 13:10:18 +00:00
|
|
|
|
|
|
|
return aLoc;
|
|
|
|
}
|
|
|
|
|
2002-05-22 10:48:43 +00:00
|
|
|
::com::sun::star::awt::Size SAL_CALL SwAccessibleDocumentBase::getSize()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-02-04 13:10:18 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window *pWin = GetWindow();
|
2002-02-04 13:10:18 +00:00
|
|
|
|
|
|
|
CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
|
|
|
|
|
|
|
|
Size aPixSize( pWin->GetWindowExtentsRelative( 0 ).GetSize() );
|
|
|
|
awt::Size aSize( aPixSize.Width(), aPixSize.Height() );
|
|
|
|
|
|
|
|
return aSize;
|
|
|
|
}
|
|
|
|
|
2003-04-24 15:10:35 +00:00
|
|
|
sal_Bool SAL_CALL SwAccessibleDocumentBase::containsPoint(
|
2007-06-05 16:26:08 +00:00
|
|
|
const awt::Point& aPoint )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-08-07 11:41:28 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-08-07 11:41:28 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window *pWin = GetWindow();
|
2002-08-07 11:41:28 +00:00
|
|
|
|
|
|
|
CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
|
|
|
|
|
2002-10-02 07:48:09 +00:00
|
|
|
Rectangle aPixBounds( pWin->GetWindowExtentsRelative( 0 ) );
|
|
|
|
aPixBounds.Move(-aPixBounds.Left(), -aPixBounds.Top());
|
2002-08-07 11:41:28 +00:00
|
|
|
|
|
|
|
Point aPixPoint( aPoint.X, aPoint.Y );
|
|
|
|
return aPixBounds.IsInside( aPixPoint );
|
|
|
|
}
|
|
|
|
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Reference< XAccessible > SAL_CALL SwAccessibleDocumentBase::getAccessibleAtPoint(
|
2002-06-07 06:32:53 +00:00
|
|
|
const awt::Point& aPoint )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-06-07 06:32:53 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-06-07 06:32:53 +00:00
|
|
|
|
2007-09-27 07:19:24 +00:00
|
|
|
if( mpChildWin )
|
2002-06-07 06:32:53 +00:00
|
|
|
{
|
|
|
|
CHECK_FOR_DEFUNC( XAccessibleComponent )
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window *pWin = GetWindow();
|
2002-06-07 06:32:53 +00:00
|
|
|
CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
|
2002-02-04 13:10:18 +00:00
|
|
|
|
2002-06-07 06:32:53 +00:00
|
|
|
Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to window
|
2007-09-27 07:19:24 +00:00
|
|
|
if( mpChildWin->GetWindowExtentsRelative( pWin ).IsInside( aPixPoint ) )
|
|
|
|
return mpChildWin->GetAccessible();
|
2002-06-07 06:32:53 +00:00
|
|
|
}
|
|
|
|
|
2003-04-24 15:10:35 +00:00
|
|
|
return SwAccessibleContext::getAccessibleAtPoint( aPoint );
|
2002-06-07 06:32:53 +00:00
|
|
|
}
|
2002-05-22 10:48:43 +00:00
|
|
|
|
|
|
|
// SwAccessibeDocument
|
|
|
|
|
|
|
|
void SwAccessibleDocument::GetStates(
|
|
|
|
::utl::AccessibleStateSetHelper& rStateSet )
|
|
|
|
{
|
|
|
|
SwAccessibleContext::GetStates( rStateSet );
|
|
|
|
|
|
|
|
// MULTISELECTABLE
|
2003-04-24 15:10:35 +00:00
|
|
|
rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
|
2013-11-29 13:03:27 +00:00
|
|
|
rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
|
2002-05-22 10:48:43 +00:00
|
|
|
}
|
|
|
|
|
2007-09-27 07:19:24 +00:00
|
|
|
SwAccessibleDocument::SwAccessibleDocument ( SwAccessibleMap* pInitMap ) :
|
|
|
|
SwAccessibleDocumentBase( pInitMap ),
|
|
|
|
maSelectionHelper( *this )
|
2002-05-22 10:48:43 +00:00
|
|
|
{
|
|
|
|
SetName( GetResource( STR_ACCESS_DOC_NAME ) );
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window *pWin = pInitMap->GetShell()->GetWin();
|
2002-06-07 06:32:53 +00:00
|
|
|
if( pWin )
|
|
|
|
{
|
|
|
|
pWin->AddChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nCount = pWin->GetChildCount();
|
2002-06-07 06:32:53 +00:00
|
|
|
for( sal_uInt16 i=0; i < nCount; i++ )
|
|
|
|
{
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pChildWin = pWin->GetChild( i );
|
2002-06-07 06:32:53 +00:00
|
|
|
if( pChildWin &&
|
|
|
|
AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
|
2014-09-15 15:59:40 +02:00
|
|
|
AddChild( pChildWin, false );
|
2002-06-07 06:32:53 +00:00
|
|
|
}
|
|
|
|
}
|
2002-05-22 10:48:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwAccessibleDocument::~SwAccessibleDocument()
|
|
|
|
{
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window *pWin = GetMap() ? GetMap()->GetShell()->GetWin() : 0;
|
2002-06-07 06:32:53 +00:00
|
|
|
if( pWin )
|
|
|
|
pWin->RemoveChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
|
2002-05-22 10:48:43 +00:00
|
|
|
}
|
|
|
|
|
2014-04-25 14:00:35 +02:00
|
|
|
void SwAccessibleDocument::Dispose( bool bRecursive )
|
2002-06-07 06:32:53 +00:00
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( GetFrm() && GetMap(), "already disposed" );
|
2002-06-07 06:32:53 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window *pWin = GetMap() ? GetMap()->GetShell()->GetWin() : 0;
|
2002-06-07 06:32:53 +00:00
|
|
|
if( pWin )
|
|
|
|
pWin->RemoveChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
|
|
|
|
SwAccessibleContext::Dispose( bRecursive );
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK( SwAccessibleDocument, WindowChildEventListener, VclSimpleEvent*, pEvent )
|
|
|
|
{
|
2011-05-08 22:14:45 +02:00
|
|
|
OSL_ENSURE( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
|
2002-06-07 06:32:53 +00:00
|
|
|
if ( pEvent && pEvent->ISA( VclWindowEvent ) )
|
|
|
|
{
|
|
|
|
VclWindowEvent *pVclEvent = static_cast< VclWindowEvent * >( pEvent );
|
2011-05-08 22:14:45 +02:00
|
|
|
OSL_ENSURE( pVclEvent->GetWindow(), "Window???" );
|
2002-06-07 06:32:53 +00:00
|
|
|
switch ( pVclEvent->GetId() )
|
|
|
|
{
|
|
|
|
case VCLEVENT_WINDOW_SHOW: // send create on show for direct accessible children
|
|
|
|
{
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pChildWin = static_cast< vcl::Window* >( pVclEvent->GetData() );
|
2002-06-07 06:32:53 +00:00
|
|
|
if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
|
|
|
|
{
|
|
|
|
AddChild( pChildWin );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_HIDE: // send destroy on hide for direct accessible children
|
2004-09-08 16:41:25 +00:00
|
|
|
{
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pChildWin = static_cast< vcl::Window* >( pVclEvent->GetData() );
|
2004-09-08 16:41:25 +00:00
|
|
|
if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
|
|
|
|
{
|
|
|
|
RemoveChild( pChildWin );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2002-06-14 10:15:54 +00:00
|
|
|
case VCLEVENT_OBJECT_DYING: // send destroy on hide for direct accessible children
|
2002-06-07 06:32:53 +00:00
|
|
|
{
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pChildWin = pVclEvent->GetWindow();
|
2002-06-07 06:32:53 +00:00
|
|
|
if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
|
|
|
|
{
|
|
|
|
RemoveChild( pChildWin );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2002-05-22 10:48:43 +00:00
|
|
|
|
2002-02-04 13:10:18 +00:00
|
|
|
OUString SAL_CALL SwAccessibleDocument::getImplementationName()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw( uno::RuntimeException, std::exception )
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
2013-03-01 13:50:58 +01:00
|
|
|
return OUString(sImplementationName);
|
2002-02-04 13:10:18 +00:00
|
|
|
}
|
|
|
|
|
2013-12-05 19:17:18 -02:00
|
|
|
sal_Bool SAL_CALL SwAccessibleDocument::supportsService(const OUString& sTestServiceName)
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
2013-12-05 19:17:18 -02:00
|
|
|
return cppu::supportsService(this, sTestServiceName);
|
2002-02-04 13:10:18 +00:00
|
|
|
}
|
|
|
|
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Sequence< OUString > SAL_CALL SwAccessibleDocument::getSupportedServiceNames()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw( uno::RuntimeException, std::exception )
|
2002-02-04 13:10:18 +00:00
|
|
|
{
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Sequence< OUString > aRet(2);
|
2002-02-04 13:10:18 +00:00
|
|
|
OUString* pArray = aRet.getArray();
|
2014-12-18 13:35:13 +01:00
|
|
|
pArray[0] = sServiceName;
|
|
|
|
pArray[1] = sAccessibleServiceName;
|
2002-02-04 13:10:18 +00:00
|
|
|
return aRet;
|
|
|
|
}
|
2002-04-12 08:19:43 +00:00
|
|
|
|
2013-03-16 23:54:23 +01:00
|
|
|
// XInterface
|
2002-04-12 08:19:43 +00:00
|
|
|
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Any SwAccessibleDocument::queryInterface(
|
|
|
|
const uno::Type& rType )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw ( uno::RuntimeException, std::exception )
|
2002-04-12 08:19:43 +00:00
|
|
|
{
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Any aRet;
|
2014-05-14 23:17:17 +02:00
|
|
|
if ( rType == cppu::UnoType<XAccessibleSelection>::get() )
|
2002-04-12 08:19:43 +00:00
|
|
|
{
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Reference<XAccessibleSelection> aSelect = this;
|
2002-04-12 08:19:43 +00:00
|
|
|
aRet <<= aSelect;
|
|
|
|
}
|
2013-11-29 13:03:27 +00:00
|
|
|
//Add XEventListener interface support.
|
2014-05-17 23:32:29 +02:00
|
|
|
else if ( (rType == cppu::UnoType<com::sun::star::document::XEventListener>::get()) )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
uno::Reference<com::sun::star::document::XEventListener> aSelect = this;
|
|
|
|
aRet <<= aSelect;
|
|
|
|
}
|
2014-05-17 23:32:29 +02:00
|
|
|
else if ( rType == cppu::UnoType<XAccessibleExtendedAttributes>::get())
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
uno::Reference<XAccessibleExtendedAttributes> aAttribute = this;
|
|
|
|
aRet <<= aAttribute;
|
|
|
|
}
|
2014-05-17 23:32:29 +02:00
|
|
|
else if(rType == cppu::UnoType<XAccessibleGetAccFlowTo>::get())
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
uno::Reference<XAccessibleGetAccFlowTo> AccFlowTo = this;
|
|
|
|
aRet <<= AccFlowTo;
|
|
|
|
}
|
2002-04-12 08:19:43 +00:00
|
|
|
else
|
|
|
|
aRet = SwAccessibleContext::queryInterface( rType );
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
2013-03-16 23:54:23 +01:00
|
|
|
// XTypeProvider
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Sequence< uno::Type > SAL_CALL SwAccessibleDocument::getTypes()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(uno::RuntimeException, std::exception)
|
2002-08-07 12:32:17 +00:00
|
|
|
{
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Sequence< uno::Type > aTypes( SwAccessibleDocumentBase::getTypes() );
|
2002-08-07 12:32:17 +00:00
|
|
|
|
|
|
|
sal_Int32 nIndex = aTypes.getLength();
|
2013-11-29 13:03:27 +00:00
|
|
|
//Reset types memory alloc
|
|
|
|
//aTypes.realloc( nIndex + 1 );
|
|
|
|
aTypes.realloc( nIndex + 2 );
|
2002-08-07 12:32:17 +00:00
|
|
|
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Type* pTypes = aTypes.getArray();
|
2014-05-14 23:17:17 +02:00
|
|
|
pTypes[nIndex] = cppu::UnoType<XAccessibleSelection>::get();
|
2013-11-29 13:03:27 +00:00
|
|
|
//Add XEventListener interface support.
|
2014-05-17 23:32:29 +02:00
|
|
|
pTypes[nIndex + 1 ] = cppu::UnoType<com::sun::star::document::XEventListener>::get();
|
2002-08-07 12:32:17 +00:00
|
|
|
return aTypes;
|
|
|
|
}
|
|
|
|
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleDocument::getImplementationId()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(uno::RuntimeException, std::exception)
|
2002-08-15 09:25:23 +00:00
|
|
|
{
|
2014-03-10 16:24:57 +01:00
|
|
|
return css::uno::Sequence<sal_Int8>();
|
2002-08-15 09:25:23 +00:00
|
|
|
}
|
|
|
|
|
2013-03-16 23:54:23 +01:00
|
|
|
// XAccessibleSelection
|
2002-04-12 08:19:43 +00:00
|
|
|
|
|
|
|
void SwAccessibleDocument::selectAccessibleChild(
|
|
|
|
sal_Int32 nChildIndex )
|
2007-06-05 16:26:08 +00:00
|
|
|
throw ( lang::IndexOutOfBoundsException,
|
2014-02-25 21:31:58 +01:00
|
|
|
uno::RuntimeException, std::exception )
|
2002-04-12 08:19:43 +00:00
|
|
|
{
|
2007-09-27 07:19:24 +00:00
|
|
|
maSelectionHelper.selectAccessibleChild(nChildIndex);
|
2002-04-12 08:19:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SwAccessibleDocument::isAccessibleChildSelected(
|
|
|
|
sal_Int32 nChildIndex )
|
2007-06-05 16:26:08 +00:00
|
|
|
throw ( lang::IndexOutOfBoundsException,
|
2014-02-25 21:31:58 +01:00
|
|
|
uno::RuntimeException, std::exception )
|
2002-04-12 08:19:43 +00:00
|
|
|
{
|
2007-09-27 07:19:24 +00:00
|
|
|
return maSelectionHelper.isAccessibleChildSelected(nChildIndex);
|
2002-04-12 08:19:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwAccessibleDocument::clearAccessibleSelection( )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw ( uno::RuntimeException, std::exception )
|
2002-04-12 08:19:43 +00:00
|
|
|
{
|
2007-09-27 07:19:24 +00:00
|
|
|
maSelectionHelper.clearAccessibleSelection();
|
2002-04-12 08:19:43 +00:00
|
|
|
}
|
|
|
|
|
2003-05-22 11:50:41 +00:00
|
|
|
void SwAccessibleDocument::selectAllAccessibleChildren( )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw ( uno::RuntimeException, std::exception )
|
2002-04-12 08:19:43 +00:00
|
|
|
{
|
2007-09-27 07:19:24 +00:00
|
|
|
maSelectionHelper.selectAllAccessibleChildren();
|
2002-04-12 08:19:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 SwAccessibleDocument::getSelectedAccessibleChildCount( )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw ( uno::RuntimeException, std::exception )
|
2002-04-12 08:19:43 +00:00
|
|
|
{
|
2007-09-27 07:19:24 +00:00
|
|
|
return maSelectionHelper.getSelectedAccessibleChildCount();
|
2002-04-12 08:19:43 +00:00
|
|
|
}
|
|
|
|
|
2007-06-05 16:26:08 +00:00
|
|
|
uno::Reference<XAccessible> SwAccessibleDocument::getSelectedAccessibleChild(
|
2002-04-12 08:19:43 +00:00
|
|
|
sal_Int32 nSelectedChildIndex )
|
2007-06-05 16:26:08 +00:00
|
|
|
throw ( lang::IndexOutOfBoundsException,
|
2014-02-25 21:31:58 +01:00
|
|
|
uno::RuntimeException, std::exception)
|
2002-04-12 08:19:43 +00:00
|
|
|
{
|
2007-09-27 07:19:24 +00:00
|
|
|
return maSelectionHelper.getSelectedAccessibleChild(nSelectedChildIndex);
|
2002-04-12 08:19:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 04:19:53 +09:00
|
|
|
// index has to be treated as global child index.
|
2003-04-24 15:10:35 +00:00
|
|
|
void SwAccessibleDocument::deselectAccessibleChild(
|
2004-12-23 09:01:37 +00:00
|
|
|
sal_Int32 nChildIndex )
|
2007-06-05 16:26:08 +00:00
|
|
|
throw ( lang::IndexOutOfBoundsException,
|
2014-02-25 21:31:58 +01:00
|
|
|
uno::RuntimeException, std::exception )
|
2002-04-12 08:19:43 +00:00
|
|
|
{
|
2007-09-27 07:19:24 +00:00
|
|
|
maSelectionHelper.deselectAccessibleChild( nChildIndex );
|
2002-04-12 08:19:43 +00:00
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
//Implement XEventListener interfaces
|
|
|
|
void SAL_CALL SwAccessibleDocument::notifyEvent( const ::com::sun::star::document::EventObject& Event )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (::com::sun::star::uno::RuntimeException, std::exception)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2013-12-13 22:10:17 +01:00
|
|
|
SolarMutexGuard g;
|
|
|
|
|
2014-12-15 10:18:44 +01:00
|
|
|
if ( Event.EventName == "FirstPageShows" )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2014-04-25 14:00:35 +02:00
|
|
|
FireStateChangedEvent( AccessibleStateType::FOCUSED,true );
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
2014-12-15 10:18:44 +01:00
|
|
|
else if ( Event.EventName == "LoadFinished" )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
// IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent
|
2014-11-09 18:39:00 +01:00
|
|
|
// FireStateChangedEvent( AccessibleStateType::OFFSCREEN,true );
|
2013-11-29 13:03:27 +00:00
|
|
|
// MT: LoadFinished => Why not SHOWING == TRUE?
|
2014-04-25 14:00:35 +02:00
|
|
|
FireStateChangedEvent( AccessibleStateType::SHOWING,false );
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
2014-12-15 10:18:44 +01:00
|
|
|
else if ( Event.EventName == "FormatFinished" )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2014-04-25 14:00:35 +02:00
|
|
|
FireStateChangedEvent( AccessibleStateType::BUSY,false );
|
2014-11-09 18:39:00 +01:00
|
|
|
// FireStateChangedEvent( AccessibleStateType::OFFSCREEN,false );
|
2014-04-25 14:00:35 +02:00
|
|
|
FireStateChangedEvent( AccessibleStateType::SHOWING,true );
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-04-25 14:00:35 +02:00
|
|
|
isIfAsynLoad = false;
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SwAccessibleDocument::disposing( const ::com::sun::star::lang::EventObject& )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (::com::sun::star::uno::RuntimeException, std::exception)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes()
|
2014-01-28 10:00:45 +00:00
|
|
|
throw (::com::sun::star::lang::IndexOutOfBoundsException,
|
|
|
|
::com::sun::star::uno::RuntimeException,
|
|
|
|
std::exception)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2013-12-13 22:10:17 +01:00
|
|
|
SolarMutexGuard g;
|
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
uno::Any anyAtrribute;
|
2013-12-13 22:10:17 +01:00
|
|
|
SwDoc *pDoc = GetMap() ? GetShell()->GetDoc() : 0;
|
2013-11-29 13:03:27 +00:00
|
|
|
|
|
|
|
if (!pDoc)
|
|
|
|
return anyAtrribute;
|
|
|
|
SwCrsrShell* pCrsrShell = GetCrsrShell();
|
|
|
|
if( !pCrsrShell )
|
|
|
|
return anyAtrribute;
|
|
|
|
|
|
|
|
SwFEShell* pFEShell = pCrsrShell->ISA( SwFEShell )
|
|
|
|
? static_cast<SwFEShell*>( pCrsrShell )
|
|
|
|
: 0;
|
|
|
|
OUString sAttrName;
|
|
|
|
OUString sValue;
|
|
|
|
sal_uInt16 nPage, nLogPage;
|
|
|
|
OUString sDisplay;
|
|
|
|
|
|
|
|
if( pFEShell )
|
|
|
|
{
|
2014-04-25 14:00:35 +02:00
|
|
|
pFEShell->GetPageNumber(-1,true,nPage,nLogPage,sDisplay);
|
2013-11-29 13:03:27 +00:00
|
|
|
sAttrName = "page-name:";
|
|
|
|
|
|
|
|
sValue = sAttrName + sDisplay ;
|
|
|
|
sAttrName = ";page-number:";
|
|
|
|
sValue += sAttrName;
|
|
|
|
sValue += OUString::number( nPage ) ;
|
|
|
|
sAttrName = ";total-pages:";
|
|
|
|
sValue += sAttrName;
|
|
|
|
sValue += OUString::number( pCrsrShell->GetPageCnt() ) ;
|
|
|
|
sValue += ";";
|
|
|
|
|
|
|
|
sAttrName = "line-number:";
|
|
|
|
|
|
|
|
SwCntntFrm* pCurrFrm = pCrsrShell->GetCurrFrm();
|
2014-11-24 10:38:59 +02:00
|
|
|
SwPageFrm* pCurrPage=static_cast<SwFrm*>(pCurrFrm)->FindPageFrm();
|
2013-11-29 13:03:27 +00:00
|
|
|
sal_uLong nLineNum = 0;
|
|
|
|
SwTxtFrm* pTxtFrm = NULL;
|
|
|
|
SwTxtFrm* pCurrTxtFrm = NULL;
|
|
|
|
pTxtFrm = static_cast< SwTxtFrm* >(static_cast< SwPageFrm* > (pCurrPage)->ContainsCntnt());
|
|
|
|
if (pCurrFrm->IsInFly())//such as, graphic,chart
|
|
|
|
{
|
|
|
|
SwFlyFrm *pFlyFrm = pCurrFrm->FindFlyFrm();
|
|
|
|
const SwFmtAnchor& rAnchor = pFlyFrm->GetFmt()->GetAnchor();
|
|
|
|
RndStdIds eAnchorId = rAnchor.GetAnchorId();
|
|
|
|
if(eAnchorId == FLY_AS_CHAR)
|
|
|
|
{
|
|
|
|
const SwFrm *pSwFrm = pFlyFrm->GetAnchorFrm();
|
|
|
|
if(pSwFrm->IsTxtFrm())
|
2014-11-10 12:52:41 +02:00
|
|
|
pCurrTxtFrm = const_cast<SwTxtFrm*>(static_cast<const SwTxtFrm*>(pSwFrm));
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2014-11-10 12:52:41 +02:00
|
|
|
pCurrTxtFrm = const_cast<SwTxtFrm*>(static_cast<const SwTxtFrm* >(pCurrFrm));
|
2013-11-29 13:03:27 +00:00
|
|
|
//check whether the text frame where the Graph/OLE/Frame anchored is in the Header/Footer
|
|
|
|
SwFrm* pFrm = pCurrTxtFrm;
|
|
|
|
while ( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() )
|
|
|
|
pFrm = pFrm->GetUpper();
|
|
|
|
if ( pFrm )
|
|
|
|
pCurrTxtFrm = NULL;
|
|
|
|
//check shape
|
|
|
|
if(pCrsrShell->Imp()->GetDrawView())
|
|
|
|
{
|
|
|
|
const SdrMarkList &rMrkList = pCrsrShell->Imp()->GetDrawView()->GetMarkedObjectList();
|
2014-08-05 22:30:24 +02:00
|
|
|
for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
SdrObject *pObj = rMrkList.GetMark(i)->GetMarkedSdrObj();
|
2014-11-10 12:52:41 +02:00
|
|
|
SwFrmFmt* pFmt = static_cast<SwDrawContact*>(pObj->GetUserCall())->GetFmt();
|
2013-11-29 13:03:27 +00:00
|
|
|
const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
|
|
|
|
if( FLY_AS_CHAR != rAnchor.GetAnchorId() )
|
|
|
|
pCurrTxtFrm = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//calculate line number
|
|
|
|
if (pCurrTxtFrm && pTxtFrm)
|
|
|
|
{
|
|
|
|
if (!(pCurrTxtFrm->IsInTab() || pCurrTxtFrm->IsInFtn()))
|
|
|
|
{
|
|
|
|
while( pTxtFrm != pCurrTxtFrm )
|
|
|
|
{
|
|
|
|
//check header/footer
|
|
|
|
pFrm = pTxtFrm;
|
|
|
|
while ( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() )
|
|
|
|
pFrm = pFrm->GetUpper();
|
|
|
|
if ( pFrm )
|
|
|
|
{
|
|
|
|
pTxtFrm = static_cast< SwTxtFrm*>(pTxtFrm->GetNextCntntFrm());
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!(pTxtFrm->IsInTab() || pTxtFrm->IsInFtn() || pTxtFrm->IsInFly()))
|
|
|
|
nLineNum += pTxtFrm->GetThisLines();
|
|
|
|
pTxtFrm = static_cast< SwTxtFrm* >(pTxtFrm ->GetNextCntntFrm());
|
|
|
|
}
|
|
|
|
SwPaM* pCaret = pCrsrShell->GetCrsr();
|
|
|
|
if (!pCurrTxtFrm->IsEmpty() && pCaret)
|
|
|
|
{
|
|
|
|
sal_uInt16 nActPos = 0;
|
|
|
|
if (pCurrTxtFrm->IsTxtFrm())
|
|
|
|
{
|
|
|
|
const SwPosition* pPoint = NULL;
|
|
|
|
if(pCurrTxtFrm->IsInFly())
|
|
|
|
{
|
|
|
|
SwFlyFrm *pFlyFrm = pCurrTxtFrm->FindFlyFrm();
|
|
|
|
const SwFmtAnchor& rAnchor = pFlyFrm->GetFmt()->GetAnchor();
|
|
|
|
pPoint= rAnchor.GetCntntAnchor();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pPoint = pCaret->GetPoint();
|
|
|
|
nActPos = pPoint->nContent.GetIndex();
|
|
|
|
nLineNum += pCurrTxtFrm->GetLineCount( nActPos );
|
|
|
|
}
|
|
|
|
else//graphic, form, shape, etc.
|
|
|
|
{
|
|
|
|
SwPosition* pPoint = pCaret->GetPoint();
|
|
|
|
Point aPt = pCrsrShell->_GetCrsr()->GetPtPos();
|
|
|
|
if( pCrsrShell->GetLayout()->GetCrsrOfst( pPoint, aPt/*,* &eTmpState*/ ) )
|
|
|
|
{
|
|
|
|
nActPos = pPoint->nContent.GetIndex();
|
|
|
|
nLineNum += pCurrTxtFrm->GetLineCount( nActPos );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
++nLineNum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sValue += sAttrName;
|
|
|
|
sValue += OUString::number( nLineNum ) ;
|
|
|
|
|
|
|
|
sValue += ";";
|
|
|
|
|
2014-11-24 10:38:59 +02:00
|
|
|
SwFrm* pCurrCol=static_cast<SwFrm*>(pCurrFrm)->FindColFrm();
|
2013-11-29 13:03:27 +00:00
|
|
|
|
|
|
|
sAttrName = "column-number:";
|
|
|
|
sValue += sAttrName;
|
|
|
|
|
|
|
|
sal_uInt16 nCurrCol = 1;
|
|
|
|
if(pCurrCol!=NULL)
|
|
|
|
{
|
|
|
|
//SwLayoutFrm* pParent = pCurrCol->GetUpper();
|
2014-11-24 10:38:59 +02:00
|
|
|
SwFrm* pCurrPageCol=static_cast<SwFrm*>(pCurrFrm)->FindColFrm();
|
2013-11-29 13:03:27 +00:00
|
|
|
while(pCurrPageCol && pCurrPageCol->GetUpper() && pCurrPageCol->GetUpper()->IsPageFrm())
|
|
|
|
{
|
|
|
|
pCurrPageCol = pCurrPageCol->GetUpper();
|
|
|
|
}
|
|
|
|
|
|
|
|
SwLayoutFrm* pParent = (SwLayoutFrm*)(pCurrPageCol->GetUpper());
|
|
|
|
|
|
|
|
if(pParent!=NULL)
|
|
|
|
{
|
|
|
|
SwFrm* pCol = pParent->Lower();
|
|
|
|
while(pCol&&(pCol!=pCurrPageCol))
|
|
|
|
{
|
|
|
|
pCol = pCol->GetNext();
|
|
|
|
nCurrCol +=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sValue += OUString::number( nCurrCol ) ;
|
|
|
|
sValue += ";";
|
|
|
|
|
|
|
|
sAttrName = "total-columns:";
|
|
|
|
|
|
|
|
const SwFmtCol &rFmtCol=pCurrPage->GetAttrSet()->GetCol();
|
|
|
|
sal_uInt16 nColCount=rFmtCol.GetNumCols();
|
|
|
|
nColCount = nColCount>0?nColCount:1;
|
|
|
|
sValue += sAttrName;
|
|
|
|
sValue += OUString::number( nColCount ) ;
|
|
|
|
|
|
|
|
sValue += ";";
|
|
|
|
|
2014-11-24 10:38:59 +02:00
|
|
|
SwSectionFrm* pCurrSctFrm=static_cast<SwFrm*>(pCurrFrm)->FindSctFrm();
|
2014-01-27 09:25:27 +00:00
|
|
|
if(pCurrSctFrm!=NULL && pCurrSctFrm->GetSection()!=NULL )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2014-01-27 09:25:27 +00:00
|
|
|
sAttrName = "section-name:";
|
2013-11-29 13:03:27 +00:00
|
|
|
|
2014-01-27 09:25:27 +00:00
|
|
|
sValue += sAttrName;
|
|
|
|
OUString sectionName = pCurrSctFrm->GetSection()->GetSectionName();
|
2013-11-29 13:03:27 +00:00
|
|
|
|
2014-01-27 09:25:27 +00:00
|
|
|
sectionName = sectionName.replaceFirst( "\\" , "\\\\" );
|
|
|
|
sectionName = sectionName.replaceFirst( "=" , "\\=" );
|
|
|
|
sectionName = sectionName.replaceFirst( ";" , "\\;" );
|
|
|
|
sectionName = sectionName.replaceFirst( "," , "\\," );
|
|
|
|
sectionName = sectionName.replaceFirst( ":" , "\\:" );
|
2013-11-29 13:03:27 +00:00
|
|
|
|
2014-01-27 09:25:27 +00:00
|
|
|
sValue += sectionName;
|
2013-11-29 13:03:27 +00:00
|
|
|
|
2014-01-27 09:25:27 +00:00
|
|
|
sValue += ";";
|
2013-11-29 13:03:27 +00:00
|
|
|
|
2014-01-27 09:25:27 +00:00
|
|
|
//section-columns-number
|
|
|
|
sAttrName = "section-columns-number:";
|
2013-11-29 13:03:27 +00:00
|
|
|
|
2014-01-27 09:25:27 +00:00
|
|
|
nCurrCol = 1;
|
2013-11-29 13:03:27 +00:00
|
|
|
|
2014-01-27 09:25:27 +00:00
|
|
|
if(pCurrCol!=NULL)
|
|
|
|
{
|
|
|
|
SwLayoutFrm* pParent = pCurrCol->GetUpper();
|
|
|
|
if(pParent!=NULL)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2014-01-27 09:25:27 +00:00
|
|
|
SwFrm* pCol = pParent->Lower();
|
|
|
|
while(pCol&&(pCol!=pCurrCol))
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2014-01-27 09:25:27 +00:00
|
|
|
pCol = pCol->GetNext();
|
|
|
|
nCurrCol +=1;
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-01-27 09:25:27 +00:00
|
|
|
sValue += sAttrName;
|
|
|
|
sValue += OUString::number( nCurrCol ) ;
|
|
|
|
sValue += ";";
|
|
|
|
|
|
|
|
//section-total-columns
|
|
|
|
sAttrName = "section-total-columns:";
|
|
|
|
const SwFmtCol &rFmtSctCol=pCurrSctFrm->GetAttrSet()->GetCol();
|
|
|
|
sal_uInt16 nSctColCount=rFmtSctCol.GetNumCols();
|
|
|
|
nSctColCount = nSctColCount>0?nSctColCount:1;
|
|
|
|
sValue += sAttrName;
|
|
|
|
sValue += OUString::number( nSctColCount ) ;
|
|
|
|
|
|
|
|
sValue += ";";
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
2014-01-27 09:25:27 +00:00
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
anyAtrribute <<= sValue;
|
|
|
|
}
|
|
|
|
return anyAtrribute;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL SwAccessibleDocument::getBackground()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (::com::sun::star::uno::RuntimeException, std::exception)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
SolarMutexGuard aGuard;
|
|
|
|
return SW_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
|
2014-04-10 18:16:50 +02:00
|
|
|
SAL_CALL SwAccessibleDocument::getAccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
|
2014-01-28 10:01:59 +00:00
|
|
|
throw (::com::sun::star::uno::RuntimeException,
|
|
|
|
std::exception)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2013-12-13 22:10:17 +01:00
|
|
|
SolarMutexGuard g;
|
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
const sal_Int32 FORSPELLCHECKFLOWTO = 1;
|
|
|
|
const sal_Int32 FORFINDREPLACEFLOWTO = 2;
|
|
|
|
SwAccessibleMap* pAccMap = GetMap();
|
|
|
|
if ( !pAccMap )
|
|
|
|
{
|
|
|
|
return uno::Sequence< uno::Any >();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nType == FORSPELLCHECKFLOWTO )
|
|
|
|
{
|
|
|
|
uno::Reference< ::com::sun::star::drawing::XShape > xShape;
|
|
|
|
rAny >>= xShape;
|
|
|
|
if( xShape.is() )
|
|
|
|
{
|
|
|
|
SdrObject* pObj = GetSdrObjectFromXShape(xShape);
|
|
|
|
if( pObj )
|
|
|
|
{
|
2014-04-25 14:00:35 +02:00
|
|
|
uno::Reference<XAccessible> xAcc = pAccMap->GetContext(pObj, this, false);
|
2013-11-29 13:03:27 +00:00
|
|
|
uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY );
|
|
|
|
if ( xAccSelection.is() )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if ( xAccSelection->getSelectedAccessibleChildCount() )
|
|
|
|
{
|
|
|
|
uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 );
|
|
|
|
if ( xSel.is() )
|
|
|
|
{
|
|
|
|
uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() );
|
|
|
|
if ( xSelContext.is() )
|
|
|
|
{
|
|
|
|
//if in sw we find the selected paragraph here
|
|
|
|
if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
|
|
|
|
{
|
|
|
|
uno::Sequence<uno::Any> aRet( 1 );
|
|
|
|
aRet[0] = uno::makeAny( xSel );
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch ( const com::sun::star::lang::IndexOutOfBoundsException& )
|
|
|
|
{
|
|
|
|
return uno::Sequence< uno::Any >();
|
|
|
|
}
|
|
|
|
//end of try...catch
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
uno::Reference< XAccessible > xAcc = pAccMap->GetCursorContext();
|
|
|
|
SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
|
|
|
|
if ( pAccImpl && pAccImpl->getAccessibleRole() == AccessibleRole::PARAGRAPH )
|
|
|
|
{
|
|
|
|
uno::Sequence< uno::Any > aRet(1);
|
|
|
|
aRet[0] = uno::makeAny( xAcc );
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( nType == FORFINDREPLACEFLOWTO )
|
|
|
|
{
|
|
|
|
SwCrsrShell* pCrsrShell = GetCrsrShell();
|
|
|
|
if ( pCrsrShell )
|
|
|
|
{
|
|
|
|
SwPaM *_pStartCrsr = pCrsrShell->GetCrsr(), *__pStartCrsr = _pStartCrsr;
|
|
|
|
SwCntntNode* pPrevNode = NULL;
|
|
|
|
std::vector<SwFrm*> vFrmList;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( _pStartCrsr && _pStartCrsr->HasMark() )
|
|
|
|
{
|
|
|
|
SwCntntNode* pCntntNode = _pStartCrsr->GetCntntNode();
|
|
|
|
if ( pCntntNode == pPrevNode )
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
SwFrm* pFrm = pCntntNode ? pCntntNode->getLayoutFrm( pCrsrShell->GetLayout() ) : NULL;
|
|
|
|
if ( pFrm )
|
|
|
|
{
|
|
|
|
vFrmList.push_back( pFrm );
|
|
|
|
}
|
|
|
|
|
|
|
|
pPrevNode = pCntntNode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-03 15:38:07 +01:00
|
|
|
while( _pStartCrsr && ( (_pStartCrsr = _pStartCrsr->GetNext()) != __pStartCrsr) );
|
2013-11-29 13:03:27 +00:00
|
|
|
|
|
|
|
if ( vFrmList.size() )
|
|
|
|
{
|
|
|
|
uno::Sequence< uno::Any > aRet(vFrmList.size());
|
|
|
|
std::vector<SwFrm*>::iterator aIter = vFrmList.begin();
|
2013-12-13 22:37:06 +01:00
|
|
|
for ( sal_Int32 nIndex = 0; aIter != vFrmList.end(); ++aIter, nIndex++ )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2014-04-25 14:00:35 +02:00
|
|
|
uno::Reference< XAccessible > xAcc = pAccMap->GetContext(*aIter, false);
|
2013-11-29 13:03:27 +00:00
|
|
|
if ( xAcc.is() )
|
|
|
|
{
|
|
|
|
SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
|
|
|
|
if ( pAccImpl && pAccImpl->getAccessibleRole() == AccessibleRole::PARAGRAPH )
|
|
|
|
{
|
|
|
|
aRet[nIndex] = uno::makeAny( xAcc );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return uno::Sequence< uno::Any >();
|
|
|
|
}
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|