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 .
|
|
|
|
*/
|
2002-04-11 12:42:31 +00:00
|
|
|
|
2010-10-16 03:22:02 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2003-04-24 15:09:49 +00:00
|
|
|
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
|
|
|
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
|
|
|
|
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
|
2002-04-11 12:42:31 +00:00
|
|
|
#include <unotools/accessiblestatesethelper.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-04-11 12:42:31 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <cellfrm.hxx>
|
|
|
|
#include <tabfrm.hxx>
|
|
|
|
#include <swtable.hxx>
|
|
|
|
#include "crsrsh.hxx"
|
|
|
|
#include "viscrs.hxx"
|
2010-02-02 15:11:26 +01:00
|
|
|
#include <accfrmobj.hxx>
|
2002-04-11 12:42:31 +00:00
|
|
|
#include <accfrmobjslist.hxx>
|
2002-05-24 12:40:29 +00:00
|
|
|
#include "frmfmt.hxx"
|
|
|
|
#include "cellatr.hxx"
|
2002-04-11 12:42:31 +00:00
|
|
|
#include "accmap.hxx"
|
|
|
|
#include <acccell.hxx>
|
|
|
|
|
2006-11-14 14:07:45 +00:00
|
|
|
#include <cfloat>
|
2002-05-24 12:40:29 +00:00
|
|
|
#include <limits.h>
|
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
#include <ndtxt.hxx>
|
|
|
|
#include <editeng/brushitem.hxx>
|
|
|
|
#include <swatrset.hxx>
|
|
|
|
#include <frmatr.hxx>
|
|
|
|
#include "acctable.hxx"
|
|
|
|
|
2007-06-05 16:25:06 +00:00
|
|
|
using namespace ::com::sun::star;
|
2003-04-24 15:09:49 +00:00
|
|
|
using namespace ::com::sun::star::accessibility;
|
2010-02-02 15:11:26 +01:00
|
|
|
using namespace sw::access;
|
2002-04-11 12:42:31 +00:00
|
|
|
|
2003-04-24 15:09:49 +00:00
|
|
|
const sal_Char sServiceName[] = "com.sun.star.table.AccessibleCellView";
|
2002-07-09 11:51:33 +00:00
|
|
|
const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleCellView";
|
2002-04-11 12:42:31 +00:00
|
|
|
|
|
|
|
sal_Bool SwAccessibleCell::IsSelected()
|
|
|
|
{
|
|
|
|
sal_Bool bRet = sal_False;
|
|
|
|
|
2011-05-08 22:14:45 +02:00
|
|
|
OSL_ENSURE( GetMap(), "no map?" );
|
2013-10-26 19:50:13 +02:00
|
|
|
const SwViewShell *pVSh = GetMap()->GetShell();
|
2011-05-08 22:14:45 +02:00
|
|
|
OSL_ENSURE( pVSh, "no shell?" );
|
2002-04-11 12:42:31 +00:00
|
|
|
if( pVSh->ISA( SwCrsrShell ) )
|
|
|
|
{
|
|
|
|
const SwCrsrShell *pCSh = static_cast< const SwCrsrShell * >( pVSh );
|
|
|
|
if( pCSh->IsTableMode() )
|
|
|
|
{
|
|
|
|
const SwCellFrm *pCFrm =
|
|
|
|
static_cast< const SwCellFrm * >( GetFrm() );
|
|
|
|
SwTableBox *pBox =
|
2012-07-28 16:58:57 +01:00
|
|
|
const_cast< SwTableBox *>( pCFrm->GetTabBox() );
|
2012-09-21 15:18:23 +02:00
|
|
|
SwSelBoxes const& rBoxes(pCSh->GetTableCrsr()->GetSelectedBoxes());
|
|
|
|
bRet = rBoxes.find(pBox) != rBoxes.end();
|
2002-04-11 12:42:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2010-02-02 15:11:26 +01:00
|
|
|
void SwAccessibleCell::GetStates( ::utl::AccessibleStateSetHelper& rStateSet )
|
2002-04-11 12:42:31 +00:00
|
|
|
{
|
|
|
|
SwAccessibleContext::GetStates( rStateSet );
|
|
|
|
|
|
|
|
// SELECTABLE
|
2013-10-26 19:50:13 +02:00
|
|
|
const SwViewShell *pVSh = GetMap()->GetShell();
|
2011-05-08 22:14:45 +02:00
|
|
|
OSL_ENSURE( pVSh, "no shell?" );
|
2002-07-10 15:53:35 +00:00
|
|
|
if( pVSh->ISA( SwCrsrShell ) )
|
|
|
|
rStateSet.AddState( AccessibleStateType::SELECTABLE );
|
2013-11-29 13:03:27 +00:00
|
|
|
//Add resizable state to table cell.
|
|
|
|
rStateSet.AddState( AccessibleStateType::RESIZABLE );
|
2002-04-11 12:42:31 +00:00
|
|
|
|
|
|
|
// SELECTED
|
|
|
|
if( IsSelected() )
|
|
|
|
{
|
|
|
|
rStateSet.AddState( AccessibleStateType::SELECTED );
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( bIsSelected, "bSelected out of sync" );
|
2010-10-15 11:44:38 -05:00
|
|
|
::rtl::Reference < SwAccessibleContext > xThis( this );
|
2002-04-11 12:42:31 +00:00
|
|
|
GetMap()->SetCursorContext( xThis );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-02 15:11:26 +01:00
|
|
|
SwAccessibleCell::SwAccessibleCell( SwAccessibleMap *pInitMap,
|
|
|
|
const SwCellFrm *pCellFrm )
|
|
|
|
: SwAccessibleContext( pInitMap, AccessibleRole::TABLE_CELL, pCellFrm )
|
2013-11-29 13:03:27 +00:00
|
|
|
, aSelectionHelper( *this )
|
2010-02-02 15:11:26 +01:00
|
|
|
, bIsSelected( sal_False )
|
2002-04-11 12:42:31 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2007-09-27 07:18:40 +00:00
|
|
|
OUString sBoxName( pCellFrm->GetTabBox()->GetName() );
|
|
|
|
SetName( sBoxName );
|
2002-04-11 12:42:31 +00:00
|
|
|
|
|
|
|
bIsSelected = IsSelected();
|
2013-11-29 13:03:27 +00:00
|
|
|
|
2013-12-02 14:45:36 +01:00
|
|
|
css::uno::Reference<css::accessibility::XAccessible> xTableReference(
|
|
|
|
getAccessibleParent());
|
|
|
|
css::uno::Reference<css::accessibility::XAccessibleContext> xContextTable(
|
|
|
|
xTableReference, css::uno::UNO_QUERY);
|
|
|
|
SAL_WARN_IF(
|
|
|
|
(!xContextTable.is()
|
|
|
|
|| xContextTable->getAccessibleRole() != AccessibleRole::TABLE),
|
|
|
|
"sw.core", "bad accessible context");
|
|
|
|
m_pAccTable = static_cast<SwAccessibleTable *>(xTableReference.get());
|
2002-04-11 12:42:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SwAccessibleCell::_InvalidateMyCursorPos()
|
|
|
|
{
|
|
|
|
sal_Bool bNew = IsSelected();
|
|
|
|
sal_Bool bOld;
|
|
|
|
{
|
2010-10-16 03:22:02 -05:00
|
|
|
osl::MutexGuard aGuard( aMutex );
|
2002-04-11 12:42:31 +00:00
|
|
|
bOld = bIsSelected;
|
|
|
|
bIsSelected = bNew;
|
|
|
|
}
|
|
|
|
if( bNew )
|
|
|
|
{
|
|
|
|
// remember that object as the one that has the caret. This is
|
2013-03-03 17:11:39 +01:00
|
|
|
// necessary to notify that object if the cursor leaves it.
|
2010-10-15 11:44:38 -05:00
|
|
|
::rtl::Reference < SwAccessibleContext > xThis( this );
|
2002-04-11 12:42:31 +00:00
|
|
|
GetMap()->SetCursorContext( xThis );
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool bChanged = bOld != bNew;
|
|
|
|
if( bChanged )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2002-04-11 12:42:31 +00:00
|
|
|
FireStateChangedEvent( AccessibleStateType::SELECTED, bNew );
|
2013-12-02 14:45:36 +01:00
|
|
|
if (m_pAccTable.is())
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
m_pAccTable->AddSelectionCell(this,bNew);
|
|
|
|
}
|
|
|
|
}
|
2002-04-11 12:42:31 +00:00
|
|
|
return bChanged;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SwAccessibleCell::_InvalidateChildrenCursorPos( const SwFrm *pFrm )
|
|
|
|
{
|
|
|
|
sal_Bool bChanged = sal_False;
|
|
|
|
|
2010-02-02 15:11:26 +01:00
|
|
|
const SwAccessibleChildSList aVisList( GetVisArea(), *pFrm, *GetMap() );
|
|
|
|
SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
|
2002-04-11 12:42:31 +00:00
|
|
|
while( aIter != aVisList.end() )
|
|
|
|
{
|
2010-02-02 15:11:26 +01:00
|
|
|
const SwAccessibleChild& rLower = *aIter;
|
2002-04-11 12:42:31 +00:00
|
|
|
const SwFrm *pLower = rLower.GetSwFrm();
|
|
|
|
if( pLower )
|
|
|
|
{
|
2013-10-16 16:36:45 +02:00
|
|
|
if( rLower.IsAccessible( GetMap()->GetShell()->IsPreview() ) )
|
2002-04-11 12:42:31 +00:00
|
|
|
{
|
2010-10-15 11:44:38 -05:00
|
|
|
::rtl::Reference< SwAccessibleContext > xAccImpl(
|
2002-04-11 12:42:31 +00:00
|
|
|
GetMap()->GetContextImpl( pLower, sal_False ) );
|
2010-10-15 11:44:38 -05:00
|
|
|
if( xAccImpl.is() )
|
2002-04-11 12:42:31 +00:00
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( xAccImpl->GetFrm()->IsCellFrm(),
|
|
|
|
"table child is not a cell frame" );
|
2013-11-29 13:03:27 +00:00
|
|
|
bChanged = static_cast< SwAccessibleCell *>(
|
2010-10-15 11:44:38 -05:00
|
|
|
xAccImpl.get() )->_InvalidateMyCursorPos();
|
2002-04-11 12:42:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
bChanged = sal_True; // If the context is not know we
|
|
|
|
// don't know whether the selection
|
|
|
|
// changed or not.
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// This is a box with sub rows.
|
|
|
|
bChanged |= _InvalidateChildrenCursorPos( pLower );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
++aIter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bChanged;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwAccessibleCell::_InvalidateCursorPos()
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
if (IsSelected())
|
|
|
|
{
|
|
|
|
const SwAccessibleChild aChild( GetChild( *(GetMap()), 0 ) );
|
|
|
|
if( aChild.IsValid() && aChild.GetSwFrm() )
|
|
|
|
{
|
|
|
|
::rtl::Reference < SwAccessibleContext > xChildImpl( GetMap()->GetContextImpl( aChild.GetSwFrm()) );
|
|
|
|
if (xChildImpl.is())
|
|
|
|
{
|
|
|
|
AccessibleEventObject aEvent;
|
|
|
|
aEvent.EventId = AccessibleEventId::STATE_CHANGED;
|
|
|
|
aEvent.NewValue <<= AccessibleStateType::FOCUSED;
|
|
|
|
xChildImpl->FireAccessibleEvent( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-04-11 12:42:31 +00:00
|
|
|
|
2010-02-02 15:11:26 +01:00
|
|
|
const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pParent->IsTabFrm(), "parent is not a tab frame" );
|
2002-04-11 12:42:31 +00:00
|
|
|
const SwTabFrm *pTabFrm = static_cast< const SwTabFrm * >( pParent );
|
|
|
|
if( pTabFrm->IsFollow() )
|
|
|
|
pTabFrm = pTabFrm->FindMaster();
|
|
|
|
|
|
|
|
while( pTabFrm )
|
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
_InvalidateChildrenCursorPos( pTabFrm );
|
2002-04-11 12:42:31 +00:00
|
|
|
pTabFrm = pTabFrm->GetFollow();
|
|
|
|
}
|
2013-12-02 14:45:36 +01:00
|
|
|
if (m_pAccTable.is())
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
m_pAccTable->FireSelectionEvent();
|
|
|
|
}
|
2002-04-11 12:42:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SwAccessibleCell::HasCursor()
|
|
|
|
{
|
2010-10-16 03:22:02 -05:00
|
|
|
osl::MutexGuard aGuard( aMutex );
|
2002-04-11 12:42:31 +00:00
|
|
|
return bIsSelected;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwAccessibleCell::~SwAccessibleCell()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString SAL_CALL SwAccessibleCell::getAccessibleDescription (void)
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-04-11 12:42:31 +00:00
|
|
|
{
|
|
|
|
return GetName();
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString SAL_CALL SwAccessibleCell::getImplementationName()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw( uno::RuntimeException, std::exception )
|
2002-04-11 12:42:31 +00:00
|
|
|
{
|
2013-03-01 13:50:58 +01:00
|
|
|
return OUString(sImplementationName);
|
2002-04-11 12:42:31 +00:00
|
|
|
}
|
|
|
|
|
2013-12-05 19:17:18 -02:00
|
|
|
sal_Bool SAL_CALL SwAccessibleCell::supportsService(const OUString& sTestServiceName)
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2002-04-11 12:42:31 +00:00
|
|
|
{
|
2013-12-05 19:17:18 -02:00
|
|
|
return cppu::supportsService(this, sTestServiceName);
|
2002-04-11 12:42:31 +00:00
|
|
|
}
|
|
|
|
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Sequence< OUString > SAL_CALL SwAccessibleCell::getSupportedServiceNames()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw( uno::RuntimeException, std::exception )
|
2002-04-11 12:42:31 +00:00
|
|
|
{
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Sequence< OUString > aRet(2);
|
2002-04-11 12:42:31 +00:00
|
|
|
OUString* pArray = aRet.getArray();
|
2013-03-01 13:50:58 +01:00
|
|
|
pArray[0] = OUString(sServiceName );
|
|
|
|
pArray[1] = OUString(sAccessibleServiceName );
|
2002-04-11 12:42:31 +00:00
|
|
|
return aRet;
|
|
|
|
}
|
2002-04-17 13:07:39 +00:00
|
|
|
|
|
|
|
void SwAccessibleCell::Dispose( sal_Bool bRecursive )
|
|
|
|
{
|
2010-02-02 15:11:26 +01:00
|
|
|
const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
|
2010-10-15 11:44:38 -05:00
|
|
|
::rtl::Reference< SwAccessibleContext > xAccImpl(
|
2002-04-17 13:07:39 +00:00
|
|
|
GetMap()->GetContextImpl( pParent, sal_False ) );
|
2010-10-15 11:44:38 -05:00
|
|
|
if( xAccImpl.is() )
|
2010-02-02 15:11:26 +01:00
|
|
|
xAccImpl->DisposeChild( SwAccessibleChild(GetFrm()), bRecursive );
|
2002-05-03 11:34:00 +00:00
|
|
|
SwAccessibleContext::Dispose( bRecursive );
|
2002-04-17 13:07:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwAccessibleCell::InvalidatePosOrSize( const SwRect& rOldBox )
|
|
|
|
{
|
2010-02-02 15:11:26 +01:00
|
|
|
const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
|
2010-10-15 11:44:38 -05:00
|
|
|
::rtl::Reference< SwAccessibleContext > xAccImpl(
|
2002-04-17 13:07:39 +00:00
|
|
|
GetMap()->GetContextImpl( pParent, sal_False ) );
|
2010-10-15 11:44:38 -05:00
|
|
|
if( xAccImpl.is() )
|
2010-02-02 15:11:26 +01:00
|
|
|
xAccImpl->InvalidateChildPosOrSize( SwAccessibleChild(GetFrm()), rOldBox );
|
2002-05-03 11:34:00 +00:00
|
|
|
SwAccessibleContext::InvalidatePosOrSize( rOldBox );
|
2002-04-17 13:07:39 +00:00
|
|
|
}
|
2002-05-24 12:40:29 +00:00
|
|
|
|
2013-03-16 23:54:23 +01:00
|
|
|
// XAccessibleInterface
|
2002-05-24 12:40:29 +00:00
|
|
|
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Any SwAccessibleCell::queryInterface( const uno::Type& rType )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw( uno::RuntimeException, std::exception )
|
2002-05-24 12:40:29 +00:00
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
if (rType == ::getCppuType((const uno::Reference<XAccessibleExtendedAttributes>*)0))
|
|
|
|
{
|
|
|
|
uno::Any aR;
|
|
|
|
aR <<= uno::Reference<XAccessibleExtendedAttributes>(this);
|
|
|
|
return aR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rType == ::getCppuType((const uno::Reference<XAccessibleSelection>*)0))
|
|
|
|
{
|
|
|
|
uno::Any aR;
|
|
|
|
aR <<= uno::Reference<XAccessibleSelection>(this);
|
|
|
|
return aR;
|
|
|
|
}
|
2007-06-05 16:25:06 +00:00
|
|
|
if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleValue > * >( 0 ) ) )
|
2002-05-24 12:40:29 +00:00
|
|
|
{
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Reference<XAccessibleValue> xValue = this;
|
|
|
|
uno::Any aRet;
|
2002-05-24 12:40:29 +00:00
|
|
|
aRet <<= xValue;
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return SwAccessibleContext::queryInterface( rType );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-16 23:54:23 +01:00
|
|
|
// XTypeProvider
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Sequence< uno::Type > SAL_CALL SwAccessibleCell::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:25:06 +00:00
|
|
|
uno::Sequence< uno::Type > aTypes( SwAccessibleContext::getTypes() );
|
2002-08-07 12:32:17 +00:00
|
|
|
|
|
|
|
sal_Int32 nIndex = aTypes.getLength();
|
|
|
|
aTypes.realloc( nIndex + 1 );
|
|
|
|
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Type* pTypes = aTypes.getArray();
|
|
|
|
pTypes[nIndex] = ::getCppuType( static_cast< uno::Reference< XAccessibleValue > * >( 0 ) );
|
2002-08-07 12:32:17 +00:00
|
|
|
|
|
|
|
return aTypes;
|
|
|
|
}
|
|
|
|
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleCell::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
|
|
|
}
|
2002-05-24 12:40:29 +00:00
|
|
|
|
2013-03-16 23:54:23 +01:00
|
|
|
// XAccessibleValue
|
2002-05-24 12:40:29 +00:00
|
|
|
|
|
|
|
SwFrmFmt* SwAccessibleCell::GetTblBoxFormat() const
|
|
|
|
{
|
2011-05-08 22:14:45 +02:00
|
|
|
OSL_ENSURE( GetFrm() != NULL, "no frame?" );
|
|
|
|
OSL_ENSURE( GetFrm()->IsCellFrm(), "no cell frame?" );
|
2002-05-24 12:40:29 +00:00
|
|
|
|
|
|
|
const SwCellFrm* pCellFrm = static_cast<const SwCellFrm*>( GetFrm() );
|
|
|
|
return pCellFrm->GetTabBox()->GetFrmFmt();
|
|
|
|
}
|
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
//Implement TableCell currentValue
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Any SwAccessibleCell::getCurrentValue( )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw( uno::RuntimeException, std::exception )
|
2002-05-24 12:40:29 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-05-24 12:40:29 +00:00
|
|
|
CHECK_FOR_DEFUNC( XAccessibleValue );
|
|
|
|
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Any aAny;
|
2013-12-02 16:09:47 +01:00
|
|
|
aAny <<= GetTblBoxFormat()->GetTblBoxValue().GetValue();
|
2002-05-24 12:40:29 +00:00
|
|
|
return aAny;
|
|
|
|
}
|
|
|
|
|
2007-06-05 16:25:06 +00:00
|
|
|
sal_Bool SwAccessibleCell::setCurrentValue( const uno::Any& aNumber )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw( uno::RuntimeException, std::exception )
|
2002-05-24 12:40:29 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-05-24 12:40:29 +00:00
|
|
|
CHECK_FOR_DEFUNC( XAccessibleValue );
|
|
|
|
|
2007-11-12 15:21:57 +00:00
|
|
|
double fValue = 0;
|
2002-05-24 12:40:29 +00:00
|
|
|
sal_Bool bValid = (aNumber >>= fValue);
|
|
|
|
if( bValid )
|
|
|
|
{
|
|
|
|
SwTblBoxValue aValue( fValue );
|
2008-06-13 08:30:03 +00:00
|
|
|
GetTblBoxFormat()->SetFmtAttr( aValue );
|
2002-05-24 12:40:29 +00:00
|
|
|
}
|
|
|
|
return bValid;
|
|
|
|
}
|
|
|
|
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Any SwAccessibleCell::getMaximumValue( )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw( uno::RuntimeException, std::exception )
|
2002-05-24 12:40:29 +00:00
|
|
|
{
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Any aAny;
|
2002-05-24 12:40:29 +00:00
|
|
|
aAny <<= DBL_MAX;
|
|
|
|
return aAny;
|
|
|
|
}
|
|
|
|
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Any SwAccessibleCell::getMinimumValue( )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw( uno::RuntimeException, std::exception )
|
2002-05-24 12:40:29 +00:00
|
|
|
{
|
2007-06-05 16:25:06 +00:00
|
|
|
uno::Any aAny;
|
2002-11-25 14:14:37 +00:00
|
|
|
aAny <<= -DBL_MAX;
|
2002-05-24 12:40:29 +00:00
|
|
|
return aAny;
|
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
2014-03-17 09:14:55 +02:00
|
|
|
static OUString ReplaceOneChar(const OUString& oldOUString, const OUString& replacedChar, const OUString& replaceStr)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2014-01-12 22:26:20 +01:00
|
|
|
int iReplace = oldOUString.lastIndexOf(replacedChar);
|
2014-03-17 09:14:55 +02:00
|
|
|
OUString aRet = oldOUString;
|
|
|
|
while(iReplace > -1)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2014-03-17 09:14:55 +02:00
|
|
|
aRet = aRet.replaceAt(iReplace,1, replaceStr);
|
|
|
|
iReplace = aRet.lastIndexOf(replacedChar,iReplace);
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
2014-03-17 09:14:55 +02:00
|
|
|
return aRet;
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
2013-12-05 18:06:04 +02:00
|
|
|
|
2014-03-17 09:14:55 +02:00
|
|
|
static OUString ReplaceFourChar(const OUString& oldOUString)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2014-03-17 09:14:55 +02:00
|
|
|
OUString aRet = ReplaceOneChar(oldOUString,OUString("\\"),OUString("\\\\"));
|
|
|
|
aRet = ReplaceOneChar(aRet,OUString(";"),OUString("\\;"));
|
|
|
|
aRet = ReplaceOneChar(aRet,OUString("="),OUString("\\="));
|
|
|
|
aRet = ReplaceOneChar(aRet,OUString(","),OUString("\\,"));
|
|
|
|
aRet = ReplaceOneChar(aRet,OUString(":"),OUString("\\:"));
|
|
|
|
return aRet;
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
::com::sun::star::uno::Any SAL_CALL SwAccessibleCell::getExtendedAttributes()
|
2014-02-25 21:31:58 +01: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 23:33:21 +01:00
|
|
|
SolarMutexGuard g;
|
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
::com::sun::star::uno::Any strRet;
|
|
|
|
SwFrmFmt *pFrmFmt = GetTblBoxFormat();
|
|
|
|
DBG_ASSERT(pFrmFmt,"Must be Valid");
|
|
|
|
|
|
|
|
const SwTblBoxFormula& tbl_formula = pFrmFmt->GetTblBoxFormula();
|
|
|
|
|
|
|
|
OUString strFormula = ReplaceFourChar(tbl_formula.GetFormula());
|
|
|
|
OUString strFor("Formula:");
|
|
|
|
strFor += strFormula;
|
|
|
|
strFor += ";" ;
|
|
|
|
strRet <<= strFor;
|
|
|
|
|
|
|
|
return strRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL SwAccessibleCell::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
|
|
|
{
|
2013-12-13 23:33:21 +01:00
|
|
|
SolarMutexGuard g;
|
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
const SvxBrushItem &rBack = GetFrm()->GetAttrSet()->GetBackground();
|
|
|
|
sal_uInt32 crBack = rBack.GetColor().GetColor();
|
|
|
|
|
|
|
|
if (COL_AUTO == crBack)
|
|
|
|
{
|
|
|
|
uno::Reference<XAccessible> xAccDoc = getAccessibleParent();
|
|
|
|
if (xAccDoc.is())
|
|
|
|
{
|
|
|
|
uno::Reference<XAccessibleComponent> xCompoentDoc(xAccDoc, uno::UNO_QUERY);
|
|
|
|
if (xCompoentDoc.is())
|
|
|
|
{
|
|
|
|
crBack = (sal_uInt32)xCompoentDoc->getBackground();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return crBack;
|
|
|
|
}
|
|
|
|
|
2014-04-21 19:28:47 -04:00
|
|
|
// XAccessibleSelection
|
2013-11-29 13:03:27 +00:00
|
|
|
void SwAccessibleCell::selectAccessibleChild(
|
|
|
|
sal_Int32 nChildIndex )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
aSelectionHelper.selectAccessibleChild(nChildIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SwAccessibleCell::isAccessibleChildSelected(
|
|
|
|
sal_Int32 nChildIndex )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
return aSelectionHelper.isAccessibleChildSelected(nChildIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwAccessibleCell::clearAccessibleSelection( )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw ( uno::RuntimeException, std::exception )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
aSelectionHelper.clearAccessibleSelection();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwAccessibleCell::selectAllAccessibleChildren( )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw ( uno::RuntimeException, std::exception )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
aSelectionHelper.selectAllAccessibleChildren();
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 SwAccessibleCell::getSelectedAccessibleChildCount( )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw ( uno::RuntimeException, std::exception )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
return aSelectionHelper.getSelectedAccessibleChildCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference<XAccessible> SwAccessibleCell::getSelectedAccessibleChild(
|
|
|
|
sal_Int32 nSelectedChildIndex )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
return aSelectionHelper.getSelectedAccessibleChild(nSelectedChildIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwAccessibleCell::deselectAccessibleChild(
|
|
|
|
sal_Int32 nSelectedChildIndex )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
|
|
|
aSelectionHelper.deselectAccessibleChild(nSelectedChildIndex);
|
|
|
|
}
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|