sw/source/uibase/inc/glosdoc.hxx | 5 ++++- sw/source/uibase/inc/unoatxt.hxx | 6 ------ sw/source/uibase/misc/glosdoc.cxx | 13 +++++-------- sw/source/uibase/uno/unoatxt.cxx | 11 ----------- unotools/source/misc/ZipPackageHelper.cxx | 7 +++---- 5 files changed, 12 insertions(+), 30 deletions(-)
New commits: commit b09954a06a2e45417ed503165ff05f49d49395a2 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jan 20 10:41:12 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Jan 21 18:07:05 2023 +0000 XUnoTunnel->dynamic_cast in SwXAutoTextEntry just store the concrete type in the vector, which avoids all the dynamic_cast anyway Change-Id: Id8f37ee1c630e6e94e1b23f780f88d56f980a118 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145925 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/uibase/inc/glosdoc.hxx b/sw/source/uibase/inc/glosdoc.hxx index e6d01aa4481c..9206a7d02011 100644 --- a/sw/source/uibase/inc/glosdoc.hxx +++ b/sw/source/uibase/inc/glosdoc.hxx @@ -20,6 +20,7 @@ #define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSDOC_HXX #include <rtl/ustring.hxx> +#include <unotools/weakref.hxx> #include <com/sun/star/text/XAutoTextGroup.hpp> class SwTextBlocks; @@ -35,8 +36,10 @@ typedef tools::SvRef<SwDocShell> SwDocShellRef; #include <vector> #include <swdllapi.h> +class SwXAutoTextEntry; + typedef std::vector< css::uno::WeakReference< css::text::XAutoTextGroup > > UnoAutoTextGroups; -typedef std::vector< css::uno::WeakReference< css::text::XAutoTextEntry > > UnoAutoTextEntries; +typedef std::vector< unotools::WeakReference< SwXAutoTextEntry > > UnoAutoTextEntries; #define GLOS_DELIM u'*' diff --git a/sw/source/uibase/inc/unoatxt.hxx b/sw/source/uibase/inc/unoatxt.hxx index 1526c06570a4..15e66d063095 100644 --- a/sw/source/uibase/inc/unoatxt.hxx +++ b/sw/source/uibase/inc/unoatxt.hxx @@ -155,7 +155,6 @@ class SwXAutoTextEntry final < css::text::XAutoTextEntry, css::lang::XServiceInfo, - css::lang::XUnoTunnel, css::text::XText, css::document::XEventsSupplier > @@ -197,11 +196,6 @@ class SwXAutoTextEntry final public: SwXAutoTextEntry(SwGlossaries* , OUString aGroupName, OUString aEntryName); - static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); - - //XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - //XText virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override; virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > & aTextPosition) override; diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index a5348f9c1a59..474d643acf97 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -459,7 +459,7 @@ void SwGlossaries::RemoveFileFromList( const OUString& rGroup ) aLoop != m_aGlossaryEntries.end(); ) { - auto pEntry = comphelper::getFromUnoTunnel<SwXAutoTextEntry>(aLoop->get()); + rtl::Reference<SwXAutoTextEntry> pEntry = aLoop->get(); if ( pEntry && ( pEntry->GetGroupName() == rGroup ) ) { pEntry->Invalidate(); @@ -511,7 +511,7 @@ void SwGlossaries::InvalidateUNOOjects() // invalidate all the AutoTextEntry-objects for (const auto& rEntry : m_aGlossaryEntries) { - auto pEntry = comphelper::getFromUnoTunnel<SwXAutoTextEntry>(rEntry.get()); + rtl::Reference<SwXAutoTextEntry> pEntry = rEntry.get(); if ( pEntry ) pEntry->Invalidate(); } @@ -584,17 +584,14 @@ Reference< text::XAutoTextEntry > SwGlossaries::GetAutoTextEntry( if ( USHRT_MAX == nIdx ) throw container::NoSuchElementException(); - Reference< text::XAutoTextEntry > xReturn; + rtl::Reference< SwXAutoTextEntry > xReturn; UnoAutoTextEntries::iterator aSearch( m_aGlossaryEntries.begin() ); for ( ; aSearch != m_aGlossaryEntries.end(); ) { - Reference< lang::XUnoTunnel > xEntryTunnel( aSearch->get(), UNO_QUERY ); + rtl::Reference< SwXAutoTextEntry > pEntry( aSearch->get() ); - SwXAutoTextEntry* pEntry = nullptr; - if ( xEntryTunnel.is() ) - pEntry = comphelper::getFromUnoTunnel<SwXAutoTextEntry>(xEntryTunnel); - else + if ( !pEntry ) { // the object is dead in the meantime -> remove from cache aSearch = m_aGlossaryEntries.erase( aSearch ); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index a3960425ad29..cb0166062af2 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -655,17 +655,6 @@ uno::Sequence< OUString > SwXAutoTextGroup::getSupportedServiceNames() return aRet; } -const uno::Sequence< sal_Int8 > & SwXAutoTextEntry::getUnoTunnelId() -{ - static const comphelper::UnoIdInit theSwXAutoTextEntryUnoTunnelId; - return theSwXAutoTextEntryUnoTunnelId.getSeq(); -} - -sal_Int64 SAL_CALL SwXAutoTextEntry::getSomething( const uno::Sequence< sal_Int8 >& rId ) -{ - return comphelper::getSomethingImpl(rId, this); -} - SwXAutoTextEntry::SwXAutoTextEntry(SwGlossaries* pGlss, OUString aGroupName, OUString aEntryName) : m_pGlossaries(pGlss), commit 4fd3fd36302f33fa0dda8ade3f99e40d2db138bc Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jan 20 13:19:27 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Jan 21 18:06:50 2023 +0000 fix ZipPackageHelper::addFile after commit a04bf69bccfbc266643b418ef57030a42bbb5c05 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Jan 16 10:36:59 2023 +0200 XUnoTunnel->dynamic_cast in ZipPackageEntry it no longer implements XUnoTunnel. And add an assert, the createInstance call should never fail. Change-Id: I9a0698862ba783057a299b9c52ebc2b828cc2ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145929 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/unotools/source/misc/ZipPackageHelper.cxx b/unotools/source/misc/ZipPackageHelper.cxx index c66db01272fe..d94b431bb6c6 100644 --- a/unotools/source/misc/ZipPackageHelper.cxx +++ b/unotools/source/misc/ZipPackageHelper.cxx @@ -23,7 +23,6 @@ #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/util/XChangesBatch.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> @@ -155,12 +154,12 @@ void ZipPackageHelper::addFile( css::uno::Reference< css::uno::XInterface > cons SvFileStream* pStream = new SvFileStream(rSourceFileURL, StreamMode::READ ); Reference< XInputStream > xInput( new utl::OSeekableInputStreamWrapper( pStream, true ) ); Reference< XActiveDataSink > xSink( mxFactory->createInstance(), UNO_QUERY ); - Reference< XUnoTunnel > xTunnel( xSink, UNO_QUERY ); - if( !xSink.is() || !xTunnel.is()) + assert(xSink); // this should never fail + if( !xSink.is() ) return; Reference< XNameContainer > xNameContainer(xRootFolder, UNO_QUERY ); - xNameContainer->insertByName(encodeZipUri( aName ), Any(xTunnel)); + xNameContainer->insertByName(encodeZipUri( aName ), Any(xSink)); xSink->setInputStream( xInput ); }