include/vcl/toolkit/svtabbx.hxx | 3 - vcl/inc/accessibility/vclxaccessibleheaderbar.hxx | 7 +- vcl/inc/accessibility/vclxaccessiblelist.hxx | 2 vcl/source/accessibility/accessibleiconchoicectrl.cxx | 2 vcl/source/accessibility/accessiblelistboxentry.cxx | 18 ++---- vcl/source/accessibility/vclxaccessiblebox.cxx | 49 ++++++++---------- vcl/source/accessibility/vclxaccessibleheaderbar.cxx | 11 +--- vcl/source/accessibility/vclxaccessiblelist.cxx | 18 +++--- vcl/source/gdi/graph.cxx | 14 +---- vcl/source/graphic/UnoGraphicProvider.cxx | 20 ++----- vcl/source/treelist/svtabbx.cxx | 6 +- 11 files changed, 70 insertions(+), 80 deletions(-)
New commits: commit 0e8ddfc3d4af0a73e819adb90b57746e3a015f17 Author: Noel Grandin <[email protected]> AuthorDate: Mon Mar 3 09:15:22 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Mar 3 11:54:34 2025 +0100 use more conrete UNO classes in vcl Change-Id: I1caceef305fb88a25a505633c7fa31fd70b7e960 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182417 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx index b390f996a3c7..35967ff14213 100644 --- a/include/vcl/toolkit/svtabbx.hxx +++ b/include/vcl/toolkit/svtabbx.hxx @@ -84,6 +84,7 @@ class HeaderBar; namespace vcl { struct SvHeaderTabListBoxImpl; } +class AccessibleBrowseBoxHeaderCell; class UNLESS_MERGELIBS_MORE(VCL_DLLPUBLIC) SvHeaderTabListBox : public SvTabListBox, public vcl::IAccessibleTableProvider { @@ -91,7 +92,7 @@ private: bool m_bFirstPaint; VclPtr<HeaderBar> m_xHeaderBar; rtl::Reference<AccessibleTabListBox> m_xAccessible; - std::vector<css::uno::Reference<css::accessibility::XAccessible>> m_aAccessibleChildren; + std::vector<rtl::Reference<AccessibleBrowseBoxHeaderCell>> m_aAccessibleChildren; Link<SvTreeListEntry*, bool> m_aEditingEntryHdl; Link<const IterString&, bool> m_aEditedEntryHdl; diff --git a/vcl/inc/accessibility/vclxaccessibleheaderbar.hxx b/vcl/inc/accessibility/vclxaccessibleheaderbar.hxx index 33ac4130e746..09b84536ea17 100644 --- a/vcl/inc/accessibility/vclxaccessibleheaderbar.hxx +++ b/vcl/inc/accessibility/vclxaccessibleheaderbar.hxx @@ -20,8 +20,11 @@ #include <vcl/accessibility/vclxaccessiblecomponent.hxx> #include <vcl/headbar.hxx> +#include <unotools/weakref.hxx> -typedef std::vector<css::uno::WeakReference<css::accessibility::XAccessible>> ListItems; +class VCLXAccessibleHeaderBarItem; + +typedef std::vector<unotools::WeakReference<VCLXAccessibleHeaderBarItem>> ListItems; class VCLXAccessibleHeaderBar final : public VCLXAccessibleComponent { @@ -44,7 +47,7 @@ public: public: virtual void SAL_CALL disposing() override; - css::uno::Reference<css::accessibility::XAccessible> CreateChild(sal_Int32 i); + rtl::Reference<VCLXAccessibleHeaderBarItem> CreateChild(sal_Int32 i); private: ListItems m_aAccessibleChildren; diff --git a/vcl/inc/accessibility/vclxaccessiblelist.hxx b/vcl/inc/accessibility/vclxaccessiblelist.hxx index ed377a03fa75..7ea3af628811 100644 --- a/vcl/inc/accessibility/vclxaccessiblelist.hxx +++ b/vcl/inc/accessibility/vclxaccessiblelist.hxx @@ -163,7 +163,7 @@ private: void UpdateSelection_Impl(sal_Int32 nPos = 0); bool checkEntrySelected(sal_Int32 _nPos, css::uno::Any& _rNewValue, - css::uno::Reference< css::accessibility::XAccessible >& _rxNewAcc); + rtl::Reference< VCLXAccessibleListItem >& _rxNewAcc); void notifyVisibleStates(bool _bSetNew ); void UpdateVisibleLineCount(); }; diff --git a/vcl/source/accessibility/accessibleiconchoicectrl.cxx b/vcl/source/accessibility/accessibleiconchoicectrl.cxx index 356685825d1b..e8e96f8d8c52 100644 --- a/vcl/source/accessibility/accessibleiconchoicectrl.cxx +++ b/vcl/source/accessibility/accessibleiconchoicectrl.cxx @@ -239,7 +239,7 @@ Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getSelectedAccessibl if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) throw IndexOutOfBoundsException(); - Reference< XAccessible > xChild; + rtl::Reference< AccessibleIconChoiceCtrlEntry > xChild; sal_Int32 nSelCount = 0; VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); sal_Int32 nCount = pCtrl->GetEntryCount(); diff --git a/vcl/source/accessibility/accessiblelistboxentry.cxx b/vcl/source/accessibility/accessiblelistboxentry.cxx index a1f47be52c68..9489f756f690 100644 --- a/vcl/source/accessibility/accessiblelistboxentry.cxx +++ b/vcl/source/accessibility/accessiblelistboxentry.cxx @@ -395,19 +395,17 @@ OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName( ) Reference< XAccessibleRelationSet > SAL_CALL AccessibleListBoxEntry::getAccessibleRelationSet( ) { - Reference< XAccessibleRelationSet > xRelSet; Reference< XAccessible > xParent; if ( m_aEntryPath.size() > 1 ) // not a root entry xParent = implGetParentAccessible(); - if ( xParent.is() ) - { - rtl::Reference<utl::AccessibleRelationSetHelper> pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Sequence<Reference<XAccessible>> aSequence { xParent }; - pRelationSetHelper->AddRelation( - AccessibleRelation( AccessibleRelationType_NODE_CHILD_OF, aSequence ) ); - xRelSet = pRelationSetHelper; - } - return xRelSet; + if ( !xParent ) + return nullptr; + + rtl::Reference<utl::AccessibleRelationSetHelper> pRelationSetHelper = new utl::AccessibleRelationSetHelper; + Sequence<Reference<XAccessible>> aSequence { xParent }; + pRelationSetHelper->AddRelation( + AccessibleRelation( AccessibleRelationType_NODE_CHILD_OF, aSequence ) ); + return pRelationSetHelper; } sal_Int64 SAL_CALL AccessibleListBoxEntry::getAccessibleStateSet( ) diff --git a/vcl/source/accessibility/vclxaccessiblebox.cxx b/vcl/source/accessibility/vclxaccessiblebox.cxx index d13307060cf4..27547347bcaf 100644 --- a/vcl/source/accessibility/vclxaccessiblebox.cxx +++ b/vcl/source/accessibility/vclxaccessiblebox.cxx @@ -290,40 +290,37 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int64 if (i<0 || i>=implGetAccessibleChildCount()) throw IndexOutOfBoundsException(); - Reference< XAccessible > xChild; - if (IsValid()) + if (!IsValid()) + return nullptr; + + if (i==1 || ! m_bHasTextChild) { - if (i==1 || ! m_bHasTextChild) + // List. + if ( ! m_xList.is()) { - // List. - if ( ! m_xList.is()) - { - m_xList = new VCLXAccessibleList(GetWindow(), - (m_aBoxType == LISTBOX ? VCLXAccessibleList::LISTBOX : VCLXAccessibleList::COMBOBOX), - this); - m_xList->SetIndexInParent(i); - } - xChild = m_xList; + m_xList = new VCLXAccessibleList(GetWindow(), + (m_aBoxType == LISTBOX ? VCLXAccessibleList::LISTBOX : VCLXAccessibleList::COMBOBOX), + this); + m_xList->SetIndexInParent(i); } - else + return m_xList; + } + else + { + // Text Field. + if ( ! m_xText.is()) { - // Text Field. - if ( ! m_xText.is()) + if (m_aBoxType==COMBOBOX) { - if (m_aBoxType==COMBOBOX) - { - VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); - if (pComboBox && pComboBox->GetSubEdit()) - m_xText = pComboBox->GetSubEdit()->GetAccessible(); - } - else if (m_bIsDropDownBox) - m_xText = new VCLXAccessibleTextField(GetWindow(), this); + VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); + if (pComboBox && pComboBox->GetSubEdit()) + m_xText = pComboBox->GetSubEdit()->GetAccessible(); } - xChild = m_xText; + else if (m_bIsDropDownBox) + m_xText = new VCLXAccessibleTextField(GetWindow(), this); } + return m_xText; } - - return xChild; } sal_Int16 SAL_CALL VCLXAccessibleBox::getAccessibleRole() diff --git a/vcl/source/accessibility/vclxaccessibleheaderbar.cxx b/vcl/source/accessibility/vclxaccessibleheaderbar.cxx index 98ceee1978d2..28c2b4f78a2e 100644 --- a/vcl/source/accessibility/vclxaccessibleheaderbar.cxx +++ b/vcl/source/accessibility/vclxaccessibleheaderbar.cxx @@ -71,7 +71,7 @@ css::uno::Reference<css::accessibility::XAccessible> if (i < 0 || i >= getAccessibleChildCount()) throw IndexOutOfBoundsException(); - Reference<XAccessible> xChild; + rtl::Reference<VCLXAccessibleHeaderBarItem> xChild; // search for the child if (o3tl::make_unsigned(i) >= m_aAccessibleChildren.size()) xChild = CreateChild(i); @@ -97,10 +97,9 @@ void SAL_CALL VCLXAccessibleHeaderBar::disposing() VCLXAccessibleComponent::disposing(); } -css::uno::Reference<css::accessibility::XAccessible> -VCLXAccessibleHeaderBar::CreateChild(sal_Int32 i) +rtl::Reference<VCLXAccessibleHeaderBarItem> VCLXAccessibleHeaderBar::CreateChild(sal_Int32 i) { - Reference<XAccessible> xChild; + rtl::Reference<VCLXAccessibleHeaderBarItem> xChild; sal_uInt16 nPos = static_cast<sal_uInt16>(i); if (nPos >= m_aAccessibleChildren.size()) @@ -109,7 +108,7 @@ VCLXAccessibleHeaderBar::CreateChild(sal_Int32 i) // insert into the container xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i); - m_aAccessibleChildren[nPos] = xChild; + m_aAccessibleChildren[nPos] = xChild.get(); } else { @@ -118,7 +117,7 @@ VCLXAccessibleHeaderBar::CreateChild(sal_Int32 i) if (!xChild.is()) { xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i); - m_aAccessibleChildren[nPos] = xChild; + m_aAccessibleChildren[nPos] = xChild.get(); } } return xChild; diff --git a/vcl/source/accessibility/vclxaccessiblelist.cxx b/vcl/source/accessibility/vclxaccessiblelist.cxx index 784c04cfbd9f..a6d372e0cf6a 100644 --- a/vcl/source/accessibility/vclxaccessiblelist.cxx +++ b/vcl/source/accessibility/vclxaccessiblelist.cxx @@ -210,7 +210,7 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool bHasDropDownList) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - Reference< XAccessible > xNewAcc; + rtl::Reference< VCLXAccessibleListItem > xNewAcc; if ( m_pListBoxHelper ) { sal_Int32 i=0; @@ -227,7 +227,7 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool bHasDropDownList) if (bNowSelected && !rxChild->IsSelected()) { xNewAcc = rxChild; - aNewValue <<= xNewAcc; + aNewValue <<= Reference< XAccessible >(xNewAcc); } else if (rxChild->IsSelected()) m_nLastSelectedPos = i; @@ -250,7 +250,7 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool bHasDropDownList) { if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND ) aOldValue <<= getAccessibleChild( m_nLastSelectedPos ); - aNewValue <<= xNewAcc; + aNewValue <<= Reference< XAccessible >(xNewAcc); } } } @@ -559,7 +559,7 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int6 if ( i < 0 || i >= getAccessibleChildCount() ) throw IndexOutOfBoundsException(); - Reference< XAccessible > xChild; + rtl::Reference< VCLXAccessibleListItem > xChild; // search for the child if ( o3tl::make_unsigned(i) >= m_aAccessibleChildren.size() ) xChild = CreateChild (i); @@ -652,7 +652,7 @@ void VCLXAccessibleList::UpdateEntryRange_Impl() m_nLastTopEntry = nTop; } -bool VCLXAccessibleList::checkEntrySelected(sal_Int32 _nPos,Any& _rNewValue,Reference< XAccessible >& _rxNewAcc) +bool VCLXAccessibleList::checkEntrySelected(sal_Int32 _nPos,Any& _rNewValue, rtl::Reference< VCLXAccessibleListItem >& _rxNewAcc) { OSL_ENSURE(m_pListBoxHelper,"Helper is not valid!"); bool bNowSelected = false; @@ -662,7 +662,7 @@ bool VCLXAccessibleList::checkEntrySelected(sal_Int32 _nPos,Any& _rNewValue,Refe if ( bNowSelected ) { _rxNewAcc = CreateChild(_nPos); - _rNewValue <<= _rxNewAcc; + _rNewValue <<= uno::Reference<XAccessible>(_rxNewAcc); } } return bNowSelected; @@ -676,7 +676,7 @@ void VCLXAccessibleList::UpdateSelection_Impl(sal_Int32) { SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - Reference< XAccessible > xNewAcc; + rtl::Reference< VCLXAccessibleListItem > xNewAcc; if ( m_pListBoxHelper ) { @@ -694,7 +694,7 @@ void VCLXAccessibleList::UpdateSelection_Impl(sal_Int32) if (bNowSelected && !rxChild->IsSelected()) { xNewAcc = rxChild; - aNewValue <<= xNewAcc; + aNewValue <<= Reference< XAccessible >(xNewAcc); } else if (rxChild->IsSelected()) m_nLastSelectedPos = i; @@ -717,7 +717,7 @@ void VCLXAccessibleList::UpdateSelection_Impl(sal_Int32) { if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND ) aOldValue <<= getAccessibleChild( m_nLastSelectedPos ); - aNewValue <<= xNewAcc; + aNewValue <<= Reference< XAccessible >(xNewAcc); } if (m_pListBoxHelper->IsInDropDown()) { diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index fff50ba0957c..4efb09a1c7cb 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -350,16 +350,12 @@ const BitmapEx& Graphic::GetBitmapExRef() const uno::Reference<css::graphic::XGraphic> Graphic::GetXGraphic() const { - uno::Reference<css::graphic::XGraphic> xGraphic; + if (GetType() == GraphicType::NONE) + return nullptr; - if (GetType() != GraphicType::NONE) - { - rtl::Reference<unographic::Graphic> pUnoGraphic = new unographic::Graphic; - pUnoGraphic->init(*this); - xGraphic = pUnoGraphic; - } - - return xGraphic; + rtl::Reference<unographic::Graphic> pUnoGraphic = new unographic::Graphic; + pUnoGraphic->init(*this); + return pUnoGraphic; } Size Graphic::GetPrefSize() const diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx index 84abd74f291b..a954a8d681b0 100644 --- a/vcl/source/graphic/UnoGraphicProvider.cxx +++ b/vcl/source/graphic/UnoGraphicProvider.cxx @@ -176,23 +176,19 @@ uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId() uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadMemory( std::u16string_view rResourceURL ) { - uno::Reference< ::graphic::XGraphic > xRet; sal_Int32 nIndex = 0; - if( o3tl::getToken(rResourceURL, 0, '/', nIndex ) == u"private:memorygraphic" ) - { - sal_Int64 nGraphicAddress = o3tl::toInt64(o3tl::getToken(rResourceURL, 0, '/', nIndex )); + if( o3tl::getToken(rResourceURL, 0, '/', nIndex ) != u"private:memorygraphic" ) + return nullptr; - if( nGraphicAddress ) - { - rtl::Reference<::unographic::Graphic> pUnoGraphic = new ::unographic::Graphic; + sal_Int64 nGraphicAddress = o3tl::toInt64(o3tl::getToken(rResourceURL, 0, '/', nIndex )); + if( nGraphicAddress == 0 ) + return nullptr; - pUnoGraphic->init( *reinterpret_cast< ::Graphic* >( nGraphicAddress ) ); - xRet = pUnoGraphic; - } - } + rtl::Reference<::unographic::Graphic> pUnoGraphic = new ::unographic::Graphic; - return xRet; + pUnoGraphic->init( *reinterpret_cast< ::Graphic* >( nGraphicAddress ) ); + return pUnoGraphic; } uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadRepositoryImage( std::u16string_view rResourceURL ) diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index 721ffb1cb452..897dd6581163 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -544,7 +544,7 @@ SvHeaderTabListBox::~SvHeaderTabListBox() void SvHeaderTabListBox::dispose() { - for (css::uno::Reference<css::accessibility::XAccessible>& rxChild : m_aAccessibleChildren) + for (rtl::Reference<AccessibleBrowseBoxHeaderCell>& rxChild : m_aAccessibleChildren) comphelper::disposeComponent(rxChild); m_aAccessibleChildren.clear(); m_xAccessible.clear(); @@ -871,11 +871,11 @@ Reference< XAccessible > SvHeaderTabListBox::CreateAccessibleColumnHeader( sal_u if ( m_aAccessibleChildren.empty() ) { const sal_uInt16 nColumnCount = GetColumnCount(); - m_aAccessibleChildren.assign( nColumnCount, Reference< XAccessible >() ); + m_aAccessibleChildren.resize( nColumnCount ); } // get header - Reference< XAccessible > xChild = m_aAccessibleChildren[ _nColumn ]; + rtl::Reference< AccessibleBrowseBoxHeaderCell > xChild = m_aAccessibleChildren[ _nColumn ]; // already exists? if (!xChild.is() && m_xAccessible.is()) {
