diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-14 08:19:47 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-15 06:07:36 +0200 |
commit | 05bc93db2de56000f65764d7e394d03747cac23d (patch) | |
tree | 975de9ae83572aac8a5c3ea8db281e1017ee5be0 /chart2 | |
parent | 8cbb414ed737f9ffc76e1258e6671769bf63fc6c (diff) |
Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 1
The header got some changes:
1. Move UnoTunnelIdInit and isUnoTunnelId into 'comphelper' namespace
2. Rename UnoTunnelIdInit to UnoIdInit, as a precondition to replace
of uses of OImplementationId with it, including in XTypeProvider
3. Introduce convenience functions 'getSomething_cast' to cast between
sal_Int64 and object pointers uniformly.
4. Rename getUnoTunnelImplementation to getFromUnoTunnel, both to make
it a bit shorter, and to reflect its function better. Templatize it
to take also css::uno::Any for convenience.
5. Introduce getSomethingImpl, inspired by sw::UnoTunnelImpl; allow it
handle cases both with and without fallback to parent.
6. Adjust UNO3_GETIMPLEMENTATION_* macros
TODO (in separate commits):
- Drop sw::UnoTunnelImpl and sw::UnoTunnelGetImplementation
- Replace all uses of OImplementationId in core with UnoIdInit
- Deprecate OImplementationId in <cppuhelper/typeprovider.hxx>
- Change implementations of getSomething to use getSomethingImpl
- Revise uses of getSomething to use getFromUnoTunnel
Change-Id: If4a3cb024130f1f552f988f0479589da1cd066e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122022
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'chart2')
13 files changed, 19 insertions, 19 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index 8b539d9dc644..a4c1a4befa2b 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -631,7 +631,7 @@ Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleAtPoint( const aw awt::Rectangle SAL_CALL AccessibleBase::getBounds() { ExplicitValueProvider *pExplicitValueProvider( - comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_aAccInfo.m_xView )); + comphelper::getFromUnoTunnel<ExplicitValueProvider>( m_aAccInfo.m_xView )); if( pExplicitValueProvider ) { VclPtr<vcl::Window> pWindow( VCLUnoHelper::GetWindow( m_aAccInfo.m_xWindow )); diff --git a/chart2/source/controller/accessibility/AccessibleChartView.cxx b/chart2/source/controller/accessibility/AccessibleChartView.cxx index 0738f52abc36..6ea9befe8009 100644 --- a/chart2/source/controller/accessibility/AccessibleChartView.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartView.cxx @@ -299,7 +299,7 @@ void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY ); if( xChartDoc.is()) m_spObjectHierarchy = - std::make_shared<ObjectHierarchy>( xChartDoc, comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(m_xChartView) ); + std::make_shared<ObjectHierarchy>( xChartDoc, comphelper::getFromUnoTunnel<ExplicitValueProvider>(m_xChartView) ); else m_spObjectHierarchy.reset(); } diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 898e4676c763..aef26f4a483a 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -1043,7 +1043,7 @@ namespace { uno::Reference< lang::XMultiServiceFactory > getShapeFactory(const uno::Reference<uno::XInterface>& xChartView) { - auto pProvider = comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(xChartView); + auto pProvider = comphelper::getFromUnoTunnel<ExplicitValueProvider>(xChartView); if( pProvider ) return pProvider->getDrawModelWrapper()->getShapeFactory(); diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx index a7aeb35d72d6..f06ff56559fa 100644 --- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx @@ -70,7 +70,7 @@ double InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( { double fStepWidth = 0.001; - ExplicitValueProvider* pExplicitValueProvider( comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(xChartView) ); + ExplicitValueProvider* pExplicitValueProvider( comphelper::getFromUnoTunnel<ExplicitValueProvider>(xChartView) ); if( pExplicitValueProvider ) { Reference< XAxis > xAxis; diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 8f6b0644e6e3..5ae751ad96b0 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -1485,7 +1485,7 @@ DrawModelWrapper* ChartController::GetDrawModelWrapper() { if( !m_pDrawModelWrapper ) { - ExplicitValueProvider* pProvider = comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_xChartView ); + ExplicitValueProvider* pProvider = comphelper::getFromUnoTunnel<ExplicitValueProvider>( m_xChartView ); if( pProvider ) m_pDrawModelWrapper = pProvider->getDrawModelWrapper(); if ( m_pDrawModelWrapper ) diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx index c6af3878bdd7..4b9479c78dab 100644 --- a/chart2/source/controller/main/ChartController_Position.cxx +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -177,7 +177,7 @@ void ChartController::executeDispatch_PositionAndSize(const ::css::uno::Sequence if(pOutItemSet || pArgs) { awt::Rectangle aOldObjectRect; - ExplicitValueProvider* pProvider(comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_xChartView )); + ExplicitValueProvider* pProvider(comphelper::getFromUnoTunnel<ExplicitValueProvider>( m_xChartView )); if( pProvider ) aOldObjectRect = pProvider->getRectangleOfObject(aCID); diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index e7a35fef3410..57eadfb63ca9 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -733,7 +733,7 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( std::unique_ptr<wrapper::ItemConverter> pItemConverter( createItemConverter( rObjectCID, getModel(), m_xCC, m_pDrawModelWrapper->getSdrModel(), - comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(m_xChartView), + comphelper::getFromUnoTunnel<ExplicitValueProvider>(m_xChartView), pRefSizeProv.get())); if (!pItemConverter) diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 73b7ad46a9d9..1d58ddc70b40 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1301,7 +1301,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) } } - Menu* pPopupMenu = comphelper::getUnoTunnelImplementation<VCLXMenu>(xPopupMenu)->GetMenu(); + Menu* pPopupMenu = comphelper::getFromUnoTunnel<VCLXMenu>(xPopupMenu)->GetMenu(); boost::property_tree::ptree aMenu = SfxDispatcher::fillPopupMenu(pPopupMenu); boost::property_tree::ptree aRoot; aRoot.add_child("menu", aMenu); @@ -1382,7 +1382,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) { // Navigation (Tab/F3/Home/End) uno::Reference< XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY ); - ObjectKeyNavigation aObjNav( m_aSelection.getSelectedOID(), xChartDoc, comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_xChartView )); + ObjectKeyNavigation aObjNav( m_aSelection.getSelectedOID(), xChartDoc, comphelper::getFromUnoTunnel<ExplicitValueProvider>( m_xChartView )); awt::KeyEvent aKeyEvent( ::svt::AcceleratorExecute::st_VCLKey2AWTKey( aKeyCode )); bReturn = aObjNav.handleKeyEvent( aKeyEvent ); if( bReturn ) @@ -1649,7 +1649,7 @@ bool ChartController::requestQuickHelp( // set rectangle ExplicitValueProvider * pValueProvider( - comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_xChartView )); + comphelper::getFromUnoTunnel<ExplicitValueProvider>( m_xChartView )); if( pValueProvider ) rOutEqualRect = pValueProvider->getRectangleOfObject( aCID, true ); } @@ -1804,7 +1804,7 @@ bool ChartController::impl_moveOrResizeObject( ( aRefSize.Width > 0 && aRefSize.Height > 0 ) ) { ExplicitValueProvider * pValueProvider( - comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_xChartView )); + comphelper::getFromUnoTunnel<ExplicitValueProvider>( m_xChartView )); if( pValueProvider ) { awt::Rectangle aRect( pValueProvider->getRectangleOfObject( rCID )); diff --git a/chart2/source/controller/uitest/uiobject.cxx b/chart2/source/controller/uitest/uiobject.cxx index 651c407565d7..45915a62e554 100644 --- a/chart2/source/controller/uitest/uiobject.cxx +++ b/chart2/source/controller/uitest/uiobject.cxx @@ -175,7 +175,7 @@ std::set<OUString> ChartWindowUIObject::get_children() const css::uno::Reference< css::chart2::XChartDocument > xChartDoc( pController->getModel(), css::uno::UNO_QUERY ); css::uno::Reference<css::uno::XInterface> xChartView = pController->getChartView(); - chart::ExplicitValueProvider* pValueProvider = comphelper::getUnoTunnelImplementation<chart::ExplicitValueProvider>( xChartView ); + chart::ExplicitValueProvider* pValueProvider = comphelper::getFromUnoTunnel<chart::ExplicitValueProvider>( xChartView ); chart::ObjectHierarchy aHierarchy(xChartDoc, pValueProvider); chart::ObjectIdentifier aIdentifier = chart::ObjectHierarchy::getRootNodeOID(); aChildren.insert(aIdentifier.getObjectCID()); diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 9960f84c00b1..c5bf2167184d 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -1210,7 +1210,7 @@ Reference< util::XNumberFormatsSupplier > const & ChartModel::getNumberFormatsSu // ____ XUnoTunnel ___ ::sal_Int64 SAL_CALL ChartModel::getSomething( const Sequence< ::sal_Int8 >& aIdentifier ) { - if( isUnoTunnelId<SvNumberFormatsSupplierObj>(aIdentifier) ) + if( comphelper::isUnoTunnelId<SvNumberFormatsSupplierObj>(aIdentifier) ) { Reference< lang::XUnoTunnel > xTunnel( getNumberFormatsSupplier(), uno::UNO_QUERY ); if( xTunnel.is() ) diff --git a/chart2/source/tools/NumberFormatterWrapper.cxx b/chart2/source/tools/NumberFormatterWrapper.cxx index e6bc55d0556f..f5bef49d19de 100644 --- a/chart2/source/tools/NumberFormatterWrapper.cxx +++ b/chart2/source/tools/NumberFormatterWrapper.cxx @@ -57,7 +57,7 @@ NumberFormatterWrapper::NumberFormatterWrapper( const uno::Reference< util::XNum OUString sNullDate( "NullDate" ); if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(sNullDate) ) m_aNullDate = xProp->getPropertyValue(sNullDate); - SvNumberFormatsSupplierObj* pSupplierObj = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( xSupplier ); + SvNumberFormatsSupplierObj* pSupplierObj = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( xSupplier ); if( pSupplierObj ) m_pNumberFormatter = pSupplierObj->GetNumberFormatter(); SAL_WARN_IF(!m_pNumberFormatter,"chart2.tools","need a numberformatter"); diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index e2b983d7d63a..17295029e26d 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -377,7 +377,7 @@ static bool lcl_hasWordBreak( const Reference<drawing::XShape>& xShape ) if (!xShape.is()) return false; - SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape); + SvxShape* pShape = comphelper::getFromUnoTunnel<SvxShape>(xShape); SvxShapeText* pShapeText = dynamic_cast<SvxShapeText*>(pShape); if (!pShapeText) return false; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index c9ef9f953bb6..499bb55c1504 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1033,7 +1033,7 @@ struct CreateShapeParam2D const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId() { - static const UnoTunnelIdInit theExplicitValueProviderUnoTunnelId; + static const comphelper::UnoIdInit theExplicitValueProviderUnoTunnelId; return theExplicitValueProviderUnoTunnelId.getSeq(); } @@ -1204,7 +1204,7 @@ sal_Bool SAL_CALL ChartView::isDataFlavorSupported( const datatransfer::DataFlav // ____ XUnoTunnel ___ ::sal_Int64 SAL_CALL ChartView::getSomething( const uno::Sequence< ::sal_Int8 >& aIdentifier ) { - if( isUnoTunnelId<ExplicitValueProvider>(aIdentifier) ) + if( comphelper::isUnoTunnelId<ExplicitValueProvider>(aIdentifier) ) { ExplicitValueProvider* pProvider = this; return reinterpret_cast<sal_Int64>(pProvider); @@ -1736,7 +1736,7 @@ bool ChartView::getExplicitValuesForAxis( SdrPage* ChartView::getSdrPage() { - auto pSvxDrawPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>(m_xDrawPage); + auto pSvxDrawPage = comphelper::getFromUnoTunnel<SvxDrawPage>(m_xDrawPage); if(pSvxDrawPage) return pSvxDrawPage->GetSdrPage(); @@ -1898,7 +1898,7 @@ awt::Rectangle ExplicitValueProvider::AddSubtractAxisTitleSizes( uno::Reference< chart2::XTitle > xSecondTitle_Width( TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, rModel ) ); if( xTitle_Height.is() || xTitle_Width.is() || xSecondTitle_Height.is() || xSecondTitle_Width.is() ) { - ExplicitValueProvider* pExplicitValueProvider = comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(xChartView); + ExplicitValueProvider* pExplicitValueProvider = comphelper::getFromUnoTunnel<ExplicitValueProvider>(xChartView); if( pExplicitValueProvider ) { //detect whether x axis points into x direction or not |