summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-06-15 21:46:13 +0300
committerStephan Bergmann <sbergman@redhat.com>2019-06-17 08:56:36 +0200
commitadc295a1b2e1f2ed43e7eb587fc89d7229e0f122 (patch)
treed045a927d1f88d2574bdef441bc1cbc0b81fd16b /svx/source
parentd39846bfd16ad9873795149c370a95f42363bfd9 (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 'svx/source')
-rw-r--r--svx/source/accessibility/ShapeTypeHandler.cxx2
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.cxx2
-rw-r--r--svx/source/fmcomp/fmgridif.cxx4
-rw-r--r--svx/source/fmcomp/gridcell.cxx4
-rw-r--r--svx/source/mnuctrls/smarttagmenu.cxx2
-rw-r--r--svx/source/svdraw/svdedxv.cxx2
-rw-r--r--svx/source/svdraw/svdobj.cxx4
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx4
-rw-r--r--svx/source/unodraw/unomod.cxx2
-rw-r--r--svx/source/unodraw/unopage.cxx10
-rw-r--r--svx/source/unodraw/unoshap2.cxx8
-rw-r--r--svx/source/unodraw/unoshap3.cxx4
-rw-r--r--svx/source/unodraw/unoshape.cxx15
-rw-r--r--svx/source/unogallery/unogaltheme.cxx4
14 files changed, 28 insertions, 39 deletions
diff --git a/svx/source/accessibility/ShapeTypeHandler.cxx b/svx/source/accessibility/ShapeTypeHandler.cxx
index 4899662a0fee..b00fe30c8e3b 100644
--- a/svx/source/accessibility/ShapeTypeHandler.cxx
+++ b/svx/source/accessibility/ShapeTypeHandler.cxx
@@ -272,7 +272,7 @@ OUString ShapeTypeHandler::CreateAccessibleBaseName (const uno::Reference<drawin
case DRAWING_CUSTOM:
pResourceId = STR_ObjNameSingulCUSTOMSHAPE;
- if (SvxShape* pShape = SvxShape::getImplementation(rxShape))
+ if (SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>(rxShape))
{
if (auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->GetSdrObject()))
{
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 811793458a16..094e353ce350 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -266,7 +266,7 @@ void SetTemporary( uno::Reference< drawing::XShape > const & xShape )
{
if ( xShape.is() )
{
- SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
if ( pShape )
pShape->TakeSdrObjectOwnership();
}
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index ca56f80ae9e6..e270576298c0 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -473,7 +473,7 @@ void SAL_CALL FmXGridControl::createPeer(const Reference< css::awt::XToolkit >&
vcl::Window* pParentWin = nullptr;
if (rParentPeer.is())
{
- VCLXWindow* pParent = VCLXWindow::getImplementation(rParentPeer);
+ VCLXWindow* pParent = comphelper::getUnoTunnelImplementation<VCLXWindow>(rParentPeer);
if (pParent)
pParentWin = pParent->GetWindow().get();
}
@@ -496,7 +496,7 @@ void SAL_CALL FmXGridControl::createPeer(const Reference< css::awt::XToolkit >&
// if (--m_nPeerCreationLevel == 0)
{
DBG_ASSERT(getPeer().is(), "FmXGridControl::createPeer : something went wrong ... no top level peer !");
- pPeer = FmXGridPeer::getImplementation(getPeer());
+ pPeer = comphelper::getUnoTunnelImplementation<FmXGridPeer>(getPeer());
setPosSize( maComponentInfos.nX, maComponentInfos.nY, maComponentInfos.nWidth, maComponentInfos.nHeight, css::awt::PosSize::POSSIZE );
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index dd14bffef58c..7cb4a87cd4d0 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -1329,7 +1329,7 @@ void DbFormattedField::Init( vcl::Window& rParent, const Reference< XRowSet >& x
SvNumberFormatter* pFormatterUsed = nullptr;
if (m_xSupplier.is())
{
- SvNumberFormatsSupplierObj* pImplmentation = SvNumberFormatsSupplierObj::getImplementation(m_xSupplier);
+ SvNumberFormatsSupplierObj* pImplmentation = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(m_xSupplier);
if (pImplmentation)
pFormatterUsed = pImplmentation->GetNumberFormatter();
else
@@ -1914,7 +1914,7 @@ void DbNumericField::implAdjustGenericFieldSetting( const Reference< XPropertySe
SvNumberFormatter* pFormatterUsed = nullptr;
if ( xSupplier.is() )
{
- SvNumberFormatsSupplierObj* pImplmentation = SvNumberFormatsSupplierObj::getImplementation( xSupplier );
+ SvNumberFormatsSupplierObj* pImplmentation = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( xSupplier );
pFormatterUsed = pImplmentation ? pImplmentation->GetNumberFormatter() : nullptr;
}
if ( nullptr == pFormatterUsed )
diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxx
index 36b1e135af60..2780cf383f95 100644
--- a/svx/source/mnuctrls/smarttagmenu.cxx
+++ b/svx/source/mnuctrls/smarttagmenu.cxx
@@ -107,7 +107,7 @@ void SmartTagMenuController::FillMenu()
sal_uInt16 nMenuId = 1;
sal_uInt16 nSubMenuId = MN_ST_INSERT_START;
- VCLXMenu* pAwtMenu = VCLXMenu::getImplementation( m_xPopupMenu );
+ VCLXMenu* pAwtMenu = comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu );
PopupMenu* pVCLMenu = static_cast< PopupMenu* >( pAwtMenu->GetMenu() );
const css::uno::Sequence< css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > >& rActionComponentsSequence = m_pSmartTagItem->GetActionComponentsSequence();
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 8935d2702804..f4d3f8eee8aa 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -2385,7 +2385,7 @@ void SdrObjEditView::getTextSelection( css::uno::Any& rSelection )
css::uno::Reference< css::text::XText > xText( pObj->getUnoShape(), css::uno::UNO_QUERY );
if( xText.is() )
{
- SvxUnoTextBase* pRange = SvxUnoTextBase::getImplementation( xText );
+ SvxUnoTextBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextBase>( xText );
if( pRange )
{
rSelection <<= pRange->createTextCursorBySelection( pOutlinerView->GetSelection() );
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index ab3349fe703b..753caf3edd8a 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -2746,7 +2746,7 @@ void SdrObject::impl_setUnoShape( const uno::Reference< uno::XInterface >& _rxUn
}
maWeakUnoShape = _rxUnoShape;
- mpSvxShape = SvxShape::getImplementation( _rxUnoShape );
+ mpSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>( _rxUnoShape );
// I think this may never happen... But I am not sure enough .-)
if ( bTransferOwnership )
@@ -2837,7 +2837,7 @@ css::uno::Reference< css::uno::XInterface > SdrObject::getUnoShape()
uno::Reference< uno::XInterface > xPage(pPageCandidate->getUnoPage());
if( xPage.is() )
{
- SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation(xPage);
+ SvxDrawPage* pDrawPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>(xPage);
if( pDrawPage )
{
// create one
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 3a83e49f3505..bbaf3ac628af 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -554,7 +554,7 @@ void GraphicExporter::ParseSettings( const Sequence< PropertyValue >& aDescripto
pDataValues->Value >>= xPage;
if( xPage.is() )
{
- SvxDrawPage* pUnoPage = SvxDrawPage::getImplementation( xPage );
+ SvxDrawPage* pUnoPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>( xPage );
if( pUnoPage && pUnoPage->GetSdrPage() )
mpCurrentPage = pUnoPage->GetSdrPage();
}
@@ -1182,7 +1182,7 @@ void SAL_CALL GraphicExporter::setSourceDocument( const Reference< lang::XCompon
if( !mxPage.is() )
break;
- mpUnoPage = SvxDrawPage::getImplementation( mxPage );
+ mpUnoPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>( mxPage );
if( nullptr == mpUnoPage || nullptr == mpUnoPage->GetSdrPage() )
break;
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index 132f3b6c3fd7..c318442d279d 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -662,7 +662,7 @@ void SAL_CALL SvxUnoDrawPagesAccess::remove( const uno::Reference< drawing::XDra
if( nPageCount > 1 )
{
// get pPage from xPage and get Id (nPos)
- SvxDrawPage* pSvxPage = SvxDrawPage::getImplementation( xPage );
+ SvxDrawPage* pSvxPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>( xPage );
if( pSvxPage )
{
SdrPage* pPage = pSvxPage->GetSdrPage();
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index 7982ddced061..5f326ceaaf72 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -183,7 +183,7 @@ void SAL_CALL SvxDrawPage::add( const uno::Reference< drawing::XShape >& xShape
if ( ( mpModel == nullptr ) || ( mpPage == nullptr ) )
throw lang::DisposedException();
- SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
if( nullptr == pShape )
return;
@@ -254,7 +254,7 @@ void SAL_CALL SvxDrawPage::addBottom( const uno::Reference< drawing::XShape >& x
if ( ( mpModel == nullptr ) || ( mpPage == nullptr ) )
throw lang::DisposedException();
- SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
if( nullptr == pShape )
return;
@@ -289,7 +289,7 @@ void SAL_CALL SvxDrawPage::remove( const Reference< drawing::XShape >& xShape )
if( (mpModel == nullptr) || (mpPage == nullptr) )
throw lang::DisposedException();
- SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
if (pShape)
{
@@ -381,7 +381,7 @@ namespace
{
void lcl_markSdrObjectOfShape( const Reference< drawing::XShape >& _rxShape, SdrView& _rView, SdrPageView& _rPageView )
{
- SvxShape* pShape = SvxShape::getImplementation( _rxShape );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( _rxShape );
if ( !pShape )
return;
@@ -892,7 +892,7 @@ SdrPage* GetSdrPageFromXDrawPage( const uno::Reference< drawing::XDrawPage >& xD
{
if(xDrawPage.is())
{
- SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xDrawPage );
+ SvxDrawPage* pDrawPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>( xDrawPage );
if(pDrawPage)
{
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 760b6eb4da6a..13e8205e353d 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -190,7 +190,7 @@ void SvxShapeGroup::addUnoShape( const uno::Reference< drawing::XShape >& xShape
return;
}
- SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
if (!pShape)
{
OSL_FAIL("could not add XShape to group shape!");
@@ -240,7 +240,7 @@ void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xS
::SolarMutexGuard aGuard;
SdrObject* pSdrShape = nullptr;
- SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
if( pShape )
pSdrShape = pShape->GetSdrObject();
@@ -438,7 +438,7 @@ void SAL_CALL SvxShapeConnector::connectStart( const uno::Reference< drawing::XC
::SolarMutexGuard aGuard;
Reference< drawing::XShape > xRef( xShape, UNO_QUERY );
- SvxShape* pShape = SvxShape::getImplementation( xRef );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xRef );
if( pShape )
GetSdrObject()->ConnectToNode( true, pShape->GetSdrObject() );
@@ -452,7 +452,7 @@ void SAL_CALL SvxShapeConnector::connectEnd( const uno::Reference< drawing::XCon
::SolarMutexGuard aGuard;
Reference< drawing::XShape > xRef( xShape, UNO_QUERY );
- SvxShape* pShape = SvxShape::getImplementation( xRef );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xRef );
if( HasSdrObject() && pShape )
GetSdrObject()->ConnectToNode( false, pShape->GetSdrObject() );
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index 394300ebae6d..39b04d480752 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -117,7 +117,7 @@ void SAL_CALL Svx3DSceneObject::add( const Reference< drawing::XShape >& xShape
{
SolarMutexGuard aGuard;
- SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
if(!HasSdrObject() || !mxPage.is() || pShape == nullptr || nullptr != pShape->GetSdrObject() )
throw uno::RuntimeException();
@@ -142,7 +142,7 @@ void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xSha
{
SolarMutexGuard aGuard;
- SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
if(!HasSdrObject() || pShape == nullptr)
throw uno::RuntimeException();
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 9cd0d2ea520c..929e0350ec22 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -295,17 +295,6 @@ const css::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() throw()
return theSvxShapeUnoTunnelId::get().getSeq();
}
-
-SvxShape* SvxShape::getImplementation( const uno::Reference< uno::XInterface >& xInt )
-{
- uno::Reference< lang::XUnoTunnel > xUT( xInt, css::uno::UNO_QUERY );
- if( xUT.is() )
- return reinterpret_cast<SvxShape*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxShape::getUnoTunnelId())));
- else
- return nullptr;
-}
-
-
sal_Int64 SAL_CALL SvxShape::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
{
if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) )
@@ -4100,14 +4089,14 @@ uno::Reference< drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) throw
/** returns the SdrObject from the given StarOffice API wrapper */
SdrObject* GetSdrObjectFromXShape( const uno::Reference< drawing::XShape >& xShape ) throw()
{
- SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
return pShape ? pShape->GetSdrObject() : nullptr;
}
SdrObject* SdrObject::getSdrObjectFromXShape( const css::uno::Reference< css::uno::XInterface >& xInt )
{
- SvxShape* pSvxShape = SvxShape::getImplementation( xInt );
+ SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>( xInt );
return pSvxShape ? pSvxShape->GetSdrObject() : nullptr;
}
diff --git a/svx/source/unogallery/unogaltheme.cxx b/svx/source/unogallery/unogaltheme.cxx
index 32f111d6a200..88a8bff8cae8 100644
--- a/svx/source/unogallery/unogaltheme.cxx
+++ b/svx/source/unogallery/unogaltheme.cxx
@@ -231,7 +231,7 @@ void SAL_CALL GalleryTheme::update( )
if( mpTheme )
{
- GalleryDrawingModel* pModel = GalleryDrawingModel::getImplementation( Drawing );
+ GalleryDrawingModel* pModel = comphelper::getUnoTunnelImplementation<GalleryDrawingModel>( Drawing );
if( pModel && dynamic_cast<const FmFormModel*>(pModel->GetDoc()) )
{
@@ -250,7 +250,7 @@ void SAL_CALL GalleryTheme::update( )
uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSupplier( Drawing, uno::UNO_QUERY_THROW );
uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), uno::UNO_SET_THROW );
uno::Reference< drawing::XDrawPage > xPage( xDrawPages->getByIndex( 0 ), uno::UNO_QUERY_THROW );
- SvxDrawPage* pUnoPage = xPage.is() ? SvxDrawPage::getImplementation( xPage ) : nullptr;
+ SvxDrawPage* pUnoPage = xPage.is() ? comphelper::getUnoTunnelImplementation<SvxDrawPage>( xPage ) : nullptr;
SdrModel* pOrigModel = pUnoPage ? &pUnoPage->GetSdrPage()->getSdrModelFromSdrPage() : nullptr;
SdrPage* pOrigPage = pUnoPage ? pUnoPage->GetSdrPage() : nullptr;