|
18 | 18 | */
|
19 | 19 |
|
20 | 20 | #include "thumbnailviewacc.hxx"
|
| 21 | +#include "thumbnailviewitemacc.hxx" |
21 | 22 |
|
22 | 23 | #include <comphelper/servicehelper.hxx>
|
23 | 24 | #include <sfx2/thumbnailview.hxx>
|
@@ -493,21 +494,6 @@ void ThumbnailViewAcc::ThrowIfDisposed()
|
493 | 494 | }
|
494 | 495 | }
|
495 | 496 |
|
496 |
| -ThumbnailViewItemAcc::ThumbnailViewItemAcc(ThumbnailViewItem* pThumbnailViewItem) |
497 |
| - : mpThumbnailViewItem(pThumbnailViewItem) |
498 |
| -{ |
499 |
| -} |
500 |
| - |
501 |
| -ThumbnailViewItemAcc::~ThumbnailViewItemAcc() |
502 |
| -{ |
503 |
| -} |
504 |
| - |
505 |
| -void ThumbnailViewItemAcc::ThumbnailViewItemDestroyed() |
506 |
| -{ |
507 |
| - std::scoped_lock aGuard( maMutex ); |
508 |
| - mpThumbnailViewItem = nullptr; |
509 |
| -} |
510 |
| - |
511 | 497 | void ThumbnailViewAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue )
|
512 | 498 | {
|
513 | 499 | if( !nEventId )
|
@@ -556,283 +542,4 @@ void ThumbnailViewAcc::LoseFocus()
|
556 | 542 | aOldState, aNewState);
|
557 | 543 | }
|
558 | 544 |
|
559 |
| -uno::Reference< accessibility::XAccessibleContext > SAL_CALL ThumbnailViewItemAcc::getAccessibleContext() |
560 |
| -{ |
561 |
| - return this; |
562 |
| -} |
563 |
| - |
564 |
| -sal_Int64 SAL_CALL ThumbnailViewItemAcc::getAccessibleChildCount() |
565 |
| -{ |
566 |
| - return 0; |
567 |
| -} |
568 |
| - |
569 |
| -uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewItemAcc::getAccessibleChild( sal_Int64 ) |
570 |
| -{ |
571 |
| - throw lang::IndexOutOfBoundsException(); |
572 |
| -} |
573 |
| - |
574 |
| -uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewItemAcc::getAccessibleParent() |
575 |
| -{ |
576 |
| - const SolarMutexGuard aSolarGuard; |
577 |
| - uno::Reference< accessibility::XAccessible > xRet; |
578 |
| - |
579 |
| - if (mpThumbnailViewItem) |
580 |
| - xRet = mpThumbnailViewItem->mrParent.getAccessible(); |
581 |
| - |
582 |
| - return xRet; |
583 |
| -} |
584 |
| - |
585 |
| -sal_Int64 SAL_CALL ThumbnailViewItemAcc::getAccessibleIndexInParent() |
586 |
| -{ |
587 |
| - const SolarMutexGuard aSolarGuard; |
588 |
| - // The index defaults to -1 to indicate the child does not belong to its |
589 |
| - // parent. |
590 |
| - sal_Int64 nIndexInParent = -1; |
591 |
| - |
592 |
| - if (mpThumbnailViewItem) |
593 |
| - { |
594 |
| - bool bDone = false; |
595 |
| - |
596 |
| - sal_uInt16 nCount = mpThumbnailViewItem->mrParent.ImplGetVisibleItemCount(); |
597 |
| - ThumbnailViewItem* pItem; |
598 |
| - for (sal_uInt16 i=0; i<nCount && !bDone; i++) |
599 |
| - { |
600 |
| - // Guard the retrieval of the i-th child with a try/catch block |
601 |
| - // just in case the number of children changes in the meantime. |
602 |
| - try |
603 |
| - { |
604 |
| - pItem = mpThumbnailViewItem->mrParent.ImplGetVisibleItem(i); |
605 |
| - } |
606 |
| - catch (const lang::IndexOutOfBoundsException&) |
607 |
| - { |
608 |
| - pItem = nullptr; |
609 |
| - } |
610 |
| - |
611 |
| - if (pItem && pItem == mpThumbnailViewItem) |
612 |
| - { |
613 |
| - nIndexInParent = i; |
614 |
| - bDone = true; |
615 |
| - } |
616 |
| - } |
617 |
| - } |
618 |
| - |
619 |
| - return nIndexInParent; |
620 |
| -} |
621 |
| - |
622 |
| -sal_Int16 SAL_CALL ThumbnailViewItemAcc::getAccessibleRole() |
623 |
| -{ |
624 |
| - return accessibility::AccessibleRole::LIST_ITEM; |
625 |
| -} |
626 |
| - |
627 |
| -OUString SAL_CALL ThumbnailViewItemAcc::getAccessibleDescription() |
628 |
| -{ |
629 |
| - return OUString(); |
630 |
| -} |
631 |
| - |
632 |
| -OUString SAL_CALL ThumbnailViewItemAcc::getAccessibleName() |
633 |
| -{ |
634 |
| - const SolarMutexGuard aSolarGuard; |
635 |
| - OUString aRet; |
636 |
| - |
637 |
| - if (mpThumbnailViewItem) |
638 |
| - { |
639 |
| - aRet = mpThumbnailViewItem->maTitle; |
640 |
| - |
641 |
| - if( aRet.isEmpty() ) |
642 |
| - { |
643 |
| - aRet = "Item " + OUString::number(static_cast<sal_Int32>(mpThumbnailViewItem->mnId)); |
644 |
| - } |
645 |
| - } |
646 |
| - |
647 |
| - return aRet; |
648 |
| -} |
649 |
| - |
650 |
| -uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ThumbnailViewItemAcc::getAccessibleRelationSet() |
651 |
| -{ |
652 |
| - return uno::Reference< accessibility::XAccessibleRelationSet >(); |
653 |
| -} |
654 |
| - |
655 |
| -sal_Int64 SAL_CALL ThumbnailViewItemAcc::getAccessibleStateSet() |
656 |
| -{ |
657 |
| - const SolarMutexGuard aSolarGuard; |
658 |
| - sal_Int64 nStateSet = 0; |
659 |
| - |
660 |
| - if (mpThumbnailViewItem) |
661 |
| - { |
662 |
| - nStateSet |= accessibility::AccessibleStateType::ENABLED; |
663 |
| - nStateSet |= accessibility::AccessibleStateType::SENSITIVE; |
664 |
| - nStateSet |= accessibility::AccessibleStateType::SHOWING; |
665 |
| - nStateSet |= accessibility::AccessibleStateType::VISIBLE; |
666 |
| - nStateSet |= accessibility::AccessibleStateType::TRANSIENT; |
667 |
| - nStateSet |= accessibility::AccessibleStateType::SELECTABLE; |
668 |
| - nStateSet |= accessibility::AccessibleStateType::FOCUSABLE; |
669 |
| - |
670 |
| - if (mpThumbnailViewItem->isSelected()) |
671 |
| - { |
672 |
| - nStateSet |= accessibility::AccessibleStateType::SELECTED; |
673 |
| - if (mpThumbnailViewItem->mrParent.HasChildFocus()) |
674 |
| - nStateSet |= accessibility::AccessibleStateType::FOCUSED; |
675 |
| - } |
676 |
| - } |
677 |
| - |
678 |
| - return nStateSet; |
679 |
| -} |
680 |
| - |
681 |
| -lang::Locale SAL_CALL ThumbnailViewItemAcc::getLocale() |
682 |
| -{ |
683 |
| - const SolarMutexGuard aSolarGuard; |
684 |
| - uno::Reference< accessibility::XAccessible > xParent( getAccessibleParent() ); |
685 |
| - lang::Locale aRet( u""_ustr, u""_ustr, u""_ustr ); |
686 |
| - |
687 |
| - if( xParent.is() ) |
688 |
| - { |
689 |
| - uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() ); |
690 |
| - |
691 |
| - if( xParentContext.is() ) |
692 |
| - aRet = xParentContext->getLocale(); |
693 |
| - } |
694 |
| - |
695 |
| - return aRet; |
696 |
| -} |
697 |
| - |
698 |
| -void SAL_CALL ThumbnailViewItemAcc::addAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener ) |
699 |
| -{ |
700 |
| - std::scoped_lock aGuard( maMutex ); |
701 |
| - |
702 |
| - if( !rxListener.is() ) |
703 |
| - return; |
704 |
| - |
705 |
| - bool bFound = false; |
706 |
| - |
707 |
| - for (auto const& eventListener : mxEventListeners) |
708 |
| - { |
709 |
| - if( eventListener == rxListener ) |
710 |
| - { |
711 |
| - bFound = true; |
712 |
| - break; |
713 |
| - } |
714 |
| - } |
715 |
| - |
716 |
| - if (!bFound) |
717 |
| - mxEventListeners.push_back( rxListener ); |
718 |
| -} |
719 |
| - |
720 |
| -void SAL_CALL ThumbnailViewItemAcc::removeAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener ) |
721 |
| -{ |
722 |
| - std::scoped_lock aGuard( maMutex ); |
723 |
| - |
724 |
| - if( rxListener.is() ) |
725 |
| - { |
726 |
| - std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::iterator aIter = |
727 |
| - std::find(mxEventListeners.begin(), mxEventListeners.end(), rxListener); |
728 |
| - |
729 |
| - if (aIter != mxEventListeners.end()) |
730 |
| - mxEventListeners.erase( aIter ); |
731 |
| - } |
732 |
| -} |
733 |
| - |
734 |
| -sal_Bool SAL_CALL ThumbnailViewItemAcc::containsPoint( const awt::Point& aPoint ) |
735 |
| -{ |
736 |
| - const awt::Rectangle aRect( getBounds() ); |
737 |
| - const Point aSize( aRect.Width, aRect.Height ); |
738 |
| - const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y ); |
739 |
| - |
740 |
| - return tools::Rectangle( aNullPoint, aSize ).Contains( aTestPoint ); |
741 |
| -} |
742 |
| - |
743 |
| -uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewItemAcc::getAccessibleAtPoint( const awt::Point& ) |
744 |
| -{ |
745 |
| - uno::Reference< accessibility::XAccessible > xRet; |
746 |
| - return xRet; |
747 |
| -} |
748 |
| - |
749 |
| -awt::Rectangle SAL_CALL ThumbnailViewItemAcc::getBounds() |
750 |
| -{ |
751 |
| - const SolarMutexGuard aSolarGuard; |
752 |
| - awt::Rectangle aRet; |
753 |
| - |
754 |
| - if (mpThumbnailViewItem) |
755 |
| - { |
756 |
| - tools::Rectangle aRect(mpThumbnailViewItem->getDrawArea()); |
757 |
| - tools::Rectangle aParentRect; |
758 |
| - |
759 |
| - // get position of the accessible parent in screen coordinates |
760 |
| - uno::Reference< XAccessible > xParent = getAccessibleParent(); |
761 |
| - if ( xParent.is() ) |
762 |
| - { |
763 |
| - uno::Reference<XAccessibleComponent> xParentComponent(xParent->getAccessibleContext(), uno::UNO_QUERY); |
764 |
| - if (xParentComponent.is()) |
765 |
| - { |
766 |
| - awt::Size aParentSize = xParentComponent->getSize(); |
767 |
| - aParentRect = tools::Rectangle(0, 0, aParentSize.Width, aParentSize.Height); |
768 |
| - } |
769 |
| - } |
770 |
| - |
771 |
| - aRect.Intersection( aParentRect ); |
772 |
| - |
773 |
| - aRet.X = aRect.Left(); |
774 |
| - aRet.Y = aRect.Top(); |
775 |
| - aRet.Width = aRect.GetWidth(); |
776 |
| - aRet.Height = aRect.GetHeight(); |
777 |
| - } |
778 |
| - |
779 |
| - return aRet; |
780 |
| -} |
781 |
| - |
782 |
| -awt::Point SAL_CALL ThumbnailViewItemAcc::getLocation() |
783 |
| -{ |
784 |
| - const awt::Rectangle aRect( getBounds() ); |
785 |
| - awt::Point aRet; |
786 |
| - |
787 |
| - aRet.X = aRect.X; |
788 |
| - aRet.Y = aRect.Y; |
789 |
| - |
790 |
| - return aRet; |
791 |
| -} |
792 |
| - |
793 |
| -awt::Point SAL_CALL ThumbnailViewItemAcc::getLocationOnScreen() |
794 |
| -{ |
795 |
| - const SolarMutexGuard aSolarGuard; |
796 |
| - awt::Point aRet; |
797 |
| - |
798 |
| - if (mpThumbnailViewItem) |
799 |
| - { |
800 |
| - const Point aPos = mpThumbnailViewItem->getDrawArea().TopLeft(); |
801 |
| - const Point aScreenPos( |
802 |
| - mpThumbnailViewItem->mrParent.GetDrawingArea()->get_accessible_location_on_screen()); |
803 |
| - |
804 |
| - aRet.X = aPos.X() + aScreenPos.X(); |
805 |
| - aRet.Y = aPos.Y() + aScreenPos.X(); |
806 |
| - } |
807 |
| - |
808 |
| - return aRet; |
809 |
| -} |
810 |
| - |
811 |
| -awt::Size SAL_CALL ThumbnailViewItemAcc::getSize() |
812 |
| -{ |
813 |
| - const awt::Rectangle aRect( getBounds() ); |
814 |
| - awt::Size aRet; |
815 |
| - |
816 |
| - aRet.Width = aRect.Width; |
817 |
| - aRet.Height = aRect.Height; |
818 |
| - |
819 |
| - return aRet; |
820 |
| -} |
821 |
| - |
822 |
| -void SAL_CALL ThumbnailViewItemAcc::grabFocus() |
823 |
| -{ |
824 |
| - // nothing to do |
825 |
| -} |
826 |
| - |
827 |
| -sal_Int32 SAL_CALL ThumbnailViewItemAcc::getForeground( ) |
828 |
| -{ |
829 |
| - Color nColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor(); |
830 |
| - return static_cast<sal_Int32>(nColor); |
831 |
| -} |
832 |
| - |
833 |
| -sal_Int32 SAL_CALL ThumbnailViewItemAcc::getBackground( ) |
834 |
| -{ |
835 |
| - return static_cast<sal_Int32>(Application::GetSettings().GetStyleSettings().GetWindowColor()); |
836 |
| -} |
837 |
| - |
838 | 545 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
0 commit comments