summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-09-14 08:19:47 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-09-15 06:07:36 +0200
commit05bc93db2de56000f65764d7e394d03747cac23d (patch)
tree975de9ae83572aac8a5c3ea8db281e1017ee5be0 /starmath
parent8cbb414ed737f9ffc76e1258e6671769bf63fc6c (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 'starmath')
-rw-r--r--starmath/source/mathml/export.cxx14
-rw-r--r--starmath/source/mathml/import.cxx16
-rw-r--r--starmath/source/mathml/mathmlexport.cxx14
-rw-r--r--starmath/source/mathml/mathmlimport.cxx12
-rw-r--r--starmath/source/unomodel.cxx6
-rw-r--r--starmath/source/view.cxx2
6 files changed, 32 insertions, 32 deletions
diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx
index 11e91e35cbfc..a1e768bd71bd 100644
--- a/starmath/source/mathml/export.cxx
+++ b/starmath/source/mathml/export.cxx
@@ -83,7 +83,7 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium)
//Get model
uno::Reference<lang::XComponent> xModelComp = m_xModel;
SAL_WARN_IF(xModelComp == nullptr, "starmath", "Missing model component");
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(m_xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(m_xModel);
SAL_WARN_IF(pModel == nullptr, "starmath", "Failed to get threw uno tunnel");
if (xModelComp == nullptr || pModel == nullptr)
return false;
@@ -251,7 +251,7 @@ OUString SmMLExportWrapper::Export(SmMlElement* pElementTree)
//Get model
uno::Reference<lang::XComponent> xModelComp = m_xModel;
SAL_WARN_IF(xModelComp == nullptr, "starmath", "Missing model component");
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(m_xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(m_xModel);
SAL_WARN_IF(pModel == nullptr, "starmath", "Failed to get threw uno tunnel");
if (xModelComp == nullptr || pModel == nullptr)
return u"";
@@ -336,7 +336,7 @@ bool SmMLExportWrapper::WriteThroughComponentOS(const Reference<io::XOutputStrea
// filter
if (nSyntaxVersion == 5)
{
- SmXMLExport* pFilter = comphelper::getUnoTunnelImplementation<SmXMLExport>(xFilter);
+ SmXMLExport* pFilter = comphelper::getFromUnoTunnel<SmXMLExport>(xFilter);
if (pFilter == nullptr)
{
SAL_WARN("starmath", "Failed to fetch SmMLExport");
@@ -347,7 +347,7 @@ bool SmMLExportWrapper::WriteThroughComponentOS(const Reference<io::XOutputStrea
}
// filter
- SmMLExport* pFilter = comphelper::getUnoTunnelImplementation<SmMLExport>(xFilter);
+ SmMLExport* pFilter = comphelper::getFromUnoTunnel<SmMLExport>(xFilter);
// Setup filter
if (pFilter == nullptr)
@@ -446,14 +446,14 @@ SmMLExportWrapper::WriteThroughComponentMS(const Reference<XComponent>& xCompone
sal_Int64 SAL_CALL SmMLExport::getSomething(const uno::Sequence<sal_Int8>& rId)
{
- if (isUnoTunnelId<SmMLExport>(rId))
+ if (comphelper::isUnoTunnelId<SmMLExport>(rId))
return reinterpret_cast<intptr_t>(this);
return SvXMLExport::getSomething(rId);
}
const uno::Sequence<sal_Int8>& SmMLExport::getUnoTunnelId() noexcept
{
- static const UnoTunnelIdInit theSmMLExportUnoTunnelId;
+ static const comphelper::UnoIdInit theSmMLExportUnoTunnelId;
return theSmMLExportUnoTunnelId.getSeq();
}
@@ -491,7 +491,7 @@ Math_MLContentExporter_get_implementation(css::uno::XComponentContext* context,
SmDocShell* SmMLExport::getSmDocShell()
{
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(GetModel());
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(GetModel());
if (pModel != nullptr)
return static_cast<SmDocShell*>(pModel->GetObjectShell());
return nullptr;
diff --git a/starmath/source/mathml/import.cxx b/starmath/source/mathml/import.cxx
index b16933fbff22..b03f9cefbbdd 100644
--- a/starmath/source/mathml/import.cxx
+++ b/starmath/source/mathml/import.cxx
@@ -106,7 +106,7 @@ ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium)
uno::Reference<task::XStatusIndicator> xStatusIndicator;
// Get model via uno
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(m_xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(m_xModel);
if (pModel == nullptr)
{
SAL_WARN("starmath", "Failed to fetch sm model while file input");
@@ -331,7 +331,7 @@ ErrCode SmMLImportWrapper::Import(std::u16string_view aSource)
}
// Get model via uno
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(m_xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(m_xModel);
if (pModel == nullptr)
{
SAL_WARN("starmath", "Failed to fetch sm model while file input");
@@ -437,7 +437,7 @@ ErrCode SmMLImportWrapper::ReadThroughComponentIS(
if (nSyntaxVersion == 5)
{
- SmXMLImport* pXMlImport = comphelper::getUnoTunnelImplementation<SmXMLImport>(xFilter);
+ SmXMLImport* pXMlImport = comphelper::getFromUnoTunnel<SmXMLImport>(xFilter);
if (pXMlImport != nullptr && pXMlImport->GetSuccess())
return ERRCODE_NONE;
else
@@ -447,7 +447,7 @@ ErrCode SmMLImportWrapper::ReadThroughComponentIS(
}
}
- m_pMlImport = comphelper::getUnoTunnelImplementation<SmMLImport>(xFilter);
+ m_pMlImport = comphelper::getFromUnoTunnel<SmMLImport>(xFilter);
if (m_pMlImport != nullptr && m_pMlImport->getSuccess())
return ERRCODE_NONE;
else
@@ -1207,13 +1207,13 @@ void SmMLImportContext::endFastElement(sal_Int32) { inheritStyleEnd(); }
const uno::Sequence<sal_Int8>& SmMLImport::getUnoTunnelId() noexcept
{
- static const UnoTunnelIdInit theSmMLImportUnoTunnelId;
+ static const comphelper::UnoIdInit theSmMLImportUnoTunnelId;
return theSmMLImportUnoTunnelId.getSeq();
}
sal_Int64 SAL_CALL SmMLImport::getSomething(const uno::Sequence<sal_Int8>& rId)
{
- if (isUnoTunnelId<SmMLImport>(rId))
+ if (comphelper::isUnoTunnelId<SmMLImport>(rId))
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
return SvXMLImport::getSomething(rId);
@@ -1267,7 +1267,7 @@ void SmMLImport::endDocument()
return;
}
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel);
if (!pModel)
{
SAL_WARN("starmath", "Failed to set view settings because missing sm model");
@@ -1319,7 +1319,7 @@ void SmMLImport::SetViewSettings(const Sequence<PropertyValue>& aViewProps)
return;
}
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel);
if (!pModel)
{
SAL_WARN("starmath", "Failed to set view settings because missing sm model");
diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx
index e9fc5a3de11d..7e35757536b6 100644
--- a/starmath/source/mathml/mathmlexport.cxx
+++ b/starmath/source/mathml/mathmlexport.cxx
@@ -99,7 +99,7 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium)
uno::Reference<lang::XComponent> xModelComp = xModel;
bool bEmbedded = false;
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel);
SmDocShell* pDocShell = pModel ? static_cast<SmDocShell*>(pModel->GetObjectShell()) : nullptr;
if (pDocShell && SfxObjectCreateMode::EMBEDDED == pDocShell->GetCreateMode())
@@ -266,7 +266,7 @@ bool SmXMLExportWrapper::WriteThroughComponent(const Reference<io::XOutputStream
uno::Sequence<PropertyValue> aProps(0);
xFilter->filter(aProps);
- auto pFilter = comphelper::getUnoTunnelImplementation<SmXMLExport>(xFilter);
+ auto pFilter = comphelper::getFromUnoTunnel<SmXMLExport>(xFilter);
return pFilter == nullptr || pFilter->GetSuccess();
}
@@ -324,7 +324,7 @@ SmXMLExport::SmXMLExport(const css::uno::Reference<css::uno::XComponentContext>&
sal_Int64 SAL_CALL SmXMLExport::getSomething(const uno::Sequence<sal_Int8>& rId)
{
- if (isUnoTunnelId<SmXMLExport>(rId))
+ if (comphelper::isUnoTunnelId<SmXMLExport>(rId))
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
return SvXMLExport::getSomething(rId);
@@ -332,7 +332,7 @@ sal_Int64 SAL_CALL SmXMLExport::getSomething(const uno::Sequence<sal_Int8>& rId)
const uno::Sequence<sal_Int8>& SmXMLExport::getUnoTunnelId() noexcept
{
- static const UnoTunnelIdInit theSmXMLExportUnoTunnelId;
+ static const comphelper::UnoIdInit theSmXMLExportUnoTunnelId;
return theSmXMLExportUnoTunnelId.getSeq();
}
@@ -393,7 +393,7 @@ ErrCode SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
else
{
uno::Reference<frame::XModel> xModel = GetModel();
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel);
if (pModel)
{
@@ -428,7 +428,7 @@ ErrCode SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
void SmXMLExport::ExportContent_()
{
uno::Reference<frame::XModel> xModel = GetModel();
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel);
SmDocShell* pDocShell = pModel ? static_cast<SmDocShell*>(pModel->GetObjectShell()) : nullptr;
OSL_ENSURE(pDocShell, "doc shell missing");
@@ -487,7 +487,7 @@ void SmXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps)
if (!xModel.is())
return;
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel);
if (!pModel)
return;
diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx
index 131eda86bb9f..db5426cd927b 100644
--- a/starmath/source/mathml/mathmlimport.cxx
+++ b/starmath/source/mathml/mathmlimport.cxx
@@ -106,7 +106,7 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium& rMedium)
uno::Reference<task::XStatusIndicator> xStatusIndicator;
bool bEmbedded = false;
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel);
SmDocShell* pDocShell = pModel ? static_cast<SmDocShell*>(pModel->GetObjectShell()) : nullptr;
if (pDocShell)
@@ -296,7 +296,7 @@ ErrCode SmXMLImportWrapper::ReadThroughComponent(const Reference<io::XInputStrea
xParser->parseStream(aParserInput);
}
- auto pFilter = comphelper::getUnoTunnelImplementation<SmXMLImport>(xFilter);
+ auto pFilter = comphelper::getFromUnoTunnel<SmXMLImport>(xFilter);
if (pFilter && pFilter->GetSuccess())
nError = ERRCODE_NONE;
}
@@ -408,7 +408,7 @@ SmXMLImport::SmXMLImport(const css::uno::Reference<css::uno::XComponentContext>&
const uno::Sequence<sal_Int8>& SmXMLImport::getUnoTunnelId() noexcept
{
- static const UnoTunnelIdInit theSmXMLImportUnoTunnelId;
+ static const comphelper::UnoIdInit theSmXMLImportUnoTunnelId;
return theSmXMLImportUnoTunnelId.getSeq();
}
@@ -438,7 +438,7 @@ Math_XMLOasisSettingsImporter_get_implementation(uno::XComponentContext* pCtx,
sal_Int64 SAL_CALL SmXMLImport::getSomething(const uno::Sequence<sal_Int8>& rId)
{
- if (isUnoTunnelId<SmXMLImport>(rId))
+ if (comphelper::isUnoTunnelId<SmXMLImport>(rId))
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
return SvXMLImport::getSomething(rId);
@@ -451,7 +451,7 @@ void SmXMLImport::endDocument()
if (pTree && pTree->GetType() == SmNodeType::Table)
{
uno::Reference<frame::XModel> xModel = GetModel();
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel);
if (pModel)
{
@@ -2581,7 +2581,7 @@ void SmXMLImport::SetViewSettings(const Sequence<PropertyValue>& aViewProps)
if (!xModel.is())
return;
- SmModel* pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
+ SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel);
if (!pModel)
return;
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 0009253fbcfe..c9f27f4dd082 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -357,13 +357,13 @@ uno::Sequence< uno::Type > SAL_CALL SmModel::getTypes( )
const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId()
{
- static const UnoTunnelIdInit theSmModelUnoTunnelId;
+ static const comphelper::UnoIdInit theSmModelUnoTunnelId;
return theSmModelUnoTunnelId.getSeq();
}
sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId )
{
- if( isUnoTunnelId<SmModel>(rId) )
+ if( comphelper::isUnoTunnelId<SmModel>(rId) )
{
return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this));
}
@@ -988,7 +988,7 @@ void SAL_CALL SmModel::render(
if (!xRenderDevice.is())
return;
- VCLXDevice* pDevice = comphelper::getUnoTunnelImplementation<VCLXDevice>( xRenderDevice );
+ VCLXDevice* pDevice = comphelper::getFromUnoTunnel<VCLXDevice>( xRenderDevice );
VclPtr< OutputDevice> pOut = pDevice ? pDevice->GetOutputDevice()
: VclPtr< OutputDevice >();
if (!pOut)
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index ef05e243f798..a5d427d89cdc 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1585,7 +1585,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
Reference< datatransfer::XTransferable > xTrans( GetDoc()->GetModel(), uno::UNO_QUERY );
if( xTrans.is() )
{
- auto pTrans = comphelper::getUnoTunnelImplementation<TransferableHelper>(xTrans);
+ auto pTrans = comphelper::getFromUnoTunnel<TransferableHelper>(xTrans);
if (pTrans)
{
SmEditWindow *pEditWin = GetEditWindow();