1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svtools.hxx"
26 #include <svtools/brwbox.hxx>
27 #include <svtools/AccessibleBrowseBoxObjType.hxx>
28 #include <tools/debug.hxx>
29 #include <tools/multisel.hxx>
30 #include "datwin.hxx"
31 #include "brwimpl.hxx"
32 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
33 #include <com/sun/star/accessibility/AccessibleRole.hpp>
34 #include <toolkit/helper/vclunohelper.hxx>
35
36 // Accessibility ==============================================================
37
38 using ::rtl::OUString;
39 using namespace ::com::sun::star::uno;
40 using ::com::sun::star::accessibility::XAccessible;
41 using namespace ::com::sun::star::accessibility;
42
43 // ============================================================================
44 namespace svt
45 {
46 using namespace ::com::sun::star::lang;
47 using namespace utl;
48
getHeaderCell(BrowseBoxImpl::THeaderCellMap & _raHeaderCells,sal_Int32 _nPos,AccessibleBrowseBoxObjType _eType,const Reference<XAccessible> & _rParent,BrowseBox & _rBrowseBox,IAccessibleFactory & rFactory)49 Reference< XAccessible > getHeaderCell( BrowseBoxImpl::THeaderCellMap& _raHeaderCells,
50 sal_Int32 _nPos,
51 AccessibleBrowseBoxObjType _eType,
52 const Reference< XAccessible >& _rParent,
53 BrowseBox& _rBrowseBox,
54 IAccessibleFactory& rFactory
55 )
56 {
57 Reference< XAccessible > xRet;
58 BrowseBoxImpl::THeaderCellMap::iterator aFind = _raHeaderCells.find( _nPos );
59 if ( aFind == _raHeaderCells.end() )
60 {
61 Reference< XAccessible > xAccessible = rFactory.createAccessibleBrowseBoxHeaderCell(
62 _nPos,
63 _rParent,
64 _rBrowseBox,
65 NULL,
66 _eType
67 );
68 aFind = _raHeaderCells.insert( BrowseBoxImpl::THeaderCellMap::value_type( _nPos, xAccessible ) ).first;
69 }
70 if ( aFind != _raHeaderCells.end() )
71 xRet = aFind->second;
72 return xRet;
73 }
74
75 // ============================================================================
76 // ----------------------------------------------------------------------------
getAccessibleHeaderBar(AccessibleBrowseBoxObjType _eObjType)77 Reference< XAccessible > BrowseBoxImpl::getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType )
78 {
79 if ( m_pAccessible && m_pAccessible->isAlive() )
80 return m_pAccessible->getHeaderBar( _eObjType );
81 return NULL;
82 }
83
84 // ----------------------------------------------------------------------------
getAccessibleTable()85 Reference< XAccessible > BrowseBoxImpl::getAccessibleTable( )
86 {
87 if ( m_pAccessible && m_pAccessible->isAlive() )
88 return m_pAccessible->getTable( );
89 return NULL;
90 }
91 }
92
93 // ============================================================================
94
CreateAccessible()95 Reference< XAccessible > BrowseBox::CreateAccessible()
96 {
97 Window* pParent = GetAccessibleParentWindow();
98 DBG_ASSERT( pParent, "BrowseBox::CreateAccessible - parent not found" );
99
100 if( pParent && !m_pImpl->m_pAccessible)
101 {
102 Reference< XAccessible > xAccParent = pParent->GetAccessible();
103 if( xAccParent.is() )
104 {
105 m_pImpl->m_pAccessible = getAccessibleFactory().createAccessibleBrowseBox(
106 xAccParent, *this
107 );
108 }
109 }
110
111 Reference< XAccessible > xAccessible;
112 if ( m_pImpl->m_pAccessible )
113 xAccessible = m_pImpl->m_pAccessible->getMyself();
114
115 return xAccessible;
116 }
117 // -----------------------------------------------------------------------------
118
119 // Children -------------------------------------------------------------------
120
CreateAccessibleCell(sal_Int32 _nRow,sal_uInt16 _nColumnPos)121 Reference< XAccessible > BrowseBox::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos )
122 {
123 // BBINDEX_TABLE must be the table
124 OSL_ENSURE(m_pImpl->m_pAccessible,"Invalid call: Accessible is null");
125
126 return m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxTableCell(
127 m_pImpl->getAccessibleTable(),
128 *this,
129 NULL,
130 _nRow,
131 _nColumnPos,
132 OFFSET_DEFAULT
133 );
134 }
135 // -----------------------------------------------------------------------------
136
CreateAccessibleRowHeader(sal_Int32 _nRow)137 Reference< XAccessible > BrowseBox::CreateAccessibleRowHeader( sal_Int32 _nRow )
138 {
139 return svt::getHeaderCell(
140 m_pImpl->m_aRowHeaderCellMap,
141 _nRow,
142 svt::BBTYPE_ROWHEADERCELL,
143 m_pImpl->getAccessibleHeaderBar(svt::BBTYPE_ROWHEADERBAR),
144 *this,
145 m_pImpl->m_aFactoryAccess.getFactory()
146 );
147 }
148 // -----------------------------------------------------------------------------
149
CreateAccessibleColumnHeader(sal_uInt16 _nColumnPos)150 Reference< XAccessible > BrowseBox::CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos )
151 {
152 return svt::getHeaderCell(
153 m_pImpl->m_aColHeaderCellMap,
154 _nColumnPos,
155 svt::BBTYPE_COLUMNHEADERCELL,
156 m_pImpl->getAccessibleHeaderBar(svt::BBTYPE_COLUMNHEADERBAR),
157 *this,
158 m_pImpl->m_aFactoryAccess.getFactory()
159 );
160 }
161 // -----------------------------------------------------------------------------
162
GetAccessibleControlCount() const163 sal_Int32 BrowseBox::GetAccessibleControlCount() const
164 {
165 return 0;
166 }
167 // -----------------------------------------------------------------------------
168
CreateAccessibleControl(sal_Int32)169 Reference< XAccessible > BrowseBox::CreateAccessibleControl( sal_Int32 )
170 {
171 DBG_ASSERT( sal_False, "BrowseBox::CreateAccessibleControl: to be overwritten!" );
172 return NULL;
173 }
174 // -----------------------------------------------------------------------------
175
176 // Conversions ----------------------------------------------------------------
177
ConvertPointToCellAddress(sal_Int32 & rnRow,sal_uInt16 & rnColumnPos,const Point & rPoint)178 sal_Bool BrowseBox::ConvertPointToCellAddress(
179 sal_Int32& rnRow, sal_uInt16& rnColumnPos, const Point& rPoint )
180 {
181 //! TODO has to be checked
182 rnRow = GetRowAtYPosPixel(rPoint.Y());
183 rnColumnPos = GetColumnAtXPosPixel(rPoint.X());
184 return rnRow != BROWSER_INVALIDID && rnColumnPos != BROWSER_INVALIDID;
185 }
186 // -----------------------------------------------------------------------------
187
ConvertPointToRowHeader(sal_Int32 & rnRow,const Point & rPoint)188 sal_Bool BrowseBox::ConvertPointToRowHeader( sal_Int32& rnRow, const Point& rPoint )
189 {
190 rnRow = GetRowAtYPosPixel(rPoint.Y());
191 // sal_uInt16 nColumnId = GetColumnAtXPosPixel(rPoint.X());
192 return rnRow != BROWSER_INVALIDID;// && nColumnId == 0;
193 }
194 // -----------------------------------------------------------------------------
195
ConvertPointToColumnHeader(sal_uInt16 & _rnColumnPos,const Point & _rPoint)196 sal_Bool BrowseBox::ConvertPointToColumnHeader( sal_uInt16& _rnColumnPos, const Point& _rPoint )
197 {
198 _rnColumnPos = GetColumnAtXPosPixel(_rPoint.X());
199 return _rnColumnPos != BROWSER_INVALIDID;
200 }
201 // -----------------------------------------------------------------------------
202
ConvertPointToControlIndex(sal_Int32 & _rnIndex,const Point & _rPoint)203 sal_Bool BrowseBox::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )
204 {
205 //! TODO has to be checked
206 sal_Int32 nRow = 0;
207 sal_uInt16 nColumn = 0;
208 sal_Bool bRet = ConvertPointToCellAddress(nRow,nColumn,_rPoint);
209 if ( bRet )
210 _rnIndex = nRow * ColCount() + nColumn;
211
212 return bRet;
213 }
214 // -----------------------------------------------------------------------------
215
216 // Object data and state ------------------------------------------------------
217
GetAccessibleObjectName(::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition) const218 OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition) const
219 {
220 OUString aRetText;
221 switch( eObjType )
222 {
223 case ::svt::BBTYPE_BROWSEBOX:
224 aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "BrowseBox" ) );
225 break;
226 case ::svt::BBTYPE_TABLE:
227 aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) );
228 break;
229 case ::svt::BBTYPE_ROWHEADERBAR:
230 aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderBar" ) );
231 break;
232 case ::svt::BBTYPE_COLUMNHEADERBAR:
233 aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) );
234 break;
235 case ::svt::BBTYPE_TABLECELL:
236 if( ColCount() !=0 && GetRowCount()!=0)
237 {
238
239 sal_Int32 columnId = _nPosition % ColCount() +1;
240 aRetText = OUString( GetColumnDescription( sal_Int16( columnId ) ) );
241 sal_Int32 rowId = _nPosition / GetRowCount() + 1;
242 aRetText += OUString::valueOf(rowId);
243 }
244 else
245 aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "TableCell" ) );
246 #if OSL_DEBUG_LEVEL > 1
247 aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
248 aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
249 aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "," ) );
250 aRetText += OUString::valueOf(sal_Int32(GetCurColumnId()));
251 aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "]" ) );
252 #endif
253 break;
254 case ::svt::BBTYPE_ROWHEADERCELL:
255 {
256 sal_Int32 rowId = _nPosition + 1;
257 aRetText = OUString::valueOf( rowId );
258 }
259 #if OSL_DEBUG_LEVEL > 1
260 aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
261 aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
262 aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "," ) );
263 aRetText += OUString::valueOf(sal_Int32(GetCurColumnId()));
264 aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "]" ) );
265 #endif
266 break;
267 case ::svt::BBTYPE_COLUMNHEADERCELL:
268 aRetText = OUString( GetColumnDescription( sal_Int16( _nPosition ) ) );
269 #if OSL_DEBUG_LEVEL > 1
270 aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
271 aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
272 aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "," ) );
273 aRetText += OUString::valueOf(sal_Int32(GetCurColumnId()));
274 aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "]" ) );
275 #endif
276 break;
277 default:
278 OSL_ENSURE(0,"BrowseBox::GetAccessibleName: invalid enum!");
279 }
280 return aRetText;
281 }
282 // -----------------------------------------------------------------------------
283
GetAccessibleObjectDescription(::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32) const284 OUString BrowseBox::GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 ) const
285 {
286 OUString aRetText;
287 switch( eObjType )
288 {
289 case ::svt::BBTYPE_BROWSEBOX:
290 aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "BrowseBox description" ) );
291 break;
292 case ::svt::BBTYPE_TABLE:
293 // aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLE description" ) );
294 break;
295 case ::svt::BBTYPE_ROWHEADERBAR:
296 // aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERBAR description" ) );
297 break;
298 case ::svt::BBTYPE_COLUMNHEADERBAR:
299 // aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERBAR description" ) );
300 break;
301 case ::svt::BBTYPE_TABLECELL:
302 // aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLECELL description" ) );
303 break;
304 case ::svt::BBTYPE_ROWHEADERCELL:
305 // aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERCELL description" ) );
306 break;
307 case ::svt::BBTYPE_COLUMNHEADERCELL:
308 // aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERCELL description" ) );
309 break;
310 case ::svt::BBTYPE_CHECKBOXCELL:
311 break;
312 }
313 return aRetText;
314 }
315 // -----------------------------------------------------------------------------
316
GetRowDescription(sal_Int32) const317 OUString BrowseBox::GetRowDescription( sal_Int32 ) const
318 {
319 return OUString();
320 }
321 // -----------------------------------------------------------------------------
322
GetColumnDescription(sal_uInt16 _nColumn) const323 OUString BrowseBox::GetColumnDescription( sal_uInt16 _nColumn ) const
324 {
325 return OUString( GetColumnTitle( GetColumnId( _nColumn ) ) );
326 }
327
328 // -----------------------------------------------------------------------------
329
FillAccessibleStateSet(::utl::AccessibleStateSetHelper & rStateSet,::svt::AccessibleBrowseBoxObjType eObjType) const330 void BrowseBox::FillAccessibleStateSet(
331 ::utl::AccessibleStateSetHelper& rStateSet,
332 ::svt::AccessibleBrowseBoxObjType eObjType ) const
333 {
334 switch( eObjType )
335 {
336 case ::svt::BBTYPE_BROWSEBOX:
337 case ::svt::BBTYPE_TABLE:
338
339 rStateSet.AddState( AccessibleStateType::FOCUSABLE );
340 if ( HasFocus() )
341 rStateSet.AddState( AccessibleStateType::FOCUSED );
342 if ( IsActive() )
343 rStateSet.AddState( AccessibleStateType::ACTIVE );
344 if ( GetUpdateMode() )
345 rStateSet.AddState( AccessibleStateType::EDITABLE );
346 if ( IsEnabled() )
347 {
348 rStateSet.AddState( AccessibleStateType::ENABLED );
349 rStateSet.AddState( AccessibleStateType::SENSITIVE );
350 }
351 if ( IsReallyVisible() )
352 rStateSet.AddState( AccessibleStateType::VISIBLE );
353 if ( eObjType == ::svt::BBTYPE_TABLE )
354 rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
355
356 break;
357 case ::svt::BBTYPE_ROWHEADERBAR:
358 rStateSet.AddState( AccessibleStateType::FOCUSABLE );
359 rStateSet.AddState( AccessibleStateType::VISIBLE );
360 if ( GetSelectRowCount() )
361 rStateSet.AddState( AccessibleStateType::FOCUSED );
362 rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
363 break;
364 case ::svt::BBTYPE_COLUMNHEADERBAR:
365 rStateSet.AddState( AccessibleStateType::FOCUSABLE );
366 rStateSet.AddState( AccessibleStateType::VISIBLE );
367 if ( GetSelectColumnCount() )
368 rStateSet.AddState( AccessibleStateType::FOCUSED );
369 rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
370 break;
371 case ::svt::BBTYPE_TABLECELL:
372 {
373 sal_Int32 nRow = GetCurRow();
374 sal_uInt16 nColumn = GetCurColumnId();
375 if ( IsFieldVisible(nRow,nColumn) )
376 rStateSet.AddState( AccessibleStateType::VISIBLE );
377 if ( !IsFrozen( nColumn ) )
378 rStateSet.AddState( AccessibleStateType::FOCUSABLE );
379 rStateSet.AddState( AccessibleStateType::TRANSIENT );
380 }
381 break;
382 case ::svt::BBTYPE_ROWHEADERCELL:
383 case ::svt::BBTYPE_COLUMNHEADERCELL:
384 case ::svt::BBTYPE_CHECKBOXCELL:
385 OSL_ENSURE(0,"Illegal call here!");
386 break;
387 }
388 }
389 // -----------------------------------------------------------------------
FillAccessibleStateSetForCell(::utl::AccessibleStateSetHelper & _rStateSet,sal_Int32 _nRow,sal_uInt16 _nColumnPos) const390 void BrowseBox::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet,
391 sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
392 {
393 //! TODO check if the state is valid for table cells
394 if ( IsCellVisible( _nRow, _nColumnPos ) )
395 _rStateSet.AddState( AccessibleStateType::VISIBLE );
396 if ( GetCurrRow() == _nRow && GetCurrColumn() == _nColumnPos )
397 _rStateSet.AddState( AccessibleStateType::FOCUSED );
398 else // only transient when column is not focused
399 _rStateSet.AddState( AccessibleStateType::TRANSIENT );
400 }
401 // -----------------------------------------------------------------------------
402
GrabTableFocus()403 void BrowseBox::GrabTableFocus()
404 {
405 GrabFocus();
406 }
407 // -----------------------------------------------------------------------------
GetCellText(long,sal_uInt16) const408 String BrowseBox::GetCellText(long, sal_uInt16 ) const
409 {
410 DBG_ASSERT(0,"This method has to be implemented by the derived classes! BUG!!");
411 return String();
412 }
413
414 // -----------------------------------------------------------------------------
commitHeaderBarEvent(sal_Int16 nEventId,const Any & rNewValue,const Any & rOldValue,sal_Bool _bColumnHeaderBar)415 void BrowseBox::commitHeaderBarEvent(sal_Int16 nEventId,
416 const Any& rNewValue, const Any& rOldValue, sal_Bool _bColumnHeaderBar )
417 {
418 if ( isAccessibleAlive() )
419 m_pImpl->m_pAccessible->commitHeaderBarEvent( nEventId,
420 rNewValue, rOldValue, _bColumnHeaderBar );
421 }
422
423 // -----------------------------------------------------------------------------
commitTableEvent(sal_Int16 _nEventId,const Any & _rNewValue,const Any & _rOldValue)424 void BrowseBox::commitTableEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
425 {
426 if ( isAccessibleAlive() )
427 m_pImpl->m_pAccessible->commitTableEvent( _nEventId, _rNewValue, _rOldValue );
428 }
429 // -----------------------------------------------------------------------------
commitBrowseBoxEvent(sal_Int16 _nEventId,const Any & _rNewValue,const Any & _rOldValue)430 void BrowseBox::commitBrowseBoxEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
431 {
432 if ( isAccessibleAlive() )
433 m_pImpl->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue);
434 }
435
436 // -----------------------------------------------------------------------------
getAccessibleFactory()437 ::svt::IAccessibleFactory& BrowseBox::getAccessibleFactory()
438 {
439 return m_pImpl->m_aFactoryAccess.getFactory();
440 }
441
442 // -----------------------------------------------------------------------------
isAccessibleAlive() const443 sal_Bool BrowseBox::isAccessibleAlive( ) const
444 {
445 return ( NULL != m_pImpl->m_pAccessible ) && m_pImpl->m_pAccessible->isAlive();
446 }
447 // -----------------------------------------------------------------------------
448 // IAccessibleTableProvider
449 // -----------------------------------------------------------------------------
GetCurrRow() const450 sal_Int32 BrowseBox::GetCurrRow() const
451 {
452 return GetCurRow();
453 }
454 // -----------------------------------------------------------------------------
GetCurrColumn() const455 sal_uInt16 BrowseBox::GetCurrColumn() const
456 {
457 return GetColumnPos( GetCurColumnId() );
458 }
459 // -----------------------------------------------------------------------------
HasRowHeader() const460 sal_Bool BrowseBox::HasRowHeader() const
461 {
462 return ( GetColumnId( 0 ) == 0 ); // HandleColumn == RowHeader
463 }
464 // -----------------------------------------------------------------------------
IsCellFocusable() const465 sal_Bool BrowseBox::IsCellFocusable() const
466 {
467 return sal_True;
468 }
469 // -----------------------------------------------------------------------------
GoToCell(sal_Int32 _nRow,sal_uInt16 _nColumn)470 sal_Bool BrowseBox::GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn )
471 {
472 return GoToRowColumnId( _nRow, GetColumnId( _nColumn ) );
473 }
474 // -----------------------------------------------------------------------------
SelectColumn(sal_uInt16 _nColumn,sal_Bool _bSelect)475 void BrowseBox::SelectColumn( sal_uInt16 _nColumn, sal_Bool _bSelect )
476 {
477 SelectColumnPos( _nColumn, _bSelect );
478 }
479 // -----------------------------------------------------------------------------
IsColumnSelected(long _nColumn) const480 sal_Bool BrowseBox::IsColumnSelected( long _nColumn ) const
481 {
482 return ( pColSel && (0 <= _nColumn) && (_nColumn <= 0xFFF) ) ?
483 pColSel->IsSelected( static_cast< sal_uInt16 >( _nColumn ) ) :
484 sal_False;
485 }
486 // -----------------------------------------------------------------------------
GetSelectedRowCount() const487 sal_Int32 BrowseBox::GetSelectedRowCount() const
488 {
489 return GetSelectRowCount();
490 }
491 // -----------------------------------------------------------------------------
GetSelectedColumnCount() const492 sal_Int32 BrowseBox::GetSelectedColumnCount() const
493 {
494 const MultiSelection* pColumnSel = GetColumnSelection();
495 return pColumnSel ? pColumnSel->GetSelectCount() : 0;
496 }
497 // -----------------------------------------------------------------------------
GetAllSelectedRows(::com::sun::star::uno::Sequence<sal_Int32> & _rRows) const498 void BrowseBox::GetAllSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& _rRows ) const
499 {
500 sal_Int32 nCount = GetSelectRowCount();
501 if( nCount )
502 {
503 _rRows.realloc( nCount );
504 _rRows[ 0 ] = const_cast< BrowseBox* >( this )->FirstSelectedRow();
505 for( sal_Int32 nIndex = 1; nIndex < nCount; ++nIndex )
506 _rRows[ nIndex ] = const_cast< BrowseBox* >( this )->NextSelectedRow();
507 DBG_ASSERT( const_cast< BrowseBox* >( this )->NextSelectedRow() == BROWSER_ENDOFSELECTION,
508 "BrowseBox::GetAllSelectedRows - too many selected rows found" );
509 }
510 }
511 // -----------------------------------------------------------------------------
GetAllSelectedColumns(::com::sun::star::uno::Sequence<sal_Int32> & _rColumns) const512 void BrowseBox::GetAllSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& _rColumns ) const
513 {
514 const MultiSelection* pColumnSel = GetColumnSelection();
515 sal_Int32 nCount = GetSelectedColumnCount();
516 if( pColumnSel && nCount )
517 {
518 _rColumns.realloc( nCount );
519
520 sal_Int32 nIndex = 0;
521 sal_uInt32 nRangeCount = pColumnSel->GetRangeCount();
522 for( sal_uInt32 nRange = 0; nRange < nRangeCount; ++nRange )
523 {
524 const Range& rRange = pColumnSel->GetRange( nRange );
525 // loop has to include aRange.Max()
526 for( sal_Int32 nCol = rRange.Min(); nCol <= rRange.Max(); ++nCol )
527 {
528 DBG_ASSERT( nIndex < nCount,
529 "GetAllSelectedColumns - range overflow" );
530 _rColumns[ nIndex ] = nCol;
531 ++nIndex;
532 }
533 }
534 }
535 }
536 // -----------------------------------------------------------------------------
IsCellVisible(sal_Int32 _nRow,sal_uInt16 _nColumnPos) const537 sal_Bool BrowseBox::IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
538 {
539 return IsFieldVisible( _nRow, GetColumnId( _nColumnPos ) );
540 }
541 // -----------------------------------------------------------------------------
GetAccessibleCellText(long _nRow,sal_uInt16 _nColPos) const542 String BrowseBox::GetAccessibleCellText(long _nRow, sal_uInt16 _nColPos) const
543 {
544 return GetCellText( _nRow, GetColumnId( _nColPos ) );
545 }
546
547 // -----------------------------------------------------------------------------
GetGlyphBoundRects(const Point & rOrigin,const String & rStr,int nIndex,int nLen,int nBase,MetricVector & rVector)548 sal_Bool BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector )
549 {
550 return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, nBase, rVector );
551 }
552 // -----------------------------------------------------------------------------
GetWindowExtentsRelative(Window * pRelativeWindow) const553 Rectangle BrowseBox::GetWindowExtentsRelative( Window *pRelativeWindow ) const
554 {
555 return Control::GetWindowExtentsRelative( pRelativeWindow );
556 }
557 // -----------------------------------------------------------------------------
GrabFocus()558 void BrowseBox::GrabFocus()
559 {
560 Control::GrabFocus();
561 }
562 // -----------------------------------------------------------------------------
GetAccessible(sal_Bool bCreate)563 Reference< XAccessible > BrowseBox::GetAccessible( sal_Bool bCreate )
564 {
565 return Control::GetAccessible( bCreate );
566 }
567 // -----------------------------------------------------------------------------
GetAccessibleParentWindow() const568 Window* BrowseBox::GetAccessibleParentWindow() const
569 {
570 return Control::GetAccessibleParentWindow();
571 }
572 // -----------------------------------------------------------------------------
GetWindowInstance()573 Window* BrowseBox::GetWindowInstance()
574 {
575 return this;
576 }
577