Files
libreoffice/svtools/source/brwbox/brwbox3.cxx

571 lines
18 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patch contributed by: Jurgen Schmidt remove onlineregistration with dependencies http://svn.apache.org/viewvc?view=revision&revision=1240245 imported patch package_eventlistener.patch http://svn.apache.org/viewvc?view=revision&revision=1172103 Patch contributed by Pedro Giffuni Accept Google Chrome OS fonts as equivalent to MS fonts. http://svn.apache.org/viewvc?view=revision&revision=1233155 http://svn.apache.org/viewvc?view=revision&revision=1233408 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 Patches contributed by Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i114600#: remove forbidden characters from list of unencoded characters http://svn.apache.org/viewvc?view=revision&revision=1172370 Patches contributed by Oliver Rainer-Wittman some clean up in JPEGReader due to memory constraints http://svn.apache.org/viewvc?view=revision&revision=1299729 119114 - method <UpdateDialog::addSpecificError(..)> - create entry with correct type http://svn.apache.org/viewvc?view=revision&revision=1305265 Patches contributed by Ariel Constenla-Haile i118707 - make toolbar control's popup window grab focus http://svn.apache.org/viewvc?view=revision&revision=1225846 Patches contributed by Herbert Duerr #i118662# remove usage of BerkeleyDB in desktop module http://svn.apache.org/viewvc?view=revision&revision=1213171 minor cleanups in dp_persmap.* http://svn.apache.org/viewvc?view=revision&revision=1215064 flush early to prevent problem with extension manager not cleaning up its objects http://svn.apache.org/viewvc?view=revision&revision=1228147 i118726 do not flush *pmap file while reading it http://svn.apache.org/viewvc?view=revision&revision=1230614 #i119048# migrate BDB extension entries using a simple heuristic http://svn.apache.org/viewvc?view=revision&revision=1300972 #i119048# handle edge cases when importing BDB hash files http://svn.apache.org/viewvc?view=revision&revision=1301428 #i119113# fix of-by-one when importing BDB files http://svn.apache.org/viewvc?view=revision&revision=1305420 restore our encryption settings, icon themes, and dictionaries. removed wrapper hacks, kill obsolete bundled extension blob / pre-registration handling, remove duplicated quickstart code. remove OS/2 conditionals.
2012-11-15 17:28:16 +00: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-02 07:56:18 +00:00
#include <svtools/brwbox.hxx>
#include <svtools/AccessibleBrowseBoxObjType.hxx>
2002-04-02 07:56:18 +00:00
#include <tools/debug.hxx>
2002-09-13 11:34:10 +00:00
#include <tools/multisel.hxx>
2002-04-09 06:27:17 +00:00
#include "datwin.hxx"
#include "brwimpl.hxx"
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
2002-05-31 12:25:17 +00:00
#include <toolkit/helper/vclunohelper.hxx>
2002-04-02 07:56:18 +00:00
// Accessibility ==============================================================
2002-04-09 06:27:17 +00:00
using namespace ::com::sun::star::uno;
using ::com::sun::star::accessibility::XAccessible;
using namespace ::com::sun::star::accessibility;
2002-04-09 06:27:17 +00:00
2002-04-09 06:27:17 +00:00
namespace svt
{
using namespace ::com::sun::star::lang;
using namespace utl;
2002-04-02 07:56:18 +00:00
2002-09-13 11:34:10 +00:00
Reference< XAccessible > getHeaderCell( BrowseBoxImpl::THeaderCellMap& _raHeaderCells,
sal_Int32 _nPos,
2002-04-09 06:27:17 +00:00
AccessibleBrowseBoxObjType _eType,
const Reference< XAccessible >& _rParent,
BrowseBox& _rBrowseBox,
IAccessibleFactory& rFactory
)
2002-04-09 06:27:17 +00:00
{
Reference< XAccessible > xRet;
BrowseBoxImpl::THeaderCellMap::iterator aFind = _raHeaderCells.find( _nPos );
2002-09-13 11:34:10 +00:00
if ( aFind == _raHeaderCells.end() )
2002-05-31 12:25:17 +00:00
{
Reference< XAccessible > xAccessible = rFactory.createAccessibleBrowseBoxHeaderCell(
_nPos,
_rParent,
_rBrowseBox,
NULL,
_eType
);
aFind = _raHeaderCells.insert( BrowseBoxImpl::THeaderCellMap::value_type( _nPos, xAccessible ) ).first;
2002-05-31 12:25:17 +00:00
}
2002-09-13 11:34:10 +00:00
if ( aFind != _raHeaderCells.end() )
2002-04-09 06:27:17 +00:00
xRet = aFind->second;
return xRet;
}
Reference< XAccessible > BrowseBoxImpl::getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType )
{
if ( m_pAccessible && m_pAccessible->isAlive() )
return m_pAccessible->getHeaderBar( _eObjType );
return NULL;
}
Reference< XAccessible > BrowseBoxImpl::getAccessibleTable( )
{
if ( m_pAccessible && m_pAccessible->isAlive() )
return m_pAccessible->getTable( );
return NULL;
}
2002-04-09 06:27:17 +00:00
}
2002-04-02 07:56:18 +00:00
Reference< XAccessible > BrowseBox::CreateAccessible()
{
vcl::Window* pParent = GetAccessibleParentWindow();
2002-04-02 07:56:18 +00:00
DBG_ASSERT( pParent, "BrowseBox::CreateAccessible - parent not found" );
2002-04-09 06:27:17 +00:00
if( pParent && !m_pImpl->m_pAccessible)
2002-04-02 07:56:18 +00:00
{
Reference< XAccessible > xAccParent = pParent->GetAccessible();
if( xAccParent.is() )
2002-04-09 06:27:17 +00:00
{
m_pImpl->m_pAccessible = getAccessibleFactory().createAccessibleBrowseBox(
xAccParent, *this
);
2002-04-09 06:27:17 +00:00
}
2002-04-02 07:56:18 +00:00
}
Reference< XAccessible > xAccessible;
if ( m_pImpl->m_pAccessible )
xAccessible = m_pImpl->m_pAccessible->getMyself();
2002-04-09 06:27:17 +00:00
return xAccessible;
2002-04-02 07:56:18 +00:00
}
2002-04-02 07:56:18 +00:00
// Children -------------------------------------------------------------------
Reference< XAccessible > BrowseBox::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos )
2002-04-02 07:56:18 +00:00
{
2002-04-09 06:27:17 +00:00
// BBINDEX_TABLE must be the table
OSL_ENSURE(m_pImpl->m_pAccessible,"Invalid call: Accessible is null");
return m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxTableCell(
m_pImpl->getAccessibleTable(),
*this,
NULL,
_nRow,
_nColumnPos,
OFFSET_DEFAULT
);
2002-04-02 07:56:18 +00:00
}
2002-04-02 07:56:18 +00:00
2002-04-09 06:27:17 +00:00
Reference< XAccessible > BrowseBox::CreateAccessibleRowHeader( sal_Int32 _nRow )
2002-04-02 07:56:18 +00:00
{
2002-04-09 06:27:17 +00:00
return svt::getHeaderCell(
m_pImpl->m_aRowHeaderCellMap,
_nRow,
svt::BBTYPE_ROWHEADERCELL,
m_pImpl->getAccessibleHeaderBar(svt::BBTYPE_ROWHEADERBAR),
*this,
m_pImpl->m_aFactoryAccess.getFactory()
);
2002-04-02 07:56:18 +00:00
}
2002-04-02 07:56:18 +00:00
Reference< XAccessible > BrowseBox::CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos )
2002-04-02 07:56:18 +00:00
{
2002-04-09 06:27:17 +00:00
return svt::getHeaderCell(
m_pImpl->m_aColHeaderCellMap,
_nColumnPos,
2002-04-09 06:27:17 +00:00
svt::BBTYPE_COLUMNHEADERCELL,
m_pImpl->getAccessibleHeaderBar(svt::BBTYPE_COLUMNHEADERBAR),
*this,
m_pImpl->m_aFactoryAccess.getFactory()
);
2002-04-02 07:56:18 +00:00
}
2002-04-02 07:56:18 +00:00
sal_Int32 BrowseBox::GetAccessibleControlCount() const
{
return 0;
}
2002-04-02 07:56:18 +00:00
Reference< XAccessible > BrowseBox::CreateAccessibleControl( sal_Int32 )
2002-04-02 07:56:18 +00:00
{
DBG_ASSERT( false, "BrowseBox::CreateAccessibleControl: to be overwritten!" );
2002-04-02 07:56:18 +00:00
return NULL;
}
2002-04-02 07:56:18 +00:00
// Conversions ----------------------------------------------------------------
bool BrowseBox::ConvertPointToCellAddress(
sal_Int32& rnRow, sal_uInt16& rnColumnPos, const Point& rPoint )
2002-04-02 07:56:18 +00:00
{
2002-04-17 10:56:23 +00:00
//! TODO has to be checked
2002-04-09 06:27:17 +00:00
rnRow = GetRowAtYPosPixel(rPoint.Y());
rnColumnPos = GetColumnAtXPosPixel(rPoint.X());
return rnRow != BROWSER_INVALIDID && rnColumnPos != BROWSER_INVALIDID;
2002-04-02 07:56:18 +00:00
}
2002-04-02 07:56:18 +00:00
bool BrowseBox::ConvertPointToRowHeader( sal_Int32& rnRow, const Point& rPoint )
2002-04-02 07:56:18 +00:00
{
2002-04-09 06:27:17 +00:00
rnRow = GetRowAtYPosPixel(rPoint.Y());
// sal_uInt16 nColumnId = GetColumnAtXPosPixel(rPoint.X());
2002-04-09 06:27:17 +00:00
return rnRow != BROWSER_INVALIDID;// && nColumnId == 0;
2002-04-02 07:56:18 +00:00
}
2002-04-02 07:56:18 +00:00
bool BrowseBox::ConvertPointToColumnHeader( sal_uInt16& _rnColumnPos, const Point& _rPoint )
2002-04-02 07:56:18 +00:00
{
_rnColumnPos = GetColumnAtXPosPixel(_rPoint.X());
return _rnColumnPos != BROWSER_INVALIDID;
2002-04-02 07:56:18 +00:00
}
2002-04-02 07:56:18 +00:00
bool BrowseBox::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )
2002-04-02 07:56:18 +00:00
{
2002-04-17 10:56:23 +00:00
//! TODO has to be checked
2002-04-09 06:27:17 +00:00
sal_Int32 nRow = 0;
sal_uInt16 nColumn = 0;
bool bRet = ConvertPointToCellAddress(nRow,nColumn,_rPoint);
2002-04-09 06:27:17 +00:00
if ( bRet )
_rnIndex = nRow * ColCount() + nColumn;
return bRet;
2002-04-02 07:56:18 +00:00
}
2002-04-02 07:56:18 +00:00
// Object data and state ------------------------------------------------------
OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition) const
2002-04-02 07:56:18 +00:00
{
OUString aRetText;
switch( eObjType )
{
case ::svt::BBTYPE_BROWSEBOX:
aRetText = "BrowseBox";
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_TABLE:
aRetText = "Table";
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_ROWHEADERBAR:
aRetText = "RowHeaderBar";
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_COLUMNHEADERBAR:
aRetText = "ColumnHeaderBar";
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_TABLECELL:
if( ColCount() !=0 && GetRowCount()!=0)
{
sal_Int32 columnId = _nPosition % ColCount() +1;
aRetText = OUString( GetColumnDescription( sal_Int16( columnId ) ) );
sal_Int32 rowId = _nPosition / GetRowCount() + 1;
aRetText += OUString::number(rowId);
}
else
aRetText = "TableCell";
#if OSL_DEBUG_LEVEL > 1
aRetText += " [";
aRetText += OUString::number(sal_Int32(GetCurRow()));
aRetText += ",";
aRetText += OUString::number(sal_Int32(GetCurColumnId()));
aRetText += "]";
#endif
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_ROWHEADERCELL:
{
sal_Int32 rowId = _nPosition + 1;
aRetText = OUString::number( rowId );
}
#if OSL_DEBUG_LEVEL > 1
aRetText += " [";
aRetText += OUString::number(sal_Int32(GetCurRow()));
aRetText += ",";
aRetText += OUString::number(sal_Int32(GetCurColumnId()));
aRetText += "]";
#endif
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_COLUMNHEADERCELL:
aRetText = OUString( GetColumnDescription( sal_Int16( _nPosition ) ) );
#if OSL_DEBUG_LEVEL > 1
aRetText += " [";
aRetText += OUString::number(sal_Int32(GetCurRow()));
aRetText += ",";
aRetText += OUString::number(sal_Int32(GetCurColumnId()));
aRetText += "]";
#endif
2002-04-09 06:27:17 +00:00
break;
default:
OSL_FAIL("BrowseBox::GetAccessibleName: invalid enum!");
2002-04-02 07:56:18 +00:00
}
return aRetText;
}
2002-04-02 07:56:18 +00:00
OUString BrowseBox::GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 ) const
2002-04-02 07:56:18 +00:00
{
OUString aRetText;
switch( eObjType )
{
case ::svt::BBTYPE_BROWSEBOX:
aRetText = "BrowseBox description";
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_TABLE:
// aRetText = "TABLE description";
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_ROWHEADERBAR:
// aRetText = "ROWHEADERBAR description";
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_COLUMNHEADERBAR:
// aRetText = "COLUMNHEADERBAR description";
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_TABLECELL:
// aRetText = "TABLECELL description";
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_ROWHEADERCELL:
// aRetText = "ROWHEADERCELL description";
2002-04-09 06:27:17 +00:00
break;
2002-04-02 07:56:18 +00:00
case ::svt::BBTYPE_COLUMNHEADERCELL:
// aRetText = "COLUMNHEADERCELL description";
2002-04-09 06:27:17 +00:00
break;
case ::svt::BBTYPE_CHECKBOXCELL:
break;
2002-04-02 07:56:18 +00:00
}
return aRetText;
}
2002-04-02 07:56:18 +00:00
OUString BrowseBox::GetRowDescription( sal_Int32 ) const
2002-04-02 07:56:18 +00:00
{
return OUString();
}
2002-04-02 07:56:18 +00:00
2002-09-13 11:34:10 +00:00
OUString BrowseBox::GetColumnDescription( sal_uInt16 _nColumn ) const
{
return OUString( GetColumnTitle( GetColumnId( _nColumn ) ) );
}
2002-09-13 11:34:10 +00:00
2002-04-02 07:56:18 +00:00
void BrowseBox::FillAccessibleStateSet(
::utl::AccessibleStateSetHelper& rStateSet,
::svt::AccessibleBrowseBoxObjType eObjType ) const
{
2002-04-09 06:27:17 +00:00
switch( eObjType )
{
case ::svt::BBTYPE_BROWSEBOX:
case ::svt::BBTYPE_TABLE:
rStateSet.AddState( AccessibleStateType::FOCUSABLE );
if ( HasFocus() )
rStateSet.AddState( AccessibleStateType::FOCUSED );
if ( IsActive() )
rStateSet.AddState( AccessibleStateType::ACTIVE );
if ( GetUpdateMode() )
rStateSet.AddState( AccessibleStateType::EDITABLE );
if ( IsEnabled() )
{
2002-04-09 06:27:17 +00:00
rStateSet.AddState( AccessibleStateType::ENABLED );
rStateSet.AddState( AccessibleStateType::SENSITIVE );
}
2002-04-09 06:27:17 +00:00
if ( IsReallyVisible() )
rStateSet.AddState( AccessibleStateType::VISIBLE );
if ( eObjType == ::svt::BBTYPE_TABLE )
rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
2002-04-09 06:27:17 +00:00
break;
case ::svt::BBTYPE_ROWHEADERBAR:
rStateSet.AddState( AccessibleStateType::FOCUSABLE );
rStateSet.AddState( AccessibleStateType::VISIBLE );
if ( GetSelectRowCount() )
rStateSet.AddState( AccessibleStateType::FOCUSED );
rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
2002-04-09 06:27:17 +00:00
break;
case ::svt::BBTYPE_COLUMNHEADERBAR:
rStateSet.AddState( AccessibleStateType::FOCUSABLE );
rStateSet.AddState( AccessibleStateType::VISIBLE );
if ( GetSelectColumnCount() )
rStateSet.AddState( AccessibleStateType::FOCUSED );
rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
2002-04-09 06:27:17 +00:00
break;
case ::svt::BBTYPE_TABLECELL:
{
sal_Int32 nRow = GetCurRow();
sal_uInt16 nColumn = GetCurColumnId();
if ( IsFieldVisible(nRow,nColumn) )
2002-04-09 06:27:17 +00:00
rStateSet.AddState( AccessibleStateType::VISIBLE );
if ( !IsFrozen( nColumn ) )
2002-04-09 06:27:17 +00:00
rStateSet.AddState( AccessibleStateType::FOCUSABLE );
2002-05-31 12:25:17 +00:00
rStateSet.AddState( AccessibleStateType::TRANSIENT );
2002-04-09 06:27:17 +00:00
}
break;
case ::svt::BBTYPE_ROWHEADERCELL:
case ::svt::BBTYPE_COLUMNHEADERCELL:
case ::svt::BBTYPE_CHECKBOXCELL:
OSL_FAIL("Illegal call here!");
2002-04-09 06:27:17 +00:00
break;
}
2002-04-02 07:56:18 +00:00
}
2002-09-13 11:34:10 +00:00
void BrowseBox::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet,
sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
2002-09-13 11:34:10 +00:00
{
//! TODO check if the state is valid for table cells
if ( IsCellVisible( _nRow, _nColumnPos ) )
2002-09-13 11:34:10 +00:00
_rStateSet.AddState( AccessibleStateType::VISIBLE );
if ( GetCurrRow() == _nRow && GetCurrColumn() == _nColumnPos )
2002-09-13 11:34:10 +00:00
_rStateSet.AddState( AccessibleStateType::FOCUSED );
else // only transient when column is not focused
_rStateSet.AddState( AccessibleStateType::TRANSIENT );
2002-09-13 11:34:10 +00:00
}
2002-04-02 07:56:18 +00:00
void BrowseBox::GrabTableFocus()
{
GrabFocus();
}
OUString BrowseBox::GetCellText(long, sal_uInt16 ) const
2002-04-09 06:27:17 +00:00
{
DBG_ASSERT(false,"This method has to be implemented by the derived classes! BUG!!");
return OUString();
2002-04-09 06:27:17 +00:00
}
void BrowseBox::commitHeaderBarEvent(sal_Int16 nEventId,
const Any& rNewValue, const Any& rOldValue, bool _bColumnHeaderBar )
{
if ( isAccessibleAlive() )
m_pImpl->m_pAccessible->commitHeaderBarEvent( nEventId,
rNewValue, rOldValue, _bColumnHeaderBar );
}
void BrowseBox::commitTableEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
2002-04-17 10:56:23 +00:00
{
if ( isAccessibleAlive() )
m_pImpl->m_pAccessible->commitTableEvent( _nEventId, _rNewValue, _rOldValue );
2002-04-17 10:56:23 +00:00
}
void BrowseBox::commitBrowseBoxEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
{
if ( isAccessibleAlive() )
m_pImpl->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue);
}
::svt::IAccessibleFactory& BrowseBox::getAccessibleFactory()
{
return m_pImpl->m_aFactoryAccess.getFactory();
}
bool BrowseBox::isAccessibleAlive( ) const
{
return ( NULL != m_pImpl->m_pAccessible ) && m_pImpl->m_pAccessible->isAlive();
}
2002-09-13 11:34:10 +00:00
// IAccessibleTableProvider
2002-09-13 11:34:10 +00:00
sal_Int32 BrowseBox::GetCurrRow() const
{
return GetCurRow();
}
2002-09-13 11:34:10 +00:00
sal_uInt16 BrowseBox::GetCurrColumn() const
{
return GetColumnPos( GetCurColumnId() );
}
bool BrowseBox::HasRowHeader() const
2002-09-13 11:34:10 +00:00
{
return ( GetColumnId( 0 ) == HandleColumnId ); // HandleColumn == RowHeader
2002-09-13 11:34:10 +00:00
}
bool BrowseBox::IsCellFocusable() const
2002-09-13 11:34:10 +00:00
{
return true;
2002-09-13 11:34:10 +00:00
}
bool BrowseBox::GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn )
2002-09-13 11:34:10 +00:00
{
return GoToRowColumnId( _nRow, GetColumnId( _nColumn ) );
}
void BrowseBox::SelectColumn( sal_uInt16 _nColumn, bool _bSelect )
2002-09-13 11:34:10 +00:00
{
SelectColumnPos( _nColumn, _bSelect );
}
bool BrowseBox::IsColumnSelected( long _nColumn ) const
2002-09-13 11:34:10 +00:00
{
return ( pColSel && (0 <= _nColumn) && (_nColumn <= 0xFFF) ) &&
pColSel->IsSelected( static_cast< sal_uInt16 >( _nColumn ) );
2002-09-13 11:34:10 +00:00
}
2002-09-13 11:34:10 +00:00
sal_Int32 BrowseBox::GetSelectedRowCount() const
{
return GetSelectRowCount();
}
2002-09-13 11:34:10 +00:00
sal_Int32 BrowseBox::GetSelectedColumnCount() const
{
const MultiSelection* pColumnSel = GetColumnSelection();
return pColumnSel ? pColumnSel->GetSelectCount() : 0;
2002-09-13 11:34:10 +00:00
}
2002-09-13 11:34:10 +00:00
void BrowseBox::GetAllSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& _rRows ) const
{
sal_Int32 nCount = GetSelectRowCount();
if( nCount )
{
_rRows.realloc( nCount );
_rRows[ 0 ] = const_cast< BrowseBox* >( this )->FirstSelectedRow();
for( sal_Int32 nIndex = 1; nIndex < nCount; ++nIndex )
_rRows[ nIndex ] = const_cast< BrowseBox* >( this )->NextSelectedRow();
DBG_ASSERT( const_cast< BrowseBox* >( this )->NextSelectedRow() == BROWSER_ENDOFSELECTION,
"BrowseBox::GetAllSelectedRows - too many selected rows found" );
}
}
2002-09-13 11:34:10 +00:00
void BrowseBox::GetAllSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& _rColumns ) const
{
const MultiSelection* pColumnSel = GetColumnSelection();
2002-09-13 11:34:10 +00:00
sal_Int32 nCount = GetSelectedColumnCount();
if( pColumnSel && nCount )
2002-09-13 11:34:10 +00:00
{
_rColumns.realloc( nCount );
2002-04-02 07:56:18 +00:00
2002-09-13 11:34:10 +00:00
sal_Int32 nIndex = 0;
const size_t nRangeCount = pColumnSel->GetRangeCount();
for( size_t nRange = 0; nRange < nRangeCount; ++nRange )
2002-09-13 11:34:10 +00:00
{
const Range& rRange = pColumnSel->GetRange( nRange );
2002-09-13 11:34:10 +00:00
// loop has to include aRange.Max()
for( sal_Int32 nCol = rRange.Min(); nCol <= (sal_Int32)rRange.Max(); ++nCol )
2002-09-13 11:34:10 +00:00
{
DBG_ASSERT( nIndex < nCount,
"GetAllSelectedColumns - range overflow" );
_rColumns[ nIndex ] = nCol;
++nIndex;
}
}
}
}
bool BrowseBox::IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
2002-09-13 11:34:10 +00:00
{
return IsFieldVisible( _nRow, GetColumnId( _nColumnPos ) );
2002-09-13 11:34:10 +00:00
}
OUString BrowseBox::GetAccessibleCellText(long _nRow, sal_uInt16 _nColPos) const
{
return GetCellText( _nRow, GetColumnId( _nColPos ) );
}
bool BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector )
2002-09-13 11:34:10 +00:00
{
return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, nBase, rVector );
}
Rectangle BrowseBox::GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const
2002-09-13 11:34:10 +00:00
{
return Control::GetWindowExtentsRelative( pRelativeWindow );
}
2002-09-13 11:34:10 +00:00
void BrowseBox::GrabFocus()
{
Control::GrabFocus();
}
Reference< XAccessible > BrowseBox::GetAccessible( bool bCreate )
2002-09-13 11:34:10 +00:00
{
return Control::GetAccessible( bCreate );
}
vcl::Window* BrowseBox::GetAccessibleParentWindow() const
2002-09-13 11:34:10 +00:00
{
return Control::GetAccessibleParentWindow();
}
vcl::Window* BrowseBox::GetWindowInstance()
2002-09-13 11:34:10 +00:00
{
return this;
2002-09-13 11:34:10 +00:00
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */