diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-15 21:46:13 +0300 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-06-17 08:56:36 +0200 |
commit | adc295a1b2e1f2ed43e7eb587fc89d7229e0f122 (patch) | |
tree | d045a927d1f88d2574bdef441bc1cbc0b81fd16b /editeng | |
parent | d39846bfd16ad9873795149c370a95f42363bfd9 (diff) |
Add comphelper::getUnoTunnelImplementation template
Use it instead of classname::getImplementation from UNO3_GETIMPLEMENTATION_*
Change-Id: Ifcc8cfcd6369c576250008c76ce31ba79ea3a596
Reviewed-on: https://gerrit.libreoffice.org/74107
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/uno/unofield.cxx | 2 | ||||
-rw-r--r-- | editeng/source/uno/unonrule.cxx | 6 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 29 | ||||
-rw-r--r-- | editeng/source/uno/unotext2.cxx | 2 |
4 files changed, 15 insertions, 24 deletions
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index 5e0eae732fd3..5a30627a3d7b 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -663,7 +663,7 @@ OUString SAL_CALL SvxUnoTextField::getPresentation( sal_Bool bShowCommand ) // Interface text::XTextContent void SAL_CALL SvxUnoTextField::attach( const uno::Reference< text::XTextRange >& xTextRange ) { - SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xTextRange ); + SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xTextRange ); if(pRange == nullptr) throw lang::IllegalArgumentException(); diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx index e3a3d5111706..a046910b1068 100644 --- a/editeng/source/uno/unonrule.cxx +++ b/editeng/source/uno/unonrule.cxx @@ -473,7 +473,7 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex(const Sequence<beans::Propert const SvxNumRule& SvxGetNumRule( Reference< XIndexReplace > const & xRule ) { - SvxUnoNumberingRules* pRule = SvxUnoNumberingRules::getImplementation( xRule ); + SvxUnoNumberingRules* pRule = comphelper::getUnoTunnelImplementation<SvxUnoNumberingRules>( xRule ); if( pRule == nullptr ) throw IllegalArgumentException(); @@ -513,10 +513,10 @@ sal_Int16 SvxUnoNumberingRules::Compare( const Any& Any1, const Any& Any2 ) if( x1.get() == x2.get() ) return 0; - SvxUnoNumberingRules* pRule1 = SvxUnoNumberingRules::getImplementation( x1 ); + SvxUnoNumberingRules* pRule1 = comphelper::getUnoTunnelImplementation<SvxUnoNumberingRules>( x1 ); if( pRule1 ) { - SvxUnoNumberingRules* pRule2 = SvxUnoNumberingRules::getImplementation( x2 ); + SvxUnoNumberingRules* pRule2 = comphelper::getUnoTunnelImplementation<SvxUnoNumberingRules>( x2 ); if( pRule2 ) { const SvxNumRule& rRule1 = pRule1->getNumRule(); diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index d37b4fdaebec..07c27d701e57 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -315,7 +315,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart() { CheckSelection( maSelection, pForwarder ); - SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() ); + SvxUnoTextBase* pText = comphelper::getUnoTunnelImplementation<SvxUnoTextBase>( getText() ); if(pText == nullptr) throw uno::RuntimeException(); @@ -343,7 +343,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd() { CheckSelection( maSelection, pForwarder ); - SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() ); + SvxUnoTextBase* pText = comphelper::getUnoTunnelImplementation<SvxUnoTextBase>( getText() ); if(pText == nullptr) throw uno::RuntimeException(); @@ -1452,8 +1452,8 @@ uno::Sequence< OUString > SvxUnoTextRangeBase::getSupportedServiceNames_Static() // XTextRangeCompare sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionStarts( const uno::Reference< text::XTextRange >& xR1, const uno::Reference< text::XTextRange >& xR2 ) { - SvxUnoTextRangeBase* pR1 = SvxUnoTextRangeBase::getImplementation( xR1 ); - SvxUnoTextRangeBase* pR2 = SvxUnoTextRangeBase::getImplementation( xR2 ); + SvxUnoTextRangeBase* pR1 = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( xR1 ); + SvxUnoTextRangeBase* pR2 = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( xR2 ); if( (pR1 == nullptr) || (pR2 == nullptr) ) throw lang::IllegalArgumentException(); @@ -1476,8 +1476,8 @@ sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionStarts( const uno::Referenc sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionEnds( const uno::Reference< text::XTextRange >& xR1, const uno::Reference< text::XTextRange >& xR2 ) { - SvxUnoTextRangeBase* pR1 = SvxUnoTextRangeBase::getImplementation( xR1 ); - SvxUnoTextRangeBase* pR2 = SvxUnoTextRangeBase::getImplementation( xR2 ); + SvxUnoTextRangeBase* pR1 = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( xR1 ); + SvxUnoTextRangeBase* pR2 = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( xR2 ); if( (pR1 == nullptr) || (pR2 == nullptr) ) throw lang::IllegalArgumentException(); @@ -1723,7 +1723,7 @@ uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursorByR if( aTextPosition.is() ) { - SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( aTextPosition ); + SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( aTextPosition ); if(pRange) xCursor = createTextCursorBySelection( pRange->GetSelection() ); } @@ -1745,7 +1745,7 @@ void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRan SetSelection( aSelection ); } - SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange ); + SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange ); if(pRange) { // setString on SvxUnoTextRangeBase instead of itself QuickInsertText @@ -1785,7 +1785,7 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text } case text::ControlCharacter::LINE_BREAK: { - SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange ); + SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange ); if(pRange) { ESelection aRange = pRange->GetSelection(); @@ -1816,7 +1816,7 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text } case text::ControlCharacter::APPEND_PARAGRAPH: { - SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange ); + SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange ); if(pRange) { ESelection aRange = pRange->GetSelection(); @@ -2180,15 +2180,6 @@ const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() throw() return theSvxUnoTextBaseUnoTunnelId::get().getSeq(); } -SvxUnoTextBase* SvxUnoTextBase::getImplementation( const uno::Reference< uno::XInterface >& xInt ) -{ - uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY ); - if( xUT.is() ) - return reinterpret_cast<SvxUnoTextBase*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxUnoTextBase::getUnoTunnelId()))); - else - return nullptr; -} - sal_Int64 SAL_CALL SvxUnoTextBase::getSomething( const uno::Sequence< sal_Int8 >& rId ) { if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index cf2a7f8aa4b9..1fa6e212dc90 100644 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -588,7 +588,7 @@ void SAL_CALL SvxUnoTextCursor::gotoRange( const uno::Reference< text::XTextRang if( !xRange.is() ) return; - SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( xRange ); + SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( xRange ); if( pRange ) { |