summaryrefslogtreecommitdiff
path: root/reportdesign
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 /reportdesign
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 'reportdesign')
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx4
-rw-r--r--reportdesign/source/core/api/Section.cxx2
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx2
-rw-r--r--reportdesign/source/core/sdr/RptPage.cxx4
-rw-r--r--reportdesign/source/core/sdr/UndoActions.cxx2
-rw-r--r--reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx6
-rw-r--r--reportdesign/source/ui/misc/RptUndo.cxx2
7 files changed, 11 insertions, 11 deletions
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 6515672d7d5b..34b1140b0a9d 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -1937,7 +1937,7 @@ uno::Sequence< OUString > SAL_CALL OReportDefinition::getAvailableMimeTypes( )
sal_Int64 SAL_CALL OReportDefinition::getSomething( const uno::Sequence< sal_Int8 >& rId )
{
sal_Int64 nRet = 0;
- if (isUnoTunnelId<OReportDefinition>(rId) )
+ if (comphelper::isUnoTunnelId<OReportDefinition>(rId) )
nRet = reinterpret_cast<sal_Int64>(this);
else
{
@@ -1978,7 +1978,7 @@ uno::Reference< uno::XComponentContext > OReportDefinition::getContext()
std::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::Reference< report::XReportDefinition >& _xReportDefinition)
{
std::shared_ptr<rptui::OReportModel> pReportModel;
- auto pReportDefinition = comphelper::getUnoTunnelImplementation<OReportDefinition>(_xReportDefinition);
+ auto pReportDefinition = comphelper::getFromUnoTunnel<OReportDefinition>(_xReportDefinition);
if (pReportDefinition)
pReportModel = pReportDefinition->m_pImpl->m_pReportModel;
return pReportModel;
diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx
index 4744eff5cfa2..73dcd20a1b6a 100644
--- a/reportdesign/source/core/api/Section.cxx
+++ b/reportdesign/source/core/api/Section.cxx
@@ -566,7 +566,7 @@ sal_Bool SAL_CALL OSection::hasForms()
sal_Int64 OSection::getSomething( const uno::Sequence< sal_Int8 > & rId )
{
- if (isUnoTunnelId<OSection>(rId) )
+ if (comphelper::isUnoTunnelId<OSection>(rId) )
return reinterpret_cast<sal_Int64>(this);
return (m_xDrawPage_Tunnel.is()) ? m_xDrawPage_Tunnel->getSomething(rId) : 0;
}
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index 731ac9c8911c..cdcb355e7729 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -426,7 +426,7 @@ void OObjectBase::ensureSdrObjectOwnership( const uno::Reference< uno::XInterfac
// which are removed from it, which is deadly for us. To prevent this,
// we give the XShape implementation the ownership of the SdrObject, which
// ensures the SvxDrawPage won't delete it.
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( _rxShape );
+ SvxShape* pShape = comphelper::getFromUnoTunnel<SvxShape>( _rxShape );
OSL_ENSURE( pShape, "OObjectBase::ensureSdrObjectOwnership: can't access the SvxShape!" );
if ( pShape )
{
diff --git a/reportdesign/source/core/sdr/RptPage.cxx b/reportdesign/source/core/sdr/RptPage.cxx
index 0b856322796c..d774f37100a1 100644
--- a/reportdesign/source/core/sdr/RptPage.cxx
+++ b/reportdesign/source/core/sdr/RptPage.cxx
@@ -91,7 +91,7 @@ SdrObject* OReportPage::RemoveObject(size_t nObjNum)
}
// this code is evil, but what else shall I do
- reportdesign::OSection* pSection = comphelper::getUnoTunnelImplementation<reportdesign::OSection>(m_xSection);
+ reportdesign::OSection* pSection = comphelper::getFromUnoTunnel<reportdesign::OSection>(m_xSection);
uno::Reference< drawing::XShape> xShape(pObj->getUnoShape(),uno::UNO_QUERY);
pSection->notifyElementRemoved(xShape);
if (dynamic_cast< const OUnoObject *>( pObj ) != nullptr)
@@ -175,7 +175,7 @@ void OReportPage::NbcInsertObject(SdrObject* pObj, size_t nPos)
}
// this code is evil, but what else shall I do
- reportdesign::OSection* pSection = comphelper::getUnoTunnelImplementation<reportdesign::OSection>(m_xSection);
+ reportdesign::OSection* pSection = comphelper::getFromUnoTunnel<reportdesign::OSection>(m_xSection);
uno::Reference< drawing::XShape> xShape(pObj->getUnoShape(),uno::UNO_QUERY);
pSection->notifyElementAdded(xShape);
diff --git a/reportdesign/source/core/sdr/UndoActions.cxx b/reportdesign/source/core/sdr/UndoActions.cxx
index 21332691bfb7..5086bc1f92c1 100644
--- a/reportdesign/source/core/sdr/UndoActions.cxx
+++ b/reportdesign/source/core/sdr/UndoActions.cxx
@@ -119,7 +119,7 @@ OUndoContainerAction::~OUndoContainerAction()
rEnv.RemoveElement( m_xOwnElement );
#if OSL_DEBUG_LEVEL > 0
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xChild );
+ SvxShape* pShape = comphelper::getFromUnoTunnel<SvxShape>( xChild );
SdrObject* pObject = pShape ? pShape->GetSdrObject() : nullptr;
OSL_ENSURE( pObject == nullptr || (pShape->HasSdrObjectOwnership() && !pObject->IsInserted()),
"OUndoContainerAction::~OUndoContainerAction: inconsistency in the shape/object ownership!" );
diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
index 19fdbbc119a9..ec1796a56db1 100644
--- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
+++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
@@ -58,7 +58,7 @@ OUString lcl_createAttribute(const xmloff::token::XMLTokenEnum& _eNamespace,cons
static void lcl_correctCellAddress(const OUString & _sName, const uno::Reference< xml::sax::XAttributeList > & xAttribs)
{
- SvXMLAttributeList* pList = comphelper::getUnoTunnelImplementation<SvXMLAttributeList>(xAttribs);
+ SvXMLAttributeList* pList = comphelper::getFromUnoTunnel<SvXMLAttributeList>(xAttribs);
OUString sCellAddress = pList->getValueByName(_sName);
const sal_Int32 nPos = sCellAddress.lastIndexOf('$');
if ( nPos != -1 )
@@ -186,7 +186,7 @@ void SAL_CALL ExportDocumentHandler::startElement(const OUString & _sName, const
bExport = false;
else if ( _sName == "chart:plot-area" )
{
- SvXMLAttributeList* pList = comphelper::getUnoTunnelImplementation<SvXMLAttributeList>(xAttribs);
+ SvXMLAttributeList* pList = comphelper::getFromUnoTunnel<SvXMLAttributeList>(xAttribs);
pList->RemoveAttribute("table:cell-range-address");
}
else if ( _sName == "chart:categories" )
@@ -201,7 +201,7 @@ void SAL_CALL ExportDocumentHandler::startElement(const OUString & _sName, const
}
else if ( m_bTableRowsStarted && !m_bFirstRowExported && _sName == "table:table-cell" )
{
- SvXMLAttributeList* pList = comphelper::getUnoTunnelImplementation<SvXMLAttributeList>(xAttribs);
+ SvXMLAttributeList* pList = comphelper::getFromUnoTunnel<SvXMLAttributeList>(xAttribs);
static OUString s_sValue(lcl_createAttribute(XML_NP_OFFICE,XML_VALUE));
pList->RemoveAttribute(s_sValue);
}
diff --git a/reportdesign/source/ui/misc/RptUndo.cxx b/reportdesign/source/ui/misc/RptUndo.cxx
index 29d3945bedc3..d56171ec53c3 100644
--- a/reportdesign/source/ui/misc/RptUndo.cxx
+++ b/reportdesign/source/ui/misc/RptUndo.cxx
@@ -132,7 +132,7 @@ OSectionUndo::~OSectionUndo()
rEnv.RemoveElement(xShape);
#if OSL_DEBUG_LEVEL > 0
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
+ SvxShape* pShape = comphelper::getFromUnoTunnel<SvxShape>( xShape );
SdrObject* pObject = pShape ? pShape->GetSdrObject() : nullptr;
OSL_ENSURE( pShape && pShape->HasSdrObjectOwnership() && pObject && !pObject->IsInserted(),
"OSectionUndo::~OSectionUndo: inconsistency in the shape/object ownership!" );