LibreOffice Module sc (master)  1
AccessibleCsvControl.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <memory>
21 #include <sal/config.h>
22 
23 #include <utility>
24 
25 #include <AccessibleCsvControl.hxx>
26 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
27 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
28 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
29 #include <com/sun/star/accessibility/AccessibleTextType.hpp>
30 #include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
31 #include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
32 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
35 #include <comphelper/sequence.hxx>
36 #include <scitems.hxx>
37 #include <editeng/fontitem.hxx>
38 #include <editeng/fhgtitem.hxx>
39 #include <editeng/langitem.hxx>
40 #include <csvtablebox.hxx>
41 #include <csvcontrol.hxx>
42 #include <csvruler.hxx>
43 #include <csvgrid.hxx>
44 #include <AccessibleText.hxx>
45 #include <editsrc.hxx>
46 #include <scresid.hxx>
47 #include <strings.hrc>
48 #include <scmod.hxx>
49 #include <svtools/colorcfg.hxx>
50 #include <vcl/svapp.hxx>
51 #include <vcl/settings.hxx>
52 
53 using ::utl::AccessibleRelationSetHelper;
54 using ::utl::AccessibleStateSetHelper;
55 using ::accessibility::AccessibleStaticTextBase;
56 using ::com::sun::star::uno::Any;
57 using ::com::sun::star::uno::Reference;
58 using ::com::sun::star::uno::Sequence;
59 using ::com::sun::star::uno::RuntimeException;
60 using ::com::sun::star::uno::XInterface;
61 using ::com::sun::star::lang::IndexOutOfBoundsException;
62 using ::com::sun::star::beans::PropertyValue;
63 using namespace ::com::sun::star::accessibility;
64 
65 const sal_Unicode cRulerDot = '.';
66 const sal_Unicode cRulerLine = '|';
67 
68 const sal_Int32 CSV_LINE_HEADER = CSV_POS_INVALID;
70 
72  : mpControl(&rControl)
73 {
74 }
75 
77 {
79 }
80 
82 {
83  SolarMutexGuard aGuard;
84  mpControl = nullptr;
86 }
87 
88 // XAccessibleComponent -------------------------------------------------------
89 
90 Reference< XAccessible > SAL_CALL ScAccessibleCsvControl::getAccessibleAtPoint( const css::awt::Point& /* rPoint */ )
91 {
92  ensureAlive();
93  return nullptr;
94 }
95 
97 {
98  SolarMutexGuard aGuard;
99  ensureAlive();
101 }
102 
103 // events ---------------------------------------------------------------------
104 
106 {
107  Any aOldAny, aNewAny;
108  if (bFocused)
109  aNewAny <<= AccessibleStateType::FOCUSED;
110  else
111  aOldAny <<= AccessibleStateType::FOCUSED;
112  NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny);
113 }
114 
116 {
117  OSL_FAIL( "ScAccessibleCsvControl::SendCaretEvent - Illegal call" );
118 }
119 
121 {
122  NotifyAccessibleEvent(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any());
123 }
124 
126 {
127  NotifyAccessibleEvent(AccessibleEventId::SELECTION_CHANGED, Any(), Any());
128 }
129 
130 void ScAccessibleCsvControl::SendTableUpdateEvent( sal_uInt32 /* nFirstColumn */, sal_uInt32 /* nLastColumn */, bool /* bAllRows */ )
131 {
132  OSL_FAIL( "ScAccessibleCsvControl::SendTableUpdateEvent - Illegal call" );
133 }
134 
135 void ScAccessibleCsvControl::SendInsertColumnEvent( sal_uInt32 /* nFirstColumn */, sal_uInt32 /* nLastColumn */ )
136 {
137  OSL_FAIL( "ScAccessibleCsvControl::SendInsertColumnEvent - Illegal call" );
138 }
139 
140 void ScAccessibleCsvControl::SendRemoveColumnEvent( sal_uInt32 /* nFirstColumn */, sal_uInt32 /* nLastColumn */ )
141 {
142  OSL_FAIL( "ScAccessibleCsvControl::SendRemoveColumnEvent - Illegal call" );
143 }
144 
145 // helpers --------------------------------------------------------------------
146 
148 {
149  SolarMutexGuard aGuard;
150  ensureAlive();
151  Size aOutSize(implGetControl().GetOutputSizePixel());
152  return css::awt::Rectangle(0, 0, aOutSize.Width(), aOutSize.Height());
153 }
154 
156 {
157  assert(mpControl && "ScAccessibleCsvControl::implGetControl - missing control");
158  return *mpControl;
159 }
160 
162 {
163  SolarMutexGuard aGuard;
164  AccessibleStateSetHelper* pStateSet = new AccessibleStateSetHelper();
165  if (isAlive())
166  {
167  const ScCsvControl& rCtrl = implGetControl();
168  pStateSet->AddState( AccessibleStateType::OPAQUE );
169  if( rCtrl.IsEnabled() )
170  pStateSet->AddState( AccessibleStateType::ENABLED );
171  if( rCtrl.IsReallyVisible() )
172  pStateSet->AddState( AccessibleStateType::SHOWING );
173  if( rCtrl.IsVisible() )
174  pStateSet->AddState( AccessibleStateType::VISIBLE );
175  }
176  else
177  pStateSet->AddState( AccessibleStateType::DEFUNC );
178  return pStateSet;
179 }
180 
181 // Ruler ======================================================================
182 
184 static sal_Int32 lcl_GetApiPos( sal_Int32 nRulerPos )
185 {
186  sal_Int32 nApiPos = nRulerPos;
187  sal_Int32 nStart = (nRulerPos - 1) / 10;
188  sal_Int32 nExp = 1;
189  while( nStart >= nExp )
190  {
191  nApiPos += nStart - nExp + 1;
192  nExp *= 10;
193  }
194  return ::std::max( nApiPos, static_cast<sal_Int32>(0) );
195 }
196 
198 static sal_Int32 lcl_GetRulerPos( sal_Int32 nApiPos )
199 {
200  sal_Int32 nDiv = 10;
201  sal_Int32 nExp = 10;
202  sal_Int32 nRulerPos = 0;
203  sal_Int32 nApiBase = 0;
204  sal_Int32 nApiLimit = 10;
205  while( nApiPos >= nApiLimit )
206  {
207  ++nDiv;
208  nRulerPos = nExp;
209  nExp *= 10;
210  nApiBase = nApiLimit;
211  nApiLimit = lcl_GetApiPos( nExp );
212  }
213  sal_Int32 nRelPos = nApiPos - nApiBase;
214  return nRulerPos + nRelPos / nDiv * 10 + ::std::max<sal_Int32>( nRelPos % nDiv - nDiv + 10, 0 );
215 }
216 
218 static sal_Int32 lcl_ExpandSequence( Sequence< PropertyValue >& rSeq, sal_Int32 nExp )
219 {
220  OSL_ENSURE( nExp > 0, "lcl_ExpandSequence - invalid value" );
221  rSeq.realloc( rSeq.getLength() + nExp );
222  return rSeq.getLength() - nExp;
223 }
224 
226 static void lcl_FillProperty( PropertyValue& rVal, const OUString& rPropName, const SfxPoolItem& rItem, sal_uInt8 nMID )
227 {
228  rVal.Name = rPropName;
229  rItem.QueryValue( rVal.Value, nMID );
230 }
231 
233 static void lcl_FillFontAttributes( Sequence< PropertyValue >& rSeq, const vcl::Font& rFont )
234 {
235  SvxFontItem aFontItem( rFont.GetFamilyType(), rFont.GetFamilyName(), rFont.GetStyleName(), rFont.GetPitch(), rFont.GetCharSet(), ATTR_FONT );
236  SvxFontHeightItem aHeightItem( rFont.GetFontSize().Height(), 100, ATTR_FONT_HEIGHT );
237  SvxLanguageItem aLangItem( rFont.GetLanguage(), ATTR_FONT_LANGUAGE );
238 
239  sal_Int32 nIndex = lcl_ExpandSequence( rSeq, 7 );
240  lcl_FillProperty( rSeq[ nIndex++ ], "CharFontName", aFontItem, MID_FONT_FAMILY_NAME );
241  lcl_FillProperty( rSeq[ nIndex++ ], "CharFontFamily", aFontItem, MID_FONT_FAMILY );
242  lcl_FillProperty( rSeq[ nIndex++ ], "CharFontStyleName", aFontItem, MID_FONT_STYLE_NAME );
243  lcl_FillProperty( rSeq[ nIndex++ ], "CharFontCharSet", aFontItem, MID_FONT_PITCH );
244  lcl_FillProperty( rSeq[ nIndex++ ], "CharFontPitch", aFontItem, MID_FONT_CHAR_SET );
245  lcl_FillProperty( rSeq[ nIndex++ ], "CharHeight", aHeightItem, MID_FONTHEIGHT );
246  lcl_FillProperty( rSeq[ nIndex++ ], "CharLocale", aLangItem, MID_LANG_LOCALE );
247 }
248 
250  : ScAccessibleCsvControl(rRuler)
251 {
253 }
254 
256 {
257  ensureDisposed();
258 }
259 
260 // XAccessibleComponent -----------------------------------------------------
261 
263 {
264  SolarMutexGuard aGuard;
265  ensureAlive();
266  return sal_Int32(Application::GetSettings().GetStyleSettings().GetLabelTextColor());
267 }
268 
270 {
271  SolarMutexGuard aGuard;
272  ensureAlive();
273  return sal_Int32(Application::GetSettings().GetStyleSettings().GetFaceColor());
274 }
275 
276 // XAccessibleContext ---------------------------------------------------------
277 
279 {
280  ensureAlive();
281  return 0;
282 }
283 
284 Reference< XAccessible > SAL_CALL ScAccessibleCsvRuler::getAccessibleChild( sal_Int32 /* nIndex */ )
285 {
286  ensureAlive();
287  throw IndexOutOfBoundsException();
288 }
289 
290 Reference< XAccessibleRelationSet > SAL_CALL ScAccessibleCsvRuler::getAccessibleRelationSet()
291 {
292  SolarMutexGuard aGuard;
293  ensureAlive();
294  AccessibleRelationSetHelper* pRelationSet = new AccessibleRelationSetHelper();
295 
296  ScCsvRuler& rRuler = implGetRuler();
297  ScCsvTableBox* pTableBox = rRuler.GetTableBox();
298  ScCsvGrid& rGrid = pTableBox->GetGrid();
299 
300  css::uno::Reference<css::accessibility::XAccessible> xAccObj(static_cast<ScAccessibleCsvGrid*>(rGrid.GetAccessible()));
301  if( xAccObj.is() )
302  {
303  Sequence< Reference< XInterface > > aSeq( 1 );
304  aSeq[ 0 ] = xAccObj;
305  pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::CONTROLLER_FOR, aSeq ) );
306  }
307 
308  return pRelationSet;
309 }
310 
311 Reference< XAccessibleStateSet > SAL_CALL ScAccessibleCsvRuler::getAccessibleStateSet()
312 {
313  SolarMutexGuard aGuard;
314  AccessibleStateSetHelper* pStateSet = implCreateStateSet();
315  if( isAlive() )
316  {
317  pStateSet->AddState( AccessibleStateType::FOCUSABLE );
318  pStateSet->AddState( AccessibleStateType::SINGLE_LINE );
319  if( implGetRuler().HasFocus() )
320  pStateSet->AddState( AccessibleStateType::FOCUSED );
321  }
322  return pStateSet;
323 }
324 
325 // XAccessibleText ------------------------------------------------------------
326 
328 {
329  SolarMutexGuard aGuard;
330  ensureAlive();
331  return lcl_GetApiPos( implGetRuler().GetRulerCursorPos() );
332 }
333 
335 {
336  SolarMutexGuard aGuard;
337  ensureAlive();
338  ensureValidIndex( nIndex );
339  ScCsvRuler& rRuler = implGetRuler();
340  sal_Int32 nOldCursor = rRuler.GetRulerCursorPos();
341  rRuler.Execute( CSVCMD_MOVERULERCURSOR, lcl_GetRulerPos( nIndex ) );
342  return rRuler.GetRulerCursorPos() != nOldCursor;
343 }
344 
346 {
347  SolarMutexGuard aGuard;
348  ensureAlive();
349  ensureValidIndex( nIndex );
350  return maBuffer[nIndex];
351 }
352 
353 Sequence< PropertyValue > SAL_CALL ScAccessibleCsvRuler::getCharacterAttributes( sal_Int32 nIndex,
354  const css::uno::Sequence< OUString >& /* aRequestedAttributes */ )
355 {
356  SolarMutexGuard aGuard;
357  ensureAlive();
358  ensureValidIndexWithEnd( nIndex );
359  Sequence< PropertyValue > aSeq;
360  lcl_FillFontAttributes( aSeq, implGetRuler().GetDrawingArea()->get_ref_device().GetFont() );
361  return aSeq;
362 }
363 
364 css::awt::Rectangle SAL_CALL ScAccessibleCsvRuler::getCharacterBounds( sal_Int32 nIndex )
365 {
366  SolarMutexGuard aGuard;
367  ensureAlive();
368  ensureValidIndexWithEnd( nIndex );
369  ScCsvRuler& rRuler = implGetRuler();
370  Point aPos( rRuler.GetX( lcl_GetRulerPos( nIndex ) ) - rRuler.GetCharWidth() / 2, 0 );
371  css::awt::Rectangle aRect( aPos.X(), aPos.Y(), rRuler.GetCharWidth(), rRuler.GetOutputSizePixel().Height() );
372  // do not return rectangle out of window
373  sal_Int32 nWidth = rRuler.GetOutputSizePixel().Width();
374  if( aRect.X >= nWidth )
375  throw IndexOutOfBoundsException();
376  if( aRect.X + aRect.Width > nWidth )
377  aRect.Width = nWidth - aRect.X;
378  return aRect;
379 }
380 
382 {
383  SolarMutexGuard aGuard;
384  ensureAlive();
385  return implGetTextLength();
386 }
387 
388 sal_Int32 SAL_CALL ScAccessibleCsvRuler::getIndexAtPoint( const css::awt::Point& rPoint )
389 {
390  SolarMutexGuard aGuard;
391  ensureAlive();
392  ScCsvRuler& rRuler = implGetRuler();
393  // use object's coordinate system, convert to API position
394  return lcl_GetApiPos( ::std::min( ::std::max( rRuler.GetPosFromX( rPoint.X ), static_cast<sal_Int32>(0) ), rRuler.GetPosCount() ) );
395 }
396 
398 {
399  ensureAlive();
400  return OUString();
401 }
402 
404 {
405  ensureAlive();
406  return -1;
407 }
408 
410 {
411  ensureAlive();
412  return -1;
413 }
414 
415 sal_Bool SAL_CALL ScAccessibleCsvRuler::setSelection( sal_Int32 /* nStartIndex */, sal_Int32 /* nEndIndex */ )
416 {
417  ensureAlive();
418  return false;
419 }
420 
421 OUString SAL_CALL ScAccessibleCsvRuler::getText()
422 {
423  SolarMutexGuard aGuard;
424  ensureAlive();
425  return OUString( maBuffer.getStr(), implGetTextLength() );
426 }
427 
428 OUString SAL_CALL ScAccessibleCsvRuler::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
429 {
430  SolarMutexGuard aGuard;
431  ensureAlive();
432  ensureValidRange( nStartIndex, nEndIndex );
433  return OUString( maBuffer.getStr() + nStartIndex, nEndIndex - nStartIndex );
434 }
435 
436 TextSegment SAL_CALL ScAccessibleCsvRuler::getTextAtIndex( sal_Int32 nIndex, sal_Int16 nTextType )
437 {
438  SolarMutexGuard aGuard;
439  ensureAlive();
440 
441  TextSegment aResult;
442  aResult.SegmentStart = -1;
443  aResult.SegmentEnd = -1;
444 
445  if( (nIndex == implGetTextLength()) && (nTextType != AccessibleTextType::LINE) )
446  return aResult;
447 
448  ensureValidIndex( nIndex );
449 
450  OUStringBuffer aResultText; // will be assigned to aResult.SegmentText below
451  sal_Int32 nRulerPos = lcl_GetRulerPos( nIndex );
452 
453  switch( nTextType )
454  {
455  // single character
456  case AccessibleTextType::CHARACTER:
457  {
458  aResult.SegmentStart = nIndex;
459  aResultText.append(maBuffer[nIndex]);
460  }
461  break;
462 
463  // entire number or single dot/line
464  case AccessibleTextType::WORD:
465  case AccessibleTextType::GLYPH:
466  aResult.SegmentStart = nIndex;
467  if( nRulerPos % 10 )
468  aResultText.append(maBuffer[nIndex]);
469  else
470  aResultText.append( nRulerPos ); // string representation of sal_Int32!!!
471  break;
472 
473  // entire text
474  case AccessibleTextType::SENTENCE:
475  case AccessibleTextType::PARAGRAPH:
476  case AccessibleTextType::LINE:
477  aResult.SegmentStart = 0;
478  aResultText.append( maBuffer.getStr(), implGetTextLength() );
479  break;
480 
481  // equal-formatted text
482  case AccessibleTextType::ATTRIBUTE_RUN:
483  {
484  sal_Int32 nFirstIndex = implGetFirstEqualFormatted( nIndex );
485  sal_Int32 nLastIndex = implGetLastEqualFormatted( nIndex );
486  aResult.SegmentStart = nFirstIndex;
487  aResultText.append( maBuffer.getStr() + nFirstIndex, nLastIndex - nFirstIndex + 1 );
488  }
489  break;
490 
491  default:
492  throw RuntimeException();
493  }
494 
495  aResult.SegmentText = aResultText.makeStringAndClear();
496  aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength();
497  return aResult;
498 }
499 
500 TextSegment SAL_CALL ScAccessibleCsvRuler::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 nTextType )
501 {
502  SolarMutexGuard aGuard;
503  ensureAlive();
504  ensureValidIndexWithEnd( nIndex );
505 
506  TextSegment aResult;
507  aResult.SegmentStart = -1;
508  aResult.SegmentEnd = -1;
509 
510  sal_Int32 nRulerPos = lcl_GetRulerPos( nIndex );
511 
512  switch( nTextType )
513  {
514  // single character
515  case AccessibleTextType::CHARACTER:
516  if( nIndex > 0 )
517  aResult = getTextAtIndex( nIndex - 1, nTextType );
518  // else empty
519  break;
520 
521  // entire number or single dot/line
522  case AccessibleTextType::WORD:
523  case AccessibleTextType::GLYPH:
524  if( nRulerPos > 0 )
525  aResult = getTextAtIndex( lcl_GetApiPos( nRulerPos - 1 ), nTextType );
526  // else empty
527  break;
528 
529  // entire text
530  case AccessibleTextType::SENTENCE:
531  case AccessibleTextType::PARAGRAPH:
532  case AccessibleTextType::LINE:
533  // empty
534  break;
535 
536  // equal-formatted text
537  case AccessibleTextType::ATTRIBUTE_RUN:
538  {
539  sal_Int32 nFirstIndex = implGetFirstEqualFormatted( nIndex );
540  if( nFirstIndex > 0 )
541  aResult = getTextAtIndex( nFirstIndex - 1, nTextType );
542  // else empty
543  }
544  break;
545 
546  default:
547  throw RuntimeException();
548  }
549  return aResult;
550 }
551 
552 TextSegment SAL_CALL ScAccessibleCsvRuler::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 nTextType )
553 {
554  SolarMutexGuard aGuard;
555  ensureAlive();
556  ensureValidIndexWithEnd( nIndex );
557 
558  TextSegment aResult;
559  aResult.SegmentStart = -1;
560  aResult.SegmentEnd = -1;
561 
562  sal_Int32 nRulerPos = lcl_GetRulerPos( nIndex );
563  sal_Int32 nLastValid = implGetTextLength();
564 
565  switch( nTextType )
566  {
567  // single character
568  case AccessibleTextType::CHARACTER:
569  if( nIndex < nLastValid )
570  aResult = getTextAtIndex( nIndex + 1, nTextType );
571  // else empty
572  break;
573 
574  // entire number or single dot/line
575  case AccessibleTextType::WORD:
576  case AccessibleTextType::GLYPH:
577  if( nRulerPos < implGetRuler().GetPosCount() )
578  aResult = getTextAtIndex( lcl_GetApiPos( nRulerPos + 1 ), nTextType );
579  // else empty
580  break;
581 
582  // entire text
583  case AccessibleTextType::SENTENCE:
584  case AccessibleTextType::PARAGRAPH:
585  case AccessibleTextType::LINE:
586  // empty
587  break;
588 
589  // equal-formatted text
590  case AccessibleTextType::ATTRIBUTE_RUN:
591  {
592  sal_Int32 nLastIndex = implGetLastEqualFormatted( nIndex );
593  if( nLastIndex < nLastValid )
594  aResult = getTextAtIndex( nLastIndex + 1, nTextType );
595  // else empty
596  }
597  break;
598 
599  default:
600  throw RuntimeException();
601  }
602  return aResult;
603 }
604 
605 sal_Bool SAL_CALL ScAccessibleCsvRuler::copyText( sal_Int32 /* nStartIndex */, sal_Int32 /* nEndIndex */ )
606 {
607  ensureAlive();
608  return false;
609 }
610 
611 sal_Bool SAL_CALL ScAccessibleCsvRuler::scrollSubstringTo( sal_Int32 /* nStartIndex */, sal_Int32/* nEndIndex */, AccessibleScrollType /* aScrollType */ )
612 {
613  return false;
614 }
615 
616 // XInterface -----------------------------------------------------------------
617 
618 Any SAL_CALL ScAccessibleCsvRuler::queryInterface( const css::uno::Type& rType )
619 {
621  return aAny.hasValue() ? aAny : ScAccessibleCsvControl::queryInterface( rType );
622 }
623 
624 void SAL_CALL ScAccessibleCsvRuler::acquire() throw ()
625 {
626  ScAccessibleCsvControl::acquire();
627 }
628 
629 void SAL_CALL ScAccessibleCsvRuler::release() throw ()
630 {
631  ScAccessibleCsvControl::release();
632 }
633 
634 // XTypeProvider --------------------------------------------------------------
635 
636 Sequence< css::uno::Type > SAL_CALL ScAccessibleCsvRuler::getTypes()
637 {
638  return ::comphelper::concatSequences( ScAccessibleCsvControl::getTypes(),
639  Sequence { cppu::UnoType<XAccessibleText>::get() });
640 }
641 
643 {
644  return css::uno::Sequence<sal_Int8>();
645 }
646 
647 // events ---------------------------------------------------------------------
648 
650 {
651  sal_Int32 nPos = implGetRuler().GetRulerCursorPos();
652  if (nPos != CSV_POS_INVALID)
653  {
654  Any aOldValue, aNewValue;
655  aNewValue <<= nPos;
656  NotifyAccessibleEvent( AccessibleEventId::CARET_CHANGED, aOldValue, aNewValue );
657  }
658 }
659 
660 // helpers --------------------------------------------------------------------
661 
663 {
664  return ScResId( STR_ACC_CSVRULER_NAME );
665 }
666 
668 {
669  return ScResId( STR_ACC_CSVRULER_DESCR );
670 }
671 
672 void ScAccessibleCsvRuler::ensureValidIndex( sal_Int32 nIndex ) const
673 {
674  if( (nIndex < 0) || (nIndex >= implGetTextLength()) )
675  throw IndexOutOfBoundsException();
676 }
677 
678 void ScAccessibleCsvRuler::ensureValidIndexWithEnd( sal_Int32 nIndex ) const
679 {
680  if( (nIndex < 0) || (nIndex > implGetTextLength()) )
681  throw IndexOutOfBoundsException();
682 }
683 
684 void ScAccessibleCsvRuler::ensureValidRange( sal_Int32& rnStartIndex, sal_Int32& rnEndIndex ) const
685 {
686  if( rnStartIndex > rnEndIndex )
687  ::std::swap( rnStartIndex, rnEndIndex );
688  if( (rnStartIndex < 0) || (rnEndIndex > implGetTextLength()) )
689  throw IndexOutOfBoundsException();
690 }
691 
693 {
694  return static_cast< ScCsvRuler& >( implGetControl() );
695 }
696 
698 {
699  SolarMutexGuard aGuard;
700  ensureAlive();
701  // extend existing string buffer to new ruler size
702  sal_Int32 nRulerCount = implGetRuler().GetPosCount();
703  sal_Int32 nRulerPos = lcl_GetRulerPos( maBuffer.getLength() );
704  for( ; nRulerPos <= nRulerCount; ++nRulerPos ) // include last position
705  {
706  switch( nRulerPos % 10 )
707  {
708  case 0: maBuffer.append( nRulerPos ); break;
709  case 5: maBuffer.append( cRulerLine ); break;
710  default: maBuffer.append( cRulerDot );
711  }
712  }
713 }
714 
716 {
717  return lcl_GetApiPos( implGetRuler().GetPosCount() + 1 );
718 }
719 
720 bool ScAccessibleCsvRuler::implHasSplit( sal_Int32 nApiPos )
721 {
722  sal_Int32 nRulerPos = lcl_GetRulerPos( nApiPos );
723  return implGetRuler().HasSplit( nRulerPos ) && (nApiPos == lcl_GetApiPos( nRulerPos ));
724 }
725 
727 {
728  bool bSplit = implHasSplit( nApiPos );
729  while( (nApiPos > 0) && (implHasSplit( nApiPos - 1 ) == bSplit) )
730  --nApiPos;
731  return nApiPos;
732 }
733 
735 {
736  bool bSplit = implHasSplit( nApiPos );
737  sal_Int32 nLength = implGetTextLength();
738  while( (nApiPos < nLength - 1) && (implHasSplit( nApiPos + 1 ) == bSplit) )
739  ++nApiPos;
740  return nApiPos;
741 }
742 
743 css::uno::Reference<css::accessibility::XAccessible> SAL_CALL ScAccessibleCsvRuler::getAccessibleParent()
744 {
746 }
747 
748 // Grid =======================================================================
749 
751 static sal_Int32 lcl_GetApiColumn( sal_uInt32 nGridColumn )
752 {
753  return (nGridColumn != CSV_COLUMN_HEADER) ? static_cast< sal_Int32 >( nGridColumn + 1 ) : 0;
754 }
755 
757 static sal_uInt32 lcl_GetGridColumn( sal_Int32 nApiColumn )
758 {
759  return (nApiColumn > 0) ? static_cast< sal_uInt32 >( nApiColumn - 1 ) : CSV_COLUMN_HEADER;
760 }
761 
763  : ScAccessibleCsvControl(rGrid)
764 {
765 }
766 
768 {
769  ensureDisposed();
770 }
771 
773 {
774  SolarMutexGuard aGuard;
775  for (auto& rEntry : maAccessibleChildren)
776  rEntry.second->dispose();
777  maAccessibleChildren.clear();
779 }
780 
781 // XAccessibleComponent -------------------------------------------------------
782 
783 Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleAtPoint( const css::awt::Point& rPoint )
784 {
785  Reference< XAccessible > xRet;
786  if( containsPoint( rPoint ) )
787  {
788  SolarMutexGuard aGuard;
789  ensureAlive();
790 
791  const ScCsvGrid& rGrid = implGetGrid();
792  // #102679#; use <= instead of <, because the offset is the size and not the point
793  sal_Int32 nColumn = ((rGrid.GetFirstX() <= rPoint.X) && (rPoint.X <= rGrid.GetLastX())) ?
794  lcl_GetApiColumn( rGrid.GetColumnFromX( rPoint.X ) ) : 0;
795  sal_Int32 nRow = (rPoint.Y >= rGrid.GetHdrHeight()) ?
796  (rGrid.GetLineFromY( rPoint.Y ) - rGrid.GetFirstVisLine() + 1) : 0;
797  xRet = getAccessibleCell(nRow, nColumn);
798  }
799  return xRet;
800 }
801 
803 {
804  SolarMutexGuard aGuard;
805  ensureAlive();
806  return sal_Int32(Application::GetSettings().GetStyleSettings().GetButtonTextColor());
807 }
808 
810 {
811  SolarMutexGuard aGuard;
812  ensureAlive();
813  return sal_Int32(SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor);
814 }
815 
816 // XAccessibleContext ---------------------------------------------------------
817 
819 {
820  SolarMutexGuard aGuard;
821  ensureAlive();
822  return implGetCellCount();
823 }
824 
825 Reference<XAccessible> ScAccessibleCsvGrid::getAccessibleCell(sal_Int32 nRow, sal_Int32 nColumn)
826 {
827  sal_Int32 nIndex = implGetIndex(nRow, nColumn);
828 
829  XAccessibleSet::iterator aI = maAccessibleChildren.lower_bound(nIndex);
830  if (aI != maAccessibleChildren.end() && !(maAccessibleChildren.key_comp()(nIndex, aI->first)))
831  {
832  // key already exists
833  return Reference<XAccessible>(aI->second.get());
834  }
835  // key does not exist
837  maAccessibleChildren.insert(aI, XAccessibleSet::value_type(nIndex, xNew));
838  return Reference<XAccessible>(xNew.get());
839 }
840 
841 Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleChild( sal_Int32 nIndex )
842 {
843  SolarMutexGuard aGuard;
844  ensureAlive();
845  ensureValidIndex( nIndex );
846 
847  return getAccessibleCell(implGetRow(nIndex), implGetColumn(nIndex));
848 }
849 
850 Reference< XAccessibleRelationSet > SAL_CALL ScAccessibleCsvGrid::getAccessibleRelationSet()
851 {
852  SolarMutexGuard aGuard;
853  ensureAlive();
854  AccessibleRelationSetHelper* pRelationSet = new AccessibleRelationSetHelper();
855 
856  ScCsvGrid& rGrid = implGetGrid();
857  ScCsvTableBox* pTableBox = rGrid.GetTableBox();
858  ScCsvRuler& rRuler = pTableBox->GetRuler();
859 
860  if (rRuler.IsVisible())
861  {
862  css::uno::Reference<css::accessibility::XAccessible> xAccObj(static_cast<ScAccessibleCsvGrid*>(rRuler.GetAccessible()));
863  if( xAccObj.is() )
864  {
865  Sequence< Reference< XInterface > > aSeq( 1 );
866  aSeq[ 0 ] = xAccObj;
867  pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::CONTROLLED_BY, aSeq ) );
868  }
869  }
870 
871  return pRelationSet;
872 }
873 
874 Reference< XAccessibleStateSet > SAL_CALL ScAccessibleCsvGrid::getAccessibleStateSet()
875 {
876  SolarMutexGuard aGuard;
877  AccessibleStateSetHelper* pStateSet = implCreateStateSet();
878  if( isAlive() )
879  {
880  pStateSet->AddState( AccessibleStateType::FOCUSABLE );
881  pStateSet->AddState( AccessibleStateType::MULTI_SELECTABLE );
882  pStateSet->AddState( AccessibleStateType::MANAGES_DESCENDANTS );
883  if( implGetGrid().HasFocus() )
884  pStateSet->AddState( AccessibleStateType::FOCUSED );
885  }
886  else
887  pStateSet->AddState( AccessibleStateType::DEFUNC );
888  return pStateSet;
889 }
890 
891 // XAccessibleTable -----------------------------------------------------------
892 
894 {
895  SolarMutexGuard aGuard;
896  ensureAlive();
897  return implGetRowCount();
898 }
899 
901 {
902  SolarMutexGuard aGuard;
903  ensureAlive();
904  return implGetColumnCount();
905 }
906 
907 OUString SAL_CALL ScAccessibleCsvGrid::getAccessibleRowDescription( sal_Int32 nRow )
908 {
909  SolarMutexGuard aGuard;
910  ensureAlive();
911  ensureValidPosition( nRow, 0 );
912  return implGetCellText( nRow, 0 );
913 }
914 
915 OUString SAL_CALL ScAccessibleCsvGrid::getAccessibleColumnDescription( sal_Int32 nColumn )
916 {
917  SolarMutexGuard aGuard;
918  ensureAlive();
919  ensureValidPosition( 0, nColumn );
920  return implGetCellText( 0, nColumn );
921 }
922 
923 sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
924 {
925  ensureAlive();
926  ensureValidPosition( nRow, nColumn );
927  return 1;
928 }
929 
930 sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
931 {
932  ensureAlive();
933  ensureValidPosition( nRow, nColumn );
934  return 1;
935 }
936 
937 Reference< XAccessibleTable > SAL_CALL ScAccessibleCsvGrid::getAccessibleRowHeaders()
938 {
939  ensureAlive();
940  return nullptr;
941 }
942 
943 Reference< XAccessibleTable > SAL_CALL ScAccessibleCsvGrid::getAccessibleColumnHeaders()
944 {
945  ensureAlive();
946  return nullptr;
947 }
948 
949 Sequence< sal_Int32 > SAL_CALL ScAccessibleCsvGrid::getSelectedAccessibleRows()
950 {
951  ensureAlive();
952  return Sequence< sal_Int32 >();
953 }
954 
956 {
957  SolarMutexGuard aGuard;
958  ensureAlive();
959 
960  ScCsvGrid& rGrid = implGetGrid();
961  Sequence< sal_Int32 > aSeq( implGetColumnCount() );
962 
963  sal_Int32 nSeqIx = 0;
964  sal_uInt32 nColIx = rGrid.GetFirstSelected();
965  for( ; nColIx != CSV_COLUMN_INVALID; ++nSeqIx, nColIx = rGrid.GetNextSelected( nColIx ) )
966  aSeq[ nSeqIx ] = lcl_GetApiColumn( nColIx );
967 
968  aSeq.realloc( nSeqIx );
969  return aSeq;
970 }
971 
973 {
974  ensureAlive();
975  return false;
976 }
977 
979 {
980  SolarMutexGuard aGuard;
981  ensureAlive();
982  ensureValidIndex( nColumn );
983  return implIsColumnSelected( nColumn );
984 }
985 
986 Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
987 {
988  SolarMutexGuard aGuard;
989  ensureAlive();
990  ensureValidPosition( nRow, nColumn );
991  return getAccessibleCell(nRow, nColumn);
992 }
993 
994 Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleCaption()
995 {
996  ensureAlive();
997  return nullptr;
998 }
999 
1000 Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleSummary()
1001 {
1002  ensureAlive();
1003  return nullptr;
1004 }
1005 
1006 sal_Bool SAL_CALL ScAccessibleCsvGrid::isAccessibleSelected( sal_Int32 /* nRow */, sal_Int32 nColumn )
1007 {
1008  return isAccessibleColumnSelected( nColumn );
1009 }
1010 
1011 sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
1012 {
1013  SolarMutexGuard aGuard;
1014  ensureAlive();
1015  ensureValidPosition( nRow, nColumn );
1016  return implGetIndex( nRow, nColumn );
1017 }
1018 
1019 sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleRow( sal_Int32 nChildIndex )
1020 {
1021  SolarMutexGuard aGuard;
1022  ensureAlive();
1023  ensureValidIndex( nChildIndex );
1024  return implGetRow( nChildIndex );
1025 }
1026 
1027 sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleColumn( sal_Int32 nChildIndex )
1028 {
1029  SolarMutexGuard aGuard;
1030  ensureAlive();
1031  ensureValidIndex( nChildIndex );
1032  return implGetColumn( nChildIndex );
1033 }
1034 
1035 // XAccessibleSelection -------------------------------------------------------
1036 
1037 void SAL_CALL ScAccessibleCsvGrid::selectAccessibleChild( sal_Int32 nChildIndex )
1038 {
1039  SolarMutexGuard aGuard;
1040  ensureAlive();
1041  ensureValidIndex( nChildIndex );
1042  sal_Int32 nColumn = implGetColumn( nChildIndex );
1043  if( nChildIndex == 0 )
1044  implGetGrid().SelectAll();
1045  else
1046  implSelectColumn( nColumn, true );
1047 }
1048 
1050 {
1051  SolarMutexGuard aGuard;
1052  ensureAlive();
1053  ensureValidIndex( nChildIndex );
1054  sal_Int32 nColumn = implGetColumn( nChildIndex );
1055  return implIsColumnSelected( nColumn );
1056 }
1057 
1059 {
1060  SolarMutexGuard aGuard;
1061  ensureAlive();
1062  implGetGrid().SelectAll( false );
1063 }
1064 
1066 {
1067  selectAccessibleChild( 0 );
1068 }
1069 
1071 {
1072  SolarMutexGuard aGuard;
1073  ensureAlive();
1075 }
1076 
1077 Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
1078 {
1079  SolarMutexGuard aGuard;
1080  ensureAlive();
1081  sal_Int32 nColumns = implGetSelColumnCount();
1082  if( nColumns == 0 )
1083  throw IndexOutOfBoundsException();
1084 
1085  sal_Int32 nRow = nSelectedChildIndex / nColumns;
1086  sal_Int32 nColumn = implGetSelColumn( nSelectedChildIndex % nColumns );
1087  return getAccessibleCellAt( nRow, nColumn );
1088 }
1089 
1090 void SAL_CALL ScAccessibleCsvGrid::deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
1091 {
1092  SolarMutexGuard aGuard;
1093  ensureAlive();
1094  sal_Int32 nColumns = implGetSelColumnCount();
1095  if( nColumns == 0 )
1096  throw IndexOutOfBoundsException();
1097 
1098  sal_Int32 nColumn = implGetSelColumn( nSelectedChildIndex % nColumns );
1099  ensureValidPosition( nSelectedChildIndex / nColumns, nColumn );
1100  if( nColumn > 0 )
1101  implSelectColumn( nColumn, false );
1102 }
1103 
1104 // XInterface -----------------------------------------------------------------
1105 
1106 Any SAL_CALL ScAccessibleCsvGrid::queryInterface( const css::uno::Type& rType )
1107 {
1109  return aAny.hasValue() ? aAny : ScAccessibleCsvControl::queryInterface( rType );
1110 }
1111 
1112 void SAL_CALL ScAccessibleCsvGrid::acquire() throw ()
1113 {
1114  ScAccessibleCsvControl::acquire();
1115 }
1116 
1117 void SAL_CALL ScAccessibleCsvGrid::release() throw ()
1118 {
1119  ScAccessibleCsvControl::release();
1120 }
1121 
1122 // XTypeProvider --------------------------------------------------------------
1123 
1124 Sequence< css::uno::Type > SAL_CALL ScAccessibleCsvGrid::getTypes()
1125 {
1126  return ::comphelper::concatSequences( ScAccessibleCsvControl::getTypes(),
1127  Sequence {
1130 }
1131 
1133 {
1134  return css::uno::Sequence<sal_Int8>();
1135 }
1136 
1137 // events ---------------------------------------------------------------------
1138 
1140 {
1142  Any aOldAny, aNewAny;
1143  (bFocused ? aNewAny : aOldAny) <<=
1144  getAccessibleCellAt( 0, lcl_GetApiColumn( implGetGrid().GetFocusColumn() ) );
1145  NotifyAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny);
1146 }
1147 
1148 void ScAccessibleCsvGrid::SendTableUpdateEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn, bool bAllRows )
1149 {
1150  if( nFirstColumn <= nLastColumn )
1151  {
1152  AccessibleTableModelChange aModelChange(
1153  AccessibleTableModelChangeType::UPDATE, 0, bAllRows ? implGetRowCount() - 1 : 0,
1154  lcl_GetApiColumn( nFirstColumn ), lcl_GetApiColumn( nLastColumn ) );
1155  Any aOldAny, aNewAny;
1156  aNewAny <<= aModelChange;
1157  NotifyAccessibleEvent(AccessibleEventId::TABLE_MODEL_CHANGED, aOldAny, aNewAny);
1158  }
1159 }
1160 
1161 void ScAccessibleCsvGrid::SendInsertColumnEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn )
1162 {
1163  if( nFirstColumn <= nLastColumn )
1164  {
1165  AccessibleTableModelChange aModelChange(
1166  AccessibleTableModelChangeType::INSERT, 0, implGetRowCount() - 1,
1167  lcl_GetApiColumn( nFirstColumn ), lcl_GetApiColumn( nLastColumn ) );
1168  Any aOldAny, aNewAny;
1169  aNewAny <<= aModelChange;
1170  NotifyAccessibleEvent(AccessibleEventId::TABLE_MODEL_CHANGED, aOldAny, aNewAny);
1171  }
1172 }
1173 
1174 void ScAccessibleCsvGrid::SendRemoveColumnEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn )
1175 {
1176  if( nFirstColumn <= nLastColumn )
1177  {
1178  AccessibleTableModelChange aModelChange(
1179  AccessibleTableModelChangeType::DELETE, 0, implGetRowCount() - 1,
1180  lcl_GetApiColumn( nFirstColumn ), lcl_GetApiColumn( nLastColumn ) );
1181  Any aOldAny, aNewAny;
1182  aNewAny <<= aModelChange;
1183  NotifyAccessibleEvent(AccessibleEventId::TABLE_MODEL_CHANGED, aOldAny, aNewAny);
1184  }
1185 }
1186 
1187 // helpers --------------------------------------------------------------------
1188 
1190 {
1191  return ScResId( STR_ACC_CSVGRID_NAME );
1192 }
1193 
1195 {
1196  return ScResId( STR_ACC_CSVGRID_DESCR );
1197 }
1198 
1199 void ScAccessibleCsvGrid::ensureValidIndex( sal_Int32 nIndex ) const
1200 {
1201  if( (nIndex < 0) || (nIndex >= implGetCellCount()) )
1202  throw IndexOutOfBoundsException();
1203 }
1204 
1205 void ScAccessibleCsvGrid::ensureValidPosition( sal_Int32 nRow, sal_Int32 nColumn ) const
1206 {
1207  if( (nRow < 0) || (nRow >= implGetRowCount()) || (nColumn < 0) || (nColumn >= implGetColumnCount()) )
1208  throw IndexOutOfBoundsException();
1209 }
1210 
1212 {
1213  return static_cast< ScCsvGrid& >( implGetControl() );
1214 }
1215 
1216 bool ScAccessibleCsvGrid::implIsColumnSelected( sal_Int32 nColumn ) const
1217 {
1218  return (nColumn > 0) && implGetGrid().IsSelected( lcl_GetGridColumn( nColumn ) );
1219 }
1220 
1221 void ScAccessibleCsvGrid::implSelectColumn( sal_Int32 nColumn, bool bSelect )
1222 {
1223  if( nColumn > 0 )
1224  implGetGrid().Select( lcl_GetGridColumn( nColumn ), bSelect );
1225 }
1226 
1228 {
1229  return static_cast< sal_Int32 >( implGetGrid().GetLastVisLine() - implGetGrid().GetFirstVisLine() + 2 );
1230 }
1231 
1233 {
1234  return static_cast< sal_Int32 >( implGetGrid().GetColumnCount() + 1 );
1235 }
1236 
1238 {
1239  ScCsvGrid& rGrid = implGetGrid();
1240  sal_Int32 nCount = 0;
1241  for( sal_uInt32 nColIx = rGrid.GetFirstSelected(); nColIx != CSV_COLUMN_INVALID; nColIx = rGrid.GetNextSelected( nColIx ) )
1242  ++nCount;
1243  return nCount;
1244 }
1245 
1246 sal_Int32 ScAccessibleCsvGrid::implGetSelColumn( sal_Int32 nSelColumn ) const
1247 {
1248  ScCsvGrid& rGrid = implGetGrid();
1249  sal_Int32 nColumn = 0;
1250  for( sal_uInt32 nColIx = rGrid.GetFirstSelected(); nColIx != CSV_COLUMN_INVALID; nColIx = rGrid.GetNextSelected( nColIx ) )
1251  {
1252  if( nColumn == nSelColumn )
1253  return static_cast< sal_Int32 >( nColIx + 1 );
1254  ++nColumn;
1255  }
1256  return 0;
1257 }
1258 
1259 OUString ScAccessibleCsvGrid::implGetCellText( sal_Int32 nRow, sal_Int32 nColumn ) const
1260 {
1261  ScCsvGrid& rGrid = implGetGrid();
1262  sal_Int32 nLine = nRow + rGrid.GetFirstVisLine() - 1;
1263  OUString aCellStr;
1264  if( (nColumn > 0) && (nRow > 0) )
1265  aCellStr = rGrid.GetCellText( lcl_GetGridColumn( nColumn ), nLine );
1266  else if( nRow > 0 )
1267  aCellStr = OUString::number( nLine + 1 );
1268  else if( nColumn > 0 )
1269  aCellStr = rGrid.GetColumnTypeName( lcl_GetGridColumn( nColumn ) );
1270  return aCellStr;
1271 }
1272 
1274 {
1275  return new ScAccessibleCsvCell(implGetGrid(), implGetCellText(nRow, nColumn), nRow, nColumn);
1276 }
1277 
1278 css::uno::Reference<css::accessibility::XAccessible> SAL_CALL ScAccessibleCsvGrid::getAccessibleParent()
1279 {
1281 }
1282 
1284  ScCsvGrid& rGrid,
1285  const OUString& rCellText,
1286  sal_Int32 nRow, sal_Int32 nColumn ) :
1287  ScAccessibleCsvControl( rGrid ),
1288  AccessibleStaticTextBase( SvxEditSourcePtr() ),
1289  maCellText( rCellText ),
1290  mnLine( nRow ? (nRow + rGrid.GetFirstVisLine() - 1) : CSV_LINE_HEADER ),
1291  mnColumn( lcl_GetGridColumn( nColumn ) ),
1292  mnIndex( nRow * (rGrid.GetColumnCount() + 1) + nColumn )
1293 {
1295 }
1296 
1298 {
1299 }
1300 
1302 {
1303  SolarMutexGuard aGuard;
1306 }
1307 
1308 // XAccessibleComponent -------------------------------------------------------
1309 
1311 {
1312  SolarMutexGuard aGuard;
1313  ensureAlive();
1314  ScCsvGrid& rGrid = implGetGrid();
1316 }
1317 
1319 {
1320  SolarMutexGuard aGuard;
1321  ensureAlive();
1322  return sal_Int32(Application::GetSettings().GetStyleSettings().GetButtonTextColor());
1323 }
1324 
1326 {
1327  SolarMutexGuard aGuard;
1328  ensureAlive();
1329  return sal_Int32(SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor);
1330 }
1331 
1332 // XAccessibleContext -----------------------------------------------------
1333 
1335 {
1336  return AccessibleStaticTextBase::getAccessibleChildCount();
1337 }
1338 
1339 Reference< XAccessible > SAL_CALL ScAccessibleCsvCell::getAccessibleChild( sal_Int32 nIndex )
1340 {
1341  return AccessibleStaticTextBase::getAccessibleChild( nIndex );
1342 }
1343 
1345 {
1346  SolarMutexGuard aGuard;
1347  ensureAlive();
1348  return mnIndex;
1349 }
1350 
1351 Reference< XAccessibleRelationSet > SAL_CALL ScAccessibleCsvCell::getAccessibleRelationSet()
1352 {
1353  SolarMutexGuard aGuard;
1354  ensureAlive();
1355  return new AccessibleRelationSetHelper();
1356 }
1357 
1358 Reference< XAccessibleStateSet > SAL_CALL ScAccessibleCsvCell::getAccessibleStateSet()
1359 {
1360  SolarMutexGuard aGuard;
1361  AccessibleStateSetHelper* pStateSet = implCreateStateSet();
1362  if( isAlive() )
1363  {
1364  const ScCsvGrid& rGrid = implGetGrid();
1365  pStateSet->AddState( AccessibleStateType::SINGLE_LINE );
1366  if( mnColumn != CSV_COLUMN_HEADER )
1367  pStateSet->AddState( AccessibleStateType::SELECTABLE );
1368  if( rGrid.HasFocus() && (rGrid.GetFocusColumn() == mnColumn) && (mnLine == CSV_LINE_HEADER) )
1369  pStateSet->AddState( AccessibleStateType::ACTIVE );
1370  if( rGrid.IsSelected( mnColumn ) )
1371  pStateSet->AddState( AccessibleStateType::SELECTED );
1372  }
1373  return pStateSet;
1374 }
1375 
1376 // XInterface -----------------------------------------------------------------
1377 
1379 
1380 // XTypeProvider --------------------------------------------------------------
1381 
1382 IMPLEMENT_FORWARD_XTYPEPROVIDER2( ScAccessibleCsvCell, ScAccessibleCsvControl, AccessibleStaticTextBase )
1383 
1384 // helpers --------------------------------------------------------------------
1385 
1386 OUString SAL_CALL ScAccessibleCsvCell::getAccessibleName()
1387 {
1388  return maCellText;
1389 }
1390 
1392 {
1393  return OUString();
1394 }
1395 
1397 {
1398  return static_cast< ScCsvGrid& >( implGetControl() );
1399 }
1400 
1402 {
1403  ScCsvGrid& rGrid = implGetGrid();
1404  return Point(
1405  (mnColumn == CSV_COLUMN_HEADER) ? rGrid.GetHdrX() : rGrid.GetColumnX( mnColumn ),
1406  (mnLine == CSV_LINE_HEADER) ? 0 : rGrid.GetY( mnLine ) );
1407 }
1408 
1409 sal_uInt32 ScAccessibleCsvCell::implCalcPixelWidth(sal_uInt32 nChars) const
1410 {
1411  ScCsvGrid& rGrid = implGetGrid();
1412  return rGrid.GetCharWidth() * nChars;
1413 }
1414 
1416 {
1417  ScCsvGrid& rGrid = implGetGrid();
1418  return Size(
1420  (mnLine == CSV_LINE_HEADER) ? rGrid.GetHdrHeight() : rGrid.GetLineHeight() );
1421 }
1422 
1424 {
1425  ScCsvGrid& rGrid = implGetGrid();
1426  tools::Rectangle aClipRect( Point( 0, 0 ), rGrid.GetOutputSizePixel() );
1427  if( mnColumn != CSV_COLUMN_HEADER )
1428  {
1429  aClipRect.SetLeft( rGrid.GetFirstX() );
1430  aClipRect.SetRight( rGrid.GetLastX() );
1431  }
1432  if( mnLine != CSV_LINE_HEADER )
1433  aClipRect.SetTop( rGrid.GetHdrHeight() );
1434 
1436  aRect.Intersection( aClipRect );
1437  if( aRect.IsEmpty() )
1438  aRect.SetSize( Size( -1, -1 ) );
1439 
1440  return css::awt::Rectangle(aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight());
1441 }
1442 
1443 ::std::unique_ptr< SvxEditSource > ScAccessibleCsvCell::implCreateEditSource()
1444 {
1445  ScCsvGrid& rGrid = implGetGrid();
1446 
1447  ::std::unique_ptr< SvxEditSource > pEditSource( new ScAccessibilityEditSource( std::make_unique<ScAccessibleCsvTextData>(&rGrid.GetDrawingArea()->get_ref_device(), rGrid.GetEditEngine(), maCellText, implGetRealSize()) ) );
1448  return pEditSource;
1449 }
1450 
1451 css::uno::Reference<css::accessibility::XAccessible> SAL_CALL ScAccessibleCsvCell::getAccessibleParent()
1452 {
1453  ScCsvGrid& rGrid = implGetGrid();
1454 
1455  ScAccessibleCsvGrid* pAcc = static_cast<ScAccessibleCsvGrid*>(rGrid.GetAccessible());
1456 
1457  return pAcc;
1458 }
1459 
1460 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~ScAccessibleCsvControl() override
virtual void SendInsertColumnEvent(sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn) override
Sends a table model changed event for an inserted column to all listeners.
Change data line pixel height. [height in pixel}.
Definition: csvcontrol.hxx:179
bool implIsColumnSelected(sal_Int32 nColumn) const
Returns true, if the specified column (including header) is selected.
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
virtual sal_Int32 SAL_CALL getBackground() override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders() override
Returns the column headers as an AccessibleTable.
static void lcl_FillProperty(PropertyValue &rVal, const OUString &rPropName, const SfxPoolItem &rItem, sal_uInt8 nMID)
Fills the property value rVal with the specified name and value from the item.
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
ScCsvGrid & implGetGrid() const
Returns the VCL grid control.
sal_Int32 nIndex
virtual sal_Int32 SAL_CALL getForeground() override
virtual sal_Bool SAL_CALL scrollSubstringTo(sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Returns the relation to the ruler control.
static sal_uInt32 lcl_GetGridColumn(sal_Int32 nApiColumn)
Converts an API columnm index to a ScCsvGrid column index.
const OUString & GetFamilyName() const
virtual sal_Int32 SAL_CALL getAccessibleColumnCount() override
Returns the number of columns in the table.
const sal_Int32 CSV_POS_INVALID
Constant for an invalid ruler position.
Definition: csvsplits.hxx:30
tools::Rectangle & Intersection(const tools::Rectangle &rRect)
virtual sal_Bool SAL_CALL isAccessibleRowSelected(sal_Int32 nRow) override
Returns true, if the specified row is selected.
virtual void SAL_CALL grabFocus() override
Sets the focus to the column of this cell.
sal_Int32 GetPosCount() const
Returns the number of available positions.
Definition: csvcontrol.hxx:302
virtual a11yref get_accessible_parent()=0
virtual void SAL_CALL clearAccessibleSelection() override
Deselects all cells.
const OUString & GetStyleName() const
virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt(sal_Int32 nRow, sal_Int32 nColumn) override
Returns the number of rows occupied at a specified row and column.
virtual void SendFocusEvent(bool bFocused)
Sends a GetFocus or LoseFocus event to all listeners.
virtual sal_Int32 SAL_CALL getSelectionEnd() override
Returns the end index of the selection (ruler returns -1).
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Returns a sequence with all supported interface types.
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders() override
Returns the row headers as an AccessibleTable.
sal_Int32 GetLineHeight() const
Returns the height of one line.
Definition: csvcontrol.hxx:351
sal_Int32 GetX(sal_Int32 nPos) const
Returns output X coordinate of the specified position.
Definition: csvcontrol.cxx:195
virtual sal_Int32 SAL_CALL getAccessibleIndex(sal_Int32 nRow, sal_Int32 nColumn) override
Returns the child index of the cell at the specified position.
virtual sal_Bool SAL_CALL isAccessibleSelected(sal_Int32 nRow, sal_Int32 nColumn) override
Returns true, if the cell at a specified position is selected.
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
Returns the child count.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
Returns the specified child.
constexpr TypedWhichId< SvxLanguageItem > ATTR_FONT_LANGUAGE(110)
static const AllSettings & GetSettings()
virtual sal_Int32 SAL_CALL getIndexAtPoint(const css::awt::Point &rPoint) override
Returns the character index at the specified coordinate (object's coordinate system).
virtual void SendInsertColumnEvent(sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn)
Sends a table model changed event for an inserted column to all listeners.
virtual void SendRemoveColumnEvent(sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn) override
Sends a table model changed event for a removed column to all listeners.
virtual void SAL_CALL disposing() override
Accessible class representing the CSV grid control.
virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt(sal_Int32 nRow, sal_Int32 nColumn) override
Returns the number of rows occupied at a specified row and column.
virtual OUString SAL_CALL getAccessibleDescription() override
virtual sal_Int32 SAL_CALL getSelectionStart() override
Returns the start index of the selection (ruler returns -1).
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Returns an implementation ID.
void ensureValidIndex(sal_Int32 nIndex) const
tools::Long GetWidth() const
virtual void SAL_CALL disposing() override
sal_Int32 GetHdrHeight() const
Returns the height of the header line.
Definition: csvcontrol.hxx:349
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
Accessible class representing a cell of the CSV grid control.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override
Returns the index of this cell in the table.
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes(sal_Int32 nIndex, const css::uno::Sequence< OUString > &aRequestedAttributes) override
Returns the attributes of the specified character.
virtual OUString SAL_CALL getAccessibleRowDescription(sal_Int32 nRow) override
Returns the description of the specified row in the table.
virtual OUString SAL_CALL getSelectedText() override
Returns the selected text (ruler returns empty string).
void ensureValidIndex(sal_Int32 nIndex) const
static void lcl_FillFontAttributes(Sequence< PropertyValue > &rSeq, const vcl::Font &rFont)
Fills the sequence with all font attributes of rFont.
void ensureValidRange(sal_Int32 &rnStartIndex, sal_Int32 &rnEndIndex) const
Base class for the CSV ruler and the data grid control.
Definition: csvcontrol.hxx:224
virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) override
Selects the specified child (selects the entire column or the entire table).
virtual OUString SAL_CALL getText() override
Returns the entire text.
Accessible base class used for CSV controls.
virtual void SAL_CALL acquire() override
sal_Int32 implGetCellCount() const
Returns the total cell count in the table (including header).
A ruler control for the CSV import dialog.
Definition: csvruler.hxx:34
Move ruler cursor to new position. [position].
Definition: csvcontrol.hxx:180
Size const & GetOutputSizePixel() const
FontFamily GetFamilyType()
XAccessibleSet maAccessibleChildren
static sal_Int32 lcl_GetApiPos(sal_Int32 nRulerPos)
Converts a ruler cursor position to API text index.
virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
Returns the specified range [Start,End) of the text.
sal_Int32 implGetColumn(sal_Int32 nIndex) const
Returns the column index from cell index (including header).
ScCsvTableBox * GetTableBox()
Definition: csvruler.hxx:63
bool IsEmpty() const
css::uno::Reference< css::accessibility::XAccessible > getAccessibleCell(sal_Int32 nRow, sal_Int32 nColumn)
void implSelectColumn(sal_Int32 nColumn, bool bSelect)
Selects the specified column (including header).
sal_uInt32 mnColumn
The grid line index (core index).
LanguageType GetLanguage() const
#define MID_FONT_FAMILY
void SelectAll(bool bSelect=true)
Selects or deselects all columns.
Definition: csvgrid.cxx:690
void SendSelectionEvent()
Sends a selection changed event to all listeners.
sal_uInt16 sal_Unicode
#define MID_FONT_FAMILY_NAME
ScAccessibleCsvRuler(ScCsvRuler &rRuler)
Contains the text representation of the ruler.
virtual OUString SAL_CALL getAccessibleName() override
sal_Int32 GetLastX() const
Returns the X position of the last pixel of the data area.
Definition: csvcontrol.cxx:190
#define MID_LANG_LOCALE
tools::Long Left() const
sal_Int32 GetY(sal_Int32 nLine) const
Returns output Y coordinate of the specified line.
Definition: csvcontrol.cxx:230
Point implGetRealPos() const
Returns the pixel position of the cell (rel.
void SetLeft(tools::Long v)
static sal_Int32 lcl_ExpandSequence(Sequence< PropertyValue > &rSeq, sal_Int32 nExp)
Expands the sequence's size and returns the base index of the new inserted elements.
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
sal_Int32 GetCharWidth() const
Returns the width of one character column.
Definition: csvcontrol.hxx:320
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual OUString SAL_CALL getAccessibleDescription() override
ScCsvGrid & implGetGrid() const
Returns the VCL grid control.
virtual sal_Int32 SAL_CALL getBackground() override
int nCount
ScAccessibleCsvControl * GetAccessible()
Definition: csvcontrol.hxx:260
EditEngine * GetEditEngine()
Returns a pointer to the used edit engine.
Definition: csvgrid.cxx:1083
virtual sal_Bool SAL_CALL setCaretPosition(sal_Int32 nIndex) override
Sets the position of the caret.
void Select(sal_uInt32 nColIndex, bool bSelect=true)
Selects or deselects the specified column.
Definition: csvgrid.cxx:644
ScCsvRuler & implGetRuler() const
Returns the VCL ruler control.
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
Returns the current set of states.
virtual OutputDevice & get_ref_device()=0
virtual void SAL_CALL selectAllAccessibleChildren() override
Selects all cells.
ScCsvControl & implGetControl() const
Returns the VCL control.
sal_Int32 GetFirstX() const
Returns the X position of the first pixel of the data area.
Definition: csvcontrol.cxx:185
virtual css::awt::Rectangle implGetBounds() override
Returns the bounding box of the cell relative in the table.
void SendVisibleEvent()
Sends a visible area changed event to all listeners.
virtual sal_Int32 SAL_CALL getAccessibleRowCount() override
Returns the number of rows in the table.
virtual sal_Int32 SAL_CALL getCharacterCount() override
Returns the count of characters.
virtual sal_Bool SAL_CALL isAccessibleColumnSelected(sal_Int32 nColumn) override
Returns true, if the specified column is selected.
virtual void SendRemoveColumnEvent(sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn)
Sends a table model changed event for a removed column to all listeners.
sal_Int32 implGetRow(sal_Int32 nIndex) const
Returns the row index from cell index (including header).
const OUString & GetCellText(sal_uInt32 nColIndex, sal_Int32 nLine) const
Returns the text of the specified cell.
Definition: csvgrid.cxx:852
::std::unique_ptr< SvxEditSource > implCreateEditSource()
Creates the edit source the text helper needs.
Size implGetRealSize() const
Returns the pixel size of the cell, regardless of visibility.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn) override
Returns the accessible cell object at the specified position.
virtual void SAL_CALL grabFocus() override
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Returns the relation to the grid control.
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
const OUString & GetColumnTypeName(sal_uInt32 nColIndex) const
Returns the UI type name of the specified column.
Definition: csvgrid.cxx:551
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
FontPitch GetPitch()
virtual OUString SAL_CALL getAccessibleColumnDescription(sal_Int32 nColumn) override
Returns the description text of the specified column in the table.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
sal_Int32 implGetRowCount() const
Returns the count of visible rows in the table (including header).
virtual ~ScAccessibleCsvRuler() override
const sal_uInt32 CSV_COLUMN_INVALID
Definition: csvgrid.hxx:39
#define SC_MOD()
Definition: scmod.hxx:253
ScAccessibleCsvControl(ScCsvControl &rControl)
Pointer to the VCL control.
void SetSize(const Size &rSize)
virtual void SendTableUpdateEvent(sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn, bool bAllRows) override
Sends a table model changed event for changed cell contents to all listeners.
sal_Int32 GetPosFromX(sal_Int32 nX) const
Returns position from output coordinate.
Definition: csvcontrol.cxx:200
tools::Long Width() const
virtual css::awt::Rectangle implGetBounds() override
virtual sal_Int32 SAL_CALL getForeground() override
unsigned char sal_Bool
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
OUString ScResId(const char *pId)
Definition: scdll.cxx:95
sal_Int32 mnIndex
The grid column index (core index).
sal_Int32 GetFirstVisLine() const
Returns index of first visible line.
Definition: csvcontrol.hxx:337
virtual void SendTableUpdateEvent(sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn, bool bAllRows)
Sends a table model changed event for changed cell contents to all listeners.
sal_Int32 implGetTextLength() const
Returns the character count of the text.
const Size & GetFontSize() const
sal_uInt32 GetFocusColumn() const
Returns index of the focused column.
Definition: csvgrid.hxx:221
bool HasSplit(sal_Int32 nPos) const
Returns true if at position nPos is a split.
Definition: csvruler.hxx:101
bool implHasSplit(sal_Int32 nApiPos)
Returns true, if the character at the specified index has a split.
sal_Int32 mnLine
The text contents of this cell.
sal_uInt32 GetColumnFromX(sal_Int32 nX) const
Returns column index from output coordinate.
Definition: csvgrid.cxx:470
css::uno::Type const & get()
virtual sal_Bool SAL_CALL copyText(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
Copies the specified text range into the clipboard (ruler does nothing).
ScCsvTableBox * GetTableBox()
Definition: csvgrid.hxx:99
virtual ~ScAccessibleCsvGrid() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
Returns the cell at the specified point.
const sal_Unicode cRulerDot
sal_Int32 implGetFirstEqualFormatted(sal_Int32 nApiPos)
Returns the first character index with equal formatting as at nApiPos.
tools::Long Top() const
sal_Int32 GetColumnWidth(sal_uInt32 nColIndex) const
Returns the character width of the column with the specified index.
Definition: csvgrid.cxx:482
sal_uInt32 GetColumnCount() const
Returns the number of columns.
Definition: csvgrid.hxx:151
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns() override
Returns the selected columns as a sequence.
virtual css::awt::Rectangle SAL_CALL getCharacterBounds(sal_Int32 nIndex) override
Returns the screen coordinates of the specified character.
#define MID_FONT_PITCH
ScAccessibleCsvCell * implCreateCellObj(sal_Int32 nRow, sal_Int32 nColumn)
Creates a new accessible object of the specified cell.
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows() override
Returns the selected rows as a sequence.
void ensureValidPosition(sal_Int32 nRow, sal_Int32 nColumn) const
css::lang::IndexOutOfBoundsException if the specified position is invalid.
The control in the CSV import dialog that contains a ruler and a data grid to visualize and modify th...
Definition: csvtablebox.hxx:44
virtual void SendFocusEvent(bool bFocused) override
Sends a GetFocus or LoseFocus event to all listeners.
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual sal_Bool SAL_CALL setSelection(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
Selects a part of the text (ruler does nothing).
void ensureValidIndexWithEnd(sal_Int32 nIndex) const
static sal_Int32 lcl_GetApiColumn(sal_uInt32 nGridColumn)
Converts a grid columnm index to an API column index.
virtual OUString SAL_CALL getAccessibleDescription() override
virtual OUString SAL_CALL getAccessibleName() override
virtual sal_Int32 SAL_CALL getAccessibleColumn(sal_Int32 nChildIndex) override
Returns the column index of the specified child.
const sal_uInt32 CSV_COLUMN_HEADER
#define MID_FONT_STYLE_NAME
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
Returns the child count (count of cells in the table).
sal_uInt32 GetNextSelected(sal_uInt32 nFromIndex) const
Returns index of the first selected column really after nFromIndex.
Definition: csvgrid.cxx:635
weld::DrawingArea * GetDrawingArea() const
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
::std::unique_ptr< SvxEditSource > SvxEditSourcePtr
#define MID_FONTHEIGHT
virtual void SendCaretEvent() override
Sends a caret changed event to all listeners.
sal_Int32 GetRulerCursorPos() const
Returns the ruler cursor position.
Definition: csvcontrol.hxx:358
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCaption() override
Returns the caption object of the table.
void Execute(ScCsvCmdType eType, sal_Int32 nParam1=CSV_POS_INVALID, sal_Int32 nParam2=CSV_POS_INVALID)
Executes a command by calling command handler.
Definition: csvcontrol.cxx:152
sal_Int32 GetLineFromY(sal_Int32 nY) const
Returns line index from output coordinate.
Definition: csvcontrol.cxx:235
sal_Int32 implGetIndex(sal_Int32 nRow, sal_Int32 nColumn) const
Returns the child index from cell position (including header).
unsigned char sal_uInt8
virtual sal_Int32 SAL_CALL getForeground() override
sal_Int32 GetLastVisLine() const
Returns index of last visible line.
Definition: csvcontrol.cxx:210
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
sal_Int32 implGetSelColumn(sal_Int32 nSelColumn) const
Returns the absolute column index of the nSelColumn-th selected column.
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
Returns the current set of states.
void SetEditSource(::std::unique_ptr< SvxEditSource > &&pEditSource)
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
Returns the child count (the ruler does not have children).
ScCsvGrid & GetGrid()
Definition: csvtablebox.hxx:82
virtual void SendCaretEvent()
Sends a caret changed event to all listeners.
virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nSelectedChildIndex) override
Deselects the child with the specified index in all selected children.
sal_uInt32 implCalcPixelWidth(sal_uInt32 nChars) const
Returns the width of the character count.
virtual sal_Int32 SAL_CALL getCaretPosition() override
Return the position of the caret.
sal_Int32 GetHdrWidth() const
Returns the width of the header column.
Definition: csvcontrol.hxx:318
sal_Int32 GetColumnX(sal_uInt32 nColIndex) const
Returns X coordinate of the specified column.
Definition: csvgrid.cxx:465
tools::Long Height() const
virtual sal_Int32 SAL_CALL getBackground() override
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
Sequence< sal_Int8 > aSeq
ScCsvRuler & GetRuler()
Definition: csvtablebox.hxx:81
sal_uInt32 GetFirstSelected() const
Returns index of the first selected column.
Definition: csvgrid.cxx:630
const sal_Int32 CSV_LINE_HEADER
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleSummary() override
Returns the summary description object of the table.
sal_Int32 implGetColumnCount() const
Returns the total column count in the table (including header).
virtual ~ScAccessibleCsvCell() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
Throws an exception (the ruler does not have children).
virtual void SAL_CALL release() override
virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
Returns the specified text portion.
tools::Long GetHeight() const
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
Returns the current set of states.
ScAccessibleCsvGrid(ScCsvGrid &rGrid)
::utl::AccessibleStateSetHelper * implCreateStateSet()
Creates a StateSetHelper and fills it with DEFUNC, OPAQUE, ENABLED, SHOWING and VISIBLE.
sal_Int32 implGetSelColumnCount() const
Returns the count of selected columns in the table.
virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override
Returns the count of selected children.
sal_Int32 implGetLastEqualFormatted(sal_Int32 nApiPos)
Returns the last character index with equal formatting as at nApiPos.
sal_Int32 nLength
sal_Int32 GetHdrX() const
Returns the start position of the header column.
Definition: csvcontrol.cxx:180
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) override
Returns true, if the specified child is selected.
virtual void SAL_CALL disposing() override
int mnIndex
bool IsSelected(sal_uInt32 nColIndex) const
Returns true, if the specified column is selected.
Definition: csvgrid.cxx:625
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
Returns the specified child cell.
virtual sal_Int32 SAL_CALL getAccessibleRow(sal_Int32 nChildIndex) override
Returns the row index of the specified child.
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Returns the relation to the ruler control.
ScAccessibleCsvCell(ScCsvGrid &rGrid, const OUString &rCellText, sal_Int32 nRow, sal_Int32 nColumn)
The index of the cell in the table.
OUString implGetCellText(sal_Int32 nRow, sal_Int32 nColumn) const
Returns the contents of the specified cell (including header).
void constructStringBuffer()
Builds the entire string buffer.
rtl_TextEncoding GetCharSet() const
virtual sal_Unicode SAL_CALL getCharacter(sal_Int32 nIndex) override
Returns the specified character.
sal_uInt16 nPos
sal_Int32 GetColumnPos(sal_uInt32 nColIndex) const
Returns start position of the column with the specified index.
Definition: csvgrid.hxx:168
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex) override
Returns the child with the specified index in all selected children.
#define MID_FONT_CHAR_SET
const sal_Unicode cRulerLine
A data grid control for the CSV import dialog.
Definition: csvgrid.hxx:58
void NotifyAccessibleEvent(const sal_Int16 _nEventId, const css::uno::Any &_rOldValue, const css::uno::Any &_rNewValue)
static sal_Int32 lcl_GetRulerPos(sal_Int32 nApiPos)
Converts an API text index to a ruler cursor position.
virtual void SAL_CALL disposing() override